Skip to content

feat: Session Phase 2 — interactive agent chat + split pane #105

@jonwiggins

Description

@jonwiggins

Summary

Add an interactive Claude Code chat pane alongside the existing web terminal in sessions. This is Phase 2 of the sessions feature (#80) — Phase 1 (terminal + PR tracking) shipped in #93.

Motivation

Sessions currently give users a terminal into a repo pod, but no way to interact with an AI agent within that same workspace. The goal is a side-by-side experience: agent chat on the left, terminal on the right, both operating on the same worktree.

Features

Split pane layout

  • Resizable split — agent chat (left) + terminal (right)
  • Either pane collapsible to full-width
  • Layout preference persisted (localStorage or session record)

Interactive agent chat

  • Long-running claude process exec'd in the pod (not one-shot per message) — stdin/stdout piped through WebSocket (WS /ws/sessions/:id/chat)
  • Streaming responses rendered in a chat pane with markdown
  • Tool use visibility — show files being read/edited and commands being run (reuse existing log viewer / agent event parser)
  • Interrupt button — cancel the current response mid-stream
  • Session history persists in scrollback even when navigating away and back

Terminal ↔ Agent coordination

  • "Send to agent" action — select terminal output and send it as context to the chat (e.g. paste an error and say "fix this")
  • Shared worktree means git status in the terminal immediately reflects agent edits and vice versa

Cost and tracking

  • Live cost counter displayed in the session header (token spend so far)
  • Per-message cost breakdown in the chat UI
  • Model selector — pick which model the agent uses (default from repo claudeModel setting)

PR lifecycle (extending Phase 1)

  • Trigger review agent on any session PR directly from the chat pane
  • CI status / review status badges inline when a PR is detected

API

  • WS /ws/sessions/:id/chat — agent chat WebSocket (stdin/stdout + structured events)
  • Extend GET /api/sessions/:id to include cost breakdown and model info
  • Extend POST /api/sessions/:id/end to kill the claude process if running

Non-goals

  • Multiple terminal tabs per session
  • Auto-fix CI failures (user-driven only)
  • Multi-agent (one claude process per session)
  • Control plane agent ("chat with Optio" outside a repo context)

Follows

Metadata

Metadata

Assignees

No one assigned

    Labels

    optioAssigned to Optio AI agent

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions