← Reddit

How I cut Claude Code token usage in half (open source, benchmark included)

Reddit · Obvious_Gap_5768 · May 6, 2026
Repowise is an open-source tool that optimizes Claude Code's codebase analysis by pre-computing architectural archaeology—including dependency graphs, git behavioral signals, semantic documentation, and decision records—into eight MCP tools that enable Claude to understand a 3,000-file project in 2 minutes instead of 8. The tool detects hidden coupling through co-change analysis that static analysis cannot find and auto-generates documentation on every commit while remaining fully self-hostable.

Detailed Analysis

Repowise, an open-source tool released under the AGPL-3.0 license, addresses one of the most persistent inefficiencies in AI-assisted software development: the repeated, expensive process by which large language models like Claude must reconstruct an understanding of a codebase from scratch at the start of every session. The tool's author observed that Claude Code, when working with a 3,000-file project, consistently follows the same exploratory pattern — reading directory trees, opening dozens of files, tracing import chains — before it can begin meaningful work. Repowise intercepts this process by pre-computing codebase knowledge into four structured layers: an AST-derived dependency graph, git-derived behavioral signals (including hotspots, ownership attribution, and co-change pair detection), an auto-generated documentation wiki with semantic search, and architectural decision records linked directly to the code nodes they govern. These layers are exposed to Claude Code via eight Model Context Protocol (MCP) tools.

The benchmark results the author presents are striking in their concreteness. For the task of adding rate limiting to all API endpoints on the same 3,000-file project, Claude Code operating without Repowise required approximately 30 file reads, took around eight minutes, and failed to surface ownership information and hidden coupling relationships. With Repowise, the same task was completed in five targeted MCP calls and approximately two minutes. The five-call sequence — get_overview, get_context, get_risk, get_why, and search_codebase — provides Claude with a complete architectural picture before any file is modified. This is not merely a speed improvement; it represents a qualitative shift in the kind of reasoning Claude can perform, because it gains access to relational and historical information that static file reads cannot surface.

The co-change detection capability is the most technically notable feature. Traditional static analysis and dependency graphs capture explicit import relationships between files, but they miss the emergent behavioral coupling that git history reveals — files that consistently change together across commits despite having no declared dependency on each other. This hidden coupling is a well-documented source of software defects, and it is precisely the kind of signal that neither grep-based exploration nor AST parsing can recover. By mining git history to expose these relationships as first-class data, Repowise gives Claude a form of institutional memory about how a codebase actually evolves, which is meaningfully different from how it is formally structured.

The tool also addresses the documentation decay problem through automated CLAUDE.md generation on every commit, pulling live graph data to populate hotspot warnings, ownership maps, co-change pairs, active architectural decisions, and dead code candidates — all in under five seconds. This is significant because CLAUDE.md files, which Claude Code uses as a project-specific instruction and context document, tend to become stale as codebases evolve; Repowise makes that document a continuously accurate artifact rather than a manually maintained one. The multi-repo support extends these capabilities across organizational boundaries, enabling cross-repository hotspot and ownership queries in a single view, which addresses a common gap in enterprise development contexts where related services are split across repositories.

Repowise's approach reflects a broader trend in the AI tooling ecosystem: rather than asking language models to do more with raw context, practitioners are increasingly investing in preprocessing and structured representation layers that make context retrieval both cheaper and more semantically precise. The MCP protocol, which Anthropic introduced as a standard for connecting Claude to external tools and data sources, has become a natural integration point for this category of developer tooling. Repowise's design — fully self-hostable, no data exfiltration, pip-installable, and compatible with Claude Code, Cursor, and local setups — positions it as infrastructure-layer tooling rather than a hosted service, which may be an important consideration for enterprises with code confidentiality requirements. The open-source release and public benchmark invite scrutiny and community contribution at a moment when the developer tools space around AI coding assistants is intensely competitive and rapidly evolving.

Article image Read original article →