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
I'll start by exploring the repository structure to understand the codebase and locate the relevant file mentioned in the issue description. Let me first check what's in the current directory.
- Assistant
Let me explore the structure more systematically.
- Assistant
Let me look for the discovery.go file mentioned in the issue description.
- Assistant
Great! Found it. Let me examine the discovery.go file to understand the current implementation.
- Assistant
Let me scroll down to find the specific code section mentioned in the issue description. Let me search for the relevant section around line 359.
- Assistant
Good! Found it at line 359. Let me open the file and navigate to that section to understand the context better.
- Assistant
Now I can see the problematic code. Lines 359-376 show the loop that processes subagent files. The issue is that when it encounters a directory (like "workflows/"), it skips it completely (line 360-362), so any files in subdirectories like
workflows/<wf_id>/are never discovered.Let me also look at the broader context to understand how this function works. Let me scroll up a bit more to see the function signature and understand the overall structure.
- Assistant
Now I understand the structure better. The
DiscoverClaudeProjectsfunction:- Reads all project directories
- For each project directory, reads session files
- For each session directory, reads subagent files from the
subagents/subdirectory - The issue is that it only reads the top-level of the
subagents/directory and doesn't descend into subdirectories likeworkflows/<wf_id>/
Let me also check if there are any tests for this function to understand how it's tested.
- Assistant
Good! Let me check the test file to understand how the function is tested and what test cases exist.
- Assistant
Let me continue reading the test file to see if there are more test cases, especially for nested subagents.
- Assistant
I see there are tests for
DiscoverClaudeProjects, including a "Subagents" test case. However, the test case only tests subagents directly under thesubagents/directory, not nested subagents underworkflows/<wf_id>/.Now let me create a test script to reproduce the issue. First, let me create a simple test to see the current behavior with nested subagents.
- Assistant
Let me check the go.mod to get the correct module path:
- Assistant
Good, the module path is
go.kenn.io/agentsview. Let me fix the import path in my test script. - Assistant
Let me just use sed to fix it.
- Assistant
Now let me run this test to confirm the issue.
- Assistant
The file seems to have gotten corrupted. Let me recreate it properly:
- Assistant
Let me just write the test as a Go test within the package:
- Assistant
Let me set up Go properly:
- Assistant
Let me check if GOPATH and GOMODCACHE are set.
- Assistant
Let me set HOME too.
- Assistant
Good, Go is working. Let me now verify the bug by running my reproduction script:
- Assistant
Let me write a test file inside the parser package instead:
- Assistant
Bug confirmed. The nested workflow subagent files under
subagents/workflows/<wf_id>/are NOT discovered. Now let me fix theDiscoverClaudeProjectsfunction to recursively walk the subagents directory.Let me look at the exact code I need to modify:
- Assistant
Now I need to fix the code. The fix is to replace the flat loop over
subFileswith a recursive walk usingfilepath.WalkDiron thesubagentsDir. This will allow findingagent-*.jsonlfiles at any depth undersubagents/. - Assistant
Now let me run the existing tests to make sure my change doesn't break anything:
- Assistant
Existing tests pass. Now let me verify my reproduction test passes:
- Assistant
Excellent! The fix works. Let me also run all tests in the parser package to ensure nothing else is broken:
- Assistant
There's a test failure. Let me see which tests failed:
- Assistant
Let me check if this was already failing before my change:
- Assistant
This is a pre-existing test failure, unrelated to my change. Let me verify by reverting my change temporarily and running that test:
- Assistant
The pre-existing failure exists without my change. Let me restore my change:
- Assistant
Now let me clean up the repro test file and verify everything looks good:
- Assistant
Good, only my change to
discovery.gois pending. Let me verify the change one more time: - Assistant
Let me run the discovery-related tests once more to make sure everything works:
- Assistant
Let me also check for any other discovery-related tests:
- Assistant
All discovery tests pass. Let me also clean up any other temporary files:
- Assistant
Let me also verify the final state of my changes:
- Assistant
Let me verify the code compiles correctly:
- Assistant
Let me look at the final diff one more time to confirm it's clean:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.