Tools
Tool Reference
Complete reference for all 76 LeanCTX context layer tools, organized by category.
LeanCTX provides 76 MCP tools organized into six categories. Each tool is used by the AI automatically — you don't need to learn or type any of these commands.
Core Tools: File & Code
The foundation. These handle file reading, directory exploration, command execution, and code search - the operations that make up 90% of AI coding interactions.
| Tool | What it does | Savings |
|---|---|---|
ctx_read | Smart file read with 10 read modes + session caching | up to 99% |
ctx_multi_read | Batch file reads in one call | fewer round-trips |
ctx_tree | Compact project structure maps | 34-60% |
ctx_shell | Shell commands with 95+ pattern compression. Use raw=true for uncompressed output. | |
ctx_search | Regex code search with compact results | 50-80% |
ctx_edit | Context-aware file editor with create, replace, and replace_all | - |
ctx_delta | Show only changed lines since last read | 80-95% |
ctx_smart_read | Intelligent single-call read with auto-mode | varies |
ctx_semantic_search | Hybrid semantic search (BM25 + embeddings) - find code by meaning, even without keyword overlap | varies |
ctx_glob | Find files by glob pattern (gitignore-aware, multi-root) | 60-90% |
shell | Execute a shell command with compressed output (95+ patterns) | 60-95% |
ctx_provider | External context providers: GitHub, GitLab, Jira, Postgres, MCP, REST | - |
ctx_discover_tools | Search available lean-ctx tools by keyword | - |
ctx_multi_repo | Multi-repo management and cross-repo search (RRF ranking) | varies |
ctx_url_read | Fetch a web page, PDF, feed, or YouTube URL as cited context | varies |
ctx_git_read | Read a remote git repo via a cached shallow clone (tree/read/grep) | varies |
View full Core Tools documentation →
Intelligence Engine
Tools that go beyond compression - they understand your workflow, detect intent, deduplicate context, and intelligently manage token budgets.
| Tool | What it does |
|---|---|
ctx_fill | Priority-based context filling with a token budget |
ctx_intent | Semantic intent detection + auto file loading |
ctx_graph | Persistent project dependency graph (build, related, symbol, impact) |
ctx_dedup | Cross-file deduplication analysis |
ctx_response | Bi-directional response compression |
ctx_discover | Shell history analysis for missed compression opportunities |
ctx_preload | Proactive context loader - caches task-relevant files at session start |
ctx_overview | Project overview with structure, entry points, and key files |
ctx_prefetch | Pre-load files based on task context and changed files |
ctx_index | Build and refresh the code-intelligence index (symbols, graph, tree-sitter) |
ctx_compress_memory | Compress memory/config markdown (preserve code/URLs) + create .original backup |
ctx_impact | Impact analysis: trace dependency chains and build graphs |
ctx_architecture | Graph-based architecture analysis: clusters, layers, cycles |
ctx_analyze | Entropy analysis - recommends optimal compression mode |
ctx_compose | Task composer: keywords, ranked files, match locations, and the top symbol inline |
ctx_expand | Retrieve archived/firewalled tool output (zero-loss) by ID |
ctx_retrieve | Retrieve original uncompressed content from the session cache (CCR) |
ctx_repomap | PageRank repo map of the most important symbols across the codebase |
ctx_tools | Gateway to downstream MCP servers — unlimited external tools at ~constant context cost |
View full Intelligence Engine documentation →
Session & Monitoring
Session persistence, performance monitoring, compression analysis, and benchmarking - everything you need to measure and optimize your token savings.
| Tool | What it does |
|---|---|
ctx_session | Cross-chat session memory (task, findings, decisions) |
ctx_compress | Compact context checkpoint for chat continuation |
ctx_benchmark | Real token counts per mode - single file or project-wide |
ctx_metrics | Session statistics with USD cost estimates |
ctx_radar | Full context budget breakdown: system prompt, messages, tools, reads, and shell |
ctx_cache | Explicit cache management (status, clear, invalidate) |
ctx_gain | Query token savings, GainScore (0–100), cost breakdowns, task classifications, and per-agent statistics. Powered by the GainEngine with embedded ModelPricing. |
ctx_heatmap | File access heatmap - find hot files and cold directories |
ctx_checkpoint | Shadow git history of the agent's changes (snapshot/log/diff/restore) |
ctx_ledger | Context ledger ops (status/reset/evict) for managing context pressure |
ctx_artifacts | Context artifact registry + BM25 index (list/index/search) |
ctx_verify | Verification observability: tool-call stats and ContextProofV2 |
ctx_control | Universal context manipulation: exclude/include/pin/set_view/priority |
ctx_load_tools | Load or unload specialized tool categories on demand |
ctx_plugins | Plugin management: list, enable, disable, info, hooks |
View full Session & Monitoring documentation →
Memory & Multi-Agent
Cross-session memory, multi-agent coordination, and task-aware project orientation. New in v2.7.0.
| Tool | What it does |
|---|---|
ctx_knowledge | Persistent project knowledge store - remember facts across sessions |
ctx_agent | Multi-agent coordination - register, post, handoff tasks, sync status |
ctx_share | Multi-agent context sharing - push/pull cached file contexts between agents |
ctx_task | Task delegation and tracking across agents |
ctx_cost | Cost attribution - track token spend per agent and tool |
ctx_summary | Record and recall compact AI session summaries (task, files, decisions, next steps) |
ctx_context | Multi-turn context state overview |
View full Memory & Multi-Agent documentation →
Workflow & Orchestration
State machines, context handoff, sandboxed code execution, and quality feedback loops.
| Tool | What it does |
|---|---|
ctx_workflow | State-machine workflows with step ordering and evidence |
ctx_handoff | Context transfer between sessions or agents |
ctx_execute | Sandboxed code execution in 11 languages |
ctx_feedback | Quality feedback: latency, token counts, model info |
ctx_pack | Context Package Manager: PR context and shareable project packages |
ctx_proof | Export a machine-readable ContextProofV1 (Verifier + SLO + Pipeline + Provenance) |
ctx_compile | Context compilation (CFT): minimal package via greedy knapsack + Boltzmann views |
ctx_plan | Context planning (CFT): optimal plan with Phi scoring and budget allocation |
ctx_call | Invoke any non-core lean-ctx tool by name |
ctx_rules | Cross-agent rules governance: sync, diff, lint, status, init |
ctx_package | Save or resume portable context packages (session state + knowledge) |
ctx_skillify | Codify recurring patterns into versioned .cursor/rules/skillify-*.mdc files |
View Workflow & Orchestration docs →
Analysis & Navigation
Tree-sitter-powered symbol navigation, call graphs, route extraction, and structural outlining.
| Tool | What it does |
|---|---|
ctx_symbol | Find symbol definitions across 18 languages |
ctx_callgraph | Caller and callee graph for a function across the codebase |
ctx_outline | Structural outline of a file |
ctx_routes | Extract HTTP routes from web frameworks |
ctx_smells | Code smell detection with graph-enriched scoring (long functions, deep nesting, complexity) |
ctx_refactor | LSP/IDE refactoring: rename, move, symbol-body edits, reformat (JetBrains two-phase) |
ctx_review | Automated code review: impact, caller tracking, and test discovery |