Private early access · free while in early accessWhat works today
For coding agents

Agents follow what they're told. Tell them everything.

An agent writes good code for the codebase it imagines. Groundrule describes the one you actually have: the gateway to use, the logger, the floats you never use for money. Then it checks the result before it lands.

§ 01agent files

sync writes each format from the same rules, scoped to the repository's languages and paths.

fmt · 01

AGENTS.md

OpenAI Codex and every agent that reads AGENTS.md

fmt · 02

CLAUDE.md

Claude Code, importing AGENTS.md

fmt · 03

.cursor/rules

Cursor, one rule file per scope, with globs

fmt · 04

copilot-instructions.md

GitHub Copilot, plus path-specific instructions

One rulebook, written the way each agent reads.

These are sync's real outputs. Anything you write outside the markers stays exactly as you wrote it.

# Checkout API, notes for coding agents

Run `pnpm test` before pushing.

<!-- groundrule:begin -->
<!-- Generated by Groundrule from `.groundrule/`. Edit the standards there, then run `groundrule sync`. -->

## Engineering standards

These are this repository's engineering ground rules. Follow them in every change.
Before you finish a task, run `npx @groundrule/cli check` and fix what it reports.
For the reasoning and examples behind a rule, run `npx @groundrule/cli explain <ID>`.

### Everywhere

- **ACME-004** Route all Stripe calls through src/payments/gateway.ts · _blocker_
  Never import 'stripe' or call api.stripe.com outside src/payments/gateway.ts;
  call the gateway's functions instead, and add new operations there if needed.

- **SEC-001** No private keys in the repository · _blocker_
  Never commit private keys. Load them at runtime from a secret manager or the environment.
<!-- groundrule:end -->

The managed block. Anything you write outside the markers stays exactly as you wrote it. Rules are grouped by where they apply, with examples where the standard has them.

§ 02the loop

Write, check, fix. The check takes a fraction of a second.

The agent writes, the check catches, the agent fixes.

  • Fast enough to run every timeEvery generated file tells the agent to run the check before it finishes.
  • An explanation on demandgroundrule explain ACME-004 prints why the rule exists, the examples, and how to comply.
  • The same check in CIWhatever slips past the agent stops at the pull request, at the stages you chose.
§ 03mcp

Two tools: list_standards and propose_rule.

Live rules, and a way to propose new ones.

groundrule mcp is a Model Context Protocol server. list_standards gives an agent the rules in effect, with each rule's stage. propose_rule sends a rule to your inbox when a developer corrects the agent and says it should apply to everyone.

claude mcp add groundrule -- npx -y @groundrule/cli mcp

Run it once in the repository. The server reads the same rulebook as sync and check: your organization's, with the repository's own standards.

  1. you

    We never log full card numbers here. Mask all but the last four, and make that a rule for everyone.

  2. agent

    Fixed in src/http/refunds.ts. Proposing it to the team.

    propose_rule { rule: "Never log full card numbers; mask all but the last four digits.", file: "src/http/refunds.ts", line: 4 }
  3. groundrule

    Proposed to Acme Payments. Reviewers will see it in the inbox.

§ 04questions

The documentation covers each format and every option.

About agents.

Which agents read which file?

AGENTS.md is read by OpenAI Codex and the growing list of agents that support it. Claude Code reads CLAUDE.md (which imports AGENTS.md), Cursor reads .cursor/rules, and GitHub Copilot reads .github/copilot-instructions.md and .github/instructions. Choose the targets in .groundrule/config.yaml; onboarding picks them from the agents your team uses.

Which rules reach the agent files?

Rules at Teach, Advise and Enforce that apply to the repository's languages and paths, with your organization's and team's changes applied. Rules at Observe stay out, as do rules turned off.

Does an agent need network access to follow the rules?

No. The agent files are plain text in the repository. Only the MCP server and sync talk to Groundrule, and only with a token you created.

What does an agent send when it proposes a rule?

The rule, the reason and an example if given, the file and line if given, and the agent's name. Nothing else from the repository. A rule needs at least 10 characters; proposing the same rule again counts as a vote.

§ 05 · sign-off · Private early access, free while in early access

Teach your agents in ten minutes.

Sign in from the CLI, connect a repository and run sync. Your agents read the rules on their next task.