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.meta.json(agentType: workflow-subagent) is available alongside each transcript if the workflow grouping is worth surfacing in the UI.ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- If an error was reported in the issue description, I have successfully reproduced it.
- If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- I have thought about edge cases and made sure my fix handles them as well.
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /agentsview, current file: none) bash-$
- Assistant
I'll start by exploring the repository structure to understand the codebase and locate the relevant file mentioned in the issue:
internal/parser/discovery.go. Let's first see what's in the repository. - Assistant
Good, I found the file. Let me first look at the repository structure and then examine the specific file mentioned in the issue.
- Assistant
Let me examine the discovery.go file to understand the current implementation and locate the exact code mentioned in the issue.
- Assistant
I can see the issue. Let me continue reading the file to understand the full context, and also look at the test file:
- Assistant
Let me look at the discovery_test.go to understand the testing structure:
- Assistant
Let me see more of the test file:
- Assistant
Now let me look at the exact function in detail to understand the current logic:
- Assistant
Let me check if there's a Walk function already used in the codebase to understand the project's conventions:
- Assistant
Let me check how that's used to understand the pattern:
- Assistant
Let me also check if there are any other similar patterns in the codebase:
- Assistant
Let me check around line 461 to understand the context:
- Assistant
Let me see more of that function to understand how subagents are handled:
- Assistant
Let me see the full function that finds source files:
- Assistant
Now I have a clear understanding of the issue. There are two places that need to be fixed:
DiscoverClaudeProjectsfunction (lines 347-376) - scans for all subagent filesFindClaudeSourceFilefunction (lines 461-493) - finds a specific subagent file by ID
Both only look one level deep in the
subagents/directory. Let me first run the existing tests to make sure they pass: - Assistant
Let me check the Go environment:
- Assistant
Let me set up the Go environment properly:
- Assistant
Let me try setting GOPATH differently.
- Assistant
That's odd - the outputs were blank. Let me check what environment variables are set.
- Assistant
The environment doesn't have HOME, GOPATH or GOMODCACHE set. Let me set them.
- Assistant
Good, the tests pass. Now let me understand the issue better. The problem is clear:
- In
DiscoverClaudeProjects(line 359-376), when scanningsubagents/directory, it skips directories withif sub.IsDir() { continue }at line 361. - Deep-research/Workflow-tool runs write their subagent transcripts one level deeper:
<project>/<session>/subagents/workflows/<wf_id>/agent-<id>.jsonl - The
workflows/directory is skipped, so none of the nested files are discovered.
Similarly,
FindClaudeSourceFile(lines 461-493) only looks one level deep.Let me create a helper function that recursively walks a directory to find all
agent-*.jsonlfiles. I'll also check if there are any other similar patterns in the file: - In
- Assistant
Let me open the file and examine the exact code I need to modify:
- Assistant
Now I'll fix the code. I need to replace the inner loop that only looks at direct children with a recursive walk. Let me make the change:
- Assistant
Good, I made the first change. Now I need to add
"io/fs"to the imports since I'm usingfs.DirEntry. Let me check the imports: - Assistant
I need to add
"io/fs"to the imports. Let me do that: - Assistant
Good, now I need to fix the second place - the
FindClaudeSourceFilefunction. Let me look at it: - Assistant
Now I need to fix the
FindClaudeSourceFilefunction as well. The current code only looks one level deep. Let me update it: - Assistant
Wait, I see there's an extra closing brace at line 511. Let me check the context:
- Assistant
I see there's an extra closing brace at line 511. Let me look at the broader context to understand the structure:
- Assistant
I see the issue - there's an extra closing brace
}on line 511. Let me fix that: - Assistant
Good, the fix looks correct now. Let me also verify that
filepath.SkipAllexists in the Go version being used. Let me check the Go version and verify: - Assistant
I need to remove the unused
subFilesvariable. Let me look at the current code: - Assistant
I need to remove the unused
subFilesvariable and the old error check. Let me fix this: - Assistant
Let me try a different approach:
- Assistant
Let me use sed to fix this:
- Assistant
Let me check what the code looks like now:
- Assistant
I see there's a syntax error - the closing parenthesis was replaced with a closing brace. Let me fix that:
- Assistant
Let me check the code again to make sure it's correct:
- Assistant
Let me use a different approach to fix this:
- Assistant
Let me check line 355:
- Assistant
Ah I see - the closing brace
}is on line 355. Let me fix that: - Assistant
Let me verify the fix:
- Assistant
Now let me check if
erris already declared in the outer scope. Let me look at the broader context: - Assistant
Good, the
errvariable is already declared in the outer scope fromsessionFiles, err := os.ReadDir(projDir)at line 325, soerr = filepath.WalkDir(...)should work fine. Let me verify with go vet: - Assistant
Great, go vet passes. Now let me also check if
filepath.SkipAllis available in Go 1.26. Let me check: - Assistant
Good, it builds. Now let me run the existing tests to make sure I haven't broken anything:
- Assistant
The existing tests pass. Now let me create a test script to verify that my fix works for the described scenario. Let me first create a test that reproduces the issue:
- Assistant
Now let me run the test script to verify the fix works:
- Assistant
I can't use internal packages from outside the module. Let me create a test within the parser package:
- Assistant
The tests pass. Now let me remove the test file I created and run all the existing tests to make sure I haven't broken anything:
- Assistant
Now let me run all the tests in the parser package to make sure I haven't broken anything:
- Assistant
I see one test failure:
TestParseCortexSession_SplitHistoryReadError. Let me check if this is a pre-existing failure by examining the test: - Assistant
This is a pre-existing test failure unrelated to my changes. It's a permission-based test that fails when running as root. Let me verify by running only the discovery-related tests:
- Assistant
All discovery-related tests pass. The one failure (
TestParseCortexSession_SplitHistoryReadError) is a pre-existing issue unrelated to my changes - it useschmod 0o000which doesn't work when running as root. Let me verify this by checking git status and making sure I haven't introduced any unexpected changes: - Assistant
Good, only the discovery.go file was modified. Let me check the diff to review my changes:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
- xiaomi/mimo-v2.5-proCompare side by side →
- xiaomi/mimo-v2.5-proCompare side by side →
- xiaomi/mimo-v2.5-proCompare side by side →
- xiaomi/mimo-v2.5-proCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →