Every layer. Every tool. Every cut verified.
24 MCP tools. 25 CLI commands. 10 layers of context governance — from tree-sitter code intelligence to session handoffs. Warden doesn't just compress context. It proves the compression is safe, tracks whether outcomes held, and gives you a full audit trail of every decision.
Code intelligence
Tree-sitter indexing across 30+ languages. Structural queries that replace dozens of grep/read cycles with one call.
Project indexing
Indexes every function, class, import, and call site using tree-sitter WASM parsers. Incremental — only changed files are re-parsed. One index, six query types.
Call graph queries
Find every caller or callee of any function. See the full call chain — who calls it, what it calls, where each is defined. One structural query replaces reading 10 files.
Impact analysis
Change a file, see the blast radius. Direct dependents, transitive dependents (2 hops), affected callers, and risk assessment (low/medium/high) — all in one call.
Architecture overview
Project structure in one call: languages, packages, entry points, hotspots, total counts. Understand a codebase without reading 20 files first.
Symbol search
Search for functions, classes, and types by name pattern across the indexed project. Faster and more structured than grep — returns signatures, not just matches.
Dead code detection
Find functions with zero callers — potential dead code. Exports are excluded (they're API surface). Clean up safely with structural evidence.
Context selection
Before the agent starts work, Warden scans the project and extracts only the relevant code — not file lists, the actual content.
Task-aware file recommendation
Given a task description, Warden ranks every file in the project by relevance using name matching, path proximity, recency, test association, and directory proximity. The agent loads only what matters.
Relevant slice extraction
Doesn't just recommend files — reads them and extracts the relevant sections. Code blocks matching the task, markdown sections, JSON key windows. The agent gets verbatim content, not a reading list.
2-hop symbol expansion
newWhen the code index is available, Warden automatically includes the function and class signatures of each recommended file's direct dependencies. The agent sees login.ts plus the signatures of jwt.ts, config.ts, and db.ts — without reading them.
Tool output pruning
Every tool call goes through Warden's wrappers. Content-aware routing detects the output type and applies the optimal pruner. 50-90% reduction, every call.
Grep with deduplication
Searches via ripgrep, respects .gitignore, and prunes results to matches relevant to the current task. Duplicate matches across files are deduplicated. 200 matches become 12.
File read with slice + outline
Large files get a relevant slice (the function or block matching the task) plus a structural outline of the rest. Code is never rewritten — only included or excluded. The agent sees the relevant code and knows what else is in the file.
AST-based outlines
newWhen the code index is available, file outlines use tree-sitter-parsed symbols instead of regex matching. Outlines show full signatures with parameter lists, export status, and async markers — not just 'function foo'.
Test output pruning
Runs tests and keeps failures with context, collapses passing noise. Stack traces stay verbatim. 5000 lines of test output become the 3 failures and their context.
Command output pruning
Runs any shell command and strips low-signal lines, keeping errors, warnings, and relevant content. ANSI codes stripped, paths shortened, JSON cleaned up.
Manual pruning
For tools Warden doesn't wrap. Pass any output and Warden auto-detects the content type (JSON, grep, test log, source code) and routes to the optimal pruner.
Reversible pruning
Every cut is reversible. The original output is cached in SQLite with a hash key. The agent can retrieve the full original — or a slice of it — at any time.
Full retrieval
Every pruned output includes a retrieval marker with a 12-char hash. The agent calls warden_retrieve with the hash and gets the complete original back. No guesswork, no re-running tools.
Slice-based retrieval
newInstead of retrieving the entire original, the agent can request a slice — lines around a symbol name, or an explicit line range. Get the 10 lines you need, not the 903 lines you don't.
Automatic TTL + cleanup
CCR entries auto-expire after 7 days (configurable). The cleanup command force-expires old entries. Disk usage is bounded — no unbounded growth.
Durable memory
Decisions persist across sessions in local SQLite with FTS5 full-text search. The agent recalls relevant past decisions before starting work — no re-deriving context every time.
Decision persistence
When the agent makes a durable decision — architecture choice, library selection, convention, constraint — it persists to local SQLite. Categories: decision, finding, pattern, constraint, preference. Tagged for recall.
FTS5 full-text recall
Recall uses SQLite FTS5 for full-text search across titles, bodies, and tags. Results are ranked by relevance, then by access recency — the most useful memories surface first.
Conflict detection
When saving a new decision, Warden checks for conflicts with existing memories. 'Use PayPal' after 'Use Stripe' triggers a warning — the agent resolves the contradiction before it causes problems.
Auto-surface at session start
warden_status automatically surfaces recent memories at session start. The agent sees what Warden remembers without an explicit recall call.
Outcome tracking
Not just 'did we keep the right lines' — but 'did the agent still complete the task correctly after pruning.' Real evidence, not assumptions.
Task outcome recording
After completing a task, the agent reports success or failure. Warden correlates this with whether pruning was active. Over time, this builds a real dataset of pruning impact on agent performance.
Regression detection
Warden compares success rates: pruned vs. raw. If pruned success rate drops below raw by more than 5%, that's a regression signal. The agent is told to consider reverting. This is the evidence that compression didn't degrade outcomes.
Budget caps
Set per-seat or per-project token budgets. Warden tracks spend against the cap in real time. Prevents runaway costs on long sessions or expensive models.
Response & file compression
Warden compresses what goes INTO the agent (tool outputs, file context) and what comes OUT (agent responses, memory files). Two layers of token savings.
Response compression rules
Warden writes rules to the agent's config (CLAUDE.md, AGENTS.md, .cursorrules, .devin/rules) that drop filler, pleasantries, and self-narration automatically. Code, commands, and errors stay verbatim. Max compression, always on — no config, no levels.
File compression
Memory files (CLAUDE.md, AGENTS.md) load into context every session. Verbose ones waste tokens forever. warden compress strips filler deterministically — no LLM call, free, instant, offline. Original backed up. Up to 32% reduction.
Auto-clarity for safety
When the situation is high-risk — security warnings, irreversible actions, breaking changes — compression automatically switches to full, clear sentences. Safety beats token savings. Built into the rules, not optional.
Session continuity
Sessions end. Context windows fill up. Warden generates a compact handoff document so the next session starts with the essential state — not from scratch. Automatic: the rules file tells the agent when to read and when to generate.
Read at session start
newwarden_handoff with read=true returns the previous session's handoff document. The rules file tells the agent to call this first thing — before warden_status, before memory recall. The next session picks up where the last left off: decisions made, tasks completed, files touched.
Generate at session end
newwarden_handoff (without read) generates a new handoff document: decisions made, task outcomes, files touched, pruning decisions. Under 300 words. Stored locally. The rules file tells the agent to call this at session end, before context compaction, or after significant multi-step tasks.
Incremental windowing
Handoff tracks the last generation timestamp. Each handoff covers only the window since the previous one — no duplication, no stale data. Pass --hours to override the window.
Trust guard & eval gate
The real problem Warden solves: developers can't tell whether context optimization silently degraded their agent. Warden provides compression with evidence, not assumptions.
Trust guard (line-level verification)
Every pruned output is verified: every non-annotation line must appear verbatim in the raw output, or the raw ships instead. No silent rewrites, ever. If a pruning module has a bug, the guard catches it and falls back to raw.
Eval gate (shadow → canary → active)
Every pruning rule starts in shadow mode. Warden runs it in parallel with raw output, scores parity, and only promotes once confidence is proven. Built-in rules are active by default — savings from first install. Enterprise mode starts in shadow.
Regression watchdog
A continuous watchdog re-runs canary tasks. If a model update, caching bug, or over-aggressive prune rule causes a regression, Warden auto-reverts to the last known-good config. You don't notice — Warden already fixed it.
Doctor health check
warden doctor runs 10 checks: MCP registration, rules files, pruning engine, memory system, FTS5 index, code index, CCR cache, outcome tracking, budget tracker, and database integrity. Clear pass/fail report.
Dashboard & audit
See every token saved, every pruning decision, every rule's confidence. Full audit trail in SQLite, exportable to JSON or CSV.
Live terminal HUD
warden hud runs a live, refreshing terminal dashboard — rules, stages, confidence bars, tokens saved, recent decisions. Updates every 2 seconds. Ctrl+C to exit.
Web dashboard
warden dashboard runs a real-time web UI at localhost:7878 — rule status, confidence bars, token savings charts, recent decisions, memory browser. Full visibility into what Warden is doing.
Status snapshot
One-shot snapshot of rules, confidence, tokens saved, and recent memories. The agent calls this at session start so you see Warden is working.
Audit trail export
Every pruning decision is logged in SQLite with timestamp, rule ID, tokens saved, and detail. Export the full trail to JSON or CSV for analysis or compliance.
Real-file benchmarks
warden benchmark runs actual benchmarks on real files — pruning, compression, response rules. See exact token savings per module, per file type, per content type.