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 start by exploring the repository structure and locating the discovery code that skips nested workflow subagent transcripts.
- Assistant
Let me find the discovery.go file and explore more.
- Assistant
Let me read the discovery.go file, especially around the subagents section.
- Assistant
I need to find the DiscoverClaudeSessions function and the subagents loop.
- Assistant
Let me read around lines 300-400 in discovery.go for the Claude sessions discovery.
- Assistant
There's also related lookup logic around line 461 — I'll inspect that along with the existing tests.
- Assistant
I'll inspect the discovery tests and other places that deal with Claude subagent paths.
- Assistant
There's matching path-shape logic in the sync engine; I'll inspect that next.
- Assistant
There's another classifier around line 5590 — I'll check that and scan for other subagent path assumptions.
- Assistant
I'll check how Claude session IDs are derived from paths and how FindClaudeSourceFile is used.
- Assistant
Next I'll check how Claude session IDs are pulled from paths, and skim AGENTS.md for conventions.
- Assistant
I'll check how parent session IDs are set for Claude subagents and how path matching is tested in the engine.
- Assistant
I'll check the file watcher and any other path-shape checks that might reject nested workflow subagents.
- Assistant
I'll look for existing recursive walk helpers and review the Cursor nested-layout pattern for reference.
- Assistant
Checking session-ID validation and whether meta.json is used anywhere.
- Assistant
Checking Engine.FindSourceFile and coding style conventions next.
- Assistant
Checking whether the file watcher limits depth and would miss nested workflow directories.
- Assistant
I have a clear plan: walk
subagents/recursively in discovery/FindSource, and accept nested workflow paths in the sync classifier. Implementing that now. - Assistant
The edit landed in the wrong file — reverting watcher.go and applying the change to discovery.go.
- Assistant
Applying the discovery.go edit with an explicit file path.
- Assistant
Updating FindClaudeSourceFile to search nested workflow subagent paths.
- Assistant
I'll update FindClaudeSourceFile and add the helper near it.
- Assistant
Updating path classification in the sync engine next.
- Assistant
Removing leftover braces from the engine.go edit.
- Assistant
Verifying the build and running a quick reproduction script for nested workflow discovery.
- Assistant
Setting Go module cache paths, then rebuilding.
- Assistant
I'll write a temporary reproduction script next, then run it to confirm the fix.
- Assistant
Discovery looks good — next I'll cover sync path classification.
- Assistant
I'll add a temporary end-to-end sync test for nested workflow subagents next.
- Assistant
I'll write a full end-to-end sync test in package
sync_test. - Assistant
Removing temporary tests and running the existing related suite.
- Assistant
Reviewing the final diff for cleanliness.
- Assistant
Reverting unrelated gofmt changes in the integration test file.
- Assistant
Checking TestSyncPathsClaudeRejectsNested so we don't break its path rules.
- Assistant
Running a final focused test pass before submit.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.