pi-warden

September 22, 2026 · View on GitHub

Stop babysitting your coding agent.

pi-warden supervises Pi while it works, catching risky actions, ignored rules, stuck loops, unverified "done" claims, security issues, runaway output, wasted context, and more.

Instead of interrupting you for every problem, Warden usually feeds the issue back to the agent so it can correct itself and keep going.

Real verdicts from pi-warden: the same command gets a different verdict depending on what the user asked for

Install

pi install npm:pi-warden
  1. /warden enable to turn judgments on. Paste a key from console.typesafe.ai (hidden input, saved owner-only), or skip for offline-only mode.
  2. /warden init to write a starter pi-warden.md. The rules guard enforces what you put there.
  3. /warden index (recommended) so the conscience knows your skills and tools from their real descriptions.
  4. /warden test to see one synthetic verdict, then work as usual. The status line shows verdicts; ctrl+shift+w opens the trace sidebar.

The conscience is beta and off by default. Turn it on with conscience.enabled: true in the user config.

Works without any key (offline guards: pattern list, runaway stop, sensitive-path notes, credential warnings). Requires Pi 0.85+, Node 22.19+.

What Warden catches

GuardWatchesDoes
Actionbash, write, edit before runHolds irreversible calls, records trace-only off-task findings
Rulesevery write and editJudges against project Markdown rules, quotes the broken rule
Slopcode and repliesNames stubs, restating comments, dead code, hedging
Stucktool resultsRepeated failures using the same strategy
Done-checkfinal message"Done" claims with no test/build/lint behind them
Securitycode and outputHardcoded secrets, injection risks
Runawayreply streamStops replies that begin repeating themselves
Subagent triageasync child reportsKeeps noisy background work from waking the parent
Conscience (beta, off)each operator promptRecommends a skill or tool from the capability index before the agent acts; enable with conscience.enabled: true

How intervention works

  1. Read-only? Skip. git status, ls, read means no request and no trace entry.
  2. Known-dangerous pattern? Catch it locally. Force push, git reset --hard, recursive rm, SQL DROP held instantly.
  3. Needs judgment? Warden evaluates the action in context.
  4. Steer or hold. Most issues go back to the agent so it can correct itself. Irreversible actions can be stopped before they run.

In the default steer mode, Warden talks to the agent rather than interrupting you. confirm asks you directly; advise never blocks.

More than guardrails

  • Learns from holds, tracking outcomes and recommending policy changes via /warden recommend.
  • Custom policies: command, path, and arming rules for your own workflow.
  • Context saver trims oversized tool output while keeping the full result retrievable.
  • Multiple judgment backends: TypeSafe by default, with OpenRouter support.
  • Full traceability: inspect what Warden saw, decided, and told the agent.
  • Desktop alerts for events that need you.

Custom rules

Put pi-warden.md at the project root. Each heading is one rule:

# No console statements
Code must not contain `console.log` or `console.debug`. Use the logger.

# Exported functions must have explicit return types
paths: src/**/*.ts
Every exported function declares its return type.

Jev judges every write and quotes violations back. Rules can be things no linter checks: "a TODO must name a ticket", "comments must not restate the code". Without pi-warden.md, the first of README.md/CLAUDE.md/AGENTS.md is judged instead. Examples and config details.

Does it actually help?

In 150 paired agent runs, the control setup violated the tested project rule 6 times. With Warden: 0.

An overnight stability run covered 13,952 guard cases across 109 cycles with no score drift.

These are project-maintained benchmarks, not universal claims. Raw reports and reproducible eval tooling are in the repo.

Does it get in the way? Measured, not promised.

3 holds per 1,000 calls. The other 997 run. Across 315 recorded sessions and 18,075 guarded calls, the action hold fired 48 times, each for an action that is hard to undo. On the maintainer's machine, 452 allowed calls have run since outcome tracking began and not one was regretted afterward. When a hold was wrong, one retry cleared it: 2 of 13 labeled holds stood, the other 11 cleared on retry. The 27 calls the maintainer later regretted in the replay were ordinary edits and commits, not the kind a pre-call hold can see coming; those belong to the rules guard, the done-check, and the regret label, which are measured too. Snapshot numbers: scripts/hold-stats.mjs refreshes them, and the full replay is in eval/reports/2026-09-21-calibration-0.33.3/.

See the evals ->

Privacy

Depending on the configured judgment backend, Warden sends to your provider: a redacted summary of each guarded call, the agent's plan, up to eight redacted prior messages, and redacted tool-output samples. Secrets are stripped before anything leaves the machine. Full details. Security work — pentesting, incident response, CTF — has its own configuration recipe for keeping samples local and for the friction that credentials and lab setups cause: Recipe: security work.

Documentation

Development

npm install
npm run check          # typecheck + offline tests + build
npm run test:live      # live tests (costs real judgments)
npm run eval:ab        # A/B benchmark (costs real tokens)

License

MIT