Skip to content

fix: file subagent transcripts under their real project, not "subagents" - #2

Merged
AndrewSpell merged 1 commit into
mainfrom
fix/subagent-project-name
Oct 10, 2026
Merged

AndrewSpell merged 1 commit into
mainfrom
fix/subagent-project-name

Conversation

@AndrewSpell

Copy link
Copy Markdown
Owner

Found while reviewing the index on 2026-10-10: 46 of our 466 exchanges (40 subagent transcripts) were filed under a project called subagents.

Cause: Claude Code keeps subagent transcripts at <project>/<session>/subagents/agent-*.jsonl. Two places in sync.ts (indexing and summarizing) and parseConversationFile took the parent directory as the project name. indexer.ts and verify.ts were already correct.

Fix:

  • projectFromTranscriptPath() in paths.ts is now used at all three sites. It skips <session>/subagents/ only when the file is also named agent-*. My first version checked only the directory name, and the migration test caught it renaming a real project called subagents to unknown.
  • migrateSubagentProjects() in db.ts repairs rows that were already indexed this way. It runs from migrateSchema alongside the cascade migration, it's idempotent, and it leaves a genuine subagents project alone.

Tests: new test/subagent-project.test.ts with 7 tests: the helper, parseConversationFile, a real syncConversations run with mocked embeddings, and the migration. The parser and sync tests failed with "subagents" before the fix was wired in. Full suite: 376 passed / 8 skipped / 0 failed on Windows (369 before, plus these 7). dist/ is rebuilt.

Dry run on a copy of our real index: "Migrating 40 subagent transcript(s)…", leaving d--Personal-Projects with 463 and C--Users-drewt with 3. No subagents rows remain. The real index was not touched.

After merge: reinstall the plugin from the local marketplace, since it runs from a cache copy. The migration then runs on the next start. That reinstall is also still pending for PR #1.

Not upstreamed. If you want it sent to obra/episodic-memory, that would be a separate step, under your name.

🤖 Generated with Claude Code

Claude Code keeps subagent transcripts at
<project>/<session>/subagents/agent-*.jsonl. sync.ts (index and summary
paths) and parseConversationFile took the parent directory as the
project, so every subagent exchange was indexed under "subagents" and
fell out of project-scoped searches.

- projectFromTranscriptPath() in paths.ts skips <session>/subagents/
  when the file is an agent-*.jsonl; a real project named "subagents"
  keeps its name.
- migrateSubagentProjects() repairs rows already indexed this way. It
  runs from migrateSchema and is a no-op once nothing needs fixing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@AndrewSpell
AndrewSpell merged commit d394f20 into main Oct 10, 2026
2 checks passed
@AndrewSpell
AndrewSpell deleted the fix/subagent-project-name branch October 10, 2026 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant