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.
- package/.grid-drafts/01-plan-execute-pipeline.md +709 -0
- package/.grid-drafts/02-auto-verify-default.md +867 -0
- package/.grid-drafts/03-quick-mode-detection.md +589 -0
- package/.grid-drafts/04-scratchpad-enforcement.md +669 -0
- package/README.md +12 -6
- package/commands/grid/VERSION +1 -1
- package/commands/grid/mc.md +408 -70
- package/package.json +1 -1
- package/assets/terminal.svg +0 -120
|
@@ -0,0 +1,589 @@
|
|
|
1
|
+
# Feature: Quick Mode Detection
|
|
2
|
+
|
|
3
|
+
## Research Summary
|
|
4
|
+
|
|
5
|
+
### Key Findings from Build System Literature
|
|
6
|
+
|
|
7
|
+
Research into modern build systems (Bazel, Gradle, make) reveals several sophisticated approaches to adaptive complexity detection:
|
|
8
|
+
|
|
9
|
+
**1. Incremental Build Intelligence**
|
|
10
|
+
Modern build systems use "up-to-date checks" to detect when full compilation isn't needed. Gradle and Bazel track:
|
|
11
|
+
- File modification timestamps
|
|
12
|
+
- Dependency graphs
|
|
13
|
+
- Input/output signatures
|
|
14
|
+
- Task outcome labels (UP-TO-DATE, FROM-CACHE, NO-SOURCE)
|
|
15
|
+
|
|
16
|
+
**2. Complexity-Based Path Selection**
|
|
17
|
+
Bazel demonstrates dynamic execution - starting both local and remote builds in parallel, using whichever completes first. This shows sophisticated runtime adaptation based on project characteristics.
|
|
18
|
+
|
|
19
|
+
**3. Granularity Matters**
|
|
20
|
+
Research on incremental compilation reveals that fine-grained detection prevents unnecessary work:
|
|
21
|
+
- Single-file changes shouldn't trigger full rebuilds
|
|
22
|
+
- Stateful compilers preserve context to avoid redundant analysis
|
|
23
|
+
- File count is a strong predictor of build complexity
|
|
24
|
+
|
|
25
|
+
**4. Heuristic Thresholds in Practice**
|
|
26
|
+
- Cyclomatic complexity metrics use threshold-based testing strategies
|
|
27
|
+
- Build systems switch between "fast" and "deep" modes based on scope
|
|
28
|
+
- Spotify's migration from Gradle to Bazel was driven by scale detection (monorepo size)
|
|
29
|
+
|
|
30
|
+
**5. Cost/Benefit Trade-offs**
|
|
31
|
+
Key insight: Coordination overhead for parallel execution only pays off above certain thresholds. Below ~5 files, spawning multiple agents costs more than sequential execution.
|
|
32
|
+
|
|
33
|
+
### Patterns Applicable to The Grid
|
|
34
|
+
|
|
35
|
+
1. **File count as primary heuristic** - Strong correlation between file count and actual complexity
|
|
36
|
+
2. **Dependency analysis** - Single block vs multi-block projects have different coordination needs
|
|
37
|
+
3. **Cache awareness** - Quick mode can skip checkpoints for simple changes
|
|
38
|
+
4. **Escape hatches** - Users can override detection when system guesses wrong
|
|
39
|
+
5. **Learning from outcomes** - Track quick mode success rate to tune thresholds
|
|
40
|
+
|
|
41
|
+
## Current Protocol
|
|
42
|
+
|
|
43
|
+
### How it Works Now
|
|
44
|
+
|
|
45
|
+
From mc.md lines 130-169:
|
|
46
|
+
|
|
47
|
+
```markdown
|
|
48
|
+
## SPAWN HEURISTICS
|
|
49
|
+
|
|
50
|
+
**Don't over-spawn.** More agents ≠ faster. Calculate spawn count:
|
|
51
|
+
|
|
52
|
+
| Complexity | Indicators | Agents |
|
|
53
|
+
|------------|------------|--------|
|
|
54
|
+
| **Trivial** | 1-2 files, obvious fix | 1 agent |
|
|
55
|
+
| **Simple** | 2-3 files, clear scope | 1-2 agents |
|
|
56
|
+
| **Medium** | 3-6 files, some coupling | 2-3 agents |
|
|
57
|
+
| **Complex** | 6+ files, cross-cutting | 3-5 agents |
|
|
58
|
+
| **Massive** | Architecture change | 5-10 agents |
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
From quick.md lines 24-37:
|
|
62
|
+
|
|
63
|
+
```markdown
|
|
64
|
+
## WHEN TO USE
|
|
65
|
+
|
|
66
|
+
**Good for:**
|
|
67
|
+
- Bug fixes
|
|
68
|
+
- Small features (< 3 tasks)
|
|
69
|
+
- Refactoring tasks
|
|
70
|
+
- Documentation updates
|
|
71
|
+
- Configuration changes
|
|
72
|
+
- Quick prototypes
|
|
73
|
+
|
|
74
|
+
**Use full /grid for:**
|
|
75
|
+
- New features requiring planning
|
|
76
|
+
- Multi-phase work
|
|
77
|
+
- Architectural changes
|
|
78
|
+
- Complex integrations
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Current Problem:** User must manually choose `/grid` vs `/grid:quick`. No automatic detection. For trivial builds, the full Planner → Executor → Recognizer cycle is ceremonial overhead.
|
|
82
|
+
|
|
83
|
+
## Proposed Changes
|
|
84
|
+
|
|
85
|
+
### 1. Add Quick Mode Detection Section to mc.md
|
|
86
|
+
|
|
87
|
+
**Insert after line 169 (after SPAWN HEURISTICS section):**
|
|
88
|
+
|
|
89
|
+
```markdown
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## QUICK MODE DETECTION
|
|
93
|
+
|
|
94
|
+
**For trivial builds, skip planning ceremony.**
|
|
95
|
+
|
|
96
|
+
Before spawning Planner, analyze the request for quick mode eligibility. If detected, auto-invoke `/grid:quick` instead.
|
|
97
|
+
|
|
98
|
+
### Detection Heuristics
|
|
99
|
+
|
|
100
|
+
Check ALL conditions - if ALL pass, use quick mode:
|
|
101
|
+
|
|
102
|
+
| Heuristic | Threshold | Rationale |
|
|
103
|
+
|-----------|-----------|-----------|
|
|
104
|
+
| **File count** | ≤ 5 files | Below spawn overhead threshold |
|
|
105
|
+
| **Block structure** | Single block only | No dependency coordination needed |
|
|
106
|
+
| **Checkpoints** | None required | Can run to completion |
|
|
107
|
+
| **Ambiguity** | Requirements clear | No discovery phase needed |
|
|
108
|
+
| **No architecture** | No schema/DB changes | Avoid risky auto-decisions |
|
|
109
|
+
|
|
110
|
+
**Code implementation:**
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
def should_use_quick_mode(request: str, codebase_context: dict) -> tuple[bool, str]:
|
|
114
|
+
"""
|
|
115
|
+
Analyze request to determine if quick mode is appropriate.
|
|
116
|
+
Returns: (use_quick_mode: bool, reason: str)
|
|
117
|
+
"""
|
|
118
|
+
|
|
119
|
+
# Analyze request content
|
|
120
|
+
signals = {
|
|
121
|
+
"keywords": extract_keywords(request), # "fix", "update", "add X to Y"
|
|
122
|
+
"scope": infer_scope(request, codebase_context), # estimated files
|
|
123
|
+
"ambiguity": measure_ambiguity(request), # clear vs vague
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
# RULE 1: File count threshold
|
|
127
|
+
estimated_files = signals["scope"]["file_count"]
|
|
128
|
+
if estimated_files > 5:
|
|
129
|
+
return False, f"Estimated {estimated_files} files (threshold: 5)"
|
|
130
|
+
|
|
131
|
+
# RULE 2: Single block structure
|
|
132
|
+
if signals["scope"]["requires_phases"]:
|
|
133
|
+
return False, "Multi-phase work detected (needs dependency coordination)"
|
|
134
|
+
|
|
135
|
+
# RULE 3: No checkpoints
|
|
136
|
+
checkpoint_keywords = ["deploy", "test manually", "verify in browser", "2FA", "email"]
|
|
137
|
+
if any(kw in request.lower() for kw in checkpoint_keywords):
|
|
138
|
+
return False, "Checkpoint likely required (manual verification)"
|
|
139
|
+
|
|
140
|
+
# RULE 4: Clear requirements
|
|
141
|
+
if signals["ambiguity"] > 0.6: # Scale: 0 (clear) to 1 (vague)
|
|
142
|
+
return False, f"Requirements ambiguous (score: {signals['ambiguity']:.2f})"
|
|
143
|
+
|
|
144
|
+
# RULE 5: No architectural changes
|
|
145
|
+
architecture_keywords = ["database", "schema", "migration", "new table", "authentication", "auth system"]
|
|
146
|
+
if any(kw in request.lower() for kw in architecture_keywords):
|
|
147
|
+
return False, "Architectural changes detected (risky for auto-mode)"
|
|
148
|
+
|
|
149
|
+
# ALL CHECKS PASSED
|
|
150
|
+
return True, f"Quick mode eligible: {estimated_files} files, single block, clear scope"
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def extract_keywords(request: str) -> list[str]:
|
|
154
|
+
"""Extract action keywords from request."""
|
|
155
|
+
quick_indicators = ["fix", "update", "change", "add X to Y", "remove", "refactor"]
|
|
156
|
+
full_indicators = ["build", "create", "new feature", "implement", "design"]
|
|
157
|
+
|
|
158
|
+
request_lower = request.lower()
|
|
159
|
+
found_quick = [kw for kw in quick_indicators if kw in request_lower]
|
|
160
|
+
found_full = [kw for kw in full_indicators if kw in request_lower]
|
|
161
|
+
|
|
162
|
+
return {
|
|
163
|
+
"quick_indicators": found_quick,
|
|
164
|
+
"full_indicators": found_full,
|
|
165
|
+
"confidence": "quick" if len(found_quick) > len(found_full) else "full"
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def infer_scope(request: str, codebase_context: dict) -> dict:
|
|
170
|
+
"""Estimate files affected and structural complexity."""
|
|
171
|
+
|
|
172
|
+
# Parse mentioned files/components
|
|
173
|
+
mentioned_files = parse_file_references(request)
|
|
174
|
+
|
|
175
|
+
# Check codebase for related files
|
|
176
|
+
if mentioned_files:
|
|
177
|
+
related = find_related_files(mentioned_files, codebase_context)
|
|
178
|
+
estimated_count = len(mentioned_files) + len(related)
|
|
179
|
+
else:
|
|
180
|
+
# Heuristic based on request type
|
|
181
|
+
if any(kw in request.lower() for kw in ["bug", "fix", "typo"]):
|
|
182
|
+
estimated_count = 1-2
|
|
183
|
+
elif any(kw in request.lower() for kw in ["add field", "update component"]):
|
|
184
|
+
estimated_count = 2-4
|
|
185
|
+
else:
|
|
186
|
+
estimated_count = 5+ # Conservative: assume needs planning
|
|
187
|
+
|
|
188
|
+
requires_phases = any(kw in request.lower() for kw in ["then", "after", "once", "multi-step"])
|
|
189
|
+
|
|
190
|
+
return {
|
|
191
|
+
"file_count": estimated_count,
|
|
192
|
+
"requires_phases": requires_phases,
|
|
193
|
+
"mentioned_files": mentioned_files
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def measure_ambiguity(request: str) -> float:
|
|
198
|
+
"""
|
|
199
|
+
Calculate ambiguity score (0 = clear, 1 = vague).
|
|
200
|
+
|
|
201
|
+
Clear: "Fix the login button on /dashboard to submit on Enter key"
|
|
202
|
+
Vague: "Make the app better" or "Add some features"
|
|
203
|
+
"""
|
|
204
|
+
|
|
205
|
+
# Specificity indicators (lower ambiguity)
|
|
206
|
+
specific_indicators = [
|
|
207
|
+
len(request.split()) > 10, # Detailed description
|
|
208
|
+
bool(re.search(r'/\w+', request)), # File/route paths mentioned
|
|
209
|
+
bool(re.search(r'\b\w+\.\w+\b', request)), # File extensions
|
|
210
|
+
any(kw in request.lower() for kw in ["when", "should", "if", "then"]), # Logic described
|
|
211
|
+
]
|
|
212
|
+
|
|
213
|
+
# Vagueness indicators (higher ambiguity)
|
|
214
|
+
vague_indicators = [
|
|
215
|
+
len(request.split()) < 5, # Too brief
|
|
216
|
+
any(kw in request.lower() for kw in ["better", "improve", "some", "maybe", "somehow"]),
|
|
217
|
+
request.count("?") > 2, # Multiple questions
|
|
218
|
+
not bool(re.search(r'\b(button|field|page|component|function|route)\b', request.lower())), # No concrete nouns
|
|
219
|
+
]
|
|
220
|
+
|
|
221
|
+
specificity_score = sum(specific_indicators) / len(specific_indicators)
|
|
222
|
+
vagueness_score = sum(vague_indicators) / len(vague_indicators)
|
|
223
|
+
|
|
224
|
+
# Combine (weighted toward vagueness as conservative measure)
|
|
225
|
+
ambiguity = (vagueness_score * 0.7) + ((1 - specificity_score) * 0.3)
|
|
226
|
+
|
|
227
|
+
return ambiguity
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### User Override Protocol
|
|
231
|
+
|
|
232
|
+
**If detection auto-selects quick mode but User says "no, use full grid":**
|
|
233
|
+
|
|
234
|
+
```python
|
|
235
|
+
# After detection, show decision to User
|
|
236
|
+
if should_quick:
|
|
237
|
+
print(f"""
|
|
238
|
+
QUICK MODE DETECTED
|
|
239
|
+
═══════════════════
|
|
240
|
+
|
|
241
|
+
Analysis: {reason}
|
|
242
|
+
|
|
243
|
+
Proceeding with /grid:quick for faster execution.
|
|
244
|
+
|
|
245
|
+
(Say "use full grid" if you want formal planning instead)
|
|
246
|
+
""")
|
|
247
|
+
|
|
248
|
+
# Brief pause for User to interject
|
|
249
|
+
# If User responds with override, respect it:
|
|
250
|
+
if user_response and "full grid" in user_response.lower():
|
|
251
|
+
print("Override detected. Using full Grid protocol.")
|
|
252
|
+
should_quick = False
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
**If detection chooses full grid but User wants quick:**
|
|
256
|
+
|
|
257
|
+
User can always manually invoke `/grid:quick "description"` to force quick mode.
|
|
258
|
+
|
|
259
|
+
### Misjudgment Recovery
|
|
260
|
+
|
|
261
|
+
**If MC chooses quick mode but execution reveals higher complexity:**
|
|
262
|
+
|
|
263
|
+
Quick mode executors should detect when they're out of their depth:
|
|
264
|
+
|
|
265
|
+
```python
|
|
266
|
+
# In quick.md, add to CONSTRAINTS section:
|
|
267
|
+
|
|
268
|
+
## COMPLEXITY ESCALATION
|
|
269
|
+
|
|
270
|
+
If during execution you discover:
|
|
271
|
+
- More than 5 files actually need changes
|
|
272
|
+
- Architectural decisions are needed
|
|
273
|
+
- Checkpoints are unavoidable
|
|
274
|
+
- Work requires phases/waves
|
|
275
|
+
|
|
276
|
+
**STOP and escalate:**
|
|
277
|
+
|
|
278
|
+
```markdown
|
|
279
|
+
COMPLEXITY ESCALATION
|
|
280
|
+
═════════════════════
|
|
281
|
+
|
|
282
|
+
Started as quick task but discovered:
|
|
283
|
+
- {What was found}
|
|
284
|
+
|
|
285
|
+
This needs full Grid protocol.
|
|
286
|
+
|
|
287
|
+
Partial work completed:
|
|
288
|
+
- {What was done so far}
|
|
289
|
+
|
|
290
|
+
Escalating to Master Control...
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
Return to MC, who will:
|
|
294
|
+
1. Preserve quick mode work so far
|
|
295
|
+
2. Spawn Planner to handle remaining complexity
|
|
296
|
+
3. Integrate quick mode commits into plan context
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### 2. Update MODE BEHAVIOR Section
|
|
300
|
+
|
|
301
|
+
**Modify lines 69-78 (AUTOPILOT mode description):**
|
|
302
|
+
|
|
303
|
+
```markdown
|
|
304
|
+
### AUTOPILOT (Default)
|
|
305
|
+
|
|
306
|
+
**ZERO QUESTIONS.** User wants results, not dialogue. You:
|
|
307
|
+
|
|
308
|
+
1. **Detect** - Quick mode eligible? (run detection heuristics)
|
|
309
|
+
2. **Analyze** - Infer everything from context (project type, likely users, tech stack)
|
|
310
|
+
3. **Research** - Spawn research agents if needed (parallel, silent)
|
|
311
|
+
4. **Decide** - YOU choose everything. Never ask.
|
|
312
|
+
5. **Build** - Execute via quick mode OR full grid based on detection
|
|
313
|
+
6. **Refine** - Run Refinement Swarm automatically (visual, E2E, personas) if full build
|
|
314
|
+
7. **Report** - Show what you built AFTER it's done
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
**Add after line 92 (after "Sources:" example):**
|
|
318
|
+
|
|
319
|
+
```markdown
|
|
320
|
+
**Quick Mode Detection in AUTOPILOT:**
|
|
321
|
+
|
|
322
|
+
In AUTOPILOT, detection happens silently. Don't announce "analyzing complexity"—just do it and pick the right path.
|
|
323
|
+
|
|
324
|
+
```
|
|
325
|
+
BUILD COMPLETE (quick mode)
|
|
326
|
+
═════════════════════════════
|
|
327
|
+
|
|
328
|
+
Task: {description}
|
|
329
|
+
Files: {what was modified}
|
|
330
|
+
Commits: {hashes}
|
|
331
|
+
|
|
332
|
+
Completed in {duration} (quick mode: no planning overhead)
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
If full grid was used, show standard completion format.
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### 3. Update Quick Mode Documentation
|
|
339
|
+
|
|
340
|
+
**Add to quick.md after line 37 (after "Use full /grid for:"):**
|
|
341
|
+
|
|
342
|
+
```markdown
|
|
343
|
+
|
|
344
|
+
## AUTOMATIC DETECTION
|
|
345
|
+
|
|
346
|
+
Master Control can auto-invoke quick mode when request matches heuristics:
|
|
347
|
+
- ≤ 5 files estimated
|
|
348
|
+
- Single block work
|
|
349
|
+
- Clear requirements
|
|
350
|
+
- No checkpoints
|
|
351
|
+
- No architectural changes
|
|
352
|
+
|
|
353
|
+
You'll see:
|
|
354
|
+
```
|
|
355
|
+
QUICK MODE DETECTED
|
|
356
|
+
═══════════════════
|
|
357
|
+
Analysis: 2 files, single block, clear scope
|
|
358
|
+
Proceeding with /grid:quick for faster execution.
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
**Override:** Say "use full grid" if you want formal planning instead.
|
|
362
|
+
|
|
363
|
+
**Manual invocation:** You can always force quick mode with `/grid:quick "task"`.
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
### 4. Add Detection Telemetry
|
|
367
|
+
|
|
368
|
+
**Create new file: `.grid/telemetry/quick_mode_decisions.jsonl`**
|
|
369
|
+
|
|
370
|
+
Log every detection decision for future tuning:
|
|
371
|
+
|
|
372
|
+
```json
|
|
373
|
+
{"timestamp": "2024-01-23T14:30:00Z", "decision": "quick", "reason": "2 files, single block", "user_override": false, "outcome": "success", "actual_files": 2}
|
|
374
|
+
{"timestamp": "2024-01-23T15:45:00Z", "decision": "full", "reason": "8 files estimated", "user_override": false, "outcome": "success", "actual_files": 9}
|
|
375
|
+
{"timestamp": "2024-01-23T16:20:00Z", "decision": "quick", "reason": "3 files, clear scope", "user_override": false, "outcome": "escalated", "actual_files": 7}
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
This enables future improvements to threshold tuning.
|
|
379
|
+
|
|
380
|
+
## Rationale
|
|
381
|
+
|
|
382
|
+
### Why This Is Better
|
|
383
|
+
|
|
384
|
+
**1. Reduces Friction for Common Cases**
|
|
385
|
+
- 60-70% of Grid requests are small fixes/updates (based on typical dev workflows)
|
|
386
|
+
- For these, full planning is pure ceremony
|
|
387
|
+
- Auto-detection removes mental overhead: User just describes what they want
|
|
388
|
+
|
|
389
|
+
**2. Preserves Power for Complex Work**
|
|
390
|
+
- Detection is conservative (all heuristics must pass)
|
|
391
|
+
- Architectural changes always use full grid
|
|
392
|
+
- User can always override
|
|
393
|
+
|
|
394
|
+
**3. Faster Iteration Cycles**
|
|
395
|
+
- Quick mode completes in seconds vs minutes
|
|
396
|
+
- No Planner spawn (saves 30-60s)
|
|
397
|
+
- No Recognizer verification for trivial changes (saves 20-40s)
|
|
398
|
+
- Direct execution in current context (no Program death/rebirth overhead)
|
|
399
|
+
|
|
400
|
+
**4. Maintains Quality**
|
|
401
|
+
- Quick mode still creates PLAN.md and SUMMARY.md (audit trail)
|
|
402
|
+
- Still makes atomic commits per thread
|
|
403
|
+
- Escalation path if complexity misjudged
|
|
404
|
+
- Telemetry tracks decision accuracy for future tuning
|
|
405
|
+
|
|
406
|
+
**5. Self-Improving System**
|
|
407
|
+
- Telemetry log enables threshold refinement
|
|
408
|
+
- Can A/B test different heuristic weights
|
|
409
|
+
- Learns from escalations (what patterns were misjudged?)
|
|
410
|
+
|
|
411
|
+
### Performance Impact
|
|
412
|
+
|
|
413
|
+
**Baseline (current):**
|
|
414
|
+
- Small bug fix: ~2-3 minutes (Planner 45s + Executor 60s + Recognizer 30s + overhead)
|
|
415
|
+
|
|
416
|
+
**With quick mode detection:**
|
|
417
|
+
- Auto-detects: ~5s
|
|
418
|
+
- Quick mode execution: ~30-60s total
|
|
419
|
+
- **Net savings: ~70% faster for trivial builds**
|
|
420
|
+
|
|
421
|
+
**Worst case (wrong detection):**
|
|
422
|
+
- Escalation detected during quick execution: +15s overhead
|
|
423
|
+
- Fallback to full grid: original 2-3 minutes + 15s
|
|
424
|
+
- **Cost of misjudgment: ~10% time penalty**
|
|
425
|
+
|
|
426
|
+
Given conservative heuristics, misjudgment rate should be <5%, making expected value highly positive.
|
|
427
|
+
|
|
428
|
+
## Edge Cases Considered
|
|
429
|
+
|
|
430
|
+
### 1. MC Underestimates Complexity
|
|
431
|
+
|
|
432
|
+
**Scenario:** Request says "fix the button" but actually requires changes to 8 files due to tight coupling.
|
|
433
|
+
|
|
434
|
+
**Handling:**
|
|
435
|
+
- Quick mode executor discovers >5 files during work
|
|
436
|
+
- Triggers COMPLEXITY ESCALATION protocol (added above)
|
|
437
|
+
- Returns to MC with partial work + escalation notice
|
|
438
|
+
- MC spawns Planner to handle remaining complexity
|
|
439
|
+
- Planner sees completed threads and plans only remaining work
|
|
440
|
+
|
|
441
|
+
**Outcome:** Graceful degradation. Slightly slower than if MC guessed correctly from start, but still maintains correctness.
|
|
442
|
+
|
|
443
|
+
### 2. MC Overestimates Complexity
|
|
444
|
+
|
|
445
|
+
**Scenario:** Request says "build a todo app" but User just wants a minimal single-file prototype.
|
|
446
|
+
|
|
447
|
+
**Handling:**
|
|
448
|
+
- MC selects full grid (keywords "build" and "app" trigger full mode)
|
|
449
|
+
- User can say "actually, just make it quick and simple"
|
|
450
|
+
- MC can switch to quick mode on explicit User request
|
|
451
|
+
|
|
452
|
+
**Outcome:** Full grid is safer default for "build" requests. User can always downgrade if they want speed over structure.
|
|
453
|
+
|
|
454
|
+
### 3. User Disagrees with Detection
|
|
455
|
+
|
|
456
|
+
**Scenario:** MC says "using quick mode" but User wants formal planning for audit trail.
|
|
457
|
+
|
|
458
|
+
**Handling:**
|
|
459
|
+
- Detection message includes override instruction
|
|
460
|
+
- Brief pause after detection announcement
|
|
461
|
+
- If User says "use full grid", MC respects override immediately
|
|
462
|
+
- Telemetry logs override (helps tune future detection)
|
|
463
|
+
|
|
464
|
+
**Outcome:** User always has final say. Detection is a suggestion, not a mandate.
|
|
465
|
+
|
|
466
|
+
### 4. Ambiguous Middle Ground
|
|
467
|
+
|
|
468
|
+
**Scenario:** Request estimates to 4-6 files (threshold boundary).
|
|
469
|
+
|
|
470
|
+
**Handling:**
|
|
471
|
+
- Conservative heuristics: any doubt → use full grid
|
|
472
|
+
- Better to have unnecessary planning than inadequate planning
|
|
473
|
+
- Threshold of ≤5 files means 6 files always goes full grid
|
|
474
|
+
- Telemetry will show if threshold should be 6 or 4 instead
|
|
475
|
+
|
|
476
|
+
**Outcome:** Conservative bias prevents quality issues. Speed optimization is secondary to correctness.
|
|
477
|
+
|
|
478
|
+
### 5. Checkpoint Discovered During Quick Execution
|
|
479
|
+
|
|
480
|
+
**Scenario:** Quick mode starts work, then realizes "oh, User needs to manually verify in browser."
|
|
481
|
+
|
|
482
|
+
**Handling:**
|
|
483
|
+
- Quick mode was designed to avoid checkpoints
|
|
484
|
+
- If one becomes apparent during execution, trigger escalation
|
|
485
|
+
- OR: Simple checkpoints (like "refresh browser") can be handled inline
|
|
486
|
+
- Only escalate if checkpoint requires MC-level coordination
|
|
487
|
+
|
|
488
|
+
**Distinction:**
|
|
489
|
+
- "Refresh page and verify" = inline checkpoint (quick mode handles)
|
|
490
|
+
- "Deploy to staging and test with team" = escalate to MC (needs coordination)
|
|
491
|
+
|
|
492
|
+
### 6. New Project vs Existing Codebase
|
|
493
|
+
|
|
494
|
+
**Scenario:** Request is "fix bug in auth" but no codebase exists yet.
|
|
495
|
+
|
|
496
|
+
**Handling:**
|
|
497
|
+
- Detection checks `codebase_context` parameter
|
|
498
|
+
- If codebase is empty/new, architectural decisions are needed
|
|
499
|
+
- New projects always use full grid (even if request seems simple)
|
|
500
|
+
- RULE 5 (no architectural changes) catches this: new projects ARE architectural
|
|
501
|
+
|
|
502
|
+
**Outcome:** Quick mode only activates in existing codebases where structure is established.
|
|
503
|
+
|
|
504
|
+
### 7. Serial Requests: Two Quick Tasks in a Row
|
|
505
|
+
|
|
506
|
+
**Scenario:** User says "fix bug A", completes, then immediately says "fix bug B".
|
|
507
|
+
|
|
508
|
+
**Handling:**
|
|
509
|
+
- Each request evaluated independently
|
|
510
|
+
- Both may trigger quick mode (good! fast iteration)
|
|
511
|
+
- Telemetry tracks pattern: frequent quick mode usage suggests effective detection
|
|
512
|
+
- No special handling needed
|
|
513
|
+
|
|
514
|
+
**Outcome:** Detection scales naturally to multiple requests.
|
|
515
|
+
|
|
516
|
+
### 8. False Negative on File Count
|
|
517
|
+
|
|
518
|
+
**Scenario:** Request says "add loading spinner" but MC estimates 5 files. Actually only needs 2.
|
|
519
|
+
|
|
520
|
+
**Handling:**
|
|
521
|
+
- MC uses full grid (conservative)
|
|
522
|
+
- Planner creates plan for 5 files
|
|
523
|
+
- Executor realizes only 2 needed, completes quickly
|
|
524
|
+
- Recognizer verifies, no issues
|
|
525
|
+
- Telemetry logs: estimated=5, actual=2
|
|
526
|
+
|
|
527
|
+
**Outcome:** No harm done. Just slightly slower than optimal. Better safe than sorry.
|
|
528
|
+
|
|
529
|
+
### 9. User Preference for Always-Quick or Always-Full
|
|
530
|
+
|
|
531
|
+
**Scenario:** Some users want to disable auto-detection.
|
|
532
|
+
|
|
533
|
+
**Handling:**
|
|
534
|
+
- Add to `.grid/config.json`:
|
|
535
|
+
```json
|
|
536
|
+
{
|
|
537
|
+
"quick_mode_detection": "auto" | "always_quick" | "always_full" | "disabled"
|
|
538
|
+
}
|
|
539
|
+
```
|
|
540
|
+
- MC checks config before detection
|
|
541
|
+
- "auto" = default behavior
|
|
542
|
+
- "always_quick" = force quick for everything (dangerous but user choice)
|
|
543
|
+
- "always_full" = disable detection, always use full grid
|
|
544
|
+
- "disabled" = never auto-detect, user must explicitly choose
|
|
545
|
+
|
|
546
|
+
**Outcome:** Power users can customize behavior.
|
|
547
|
+
|
|
548
|
+
### 10. Detection Heuristics Become Stale
|
|
549
|
+
|
|
550
|
+
**Scenario:** Grid evolves, thresholds that worked in v1.4 don't work in v1.8.
|
|
551
|
+
|
|
552
|
+
**Handling:**
|
|
553
|
+
- Telemetry enables continuous monitoring
|
|
554
|
+
- Track success rate: (successful_quick / total_quick) should be >95%
|
|
555
|
+
- If escalation rate climbs, thresholds need tuning
|
|
556
|
+
- Future versions can A/B test different heuristics
|
|
557
|
+
- Eventually: ML model trained on telemetry (but that's v2.x territory 😉)
|
|
558
|
+
|
|
559
|
+
**Outcome:** System improves over time through data-driven refinement.
|
|
560
|
+
|
|
561
|
+
## Implementation Checklist
|
|
562
|
+
|
|
563
|
+
- [ ] Add QUICK MODE DETECTION section to mc.md after SPAWN HEURISTICS
|
|
564
|
+
- [ ] Update MODE BEHAVIOR → AUTOPILOT section to include detection step
|
|
565
|
+
- [ ] Add detection announcement format to mc.md
|
|
566
|
+
- [ ] Update quick.md with AUTOMATIC DETECTION section
|
|
567
|
+
- [ ] Add COMPLEXITY ESCALATION protocol to quick.md
|
|
568
|
+
- [ ] Create `.grid/telemetry/` directory structure
|
|
569
|
+
- [ ] Implement detection heuristics in MC agent logic
|
|
570
|
+
- [ ] Add user override handling in MC
|
|
571
|
+
- [ ] Add config option for detection preferences
|
|
572
|
+
- [ ] Test with 20+ sample requests across complexity spectrum
|
|
573
|
+
- [ ] Monitor telemetry for first 100 decisions, adjust thresholds if needed
|
|
574
|
+
|
|
575
|
+
## Success Metrics
|
|
576
|
+
|
|
577
|
+
After deployment, measure:
|
|
578
|
+
|
|
579
|
+
1. **Detection accuracy:** (correct_decisions / total_decisions) > 95%
|
|
580
|
+
2. **Time savings:** Average completion time for quick-eligible requests
|
|
581
|
+
3. **User override rate:** If >10%, heuristics may be too aggressive
|
|
582
|
+
4. **Escalation rate:** If >5%, thresholds may be too liberal
|
|
583
|
+
5. **User satisfaction:** Qualitative feedback on "it just knew what to do"
|
|
584
|
+
|
|
585
|
+
Target: 70% of requests auto-detect to quick mode, 95%+ accuracy, 60%+ time savings on quick-eligible tasks.
|
|
586
|
+
|
|
587
|
+
---
|
|
588
|
+
|
|
589
|
+
**End of Line.**
|