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:<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 () is available alongside each transcript if the workflow grouping is worth surfacing in the UI. - Assistant
I’ll inspect the repository and the Claude session discovery implementation, then trace its tests and data model. I’ll reproduce the shallow-discovery behavior with a temporary fixture, implement recursive discovery while preserving existing filtering/error behavior, run targeted and broader tests, and review the final diff before submitting.
- Assistant
The repository is Go-based, and the affected code is isolated in
internal/parser/discovery.go; existing tests already cover directsubagents/agent-*.jsonlfiles. I’ll now inspect the discovery function and its test fixture helpers to determine the safest recursive implementation and whether downstream path assumptions must also change. - Assistant
The same depth assumption exists in
FindClaudeSourceFile, which is used later to resolve a discovered session’s source path. I’ll update both discovery and source lookup via one bounded recursive walker rooted at each session’ssubagentsdirectory. It will recurse only through directories undersubagents, retain the existingagent-*.jsonlfilter, ignore unreadable directories, and avoid following symlinked directories just as the currentDirEntry.IsDir()logic does. - Assistant
The implementation now recursively visits matching files and keeps the original lexical filtering and deterministic final sort. I also extended source lookup so a nested workflow transcript can be resolved, not merely listed. Next I’ll run the parser tests and a temporary focused test fixture that verifies both direct and
workflows/<id>paths, then remove that temporary file. - Assistant
The temporary test could not execute because this environment has neither
GOMODCACHEnorGOPATHconfigured, so Go cannot locate dependencies. The temporary test file was removed successfully. I’ll configure isolated cache directories outside the repository, download the declared modules if network access permits, and rerun the targeted and package tests without changing repository tests. - Assistant
Dependency resolution progressed, but Go also requires a build cache and this shell has no
HOMEor cache variable. I’ll provide isolatedHOMEandGOCACHEpaths under/tmpand rerun the same validation. - Assistant
The targeted existing discovery/source tests pass. The full parser package reaches an unrelated pre-existing failure (
TestParseCortexSession_SplitHistoryReadError, expected non-ENOENT read error but got nil); the failure is outside this change. I’ll now execute the temporary nested fixture under the configured Go environment, remove it, and inspect the final diff and repository state.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.