MertCapkin-GraphStack 4.5.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- graphstack/__init__.py +12 -0
- graphstack/__main__.py +10 -0
- graphstack/assets/docs/CURSOR_PROMPTS.md +215 -0
- graphstack/assets/handoff/BOOTSTRAP.md +73 -0
- graphstack/assets/handoff/BRIEF.md +66 -0
- graphstack/assets/handoff/REVIEW.md +7 -0
- graphstack/assets/handoff/board/README.md +60 -0
- graphstack/assets/orchestrator/ORCHESTRATOR.md +416 -0
- graphstack/assets/orchestrator/TOKEN_OPTIMIZER.md +319 -0
- graphstack/assets/scripts/board.ps1 +37 -0
- graphstack/assets/scripts/board.sh +22 -0
- graphstack/assets/scripts/gate-hook.ps1 +41 -0
- graphstack/assets/scripts/gate-hook.sh +26 -0
- graphstack/assets/scripts/post-commit +20 -0
- graphstack/assets/scripts/post-commit.ps1 +44 -0
- graphstack/board.py +361 -0
- graphstack/bootstrap.py +50 -0
- graphstack/cli.py +99 -0
- graphstack/compact/__init__.py +9 -0
- graphstack/compact/__pycache__/__init__.cpython-311.pyc +0 -0
- graphstack/compact/__pycache__/base.cpython-311.pyc +0 -0
- graphstack/compact/__pycache__/generic.cpython-311.pyc +0 -0
- graphstack/compact/__pycache__/git.cpython-311.pyc +0 -0
- graphstack/compact/__pycache__/registry.cpython-311.pyc +0 -0
- graphstack/compact/base.py +115 -0
- graphstack/compact/generic.py +90 -0
- graphstack/compact/git.py +167 -0
- graphstack/compact/registry.py +47 -0
- graphstack/constants.py +38 -0
- graphstack/gate.py +429 -0
- graphstack/graph.py +143 -0
- graphstack/hook.py +144 -0
- graphstack/init_cmd.py +113 -0
- graphstack/installer.py +366 -0
- graphstack/platform_utils.py +127 -0
- graphstack/run.py +103 -0
- graphstack/state.py +117 -0
- graphstack/tests/__init__.py +0 -0
- graphstack/tests/conftest.py +30 -0
- graphstack/tests/test_assets.py +35 -0
- graphstack/tests/test_board.py +166 -0
- graphstack/tests/test_compact.py +93 -0
- graphstack/tests/test_gate.py +406 -0
- graphstack/tests/test_graph.py +60 -0
- graphstack/tests/test_hook.py +57 -0
- graphstack/tests/test_init.py +58 -0
- graphstack/tests/test_installer.py +73 -0
- graphstack/tests/test_platform_utils.py +69 -0
- graphstack/tests/test_state.py +56 -0
- graphstack/tests/test_validate.py +204 -0
- graphstack/validate.py +469 -0
- mertcapkin_graphstack-4.5.1.dist-info/METADATA +720 -0
- mertcapkin_graphstack-4.5.1.dist-info/RECORD +57 -0
- mertcapkin_graphstack-4.5.1.dist-info/WHEEL +5 -0
- mertcapkin_graphstack-4.5.1.dist-info/entry_points.txt +2 -0
- mertcapkin_graphstack-4.5.1.dist-info/licenses/LICENSE +21 -0
- mertcapkin_graphstack-4.5.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,720 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: MertCapkin_GraphStack
|
|
3
|
+
Version: 4.5.1
|
|
4
|
+
Summary: Graph-first AI development workflow β board, gate, graph queries, one-shot init
|
|
5
|
+
Author: GraphStack contributors
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/MertCapkin/GraphStack
|
|
8
|
+
Project-URL: Repository, https://github.com/MertCapkin/GraphStack
|
|
9
|
+
Project-URL: Documentation, https://github.com/MertCapkin/GraphStack#readme
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/MertCapkin/GraphStack/issues
|
|
11
|
+
Keywords: graphstack,cursor,graphify,ai,workflow,agent
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
23
|
+
Requires-Python: >=3.8
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Provides-Extra: graphify
|
|
27
|
+
Requires-Dist: graphifyy<0.9,>=0.7; extra == "graphify"
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
<div align="center">
|
|
31
|
+
|
|
32
|
+
# GraphStack π§ β‘
|
|
33
|
+
|
|
34
|
+
**Graph-first, automatically orchestrated AI development workflow.**
|
|
35
|
+
One prompt starts the entire lifecycle β from blank repo to production.
|
|
36
|
+
|
|
37
|
+
[](https://github.com/MertCapkin/graphstack/actions)
|
|
38
|
+
[](LICENSE)
|
|
39
|
+
[](CHANGELOG.md)
|
|
40
|
+
[](#compatibility)
|
|
41
|
+
[](https://cursor.sh)
|
|
42
|
+
[](https://claude.ai/code)
|
|
43
|
+
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
> **v4.5 highlights:** One-command bootstrap (`bootstrap.ps1` / `bootstrap.sh`), PyPI-ready packaging, `board reopen` / `list-done`. Plus v4.4 `graph query` + `init`, v4.3 gate. See [CHANGELOG.md](CHANGELOG.md).
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## One command (Cursor terminal)
|
|
51
|
+
|
|
52
|
+
Open your **project folder** in Cursor, open the integrated terminal, and run:
|
|
53
|
+
|
|
54
|
+
**Windows (PowerShell):**
|
|
55
|
+
```powershell
|
|
56
|
+
irm https://raw.githubusercontent.com/MertCapkin/GraphStack/main/scripts/bootstrap.ps1 | iex
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**macOS / Linux:**
|
|
60
|
+
```bash
|
|
61
|
+
curl -fsSL https://raw.githubusercontent.com/MertCapkin/GraphStack/main/scripts/bootstrap.sh | bash
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**After [PyPI publish](docs/PYPI.md):**
|
|
65
|
+
|
|
66
|
+
> PyPI package name is **`MertCapkin_GraphStack`** (`graphstack` was already taken). The CLI command is still `graphstack`.
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pip install "MertCapkin_GraphStack[graphify]" && graphstack init . -y --install-deps
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
This installs GraphStack + Graphify, copies workflow files into **the current project**, refreshes the code graph, and runs `doctor`. Then describe your task in Cursor chat β rules load automatically.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Quick Start
|
|
77
|
+
|
|
78
|
+
### Step 1 β Install prerequisites
|
|
79
|
+
|
|
80
|
+
**Python 3.8+** and **Git** are required. Check if you have them:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
py -3 --version # need 3.8 or higher
|
|
84
|
+
git --version # any recent version is fine
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Install Graphify** β the knowledge graph engine GraphStack is built on. The version range is pinned in [`requirements.txt`](requirements.txt):
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
pip install -r requirements.txt
|
|
91
|
+
# or, equivalently, install Graphify directly with the same pin:
|
|
92
|
+
pip install "graphifyy>=0.7,<0.9"
|
|
93
|
+
|
|
94
|
+
# Optional: install GraphStack CLI from a clone (board / validate / doctor / run)
|
|
95
|
+
pip install -e /path/to/graphstack
|
|
96
|
+
# or with Graphify in one step:
|
|
97
|
+
pip install -e "/path/to/graphstack[graphify]"
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
After installation, register the Cursor slash command (one-time):
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
graphify cursor install
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Verify it worked:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
pip show graphifyy
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
If `graphify` is not found after install, try:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
pip install --user "graphifyy>=0.7,<0.9"
|
|
116
|
+
# then add ~/.local/bin to your PATH, or use:
|
|
117
|
+
python3 -m graphify --version
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
> Graphify runs **entirely locally** β no API calls, no data sent anywhere.
|
|
121
|
+
> It uses tree-sitter to parse your code and builds the graph on your machine.
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
### Step 2 β Install GraphStack into your project
|
|
126
|
+
|
|
127
|
+
GraphStack now works natively on Windows, macOS, and Linux. The installer runs through Python (which you already have for Graphify), so no shell-specific tooling is required.
|
|
128
|
+
|
|
129
|
+
#### One command (recommended)
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
git clone https://github.com/MertCapkin/graphstack /path/to/graphstack
|
|
133
|
+
cd /path/to/your-project
|
|
134
|
+
/path/to/graphstack/install.ps1 . # Windows
|
|
135
|
+
# or: python -m graphstack init . -y # any OS β install + graph refresh + doctor
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
#### macOS / Linux (bash / zsh)
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
git clone https://github.com/MertCapkin/graphstack /tmp/graphstack
|
|
142
|
+
cd /path/to/your-project
|
|
143
|
+
bash /tmp/graphstack/install.sh
|
|
144
|
+
# or, equivalently:
|
|
145
|
+
# python3 -m graphstack install . --no-interactive
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
#### Windows (PowerShell β native, no Git Bash needed)
|
|
149
|
+
|
|
150
|
+
```powershell
|
|
151
|
+
git clone https://github.com/MertCapkin/graphstack $env:TEMP\graphstack
|
|
152
|
+
cd C:\path\to\your-project
|
|
153
|
+
& $env:TEMP\graphstack\install.ps1 .
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
If `python.exe` on Windows redirects you to the Microsoft Store, the installer detects that and falls back to the official `py -3` launcher automatically.
|
|
157
|
+
|
|
158
|
+
#### Any platform (Python, no shell preference)
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
git clone https://github.com/MertCapkin/graphstack /path/to/graphstack
|
|
162
|
+
cd /path/to/your-project
|
|
163
|
+
python -m graphstack install . --non-interactive
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
This copies all GraphStack files into your project:
|
|
167
|
+
- `.cursor/rules/graphstack.mdc` β Cursor loads this automatically on every session
|
|
168
|
+
- `orchestrator/`, `.cursor/skills/`, `handoff/`, `scripts/` β the full workflow system
|
|
169
|
+
- `scripts/graphstack/` β the Python helper package (used by both the bash and PowerShell shims)
|
|
170
|
+
|
|
171
|
+
The install script is non-destructive: it won't overwrite existing `handoff/BRIEF.md`, `handoff/REVIEW.md`, or `handoff/BOOTSTRAP.md` if they already exist.
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
### Step 3 β Build the knowledge graph
|
|
176
|
+
|
|
177
|
+
Open your project in Cursor. In the chat, type:
|
|
178
|
+
|
|
179
|
+
```
|
|
180
|
+
/graphify .
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
What happens:
|
|
184
|
+
- Graphify scans all source files (25 languages supported)
|
|
185
|
+
- Builds a dependency graph using tree-sitter (local, no API)
|
|
186
|
+
- Creates three files in `graphify-out/`:
|
|
187
|
+
- `GRAPH_REPORT.md` β human-readable architecture summary
|
|
188
|
+
- `graph.json` β machine-queryable full graph
|
|
189
|
+
- `graph.html` β visual explorer, open in browser
|
|
190
|
+
|
|
191
|
+
**How long does it take?**
|
|
192
|
+
|
|
193
|
+
| Codebase size | Time |
|
|
194
|
+
|---|---|
|
|
195
|
+
| < 50 files | ~5 seconds |
|
|
196
|
+
| 50β200 files | ~15β30 seconds |
|
|
197
|
+
| 200β500 files | ~1β2 minutes |
|
|
198
|
+
| 500+ files | ~3β5 minutes |
|
|
199
|
+
|
|
200
|
+
Run this once. After that, use `/graphify --update` β it only re-scans changed files and takes a few seconds.
|
|
201
|
+
|
|
202
|
+
**New project with no code yet?** Skip this step β GraphStack's Bootstrap Mode handles it. Just go to Step 4.
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
### Step 4 β Start working
|
|
207
|
+
|
|
208
|
+
The repo ships two ways to bootstrap the orchestrator β pick whichever feels natural.
|
|
209
|
+
|
|
210
|
+
#### A) Easiest β new chat only (recommended)
|
|
211
|
+
|
|
212
|
+
Because `.cursor/rules/graphstack.mdc` is **`alwaysApply: true`**, every new Composer / Agent
|
|
213
|
+
session already carries GraphStackβs binding rules. Simply open chat and describe your goal in
|
|
214
|
+
natural language (`Add β¦`, `Fix β¦`). The assistantβs first turn must still **execute**
|
|
215
|
+
`orchestrator/ORCHESTRATOR.md β Activation** (parallel `TOKEN_OPTIMIZER` + `GRAPH_REPORT`),
|
|
216
|
+
but **you donβt paste** `Read orchestrator/...` anymore.
|
|
217
|
+
|
|
218
|
+
#### B) Slash command `/graphstack` (explicit nudge)
|
|
219
|
+
|
|
220
|
+
In Cursor Chat/Composer press `/` β choose **`graphstack`**. That injects the Bootstrap command
|
|
221
|
+
stored in `.cursor/commands/graphstack.md` (helps when you want deterministic orchestrator wording
|
|
222
|
+
or onboarding teammates).
|
|
223
|
+
|
|
224
|
+
*If `/graphstack` doesn't appear immediately, restart Cursor once so it rescans `.cursor/commands/`.*
|
|
225
|
+
|
|
226
|
+
#### C) Classic explicit prompt (fallback / other tools)
|
|
227
|
+
|
|
228
|
+
**Existing codebase:**
|
|
229
|
+
|
|
230
|
+
```
|
|
231
|
+
Read orchestrator/ORCHESTRATOR.md and follow it exactly.
|
|
232
|
+
[Describe what you want to build or fix]
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
**New project from scratch:**
|
|
236
|
+
|
|
237
|
+
```
|
|
238
|
+
Read orchestrator/ORCHESTRATOR.md and follow it exactly.
|
|
239
|
+
This is a new project with no existing codebase.
|
|
240
|
+
I want to build [describe your idea].
|
|
241
|
+
Tech stack: [language, framework, database].
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
GraphStack handles everything from here β planning, building, reviewing, testing, shipping.
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## What Is GraphStack?
|
|
249
|
+
|
|
250
|
+
GraphStack combines two ideas into one installable system:
|
|
251
|
+
|
|
252
|
+
**[Graphify](https://github.com/safishamsi/graphify)** builds a queryable knowledge graph of your codebase. Every AI query navigates that compact map instead of re-reading raw files from scratch.
|
|
253
|
+
|
|
254
|
+
**Role-based orchestration** drives a structured lifecycle: Bootstrapper β Architect β Builder β Reviewer β QA β Ship. A central Orchestrator manages all transitions automatically. You never switch roles manually.
|
|
255
|
+
|
|
256
|
+
> You write one prompt. GraphStack runs the full cycle.
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## The Problem
|
|
261
|
+
|
|
262
|
+
Without GraphStack, every AI coding session looks like this:
|
|
263
|
+
|
|
264
|
+
```
|
|
265
|
+
You: "Add rate limiting to login."
|
|
266
|
+
AI: reads login.ts... reads session.ts... reads crypto.ts... reads types.ts...
|
|
267
|
+
(4 files, ~3 000 tokens β before writing a single line)
|
|
268
|
+
|
|
269
|
+
You: "Now add tests."
|
|
270
|
+
AI: reads login.ts again... reads session.ts again...
|
|
271
|
+
(same files, same cost, zero memory)
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
Problems:
|
|
275
|
+
- **Token waste** β AI re-reads your codebase on every query
|
|
276
|
+
- **No structure** β planning, coding, reviewing blur together
|
|
277
|
+
- **No memory** β closing Cursor means starting from zero
|
|
278
|
+
- **No audit trail** β impossible to know what was decided and why
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## The Solution
|
|
283
|
+
|
|
284
|
+
```
|
|
285
|
+
Step 1 β once:
|
|
286
|
+
/graphify . β graphify-out/GRAPH_REPORT.md + graph.json
|
|
287
|
+
|
|
288
|
+
Step 2 β every session (minimal typing):
|
|
289
|
+
Open Composer + describe the task (rules already activate GraphStack automatically),
|
|
290
|
+
optionally type `/graphstack` once for an explicit orchestrator preamble,
|
|
291
|
+
or paste the legacy `Read orchestrator/ORCHESTRATOR.md β¦` snippet if working outside Cursor.
|
|
292
|
+
|
|
293
|
+
Example natural-language kickoff:
|
|
294
|
+
"Add rate limiting to login."
|
|
295
|
+
|
|
296
|
+
[ARCHITECT] reads graph (not raw files) β scopes change β writes BRIEF.md
|
|
297
|
+
β auto
|
|
298
|
+
[BUILDER] reads brief β queries graph for deps β builds exactly the brief
|
|
299
|
+
β auto
|
|
300
|
+
[REVIEWER] checks criteria β inspects graph neighbors for side effects
|
|
301
|
+
β auto (loops to Builder if rejected, max 3Γ)
|
|
302
|
+
[QA] traces call path through graph β verifies behavior
|
|
303
|
+
β auto
|
|
304
|
+
[SHIP] checklist β graph update β commit message β closes board task
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
**Zero manual role switching. Zero repeated file reads. Full git audit trail.**
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## Bootstrap Mode β Start from Zero
|
|
312
|
+
|
|
313
|
+
No code yet? GraphStack handles that too.
|
|
314
|
+
|
|
315
|
+
```
|
|
316
|
+
Composer (Cursor):
|
|
317
|
+
Describe the product + tech stack naturally (alwaysApply rules bootstrap GraphStack),
|
|
318
|
+
optionally `/graphstack` beforehand to inject the scripted opener.
|
|
319
|
+
|
|
320
|
+
Bootstrap example:
|
|
321
|
+
"/graphstack then: New project REST API for task mgmt β TS, Express, PostgreSQL."
|
|
322
|
+
|
|
323
|
+
[BOOTSTRAPPER] analyzes idea β decomposes into modules β orders by dependency
|
|
324
|
+
β writes BOOTSTRAP.md (the memory across all cycles)
|
|
325
|
+
β writes Cycle 1 brief
|
|
326
|
+
β auto
|
|
327
|
+
[BUILDER β REVIEWER β QA β SHIP] Cycle 1 (auth module)
|
|
328
|
+
β
|
|
329
|
+
run /graphify . β first graph from real code
|
|
330
|
+
β
|
|
331
|
+
[BOOTSTRAPPER] reads new graph β writes Cycle 2 brief with real knowledge
|
|
332
|
+
β auto
|
|
333
|
+
[BUILDER β REVIEWER β QA β SHIP] Cycle 2 (data models)
|
|
334
|
+
β
|
|
335
|
+
run /graphify --update β next cycle β ...
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
Each brief is written with knowledge of what was **actually built** β not just planned. The graph grows with the project.
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
## Token Savings
|
|
343
|
+
|
|
344
|
+
GraphStack's savings come from three mechanisms:
|
|
345
|
+
|
|
346
|
+
| Mechanism | How | Savings |
|
|
347
|
+
|-----------|-----|---------|
|
|
348
|
+
| Graph-first reads | GRAPH_REPORT.md replaces browsing 10+ files | ~85% on architecture queries |
|
|
349
|
+
| Role discipline | Each role reads only what its job requires | ~60% vs unstructured sessions |
|
|
350
|
+
| File-based state | STATE.md replaces chat history on resume | ~60% per new session |
|
|
351
|
+
| Parallel reads | Multiple files in one tool call | ~50% on multi-file ops |
|
|
352
|
+
| Shell compaction | `graphstack run` shrinks git/test output before it hits context | ~60β80% on verbose shell ops |
|
|
353
|
+
|
|
354
|
+
**Net savings by codebase size:**
|
|
355
|
+
|
|
356
|
+
| Codebase | Tokens/day without | Tokens/day with | Saving |
|
|
357
|
+
|----------|--------------------|-----------------|--------|
|
|
358
|
+
| Small (10β20 files) | ~40k | ~28k | **~30%** |
|
|
359
|
+
| Medium (50β100 files) | ~180k | ~54k | **~70%** |
|
|
360
|
+
| Large (200+ files) | ~600k | ~90k | **~85%** |
|
|
361
|
+
| Very large (500+ files) | ~1.5M | ~180k | **~88%** |
|
|
362
|
+
|
|
363
|
+
*Estimates based on Graphify benchmarks and TOKEN_OPTIMIZER rules. Real savings depend on query patterns. See [docs/case-studies/graphstack-self.md](docs/case-studies/graphstack-self.md) for an honest self-analysis β measured community benchmarks are welcome via PR.*
|
|
364
|
+
|
|
365
|
+
---
|
|
366
|
+
|
|
367
|
+
## Limitations (read before adopting)
|
|
368
|
+
|
|
369
|
+
GraphStack is a **workflow protocol** (markdown + handoff files), not a runtime that enforces AI behavior.
|
|
370
|
+
|
|
371
|
+
| Topic | Reality |
|
|
372
|
+
|-------|---------|
|
|
373
|
+
| Role automation | Prompts alone cannot guarantee discipline. v4.3+ **`graphstack gate`** + v4.4 Cursor **`preToolUse`**. Hooks block commits and (on Cursor/Claude) code writes without a claimed task; `afterFileEdit` on Cursor remains advisory-only backup. |
|
|
374
|
+
| Token savings | The table above is **estimated**, not guaranteed. Small repos or undisciplined sessions may use **more** tokens than unstructured chat. |
|
|
375
|
+
| Knowledge graph | Value appears on **20+ file** codebases with module boundaries. Meta-repos full of markdown produce noisy graphs β use `.graphifyignore` (included in this repo). |
|
|
376
|
+
| Setup | Graphify + GraphStack install + `/graphify` + Cursor β four steps, not zero-config. |
|
|
377
|
+
|
|
378
|
+
**v4.1 helpers:** `graphstack doctor` (health report) and `graphstack validate` (exit code for CI). Use `--strict` before Builder handoff; use `--fail-stale-graph` in CI after code changes.
|
|
379
|
+
|
|
380
|
+
```bash
|
|
381
|
+
graphstack doctor
|
|
382
|
+
graphstack validate
|
|
383
|
+
graphstack validate --strict --fail-stale-graph
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
---
|
|
387
|
+
|
|
388
|
+
## Shell Output Compaction (`graphstack run`)
|
|
389
|
+
|
|
390
|
+
Graph-first rules reduce **file reads**. Shell compaction reduces **terminal output** (git status, diffs, test runners) before it enters the AI context β without installing third-party proxies.
|
|
391
|
+
|
|
392
|
+
**Who uses it:** Cursor/Claude agents follow `TOKEN_OPTIMIZER.md` and `.cursor/rules/graphstack.mdc` β they call `graphstack run`, not raw `git`/`pytest`. You do not need to remember a separate workflow.
|
|
393
|
+
|
|
394
|
+
```bash
|
|
395
|
+
python -m graphstack run -- git status
|
|
396
|
+
python -m graphstack run -- git diff
|
|
397
|
+
python -m graphstack run -- git log -n 20
|
|
398
|
+
python -m graphstack run -- pytest -q
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
**Quality safeguards (not βblind compressionβ):**
|
|
402
|
+
|
|
403
|
+
- File paths, branch names, diff hunks (`@@`), and `+`/`-` lines are preserved
|
|
404
|
+
- Test failures, tracebacks, and stderr are kept (stderr is never compacted)
|
|
405
|
+
- If compaction would drop too much signal, output **falls back to raw** automatically
|
|
406
|
+
- Full output when debugging: `python -m graphstack run --raw -- git diff`
|
|
407
|
+
|
|
408
|
+
Independent Python implementation (MIT) β inspired by common agent-tooling patterns, no RTK dependency or vendored code.
|
|
409
|
+
|
|
410
|
+
`graphstack doctor` reports whether the compact module is installed in your project.
|
|
411
|
+
|
|
412
|
+
---
|
|
413
|
+
|
|
414
|
+
## Graph Queries (`graphstack graph`)
|
|
415
|
+
|
|
416
|
+
Graph-first rules mean **query the graph before opening raw files**. v4.4 wraps Graphify's CLI so agents use one consistent command:
|
|
417
|
+
|
|
418
|
+
```bash
|
|
419
|
+
python -m graphstack graph query "who calls login"
|
|
420
|
+
python -m graphstack graph query "blast radius of crypto.ts" --budget 1500
|
|
421
|
+
python -m graphstack graph path src/auth/login.ts src/utils/crypto.ts
|
|
422
|
+
python -m graphstack graph explain "login()"
|
|
423
|
+
python -m graphstack graph update . # AST-only refresh after code changes
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
Requires `graphify` on PATH (`pip install -r requirements.txt`). Agents should prefer `graph query` over reading full `GRAPH_REPORT.md` or grepping source for structural questions.
|
|
427
|
+
|
|
428
|
+
---
|
|
429
|
+
|
|
430
|
+
## Process Gate (`graphstack gate`)
|
|
431
|
+
|
|
432
|
+
v4.3+ adds **mechanical enforcement** so Architect β Builder β Reviewer steps are harder to skip silently. v4.4 extends Cursor with `preToolUse` blocking.
|
|
433
|
+
|
|
434
|
+
| Rule | What it blocks | Cursor | Claude Code |
|
|
435
|
+
|------|----------------|--------|-------------|
|
|
436
|
+
| R1 | `git commit` touching code while `doing/` is empty | deny (`beforeShellExecution` + `preToolUse` Shell) | deny (`PreToolUse` Bash) |
|
|
437
|
+
| R2 | Edit/Write on code paths while `doing/` is empty | deny (`preToolUse` Write/Edit) | deny (`PreToolUse` Edit/Write) |
|
|
438
|
+
| R3 | Commit while `BRIEF.md` is still the template | deny | deny |
|
|
439
|
+
| R4 | `STATE.json` not updated this cycle | advisory (`stop`) | advisory (`Stop`) |
|
|
440
|
+
| β | Edit already applied (legacy hook) | advisory only (`afterFileEdit`) | β |
|
|
441
|
+
|
|
442
|
+
```bash
|
|
443
|
+
python -m graphstack gate check # CI / manual β exit 1 on violation
|
|
444
|
+
python -m graphstack state set --role builder --task my-feature
|
|
445
|
+
GRAPHSTACK_GATE=off # emergency bypass (one session)
|
|
446
|
+
GRAPHSTACK_GATE=strict # fail-closed on hook internal errors
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
**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.
|
|
450
|
+
|
|
451
|
+
> **Framework repo note:** This GitHub repo ships `handoff/` as **templates** (empty brief, no `done/` tasks). Your installed project fills those files during real work. Before contributing here, reset handoff β see [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
452
|
+
|
|
453
|
+
---
|
|
454
|
+
|
|
455
|
+
## What Gets Installed
|
|
456
|
+
|
|
457
|
+
```
|
|
458
|
+
your-project/
|
|
459
|
+
βββ .cursor/rules/graphstack.mdc β always-active rules (Cursor auto-loads)
|
|
460
|
+
βββ .cursor/commands/graphstack.md β `/graphstack` Cursor slash-command bootstrapper
|
|
461
|
+
βββ orchestrator/
|
|
462
|
+
β βββ ORCHESTRATOR.md β state machine: all transitions
|
|
463
|
+
β βββ TOKEN_OPTIMIZER.md β token budget rules for all roles
|
|
464
|
+
βββ .cursor/skills/
|
|
465
|
+
β βββ bootstrapper/BOOTSTRAPPER.md β new project β module plan β cycles
|
|
466
|
+
β βββ architect/ARCHITECT.md β scopes features, writes briefs
|
|
467
|
+
β βββ builder/BUILDER.md β implements exactly the brief
|
|
468
|
+
β βββ reviewer/REVIEWER.md β checks criteria + graph side effects
|
|
469
|
+
β βββ qa/QA.md β traces call paths, verifies behavior
|
|
470
|
+
β βββ ship/SHIP.md β checklist + graph update + commit msg
|
|
471
|
+
βββ handoff/
|
|
472
|
+
β βββ BRIEF.md β Architect β Builder
|
|
473
|
+
β βββ REVIEW.md β Reviewer + QA findings (append-only)
|
|
474
|
+
β βββ STATE.md β session state for resuming
|
|
475
|
+
β βββ BOOTSTRAP.md β cross-cycle project memory
|
|
476
|
+
β βββ board/
|
|
477
|
+
β βββ todo/ β tasks waiting to be claimed
|
|
478
|
+
β βββ doing/ β tasks in progress
|
|
479
|
+
β βββ done/ β completed tasks (audit trail)
|
|
480
|
+
βββ graphify-out/ β generated by graphify (commit this)
|
|
481
|
+
β βββ GRAPH_REPORT.md
|
|
482
|
+
β βββ graph.json
|
|
483
|
+
β βββ graph.html
|
|
484
|
+
βββ scripts/
|
|
485
|
+
β βββ board.sh β GNAP board shim (bash)
|
|
486
|
+
β βββ board.ps1 β GNAP board shim (PowerShell)
|
|
487
|
+
β βββ post-commit β smart graph-update hook (bash)
|
|
488
|
+
β βββ post-commit.ps1 β smart graph-update hook (PowerShell)
|
|
489
|
+
β βββ graphstack/ β Python core (single source of truth)
|
|
490
|
+
β βββ board.py β GNAP board logic
|
|
491
|
+
β βββ installer.py β project installer logic
|
|
492
|
+
β βββ hook.py β post-commit graph-update logic
|
|
493
|
+
β βββ platform_utils.py β OS detection, Python finder, encoding-safe echo
|
|
494
|
+
β βββ cli.py β entry point dispatcher
|
|
495
|
+
β βββ validate.py β layout / brief / graph checks
|
|
496
|
+
β βββ run.py β shell runner with compaction
|
|
497
|
+
β βββ compact/ β git / pytest / generic compactors
|
|
498
|
+
β βββ tests/ β pytest suite
|
|
499
|
+
βββ pyproject.toml β pip install -e . (v4.1+)
|
|
500
|
+
βββ .graphifyignore β code-focused graph for this repo
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
---
|
|
504
|
+
|
|
505
|
+
## The GNAP Board
|
|
506
|
+
|
|
507
|
+
GraphStack uses Git-Native Agent Protocol for task tracking β no server, no database, just files and git commits.
|
|
508
|
+
|
|
509
|
+
All three forms below are equivalent. Pick whichever fits your shell.
|
|
510
|
+
|
|
511
|
+
#### macOS / Linux (bash)
|
|
512
|
+
|
|
513
|
+
```bash
|
|
514
|
+
bash scripts/board.sh status
|
|
515
|
+
bash scripts/board.sh new add-oauth Add OAuth login with GitHub
|
|
516
|
+
bash scripts/board.sh claim add-oauth builder
|
|
517
|
+
bash scripts/board.sh complete add-oauth
|
|
518
|
+
bash scripts/board.sh log
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
#### Windows (PowerShell)
|
|
522
|
+
|
|
523
|
+
```powershell
|
|
524
|
+
.\scripts\board.ps1 status
|
|
525
|
+
.\scripts\board.ps1 new add-oauth Add OAuth login with GitHub
|
|
526
|
+
.\scripts\board.ps1 claim add-oauth builder
|
|
527
|
+
.\scripts\board.ps1 complete add-oauth
|
|
528
|
+
.\scripts\board.ps1 log
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
#### Cross-platform (any shell with Python)
|
|
532
|
+
|
|
533
|
+
```bash
|
|
534
|
+
python -m graphstack board status
|
|
535
|
+
python -m graphstack board new add-oauth Add OAuth login with GitHub
|
|
536
|
+
python -m graphstack board claim add-oauth builder
|
|
537
|
+
python -m graphstack board complete add-oauth
|
|
538
|
+
python -m graphstack board log
|
|
539
|
+
python -m graphstack run -- git status
|
|
540
|
+
python -m graphstack doctor
|
|
541
|
+
python -m graphstack validate --fail-stale-graph
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
Every board operation is a git commit. `git log handoff/board/` shows who did what, when.
|
|
545
|
+
|
|
546
|
+
---
|
|
547
|
+
|
|
548
|
+
## Graph Update Strategy
|
|
549
|
+
|
|
550
|
+
GraphStack's Ship role manages graph updates automatically at the end of every cycle:
|
|
551
|
+
|
|
552
|
+
| Condition | Action |
|
|
553
|
+
|-----------|--------|
|
|
554
|
+
| Files were **added or deleted** this cycle | Always update |
|
|
555
|
+
| Bootstrap cycle completed | Always update (next brief needs fresh graph) |
|
|
556
|
+
| Content-only edits (bug fixes, refactors) | Skip β graph topology unchanged |
|
|
557
|
+
|
|
558
|
+
The post-commit hook enforces the same rules automatically. You never need to think about when to update.
|
|
559
|
+
|
|
560
|
+
---
|
|
561
|
+
|
|
562
|
+
## Project Suitability
|
|
563
|
+
|
|
564
|
+
| Project type | Suitability | Notes |
|
|
565
|
+
|---|---|---|
|
|
566
|
+
| REST / GraphQL API | βββββ | Best fit β clear module boundaries |
|
|
567
|
+
| Monolithic web app | βββββ | God node protection is critical here |
|
|
568
|
+
| Data pipeline / ETL | βββββ | Graph mirrors pipeline topology |
|
|
569
|
+
| Library / SDK | βββββ | Breaking change detection is precise |
|
|
570
|
+
| Microservice (single) | βββββ | Integration edges clearly visible |
|
|
571
|
+
| CLI tool | ββββ | Good for medium+ complexity |
|
|
572
|
+
| Serverless / Lambda | ββββ | Shared util blast radius visible |
|
|
573
|
+
| Admin panel | ββββ | State + API integration coverage |
|
|
574
|
+
| Game server (backend) | ββββ | State machine edges map well |
|
|
575
|
+
| DevOps / automation | ββββ | Script dependency tracking |
|
|
576
|
+
| React / Vue SPA | βββ | Good, but UI churn increases update frequency |
|
|
577
|
+
| TypeScript monorepo | βββ | Cross-package deps very valuable |
|
|
578
|
+
| Mobile app (React Native) | βββ | JS/TS layer fully covered |
|
|
579
|
+
| Unity game (C#) | βββ | God node protection excellent |
|
|
580
|
+
| E-commerce backend | βββ | Checkout flow blast radius useful |
|
|
581
|
+
| AI / embedding pipeline | βββ | Static structure good; runtime behavior not |
|
|
582
|
+
| Flutter app | ββ | Dart supported; widget tree less useful |
|
|
583
|
+
| Rapid prototype | ββ | Brief discipline adds friction at this stage |
|
|
584
|
+
| Static site | β | Minimal dependencies β low graph value |
|
|
585
|
+
| Single-file script | β | No graph structure to analyze |
|
|
586
|
+
|
|
587
|
+
**Rule of thumb:** GraphStack pays off when your codebase exceeds ~20 files and queries regularly cross module boundaries.
|
|
588
|
+
|
|
589
|
+
---
|
|
590
|
+
|
|
591
|
+
## Comparison
|
|
592
|
+
|
|
593
|
+
| | GraphStack | gstack | loki-mode | code-review-graph |
|
|
594
|
+
|---|---|---|---|---|
|
|
595
|
+
| Knowledge graph | β
Graphify | β | β | β
|
|
|
596
|
+
| Auto role transitions | β
| β manual | β
complex | β |
|
|
597
|
+
| Bootstrap (0βproject) | β
| β | β | β |
|
|
598
|
+
| Git-native task board | β
GNAP | β | β | β |
|
|
599
|
+
| Session resumability | β
STATE.md | β | β | β |
|
|
600
|
+
| Token optimization rules | β
explicit | β | β | β
partial |
|
|
601
|
+
| Cursor `/graphstack` slash bootstrap | β
| β | β | β |
|
|
602
|
+
| Setup complexity | Low | Low | High | Low |
|
|
603
|
+
|
|
604
|
+
---
|
|
605
|
+
|
|
606
|
+
## Resuming a Session
|
|
607
|
+
|
|
608
|
+
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.
|
|
609
|
+
|
|
610
|
+
Classic explicit prompt:
|
|
611
|
+
|
|
612
|
+
```
|
|
613
|
+
Read orchestrator/ORCHESTRATOR.md and follow it exactly.
|
|
614
|
+
Resume from last session.
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
Orchestrator reads `handoff/STATE.md` and `handoff/board/doing/` and picks up exactly where it left off.
|
|
618
|
+
|
|
619
|
+
---
|
|
620
|
+
|
|
621
|
+
## All Prompts
|
|
622
|
+
|
|
623
|
+
**Quick path:** describe work directly (rules + optional `/graphstack`). Legacy blocks remain for deterministic copy/paste workflows or nonβCursor tooling.
|
|
624
|
+
|
|
625
|
+
### Standard session *(legacy explicit)*
|
|
626
|
+
```
|
|
627
|
+
Read orchestrator/ORCHESTRATOR.md and follow it exactly.
|
|
628
|
+
[What you want to build or fix β any language]
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
### New project from scratch *(legacy explicit)*
|
|
632
|
+
```
|
|
633
|
+
Read orchestrator/ORCHESTRATOR.md and follow it exactly.
|
|
634
|
+
This is a new project with no existing codebase.
|
|
635
|
+
I want to build [describe your idea].
|
|
636
|
+
Tech stack: [language, framework, database].
|
|
637
|
+
```
|
|
638
|
+
|
|
639
|
+
### Resume a previous session *(legacy explicit)*
|
|
640
|
+
```
|
|
641
|
+
Read orchestrator/ORCHESTRATOR.md and follow it exactly.
|
|
642
|
+
Resume from last session.
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
### Manual role activation (advanced)
|
|
646
|
+
|
|
647
|
+
Use these when you want a single role without the full lifecycle:
|
|
648
|
+
|
|
649
|
+
**Architect** β plan and scope only, no building
|
|
650
|
+
```
|
|
651
|
+
Read .cursor/skills/architect/ARCHITECT.md and follow it exactly.
|
|
652
|
+
Read orchestrator/TOKEN_OPTIMIZER.md for token rules.
|
|
653
|
+
[What you want to plan]
|
|
654
|
+
```
|
|
655
|
+
|
|
656
|
+
**Builder** β build directly from an existing brief
|
|
657
|
+
```
|
|
658
|
+
Read .cursor/skills/builder/BUILDER.md and follow it exactly.
|
|
659
|
+
Read orchestrator/TOKEN_OPTIMIZER.md for token rules.
|
|
660
|
+
Brief is in handoff/BRIEF.md. Start building.
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
**Reviewer** β review existing code or a diff
|
|
664
|
+
```
|
|
665
|
+
Read .cursor/skills/reviewer/REVIEWER.md and follow it exactly.
|
|
666
|
+
Read orchestrator/TOKEN_OPTIMIZER.md for token rules.
|
|
667
|
+
Review the changes in [filename or "the last git diff"].
|
|
668
|
+
```
|
|
669
|
+
|
|
670
|
+
**QA** β trace and verify a specific feature
|
|
671
|
+
```
|
|
672
|
+
Read .cursor/skills/qa/QA.md and follow it exactly.
|
|
673
|
+
Read orchestrator/TOKEN_OPTIMIZER.md for token rules.
|
|
674
|
+
Trace and verify [feature name].
|
|
675
|
+
```
|
|
676
|
+
|
|
677
|
+
**Ship** β run pre-deploy checklist
|
|
678
|
+
```
|
|
679
|
+
Read .cursor/skills/ship/SHIP.md and follow it exactly.
|
|
680
|
+
Run the pre-ship checklist for task [task-id].
|
|
681
|
+
```
|
|
682
|
+
|
|
683
|
+
**Bootstrapper** β decompose an idea into a module plan only
|
|
684
|
+
```
|
|
685
|
+
Read .cursor/skills/bootstrapper/BOOTSTRAPPER.md and follow it exactly.
|
|
686
|
+
Read orchestrator/TOKEN_OPTIMIZER.md for token rules.
|
|
687
|
+
[Describe your project idea]
|
|
688
|
+
```
|
|
689
|
+
|
|
690
|
+
> **Note:** `.cursor/rules/graphstack.mdc` is loaded automatically by Cursor on every session. You never need to reference it manually.
|
|
691
|
+
|
|
692
|
+
---
|
|
693
|
+
|
|
694
|
+
## Compatibility
|
|
695
|
+
|
|
696
|
+
| Tool | Orchestrator | Manual roles |
|
|
697
|
+
|------|-------------|-------------|
|
|
698
|
+
| Cursor | β
Full (.mdc auto-loads) | β
|
|
|
699
|
+
| Claude Code | β
Full | β
|
|
|
700
|
+
| VS Code Copilot Chat | β
Full | β
|
|
|
701
|
+
| GitHub Copilot CLI | β οΈ Paste per session | β
|
|
|
702
|
+
| Aider | β οΈ Paste per session | β
|
|
|
703
|
+
|
|
704
|
+
---
|
|
705
|
+
|
|
706
|
+
## Demo
|
|
707
|
+
|
|
708
|
+
[`demo/DEMO_WALKTHROUGH.md`](demo/DEMO_WALKTHROUGH.md) β full end-to-end walkthrough: adding rate limiting to a Node.js auth service, showing every automatic transition, graph query, and board update.
|
|
709
|
+
|
|
710
|
+
---
|
|
711
|
+
|
|
712
|
+
## Contributing
|
|
713
|
+
|
|
714
|
+
See [`CONTRIBUTING.md`](CONTRIBUTING.md). GraphStack is just markdown and bash β the barrier is intentionally low.
|
|
715
|
+
|
|
716
|
+
---
|
|
717
|
+
|
|
718
|
+
## License
|
|
719
|
+
|
|
720
|
+
MIT β free forever. No telemetry. No accounts. No phoning home.
|