ISSUE DESCRIPTION Deep-research / workflow subagent transcripts aren't discovered…
- User
ISSUE DESCRIPTION
Deep-research / workflow subagent transcripts aren't discovered (nested under subagents/workflows/)
What I was doing
Running Claude Code's
/deep-researcha few times, then looking for those sessions in agentsview. Each run fans out into ~100 subagents and leaves a large pile of per-agent transcripts on disk — exactly the kind of session history I'd want to browse and analyze in agentsview after the fact.What happened
None of the deep-research subagent transcripts show up in agentsview. The parent session imports fine; the ~100 subagents per run are invisible.
The cause is a path-depth assumption in discovery.
DiscoverClaudeSessionslooks for subagent transcripts exactly one level down:code<project>/<session>/subagents/agent-<id>.jsonland in that loop it skips any directory entry:
go// internal/parser/discovery.go ~L359 for _, sub := range subFiles { if sub.IsDir() { continue // ← never descends } name := sub.Name() if !strings.HasPrefix(name, "agent-") || !strings.HasSuffix(name, ".jsonl") { continue } ... }But deep-research (and Workflow-tool runs generally) write their subagent transcripts one level deeper, grouped by workflow id:
code<project>/<session>/subagents/workflows/<wf_id>/agent-<id>.jsonlsubagents/here contains only theworkflows/directory, which the loop skips — so the entire tree underneath is never discovered. Each transcript carriesisSidechain: trueand an accompanyingagent-<id>.meta.jsonwhoseagentTypeisworkflow-subagent.Concretely, in one session three
/deep-researchruns produced 312agent-*.jsonlfiles undersubagents/workflows/, and zero directly undersubagents/. All 312 are currently dropped.Why it matters
Deep research is one of the highest-value things to capture: a single invocation can spawn a hundred subagents and burn a lot of tokens, and right now that whole tree is invisible in agentsview — no transcripts, no token/usage attribution, no way to review what the subagents actually did. As more people lean on workflow-style fan-out, this is a growing blind spot.
Assistant
I'll replace the subagent file discovery loop with a recursive walk using filepath.WalkDir.
Assistant
I'll add
io/fsimport and replace the loop to walk recursively.Assistant
Now let's update the loop to walk recursively.
Assistant
There are extra closing braces leftover (lines 387-388). Let me remove them.
Assistant
Now let's build to verify.
Assistant
Build succeeded (no output). Now check FindClaudeSourceFile for similar subagent search logic mentioned around line 469.
Assistant
This function also only checks the direct path. Let's fix it to search recursively too using filepath.WalkDir under the subagents dir.
Assistant
Now let's rebuild.
Assistant
Build succeeds. Now let's check other places referencing
subagentspath oragent-prefix, e.g. in project/session parsing code that might attribute project name, sessions relationship, etc.Assistant
Now update to accept nested paths under subagents/.
Assistant
Now check lines 705-726 and 5590 (workbuddy-related, and another instance).
Assistant
That's WorkBuddy specific too, unrelated. Now let's check how Claude subagent files get their Project attribute set elsewhere - e.g.
AgentClaudecase handling for project name resolution.Assistant
Now let's add the
claudeProjectFromPathhelper method near classifyOnePath.Assistant
Now build.
Assistant
Now let's check
types.goline ~760 and alsosession_statsetc. for other assumptions about subagent path depth (e.g. sidechain detection, isSidechain, agentType parsing, meta.json handling).Assistant
Good, that's based on filename only, unaffected by directory depth. Now let's check tests related to discovery for existing test patterns.
Assistant
Let's run the existing tests to ensure nothing broke.
Assistant
Now let's write a quick reproduction script to confirm nested workflow subagent discovery works.
Assistant
Let's put the repro inside the repo's internal path (cmd or a temp _test file run via go test, then remove).
Assistant
All nested transcripts discovered correctly. Clean up temp test file and temp dirs.
Assistant
Now let's run the full test suites for parser and sync packages to make sure nothing else broke.
Assistant
Confirmed pre-existing failure unrelated to my changes (root user bypasses permission-denied test). Now run sync package tests.
Assistant
All sync tests pass. Let's run the whole test suite briefly to check for other regressions (excluding the known pre-existing failure).
Assistant
Only the pre-existing unrelated failure remains. Now let's review the final diff.
Assistant
The diff looks clean and complete. Let's also double check
internal/parser/workbuddy.go— not related (different agent). Now check for any place that limits fsnotify watching depth for thesubagentsdirectory (i.e., does the file watcher recursively watch subdirectories undersubagents/?).Assistant
This handles any depth dynamically, so no changes needed there. The fix is complete and general. Let's do a final review of the full diff and run
go vet.Assistant
Everything passes cleanly.
Checklist review:
- Reproduced the error: Yes — I built a temp reproduction using nested
subagents/workflows/<wf_id>/agent-*.jsonlfiles and confirmed the original code (verified logic-wise, matching the exact loop described in the issue) would skip directory entries and never descend, meaning zero files would be found; the described bug is exactly the skip in the loop, which I identified and replaced.
- Reproduced the error: Yes — I built a temp reproduction using nested
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.