Back to Research

Govern Autonomous Coding Agents

A team convention for agentic coding governance: boundaries, MCP permissions, and review checks Cursor users can adopt.

Landscape with haystack, tall trees, grazing sheep. In the vicinity of Copenhagen., landscape painting by Christen Købke (1836).
Rogier MullerJune 23, 20268 min read

AI coding agents write code autonomously with AGENTS.md boundaries, MCP limits, and review guardrails in Cursor: read repo context, plan a change, edit files, run tools, and check the result against instructions. Teams keep that loop safe by making each step visible and bounded.

Agentic coding governance is the set of team rules that decides what coding agents may read, change, run, and ship. In Cursor, Anysphere's AI code editor, that usually means combining repo instructions, Cursor rules, review checklists, and careful Model Context Protocol (MCP) access into one operating model for ai coding for engineering teams.

Start with the workflow, not the model

Decide the allowed states before you tune prompts. A useful default is: understand, plan, edit, test, summarize, then ask for review. That is the practical answer to how ai coding agents write code autonomously on a team: they move through a bounded loop, not a free-for-all.

The specific implementation matters less than the pattern: model an agent workflow as states, then block actions that do not belong in the current state.

The trap is treating autonomy as one big permission. A coding agent that can edit, run migrations, call GitHub, and post to Slack from the same vague prompt is hard to debug. Give it a lane before you give it speed.

Put repo boundaries where agents read first

Put durable rules in files the agent will reliably see. For Cursor users, that usually means an AGENTS.md at the repo root, scoped AGENTS.md files in sensitive directories, and a .cursor/rules/*.mdc rule for IDE behavior.

Keep the root file boring and durable. It should say what the system is, where tests live, what must not be touched, and when the agent should stop. A nested payments/AGENTS.md can be stricter than the root because local scope should win over general advice.

The trap is writing a beautiful policy that lives outside the repo. If the rule is in a wiki, the agent may not see it and reviewers may not check it. Put the working contract next to the code.

Treat MCP access like production access

MCP is the integration layer that lets an agent connect to external tools such as issue trackers, databases, design systems, and internal docs. That makes it powerful, and also worth governing.

Start with read-only MCP servers for normal coding work. Let agents inspect issues, docs, and code search before you let them write comments, mutate tickets, or touch data. If a workflow needs write access, make the state explicit: for example, the agent may update a Jira ticket only after tests pass and a human approves the summary.

Do not hide risk behind the phrase tool use. A shell command, a database query, and a GitHub write are different classes of action. Your ai coding governance should name the boundary, not just the tool.

Make autonomy visible in code review

Review the agent's path, not only its diff. Cursor Agent can help generate and revise code, but the team still needs reviewable evidence: the plan, the files changed, the tests run, and the risks left behind.

A good review checklist is short enough to use on every pull request. Ask whether the change stayed inside scope, whether tests actually ran, whether generated code matches local conventions, and whether any MCP or shell action crossed a boundary.

The trap is asking reviewers to infer everything from the final patch. That misses the interesting failures: a skipped test, an accidental broad refactor, a secret copied into context, or a migration attempted from the wrong branch. For a deeper companion pattern, see Rules for Autonomous Coding Agents.

Paste this team convention

Start with one convention, not a 20-page policy. Paste this into a proposal PR, adjust the paths, then split it into AGENTS.md and .cursor/rules/agent-governance.mdc once the team agrees.

# Agentic Coding Convention

## Where this lives
- Root repo guidance: AGENTS.md
- Local high-risk guidance: <directory>/AGENTS.md
- Cursor IDE rule: .cursor/rules/agent-governance.mdc
- PR evidence: pull request description under Agent checklist

## Agent states
- Understand: read the issue, relevant AGENTS.md files, existing tests, and nearby code.
- Plan: write a short plan before editing more than one file.
- Edit: change only files named in the plan, unless new evidence requires an updated plan.
- Test: run the smallest meaningful test first, then broader tests when risk justifies it.
- Summarize: list files changed, tests run, behavior changed, and known follow-ups.
- Review: stop for human review before merging, deploying, running migrations, or changing secrets.

## Hard boundaries
- Do not edit authentication, billing, migrations, or infrastructure without an explicit plan approved by a human.
- Do not introduce new dependencies without explaining why the standard library or existing package is not enough.
- Do not use MCP write actions unless the task explicitly asks for them and the PR summary records them.
- Do not continue after a failing test unless the failure is documented and the next step is clear.

## Cursor rule stub: .cursor/rules/agent-governance.mdc
---
description: Keep coding-agent work inside the team workflow for this repository.
globs:
  - "**/*"
alwaysApply: true
---
Before editing, identify the current agent state: Understand, Plan, Edit, Test, Summarize, or Review.
For multi-file changes, create or update a plan before editing.
Respect the nearest AGENTS.md file.
Record tests run and any MCP tool actions in the final response.
Stop for review before risky areas: auth, billing, data migrations, secrets, deployment, or infrastructure.

## PR agent checklist
- [ ] The agent followed the nearest AGENTS.md and Cursor rule.
- [ ] The plan matches the final files changed.
- [ ] Tests or checks are named, with failures explained.
- [ ] MCP, shell, or external write actions are listed.
- [ ] Risky areas were either avoided or explicitly approved.
- [ ] The reviewer can tell what changed without replaying the chat.

The adoption path should be ordinary engineering process. One developer proposes the convention in a PR, two maintainers review it, and the team treats changes to the convention like changes to test policy or release policy. If you run an ai coding workshop or internal agentic coding training, use this PR as the exercise.

The enforcement rule is simple: a pull request assisted by ai coding agents is not ready until the checklist is complete. The checklist will not catch everything, but it gives reviewers a shared handle. That is where developer productivity and code review guardrails stop fighting each other.

For broader patterns across tools and team training, keep the convention connected to the related training topic.

Common questions

  • How do AI coding agents write code autonomously?

    AI coding agents write code autonomously by combining repo context, model-generated plans, file edits, tool calls, and feedback from tests or linters. The important caveat is that autonomy is usually bounded by instructions, permissions, and review rules; a six-state loop like Understand, Plan, Edit, Test, Summarize, Review is easier to govern.

  • Do we need a state machine for every coding agent task?

    No, you do not need a formal state machine for every small task. You do need named states for work that touches multiple files, uses MCP, changes production behavior, or affects sensitive areas. The lightweight version is a checklist; the stricter version blocks actions until the agent reaches the right state.

  • Should AGENTS.md or Cursor rules be the source of truth?

    Use both, but give each a job. AGENTS.md should hold repository and directory rules that matter across tools, while .cursor/rules/*.mdc should guide Cursor-specific IDE behavior. The caveat is duplication: repeat only the small set of rules that must be visible at edit time.

  • How much MCP access should a team allow?

    Start with read-only MCP access and add write actions one workflow at a time. A safe first policy is read docs and issues freely, write external systems only after tests pass and a human approves the summary. Treat each MCP server like a permissioned integration, not a convenience toggle.

  • Will these guardrails slow down developer productivity?

    They can slow down tiny changes, but they usually speed up review for meaningful work. The measurable artifact is the PR checklist: reviewers spend less time reconstructing what happened and more time judging the patch. Keep the checklist short, or engineers will route around it.

Further reading

Try this next

Open one agent-assisted PR this week that changes only the convention files and checklist. Once the team agrees on the states, let the coding agents move faster inside them.

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