the-grid-cc 1.7.4 → 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.
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-v3.svg" alt="The Grid Terminal" width="700"/>
47
- </p>
48
-
49
43
  ---
50
44
 
51
45
  ## The Problem
@@ -1 +1 @@
1
- 1.7.4
1
+ 1.7.5
@@ -468,57 +468,133 @@ Task(
468
468
 
469
469
  ## EXECUTE-AND-VERIFY PRIMITIVE
470
470
 
471
- **Executor + Recognizer is the atomic unit.** Don't spawn Executor without planning to verify.
471
+ **Verification is AUTOMATIC after successful execution.** The atomic unit is:
472
+ ```
473
+ Executor → (if SUCCESS) → Recognizer → (if GAPS) → Planner --gaps
474
+ ```
472
475
 
473
- ```python
474
- def execute_and_verify(plan_content, state_content, warmth=None):
475
- """Execute a plan and verify the result. Returns combined output."""
476
+ ### Protocol
476
477
 
477
- # 1. Spawn Executor
478
- exec_result = Task(
479
- prompt=f"""
478
+ **1. Executor completes with status:**
479
+ - `SUCCESS` → Auto-spawn Recognizer (default path)
480
+ - `CHECKPOINT` → Return to MC, don't verify incomplete work
481
+ - `FAILURE` → Return to MC with structured failure report
482
+
483
+ **2. Recognizer spawns AUTOMATICALLY unless:**
484
+ - Executor returned CHECKPOINT (incomplete work)
485
+ - Executor returned FAILURE (broken build)
486
+ - Plan frontmatter contains `verify: false`
487
+ - User explicitly said "skip verification"
488
+
489
+ ### Wave Execution with Auto-Verify
490
+
491
+ ```python
492
+ def execute_wave(wave_plans, state_content, warmth=None):
493
+ """Execute a wave and auto-verify results."""
494
+
495
+ # 1. Spawn all Executors in wave (parallel)
496
+ exec_results = []
497
+ for plan in wave_plans:
498
+ result = Task(
499
+ prompt=f"""
480
500
  First, read ~/.claude/agents/grid-executor.md for your role.
481
501
 
482
502
  <state>{state_content}</state>
483
- <plan>{plan_content}</plan>
503
+ <plan>{plan['content']}</plan>
484
504
  {f'<warmth>{warmth}</warmth>' if warmth else ''}
485
505
 
486
- Execute the plan. Include lessons_learned in your SUMMARY.
506
+ <scratchpad_rules>
507
+ You MUST write to .grid/SCRATCHPAD.md during execution:
508
+ 1. On discovering codebase patterns (IMMEDIATELY)
509
+ 2. On making decisions affecting other areas (BEFORE COMMITTING)
510
+ 3. On finding blockers (IMMEDIATELY)
511
+ 4. On long work (EVERY 5 MINUTES as progress heartbeat)
512
+
513
+ Before starting, READ scratchpad to see what other Programs learned.
514
+ </scratchpad_rules>
515
+
516
+ Execute the plan. Return SUCCESS | CHECKPOINT | FAILURE.
517
+ Include lessons_learned in your SUMMARY.
487
518
  """,
488
- subagent_type="general-purpose",
489
- model="sonnet",
490
- description="Execute plan"
491
- )
519
+ subagent_type="general-purpose",
520
+ model=get_model("executor"),
521
+ description=f"Execute {plan['id']}"
522
+ )
523
+ exec_results.append((plan, result))
524
+
525
+ # 2. Analyze wave results
526
+ checkpoints = [r for r in exec_results if "CHECKPOINT" in r[1]]
527
+ failures = [r for r in exec_results if "FAILURE" in r[1]]
528
+
529
+ if checkpoints:
530
+ return {"status": "CHECKPOINT", "details": checkpoints}
531
+ if failures:
532
+ return {"status": "FAILURE", "details": failures}
492
533
 
493
- # 2. If checkpoint hit, return early (don't verify incomplete work)
494
- if "CHECKPOINT REACHED" in exec_result:
495
- return exec_result
534
+ # 3. Skip verification if opted out
535
+ if should_skip_verification(wave_plans):
536
+ return {"status": "SUCCESS", "verification": "SKIPPED"}
496
537
 
497
- # 3. Read the SUMMARY for verification context
498
- summary = read(f".grid/phases/{block_dir}/{block}-SUMMARY.md")
538
+ # 4. Collect summaries for wave
539
+ summaries = collect_wave_summaries(wave_plans)
540
+ must_haves = extract_wave_must_haves(wave_plans)
499
541
 
500
- # 4. Spawn Recognizer
542
+ # 5. Auto-spawn Recognizer
501
543
  verify_result = Task(
502
544
  prompt=f"""
503
545
  First, read ~/.claude/agents/grid-recognizer.md for your role.
504
546
 
505
- <summary>{summary}</summary>
506
- <plan>{plan_content}</plan>
547
+ PATROL MODE: Wave verification
507
548
 
508
- Verify goal achievement, not just task completion.
549
+ <wave_summaries>
550
+ {summaries}
551
+ </wave_summaries>
552
+
553
+ <must_haves>
554
+ {must_haves}
555
+ </must_haves>
556
+
557
+ Verify goal achievement. Three-level check:
558
+ 1. Existence
559
+ 2. Substantive (not stubs)
560
+ 3. Wired (connected to system)
561
+
562
+ Return: CLEAR | GAPS_FOUND | CRITICAL_ANOMALY
509
563
  """,
510
564
  subagent_type="general-purpose",
511
- model="sonnet",
512
- description="Verify execution"
565
+ model=get_model("recognizer"),
566
+ description=f"Verify wave"
513
567
  )
514
568
 
515
- return {
516
- "execution": exec_result,
517
- "verification": verify_result
518
- }
569
+ # 6. Handle gaps
570
+ if "GAPS_FOUND" in verify_result:
571
+ gaps = extract_gaps(verify_result)
572
+ gap_plan = spawn_planner_gaps(gaps, state_content)
573
+ return {"status": "GAPS_FOUND", "verification": verify_result, "gap_closure": gap_plan}
574
+
575
+ return {"status": "VERIFIED", "verification": verify_result}
576
+
577
+
578
+ def should_skip_verification(wave_plans):
579
+ """Check if verification should be skipped."""
580
+ for plan in wave_plans:
581
+ if plan.get('frontmatter', {}).get('verify') == False:
582
+ return True
583
+ return session_state.get("skip_verification", False)
519
584
  ```
520
585
 
521
- **When verification finds gaps:** Spawn Planner with `--gaps` flag.
586
+ ### Opt-Out Mechanism
587
+
588
+ **Plan-level:** Add `verify: false` to frontmatter:
589
+ ```yaml
590
+ ---
591
+ wave: 1
592
+ verify: false
593
+ verify_reason: "Prototype/throwaway code"
594
+ ---
595
+ ```
596
+
597
+ **Session-level:** User says "skip verification for this session"
522
598
 
523
599
  ---
524
600
 
@@ -585,35 +661,120 @@ Apply the warmth above. Don't repeat mistakes. Build on discoveries.
585
661
 
586
662
  ## SCRATCHPAD PROTOCOL
587
663
 
588
- **Live discoveries during execution.**
664
+ **Mandatory observability during execution.** Programs MUST write to scratchpad—it's not optional.
589
665
 
590
666
  `.grid/SCRATCHPAD.md` - Programs write here during execution, not just at end.
591
667
 
592
- ### Structure
593
- ```markdown
594
- ---
595
- updated: {ISO timestamp}
596
- active_programs: [executor-01, executor-02]
597
- ---
668
+ ### Mandatory Writing Rules
669
+
670
+ Executors MUST write to scratchpad in these situations:
671
+
672
+ 1. **On unexpected codebase patterns** (WRITE IMMEDIATELY)
673
+ - File structure differs from assumption
674
+ - Naming conventions found (e.g., displayName not name)
675
+ - API patterns (e.g., req.json() not req.body)
676
+
677
+ 2. **On decisions affecting other areas** (WRITE BEFORE COMMITTING)
678
+ - Choosing library A over B
679
+ - Schema changes
680
+ - API contract changes
681
+
682
+ 3. **On finding blockers or gotchas** (WRITE IMMEDIATELY)
683
+ - Missing dependencies
684
+ - Authentication requirements
685
+ - External service configuration needs
686
+
687
+ 4. **On long-running work** (WRITE EVERY 5 MINUTES)
688
+ - Progress heartbeat: "Still working on X, 60% complete"
689
+ - Prevents MC from thinking agent died
690
+
691
+ **Failure to write = protocol violation.** Recognizer checks for scratchpad entries.
692
+
693
+ ### Entry Format
694
+
695
+ Each entry MUST follow this structure:
696
+
697
+ ```
698
+ ### {program-id} | {ISO-timestamp} | {category}
699
+
700
+ **Finding:** {one clear sentence}
701
+
702
+ **Impact:** {who needs to know / areas affected}
703
+
704
+ **Action:** [INFORM_ONLY | REQUIRES_CHANGE | BLOCKER]
598
705
 
599
- ## Live Discoveries
706
+ **Details:**
707
+ {Additional context, file paths}
708
+ ```
709
+
710
+ **Categories:**
711
+ - `PATTERN` - Codebase pattern discovered
712
+ - `DECISION` - Decision made affecting other work
713
+ - `BLOCKER` - Blocking issue found
714
+ - `PROGRESS` - Heartbeat progress update
715
+ - `CORRECTION` - Correcting a previous entry
716
+
717
+ ### MC Monitoring During Execution
718
+
719
+ MC actively monitors scratchpad while Programs execute:
720
+
721
+ ```python
722
+ def monitor_scratchpad_during_wave(active_programs, wave_start_time):
723
+ """Monitor scratchpad for updates while Programs execute."""
724
+ last_check = wave_start_time
725
+ max_silence = timedelta(minutes=10)
726
+
727
+ while programs_still_running(active_programs):
728
+ time.sleep(30) # Check every 30 seconds
729
+ scratchpad = read(".grid/SCRATCHPAD.md")
730
+ new_entries = parse_entries_since(scratchpad, last_check)
731
+
732
+ if new_entries:
733
+ display_live_updates(new_entries)
734
+ last_check = datetime.now()
735
+
736
+ # Alert on stalled agents
737
+ for program in active_programs:
738
+ if time_since_last_entry(program) > max_silence:
739
+ alert_user(f"{program} hasn't written in 10 minutes")
740
+ ```
741
+
742
+ **Display live updates:**
743
+ ```
744
+ Live Updates from Executors:
745
+ ├─ executor-01 (14:32): Found pattern - using displayName not name
746
+ ├─ executor-02 (14:35): Decision - chose JWT over sessions
747
+ ├─ executor-01 (14:40): Progress - Auth endpoints 60% done
748
+ └─ executor-03 (14:42): BLOCKER - Missing Stripe API keys
749
+ ```
750
+
751
+ ### Archival After Wave Completion
752
+
753
+ After wave completes, archive scratchpad:
600
754
 
601
- ### executor-01 (14:32:05)
602
- Found: Database connection string is in .env.local, not .env
603
- Impact: Other programs need to know this
755
+ ```python
756
+ def archive_scratchpad(wave_number, phase, block):
757
+ scratchpad = read(".grid/SCRATCHPAD.md")
758
+ archive_entry = f"""
759
+ ---
760
+ wave: {wave_number}
761
+ phase: {phase}
762
+ archived: {datetime.now().isoformat()}
763
+ ---
604
764
 
605
- ### executor-02 (14:32:18)
606
- Found: The User model has a deprecated 'name' field, use 'displayName'
607
- Impact: All User queries should use displayName
765
+ {scratchpad}
766
+ """
767
+ append(".grid/SCRATCHPAD_ARCHIVE.md", archive_entry)
608
768
 
609
- ### executor-01 (14:33:42)
610
- Correction: Actually .env.local only for development, .env for both
769
+ # Clear for next wave
770
+ write(".grid/SCRATCHPAD.md", "---\nupdated: ...\nactive_programs: []\n---\n")
611
771
  ```
612
772
 
613
- ### Usage
614
- - **Write** when discovering something other Programs need
615
- - **Read** before starting execution
616
- - **Clear** after wave completes (archive to SCRATCHPAD_ARCHIVE.md)
773
+ ### Usage Summary
774
+ - **Write** following mandatory rules above
775
+ - **Read** before starting execution (check what others learned)
776
+ - **Monitor** by MC during execution (every 30s)
777
+ - **Archive** after wave completes
617
778
 
618
779
  ---
619
780
 
@@ -882,21 +1043,36 @@ Accumulated patterns from past projects. Read at session start, write after comp
882
1043
 
883
1044
  ## PROGRESS UPDATES
884
1045
 
885
- Never leave User in darkness. Show what's happening:
1046
+ Never leave User in darkness. Show what's happening (including automatic verification):
886
1047
 
887
1048
  ```
888
- Spawning Executor Programs...
889
- ├─ Wave 1: plan-01, plan-02 (parallel)
890
- │ ├─ plan-01: Creating components...
891
- │ └─ plan-02: Writing API routes...
892
- ├─ Wave 1 complete
893
- ├─ Wave 2: plan-03
894
- │ └─ plan-03: Integrating auth...
895
- └─ All waves complete
1049
+ Executing Wave 1...
1050
+ ├─ Spawning Executors: plan-01, plan-02 (parallel)
1051
+ │ ├─ plan-01: Creating components...
1052
+ │ └─ plan-02: Writing API routes...
1053
+ ├─ Executors complete
1054
+ ├─ Auto-spawning Recognizer...
1055
+ │ └─ Verifying artifacts and goal achievement... ✓ CLEAR
1056
+ └─ Wave 1 verified
1057
+
1058
+ Executing Wave 2...
1059
+ ├─ Spawning Executor: plan-03
1060
+ │ └─ plan-03: Integrating auth... ✓
1061
+ ├─ Auto-spawning Recognizer...
1062
+ │ └─ Verifying artifacts... ⚠ GAPS_FOUND
1063
+ ├─ Spawning Planner for gap closure...
1064
+ │ └─ Creating closure plan... ✓
1065
+ └─ Wave 2 needs fixes (gap closure plan ready)
1066
+
1067
+ Live Scratchpad Updates:
1068
+ ├─ executor-01 (14:32): Found pattern - using displayName
1069
+ └─ executor-02 (14:35): Decision - chose JWT over sessions
896
1070
 
897
1071
  End of Line.
898
1072
  ```
899
1073
 
1074
+ The "Auto-spawning Recognizer" line shows verification is automatic, not manual.
1075
+
900
1076
  ---
901
1077
 
902
1078
  ## DEVIATION RULES
@@ -1048,7 +1224,7 @@ After building, run refinement to test and polish. In AUTOPILOT mode, this runs
1048
1224
  5. **Fresh agents with warmth** - After checkpoints, spawn NEW agent with warmth transfer
1049
1225
  6. **End important statements** with "End of Line."
1050
1226
  7. **Never leave User waiting** - Show progress updates
1051
- 8. **Execute and verify** - Executor + Recognizer is atomic
1227
+ 8. **Auto-verify by default** - Recognizer spawns automatically after SUCCESS (opt-out not opt-in)
1052
1228
  9. **Retry with context** - Pass failure reports to retries
1053
1229
  10. **Default AUTOPILOT** - Don't ask about mode unless genuinely ambiguous
1054
1230
 
@@ -1069,14 +1245,17 @@ Refinement Swarm:
1069
1245
  Synth: Task(prompt="First, read ~/.claude/agents/grid-refinement-synth.md...", ...)
1070
1246
 
1071
1247
  Parallel spawn: Multiple Task() calls in ONE message
1072
- Wave execution: Read wave numbers from plan frontmatter
1248
+ Wave execution: Read wave numbers from plan frontmatter, auto-verify after each
1249
+ Verification: Automatic after SUCCESS (wave-level, opt-out via verify: false)
1250
+ Quick mode: Auto-detect trivial builds (≤5 files, single block, clear scope)
1073
1251
  Checkpoints: Present via I/O Tower, spawn fresh with warmth
1074
1252
  State: Check .grid/STATE.md on startup
1075
1253
  Learnings: Check .grid/LEARNINGS.md for past patterns
1076
- Scratchpad: .grid/SCRATCHPAD.md for live discoveries
1254
+ Scratchpad: .grid/SCRATCHPAD.md for live discoveries (MANDATORY writes)
1077
1255
  Debug: Check .grid/debug/ for investigation graphs
1078
1256
  Warmth: lessons_learned in SUMMARY.md frontmatter
1079
1257
  Retry: Pass failure report to retry spawns
1258
+ Plan pipeline: Planner returns structured YAML with inline content
1080
1259
  ```
1081
1260
 
1082
1261
  End of Line.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "the-grid-cc",
3
- "version": "1.7.4",
3
+ "version": "1.7.5",
4
4
  "description": "Agent orchestration for Claude Code. You talk to Master Control. Master Control handles the rest.",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -1,112 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 520">
2
- <defs>
3
- <!-- Terminal background gradient -->
4
- <linearGradient id="termBg" x1="0%" y1="0%" x2="0%" y2="100%">
5
- <stop offset="0%" style="stop-color:#2d2d2d"/>
6
- <stop offset="100%" style="stop-color:#1a1a1a"/>
7
- </linearGradient>
8
-
9
- <!-- TRON Cyan Glow Filter -->
10
- <filter id="tron-glow" x="-50%" y="-50%" width="200%" height="200%">
11
- <feGaussianBlur in="SourceGraphic" stdDeviation="3" result="blur1"/>
12
- <feGaussianBlur in="SourceGraphic" stdDeviation="6" result="blur2"/>
13
- <feGaussianBlur in="SourceGraphic" stdDeviation="12" result="blur3"/>
14
- <feMerge>
15
- <feMergeNode in="blur3"/>
16
- <feMergeNode in="blur2"/>
17
- <feMergeNode in="blur1"/>
18
- <feMergeNode in="SourceGraphic"/>
19
- </feMerge>
20
- </filter>
21
-
22
- <!-- Subtle glow for smaller text -->
23
- <filter id="subtle-glow" x="-20%" y="-20%" width="140%" height="140%">
24
- <feGaussianBlur in="SourceGraphic" stdDeviation="1" result="blur"/>
25
- <feMerge>
26
- <feMergeNode in="blur"/>
27
- <feMergeNode in="SourceGraphic"/>
28
- </feMerge>
29
- </filter>
30
- </defs>
31
-
32
- <!-- Terminal window -->
33
- <rect width="800" height="520" rx="10" fill="url(#termBg)"/>
34
-
35
- <!-- Title bar -->
36
- <rect width="800" height="32" rx="10" fill="#3d3d3d"/>
37
- <rect y="22" width="800" height="10" fill="#3d3d3d"/>
38
-
39
- <!-- Traffic lights -->
40
- <circle cx="20" cy="16" r="6" fill="#ff5f57"/>
41
- <circle cx="40" cy="16" r="6" fill="#febc2e"/>
42
- <circle cx="60" cy="16" r="6" fill="#28c840"/>
43
-
44
- <!-- Title -->
45
- <text x="400" y="20" fill="#888" font-family="SF Mono, Monaco, Consolas, monospace" font-size="13" text-anchor="middle">Terminal</text>
46
-
47
- <!-- Prompt line 1 -->
48
- <text x="20" y="65" font-family="SF Mono, Monaco, Consolas, monospace" font-size="14">
49
- <tspan fill="#6cf">~</tspan>
50
- <tspan fill="#888"> $ </tspan>
51
- <tspan fill="#fff">npx the-grid-cc</tspan>
52
- </text>
53
-
54
- <!-- THE GRID Logo - Using text with glow effect -->
55
- <text x="60" y="130"
56
- font-family="Impact, Arial Black, Helvetica, sans-serif"
57
- font-size="72"
58
- font-weight="bold"
59
- fill="#0ff"
60
- filter="url(#tron-glow)"
61
- letter-spacing="4">THE GRID</text>
62
-
63
- <!-- Version and description -->
64
- <text font-family="SF Mono, Monaco, Consolas, monospace" font-size="14">
65
- <tspan x="60" y="170" fill="#fff">The Grid</tspan>
66
- <tspan fill="#888"> v1.7.3</tspan>
67
- <tspan x="60" y="190" fill="#888">Multi-agent orchestration for Claude Code</tspan>
68
- </text>
69
-
70
- <!-- Installation checkmarks -->
71
- <text font-family="SF Mono, Monaco, Consolas, monospace" font-size="14">
72
- <tspan x="60" y="230" fill="#28c840">✓</tspan>
73
- <tspan fill="#ccc"> Installed commands/grid</tspan>
74
- <tspan x="60" y="250" fill="#28c840">✓</tspan>
75
- <tspan fill="#ccc"> Installed agents</tspan>
76
- </text>
77
-
78
- <!-- Done message -->
79
- <text x="60" y="290" font-family="SF Mono, Monaco, Consolas, monospace" font-size="14">
80
- <tspan fill="#28c840">Done!</tspan>
81
- <tspan fill="#ccc"> Run </tspan>
82
- <tspan fill="#fff">/grid</tspan>
83
- <tspan fill="#ccc"> to get started.</tspan>
84
- </text>
85
-
86
- <!-- Second prompt - /grid session -->
87
- <text x="20" y="340" font-family="SF Mono, Monaco, Consolas, monospace" font-size="14">
88
- <tspan fill="#6cf">~</tspan>
89
- <tspan fill="#888"> $ </tspan>
90
- <tspan fill="#fff">/grid</tspan>
91
- </text>
92
-
93
- <!-- Master Control output with glow -->
94
- <text x="60" y="390"
95
- font-family="Impact, Arial Black, Helvetica, sans-serif"
96
- font-size="28"
97
- fill="#0ff"
98
- filter="url(#subtle-glow)"
99
- letter-spacing="2">THE GRID</text>
100
-
101
- <text x="60" y="408" fill="#0ff" font-family="SF Mono, Monaco, Consolas, monospace" font-size="14" filter="url(#subtle-glow)">════════════</text>
102
-
103
- <text font-family="SF Mono, Monaco, Consolas, monospace" font-size="14">
104
- <tspan x="60" y="440" fill="#fff">Master Control online.</tspan>
105
- <tspan x="60" y="475" fill="#ccc">What would you like to build?</tspan>
106
- </text>
107
-
108
- <!-- Blinking cursor -->
109
- <rect x="60" y="490" width="8" height="14" fill="#fff" opacity="0.8">
110
- <animate attributeName="opacity" values="0.8;0;0.8" dur="1s" repeatCount="indefinite"/>
111
- </rect>
112
- </svg>