AugmentClaude

Lean Context

Compress AI context by up to 99% when reading files, searching code, and running commands.

Installation

  1. Make sure Claude is on your device and in your terminal.

    Skills load from ~/.claude/skills/ when Claude Code starts up β€” so you need it on your machine first. If you don't have it yet, install it once with the command below, then run claude in any terminal to verify.

    One-time setup
    npm i -g @anthropic-ai/claude-code

    Already have it? Skip ahead.

  2. Paste into Claude Code or into your terminal.

    This copies the whole skill folder into ~/.claude/skills/lean-ctx-yvgude/ β€” the SKILL.md plus any scripts, reference docs, or templates the skill ships with. Safe default: works for every skill.

    Faster alternative (instruction-only skills)

    Skips the clone and grabs only the SKILL.md file. Don't use this if the skill ships Python scripts, reference markdowns, or asset templates β€” they won't be downloaded and the skill will fail when it tries to load them.

    Quick install (SKILL.md only)
    Sign up to copy
  3. Restart Claude Code.

    Quit and reopen Claude Code (or any other agent that loads from ~/.claude/skills/). New skills are picked up on startup.

  4. Just ask Claude.

    Skills auto-activate when your request matches the skill's description β€” no slash command needed. Trigger phrases live in the skill's own frontmatter; you can read them in the β€œWhat this skill does” section above.

Prefer to read the source first? Open on GitHub.

When Claude uses it

Context Engineering for AI Agents β€” 82 MCP tools, 10 read modes, 95+ shell patterns, tree-sitter AST for 27 languages. Compresses LLM context by up to 99%. Use when reading files, running shell commands, searching code, or exploring directories. Auto-installs if not present.

What this skill does

lean-ctx β€” Context Engineering for AI Agents

Setup

which lean-ctx || curl -fsSL https://raw.githubusercontent.com/yvgude/lean-ctx/main/skills/lean-ctx/scripts/install.sh | bash
lean-ctx setup

Tool Visibility Profiles

ProfileTools advertised
Lean (default, unpinned)ctx_read, ctx_shell, shell, ctx_search, ctx_glob, ctx_tree, ctx_session, ctx_compose, ctx_callgraph, ctx_patch*, ctx_call, ctx_expand
minimalctx_read, ctx_shell, ctx_search, ctx_glob, ctx_tree; ctx_call is also advertised as the fallback invoker
standardMinimal + ctx_compose, ctx_explore, ctx_knowledge, ctx_session, ctx_callgraph, ctx_graph, ctx_delta, ctx_execute, ctx_expand, ctx_overview, ctx_url_read, ctx_patch; ctx_call is also advertised as the fallback invoker
powerFull public tool registry

* Lean hides ctx_patch for clients with a reliable native editor. Disabled tools, role policy, and client compatibility can further narrow every profile.

Shell Hook (use instead of raw exec)

lean-ctx -c "git status"
lean-ctx -c "cargo test"
lean-ctx -c "npm install"
lean-ctx ls src/

ctx_read Modes

ModeWhen
anchoredFiles you will edit (full text + N:hh| anchors for ctx_patch)
fullVerbatim cached read
mapContext-only (deps + exports)
signaturesAPI surface only
diffAfter edits (changed lines)
aggressiveLarge files, syntax-stripped; JSON arrays row-deduped (lossless)
entropyShannon filtering
taskTask-relevant lines
lines:N-MSpecific range
autoSystem selects optimal

Re-reads cost ~13 tokens. fresh=true bypasses cache. Redundant JSON (arrays of like objects) is crushed losslessly into a compact _defaults + per-row form; if a slice was dropped, recover it with ctx_expand(id, json_path=… | search=…).

File Editing

Anchored editing saves output tokens: ctx_read(mode="anchored") β†’ ctx_patch(path, op, line, hash, new_text). Never reproduce old text byte-for-byte; batch via ops:[…]; op=create writes new files. Stale anchor β†’ CONFLICT with fresh anchors (retry once). Native Edit/StrReplace stay fine; ctx_edit (str_replace) is the legacy fallback via ctx_call/power profile.

More Tools (via ctx_call or ctx_load_tools)

Architecture: ctx_symbol, ctx_callgraph, ctx_impact, ctx_architecture, ctx_routes, ctx_smells, ctx_quality ↳ "What breaks if I change this file/class/type?" β†’ ctx_impact (file-level blast radius; resolves same-package/namespace type usage with no import for C#, Java, Go and Kotlin). "Who calls this function?" β†’ ctx_callgraph (symbol-level). "How navigable / how much is complexity costing me?" β†’ ctx_quality (navigability score + token quality tax). Multi-agent: ctx_agent, ctx_share, ctx_task, ctx_handoff, ctx_workflow Verify: ctx_benchmark, ctx_verify, ctx_proof, ctx_review Batch: ctx_fill, ctx_execute, ctx_expand, ctx_pack

Full docs: https://leanctx.com/docs

Related skills