DEV Community

Leo Gong
Leo Gong

Posted on

How I cut AI context tokens by 80%

Token is the new currency.

CodePulse to solve a frustrating problem: every time I start an AI coding session, I waste hundreds of tokens just explaining what my project is, where things live, and what files are relevant.

CodePulse indexes your repo into SQLite and serves a smart context snapshot — only what the AI needs, nothing it doesn't.

What it does:

  • Extracts symbols (functions, classes, exports) via Tree-Sitter AST parsing
  • Scores file relevance against your task using keyword matching on paths, summaries, and symbol names
  • Tracks which files change most often (git history) and surfaces hot files first
  • Auto-scales the token budget to repo size (skips tiny repos, scales up to 4k tokens for large ones)
  • Keeps itself fresh with a git post-commit hook installer

Token savings in practice:

On a medium-sized TypeScript project: manual context pasting = ~6,000 tokens. CodePulse = ~800 tokens, with better coverage because it
prioritizes relevant files.

Three ways to use it:

  1. Claude Code skill (recommended) — drops a skill/codepulse/ folder in your project, auto-injects context on every prompt
  2. CLI — codepulse context --task "fix the login bug" | pbcopy
  3. MCP server — for tools that support Model Context Protocol

Install:
npm install -g @aicodepulse/cli
codepulse index .
codepulse context --task "your task here"

Would love feedback on the scoring algorithm, the token budget tiers, and whether the MCP integration is worth investing more in. Source is on GitHub.

Top comments (0)