Code warden
AI development governance protocol for Codex, Claude Code, and Cowork. Enforces modular architecture, adversarial feedback, patch-first editing, blast radius safety, zero-trust secrets, and context drift prevention. Use at the start of any coding session, when generating or modifying modules, when refactoring existing code, when making architectural changes, or when any of the following are said: "load protocol", "apply dev rules", "check the rules", "start a new module", "review this before we write", "are we following the rules", "new session", "begin coding", "load code-warden", "governance check", or any request to begin writing code.From its SKILL.md
npx -y skills add Kodaxadev/Code-Warden --skill code-wardenAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
13.7 KB, ~1.8k tokens by cl100k_base, as published. Nobody here has run it
code-warden v4.0.0
Production-grade AI development governance skill. Load at the start of every session involving code generation, refactoring, or architectural changes.
Session Start - HARD GATE
Do not ask implementation questions. Do not gather requirements. Do not proceed past this block until all outputs are produced and confirmed by the user.
Mandatory sequence — produce in order, each confirmed before the next:
- Architecture State (below)
- Session Scope (below)
- Reference Files (below)
- Scope Gate — see references/planning-gates.md
- Plan Gate — see references/planning-gates.md (fires after Scope Gate confirmed)
Before responding, execute node <installed-skill-dir>/tools/get-context.js if
you lack architectural context.
Common install directories:
- Codex shared agents:
~/.agents/skills/code-warden - Codex local skills:
~/.codex/skills/code-warden - Claude Code:
~/.claude/skills/code-warden
Output this block as your first response before anything else:
ARCHITECTURE STATE (Re-injection Rule)
[Paste the context found by get-context.js or provided by user. If none found, write:]
[WARN] No architecture doc found - applying Re-injection Fallback:
- Last known files: [list any files mentioned in this session]
- Current data flow: [unknown - user must provide before proceeding]
REQUEST: Paste your architecture doc, PRD, or a 3-sentence scope summary before we continue.
SESSION SCOPE (Session Scoping Rule)
This session is scoped to: [module/feature name] Files in scope: [list] Files explicitly OUT of scope: [everything else]
[If scope is unknown, write:]
[WARN] Scope undefined - user must confirm before proceeding.
REFERENCE FILES LOADED (Blueprint Rule)
For this task, loading: [list relevant references/ files] Status: [PASS found | WARN missing from install - rules enforced from prompt]
Do not proceed until the user replies "confirmed" or provides the missing information above.
Quick Rules
- Scope Gate: Required before every session. Declare goal, non-goals, files in/out, verify commands, rollback plan. See
references/planning-gates.md. - Scope Lock: Ask the user to run
code-warden scope set --goal="..." <paths...>after the Scope Gate is confirmed. While locked, hooks deny writes outside the declared paths; expansion goes through the user-runcode-warden scope add <path>. Never edit.code-warden/directly — hooks deny it unconditionally. - Plan Gate: Required before any multi-file or >30-line change. Declare patch order, blast radius class, post-patch checks. See
references/planning-gates.md. - Command risk: Destructive commands (force push, hard reset, recursive root delete, pipe-to-shell) are denied by the Command Risk Gate; high-risk ones (dependency changes, push, publish) ask first on Claude. Do not work around a denial — surface it.
- Audit + receipts: Governed sessions append to a hash-chained
.code-warden/audit.jsonl. Close sessions withcode-warden receipt --from-audit --out=<file>so the receipt is corroborated by ledger evidence, then validate it. - Baseline ratchet: In brownfield repos,
code-warden report --baselinefails only NEW or WORSENED violations; never grow a baselined file or add a fresh secret. - Max file size: Enforced by
warden-lint.js(default 400 lines). Split into modules at the limit. - Editing mode: Patch/diff first. No full rewrites without blast radius check.
- Feedback mode: Adversarial. Correctness over comfort; push back on weak logic.
- Secrets: Zero-trust. Enforced by
verify-secrets.js; no hardcoded keys. - Uncertainty: Say so. Never guess niche syntax or stale API behavior.
- Concerns: One responsibility per file. Support human auditing.
- Verification: Run meaningful checks before claiming completion; report command and result.
- Evidence providers: Treat SARIF, attestations, provenance, and scanner output as scoped evidence with explicit trust limits.
- Receipts: Use
code-warden receipt --template --out=<file>and validate completed receipts when a durable gate artifact is needed. - Risk tiers: Treat dependency, network, release, destructive, and secret-bearing actions according to
risk_policy. - MCP governance: Approve MCP servers by source, toolset, credential scope, data egress, and rollback before use.
- Reference selection: Use
code-warden references <paths...>to recommend focused governance references for touched paths. - Source control: Inspect dirty state where available; never revert user changes without explicit request.
- Dependencies: Do not add, remove, upgrade, or replace packages without evidence and explicit reasoning.
- Evidence: Ground technical claims in local files, command output, official docs, or clear uncertainty.
- Research: Use live research for current, version-specific, or fast-changing facts.
- Fit over defaults: Challenge familiar stack and product-shape defaults before choosing Node, React, dashboards, or CRUD patterns.
Reference Files
Load these when relevant to the current task:
- Scope Gate, Plan Gate, blast radius class, patch order -> references/planning-gates.md
- Architecture decisions, Blueprint Rule, Re-injection -> references/architecture.md
- Blast Radius, Patch-First, Zero-Trust, Dependency Freeze -> references/safety.md
- Think Before Coding, Don't Guess Syntax, Human Checkpoint -> references/cognition.md
- Tech Debt flag format, Test Contract, Decision Log -> references/cleanup.md
- Anchor Check, Session Scoping, Drift Trigger -> references/anti-drift.md
- Verification, git hygiene, dependency control, evidence -> references/operations.md
- External evidence providers, provenance, attestations, SARIF, and trust limits -> references/evidence-providers.md
- Live research, anti-default stack choices, product-shape fit -> references/research-and-fit.md
- MCP server approval, toolset scope, credentials, consent, and audit evidence -> references/mcp-governance.md
Drift Signals - Hard Stop
Stop and re-anchor immediately if any of these appear:
| Signal | Action |
|---|---|
| Began implementing without a confirmed Scope Gate | Stop, produce Scope Gate, await confirmation |
| Began implementing without a confirmed Plan Gate | Stop, produce Plan Gate, await confirmation |
| Touched a file not declared in Scope Gate | Stop, declare scope expansion, await approval |
| Write denied by the Scope Lock or Command Risk Gate | Stop, report the denial verbatim, ask the user to expand scope or approve — never bypass |
| Guessed library syntax without searching docs | Search live docs, correct output |
| Used stale training data for current facts | Run live research or mark unverified |
| Chose a default stack/product shape without fit check | Compare alternatives against project constraints |
| Unexplained contiguous block > limit | Run warden-lint.js, split if needed |
| Skipped Blast Radius Check before a rewrite | Run check before proceeding |
| Claimed completion without verification evidence | Run relevant checks or state residual risk |
| Changed dependencies without version/source evidence | Stop, inspect package metadata and lockfile |
| Edited in a dirty repo without checking ownership | Inspect status and preserve user changes |
No [AWAITING CONFIRMATION] before >2-file change | Pause and request confirmation |
| Monolithic file output without module split | Refactor into separated concerns |
All limits and thresholds are defined in codewarden.json.
What ships with it: 85 files
415.7 KB alongside SKILL.md, 68 of them executable
bin/
- code-warden.jsruns4.3 KB
examples/
- governed-session.md6.1 KB
references/
- anti-drift.md2.0 KB
- architecture.md1.1 KB
- cleanup.md898 B
- cognition.md1.1 KB
- evidence-providers.md3.9 KB
- mcp-governance.md4.1 KB
- operations.md2.0 KB
- planning-gates.md2.7 KB
- research-and-fit.md2.5 KB
- safety.md1.1 KB
templates/
- ci/github-actions.yml3.5 KB
tools/
- auto-detect.jsruns2.2 KB
- auto-targets.jsruns2.8 KB
- auto-windsurf-adapter.jsruns2.3 KB
- get-context.jsruns600 B
- governance-report.jsruns10.4 KB
- hooks/claude/install-hooks.jsruns4.9 KB
- hooks/claude/uninstall-hooks.jsruns1.7 KB
- hooks/claude/warden-audit-hook.jsruns1.1 KB
- hooks/claude/warden-command-hook.jsruns3.2 KB
- hooks/claude/warden-lint-hook.jsruns4.8 KB
- hooks/claude/warden-scope-hook.jsruns2.3 KB
- hooks/claude/warden-secrets-hook.jsruns2.7 KB
- hooks/claude/warden-session-hook.jsruns2.6 KB
- hooks/claude/warden-stop-hook.jsruns2.9 KB
- hooks/codex/install-hooks.jsruns3.3 KB
- hooks/codex/uninstall-hooks.jsruns1.6 KB
- hooks/codex/warden-apply-patch-hook.jsruns4.5 KB
- hooks/codex/warden-bash-hook.jsruns2.5 KB
- hooks/git/install-hooks.jsruns8.1 KB
- codewarden.json3.0 KB
- CONFIGURE.md9.2 KB
- DECISIONS.md40.3 KB
- install.jsruns15.3 KB
- install.ps1runs888 B
- install.shruns718 B
- package.json1.7 KB
- README.md14.3 KB
45 more files not listed here. See all 85 in the repository.