Skip to content

spike(chat): Host the Harness's own TUI in a PTY instead of drawing our chat surface? #508

Open

Description

@omesser

ADR-0018 runs the Harness headless over ACP and has ai-buddy draw the Chat surface. The open chat issues — #474 (which mind answers), #476 (history the session no longer has), #483 (no thinking shown), #459 (connect flow), #437's held permission prompt, #348 (switcher) — are each a piece of the Harness's own TUI being rebuilt in src/chat.js. The TUI solves all of them today.

The load-bearing reason

ADR-0018 rests on ADR-0008: one Harness session is Director and chat, and a TUI is a second process, so on "four of five Harnesses" a second conversation. The other reasons in ADR-0010 are weaker: the turn-finished signal is needed by the Director, not by chat; "terminal log" is already an approved Chat UI (#339); the zero-dependency stance was stated as a cost, not a principle.

The Director keeps ACP regardless — it needs a structured prompt in and one parseable line out. So the question is narrower than the ADR frames it: must chat share the Director's session, and can a TUI attach to it?

Probes

  1. Resume the ACP session from the CLI. harness-session.json records the id the Claude adapter returned. Does claude --resume <that id> from the same working directory open that conversation? ADR-0010 asserted only opencode can attach; it never probed Claude. hermes acp advertises sessionCapabilities: fork, list, resume (ADR-0017) and nothing reads it.
  2. PTY spike. portable-pty + xterm.js in a Tauri window, claude at the data folder with our MCP config, wrapped in a header/footer carrying the status line ADR-0010 wanted. Judged by Summon → ask → speak lands on screen.

What decides

— Claude, in a session with @omesser

Activity

  1. omesser commented on Sep 7, 2026

    @omesser
    OwnerAuthor

    Probe 1: resume works, from any cwd

    harness-session.json holds 8e3d40f9-…. That exact file exists at ~/.claude/projects/-Users-oded-Library-Application-Support-ai-buddy/8e3d40f9-….jsonl, and every record in it carries that sessionId: the id the ACP adapter returns is the Claude Code session id, with no aliasing. The file holds the Director's turns (55 user, 19 assistant; the last prompt ends standing on: the top of the Dock).

    cd "$HOME/Library/Application Support/ai-buddy" && claude --resume 8e3d40f9-… -p "In one sentence, what was the last thing you were asked to do in this conversation?" --output-format json
    → exit 0, session_id 8e3d40f9-…, result: "You were asked to propose one of a set of desktop-buddy behaviors (with an optional spoken line) for BMO after being placed on a perch on top of the Dock."
    

    The same command from an empty scratch directory gave the same answer and appended to the same file, so cwd only stamps the turn; it is not needed to find the session.

    So ADR-0010's "only opencode can attach" does not hold for the default Harness. The TUI can open the Director's own conversation. What this did not test: both processes attached at once. The ACP child was not running during the probe. Claude Code has no visible lock on the transcript, so a PTY-hosted TUI and the ACP Director appending to one jsonl is last-writer-wins until proven otherwise, and the spike has to check whether a resumed TUI sees turns the ACP child appends after the TUI loaded.

    Side finding: the last two assistant records before the probe are API Error: 400 Claude Code 2.1.185 does not support this model; version 2.1.251 or newer is required. @agentclientprotocol/claude-agent-acp bundles SDK 2.1.185, so the Director's turns were failing against the configured model. Separate bug.

    — Claude, in a session with @omesser

  2. added this to the V2 milestone on Sep 7, 2026
  3. moved this from 👷 Todo to 🙋 Human Triage in Fidgeton Sep 9, 2026
  4. added
    p2Eventually: real, but nothing waits on it
    on Sep 9, 2026
  5. moved this from Human Triage to Ice Box in Fidgeton Sep 22, 2026
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

    needs-triageMaintainer needs to evaluate this issuep2Eventually: real, but nothing waits on itquestionFurther information is requestedready-for-humanRequires human implementation

    Projects

    • Status
      Ice Box

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions