lean-ctx / rules
Cursor rule3.9k starsChanged 4 months agoApache-2.0View on GitHub
lean-ctx shadow-mode hooks compress file reads. If an edit tool (StrReplace, Write) reads through the hook, it sees compressed content and writes markers like [lean-ctx: omitted N lines] back to disk. This silently destroys file content. The pre-commit hook blocks commits containing [lean-ctx: omitted markers. If your commit is blocked, the file was corrupted. Fix: Always use LEAN_CTX_DISABLED=1 when restoring files from git: NEVER use git show commit:file > file — the shell redirect writes compressed output. If a file…
Trending
Less talk lately.about the whole repository
Who's talking about yvgude/lean-ctx
- @rusttrending.bsky.social“yvgude / lean-ctx: Lean Cortex -- the cognitive context layer for agentic systems. 51+ MCP tools, 10 read …”Bluesky · May 24, 2026 · 6 likes
- @qdrddr.bsky.social“Context reduction for local #development. #MCP tools, #CLI, Hooks to #Harness #codeagents. Build-in …”Bluesky · May 9, 2026 · 5 likes
- dirge-code/dirge“feat: Janet compression plugin + /plugins slash command”GitHub · Jun 10, 2026 · 1 reactions
- Amitro123/knowledgeBase-Agent“Clean up the Google Sheet so the graph gets real topics (Category values, duplicates, empty tabs)”GitHub · Oct 4, 2026
- sudosubin/agents.nix“agent-skills.github.yvgude.lean-ctx: 3.10.2 → 3.10.5”GitHub · Oct 4, 2026
The biggest 5 of 44 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 44
Talked about on GitHub and Bluesky (44 times).
On GitHub · 41
- Jun 10, 2026feat: Janet compression plugin + /plugins slash command — dirge-code/dirge1 reaction · 2 comments
- Oct 4, 2026Clean up the Google Sheet so the graph gets real topics (Category values, duplicates, empty tabs) — Amitro123/knowledgeBase-Agent0 reactions · 3 comments
- Oct 4, 2026agent-skills.github.yvgude.lean-ctx: 3.10.2 → 3.10.5 — sudosubin/agents.nix0 reactions
- Oct 3, 2026agent-skills.github.yvgude.lean-ctx: init at 3.10.2 — sudosubin/agents.nix0 reactions
- Sep 20, 2026Freshness: lean-ctx v3.10.1 -> v3.10.5 — thoroc/context-radar0 reactions
36 more on GitHub
- Sep 17, 2026Feature request: add lean-ctx as a Token Saver (external /v1/compress — verified compatible with the Headroom slot) — decolua/9router0 reactions
- Sep 6, 2026Feature request: MCP Tasks support for background ctx_shell jobs with polling fallback and standardized status notifications — tryweb/ai-engkit0 reactions · 2 comments
- Aug 30, 2026feat: add custom agent tool SDK — Thinkery-AG/leanctx-sdk0 reactions
- Aug 14, 2026claude-proxy-rs: expand text-noise pattern catalog (LeanCTX-inspired) — tstapler/consolette0 reactions · 1 comment
- Aug 11, 2026Add lean-ctx — conda-forge/staged-recipes0 reactions · 2 comments
- Aug 11, 2026claude-proxy-rs: expand text-noise pattern catalog (LeanCTX-inspired) — tstapler/dotfiles0 reactions · 1 comment
- Aug 2, 2026Freshness: lean-ctx v3.9.12 -> v3.10.1 — thoroc/context-radar0 reactions
- Jul 30, 2026Token Optimizer List — haseeb-heaven/token-zero-studio0 reactions · 1 comment
- Jul 26, 2026docs(rules): correct lean-ctx tool-denial claims and cap's per-project skill assertion — arjaygg/dotfiles-omerxx0 reactions
- Jul 19, 2026Freshness: lean-ctx v3.9.11 -> v3.9.12 — thoroc/context-radar0 reactions
- Jul 17, 2026renovate(mise): Update dependency github:yvgude/lean-ctx to v3.9.5 — y-miyazaki/config0 reactions
- Jul 16, 2026Freshness: lean-ctx unrecorded -> v3.9.11 — thoroc/context-radar0 reactions · 1 comment
- Jul 15, 2026fix(github-release): update release github:yvgude/lean-ctx ( v3.9.8 → v3.9.10 ) — david-driscoll/home-operations0 reactions · 1 comment
- Jul 14, 2026Update dependency github:yvgude/lean-ctx to v3.9.9 - autoclosed — david-driscoll/dotfiles0 reactions · 1 comment
- Jul 11, 2026ci: add clippy, fmt, and cargo-deny gates behind a CI Green aggregator — getappz/agentflare0 reactions · 2 comments
- Jul 10, 2026Update dependency github:yvgude/lean-ctx to v3.9.5 — david-driscoll/dotfiles0 reactions · 1 comment
- Jul 8, 2026[Bug]: WSL agent discovery fails when claude/codex are shell aliases; please use type -P or absolute path detection — stablyai/orca0 reactions · 1 comment
- Jul 8, 2026[Build Infra] lean-ctx install step fails with HTTP 403 — GitHub API rate limit blocks CI — tryweb/ai-engkit0 reactions · 1 comment
- Jul 6, 2026fix(github-release): update release github:yvgude/lean-ctx ( v3.9.0 → v3.9.1 ) — david-driscoll/home-operations0 reactions · 1 comment
- Jul 5, 2026lean-ctx Integration — toon-format/toon-rust0 reactions · 1 comment
- Jul 2, 2026docs(readme): update lean-ctx comparison row — headroomlabs-ai/headroom0 reactions · 1 comment
- Jul 2, 2026docs(readme): fix lean-ctx Reversible column — it ships 5 recovery paths — headroomlabs-ai/headroom0 reactions · 2 comments
- Jul 2, 2026README "Compared to" table: lean-ctx row lists Reversible: No — it ships five recovery paths — headroomlabs-ai/headroom0 reactions
- Jul 2, 2026fix: Verifiable Memory Vault: external time-anchor (RFC 3161 + transparency log) + C2PA composition (fixes #1740) — alex-place/lantern-os0 reactions · 4 comments
- Jun 30, 2026Verifiable Memory Vault: external time-anchor (RFC 3161 + transparency log) + C2PA composition — alex-place/lantern-os0 reactions · 3 comments
- Jun 19, 2026[Request]: LeanCTX — ScoopInstaller/Main0 reactions
- Jun 12, 2026Stack with lean-ctx — paql4711/agent-space0 reactions
- Jun 6, 2026content(mcp): add LeanCTX MCP Server — JSONbored/awesome-claude0 reactions · 2 comments
- Jun 5, 2026Lean-Ctx support — cortexkit/aft0 reactions · 3 comments
- May 25, 2026refactor: replace RTK/Reasonix with lean-ctx, fix config schema — alfathhh/hataf-hermes0 reactions
- May 25, 2026refactor: replace RTK + Reasonix with lean-ctx, fix config schema — alfathhh/hataf-hermes0 reactions
- May 21, 2026Investigate LeanCTX — mnemosyne-systems/orangu0 reactions
- May 9, 2026Lean-ctx — github/gh-aw-firewall0 reactions
- Apr 28, 2026Add lean-ctx to Tools section — jim-schwoebel/awesome_ai_agents0 reactions
- Apr 24, 2026[FEATURE] Ability to replace rtk with lean-ctx — headroomlabs-ai/headroom0 reactions · 1 comment
- Apr 17, 2026Plugin proposal: lean-ctx — Claude Code context optimization MCP (649⭐, Rust, zero telemetry) — EnterOS-AI/enter-os-core0 reactions · 1 comment
On Bluesky · 3
- May 24, 2026yvgude / lean-ctx: Lean Cortex -- the cognitive context layer for agentic systems. 51+ MCP tools, 10 read modes, 95+ shell patterns. Up to… — @rusttrending.bsky.social6 likes and reposts
- May 9, 2026Context reduction for local #development. #MCP tools, #CLI, Hooks to #Harness #codeagents. Build-in #knowledgegraph, BM25 & Vector search.… — @qdrddr.bsky.social5 likes and reposts
- Jun 10, 2026公式READMEは、通常の削減を 60-90%、99%級は cached re-reads と案内している。しかも「session memory persists across chats」「knowledge graph」とも書いている。💎… — @sara-echosphere.bsky.socialsays it tested it0 likes and reposts · 1 reply
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 1,533 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository7 other files it gives its agents.
- AGENTS.mdAGENTS.md
- rust/AGENTS.mdAGENTS.md
- rust/CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- llms.txtllms.txt
- lean-ctx-reviewSkill
- lean-ctxSkill
The file
We split this compression-safety.mdc into the rules it gives an agent
7 rules. About 0 are common, 1 is distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
If your commit is blocked, the file was corrupted.
- Very specific: line 22
Always use LEAN_CTX_DISABLED=1 when restoring files from git:
- Very specific: line 29
NEVER use git show commit:file > file — the shell redirect writes compressed output.
- Very specific: line 33
If a file shrinks after StrReplace or contains [lean-ctx: text:
- Very specific: line 35
Use LEAN_CTX_DISABLED=1 sed -i '' 's/old/new/g' <file> for the edit
- Very specific: line 36
Verify: wc -l + rg '[lean-ctx:' <file> must show 0
- Very specific: line 47
Commit files containing [lean-ctx: omitted or --- lean-ctx: text
≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
# Compression Safety — Prevent lean-ctx Marker Corruption ## The problem lean-ctx shadow-mode hooks compress file reads. If an edit tool (StrReplace, Write) reads through the hook, it sees compressed content and writes markers like `[lean-ctx: omitted N lines]` back to disk. This silently destroys file content. ## Rules for ALL agents ### Never write compressed content to files The pre-commit hook blocks commits containing `[lean-ctx: omitted` markers. If your commit is blocked, the file was corrupted. Fix: ```bash LEAN_CTX_DISABLED=1 git restore --source=HEAD -- <file> ``` ### File restoration commands Always use `LEAN_CTX_DISABLED=1` when restoring files from git: ```bash LEAN_CTX_DISABLED=1 git restore --source=<commit> -- <file> LEAN_CTX_DISABLED=1 git checkout <commit> -- <file> ``` NEVER use `git show commit:file > file` — the shell redirect writes compressed output. ### When StrReplace produces unexpected results If a file shrinks after StrReplace or contains `[lean-ctx:` text: 1. `LEAN_CTX_DISABLED=1 git restore --source=HEAD -- <file>` 2. Use `LEAN_CTX_DISABLED=1 sed -i '' 's/old/new/g' <file>` for the edit 3. Verify: `wc -l` + `rg '[lean-ctx:' <file>` must show 0 ### Environment variable: `LEAN_CTX_DISABLED` Set `LEAN_CTX_DISABLED=1` to bypass ALL lean-ctx compression for a command. This is the escape hatch for any compression-related issue. ## NEVER do - Pipe `git show` output to a file without `LEAN_CTX_DISABLED=1` - Trust `wc -l` output that's significantly lower than expected - Commit files containing `[lean-ctx: omitted` or `--- lean-ctx:` text
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

