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 repository and the discovery implementation/tests first, then trace how subagent files are parsed so the recursive change preserves existing metadata, deduplication, and error behavior. I’ll run the focused tests before and after the fix, add no repository tests, and use a temporary reproduction if the existing coverage does not expose the nested layout.
- Assistant
The relevant code is in
internal/parser/discovery.go; sync also has path-shape assumptions, so I’ll inspect both discovery and downstream sync handling before editing. The issue specifically concerns discovery, but nested files must also remain importable and synchronizable rather than merely being listed. - Assistant
The direct discovery loop is confirmed to skip directories. Two related functions also assume exactly four relative path components:
FindClaudeSourceFile(used for lookup) and sync path classification (used for filesystem event/import paths). I’ll make all three accept arbitrary depth belowsubagents, while retaining the strictagent-*.jsonlfilename rule and rejecting unrelated nested JSONL files. - Assistant
I’ll implement recursion with
filepath.WalkDirrooted at each session’ssubagentsdirectory. This preserves the existing project/session discovery boundary, does not follow directory symlinks implicitly, and filters every visited file by the sameagent-plus.jsonlrule. I’ll update source lookup and sync classification to recognize any depth undersubagents, including the workflow layout. - Assistant
The first edit command failed before writing because of a temporary script syntax error; the repository remains unchanged. I’ll rerun the edit with a simpler replacement script and then verify the diff immediately.
- Assistant
The recursive discovery and lookup changes are now applied, and sync classification uses the basename so nested workflow IDs do not affect agent detection. I’ll check the Go version compatibility and run parser plus sync tests; then I’ll use a temporary nested-layout probe to verify both discovery and source lookup concretely.
- Assistant
The focused tests could not start because this environment has neither
GOMODCACHEnorGOPATH, so dependencies are unavailable; this is an environment issue rather than a test failure. Since the module declares Go 1.26.3,filepath.WalkDirandfilepath.SkipAllare compatible. I’ll try the repository’s dependency download path, then inspect formatting and run whatever validation is possible. - Assistant
Dependency download completed successfully into a temporary cache, and
git diff --checkreports no whitespace errors. I’ll rerun the focused tests with that cache and then perform a direct temporary Go probe against the changed parser functions using a nestedsubagents/workflows/<id>tree. - Assistant
The rerun reached a second environment limitation: no
HOME/GOCACHEis configured. I’ll set a temporary build cache and rerun; no source changes are needed for this issue. - Assistant
The focused run compiled the changes: sync and db pass, while parser has one unrelated pre-existing failure (
TestParseCortexSession_SplitHistoryReadError), unrelated to Claude discovery. I’ll now verify the exact nested layout with a temporary standalone Go program (outside the repository), and inspect the final diff for edge cases such as non-agent files and source lookup behavior. - Assistant
The temporary probe confirms a nested workflow transcript is discovered and
FindClaudeSourceFileresolves it, while the.meta.jsonand unrelated JSONL are excluded. I’ll run the directly affected parser tests separately (to demonstrate they pass despite the unrelated parser failure), rerun sync tests, and review the final diff.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.