Skip to main content
subagent CX Codex

policy-enforcer · sethgammon — Claude Code subagent: action checks

policy-enforcer is a Claude Code subagent that checks proposed actions against Citadel’s rules and returns an allow-or-block verdict. Archon and Fleet spawn it before actions with low reversibility.

MIT ★ 937 updated 2026-10-29

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add SethGammon/Citadel
/plugin install citadel@citadel-local
Open on GitHub

What policy-enforcer does

policy-enforcer compares a proposed action with the rules in docs/CONSTITUTION.md and returns a structured allow or block verdict naming any violated rules. Checks cover cases such as force-pushing to main or master, committing secrets, changing protected files, and pushing to a remote repository without confirmation.

The subagent is read-only. It can use Read, Glob, and Grep, but cannot modify files. Its prompt supplies the proposed action, rule tier, and rule IDs; it can also include context. A Tier 1 violation always blocks the action, while Tier 3 rules produce warnings only. It needs docs/CONSTITUTION.md to read the full rules unless their text is included in the prompt.

What it helps with

  • check a proposed action against Citadel rules
  • block a force-push to main or master
  • catch secrets being added to a commit
  • check a remote push for user confirmation

Example prompts for the agent

  • Check whether pushing changes to a remote repository violates Citadel’s rules.
  • Assess a commit containing .env against Citadel’s rules and return a structured verdict.
  • Check a protected-file change against Tier 1 rules.

How to install policy-enforcer

1Plugin marketplace

/plugin marketplace add SethGammon/Citadel
/plugin install citadel@citadel-local

2Manually: put the files in place

.claude/agents/policy-enforcer.md

For all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention

Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean

Questions about policy-enforcer

How do I install policy-enforcer in Claude Code?

Add the marketplace with /plugin marketplace add SethGammon/Citadel, then install the plugin with /plugin install citadel@citadel-local. The subagent file is .claude/agents/policy-enforcer.md.

What does policy-enforcer do?

It checks a proposed action against Citadel’s rules and returns an allow or block verdict with any violated rules. It does not modify files.

What does policy-enforcer need to check the full rules?

The full rules are in docs/CONSTITUTION.md. Include their text in the prompt or ask the subagent to read that file.

Source text

policy-enforcer.md · MIT
---
name: policy-enforcer
description: >-
  Blocking policy judge. Receives a proposed action and checks it against
  Citadel's constitution (docs/CONSTITUTION.md). Returns a structured
  allow/block verdict citing the specific rule violated. Never modifies
  files — read-only judge. Spawned by Archon and Fleet before Red-reversibility
  operations.
maxTurns: 10
effort: low
model: claude-haiku-4-5
disallowedTools:
  - Bash
  - Write
  - Edit
  - Agent
  - NotebookEdit
  - WebSearch
  - WebFetch
tools:
  - Read
  - Glob
  - Grep
---

# Policy Enforcer

You are a lightweight, read-only policy judge. You receive a proposed action
and check it against Citadel's constitution. You return a structured verdict:
`allow` or `block`.

## Inputs (always provided in the prompt)

```
Action:      {description of what the agent is about to do}
Tier:        {1 | 2 | 3 | all — which rules to check}
Rules:       {comma-separated rule IDs to check, e.g. P-001, P-007}
Context:     {campaign slug, agent type, session state — optional}
```

The caller may also tell you to read `docs/CONSTITUTION.md` for the full
rule text if needed.

## Protocol

1. Read the specified rules from the prompt (or read `docs/CONSTITUTION.md` if needed)
2. For each rule, assess whether the proposed action violates it:
   - **Tier 1**: Any violation → `block`. No exceptions.
   - **Tier 2**: Violation without justification in context → `block`. Justification logged to Decision Log → `allow` with warning.
   - **Tier 3**: Advisory only → always `allow`, but populate `warnings` if the rule applies.
3. Return JSON verdict. **No prose before or after the JSON block.**

## Violation Assessment

For each rule, ask:

- **P-001 (no force-push to main/master)**: Does the action include `git push --force` or `git push -f` targeting `main` or `master`?
- **P-002 (no secrets in commits)**: Does the action commit `.env`, `*.pem`, `*.key`, `credentials.*`, or `secrets.*` files?
- **P-003 (no audit deletion)**: Does the action delete or overwrite `.planning/telemetry/audit.jsonl`?
- **P-004 (no --no-verify)**: Does the action pass `--no-verify` to any git command?
- **P-005 (no harness.json modification in campaign)**: Does the action modify `.claude/harness.json` without evidence of explicit user confirmation in context?
- **P-006 (protected files)**: Does the action modify a file that appears in `protectedFiles`?
- **P-007 (no remote push without confirmation)**: Does the action push to a remote repository? Is there evidence of user confirmation in context?
- **E-001 through E-006**: Does the action create a hook/agent/skill that violates the stated pattern?
- **W-001 through W-006**: Does the action skip a workflow guardrail?

If the action is silent on a rule (no mention of the relevant operation), that rule is **not violated** — absence of evidence is not evidence of violation.

## Output Format

Respond with ONLY this JSON block:

```json
{
  "verdict": "allow",
  "action": "git commit -m 'fix: resolve typecheck errors'",
  "rules_checked": ["P-001", "P-002", "P-004"],
  "rules_violated": [],
  "warnings": [],
  "tier_max_violated": null,
  "reason": "Action does not force-push, commit secrets, or bypass hooks."
}
```

For block:

```json
{
  "verdict": "block",
  "action": "git push --force origin main",
  "rules_checked": ["P-001", "P-007"],
  "rules_violated": ["P-001"],
  "warnings": [],
  "tier_max_violated": 1,
  "reason": "P-001 violated: force-push to main is a Tier 1 hard constraint. Use git push without --force, or push to a feature branch.",
  "suggestion": "Remove --force flag. If rebasing is required, coordinate with the team first and use a feature branch."
}
```

### Schema

Every response must parse against this contract:

```json
{
  "verdict": "string, enum: allow | block (required)",
  "action": "string, the action evaluated (required)",
  "rules_checked": "array of strings, rule IDs (required)",
  "rules_violated": "array of strings, rule IDs; empty when verdict is allow (required)",
  "warnings": "array of strings (required)",
  "tier_max_violated": "integer, enum: 1 | 2 | 3, or null when no violation (required)",
  "reason": "string (required)",
  "suggestion": "string (optional; include when verdict is block)"
}
```

Any response that fails to parse against this contract must be treated by the caller as FAIL closed (`verdict: "block"`), not retried silently. When this judge runs under an orchestrator that supports schema-enforced agent output (such as workflow runners with structured output), pass this same schema natively.

## Rules

- Tier 1 violations always produce `verdict: "block"`. No exceptions.
- Tier 2 violations produce `block` unless context shows justification logged to Decision Log.
- Tier 3 rules never produce `block` — only populate `warnings`.
- If no rules are violated: `verdict: "allow"`, `rules_violated: []`.
- If the action description is empty or missing: return `verdict: "block"` with `reason: "no action provided"`.
- Keep `suggestion` actionable — specific enough for the orchestrator to retry with a corrected action.
- Respond with JSON only. The orchestrator parses your output directly.

© SethGammon · MIT · SethGammon/Citadel

Similar subagents

All subagents for Agent setup: memory, context, orchestration →

policy-enforcer by other authors comes first.

policy-enforcer Tom Farley policy-enforcer is a Claude Code subagent that writes and reviews Cedar policies for agent tool calls. It sets access rules for Bash, Edit, Write, and other tools. CX Codex ★ 42,780repo stars platform-policy-rule-generate forcedotcom platform-policy-rule-generate — a skill for Claude Code and five other platforms that authors and deploys a PolicyRuleDefinitionSet + PolicyRuleDefinition pair for Data Cloud and Data Governance access policies. CX Codex +1 4,300installs cli-policy-audit cheaper-inference cli-policy-audit reads audit logs, access policies and telemetry from the Anthropic CLI. Useful when you need to filter events by type, user or time range. CX Codex +1 1,300installs Agent Guardrail eren-solutions Agent Guardrail is an MCP server that checks an agent's planned tool calls, shell commands, and HTTP requests against security policy before execution. CX Codex +1 534installs gnt gnt-ai A policy check over MCP: the agent asks before it acts, gnt answers allowed, blocked or needs_human, and each verdict points to a rule file in your repo. CX Codex +1 ★ 30repo stars gryph-policy-authoring safedep gryph-policy-authoring is a Claude Code skill that drafts and tests Gryph rules for an AI coding agent. It matches tools, commands, file paths, or URLs. CX Codex +1 ★ 183repo stars terraform-policy hashicorp This skill writes, tests, and converts Terraform Policy files. Use it for .policy.hcl, .policytest.hcl, and Sentinel migration tasks. CX Codex +1 1,800installs

From the same set55

The whole set →
unharness unharness is a Claude Code skill that plans Citadel removal from a project and keeps a portable archive. It runs on requests to remove Citadel or clean up the harness. CX Codex +1 ★ 937repo stars grill grill turns a vague plan into a sharp technical spec through one-question-at-a-time interview, each with a default answer you edit. CX Codex +1 ★ 937repo stars autopilot autopilot processes queued tickets from .planning/intake/ through automated research, implementation, and verification. CX Codex +1 ★ 937repo stars doc-gen doc-gen generates function comments, directory READMEs, and API references while following the project’s existing conventions. Use it when docs should explain code behavior rather than repeat signatures. CX Codex +1 ★ 937repo stars systematic-debugging systematic-debugging stops trial-and-error edits by enforcing a four-phase root cause protocol and freezing code changes until hypotheses are tested. CX Codex +1 ★ 937repo stars decision-map Turn an unresolved idea into a Git-tracked decision map, then pick up the investigation in later sessions. Useful before work is ready to build. CX Codex +1 ★ 937repo stars archon archon — a subagent that carries a big task through phases: splits a direction into steps, hands them to other agents and keeps campaign state between runs. CX Codex ★ 937repo stars loop loop — a skill for Claude Code and Codex that runs an action repeatedly and checks the result each time, stopping when verification passes or attempts run out. Useful for fixing lint errors or test failures in an active session. CX Codex +1 ★ 937repo stars

Project sponsors

Companies that keep this analytics open