yvgude/lean-ctx

LeanCTX — Context Intelligence for AI systems.

View on GitHub ↗Jump to charts ↓Open shareable report

Summary Information

Updated 1 hour ago
Added to GitGenius on August 2nd, 2026
Created on March 23rd, 2026
Open Issues & Pull Requests: 9 (+1)
GitHub issues: Enabled
Number of forks: 350
Total Stargazers: 3,820 (+0)
Total Subscribers: 23 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 2.4 hours
Mean response time: 11.2 hours
90th percentile: 24.0 hours
Tracked items: 1,088

How this project is maintained

Practically every issue opened in the past year has drawn a reply. 99% of issues opened in the past year have since been closed. Three people close 97% of everything that gets resolved.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 7
New in 7 days: 25
Closed in 7 days: 26
Avg open age: 16 days
Stale 30+ days: 3
Stale 90+ days: 0

Recent activity

Opened in 7 days: 23
Closed in 7 days: 24
Comments in 7 days: 16
Events in 7 days: 57

Top labels

  • bug (572)
  • status: integrated (515)
  • enhancement (264)
  • priority: medium (241)
  • priority: high (213)
  • mcp (167)
  • cli (142)
  • proxy (111)

Most active issues this week

Sign in to see which issues are moving.

Detailed Description

LeanCTX is a context intelligence layer for AI coding agents, implemented as a single local Rust binary that optimizes how AI models interact with codebases. The project addresses a fundamental problem in agentic coding: AI agents waste significant token budgets on redundant file reads, uncompressed command output, and context that resets between chat sessions. By running locally alongside coding agents like Cursor, Claude Code, Copilot, and 30+ other platforms, LeanCTX reduces token consumption by 60–90% while maintaining full context fidelity.

The core functionality spans four dimensions of context management. First, compression handles input efficiency through ten distinct read modes including full content, map-based structural views, AST signatures, diff views, line ranges, and density-based filtering that keeps only high-entropy content. File reads that would normally cost 2000 tokens drop to approximately 13 tokens on cached re-reads. Shell output compression handles 95+ patterns specific to tools like git, npm, cargo, docker, kubectl, and terraform, reducing raw git status output from 800 tokens to 120 tokens. The compression is reversible by design—pruned content moves to a content-addressed store, allowing models to request original bytes back through multiple recovery paths including in-band markers and API endpoints.

Second, routing ensures appropriate fidelity per file read. An adaptive mode predictor learns optimal read modes per file type from past sessions, while an intent engine classifies query complexity to keep simple lookups cheap. Third, memory persistence solves the problem of context resetting between chats. Session memory survives across conversations, structured recovery queries persist through compaction, and a knowledge graph tracks temporal facts with validity windows. A property graph maintains multi-edge code relationships including imports, calls, exports, and type references to power impact analysis and search ranking. Critically, all memory stays local and portable—users can export sessions as .ctxpkg packages and move them across machines or models without vendor lock-in.

Fourth, the system provides proof and visibility through a signed, verifiable savings ledger and real-time dashboard showing token and USD savings. Users gain full visibility into context window budget allocation and can set budget controls. The project is distributed across multiple package managers: crates.io for Rust, npm for Node.js, AUR for Arch Linux, and Pi.dev. It includes 76 MCP tools and integrates with 30+ agents without requiring configuration changes. The README emphasizes that LeanCTX operates on a local-first, model-agnostic principle—users can swap between OpenAI, Anthropic, and Gemini without losing context or cache, keeping the context moat portable rather than locked into a vendor's billing model. The project's philosophy centers on owning context as a managed resource rather than renting it back from the model provider, with telemetry opt-in only and security as an explicit design concern.