kb://architecture/TUI_ULTRA_IDEAL_2026-06-16active2026-06-17

Alice TUI/CLI → Ultra-Ideal (#489) — master plan

openalicedesignalice-core

Alice TUI/CLI → Ultra-Ideal (#489) — master plan

Date: 2026-06-16 · Owner: Tycho · Source: NAO directive 2026-06-16 ("красиво и приятно по цветам, пару тем светлых/тёмных, украсть у топовых, до ультра идеала, супер-полезные команды, ВСЕ конфиги → hot-reload + командами/самой Алисой, auto-mode + permissions, и всё всё").

Backed by the ranker competitor scan (openalice-ranker/data/reports/) + claude-code-changelog + openfang/openhands/opencode/gemini-cli/codex review.

Where Alice already wins (don't rebuild)

  • TUI framework: ratatui 0.29 retained-mode — stronger base than claw-code (raw crossterm) and Hermes (Ink/React two-process).
  • @-context picker (3 tabs File/Memory/Worker + #L10-L20 line ranges) — richer than both Hermes and claw-code.
  • Shipped: multi-pane (sessions/memory/tool-feed), 7 slash commands, streaming, input modes (Normal/AutoAccept/Plan enum), cockpit Phase-A/B, theme module scaffold (ui/theme.rs), ! shell-exec (this wave, commit fbb4e496e).

The gaps (ranked, with who has it)

Phase A — THEME SYSTEM (highest visible win)

Today ui/theme.rs is one hardcoded ANSI-16 palette. Target = a real theme system like OpenCode (11 JSON themes) / Claude Code (/theme + color editor) / Codex (/theme + schema).

  • A1. Named-theme registry with light AND dark built-ins. Steal palettes: tokyonight, catppuccin(+macchiato), gruvbox, nord, everforest, one-dark, ayu, kanagawa (OpenCode set) + a clean light (catppuccin-latte / ayu-light).
  • A2. /theme slash command → picker overlay (type-to-filter, live preview).
  • A3. Custom themes as JSON at ~/.config/openalice/themes/<name>.json (global) and .openalice/themes/ (project), truecolor with ANSI-16 fallback.
  • A4. Light-ANSI correctness (the Claude Code 2.1.144 invisible-diff-line bug: never render near-bg-on-bg).
  • Files: crates/tui/src/ui/theme.rs (registry), new ui/theme_picker.rs overlay, commands.rs (+theme), config binding (Phase C).

Phase B — PERMISSIONS + AUTO-MODE

Alice has the InputMode enum (Normal/AutoAccept/Plan) but no enforcement/UI.

  • B1. Adopt the clean 4-mode enum (gemini-cli): default / auto_edit / yolo / plan. Map onto existing InputMode; plan blocks writes even when an allow-rule matches (Claude Code 2.1.154).
  • B2. Interactive approval overlay (once / session / always / deny, number-key select) — Hermes prompts.tsx. Wire to a pending-approval queue.
  • B3. Sensitive-file write guard — always prompt before exec-granting build configs (.npmrc, .bazelrc, .pre-commit-config.yaml, .devcontainer/) + shell startup files (.zshenv, .bash_login), even under auto-accept (CC 2.1.136/160).
  • B4. Parameter-level + wildcard rules: Tool(param:value), WebFetch(domain:*.x), Read(secrets-*/config.json) (CC 2.1.178/169).
  • B5. Approvals as a CLI noun: alice-cli approvals list|approve|reject --json (openfang) for out-of-band grant.
  • B6. Budget/iteration kill-switch in config: max_budget_per_task, max_iterations (openhands [core]).
  • B7 (stretch). Configurable risk classifier security_analyzer = heuristic|llm deciding approve/deny, not just static allowlists (openhands [security]).

Phase C — CONFIG: everything → config, hot-reload, command/self-editable

Phase 9 oa.yaml + ConfigResolver already exist (#442/#457). Extend to "all params live in config, hot-reloadable, editable by command or by Alice".

  • C1. Audit every tunable currently behind an env var or constant → promote into oa.yaml with a typed key + default + doc-comment. (Self-documenting, alphabetized, sectioned — openhands config.template.toml house style.)
  • C2. Hot-reload on file change (notify watcher) — already partially in the ConfigResolver; verify it covers the TUI + runtime knobs.
  • C3. `alice-cli config get|set|edit|validate|diff` (exists, Phase 9a) + `alice-cli doctor --fix` (openfang) self-heal.
  • C4. In-TUI `/config` settings screen (openfang settings.rs): editable provider keys, model catalog (context+cost), live provider health/latency probe.
  • C5. Alice-self-editable config — a guarded tool so Alice can change her own parameters on request (already has memory/charter; extend to config keys with an allowlist + audit).
  • C6. fallbackModel chain + availableModels/enforceAvailableModels allowlist (CC 2.1.166/175) — governable, resilient model choice.

Phase D — USEFUL COMMANDS + SURFACE

  • D1. Steal slash commands: /doctor (health flat-tree), /simplify (cleanup-only review), /effort (persist-as-default), /resume (fuzzy session picker that ACTUALLY loads history — Alice's sidebar currently lists but doesn't open: "M9 deferred"), /export (transcript→markdown), /side (scope-fork side conversation).
  • D2. Streaming markdown + syntax highlighting (pulldown-cmark + syntect — steal from claw-code render.rs, same language). Today Alice streams plain text.
  • D3. Security-posture dashboard (/security) — active features grouped Core/Configurable/Monitoring incl. prompt-injection scanner + audit trail (openfang).
  • D4. Quick wins: Ctrl+O copy last response (SSH-safe), Ctrl+R slash-history reverse-search, Ctrl+G open $EDITOR, mouse click/scroll.

Execution order

A (themes, visible) → B (permissions, safety) → C (config, depth) → D (commands). Each phase ships independently with tests; no phase blocks the prod path (TUI is a dev surface). Build is now fast (thin-LTO + sccache, commit 36940232d).

Already shipped this wave

  • ! shell-exec prefix (fbb4e496e) — Phase D quick win, first slice.