CostAffective
Local-First Repo Intelligence

Convert Your Remaining Cost Into Coffee ☕

Reduce repository exploration costs, shrink context windows by up to 45.9%, and help AI coding agents find deterministic codebase answers faster.

costaffective --serve
logs
_
Savings Rate45.9%
Index Sync8ms
Egress Data0 KB
45.9% fewer tokens
54.3% fewer exploration loops
42.1% fewer tool interactions
100% Local-First

100% Local-First

All index calculations, SQLite queries, and AST compiles execute locally. No code telemetry egress.

MCP Compatible

Plugs seamlessly into Claude Code, Cursor, Codex, VS Code, and any client supporting the stdio protocol.

8ms Sync Watchdog

Incremental watchdog captures file modifications on-save and updates only changed checksums instantly.

Context Compress

Returns compressed, semantic code definitions instead of bloated files, preserving LLM context size.

Retriever Performance

Quality Benchmarks

Direct measurements of context efficiency and API footprint comparing CostAffective against CodeGraph on large repositories.

Featured Case Study: Continue OSS (3,203 Files)

CostAffective vs CodeGraph
45.9% Savings
Evaluation MetricCostAffectiveCodeGraphWinner
Total Tokens4,708,8358,707,328🏆 CostAffective
Subagent Calls (Exploration Loops)4394🏆 CostAffective
API Calls (Tool Interactions)89134🏆 CostAffective
Deliverables Generated44Tie
Static Analysis

How It Works

CostAffective indexes codebases statically using compilers to map declarations. Experience it live inside our AST compiler simulator.

class="ast-keyword">import tree_sitter
class Parser:
def __init__(self, language):
self.language = language
def parse_file(self, filepath):
"""Extract functions and calls from path"""
print(f"Parsing AST for: {filepath}")
tree = self.language.parse(filepath)
return self.extract_symbols(tree.root_node)
Local Watchdog Idle
Parsing speed:12ms
Tokens compressed:685
Context reduction:45.9%

Extracted AST Nodes

Declarations
class Parserdef parse_filedef extract_symbols
References
tree_sittersqlite3sys.argv
System Layout

Architectural Overview

Hover or click components inside the relational flow diagram to examine operational modules.

AI Editor Client (Cursor/Claude)MCP Server transport (stdio)AST Parser & Watchertreesitter static mappingLocal SQLite DBrelational index store

AST Relational Parser & Watcher

Parses files statically using tree-sitter compiler definitions to extract symbols, implementations, and call relationships. Monitored by a background fsnotify watchdog.

Relevant Repository Files
  • internal/watcher/watcher.go
  • internal/watcher/watchdog.go
  • internal/parser/ast.go
Module Maps

Codebase Inspector

Browse through directories of the actual CostAffective local codebase to verify its architecture.

Repository Modules
📦

internal/retriever

Semantic Search Engines

Implements the core 9 indexing algorithms (treesitter, grep, fts, auto, naive) used to measure benchmark scores.

Files Count11 source files
Access BoundaryLocal Stdio only
Compiled AST Symbols
structtype Retriever interface
funcfunc (t *TreeSitter) Retrieve()
funcfunc (a *AutoRouter) Route()
Setup Guides

Editor Configurator

Select your IDE platform below to generate setup profiles.

Config Location:~/.claude.json
settings.json
{
  "mcpServers": {
    "costaffective": {
      "command": "costaffective",
      "args": ["serve"]
    }
  }
}
Comparisons

CostAffective vs Alternatives

See how CostAffective outperforms legacy dependency graphs and simple file search tools.

CodeGraph

Saves 43.8% token context compared to heavy code-graph pointer files.

Serena

Restores offline security and local parsing without cloud data egress.

Graphify

Opt for optimized symbol arrays instead of complex spatial coordinates.

ripgrep

Retrieves logical scopes rather than noisy, generic text lines.

Questions

Frequently Asked Questions

Find answers to common questions about indexing, token optimization, and IDE integrations.

How does CostAffective save prompt tokens?

Instead of piping full files to LLMs during coding tasks, CostAffective extracts only structural declarations and scopes, trimming down input contexts by up to 45.9%.

Does it send my codebase to external cloud APIs?

No. CostAffective operates fully local. All compilation and SQLite index writes are done locally on your computer.

Creator

Developed by Yash Gajjar

Connect with the developer of CostAffective-MCP.

⭐ Support the Project

CostAffective is open-source (MIT). Star the repo on GitHub to help others discover local-first repository intelligence.

Save Context. Write Code.

Install the local-first repository intelligence server now and enjoy sub-millisecond, token-efficient semantic retrievals.

$npm install -g costaffective-mcp
View Guide