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
Let me analyze the issue:
- The problem is in
internal/parser/discovery.goaround line 359 - The code currently only looks one level deep in
subagents/directory - Deep-research and workflow runs put subagent transcripts in
subagents/workflows/<wf_id>/agent-<id>.jsonl - The fix should recursively walk the
subagents/directory to find allagent-*.jsonlfiles
Let me start by exploring the repository structure and understanding the codebase.
- The problem is in
Assistant
Let me explore the repository structure and find the discovery.go file mentioned in the issue.
Assistant
The open command seems to need a different format. Let me try without the line number first.
Assistant
The open command isn't working, so I'll use cat and sed to view and edit files. Let me continue reading the discovery.go file to find the problematic code around line 359. )
<tool_call> <function=bash_terminal> <parameter=command> cat -n /agentsview/internal/parser/discovery.go | sed -n '340,400p' </tool_call>
Assistant
Let me try the bash command again with the correct format.
Assistant
Now I can see the issue. The code at lines 359-362 skips directories, so it never descends into
subagents/workflows/<wf_id>/. Let me see more context of this function to understand it fully.Assistant
Now I understand the issue. The code at lines 359-361 skips directories when scanning
subagents/, so it never finds files insubagents/workflows/<wf_id>/. I need to replace this with a recursive walk.Let me check for existing tests first:
Assistant
Now I understand the issue clearly. The code in
discovery.goaround lines 359-361 skips directories when scanning thesubagents/folder, so it never descends intosubagents/workflows/<wf_id>/where deep-research and workflow runs store their subagent transcripts.I need to:
- Look at the existing tests to understand the test structure
- Create a helper function to recursively walk the subagents directory
- Modify the code to use recursive walking instead of just checking the top level
Let me first look at the test file to understand the testing patterns used. )
Let me look at the test file to understand the testing patterns and also check if there are any existing helper functions for recursive walking in the codebase.
Assistant
Let me look at the test file and also check for any existing recursive walking utilities in the codebase.
Assistant
Now I understand the test structure. Let me continue reading the test file to see all the tests and understand the full pattern.
Assistant
Now I understand the issue and the test structure. I need to modify the code to recursively walk the
subagents/directory instead of only looking at its top level. Let me create a helper function and modify the scanning loop.Assistant
Now I understand the issue clearly. I need to replace the code at lines 355-375 that only reads the top level of
subagents/with a recursive walk that findsagent-*.jsonlfiles anywhere beneath it.Let me create a helper function and modify the scanning logic:
Assistant
Let me verify the changes were applied correctly.
Assistant
The changes look good. Now let me run the existing tests to make sure I haven't broken anything.
Assistant
Let me set up the Go environment properly and try running the tests again.
Assistant
Good catch. Let me check the actual file content to verify if there's a tab/space mismatch.
Assistant
I see the issue - my helper function uses spaces for indentation, but the rest of the file uses tabs. Let me fix the indentation to use tabs consistently.
Assistant
Now let me verify the indentation is correct and run the tests.
Assistant
Good, the indentation is now using tabs (^I). Let me run the tests now.
Assistant
The existing tests pass. Now let me create a test script to verify that the new recursive behavior works correctly for the workflow subagent case.
Assistant
All edge cases pass. Let me run all the parser tests to make sure nothing else is broken.
Assistant
All my relevant tests pass. The only failure (
TestParseCortexSession_SplitHistoryReadError) is a pre-existing, unrelated test. Let me verify the final state of my changes and review the diff.Assistant
The diff looks correct. Let me verify the final file content one more time and then clean up the temp test file.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.