@webpresso/plugin-antigravity 0.0.0-stage → 0.0.17

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.
Files changed (43) hide show
  1. package/LICENSE +104 -0
  2. package/bin/wp +276 -0
  3. package/hooks.json +54 -0
  4. package/mcp_config.json +11 -0
  5. package/package.json +37 -3
  6. package/plugin-skill-ownership.json +105 -0
  7. package/plugin.json +11 -0
  8. package/skills/ai-deslop/SKILL.md +96 -0
  9. package/skills/antigravity/SKILL.md +52 -0
  10. package/skills/autopilot/SKILL.md +82 -0
  11. package/skills/autoresearch/SKILL.md +49 -0
  12. package/skills/best-practice-research/SKILL.md +102 -0
  13. package/skills/browse/SKILL.md +25 -0
  14. package/skills/claude/SKILL.md +52 -0
  15. package/skills/codex/SKILL.md +52 -0
  16. package/skills/deep-interview/LICENSE.txt +28 -0
  17. package/skills/deep-interview/SKILL.md +270 -0
  18. package/skills/deep-research/SKILL.md +259 -0
  19. package/skills/delivery-program/SKILL.md +62 -0
  20. package/skills/design-review/SKILL.md +26 -0
  21. package/skills/devex-review/SKILL.md +28 -0
  22. package/skills/fix/SKILL.md +218 -0
  23. package/skills/handoff/SKILL.md +99 -0
  24. package/skills/hooks-doctor/SKILL.md +153 -0
  25. package/skills/investigate/SKILL.md +83 -0
  26. package/skills/lore-protocol/SKILL.md +84 -0
  27. package/skills/opencode-go/SKILL.md +52 -0
  28. package/skills/plan-ceo-review/SKILL.md +27 -0
  29. package/skills/plan-design-review/SKILL.md +27 -0
  30. package/skills/plan-devex-review/SKILL.md +19 -0
  31. package/skills/plan-eng-review/SKILL.md +24 -0
  32. package/skills/plan-refine/SKILL.md +122 -0
  33. package/skills/plan-refine/references/full-methodology.md +654 -0
  34. package/skills/ralplan/SKILL.md +196 -0
  35. package/skills/team/SKILL.md +121 -0
  36. package/skills/tech-debt/SKILL.md +95 -0
  37. package/skills/testing-philosophy/SKILL.md +53 -0
  38. package/skills/testing-philosophy/references/full-testing-philosophy.md +519 -0
  39. package/skills/tooling-friction/SKILL.md +234 -0
  40. package/skills/tph/SKILL.md +35 -0
  41. package/skills/ultragoal/SKILL.md +304 -0
  42. package/skills/verify/SKILL.md +399 -0
  43. package/README.md +0 -3
@@ -0,0 +1,654 @@
1
+ # Full reference moved from SKILL.md
2
+
3
+ > **Implementation Status: Production-Ready**
4
+ >
5
+ > Blueprint hardening and lifecycle infrastructure are production-ready:
6
+ >
7
+ > - Blueprint dependency parsing, format validation, and the lifecycle state
8
+ > machine with evidence-gated task completion (fully tested, in-package)
9
+ > batches independent tasks by dependency order and blocks dependents of
10
+ > failed tasks
11
+ >
12
+ > **Remaining gaps:** execution docs and wrappers must stay aligned with the currently shipped runtime and CLI surface.
13
+
14
+ # Plan Refinement Methodology
15
+
16
+ ## Core Principle
17
+
18
+ > **"A plan is only as strong as its weakest unchecked claim — only as elegant as what it refuses to add — and only as fast as its coarsest task granularity."**
19
+
20
+ Every technology claim, file path, API, version, and architecture decision must be verified against reality before implementation. **Zero assumptions:** model memory is not evidence. Unverified plans cascade into execution failure. Coarse tasks serialize work that should run in parallel.
21
+
22
+ ### Non-negotiable bar (always)
23
+
24
+ | Target | Definition | Fail condition |
25
+ | ------------------- | ----------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
26
+ | **100% confidence** | Every material claim has a code pinpoint and/or official-doc citation at a stated version | Any “probably / should work / AI recall” left standing |
27
+ | **Elegance** | Smallest coherent design; delete/reuse over add | Heavier option kept without recorded rejection of lighter ones |
28
+ | **Durability** | Survives upgrades and adjacent change; ownership boundaries clear | Rewrite-prone seams or version-blind third-party usage |
29
+ | **Efficiency** | Minimal critical path; true parallel waves; no speculative work | False dependencies, CP > 0, busywork tasks |
30
+
31
+ Refinement goals (all required):
32
+
33
+ 1. **Correctness** — Every claim fact-checked; every edge case documented
34
+ 2. **Zero assumptions** — Unproven statements removed or proven
35
+ 3. **Code pinpoints** — Paths, symbols, and signatures anchored in the repo
36
+ 4. **Official latest docs** — Third-party behavior from primary sources at latest/pinned version
37
+ 5. **Parallelizability** — Maximum independent tasks for `/goal` / `ultragoal`
38
+ 6. **Elegance, durability, efficiency** — Not merely correct; DRY/SOLID/YAGNI/KISS + public-package safety
39
+
40
+ ## When to Use
41
+
42
+ **ALWAYS refine a plan when:**
43
+
44
+ - A new blueprint has been created from Q&A or brainstorming
45
+ - A blueprint references specific technologies, libraries, or APIs
46
+ - A blueprint makes assumptions about existing codebase structure
47
+ - A blueprint has cross-plan dependencies (upstream/downstream)
48
+ - Before moving a blueprint from `draft/` to `in-progress/`
49
+ - After significant codebase changes that may invalidate assumptions
50
+ - Tasks are too coarse for parallel execution (should be split)
51
+
52
+ **Don't use for:**
53
+
54
+ - Trivial single-task plans (just verify inline)
55
+ - Plans that are purely process/methodology (no code assumptions)
56
+ - Plans already verified and in execution
57
+
58
+ ## The Refinement Pipeline
59
+
60
+ Phases 1–3 (and independent review lenses) run **in parallel**. Only cross-plan alignment, blueprint enforcement, and apply need their inputs.
61
+
62
+ ```
63
+ Blueprint (Draft/In-Progress)
64
+ │
65
+ ├──────────────────┬──────────────────┐
66
+ ▼ ▼ ▼
67
+ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
68
+ │ PHASE 1 (//) │ │ PHASE 2 (//) │ │ PHASE 3 (//) │
69
+ │ Official latest │ │ Code pinpoints │ │ Architecture + │
70
+ │ 3rd-party docs │ │ path + symbol │ │ elegance/ │
71
+ │ version-pinned │ │ 0 assumptions │ │ durability │
72
+ └────────┬────────┘ └────────┬────────┘ └────────┬────────┘
73
+ └──────────────────┬──────────────────┘
74
+ ▼
75
+ ┌─────────────────────────────────┐
76
+ │ PHASE 4: Cross-Plan Alignment │
77
+ │ - Upstream/downstream contracts│
78
+ │ - Shared decisions consistent │
79
+ └──────────────┬──────────────────┘
80
+ ▼
81
+ ┌─────────────────────────────────┐
82
+ │ PHASE 5: Max-parallel Blueprint│
83
+ │ - Split/merge for RW/CPR/CP=0 │
84
+ │ - Depends + Files + TDD │
85
+ └──────────────┬──────────────────┘
86
+ ▼
87
+ ┌─────────────────────────────────┐
88
+ │ PHASE 6: Apply & Consolidate │
89
+ │ - Fx tags, tables, waves │
90
+ │ - Ready only at 100% confidence│
91
+ └─────────────────────────────────┘
92
+ ```
93
+
94
+ ---
95
+
96
+ ## Folded plan-review pipeline
97
+
98
+ `/autoplan` is folded into this skill. For non-trivial plans, run the plan review
99
+ lenses in the order that matches the risk: CEO/founder scope, design/UX,
100
+ engineering architecture, then DevEx/migration. Consolidate the reviews into
101
+ keep/change/drop decisions, unresolved taste calls, required tests, and a final
102
+ go/no-go. Do not edit implementation code during plan refinement.
103
+
104
+ ## Required Policy Gates
105
+
106
+ Apply these gates to every refined blueprint:
107
+
108
+ - **Engineering principles:** enforce `.agent/rules/engineering-principles.md`.
109
+ Reject speculative abstractions, unused extension seams, avoidable
110
+ dependencies, and designs that can be simpler without losing behavior.
111
+ - **Public package safety:** when a plan touches `package.json`, `files`, `bin`,
112
+ `exports`, package docs, catalog assets, generated agent surfaces, or release
113
+ workflows, enforce `.agent/rules/public-package-safety.md`. Require a
114
+ tarball/package-surface check and explicitly keep private content out.
115
+
116
+ If either gate fails, record the finding and simplify or quarantine the public
117
+ surface before execution.
118
+
119
+ ---
120
+
121
+ ## Phase 1: Technology Fact-Check (official, latest, version-pinned)
122
+
123
+ **Goal:** Verify every external technology claim against **official/upstream primary sources** at the **latest stable or plan-pinned version**. Secondary sources (blogs, forums, model memory) never stand alone.
124
+
125
+ ### Source order (strict)
126
+
127
+ 1. Vendor/official docs for that version (docs site, OpenAPI, man pages)
128
+ 2. Upstream release notes / changelog for that version
129
+ 3. Package registry metadata (resolved version, peer deps, engines)
130
+ 4. Maintainer GH issues/discussions **only** as supplemental after (1–3)
131
+
132
+ Route through `best-practice-research` when reusable; escalate to `deep-research` for multi-source depth. Prefer Context7/WebFetch of the **official** URL over search snippets.
133
+
134
+ ### What to Check
135
+
136
+ | Category | Check | How |
137
+ | ------------------------------ | -------------------------------------------- | ---------------------------------------------------------- |
138
+ | **Library compatibility** | Does library X work with runtime Y at ver Z? | Official compat matrix + engines field + release notes |
139
+ | **API correctness** | Does the API exist as described at that ver? | Official docs page for **that version**, not “latest blog” |
140
+ | **Version constraints** | Pinned/latest available? Breaking changes? | Registry + changelog between plan version and current |
141
+ | **Native addon compatibility** | Compiles for all targets? | Official platform support + CI matrix docs |
142
+ | **Protocol correctness** | Wire protocol right? | Official protocol/spec docs |
143
+ | **Platform limits** | Timeout/memory/size limits? | Platform official limits docs (e.g. Workers) |
144
+
145
+ ### Output Format
146
+
147
+ For each finding, assign:
148
+
149
+ - **ID**: F1, F2, F3...
150
+ - **Severity**: CRITICAL (blocks implementation), HIGH (causes bugs), MEDIUM (suboptimal), LOW (cosmetic)
151
+ - **Claim**: What the blueprint says
152
+ - **Reality**: What official docs show (quote or paraphrase + **URL + version/date**)
153
+ - **Fix**: Concrete change to the blueprint
154
+
155
+ ### Anti-Patterns
156
+
157
+ | Anti-Pattern | Why It's Wrong | Do This Instead |
158
+ | ------------------------------------- | --------------------------------- | ------------------------------------------------- |
159
+ | "Library X should work" | Untested assumption | Official docs + version-pinned evidence |
160
+ | Trusting AI knowledge of library APIs | Models hallucinate API signatures | Fetch official docs for the exact version |
161
+ | "Latest" without stating which latest | Drift between refine and execute | Record version identity (semver / date / channel) |
162
+ | Blog/SO as sole source | Often wrong or version-skewed | Primary docs first; blogs only as supplemental |
163
+ | Ignoring native addon constraints | Build failures in CI/CD | Official target matrix + engines |
164
+
165
+ ## Phase 2: Codebase Verification (pinpoint to code)
166
+
167
+ **Goal:** Prove every local claim against the live tree with **exact anchors** — path + symbol (+ line range when it reduces ambiguity). No “roughly around” or “probably in utils”.
168
+
169
+ Use the lightest reliable inspection tool first: prefer `rg -n` for search, read exact ranges for definitions, and only escalate to ad hoc scripts when structure across many files is required.
170
+
171
+ ### What to Check
172
+
173
+ | Category | Check | How — evidence shape |
174
+ | ---------------------- | ------------------------------------------ | -------------------------------------------- |
175
+ | **File paths** | Do referenced files exist at stated paths? | Path exists; cite path in the fix |
176
+ | **API signatures** | Parameters/returns match the plan? | `path` + symbol + signature snippet |
177
+ | **Import paths** | Package exports available? | `package.json` `exports` field + importer |
178
+ | **Existing patterns** | Assumed pattern actually used? | 1–3 real call sites (path + symbol) |
179
+ | **Naming conventions** | New files match neighbors? | Sibling directory listing + one exemplar |
180
+ | **Configuration** | Config/env keys real? | Config file / `.env.example` path + key name |
181
+
182
+ ### Evidence rule
183
+
184
+ Every material correction must include a **code pinpoint** of the form:
185
+
186
+ - `packages/foo/src/bar.ts` — `export function baz(...)` (or equivalent symbol)
187
+ - or `packages/foo/package.json` — `exports["./bar"]`
188
+
189
+ If you cannot produce a pinpoint, the claim is an **assumption** → drop it or block.
190
+
191
+ ### Codebase Red Flags
192
+
193
+ - Blueprint says `targets/` but codebase uses `emitters/`
194
+ - Blueprint imports from `package/subpath` but package.json has no subpath export
195
+ - Blueprint extends a class that doesn't exist yet (timing dependency)
196
+ - Blueprint assumes a function returns X but it actually returns Y
197
+ - Blueprint references env var that isn't in any config
198
+ - Blueprint cites a helper without a path/symbol (un-pinpointed)
199
+
200
+ ## Phase 3: Architecture Review
201
+
202
+ **Goal:** Adversarial critique of the architecture — find every way it can break — then select the most **elegant, durable, and efficient** design the constraints allow (not merely a correct one). Record why lighter alternatives were rejected when a heavier option is kept.
203
+
204
+ ### The Adversarial Checklist
205
+
206
+ Think like a hostile system trying to break the design:
207
+
208
+ #### Concurrency & Race Conditions
209
+
210
+ - [ ] What happens if two processes write simultaneously?
211
+ - [ ] What happens if operation A completes between steps of operation B?
212
+ - [ ] Is there a time-of-check-to-time-of-use (TOCTOU) gap?
213
+ - [ ] Can operations interleave in a way that corrupts state?
214
+
215
+ #### Echo Loops & Infinite Cycles
216
+
217
+ - [ ] If A triggers B which triggers A, what breaks the cycle?
218
+ - [ ] Is the cycle-break mechanism robust to timing variations?
219
+ - [ ] Can events batch in a way that bypasses the cycle-break?
220
+
221
+ #### Error Cascades
222
+
223
+ - [ ] If step N fails, do steps N+1...M still make sense?
224
+ - [ ] Can a partial failure leave the system in an inconsistent state?
225
+ - [ ] Is there a dead-letter queue for permanently failed operations?
226
+ - [ ] What happens after N retries? Is there a max?
227
+
228
+ #### Authentication & Sessions
229
+
230
+ - [ ] What happens when tokens expire during long operations?
231
+ - [ ] Is there a refresh mechanism? What if refresh also fails?
232
+ - [ ] Do WebSocket connections survive token rotation?
233
+
234
+ #### Data Integrity
235
+
236
+ - [ ] Can the ABA problem occur? (A→B→A looks like no change)
237
+ - [ ] Are soft deletes propagated correctly in both directions?
238
+ - [ ] What happens during schema changes with in-flight data? (Note: repos that prefer `db push` over migrations have different edge cases from migration-based repos.)
239
+ - [ ] Can orphaned records accumulate?
240
+
241
+ #### Platform Constraints
242
+
243
+ - [ ] Workers: 100s idle timeout, 30s CPU, 128MB memory
244
+ - [ ] SQLite: single-writer, no network FS, WAL checkpoint starvation
245
+ - [ ] WebSocket: protocol negotiation, heartbeat requirements
246
+ - [ ] File watchers: missed events during rapid bursts, git operations
247
+
248
+ ### Output: Severity Classification
249
+
250
+ | Severity | Definition | Example |
251
+ | -------- | ------------------------------------------------------ | ------------------------------------------ |
252
+ | CRITICAL | Will cause infinite loops, data loss, or build failure | Echo loop with no break mechanism |
253
+ | HIGH | Will cause bugs in normal usage | Duplicate outbox entries from dual process |
254
+ | MEDIUM | Will cause bugs in edge cases | Race condition during schema push |
255
+ | LOW | Suboptimal but functional | Unnecessary payload size |
256
+
257
+ ## Phase 4: Cross-Plan Alignment
258
+
259
+ **Goal:** Ensure the plan is coherent with all related blueprints.
260
+
261
+ ### What to Check
262
+
263
+ 1. **Upstream dependencies** — Are the interfaces/packages this plan depends on still designed the same way?
264
+ 2. **Downstream impacts** — Do plans that depend on this one need updating?
265
+ 3. **Shared decisions** — If two plans both chose a technology (e.g., Drizzle ORM), are they using compatible versions/patterns?
266
+ 4. **Non-goals consistency** — If plan A says "X is out of scope" and plan B says "depends on X from plan A", there's a contradiction.
267
+ 5. **Timeline consistency** — If plan A depends on plan B Phase 2, is plan B still structured with that phase?
268
+
269
+ ### Cross-Plan Update Protocol
270
+
271
+ When a fix in Plan A affects Plan B:
272
+
273
+ 1. Read Plan B in full
274
+ 2. Identify the specific section that needs updating
275
+ 3. Add a dated architecture note (not a rewrite)
276
+ 4. Add/update the cross-plan reference in both plans
277
+
278
+ ---
279
+
280
+ ## Phase 5: Blueprint Format Enforcement & Parallelization
281
+
282
+ > **"If the parallel execution surface (`/goal` autopilot, `ultragoal`) can't run 6-8 agents simultaneously, the plan is too coarse."**
283
+
284
+ **Goal:** Ensure every task follows Blueprint format and the dependency graph maximizes parallelism for `/goal` (autopilot) / `ultragoal` with Kahn's Algorithm.
285
+
286
+ The parallel orchestrator is production-ready. This phase ensures plans are structured to maximize parallel agent throughput.
287
+
288
+ ### Task Granularity Optimization (Parallel-First)
289
+
290
+ **Goal**: Maximize independent tasks while avoiding file conflicts and hidden dependencies.
291
+
292
+ **Rules of thumb**:
293
+
294
+ - **1 task = 1 file cluster** (touch 1–3 related files; split if >3 distinct areas)
295
+ - **No mixed concerns** (separate UI, data, and infra tasks)
296
+ - **Explicit dependencies only** (if a task needs outputs from another, list it in `Depends`)
297
+ - **Avoid shared-file contention** (if two tasks touch the same file, either merge or serialize)
298
+ - **Target wave size ≥ 6 tasks** for plans intended to run with 6–8 agents
299
+
300
+ **Split tasks when**:
301
+
302
+ - A task mixes **setup + implementation + refactor** in one block
303
+ - It touches **multiple packages** without a clear sequencing need
304
+ - It includes both **schema changes** and **feature code**
305
+ - It bundles **tests** for multiple components (split per component)
306
+
307
+ **Merge tasks when**:
308
+
309
+ - Two tasks always touch the **same files**
310
+ - One task is only **a tiny follow-up** (e.g., rename, lint fix) for another
311
+ - Dependencies create a chain with no parallelism
312
+
313
+ ### The Blueprint Task Template (Mandatory)
314
+
315
+ Every task MUST follow this exact structure:
316
+
317
+ ```markdown
318
+ #### [lane] Task X.Y: [Component Name]
319
+
320
+ **Status:** todo
321
+
322
+ **Depends:** Task 1.1, Task 1.2 (or "None" for Tier 0)
323
+
324
+ [Description paragraph — enough context for an independent agent to execute
325
+ without reading other tasks. Include: what, why, constraints, gotchas.]
326
+
327
+ **Files:**
328
+
329
+ - Create: `exact/path/to/file.ts`
330
+ - Create: `exact/path/to/file.test.ts`
331
+ - Modify: `exact/path/to/existing.ts`
332
+
333
+ **Steps (TDD):**
334
+
335
+ 1. Write failing test for [specific behavior]
336
+ 2. Run: `wp test --files <path/to/test-file.test.ts>` — verify the current contract
337
+ 3. Implement minimal code to pass
338
+ 4. Run: `wp test --files <path/to/test-file.test.ts>` — verify PASS
339
+ 5. Refactor if needed (complexity ≤ 8)
340
+ 6. Run: `wp lint --files <changed-file.ts> <changed-test.ts>` and `wp typecheck --files <changed-file.ts> <changed-test.ts>`
341
+
342
+ **Acceptance:**
343
+
344
+ - [ ] Positive contract test covers the requested behavior
345
+ - [ ] Implementation passes all tests
346
+ - [ ] `wp lint --files <changed-files...>` passes
347
+ - [ ] `wp typecheck --files <changed-files...>` passes
348
+ ```
349
+
350
+ Use `#### Task X.Y: ...` only when a lane prefix would add no value, but prefer lane-prefixed headers such as `[schema]`, `[backend]`, `[ui]`, `[infra]`, `[docs]`, or `[qa]`.
351
+
352
+ ### Project Conventions
353
+
354
+ These are enforced project conventions (with webpresso's conventions as the example):
355
+
356
+ | Convention | Rule | Rationale |
357
+ | -------------------- | ------------------------------------- | ------------------------------------------------------------------- |
358
+ | **Estimates** | Use t-shirt sizing ONLY (XS/S/M/L/XL) | No day/week estimates — too inaccurate and cause false expectations |
359
+ | **Database Changes** | Follow the repo's preferred workflow | e.g. `db push` before production launch, migrations after |
360
+
361
+ **Violations to flag:**
362
+
363
+ - Task says "1 day", "3 hours", "2 weeks" → Change to t-shirt size
364
+ - Task creates migration files or migration infrastructure when the repo prefers `db push` → Use the repo's chosen workflow
365
+ - References a retired database command when the repo uses `db push` → Use `db push` (entity YAML → schema generation → push)
366
+
367
+ ### Blueprint Validation Checklist
368
+
369
+ Run this audit on every task in the blueprint:
370
+
371
+ | Check | Violation | Fix |
372
+ | --------------------------------- | ---------------------------------------------------- | -------------------------------------------------------- |
373
+ | Has `**Depends:**` line? | Missing → parallel execution can't build DAG | Add explicit dependency or "None" |
374
+ | Has `**Files:**` section? | Missing → agents can't detect file conflicts | List every file touched (Create/Modify) |
375
+ | Has `**Steps (TDD):**`? | Missing → agents skip tests | Add positive verification steps with exact `wp` commands |
376
+ | Has `**Acceptance:**` checkboxes? | Missing → no completion criteria | Add testable acceptance criteria |
377
+ | Description self-contained? | References "see above" or "as described in Task X.Y" | Inline the context — each task runs independently |
378
+ | Files overlap with another task? | Two tasks modify same file → conflict in parallel | Merge tasks or add explicit `**Depends:**` |
379
+ | Uses t-shirt sizing? | Day/week estimates used | Replace with XS/S/M/L/XL |
380
+ | Follows repo DB workflow? | Diverges from repo's chosen workflow | Use repo's chosen workflow instead |
381
+
382
+ ### Granularity Rules
383
+
384
+ **The Goldilocks Zone:** Each task should be **XS-S size** (single focused change with tests). Smaller = overhead. Larger = blocks other work.
385
+
386
+ #### Too Coarse (Split It)
387
+
388
+ ```markdown
389
+ BAD: "Implement sync engine with push, pull, and connection manager"
390
+ ```
391
+
392
+ This is 3+ independent concerns. An agent working on this blocks 30+ minutes while push, pull, and connection could all run in parallel.
393
+
394
+ ```markdown
395
+ GOOD: Split into:
396
+ Task 3.1: Push engine (client-side) Depends: 2.3
397
+ Task 3.2: Pull engine (client-side) Depends: 1.2
398
+ Task 4.2: WebSocket auth proxy Depends: None
399
+ Task 5.1: Connection manager + orchestrator Depends: 3.1, 3.2, 4.1, 4.2
400
+ ```
401
+
402
+ #### Too Fine (Merge It)
403
+
404
+ ```markdown
405
+ BAD:
406
+ Task 1.1a: Create package.json for sync package
407
+ Task 1.1b: Create tsconfig.json for sync package
408
+ Task 1.1c: Add subpath exports to package.json
409
+ ```
410
+
411
+ These can't be tested independently and have no value as separate agent work.
412
+
413
+ ```markdown
414
+ GOOD: "Task 1.2: Scaffold sync package + local DB"
415
+ — package.json, tsconfig, exports, db client, tests — all one task
416
+ ```
417
+
418
+ ### Splitting Rules
419
+
420
+ | Signal | Action |
421
+ | -------------------------------------------- | ----------------------------------------- |
422
+ | Task touches 3+ unrelated files | Split into independent tasks |
423
+ | Task has "and" in the title | Split at the "and" |
424
+ | Task is M or larger | Split by concern (data layer, API, tests) |
425
+ | Two subtasks have no data dependency | They should be separate tasks |
426
+ | Task can't start until 3+ other tasks finish | Check if some deps are artificial |
427
+
428
+ ### Merging Rules
429
+
430
+ | Signal | Action |
431
+ | ------------------------------------------------- | -------------------------------------- |
432
+ | Task is XS with no tests | Merge with related task |
433
+ | Task creates a file that only one other task uses | Merge into that task |
434
+ | Three tasks all modify the same file | Merge or serialize them |
435
+ | Task has no test (pure config/scaffold) | Merge with the first task that uses it |
436
+
437
+ ### Dependency Graph Optimization
438
+
439
+ **Goal:** Maximize the width of each wave (more tasks in parallel = faster execution).
440
+
441
+ #### Wave Analysis
442
+
443
+ ```
444
+ Wave 0 (Tier 0): Tasks with no dependencies → All run in parallel
445
+ Wave 1 (Tier 1): Tasks depending only on Wave 0 → Run as Wave 0 completes
446
+ Wave 2 (Tier 2): Tasks depending on Wave 0+1 → Run as deps clear
447
+ ...
448
+ ```
449
+
450
+ **Metric: Critical path length** — The longest chain of sequential dependencies. This is the minimum wall-clock time regardless of how many agents you throw at it.
451
+
452
+ ### State-of-the-Art Parallelization Metrics (Required)
453
+
454
+ Use these metrics when refining or challenging a blueprint:
455
+
456
+ 1. **Ready Width (RW)**
457
+ - Number of runnable tasks at each wave.
458
+ - Target: first two waves should keep planned agents busy (for 6 agents, RW ≥ 6 in Wave 0 or Wave 1).
459
+
460
+ 2. **Critical Path Ratio (CPR)**
461
+ - `CPR = total_tasks / critical_path_length`
462
+ - Higher is better (more theoretical parallel speedup).
463
+ - Target: CPR ≥ 2.5 for parallel plans.
464
+
465
+ 3. **Dependency Density (DD)**
466
+ - `DD = total_dependency_edges / total_tasks`
467
+ - Lower is usually better (fewer coordination constraints).
468
+ - Target: DD ≤ 2.0 unless architecture requires strict sequencing.
469
+
470
+ 4. **Conflict Pressure (CP)**
471
+ - Count of same-file overlaps across tasks in the same wave.
472
+ - Hard target: CP = 0 for every wave.
473
+
474
+ If metrics miss target, refine task granularity or dependency design before execution.
475
+
476
+ #### Optimization Techniques
477
+
478
+ 1. **Break false dependencies.** If Task 2.1 "depends on" Task 1.2 but only needs the _interface_ (not the implementation), extract the interface into a Tier 0 task.
479
+
480
+ 2. **Parallelize within phases.** If Phase 2 has 3 tasks that all depend on Phase 1 but not on each other, they should all be in the same wave.
481
+
482
+ 3. **Front-load independent work.** Move tasks that don't depend on anything to Wave 0 — they start immediately.
483
+
484
+ 4. **Minimize the fan-in bottleneck.** If Task 5.1 depends on Tasks 3.1, 3.2, 4.1, and 4.2 — that's 4 tasks that must ALL complete before 5.1 starts. Ask: can any of 5.1's work start earlier?
485
+
486
+ #### File Conflict Detection
487
+
488
+ Two tasks running in parallel MUST NOT modify the same file. If they do:
489
+
490
+ 1. **Preferred:** Restructure so each task has its own files
491
+ 2. **Acceptable:** Add explicit `**Depends:**` to serialize them
492
+ 3. **Last resort:** Document the conflict in the Quick Reference table
493
+
494
+ ### Quick Reference Table (Required)
495
+
496
+ Every refined blueprint MUST include this table for parallel execution (`/goal` autopilot, `ultragoal`):
497
+
498
+ ```markdown
499
+ ## Quick Reference (Execution Waves)
500
+
501
+ | Wave | Tasks | Dependencies | Parallelizable | Effort (T-shirt) |
502
+ | ----------------- | --------------------------------- | ---------------- | -------------- | ---------------- |
503
+ | **Wave 0** | 1.1, 1.2, 1.3 | None | 3 agents | XS-S |
504
+ | **Wave 1** | 2.1, 2.2, 2.3 | Wave 0 | 3 agents | S-M |
505
+ | **Wave 2** | 3.1, 3.2, 4.2 | Wave 1 (partial) | 3 agents | S-M |
506
+ | **Wave 3** | 4.1, 5.1 | Wave 2 | 2 agents | M |
507
+ | **Wave 4** | 6.1 | Wave 3 | 1 agent | S |
508
+ | **Critical path** | 1.1 → 2.3 → 3.1 → 4.1 → 5.1 → 6.1 | — | 6 waves | L |
509
+
510
+ ### Parallel Metrics Snapshot (Required)
511
+
512
+ | Metric | Formula / Meaning | Target | Actual |
513
+ | ------ | ---------------------------------- | -------------------- | ------- |
514
+ | RW0 | Ready tasks in Wave 0 | ≥ planned agents / 2 | <value> |
515
+ | CPR | total_tasks / critical_path_length | ≥ 2.5 | <value> |
516
+ | DD | dependency_edges / total_tasks | ≤ 2.0 | <value> |
517
+ | CP | same-file overlaps per wave | 0 | <value> |
518
+
519
+ If any target misses, include a short "refinement delta" note describing task split/merge changes.
520
+ ```
521
+
522
+ ### Parallelization Score
523
+
524
+ Rate the plan's parallelizability:
525
+
526
+ | Score | Definition | Action |
527
+ | ----- | ------------------------------------- | ----------------------------------- |
528
+ | **A** | RW target met, CPR ≥ 2.5, CP = 0 | Ready for parallel execution |
529
+ | **B** | RW near target, CPR 2.0-2.49, CP = 0 | Improve dependencies before execute |
530
+ | **C** | CPR 1.5-1.99 or frequent narrow waves | Split coarse tasks, reduce fan-in |
531
+ | **D** | CPR < 1.5 or CP > 0 in planned waves | Must restructure before execution |
532
+
533
+ ### Self-Contained Task Test
534
+
535
+ For each task, ask: **"Can an agent execute this task with ONLY the task description, the codebase, and the repository's `wp` commands?"**
536
+
537
+ If the answer is no, the task is missing context. Common fixes:
538
+
539
+ - Inline interface definitions (don't say "use the interface from Task 1.1")
540
+ - Include the schema/type the task needs to implement
541
+ - Specify exact import paths
542
+ - Include example input/output for test cases
543
+
544
+ ---
545
+
546
+ ## Phase 6: Apply & Consolidate
547
+
548
+ **Goal:** Write all fixes into the blueprint as a single coherent update.
549
+
550
+ ### Fix Tagging Convention
551
+
552
+ Every fix gets an `(Fx)` tag that appears:
553
+
554
+ 1. In the inline task where the fix is applied
555
+ 2. In the Edge Cases table
556
+ 3. In the Risks table (if applicable)
557
+ 4. In the Technology Choices table (if applicable)
558
+
559
+ This creates **traceability** — anyone reading the blueprint can trace why a particular decision was made back to the fact-check finding.
560
+
561
+ ### Required Updates
562
+
563
+ After applying all fixes, verify:
564
+
565
+ - [ ] **Blueprint format** — Every task has Depends, Files, Steps (TDD), Acceptance
566
+ - [ ] **Self-contained tasks** — Each task can be executed by an independent agent
567
+ - [ ] **Engineering principles** — DRY, SOLID, YAGNI, and KISS are applied; unnecessary abstractions, dependencies, and config are removed
568
+ - [ ] **Public package safety** — Plans that touch package or release surfaces include tarball/package-surface leak checks and denied-content exclusions
569
+ - [ ] **No file conflicts** — No two parallel tasks modify the same file
570
+ - [ ] **Quick Reference table** — Updated with correct waves and agent counts
571
+ - [ ] **Edge Cases table** — Every finding with severity ≥ MEDIUM has a row
572
+ - [ ] **Risks table** — Every finding with severity ≥ HIGH has a row with mitigation
573
+ - [ ] **Technology Choices table** — Any library/tool changes reflected
574
+ - [ ] **Key Decisions table** — Any decision changes reflected with rationale
575
+ - [ ] **Cross-Plan References** — Downstream plans updated if affected
576
+ - [ ] **Progress field** — Updated to note fact-check completion
577
+ - [ ] **Architecture diagram** — Updated if technology names changed
578
+
579
+ ### Verification Report
580
+
581
+ At the end, produce a summary:
582
+
583
+ ```markdown
584
+ ## Refinement Summary
585
+
586
+ | Metric | Value |
587
+ | ------------------------- | --------------------- |
588
+ | Findings total | 20 |
589
+ | Critical | 3 |
590
+ | High | 5 |
591
+ | Medium | 8 |
592
+ | Low | 4 |
593
+ | Fixes applied | 20/20 |
594
+ | Cross-plans updated | 2 |
595
+ | Edge cases documented | 15 |
596
+ | Risks documented | 12 |
597
+ | **Parallelization score** | B (5 tasks in Wave 0) |
598
+ | **Critical path** | 6 waves (~90 min) |
599
+ | **Max parallel agents** | 3 |
600
+ | **Total tasks** | 11 |
601
+ | **Blueprint compliant** | 11/11 |
602
+ ```
603
+
604
+ ---
605
+
606
+ ## Red Flags — STOP
607
+
608
+ Stop and escalate to the user if:
609
+
610
+ - A CRITICAL finding invalidates the core architecture (e.g., the chosen database doesn't work on the target runtime)
611
+ - Two findings contradict each other (fix A requires X, fix B requires not-X)
612
+ - A cross-plan dependency is broken and requires re-planning
613
+ - The number of CRITICAL + HIGH findings exceeds 10 (plan may need fundamental rethinking)
614
+ - A technology assumption affects more than 3 tasks (cascading rewrite needed)
615
+ - Parallelization score is **D** (1 task in Wave 0) — plan needs fundamental restructure
616
+ - Any material claim still lacks a **code pinpoint** or **official-doc + version** after a full pass (confidence ≠ 100%)
617
+ - The “ready” design is only correct, not the most **elegant / durable / efficient** option under constraints
618
+
619
+ ## Parallel Agent Strategy
620
+
621
+ The refinement pipeline itself **must** maximize concurrency:
622
+
623
+ | Lane | Phase | Tools | Focus |
624
+ | ---- | ------------------------ | --------------------------------------- | ------------------------------------------------------- |
625
+ | A | Technology fact-check | WebSearch, WebFetch, Context7, registry | Official latest docs, version-pinned APIs |
626
+ | B | Codebase verification | Grep, Glob, Read | Path + symbol pinpoints, 0 assumptions |
627
+ | C | Architecture review | Blueprint + evidence from A/B | Races, elegance, durability, efficiency |
628
+ | D | Review lenses (optional) | plan-*-review skills | CEO / design / eng / DevEx in parallel when independent |
629
+
630
+ **Lanes A–C(/D) run in parallel.** Phases 4–6 (cross-plan, blueprint enforcement, apply) run after their inputs land — not after an artificial full serial wait when a subset already unblocks the next edit.
631
+
632
+ **Do not** refine serially “for simplicity” when claims partition cleanly (external vs local vs architecture).
633
+
634
+ ## Related Skills
635
+
636
+ - **plan** — Creating plans (this skill refines them)
637
+ - **question-flow** — Supported user-input pattern for plan clarification
638
+ - **testing-philosophy** — Test strategy validation within plans (integration-first, 85% mutation)
639
+ - **verify** — Evidence-based completion and post-implementation verification
640
+ - **systematic-debugging** — When refinement finds broken assumptions
641
+
642
+ ## Related Commands
643
+
644
+ - `wp blueprint new "<goal>" --complexity <size>` — Create a new blueprint (this skill refines it)
645
+ - `wp blueprint audit --all --strict` — Audit blueprint format/lifecycle before or after refinement
646
+ - `/goal` (autopilot) / `ultragoal` — Operator-facing parallel execution workflow for refined Blueprint-shaped work
647
+ - `/verify <target>` — Post-implementation quality gate
648
+ - `/soa <target>` — Apply SOA 2026 quality standards (TDD, complexity ≤8, mutation ≥85%)
649
+
650
+ **Parallel Execution:** Refined plans should execute through the current workflow surface while Blueprint remains the durable lifecycle source of truth via `wp blueprint start|task|finalize`. See the `autopilot` and `ultragoal` skills for the current operator guidance.
651
+
652
+ ## Planned eligibility verdict
653
+
654
+ Before declaring a blueprint planned-eligible, complete its Trust Dossier, evidence material claims, close material decisions, define Promotion Gates, and emit exactly one verdict: `planned-eligible` or `not-planned-eligible`. Reject speculative abstractions, unverifiable material claims, and "decide during implementation" placeholders. Blueprints implementing this gate before it lands may document that the dossier becomes required once the gate exists.