
redcon
io.github.natiixntPublished by GitHub account natiixntv1.15.0Updated Oct 27, 2026
Deterministic context packing for AI coding agents; measured 83% fewer input tokens, local.
Overview
Redcon packs repository context for AI coding agents: it ranks, compresses and budgets files and command output locally, exposing nine MCP tools.
- What you can do
- Rank and map a repository: top-K relevant files with scores and reasons, a directory-grouped overview, and a ranked repo map fitted to a token budget
- Inspect and search code: compressed single-file views, regex search scoped to ranked files or the whole repo, and AST-based structural search
- Plan token budgets: fit selected files under a maximum token count
- Run and compress commands: execute a shell command and return a budget-aware compressed view, with a quality check that verifies preserved facts
- When to use it
- Useful when an assistant works in a code repository and you want it to spend fewer input tokens on exploration, or when you want deterministic, local context selection instead of dumping whole files or blind grepping. Also fits CI checks on context growth and command-output trimming.
- Requirements
- Runs as a local process, installed from PyPI (redcon, with the mcp extra) and launched with uvx or pip. Needs Python and a local repository checkout; git is used for history-aware ranking. No accounts, API keys or environment variables are declared.
Installation
In SourceWeft
- Open redcon in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
Redcon
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.
[PyPI] [Tests] [Python 3.10+] [VS Code Extension] [License: FSL-1.1-MIT]
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)
- Install Redcon - Context Budget from the marketplace
- Open the Redcon sidebar, click Install & Set Up
- 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):
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:
Typical agent flow uses ~5k tokens for exploration instead of 30k for a blob. The agent itself decides what to read in full.
Config gets written automatically to:
.mcp.json(Claude Code).cursor/mcp.json(Cursor)~/.codeium/windsurf/mcp_config.json(Windsurf)
Command Output Compression
Source files are only half the bloat. The other half is command output: git diff, pytest, cargo test, grep, ls -R. Redcon's redcon_run MCP tool (and redcon run CLI) wraps the call, parses the output, and returns a budget-aware compressed view that preserves every fact the agent actually needs.
Headline reductions on representative inputs:
Quality is enforced separately. Every compressor declares must_preserve_patterns (file paths in a diff, failing test names in pytest, branch name in git status, slowest node operator in EXPLAIN); the M8 quality harness rejects any compressor whose compact output drops a fact present in the raw input. Run it as a CI step:
Twenty compressors ship today: git_diff, git_status, git_log, pytest, cargo_test, npm_test (vitest+jest), go_test, grep, ls, tree, find, lint (ruff+mypy), docker, pkg_install (pip+npm+yarn), kubectl_get/kubectl_events, profiler (py-spy+perf), json_log, coverage, sql_explain (Postgres+MySQL TREE), bundle_stats (webpack + esbuild metafiles). Full per-schema benchmarks: docs/benchmarks/cmd/.
Cross-call dimension
Beyond per-call compression, four layers compose across an agent session:
- Path aliases (V41): repeated paths like
redcon/cmd/pipeline.pycollapse tof001on later mentions. Lazy first-use, never net-negative. - Content reference ledger (V43): paragraph-shaped blocks above 6 cl100k tokens get session-stable
{ref:001}aliases on second-and-later occurrences. Empirically 23% of session output had block-level overlap. - Symbol aliases (V49): CamelCase types / multi-word snake_case identifiers (>=8 chars) collapse to
c001aliases the same way paths do. Empirically 72% of distinct symbols recur >=2 times per session. - Snapshot delta vs prior call (V47): when the same argv runs twice, ship only the delta. Schema-aware renderers for
pytest(set-diff over failure names),git_diff(file-set with per-file +/- counts), andcoverage(per-file pp moves) win meaningfully over generic line-diff. Always picksmin(cost_delta, cost_abs)so non-regressive by construction. - Invariant cert (V93): every COMPACT/VERBOSE output stamps
mp_sha=<16hex>over the sorted multiset of(pattern, capture)extracted from raw. Auditors recompute the cert against the compressed text to detect spurious additions or capture thinning - upgrades the existing must-preserve boolean to set-equality.
Empirical measurement on 5 simulated agent sessions (benchmarks/measure_sessions.py): the cross-call layers add +8.3% session-level saving on top of the per-call compressors, with +15% on heavy-overlap sessions (debugging, search-and-edit) and near-zero on distinct-content sessions. V85 adversarial GA fuzzer ratchets all 20 schemas as a hard CI gate (REDCON_V85_ENFORCE=1).
VS Code Extension
Once installed you get:
- Sidebar chat: type a task, send, watch the pack run live
- Dashboard: donut/pie/bar charts for budget, strategies, token impact per file
- Status bar: current budget usage with risk indicator
- CodeLens: compression strategy and token count shown above each file
- File decorations: relevance score badges on files in the explorer
- History: browse past runs, diff them, export to clipboard
Branding: red->navy gradient with triple chevron mark, glass-style UI.
Workspaces (Multi-Repo)
One task can span multiple repos. Place the workspace TOML in a folder that contains all the repos (a monorepo root or a common parent directory) - repo paths must resolve inside that folder, so a workspace file cannot reach above itself:
Artifacts include workspace, scanned_repos, selected_repos, and repo-qualified paths like auth-service:src/auth.py.
See docs/workspace.md.
Python API
Full reference: docs/python-api.md.
Features
- Deterministic scoring: keyword match, import graph, file role (test/docs/prod), git history
- Language-aware compression: Python, TypeScript, JavaScript, Go, Rust, Java, and more
- Command output compression: 20 compressors covering git, test runners, grep/rg, listings, lint, docker, pkg-install, kubectl, profilers, JSON logs, coverage, SQL EXPLAIN, and bundle stats - 70-99% reduction at compact level
- Incremental scanning: cached file metadata with git-aware change detection
- Multi-repo workspaces: single task, multiple repos, shared config
- Budget policies: enforce max tokens, quality risk levels, file counts in CI
- Quality harness: must-preserve regex assertions per compressor, deterministic, robust to truncated/binary input
- Streaming runner: chunked Popen reader with bounded memory and early SIGTERM/SIGKILL when output cap is hit
- Run history: SQLite-backed artifact store for both file packs and command runs, diff/heatmap/drift analysis
- Cost analysis: estimate token costs across GPT-4o, Claude, and other models
- PR auditing: detect context growth in pull requests
- Plugin system: custom scorers, compressors, token estimators, summarizers
- Cache backends: in-memory, local file, Redis
- Doctor command: diagnose environment, Python version, disk space, git availability
Documentation
- Getting Started - first pack in 60 seconds
- CLI Reference - all commands and flags
- MCP and Hooks - agent integration, tool list, deterministic context injection
- Configuration - redcon.toml fields
- Workspaces - multi-repo setup
- Python API - programmatic usage
- Agent Integration - middleware layer
- Plugins - custom extensions
- Architecture - how it all fits together
- Migration Notes - upgrading between versions
License
Everything in this repository is licensed under the Functional Source License, FSL-1.1-MIT: use it freely for any purpose except building a competing commercial product or service. Each release automatically becomes MIT-licensed two years after it ships.
The hosted Redcon Cloud control plane (orgs, quotas, usage metering, billing, team dashboards) is separate commercial software maintained in a private repository.
Commercial licensing: [email protected]
Source: README.md at commit fa3569a
Tools
0Version history
1- v1.15.0LatestSep 16, 2026
Score
40% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts
Declare a license in the repository or the registry entry.