{"slug": "codepulse-token-efficient-codebase-indexer-for-ai-coding-tools", "title": "CodePulse – token-efficient codebase indexer for AI coding tools", "summary": "CodePulse has launched a token-efficient codebase indexer that reduces AI coding tool token consumption by up to 87% by replacing the need for AI assistants to explore repositories during new sessions. The tool maintains a persistent, git-diff-aware index that injects a compact snapshot of repo structure, exported symbols, and import graphs at session start, eliminating the typical 10-30 file reads per session. CodePulse works with Claude Code, OpenAI Codex CLI, Cursor, and Continue.dev, and its token savings translate to monthly cost reductions of up to $90 per developer at current API pricing.", "body_md": "**Token-efficient codebase indexing for AI coding tools.**\n\nAI assistants waste 60–80% of their token budget exploring your repo on every new conversation. CodePulse maintains a persistent, git-diff-aware index and injects a compact snapshot — repo structure, exported symbols, import graph — at session start.\n\nWorks with Claude Code (skill), OpenAI Codex CLI (pipe or `AGENTS.md`\n\n), Cursor/Continue.dev (MCP server), and any tool that can consume CLI output.\n\nWithout CodePulse, an AI assistant typically reads 10–30 files per session just to understand your repo before it can help. With CodePulse, it gets a pre-built snapshot instead — no exploration needed.\n\n| Repo Size | Without CodePulse | With CodePulse | Saved |\n|---|---|---|---|\n| Small (< 5k lines) | ~8,000 tokens | ~2,000 tokens | ~75% |\n| Medium (5k–50k lines) | ~25,000 tokens | ~4,000 tokens | ~84% |\n| Large (50k+ lines) | ~60,000 tokens | ~8,000 tokens | ~87% |\n\nEstimates based on typical file-read patterns. Actual savings vary by repo structure and session type. Use\n\n`codepulse context --budget`\n\nto tune the snapshot size.\n\nAt current API pricing (Claude Sonnet ~$3/MTok input), saving 20,000 tokens per session adds up fast across a team:\n\n| Sessions/day | Tokens saved/day | Monthly savings (per developer) |\n|---|---|---|\n| 5 | 100,000 | ~$9 |\n| 20 | 400,000 | ~$36 |\n| 50 | 1,000,000 | ~$90 |\n\nBeyond cost, fewer tokens spent on exploration means faster responses and more of the context window available for actual work.\n\n```\nnpm install -g @aicodepulse/cli\n\n# In your repo: build the index (one-time)\ncodepulse init\n\n# Emit context into any AI session\ncodepulse context\n\n# Keep it fresh after commits\ncodepulse update\n```\n\nIn Claude Code: install the skill, then type `/codepulse`\n\nat the start of a session.\n\nThere are three ways to use CodePulse depending on your AI tool. Pick the one that fits your workflow.\n\nInstall and index your repo:\n\n```\nnpm install -g @aicodepulse/cli\ncd your-project\ncodepulse init\n```\n\nPipe context into any AI session:\n\n```\ncodepulse context --format markdown\n```\n\nKeep the index up to date:\n\n```\ncodepulse update              # incremental (fast)\ncodepulse watch               # auto-update on file changes\ncodepulse install-hooks       # auto-update after every git commit (recommended)\n```\n\n- Copy\n`skill/codepulse/`\n\ninto your project's`.claude/skills/`\n\ndirectory - Run\n`codepulse init`\n\nin your repo once - Type\n`/codepulse`\n\nat the start of any Claude Code session — it injects a fresh context snapshot automatically\n\nFor always-on injection without typing the command, add this to `.claude/settings.json`\n\n:\n\n```\n{\n  \"hooks\": {\n    \"PreToolUse\": [{\n      \"matcher\": \".*\",\n      \"hooks\": [{ \"type\": \"command\", \"command\": \"codepulse context --format xml\" }]\n    }]\n  }\n}\n```\n\nInstall the MCP package:\n\n```\nnpm install -g @aicodepulse/cli @aicodepulse/mcp\ncd your-project && codepulse init\n```\n\nAdd to your MCP config (e.g. `.cursor/mcp.json`\n\n):\n\n```\n{\n  \"codepulse\": {\n    \"command\": \"codepulse-mcp\",\n    \"args\": []\n  }\n}\n```\n\nThe MCP server exposes three tools your AI editor can call on demand:\n\n`get_context(budget_tokens, focus_path?)`\n\n— full context snapshot`search_symbols(query)`\n\n— find exported symbols by name`get_file_summary(path)`\n\n— symbols, imports, and importers for one file\n\n| Command | Description |\n|---|---|\n`codepulse init` |\nBuild the initial full index |\n`codepulse update` |\nIncremental update (git-diff-aware) |\n`codepulse update --full` |\nForce full re-index |\n`codepulse context` |\nEmit context snapshot (default: 4000 tokens, XML) |\n`codepulse context --auto` |\nAuto-scale budget by repo complexity |\n`codepulse context --task \"description\"` |\nRank files relevant to the task first |\n`codepulse context --budget 8000` |\nLarger budget for bigger repos |\n`codepulse context --focus src/auth` |\nDeep detail on one subsystem |\n`codepulse context --format markdown` |\nHuman-readable output |\n`codepulse search <query>` |\nSearch exported symbols by name |\n`codepulse search <query> --limit 10` |\nLimit results |\n`codepulse stats` |\nShow index stats |\n`codepulse watch` |\nAuto-update on file changes |\n`codepulse install-hooks` |\nInstall git post-commit hook for auto-updates |\n`codepulse uninstall-hooks` |\nRemove git hooks |\n\nCodePulse ranks what goes into the snapshot so the most useful files fit within the budget:\n\n**Task-aware ranking** — pass `--task`\n\nto rank files by relevance to what you're working on:\n\n```\ncodepulse context --auto --task \"fix the login bug\"\n```\n\nKeywords are extracted from your task description and matched against file paths, symbol names, exported function signatures, and stored file summaries. Files most relevant to your task appear first.\n\n**Git-aware ranking** — even without `--task`\n\n, CodePulse checks which files you've recently changed (`git diff`\n\n) and boosts those automatically. Files with a longer history of changes rank higher by default.\n\n**Auto budget** — `--auto`\n\nscales the token budget to your repo's complexity score (symbols × 2 + imports + lines/50). Tiny repos are skipped entirely:\n\n| Complexity | Budget |\n|---|---|\n| < 50 | skipped (0 tokens) |\n| 50–499 | 800 tokens |\n| 500–1499 | 2,000 tokens |\n| ≥ 1,500 | 4,000 tokens |\n\nIf the budget is too small and files were cut off, CodePulse warns you and suggests the next tier.\n\nSearch exported symbols across your entire indexed codebase:\n\n```\ncodepulse search \"validateToken\"\ncodepulse search \"auth\" --limit 10\n```\n\nReturns kind, name, signature, file path, and line number for every match — useful for navigating large repos without opening an editor.\n\nInstall a `post-commit`\n\nhook so the index updates automatically after every commit:\n\n```\ncodepulse install-hooks\n```\n\nThis appends a single line to `.git/hooks/post-commit`\n\n(or creates the file). It runs `codepulse update`\n\nafter each commit — incremental, so it's fast. Remove it any time:\n\n```\ncodepulse uninstall-hooks\n```\n\nJavaScript, TypeScript, Python, Go, Rust, Java, C, C++, C#, Ruby, PHP, Bash, Kotlin, Swift\n\nCopy `skill/codepulse/`\n\ninto your project's `.claude/skills/`\n\ndirectory, then use `/codepulse`\n\nin any Claude Code session.\n\n**Always-on injection (opt-in):** Add to `.claude/settings.json`\n\n:\n\n```\n{\n  \"hooks\": {\n    \"PreToolUse\": [{\n      \"matcher\": \".*\",\n      \"hooks\": [{ \"type\": \"command\", \"command\": \"codepulse context --format xml\" }]\n    }]\n  }\n}\n```\n\nCodex CLI supports an `AGENTS.md`\n\nfile for project-level instructions and can read context piped into it via stdin.\n\n**Option 1 — Pipe context directly into a prompt:**\n\n```\ncodepulse context --format markdown | codex \"refactor the auth module\"\n```\n\n**Option 2 — Inject into AGENTS.md at session start:**\n\nAdd a setup script to your repo (e.g. `scripts/codex-init.sh`\n\n):\n\n``` bash\n#!/usr/bin/env bash\n# Regenerate AGENTS.md with a fresh CodePulse snapshot before each Codex session\ncat > AGENTS.md << 'HEADER'\n# Project Context (auto-generated by CodePulse)\nHEADER\ncodepulse context --format markdown >> AGENTS.md\n```\n\nRun it before starting Codex:\n\n```\nbash scripts/codex-init.sh && codex\n```\n\nCodex will pick up `AGENTS.md`\n\nautomatically on startup, giving it instant structural awareness without exploring the repo itself.\n\n**Option 3 — Always-on via shell alias:**\n\n```\n# Add to ~/.zshrc or ~/.bashrc\nalias codex='(codepulse update --full 2>/dev/null; codepulse context --format markdown > /tmp/cp-context.md); codex --context /tmp/cp-context.md'\n```\n\nNote:\n\n`--context`\n\nflag availability depends on your Codex CLI version. Check`codex --help`\n\nfor the exact flag name.\n\nAdd to your MCP config:\n\n```\n{\n  \"codepulse\": {\n    \"command\": \"codepulse-mcp\",\n    \"args\": []\n  }\n}\n```\n\nTools available:\n\n`get_context(budget_tokens, focus_path?)`\n\n— full context snapshot`search_symbols(query)`\n\n— find exported symbols by name`get_file_summary(path)`\n\n— symbols, imports, and importers for one file\n\n**Index:** Tree-Sitter parses all source files, extracting exported symbols, import edges, and a compact per-file summary into a SQLite database (`.codepulse/index.db`\n\n). Git history is scanned to record how often each file changes.**Update:** On each`update`\n\n, only files changed since the last indexed git commit are re-parsed — a 50k-line repo updates in milliseconds. With`install-hooks`\n\n, this runs automatically after every commit.**Context:** Given a token budget, a layered generator fills it from most to least important: repo overview → directory map → symbol table → import graph. Files are ranked by task relevance, then change frequency (most-edited files first), so the most useful content always fits within the budget.**Smart budget:**`--auto`\n\nscales the token budget to your repo's actual complexity — tiny repos are skipped entirely, saving 100% overhead.\n\nThe index is stored per-repo (not globally) so each project has its own isolated snapshot.\n\n| Package | Description |\n|---|---|\n`@aicodepulse/core` |\nIndexer engine (Tree-Sitter, SQLite, context generator) |\n`@aicodepulse/cli` |\n`codepulse` CLI |\n`@aicodepulse/mcp` |\n`codepulse-mcp` MCP server |\n\nMIT", "url": "https://wpnews.pro/news/codepulse-token-efficient-codebase-indexer-for-ai-coding-tools", "canonical_source": "https://github.com/leogong99/codepulse", "published_at": "2026-05-29 04:48:12+00:00", "updated_at": "2026-05-29 05:16:49.824273+00:00", "lang": "en", "topics": ["ai-tools", "ai-infrastructure", "ai-agents", "large-language-models", "ai-products"], "entities": ["CodePulse", "Claude Code", "OpenAI Codex CLI", "Cursor", "Continue.dev", "Claude Sonnet"], "alternates": {"html": "https://wpnews.pro/news/codepulse-token-efficient-codebase-indexer-for-ai-coding-tools", "markdown": "https://wpnews.pro/news/codepulse-token-efficient-codebase-indexer-for-ai-coding-tools.md", "text": "https://wpnews.pro/news/codepulse-token-efficient-codebase-indexer-for-ai-coding-tools.txt", "jsonld": "https://wpnews.pro/news/codepulse-token-efficient-codebase-indexer-for-ai-coding-tools.jsonld"}}