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:<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.meta.json(agentType: workflow-subagent) is available alongside each transcript if the workflow grouping is worth surfacing in the UI.Interface
No new interfaces are introduced.
- Assistant
Now let me check the watcher and the existing tests:
- Assistant
Now add the two helpers after
DiscoverClaudeProjects: - Assistant
2.
FindClaudeSourceFile— search nested subagent dirs: - Assistant
3.
engine.goclassify — accept nested subagent paths: - Assistant
Now update the tests. First, add cases to the parser discovery tests:
- Assistant
Now check for existing classify tests in the sync package:
- Assistant
Add a classify test for the nested subagent layout:
- Assistant
Now build and run the relevant tests:
- Assistant
engine_integration_test.gois pre-existing unformatted and untouched by me — I'll leave it. Format only my test file: - Assistant
Now run the full test suites for both changed packages:
- Assistant
The fix is complete. Deep-research/workflow subagent transcripts nested under
subagents/workflows/<wf_id>/are now discovered, classified by the file watcher, and locatable for single-session re-sync.Changes
internal/parser/discovery.goDiscoverClaudeProjectsnow walks each session'ssubagents/directory recursively via a newcollectClaudeSubagentFileshelper, instead of skipping directory entries at the top level. Anyagent-*.jsonlfound at any depth (e.g.subagents/workflows/<wf_id>/agent-<id>.jsonl) is discovered;agent-*.meta.jsonand non-agent-files are still excluded. Symlinked directories are not followed to avoid cycles.FindClaudeSourceFileuses a newfindClaudeSubagentFilehelper that checks the directsubagents/<target>path first (fast path, matches old behavior) and then descends into nested directories, soagentsview sync <agent-id>and source-file lookups work for workflow subagents.
internal/sync/engine.goclassifyOnePath(watcher-event classification) now acceptsproject/session/subagents/.../agent-*.jsonlat any depth (len(parts) >= 4 && parts[2] == "subagents", filename check moved to the last path component), so live fsnotify events for workflow transcripts sync in real time. The watcher already auto-adds newly created directories, so the nestedworkflows/<wf_id>/dirs get watched as they appear.- Fixed the single-session project fallback, which used
filepath.Base(filepath.Dir(path))— for subagent paths that yieldedsubagents(flat layout) or the workflow id (nested). It now derives the project from the path relative to the configured Claude dir.
No parser changes were needed: session ID comes from the filename and parent linkage from the
sessionIdfield plusisSidechain, both depth-independent.Tests
TestDiscoverClaudeProjects/WorkflowSubagents— nested transcripts (including a deeper level) discovered,.meta.jsonand non-agent files excluded, project attribution correct.TestFindClaudeSourceFile/WorkflowSubagent— nested lookup by agent ID.TestEngine_ClassifyOnePathClaudeSubagents— table-driven: flat subagent, workflow subagent, meta.json rejected, non-agent JSONL rejected.
go build,go vet,gofmtclean; full./internal/syncand./internal/parsersuites pass, except pre-existingTestParseCortexSession_SplitHistoryReadError, which fails only because this environment runs as root (uid 0), so itschmod 0o000read-error setup can't take effect — unrelated to this change. Per the task constraints I've left the changes uncommitted;git diff --checkreports no issues.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- fable-5Compare side by side →