|
1 | 1 | --- |
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) |
3 | 3 | alwaysApply: true |
4 | 4 | --- |
5 | 5 |
|
6 | | -# GraphStack Core Rules (v4) |
| 6 | +# GraphStack Core Rules (v4.6) |
7 | 7 |
|
8 | 8 | ## 🎯 Default Mode: Orchestrated |
9 | 9 |
|
10 | 10 | Unless the user explicitly activates a single role, always run as the **Orchestrator**. |
11 | 11 |
|
12 | | -**Frictionless startup (Cursor):** This project’s `.cursor/rules/graphstack.mdc` is |
| 12 | +**Frictionless startup (Cursor):** This project's `.cursor/rules/graphstack.mdc` is |
13 | 13 | `alwaysApply: true`, so Composer/Agent already ships with GraphStack rules in every |
14 | 14 | new chat. The user does **not** need to paste `Read orchestrator/ORCHESTRATOR.md …` |
15 | 15 | every time. |
16 | 16 | 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. |
19 | 19 |
|
20 | 20 | **Optional shortcut:** The `/graphstack` Cursor command (project slash menu) expands |
21 | 21 | explicit Orchestrator-bootstrap instructions. |
22 | 22 |
|
23 | 23 | These rules are ALWAYS active in this project. Follow them in every response. |
24 | 24 |
|
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. |
26 | 38 |
|
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) |
30 | 46 |
|
31 | 47 | 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) |
33 | 49 | - Open implementation files only when the graph cannot answer |
34 | 50 |
|
35 | 51 | When no graph exists, suggest `/graphify .`; if proceeding without confirmation, |
36 | 52 | state risks explicitly. |
37 | 53 |
|
38 | 54 | ## ⚡ Rule 2: Token Discipline |
39 | 55 |
|
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). |
43 | 57 |
|
44 | 58 | ``` |
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 "…" |
46 | 60 | Shell/git/test command needed? → python -m graphstack run -- <cmd> (not raw) |
47 | 61 | Is this tool call speculative? → Cancel it, ask user first |
48 | 62 | Can reads run in parallel? → Parallelize them |
49 | 63 | Output > 15 lines user won't act on → Summarize instead |
50 | | -About to restate what user said? → Delete it, start with action |
51 | 64 | ``` |
52 | 65 |
|
53 | | -## 🎭 Rule 3: Role Discipline |
| 66 | +## 🎭 Rule 3: Role Discipline (announce every transition) |
54 | 67 |
|
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 | +``` |
59 | 88 |
|
60 | 89 | ## 📋 Rule 4: Brief-Driven Building |
61 | 90 |
|
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**. |
63 | 93 | The Reviewer NEVER approves without checking against the brief. |
64 | 94 | If no brief exists, the Architect must write one first. |
65 | 95 |
|
66 | 96 | ## 🚫 Rule 5: No Scope Creep |
67 | 97 |
|
68 | 98 | 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`. |
71 | 100 |
|
72 | 101 | ## 🔄 Rule 6: Graph Staleness Check |
73 | 102 |
|
74 | 103 | If `graphify-out/GRAPH_REPORT.md` is older than the files being discussed: |
75 | 104 | - Warn: "Graph may be stale. Consider running `/graphify --update`" |
76 | | -- Continue with available graph data unless user requests refresh |
77 | 105 |
|
78 | 106 | ## 📁 Rule 7: Handoff Files |
79 | 107 |
|
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. |
0 commit comments