Warden-AI

mcp
Security Audit
Fail
Health Warn
  • License — License: NOASSERTION
  • Description — Repository has a description
  • Active repo — Last push 0 days ago
  • Low visibility — Only 5 GitHub stars
Code Fail
  • execSync — Synchronous shell command execution in bin/postinstall.cjs
  • fs module — File system access in bin/postinstall.cjs
  • exec() — Shell command execution in src/budget/index.ts
  • exec() — Shell command execution in src/ccr/index.ts
  • exec() — Shell command execution in src/classifier/index.ts
Permissions Pass
  • Permissions — No dangerous permissions requested

No AI report is available for this listing yet.

SUMMARY

The structurally-verified context layer for AI coding agents. Cut 50-90% of your agent's token spend.

README.md

Warden

Your AI agent burns tokens on noise. Warden stops that.

npm License 30+ agents Trust Guard Local First Website


Every token your agent spends on noise is a token it didn't spend on your actual problem. Warden fixes this.

Warden is an MCP server that drops into Claude Code, Cursor, Codex, Windsurf, Cline, Gemini, and 30+ other agents. Install once. Warden prunes tool output, compresses responses, indexes your codebase, and remembers decisions across sessions — then proves every cut is safe with a verifiable trust guard.

50-90% fewer tokens. Zero config. Zero cloud. Zero lock-in.

Install

All platforms (macOS, Linux, Windows, WSL):

npm install -g warden-ai && warden init

macOS / Linux / WSL (curl one-liner):

curl -fsSL https://raw.githubusercontent.com/rynald0cst0ltziam/Warden-AI/main/install.sh | bash

Windows (PowerShell one-liner):

irm https://raw.githubusercontent.com/rynald0cst0ltziam/Warden-AI/main/install.ps1 | iex

Windows users: do NOT use the curl command in CMD or PowerShell — bash triggers WSL on Windows. Use the PowerShell or npm command above.

~10 seconds · Node >= 22.5 · skips agents you don't have · safe to re-run

warden init does everything automatically:

Step What happens
Register Warden registered as MCP server in all detected agents (30+)
Rules Agent rules files written (CLAUDE.md, AGENTS.md, .cursorrules, etc.)
Index Code index built — call graph, imports, symbols, dead code
Compress Memory files compressed to save tokens every future session

Restart your IDE. Start working normally. Warden runs automatically — no commands to remember, no settings to tune, no levels to pick. Max compression is always on.

See it working: your agent prints ‹warden› saved 4295 tokens (79%) on every tool call. Run warden hud for a live terminal HUD. Run warden dashboard for a web UI at http://localhost:7878.

Install for one agent, or see what's detected
warden doctor          # see which agents are detected (16 checks)
warden init            # re-register after installing a new agent
warden benchmark       # see real benchmark numbers on your own files

Warden detects and registers for: Claude Code, Claude Desktop, Cursor, Windsurf, Codex CLI, Cline, Roo Code, Continue, VS Code Copilot, Zed, JetBrains, Amazon Q, Gemini CLI, Antigravity, Aider, Goose, OpenHands, opencode, Augment Code, Warp, Cody, Tabnine, Replit AI, and more.


Before / After

Same grep query. Same information. 79% fewer tokens.

Without Warden — 4,295 tokens:

$ grep -rn "function auth" src/
src/auth/login.ts:15:export function login(user) {
src/auth/login.ts:16:  const token = signJWT(user);
src/auth/login.ts:17:  if (!token) throw new Error("no token");
src/auth/login.ts:18:  return { token, user };
src/auth/middleware.ts:45:export function authMiddleware(req, res, next) {
src/auth/middleware.ts:46:  const token = req.headers.authorization;
src/auth/middleware.ts:47:  if (!token) return res.status(401).send("no token");
... (138 more matches)

With Warden — 883 tokens:

warden_grep({ pattern: "function auth" })

  200 matches → 12 relevant
  ‹warden› removed 50 duplicates
  ‹warden› collapsed 138 low-signal
  guard: every line verbatim ✓
  saved: 4295 → 883 tokens (-79%)

  src/auth/login.ts:15    export function login(user)
  src/auth/login.ts:22    export function logout()
  src/auth/middleware.ts:45    authMiddleware(req,res,next)
  src/auth/token.ts:8     export function generateToken()
  src/auth/token.ts:31    export function verifyToken()
  ... 7 more (use warden_retrieve for full)

Every line in the pruned output exists verbatim in the raw — verified by the trust guard.


What it does

Eight layers. One MCP server. Zero config.

Layer What it does Savings
Code intelligence Index functions, imports, call sites. Query call graph, impact, dead code 100x fewer round trips
Context selection Recommends files for the task with 2-hop symbol expansion 80%+ smaller context
Tool output pruning warden_grep, warden_file_read, warden_run_tests, warden_run_command 50-91% per call
Agent memory Decisions persist across sessions with lifecycle (reaffirm, supersede, archive). Failed approaches surface as warnings 0 repeated mistakes
Response compression Rules drop filler, preamble, narration. Code stays verbatim 45-65% per reply
File compression warden compress strips filler from memory files, no LLM call up to 32% per file
Description compression 24 tool descriptions compressed before sending ~41% per turn
Session continuity warden_handoff reads previous session at start, writes at end 0 cold starts
Git context File history, blame, churn metrics — know if code is stable or volatile fewer surprises
Sufficient context Unified context: files + past decisions + failed approaches + git volatility + token budget 90%+ smaller context
Task reports Per-task and project-wide reports with overhead timing measure what matters

Safety net — always on

Mechanism What it does
Trust guard Every pruned line verified verbatim against raw. If altered, raw ships instead.
Eval gate Rules earn confidence through real samples before going live.
Regression watchdog Tracks task success rates. Auto-reverts rules that degrade outcomes.
CCR Every cut reversible. Full original cached 7 days. warden_retrieve with --around and --lines.

Code intelligence

// Who calls auth() and what does auth() call?
warden_call_graph({ function: "auth" })
// → Callers: login(), UserService.isValid()
//   Callees: checkToken(), generateToken()

// What's affected if I change src/auth.ts?
warden_impact({ filePath: "src/auth.ts" })
// → Risk: HIGH — 5 dependents, 12 callers

// Project overview in one call
warden_architecture({})
// → TypeScript: 57 files, 251 symbols, 2061 calls

// Find dead code
warden_dead_code({})
// → 3 functions with zero callers

// Search for symbols
warden_search_symbols({ pattern: "auth" })
// → 8 matches across 4 files

Powered by tree-sitter (WASM — no native compilation, works on Windows/macOS/Linux). Supports 30+ languages including TypeScript, JavaScript, Python, Go, Rust, Java, C/C++, C#, Ruby, PHP, Swift, Kotlin, Scala, Lua, Dart, Elixir, and more — extracting functions, classes, methods, interfaces, types, enums, imports, and call sites.


Trust guard

40 lines. Read them yourself.

src/pruner/guard.ts — the non-negotiable rule:

Every non-annotation line in the pruned output
must appear verbatim in the raw output.
If it doesn't, the raw is shipped instead.
No exceptions. No heuristics. No silent rewrites.

Code, shell commands, and error text are included-or-excluded wholesale — never altered. Safety first, optimization second.


Evolution & measurement

Warden doesn't just prune — it measures itself and evolves its memory.

Task reports

warden task-report --all
# WARDEN PROJECT REPORT — ALL TIME
# Total prune calls:     143
# Tokens saved (gross):  186,038
# Reduction:             77.9%
# WARDEN OVERHEAD
#   Processing time:      34ms
#   Overhead tokens:      34 (est.)
#   Net tokens saved:     186,004

Per-task or project-wide. Includes overhead timing — Warden measures its own cost and subtracts it from gross savings to report net tokens saved.

Memory lifecycle

Decisions aren't static. They evolve:

warden_memory_save({ category: "decision", title: "Use PostgreSQL", body: "...", sourceType: "documentation", evidence: ["docs/arch.md"] })
warden_memory_reaffirm({ id: 42 })     // decision confirmed again — boosts confidence
warden_memory_supersede({ oldId: 42, newId: 55 })  // old decision replaced
warden_memory_archive({ id: 42 })      // no longer relevant
warden_memory_mark_contested({ id: 42 }) // someone disagrees

Failed approach tracking

When something doesn't work, Warden remembers:

warden_memory_save({ category: "failed_approach", title: "Redis for sessions", body: "Lost persistence in deploy. Do not retry.", outcome: "failure" })
// Later, when starting a similar task:
warden_memory_failed_approaches({ query: "session storage" })
// → WARNING: Redis for sessions — failure. Do not retry.

Sufficient context — one call, everything you need

warden_sufficient_context({ task: "fix auth token expiry", tokenBudget: 2000 })
// → FILES (3 files, categorized, with git churn)
// → PAST DECISIONS (2 recalled decisions)
// → FAILED APPROACHES (1 warning — don't use Redis for this)
// → VOLATILITY NOTES (auth.ts: 8 commits — volatile, expect recent changes)
// → TOKEN ACCOUNTING (budget=2000, used=1847, trimmed=yes)

Combines file recommendations, past decisions, failed approach warnings, git volatility, and token budget trimming into a single response. Replaces warden_context_select when you want the full picture.


Works with 30+ agents

Claude Code Claude Desktop Cursor Windsurf Codex CLI
Cline Roo Code Continue VS Code Copilot Zed
JetBrains Amazon Q Gemini CLI Antigravity Aider
Goose OpenHands opencode Augment Code Warp
Cody Tabnine Replit AI + more

If your agent supports MCP, Warden works with it.


Commands

Command What it does
warden init Register in all agents + write rules + build index + compress files
warden serve Run MCP server over stdio (called by agents automatically)
warden status Rules, confidence, tokens saved, recent memories
warden hud Live terminal HUD (Ctrl+C to exit)
warden dashboard Web UI at http://localhost:7878
warden doctor Health check — 16 checks, clear pass/fail
warden benchmark Run actual benchmarks on real files
warden compress <file> Compress a memory file (max compression)
warden index Index project code structure
warden graph <fn> Query call graph: who calls X / what X calls
warden impact <file> Impact analysis: blast radius of changes
warden architecture Project overview: languages, packages, entry points
warden handoff Generate session handoff for next session
warden handoff --read Read previous session's handoff
warden ccr CCR cache stats
warden ccr retrieve <hash> Retrieve original output (--around, --lines)
warden memory list List all stored memories
warden memory recall <query> Search memories
warden task-report Per-task report: tokens saved, overhead, outcomes (--all, --since, --until, --task)
warden git-context <file> Git history, blame, churn metrics for a file (--start, --end, --blame)
warden sufficient-context <task> Unified context: files + memories + failed approaches + git volatility (-b budget)
warden rules Write agent rules files

MCP tools

30+ tools. All called automatically by your agent via the rules file.

Category Tools
Tool wrappers warden_grep · warden_file_read · warden_run_tests · warden_run_command
Context & intelligence warden_context_select · warden_sufficient_context · warden_index · warden_call_graph · warden_impact · warden_architecture · warden_search_symbols · warden_dead_code
Memory warden_memory_save · warden_memory_recall · warden_memory_list · warden_memory_forget · warden_memory_failed_approaches · warden_memory_reaffirm · warden_memory_archive · warden_memory_mark_contested · warden_memory_reject
Git context warden_git_context — history, blame, churn metrics
Eval & outcomes warden_record_outcome · warden_outcome_stats · warden_task_report
Status & audit warden_status · warden_report · warden_prune · warden_compress
CCR (reversibility) warden_retrieve · warden_ccr_status
Session continuity warden_handoffread: true at start, generate at end

Privacy

No cloud. No API server. No telemetry. No analytics. No phone-home.
Your code, tool outputs, and pruning decisions stay in a local SQLite
file on your machine. It works on a plane.

The only network code: localhost-only dashboard — bound to127.0.0.1, no external access.

Audit it yourself — the full source is public. The trust guard is 40 lines in src/pruner/guard.ts.


Requirements

  • Node.js >= 22.5 (uses built-in node:sqlite)
  • Any MCP-compatible AI coding agent (30+ supported)

Tech stack

Component Technology
Runtime Node.js 22.5+ (built-in node:sqlite, no native deps)
Language TypeScript 5.x, ESM
MCP protocol @modelcontextprotocol/sdk
Code parsing tree-sitter WASM (30+ languages, no native compilation)
Storage SQLite (via node:sqlite) — FTS5 full-text search
Build tsup (esbuild)
Tests Vitest (308 tests, 28 files)
Search ripgrep (auto-detected, optional)
Dashboard HTTP server, localhost-only, CSP headers
CLI Commander.js
License PolyForm Shield1.0.0

License

PolyForm Shield1.0.0 — source-available, free for everyone including commercial use. See LICENSE and TRADEMARK.md.

Support Warden

Warden is free and always will be. No paywall, no license key, no gated features. If it saves you tokens, consider a donation:

Amount What it does
$5 Say thanks — a small thank-you for a tool you use daily
$10 Buy lunch — covers development time, the fair price for daily use
$25 Fund a feature — supports ongoing development and the features you want next

PayPal: paypal.me/rynald0s

Bitcoin: 1Jt3kETWcWkAsNKrc6WsPLKnkkSTe3Uv5o

Honor system. Warden is fully functional without donating. No gated features, no license keys, no "pro" version. If it saves you tokens and you want to support development, donate. If not, use it free. That's the deal.


Install · Website · GitHub · npm · Issues · Donate

Made with ⚡ by Rynaldo Stoltz

Reviews (0)

No results found