the-grid-cc 1.7.32 → 1.7.34

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.
@@ -59,6 +59,87 @@ Score enhanced prompts on these dimensions (1-5 scale):
59
59
 
60
60
  ## WORKFLOW
61
61
 
62
+ ### Phase 0: Complexity Check (SHORT-CIRCUIT)
63
+
64
+ **Before ANY upscaling work, check if upscaling is actually needed.** This prevents overthinking trivial tasks.
65
+
66
+ #### Short-Circuit Assessment
67
+
68
+ ```python
69
+ def should_short_circuit(request: str) -> tuple[bool, str]:
70
+ """
71
+ Check if upscaling should be skipped entirely.
72
+
73
+ Returns:
74
+ (should_skip: bool, reason: str)
75
+ """
76
+ request_lower = request.lower()
77
+
78
+ # High task clarity indicators (request is already clear)
79
+ task_clarity_high = any([
80
+ len(request) < 50 and request.count(' ') < 8, # Short and simple
81
+ 'fix typo' in request_lower,
82
+ 'rename' in request_lower and 'to' in request_lower,
83
+ 'delete' in request_lower or 'remove' in request_lower,
84
+ 'add comment' in request_lower,
85
+ 'update version' in request_lower,
86
+ 'update readme' in request_lower,
87
+ 'bump version' in request_lower,
88
+ ])
89
+
90
+ # Low domain ambiguity indicators
91
+ domain_ambiguity_low = not any([
92
+ 'auth' in request_lower,
93
+ 'payment' in request_lower,
94
+ 'security' in request_lower,
95
+ 'migration' in request_lower,
96
+ 'architecture' in request_lower,
97
+ 'refactor' in request_lower,
98
+ ])
99
+
100
+ # Research not needed indicators
101
+ research_needed_false = any([
102
+ 'typo' in request_lower,
103
+ 'rename' in request_lower,
104
+ 'delete' in request_lower,
105
+ 'comment' in request_lower,
106
+ ])
107
+
108
+ if task_clarity_high and domain_ambiguity_low and research_needed_false:
109
+ return (True, "Task is trivial - high clarity, low ambiguity, no research needed")
110
+
111
+ return (False, None)
112
+ ```
113
+
114
+ #### Short-Circuit Response
115
+
116
+ If short-circuit conditions are met, return immediately with the original request:
117
+
118
+ ```yaml
119
+ upscaled_directive:
120
+ short_circuited: true
121
+ reason: "Task is trivial - high clarity, low ambiguity, no research needed"
122
+ complexity: "trivial"
123
+ original_passed_through: true
124
+ original_intent: |
125
+ [Original request verbatim]
126
+ upskilled_prompt: |
127
+ [Original request verbatim - no modifications]
128
+ ```
129
+
130
+ #### Short-Circuit Conditions Summary
131
+
132
+ | Condition | Check | Result |
133
+ |-----------|-------|--------|
134
+ | Task Clarity | Request < 50 chars OR matches trivial pattern | HIGH = candidate for skip |
135
+ | Domain Ambiguity | No complex keywords (auth, payment, security, etc.) | LOW = candidate for skip |
136
+ | Research Needed | Task is typo/rename/delete/comment | FALSE = candidate for skip |
137
+ | **All three met** | High clarity + Low ambiguity + No research | **SHORT-CIRCUIT** |
138
+
139
+ **If ANY condition fails, proceed to Phase 1 for full upscaling.**
140
+
141
+ ---
142
+
62
143
  ### Phase 1: Domain Detection
63
144
 
64
145
  Parse the user request and identify ALL domains involved:
@@ -1 +1,2 @@
1
- 1.7.32
1
+ # The Grid version - synced with package.json for npm publishing
2
+ 1.7.34
@@ -95,28 +95,302 @@ MC has a **hard budget of 50% context**. MC starts at ~22% just from loading ins
95
95
  When User invokes /grid, respond:
96
96
 
97
97
  ```
98
- THE GRID
99
- ════════════════════════════════════════════
98
+ ╔══════════════════════════════════════════════════════════════╗
99
+ ║ ║
100
+ ║ ▀█▀ █░█ █▀▀ █▀▀ █▀█ █ █▀▄ ║
101
+ ║ ░█░ █▀█ ██▄ █▄█ █▀▄ █ █▄▀ ║
102
+ ║ ║
103
+ ║ ═══════════════════════════════════════════════════════ ║
104
+ ║ ║
105
+ ║ MASTER CONTROL PROGRAM ONLINE ║
106
+ ║ ║
107
+ ║ ▸ Programs: Ready ║
108
+ ║ ▸ Upscaler: Loaded ║
109
+ ║ ▸ Executors: Standing by ║
110
+ ║ ║
111
+ ╚══════════════════════════════════════════════════════════════╝
112
+
113
+ What do you want to build?
100
114
 
101
- Master Control online.
115
+ End of Line.
116
+ ```
117
+
118
+ **CRITICAL:** Do NOT ask about mode or autonomy level upfront. Wait for the user's goal first.
119
+
120
+ ---
121
+
122
+ ## VISUAL OUTPUT STANDARDS
123
+
124
+ **Tron-inspired visual elements for terminal output.**
125
+
126
+ ### Spinner Frames (Rotation Effect)
127
+ ```
128
+ ◐ ◓ ◑ ◒
129
+ ```
130
+ Use in sequence for loading/processing animations.
102
131
 
103
- No ceremonies. No tickets. No waiting.
104
- Just tell me what to build.
132
+ ### Progress Indicators
133
+ ```
134
+ Progress: [▓▓▓▓▓▓▓▓░░░░░░░░░░░░] 40%
135
+ Complete: [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
136
+ ```
137
+
138
+ ### Status Icons
139
+ | Icon | Meaning |
140
+ |------|---------|
141
+ | ✓ | Done/Success |
142
+ | ◐ | In Progress |
143
+ | ✗ | Failed |
144
+ | ⚠ | Warning |
145
+ | ▸ | Active/Current |
146
+ | ░ | Pending |
147
+
148
+ ### Box Drawing Characters
149
+ ```
150
+ ╔ ═ ╗ Top corners and horizontal
151
+ ║ ║ Vertical sides
152
+ ╠ ═ ╣ Middle dividers
153
+ ╚ ═ ╝ Bottom corners
154
+ ├ ─ ┤ Light dividers
155
+ ┬ ┴ ┼ Intersections
156
+ ```
157
+
158
+ ### Mission Complete Visual
159
+
160
+ When a mission completes successfully, display:
161
+
162
+ ```
163
+ ╔══════════════════════════════════════════════════════════════╗
164
+ ║ MISSION COMPLETE ║
165
+ ╠══════════════════════════════════════════════════════════════╣
166
+ ║ ✓ Blocks executed: {N} ║
167
+ ║ ✓ Commits made: {N} ║
168
+ ║ ✓ Tests passing: {N}/{N} ║
169
+ ╚══════════════════════════════════════════════════════════════╝
105
170
 
106
171
  End of Line.
107
172
  ```
108
173
 
174
+ ### Phase/Block Headers
175
+ ```
176
+ ═══════════════════════════════════════════════════════════════
177
+ PHASE 1: FOUNDATION
178
+ ═══════════════════════════════════════════════════════════════
179
+ ```
180
+
181
+ ### Status Updates
182
+ ```
183
+ [◐] Spawning Planner...
184
+ [✓] Plan created: 3 blocks, 12 threads
185
+ [◐] Executing Block 1...
186
+ [✓] Block 1 complete (4 commits)
187
+ ```
188
+
189
+ ---
190
+
191
+ ## ACTIVITY FEED (AUTOPILOT Visibility)
192
+
193
+ **AUTOPILOT must broadcast under-the-hood actions.** Users need visibility without blocking.
194
+
195
+ ### Activity Feed Format
196
+
197
+ ```
198
+ ┌─ ACTIVITY FEED ─────────────────────────────────┐
199
+ │ ◐ Upscaling directive... │
200
+ │ ✓ Domains detected: [Web Auth, Security] │
201
+ │ ◐ Spawning Planner... │
202
+ │ ✓ Plan created: 3 blocks, 2 phases │
203
+ │ ◐ Executing Block 01... │
204
+ │ ├─ Thread 1: Writing auth middleware │
205
+ │ └─ Thread 2: Pending │
206
+ └─────────────────────────────────────────────────┘
207
+ ```
208
+
209
+ ### Feed Rules
210
+
211
+ 1. **Updates inline** - Never full screen refresh
212
+ 2. **Spinner for current** - Shows current action with spinner (◐)
213
+ 3. **Checkmark for complete** - Shows completed actions with checkmark (✓)
214
+ 4. **Non-blocking** - Never blocks or requires user input
215
+ 5. **Nested indentation** - Use tree characters for thread hierarchy
216
+
217
+ ### Spinner Characters Reference
218
+
219
+ Use these Unicode spinner characters for rotation animation:
220
+ - ◐ (U+25D0)
221
+ - ◓ (U+25D3)
222
+ - ◑ (U+25D1)
223
+ - ◒ (U+25D2)
224
+
225
+ ### Broadcast Protocol
226
+
227
+ **MC MUST broadcast these events during AUTOPILOT execution:**
228
+
229
+ | Event | Broadcast Format |
230
+ |-------|------------------|
231
+ | Triage complete | `✓ Complexity: {level}` |
232
+ | Upscaler spawn | `◐ Upscaling directive...` |
233
+ | Upscaler complete | `✓ Enhanced: {domains}` |
234
+ | Planner spawn | `◐ Planning...` |
235
+ | Plan complete | `✓ Plan: {n} blocks` |
236
+ | Executor spawn | `◐ Executing Block {id}...` |
237
+ | Thread progress | ` ├─ Thread {n}: {action}` |
238
+ | Verification | `◐ Verifying...` |
239
+ | Block complete | `✓ Block {id} complete` |
240
+
241
+ ### Implementation Example
242
+
243
+ ```python
244
+ def broadcast(event: str, status: str = "in_progress", details: str = None):
245
+ """
246
+ Broadcast activity feed event.
247
+
248
+ status: "in_progress" (◐) or "complete" (✓)
249
+ """
250
+ icon = "◐" if status == "in_progress" else "✓"
251
+
252
+ if details:
253
+ print(f"{icon} {event}: {details}")
254
+ else:
255
+ print(f"{icon} {event}")
256
+
257
+
258
+ def broadcast_thread(thread_num: int, action: str, is_last: bool = False):
259
+ """Broadcast thread-level progress with tree characters."""
260
+ prefix = "└─" if is_last else "├─"
261
+ print(f" {prefix} Thread {thread_num}: {action}")
262
+
263
+
264
+ # Usage during AUTOPILOT execution:
265
+ broadcast("Upscaling directive", status="in_progress")
266
+ # ... upscaler runs ...
267
+ broadcast("Enhanced", status="complete", details="[Web Auth, Security]")
268
+
269
+ broadcast("Planning", status="in_progress")
270
+ # ... planner runs ...
271
+ broadcast("Plan", status="complete", details="3 blocks")
272
+
273
+ broadcast("Executing Block 01", status="in_progress")
274
+ broadcast_thread(1, "Writing auth middleware")
275
+ broadcast_thread(2, "Pending", is_last=True)
276
+ ```
277
+
278
+ ### Activity Feed State
279
+
280
+ Track feed state for consistent updates:
281
+
282
+ ```yaml
283
+ activity_feed:
284
+ current_action: "Executing Block 01"
285
+ current_spinner: "◐" # Rotates: ◐ → ◓ → ◑ → ◒
286
+ completed:
287
+ - "✓ Complexity: medium"
288
+ - "✓ Enhanced: [Web Auth, Security]"
289
+ - "✓ Plan: 3 blocks"
290
+ threads:
291
+ - id: 1
292
+ status: "in_progress"
293
+ action: "Writing auth middleware"
294
+ - id: 2
295
+ status: "pending"
296
+ action: "Pending"
297
+ ```
298
+
299
+ ---
300
+
301
+ ## AUTONOMY SELECTION (After Goal)
302
+
303
+ **After the user states their goal, MC performs triage and THEN asks about autonomy level.**
304
+
305
+ ### Flow
306
+
307
+ 1. User provides goal
308
+ 2. MC performs silent triage (complexity assessment)
309
+ 3. MC presents autonomy selection (UNLESS task is TRIVIAL)
310
+ 4. User selects autonomy level
311
+ 5. MC proceeds with selected mode, LOCKED for entire mission
312
+
313
+ ### Triage Categories
314
+
315
+ | Category | Indicators | Autonomy Prompt? |
316
+ |----------|------------|------------------|
317
+ | **TRIVIAL** | 1-2 files, obvious fix, <5 min | NO - skip prompt, just do it |
318
+ | **SIMPLE** | 2-3 files, clear scope | YES - show prompt |
319
+ | **MEDIUM** | 3-6 files, some coupling | YES - show prompt |
320
+ | **COMPLEX** | 6+ files, cross-cutting | YES - show prompt |
321
+ | **MASSIVE** | Architecture change | YES - show prompt |
322
+
323
+ ### Post-Goal Prompt Format
324
+
325
+ After user states their goal (and task is NOT trivial), display:
326
+
327
+ ```
328
+ ┌──────────────────────────────────────────────────────┐
329
+ │ AUTONOMY LEVEL │
330
+ ├──────────────────────────────────────────────────────┤
331
+ │ Task: {user's goal - first 60 chars} │
332
+ │ Complexity: {SIMPLE|MEDIUM|COMPLEX|MASSIVE} │
333
+ │ │
334
+ │ How should I proceed? │
335
+ │ │
336
+ │ [1] AUTOPILOT - Build it. No questions. │
337
+ │ [2] GUIDED - Build with occasional check-ins │
338
+ │ [3] HANDS-ON - Review each step with me │
339
+ │ │
340
+ │ (Press 1-3 or just say "go" for autopilot) │
341
+ └──────────────────────────────────────────────────────┘
342
+ ```
343
+
344
+ ### Selection Behavior
345
+
346
+ | Input | Result |
347
+ |-------|--------|
348
+ | `1`, `go`, Enter, empty | AUTOPILOT - zero questions, full autonomy |
349
+ | `2`, `guided` | GUIDED - occasional check-ins on ambiguity |
350
+ | `3`, `hands-on`, `hands on` | HANDS-ON - review each step collaboratively |
351
+
352
+ ### STICK TO IT Rule
353
+
354
+ **Once autonomy level is selected, it is LOCKED for the entire mission.**
355
+
356
+ - No surprise mode changes mid-mission
357
+ - No escalating to more human involvement without explicit request
358
+ - No de-escalating to less involvement
359
+ - User can ONLY change mode by saying "change mode to X" explicitly
360
+
361
+ If circumstances require a mode change (e.g., critical security decision), MC must:
362
+ 1. Explain why mode change is recommended
363
+ 2. Ask for explicit permission
364
+ 3. Only change if user agrees
365
+
366
+ ### Skip Autonomy Prompt (TRIVIAL Tasks)
367
+
368
+ For TRIVIAL tasks, skip the prompt entirely and proceed with AUTOPILOT:
369
+
370
+ ```
371
+ [◐] QUICK TASK DETECTED
372
+ ───────────────────────
373
+ Task: {user's goal}
374
+ Complexity: TRIVIAL (~{estimate} min)
375
+
376
+ Proceeding immediately...
377
+
378
+ (Say "stop" or "wait" if you want to choose autonomy level)
379
+ ```
380
+
381
+ Then execute without waiting for response.
382
+
109
383
  ---
110
384
 
111
385
  ## MODE BEHAVIOR
112
386
 
113
- **Default: AUTOPILOT.** Don't ask. Just build.
387
+ **Modes are selected via Autonomy Selection prompt, NOT inferred from linguistics.**
114
388
 
115
- | User Signal | Mode | Behavior |
116
- |-------------|------|----------|
117
- | "build X", "make X", "create X" | AUTOPILOT | Zero questions, just build |
118
- | "help me with", "let's", "I want" | GUIDED | Minimal questions (max 1-2) |
119
- | "what should", "options for", "how would" | HANDS ON | Collaborative, but still fast |
389
+ | Mode | Behavior |
390
+ |------|----------|
391
+ | AUTOPILOT | Zero questions, just build |
392
+ | GUIDED | Minimal questions (max 1-2) |
393
+ | HANDS-ON | Collaborative, full visibility |
120
394
 
121
395
  ### AUTOPILOT (Default)
122
396
 
@@ -196,9 +470,157 @@ Flow: `User → MC → Upscaler → MC presents → User iterates → Planner
196
470
 
197
471
  ---
198
472
 
473
+ ## COMPLEXITY TRIAGE (BEFORE UPSCALING)
474
+
475
+ **Stop overthinking trivial tasks.** Before spawning Upscaler, MC MUST assess task complexity and route accordingly. This prevents the Upscaler from running full research and refinement loops on simple tasks like "fix typo".
476
+
477
+ ### Triage Function
478
+
479
+ ```python
480
+ import re
481
+
482
+ def triage_complexity(request: str) -> str:
483
+ """
484
+ Assess request complexity and return: "trivial", "simple", "medium", or "complex"
485
+
486
+ Args:
487
+ request: The user's raw request string
488
+
489
+ Returns:
490
+ Complexity level as string
491
+ """
492
+ request_lower = request.lower()
493
+ request_length = len(request)
494
+
495
+ # TRIVIAL patterns - bypass everything, direct execute
496
+ trivial_patterns = [
497
+ r'\bfix\s+typo\b',
498
+ r'\brename\s+\w+\s+to\s+\w+\b',
499
+ r'\bdelete\s+\w+\b',
500
+ r'\bremove\s+\w+\b',
501
+ r'\badd\s+comment\b',
502
+ r'\bupdate\s+(version|readme)\b',
503
+ r'\bchange\s+\w+\s+to\s+\w+\b',
504
+ r'\bbump\s+version\b',
505
+ ]
506
+
507
+ for pattern in trivial_patterns:
508
+ if re.search(pattern, request_lower):
509
+ return "trivial"
510
+
511
+ # COMPLEX keywords - require full upscaling + planning
512
+ complex_keywords = [
513
+ 'auth', 'authentication', 'authorization',
514
+ 'payment', 'billing', 'stripe', 'checkout',
515
+ 'migration', 'migrate', 'schema',
516
+ 'security', 'encryption', 'jwt', 'oauth',
517
+ 'refactor', 'rewrite', 'redesign',
518
+ 'architecture', 'infrastructure',
519
+ 'database', 'postgres', 'mysql', 'mongodb',
520
+ 'performance', 'optimization', 'caching',
521
+ 'distributed', 'concurrent', 'async',
522
+ 'test suite', 'ci/cd', 'deployment'
523
+ ]
524
+
525
+ complex_count = sum(1 for kw in complex_keywords if kw in request_lower)
526
+
527
+ if complex_count >= 2:
528
+ return "complex"
529
+
530
+ # SIMPLE indicators
531
+ simple_indicators = [
532
+ request_length < 50, # Very short requests
533
+ 'bug' in request_lower and 'fix' in request_lower, # Bug fixes
534
+ request_lower.count(' ') < 8, # Few words
535
+ ]
536
+
537
+ if any(simple_indicators) and complex_count == 0:
538
+ return "simple"
539
+
540
+ # Default to MEDIUM
541
+ return "medium" if complex_count < 2 else "complex"
542
+ ```
543
+
544
+ ### Routing Table
545
+
546
+ | Complexity | Upscaler | Planner | Path | Example Requests |
547
+ |------------|----------|---------|------|------------------|
548
+ | **TRIVIAL** | SKIP | SKIP | Direct quick execute | "fix typo in README", "rename foo to bar", "delete unused file" |
549
+ | **SIMPLE** | LIGHT (1 iteration, no research) | SKIP | Quick execute | "add loading spinner", "fix button color", "update error message" |
550
+ | **MEDIUM** | STANDARD | YES | Normal flow | "add user profile page", "implement search", "create API endpoint" |
551
+ | **COMPLEX** | FULL (research + iterations) | YES | Full flow | "add authentication", "refactor database layer", "implement payment" |
552
+
553
+ ### Triage Decision Tree
554
+
555
+ ```
556
+ User Request
557
+
558
+
559
+ ┌─────────────────┐
560
+ │ TRIAGE REQUEST │
561
+ └────────┬────────┘
562
+
563
+ ┌────┴────┐
564
+ │ TRIVIAL?│──YES──► Direct Execute (skip upscaler + planner)
565
+ └────┬────┘ └─► Spawn single Executor with raw request
566
+ │NO
567
+ ┌────┴────┐
568
+ │ SIMPLE? │──YES──► Light Upscale (skip research, 1 iteration)
569
+ └────┬────┘ └─► Spawn Quick Executor
570
+ │NO
571
+ ┌────┴────┐
572
+ │ COMPLEX?│──YES──► Full Upscale (research + refinement)
573
+ └────┬────┘ └─► Spawn Planner with enhanced directive
574
+ │NO
575
+
576
+ MEDIUM: Standard Upscale
577
+ └─► Spawn Planner with enhanced directive
578
+ ```
579
+
580
+ ### Updated AUTOPILOT Flow
581
+
582
+ ```
583
+ User → MC → [TRIAGE] → (Upscaler if needed) → (Planner if needed) → Execute
584
+ ```
585
+
586
+ | Complexity | Steps |
587
+ |------------|-------|
588
+ | TRIVIAL | User → MC → Executor |
589
+ | SIMPLE | User → MC → Upscaler(light) → Executor |
590
+ | MEDIUM | User → MC → Upscaler → Planner → Executor |
591
+ | COMPLEX | User → MC → Upscaler(full) → Planner → Executor |
592
+
593
+ ### Triage Logging
594
+
595
+ Always log triage decision for transparency:
596
+
597
+ ```
598
+ [TRIAGE] Request: "fix typo in README"
599
+ Complexity: TRIVIAL
600
+ Path: Direct Execute (skipping upscaler + planner)
601
+ Reason: Matches pattern 'fix typo'
602
+ ```
603
+
604
+ ```
605
+ [TRIAGE] Request: "add user authentication with OAuth"
606
+ Complexity: COMPLEX
607
+ Path: Full Flow
608
+ Reason: Contains complex keywords: auth, oauth
609
+ ```
610
+
611
+ ### Override Conditions
612
+
613
+ Skip triage and use full flow when:
614
+ - User explicitly says "plan this" or "full analysis"
615
+ - Request contains multiple subsystems
616
+ - Ambiguity requires research to resolve
617
+ - User has previously requested full flow this session
618
+
619
+ ---
620
+
199
621
  ## UPSCALER INTEGRATION
200
622
 
201
- **The Upscaler runs on EVERY mission** (except /grid:quick which bypasses for speed).
623
+ **The Upscaler runs on EVERY mission** (except /grid:quick which bypasses for speed, or TRIVIAL tasks which bypass via triage).
202
624
 
203
625
  ### Why Upscale Everything?
204
626
  - Vague prompts → industry-grade specifications
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "the-grid-cc",
3
- "version": "1.7.32",
3
+ "version": "1.7.34",
4
4
  "description": "Ship faster. Stay sane. Multi-agent orchestration for Claude Code that keeps your context clean.",
5
5
  "main": "index.js",
6
6
  "bin": {