Back to Research

How Coding Agents Stay Inside Bounds

A practical team convention for governing Claude Code, MCP access, hooks, and autonomous agent reviews.

Trees (Arbres), landscape painting by Paul Cézanne (1900).
Rogier MullerJune 23, 20268 min read

ai coding agents write code autonomously by turning a goal into a plan, reading repo context, calling tools, editing files, running checks, and asking for review at the boundaries you set. A safe workflow gives coding agents a small operating model: rules, tool permissions, hooks, and review gates. Agentic coding governance decides what an agent may change, what it must prove, and when a human must stop it.

Claude Code, Anthropic's coding agent, makes this practical because it can read CLAUDE.md, use skills, run slash commands, and connect to external systems through MCP. The same pattern works across an AI IDE like Claude, Anysphere's AI code editor, and OpenAI Codex, OpenAI's coding agent, so it belongs in AI coding governance training, not in one person's prompt history.

Start with the repo contract

Put durable instructions where the agent will read them. For Claude Code teams, that usually means a short root CLAUDE.md plus nested files for risky or unusual areas, such as apps/billing/CLAUDE.md or packages/db/CLAUDE.md.

A useful root file says things like: use pnpm, never edit generated Prisma files directly, run pnpm test --filter web before opening a web PR, and ask before changing auth, billing, or migrations. That is the practical answer to how ai coding agents write code autonomously: they do not become trustworthy by being clever; they become useful when the repo tells them what safe progress looks like.

Do not turn CLAUDE.md into a warehouse. If a rule only matters for one folder, put it near that folder. Local scope beats one giant memory file because the agent sees the relevant constraint at the moment it is editing.

Paste this convention into a repo

Use one convention for every repo-connected agent, then add Claude-specific details where they help. This keeps agentic coding from becoming a pile of personal preferences.

# Autonomous coding agent convention

Owner: engineering manager + rotating staff engineer
Applies to: Claude Code, Claude Agent, Codex, and any repo-connected coding agent
Review cadence: update after any incident, failed review, or new MCP server

## Repo memory
- [ ] Root `CLAUDE.md` names the package manager, test commands, release branch, and risky domains.
- [ ] Nested `CLAUDE.md` files exist for auth, billing, data access, migrations, generated code, and public APIs.
- [ ] Durable rules live in repo memory. Task-specific wishes stay in the prompt or issue.

## Team skills
- [ ] Reusable workflows live as skills, not long prompts in chat history.
- [ ] Each skill has a clear name, a short activation description, required commands, and expected evidence.
- [ ] Skills for migrations, incident fixes, dependency upgrades, and accessibility changes include a human review gate.

## MCP and tool boundaries
- [ ] Allowed MCP servers are listed with scope: GitHub PR access, issue tracker updates, docs read-only, design files read-only.
- [ ] Production databases, secrets, payroll, customer exports, and destructive admin actions are not agent-writeable.
- [ ] New MCP access requires security review, least privilege, and a rollback plan.

## Hooks and local checks
- [ ] Hooks block secret files, unexpected lockfile changes, generated file edits, and direct commits to protected branches.
- [ ] Pre-PR checks run lint, typecheck, unit tests, and the smallest useful integration test.
- [ ] A failing hook means stop and explain, not work around the hook.

## Agent PR checklist
- [ ] PR description includes the plan, files changed, tests run, screenshots or logs when relevant, and known risks.
- [ ] Agent labels the change as safe, needs domain review, or needs security review.
- [ ] Human reviewer owns the merge decision.
- [ ] No agent-authored PR merges without a passing checklist and at least one human review.

Adopt it through a normal pull request. A tech lead proposes the first version, platform or security reviews the MCP section, and one engineer from each high-risk domain checks the nested memory rules.

Keep the convention in AGENTS.md if you want a cross-tool contract, and mirror Claude-specific operating notes in CLAUDE.md. The review rule is simple: no autonomous-agent PR merges unless the PR links to the checklist or clearly satisfies it in the description.

Bound tools before you add more agents

MCP is the integration layer that lets an agent talk to systems such as GitHub, issue trackers, document stores, databases, design files, and private knowledge bases. Treat every MCP server like a production permission, not like a convenience plugin.

A good starter setup gives Claude Code GitHub PR access, read-only docs, and issue updates. It does not give write access to production data, secrets, customer exports, or admin panels on day one.

The trap is adding orchestration before boundaries. A multi-agent system can make bad access faster and harder to audit. If one agent can draft a migration, another can update docs, and another can open a PR, the system still needs one visible permission model and one human merge owner.

Train reviewers, not just prompt writers

AI coding training should spend less time on magic prompts and more time on review evidence. A good agentic coding training session asks every engineer to inspect an agent PR for intent, scope, tests, tool use, and rollback.

For Claude Code, turn repeatable work into team skills. A migration skill might require reading the schema guide, generating the migration, running the local database test, adding rollback notes, and marking the PR for database review.

Do not measure developer productivity by how many files an agent changed. Better signals are smaller PRs, fewer review surprises, faster test repair, and clearer handoffs. For a deeper companion pattern, see Rules for Autonomous Coding Agents.

Use orchestration only when the work splits cleanly

Multi-agent orchestration is coordinating several agents so each handles a bounded part of a larger task. It can help when the work naturally separates, such as one agent updating API code, one updating tests, and one drafting docs.

As of June 2026, the useful lesson from coding agents news is not that every team needs a new orchestration platform. The lesson is that autonomous work needs visible handoffs. Each agent should have a role, a stop condition, and an artifact another human or agent can inspect.

The trap is parallelizing coupled code. If three agents edit the same domain without a plan, you get merge noise, duplicated assumptions, and reviews that feel like archaeology. Start with one agent per PR until your checklist catches the boring failures reliably.

Common questions

  • How do AI coding agents actually write code on their own?

    AI coding agents work by planning a task, reading the repository, selecting tools, editing files, running checks, and iterating on failures until they hit a stop condition. The important caveat is that autonomy is bounded by permissions, repo memory, hooks, and review rules; without those, the agent is just moving faster than your governance.

  • Should we use one agent or multiple agents?

    Start with one agent per PR unless the work splits into independent artifacts. A safe first multi-agent pattern is code, tests, and docs as separate responsibilities, with one human owner reviewing the combined pull request. Multiple agents help throughput only after your repo contract and review checklist are boringly reliable.

  • Where should MCP permissions live?

    MCP permissions should live in the same place your team keeps engineering operating rules: the repo convention, security review notes, and onboarding material. List each server, its scope, and its write boundaries. The key number is one: there should be one visible source of truth for allowed external access.

  • What should reviewers check on an agent-authored PR?

    Reviewers should check intent, scope, changed files, tests, tool use, and rollback notes before reading every line. Ask whether the agent followed CLAUDE.md, respected MCP boundaries, and stopped at the right human gate. The review is not just code quality; it is also a governance audit.

  • Do hooks replace human review?

    Hooks do not replace human review; they remove the easy misses before review starts. Use hooks for secrets, formatting, generated files, protected branches, and required checks. Humans still own product judgment, architecture fit, security tradeoffs, and whether the agent solved the right problem.

Further reading

Try it on one repo

Pick one active service, add the convention in a PR, and require the checklist on the next agent-authored change. Do not scale orchestration until that review feels calm.

One methodology lens

One useful way to read this through our methodology is the Plan step: delegate first-pass decomposition and dependency mapping, review the sequencing and assumptions, and keep ownership of scope and priorities. If that split is still fuzzy, the workflow usually is too.

Related training topics

Related research

Continue through the research archive

Ready to start?

Transform how your team builds software.

Get in touch