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.meta.json(agentType: workflow-subagent) is available alongside each transcript if the workflow grouping is worth surfacing in the UI.ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- If an error was reported in the issue description, I have successfully reproduced it.
- If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- I have thought about edge cases and made sure my fix handles them as well.
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /agentsview, current file: none) bash-$
- Assistant
I’ll first inspect the repository structure and the Claude discovery implementation/tests, then reproduce the depth limitation with the existing test conventions before making the smallest recursive-discovery change.
- Assistant
The discovery loop has the reported one-level assumption. I also see sync logic documenting and parsing the same exact layout, so recursive discovery alone may find files but misclassify their session identity. I’ll inspect both discovery tests and downstream path interpretation to ensure nested workflow transcripts are not merely enumerated but actually imported correctly.
- Assistant
There are three relevant code paths: initial full discovery, lookup of a Claude source file (used by resume/source resolution), and incremental filesystem-event classification. A watcher setup also appears depth-sensitive. I’ll inspect watcher registration and Claude parsing assumptions, then use a temporary in-repo program (removed afterward) to demonstrate that nested files currently return zero discoveries.
- Assistant
The shown watcher section is event handling rather than registration; Claude events use
classifyOnePath, which definitely rejects nested paths today. Parsing itself derives the agent ID from the filename and accepts arbitrary location, so no parser change is needed. I’ll locate watch registration and create/run the focused reproduction now. - Assistant
The reproduction could not compile because this environment has both
GOMODCACHEandGOPATHunset, an environment configuration issue rather than a repository failure. I’ll rerun with a temporary GOPATH, then inspect watcher code around the event classification call and determine whether recursive directory registration is delegated to the watcher implementation. - Assistant
A second missing environment variable (
GOCACHE) prevented compilation; I’ll set both explicitly. The sync engine receives a list of changed paths and classifies each, so broadening that classifier is necessary for nested workflow files whenever the external watcher reports them. Next I’ll inspect the caller and existing classifier tests to preserve path-security and filename filtering behavior. - Assistant
The focused reproduction confirms both failures exactly:
discovered=0and no source path. I’ll implement a shared recursive walker rooted only at each<project>/<session>/subagentsdirectory, retaining the strictagent-*.jsonlbasename filter. I’ll also broaden incremental classification from exactly four components to any depth beneathsubagents, while retaining project/session structure checks. Before editing, I’m checking whether the later single-file sync path overwrites the correctly classified project. - Assistant
The later branch is only explicit “sync one session” logic; full and incremental discovery preserve
DiscoveredFile.Project. However, once nested source lookup succeeds, an explicit first-time sync would otherwise infer the workflow ID as the project. I’ll make that branch derive the project from the configured Claude root (falling back to legacy behavior), so all entry points handle nested transcripts consistently. - Assistant
The implementation now recursively discovers only matching transcript basenames, does not follow directory symlinks, ignores unreadable/missing subtrees like the prior code, and preserves deterministic traversal/sorting. I’ll rerun the same reproduction unchanged to confirm discovery and source lookup, then run the parser and sync test packages under the required temporary Go cache environment.
- Assistant
The reproduction now discovers exactly one valid nested transcript, ignores the adjacent metadata/non-agent JSONL, resolves it by session ID, and assigns the correct project. Sync tests pass. The full parser package has one unrelated permission-semantics failure (
TestParseCortexSession_SplitHistoryReadError) because tests run as root in this container; I’ll run the directly affected parser tests separately, then lint/check the diff and repository status for temporary artifacts. - Assistant
Targeted Claude discovery/source tests pass, the entire sync package passes,
go vetreports no issues, andgit diff --checkis clean. I’ll do one final repository-wide test run to catch downstream compilation/regressions; based on the prior parser run, I expect only the known root-permission Cortex test may fail. Then I’ll review the final diff and checklist before submission.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
- xiaomi/mimo-v2.5-proCompare side by side →
- xiaomi/mimo-v2.5-proCompare side by side →
- xiaomi/mimo-v2.5-proCompare side by side →
- xiaomi/mimo-v2.5-proCompare side by side →
- xiaomi/mimo-v2.5-proCompare side by side →
- gpt-5.6-solCompare side by side →