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:<project>/<session>/subagents/agent-<id>.jsonland in that loop it skips any directory entry:
// 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:
<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.
The fix looks small: walk
subagents/recursively (or specifically also descend intosubagents/workflows/<wf_id>/) instead of only reading its top level, and treatagent-*.jsonlfound anywhere beneath it the same way. The () is available alongside each transcript if the workflow grouping is worth surfacing in the UI. Assistant
Let me start by understanding the repository structure and the issue. The issue is about
DiscoverClaudeSessionsininternal/parser/discovery.gothat only looks one level deep for subagent transcripts insubagents/directory, but deep-research / workflow subagents write their transcripts one level deeper undersubagents/workflows/<wf_id>/agent-<id>.jsonl.Let me first explore the repository structure and look at the relevant file.
Assistant
Let me look at the discovery.go file to understand the current implementation.
Assistant
Let me look at the discovery.go file, focusing on the area around line 359 mentioned in the issue.
Assistant
Let me open the file and look around the relevant section.
Assistant
Let me try opening with the correct format.
Assistant
Let me use grep to find the relevant section and then open the
Assistant
Let me look at the relevant code around lines 329-380:
Assistant
Now I can see the issue clearly. The loop at lines 359-374 skips directories (line 360) under
subagents/, which means theworkflows/directory and all its contents are never discovered. Let me look at the broader function context:Assistant
Let me check for other similar patterns in the codebase. Let me also look at the
DiscoverClaudeSessionsfunction mentioned in the issueAssistant
Let me search for all discovery functions and other places that reference "subagents":
Assistant
Let me look at the second area around line 461 where subagents are referenced
Assistant
Now let me look at the test file for discovery to understand what tests exist
Assistant
Let me search for Claude-specific tests in the discovery test file
Assistant
Let me look at the test for
TestDiscoverClaudeProjectsto understand the current test structureAssistant
Let me also look at
TestFindClaudeSourceFileto understand the full pictureAssistant
Let me see the full
FindClaudeSourceFilefunctionAssistant
Now I have a clear understanding. Let me create a small reproduce script to confirm the issue:
Assistant
The file name ends with
_test.gowhich Go treats specially. Let me rename it.Assistant
Let me set GOCACHE.
Assistant
I've confirmed the bug. Now let me implement the fix. Let me first check if
filepath.WalkDiris used elsewhere:Assistant
Good,
filepath.WalkDiris already used in the codebase. Now let me look at the exact lines I need to change:Assistant
Now let me implement the fix. First, let me check the imports in the file:
Assistant
Now I have all the information. Let me make the changes. First, add
"io/fs"to the imports:Assistant
The import block is duplicated. Let me fix this:
Assistant
Let me try again more carefully:
Assistant
Now let me apply the import edit with the correct line numbers:
Assistant
I see a duplicate closing paren on line 20. Let me fix it:
Assistant
Let me revert and do a cleaner edit:
Assistant
Let me use
replacewith the multi-line syntax for the import block:Assistant
Good, the import is correct. Now let me update the subagent scanning loop in
DiscoverClaudeProjects. Let me look at the current state of those lines:Assistant
Let me see the exact code for the subagent scanning loop:
Assistant
Now let me replace the inner subagent scanning loop (lines 358-375) with a recursive walk:
Assistant
Let me view the exact whitespace
Assistant
Let me use
editwith line numbers instead:Assistant
Now let me use edit with explicit line numbers:
Assistant
I see leftover lines from the old code. Let me remove lines 375-376:
Assistant
I need to remove lines 375-376. Let me edit them out
Assistant
Good. Now let me fix the
FindClaudeSourceFilefunction. Let me look at its subagent sectionAssistant
Let me check the Go version in go.mod to make sure
fs.SkipAllis available:Assistant
Go 1.26.3, so
fs.SkipAllis available. Now let me updateFindClaudeSourceFile's subagent sectionAssistant
Let me use
editwith line numbers. Let me first confirm the lines:Assistant
Now let me edit lines 459-483:
Assistant
Again, leftover lines. Let me remove lines 501-503
Assistant
Lines 501-503 are the leftovers. Let me remove them:
Assistant
Now let me verify the code compiles:
Assistant
Let me set up the Go environment properly
Assistant
Build succeeded! Now let me run the discovery tests:
Assistant
All existing tests pass. Let me also create a quick verification script to confirm the fix works for the workflow-nested case
Assistant
Let me run it from within the module:
Assistant
Let me create a temporary test file inside the repo instead
Assistant
All tests pass. Let me clean up the temporary test file and run the full test suite for the parser package
Assistant
There's a test failure. Let me see which test failed
Assistant
The grep was broken, let me find the actual failing test.
Assistant
Let me check if this test was already failing before my changes
Assistant
The test was already failing before my changes - it's a pre-existing issue. Let me restore my changes
Assistant
Let me also check if there are other places in discovery.go that have similar flat-scan patterns for subagents. Let me look at the line 953 area mentioned in the grep results
Assistant
That's for Cursor transcripts which has a different pattern. Let me also check the
claude_subagent_test.gofile to see if there are tests thereAssistant
Let me run all parser tests except the pre-existing failing one to confirm my changes don't break anything
Assistant
The
!is being interpreted by bash. Let me escape it or use a different approach.Assistant
All tests pass. Let me verify my changes with a git diff:
Assistant
The diff looks clean and correct. Let me go through the checklist:
1. If an error was reported in the issue description, I have successfully reproduced it. ✅ Yes. I reproduced the bug with a Go script showing that 0 of 3 workflow-nested subagent files were discovered with the old flat-scan logic.
2. If an error was reported in the issue description, I have confirmed that my fix resolves the error. ✅ Yes. I tested with temporary test cases that verify:
DiscoverClaudeProjectsnow finds all 3 workflow-nested subagent filesFindClaudeSourceFilenow finds subagent files nested underworkflows/<wf_id>/- Backward compatibility: directly-nested subagent files are still found
3. I have thought about edge cases and made sure my fix handles them as well. ✅ Edge cases handled:
- Files directly under
subagents/still work (backward compatible)
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.