the-grid-cc 1.7.12 → 1.7.14
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.
- package/02-SUMMARY.md +156 -0
- package/agents/grid-accountant.md +519 -0
- package/agents/grid-git-operator.md +661 -0
- package/agents/grid-researcher.md +421 -0
- package/agents/grid-scout.md +376 -0
- package/commands/grid/VERSION +1 -1
- package/commands/grid/branch.md +567 -0
- package/commands/grid/budget.md +438 -0
- package/commands/grid/daemon.md +637 -0
- package/commands/grid/init.md +375 -18
- package/commands/grid/mc.md +106 -1101
- package/commands/grid/resume.md +656 -0
- package/docs/BUDGET_SYSTEM.md +745 -0
- package/docs/DAEMON_ARCHITECTURE.md +780 -0
- package/docs/GIT_AUTONOMY.md +981 -0
- package/docs/MC_OPTIMIZATION.md +181 -0
- package/docs/MC_PROTOCOLS.md +950 -0
- package/docs/PERSISTENCE.md +962 -0
- package/docs/RESEARCH_FIRST.md +591 -0
- package/package.json +1 -1
package/commands/grid/init.md
CHANGED
|
@@ -2,50 +2,407 @@
|
|
|
2
2
|
|
|
3
3
|
---
|
|
4
4
|
name: grid:init
|
|
5
|
-
description: Initialize .grid directory for current project
|
|
5
|
+
description: Initialize .grid directory for current project with full persistence support
|
|
6
6
|
allowed-tools:
|
|
7
7
|
- Bash
|
|
8
8
|
- Write
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Initialize the `.grid/` directory structure for the current project. This creates all directories and files needed for state persistence, enabling mission recovery via `/grid:resume`.
|
|
12
|
+
|
|
13
|
+
## USAGE
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
/grid:init # Initialize in current directory
|
|
17
|
+
/grid:init --force # Reinitialize (preserves existing state)
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## DIRECTORY STRUCTURE
|
|
21
|
+
|
|
22
|
+
Create the complete `.grid/` directory structure:
|
|
12
23
|
|
|
13
24
|
```bash
|
|
14
|
-
mkdir -p .grid/
|
|
25
|
+
mkdir -p .grid/plans .grid/phases .grid/discs .grid/debug .grid/refinement/screenshots .grid/refinement/e2e .grid/refinement/personas
|
|
15
26
|
```
|
|
16
27
|
|
|
17
|
-
|
|
28
|
+
### Directory Purposes
|
|
29
|
+
|
|
30
|
+
| Directory | Purpose | Persistence |
|
|
31
|
+
|-----------|---------|-------------|
|
|
32
|
+
| `.grid/` | Root state directory | Session-scoped |
|
|
33
|
+
| `.grid/plans/` | Execution plans (PLAN.md files) | Mission-scoped |
|
|
34
|
+
| `.grid/phases/` | Execution artifacts (SUMMARY.md files) | Mission-scoped |
|
|
35
|
+
| `.grid/discs/` | Identity Discs for Programs | Session-scoped |
|
|
36
|
+
| `.grid/debug/` | Debug session state | Survives /clear |
|
|
37
|
+
| `.grid/refinement/` | Refinement swarm outputs | Mission-scoped |
|
|
38
|
+
|
|
39
|
+
## CORE STATE FILES
|
|
40
|
+
|
|
41
|
+
### STATE.md (Central State)
|
|
42
|
+
|
|
43
|
+
The primary state file - always read first on resume:
|
|
18
44
|
|
|
19
45
|
```markdown
|
|
46
|
+
---
|
|
47
|
+
# Identity
|
|
48
|
+
cluster: null
|
|
49
|
+
session_id: "{timestamp}-init"
|
|
50
|
+
status: initialized # initialized | active | checkpoint | interrupted | completed | failed
|
|
51
|
+
|
|
52
|
+
# Position tracking
|
|
53
|
+
position:
|
|
54
|
+
phase: 0
|
|
55
|
+
phase_total: 0
|
|
56
|
+
phase_name: null
|
|
57
|
+
block: 0
|
|
58
|
+
block_total: 0
|
|
59
|
+
wave: 0
|
|
60
|
+
wave_total: 0
|
|
61
|
+
|
|
62
|
+
# Progress
|
|
63
|
+
progress_percent: 0
|
|
64
|
+
energy_remaining: 10000
|
|
65
|
+
|
|
66
|
+
# Execution mode
|
|
67
|
+
mode: autopilot # autopilot | guided | hands_on
|
|
68
|
+
|
|
69
|
+
# Timestamps
|
|
70
|
+
created_at: "{ISO timestamp}"
|
|
71
|
+
updated_at: "{ISO timestamp}"
|
|
72
|
+
---
|
|
73
|
+
|
|
20
74
|
# Grid State
|
|
21
75
|
|
|
22
76
|
## Current Position
|
|
23
77
|
- Active Cluster: none
|
|
24
78
|
- Active Block: none
|
|
25
|
-
-
|
|
79
|
+
- Status: Initialized
|
|
80
|
+
|
|
81
|
+
Progress: [----------] 0%
|
|
82
|
+
|
|
83
|
+
## Session Info
|
|
84
|
+
- Initialized: {current date}
|
|
85
|
+
- Session ID: {session_id}
|
|
86
|
+
- Mode: AUTOPILOT
|
|
87
|
+
|
|
88
|
+
## Last Activity
|
|
89
|
+
Initialized Grid state directory.
|
|
90
|
+
|
|
91
|
+
## Notes
|
|
92
|
+
Ready for /grid to begin a mission.
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### WARMTH.md (Institutional Knowledge)
|
|
96
|
+
|
|
97
|
+
Template for accumulated knowledge:
|
|
98
|
+
|
|
99
|
+
```markdown
|
|
100
|
+
---
|
|
101
|
+
cluster: null
|
|
102
|
+
accumulated_from: []
|
|
103
|
+
last_updated: "{ISO timestamp}"
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
# Grid Warmth
|
|
107
|
+
|
|
108
|
+
Accumulated knowledge from Programs. Survives session death.
|
|
109
|
+
|
|
110
|
+
## Codebase Patterns
|
|
111
|
+
(Patterns discovered about the codebase)
|
|
112
|
+
|
|
113
|
+
## Gotchas
|
|
114
|
+
(Traps and pitfalls to avoid)
|
|
115
|
+
|
|
116
|
+
## User Preferences
|
|
117
|
+
(Inferred user preferences)
|
|
26
118
|
|
|
27
119
|
## Decisions Made
|
|
28
|
-
(
|
|
120
|
+
(Key decisions and their rationale)
|
|
29
121
|
|
|
30
|
-
##
|
|
31
|
-
(
|
|
122
|
+
## Almost Did
|
|
123
|
+
(Approaches considered but rejected)
|
|
32
124
|
|
|
33
|
-
##
|
|
34
|
-
|
|
125
|
+
## Fragile Areas
|
|
126
|
+
(Code that breaks easily)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### SCRATCHPAD.md (Live Discoveries)
|
|
130
|
+
|
|
131
|
+
Template for real-time discoveries during execution:
|
|
132
|
+
|
|
133
|
+
```markdown
|
|
134
|
+
---
|
|
135
|
+
updated: "{ISO timestamp}"
|
|
136
|
+
active_programs: []
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
# Grid Scratchpad
|
|
140
|
+
|
|
141
|
+
Live discoveries during execution. Programs write here when they learn something others need to know.
|
|
142
|
+
|
|
143
|
+
## Format
|
|
144
|
+
|
|
145
|
+
Each entry must follow:
|
|
146
|
+
```
|
|
147
|
+
### {program-id} | {ISO-timestamp} | {category}
|
|
148
|
+
|
|
149
|
+
**Finding:** {one clear sentence}
|
|
150
|
+
**Impact:** {who needs to know}
|
|
151
|
+
**Action:** [INFORM_ONLY | REQUIRES_CHANGE | BLOCKER]
|
|
152
|
+
**Details:** {additional context}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Categories: PATTERN | DECISION | BLOCKER | PROGRESS | CORRECTION
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
(Entries will appear below)
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### DECISIONS.md (User Decisions Log)
|
|
163
|
+
|
|
164
|
+
Template for tracking user decisions:
|
|
165
|
+
|
|
166
|
+
```markdown
|
|
167
|
+
---
|
|
168
|
+
cluster: null
|
|
169
|
+
decision_count: 0
|
|
170
|
+
last_updated: "{ISO timestamp}"
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
# Grid Decisions Log
|
|
174
|
+
|
|
175
|
+
User decisions made via I/O Tower. Referenced during resume to maintain consistency.
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
(Decisions will appear below in format:)
|
|
180
|
+
|
|
181
|
+
## Decision {N}: {ISO timestamp}
|
|
182
|
+
**Question:** {what was asked}
|
|
183
|
+
**Options Presented:**
|
|
184
|
+
- {option_a}: "{description}"
|
|
185
|
+
- {option_b}: "{description}"
|
|
186
|
+
**User Choice:** {choice}
|
|
187
|
+
**Rationale:** "{user's reason if given}"
|
|
188
|
+
**Affects:** {blocks/features affected}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### BLOCKERS.md (Blocker Tracking)
|
|
192
|
+
|
|
193
|
+
Template for tracking blockers:
|
|
194
|
+
|
|
195
|
+
```markdown
|
|
196
|
+
---
|
|
197
|
+
cluster: null
|
|
198
|
+
active_blockers: 0
|
|
199
|
+
resolved_blockers: 0
|
|
200
|
+
last_updated: "{ISO timestamp}"
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
# Grid Blockers
|
|
204
|
+
|
|
205
|
+
Issues that blocked progress. Used for resume and reporting.
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
(Blockers will appear below in format:)
|
|
210
|
+
|
|
211
|
+
## Blocker {N}: {ACTIVE | RESOLVED}
|
|
212
|
+
**Block:** {block_id}
|
|
213
|
+
**Thread:** {thread_id}
|
|
214
|
+
**Type:** {dependency_missing | human_action_required | external_service | bug}
|
|
215
|
+
**Description:** {what's blocking}
|
|
216
|
+
**Resolution:** {how it was resolved, if resolved}
|
|
217
|
+
**Created At:** {timestamp}
|
|
218
|
+
**Resolved At:** {timestamp, if resolved}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### config.json (Grid Configuration)
|
|
222
|
+
|
|
223
|
+
Configuration for Grid behavior:
|
|
224
|
+
|
|
225
|
+
```json
|
|
226
|
+
{
|
|
227
|
+
"model_tier": "quality",
|
|
228
|
+
"model_tier_options": ["quality", "balanced", "budget"],
|
|
229
|
+
"auto_verify": true,
|
|
230
|
+
"scratchpad_heartbeat_minutes": 5,
|
|
231
|
+
"stale_threshold_minutes": 10,
|
|
232
|
+
"max_retry_attempts": 3,
|
|
233
|
+
"created_at": "{ISO timestamp}"
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## INITIALIZATION BEHAVIOR
|
|
238
|
+
|
|
239
|
+
### Step 1: Check Existing State
|
|
240
|
+
|
|
241
|
+
```python
|
|
242
|
+
if file_exists(".grid/STATE.md"):
|
|
243
|
+
state = parse_yaml(read(".grid/STATE.md"))
|
|
244
|
+
if state.get("status") not in ["completed", "failed", "initialized"]:
|
|
245
|
+
# Active mission exists
|
|
246
|
+
display("""
|
|
247
|
+
WARNING: Active Grid mission detected.
|
|
248
|
+
|
|
249
|
+
Cluster: {state['cluster']}
|
|
250
|
+
Status: {state['status']}
|
|
251
|
+
Progress: {state['progress_percent']}%
|
|
252
|
+
|
|
253
|
+
Use /grid:resume to continue, or /grid:init --force to reinitialize.
|
|
254
|
+
""")
|
|
255
|
+
return
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### Step 2: Create Directories
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
mkdir -p .grid/plans
|
|
262
|
+
mkdir -p .grid/phases
|
|
263
|
+
mkdir -p .grid/discs
|
|
264
|
+
mkdir -p .grid/debug
|
|
265
|
+
mkdir -p .grid/refinement/screenshots
|
|
266
|
+
mkdir -p .grid/refinement/e2e
|
|
267
|
+
mkdir -p .grid/refinement/personas
|
|
35
268
|
```
|
|
36
269
|
|
|
37
|
-
|
|
270
|
+
### Step 3: Create State Files
|
|
38
271
|
|
|
272
|
+
Create each core state file with its template.
|
|
273
|
+
|
|
274
|
+
### Step 4: Create .gitignore Entry
|
|
275
|
+
|
|
276
|
+
If `.gitignore` exists, suggest adding `.grid/`:
|
|
277
|
+
|
|
278
|
+
```python
|
|
279
|
+
if file_exists(".gitignore"):
|
|
280
|
+
gitignore = read(".gitignore")
|
|
281
|
+
if ".grid/" not in gitignore:
|
|
282
|
+
suggest("""
|
|
283
|
+
Consider adding to .gitignore:
|
|
284
|
+
|
|
285
|
+
# Grid state (local only)
|
|
286
|
+
.grid/
|
|
287
|
+
""")
|
|
39
288
|
```
|
|
40
|
-
MCP > Grid state initialized.
|
|
41
289
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
290
|
+
### Step 5: Display Confirmation
|
|
291
|
+
|
|
292
|
+
```
|
|
293
|
+
GRID INITIALIZED
|
|
294
|
+
================
|
|
295
|
+
|
|
296
|
+
Directory structure created:
|
|
297
|
+
|
|
298
|
+
.grid/
|
|
299
|
+
├── STATE.md Central state file (read first on resume)
|
|
300
|
+
├── WARMTH.md Institutional knowledge
|
|
301
|
+
├── SCRATCHPAD.md Live discoveries during execution
|
|
302
|
+
├── DECISIONS.md User decisions log
|
|
303
|
+
├── BLOCKERS.md Blocker tracking
|
|
304
|
+
├── config.json Grid configuration
|
|
305
|
+
│
|
|
306
|
+
├── plans/ Execution plans
|
|
307
|
+
├── phases/ Execution artifacts (SUMMARY.md files)
|
|
308
|
+
├── discs/ Identity Discs for Programs
|
|
309
|
+
├── debug/ Debug session state
|
|
310
|
+
└── refinement/ Refinement swarm outputs
|
|
311
|
+
├── screenshots/
|
|
312
|
+
├── e2e/
|
|
313
|
+
└── personas/
|
|
47
314
|
|
|
48
|
-
|
|
315
|
+
PERSISTENCE ENABLED
|
|
316
|
+
-------------------
|
|
317
|
+
Your mission state will survive session death.
|
|
318
|
+
Use /grid:resume to continue an interrupted mission.
|
|
319
|
+
|
|
320
|
+
Ready to build. Run /grid to begin.
|
|
49
321
|
|
|
50
322
|
End of Line.
|
|
51
323
|
```
|
|
324
|
+
|
|
325
|
+
## FORCE REINITIALIZATION
|
|
326
|
+
|
|
327
|
+
With `--force` flag:
|
|
328
|
+
|
|
329
|
+
1. Archive existing state (if active):
|
|
330
|
+
```bash
|
|
331
|
+
mv .grid/STATE.md .grid/STATE.md.{timestamp}.bak
|
|
332
|
+
mv .grid/WARMTH.md .grid/WARMTH.md.{timestamp}.bak
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
2. Preserve completed work:
|
|
336
|
+
- Keep `.grid/phases/` (SUMMARY.md files)
|
|
337
|
+
- Keep `.grid/plans/` (for reference)
|
|
338
|
+
|
|
339
|
+
3. Create fresh state files
|
|
340
|
+
|
|
341
|
+
4. Display:
|
|
342
|
+
```
|
|
343
|
+
GRID REINITIALIZED
|
|
344
|
+
==================
|
|
345
|
+
|
|
346
|
+
Archived:
|
|
347
|
+
- STATE.md -> STATE.md.{timestamp}.bak
|
|
348
|
+
- WARMTH.md -> WARMTH.md.{timestamp}.bak
|
|
349
|
+
|
|
350
|
+
Preserved:
|
|
351
|
+
- phases/ (completed work)
|
|
352
|
+
- plans/ (execution plans)
|
|
353
|
+
|
|
354
|
+
Fresh state created. Ready to build.
|
|
355
|
+
|
|
356
|
+
End of Line.
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
## STATE FILE SCHEMAS
|
|
360
|
+
|
|
361
|
+
### STATE.md YAML Frontmatter Schema
|
|
362
|
+
|
|
363
|
+
| Field | Type | Required | Description |
|
|
364
|
+
|-------|------|----------|-------------|
|
|
365
|
+
| `cluster` | string | Yes | Cluster name |
|
|
366
|
+
| `session_id` | string | Yes | Unique session identifier |
|
|
367
|
+
| `status` | enum | Yes | initialized/active/checkpoint/interrupted/completed/failed |
|
|
368
|
+
| `position.phase` | integer | Yes | Current phase number |
|
|
369
|
+
| `position.phase_total` | integer | Yes | Total phases |
|
|
370
|
+
| `position.phase_name` | string | No | Phase name |
|
|
371
|
+
| `position.block` | integer | Yes | Current block number |
|
|
372
|
+
| `position.block_total` | integer | Yes | Total blocks |
|
|
373
|
+
| `position.wave` | integer | Yes | Current wave number |
|
|
374
|
+
| `position.wave_total` | integer | Yes | Total waves |
|
|
375
|
+
| `progress_percent` | integer | Yes | 0-100 |
|
|
376
|
+
| `energy_remaining` | integer | Yes | Energy budget |
|
|
377
|
+
| `mode` | enum | Yes | autopilot/guided/hands_on |
|
|
378
|
+
| `created_at` | ISO8601 | Yes | Creation timestamp |
|
|
379
|
+
| `updated_at` | ISO8601 | Yes | Last update timestamp |
|
|
380
|
+
|
|
381
|
+
### config.json Schema
|
|
382
|
+
|
|
383
|
+
| Field | Type | Default | Description |
|
|
384
|
+
|-------|------|---------|-------------|
|
|
385
|
+
| `model_tier` | enum | "quality" | quality/balanced/budget |
|
|
386
|
+
| `auto_verify` | boolean | true | Auto-spawn Recognizer |
|
|
387
|
+
| `scratchpad_heartbeat_minutes` | integer | 5 | Expected write frequency |
|
|
388
|
+
| `stale_threshold_minutes` | integer | 10 | When to consider session dead |
|
|
389
|
+
| `max_retry_attempts` | integer | 3 | Max retries on failure |
|
|
390
|
+
|
|
391
|
+
## PERSISTENCE GUARANTEES
|
|
392
|
+
|
|
393
|
+
After initialization, the Grid guarantees:
|
|
394
|
+
|
|
395
|
+
1. **State survives session death** - All progress recorded in files
|
|
396
|
+
2. **Warmth accumulates** - Knowledge transfers across Programs
|
|
397
|
+
3. **Decisions persist** - User choices never need repeating
|
|
398
|
+
4. **Commits are verified** - Git hashes enable state validation
|
|
399
|
+
5. **Plans are preserved** - Full execution plans available for resume
|
|
400
|
+
|
|
401
|
+
## RELATED COMMANDS
|
|
402
|
+
|
|
403
|
+
- `/grid` - Begin a mission (auto-initializes if needed)
|
|
404
|
+
- `/grid:resume` - Resume an interrupted mission
|
|
405
|
+
- `/grid:status` - Display current Grid state
|
|
406
|
+
- `/grid:model` - Configure model tier
|
|
407
|
+
|
|
408
|
+
End of Line.
|