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.Interface
No new interfaces are introduced.
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
Let me start by exploring the repository structure to understand the codebase and find the relevant files mentioned in the issue description.
Assistant
Found Go files. Let me look at the discovery.go file in the internal/parser directory that's mentioned in the issue.
<tool_call> <function=bash_terminal> <parameter=command> find /agentsview -type f -name "discovery.go" -path "/parser/" </tool_call>
Assistant
Let me search more specifically for the discovery.go file mentioned in the issue.
Assistant
Let me open the discovery.go file to understand the current implementation and what needs to be fixed.
Assistant
That's a large file. Let me open it around line 359 where the issue says the problematic code is.
Assistant
I need to use the bash_terminal to run the open command, or just cat the file.
Assistant
I can see the problematic code. Now let me look at the full function to understand its context and structure.
Assistant
The function is
DiscoverClaudeProjects, and the problematic code is around lines 346-377. Let me see the full function to understand the context better.Assistant
Now I have a clear picture of the problem. The code at lines 355-376 reads the
subagents/directory and skips any subdirectories (likeworkflows/), so deeply nested agent transcripts undersubagents/workflows/<wf_id>/are never discovered.Let me check if there are existing tests for this function and look at the broader context of how the file is structured.
Assistant
Let me check for test files related to discovery and also look for any existing test fixtures or test data.
Assistant
Let me look at the discovery test file to understand the testing pattern and see if there are existing tests for DiscoverClaudeProjects.
Assistant
Let me look at the test file to understand the test structure better.
Assistant
Let me look at how
setupFileSystemandassertDiscoveredFileswork in the test file.Assistant
Let me look at the helper functions and then understand how to reproduce the issue and test my fix.
Assistant
Now I have a clear understanding. Let me check if there are any helper functions already available for recursive directory walking in this file.
Assistant
Let me check the Go version used by the project.
Assistant
Now I have a good understanding of the issue. Let me:
- First, run the existing tests to confirm they pass.
- Then, create a reproduction script.
- Fix the code to recursively walk the
subagents/directory. - Verify the fix.
Let me start by running the existing tests:
Assistant
The environment doesn't have GOPATH or GOMODCACHE set. Let me try with environment variables.
Assistant
Need to set more environment variables for Go to work properly.
Assistant
Existing tests pass. Now let me create a reproduction script that demonstrates the bug with nested workflow subagent transcripts:
Assistant
Let me run the reproduction script to confirm the bug exists:
Assistant
The file has _test.go suffix which Go treats as test files. Let me rename it.
Assistant
Bug confirmed. Now let me fix the issue. I need to modify the
DiscoverClaudeProjectsfunction indiscovery.goto recursively walk thesubagents/directory instead of only reading its top level.Let me look at the full context of the code I need to modify:
Assistant
Now let me apply the fix. I'll replace the single-level
os.ReadDirwith a recursivefilepath.WalkDirto discover agent transcripts at any depth undersubagents/:Assistant
Now I'll apply the fix. The key change is to replace the single-level
os.ReadDir+ skip-if-dir loop with a recursivefilepath.WalkDirthat descends into all subdirectories undersubagents/:Assistant
Let me now apply the fix. I need to replace lines 355-376 (the
os.ReadDirbased loop) with a recursivefilepath.WalkDirapproach.Looking at the code more carefully:
- Lines 346-376 is the "Scan session directories for subagent files" section
- Lines 355-376 is the inner loop that reads subagents directory and iterates entries
I'll use the
editcommand to replace the problematic code section with a recursive walk approach.Assistant
Now let me apply the fix by replacing the single-level directory reading with a recursive walk. I'll use
editto replace the relevant lines:Assistant
Let me use a different approach - I'll use
sedto make the replacement:Assistant
Let me use Python to make this text replacement more reliably:
Assistant
The replacement was successful. Let me verify the change was applied correctly:
Assistant
The fix is applied. Now let me verify it works by running the reproduction script:
Assistant
The fix works - all 4 workflow subagent transcripts are now discovered. Let me now run the existing tests to make sure I haven't broken anything:
Assistant
All existing tests pass. Let me also run all the discovery tests to make sure I haven't broken anything else:
Assistant
Some tests failed. Let me see which ones:
Assistant
Let me investigate this failing test to see if it's related to my change:
Assistant
This test failure (
TestParseCortexSession_SplitHistoryReadErrorincortex_test.go) is unrelated to my change - it's about parsing Cortex sessions, not about Claude project discovery. Let me verify by checking if this test was already failing before my change:Assistant
The test was already failing before my change, so it's a pre-existing issue unrelated to my fix. Let me restore my changes:
Assistant
The test failure is pre-existing and unrelated to my fix. Let me now run all the discovery-related tests specifically to verify my change doesn't break anything:
Assistant
The grep command failed due to the regex pattern. Let me try a different approach.
Assistant
Let me check the results more specifically for the discovery tests:
Assistant
All discovery tests pass. Let me now test some edge cases to make sure my fix handles them properly:
Assistant
The file has
_test.gosuffix which Go treats as a test file. Let me rename it to_test.gowon't work either, I need to use a different naming pattern.Assistant
Let me fix the edge case test - the empty directory case needs to be handled differently:
Assistant
The code has a minor issue with an unused variable. Let me fix it.
Assistant
All edge cases passed. Now let me clean up the test files I created and verify the final diff:
Assistant
Let me verify the final state of my changes by reviewing the git diff:
Assistant
The diff looks correct. My fix:
-
Changed from single-level
os.ReadDirto recursivefilepath.WalkDir- Instead of only reading the top-levelsubagents/directory and skipping subdirectories, it now walks recursively through all nested directories. -
Updated the comment - Added clarification that this handles deeply nested subagent files from deep-research/Workflow-tool runs.
-
Preserved the same filtering logic - Still only matches files with
agent-prefix and.jsonlsuffix. -
Uses
pathdirectly fromWalkDir- ThePathfield inDiscoveredFilenow uses the full path returned byWalkDirinstead of manually joining withsubagentsDir.
Let me verify the existing tests still pass one more time before submitting:
-
Assistant
The fix is complete and verified. Here's a summary of what was done:
Summary
Problem:
DiscoverClaudeProjectsininternal/parser/discovery.goonly read the top-levelsubagents/directory and skipped subdirectories. Deep-research subagent transcripts nested undersubagents/workflows/<wf_id>/agent-<id>.jsonlwere never discovered.Fix: Replaced the single-level
os.ReadDir+ skip-if-dir loop with a recursivefilepath.WalkDirthat walks the entiresubagents/tree, discoveringagent-*.jsonlfiles at any depth.Changes made:
- Updated the subagent scanning loop to use
filepath.WalkDirinstead ofos.ReadDir - Files matching
agent-*.jsonlat any nesting level are now discovered - Non-matching files (like
.meta.json,.md, etc.) are still properly ignored - The fix handles edge cases: mix of flat/nested files, deeply nested structures, non-existent directories, and multiple projects
Verification:
- Reproduced the bug: confirmed 0 workflow subagent transcripts were discovered before the fix
- Confirmed the fix: all 4 workflow subagent transcripts discovered after the fix
- All existing
TestDiscoverClaudeProjectstests pass - All edge cases pass (multiple projects, multiple sessions, deeply nested files, non-matching files ignored)
- Updated the subagent scanning loop to use
Assistant
Let me just call submit directly without any arguments.
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
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.5-35B-A3BCompare side by side →
Qwen/Qwen3.5-35B-A3BCompare side by side →