Up to 59% offLaunch prices on every plan while spots last.See pricing
KANBANMCP
Sign inStart free

Cursor project rules for parallel agent handoffs

9 min read

Key takeaways

  • Cursor project rules live in .cursor/rules/*.mdc files with frontmatter controlling whether each rule loads always, on demand, or only for matching globs.
  • Cursor reads .cursor/rules while Claude Code reads CLAUDE.md, so keep identical wording in both files or generate them from one shared source to prevent drift.
  • For parallel agents, rules should mandate one card per session, one worktree per card, tests passing before done, and a fixed handoff note format.
  • Commit rules files with the repo so every worktree and session reads the same version, and delete any rule that has not changed agent behaviour in a fortnight.
  • Rules load only when a Cursor session starts, so background agents pick up rule changes after a restart, and non-Cursor agents need CLAUDE.md or AGENTS.md instead.

Cursor project rules work best when treated as one rules file among several, written so a Cursor agent can claim a card, pick up work another agent left mid-task, and leave a handoff note for the next session. The trick is keeping .cursor/rules and your CLAUDE.md pointing at the same source of truth instead of drifting into two sets of instructions.

What are cursor project rules and where do they live?

Cursor project rules are markdown files that give a Cursor agent standing instructions for a repo: coding conventions, test commands, handoff expectations. They live in .cursor/rules/ at the project root, one .mdc file per rule, each with frontmatter controlling when it activates. That is the difference from the older .cursorrules file, which was a single global blob for the whole project. Per Cursor's documentation on project rules, rules can be always-on, attached automatically by glob pattern, pulled in when the agent requests them, or applied only manually. Splitting rules into separate .mdc files matters when you run three or more agent sessions in parallel: a handoff rule can stay always-on while a worktree convention attaches only to files that touch git setup. For how rules line up with a shared board your agents claim cards from, see KanbanMCP's Cursor agent setup.

How do cursor project rules differ from CLAUDE.md?

Both files steer agents, but they differ in scope, format and when they load.

What each tool reads and when

Cursor reads .cursor/rules/*.mdc files, each with frontmatter that controls whether the rule loads always, on demand, or only for matching globs. CLAUDE.md is a single markdown file Claude Code loads at session start, no frontmatter, no conditional loading. Codex reads AGENTS.md, which follows the same plain-file convention. The practical difference: Cursor rules can be scoped per directory or file type, while CLAUDE.md is one blob your whole repo shares.

Cursor rulesCLAUDE.mdAGENTS.md
Location.cursor/rules/*.mdcCLAUDE.mdAGENTS.md
FormatMarkdown + frontmatterPlain markdownPlain markdown
LoadingAlways, on demand, or glob-matchedAt session startAt session start
ScopingPer directory or file typeWhole repoWhole repo

Keeping one source of truth with includes or a shared file

When Cursor and Claude Code work the same repo in parallel, duplicated rules drift. A common fix is one shared file that the tool-specific files reference, so a handoff note written by a Cursor agent lands in the same place a Claude Code session reads. The same problem shows up at the task level, which is why boards such as KanbanMCP vs GitHub Projects keep handoff state outside any single agent's instruction file.

What should go in rules when several agents run in parallel?

Parallel sessions fail on the same three things: two agents editing one file, a card claimed twice, and a handoff that says "done" when it isn't. Your rules should attack those directly. Note that Cursor now reads rules from .cursor/rules directories rather than the older .cursorrules file, per Cursor's rules documentation, so put shared conventions there where a Cursor agent picks them up automatically.

Branch, worktree and commit conventions

State the pattern once: one card, one worktree, one branch named after the card. Forbid pushing to shared branches and require small commits with the card ID in the message. This is what makes a git diff in the morning readable.

Definition of done: tests and diffs

Write the gate as a rule, not a hope: tests must pass before a card moves, and the agent must state what it changed and what it deliberately left alone. An agent that can't run tests should say so in the card instead of guessing.

Handoff note format

Require a fixed shape: what was attempted, what works, what's broken, and the next concrete step. A consistent format is what lets the next agent claim a card and start in one prompt. KanbanMCP keeps this note on the card itself so it survives across tools (docs).

How do you write a rule the agent actually follows?

Imperative, testable rules

Write each rule as a short imperative the agent can verify: "Run pnpm test before marking a card done", not "make sure quality stays high". One concern per file, so a rule about commit messages lives apart from a rule about worktrees. Prefer a worked example over prose: show the exact commit format once and the agent copies it. If you cannot picture the git diff that proves a rule was followed, rewrite it until you can.

When rules get ignored and how to fix it

Rules get ignored when they are long, vague, or buried in a file the agent never reads. Fix that by cutting the file to the rules that changed behaviour this week and deleting the rest. Move a skipped rule into the task itself, or into the handoff note on your board, where the agent must see it before claiming work. KanbanMCP works the same way: the card carries the instruction, the board carries the state, per its agent integrations page. A rule no agent has followed in a fortnight is documentation for documentation's sake.

A worked .cursor/rules file for agent handoffs

The rules file

Put this in .cursor/rules/handoffs.mdc:

---
description: Multi-agent handoff protocol
alwaysApply: true
---

- Work only on the card you claimed. One card per session.
- Before starting, read the handoff note on the card.
- Create a git worktree per card: worktree/<card-id>.
- Never touch another session's worktree or branch.
- Run the test suite before marking a card done.
- On done, write a handoff note: what changed, what you skipped,
  which tests cover it, and the next concrete step.
- Update CLAUDE.md only if a durable project convention changed.

The point is that each rule encodes one failure you have actually seen: two agents editing the same files, a card marked done with red tests, a handoff note that says "mostly finished".

The CLAUDE.md equivalent

Claude Code reads CLAUDE.md at session start and treats it as project memory, so the same conventions belong there in plain prose (Anthropic docs). Keep the wording identical, not paraphrased: "one card per session, worktree per card, handoff note on done". When a rule lives in two files, the wording drifting between them is how parallel sessions end up following different conventions. If you track the shared board outside the repo, note in both files where the cards live, and list any third-party service the agents touch so you know what your sessions depend on, similar to a subprocessors page.

How do rules interact with the board your agents share?

Rules tell each agent how to behave on the shared board, and the board is where the rules point. A typical clause: claim a card before starting, work only on claimed cards, leave a handoff note when you stop. Without that clause, two parallel sessions edit the same card or two agents grab the same task.

Pointing rules at the task system

Your .cursor/rules file should name the system of record explicitly: where tasks live, how to claim one, what a handoff note must contain. KanbanMCP fills that role here. Agents claim a card, do the work and leave a note for the next one; you watch and steer from the same board, checking the git diff in the morning.

Why chat sessions stay disposable

If the board holds the state, no chat session matters. An agent that dies mid-task leaves a note on its card, and the next session picks up from there. That is the separation readers keep asking for: tasks in one place, documents in another, chat sessions disposable. Rules make the board the contract; sessions are just workers.

How do you keep rules in sync across tools and repos?

Commit rules with the repo

The simplest option is also the one that survives a git diff in the morning: commit every rules file. .cursor/rules, CLAUDE.md, and your AGENTS.md live in the repo next to the code they govern, so every agent session in every worktree reads the same version. When you change a rule, the change goes through the same review as code, and a parallel session that started before the commit finishes against the old rules, which is usually fine for small edits.

Generating per-tool files

If duplicated files start drifting, generate them from one source. Keep a single canonical rules document in the repo and a small script that writes the per-tool files, then run it in a pre-commit hook so nobody forgets. Divergence is acceptable when a rule is genuinely tool-specific, such as Cursor-specific file references; note in the shared file that the detail lives elsewhere. Cursor documents how its rules apply to background agents, so check its documentation before assuming a rule reaches a session you did not open yourself.

Do cursor project rules apply to background or always-on agents?

Yes, with one caveat: rules load when a Cursor session starts, so an always-on bot only picks up rule changes after a restart or a fresh session. Keep the rules file committed to the repo and treat it like any other change an agent claims and ships.

For background agents, add two things. First, a startup rule: read the board, claim a card, and write a handoff note before moving on, so the next session finds a clean git diff in the morning. Second, a stop rule: never leave uncommitted work unexplained.

The same rules hold for non-Cursor agents reading a shared CLAUDE.md, which is why keeping both files in sync matters more than the tool that runs them.

FAQ

Can Cursor read my CLAUDE.md directly instead of a separate rules file?

Cursor loads its own .cursor/rules/*.mdc files and does not treat CLAUDE.md as a rules source. A practical workaround is a rule that instructs the agent to read CLAUDE.md at session start, but that depends on the agent following the instruction. Keeping the wording identical in both files is safer than hoping one file reaches both tools.

How many rules files is too many for one repo?

There is no fixed number, but each file should encode one concern you have actually seen fail: commit format, worktrees, handoff notes. If a rule has not changed agent behaviour in a fortnight, delete it. Most parallel setups run fine with three to five focused files plus one always-on handoff rule.

Do .cursor/rules work with agents I run outside the Cursor editor?

No. Rules load when a Cursor session starts, so they apply to Cursor sessions, including background and always-on ones, but not to Claude Code or other tools. Non-Cursor agents read CLAUDE.md or AGENTS.md instead. That is why the conventions need matching wording across files, or generation from one shared source.

Should rules live in the repo root or per-directory?

Commit them in the repo, next to the code they govern, so every worktree and session reads the same version. Cursor's frontmatter lets a rule attach only to matching globs or directories, so you get per-directory scoping without scattering files. Tool-specific details can diverge, but note in the shared file where they live.

How do I stop two agents from editing the same files at once?

Make it a rule, not a hope: one card per session, one worktree per card named after the card ID, and never touch another session's worktree or branch. Pair that with a board as the system of record so a card can only be claimed once. The handoff note tells the next agent where the previous session stopped.