A disciplined, evidence-first workflow for autonomous code agents
The Cursor Operational Doctrine (file core.md) encodes the agent’s always-on principles—reconnaissance before action, empirical validation over conjecture, strict command-execution hygiene, and zero-assumption stewardship.
Choose one installation mode:
| Mode | Steps |
|---|---|
| Project-specific | 1. In your repo root, create .cursorrules.2. Copy the entire contents of core.md into that file.3. Commit & push. |
| Global (all projects) | 1. Open Cursor → Command Palette (Ctrl + Shift + P / Cmd + Shift + P).2. Select “Cursor Settings → Configure User Rules”. 3. Paste core.md in its entirety.4. Save. The doctrine now applies across every workspace (unless a local .cursorrules overrides it). |
Never edit rule files piecemeal. Replace their full contents to avoid drift.
Four structured templates drive repeatable, autonomous sessions. Copy the full text of a template, replace its first placeholder line, then paste it into chat.
| Template | When to Use | First Line Placeholder |
|---|---|---|
request.md |
Build a feature, refactor code, or make a targeted change. | {Your feature / change request here} |
refresh.md |
A bug persists after earlier attempts—launch a root-cause analysis and fix. | {Concise description of the persistent issue here} |
retro.md |
Conclude a work session; harvest lessons and update rule files. | (No placeholder—use as is at session end) |
Each template embeds the doctrine’s safeguards:
- Familiarisation & Mapping step (non-destructive reconnaissance).
- Command-wrapper mandate (
timeout 30s <command> 2>&1 | cat). - Ban on unsolicited Markdown files—transient narratives stay in-chat.
-
Paste a template with the placeholder filled.
-
Cursor AI:
- Performs reconnaissance and produces a ≤ 200-line digest.
- Plans, gathers context, and executes changes incrementally.
- Runs tests/linters; auto-rectifies failures.
- Reports with ✅ /
⚠️ / 🚧 markers and an inline TODO, no stray files.
-
Review the summary; iterate or request a
retro.mdto fold lessons back into the doctrine.
- Be specific in the placeholder line—state what and why.
- One template per prompt. Never mix
refresh.mdandrequest.md. - Trust autonomy. The agent self-validates; intervene only when it escalates under the clarification threshold.
- Inspect reports, not logs. Rule files remain terse; rich diagnostics appear in-chat.
- End with a retro. Use
retro.mdto keep the rule set evergreen.
| Guard-rail | Enforcement | |
|---|---|---|
| Reconnaissance first | The agent may not mutate artefacts before completing the Familiarisation & Mapping phase. | |
| Exact command wrapper | All executed shell commands include `timeout 30s … 2>&1 | cat`. |
| No unsolicited Markdown | Summaries, scratch notes, and logs remain in-chat unless the user explicitly names the file. | |
| Safe deletions | Obsolete files may be removed autonomously only if reversible via version control and justified in-chat. | |
| Clarification threshold | The agent asks questions only for epistemic conflict, missing resources, irreversible risk, or research saturation. |
“Add an endpoint that returns build metadata (commit hash, build time). Use Go, update tests, and document the new route.”
-
Copy
request.md. -
Replace the first line with the sentence above.
-
Paste into chat.
-
Observe Cursor AI:
- inventories the repo,
- designs the endpoint,
- modifies code & tests,
- runs
go test, linters, CI scripts, - reports results with ✅ markers—no stray files created.
Once satisfied, paste retro.md to record lessons and refine the rule set.
By following this framework, you empower Cursor AI to act as a disciplined, autonomous senior engineer—planning deeply, executing safely, self-validating, and continuously improving its own operating manual.