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.
/status: show session status (shared runtime).
/terminate: cancel the active run (shared runtime).
/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.
/config init: scaffold a config example file.
/init: scaffold both config and MCP example files.
/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.
packages/meeseeks_core/src/meeseeks_core/session_runtime.py: shared runtime for session orchestration and polling.
Config knobs (UI-relevant)
llm.api_base: printed in the ready panel.
llm.default_model / llm.action_plan_model: used when --model is not set.
cli.disable_textual: disable dialogs (force fallback).
runtime.cli_log_style: default log styling for the CLI.
configs/mcp.json: MCP server config used for discovery.
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-guidance-23description: 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- `/status`: show session status (shared runtime).70- `/terminate`: cancel the active run (shared runtime).71- `/tag NAME`: tag the current session (dialog when NAME omitted).72- `/fork [TAG]`: fork current session (dialog when TAG omitted).73- `/plan on|off`: toggle action plan display.74- `/mcp [select|init]`: list MCP tools, filter, or scaffold config.75- `/config init`: scaffold a config example file.76- `/init`: scaffold both config and MCP example files.77- `/models`: model wizard (interactive only).78- `/automatic`: auto-approve all tool actions in this session.7980## Core Files (UI-related)81- `apps/meeseeks_cli/src/meeseeks_cli/cli_master.py`: main loop, output sections, startup panel.82- `apps/meeseeks_cli/src/meeseeks_cli/cli_commands.py`: commands, model wizard, MCP listing.83- `apps/meeseeks_cli/src/meeseeks_cli/cli_dialogs.py`: dialog factory.84- `apps/meeseeks_cli/src/meeseeks_cli/cli_context.py`: state shared across commands.85- `packages/meeseeks_core/src/meeseeks_core/session_runtime.py`: shared runtime for session orchestration and polling.8687## Config knobs (UI-relevant)88- `llm.api_base`: printed in the ready panel.89- `llm.default_model` / `llm.action_plan_model`: used when `--model` is not set.90- `cli.disable_textual`: disable dialogs (force fallback).91- `runtime.cli_log_style`: default log styling for the CLI.92- `configs/mcp.json`: MCP server config used for discovery.9394## KISS / DRY rules for UI work95- Reuse existing render helpers and dialogs; add small helpers if needed.96- Avoid bespoke widgets or heavy layouting unless strictly required.97- Prefer toolkit defaults; override only when UX needs it.98- Keep new UI logic near existing UI code (`cli_master.py`, `cli_dialogs.py`).99100## Orchestration + testing guardrails (CLI-facing)101- Show tool activity clearly (plan, spinner, tool panels) before final response.102- Do not print raw tool output as the final answer; let the core synthesize.103- Tests should drive a real CLI flow with fake tools/LLM outputs; avoid over-mocking.104- Keep permission prompts deterministic in tests (auto-approve or stub).105- Treat language models as black-box APIs with non-deterministic output; avoid anthropomorphic language in docs/changes.106107## Keep this file updated108Whenever you change:109- Section layouts, styles, or titles110- Dialog behaviors or new dialog types111- UI-related env vars or dependencies112…update this document to reflect the new behavior.113114Doc hygiene:115- Keep this file concise and actionable; link to code instead of duplicating it.116- This is a nested file for the CLI package; it should override root guidance only when CLI-specific.