Skip to content
TheChatArchiveThe Chat Archive
fable-5· unknownHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

Deep-research / workflow subagent transcripts aren't discovered (nested under…

  1. User

    Deep-research / workflow subagent transcripts aren't discovered (nested under subagents/workflows/)

    What I was doing

    Running Claude Code's /deep-research a 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. DiscoverClaudeSessions looks for subagent transcripts exactly one level down:

    <project>/<session>/subagents/agent-<id>.jsonl
    

    and 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>.jsonl
    

    subagents/ here contains only the workflows/ directory, which the loop skips — so the entire tree underneath is never discovered. Each transcript carries isSidechain: true and an accompanying agent-<id>.meta.json whose agentType is workflow-subagent.

    Concretely, in one session three /deep-research runs produced 312 agent-*.jsonl files under subagents/workflows/, and zero directly under subagents/. 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 into subagents/workflows/<wf_id>/) instead of only reading its top level, and treat agent-*.jsonl found anywhere beneath it the same way. The .meta.json (agentType: workflow-subagent) is available alongside each transcript if the workflow grouping is worth surfacing in the UI.

    Interface

    No new interfaces are introduced.

  2. Assistant

    Now let me check the watcher and the existing tests:

  3. Assistant

    Now add the two helpers after DiscoverClaudeProjects:

  4. Assistant

    2. FindClaudeSourceFile — search nested subagent dirs:

  5. Assistant

    3. engine.go classify — accept nested subagent paths:

  6. Assistant

    Now update the tests. First, add cases to the parser discovery tests:

  7. Assistant

    Now check for existing classify tests in the sync package:

  8. Assistant

    Add a classify test for the nested subagent layout:

  9. Assistant

    Now build and run the relevant tests:

  10. Assistant

    engine_integration_test.go is pre-existing unformatted and untouched by me — I'll leave it. Format only my test file:

  11. Assistant

    Now run the full test suites for both changed packages:

  12. Assistant

    The fix is complete. Deep-research/workflow subagent transcripts nested under subagents/workflows/<wf_id>/ are now discovered, classified by the file watcher, and locatable for single-session re-sync.

    Changes

    internal/parser/discovery.go

    • DiscoverClaudeProjects now walks each session's subagents/ directory recursively via a new collectClaudeSubagentFiles helper, instead of skipping directory entries at the top level. Any agent-*.jsonl found at any depth (e.g. subagents/workflows/<wf_id>/agent-<id>.jsonl) is discovered; agent-*.meta.json and non-agent- files are still excluded. Symlinked directories are not followed to avoid cycles.
    • FindClaudeSourceFile uses a new findClaudeSubagentFile helper that checks the direct subagents/<target> path first (fast path, matches old behavior) and then descends into nested directories, so agentsview sync <agent-id> and source-file lookups work for workflow subagents.

    internal/sync/engine.go

    • classifyOnePath (watcher-event classification) now accepts project/session/subagents/.../agent-*.jsonl at any depth (len(parts) >= 4 && parts[2] == "subagents", filename check moved to the last path component), so live fsnotify events for workflow transcripts sync in real time. The watcher already auto-adds newly created directories, so the nested workflows/<wf_id>/ dirs get watched as they appear.
    • Fixed the single-session project fallback, which used filepath.Base(filepath.Dir(path)) — for subagent paths that yielded subagents (flat layout) or the workflow id (nested). It now derives the project from the path relative to the configured Claude dir.

    No parser changes were needed: session ID comes from the filename and parent linkage from the sessionId field plus isSidechain, both depth-independent.

    Tests

    • TestDiscoverClaudeProjects/WorkflowSubagents — nested transcripts (including a deeper level) discovered, .meta.json and non-agent files excluded, project attribution correct.
    • TestFindClaudeSourceFile/WorkflowSubagent — nested lookup by agent ID.
    • TestEngine_ClassifyOnePathClaudeSubagents — table-driven: flat subagent, workflow subagent, meta.json rejected, non-agent JSONL rejected.

    go build, go vet, gofmt clean; full ./internal/sync and ./internal/parser suites pass, except pre-existing TestParseCortexSession_SplitHistoryReadError, which fails only because this environment runs as root (uid 0), so its chmod 0o000 read-error setup can't take effect — unrelated to this change. Per the task constraints I've left the changes uncommitted; git diff --check reports no issues.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.