AgentWarden
CLAUDE.md2 starsChanged 36 days agoMITView on GitHub
Semantic firewall for AI coding agents. It intercepts Claude Code actions through hooks and checks them in a cascade: deterministic rules → a local Meta open-weights model → Muse Spark via Meta Model API for the hard cases. It also scans what the agent reads for injected instructions. Every action gets allow, deny or ask. Built for the Meta Global AI Developer Hackathon (Oct 26 – Nov 4, 2026). Only code written during the event goes in this repo. Background,…
- Reads credentials
In this repository7 other files it gives its agents.
- dev-workflowSkill
- eval-caseSkill
- hook-protocolSkill
- judge-tuningSkill
- meta-apiSkill
- meta-redteamSkill
- warden-specSkill
The file
We split this CLAUDE.md into the rules it gives an agent
9 rules. About 0 are common, 2 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 41
Do not edit prompts/ or eval/cases/ or eval/content/ unless the task explicitly asks for it.
- Very specific: line 43
Never read or print .env. Configuration comes from environment variables.
- Very specific: line 48
Every task starts from a spec in docs/specs/NNN-name.md (skill: warden-spec).
- Very specific: line 52
Run reviewer only on Large tasks, or when the human asks.
- Distinctive: line 53
Read only the files the task needs.
- Very specific: line 60
Start: read docs/SESSION.md if it exists.
- Very specific: line 61
Default model is Sonnet. If the task is architecture, fail-safe/redaction/hook-wrapper design, judge prompt work, a large spec, or …
- Distinctive: line 63
When the user decides something, or you verify a fact about Meta API or hooks, offer in one line to save it to the right .md file.
- Very specific: line 64
When a spec is committed, the topic changes, or the session is long: update docs/SESSION.md, then recommend /clear and name the next task …
≈ “Common” is an estimate: at least 1 in 5 of the 29,248 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AgentWarden
Semantic firewall for AI coding agents. It intercepts Claude Code actions through hooks and checks them in a cascade: deterministic rules → a local Meta open-weights model → Muse Spark via Meta Model API for the hard cases. It also scans what the agent reads for injected instructions. Every action gets allow, deny or ask.
Built for the Meta Global AI Developer Hackathon (Oct 26 – Nov 4, 2026). Only code written during the event goes in this repo. Background, scope and decisions: docs/CONTEXT.md (read only when the task needs it).
Architecture
hooks/— command hooks that Claude Code runs. They forward events to the daemon and fail closed: daemon down, slow or broken →ask.src/agentwarden/daemon.py— FastAPI service:/event,/decide,/log, dashboard page.src/agentwarden/rules.py— deterministic allow/deny, no model. Order: built-in hard denies (secrets, self-protection) → user policy → built-in defaults.src/agentwarden/policy.py— loads the user's.agentwarden/policy.yaml; can never weaken built-in hard denies.src/agentwarden/judge.py+providers/— model call, JSON verdict{decision, risk, confidence, reason, safer_alternative}. Providers:meta_api(Muse Spark),local(Meta open weights),mock.src/agentwarden/cascade.py— local model first; escalates to Muse Spark when confidence is low or risk is mid-range.src/agentwarden/scanner.py— PostToolUse: checks content the agent just read (files, web) for injected instructions with the local model; warns the agent viaadditionalContext.src/agentwarden/redact.py— strips secrets before anything is sent to a model.src/agentwarden/decide.py— combines rules + cascade, applies risk thresholds and the fail-safe.src/agentwarden/store.py— SQLite audit log.src/agentwarden/dashboard/— one HTML page served by the daemon (opened in VS Code via Simple Browser): decision feed, filters, "always allow / always deny" buttons that write to the policy file.- Hooks add a short
systemMessagefor every deny and ask, so the user sees what AgentWarden did inside Claude Code. eval/— labelled action cases, labelled content cases for the scanner,make evalmetrics.redteam/— Meta red-team loop: Muse Spark generates attacks, the judge is scored on them.
Commands
make install— install dependencies (uv)make lint— ruff check + format checkmake test— fast tests, no networkmake eval— action eval, all modes (rules / local / spark / cascade); spark and cascade cost API creditsmake eval-rules— action eval, rules only, freemake eval MODE=cascade— one mode onlymake eval-scan— scanner eval oneval/content/make redteam ROUNDS=1— Meta red-team loop (costs API credits)make run— start the daemon on 127.0.0.1:8765
Invariants — never break these
- Any error, timeout or unparsable model output →
ask. Neverallow. - Secrets never leave the machine: everything sent to a model goes through
redact.py. - The only outbound network calls are to the configured model provider.
- Do not edit
prompts/oreval/cases/oreval/content/unless the task explicitly asks for it. Proposed eval cases go toeval/candidates/. - Tests never call the real API. Use
providers/mock.py. Tests that need the real model are marked@pytest.mark.slow. - Never read or print
.env. Configuration comes from environment variables. - The protected agent can never switch AgentWarden off: no edits to
.agentwarden/or.claude/settings*.json, no calls to the daemon URL, no killing the daemon. These are built-in hard denies; the user policy cannot override them. Policy-changing endpoints require the local UI token.
Workflow
- Every task starts from a spec in
docs/specs/NNN-name.md(skill:warden-spec). Drafts waiting for their turn live indocs/specs/backlog/; when starting one, move it todocs/specs/with the next free number. - Size the process to the task:
- Small (one module, under ~100 changed lines): no subagents. Write tests and code in this session.
- Large (several modules, or touches hooks/decide/judge fail-safe):
planner→test-writer→ implement →reviewer. - Run
revieweronly on Large tasks, or when the human asks.
- Read only the files the task needs. Do not scan the whole repo.
- Tests first, then implementation until
make testis green. - Small commits; the message starts with the spec number, e.g.
001: hook passthrough. - Definition of done:
make lintandmake testgreen, every acceptance criterion in the spec checked off.
Session rules (always on — details in the dev-workflow skill)
- Start: read
docs/SESSION.mdif it exists. - Default model is Sonnet. If the task is architecture, fail-safe/redaction/hook-wrapper design, judge prompt work, a large spec, or debugging after 2 failed attempts, say in one line that it needs Opus.
- Mechanical work (dashboard, README, demo scaffolding, bulk eval drafts) → offer a Muse Code handoff in
docs/handoff/. - When the user decides something, or you verify a fact about Meta API or hooks, offer in one line to save it to the right .md file.
- When a spec is committed, the topic changes, or the session is long: update
docs/SESSION.md, then recommend/clearand name the next task and model. - Reply to the user in Russian; keep code, comments and docs in English.
Stack
Python 3.12, uv, FastAPI, pydantic, httpx, OpenAI-compatible client for Meta Model API, SQLite, pytest, ruff.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

