the-grid-cc 1.7.13 → 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 +103 -1098
- 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
|
@@ -0,0 +1,656 @@
|
|
|
1
|
+
# /grid:resume - Resume Interrupted Mission
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
name: grid:resume
|
|
5
|
+
description: Resume an interrupted Grid mission from last checkpoint
|
|
6
|
+
allowed-tools:
|
|
7
|
+
- Read
|
|
8
|
+
- Glob
|
|
9
|
+
- Grep
|
|
10
|
+
- Bash
|
|
11
|
+
- Task
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
Resume an interrupted Grid mission. Reconstructs full context from `.grid/` files and continues execution from the exact stopping point.
|
|
15
|
+
|
|
16
|
+
## USAGE
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
/grid:resume # Auto-detect and resume
|
|
20
|
+
/grid:resume --validate # Validate state only, don't resume
|
|
21
|
+
/grid:resume --from block-02 # Resume from specific block
|
|
22
|
+
/grid:resume --rollback # Rollback last partial work, then resume
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## BEHAVIOR
|
|
26
|
+
|
|
27
|
+
### Step 1: State Detection
|
|
28
|
+
|
|
29
|
+
Check if resumable state exists:
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
def detect_state():
|
|
33
|
+
"""Detect if there's a resumable state."""
|
|
34
|
+
|
|
35
|
+
if not file_exists(".grid/STATE.md"):
|
|
36
|
+
return {"status": "no_state", "message": "No Grid state found"}
|
|
37
|
+
|
|
38
|
+
state = parse_yaml(read(".grid/STATE.md"))
|
|
39
|
+
|
|
40
|
+
if state.get("status") == "completed":
|
|
41
|
+
return {"status": "completed", "message": "Mission already completed"}
|
|
42
|
+
|
|
43
|
+
if state.get("status") == "active":
|
|
44
|
+
# Check staleness (no update in 10+ minutes)
|
|
45
|
+
updated = parse_datetime(state.get("updated_at"))
|
|
46
|
+
if datetime.now() - updated > timedelta(minutes=10):
|
|
47
|
+
return {"status": "stale", "state": state}
|
|
48
|
+
else:
|
|
49
|
+
return {"status": "active", "message": "Mission still active"}
|
|
50
|
+
|
|
51
|
+
if state.get("status") in ["checkpoint", "interrupted"]:
|
|
52
|
+
return {"status": "resumable", "state": state}
|
|
53
|
+
|
|
54
|
+
if state.get("status") == "failed":
|
|
55
|
+
return {"status": "failed", "state": state}
|
|
56
|
+
|
|
57
|
+
return {"status": "unknown", "state": state}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Step 2: Display Resume Prompt
|
|
61
|
+
|
|
62
|
+
Show the user what will be resumed:
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
GRID RESUME
|
|
66
|
+
===========
|
|
67
|
+
|
|
68
|
+
Mission: {cluster_name}
|
|
69
|
+
Status: {status}
|
|
70
|
+
Last Activity: {updated_at}
|
|
71
|
+
|
|
72
|
+
PROGRESS
|
|
73
|
+
--------
|
|
74
|
+
Phase: {phase}/{phase_total} ({phase_name})
|
|
75
|
+
Block: {block}/{block_total}
|
|
76
|
+
Wave: {wave}/{wave_total}
|
|
77
|
+
|
|
78
|
+
Progress: [{progress_bar}] {percent}%
|
|
79
|
+
|
|
80
|
+
COMPLETED WORK
|
|
81
|
+
--------------
|
|
82
|
+
{list of completed blocks with commits}
|
|
83
|
+
|
|
84
|
+
RESUME POINT
|
|
85
|
+
------------
|
|
86
|
+
{description of where execution will continue}
|
|
87
|
+
|
|
88
|
+
WARMTH AVAILABLE
|
|
89
|
+
----------------
|
|
90
|
+
- {N} codebase patterns
|
|
91
|
+
- {N} gotchas
|
|
92
|
+
- {N} user preferences
|
|
93
|
+
|
|
94
|
+
Ready to resume?
|
|
95
|
+
Type 'continue' to proceed or 'status' for more details.
|
|
96
|
+
|
|
97
|
+
End of Line.
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Step 3: State Validation
|
|
101
|
+
|
|
102
|
+
Validate state consistency before resuming:
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
def validate_state(state):
|
|
106
|
+
"""Validate state is consistent and resumable."""
|
|
107
|
+
|
|
108
|
+
validations = []
|
|
109
|
+
|
|
110
|
+
# 1. Verify claimed commits exist
|
|
111
|
+
completed_blocks = glob(".grid/phases/*/SUMMARY.md")
|
|
112
|
+
for summary_path in completed_blocks:
|
|
113
|
+
summary = parse_yaml(read(summary_path))
|
|
114
|
+
for commit in summary.get("commits", []):
|
|
115
|
+
exists = bash(f"git cat-file -t {commit['hash']} 2>/dev/null")
|
|
116
|
+
if not exists:
|
|
117
|
+
validations.append({
|
|
118
|
+
"check": "commit_exists",
|
|
119
|
+
"status": "FAIL",
|
|
120
|
+
"detail": f"Commit {commit['hash']} not found",
|
|
121
|
+
})
|
|
122
|
+
else:
|
|
123
|
+
validations.append({
|
|
124
|
+
"check": "commit_exists",
|
|
125
|
+
"status": "PASS",
|
|
126
|
+
"detail": f"Commit {commit['hash']} verified",
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
# 2. Verify claimed files exist
|
|
130
|
+
for summary_path in completed_blocks:
|
|
131
|
+
summary = parse_yaml(read(summary_path))
|
|
132
|
+
for artifact in summary.get("artifacts_created", []):
|
|
133
|
+
if file_exists(artifact["path"]):
|
|
134
|
+
validations.append({
|
|
135
|
+
"check": "file_exists",
|
|
136
|
+
"status": "PASS",
|
|
137
|
+
"detail": f"File {artifact['path']} exists",
|
|
138
|
+
})
|
|
139
|
+
else:
|
|
140
|
+
validations.append({
|
|
141
|
+
"check": "file_exists",
|
|
142
|
+
"status": "FAIL",
|
|
143
|
+
"detail": f"File {artifact['path']} missing",
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
# 3. Verify plans exist for pending blocks
|
|
147
|
+
current_block = state["position"]["block"]
|
|
148
|
+
total_blocks = state["position"]["block_total"]
|
|
149
|
+
for block_num in range(current_block, total_blocks + 1):
|
|
150
|
+
plan_path = f".grid/plans/*-block-{block_num:02d}.md"
|
|
151
|
+
if glob(plan_path):
|
|
152
|
+
validations.append({
|
|
153
|
+
"check": "plan_exists",
|
|
154
|
+
"status": "PASS",
|
|
155
|
+
"detail": f"Plan for block {block_num} exists",
|
|
156
|
+
})
|
|
157
|
+
else:
|
|
158
|
+
validations.append({
|
|
159
|
+
"check": "plan_exists",
|
|
160
|
+
"status": "FAIL",
|
|
161
|
+
"detail": f"Plan for block {block_num} missing",
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
# 4. Check for conflicting checkpoints
|
|
165
|
+
checkpoint_files = glob(".grid/CHECKPOINT*.md")
|
|
166
|
+
if len(checkpoint_files) > 1:
|
|
167
|
+
validations.append({
|
|
168
|
+
"check": "single_checkpoint",
|
|
169
|
+
"status": "FAIL",
|
|
170
|
+
"detail": f"Multiple checkpoint files found: {checkpoint_files}",
|
|
171
|
+
})
|
|
172
|
+
|
|
173
|
+
return validations
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Display validation results:
|
|
177
|
+
|
|
178
|
+
```
|
|
179
|
+
STATE VALIDATION
|
|
180
|
+
================
|
|
181
|
+
|
|
182
|
+
[PASS] Commit abc123 verified
|
|
183
|
+
[PASS] Commit def456 verified
|
|
184
|
+
[PASS] File package.json exists
|
|
185
|
+
[PASS] File astro.config.mjs exists
|
|
186
|
+
[PASS] Plan for block 02 exists
|
|
187
|
+
[PASS] Plan for block 03 exists
|
|
188
|
+
[WARN] Scratchpad has stale entries (>10 min old)
|
|
189
|
+
|
|
190
|
+
Validation: 6 PASS, 0 FAIL, 1 WARN
|
|
191
|
+
|
|
192
|
+
State is valid. Ready to resume.
|
|
193
|
+
|
|
194
|
+
End of Line.
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Step 4: Context Reconstruction
|
|
198
|
+
|
|
199
|
+
Build full context from state files:
|
|
200
|
+
|
|
201
|
+
```python
|
|
202
|
+
def reconstruct_context():
|
|
203
|
+
"""Reconstruct execution context from .grid/ files."""
|
|
204
|
+
|
|
205
|
+
context = {}
|
|
206
|
+
|
|
207
|
+
# 1. Load central state
|
|
208
|
+
state = parse_yaml(read(".grid/STATE.md"))
|
|
209
|
+
context["cluster"] = state["cluster"]
|
|
210
|
+
context["position"] = state["position"]
|
|
211
|
+
context["mode"] = state.get("mode", "autopilot")
|
|
212
|
+
|
|
213
|
+
# 2. Load checkpoint if exists
|
|
214
|
+
if file_exists(".grid/CHECKPOINT.md"):
|
|
215
|
+
context["checkpoint"] = parse_yaml(read(".grid/CHECKPOINT.md"))
|
|
216
|
+
context["completed_threads"] = context["checkpoint"].get("completed_threads", [])
|
|
217
|
+
context["resume_thread"] = context["checkpoint"]["thread"]
|
|
218
|
+
else:
|
|
219
|
+
context["checkpoint"] = None
|
|
220
|
+
context["completed_threads"] = []
|
|
221
|
+
context["resume_thread"] = 1
|
|
222
|
+
|
|
223
|
+
# 3. Collect completed block summaries
|
|
224
|
+
context["completed_blocks"] = []
|
|
225
|
+
for summary_path in sorted(glob(".grid/phases/*/SUMMARY.md")):
|
|
226
|
+
summary = parse_yaml(read(summary_path))
|
|
227
|
+
context["completed_blocks"].append(summary)
|
|
228
|
+
|
|
229
|
+
# 4. Load warmth
|
|
230
|
+
if file_exists(".grid/WARMTH.md"):
|
|
231
|
+
context["warmth"] = read(".grid/WARMTH.md")
|
|
232
|
+
else:
|
|
233
|
+
context["warmth"] = None
|
|
234
|
+
|
|
235
|
+
# 5. Load decisions
|
|
236
|
+
if file_exists(".grid/DECISIONS.md"):
|
|
237
|
+
context["decisions"] = read(".grid/DECISIONS.md")
|
|
238
|
+
else:
|
|
239
|
+
context["decisions"] = None
|
|
240
|
+
|
|
241
|
+
# 6. Load pending plan for current block
|
|
242
|
+
current_block = context["position"]["block"]
|
|
243
|
+
plan_files = glob(f".grid/plans/*-block-{current_block:02d}.md")
|
|
244
|
+
if plan_files:
|
|
245
|
+
context["current_plan"] = read(plan_files[0])
|
|
246
|
+
else:
|
|
247
|
+
context["current_plan"] = None
|
|
248
|
+
|
|
249
|
+
# 7. Load plan summary for wave structure
|
|
250
|
+
plan_summary_files = glob(".grid/plans/*-PLAN-SUMMARY.md")
|
|
251
|
+
if plan_summary_files:
|
|
252
|
+
context["plan_summary"] = read(plan_summary_files[0])
|
|
253
|
+
else:
|
|
254
|
+
context["plan_summary"] = None
|
|
255
|
+
|
|
256
|
+
return context
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Step 5: Resume Execution
|
|
260
|
+
|
|
261
|
+
Spawn continuation based on state:
|
|
262
|
+
|
|
263
|
+
#### Case A: Checkpoint Resume
|
|
264
|
+
|
|
265
|
+
```python
|
|
266
|
+
if context["checkpoint"] and context["checkpoint"]["type"] in ["human_verify", "decision", "human_action"]:
|
|
267
|
+
# Checkpoint was hit, check if user has responded
|
|
268
|
+
user_response = context["checkpoint"].get("user_response")
|
|
269
|
+
|
|
270
|
+
if not user_response:
|
|
271
|
+
# Still waiting for user
|
|
272
|
+
display_checkpoint_prompt(context["checkpoint"])
|
|
273
|
+
return
|
|
274
|
+
|
|
275
|
+
# User has responded, spawn continuation
|
|
276
|
+
Task(
|
|
277
|
+
prompt=f"""
|
|
278
|
+
First, read ~/.claude/agents/grid-executor.md for your role.
|
|
279
|
+
|
|
280
|
+
You are a **continuation executor**. A previous Program was interrupted at a checkpoint.
|
|
281
|
+
|
|
282
|
+
<warmth>
|
|
283
|
+
{context['warmth']}
|
|
284
|
+
</warmth>
|
|
285
|
+
|
|
286
|
+
<completed_threads>
|
|
287
|
+
{format_completed_threads(context['completed_threads'])}
|
|
288
|
+
</completed_threads>
|
|
289
|
+
|
|
290
|
+
<checkpoint_response>
|
|
291
|
+
User response: {user_response}
|
|
292
|
+
</checkpoint_response>
|
|
293
|
+
|
|
294
|
+
<resume_instructions>
|
|
295
|
+
Previous Program stopped at: Thread {context['resume_thread']}
|
|
296
|
+
Checkpoint type: {context['checkpoint']['type']}
|
|
297
|
+
|
|
298
|
+
CRITICAL: Verify previous commits exist before continuing:
|
|
299
|
+
```bash
|
|
300
|
+
git log --oneline -5
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
If commits are missing, STOP and report state corruption.
|
|
304
|
+
|
|
305
|
+
Continue execution from thread {context['resume_thread'] + 1}.
|
|
306
|
+
</resume_instructions>
|
|
307
|
+
|
|
308
|
+
<plan>
|
|
309
|
+
{context['current_plan']}
|
|
310
|
+
</plan>
|
|
311
|
+
|
|
312
|
+
Execute remaining threads. Document any deviations.
|
|
313
|
+
""",
|
|
314
|
+
subagent_type="general-purpose",
|
|
315
|
+
description=f"Resume block {context['position']['block']} from thread {context['resume_thread'] + 1}"
|
|
316
|
+
)
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
#### Case B: Session Death Resume
|
|
320
|
+
|
|
321
|
+
```python
|
|
322
|
+
if context["checkpoint"] and context["checkpoint"]["type"] == "session_death":
|
|
323
|
+
# Session died, need to assess partial work
|
|
324
|
+
|
|
325
|
+
Task(
|
|
326
|
+
prompt=f"""
|
|
327
|
+
First, read ~/.claude/agents/grid-executor.md for your role.
|
|
328
|
+
|
|
329
|
+
You are a **recovery executor**. The previous session died unexpectedly.
|
|
330
|
+
|
|
331
|
+
<warmth>
|
|
332
|
+
{context['warmth']}
|
|
333
|
+
</warmth>
|
|
334
|
+
|
|
335
|
+
<completed_threads>
|
|
336
|
+
{format_completed_threads(context['completed_threads'])}
|
|
337
|
+
</completed_threads>
|
|
338
|
+
|
|
339
|
+
<partial_work>
|
|
340
|
+
The previous session may have left partial work:
|
|
341
|
+
{context['checkpoint'].get('partial_work', 'Unknown')}
|
|
342
|
+
</partial_work>
|
|
343
|
+
|
|
344
|
+
<recovery_instructions>
|
|
345
|
+
1. First, verify what actually exists:
|
|
346
|
+
- Check git log for recent commits
|
|
347
|
+
- Check working directory for uncommitted changes
|
|
348
|
+
- Check staged files
|
|
349
|
+
|
|
350
|
+
2. Assess partial work:
|
|
351
|
+
- If good, commit it
|
|
352
|
+
- If broken, rollback with `git checkout -- .`
|
|
353
|
+
|
|
354
|
+
3. Continue from last verified commit
|
|
355
|
+
|
|
356
|
+
Previous position: Thread {context['resume_thread']}
|
|
357
|
+
</recovery_instructions>
|
|
358
|
+
|
|
359
|
+
<plan>
|
|
360
|
+
{context['current_plan']}
|
|
361
|
+
</plan>
|
|
362
|
+
|
|
363
|
+
Recover and continue execution.
|
|
364
|
+
""",
|
|
365
|
+
subagent_type="general-purpose",
|
|
366
|
+
description=f"Recover and resume block {context['position']['block']}"
|
|
367
|
+
)
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
#### Case C: Failure Resume
|
|
371
|
+
|
|
372
|
+
```python
|
|
373
|
+
if context["checkpoint"] and context["checkpoint"]["type"] == "failure":
|
|
374
|
+
# Previous attempt failed, present options
|
|
375
|
+
|
|
376
|
+
display(f"""
|
|
377
|
+
FAILURE RECOVERY
|
|
378
|
+
================
|
|
379
|
+
|
|
380
|
+
Previous execution failed:
|
|
381
|
+
|
|
382
|
+
Block: {context['checkpoint']['block']}
|
|
383
|
+
Thread: {context['checkpoint']['thread']}
|
|
384
|
+
Error: {context['checkpoint'].get('error', 'Unknown')}
|
|
385
|
+
|
|
386
|
+
PARTIAL WORK
|
|
387
|
+
------------
|
|
388
|
+
{context['checkpoint'].get('partial_work', 'None recorded')}
|
|
389
|
+
|
|
390
|
+
OPTIONS
|
|
391
|
+
-------
|
|
392
|
+
1. retry - Spawn fresh executor with failure context
|
|
393
|
+
2. rollback - Revert partial work, restart block
|
|
394
|
+
3. skip - Skip this block, continue to next
|
|
395
|
+
4. manual - User will fix manually, then continue
|
|
396
|
+
|
|
397
|
+
Enter choice:
|
|
398
|
+
""")
|
|
399
|
+
|
|
400
|
+
# Wait for user choice, then act accordingly
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
#### Case D: Wave Boundary Resume
|
|
404
|
+
|
|
405
|
+
```python
|
|
406
|
+
if not context["checkpoint"]:
|
|
407
|
+
# No checkpoint, resume from wave/block boundary
|
|
408
|
+
|
|
409
|
+
Task(
|
|
410
|
+
prompt=f"""
|
|
411
|
+
First, read ~/.claude/agents/grid-executor.md for your role.
|
|
412
|
+
|
|
413
|
+
Resuming mission from block boundary.
|
|
414
|
+
|
|
415
|
+
<warmth>
|
|
416
|
+
{context['warmth']}
|
|
417
|
+
</warmth>
|
|
418
|
+
|
|
419
|
+
<completed_blocks>
|
|
420
|
+
{format_completed_blocks(context['completed_blocks'])}
|
|
421
|
+
</completed_blocks>
|
|
422
|
+
|
|
423
|
+
<current_position>
|
|
424
|
+
Starting block: {context['position']['block']}
|
|
425
|
+
Wave: {context['position']['wave']}
|
|
426
|
+
</current_position>
|
|
427
|
+
|
|
428
|
+
<plan>
|
|
429
|
+
{context['current_plan']}
|
|
430
|
+
</plan>
|
|
431
|
+
|
|
432
|
+
Execute the full block plan.
|
|
433
|
+
""",
|
|
434
|
+
subagent_type="general-purpose",
|
|
435
|
+
description=f"Execute block {context['position']['block']}"
|
|
436
|
+
)
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
## OUTPUT FORMATS
|
|
440
|
+
|
|
441
|
+
### No State Found
|
|
442
|
+
|
|
443
|
+
```
|
|
444
|
+
GRID RESUME
|
|
445
|
+
===========
|
|
446
|
+
|
|
447
|
+
No Grid state found in current directory.
|
|
448
|
+
|
|
449
|
+
Either:
|
|
450
|
+
1. Initialize a new mission: /grid
|
|
451
|
+
2. Change to a directory with .grid/
|
|
452
|
+
|
|
453
|
+
End of Line.
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
### Mission Completed
|
|
457
|
+
|
|
458
|
+
```
|
|
459
|
+
GRID RESUME
|
|
460
|
+
===========
|
|
461
|
+
|
|
462
|
+
Mission already completed.
|
|
463
|
+
|
|
464
|
+
Cluster: {cluster_name}
|
|
465
|
+
Completed: {completed_at}
|
|
466
|
+
Blocks: {total_blocks}
|
|
467
|
+
Commits: {total_commits}
|
|
468
|
+
|
|
469
|
+
To start a new mission, run /grid
|
|
470
|
+
|
|
471
|
+
End of Line.
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
### Stale State Detected
|
|
475
|
+
|
|
476
|
+
```
|
|
477
|
+
GRID RESUME
|
|
478
|
+
===========
|
|
479
|
+
|
|
480
|
+
Stale state detected.
|
|
481
|
+
|
|
482
|
+
Cluster: {cluster_name}
|
|
483
|
+
Last Activity: {updated_at} ({time_ago} ago)
|
|
484
|
+
Status: {status}
|
|
485
|
+
|
|
486
|
+
The previous session appears to have died unexpectedly.
|
|
487
|
+
|
|
488
|
+
RECOVERY OPTIONS
|
|
489
|
+
----------------
|
|
490
|
+
1. continue - Attempt to continue from last known state
|
|
491
|
+
2. validate - Validate state before continuing
|
|
492
|
+
3. rollback - Rollback to last complete block
|
|
493
|
+
4. inspect - Show detailed state for manual assessment
|
|
494
|
+
|
|
495
|
+
Enter choice:
|
|
496
|
+
|
|
497
|
+
End of Line.
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
### Validation Failed
|
|
501
|
+
|
|
502
|
+
```
|
|
503
|
+
GRID RESUME
|
|
504
|
+
===========
|
|
505
|
+
|
|
506
|
+
State validation failed.
|
|
507
|
+
|
|
508
|
+
ISSUES FOUND
|
|
509
|
+
------------
|
|
510
|
+
[FAIL] Commit abc123 not found in git history
|
|
511
|
+
[FAIL] File src/components/Header.astro missing
|
|
512
|
+
|
|
513
|
+
POSSIBLE CAUSES
|
|
514
|
+
---------------
|
|
515
|
+
- Git history was rewritten (rebase, reset)
|
|
516
|
+
- Files were manually deleted
|
|
517
|
+
- Different branch checked out
|
|
518
|
+
|
|
519
|
+
RECOVERY OPTIONS
|
|
520
|
+
----------------
|
|
521
|
+
1. rebuild - Rebuild from last valid checkpoint
|
|
522
|
+
2. inspect - Show full state for manual assessment
|
|
523
|
+
3. abort - Clear state and start fresh
|
|
524
|
+
|
|
525
|
+
Enter choice:
|
|
526
|
+
|
|
527
|
+
End of Line.
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
### Resuming
|
|
531
|
+
|
|
532
|
+
```
|
|
533
|
+
GRID RESUME
|
|
534
|
+
===========
|
|
535
|
+
|
|
536
|
+
Resuming mission...
|
|
537
|
+
|
|
538
|
+
Cluster: {cluster_name}
|
|
539
|
+
Resume Point: Block {block}, Thread {thread}
|
|
540
|
+
Warmth: {warmth_count} patterns loaded
|
|
541
|
+
|
|
542
|
+
Spawning continuation executor...
|
|
543
|
+
|
|
544
|
+
End of Line.
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
## STATE UPDATES
|
|
548
|
+
|
|
549
|
+
After successful resume:
|
|
550
|
+
|
|
551
|
+
1. Update `STATE.md`:
|
|
552
|
+
- Set status: active
|
|
553
|
+
- Update updated_at timestamp
|
|
554
|
+
- Set session_id to new value
|
|
555
|
+
|
|
556
|
+
2. Clear checkpoint if consumed:
|
|
557
|
+
- Move CHECKPOINT.md to CHECKPOINT_ARCHIVE.md
|
|
558
|
+
- Or delete if no longer needed
|
|
559
|
+
|
|
560
|
+
3. Archive scratchpad:
|
|
561
|
+
- Append old entries to SCRATCHPAD_ARCHIVE.md
|
|
562
|
+
- Clear SCRATCHPAD.md for new session
|
|
563
|
+
|
|
564
|
+
## EDGE CASES
|
|
565
|
+
|
|
566
|
+
### Multiple Grid Directories
|
|
567
|
+
|
|
568
|
+
If `.grid/` exists in both current directory and parent:
|
|
569
|
+
|
|
570
|
+
```
|
|
571
|
+
GRID RESUME
|
|
572
|
+
===========
|
|
573
|
+
|
|
574
|
+
Multiple Grid states found:
|
|
575
|
+
|
|
576
|
+
1. ./grid/ - "blog" cluster (45% complete)
|
|
577
|
+
2. ../.grid/ - "api" cluster (80% complete)
|
|
578
|
+
|
|
579
|
+
Which mission to resume? Enter 1 or 2:
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
### Corrupted State
|
|
583
|
+
|
|
584
|
+
If STATE.md is unparseable:
|
|
585
|
+
|
|
586
|
+
```
|
|
587
|
+
GRID RESUME
|
|
588
|
+
===========
|
|
589
|
+
|
|
590
|
+
State file corrupted.
|
|
591
|
+
|
|
592
|
+
Attempting recovery from artifacts...
|
|
593
|
+
|
|
594
|
+
Found:
|
|
595
|
+
- 2 SUMMARY.md files (blocks 01, 02 complete)
|
|
596
|
+
- 15 commits matching Grid patterns
|
|
597
|
+
- Plan files for blocks 01-06
|
|
598
|
+
|
|
599
|
+
Reconstructed state:
|
|
600
|
+
- Cluster: blog (inferred)
|
|
601
|
+
- Position: Block 03 (inferred)
|
|
602
|
+
- Progress: ~33% (estimated)
|
|
603
|
+
|
|
604
|
+
Accept reconstructed state? (yes/no)
|
|
605
|
+
```
|
|
606
|
+
|
|
607
|
+
### Conflicting Git State
|
|
608
|
+
|
|
609
|
+
If working directory has uncommitted changes:
|
|
610
|
+
|
|
611
|
+
```
|
|
612
|
+
GRID RESUME
|
|
613
|
+
===========
|
|
614
|
+
|
|
615
|
+
Uncommitted changes detected.
|
|
616
|
+
|
|
617
|
+
Modified files:
|
|
618
|
+
- src/components/Header.astro
|
|
619
|
+
- src/layouts/BaseLayout.astro
|
|
620
|
+
|
|
621
|
+
These may be partial work from the previous session.
|
|
622
|
+
|
|
623
|
+
OPTIONS
|
|
624
|
+
-------
|
|
625
|
+
1. commit - Commit changes and continue
|
|
626
|
+
2. stash - Stash changes and continue from last commit
|
|
627
|
+
3. discard - Discard changes and continue from last commit
|
|
628
|
+
4. inspect - Show diff for manual review
|
|
629
|
+
|
|
630
|
+
Enter choice:
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
## IMPLEMENTATION NOTES
|
|
634
|
+
|
|
635
|
+
### MC Context Budget
|
|
636
|
+
|
|
637
|
+
Resume command should:
|
|
638
|
+
1. Stay under 30% context for state reading
|
|
639
|
+
2. Spawn executor for actual work
|
|
640
|
+
3. Not read source code files directly
|
|
641
|
+
|
|
642
|
+
### Warmth Injection
|
|
643
|
+
|
|
644
|
+
Always inject warmth when spawning continuation:
|
|
645
|
+
- Prevents repeating mistakes
|
|
646
|
+
- Applies learned codebase patterns
|
|
647
|
+
- Respects user preferences
|
|
648
|
+
|
|
649
|
+
### Checkpoint Cleanup
|
|
650
|
+
|
|
651
|
+
After successful continuation:
|
|
652
|
+
- Archive checkpoint to prevent re-resuming
|
|
653
|
+
- Update state to reflect progress
|
|
654
|
+
- Clear scratchpad for fresh session
|
|
655
|
+
|
|
656
|
+
End of Line.
|