What is
context engineering?
It's the shift from prompt engineering to context operations, the discipline of designing, compressing, and governing the full information environment your AI agent works in. LeanCTX is that discipline, automated.
Prompts alone aren't enough
Prompt engineering optimized the input. Context engineering optimizes the environment.
When AI agents were limited to single-turn interactions, prompt engineering was sufficient. You crafted the right instruction, the model returned a useful response, and the workflow ended.
Modern AI coding agents operate differently. They run multi-step workflows across dozens of files, maintain state across sessions, and make decisions that compound over time. The prompt is no longer the bottleneck, the context is.
A coding agent with a perfect prompt but poor context will hallucinate file paths, lose track of prior decisions, and repeat work it already completed. The failure mode isn't bad instructions, it's an incomplete picture of the codebase.
Three shifts from prompt to context engineering
Context engineering represents a fundamental change in how we think about AI agent inputs.
Static prompts → Dynamic context pipelines
Instead of a fixed system prompt, context engineering builds a pipeline that assembles the right context for each task, reading only what's relevant, at the right compression level, with the right metadata.
Manual curation → Automated compression
Rather than hand-picking which files to include, context engineering reads each file's structure, keeps the parts that carry real signal, and compresses the rest, automatically.
Single-shot → Persistent memory across sessions
Context engineering adds session memory, a knowledge graph, and clean handoffs, so agents build up understanding over time instead of starting from scratch every conversation.
What context engineering includes
Context engineering spans four interconnected domains, each addressing a different aspect of the agent's information environment.
Fit more signal into fewer tokens
Multiple read modes (full, map, signatures, entropy, aggressive), tree-sitter AST parsing across 18+ languages, and semantic chunking reduce file content by 60–99% while preserving the information agents need to make decisions.
Persist understanding across sessions
Session snapshots, knowledge graphs, handoff ledgers, and prospective memory allow agents to recall prior decisions, avoid repeated work, and transfer context between team members or agent instances.
Control what agents can access
Role-based access policies, token budgets, SLO enforcement, and path sandboxing ensure agents operate within defined boundaries, reading only what they should, spending only what's allocated.
Prove compression didn't lose information
Output validation, proof artifacts, path and identifier preservation checks, and information-loss scoring give measurable confidence that compressed context retains the semantic content the agent requires.
How LeanCTX implements context engineering
LeanCTX is an open-source context engineering runtime that brings these principles into production for AI coding agents.
76 MCP tools
A full tool surface for reading, searching, compressing, and managing context, all exposed via the Model Context Protocol.
10 read modes
From full cached reads to entropy-filtered compression, each mode is optimized for a specific task: editing, exploring, reviewing, or referencing.
95+ shell patterns
Pattern-based compression for git, cargo, npm, docker, and other CLI output, reducing verbose command results to structured, token-efficient summaries.
Zero network calls
Runs entirely local. No telemetry, no cloud dependencies, no data leaving your machine. Open-source under Apache-2.0.
Context engineering, answered.
What is context engineering?
Context engineering is the discipline of managing what information an AI agent sees, remembers, and acts on. It replaces ad-hoc prompt engineering with a systematic runtime that compresses, caches, verifies, and governs AI context.
Why does context engineering matter for AI coding?
AI coding agents waste thousands of tokens rereading files, parsing noisy shell output, and losing context between sessions. Context engineering reduces this waste by up to 99%, making agents faster, cheaper, and more reliable.
How is context engineering different from prompt engineering?
Prompt engineering focuses on crafting individual prompts. Context engineering manages the entire information lifecycle — what the agent reads, how it is compressed, what is cached, what is remembered across sessions, and what is verified before delivery.
Start engineering your context
LeanCTX is free, open-source, and installs in under a minute. See what context engineering can do for your AI workflow.