@rune-kit/rune 2.2.0 → 2.2.1

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 (144) hide show
  1. package/README.md +40 -34
  2. package/compiler/__tests__/pack-split.test.js +145 -0
  3. package/compiler/bin/rune.js +0 -5
  4. package/compiler/doctor.js +42 -0
  5. package/compiler/emitter.js +27 -4
  6. package/compiler/parser.js +41 -3
  7. package/compiler/transformer.js +10 -6
  8. package/compiler/transforms/compliance.js +40 -0
  9. package/extensions/ai-ml/PACK.md +38 -474
  10. package/extensions/ai-ml/skills/ai-agents.md +172 -0
  11. package/extensions/ai-ml/skills/code-sandbox.md +187 -0
  12. package/extensions/ai-ml/skills/deep-research.md +146 -0
  13. package/extensions/ai-ml/skills/embedding-search.md +66 -0
  14. package/extensions/ai-ml/skills/fine-tuning-guide.md +74 -0
  15. package/extensions/ai-ml/skills/llm-architect.md +125 -0
  16. package/extensions/ai-ml/skills/llm-integration.md +64 -0
  17. package/extensions/ai-ml/skills/prompt-patterns.md +72 -0
  18. package/extensions/ai-ml/skills/rag-patterns.md +66 -0
  19. package/extensions/ai-ml/skills/web-extraction.md +114 -0
  20. package/extensions/analytics/PACK.md +19 -484
  21. package/extensions/analytics/skills/ab-testing.md +72 -0
  22. package/extensions/analytics/skills/dashboard-patterns.md +83 -0
  23. package/extensions/analytics/skills/data-validation.md +68 -0
  24. package/extensions/analytics/skills/funnel-analysis.md +81 -0
  25. package/extensions/analytics/skills/sql-patterns.md +57 -0
  26. package/extensions/analytics/skills/statistical-analysis.md +79 -0
  27. package/extensions/analytics/skills/tracking-setup.md +71 -0
  28. package/extensions/backend/PACK.md +44 -618
  29. package/extensions/backend/skills/api-patterns.md +84 -0
  30. package/extensions/backend/skills/async-pipeline.md +193 -0
  31. package/extensions/backend/skills/auth-patterns.md +97 -0
  32. package/extensions/backend/skills/background-jobs.md +133 -0
  33. package/extensions/backend/skills/caching-patterns.md +108 -0
  34. package/extensions/backend/skills/cli-generation.md +133 -0
  35. package/extensions/backend/skills/database-patterns.md +87 -0
  36. package/extensions/backend/skills/middleware-patterns.md +104 -0
  37. package/extensions/chrome-ext/PACK.md +19 -921
  38. package/extensions/chrome-ext/skills/cws-preflight.md +143 -0
  39. package/extensions/chrome-ext/skills/cws-publish.md +104 -0
  40. package/extensions/chrome-ext/skills/ext-ai-integration.md +251 -0
  41. package/extensions/chrome-ext/skills/ext-messaging.md +139 -0
  42. package/extensions/chrome-ext/skills/ext-storage.md +133 -0
  43. package/extensions/chrome-ext/skills/mv3-scaffold.md +164 -0
  44. package/extensions/content/PACK.md +43 -335
  45. package/extensions/content/skills/blog-patterns.md +88 -0
  46. package/extensions/content/skills/cms-integration.md +131 -0
  47. package/extensions/content/skills/content-scoring.md +107 -0
  48. package/extensions/content/skills/i18n.md +83 -0
  49. package/extensions/content/skills/mdx-authoring.md +137 -0
  50. package/extensions/content/skills/reference.md +1014 -0
  51. package/extensions/content/skills/seo-patterns.md +67 -0
  52. package/extensions/content/skills/video-repurpose.md +153 -0
  53. package/extensions/devops/PACK.md +38 -457
  54. package/extensions/devops/skills/chaos-testing.md +67 -0
  55. package/extensions/devops/skills/ci-cd.md +75 -0
  56. package/extensions/devops/skills/docker.md +58 -0
  57. package/extensions/devops/skills/edge-serverless.md +163 -0
  58. package/extensions/devops/skills/infra-as-code.md +158 -0
  59. package/extensions/devops/skills/kubernetes.md +110 -0
  60. package/extensions/devops/skills/monitoring.md +57 -0
  61. package/extensions/devops/skills/server-setup.md +64 -0
  62. package/extensions/devops/skills/ssl-domain.md +42 -0
  63. package/extensions/ecommerce/PACK.md +62 -226
  64. package/extensions/ecommerce/skills/cart-system.md +79 -0
  65. package/extensions/ecommerce/skills/inventory-mgmt.md +102 -0
  66. package/extensions/ecommerce/skills/order-management.md +126 -0
  67. package/extensions/ecommerce/skills/payment-integration.md +472 -0
  68. package/extensions/ecommerce/skills/shopify-dev.md +69 -0
  69. package/extensions/ecommerce/skills/subscription-billing.md +93 -0
  70. package/extensions/ecommerce/skills/tax-compliance.md +117 -0
  71. package/extensions/gamedev/PACK.md +66 -317
  72. package/extensions/gamedev/skills/asset-pipeline.md +74 -0
  73. package/extensions/gamedev/skills/audio-system.md +129 -0
  74. package/extensions/gamedev/skills/camera-system.md +87 -0
  75. package/extensions/gamedev/skills/ecs.md +98 -0
  76. package/extensions/gamedev/skills/game-loops.md +72 -0
  77. package/extensions/gamedev/skills/input-system.md +199 -0
  78. package/extensions/gamedev/skills/multiplayer.md +180 -0
  79. package/extensions/gamedev/skills/particles.md +105 -0
  80. package/extensions/gamedev/skills/physics-engine.md +89 -0
  81. package/extensions/gamedev/skills/scene-management.md +146 -0
  82. package/extensions/gamedev/skills/threejs-patterns.md +90 -0
  83. package/extensions/gamedev/skills/webgl.md +71 -0
  84. package/extensions/mobile/PACK.md +56 -223
  85. package/extensions/mobile/skills/app-store-connect.md +152 -0
  86. package/extensions/mobile/skills/app-store-prep.md +66 -0
  87. package/extensions/mobile/skills/deep-linking.md +109 -0
  88. package/extensions/mobile/skills/flutter.md +60 -0
  89. package/extensions/mobile/skills/ios-build-pipeline.md +142 -0
  90. package/extensions/mobile/skills/native-bridge.md +66 -0
  91. package/extensions/mobile/skills/ota-updates.md +97 -0
  92. package/extensions/mobile/skills/push-notifications.md +111 -0
  93. package/extensions/mobile/skills/react-native.md +82 -0
  94. package/extensions/saas/PACK.md +26 -720
  95. package/extensions/saas/skills/billing-integration.md +121 -0
  96. package/extensions/saas/skills/feature-flags.md +130 -0
  97. package/extensions/saas/skills/multi-tenant.md +103 -0
  98. package/extensions/saas/skills/onboarding-flow.md +139 -0
  99. package/extensions/saas/skills/subscription-flow.md +95 -0
  100. package/extensions/saas/skills/team-management.md +144 -0
  101. package/extensions/security/PACK.md +10 -448
  102. package/extensions/security/skills/api-security.md +140 -0
  103. package/extensions/security/skills/compliance.md +68 -0
  104. package/extensions/security/skills/owasp-audit.md +64 -0
  105. package/extensions/security/skills/pentest-patterns.md +77 -0
  106. package/extensions/security/skills/secret-mgmt.md +65 -0
  107. package/extensions/security/skills/supply-chain.md +65 -0
  108. package/extensions/trading/PACK.md +18 -535
  109. package/extensions/trading/skills/chart-components.md +55 -0
  110. package/extensions/trading/skills/experiment-loop.md +125 -0
  111. package/extensions/trading/skills/fintech-patterns.md +47 -0
  112. package/extensions/trading/skills/indicator-library.md +58 -0
  113. package/extensions/trading/skills/quant-analysis.md +111 -0
  114. package/extensions/trading/skills/realtime-data.md +58 -0
  115. package/extensions/trading/skills/trade-logic.md +104 -0
  116. package/extensions/ui/PACK.md +34 -853
  117. package/extensions/ui/skills/a11y-audit.md +91 -0
  118. package/extensions/ui/skills/animation-patterns.md +106 -0
  119. package/extensions/ui/skills/component-patterns.md +75 -0
  120. package/extensions/ui/skills/design-decision.md +98 -0
  121. package/extensions/ui/skills/design-system.md +68 -0
  122. package/extensions/ui/skills/landing-patterns.md +155 -0
  123. package/extensions/ui/skills/palette-picker.md +162 -0
  124. package/extensions/ui/skills/react-health.md +90 -0
  125. package/extensions/ui/skills/type-system.md +125 -0
  126. package/extensions/ui/skills/web-vitals.md +153 -0
  127. package/extensions/zalo/PACK.md +117 -0
  128. package/extensions/zalo/skills/zalo-oa-mcp.md +317 -0
  129. package/extensions/zalo/skills/zalo-oa-messaging.md +429 -0
  130. package/extensions/zalo/skills/zalo-oa-setup.md +236 -0
  131. package/extensions/zalo/skills/zalo-oa-webhook.md +189 -0
  132. package/extensions/zalo/skills/zalo-personal-messaging.md +194 -0
  133. package/extensions/zalo/skills/zalo-personal-setup.md +153 -0
  134. package/extensions/zalo/skills/zalo-rate-guard.md +219 -0
  135. package/package.json +1 -1
  136. package/skills/brainstorm/SKILL.md +63 -1
  137. package/skills/cook/SKILL.md +84 -5
  138. package/skills/mcp-builder/SKILL.md +48 -1
  139. package/skills/review/SKILL.md +42 -5
  140. package/skills/review-intake/SKILL.md +17 -1
  141. package/skills/skill-router/SKILL.md +89 -7
  142. package/skills/team/SKILL.md +24 -1
  143. package/skills/test/SKILL.md +18 -0
  144. package/skills/verification/SKILL.md +40 -1
@@ -4,7 +4,7 @@ description: "Meta-enforcement layer that routes EVERY agent action through the
4
4
  user-invocable: false
5
5
  metadata:
6
6
  author: runedev
7
- version: "1.1.0"
7
+ version: "1.2.0"
8
8
  layer: L0
9
9
  model: haiku
10
10
  group: orchestrator
@@ -64,14 +64,33 @@ Before standard routing, check if adaptive routing rules exist:
64
64
  - Model hints are written by cook Phase 8 when debug-fix loops hit max retries on the same error pattern
65
65
  - Model hints do NOT override explicit user model preferences
66
66
 
67
+ ### Step 0.25 — Request Classifier (Fast-Path Filter)
68
+
69
+ Before intent classification, categorize the request into one of 5 types. This determines the **enforcement level** — how strictly routing must be followed.
70
+
71
+ | Request Type | Keywords / Signals | Enforcement | Action |
72
+ |---|---|---|---|
73
+ | `CODE_CHANGE` | "build", "implement", "add", "create", "fix", "refactor", "update code" | **FULL** | cook mandatory, no exceptions |
74
+ | `QUESTION` | "what is", "how does", "explain", "why" | **LITE** | Check if a skill has domain knowledge first; answer directly if no skill matches |
75
+ | `DEBUG_REQUEST` | "error", "bug", "not working", "broken", "crash", "fails" | **FULL** | debug skill mandatory |
76
+ | `REVIEW_REQUEST` | "review", "check", "audit", "look at this code" | **FULL** | review skill mandatory |
77
+ | `EXPLORE` | "find", "search", "where is", "show me", "list" | **LITE** | scout if codebase-related; answer directly if general |
78
+
79
+ **Enforcement levels:**
80
+ - **FULL** → MUST route through a skill. Writing code without skill invocation = protocol violation.
81
+ - **LITE** → SHOULD check if a skill applies. Can answer directly if no skill matches and the response involves no code changes.
82
+
83
+ **Escape hatch**: If request is clearly trivial (< 5 LOC change, single-line fix, user says "just do it"), classify as CODE_CHANGE but cook activates Fast Mode automatically.
84
+
67
85
  ### Step 0.5 — STOP before responding
68
86
 
69
87
  Before generating ANY response (including clarifying questions), the agent MUST:
70
88
 
71
- 1. **Classify the user's intent** using the routing table below
72
- 2. **Identify which skill(s) match** if even 1% chance a skill applies, invoke it
73
- 3. **Invoke the skill** via the Skill tool
74
- 4. **Follow the skill's instructions** the skill dictates the workflow, not the agent
89
+ 1. **Check the request type** from Step 0.25 — if FULL enforcement, routing is mandatory
90
+ 2. **Classify the user's intent** using the routing table below
91
+ 3. **Identify which skill(s) match** if even 1% chance a skill applies, invoke it
92
+ 4. **Invoke the skill** via the Skill tool
93
+ 5. **Follow the skill's instructions** — the skill dictates the workflow, not the agent
75
94
 
76
95
  ### Step 1 — Intent Classification (Progressive Disclosure)
77
96
 
@@ -143,7 +162,11 @@ These are rarely invoked directly — they're called by Tier 1/2 skills:
143
162
 
144
163
  #### Tier 4 — Domain Extension Packs (L4)
145
164
 
146
- When user intent matches a domain-specific pattern or user explicitly invokes an L4 trigger command, route to the L4 pack. The agent reads the pack's PACK.md and follows the matching skill's workflow.
165
+ When user intent matches a domain-specific pattern or user explicitly invokes an L4 trigger command, route to the L4 pack.
166
+
167
+ **Split pack loading** (context-efficient): First `Read` the pack's PACK.md index. If the index contains `format: split` in its frontmatter metadata, it is a split pack — the index lists skills in a table but skill content lives in separate files under `skills/`. Match user intent to the specific skill name in the table, then `Read` only that skill file (e.g., `extensions/backend/skills/api-design.md`). This loads ~100-200 lines instead of ~1000+.
168
+
169
+ **Monolith pack loading** (legacy): If no `format: split` marker, the PACK.md contains all skills inline — read it fully and extract the matching `### skill-name` section.
147
170
 
148
171
  | User Intent / Domain Signal | Route To | Pack File |
149
172
  |---|---|---|
@@ -159,13 +182,41 @@ When user intent matches a domain-specific pattern or user explicitly invokes an
159
182
  | Three.js, WebGL, game loop, physics | `@rune/gamedev` | `extensions/gamedev/PACK.md` |
160
183
  | Blog, CMS, MDX, i18n, SEO | `@rune/content` | `extensions/content/PACK.md` |
161
184
  | Analytics, A/B testing, funnels, dashboards | `@rune/analytics` | `extensions/analytics/PACK.md` |
185
+ | Chrome extension, manifest, service worker | `@rune/chrome-ext` | `extensions/chrome-ext/PACK.md` |
186
+ | PRD, roadmap, KPI, release notes, product spec | `@rune-pro/product` | `extensions/pro-product/PACK.md` |
187
+ | Sales outreach, pipeline, call prep, prospecting | `@rune-pro/sales` | `extensions/pro-sales/PACK.md` |
188
+ | Data science, SQL, dashboards, statistical analysis | `@rune-pro/data-science` | `extensions/pro-data-science/PACK.md` |
189
+ | Support tickets, KB, escalation, SLA tracking | `@rune-pro/support` | `extensions/pro-support/PACK.md` |
190
+ | Budget, expense, revenue forecast, P&L, cash flow | `@rune-pro/finance` | `extensions/pro-finance/PACK.md` |
191
+ | Contract review, NDA, compliance, GDPR, IP audit | `@rune-pro/legal` | `extensions/pro-legal/PACK.md` |
162
192
 
163
193
  **L4 routing rules:**
164
- 1. If user explicitly invokes an L4 trigger (e.g., `/rune rag-patterns`), read the PACK.md and follow the skill workflow directly
194
+ 1. If user explicitly invokes an L4 trigger (e.g., `/rune rag-patterns`), read the PACK.md index first, then load only the matching skill file (split packs) or extract the matching section (monolith packs)
165
195
  2. If the intent also involves implementation, route to `cook` (L1) first — cook will detect L4 context in Phase 1.5
166
196
  3. L4 packs supplement L1/L2 workflows — they are domain knowledge, not standalone orchestrators
167
197
  4. L4 packs can call L3 utilities (scout, verification) but CANNOT call L1 or L2 skills
168
198
  5. If the L4 pack file is not found on disk, skip silently and proceed with standard routing
199
+ 6. **NEVER load an entire split pack** — always load index first, then only the specific skill file needed
200
+
201
+ ### Step 1.5 — File Ownership Matrix (Constraint Inheritance)
202
+
203
+ When the routed skill produces file changes, the **owner skill's constraints** apply to those files — even if a different skill (e.g., cook) is the orchestrator.
204
+
205
+ | File Pattern | Owner Skill | Constraints Applied |
206
+ |---|---|---|
207
+ | `*.test.*`, `*.spec.*`, `__tests__/` | `rune:test` | Test patterns, assertions, no `test.skip`, coverage rules |
208
+ | `migrations/`, `schema.*`, `*.prisma` | `rune:db` | Migration safety, rollback script, parameterized queries |
209
+ | `Dockerfile`, `*.yml` (CI/CD), `terraform/` | `rune:deploy` | Deployment checklist, no hardcoded secrets |
210
+ | `docs/*.md`, `README.md`, `CHANGELOG.md` | `rune:docs` | Documentation patterns, no stale references |
211
+ | `SKILL.md`, `PACK.md` | `rune:skill-forge` | Skill template compliance, frontmatter validation |
212
+ | `.env*`, `*secret*`, `*credential*` | `rune:sentinel` | Security scan mandatory, never commit secrets |
213
+ | `*.css`, `*.scss`, `tailwind.config.*` | `@rune/ui` | Design system patterns (if L4 pack installed) |
214
+
215
+ **Ownership rules:**
216
+ 1. Ownership = **constraints apply**, NOT exclusive access. cook can modify test files during Phase 4 as long as test constraints are honored.
217
+ 2. If a file matches multiple patterns, ALL matching constraints apply (union, not exclusive).
218
+ 3. If no pattern matches, the routed skill's own constraints apply (default behavior).
219
+ 4. File ownership is checked DURING implementation, not at routing time — it augments, not replaces, skill routing.
169
220
 
170
221
  ### Step 2 — Compound Intent Resolution
171
222
 
@@ -235,9 +286,22 @@ These DO NOT need skill routing:
235
286
 
236
287
  ## Output Format
237
288
 
289
+ ### Routing Proof (Required in Every Code Response)
290
+
291
+ Every response that involves code changes MUST begin with a routing proof line:
292
+
293
+ ```
294
+ > Routed: rune:<skill> | Type: CODE_CHANGE | Confidence: HIGH
295
+ ```
296
+
297
+ This is NOT optional formatting. It is evidence that routing occurred. If this line is missing from a code response, the response violated skill-router compliance. For LITE enforcement (QUESTION, EXPLORE), the proof line is optional.
298
+
299
+ ### Full Routing Decision (when announcing route)
300
+
238
301
  ```
239
302
  ## Routing Decision
240
303
  - **Intent**: [classified user intent]
304
+ - **Type**: CODE_CHANGE | QUESTION | DEBUG_REQUEST | REVIEW_REQUEST | EXPLORE
241
305
  - **Skill**: rune:[skill-name]
242
306
  - **Confidence**: HIGH | MEDIUM | LOW
243
307
  - **Override**: [routing override applied, if any]
@@ -278,6 +342,24 @@ For multi-skill chains:
278
342
  - Success = every agent response passes through routing check
279
343
  - Failure = any code written without skill invocation
280
344
 
345
+ ## Self-Verification Trigger (MANDATORY)
346
+
347
+ <HARD-GATE>
348
+ Before EVERY response, complete this 3-point self-check:
349
+
350
+ 1. **Did I classify this request?** (Step 0.25 — what type is it?)
351
+ 2. **Did I route through a skill?** (Step 1-2 — which skill handles this?)
352
+ 3. **Am I about to write code without a skill invocation?** → **STOP. Route first.**
353
+
354
+ If the request type is `CODE_CHANGE` or `DEBUG_REQUEST` (FULL enforcement) and ANY answer is "no":
355
+ → DO NOT RESPOND. Complete routing first.
356
+
357
+ If the request type is `QUESTION` or `EXPLORE` (LITE enforcement):
358
+ → Check if a skill has relevant domain knowledge. If yes, route. If no, respond directly.
359
+
360
+ **User override**: If user explicitly says "skip routing", "just write it", "no process" → respect the override. Log: "User override: routing skipped per explicit request."
361
+ </HARD-GATE>
362
+
281
363
  ## Cost Profile
282
364
 
283
365
  ~0 tokens (routing logic is internalized from this document). Cost comes from the skills it routes to, not from skill-router itself. The routing table is loaded once and cached in context.
@@ -5,7 +5,7 @@ context: fork
5
5
  agent: general-purpose
6
6
  metadata:
7
7
  author: runedev
8
- version: "0.3.0"
8
+ version: "0.4.0"
9
9
  layer: L1
10
10
  model: opus
11
11
  group: orchestrator
@@ -250,6 +250,29 @@ Error recovery:
250
250
  → Present to user for decision before continuing
251
251
  ```
252
252
 
253
+ **3c. Evaluate subagent status per stream.**
254
+
255
+ Each cook instance MUST have returned one of four statuses. Team handles them as follows:
256
+
257
+ | Cook Status | Team Action |
258
+ |-------------|-------------|
259
+ | `DONE` | Stream cleared for merge — proceed normally |
260
+ | `DONE_WITH_CONCERNS` | Stream cleared for merge, BUT trigger **cross-workstream review**: check if the concern impacts any other stream's files or contracts before merging ALL streams. Log concern in Team Report. |
261
+ | `NEEDS_CONTEXT` | Stream paused — present the specific question to user. Resume that stream after answer. Other independent streams may continue in parallel. |
262
+ | `BLOCKED` | Stream blocked from merge. If stream has no dependents → continue with remaining streams and report partial completion. If stream has dependents → STOP all dependent streams, present to user with full blocker details. |
263
+
264
+ **Cross-workstream review (triggered by any DONE_WITH_CONCERNS)**:
265
+
266
+ ```
267
+ 1. Read the concern from the cook report
268
+ 2. Check if the concern touches shared contracts, interfaces, or shared files
269
+ → Use Grep to find the concern's affected symbols/files across all worktrees
270
+ 3. If concern is isolated to stream's own files → proceed to merge (concern logged only)
271
+ 4. If concern crosses stream boundaries → resolve before merge:
272
+ → Present to user with: affected streams, concern details, two remediation options
273
+ → Do NOT merge any stream until user decides
274
+ ```
275
+
253
276
  Mark todo[2] `completed`.
254
277
 
255
278
  ---
@@ -144,6 +144,23 @@ After GREEN phase, call `verification` to check coverage threshold (80% minimum)
144
144
  - If coverage drops below 80%: identify uncovered lines, write additional tests
145
145
  - Report coverage gaps with file:line references
146
146
 
147
+ ### Phase 6.5: Diff-Aware Mode (optional)
148
+
149
+ When invoked with `mode: "diff-aware"` or by `cook` after implementation:
150
+
151
+ 1. Run `git diff main --name-only` to get changed files
152
+ 2. For each changed file, trace its **blast radius**: what imports it? what routes does it serve? what components render it?
153
+ 3. Map changed files → affected routes/endpoints/pages
154
+ 4. Prioritize tests: files with most downstream dependents get tested first
155
+ 5. Generate targeted test commands that cover ONLY affected paths — skip unchanged modules
156
+
157
+ This mode is valuable for large codebases where running the full suite is slow. It answers: "what could this diff have broken?"
158
+
159
+ ```
160
+ Input: git diff main --name-only
161
+ Output: Prioritized test plan targeting only affected paths
162
+ ```
163
+
147
164
  ## Test Types
148
165
 
149
166
  | Type | When | Framework | Speed |
@@ -152,6 +169,7 @@ After GREEN phase, call `verification` to check coverage threshold (80% minimum)
152
169
  | Integration | API endpoints, DB operations | supertest/httpx/reqwest | Medium |
153
170
  | E2E | Critical user flows | Playwright/Cypress via browser-pilot | Slow |
154
171
  | Regression | After bug fixes | Same as unit | Fast |
172
+ | Diff-aware | After implementation, large codebases | Same as unit + integration | Fast (targeted) |
155
173
 
156
174
  ## Error Recovery
157
175
 
@@ -3,7 +3,7 @@ name: verification
3
3
  description: "Universal verification runner. Runs lint, type-check, tests, and build. Use after any code change to verify nothing is broken."
4
4
  metadata:
5
5
  author: runedev
6
- version: "0.2.0"
6
+ version: "0.3.0"
7
7
  layer: L3
8
8
  model: haiku
9
9
  group: validation
@@ -98,6 +98,44 @@ If build fails: record first 20 lines of build output, mark as FAIL.
98
98
 
99
99
  Compile all results into the structured report. Update all TodoWrite items to completed.
100
100
 
101
+ ### Artifact Verification
102
+
103
+ > Inspired by CLI-Anything (HKUDS/CLI-Anything, 14.5k★): "Never trust exit 0."
104
+ > Many tools exit 0 even when they fail silently. Always verify ACTUAL output.
105
+
106
+ After each phase command, verify that the expected artifact or indicator is present:
107
+
108
+ **Test output** — scan stdout for the pass/fail summary line:
109
+ - Vitest/Jest: look for `X passed`, `X failed` — if neither appears, output is incomplete
110
+ - Pytest: look for `X passed` or `X failed` — exit 0 with no summary = runner crashed silently
111
+ - If only exit code available and no summary line found → mark as INCOMPLETE, not PASS
112
+
113
+ **Build output** — after `npm run build` / `cargo build` / `go build`:
114
+ - Verify the output file exists: `Glob("dist/**/*.js")` or equivalent
115
+ - Verify file size > 0 bytes: a zero-byte output = silent truncation failure
116
+ - If output directory is missing → FAIL even if command exited 0
117
+
118
+ **Lint output** — parse stdout for counts, not just exit code:
119
+ - ESLint: look for `X problems (Y errors, Z warnings)` — `0 problems` = PASS
120
+ - Ruff/Flake8: zero output lines = PASS; any file:line output = FAIL
121
+ - If linter exits 0 but output contains `error` keyword → log as suspicious, mark WARN
122
+
123
+ **Generated files** — check magic bytes for binary outputs:
124
+ - PDF: first bytes must be `%PDF` — use `Bash("head -c 4 file.pdf")`
125
+ - ZIP/XLSX/DOCX: first bytes must be `PK` (ZIP magic) — use `Bash("head -c 2 file.zip")`
126
+ - File size must exceed minimum threshold (PDF > 1KB, ZIP > 100 bytes)
127
+
128
+ **Type check** — do not trust exit code alone:
129
+ - TypeScript `tsc --noEmit`: look for `Found X errors` or absence of error lines
130
+ - `Found 0 errors` = PASS; any other count = FAIL
131
+ - Empty output from `tsc` = PASS (no errors emitted) — note explicitly
132
+
133
+ <HARD-GATE name="artifact-verification">
134
+ Verification MUST check actual command output for success indicators, not just exit codes.
135
+ Exit 0 without a confirming output artifact or success string = UNVERIFIED.
136
+ Report the specific line that confirmed success (e.g., "3 passed, 0 failed").
137
+ </HARD-GATE>
138
+
101
139
  ## Error Recovery
102
140
 
103
141
  - If project type cannot be detected: report "Unknown project type" and skip all checks
@@ -187,6 +225,7 @@ Known failure modes for this skill. Check these before declaring done.
187
225
  | Marking check as PASS when the tool isn't installed | MEDIUM | Mark as SKIP (not PASS) — PASS means the tool ran and reported clean |
188
226
  | Stopping after first failure instead of running remaining checks | MEDIUM | Run all checks; aggregate all failures so developer can fix everything at once |
189
227
  | Reporting PASS when output has warnings but zero errors | LOW | PASS is correct but note warning count — caller decides if warnings matter |
228
+ | Trusting exit code 0 without output verification | CRITICAL | Artifact Verification HARD-GATE: always confirm success indicator in stdout (pass count, "0 errors", output file exists) |
190
229
 
191
230
  ## Done When
192
231