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.

ToolWhat it doesSavings
ctx_readSmart file read with 10 read modes + session cachingup to 99%
ctx_multi_readBatch file reads in one callfewer round-trips
ctx_treeCompact project structure maps34-60%
ctx_shellShell commands with 95+ pattern compression. Use raw=true for uncompressed output.
ctx_searchRegex code search with compact results50-80%
ctx_editContext-aware file editor with create, replace, and replace_all-
ctx_deltaShow only changed lines since last read80-95%
ctx_smart_readIntelligent single-call read with auto-modevaries
ctx_semantic_searchHybrid semantic search (BM25 + embeddings) - find code by meaning, even without keyword overlapvaries
ctx_globFind files by glob pattern (gitignore-aware, multi-root)60-90%
shellExecute a shell command with compressed output (95+ patterns)60-95%
ctx_providerExternal context providers: GitHub, GitLab, Jira, Postgres, MCP, REST-
ctx_discover_toolsSearch available lean-ctx tools by keyword-
ctx_multi_repoMulti-repo management and cross-repo search (RRF ranking)varies
ctx_url_readFetch a web page, PDF, feed, or YouTube URL as cited contextvaries
ctx_git_readRead 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.

ToolWhat it does
ctx_fillPriority-based context filling with a token budget
ctx_intentSemantic intent detection + auto file loading
ctx_graphPersistent project dependency graph (build, related, symbol, impact)
ctx_dedupCross-file deduplication analysis
ctx_responseBi-directional response compression
ctx_discoverShell history analysis for missed compression opportunities
ctx_preloadProactive context loader - caches task-relevant files at session start
ctx_overviewProject overview with structure, entry points, and key files
ctx_prefetchPre-load files based on task context and changed files
ctx_indexBuild and refresh the code-intelligence index (symbols, graph, tree-sitter)
ctx_compress_memoryCompress memory/config markdown (preserve code/URLs) + create .original backup
ctx_impactImpact analysis: trace dependency chains and build graphs
ctx_architectureGraph-based architecture analysis: clusters, layers, cycles
ctx_analyzeEntropy analysis - recommends optimal compression mode
ctx_composeTask composer: keywords, ranked files, match locations, and the top symbol inline
ctx_expandRetrieve archived/firewalled tool output (zero-loss) by ID
ctx_retrieveRetrieve original uncompressed content from the session cache (CCR)
ctx_repomapPageRank repo map of the most important symbols across the codebase
ctx_toolsGateway 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.

ToolWhat it does
ctx_sessionCross-chat session memory (task, findings, decisions)
ctx_compressCompact context checkpoint for chat continuation
ctx_benchmarkReal token counts per mode - single file or project-wide
ctx_metricsSession statistics with USD cost estimates
ctx_radarFull context budget breakdown: system prompt, messages, tools, reads, and shell
ctx_cacheExplicit cache management (status, clear, invalidate)
ctx_gainQuery token savings, GainScore (0–100), cost breakdowns, task classifications, and per-agent statistics. Powered by the GainEngine with embedded ModelPricing.
ctx_heatmapFile access heatmap - find hot files and cold directories
ctx_checkpointShadow git history of the agent's changes (snapshot/log/diff/restore)
ctx_ledgerContext ledger ops (status/reset/evict) for managing context pressure
ctx_artifactsContext artifact registry + BM25 index (list/index/search)
ctx_verifyVerification observability: tool-call stats and ContextProofV2
ctx_controlUniversal context manipulation: exclude/include/pin/set_view/priority
ctx_load_toolsLoad or unload specialized tool categories on demand
ctx_pluginsPlugin 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.

ToolWhat it does
ctx_knowledgePersistent project knowledge store - remember facts across sessions
ctx_agentMulti-agent coordination - register, post, handoff tasks, sync status
ctx_shareMulti-agent context sharing - push/pull cached file contexts between agents
ctx_taskTask delegation and tracking across agents
ctx_costCost attribution - track token spend per agent and tool
ctx_summaryRecord and recall compact AI session summaries (task, files, decisions, next steps)
ctx_contextMulti-turn context state overview

View full Memory & Multi-Agent documentation →


Workflow & Orchestration

State machines, context handoff, sandboxed code execution, and quality feedback loops.

ToolWhat it does
ctx_workflowState-machine workflows with step ordering and evidence
ctx_handoffContext transfer between sessions or agents
ctx_executeSandboxed code execution in 11 languages
ctx_feedbackQuality feedback: latency, token counts, model info
ctx_packContext Package Manager: PR context and shareable project packages
ctx_proofExport a machine-readable ContextProofV1 (Verifier + SLO + Pipeline + Provenance)
ctx_compileContext compilation (CFT): minimal package via greedy knapsack + Boltzmann views
ctx_planContext planning (CFT): optimal plan with Phi scoring and budget allocation
ctx_callInvoke any non-core lean-ctx tool by name
ctx_rulesCross-agent rules governance: sync, diff, lint, status, init
ctx_packageSave or resume portable context packages (session state + knowledge)
ctx_skillifyCodify 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.

ToolWhat it does
ctx_symbolFind symbol definitions across 18 languages
ctx_callgraphCaller and callee graph for a function across the codebase
ctx_outlineStructural outline of a file
ctx_routesExtract HTTP routes from web frameworks
ctx_smellsCode smell detection with graph-enriched scoring (long functions, deep nesting, complexity)
ctx_refactorLSP/IDE refactoring: rename, move, symbol-body edits, reformat (JetBrains two-phase)
ctx_reviewAutomated code review: impact, caller tracking, and test discovery

View Analysis & Navigation docs →