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 start by exploring the repository structure to understand the codebase
Assistant
Let me look at more context and the test file for discovery
Assistant
Now let me look at the
claude_subagent_test.gofile mentioned in the parser dir:Assistant
Now let me look at the types.go file to understand the structure of DiscoveredFile and how subagents are handled:
Assistant
Let me now look at how the test file uses setupFileSystem to understand the format:
Assistant
Let me look at the Claude parser to understand how the session files are parsed and how the subagent info gets used:
Assistant
Now let's look at the workbuddy.go to understand how it handles the same situation, as a comparison:
Assistant
Now let me also look at the function
findAgentSourceFilefor Claude to understand the logic at line 461:Assistant
Let me now look at how this discovery is called and how the project info is preserved:
Assistant
Let me also look at the sync engine to see how the discovered files are processed:
Assistant
Let me now create a reproduction script to verify the issue:
Assistant
Now let me run a Go test in the agentsview repo to verify the current behavior:
Assistant
Let me take a simpler approach. I'll add a temporary test inside the agentsview repo, and remove it later:
Assistant
I've successfully reproduced the issue. The discovery only finds the parent session file but not the workflow subagent file. Now let me also verify the same issue applies to the
FindClaudeSourceFilefunction:Assistant
I've confirmed both the discovery and the find-by-id functions have the issue. Now let me think about the fix.
Looking at the code:
- The
DiscoverClaudeProjectsfunction at lines 308-383 only walks one level deep intosubagents/. - The
FindClaudeSourceFilefunction at lines 433-490 only looks for the file directly undersubagents/agent-*.jsonl.
Now let me also check the parser for the subagent's data structure - is there an existing
agentTypeof "workflow-subagent" already handled:- The
Assistant
Let me also check the claude.go parser to understand how subagent files are parsed - specifically looking for any mention of "workflow" or anything that determines session attributes:
Assistant
Now let me design the fix. The simplest approach is to recursively walk the
subagents/directory:Assistant
Let me check what is used for directory walking in the project:
Assistant
Let me check the watcher.go for the WalkDir usage:
Assistant
me look at the imports of discovery.go:
Assistant
Let me look at all relevant tests that exist for the Claude discovery:
Assistant
Now let me also look at the symlink test:
Assistant
Now let me remove my temp test file and write the actual fix:
Assistant
Good, removed. Now let me make the fix to discovery.go:
Assistant
let me make the fix. I'll replace the subagent discovery in
DiscoverClaudeProjects:Assistant
Let me try a different approach using sed or a different edit syntax
Assistant
Now let me verify the change:
Assistant
Now I need to add the
discoverClaudeSubagentFileshelper function. Let me add it right afterDiscoverClaudeProjects:Assistant
Now let me also update the
FindClaudeSourceFileto use the new recursive helper:Assistant
Now let me build and verify the code compiles:
Assistant
Build passes. Now let me re-run my reproduction test:
Assistant
The fix works. Now let me also run all existing tests to make sure I didn't break anything:
Assistant
All existing tests pass. Let me also run the entire parser test suite to confirm nothing is broken:
Assistant
a pre-existing test failure. Let me check if it was failing before my changes:
Assistant
- the test failure is pre-existing and unrelated to my changes. Let me also run the sync engine tests to ensure my changes don't break them:
Assistant
Sync tests all pass. Let me also check the formatting and vet:
Assistant
All good. Let me also verify the changes by viewing the final state of the discovery.go:
Assistant
me verify the fix doesn't break the existing TestDiscoverClaudeProjects test for Subagents case which uses a non-existent workflows dir:
Assistant
Let me check the testdata directory for any example subagent data:
Assistant
Let me also confirm the symlink test still works:
Assistant
Now let me also create a more thorough test for the edge cases I want to verify (temporarily, then I'll remove it):
Assistant
All tests pass. Let me clean up the temporary test file:
Assistant
Now let me also check if there's anything about the symlinks test I should worry about. Let me trace through
TestFindClaudeSourceFile_Symlinkwith my changes:Assistant
All existing tests pass. Now let me run the broader test suite to confirm nothing is broken:
Assistant
only failing test is the pre-existing
TestParseCortexSession_SplitHistoryReadErrorfailure which exists regardless of my changes. Let me look at the final diff:Assistant
The diff is clean. Let me also verify with
gofmt:Let me also verify withgofmt:]<]minimax[>[<tool_call> ]<]minimax[>[]<]minimax[>[cd /agentsview && gofmt -d internal/parser/discovery.go]<]minimax[>[]<]minimax[>[ ]<]minimax[>[</tool_call>Assistant
Let me continue with the verification
Assistant
Both
gofmtandgo vetpass. Let me also confirm by running the full test suite to verify nothing is broken elsewhere:Assistant
All relevant tests pass. Let me also check the git status one more time to make sure I haven't left any temporary files:
Assistant
Only the single target file is modified. Let me do a final verification by examining the final code once more:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.