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 and locating the discovery code that skips nested workflow subagent transcripts.
- Assistant
I'll inspect the discovery code around the subagents loop and related tests.
- Assistant
Let me read the relevant section of discovery.go around lines 349-390.
- Assistant
There's another path-resolution path around line 461 — I'll inspect that and the existing subagent tests next.
- Assistant
I'll read the DiscoverClaudeProjects tests and check for recursive-walk helpers already in the codebase.
- Assistant
I'll check FindClaudeSourceFile tests and project coding guidelines next.
- Assistant
I'll check session ID validation and how discovery is used so nested workflow agents resolve correctly.
- Assistant
Let me look at IsValidSessionID and maybe cursor's nested layout handling for patterns to follow.
- Assistant
I'll scan for walk helpers and line-length conventions so the fix matches local style.
- Assistant
I'll implement recursive discovery of nested workflow subagent transcripts and update
FindClaudeSourceFileto match. - Assistant
I need the discovery code in the editor window before applying the edit.
- Assistant
Now I can edit.
- Assistant
Updating
FindClaudeSourceFileto also search nested workflow subagent paths. - Assistant
Note FindClaudeSourceFile uses
if !entry.IsDir()rather than isDirOrSymlink for the subagent branch. I'll keep that consistent. - Assistant
I'll write a temporary script to reproduce the bug and confirm the fix, then run the existing discovery tests.
- Assistant
I'll fix the module path in the temporary verification script and run it.
- Assistant
I'll put a temporary test inside the parser package, run it, then delete it.
- Assistant
Need to set GOPATH/GOMODCACHE.
- Assistant
Removing the temporary test and running gofmt plus the full parser discovery suite.
- Assistant
That failure looks unrelated — I'll confirm cortex isn't affected by this change and spot-check the rest of the suite.
- Assistant
Cleaning up leftovers, then submitting.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.