Skip to content

Commit 358eedb

Browse files
SmithSmith
authored andcommitted
feat: Enhance Cursor IDE support with new rules and validation
- Added Cursor IDE support documentation in CURSOR-SUPPORT.md, detailing the integration and limitations of Cursor with ControlFlow. - Introduced new rules under .cursor/rules/ for core functionality, documentation parity, implementation review, planning, and portability. - Implemented validation for Cursor rules in validate.mjs, ensuring compliance with defined standards and metadata requirements. - Created regression tests for Cursor rules to verify frontmatter integrity and activation metadata. - Updated governance documents to reflect Cursor IDE support policies and validation commands. - Enhanced the structural validation harness to include checks for Cursor rules and their compliance with the canonical source matrix.
1 parent 41bec64 commit 358eedb

23 files changed

Lines changed: 705 additions & 22 deletions

.cursor/rules/controlflow-core.mdc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
description: "Core ControlFlow identity, source hierarchy, and offline validations for the repository."
3+
alwaysApply: true
4+
---
5+
# ControlFlow Core
6+
7+
This is a prompt/governance/eval repository, not a runtime application.
8+
Canonical multi-agent policies, roster, and tiers are governed by `.github/copilot-instructions.md` and `plans/project-context.md`.
9+
Use local sources for context; `AGENTS.md` is compatibility context only, not the primary artifact.
10+
Cursor cannot execute VS Code-only subagent semantics (`agent/runSubagent`), read policies rather than assuming a runtime capability.
11+
All changes must pass the deterministic offline validation gate: run `cd evals && npm test`.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
description: "Rules for documentation parity, localized tutorials, and eval verification."
3+
globs:
4+
- "docs/**/*.md"
5+
- "evals/**/*.mjs"
6+
- "README.md"
7+
- "CHANGELOG.md"
8+
- "CONTRIBUTING.md"
9+
---
10+
# ControlFlow Docs And Evals
11+
12+
Adhere to contribution and PR policies defined in `CONTRIBUTING.md`.
13+
Documentation changes must maintain English/Russian tutorial parity matching `docs/tutorial-en/` and `docs/tutorial-ru/` structure.
14+
Offline test expectations and the evaluation harness are documented in `evals/README.md`.
15+
Eval harness changes (such as `evals/validate.mjs` or `evals/package.json`) must avoid networking dependencies and remain deterministic.
16+
Always verify code changes by running `cd evals && npm test`.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
description: "Guidelines for implementation, testing, review, and governance alignment."
3+
globs:
4+
- "*.agent.md"
5+
- "governance/*.json"
6+
- "schemas/*.json"
7+
---
8+
# ControlFlow Implementation And Review
9+
10+
Agent files must adhere exactly to the P.A.R.T. order (Prompt, Archive, Resources, Tools) per `docs/agent-engineering/PART-SPEC.md`.
11+
Implementation and refactoring follow the core-first migration strategy defined in `docs/agent-engineering/MIGRATION-CORE-FIRST.md`.
12+
Never modify agent tool or permission profiles without updating `governance/agent-grants.json` and `governance/tool-grants.json`.
13+
All agent execution reports must conform to their schemas (e.g., `schemas/*execution-report.schema.json`).
14+
Ensure structured failure classification (`transient`, `fixable`, `needs_replan`, `escalate`) is applied in all outputs.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
description: "Rules for planning, scope discipline, and plan artifact tracking."
3+
globs:
4+
- "plans/**/*.md"
5+
- "schemas/planner.*.json"
6+
---
7+
# ControlFlow Planning
8+
9+
For planning and phase discipline, reference `Planner.agent.md` and `Orchestrator.agent.md`.
10+
ControlFlow uses explicit complexity tiers and semantic risk discovery documented in `plans/project-context.md`.
11+
Plan artifacts must follow the structure defined in `schemas/planner.plan.schema.json`.
12+
Reference `skills/patterns/completeness-traceability.md` for plan completeness criteria.
13+
Do not invoke VS Code-only subagent mechanics; follow the declarative phases and structured text reports.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
description: "Guidelines for external host adaptation, portable plugins, and routing."
3+
globs:
4+
- "plugins/**/*"
5+
- "docs/agent-engineering/TOOL-ROUTING.md"
6+
---
7+
# ControlFlow Portability
8+
9+
Adaptations like Codex and Claude Code runtimes are governed by `plugins/controlflow-codex/README.md` and `plugins/controlflow-claude-code/README.md`.
10+
Asset generation for shared plugins follows `plugins/controlflow-shared-source/README.md`.
11+
For external tool usage, strictly follow `docs/agent-engineering/TOOL-ROUTING.md` (local-first, verified external docs mapping).
12+
Do not try to make external IDE environments replicate VS Code-specific features like `runSubagent`.

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
66

77
---
88

9+
## [Unreleased]
10+
11+
### Added
12+
13+
- **Cursor IDE Support**: Added `.cursor/rules` to provide high-level guidance to the Cursor agent, along with documentation in `docs/agent-engineering/CURSOR-SUPPORT.md`.
14+
15+
---
16+
917
## [Unreleased] — Claude Code Plugin (Phase 6)
1018

1119
### Added - Claude Code Plugin

CONTRIBUTING.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,17 @@ Always run `cd evals && npm test` after plugin edits to catch cross-repo drift.
123123

124124
---
125125

126+
## Editing Cursor Rules (`.cursor/rules`)
127+
128+
When editing `.cursor/rules`, ensure the following:
129+
130+
1. **Frontmatter is valid:** Check that frontmatter starts with `---`, has a closing `---`, and includes at least one of `alwaysApply`, `description`, or `globs`.
131+
2. **Line budget respected:** Keep rules concise and within 500 lines.
132+
3. **Canonical references:** Point to canonical ControlFlow files (e.g. `.github/copilot-instructions.md`, `plans/project-context.md`) instead of copying policy content.
133+
4. **Run structural validation:** After editing, run `cd evals && npm test` to ensure no project-wide structural contracts were accidentally broken.
134+
135+
---
136+
126137
## Proposing changes
127138

128139
- **Bug reports and feature requests:** Open a GitHub Issue describing the problem or proposal clearly.

README.md

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,42 @@
55
![Eval](https://img.shields.io/badge/eval-offline-brightgreen)
66
![License](https://img.shields.io/badge/license-MIT-green)
77

8-
A multi-agent orchestration system for VS Code Copilot, plus maintained Codex and Claude Code plugins. ControlFlow coordinates 13 specialized agents under deterministic **P.A.R.T contracts** (Prompt → Archive → Resources → Tools), structured text outputs, and layered reliability gates.
8+
A multi-agent orchestration system for VS Code Copilot, plus maintained Codex, Claude, and Cursor plugins. ControlFlow coordinates 13 specialized agents under deterministic **P.A.R.T contracts** (Prompt → Archive → Resources → Tools), structured text outputs, and layered reliability gates.
99

1010
---
1111

1212
## Contents
1313

14-
- [Why ControlFlow?](#why-controlflow)
15-
- [Quick Start](#quick-start)
16-
- [When to Use Which Agent](#when-to-use-which-agent)
17-
- [Pipeline by Complexity](#pipeline-by-complexity)
18-
- [Orchestration State Machine](#orchestration-state-machine)
19-
- [Failure Routing](#failure-routing)
20-
- [Agent Architecture](#agent-architecture)
21-
- [Evaluation Suite](#evaluation-suite)
22-
- [Project Structure](#project-structure)
23-
- [Documentation](#documentation)
24-
- [Installation](#installation)
25-
- [ControlFlow for Codex (Plugin)](#controlflow-for-codex-plugin)
26-
- [ControlFlow for Claude Code (Plugin)](#controlflow-for-claude-code-plugin)
27-
- [License](#license)
14+
- [ControlFlow](#controlflow)
15+
- [Contents](#contents)
16+
- [Why ControlFlow?](#why-controlflow)
17+
- [Quick Start](#quick-start)
18+
- [When to Use Which Agent](#when-to-use-which-agent)
19+
- [Pipeline by Complexity](#pipeline-by-complexity)
20+
- [Orchestration State Machine](#orchestration-state-machine)
21+
- [Failure Routing](#failure-routing)
22+
- [Agent Architecture](#agent-architecture)
23+
- [Interaction diagram](#interaction-diagram)
24+
- [Primary Agents](#primary-agents)
25+
- [Specialized Subagents](#specialized-subagents)
26+
- [Evaluation Suite](#evaluation-suite)
27+
- [Project Structure](#project-structure)
28+
- [Documentation](#documentation)
29+
- [Installation](#installation)
30+
- [Adding Custom Agents](#adding-custom-agents)
31+
- [ControlFlow for Codex (Plugin)](#controlflow-for-codex-plugin)
32+
- [Included Skills](#included-skills)
33+
- [ControlFlow for Claude Code (Plugin)](#controlflow-for-claude-code-plugin)
34+
- [Local Development Usage](#local-development-usage)
35+
- [Intentional Differences from VS Code](#intentional-differences-from-vs-code)
36+
- [ControlFlow for Cursor](#controlflow-for-cursor)
37+
- [ControlFlow for Codex Usage and Validation](#controlflow-for-codex-usage-and-validation)
38+
- [Plugin Installation](#plugin-installation)
39+
- [Usage](#usage)
40+
- [Validating Codex Strict-Plan Artifacts](#validating-codex-strict-plan-artifacts)
41+
- [Intentional Differences from the VS Code Version](#intentional-differences-from-the-vs-code-version)
42+
- [License](#license)
43+
- [Acknowledgments](#acknowledgments)
2844

2945
---
3046

@@ -349,6 +365,15 @@ See [`plugins/controlflow-claude-code/README.md`](plugins/controlflow-claude-cod
349365

350366
Complexity routing matches the main project: `TRIVIAL` → optional; `SMALL` → plan-audit; `MEDIUM` → plan-audit + assumption-verifier; `LARGE` → full pipeline.
351367

368+
## ControlFlow for Cursor
369+
370+
This repository includes a `.cursor/rules/` directory with version-controlled Project Rules (`.mdc` files). Cursor automatically loads these rules when you open the project — no installation or configuration required. The rules give Cursor's AI agent high-level instructions about this repository's conventions, agent roles, and architectural principles.
371+
372+
- **What it does:** Provides context and conventions to Cursor's agent.
373+
- **What it does NOT do:** It does not enable Cursor to run the VS Code subagent dispatch system.
374+
375+
For more details, see the authoritative guide at [docs/agent-engineering/CURSOR-SUPPORT.md](docs/agent-engineering/CURSOR-SUPPORT.md).
376+
352377
## ControlFlow for Codex Usage and Validation
353378

354379
### Plugin Installation
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Cursor IDE Support
2+
3+
## Overview
4+
5+
ControlFlow supports Cursor IDE through version-controlled Project Rules under `.cursor/rules/`. These rules give Cursor users access to ControlFlow conventions, governance policies, and the offline verification gate without creating a new runtime plugin or altering VS Code agent semantics.
6+
7+
Cursor IDE support is **documentation and rules only**. Cursor cannot execute VS Code-specific subagent semantics (`agent/runSubagent`) and no new tool grants or executor roles are required.
8+
9+
## Rule Inventory
10+
11+
All rules live under `.cursor/rules/` as `.mdc` files with YAML frontmatter.
12+
13+
| File | Activation | Scope | Description |
14+
| ---- | ---------- | ----- | ----------- |
15+
| `controlflow-core.mdc` | `alwaysApply: true` | All sessions | Repo identity, canonical source hierarchy, no-runtime-app warning, offline eval gate |
16+
| `controlflow-planning.mdc` | `globs: plans/**/*.md, schemas/planner.*.json` | Planning work | Planning discipline, phase decomposition, risk review, plan-artifact conventions |
17+
| `controlflow-implementation-review.mdc` | `globs: *.agent.md, governance/*.json, schemas/*.json` | Implementation and review | P.A.R.T. preservation, tool/grant update requirements, failure classification |
18+
| `controlflow-docs-evals.mdc` | `globs: docs/**/*.md, evals/**/*.mjs, ...` | Documentation and evals | Tutorial parity, eval harness conventions, verification gate |
19+
| `controlflow-portability.mdc` | `globs: plugins/**/*, docs/agent-engineering/TOOL-ROUTING.md` | Portability work | Codex, Claude Code, and shared-source adapter guidance |
20+
21+
## Activation Guidance
22+
23+
- `controlflow-core.mdc` uses `alwaysApply: true` and is automatically active in every Cursor session for this repository.
24+
- Scoped rules activate via `globs` when the current file matches the specified pattern, keeping detailed instructions focused and session-context efficient.
25+
- Rules reference canonical ControlFlow files rather than duplicating long agent prompts, minimising stale-instruction risk.
26+
- Use Cursor Project Rules (`.cursor/rules/`) as the primary integration surface for Cursor users. Do not rely on the root `AGENTS.md` as the distributable Cursor surface; it is a local-only helper (see Limitations).
27+
28+
## Limitations
29+
30+
- **No VS Code runtime semantics.** Cursor does not support `agent/runSubagent`. Cursor rules provide guidance; they do not orchestrate ControlFlow subagents. No rule may claim or imply Cursor can execute VS Code-only capabilities.
31+
- **No new tool grants.** Cursor support is a documentation surface only. `governance/tool-grants.json` and `governance/agent-grants.json` are unchanged.
32+
- **No new executor roles.** Adding Cursor rules does not create new `executor_agent` entries in `plans/project-context.md` or `governance/project-context-registry.json`.
33+
- **Rules must stay under 500 lines.** Each `.mdc` file should reference canonical docs rather than copy them verbatim.
34+
- **AGENTS.md is local-only.** The root `AGENTS.md` is an explicit local-only helper for AI coding agents working in this repository. It is not the primary Cursor support artifact and must not be treated as a versioned Cursor rule.
35+
36+
## Validation Commands
37+
38+
Run these commands locally to verify Cursor rule integrity:
39+
40+
```sh
41+
# Structural validation only (schema + P.A.R.T. + Cursor rule structure)
42+
cd evals && npm run test:structural
43+
44+
# Full offline suite including Cursor rule contract validation
45+
cd evals && npm test
46+
```
47+
48+
The offline eval harness validates:
49+
50+
- All `.cursor/rules/*.mdc` files have valid frontmatter delimiters (opening and closing `---`).
51+
- All rules include at least one activation metadata key: `alwaysApply`, `description`, or `globs`.
52+
- `controlflow-core.mdc` uses `alwaysApply: true` and references at least one canonical ControlFlow path.
53+
- No rule file exceeds 500 lines.
54+
55+
## Authoritative References
56+
57+
| Concern | File |
58+
| ------- | ---- |
59+
| Cursor rule source of truth | `.cursor/rules/*.mdc` |
60+
| ControlFlow shared policies | `.github/copilot-instructions.md` |
61+
| Agent roster and complexity tiers | `plans/project-context.md` |
62+
| Tool routing policy | `docs/agent-engineering/TOOL-ROUTING.md` |
63+
| P.A.R.T. specification | `docs/agent-engineering/PART-SPEC.md` |
64+
| Eval harness documentation | `evals/README.md` |
65+
66+
## Changing Cursor Rules
67+
68+
Before modifying any `.cursor/rules/*.mdc` file:
69+
70+
1. Verify the change does not duplicate content already in `.github/copilot-instructions.md` — reference the canonical file instead.
71+
2. Confirm the rule does not imply Cursor can use VS Code-only capabilities (`agent/runSubagent`).
72+
3. If a change requires updated Cursor frontmatter semantics, verify against official Cursor documentation (`https://cursor.com/docs/rules`) before editing; Cursor docs are the external source of truth for `.mdc` activation behaviour.
73+
4. Run `cd evals && npm test` after any rule change. The structural gate must pass before declaring the change done.

docs/agent-engineering/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ Index of governance and engineering policy documents. Each agent loads the relev
1818
- [`SCORING-SPEC.md`](SCORING-SPEC.md) — Quantitative scoring reference for reviewers and eval harnesses.
1919
- [`MIGRATION-CORE-FIRST.md`](MIGRATION-CORE-FIRST.md) — Shared implementation backbone pattern and consolidation exit criteria.
2020

21-
## Portability & Plugins
21+
## Portability & IDE Support
2222

23-
The repository contains adaptations of the ControlFlow system for non-VS Code environments:
23+
The repository contains adaptations of the ControlFlow system for non-VS Code environments and IDE integrations:
2424

2525
- **Codex CLI**: See `plugins/controlflow-codex/README.md` for the portable skills and artifacts adapter.
2626
- **Claude Code**: See `plugins/controlflow-claude-code/README.md` for the native plugin skills, agents, and local development lifecycle.
27+
- **Cursor IDE**: See [`CURSOR-SUPPORT.md`](CURSOR-SUPPORT.md) for the version-controlled Project Rules surface, activation guidance, limitations, and validation commands. Cursor support does not alter VS Code tool grants or add new executor roles.
2728

2829
## Runtime capabilities (shipped in the ControlFlow revision program)
2930

0 commit comments

Comments
 (0)