AI Agent Rails Pack
Practical workflow rails for Codex, Claude Code, Cursor and other GenAI coding agents.
AI coding agents are fast. That is exactly why they need rails.
Modern coding agents can generate large diffs in minutes. That is useful. It is also how small tasks turn into broad, hard-to-review changes.
This repository gives humans a lightweight way to keep control:
- write intent before coding;
- name invariants before touching files;
- define non-goals explicitly;
- keep diffs small and reviewable;
- require human approval at the right points;
- make every agent handoff compact and auditable;
- self-check the final diff against the original intent.
This is not an automated code-review guarantee. It is not a security tool. It is not a replacement for engineering judgment.
It is a practical rails pack for teams that use AI coding agents and do not want to vibe-code their production system.
Why this exists
AI agents often fail in boring, expensive ways:
- they start coding before the task is understood;
- they touch unrelated files;
- they silently change old behavior;
- they perform a refactor hidden inside a small feature;
- they forget critical invariants;
- they leave weak tests and unclear rollback;
- they hand a human reviewer a large diff with no decision trail.
The fix is not a bigger prompt.
The fix is a small operating model:
Intent → Boundaries → Invariants → Approval → Implementation → Self-check → Human review
Who this is for
- solo developers using Codex, Claude Code, Cursor, Gemini CLI, Copilot or similar tools;
- CTOs and engineering managers introducing AI-assisted development;
- architects who need agents to respect system boundaries;
- teams that want less prompt chaos and better change traceability;
- anyone who has seen an agent turn a small task into a suspiciously large diff.
What is included
AGENTS.md # default repo-level agent instructions
QUICKSTART.md # 60-second setup guide
docs/agent-workflow.md # recommended human-controlled workflow
docs/human-approval-checklist.md # review gate for humans
docs/trust-and-safety.md # safe positioning and responsibility boundary
docs/workflow-catalog.md # copy-paste workflows
templates/change-intent.md # fill before coding
templates/invariant-register.md # system invariants to protect
templates/rollback-plan.md # rollback notes
templates/agent-handoff.md # handoff between agents/humans
examples/java-spring/AGENTS.md # Java/Spring specialization
examples/vue/AGENTS.md # Vue frontend specialization
examples/multi-agent/roles.md # planner/builder/reviewer roles
examples/demo-change-email-notification/ # demo: controlled backend change
examples/demo-change-price-formatting/ # demo: controlled frontend change
examples/demo-agent-plugin-session/ # demo: plugin-style session
.github/pull_request_template.md # PR template aligned with the pack
.claude-plugin/marketplace.json # optional Claude plugin-style marketplace reference
plugins/agent-rails-core/ # optional Claude Code plugin-style skills
Quick start
Copy the core files into your repository:
AGENTS.md
docs/
templates/
.github/pull_request_template.md
Fill the invariant register:
templates/invariant-register.md
Then ask your coding agent:
Read AGENTS.md and templates/change-intent.md.
Do not modify code yet.
First produce a Change Intent for the task below.
Include affected files, non-goals, invariants, test plan and rollback notes.
After I approve the Change Intent, proceed with implementation.
After implementation:
Compare the diff against the approved Change Intent.
List expected changes, unexpected changes, invariant impact, tests run, tests missing and rollback path.
Return PASS, WARN or BLOCK.
See QUICKSTART.md for the 60-second setup.
Core workflow
1. Context snapshot
The agent identifies only the files, tests and patterns relevant to the task.
2. Change intent
The agent writes what it plans to do before touching code.
3. Human approval
The human approves, narrows or rejects the intent.
4. Implementation
The agent implements only inside the approved boundary.
5. Self-check
The agent compares the diff against the original intent.
6. Human review
The human reviews with a short decision trail instead of a mystery diff.
Optional Claude Code plugin-style structure
This repository includes an optional plugin-style pack under:
plugins/agent-rails-core/