Deep-research / workflow subagent transcripts aren't discovered (nested under…
- User
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 trace Claude discovery and its tests, then implement recursive subagent discovery with focused coverage. I’ll also honor the repository’s required commit despite the broader environment’s default no-commit rule, since the repo-specific instruction is explicit.
- Assistant
The same one-level assumption also exists in source-file lookup, which is used after import to locate original transcripts. I’m updating both discovery and lookup so nested workflow sessions remain fully usable, while keeping matching restricted to
agent-*.jsonlbeneath each session’ssubagentstree. - Assistant
The production change is in place and formatted. I’m running the parser test suite now, then I’ll exercise the exact nested workflow layout and run the required vet/diff checks.
- Assistant
Focused regression tests pass, and vet/diff checks completed.
go fmt ./...also touched an unrelated pre-existing test file; I’m isolating that formatter-only change now so the final diff contains only this fix and its regression coverage. - Assistant
A second path gate would have rejected these nested files during live filesystem events even after bulk discovery was fixed. I’ve aligned that classifier too and added coverage for direct workflow-subagent syncing, so both periodic/full sync and real-time updates accept the layout.
- Assistant
The focused suites pass. The repository-wide short suite reached an unrelated existing failure in
TestParseCortexSession_SplitHistoryReadError(its expected permission/read error is nil in this environment); I’m completing the unaffected sync suite and final cleanliness checks separately.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.