# yvgude/lean-ctx

Control what your AI can see. LeanCTX (Lean Context) is the context intelligence layer for AI agents — one local Rust binary that decides what they read, remembers what they learn, guards what they touch, and proves what they save. 60–90% fewer tokens as the receipt. 76 MCP tools, 30+ agents, local-first.

Repository: https://github.com/yvgude/lean-ctx
Canonical: https://ross.abutalabs.com/products/lean-ctx
Homepage: https://leanctx.com
Language: Rust
License: Apache-2.0
License Family: permissive
Topics: ai, cursor, llm, mcp, rust, token-optimization, agentic-coding, claude-code, copilot, developer-tools, ai-coding, context-engineering, gemini-cli, mcp-server, reduce-token-costs, context-layer, ai-agents, lean-context, context-intelligence
Last push: 2026-08-26T12:25:47+00:00

## Health v2 (maintenance only)
Score: 77/100 (v2, computed 2026-09-03T02:39:23.370411+00:00)
- activity 99, release rhythm 87, longevity 11
- inputs: {"age_days": 163, "days_push": 7, "days_rel": 7, "gap_med": 0, "n_releases_24m": 246}
- flags: young
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 3656, forks 332 (observed 2026-08-28T04:08:13.197543+00:00)

## What it is
LeanCTX is a local-first Rust binary that acts as a context engineering layer for AI coding agents, providing an MCP server, shell output compression hooks, and persistent project memory. It compresses file reads and command output via tree-sitter AST analysis and caching, claiming 60-90% token savings, and works with 30+ agents like Cursor, Claude Code, and Copilot.

## Use cases
- reduce token costs when using AI coding agents
- compress file reads and shell output sent to LLMs
- persist agent memory and decisions across chat sessions
- coordinate multiple AI agents with shared context
- monitor and benchmark AI agent token usage
- set up an MCP server for coding assistants
- avoid agents re-reading the same files every session

## When to choose
- you use AI coding agents daily and want to cut LLM token spend
- your agent re-reads files and re-runs commands repeatedly each session
- you want local-first, offline context tooling where code never leaves your machine
- you need cross-session memory and multi-agent coordination for coding workflows

## When to avoid
- you need a fully lossless view of all tool output by default (compression is lossy in aggressive modes)
- you rely on agents or tooling outside its supported 30+ agent integrations
- you want a hosted or cloud-managed context solution without self-hosting anything
- your workflow is simple enough that token costs are not a concern

## Facets
- artifact type: cli-tool
- maturity: active
- function: mcp, caching, compression, developer-tools, cli, monitoring, agent-framework
- domain: developer-tools, large-language-models
- platform: windows, cli, rust, cross-platform
- tags: context-engineering, token-optimization, mcp-server, ai-coding-agents, prompt-compression, local-first, session-memory, tree-sitter, cost-reduction, ai-agents, command-line, automation, macos, linux

## Member repositories
- yvgude/lean-ctx (main) score 77

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:08:13.197543+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T18:31:38.812155+00:00, confidence not recorded.
  - readme: https://github.com/yvgude/lean-ctx (fetched 2026-08-28T04:08:13.197543+00:00, sha bee195f96959)
  - homepage: https://leanctx.com (fetched 2026-08-29T09:26:09.759080+00:00, sha a0f30a17c82e)
  - site_page: https://leanctx.com/docs/getting-started (fetched 2026-08-29T09:26:09.763073+00:00, sha 9812eb7f10d3)
  - site_page: https://leanctx.com/docs/concepts/read-modes (fetched 2026-08-29T09:26:09.767909+00:00, sha 01518e0c9c94)
  - site_page: https://leanctx.com/docs/concepts/token-savings (fetched 2026-08-29T09:26:09.770442+00:00, sha ffdba3fad038)
  - site_page: https://leanctx.com/docs/tools/memory (fetched 2026-08-29T09:26:09.772253+00:00, sha fbe8e52c7aeb)
  - site_page: https://leanctx.com/docs/tools/session (fetched 2026-08-29T09:26:09.774320+00:00, sha abba8fbb32c0)
  - site_page: https://leanctx.com/docs/changelog (fetched 2026-08-29T09:26:09.779394+00:00, sha 089d5957ee91)
  - site_page: https://leanctx.com/pricing (fetched 2026-08-29T09:26:09.765910+00:00, sha df9d290522ae)
  - site_page: https://leanctx.com/metrics (fetched 2026-08-29T09:26:09.776747+00:00, sha 35daa59bb79b)
- Data as of 2026-08-30T08:39:29.467469+00:00.
