feat(claude-code): surface Task-tool subagent transcripts in detail panel#34
Open
panosAthDBX wants to merge 1 commit intoAtaraxy-Labs:mainfrom
Open
Conversation
Claude Code writes Task-tool subagent transcripts to a nested path:
~/.claude/projects/<encoded>/<session-uuid>/subagents/agent-<id>.jsonl
The watcher previously used a non-recursive readdir + .jsonl filter on
the top-level project directory, so only the main session transcript
was picked up and every subagent stayed invisible to the tracker. The
detail panel in turn showed just the parent session, even while two or
three Task-tool subagents were running.
Fix: descend one level into any <session-uuid>/ subdir, scan and watch
its subagents/ child. Each subagent is emitted as its own thread
(threadId = "agent-<id>") under the parent's projectDir, so the tracker
stores them as distinct per-session instances and the TUI For-loop
renders them alongside the main session.
Scoped to Claude Code session UUID dirs (8-4-4-4-12 hex) so we don't
recurse into unrelated children. Polling (POLL_MS=2s) plus fs.watch on
the session dir catch late-spawning subagents without requiring all
paths to exist at start-up.
Tests:
- seed discovers main session + multiple subagents under one project
- live spawn after seed is picked up via the session-dir watcher
- non-UUID siblings with a subagents/ subdir are ignored
Verified live against ~/.claude/projects/: 7 main sessions + 2 active
subagent threads surface where previously 0 subagents did.
Co-authored-by: Isaac
There was a problem hiding this comment.
inspect review
Triage: 18 entities analyzed | 0 critical, 0 high, 3 medium, 15 low
Verdict: standard_review
Findings (1)
- [low] Comment/constant mismatch: SESSION_UUID_RE is documented as matching “lowercase hex” but the regex is case-insensitive (/i) and will match uppercase too. Evidence:
/** Matches a Claude Code session UUID folder: 8-4-4-4-12 lowercase hex */vsconst SESSION_UUID_RE = /^[0-9a-f]{8}-...$/i;.
Reviewed by inspect | Entity-level triage found 0 high-risk changes
Contributor
|
would be awesome if you could share screenshot of how this looks on your end ;) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
~/.claude/projects/<encoded>/<session-uuid>/subagents/agent-<id>.jsonl— butClaudeCodeAgentWatcheronly scanned the top-level project dir non-recursively, so every subagent was invisible to the tracker and the detail panel showed just the parent session while 2–3 subagents were running.subagents/child. Each subagent is emitted as its own thread (threadId = "agent-<id>") under the parent'sprojectDir, so the tracker stores them as distinct per-session instances and the TUI's existing<For each={agents()}>loop renders them alongside the main session.fs.watchcatch late-spawning subagents without requiring all paths to exist at start-up.Motivation
Running Claude Code with the Task tool (subagents) is increasingly common — long-running research delegations, code exploration, code review agents etc. Today opensessions makes those invisible. The fix is small, isolated to the claude-code watcher, and maps cleanly onto the existing per-thread instance model in
tracker.ts.Details
claude-code.ts:SESSION_UUID_RE,isSessionDirName,scanJsonlDir,watchJsonlDir,watchSessionDirForSubagents,setupSubagentWatchers.scanInternal()now walks each project dir, scans top-level.jsonl(main sessions), then iterates session-UUID subdirs and scans<uuid>/subagents/*.jsonl.setupWatchers()registersfs.watchfor existingsubagents/dirs, and for session dirs without one yet, watches for thesubagents/child being created.agent-<id>.meta.jsonsibling files (safely ignored — non-.jsonl).Tests
Added three tests in
claude-code-watcher.test.ts:.meta.jsonnoise sibling → 3 distinctthreadIds emitted, 1 session;.meta.jsonignored.not-a-session/subagents/agent-bogus.jsonldecoy is ignored; we only recurse into UUID-shaped session dirs.Full runtime suite: 370 pass / 0 fail (was 367 pass; +3 new). Build clean via
bun run build.Validation
cd packages/runtime && bun test— 370 passbun run build— clean~/.claude/projects/with two in-flight Task-tool subagents: the watcher emitted bothagent-*threadIds alongside the parent UUID, each attributed to the same resolved session. Before the fix: zero subagent threads visible.Related
Closes the Claude Code half of #24. The pi side was canonicalized in #25; this PR handles the other half of "multi-agent per pane is real and should show up" for the Claude Code watcher specifically.
This pull request and its description were written by Isaac.