safe-agentic-workflow / rules
Cursor rule419 starsChanged 4 months agoMITView on GitHub
This directory contains .mdc rule files that translate the SAFe harness methodology into Cursor IDE's native rule format. Cursor is one of four supported AI providers in this harness, alongside Claude Code, Gemini CLI, and Codex CLI. Cursor uses .cursor/rules/*.mdc files with YAML frontmatter to provide context-aware instructions to the AI assistant. There are three activation modes: Cursor supports proje
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 1,533 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository60 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/00-core-principles.mdcCursor rule
- .cursor/rules/01-git-workflow.mdcCursor rule
- .cursor/rules/02-pattern-discovery.mdcCursor rule
- .cursor/rules/03-safe-ai-dlc.mdcCursor rule
- .cursor/rules/04-knowledge-vault.mdcCursor rule
- .cursor/rules/10-backend-python.mdcCursor rule
- .cursor/rules/11-frontend-react.mdcCursor rule
- .cursor/rules/12-database-sql.mdcCursor rule
- .cursor/rules/13-testing.mdcCursor rule
- .cursor/rules/14-spec-creation.mdcCursor rule
- .cursor/rules/15-deployment.mdcCursor rule
- .cursor/rules/16-stripe-payments.mdcCursor rule
- .cursor/rules/20-agent-architect.mdcCursor rule
- .cursor/rules/21-agent-backend.mdcCursor rule
- .cursor/rules/22-agent-qas.mdcCursor rule
- .cursor/rules/23-agent-security.mdcCursor rule
- .cursor/rules/30-background-agents.mdcCursor rule
- .cursor/rules/31-mcp-integration.mdcCursor rule
- agent-coordinationSkill
- api-patternsSkill
- confluence-docsSkill
- deployment-sopSkill
- frontend-patternsSkill
- git-advancedSkill
- linear-sopSkill
- migration-patternsSkill
- orchestration-patternsSkill
- pattern-discoverySkill
- release-patternsSkill
- rls-patternsSkill
- safe-ai-dlcSkill
- safe-workflowSkill
- security-auditSkill
- spec-creationSkill
- stripe-patternsSkill
- team-coordinationSkill
- testing-patternsSkill
- vault-syncSkill
- agent-coordinationSkill
- api-patternsSkill
- confluence-docsSkill
- deployment-sopSkill
- frontend-patternsSkill
- git-advancedSkill
- linear-sopSkill
- migration-patternsSkill
- orchestration-patternsSkill
- pattern-discoverySkill
- release-patternsSkill
- rls-patternsSkill
- safe-ai-dlcSkill
- safe-workflowSkill
- security-auditSkill
- spec-creationSkill
- stripe-patternsSkill
- team-coordinationSkill
- testing-patternsSkill
- vault-syncSkill
The file
We split this README.md into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 74
Security: Never commit real API keys.
- Distinctive: line 147
All configurations reference the same source docs (CLAUDE.md, AGENTS.md, CONTRIBUTING.md, patterns_library/) to maintain consistency.
≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Cursor Rules for SAFe Agentic Workflow
This directory contains .mdc rule files that translate the SAFe harness methodology into Cursor IDE's native rule format. Cursor is one of four supported AI providers in this harness, alongside Claude Code, Gemini CLI, and Codex CLI.
How Cursor Rules Work
Cursor uses .cursor/rules/*.mdc files with YAML frontmatter to provide context-aware instructions to the AI assistant. There are three activation modes:
| Mode | Frontmatter | When Active |
| Always Apply | alwaysApply: true | Active in every conversation |
| Auto-Attached | globs: "pattern" | Active when matching files are open/edited |
| Manual | alwaysApply: false, no globs | Active when referenced with @rule-name |
Rule Index
Always-Apply Core (active in every conversation)
| File | Purpose |
00-core-principles.mdc | SAFe methodology, round-table philosophy, evidence-based delivery |
01-git-workflow.mdc | Branch naming, commit format, rebase-first, PR process |
02-pattern-discovery.mdc | MANDATORY pattern discovery before implementing anything |
Methodology Rules (manual, use @rule-name to activate)
| File | Purpose |
03-safe-ai-dlc.mdc | SAFe x AI-DLC program cadence: Bolts, Units of Work, Mob Elaboration, human-gate checklist |
04-knowledge-vault.mdc | Knowledge-vault authoring conventions for OKF bundles: this project's frontmatter contract, link rules, drift discipline |
Auto-Attached Tech Rules (active when matching files are open)
| File | Globs | Purpose |
10-backend-python.mdc | core/**/*.py, edgekit/**/*.py | FastAPI, SQLAlchemy, async, Alembic |
11-frontend-react.mdc | sdk/**/*.tsx, sdk/**/*.ts | React 18, Electron, ShadCN, Tailwind |
12-database-sql.mdc | alembic/**, **/models.py, **/schemas.py | PostgreSQL 16, migrations, RLS |
13-testing.mdc | tests/**/*.py, tests/** | pytest, integration, E2E Docker |
14-spec-creation.mdc | specs/**/*.md, specs_templates/**/*.md | Spec templates, AC/DoD, pattern refs |
15-deployment.mdc | docker-compose*.yml, Dockerfile*, scripts/deploy* | Deploy procedures, Coolify, Docker |
16-stripe-payments.mdc | core/**/billing/**, core/**/payments/** | Stripe webhooks, checkout, idempotency |
Agent-Role Rules (manual, use @rule-name to activate)
| File | Purpose |
20-agent-architect.mdc | System Architect: pattern validation, Stage 1 review, ADRs |
21-agent-backend.mdc | BE Developer: API implementation, RLS enforcement |
22-agent-qas.mdc | QAS: independent gate, acceptance criteria verification |
23-agent-security.mdc | SecEng: OWASP, RLS validation, vulnerability scanning |
Advanced Features (manual, use @rule-name to activate)
| File | Purpose |
30-background-agents.mdc | Guidelines for Cursor background agents running in isolated VMs |
31-mcp-integration.mdc | MCP server configuration guidance for external service integration |
MCP Server Configuration
Cursor supports project-level MCP server configuration via .cursor/mcp.json. This harness includes a pre-configured MCP config with placeholder tokens for Linear and Confluence integration.
Config file: .cursor/mcp.json
To activate:
- Open
.cursor/mcp.json - Replace
{{MCP_LINEAR_SERVER}}with your preferred server name (e.g.,linear) - Replace
{{MCP_CONFLUENCE_SERVER}}with your preferred server name (e.g.,confluence) - Set environment variable values (API keys, tokens, URLs)
- Cursor auto-detects the config -- servers appear in Settings > Features > MCP Servers
Security: Never commit real API keys. Use environment variables or Cursor's settings UI for secrets. The .cursor/mcp.json file uses placeholder values that must be replaced per-project.
See 31-mcp-integration.mdc for detailed MCP usage guidance across SAFe agent roles.
Background Agent Support
Cursor Background Agents can run long tasks autonomously in isolated Ubuntu VMs. They clone the repo, work on a branch, and open PRs. This harness includes guidelines for using background agents within the SAFe workflow:
- Activate the rule with
@30-background-agentsfor guidance - Background agents follow the same SAFe gate chain (Stop-the-Line, QAS, 3-stage review)
- Assign one ticket per agent for clear scope
- PRs created by background agents still require QAS validation and HITL merge
See 30-background-agents.mdc for full details.
MCP Integration
Cursor supports the Model Context Protocol (MCP) natively. Configure MCP servers in .cursor/mcp.json or via Cursor settings to enable agents to interact with Linear, Confluence, GitHub, and other services.
- Activate the rule with
@31-mcp-integrationfor configuration guidance - MCP servers are interchangeable across all four supported providers
See 31-mcp-integration.mdc for configuration examples.
Usage
Always-Apply Rules
These load automatically. No action needed. They ensure every conversation respects SAFe principles, git workflow standards, and the pattern discovery protocol.
Auto-Attached Rules
These activate when you open or edit files matching their glob pattern. For example, editing core/gateway/router.py will automatically load 10-backend-python.mdc.
Agent-Role Rules
Reference these manually when you want Cursor to adopt a specific SAFe agent persona:
@20-agent-architect Review this PR for pattern compliance
@21-agent-backend Implement the API endpoint from spec REN-123
@22-agent-qas Validate acceptance criteria for this feature
@23-agent-security Audit RLS policies for this new tableAdvanced Feature Rules
Reference these when working with background agents or MCP:
@30-background-agents Set up a background agent for {{TICKET_PREFIX}}-42
@31-mcp-integration Configure Linear MCP for ticket managementDesign Principles
- DRY: Rules reference existing docs (CLAUDE.md, AGENTS.md, patterns_library/) rather than duplicating content
- Concise: Each rule stays under 200 lines to respect Cursor's context limits
- Template-Ready: Uses
{{TICKET_PREFIX}},{{MAIN_BRANCH}}, and other placeholders for project customization - Hierarchical: Numbering (00-02 core, 03-04 methodology, 10-16 tech, 20-23 roles, 30-31 advanced) groups rules by activation type
Relationship to Other Configurations
This harness supports four AI providers. All share the same SAFe methodology and reference the same source docs:
| Tool | Config Location | Purpose |
| Claude Code | .claude/ (agents, skills, commands, hooks) | Primary provider -- full harness |
| Gemini CLI | .gemini/ (commands, skills, settings) | Secondary provider -- TOML commands |
| Codex CLI | .codex/config.toml + .agents/skills/ | TOML config, reads AGENTS.md, MCP native |
| Cursor IDE | .cursor/rules/ (this directory) | .mdc rules, background agents, MCP |
| Augment | agent_providers/augment/rules/ | Augment Code rules |
All configurations reference the same source docs (CLAUDE.md, AGENTS.md, CONTRIBUTING.md, patterns_library/) to maintain consistency.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

