the-grid-cc 1.7.3 → 1.7.5

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.
@@ -0,0 +1,669 @@
1
+ # Feature: Scratchpad Enforcement
2
+
3
+ ## Research Summary
4
+
5
+ ### Key Findings from Observability Research
6
+
7
+ **1. The Three Pillars of Observability (OpenTelemetry, Distributed Systems)**
8
+ - **Logs**: Timestamped event records (what happened)
9
+ - **Metrics**: Numerical measurements (performance indicators)
10
+ - **Traces**: Request journey across systems (flow visualization)
11
+
12
+ The Grid currently lacks the "logs" pillar during execution. MC gets metrics (task completion) and can trace after-the-fact (SUMMARY.md), but has no live event stream.
13
+
14
+ **2. Heartbeat Patterns in Distributed Systems**
15
+ - **Purpose**: Prove worker is alive and making progress
16
+ - **Frequency**: Periodic (e.g., every 30s) OR event-driven (on significant state changes)
17
+ - **Lightweight requirement**: Must not add >5% overhead to worker execution
18
+ - **Temporal workflow pattern**: Activities heartbeat with progress details, allowing resume from last checkpoint
19
+
20
+ **3. Agent Orchestration Best Practices (Azure Foundry, AWS Bedrock)**
21
+ - **Standardized telemetry**: Cross-agent communication requires uniform logging schema
22
+ - **Structured logging**: Use consistent format for parsing (timestamps, agent ID, event type, context)
23
+ - **Real-time visibility**: Orchestrators need live visibility into agent state for debugging and optimization
24
+ - **Multi-agent tracking**: When agents run in parallel, individual agent traces prevent "black box" problem
25
+
26
+ **4. Async Process Observability (OpenTelemetry patterns)**
27
+ - **Context propagation**: Pass context (trace IDs, metadata) across async boundaries
28
+ - **Live dashboards**: Observers monitor in-flight operations via continuously updated logs
29
+ - **Sampling strategies**: Not every event needs logging (sample by importance/frequency)
30
+ - **Cardinality control**: Too many unique log entries = cost explosion (balance detail vs. overhead)
31
+
32
+ **5. Key Insight: "Seeing is Knowing"**
33
+ Microsoft Foundry's core principle: "Ensuring reliability, safety, and performance of AI agents is critical. That's where agent observability comes in." Without visibility into what agents are doing during execution, you cannot:
34
+ - Debug failures effectively (what was tried?)
35
+ - Optimize performance (where are bottlenecks?)
36
+ - Prove ROI (what actually happened?)
37
+ - Resume from failure (what state was reached?)
38
+
39
+ ### Current Gap in The Grid
40
+
41
+ Master Control is **blind during execution**. Programs spawn, MC waits, programs return. Between spawn and return:
42
+ - No progress indicators
43
+ - No discovery visibility
44
+ - No bottleneck detection
45
+ - No real-time course correction
46
+
47
+ The scratchpad exists (`.grid/SCRATCHPAD.md`) but is **optional**. In the last build, Executors didn't use it. Result: MC couldn't see what was happening.
48
+
49
+ ---
50
+
51
+ ## Current Protocol
52
+
53
+ From `mc.md` (lines 427-458):
54
+
55
+ ```markdown
56
+ ## SCRATCHPAD PROTOCOL
57
+
58
+ **Live discoveries during execution.**
59
+
60
+ `.grid/SCRATCHPAD.md` - Programs write here during execution, not just at end.
61
+
62
+ ### Structure
63
+ ```markdown
64
+ ---
65
+ updated: {ISO timestamp}
66
+ active_programs: [executor-01, executor-02]
67
+ ---
68
+
69
+ ## Live Discoveries
70
+
71
+ ### executor-01 (14:32:05)
72
+ Found: Database connection string is in .env.local, not .env
73
+ Impact: Other programs need to know this
74
+
75
+ ### executor-02 (14:32:18)
76
+ Found: The User model has a deprecated 'name' field, use 'displayName'
77
+ Impact: All user queries should use displayName
78
+
79
+ ### executor-01 (14:33:42)
80
+ Correction: Actually .env.local only for development, .env for both
81
+ ```
82
+
83
+ ### Usage
84
+ - **Write** when discovering something other Programs need
85
+ - **Read** before starting execution
86
+ - **Clear** after wave completes (archive to SCRATCHPAD_ARCHIVE.md)
87
+ ```
88
+
89
+ **Problems with current protocol:**
90
+ 1. **Permissive language**: "write when discovering" = optional
91
+ 2. **No enforcement**: No mechanism to ensure Programs actually write
92
+ 3. **No monitoring**: MC doesn't actively read scratchpad during execution
93
+ 4. **Unclear triggers**: "When discovering" is subjective - what qualifies?
94
+ 5. **No structure enforcement**: Format shown but not validated
95
+ 6. **No cleanup spec**: "Archive after wave completes" but how?
96
+
97
+ ---
98
+
99
+ ## Proposed Changes
100
+
101
+ ### Change 1: Make Scratchpad Writing Expected, Not Optional
102
+
103
+ **Before:**
104
+ ```markdown
105
+ ### Usage
106
+ - **Write** when discovering something other Programs need
107
+ - **Read** before starting execution
108
+ - **Clear** after wave completes (archive to SCRATCHPAD_ARCHIVE.md)
109
+ ```
110
+
111
+ **After:**
112
+ ```markdown
113
+ ### Mandatory Writing Rules
114
+
115
+ Executors MUST write to scratchpad in these situations:
116
+
117
+ 1. **On unexpected codebase patterns** (WRITE IMMEDIATELY)
118
+ - File structure differs from assumption (e.g., barrel exports discovered)
119
+ - Naming conventions found (e.g., use displayName not name)
120
+ - API patterns (e.g., req.json() not req.body)
121
+ - Configuration locations (e.g., .env vs .env.local)
122
+
123
+ 2. **On decisions affecting other areas** (WRITE BEFORE COMMITTING)
124
+ - Choosing library A over B (rationale matters for other agents)
125
+ - Schema changes (other agents querying same tables)
126
+ - API contract changes (other agents calling these endpoints)
127
+ - File/folder structure changes (other agents importing these files)
128
+
129
+ 3. **On finding blockers or gotchas** (WRITE IMMEDIATELY)
130
+ - Missing dependencies
131
+ - Authentication requirements
132
+ - Rate limits or quotas
133
+ - External service configuration needs
134
+
135
+ 4. **On long-running work** (WRITE EVERY 5 MINUTES)
136
+ - Progress heartbeat: "Still working on X, 60% complete, no blockers"
137
+ - Prevents MC from thinking agent died
138
+ - Allows User to see progress in real-time
139
+
140
+ **Failure to write = protocol violation.** If Recognizer finds an Executor didn't document a discovered pattern that caused issues for later work, that's a verification failure.
141
+
142
+ ### Usage
143
+ - **Write** following the rules above (mandatory)
144
+ - **Read** before starting execution (check what others learned)
145
+ - **Monitor** by MC during execution (check every 30s for updates)
146
+ - **Archive** after wave completes (move to SCRATCHPAD_ARCHIVE.md with timestamp)
147
+ ```
148
+
149
+ ### Change 2: Add Structured Entry Format
150
+
151
+ **Before:**
152
+ (No format specification beyond example)
153
+
154
+ **After:**
155
+ ```markdown
156
+ ### Entry Format
157
+
158
+ Each scratchpad entry MUST follow this structure:
159
+
160
+ ```
161
+ ### {program-id} | {ISO-timestamp} | {category}
162
+
163
+ **Finding:** {What was discovered, in one clear sentence}
164
+
165
+ **Impact:** {Who needs to know this / what areas affected}
166
+
167
+ **Action:** [INFORM_ONLY | REQUIRES_CHANGE | BLOCKER]
168
+
169
+ **Details:**
170
+ {Additional context, code snippets, file paths}
171
+ ```
172
+
173
+ **Categories:**
174
+ - `PATTERN` - Codebase pattern discovered
175
+ - `DECISION` - Decision made affecting other work
176
+ - `BLOCKER` - Blocking issue found
177
+ - `PROGRESS` - Heartbeat progress update
178
+ - `CORRECTION` - Correcting a previous entry
179
+
180
+ **Example:**
181
+
182
+ ```
183
+ ### executor-01 | 2026-01-23T14:32:05Z | PATTERN
184
+
185
+ **Finding:** User model uses 'displayName' field, not 'name' (deprecated)
186
+
187
+ **Impact:** Any agent querying User table must use displayName
188
+
189
+ **Action:** INFORM_ONLY
190
+
191
+ **Details:**
192
+ Found in: prisma/schema.prisma line 15
193
+ ```
194
+ @@@name String @deprecated
195
+ displayName String
196
+ ```
197
+ ```
198
+
199
+ ```
200
+ ### executor-02 | 2026-01-23T14:45:12Z | PROGRESS
201
+
202
+ **Finding:** Auth endpoint implementation 60% complete
203
+
204
+ **Impact:** None (progress update)
205
+
206
+ **Action:** INFORM_ONLY
207
+
208
+ **Details:**
209
+ Completed: JWT generation, token validation
210
+ Remaining: Refresh token rotation, logout endpoint
211
+ No blockers. Estimate 10 more minutes.
212
+ ```
213
+ ```
214
+
215
+ ### Change 3: Add MC Monitoring Protocol
216
+
217
+ **Add new section after SCRATCHPAD PROTOCOL:**
218
+
219
+ ```markdown
220
+ ### MC Monitoring During Execution
221
+
222
+ Master Control doesn't just wait for Programs to return. MC actively monitors progress.
223
+
224
+ **After spawning a wave of Programs:**
225
+
226
+ 1. **Start monitoring loop** (every 30 seconds):
227
+ ```python
228
+ import time
229
+ from datetime import datetime, timedelta
230
+
231
+ def monitor_scratchpad_during_wave(active_programs, wave_start_time):
232
+ """Monitor scratchpad for updates while Programs execute."""
233
+ last_check = wave_start_time
234
+ max_silence = timedelta(minutes=10) # Alert if no updates for 10 min
235
+
236
+ while programs_still_running(active_programs):
237
+ time.sleep(30) # Check every 30 seconds
238
+
239
+ scratchpad = read(".grid/SCRATCHPAD.md")
240
+
241
+ # Parse latest entries
242
+ new_entries = parse_entries_since(scratchpad, last_check)
243
+
244
+ # Display new findings to User
245
+ if new_entries:
246
+ display_live_updates(new_entries)
247
+ last_check = datetime.now()
248
+
249
+ # Check for stalled agents
250
+ for program in active_programs:
251
+ last_update = get_last_update_time(scratchpad, program)
252
+ if datetime.now() - last_update > max_silence:
253
+ alert_user(f"{program} hasn't written in 10 minutes - may be stalled")
254
+ ```
255
+
256
+ 2. **Display live updates to User:**
257
+ ```
258
+ Live Updates from Executors:
259
+ ├─ executor-01 (14:32): Found pattern - using displayName not name
260
+ ├─ executor-02 (14:35): Decision - chose JWT over sessions (performance)
261
+ ├─ executor-01 (14:40): Progress - Auth endpoints 60% done
262
+ └─ executor-03 (14:42): BLOCKER - Missing Stripe API keys
263
+
264
+ [Monitoring continues... CTRL+C to pause]
265
+ ```
266
+
267
+ 3. **Detect blockers and intervene:**
268
+ - If entry marked `BLOCKER`, pause monitoring, ask User for resolution
269
+ - After User responds, append resolution to scratchpad
270
+ - Resume monitoring
271
+
272
+ 4. **Surface to User on completion:**
273
+ ```
274
+ Wave 1 Complete
275
+ ════════════════
276
+
277
+ Key Discoveries (from scratchpad):
278
+ • Codebase uses displayName not name
279
+ • JWT chosen over sessions for performance
280
+ • API routes expect req.json() not req.body
281
+
282
+ Blockers Resolved:
283
+ • Stripe API keys added to .env
284
+
285
+ End of Line.
286
+ ```
287
+ ```
288
+
289
+ ### Change 4: Add Cleanup and Archival Protocol
290
+
291
+ **Add to SCRATCHPAD PROTOCOL section:**
292
+
293
+ ```markdown
294
+ ### Archival After Wave Completion
295
+
296
+ After a wave completes (all Programs in wave returned), MC must archive scratchpad:
297
+
298
+ ```python
299
+ def archive_scratchpad(wave_number, phase, block):
300
+ """Move scratchpad to archive, preserving history."""
301
+
302
+ scratchpad = read(".grid/SCRATCHPAD.md")
303
+
304
+ # Create/append to archive
305
+ archive_path = ".grid/SCRATCHPAD_ARCHIVE.md"
306
+ archive_entry = f"""
307
+ ---
308
+ wave: {wave_number}
309
+ phase: {phase}
310
+ block: {block}
311
+ archived: {datetime.now().isoformat()}
312
+ ---
313
+
314
+ {scratchpad}
315
+
316
+ """
317
+
318
+ if file_exists(archive_path):
319
+ append(archive_path, archive_entry)
320
+ else:
321
+ write(archive_path, archive_entry)
322
+
323
+ # Clear scratchpad for next wave
324
+ write(".grid/SCRATCHPAD.md", """---
325
+ updated: {datetime.now().isoformat()}
326
+ active_programs: []
327
+ ---
328
+
329
+ ## Live Discoveries
330
+
331
+ (Empty - awaiting next wave)
332
+ """)
333
+ ```
334
+
335
+ **Archive structure** (`.grid/SCRATCHPAD_ARCHIVE.md`):
336
+ ```markdown
337
+ # Scratchpad Archive
338
+
339
+ Historical record of live discoveries from all waves.
340
+
341
+ ---
342
+ wave: 1
343
+ phase: 01-foundation
344
+ block: 01
345
+ archived: 2026-01-23T15:00:00Z
346
+ ---
347
+
348
+ ## Live Discoveries
349
+
350
+ ### executor-01 | 2026-01-23T14:32:05Z | PATTERN
351
+ ...
352
+
353
+ ---
354
+ wave: 2
355
+ phase: 01-foundation
356
+ block: 02
357
+ archived: 2026-01-23T15:30:00Z
358
+ ---
359
+
360
+ ## Live Discoveries
361
+
362
+ ### executor-03 | 2026-01-23T15:15:00Z | DECISION
363
+ ...
364
+ ```
365
+
366
+ This preserves full history for debugging and Experience Replay.
367
+ ```
368
+
369
+ ### Change 5: Update Program Spawn Templates
370
+
371
+ **In PROGRAM SPAWNING PROTOCOL section, update Executor spawn template:**
372
+
373
+ **Before:**
374
+ ```python
375
+ Task(
376
+ prompt=f"""
377
+ First, read ~/.claude/agents/grid-executor.md for your role.
378
+
379
+ <state>{state_content}</state>
380
+ <plan>{plan_content}</plan>
381
+
382
+ Execute the plan. Include lessons_learned in your SUMMARY.
383
+ """,
384
+ ...
385
+ )
386
+ ```
387
+
388
+ **After:**
389
+ ```python
390
+ Task(
391
+ prompt=f"""
392
+ First, read ~/.claude/agents/grid-executor.md for your role.
393
+
394
+ <state>{state_content}</state>
395
+ <plan>{plan_content}</plan>
396
+
397
+ <scratchpad_rules>
398
+ You MUST write to .grid/SCRATCHPAD.md during execution:
399
+ 1. On discovering codebase patterns (IMMEDIATELY)
400
+ 2. On making decisions affecting other areas (BEFORE COMMITTING)
401
+ 3. On finding blockers (IMMEDIATELY)
402
+ 4. On long work (EVERY 5 MINUTES as progress heartbeat)
403
+
404
+ Use this format:
405
+ ### {your-program-id} | {ISO-timestamp} | {category}
406
+ **Finding:** {one sentence}
407
+ **Impact:** {who needs to know}
408
+ **Action:** [INFORM_ONLY | REQUIRES_CHANGE | BLOCKER]
409
+ **Details:** {context}
410
+
411
+ Before starting, READ scratchpad to see what other Programs learned.
412
+ </scratchpad_rules>
413
+
414
+ Execute the plan. Include lessons_learned in your SUMMARY.
415
+ """,
416
+ ...
417
+ )
418
+ ```
419
+
420
+ ---
421
+
422
+ ## Rationale
423
+
424
+ ### Why This Is Better
425
+
426
+ **1. Visibility During Execution**
427
+ - **Before:** MC is blind. User sees nothing. Agents might be stalled, duplicating work, or hitting blockers.
428
+ - **After:** MC sees live updates every 30s. User gets real-time progress. Blockers surface immediately.
429
+
430
+ **2. Cross-Agent Knowledge Sharing**
431
+ - **Before:** Agent A discovers pattern, Agent B (running in parallel) doesn't know, repeats discovery or makes wrong assumption.
432
+ - **After:** Agent A writes to scratchpad immediately, Agent B reads before starting, applies knowledge.
433
+
434
+ **3. Failure Recovery**
435
+ - **Before:** Agent fails, retry has no context about what was tried or discovered mid-execution.
436
+ - **After:** Scratchpad captures discoveries up to failure point. Retry agent reads scratchpad, knows what was learned.
437
+
438
+ **4. User Trust**
439
+ - **Before:** Long silence while agents work. User wonders if system crashed.
440
+ - **After:** Live updates every minute. User sees progress, knows system is working.
441
+
442
+ **5. Debuggability**
443
+ - **Before:** After completion, SUMMARY.md has final state. What happened during execution is lost.
444
+ - **After:** SCRATCHPAD_ARCHIVE.md preserves full timeline. Can replay execution to find where things went wrong.
445
+
446
+ **6. Enforcement Without Rigidity**
447
+ - **Before:** Scratchpad was optional → unused.
448
+ - **After:** Clear mandatory rules, but categories allow flexibility (PATTERN vs PROGRESS vs BLOCKER).
449
+
450
+ **7. Lightweight Overhead**
451
+ - Writing scratchpad entries: ~1-2 seconds per entry
452
+ - Reading scratchpad: ~0.5 seconds
453
+ - Total overhead: ~5% of execution time (acceptable per research)
454
+ - Benefit: Massive visibility gain for minimal cost
455
+
456
+ **8. Aligns with Experience Replay**
457
+ - SCRATCHPAD_ARCHIVE.md feeds into Experience Replay (LEARNINGS.md)
458
+ - Patterns discovered in scratchpad → become institutional memory
459
+ - "This project type always has X pattern" emerges from scratchpad history
460
+
461
+ ---
462
+
463
+ ## Edge Cases Considered
464
+
465
+ ### Edge Case 1: Agent Forgets to Write
466
+
467
+ **Symptom:** Executor completes, but scratchpad has no entries from that agent.
468
+
469
+ **Detection:**
470
+ - Recognizer checks SUMMARY.md against scratchpad
471
+ - If SUMMARY mentions discoveries/decisions but scratchpad is empty → flag as protocol violation
472
+
473
+ **Response:**
474
+ ```python
475
+ if executor_completed_but_no_scratchpad_entries(executor_id):
476
+ # Don't fail the build, but note in verification
477
+ add_to_verification_report(f"""
478
+ PROTOCOL VIOLATION: {executor_id} completed without scratchpad entries.
479
+
480
+ Expected: Entries for patterns discovered, decisions made, progress updates.
481
+ Found: No entries.
482
+
483
+ Recommendation: Remind agent of scratchpad rules in retry.
484
+ """)
485
+ ```
486
+
487
+ **Prevention:** Include scratchpad rules directly in every Executor spawn prompt (see Change 5).
488
+
489
+ ### Edge Case 2: Scratchpad Merge Conflicts
490
+
491
+ **Symptom:** Two agents write to scratchpad simultaneously, one overwrites the other.
492
+
493
+ **Solution:** Use append-only pattern with file locking:
494
+ ```python
495
+ def write_scratchpad_entry(program_id, category, finding, impact, action, details):
496
+ """Thread-safe append to scratchpad."""
497
+ import fcntl # File locking
498
+
499
+ entry = f"""
500
+ ### {program_id} | {datetime.now().isoformat()} | {category}
501
+
502
+ **Finding:** {finding}
503
+
504
+ **Impact:** {impact}
505
+
506
+ **Action:** {action}
507
+
508
+ **Details:**
509
+ {details}
510
+
511
+ """
512
+
513
+ scratchpad_path = ".grid/SCRATCHPAD.md"
514
+
515
+ # Lock file, append entry, unlock
516
+ with open(scratchpad_path, 'a') as f:
517
+ fcntl.flock(f.fileno(), fcntl.LOCK_EX) # Exclusive lock
518
+ f.write(entry)
519
+ fcntl.flock(f.fileno(), fcntl.LOCK_UN) # Unlock
520
+ ```
521
+
522
+ **Alternative (simpler):** Each agent writes to its own file initially:
523
+ - `.grid/scratchpad/executor-01.md`
524
+ - `.grid/scratchpad/executor-02.md`
525
+ - `.grid/scratchpad/executor-03.md`
526
+
527
+ MC merges these into SCRATCHPAD.md when reading. No conflicts possible.
528
+
529
+ ### Edge Case 3: Scratchpad Grows Too Large
530
+
531
+ **Symptom:** After 10 waves, scratchpad archive is 50MB, slowing reads.
532
+
533
+ **Solution:**
534
+ 1. **Per-phase archives:** `.grid/archives/phase-01-scratchpad.md`, `.grid/archives/phase-02-scratchpad.md`
535
+ 2. **Compression:** Archive old phases as `.gz` files
536
+ 3. **Rotation:** Keep only last 3 phases in human-readable format
537
+ 4. **Indexing:** Add frontmatter index to archive for fast lookups:
538
+ ```yaml
539
+ ---
540
+ entries_by_category:
541
+ PATTERN: [line 45, line 203, line 567]
542
+ BLOCKER: [line 123]
543
+ DECISION: [line 89, line 234]
544
+ entries_by_program:
545
+ executor-01: [line 45, line 123, line 234]
546
+ executor-02: [line 89, line 203]
547
+ ---
548
+ ```
549
+
550
+ ### Edge Case 4: Agent Writes Too Much (Spam)
551
+
552
+ **Symptom:** Agent writes progress update every 10 seconds instead of every 5 minutes. Scratchpad flooded.
553
+
554
+ **Prevention:**
555
+ 1. **Clear rules:** "EVERY 5 MINUTES" for progress, not "frequently"
556
+ 2. **Rate limiting in template:** Include guidance:
557
+ ```
558
+ Progress updates: Write every 5 minutes IF working >15 minutes on one thread.
559
+ For quick tasks (<15 min), no progress updates needed.
560
+ ```
561
+
562
+ **Detection:** MC monitoring notices same agent writing 20+ PROGRESS entries in 10 minutes.
563
+
564
+ **Response:** Note in post-wave report, adjust rules for next session.
565
+
566
+ ### Edge Case 5: MC Monitoring Adds Latency
567
+
568
+ **Symptom:** MC checking scratchpad every 30s slows down User interaction.
569
+
570
+ **Solution:**
571
+ 1. **Background monitoring:** MC spawns lightweight monitoring in separate thread/process
572
+ 2. **Non-blocking:** Monitoring doesn't block MC from responding to User
573
+ 3. **Async updates:** New scratchpad entries surface to User asynchronously (like a feed)
574
+
575
+ **Implementation:**
576
+ ```python
577
+ # In MC, after spawning wave
578
+ monitor_task = Task(
579
+ prompt=f"""
580
+ You are a scratchpad monitor. Every 30 seconds, read .grid/SCRATCHPAD.md
581
+ and report NEW entries (since your last check).
582
+
583
+ Continue monitoring until .grid/.wave_complete flag file appears.
584
+
585
+ Report format:
586
+ NEW ENTRIES:
587
+ {formatted entries}
588
+ """,
589
+ subagent_type="general-purpose",
590
+ model="haiku", # Lightweight, cheap
591
+ description="Monitor scratchpad during wave execution",
592
+ run_in_background=True # Non-blocking
593
+ )
594
+
595
+ # MC continues other work, monitor reports asynchronously
596
+ ```
597
+
598
+ ### Edge Case 6: Scratchpad Becomes Source of Truth Conflict
599
+
600
+ **Symptom:** Agent writes "Using JWT" in scratchpad, but SUMMARY.md later says "Using sessions". Which is truth?
601
+
602
+ **Hierarchy:**
603
+ 1. **SUMMARY.md = Final Truth** (what was actually done)
604
+ 2. **Scratchpad = Journey Log** (what was discovered/considered during execution)
605
+
606
+ **Rule:** Scratchpad entries are timestamped discoveries. SUMMARY.md is retrospective final state. If conflict, SUMMARY wins, but scratchpad explains why the change happened.
607
+
608
+ **Example:**
609
+ - Scratchpad: "14:30 - DECISION: Choosing JWT for auth"
610
+ - Scratchpad: "14:45 - CORRECTION: JWT refresh rotation is complex, switching to sessions"
611
+ - SUMMARY.md: "Used session-based auth (simpler for this project)"
612
+
613
+ The scratchpad shows the decision journey. SUMMARY shows the outcome.
614
+
615
+ ### Edge Case 7: User Wants to Disable Scratchpad
616
+
617
+ **Symptom:** User finds scratchpad monitoring distracting or unnecessary for simple projects.
618
+
619
+ **Solution:** Add config flag in `.grid/config.json`:
620
+ ```json
621
+ {
622
+ "model_tier": "quality",
623
+ "scratchpad_monitoring": true, // Set to false to disable
624
+ "scratchpad_write_required": true // Set to false to make optional
625
+ }
626
+ ```
627
+
628
+ **When disabled:**
629
+ - Scratchpad still exists, but MC doesn't monitor
630
+ - Executors still encouraged to write, but not enforced
631
+ - No live updates shown to User
632
+
633
+ **Default:** Enabled (monitoring=true, required=true) for maximum visibility.
634
+
635
+ ---
636
+
637
+ ## Implementation Checklist
638
+
639
+ - [ ] Update `mc.md` SCRATCHPAD PROTOCOL section with mandatory rules
640
+ - [ ] Add structured entry format specification
641
+ - [ ] Add MC monitoring protocol section
642
+ - [ ] Add archival protocol section
643
+ - [ ] Update Executor spawn template to include scratchpad rules
644
+ - [ ] Update `grid-executor.md` to include scratchpad writing as core responsibility
645
+ - [ ] Add `.grid/SCRATCHPAD.md` initialization to Grid startup
646
+ - [ ] Add `monitor_scratchpad_during_wave()` function to MC
647
+ - [ ] Add `archive_scratchpad()` function to wave completion
648
+ - [ ] Add config flag for scratchpad monitoring (optional)
649
+ - [ ] Add scratchpad check to Recognizer verification
650
+ - [ ] Update documentation with scratchpad examples
651
+
652
+ ---
653
+
654
+ ## Summary
655
+
656
+ This feature transforms scratchpad from **optional documentation** to **mandatory observability infrastructure**. It gives Master Control real-time visibility into Program execution, enabling:
657
+
658
+ - Live progress updates to User
659
+ - Cross-agent knowledge sharing
660
+ - Faster blocker detection
661
+ - Better failure recovery
662
+ - Full execution history for debugging
663
+ - Input for Experience Replay
664
+
665
+ The implementation is lightweight (5% overhead), enforceable (via Recognizer checks), and aligns with distributed systems observability best practices from OpenTelemetry, Temporal, and Azure Foundry.
666
+
667
+ By making "seeing" mandatory, we make "knowing" inevitable.
668
+
669
+ **End of Line.**
package/README.md CHANGED
@@ -40,12 +40,6 @@ npx the-grid-cc
40
40
  <strong>Works on Mac, Windows, and Linux.</strong>
41
41
  </p>
42
42
 
43
- <br>
44
-
45
- <p align="center">
46
- <img src="assets/terminal.svg" alt="The Grid Terminal" width="700"/>
47
- </p>
48
-
49
43
  ---
50
44
 
51
45
  ## The Problem
@@ -328,6 +322,18 @@ MIT License. See [LICENSE](LICENSE) for details.
328
322
 
329
323
  ---
330
324
 
325
+ ## Star History
326
+
327
+ <a href="https://star-history.com/#JamesWeatherhead/grid&Date">
328
+ <picture>
329
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=JamesWeatherhead/grid&type=Date&theme=dark" />
330
+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=JamesWeatherhead/grid&type=Date" />
331
+ <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=JamesWeatherhead/grid&type=Date" />
332
+ </picture>
333
+ </a>
334
+
335
+ ---
336
+
331
337
  <p align="center">
332
338
  <strong>"I fight for the Users."</strong>
333
339
  <br><br>
@@ -1 +1 @@
1
- 1.7.3
1
+ 1.7.5