Meeseeks CLI - UI/Terminal Guidance
Scope: this file applies to the apps/meeseeks_cli/ package only. It covers the terminal UI (renderer + dialog toolkit) and how CLI output is produced.
Goals (UI)
- Keep the terminal UI simple, fast, and readable.
- Prefer built-in components from the rendering/dialog toolkits over custom rendering.
- Stay DRY/KISS: build reusable UI helpers instead of ad‑hoc formatting.
- Preserve terminal scrollback (no full-screen takeovers).
Rendering Pipeline (How we produce output)
- Entry point:
apps/meeseeks_cli/src/meeseeks_cli/cli_master.py (run_cli).
- Rendering is done via a single console renderer instance.
- High-level sections:
- Startup header panel plus a ready line with session info.
- Action plan checklist (panel + text + group).
- Tool results as cards (panel + columns).
- Response panel (Markdown in a bold border).
- Logging is gated by
-v/--verbose and themed darker for CLI runs.
- Tool execution shows a lightweight spinner while a tool is running.
Section styles (keep consistent)
- Action Plan: checklist in a panel titled
:clipboard: Action Plan, border cyan.
- Tool Results: per-tool panels, title prefix
:wrench:, border magenta.
- Response:
:speech_balloon: Response, border bold green.
- Tool result cards dim unless they are the current focus; outputs are collapsed unless verbose and JSON renders formatted.
If you change any of these, update this file.
Dialogs / Prompts (Interactive Toolkit)
We use Rich for the normal CLI rendering (header, plans, tool cards, responses).
We use Textual only for full-screen style prompts (dialogs), not for the main output.
Do not run Rich rendering and Textual dialogs concurrently: Textual runs a blocking app loop
and mixing it with live Rich rendering/spinners can deadlock or break terminal state.
Location: apps/meeseeks_cli/src/meeseeks_cli/cli_dialogs.py
DialogFactory (reusable)
select_one: single-select list (OptionList)
select_many: multi-select list (SelectionList)
prompt_text: text input (Input)
confirm: yes/no
Key behaviors:
- Runs inline to avoid clearing scrollback.
- Auto-fallback to plain prompt when no TTY or
MEESEEKS_DISABLE_TEXTUAL=1.
- Escape/Q cancels; Enter accepts.
- Interactive app runs are blocking; do not use them for long-lived UI in the REPL loop.
Commands currently using dialogs
/models: single-select model picker (TTY only).
/tag (no args): Text input for tag name.
/fork (no args): Text input for optional tag.
/mcp select: Multi-select to filter MCP tools displayed.
If you add a new interactive flow, use DialogFactory instead of writing custom prompts.
Commands overview (keep in sync)
/help: show commands.
/exit or /quit: exit the CLI.
/new: start a fresh session.
/session: show current session id.
/summary: show current session summary.
/summarize or /compact: summarize + compact transcript.
/tag NAME: tag the current session (dialog when NAME omitted).
/fork [TAG]: fork current session (dialog when TAG omitted).
/plan on|off: toggle action plan display.
/mcp [select|init]: list MCP tools, filter, or scaffold config.
/models: model wizard (interactive only).
/automatic: auto-approve all tool actions in this session.
Core Files (UI-related)
apps/meeseeks_cli/src/meeseeks_cli/cli_master.py: main loop, output sections, startup panel.
apps/meeseeks_cli/src/meeseeks_cli/cli_commands.py: commands, model wizard, MCP listing.
apps/meeseeks_cli/src/meeseeks_cli/cli_dialogs.py: dialog factory.
apps/meeseeks_cli/src/meeseeks_cli/cli_context.py: state shared across commands.
Environment knobs (UI-relevant)
OPENAI_API_BASE / OPENAI_BASE_URL: printed in the ready panel.
DEFAULT_MODEL / ACTION_PLAN_MODEL: used when --model is not set.
MEESEEKS_DISABLE_TEXTUAL=1: disable dialogs (force fallback).
MEESEEKS_CLI=1: set at startup to tag CLI runtime context.
MEESEEKS_LOG_STYLE=dark: default log styling for the CLI.
MESEEKS_MCP_CONFIG: MCP server config used for discovery.
MESEEKS_TOOL_MANIFEST: optional override for tool registry.
KISS / DRY rules for UI work
- Reuse existing render helpers and dialogs; add small helpers if needed.
- Avoid bespoke widgets or heavy layouting unless strictly required.
- Prefer toolkit defaults; override only when UX needs it.
- Keep new UI logic near existing UI code (
cli_master.py, cli_dialogs.py).
Orchestration + testing guardrails (CLI-facing)
- Show tool activity clearly (plan, spinner, tool panels) before final response.
- Do not print raw tool output as the final answer; let the core synthesize.
- Tests should drive a real CLI flow with fake tools/LLM outputs; avoid over-mocking.
- Keep permission prompts deterministic in tests (auto-approve or stub).
- Treat language models as black-box APIs with non-deterministic output; avoid anthropomorphic language in docs/changes.
Keep this file updated
Whenever you change:
- Section layouts, styles, or titles
- Dialog behaviors or new dialog types
- UI-related env vars or dependencies
…update this document to reflect the new behavior.
Doc hygiene:
- Keep this file concise and actionable; link to code instead of duplicating it.
- This is a nested file for the CLI package; it should override root guidance only when CLI-specific.
1---2name: meeseeks-cli-ui-terminal-guidance3description: Scope: this file applies to the apps/meeseeks_cli/ package only. It covers the terminal UI (renderer + dialog toolkit) and how CLI output is produced.4---5# Meeseeks CLI - UI/Terminal Guidance67Scope: this file applies to the `apps/meeseeks_cli/` package only. It covers the terminal UI (renderer + dialog toolkit) and how CLI output is produced.89## Goals (UI)10- Keep the terminal UI simple, fast, and readable.11- Prefer built-in components from the rendering/dialog toolkits over custom rendering.12- Stay DRY/KISS: build reusable UI helpers instead of ad‑hoc formatting.13- Preserve terminal scrollback (no full-screen takeovers).1415## Rendering Pipeline (How we produce output)16- Entry point: `apps/meeseeks_cli/src/meeseeks_cli/cli_master.py` (`run_cli`).17- Rendering is done via a single console renderer instance.18- High-level sections:19 - Startup header panel plus a ready line with session info.20- Action plan checklist (panel + text + group).21- Tool results as cards (panel + columns).22- Response panel (Markdown in a bold border).23- Logging is gated by `-v/--verbose` and themed darker for CLI runs.24- Tool execution shows a lightweight spinner while a tool is running.2526### Section styles (keep consistent)27- Action Plan: checklist in a panel titled `:clipboard: Action Plan`, border `cyan`.28- Tool Results: per-tool panels, title prefix `:wrench:`, border `magenta`.29- Response: `:speech_balloon: Response`, border `bold green`.30- Tool result cards dim unless they are the current focus; outputs are collapsed unless verbose and JSON renders formatted.3132If you change any of these, update this file.3334## Dialogs / Prompts (Interactive Toolkit)35We use Rich for the normal CLI rendering (header, plans, tool cards, responses).36We use Textual only for full-screen style prompts (dialogs), not for the main output.37Do not run Rich rendering and Textual dialogs concurrently: Textual runs a blocking app loop38and mixing it with live Rich rendering/spinners can deadlock or break terminal state.3940Location: `apps/meeseeks_cli/src/meeseeks_cli/cli_dialogs.py`4142### DialogFactory (reusable)43- `select_one`: single-select list (OptionList)44- `select_many`: multi-select list (SelectionList)45- `prompt_text`: text input (Input)46- `confirm`: yes/no4748Key behaviors:49- Runs **inline** to avoid clearing scrollback.50- Auto-fallback to plain prompt when no TTY or `MEESEEKS_DISABLE_TEXTUAL=1`.51- Escape/Q cancels; Enter accepts.52- Interactive app runs are blocking; do not use them for long-lived UI in the REPL loop.5354### Commands currently using dialogs55- `/models`: single-select model picker (TTY only).56- `/tag` (no args): Text input for tag name.57- `/fork` (no args): Text input for optional tag.58- `/mcp select`: Multi-select to filter MCP tools displayed.5960If you add a new interactive flow, use `DialogFactory` instead of writing custom prompts.6162## Commands overview (keep in sync)63- `/help`: show commands.64- `/exit` or `/quit`: exit the CLI.65- `/new`: start a fresh session.66- `/session`: show current session id.67- `/summary`: show current session summary.68- `/summarize` or `/compact`: summarize + compact transcript.69- `/tag NAME`: tag the current session (dialog when NAME omitted).70- `/fork [TAG]`: fork current session (dialog when TAG omitted).71- `/plan on|off`: toggle action plan display.72- `/mcp [select|init]`: list MCP tools, filter, or scaffold config.73- `/models`: model wizard (interactive only).74- `/automatic`: auto-approve all tool actions in this session.7576## Core Files (UI-related)77- `apps/meeseeks_cli/src/meeseeks_cli/cli_master.py`: main loop, output sections, startup panel.78- `apps/meeseeks_cli/src/meeseeks_cli/cli_commands.py`: commands, model wizard, MCP listing.79- `apps/meeseeks_cli/src/meeseeks_cli/cli_dialogs.py`: dialog factory.80- `apps/meeseeks_cli/src/meeseeks_cli/cli_context.py`: state shared across commands.8182## Environment knobs (UI-relevant)83- `OPENAI_API_BASE` / `OPENAI_BASE_URL`: printed in the ready panel.84- `DEFAULT_MODEL` / `ACTION_PLAN_MODEL`: used when `--model` is not set.85- `MEESEEKS_DISABLE_TEXTUAL=1`: disable dialogs (force fallback).86- `MEESEEKS_CLI=1`: set at startup to tag CLI runtime context.87- `MEESEEKS_LOG_STYLE=dark`: default log styling for the CLI.88- `MESEEKS_MCP_CONFIG`: MCP server config used for discovery.89- `MESEEKS_TOOL_MANIFEST`: optional override for tool registry.9091## KISS / DRY rules for UI work92- Reuse existing render helpers and dialogs; add small helpers if needed.93- Avoid bespoke widgets or heavy layouting unless strictly required.94- Prefer toolkit defaults; override only when UX needs it.95- Keep new UI logic near existing UI code (`cli_master.py`, `cli_dialogs.py`).9697## Orchestration + testing guardrails (CLI-facing)98- Show tool activity clearly (plan, spinner, tool panels) before final response.99- Do not print raw tool output as the final answer; let the core synthesize.100- Tests should drive a real CLI flow with fake tools/LLM outputs; avoid over-mocking.101- Keep permission prompts deterministic in tests (auto-approve or stub).102- Treat language models as black-box APIs with non-deterministic output; avoid anthropomorphic language in docs/changes.103104## Keep this file updated105Whenever you change:106- Section layouts, styles, or titles107- Dialog behaviors or new dialog types108- UI-related env vars or dependencies109…update this document to reflect the new behavior.110111Doc hygiene:112- Keep this file concise and actionable; link to code instead of duplicating it.113- This is a nested file for the CLI package; it should override root guidance only when CLI-specific.