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 discovery implementation and its tests, then trace how subagent paths are converted into sessions so recursive traversal preserves existing behavior and avoids duplicates. I’ll implement the smallest compatible change, add no repository tests per instruction, run the affected test suite, and review the diff.
- Assistant
The relevant code is in
internal/parser/discovery.go; current tests cover only directsubagentsfiles. I’ll now inspect the complete Claude discovery and source lookup functions, including symlink conventions and session ID validation, because a recursive implementation should not accidentally follow arbitrary symlink trees or alter lookup semantics. - Assistant
This repository names the function
DiscoverClaudeProjects. The discovery path is confined to each session’ssubagentsdirectory, whileFindClaudeSourceFilealso has a separate direct-child lookup that likely must be updated; otherwise discovered nested sessions could not be reopened or watched consistently. I’ll inspect the remainder of that lookup and all callers before editing. - Assistant
The sync layer also explicitly recognizes only the four-component direct layout, so merely changing discovery would still risk dropping nested files during path filtering and source resolution. I’ll inspect those exact conditions and determine whether they are generic Claude handling or shared with another agent format, then update only the Claude path logic needed for recursive workflow files.
- Assistant
The required changes are now clear: recursively walk each
subagentstree for discovery and source lookup, and accept any relative path shaped asproject/session/subagents/.../agent-*.jsonlin sync classification/project extraction. I’ll usefilepath.WalkDir, which descends real directories but does not follow symlinked directories, matching the repository’s conservative filesystem behavior. - Assistant
The parser now discovers and resolves nested files, including direct files and workflow-grouped files. I’ll update the sync classifier’s Claude branch so incremental filesystem events are classified the same way; this is important for newly created workflow transcripts, not just bulk discovery. I’ll leave WorkBuddy’s separate fixed-layout logic unchanged.
- Assistant
The diff now covers bulk discovery, source lookup, and incremental sync classification. The recursive walk filters only regular/non-directory entries whose names are
agent-*.jsonl, so.meta.jsonfiles and unrelated JSONL files remain excluded; sorting still provides deterministic output. I’ll run the parser and sync tests, then a broader test run if those pass. - Assistant
The code tests did not start because the environment has neither
GOMODCACHEnorGOPATHconfigured, rather than because of a test failure. I’ll inspect the module configuration and available cache, configure a temporary cache location if dependencies are available, and retry; I’ll also perform a focused temporary runtime check if the full Go dependency setup remains unavailable. - Assistant
The dependencies are present in
/root/go/pkg/mod; the retry was blocked only by another unset environment variable (HOME/GOCACHE). I’ll set explicit Go cache and home directories and rerun the affected tests followed by the full suite. - Assistant
The affected sync package passes. The parser package has one pre-existing/environment-sensitive failure (
TestParseCortexSession_SplitHistoryReadError, expected non-ENOENT error but got nil), unrelated to these files; all other parser tests ran. I’ll now run the specific discovery/source tests and a temporary end-to-end check for a nested workflow path, then inspect formatting and final diff. - Assistant
The focused tests pass, and the temporary check confirms both recursive discovery and
FindClaudeSourceFilereturn the nested workflow transcript.git diff --checkis clean, and the temporary file was removed. The final changes are limited to Claude discovery/source lookup and Claude incremental path classification; no tests were modified or added. I’ll submit now.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.