Skip to content

GUI parity: extend --json stdio protocol with in-session control requests (model switch, compact, plan toggle, agent select) #1

Description

@pranavp311

Context

Building a Tauri/React GUI (codegraff-zig/gui) on top of a persistent graff --json session per conversation. Streaming (text/tool_call/tool_result/turn/error) works well.

Problem

The --json stdio protocol currently accepts only three request types — user, set_system_prompt, score (per --schemaprotocol). Several GUI controls map to graff REPL commands that act on the live session and have no protocol equivalent, so a persistent --json session can't drive them:

  • Model switch (/model): the GUI can only set the model at spawn (--model). Switching mid-conversation requires killing + respawning the child, which loses context.
  • Compaction (/compact): the GUI can't compact the live session's context (today it shows only a cosmetic marker).
  • Plan mode toggle (/plan): read-only mode can't be entered/exited per turn.
  • Agent switch (/agents).

Proposal

Add request types to the stdio protocol (and mirror over serve), each acked with an event — same pattern as set_system_prompt:

{"type":"set_model","name":"deepseek-v4-pro"}   // -> {"type":"model","ok":true,"name":"..."}
{"type":"compact"}                               // -> compaction ack / turn
{"type":"set_mode","mode":"plan"|"normal"}       // -> {"type":"mode","ok":true,"mode":"..."}
{"type":"set_agent","id":"..."}                  // -> {"type":"agent","ok":true,"id":"..."}

Same KV-cache caveat as set_system_prompt applies (mutations at turn boundaries). Happy to implement once the shape is agreed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions