Skip to content

Commit b256809

Browse files
Wire TOKEN_OPTIMIZER into orchestrator activation, add /graphstack command UX, and vendor graphify-out (cache ignored).
Keeps onboarding friction low while aligning rules with GRAPH_REPORT + TOKEN_OPTIMIZER; CI and installer enforce the command stub. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 98922cf commit b256809

15 files changed

Lines changed: 9469 additions & 44 deletions

File tree

.cursor/commands/graphstack.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# GraphStack — start Orchestrator
2+
3+
1. Execute **Activation** in `orchestrator/ORCHESTRATOR.md` exactly as written (including step **1a**).
4+
2. Greet using the scripted format from that section.
5+
3. Wait for user input (`Activation` wait step). If the user already embedded their goal in the same message as this command, proceed with that goal immediately after greeting.

.cursor/rules/graphstack.mdc

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,39 @@ alwaysApply: true
88
## 🎯 Default Mode: Orchestrated
99

1010
Unless the user explicitly activates a single role, always run as the **Orchestrator**.
11-
Read `orchestrator/ORCHESTRATOR.md` on first message of every session.
11+
12+
**Frictionless startup (Cursor):** This project’s `.cursor/rules/graphstack.mdc` is
13+
`alwaysApply: true`, so Composer/Agent already ships with GraphStack rules in every
14+
new chat. The user does **not** need to paste `Read orchestrator/ORCHESTRATOR.md …`
15+
every time.
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.
19+
20+
**Optional shortcut:** The `/graphstack` Cursor command (project slash menu) expands
21+
explicit Orchestrator-bootstrap instructions.
1222

1323
These rules are ALWAYS active in this project. Follow them in every response.
1424

1525
## 🧠 Rule 1: Graph First (Most Important)
1626

17-
Before reading ANY file, check if `graphify-out/GRAPH_REPORT.md` exists.
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.
1830

19-
If it exists:
20-
- Read `graphify-out/GRAPH_REPORT.md` FIRST
21-
- Use `graphify-out/graph.json` to answer structural questions (dependencies, call paths, module relationships)
22-
- Only open raw files when the graph is insufficient
31+
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`
33+
- Open implementation files only when the graph cannot answer
2334

24-
If it does not exist:
25-
- Suggest running `/graphify .` before proceeding
26-
- Offer to continue without graph context if user confirms
35+
When no graph exists, suggest `/graphify .`; if proceeding without confirmation,
36+
state risks explicitly.
2737

2838
## ⚡ Rule 2: Token Discipline
2939

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:
43+
3044
```
3145
Is the answer in the graph? → Use graph, skip raw file read
3246
Is this tool call speculative? → Cancel it, ask user first

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ jobs:
6363
"orchestrator/ORCHESTRATOR.md",
6464
"orchestrator/TOKEN_OPTIMIZER.md",
6565
".cursor/rules/graphstack.mdc",
66+
".cursor/commands/graphstack.md",
6667
"handoff/BRIEF.md",
6768
"handoff/REVIEW.md",
6869
"handoff/BOOTSTRAP.md",

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ npm-debug.log*
3535
# ── GraphStack-specific ───────────────────────────────────
3636

3737
# graphify-out: COMMIT this in your projects (it's the knowledge graph)
38+
# Local AST cache is machine-specific and must not be versioned:
39+
graphify-out/cache/
40+
3841
# But exclude the visual HTML in CI if it's large:
3942
# graphify-out/graph.html
4043

CONTRIBUTING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ The `demo/` folder shows GraphStack in action on a Node.js auth service. More de
4949
Used GraphStack on a real project? Measured token savings? Wrote about it?
5050
Open a PR adding a `docs/case-studies/` entry or link to your post in the README.
5151

52+
### 6. Cursor slash-command bootstrap snippets
53+
54+
Markdown files inside `.cursor/commands/` register under Cursor Composer’s **`/`** slash menu.
55+
When you introduce a copy change, restart Cursor once locally (and mention that in README) so teammates see the refreshed entry. Keep installers + CI manifests in sync via `installer.py`'s `FILE_COPIES` and `.github/workflows/ci.yml`.
56+
5257
---
5358

5459
## Pull Request Guidelines

README.md

Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,35 @@ Run this once. After that, use `/graphify --update` — it only re-scans changed
136136

137137
### Step 4 — Start working
138138

139-
Open a **new Cursor chat** and paste one of these:
139+
The repo ships two ways to bootstrap the orchestrator — pick whichever feels natural.
140+
141+
#### A) Easiest — new chat only (recommended)
142+
143+
Because `.cursor/rules/graphstack.mdc` is **`alwaysApply: true`**, every new Composer / Agent
144+
session already carries GraphStack’s binding rules. Simply open chat and describe your goal in
145+
natural language (`Add …`, `Fix …`). The assistant’s first turn must still **execute**
146+
`orchestrator/ORCHESTRATOR.md → Activation** (parallel `TOKEN_OPTIMIZER` + `GRAPH_REPORT`),
147+
but **you don’t paste** `Read orchestrator/...` anymore.
148+
149+
#### B) Slash command `/graphstack` (explicit nudge)
150+
151+
In Cursor Chat/Composer press `/` → choose **`graphstack`**. That injects the Bootstrap command
152+
stored in `.cursor/commands/graphstack.md` (helps when you want deterministic orchestrator wording
153+
or onboarding teammates).
154+
155+
*If `/graphstack` doesn't appear immediately, restart Cursor once so it rescans `.cursor/commands/`.*
156+
157+
#### C) Classic explicit prompt (fallback / other tools)
140158

141159
**Existing codebase:**
160+
142161
```
143162
Read orchestrator/ORCHESTRATOR.md and follow it exactly.
144163
[Describe what you want to build or fix]
145164
```
146165

147166
**New project from scratch:**
167+
148168
```
149169
Read orchestrator/ORCHESTRATOR.md and follow it exactly.
150170
This is a new project with no existing codebase.
@@ -196,8 +216,13 @@ Problems:
196216
Step 1 — once:
197217
/graphify . → graphify-out/GRAPH_REPORT.md + graph.json
198218
199-
Step 2 — every session (one prompt):
200-
"Read orchestrator/ORCHESTRATOR.md. Add rate limiting to login."
219+
Step 2 — every session (minimal typing):
220+
Open Composer + describe the task (rules already activate GraphStack automatically),
221+
optionally type `/graphstack` once for an explicit orchestrator preamble,
222+
or paste the legacy `Read orchestrator/ORCHESTRATOR.md …` snippet if working outside Cursor.
223+
224+
Example natural-language kickoff:
225+
"Add rate limiting to login."
201226
202227
[ARCHITECT] reads graph (not raw files) → scopes change → writes BRIEF.md
203228
↓ auto
@@ -219,8 +244,12 @@ Step 2 — every session (one prompt):
219244
No code yet? GraphStack handles that too.
220245

221246
```
222-
"Read orchestrator/ORCHESTRATOR.md.
223-
New project: REST API for task management. TypeScript, Express, PostgreSQL."
247+
Composer (Cursor):
248+
Describe the product + tech stack naturally (alwaysApply rules bootstrap GraphStack),
249+
optionally `/graphstack` beforehand to inject the scripted opener.
250+
251+
Bootstrap example:
252+
"/graphstack then: New project REST API for task mgmt — TS, Express, PostgreSQL."
224253
225254
[BOOTSTRAPPER] analyzes idea → decomposes into modules → orders by dependency
226255
→ writes BOOTSTRAP.md (the memory across all cycles)
@@ -270,6 +299,7 @@ GraphStack's savings come from three mechanisms:
270299
```
271300
your-project/
272301
├── .cursor/rules/graphstack.mdc ← always-active rules (Cursor auto-loads)
302+
├── .cursor/commands/graphstack.md ← `/graphstack` Cursor slash-command bootstrapper
273303
├── orchestrator/
274304
│ ├── ORCHESTRATOR.md ← state machine: all transitions
275305
│ └── TOKEN_OPTIMIZER.md ← token budget rules for all roles
@@ -402,12 +432,17 @@ The post-commit hook enforces the same rules automatically. You never need to th
402432
| Git-native task board | ✅ GNAP ||||
403433
| Session resumability | ✅ STATE.md ||||
404434
| Token optimization rules | ✅ explicit ||| ✅ partial |
435+
| Cursor `/graphstack` slash bootstrap |||||
405436
| Setup complexity | Low | Low | High | Low |
406437

407438
---
408439

409440
## Resuming a Session
410441

442+
Default (Cursor Composer with GraphStack repo open): reopen chat and paste a short cue such as `"Resume GraphStack STATE.md"` or select `/graphstack` followed by `"Resume"` — Activation still runs tokens + graph loaders automatically.
443+
444+
Classic explicit prompt:
445+
411446
```
412447
Read orchestrator/ORCHESTRATOR.md and follow it exactly.
413448
Resume from last session.
@@ -419,21 +454,23 @@ Orchestrator reads `handoff/STATE.md` and `handoff/board/doing/` and picks up ex
419454

420455
## All Prompts
421456

422-
### Standard session
457+
**Quick path:** describe work directly (rules + optional `/graphstack`). Legacy blocks remain for deterministic copy/paste workflows or non‑Cursor tooling.
458+
459+
### Standard session *(legacy explicit)*
423460
```
424461
Read orchestrator/ORCHESTRATOR.md and follow it exactly.
425462
[What you want to build or fix — any language]
426463
```
427464

428-
### New project from scratch
465+
### New project from scratch *(legacy explicit)*
429466
```
430467
Read orchestrator/ORCHESTRATOR.md and follow it exactly.
431468
This is a new project with no existing codebase.
432469
I want to build [describe your idea].
433470
Tech stack: [language, framework, database].
434471
```
435472

436-
### Resume a previous session
473+
### Resume a previous session *(legacy explicit)*
437474
```
438475
Read orchestrator/ORCHESTRATOR.md and follow it exactly.
439476
Resume from last session.

docs/CURSOR_PROMPTS.md

Lines changed: 45 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Bu komut şunları yapar:
3232
- `orchestrator/` → Orchestrator ve Token Optimizer
3333
- `handoff/` + `scripts/` → board ve state dosyaları
3434
- `scripts/graphstack/` → Python helper paketi (bash ve PowerShell shim'leri buna delege eder)
35+
- `.cursor/commands/graphstack.md` → Slash menüsünde `/graphstack` komutu
3536

3637
### Adım 2 — Graphify'ı yükle ve grafiği oluştur
3738

@@ -51,60 +52,79 @@ Büyük projelerde 1-2 dakika sürebilir, sonrası anında.
5152

5253
### Adım 3 — Başla
5354

54-
Yeni bir Cursor chat'i aç ve aşağıdaki promptlardan birini kullan.
55+
**Önerilen (en az sürtünme):** Cursor'da projeyle birlikte yeni Composer/Agent aç —
56+
`graphstack.mdc` `alwaysApply: true` olduğu için Kurallar zaten yüklü. Direkt olarak
57+
hedefini yaz (**Türkçe veya İngilizce**). Asistanın ilk işi olarak yine Orchestrator Activation
58+
(okuma + TOKEN_OPTIMIZER + graf) çalıştırması gerekir; senin her seferinde
59+
`Read orchestrator/...` kopyalamana gerek yok.
5560

56-
> **Not:** `.cursor/rules/graphstack.mdc` dosyası Cursor tarafından otomatik yüklenir.
57-
> Kurallar her chat'te aktif — ek bir şey yapman gerekmiyor.
61+
**Slash komutu (istersen daha net başlatmak için):** Sohbete `/` yaz → **`graphstack`**
62+
dosyası `.cursor/commands/graphstack.md` içeriğini enjekte eder (`/graphstack` çıkmıyorsa
63+
Cursor'ı yeniden başlat).
5864

59-
---
60-
61-
## ⚡ Normal Kullanım — Tek Prompt
65+
**İsteğe bağlı klasik satır *(başka editör ya da garanti için):*** aşağıdaki blok hâlen geçerlidir.
6266

6367
```
6468
Read orchestrator/ORCHESTRATOR.md and follow it exactly.
65-
[Ne yapmak istediğini buraya yaz — Türkçe veya İngilizce]
69+
[Hedefini yaz]
6670
```
6771

68-
**Örnekler:**
72+
> **Not:** `.cursor/rules/graphstack.mdc` her oturumda otomatik yüklenir; bu satır fazladan garanti için.
73+
74+
---
75+
76+
## ⚡ Örnek hedef yazıları (klasik bloğu atlarsan bile)
77+
78+
Orchestrator yine graf + handoff yüklemesini yapmak zorunda; senden sadece amaç gerek:
79+
6980
```
70-
Read orchestrator/ORCHESTRATOR.md and follow it exactly.
71-
Add email verification to the registration flow.
81+
Kayıtta e-posta doğrulaması eklemek istiyorum.
7282
```
7383
```
74-
Read orchestrator/ORCHESTRATOR.md and follow it exactly.
75-
Login endpoint çok yavaş, performans sorununu bul ve düzelt.
84+
Login endpoint çok yavaş — performansı bul ve düzelt.
85+
```
86+
```
87+
Resume from last session.
7688
```
7789

78-
Orchestrator Architect → Builder → Reviewer → QA → Ship döngüsünü otomatik yönetir.
90+
Architect → Builder → Reviewer → QA → Ship zinciri kullanıcı etkileşimi olmadan yürür.
7991

8092
---
8193

8294
## 🚀 Sıfırdan Yeni Proje (Bootstrap Modu)
8395

84-
Henüz hiç kod yoksa:
96+
Henüz kod yoksa **sırf hedef yazman yeter**: `alwaysApply` kuralları etkin.
97+
İstersen garanti olarak `/graphstack` komutunun ardından açıklamayı yaz.
8598

8699
```
87-
Read orchestrator/ORCHESTRATOR.md and follow it exactly.
88-
This is a new project with no existing codebase.
89-
[Projeyi tanımla: ne yapıyor, kime yönelik, hangi teknoloji]
100+
Boş bir repo için REST API yazıyorum: kullanıcılar proje oluşturup görev atayabilecek.
101+
TypeScript + Node + Express + PostgreSQL istiyorum. İlk fazda önce authentication.
90102
```
91103

92-
**Örnek:**
104+
**Klasik tam blok (yedek)**
105+
93106
```
94107
Read orchestrator/ORCHESTRATOR.md and follow it exactly.
95-
This is a new project. I want to build a REST API for task management.
96-
Users can create projects, add tasks, assign them, track progress.
97-
Tech stack: TypeScript, Node.js, Express, PostgreSQL.
108+
This is a new project with no existing codebase.
109+
[Projeyi tanımla: amaç, kullanıcı, teknoloji]
98110
```
99111

100112
Bootstrapper tüm modülleri planlar, bağımlılık sırasını belirler,
101-
her döngü için brief yazar. Her döngü sonrası grafı gerçek koddan günceller.
113+
her döngü için brief yazar; her döngü sonunda güncellenmiş graf gerekli.
102114

103115
---
104116

105117
## 🔄 Oturum Devam Ettirme
106118

107-
Cursor'ı kapatıp yeniden açtıysan:
119+
Cursor'ı yeniden açtıktan sonra sadece:
120+
121+
```
122+
Önceki GraphStack oturumundan devam et.
123+
STATE.md ile board'daki yapılacaklara uy.
124+
```
125+
126+
Gerekli güvence için hâlen şu blok kullanılabilir:
127+
108128
```
109129
Read orchestrator/ORCHESTRATOR.md and follow it exactly.
110130
Resume from last session.
@@ -187,7 +207,8 @@ python -m graphstack board log
187207

188208
## 💡 İpuçları
189209

190-
- Her Orchestrator döngüsü için **yeni bir Cursor chat** aç — context temiz kalır
210+
- Her Orchestrator döngüsünde mümkünse **yeni bir Cursor chat** aç — context temiz kalır
211+
- Cursor slash menüsünde **`/graphstack`** kullanarak Orchestrator açılışını netleştir
191212
- `.cursor/rules/graphstack.mdc` otomatik yüklenir, elle okutman gerekmiyor
192213
- Grafı büyük değişikliklerden sonra güncelle: `/graphify --update`
193214
- `handoff/STATE.md` dosyasını silme — oturum geçmişin orada

graphify-out/.graphify_root

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
C:\Users\elife\Desktop\Mert_Proje\graphstack

0 commit comments

Comments
 (0)