Redcon
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
**Deterministic context budgeting for AI coding agents**
Stop sending agents 200k tokens of irrelevant code. Redcon scores, compresses, and packs repo context so your agent gets what it actually needs.
Install - Quick Start - How It Works - Docs
---
The Problem
AI coding agents burn tokens on irrelevant context. You either:
- Dump the whole repo and pay for 200k input tokens per request, or
- Let the agent grep blindly and waste tool calls figuring out where to look
Redcon solves both. It ranks files by task relevance, compresses them with language-aware strategies (full, snippet, symbol extraction, summary), and packs the result under your token budget. Deterministic, local-first, no embeddings. One MCP server covers Claude Code, Cursor, Windsurf, Cline and Zed; a plain CLI covers CI. Measured on this repository it cuts input tokens by more than 83% at the same task coverage (methodology).
Punch above your plan
On a flat subscription - Claude Pro/Max, Cursor, GitHub Copilot - the token bill isn't what stings, the **usage limit** is. Redcon cuts the tokens each task needs, so the same plan covers far more work before you hit the weekly wall. Same subscription, more runway.
It stretches the budget you already pay for, and reports exactly how much it saved.
Install
Option 1: VS Code Extension (easiest)
1. Install Redcon - Context Budget from the marketplace
2. Open the Redcon sidebar, click **Install & Set Up**
3. Reload window. Done.
The extension installs the CLI via pip, registers the MCP server for Claude Code, Cursor, and Windsurf, and gives you a sidebar with budget analytics, file rankings, and compression dashboards.
Option 2: CLI + MCP Server
The init command auto-configures MCP for Claude Code, Cursor and Windsurf, plus VS Code, Codex CLI, Gemini CLI, Junie CLI, Cline and Zed when they are detected, so your AI agent can call redcon_rank, redcon_search, redcon_compress, and redcon_budget as native tools. It also writes a short AGENTS.md section that tells agents to prefer these tools for context selection.
Option 3: CLI only
Quick Start
Output goes to run.json (machine-readable) and run.md (human-readable). Use them in CI, or feed the compressed context directly into your agent.
For a full end-to-end walkthrough on a realistic service repo (plan, pack, validate, with deterministic output), see examples/service-repo.
How It Works
Every step is deterministic. Same input, same output. No embeddings, no random chunking.
Benchmark: context-eval
Selection quality is measured, not claimed. context-eval/
is an open benchmark for context-selection tools: tasks come from real git
commits, ground truth is the files each commit actually modified, and every
tool packs the same token budget. Current results (33 tasks, 24k budget):
| Tool | Mean coverage | Tokens / coverage point |
|------|--------------:|------------------------:|
| redcon | **43.8%** | **306.8** |
| keyword-topk (baseline) | 29.8% | 538.9 |
| aider-repomap (real aider) | 15.3% | 533.3 |
| pagerank (baseline) | 11.4% | 720.0 |
Rerun it on any repo: python context-eval/run.py --repo /path/to/repo.
Methodology, limitations, and how to add your own tool:
context-eval/README.md.
MCP Integration (Pull Model)
mcp-name: io.github.natiixnt/redcon
Instead of pushing a 30k-token blob to your agent, Redcon exposes 9 MCP tools the agent calls on demand:
| Tool | What it does |
|------|--------------|
| redcon_rank | Top-K files with scores and reasons - call this first |
| redcon_overview | Lightweight repo map grouped by directory |
| redcon_repo_map | Top ranked files plus their code signatures, fitted under a token budget |
| redcon_compress | Compressed single-file view for cheap inspection |
| redcon_search | Regex search scoped to ranked files or full repo |
| redcon_structural_search | ast-grep structural search - patterns match the AST, not text |