Show HN: Subagent-reuse, an MCP to reuse Claude Code subagent context
GitHub: https://github.com/itsamruth/subagent-reuseMedium: https://medium.com/@itsamruth/stop-burning-tokens-how-to-use...
Medium: https://medium.com/@itsamruth/stop-burning-tokens-how-to-use...
I built subagent-reuse after noticing that Claude Code subagents often re-read the same files and rebuild the same context from scratch.
It scans Claude’s local session storage, tracks which files each subagent has already read or modified, and routes new work to an existing agent when there’s enough overlap. It also warns when files have changed since that agent last saw them.
GitHub: https://github.com/itsamruth/subagent-reuseMedium: https://medium.com/@itsamruth/stop-burning-tokens-how-to-use...
Blog post with full context: https://medium.com/@itsamruth/stop-burning-tokens-how-to-use...
I built this after noticing a painful pattern with Claude Code: every new subagent (planner, explorer, implementer, fixer) would re-read the same files from scratch — burning hundreds of tokens each time on files like src/auth/callback.ts.
subagent-reuse solves it by automatically scanning Claude's native session storage (~/.claude/projects/) and tracking exactly which files each subagent has already read and modified. It builds a SHA-256 Merkle tree per agent for fast lookup.
Before spawning a subagent, it runs route_task(task, files). - Strong file overlap → REUSE the existing agent - File changed since last read → staleness warning (only re-read what's needed) - No good match → CREATE_NEW + summaries of existing agents so Claude can decide
I kept routing purely structural (file overlap + directory + recency). No embeddings or word matching — the calling LLM is better at semantics anyway.
Install (one command):
npx subagent-reuse --setup
It adds the MCP and auto-approves permissions.This is part of a small stack I'm using to make Claude Code dramatically more efficient (routing + semantic search + memory).
Code is ~1000 lines of vanilla JS with 52 tests.
Would love feedback especially on the routing approach — is staying purely structural the right decision, or should I add something smarter when the task doesn't specify file paths?
Happy to answer any questions!