Schema-first generator for coding-agent repo policies and compatibility files.
Generates AGENTS.md, CLAUDE.md, .cursor/rules/, and .windsurf/rules/ (among others) from a single agent-policy.yaml.
Maintaining AGENTS.md, CLAUDE.md, and Cursor rules separately means the same policy information gets duplicated across files that diverge over time. agent-policy solves this by letting you define your repo's coding-agent policy once in a canonical agent-policy.yaml, then generating all the tool-specific compatibility files from that single source of truth.
Keep one policy file. Generate all agent instruction files from it. Detect drift in CI.
npx agent-policy
# or install globally
npm install -g agent-policypip install agent-policy-cli
# or with pipx (recommended for CLI tools)
pipx install agent-policy-cli
# or with uv
uv tool install agent-policy-cliThe PyPI package is agent-policy-cli; the command it installs is agent-policy.
cargo install agent-policyDownload pre-built binaries from GitHub Releases.
# Create a starter policy
agent-policy init
# Edit agent-policy.yaml, then generate
agent-policy generate
# Add to CI to prevent drift
agent-policy check| Command | Description |
|---|---|
agent-policy init |
Write a starter agent-policy.yaml in the current directory |
agent-policy list-targets |
View a table of all available export formats and their stability |
agent-policy generate |
Generate all enabled output files from agent-policy.yaml |
agent-policy lint |
Analyze agent-policy.yaml for semantic errors and warnings |
agent-policy check |
Verify committed files match the current policy (CI use) |
agent-policy install-hooks |
Install a pre-commit or pre-push git hook that runs check locally |
agent-policy import |
Scaffold agent-policy.yaml by scraping an existing AGENTS.md or CLAUDE.md |
Both generate and check accept --config / -c to specify a non-default config path, and --targets to natively override outputs:
agent-policy generate --config infra/agent-policy.yaml
agent-policy check --targets agents-md,clinerulesMinimal example:
schema_version: "1"
project:
name: my-project
summary: A short description.
outputs:
- agents-mdNote: You do not need to manually add .md outputs or target paths to your paths.generated config list. Any active outputs are injected into your generated list automatically!
Full example — see examples/website/agent-policy.yaml.
The file is validated against agent-policy.schema.json (JSON Schema Draft 2020-12). The schema is bundled with the binary and is versioned alongside it. It is considered unstable until v1.0.0.
| Target ID | File | Enabled by default | Tool(s) |
|---|---|---|---|
agents-md |
AGENTS.md |
Yes | Codex, Windsurf, Copilot |
claude-md |
CLAUDE.md |
No | Claude Code, Copilot |
cursor-rules |
.cursor/rules/*.mdc |
No | Cursor |
gemini-md |
GEMINI.md |
No | Google Gemini CLI |
windsurf-rules |
.windsurf/rules/*.md |
No | Codeium Windsurf |
clinerules |
.clinerules/*.md |
No | Cline |
copilot-instructions |
.github/copilot-instructions.md |
No | Copilot (Global) |
copilot-instructions-scoped |
.github/instructions/*.md |
No | Copilot (Scoped Context) |
junie-guidelines |
.junie/guidelines.md |
No | JetBrains Junie |
When outputting directory rules like cursor-rules or clinerules, agent-policy generates one default layout and optionally one file per customized role, intelligently assigning frontmatter globs and path references directly into the generated configurations to cleanly silo AI behaviors scope-to-scope!
Add to your CI workflow to enforce that generated files are never edited by hand:
- name: Check agent policy
run: agent-policy checkThis step exits non-zero if any generated file is stale or missing, and prints a unified diff to stderr.
- Not a replacement for
AGENTS.md— it generatesAGENTS.md - Not a full enforcement engine or policy-as-code runtime
- Not a SaaS platform or hosted service
- Not a daemon or background process
Apache-2.0