A new npm package called agent-stack aims to solve one of the most annoying friction points in the Claude Code workflow: getting a repository properly configured for token efficiency. The tool, published by developer drmahdikazempour as @drmahdikazempour/agent-stack v0.2.0, delivers what its README describes as "one command to make any repo token-efficient"—handling installation, configuration generation, hook wiring, and baseline measurement in a single pass.
What It Actually Does
Running npx @drmahdikazempour/agent-stack init --all triggers a ten-step process that detects the host environment (Claude Code or Cursor), identifies the repository framework, installs only ccusage as an external dependency, generates a lean CLAUDE.md file capped at 800 tokens, wires hooks into .claude/settings.json without clobbering existing entries, builds a code map for symbol lookup, and captures a token baseline via ccusage for future comparison. The entire operation is designed to complete in under two minutes with a single confirmation prompt.
Token Cutting Mechanisms
The tool ships several built-in token reduction mechanisms rather than relying on external packages. A code map generates .agent-stack/graph.md—a compact index mapping source files to their exported symbols, allowing agents to grep one small file instead of reading entire directories. Output compression strips ANSI codes, folds duplicate lines with notation like "line (×42)", and head/tail-elides massive command output, reportedly achieving roughly 60% character reduction on 500-line logs. The .claudeignore keeps node_modules, build artifacts, media files, and lockfiles out of context entirely.
Profiles and External Tool Integration
Agent-stack supports six profiles—code (default), review, multimodal, spec, research, and max—that bundle different graph backends, compression settings, and skill configurations. The max profile, activated by --all, brings in external tools including rtk for command proxy output cutting, code-review-graph as an MCP server with impact radius analysis, graphify for knowledge graphs across multiple file types, caveman for terse output mode, claude-handoff for session continuity, and gbrain for cross-session memory. Notably, none of these are installed by name—agent-stack detects whether their binaries exist on PATH first, falling back to built-in alternatives when absent.
Measuring Real Savings
One thing that separates agent-stack from other optimization tools is its insistence on measured rather than claimed savings. The init command captures a ccusage baseline at installation time; users re-run agent-stack measure --since 7d after roughly a week to see actual token reduction percentages. Example output shown in the README displays "−41.8% input-token reduction vs baseline (target ≥ 40%)"—a specific, auditable number rather than marketing copy.
Safety and Reversibility
The package implements several safeguards for teams concerned about automated config changes. Existing CLAUDE.md files are merged rather than replaced, existing hooks are preserved with deduplication, all modifications are backed up to .agent-stack.bak.
The Bottom Line
Agent-stack tackles a real pain point—the fragmentation of Claude Code optimization into five-to-ten separate tools requiring individual installation and manual hook merging—but its value proposition depends heavily on whether the measured token savings actually materialize in day-to-day usage. For teams running Claude Code extensively, the one-command setup alone justifies trying it; for casual users, the overhead may exceed the benefit until a week of measurement data proves otherwise.