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 inspect the repository and the discovery implementation first, then trace its tests and data structures. I’ll reproduce the missed nested-path behavior with a temporary fixture or focused test command, implement recursive discovery without changing existing tests, run the relevant test suite, review the diff, and submit only once verification is complete.
pwd && git status --short && find . -maxdepth 2 -type f | sort | sed -n '1,160p' && grep -R "DiscoverClaudeSessions" -n . --exclude-dir=.git - Assistant
The initial combined command stopped at the search because the symbol was not found in the first pass (the repository is larger than the shallow file listing). I’ll locate the parser files directly and inspect the relevant discovery code and tests, allowing the search to continue even if one probe has no matches.
find . -path '*/internal/parser/*' -type f -maxdepth 6 -print; grep -R "DiscoverClaude\|subagents\|agent-" -n internal . --include='*.go' 2>/dev/null | head -240 - Assistant
The issue is in
internal/parser/discovery.go, and the existing discovery tests already cover direct subagents. I’ll inspect the exact loop plus how discovered paths are represented and whether downstream code assumes the parent directory is exactlysubagents; this determines whether a minimal recursive walk is sufficient or whether path reconstruction/filtering also needs adjustment.sed -n '290,390p' internal/parser/discovery.go; sed -n '430,500p' internal/parser/discovery.go; sed -n '1,145p' internal/parser/discovery_test.go; grep -R "DiscoverClaudeProjects\|ParseClaudeSession\|subagents.*filepath.Base\|filepath.Base.*subagents" -n internal/parser --include='*.go' - Assistant
The parser only uses the basename for the subagent session ID, so nested workflow directories do not require special metadata handling. However,
FindClaudeSourceFilehas the same one-level assumption and would fail to locate a discovered nested transcript later, so I’ll fix both discovery and source lookup through one recursive helper. The helper will recurse beneath each session’ssubagentsdirectory, include only regularagent-*.jsonlfiles, and preserve the existing behavior of ignoring unrelated files/directories.python3 - <<'PY' from pathlib import Path p = Path("internal/parser/discovery.go") s = p.read_text() old = '''\t\t// Scan session directories for subagent files \t\tfor _, sf := range sessionFiles { \t\t\tif !sf.IsDir() { \t\t\t\tcontinue \t\t\t} \t\t\tsubagentsDir := filepath.Join( \t\t\t\tprojDir, sf.Name(), "subagents", \t\t\t) \t\t\tsubFiles, err := os.ReadDir(subagentsDir) \t\t\tif err != nil { \t\t\t\tcontinue \t\t\t} \t\t\tfor _, sub := range subFiles { \t\t\t\tif sub.IsDir() { \t\t\t\t\tcontinue \t\t\t\t} \t\t\tname := sub.Name() \t\t\t\tif !strings.HasPrefix(name, "agent-") || \t\t\t\t\t!strings.HasSuffix(name, ".jsonl") { \t\t\t\t\tcontinue \t\t\t\t} \t\t\t\tfiles = append(files, DiscoveredFile{ \t\t\t\t\tPath: filepath.Join( \t\t\t\t\t\tsubagentsDir, name, \t\t\t\t\t), \t\t\t\t\tProject: entry.Name(), \t\t\t\t\tAgent: AgentClaude, \t\t\t\t}) \t\t\t} \t\t} ''' new = '''\t\t// Scan session directories recursively for subagent files. Workflow \t\t// runs may group their transcripts below subagents/workflows/<id>/. \t\tfor _, sf := range sessionFiles { \t\t\tif !sf.IsDir() { \t\t\t\tcontinue \t\t\t} \t\t\tsubagentsDir := filepath.Join(projDir, sf.Name(), "subagents") \t\t\tfor _, path := range discoverClaudeSubagentFiles(subagentsDir) { \t\t\t\tfiles = append(files, DiscoveredFile{ \t\t\t\t\tPath: path, \t\t\t\t\tProject: entry.Name(), \t\t\t\t\tAgent: AgentClaude, \t\t\t\t}) \t\t\t} \t\t} ''' if old not in s: raise SystemExit("discovery block not found") s = s.replace(old, new) old2 = '''\t\t\tfor _, sd := range sessionDirs { \t\t\t\tif !sd.IsDir() { \t\t\t\t\tcontinue \t\t\t\t} \t\t\t\tcandidate := filepath.Join( \t\t\t\t\tprojDir, sd.Name(), \t\t\t\t\t"subagents", target, \t\t\t\t) \t\t\t\tif _, err := os.Stat(candidate); err == nil { \t\t\t\t\treturn candidate \t\t\t\t} \t\t\t} ''' new2 = '''\t\t\tfor _, sd := range sessionDirs { \t\t\t\tif !sd.IsDir() { \t\t\t\t\tcontinue \t\t\t\t} \t\t\t\tfor _, candidate := range discoverClaudeSubagentFiles( \t\t\t\t\tfilepath.Join(projDir, sd.Name(), "subagents"), \t\t\t\t) { \t\t\t\t\tif filepath.Base(candidate) == target { \t\t\t\t\t\treturn candidate \t\t\t\t\t} \t\t\t\t} \t\t\t} ''' if old2 not in s: raise SystemExit("source lookup block not found") s = s.replace(old2, new2) marker = '''// DiscoverCodexSessions finds all Codex JSONL session files under ''' helper = '''// discoverClaudeSubagentFiles returns agent transcripts at any depth below // subagents. Workflow runs use additional grouping directories there. func discoverClaudeSubagentFiles(root string) []string { \tvar files []string \terr := filepath.WalkDir(root, func(path string, d fs.DirEntry, err error) error { \t\tif err != nil { \t\t\tif d != nil && d.IsDir() { \t\t\t\treturn filepath.SkipDir \t\t\t} \t\t\treturn nil \t\t} \t\tif d.IsDir() { \t\t\treturn nil \t\t} \t\tname := d.Name() \t\tif strings.HasPrefix(name, "agent-") && \t\t\tstrings.HasSuffix(name, ".jsonl") { \t\t\tfiles = append(files, path) \t\t} \t\treturn nil \t}) \tif err != nil { \t\treturn nil \t} \treturn files } ''' if marker not in s: raise SystemExit("marker not found") s = s.replace(marker, helper + marker) p.write_text(s) PY gofmt -w internal/parser/discovery.go sed -n '1,35p' internal/parser/discovery.go; sed -n '335,410p' internal/parser/discovery.go; sed -n '465,510p' internal/parser/discovery.go - Assistant
The recursive helper is in place, but the first compile inspection exposed a required standard-library import (
io/fs) forfs.DirEntry. I’ll add it, then run the focused parser tests. I’ll also use a temporary standalone Go test fixture (outside the repository) to explicitly verify both a nested workflow transcript is discovered andFindClaudeSourceFileresolves it, without modifying repository tests.python3 - <<'PY' from pathlib import Path p = Path("internal/parser/discovery.go") s = p.read_text() s = s.replace('"fmt"\n', '"fmt"\n\t"io/fs"\n') p.write_text(s) PY gofmt -w internal/parser/discovery.go go test ./internal/parser -run 'TestDiscoverClaudeProjects|TestFindClaudeSourceFile' -count=1 - Assistant
The focused test command did not reach compilation because this environment has neither
GOPATHnorGOMODCACHEconfigured, rather than because of a code failure. I’ll inspect the Go environment and repository test conventions, configure a temporary cache location if needed, then rerun. Before that, I’ll verify the import and diff so no accidental edits are hidden by the setup issue.go env GOROOT GOPATH GOMODCACHE GO111MODULE; grep -n '"io/fs"\|discoverClaudeSubagentFiles' internal/parser/discovery.go; git diff --check; git diff -- internal/parser/discovery.go - Assistant
The diff is clean and limited to recursive Claude subagent handling plus the matching source lookup. I’ll now provide temporary Go module cache variables and run the parser tests; if dependencies need downloading, Go will use
/tmprather than altering the repository.mkdir -p /tmp/agentsview-gopath /tmp/agentsview-gomodcache GOPATH=/tmp/agentsview-gopath GOMODCACHE=/tmp/agentsview-gomodcache go test ./internal/parser -run 'TestDiscoverClaudeProjects|TestFindClaudeSourceFile' -count=1 - Assistant
The dependency download proceeded, but Go then reported the same environment issue for its build cache (
GOCACHEandHOMEare unset). I’ll set all caches to temporary directories and rerun the focused tests.mkdir -p /tmp/agentsview-gopath /tmp/agentsview-gomodcache /tmp/agentsview-gocache /tmp/agentsview-home HOME=/tmp/agentsview-home GOPATH=/tmp/agentsview-gopath GOMODCACHE=/tmp/agentsview-gomodcache GOCACHE=/tmp/agentsview-gocache go test ./internal/parser -run 'TestDiscoverClaudeProjects|TestFindClaudeSourceFile' -count=1 ```行 - Assistant
The focused existing tests pass. Since they only cover direct subagents, I’ll perform the requested explicit reproduction/confirmation with a temporary executable under the repository (so Go’s
internalimport rules allow it), creating a parent session and a nestedsubagents/workflows/<workflow>/agent-...jsonl, then asserting discovery and source lookup. The temporary file will be removed immediately afterward.tmpdir=$(mktemp -d ./tmp-claude-discovery-XXXXXX) cat > "$tmpdir/main.go" <<'EOF' package main import ( "fmt" "os" "path/filepath" "go.kenn.io/agentsview/internal/parser" ) func main() { root, err := os.MkdirTemp("", "claude-nested-") if err != nil { panic(err) } defer os.RemoveAll(root) nested := filepath.Join(root, "project", "parent-session", "subagents", "workflows", "workflow-1", "agent-nested.jsonl") if err := os.MkdirAll(filepath.Dir(nested), 0755); err != nil { panic(err) } if err := os.WriteFile(filepath.Join(root, "project", "parent-session.jsonl"), []byte("{}"), 0644); err != nil { panic(err) } if err := os.WriteFile(nested, []byte("{}"), 0644); err != nil { panic(err) } files := parser.DiscoverClaudeProjects(root) found := false for _, f := range files { if f.Path == nested { found = true } } if !found { panic("nested transcript was not discovered") } if got := parser.FindClaudeSourceFile(root, "agent-nested"); got != nested { panic(fmt.Sprintf("source lookup returned %q, want %q", got, nested)) } fmt.Printf("nested discovery and source lookup passed: %s\n", nested) } EOF HOME=/tmp/agentsview-home GOPATH=/tmp/agentsview-gopath GOMODCACHE=/tmp/agentsview-gomodcache GOCACHE=/tmp/agentsview-gocache go run "$tmpdir/main.go" rm -rf "$tmpdir" - Assistant
The temporary reproduction passed: the nested transcript is returned by discovery and found by source lookup. I’ll run the complete parser package tests now, then inspect status/diff and check for temporary files or formatting issues before submitting.
HOME=/tmp/agentsview-home GOPATH=/tmp/agentsview-gopath GOMODCACHE=/tmp/agentsview-gomodcache GOCACHE=/tmp/agentsview-gocache go test ./internal/parser -count=1 - Assistant
The full parser suite reached execution but has one unrelated pre-existing failure in
TestParseCortexSession_SplitHistoryReadError(it expects an injected non-ENOENT read error, but received nil); no discovery test failed. The focused discovery/source tests and the explicit nested reproduction both pass. I’ll do the final repository hygiene and diff review now, including confirming no temporary fixture remains and that only the intended source file changed.git status --short git diff --check find . -maxdepth 1 -type d -name 'tmp-claude-discovery-*' -print git diff --stat git diff -- internal/parser/discovery.go
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 →
- gpt-5.6-solCompare side by side →