the full inventory

Verified context optimization.

32 MCP tools. 25+ CLI commands. 10 layers of verified context optimization — from tree-sitter code intelligence to session handoffs. Warden doesn't just compress context. It verifies the compression is safe, tracks whether outcomes held, and gives you a full audit trail of every decision.

32 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-aware read modes

new

Five read modes beyond auto-pruning: signatures (symbol declarations only, 80-90% savings), symbol (one function by name), outline (structural headers), imports (import lines only), full (no pruning). Powered by tree-sitter. Every line verbatim — guard verified.

warden_file_read
warden_file_read mode="signatures" → 900 lines → 12 signatures (-88%) warden_file_read mode="symbol" symbolName="login" → 900 lines → 7 lines (-99%)

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

MCP proxy mode + guard-verified response pruning

new

Wrap any upstream MCP server and compress its tool descriptions. Warden spawns the upstream, intercepts tools/list responses, and compresses description fields. Uniquely, --prune-responses also prunes tools/call response content behind the trust guard: removal-only, every retained line byte-for-byte verbatim from the raw. Description-only compressors deliberately never touch responses because rewriting is unsafe — Warden's guard makes it safe. Opt-in. Works with any MCP client.

warden proxy--prune-responses
warden proxy npx @modelcontextprotocol/server-filesystem /tmp --prune-responses → ~79% on large tool results, guard-verified

Lazy-loading meta-tools + inputSchema compression

new

--lazy replaces the full tool catalog with 3 meta-tools (warden_list_tools, warden_get_tool_schema, warden_invoke_tool). The client sees a tiny surface and loads schemas on demand. Measured 97.9% catalog token reduction on a 50-tool server (14105 → 297 tokens). Enabled by default. --compress-schema strips cosmetic JSON-Schema fields (title, default, examples) and compresses property descriptions — 21.5% additional reduction. Never touches validation constraints. Also enabled by default.

warden proxy--lazy--compress-schema
warden proxy npx some-mcp-server --lazy --lazy-level medium --compress-schema → 97.9% catalog reduction + 21.5% schema reduction
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 hybrid search: FTS5 keyword + semantic vector (all-MiniLM-L6-v2, local ONNX). 'login' finds 'authentication' with zero keyword overlap. 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

Hybrid search (FTS5 + semantic)

Recall uses two strategies merged via Reciprocal Rank Fusion (RRF): FTS5 keyword search (porter-stemmed) for exact term matching, and vector semantic search (all-MiniLM-L6-v2, 384-dim, local ONNX) for intent matching. 'login' finds 'authentication' — 'credit card' finds 'Stripe' — even with zero keyword overlap. Falls back to FTS5-only if the model is unavailable.

warden_memory_recall
warden memory recall -q "login" → finds "Use JWT for authentication" (semantic match)

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'

Decision lifecycle — reaffirm, supersede, archive

new

Decisions aren't static. Reaffirm boosts confidence when a decision is confirmed again. Supersede links an old decision to its replacement. Archive marks decisions as no longer relevant. Mark contested flags disagreement. Reject kills bad ideas. Full lifecycle, tracked in schema.

warden_memory_reaffirmwarden_memory_archivewarden_memory_mark_contestedwarden_memory_reject
warden_memory_reaffirm({ id: 42 }) → reaffirmedCount: 3, lastReaffirmedAt: 2026-08-11

Failed approach tracking

new

When something doesn't work, Warden remembers. Save a failed_approach memory with outcome='failure' and evidence. Later, when starting a similar task, warden_memory_failed_approaches surfaces warnings — don't repeat past mistakes.

warden_memory_failed_approaches
warden_memory_failed_approaches({ query: "session storage" }) → WARNING: Redis for sessions — failure

Structured provenance

new

Every memory carries sourceType (documentation, commit, experiment, observation), evidence (array of citations), scope (e.g. 'order-service'), and outcome. Decisions are traceable — not just 'someone decided X' but 'decided X because of Y, confirmed by Z'.

warden_memory_save
save({ sourceType: "documentation", evidence: ["docs/arch.md", "commit 82ac19"], scope: "order-service" })
Layer 3b

Git context

File history, blame, and churn metrics — know if code is stable or volatile before you touch it. Integrates with git directly, no external services.

File history

new

Recent commits that touched a file, with author, date, and message. See who changed what and why — without leaving the agent. Up to 10 recent commits, sorted newest first.

warden_git_context
warden_git_context({ filePath: "src/auth.ts" }) → 4 commits, last: "fix: token expiry check"

Change frequency & churn

new

Total commits, lines added, lines deleted, churn score (lines per commit). High churn = volatile file = expect recent changes, tread carefully. Low churn = stable = safe to build on.

warden_git_context
auth.ts: 8 commits, churn 42 lines/commit — volatile file detected

Line-level blame

new

Optional blame output for a line range. See which commit last touched each line, who wrote it, and when. Useful for understanding why code looks the way it does before changing it.

warden_git_context
warden_git_context({ filePath: "auth.ts", startLine: 42, endLine: 50, includeBlame: true })
Layer 1b

Sufficient context

One call. Everything the agent needs — file recommendations, past decisions, failed approach warnings, git volatility, and token budget trimming. The integration layer that combines all Warden layers into a single response.

Unified context package

new

warden_sufficient_context wraps context selection with memory recall, failed approach warnings, git churn metrics, and file categorization (direct, dependency, test, config, doc). One call replaces four. The agent gets the full picture before starting work.

warden_sufficient_context
warden_sufficient_context({ task: "fix auth token expiry" }) → 3 files + 2 decisions + 1 failed approach warning

Token budget trimming

new

Set a token budget and Warden trims the package to fit — keeping the highest-relevance files first. Reports tokensUsed, tokensBudget, and whether trimming occurred. No more oversized context windows.

warden_sufficient_context
warden_sufficient_context({ task: "...", tokenBudget: 2000 }) → used: 1847, budget: 2000, trimmed: yes

Volatility notes

new

Files with more than 5 commits are flagged as volatile. The agent sees a warning: 'auth.ts: 8 commits — volatile, expect recent changes'. Know which files are actively churned before you start editing.

warden_sufficient_context
VOLATILITY NOTES: auth.ts — 8 commits, churn 42 lines/commit — volatile file
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

Task reports with overhead timing

new

Per-task or project-wide reports: prune calls, tokens saved, guard pass rate, per-rule breakdown, task outcomes, and CCR stats. Includes Warden's own overhead (processing time + estimated overhead tokens) — net tokens saved = gross minus overhead. Warden measures itself.

warden_task_report
warden task-report --all → 143 calls, 186K saved, overhead: 34ms, net: 186,004 tokens
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