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
I’ll inspect the discovery implementation and its existing tests first, then reproduce the nested-directory omission with the project’s test conventions before making a minimal recursive-discovery change.
- Assistant
The omission is confirmed in
DiscoverClaudeProjects, but nested paths may also affect source lookup and sync metadata extraction. I’ll inspect those call paths and the focused parser tests so the fix works end-to-end rather than merely returning a nested filename. - Assistant
There are three depth assumptions for Claude: initial discovery, incremental watcher classification, and source-file lookup. I’ll update all three consistently. The recursive walk will stay confined beneath each recognized session’s
subagentsdirectory, accept only regularagent-*.jsonlentries, tolerate unreadable subtrees, and avoid following directory symlinks (preventing cycles and escaping the tree), matchingfilepath.WalkDirsemantics. - Assistant
I’ll now add a shared nested-subagent walker and use it in discovery and lookup, then broaden only the Claude subagent branch in incremental path classification (
parts[2] == "subagents"with any deeper path). Standard nested JSONL files outsidesubagentswill remain rejected. - Assistant
The code changes are in place. I’ll verify the exact reported layout with a temporary external Go program (not a repository test), including ignored metadata/non-agent files and nested source lookup, then run the focused parser and sync test packages.
- Assistant
The first verification attempt was blocked by the environment having both
GOPATHandGOMODCACHEunset, not by the code. I’ll rerun with an isolated/tmpGo cache and place the temporary program under the module tree so Go’sinternalimport rule is satisfied; it will be removed immediately afterward. - Assistant
The exact nested workflow reproduction now passes: both workflow transcripts are found, irrelevant
.meta.json/non-agent JSONL files are ignored, and nested source lookup succeeds. The sync package passes. The full parser package has one unrelated permission-based test failure (TestParseCortexSession_SplitHistoryReadError), likely because this container runs with elevated permissions; I’ll run the directly affected discovery/lookup tests and inspect the final diff for unintended changes. - Assistant
To satisfy the reported-error checklist rigorously, I’ll also run the same temporary reproducer against an untouched
HEADworktree. This will demonstrate the pre-fix failure directly (rather than relying only on code inspection), after which I’ll remove the worktree and do a final status check.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.