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 tests, then trace how subagent metadata and paths are handled. I’ll implement recursive discovery with the narrowest compatible change, run the relevant test suite (and a focused reproduction if useful), review the diff, and submit only after verification.
- Assistant
The relevant loop is exactly the reported shallow scan. I’m checking
FindClaudeSourceFileand downstream assumptions too, because discovery alone may not be sufficient if selecting/opening a nested transcript reconstructs only the old one-level path. - Assistant
There are two additional shallow assumptions that would affect real use:
FindClaudeSourceFileresolves anagent-*ID using the old direct path, and live path classification accepts only exactly four relative components. I’ll update all three paths consistently. The existing “nested Claude path” rejection remains valid because it is outsidesubagents; only descendants withinsubagentswill be accepted. - Assistant
The first edit revealed the old
os.ReadDirresult is no longer needed after switching toWalkDir; I’m removing that redundant read before compiling. I’ll also verify nested discovery, source lookup, and live classification through temporary checks plus the repository’s parser/sync tests (without modifying tests). - Assistant
The code formats cleanly, but tests cannot start because this environment has neither
GOMODCACHEnorGOPATHconfigured, so Go cannot locate its module cache. I’ll inspect the module setup and available dependencies, then run with an appropriate temporary cache or document the environmental limitation if dependencies are unavailable. - Assistant
With the required Go environment variables set, the affected sync package passes. The parser package reaches an unrelated pre-existing filesystem-permission test failure (
TestParseCortexSession_SplitHistoryReadError), while I’ll run the discovery/source tests specifically and perform a direct nested-path reproduction. - Assistant
The focused discovery and source-resolution tests pass, and a direct reproduction confirms a transcript at
subagents/workflows/<wf>/agent-deep.jsonlis both discovered and resolvable. The full sync package also passes; the full parser package is blocked only by the unrelated Cortex permission-test behavior noted above. I’m doing the final diff/format checks now.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.