lean-ctx

GitHub

通过压缩LLM上下文(最高99%)和提供81个MCP工具,优化AI代理的文件读取、代码搜索及Shell执行效率。支持树状AST分析和锚点编辑,旨在减少Token消耗并提升开发工作流性能。

skills/lean-ctx/SKILL.md AjayIrkal23/agentic-mercy-10x

Trigger Scenarios

需要高效读取大型文件或代码库时 执行Shell命令需压缩输出以节省上下文 进行代码搜索或目录结构探索时 使用锚点模式进行精准文件编辑

Install

npx skills add AjayIrkal23/agentic-mercy-10x --skill lean-ctx -g -y
More Options

Use without installing

npx skills use AjayIrkal23/agentic-mercy-10x@lean-ctx

指定 Agent (Claude Code)

npx skills add AjayIrkal23/agentic-mercy-10x --skill lean-ctx -a claude-code -g -y

安装 repo 全部 skill

npx skills add AjayIrkal23/agentic-mercy-10x --all -g -y

预览 repo 内 skill

npx skills add AjayIrkal23/agentic-mercy-10x --list

SKILL.md

Frontmatter
{
    "name": "lean-ctx",
    "description": "Context Engineering for AI Agents — 81 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."
}

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

Core Tools (10 always visible)

Tool Purpose
ctx_read(path, mode) Read file with compression and caching
ctx_search(pattern, path) Search code with compressed results
ctx_shell(command) Run shell with compressed output
ctx_tree(path, depth) Directory listing
ctx_patch(path, ops) Anchored editing (line+hash, no old-text echo)
ctx_session(action) Session state and persistence
ctx_knowledge(action) Project knowledge across sessions
ctx_overview(task) Task-relevant project map
ctx_graph(action) Code relationships and impact
ctx_call(name, args) Invoke any tool by name

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

Mode When
anchored Files you will edit (full text + N:hh| anchors for ctx_patch)
full Verbatim cached read
map Context-only (deps + exports)
signatures API surface only
diff After edits (changed lines)
aggressive Large files, syntax-stripped; JSON arrays row-deduped (lossless)
entropy Shannon filtering
task Task-relevant lines
lines:N-M Specific range
auto System 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

Version History

  • 581d130 Current 2026-07-19 09:12

Same Skill Collection

attic/2026-07-09/skills-pre-update/taste-skill/SKILL.md
attic/2026-07-09/skills-pre-update/ui-ux-pro-max/SKILL.md
skills/agent-development/SKILL.md
skills/api-and-interface-design/SKILL.md
skills/api-contract-standards/SKILL.md
skills/architect-system-design/SKILL.md
skills/backend-api-standards/SKILL.md
skills/backend-code-review/SKILL.md
skills/backend-error-handling/SKILL.md
skills/backend-performance-standards/SKILL.md
skills/backend-standards-always-follow/SKILL.md
skills/canary-playwright/SKILL.md
skills/caveman/SKILL.md
skills/ci-cd-and-automation/SKILL.md
skills/code-execution-standard/SKILL.md
skills/code-review-and-quality/SKILL.md
skills/code-simplification/SKILL.md
skills/codebase-design/SKILL.md
skills/codebase-start-point-guide/SKILL.md
skills/command-development/SKILL.md
skills/composition-patterns/SKILL.md
skills/context-engineering/SKILL.md
skills/dead-code-and-change-audit/SKILL.md
skills/debug-investigation/SKILL.md
skills/debugging-and-error-recovery/SKILL.md
skills/deprecation-and-migration/SKILL.md
skills/design-extract/SKILL.md
skills/design-review-playwright/SKILL.md
skills/diagnose/SKILL.md
skills/documentation-and-adrs/SKILL.md
skills/domain-modeling/SKILL.md
skills/domain-scaffold-patterns/SKILL.md
skills/doubt-driven-development/SKILL.md
skills/dox-doc-tree/SKILL.md
skills/eval-harness/SKILL.md
skills/fix-lint-format/SKILL.md
skills/forensic-change-coupling/SKILL.md
skills/forensic-complexity-trends/SKILL.md
skills/forensic-debt-quantification/SKILL.md
skills/forensic-hotspot-finder/SKILL.md
skills/frontend-api-standards/SKILL.md
skills/frontend-code-review/SKILL.md
skills/frontend-response-handling/SKILL.md
skills/frontend-server-data-patterns/SKILL.md
skills/frontend-standards-always-follow/SKILL.md
skills/frontend-structure-standards/SKILL.md
skills/frontend-ui-engineering/SKILL.md
skills/git-workflow-and-versioning/SKILL.md
skills/golang-patterns/SKILL.md
skills/golang-testing/SKILL.md

Metadata

Files
0
Version
fc73590
Hash
4b4fecc8
Indexed
2026-07-19 09:12

Home - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-05 22:40
浙ICP备14020137号-1 $Map of visitor$