Skip to content

Commit c7c15e1

Browse files
Release v4.6.0: enforce orchestrator cycle with gate v3 and cycle CLI.
Adds role-aware gate rules, graphstack cycle commands, expanded alwaysApply rules, hook merge on install, and doctor handoff sync checks. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 985d818 commit c7c15e1

18 files changed

Lines changed: 900 additions & 161 deletions

File tree

.cursor/rules/graphstack.mdc

Lines changed: 70 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,125 @@
11
---
2-
description: GraphStack v4 — Orchestrated, graph-first, GNAP-tracked AI development (cross-platform)
2+
description: GraphStack v4.6 — Orchestrated, graph-first, GNAP-tracked AI development (cross-platform)
33
alwaysApply: true
44
---
55

6-
# GraphStack Core Rules (v4)
6+
# GraphStack Core Rules (v4.6)
77

88
## 🎯 Default Mode: Orchestrated
99

1010
Unless the user explicitly activates a single role, always run as the **Orchestrator**.
1111

12-
**Frictionless startup (Cursor):** This projects `.cursor/rules/graphstack.mdc` is
12+
**Frictionless startup (Cursor):** This project's `.cursor/rules/graphstack.mdc` is
1313
`alwaysApply: true`, so Composer/Agent already ships with GraphStack rules in every
1414
new chat. The user does **not** need to paste `Read orchestrator/ORCHESTRATOR.md …`
1515
every time.
1616
Your obligation is identical to **executing**
17-
`orchestrator/ORCHESTRATOR.md` → **Activation** (including parallel **1a** reads)
18-
on your first substantive turn, before acting on substantive work.
17+
`orchestrator/ORCHESTRATOR.md` → **Activation** on your first substantive turn,
18+
before acting on substantive work.
1919

2020
**Optional shortcut:** The `/graphstack` Cursor command (project slash menu) expands
2121
explicit Orchestrator-bootstrap instructions.
2222

2323
These rules are ALWAYS active in this project. Follow them in every response.
2424

25-
## 🧠 Rule 1: Graph First (Most Important)
25+
## 🚀 Activation (mandatory first turn — full checklist)
26+
27+
Run **one parallel read batch** (never split across turns):
28+
29+
```
30+
orchestrator/TOKEN_OPTIMIZER.md
31+
graphify-out/GRAPH_REPORT.md (if exists)
32+
handoff/BRIEF.md
33+
handoff/board/doing/*.json (note task ids if any)
34+
handoff/STATE.md (last ## block only)
35+
```
36+
37+
Then greet per `orchestrator/ORCHESTRATOR.md` step 8.
2638

27-
**Session bootstrap wins:** Activation step **1a** in `orchestrator/ORCHESTRATOR.md`
28-
defines the first-read batch (`TOKEN_OPTIMIZER` + `GRAPH_REPORT` when present, once).
29-
After bootstrap completes, use graph-first discipline below.
39+
**If the user's first message already contains a task goal:** greet briefly, then
40+
enter **[ARCHITECT MODE]** immediately — do **not** implement code on the first turn.
41+
42+
**If doing/ has a task and BRIEF is Ready for Builder:** offer to resume Builder or
43+
run `python -m graphstack cycle enter-builder <task-id>` before code edits.
44+
45+
## 🧠 Rule 1: Graph First (Most Important)
3046

3147
When a graph exists, answer structural questions from the graph before opening raw sources:
32-
- `graphify-out/GRAPH_REPORT.md` and, when needed, `graphify-out/graph.json`
48+
- `python -m graphstack graph query "…"` or `graphify-out/GRAPH_REPORT.md` (once per session)
3349
- Open implementation files only when the graph cannot answer
3450

3551
When no graph exists, suggest `/graphify .`; if proceeding without confirmation,
3652
state risks explicitly.
3753

3854
## ⚡ Rule 2: Token Discipline
3955

40-
The **full** decision tree (tiers 1–4, parallel-read protocol, output compression)
41-
lives in `orchestrator/TOKEN_OPTIMIZER.md`. The Orchestrator loads it once at session
42-
activation — follow both that file **and** the abbreviated reminders below:
56+
The **full** decision tree lives in `orchestrator/TOKEN_OPTIMIZER.md` (loaded at activation).
4357

4458
```
45-
Is the answer in the graph? → python -m graphstack graph query "…" (or GRAPH_REPORT once)
59+
Is the answer in the graph? → python -m graphstack graph query "…"
4660
Shell/git/test command needed? → python -m graphstack run -- <cmd> (not raw)
4761
Is this tool call speculative? → Cancel it, ask user first
4862
Can reads run in parallel? → Parallelize them
4963
Output > 15 lines user won't act on → Summarize instead
50-
About to restate what user said? → Delete it, start with action
5164
```
5265

53-
## 🎭 Rule 3: Role Discipline
66+
## 🎭 Rule 3: Role Discipline (announce every transition)
5467

55-
When a role is active (Architect / Builder / Reviewer / QA):
56-
- Stay strictly within that role's responsibilities
57-
- Do not perform another role's job unless explicitly asked
58-
- Handoff explicitly: "This is ready for Builder" or "Sending back to Architect"
68+
Before acting as a role, announce: `[ARCHITECT MODE]`, `[BUILDER MODE]`, etc.
69+
70+
After every transition, run:
71+
```bash
72+
python -m graphstack state set --role <role> [--task <task-id>]
73+
```
74+
75+
**FORBIDDEN without active builder role:**
76+
- Editing or creating code files (anything outside `handoff/`, `graphify-out/`, `.cursor/`)
77+
- The process gate (v4.6) denies edits unless `handoff/STATE.json` has `role=builder`
78+
and a task is in `handoff/board/doing/`
79+
80+
**Cycle start (new feature):**
81+
```bash
82+
python -m graphstack cycle start <task-id> "<title>"
83+
```
84+
Architect writes BRIEF → then:
85+
```bash
86+
python -m graphstack cycle enter-builder <task-id>
87+
```
5988

6089
## 📋 Rule 4: Brief-Driven Building
6190

62-
The Builder NEVER builds without a brief from `handoff/BRIEF.md`.
91+
The Builder NEVER builds without a brief from `handoff/BRIEF.md` with
92+
**Status: Ready for Builder**.
6393
The Reviewer NEVER approves without checking against the brief.
6494
If no brief exists, the Architect must write one first.
6595

6696
## 🚫 Rule 5: No Scope Creep
6797

6898
Build exactly what the brief says.
69-
Do not add features, refactors, or improvements not in the brief.
70-
If something looks wrong but is out of scope, note it in `handoff/REVIEW.md` for the next cycle.
99+
If something looks wrong but is out of scope, note it in `handoff/REVIEW.md`.
71100

72101
## 🔄 Rule 6: Graph Staleness Check
73102

74103
If `graphify-out/GRAPH_REPORT.md` is older than the files being discussed:
75104
- Warn: "Graph may be stale. Consider running `/graphify --update`"
76-
- Continue with available graph data unless user requests refresh
77105

78106
## 📁 Rule 7: Handoff Files
79107

80-
- `handoff/BRIEF.md` — Architect writes this. Builder reads this before starting.
81-
- `handoff/REVIEW.md` — Reviewer writes findings here. Architect reads before next cycle.
82-
- Never delete these files mid-session. Append new cycles with date headers.
108+
- `handoff/BRIEF.md` — Architect → Builder
109+
- `handoff/REVIEW.md` — Reviewer findings (append-only)
110+
- `handoff/STATE.md` — human session log (append-only)
111+
- `handoff/STATE.json` — machine state for gate hooks
112+
113+
## 🔁 Rule 8: Full Cycle (do not skip)
114+
115+
For any feature or fix that touches code:
116+
117+
```
118+
ARCHITECT → brief + board task
119+
BUILDER → implement (only after enter-builder)
120+
REVIEWER → append handoff/REVIEW.md with Verdict
121+
QA → trace call paths from brief
122+
SHIP → checklist + commit (strict gate: role=ship)
123+
```
124+
125+
Never jump from graph exploration directly to implementation.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ graphify-out/cache/
5656
# - graphify-out/GRAPH_REPORT.md
5757
# - graphify-out/graph.json
5858

59+
# Local wheel/sdist smoke builds (not for release)
60+
dist_test/
61+
5962
# Test artifacts (board smoke test leftovers)
6063
handoff/board/todo/smoke-*.json
6164
handoff/board/doing/smoke-*.json

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,21 @@ All notable changes to GraphStack are documented here.
44

55
---
66

7+
## [v4.6.0] — 2026-06-11
8+
9+
### Added
10+
- **`graphstack cycle`**`cycle start <id> "<title>"` and `cycle enter-builder <id>` bind board + `STATE.json` + BRIEF status in one step.
11+
- **Gate v3** — R2b (role must be `builder` for code edits), R3b (no edits on Draft brief), R5/R6 (ship + review approval required for code commits in strict mode).
12+
- **`brief_utils.py`** — shared BRIEF/REVIEW helpers for gate, validate, and cycle.
13+
- **Doctor/validate** — handoff sync warnings (`BRIEF` ready but `doing/` empty, role mismatch) and `.cursor/hooks.json` gate presence checks.
14+
15+
### Changed
16+
- **`graphstack.mdc` v4.6** — full Activation checklist, role announcements, and cycle commands embedded in `alwaysApply` rules.
17+
- **`ORCHESTRATOR.md`** — Activation step 9 routes user goals to Architect immediately (no code on first turn).
18+
- **Installer** — merges GraphStack gate hooks into existing `.cursor/hooks.json` / `.claude/settings.json` instead of skipping.
19+
20+
---
21+
722
## [v4.5.5] — 2026-06-11
823

924
### Fixed

README.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -395,17 +395,23 @@ v4.3+ adds **mechanical enforcement** so Architect → Builder → Reviewer step
395395

396396
| Rule | What it blocks | Cursor | Claude Code |
397397
|------|----------------|--------|-------------|
398-
| R1 | `git commit` touching code while `doing/` is empty | deny (`beforeShellExecution` + `preToolUse` Shell) | deny (`PreToolUse` Bash) |
399-
| R2 | Edit/Write on code paths while `doing/` is empty | deny (`preToolUse` Write/Edit) | deny (`PreToolUse` Edit/Write) |
400-
| R3 | Commit while `BRIEF.md` is still the template | deny | deny |
401-
| R4 | `STATE.json` not updated this cycle | advisory (`stop`) | advisory (`Stop`) |
402-
|| Edit already applied (legacy hook) | advisory only (`afterFileEdit`) ||
398+
| R1 | `git commit` touching code while `doing/` is empty | deny | deny |
399+
| R2 | Edit/Write on code paths while `doing/` is empty | deny | deny |
400+
| R3 | Template `BRIEF.md` while task in `doing/` | deny | deny |
401+
| R2b | Code edit while `STATE.json` role ≠ `builder` | deny | deny |
402+
| R3b | Code edit while `BRIEF.md` status is Draft | deny | deny |
403+
| R4 | Stale `STATE.json` vs board claim | advisory (`stop`; **deny** in strict) | same |
404+
| R5 | Code commit while role ≠ `ship` || — (**strict** only) |
405+
| R6 | Code commit without `Verdict: Approved` in `REVIEW.md` || — (**strict** only) |
406+
|| Edit already applied (legacy hook) | advisory (`afterFileEdit`) ||
403407

404408
```bash
409+
python -m graphstack cycle start my-feature "Add email verification"
410+
python -m graphstack cycle enter-builder my-feature # after Architect writes BRIEF
405411
python -m graphstack gate check # CI / manual — exit 1 on violation
406412
python -m graphstack state set --role builder --task my-feature
407413
GRAPHSTACK_GATE=off # emergency bypass (one session)
408-
GRAPHSTACK_GATE=strict # fail-closed on hook internal errors
414+
GRAPHSTACK_GATE=strict # R4–R6 + fail-closed on hook errors
409415
```
410416

411417
**Install** writes `.cursor/hooks.json` and `.claude/settings.json` with OS-specific shim commands (`scripts/gate-hook.ps1` on Windows, `scripts/gate-hook.sh` on macOS/Linux). By default hooks **fail open** if Python is missing — use `GRAPHSTACK_GATE=strict` for teams that prefer blocking over availability.

orchestrator/ORCHESTRATOR.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,12 @@ Execute this sequence exactly on every session start. Each step has a fallback
5252
[Only if STATE.md has entry]: Last session: [ROLE] on [date] — resume?
5353
What are we working on?"
5454
55-
9. Wait. Do not proceed until user responds.
55+
9. First-turn routing (replaces blind wait):
56+
a. User message is empty / only greeting → greet (step 8) and wait.
57+
b. User message contains a task goal (feature, fix, bug) → greet briefly (step 8),
58+
then enter ARCHITECT immediately. Do NOT implement code on the first turn.
59+
c. doing/ has a task + BRIEF Ready for Builder → offer resume Builder:
60+
`python -m graphstack cycle enter-builder <task-id>` before any code edit.
5661
```
5762

5863
---
@@ -148,13 +153,24 @@ Bootstrapper writing Cycle [N+1] brief.
148153
### IDLE → ARCHITECT
149154
**Trigger:** Graph exists with nodes AND user describes a feature, change, or bug fix.
150155

156+
**Mechanical prep (Architect):**
157+
```bash
158+
python -m graphstack cycle start <task-id> "<title>"
159+
# or manually: board new <id> "<title>" + state set --role architect --task <id>
160+
```
161+
151162
**Action:**
152163
```
153164
[ARCHITECT MODE]
154165
Reading graph context...
155166
[execute architect logic from .cursor/skills/architect/ARCHITECT.md]
156167
```
157168

169+
**Before BUILDER:** brief must be **Ready for Builder**, then:
170+
```bash
171+
python -m graphstack cycle enter-builder <task-id>
172+
```
173+
158174
### ARCHITECT → BUILDER
159175
**Trigger:** Brief is written AND user says any of:
160176
- "looks good", "proceed", "build it", "go ahead", "ok", "evet", "devam"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "MertCapkin_GraphStack"
7-
version = "4.5.5"
7+
version = "4.6.0"
88
description = "Graph-first AI development workflow — board, gate, graph queries, one-shot init"
99
readme = "README.md"
1010
license = { text = "MIT" }

scripts/graphstack/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
66
Entry point: ``python -m graphstack <command>``
77
Commands: ``board``, ``install``, ``init``, ``hook``, ``validate``, ``doctor``, ``run``,
8-
``gate``, ``state``, ``graph``
8+
``gate``, ``state``, ``graph``, ``cycle``
99
"""
1010

11-
__version__ = "4.5.5"
11+
__version__ = "4.6.0"
1212
__all__ = ["__version__"]

0 commit comments

Comments
 (0)