Watch
1
0
Fork
You've already forked SouveraineOS
0
SouveraineOS/docs/substrate/tasks/chat-vs-code-differentiation.md
Fimeg e480809c70 docs: rescue the agent-substrate tree out of a gitignored directory
219 files, 2.0 MB, untracked in souveraine/docs and existing nowhere else.
The volume is at 100% with no snapshots.
2026-07-26 12:11:50 -04:00

3.7 KiB
Raw Blame History

task_id title status assignee priority phase
ui-chat-code-001 Differentiate Chat and Code Screens pending medium 3.0

Task: Differentiate Chat and Code Screens

Objective

The "Chat" and "Code" menu items currently route to the same screen (Screen::Chat for both, at src/ui/app.rs:693). They should be distinct: the Code screen is for agent-assisted coding sessions where diff output, file content, and compiler errors take priority over conversational prose.

Current State

At src/ui/app.rs:684-708, the menu selection handler routes both menu items 1 (Chat) and 2 (Code) to the same path:

1 | 2 => {
    if self.chat.is_none() {
        match ChatState::connect(...)
    }
    self.current_screen = Screen::Chat;
}

Both screens share Screen::Chat entirely — same header, same message rendering, same input area, same cockpit.

Target State

A distinct Screen::Code that optimizes for the coding workflow:

  • Layout priority: Code output and tool results take precedence over chat bubbles. The message list should be more compact — no markdown-rendered bubbles for tool outputs, raw text preferred.
  • Tool result visibility: BackendEvent::ToolResult content renders inline instead of collapsed inside a tool card. The "you said / agent said" bubble pattern is secondary; what matters is what files were changed, what errors occurred, what diffs were applied.
  • Input area: Same as chat, but with a code-oriented prompt prefix (e.g. ≡ code instead of ). Tab-completion could prefer code commands (/diff, /files, /compile).
  • Potential: Future phases could add a souveraine code subcommand that spawns the TUI directly into Code mode, and a Code screen could wire in souve diff for inline diff rendering.

Key Questions (Investigate Before Building)

  1. Does Code need its own ChatState or can it share one? They use the same Backend, same conversation, same agent. The difference is purely in how the message history is rendered — not what's in it. A rendering flag (render_mode: ChatMode::Conversation | ChatMode::Code) on ChatState would be simpler than a parallel state struct.
  2. How should tool results render in Code mode? Current bubble rendering wraps tool results in markdown + truncated preview + "... (N more lines)". In Code mode: full raw output, monospace, no truncation, maybe line-numbered.
  3. Should Code mode auto-expand all tool cards? Or skip the card concept entirely and render tool calls as raw → bash header lines with full output below?
  4. Should there be a /code toggle command to switch modes mid-session? Allows starting in Chat, entering a coding sub-session, then returning.

Implementation Sketch

  1. Add Screen::Code variant to src/ui/app.rs
  2. Add render_mode: ChatMode field to ChatState (default Conversation)
  3. In chat.rs rendering, branch on render_mode:
    • Conversation: current behavior (bubbles, collapsed tool cards, markdown)
    • Code: raw tool results, monospace, full output, no bubble wrapping for tool content
  4. Wire Screen::Code in app.rs to pass ChatMode::Code when connecting
  5. Add /code slash command to toggle between modes

Files to Modify

File Change
src/ui/app.rs Add Screen::Code handler, pass mode flag to ChatState
src/ui/chat.rs Add ChatMode enum and rendering branches
src/ui/chat.rs — bubble/tool_card functions Add code-mode variants that skip bubble wrapping

Not in Scope

  • Diff visualization (inline +/— syntax highlighting in TUI)
  • Compilation error parsing and highlighting
  • Git integration in Code mode
  • Separate Code-mode conversation history