Repository navigation
Closed
Labels
Description
Overview
ADR-061 §7 says a terminal (PTY) chat's summary is the cross-device artefact: locally derived prose with ANSI stripped, not raw output. §6 says its session id names the harness's own state (~/.claude/…, ~/.codex/sessions/…), marked local_only. Capture currently does neither.
Problem Statement
- The summary is raw output.
SessionCapture::summary()(packages/agent/src/pty/capture.rs) returns the first 500 bytes of the raw transcript (SUMMARY_MAX_BYTES), including ANSI escapes and TUI repaints. Once a long session overflows the 1 MiB ring buffer, those bytes are an arbitrary mid-session fragment. The summary isn'tlocal_only, so it's the one piece of raw scrollback allowed to leave the device, which ADR-061 §7 rules out. - The stored id isn't resumable. Capture stores the daemon's PTY session id (
session.id,packages/daemon/src/services/capture_service.rs). It can re-attach to a live terminal, but a harness can't resume from it.
Proposed Solution
- Summary: strip ANSI and terminal control sequences from the transcript, then derive a short prose summary locally. Use the native model when it's available. When no summarizer is available, store no summary, which is ADR-061 §7's metadata-only fallback, rather than raw bytes.
- Session id: record the harness's own resumable session id for the harnesses that expose one (Claude Code, Codex), discovered from the harness's session store after it exits, as a
local_onlyfield ofai-chat-pty. Keep the daemon PTY id only if re-attaching to a live session needs it after restart; otherwise drop it. - Both fields are written through the validated update (see Split ai-chat into an abstract base with ai-chat-native and ai-chat-pty subtypes #3446).
Architecture Impact
Brings the code in line with ADR-061 §6 and §7 (decisions/061-ai-chat-private-by-default-and-machine-bound-properties.md) and ADR-088 (ai-chat-pty fields). No ADR change. The resume feature itself (relaunching a harness with its resume flag, and a Resume button) is separate work.
Acceptance Criteria
- Follows
development/node-type-sequence.md; theai-chat-ptysheet incomponents/node-types.mdstays accurate - A stored summary contains no ANSI or control sequences and is prose, or is absent (tests with a transcript that has escapes, and one that overflowed the buffer)
- For Claude Code and Codex sessions, the harness's resumable session id is stored
local_only(tests with fixture session stores) -
bun run test:changedpasses;bun run quality:fixclean
Technical Specifications
Reference Files
packages/agent/src/pty/capture.rs(SessionCapture,summary,transcript)packages/daemon/src/services/capture_service.rs(build_capture_properties,finalize_capture)packages/daemon/src/services/agent_session_service.rspackages/desktop-app/src/lib/components/viewers/ai-chat-pty-session.svelte
Dependencies
- Split ai-chat into an abstract base with ai-chat-native and ai-chat-pty subtypes #3446 (
ai-chat-ptyfields and capture through the validated update)
Non-Goals
- Resuming a harness session from the UI
- Embedding summaries (future work under ADR-061 §4)
Activity
malibio commentedon Oct 2, 2026
Frontend: 303 test files, 5559 tests passed
Derive the terminal chat summary locally and store the harness's sess…
Find a node's running terminal session from the daemon, not a stored …