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 repository structure and the Claude discovery implementation/tests, then reproduce the depth limitation with the existing test conventions before making a focused recursive-discovery change.
- Assistant
The implementation confirms the reported behavior: it reads only immediate children of each
subagentsdirectory and explicitly discards directories. I’ll inspect the surrounding discovery tests and helper semantics (especially symlink/error handling) so recursion preserves existing behavior and ordering. - Assistant
Existing tests cover only direct subagents, and the repository already uses
filepath.WalkDir. To explicitly reproduce without altering tests, I’ll create a temporary in-repository executable that builds the workflow nesting, calls the public discovery function, and reports discovered relative paths; I’ll remove it after validating the fix. - Assistant
The temporary reproducer used an outdated guessed module path. I’ll read
go.mod, update that import, and rerun it to establish the pre-fix result. - Assistant
Go is available but this environment has neither
GOMODCACHEnorGOPATHconfigured. I’ll pointGOPATHat a temporary writable cache and rerun; this is environment setup only and won’t change repository files. - Assistant
The shell also lacks a home/build-cache location. I’ll provide a temporary
GOCACHEas well and rerun the baseline reproducer. - Assistant
The baseline discovers the parent and direct child but omits the workflow child, reproducing the issue. I’ll replace the one-level
ReadDirloop with a best-effort recursiveWalkDir, retaining the exact filename filter, project/agent metadata, non-following symlink behavior, and final deterministic sort. Filesystem errors remain non-fatal as before. - Assistant
The same reproducer now finds the nested workflow transcript while preserving the direct transcript. I’ll remove the temporary executable, run the parser package tests (which include Claude discovery), then run the broader Go test suite if that passes.
- Assistant
The parser suite compiled, but one unrelated Cortex permission test failed because it expects a read error that privileged/root execution does not produce; no discovery test failed. I’ll run the Claude discovery test in isolation, then inspect call sites and run Go vet to catch API or static issues introduced by the change.
- Assistant
The focused discovery test and
go vetpass, and discovery is wired through this single function. I’ll run the complete Go test suite to check downstream sync/import behavior; I expect the already-observed root-sensitive Cortex test may remain the only failure. - Assistant
The full suite shows all downstream packages relevant to discovery (
sync,importer,server, etc.) passing. Most failures are solely because$HOMEis absent, plus the known root-sensitive Cortex permission case. I’ll rerun with a temporary home directory to eliminate the environment-only home failures and verify that Cortex is the sole remaining exception, then review the final diff. - Assistant
With
$HOMEconfigured, every package passes except the unrelated Cortex test whose chmod-based expectation cannot hold when tests run as root. I’ll now check repository-specific contribution guidance, whitespace, and the exact final diff/status before submission. - Assistant
Repository guidance asks for
go fmt ./...andgo vet ./...; I already formatted the edited file and vetted its package, but I’ll run both repository-wide now. I will not add a unit test because the higher-priority task instructions explicitly prohibit adding or modifying tests; the temporary reproducer supplied equivalent before/after validation and has been removed. - Assistant
go fmt ./...unexpectedly reformatted an existing integration test, creating an unrelated/test-file change that must not be submitted. I’ll inspect that diff to ensure it is formatting-only, then restore only that file while retaining the discovery fix. - Assistant
The unrelated formatting change is restored. One integration test name indicates generic nested Claude files are intentionally rejected, so I’ll verify that its path-validation rule explicitly permits files under
subagentsat arbitrary depth; otherwise discovery alone would find workflow files but sync could still discard them. - Assistant
This reveals a second path-depth assumption in sync routing: Claude files are accepted only when the relative path has exactly four components (
project/session/subagents/file). Recursive discovery would therefore still fail end-to-end. I’ll inspect all Claude path classification/filtering code and update only the subagent shape checks to acceptproject/session/subagents/.../agent-*.jsonl, while continuing to reject unrelated nested project files and non-agent names. - Assistant
Only
classifyOnePathenforces the exact Claude subagent depth for watcher/SyncPaths; bulk discovery itself carries the correct project metadata. I’ll change that check to require at least four components,subagentsat component 3, and anagent-*.jsonlbasename at the final component. This allows workflow grouping at any depth without relaxing the top-level nested-session rejection. I’ll also update its comment to document the recursive shape. - Assistant
The watcher path classifier now matches recursive discovery while preserving filename and location constraints. I’ll validate both affected packages with all Claude-focused tests, run the full sync package, and rerun repository-wide vet.
- Assistant
Validation passes for Claude discovery, all Claude sync tests, the entire sync package, and repository-wide vet. Before submitting, I’ll perform one final diff/status check to ensure only the two production files are changed and no temporary artifacts or test edits remain.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.