Skip to content

Add agent response rendering specification and design#110

Open
johannesjo wants to merge 1 commit into
mainfrom
claude/add-response-rendering-IyYF7
Open

Add agent response rendering specification and design#110
johannesjo wants to merge 1 commit into
mainfrom
claude/add-response-rendering-IyYF7

Conversation

@johannesjo
Copy link
Copy Markdown
Owner

Summary

This change adds comprehensive OpenSpec documentation for a new agent response rendering capability. The specification, design document, and task breakdown define how the app will render structured agent responses (from Claude Code, Amp, and other agents) in a dedicated panel alongside the existing terminal view.

Changes

  • spec.md — Complete capability specification with 10 requirements covering:

    • Panel opt-in behavior and lifecycle (enable/disable/restore across restarts)
    • Session ID binding at agent spawn time
    • Forward-only JSONL file tailing with fs.watch + stat-poll fallback
    • Event adapter normalization (Claude Code → shared AgentResponseEvent shape)
    • Live event push to renderer
    • Markdown rendering pipeline reuse with extended sanitization
    • Collapsible tool/thinking blocks
    • Panel coexistence with terminal (no interference with pty)
    • Watcher lifetime management
  • design.md — Architectural rationale and implementation strategy:

    • Why a parallel reader (tailing session JSONL) rather than headless mode
    • Claude Code session JSONL format and fixed session ID injection
    • Adapter registry pattern for multi-agent support
    • Watcher lifecycle and IPC contract
    • Parser choice (@anthropic-ai/claude-agent-sdk for type safety)
    • Normalized event shape (AgentResponseEvent union)
    • Renderer surface (component structure, markdown extensions, image sanitization)
    • Streaming and performance considerations
    • Explicit v1 scope boundaries
  • tasks.md — Detailed implementation checklist organized by subsystem:

    • Shared contract (IPC channels, types, AgentDef extension)
    • Backend watcher and adapters (fs.watch, line buffering, adapter dispatch, session ID injection)
    • Frontend store and panel (event log, UI components, markdown rendering, persistence)
    • Component and store tests
    • Persistence migrations
    • Acceptance criteria and validation steps

Implementation Notes

  • The panel is opt-in per task and only shown when the agent has a configured responseSource
  • Session IDs are fixed at spawn time via CLI flag injection, enabling deterministic file tailing
  • The watcher uses forward-only reading with byte-offset tracking and fs.watch with stat-poll fallback
  • Adapters normalize agent-specific events into a shared shape, keeping renderer code agent-agnostic
  • Markdown rendering reuses existing marked + shiki + DOMPurify stack with extended sanitization for images
  • The panel never blocks or replaces the terminal; input still flows through xterm
  • Initial support targets Claude Code and Sourcegraph Amp; adapter registry enables future agents (Codex, Cursor, etc.)

This is a specification-only change; no source code is modified. The spec is ready for implementation planning.

https://claude.ai/code/session_01PNd94wGpSPm4bxcQsjWw3V

Proposes an opt-in "AI Response" panel rendered alongside the existing
xterm agent terminal. The backend tails the agent's structured session
log (Claude Code and Amp at launch; Codex / Cursor as follow-ups) and
forwards normalised events to a SolidJS panel that reuses the existing
marked + shiki + DOMPurify + mermaid pipeline. Pty input flow,
permissions UX, and non-supported agents are unchanged.

https://claude.ai/code/session_01PNd94wGpSPm4bxcQsjWw3V
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants