the full inventory

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.

24 MCP tools25 CLI commands30+ languages50-90% reductionEvery cut reversibleEvery cut verified
Layer 0

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.

warden_index
warden index → 847 files, 12,403 symbols, 8,291 calls

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.

warden_call_graph
warden graph authMiddleware → 5 callers, 3 callees

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.

warden_impact
warden impact src/auth/login.ts → 7 dependents, 12 callers, risk: medium

Architecture overview

Project structure in one call: languages, packages, entry points, hotspots, total counts. Understand a codebase without reading 20 files first.

warden_architecture
warden architecture → 3 languages, 8 packages, 42 entry points

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.

warden_search_symbols
warden search "auth*" → 8 symbols across 4 files

Dead code detection

Find functions with zero callers — potential dead code. Exports are excluded (they're API surface). Clean up safely with structural evidence.

warden_dead_code
warden dead-code → 14 uncalled functions found
Layer 1

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.

warden_context_select
warden context "fix null pointer in auth.ts" → 6 files recommended

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.

warden_context_select
6 files, 2,400 lines → 340 lines of relevant slices + outlines

2-hop symbol expansion

new

When 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.

warden_context_select
login.ts (full) + jwt.ts (signatures: validateToken, refreshToken) + config.ts (signatures)
Layer 2

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.

warden_grep
warden_grep pattern="auth" → 200 matches → 12 relevant (-79%)

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.

warden_file_read
warden_file_read path="src/server.ts" → 903 lines → 47-line slice + 23 headers

AST-based outlines

new

When 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'.

warden_file_read
L42: export async function login(user: string, pass: string): Promise<AuthResult>

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.

warden_run_tests
warden_run_tests → 5,000 lines → 3 failures + context (-94%)

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.

warden_run_command
warden_run_command cmd="npm run build" → 847 lines → 12 errors + warnings

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.

warden_prune
warden prune -t generic -i output.txt → auto-routed to best pruner
CCR

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.

warden_retrievewarden_ccr_status
warden_retrieve("bb1baef1d59c") → full 903-line original restored

Slice-based retrieval

new

Instead 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.

warden_retrieve
warden_retrieve("bb1baef1d59c", around="login", context=10) → 21 lines

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.

warden_ccr_status
warden ccr cleanup --days 7 → 14 entries removed
Layer 3

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.

warden_memory_save
warden memory save --category decision --title "Use Stripe for payments" --tags payments,billing

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.

warden_memory_recall
warden memory recall -q "payment" → 2 relevant memories

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.

warden_memory_save
conflict detected: 'Use PayPal' conflicts with 'Use Stripe' [payments, billing]

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.

warden_status
Warden active — 2 memories found for 'payment processing'
Layer 4

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.

warden_record_outcome
warden_record_outcome({ task: "fix null pointer", success: true, pruned: true, tokensSaved: 500 })

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.

warden_outcome_stats
47 tasks | pruned: 94% success | raw: 96% success | no regression detected

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.

warden budget
warden budget set --scope project:default --limit 500000 → cap enforced
Layer 5

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.

warden ruleswarden init
warden rules → writes compression rules to 4 agent config files

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.

warden compresswarden_compress
warden compress CLAUDE.md → 4,200 → 2,856 tokens (-32%)

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.

warden rules
auto-clarity triggers on: security warnings, destructive ops, breaking changes
Layer 7

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

new

warden_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.

warden_handoff
warden_handoff({ read: true }) → "Previous session: 2 decisions, 5 tasks, 12 files"

Generate at session end

new

warden_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.

warden_handoff
warden_handoff({}) → 2 memories, 5 outcomes, 12 files, 5 decisions in 280 words

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.

warden_handoff
warden handoff --hours 4 → covers last 4 hours of activity
Safety

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.

automatic
guard: every line verbatim ✓ → pruned output shipped

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.

warden promotewarden revert
shadow (0.94 confidence) → canary (10% traffic) → active (100%)

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.

warden watchdog
watchdog: 3 canary tasks re-run every 5 min → auto-revert on regression

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.

warden doctor
warden doctor → 10/10 checks passed
Observability

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.

warden hud
warden hud → live dashboard, refreshes every 2s

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.

warden dashboard
warden dashboard → localhost:7878

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.

warden status
warden status → 4 rules active, 12,403 tokens saved, 2 memories

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.

warden exportwarden report
warden export --format csv → audit_trail.csv

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.

warden benchmark
warden benchmark → grep: -79%, fileread: -94%, testlog: -91%

Stop burning tokens on noise.

Install Warden, run init, and your agent automatically prunes every tool output — with verification that nothing got worse.

npm install -g warden-ai && warden init