agentleFS
AmaculisAmaculis/AgentWarden/CLAUDE.md

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

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
  1. Very specific:

    Do not edit prompts/ or eval/cases/ or eval/content/ unless the task explicitly asks for it.

    line 41
  2. Very specific:

    Never read or print .env. Configuration comes from environment variables.

    line 43
  3. Very specific:

    Every task starts from a spec in docs/specs/NNN-name.md (skill: warden-spec).

    line 48
  4. Very specific:

    Run reviewer only on Large tasks, or when the human asks.

    line 52
  5. Distinctive:

    Read only the files the task needs.

    line 53
  6. Very specific:

    Start: read docs/SESSION.md if it exists.

    line 60
  7. Very specific:

    Default model is Sonnet. If the task is architecture, fail-safe/redaction/hook-wrapper design, judge prompt work, a large spec, or …

    line 61
  8. Distinctive:

    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.

    line 63
  9. Very specific:

    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 …

    line 64

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

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 via additionalContext.
  • 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 systemMessage for 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 eval metrics.
  • 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 check
  • make test — fast tests, no network
  • make eval — action eval, all modes (rules / local / spark / cascade); spark and cascade cost API credits
  • make eval-rules — action eval, rules only, free
  • make eval MODE=cascade — one mode only
  • make eval-scan — scanner eval on eval/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

  1. Any error, timeout or unparsable model output → ask. Never allow.
  2. Secrets never leave the machine: everything sent to a model goes through redact.py.
  3. The only outbound network calls are to the configured model provider.
  4. Do not edit prompts/ or eval/cases/ or eval/content/ unless the task explicitly asks for it. Proposed eval cases go to eval/candidates/.
  5. Tests never call the real API. Use providers/mock.py. Tests that need the real model are marked @pytest.mark.slow.
  6. Never read or print .env. Configuration comes from environment variables.
  7. 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 in docs/specs/backlog/; when starting one, move it to docs/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 reviewer only 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 test is green.
  • Small commits; the message starts with the spec number, e.g. 001: hook passthrough.
  • Definition of done: make lint and make test green, every acceptance criterion in the spec checked off.

Session rules (always on — details in the dev-workflow skill)

  • Start: read docs/SESSION.md if 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 /clear and 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.