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 discovery loop has the reported one-level assumption. I also found sync path-shape checks that may reject or misclassify the newly discovered nested files, so I’ll inspect those call paths and existing discovery/integration tests to ensure the fix works end-to-end rather than merely returning extra paths.
- Assistant
There are three behaviors to align: bulk discovery, incremental
SyncPathsclassification, andFindSourceFile. The parser itself likely derives parent/session information from path ancestry, so I’ll verify that next and run a temporary standalone reproduction (removed afterward) showing nested workflow files are currently omitted. - Assistant
The parser identifies each transcript by filename and reads
sessionIdfrom its contents, so nested workflow grouping does not require parser changes. I’ll implement a shared error-tolerant recursive walker under eachsubagents/tree, use it for discovery and source lookup, and broaden only the guarded ClaudeSyncPathsshape (project/session/subagents/**/agent-*.jsonl). This preserves rejection of unrelated nested JSONL files.The first reproduction command was blocked by an unusual empty Go cache environment, but the fixture itself was removed. I’ll check repository tooling/environment and then edit the source.
- Assistant
The source finder prefers the database’s exact stored path, but its fallback should still support nested files, especially after moves/reimports. I’ll now apply the focused changes in
discovery.goandengine.go, then format and inspect the diff. - Assistant
The diff is narrow and preserves filename filtering at every depth. One optimization remains: the source lookup currently walks the full tree even after finding a match because the callback cannot stop. I’ll change the helper callback to return a continuation boolean, allowing early termination while retaining tolerant traversal, then configure a temporary Go cache and run the reproduction plus affected test packages.
- Assistant
Go and the module cache are present; only
GOPATH/HOMEwere unset in the shell. I’ll set them per command, run a temporary fixture against the fixed code to confirm nested discovery and source lookup, remove it, then run parser and sync tests (the directly affected packages). - Assistant
The nested fixture now discovers exactly the valid
agent-*.jsonland resolves it through fallback lookup. The full sync package passes. The parser package has one unrelated permission test failure (Cortexexpects an unreadable file error, but tests run as root so chmod does not make it unreadable); I’ll run the directly affected parser tests separately, update the helper comment to document early stopping, and run broader compile/tests to catch regressions. - Assistant
All affected focused tests pass, the entire sync package passed, and all internal packages compile. I’ll make the before/after reproduction explicit by running the same temporary fixture against an untouched
HEADworktree (expected 0) and the modified tree (already observed 1), then remove the worktree and perform the final status check.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.