the-grid-cc 1.7.2 → 1.7.4

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,112 @@
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>
@@ -1 +1 @@
1
- 1.7.2
1
+ 1.7.4
@@ -19,6 +19,7 @@ COMMANDS
19
19
  /grid:refine Run Refinement Swarm (visual, E2E, personas)
20
20
  /grid:debug Start systematic bug investigation
21
21
  /grid:status Show current Grid state
22
+ /grid:model Configure model selection (opus/sonnet/haiku)
22
23
  /grid:help This help
23
24
 
24
25
  MODES
@@ -26,6 +27,12 @@ MODES
26
27
  GUIDED MC drives, asks only when essential.
27
28
  HANDS ON Collaborative decisions.
28
29
 
30
+ MODEL TIERS
31
+ /grid:model quality Opus for all agents (default, best results)
32
+ /grid:model balanced Sonnet for most (good balance)
33
+ /grid:model budget Haiku where possible (lowest cost)
34
+ /grid:model custom Configure per-agent
35
+
29
36
  REFINEMENT SWARM
30
37
  /grid:refine Full swarm (visual + E2E + personas)
31
38
  /grid:refine visual Screenshot + vision analysis only
@@ -169,6 +169,78 @@ def spawn_count(plan):
169
169
 
170
170
  ---
171
171
 
172
+ ## QUICK MODE DETECTION
173
+
174
+ **For trivial builds, skip planning ceremony.**
175
+
176
+ Before spawning Planner, analyze the request for quick mode eligibility. If ALL conditions pass, auto-invoke `/grid:quick` instead.
177
+
178
+ ### Detection Heuristics
179
+
180
+ | Heuristic | Threshold | Rationale |
181
+ |-----------|-----------|-----------|
182
+ | **File count** | ≤ 5 files | Below spawn overhead threshold |
183
+ | **Block structure** | Single block only | No dependency coordination needed |
184
+ | **Checkpoints** | None required | Can run to completion |
185
+ | **Ambiguity** | Requirements clear | No discovery phase needed |
186
+ | **No architecture** | No schema/DB changes | Avoid risky auto-decisions |
187
+
188
+ ```python
189
+ def should_use_quick_mode(request: str, codebase_context: dict) -> tuple[bool, str]:
190
+ """Returns: (use_quick_mode, reason)"""
191
+
192
+ # RULE 1: File count threshold
193
+ estimated_files = infer_file_count(request, codebase_context)
194
+ if estimated_files > 5:
195
+ return False, f"Estimated {estimated_files} files (threshold: 5)"
196
+
197
+ # RULE 2: Single block structure
198
+ if any(kw in request.lower() for kw in ["then", "after", "once", "multi-step"]):
199
+ return False, "Multi-phase work detected"
200
+
201
+ # RULE 3: No checkpoints
202
+ checkpoint_keywords = ["deploy", "test manually", "verify in browser", "2FA", "email"]
203
+ if any(kw in request.lower() for kw in checkpoint_keywords):
204
+ return False, "Checkpoint likely required"
205
+
206
+ # RULE 4: Clear requirements (ambiguity < 0.6)
207
+ if measure_ambiguity(request) > 0.6:
208
+ return False, "Requirements too ambiguous"
209
+
210
+ # RULE 5: No architectural changes
211
+ architecture_keywords = ["database", "schema", "migration", "new table", "auth system"]
212
+ if any(kw in request.lower() for kw in architecture_keywords):
213
+ return False, "Architectural changes detected"
214
+
215
+ return True, f"Quick mode eligible: {estimated_files} files, clear scope"
216
+ ```
217
+
218
+ ### User Override
219
+
220
+ After detection, show decision:
221
+ ```
222
+ QUICK MODE DETECTED
223
+ ═══════════════════
224
+
225
+ Analysis: 2 files, single block, clear scope
226
+ Proceeding with /grid:quick for faster execution.
227
+
228
+ (Say "use full grid" if you want formal planning instead)
229
+ ```
230
+
231
+ If User says "use full grid", respect the override immediately.
232
+
233
+ ### Complexity Escalation
234
+
235
+ If quick mode executor discovers higher complexity during execution:
236
+ - More than 5 files actually need changes
237
+ - Architectural decisions required
238
+ - Checkpoints unavoidable
239
+
240
+ **STOP and escalate** back to MC with partial work. MC spawns Planner for remaining complexity.
241
+
242
+ ---
243
+
172
244
  ## PROGRAM SPAWNING PROTOCOL
173
245
 
174
246
  ### Available Programs
@@ -222,6 +294,74 @@ Task(
222
294
  )
223
295
  ```
224
296
 
297
+ ### Plan-Execute Direct Pipeline
298
+
299
+ **Planner returns structured plan data.** MC receives plans directly in memory, no re-reading from disk.
300
+
301
+ **Planner completion format:**
302
+ ```yaml
303
+ ## PLANNING COMPLETE
304
+
305
+ cluster: {name}
306
+ total_blocks: {N}
307
+ total_waves: {M}
308
+
309
+ plans:
310
+ - id: "01"
311
+ path: ".grid/phases/01-foundation/01-PLAN.md"
312
+ wave: 1
313
+ depends_on: []
314
+ autonomous: true
315
+ files_modified: [list]
316
+ objective: "{brief objective}"
317
+
318
+ frontmatter: {full YAML frontmatter}
319
+ content: |
320
+ <objective>...</objective>
321
+ <context>...</context>
322
+ <threads>...</threads>
323
+
324
+ wave_structure:
325
+ 1: ["01", "02"]
326
+ 2: ["03"]
327
+ ```
328
+
329
+ **MC workflow:**
330
+ ```python
331
+ # Step 1: Spawn Planner
332
+ planner_result = Task(prompt="...", ...)
333
+
334
+ # Step 2: Parse plan data (already in memory!)
335
+ plan_data = parse_yaml(planner_result)
336
+
337
+ # Step 3: Execute by wave (no file reads needed!)
338
+ for wave_num in sorted(plan_data['wave_structure'].keys()):
339
+ for plan_id in plan_data['wave_structure'][wave_num]:
340
+ plan = get_plan_by_id(plan_data['plans'], plan_id)
341
+
342
+ Task(
343
+ prompt=f"""
344
+ First, read ~/.claude/agents/grid-executor.md for your role.
345
+
346
+ <plan>
347
+ ---
348
+ {plan['frontmatter']}
349
+ ---
350
+ {plan['content']}
351
+ </plan>
352
+
353
+ Execute the plan.
354
+ """,
355
+ ...
356
+ )
357
+ ```
358
+
359
+ **Benefits:**
360
+ - Zero file reads between planning and execution
361
+ - MC has all plan metadata immediately
362
+ - Wave execution begins instantly after planning
363
+ - Files still written by Planner (for persistence/audit)
364
+
225
365
  ### Parallel Spawning (BatchTool Pattern)
226
366
 
227
367
  **To spawn Programs in parallel, issue multiple Task() calls in a SINGLE message.**
@@ -235,18 +375,37 @@ Task(prompt="...", subagent_type="general-purpose", description="Execute plan 03
235
375
 
236
376
  The Task tool blocks until ALL complete. No polling needed.
237
377
 
238
- ### Wave-Based Execution
378
+ ### Wave-Based Execution with Auto-Verification
239
379
 
240
- Plans are assigned **wave numbers** during planning (not execution). Execute waves sequentially, plans within each wave in parallel:
380
+ Plans are assigned **wave numbers** during planning. Execute waves sequentially, with **automatic verification** after each wave:
241
381
 
242
382
  ```
243
- WAVE 1: [plan-01, plan-02] → Spawn both in parallel
244
- (wait for completion)
245
- WAVE 2: [plan-03] → Spawn after Wave 1
246
- (wait for completion)
247
- WAVE 3: [plan-04, plan-05] → Spawn both in parallel
383
+ WAVE 1: [plan-01, plan-02]
384
+ ├─ Spawn Executors (parallel)
385
+ ├─ Wait for completion
386
+ ├─ Auto-spawn Recognizer (wave-level verification)
387
+ └─ If GAPS_FOUND → Spawn Planner --gaps
388
+
389
+ WAVE 2: [plan-03]
390
+ ├─ Spawn Executor
391
+ ├─ Wait for completion
392
+ ├─ Auto-spawn Recognizer
393
+ └─ If CLEAR → Proceed
394
+
395
+ WAVE 3: [plan-04, plan-05]
396
+ ├─ Spawn Executors (parallel)
397
+ ├─ Wait for completion
398
+ └─ Auto-spawn Recognizer
248
399
  ```
249
400
 
401
+ **Verification Timing:** Wave-level, not plan-level. This prevents redundant checks on interdependent plans.
402
+
403
+ **Verification Skipped When:**
404
+ - Executor returned CHECKPOINT (incomplete work)
405
+ - Executor returned FAILURE (broken state)
406
+ - Plan frontmatter has `verify: false`
407
+ - User said "skip verification"
408
+
250
409
  Read wave numbers from plan frontmatter:
251
410
  ```yaml
252
411
  ---
@@ -259,20 +418,48 @@ depends_on: []
259
418
 
260
419
  ### Model Routing
261
420
 
262
- Route different Programs to different models based on task complexity:
421
+ **Default: QUALITY tier (Opus for all agents)**
422
+
423
+ Check `.grid/config.json` for user model preferences. Users can configure via `/grid:model`.
263
424
 
264
425
  | Program | Quality | Balanced | Budget |
265
426
  |---------|---------|----------|--------|
266
427
  | Planner | opus | sonnet | sonnet |
267
428
  | Executor | opus | sonnet | sonnet |
268
- | Recognizer | sonnet | sonnet | haiku |
429
+ | Recognizer | opus | sonnet | haiku |
430
+ | Visual Inspector | opus | sonnet | haiku |
431
+ | E2E Exerciser | opus | sonnet | haiku |
432
+ | Persona Simulator | opus | sonnet | sonnet |
433
+ | Refinement Synth | opus | sonnet | sonnet |
434
+
435
+ **Model Selection Logic:**
436
+ ```python
437
+ def get_model(program_type):
438
+ """Get model based on .grid/config.json or default to opus."""
439
+ try:
440
+ config = json.loads(read(".grid/config.json"))
441
+ tier = config.get("model_tier", "quality")
442
+ except:
443
+ tier = "quality" # Default: Opus
444
+
445
+ if tier == "quality":
446
+ return "opus"
447
+ elif tier == "balanced":
448
+ return "sonnet"
449
+ elif tier == "budget":
450
+ # Some programs need reasoning capability
451
+ if program_type in ["planner", "executor", "persona_simulator"]:
452
+ return "sonnet"
453
+ return "haiku"
454
+ return "opus"
455
+ ```
269
456
 
270
457
  Pass `model` parameter to Task():
271
458
  ```python
272
459
  Task(
273
460
  prompt="...",
274
461
  subagent_type="general-purpose",
275
- model="sonnet", # or "opus", "haiku"
462
+ model="opus", # Default: quality tier
276
463
  description="..."
277
464
  )
278
465
  ```
@@ -0,0 +1,188 @@
1
+ # /grid:model - Configure Model Selection
2
+
3
+ ---
4
+ name: grid:model
5
+ description: Configure which Claude model to use for Grid agents
6
+ allowed-tools:
7
+ - Read
8
+ - Write
9
+ - Edit
10
+ - Bash
11
+ - AskUserQuestion
12
+ ---
13
+
14
+ Configure which Claude models The Grid uses for its agents.
15
+
16
+ ## USAGE
17
+
18
+ ```
19
+ /grid:model # Show current config + options
20
+ /grid:model quality # Use Opus for everything (best results, highest cost)
21
+ /grid:model balanced # Use Sonnet for most tasks (good balance)
22
+ /grid:model budget # Use Haiku where possible (lowest cost)
23
+ /grid:model custom # Configure per-agent models
24
+ ```
25
+
26
+ ## MODEL TIERS
27
+
28
+ ### QUALITY (Default)
29
+ All agents use **Opus** - best reasoning, highest quality output.
30
+
31
+ | Agent | Model |
32
+ |-------|-------|
33
+ | Planner | opus |
34
+ | Executor | opus |
35
+ | Recognizer | opus |
36
+ | Visual Inspector | opus |
37
+ | E2E Exerciser | opus |
38
+ | Persona Simulator | opus |
39
+
40
+ **Best for:** Complex projects, production code, when quality matters most.
41
+ **Cost:** ~3-5x more than Balanced.
42
+
43
+ ### BALANCED
44
+ Most agents use **Sonnet** - good reasoning, moderate cost.
45
+
46
+ | Agent | Model |
47
+ |-------|-------|
48
+ | Planner | sonnet |
49
+ | Executor | sonnet |
50
+ | Recognizer | sonnet |
51
+ | Visual Inspector | sonnet |
52
+ | E2E Exerciser | sonnet |
53
+ | Persona Simulator | sonnet |
54
+
55
+ **Best for:** Most projects, good quality/cost tradeoff.
56
+ **Cost:** Baseline.
57
+
58
+ ### BUDGET
59
+ Use **Haiku** where possible, Sonnet for complex reasoning.
60
+
61
+ | Agent | Model |
62
+ |-------|-------|
63
+ | Planner | sonnet (needs reasoning) |
64
+ | Executor | sonnet (needs reasoning) |
65
+ | Recognizer | haiku |
66
+ | Visual Inspector | haiku |
67
+ | E2E Exerciser | haiku |
68
+ | Persona Simulator | sonnet (needs reasoning) |
69
+
70
+ **Best for:** Prototypes, learning, cost-sensitive projects.
71
+ **Cost:** ~50-70% less than Balanced.
72
+
73
+ ### CUSTOM
74
+ Set each agent individually.
75
+
76
+ ## EXECUTION
77
+
78
+ When user runs `/grid:model`:
79
+
80
+ ### No argument - Show current config
81
+ ```
82
+ MODEL CONFIGURATION
83
+ ═══════════════════
84
+
85
+ Current tier: {tier}
86
+
87
+ | Agent | Model |
88
+ |-------------------|---------|
89
+ | Planner | {model} |
90
+ | Executor | {model} |
91
+ | Recognizer | {model} |
92
+ | Visual Inspector | {model} |
93
+ | E2E Exerciser | {model} |
94
+ | Persona Simulator | {model} |
95
+
96
+ Commands:
97
+ /grid:model quality - Opus for everything
98
+ /grid:model balanced - Sonnet for most
99
+ /grid:model budget - Haiku where possible
100
+ /grid:model custom - Configure individually
101
+
102
+ End of Line.
103
+ ```
104
+
105
+ ### With tier argument - Set tier
106
+ ```python
107
+ # Read or create config
108
+ config_path = ".grid/config.json"
109
+ try:
110
+ config = json.loads(read(config_path))
111
+ except:
112
+ config = {}
113
+
114
+ # Set tier
115
+ config["model_tier"] = tier # "quality" | "balanced" | "budget"
116
+
117
+ # Write config
118
+ write(config_path, json.dumps(config, indent=2))
119
+ ```
120
+
121
+ Display:
122
+ ```
123
+ MODEL TIER SET: {TIER}
124
+ ═════════════════════
125
+
126
+ All Grid agents will now use {tier} models.
127
+
128
+ | Agent | Model |
129
+ |-------------------|---------|
130
+ | Planner | {model} |
131
+ | ... | ... |
132
+
133
+ To change: /grid:model {other_tier}
134
+
135
+ End of Line.
136
+ ```
137
+
138
+ ### Custom mode - Interactive selection
139
+ Use AskUserQuestion to let user pick model for each agent type:
140
+
141
+ ```
142
+ CUSTOM MODEL CONFIGURATION
143
+ ══════════════════════════
144
+
145
+ Select model for each agent type:
146
+ ```
147
+
148
+ Then save to `.grid/config.json`:
149
+ ```json
150
+ {
151
+ "model_tier": "custom",
152
+ "models": {
153
+ "planner": "opus",
154
+ "executor": "sonnet",
155
+ "recognizer": "haiku",
156
+ "visual_inspector": "haiku",
157
+ "e2e_exerciser": "haiku",
158
+ "persona_simulator": "sonnet"
159
+ }
160
+ }
161
+ ```
162
+
163
+ ## CONFIG FILE FORMAT
164
+
165
+ `.grid/config.json`:
166
+ ```json
167
+ {
168
+ "model_tier": "quality",
169
+ "models": {
170
+ "planner": "opus",
171
+ "executor": "opus",
172
+ "recognizer": "opus",
173
+ "visual_inspector": "opus",
174
+ "e2e_exerciser": "opus",
175
+ "persona_simulator": "opus"
176
+ },
177
+ "topology": "hierarchical"
178
+ }
179
+ ```
180
+
181
+ ## RULES
182
+
183
+ 1. Default to "quality" (Opus) if no config exists
184
+ 2. Never use Haiku for Planner/Executor (needs reasoning capability)
185
+ 3. Show cost implications when changing tiers
186
+ 4. Config persists in `.grid/config.json`
187
+
188
+ End of Line.
@@ -127,7 +127,7 @@ Dev server command: {dev_command}
127
127
  Execute visual inspection. Save to .grid/refinement/
128
128
  """,
129
129
  subagent_type="general-purpose",
130
- model="sonnet",
130
+ model="opus", # Default: quality tier
131
131
  description="Visual Inspector"
132
132
  )
133
133
 
@@ -141,7 +141,7 @@ Dev server command: {dev_command}
141
141
  Execute E2E testing. Save to .grid/refinement/
142
142
  """,
143
143
  subagent_type="general-purpose",
144
- model="sonnet",
144
+ model="opus", # Default: quality tier
145
145
  description="E2E Exerciser"
146
146
  )
147
147
 
@@ -162,7 +162,7 @@ Become this persona. Use the product. Report findings.
162
162
  Save to .grid/refinement/personas/{persona.slug}.md
163
163
  """,
164
164
  subagent_type="general-purpose",
165
- model="sonnet",
165
+ model="opus", # Default: quality tier
166
166
  description=f"Persona: {persona.name}"
167
167
  )
168
168
  ```
@@ -196,7 +196,7 @@ Task(
196
196
  Synthesize all findings into .grid/REFINEMENT_PLAN.md
197
197
  """,
198
198
  subagent_type="general-purpose",
199
- model="sonnet",
199
+ model="opus", # Default: quality tier
200
200
  description="Refinement Synthesizer"
201
201
  )
202
202
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "the-grid-cc",
3
- "version": "1.7.2",
3
+ "version": "1.7.4",
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": {