@rune-kit/rune 2.2.6 → 2.3.0

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 (69) hide show
  1. package/README.md +1 -1
  2. package/docs/SKILL-TEMPLATE.md +15 -0
  3. package/docs/index.html +76 -7
  4. package/docs/script.js +33 -6
  5. package/docs/style.css +62 -0
  6. package/package.json +7 -5
  7. package/skills/adversary/SKILL.md +12 -0
  8. package/skills/audit/SKILL.md +63 -1
  9. package/skills/autopsy/SKILL.md +12 -0
  10. package/skills/ba/SKILL.md +9 -0
  11. package/skills/brainstorm/SKILL.md +11 -0
  12. package/skills/completion-gate/SKILL.md +15 -1
  13. package/skills/context-engine/SKILL.md +83 -1
  14. package/skills/context-pack/SKILL.md +160 -0
  15. package/skills/cook/SKILL.md +657 -958
  16. package/skills/cook/references/deviation-rules.md +19 -0
  17. package/skills/cook/references/error-recovery.md +37 -0
  18. package/skills/cook/references/exit-conditions.md +31 -0
  19. package/skills/cook/references/loop-detection.md +39 -0
  20. package/skills/cook/references/mid-run-signals.md +31 -0
  21. package/skills/cook/references/output-format.md +40 -0
  22. package/skills/cook/references/pack-detection.md +82 -0
  23. package/skills/cook/references/pause-resume-template.md +38 -0
  24. package/skills/cook/references/rfc-template.md +52 -0
  25. package/skills/cook/references/sharp-edges.md +24 -0
  26. package/skills/cook/references/subagent-status.md +38 -0
  27. package/skills/db/SKILL.md +12 -0
  28. package/skills/debug/SKILL.md +34 -2
  29. package/skills/deploy/SKILL.md +10 -0
  30. package/skills/design/SKILL.md +9 -0
  31. package/skills/docs/SKILL.md +12 -0
  32. package/skills/docs-seeker/SKILL.md +11 -0
  33. package/skills/fix/SKILL.md +36 -3
  34. package/skills/incident/SKILL.md +10 -0
  35. package/skills/launch/SKILL.md +12 -0
  36. package/skills/logic-guardian/SKILL.md +11 -0
  37. package/skills/marketing/SKILL.md +13 -0
  38. package/skills/mcp-builder/SKILL.md +13 -0
  39. package/skills/onboard/SKILL.md +54 -2
  40. package/skills/perf/SKILL.md +11 -0
  41. package/skills/plan/SKILL.md +342 -688
  42. package/skills/plan/references/completeness-scoring.md +37 -0
  43. package/skills/plan/references/outcome-block.md +41 -0
  44. package/skills/plan/references/plan-templates.md +193 -0
  45. package/skills/plan/references/wave-planning.md +44 -0
  46. package/skills/plan/references/workflow-registry.md +53 -0
  47. package/skills/preflight/SKILL.md +86 -1
  48. package/skills/rescue/SKILL.md +10 -0
  49. package/skills/retro/SKILL.md +11 -0
  50. package/skills/review/SKILL.md +100 -1
  51. package/skills/review-intake/SKILL.md +11 -0
  52. package/skills/safeguard/SKILL.md +12 -0
  53. package/skills/scaffold/SKILL.md +10 -0
  54. package/skills/scope-guard/SKILL.md +11 -0
  55. package/skills/scout/SKILL.md +9 -0
  56. package/skills/sentinel/SKILL.md +307 -425
  57. package/skills/sentinel/references/config-protection.md +52 -0
  58. package/skills/sentinel/references/destructive-commands.md +40 -0
  59. package/skills/sentinel/references/domain-hooks.md +73 -0
  60. package/skills/sentinel/references/framework-patterns.md +46 -0
  61. package/skills/sentinel/references/owasp-patterns.md +69 -0
  62. package/skills/sentinel/references/secret-patterns.md +40 -0
  63. package/skills/sentinel/references/skill-content-guard.md +55 -0
  64. package/skills/session-bridge/SKILL.md +60 -2
  65. package/skills/skill-forge/SKILL.md +47 -2
  66. package/skills/skill-router/SKILL.md +33 -1
  67. package/skills/surgeon/SKILL.md +12 -0
  68. package/skills/team/SKILL.md +35 -1
  69. package/skills/test/SKILL.md +167 -1
@@ -0,0 +1,37 @@
1
+ # Completeness Scoring
2
+
3
+ > Reference for `plan` skill — Step 5.5.
4
+ > Load this when presenting alternative approaches from brainstorm or Step 3 decisions.
5
+
6
+ ## Scoring Table
7
+
8
+ When presenting alternatives, rate each with **Completeness X/10**:
9
+
10
+ | Score | Meaning |
11
+ |-------|---------|
12
+ | 9-10 | Complete — all edge cases, full coverage, production-ready |
13
+ | 7-8 | Happy path covered, some edges skipped |
14
+ | 4-6 | Shortcut — defers significant work |
15
+ | 1-3 | Minimal viable, debt guaranteed |
16
+
17
+ ## Rules
18
+
19
+ - **Always recommend the higher-completeness option.** With AI-assisted coding, the marginal cost of completeness is near-zero.
20
+ - Show **dual effort estimates** for each approach: `(human: ~X / AI: ~Y)`
21
+ - **Anti-pattern**: "Option B saves 70 LOC" → 70 LOC delta is meaningless with AI. Choose complete. The last 10% of coverage is where production bugs hide.
22
+
23
+ > Source: garrytan/gstack v0.9.0 — "Boil the Lake" principle.
24
+
25
+ ## Example Format
26
+
27
+ ```
28
+ **Option A: Full validation with Zod** — Completeness 9/10
29
+ - Covers: schema validation, error messages, type inference
30
+ - human: ~2h / AI: ~15min
31
+ - Recommended ✅
32
+
33
+ **Option B: Manual checks** — Completeness 5/10
34
+ - Covers: happy path only, defers edge cases
35
+ - human: ~30min / AI: ~5min
36
+ - Not recommended — defers 40% of error handling
37
+ ```
@@ -0,0 +1,41 @@
1
+ # Outcome Block Format
2
+
3
+ > Reference for `plan` skill — mandatory output section for all plan outputs.
4
+ > Load this when writing the final section of any master plan, phase file, or inline plan.
5
+
6
+ ## Format
7
+
8
+ Every plan output MUST end with an **Outcome Block**:
9
+
10
+ ```markdown
11
+ ## Outcome Block
12
+
13
+ ### What Was Planned
14
+ <1-2 sentences: what this plan delivers when all phases execute successfully>
15
+
16
+ ### Immediate Next Action
17
+ <The SINGLE next action the executor should take right now — not a list, one action>
18
+ Example: "Load phase 1 file and execute Wave 1 tasks (create types, validation schema)"
19
+
20
+ ### How to Measure Success
21
+ | Metric | Target | How to Check |
22
+ |--------|--------|-------------|
23
+ | Tests pass | 100% green | `npm test` or `pytest -v` |
24
+ | Type errors | 0 | `tsc --noEmit` or `mypy` |
25
+ | Phase complete | All tasks ✅ | phase file task list |
26
+ | <domain metric> | <value> | <command> |
27
+ ```
28
+
29
+ ## Rules
30
+
31
+ 1. Outcome Block is the LAST section in every plan output (master plan, phase file, inline plan)
32
+ 2. "Immediate Next Action" = ONE action, present tense, imperative mood. Not a list.
33
+ 3. "How to Measure" table MUST include at least one verifiable shell command
34
+ 4. For phase files: Immediate Next Action = "Execute Wave 1: [list Wave 1 task names]"
35
+ 5. For master plans: Immediate Next Action = "Await approval, then load phase 1 file"
36
+
37
+ ## Why This Matters
38
+
39
+ Plans without a clear "what to do NOW" cause executor drift — agents re-read the plan, re-analyze, and pick arbitrary starting points. The Immediate Next Action eliminates ambiguity: there is exactly ONE right first move.
40
+
41
+ > Source: Affitor/affiliate-skills — every output ends with: outcome achieved + immediate next action + measurement metric ("What happened → What to do now → How to measure").
@@ -0,0 +1,193 @@
1
+ # Plan Templates
2
+
3
+ > Reference for `plan` skill — Steps 4 and 5.
4
+ > Load this when writing master plan files or phase files.
5
+
6
+ ## Master Plan Template
7
+
8
+ Save to `.rune/plan-<feature>.md`. Max 80 lines.
9
+
10
+ ```markdown
11
+ # Feature: <name>
12
+
13
+ ## Overview
14
+ <1-3 sentences: what and why>
15
+
16
+ ## Phases
17
+ | # | Name | Status | Plan File | Summary |
18
+ |---|------|--------|-----------|---------|
19
+ | 1 | Foundation | ⬚ Pending | plan-X-phase1.md | Types, core engine, basic UI |
20
+ | 2 | Interaction | ⬚ Pending | plan-X-phase2.md | Dialogue, combat, items |
21
+ | 3 | Polish | ⬚ Pending | plan-X-phase3.md | Effects, sounds, game over |
22
+
23
+ ## Key Decisions
24
+ - <decision 1 — chosen approach and why>
25
+ - <decision 2>
26
+
27
+ ## Decision Compliance
28
+ - Decisions (locked): [list from requirements.md — plan MUST honor these]
29
+ - Discretion (agent): [list — agent chose X because Y]
30
+ - Deferred: [list — explicitly excluded from this feature]
31
+
32
+ ## Architecture
33
+ <brief system diagram or component list — NOT implementation detail>
34
+
35
+ ## Dependencies
36
+ - <external dep>: <status>
37
+
38
+ ## Risks
39
+ - <risk>: <mitigation>
40
+ ```
41
+
42
+ No implementation details — that's what phase files are for.
43
+
44
+ ---
45
+
46
+ ## Phase File Template (Amateur-Proof)
47
+
48
+ Save to `.rune/plan-<feature>-phase<N>.md`. Max 200 lines.
49
+
50
+ Phase files follow the **Amateur-Proof Template** — designed so that even the weakest model (Haiku) can execute without guessing. Every section exists because an Amateur said "I need this to code correctly."
51
+
52
+ ```markdown
53
+ # Phase N: <name>
54
+
55
+ ## Goal
56
+ <What this phase delivers — 1-2 sentences>
57
+
58
+ ## Data Flow
59
+ <5-line ASCII diagram showing how data moves through this phase's components>
60
+ ```
61
+ User Input → validateInput() → calculateProfit() → formatResult() → API Response
62
+
63
+ TradeEntry[]
64
+ ```
65
+
66
+ ## Code Contracts
67
+ <Function signatures, interfaces, schemas that this phase MUST implement>
68
+ <This is the MOST IMPORTANT section — coder implements these contracts>
69
+
70
+ ```typescript
71
+ interface TradeEntry {
72
+ side: 'long' | 'short';
73
+ entryPrice: number;
74
+ exitPrice: number;
75
+ quantity: number;
76
+ }
77
+
78
+ interface ProfitResult {
79
+ netPnL: number;
80
+ totalFees: number;
81
+ winRate: number;
82
+ }
83
+
84
+ function calculateProfit(entries: TradeEntry[]): ProfitResult;
85
+ function validateInput(raw: unknown): TradeEntry[]; // throws ValidationError
86
+ ```
87
+
88
+ ## Tasks
89
+
90
+ Each task MUST include: **File** (exact path), **Test** (test file or N/A), **Verify** (shell command), **Commit** (semantic message). Granularity: 2-5 min per task. If >10min, decompose.
91
+
92
+ - [ ] Task 1 — Create calculateProfit function
93
+ - Req: REQ-001 (P&L calculation)
94
+ - File: `src/foo/bar.ts` (new)
95
+ - Test: `tests/foo/bar.test.ts` (new)
96
+ - Verify: `npm test -- --grep "calculateProfit"`
97
+ - Commit: `feat(trading): add calculateProfit with fee calculation`
98
+ - Logic: sum entries by side, apply fees (0.1% per trade), return net P&L
99
+ - Edge: empty array → return { netPnL: 0, totalFees: 0, winRate: 0 }
100
+ - [ ] Task 2 — Add input validation
101
+ - Req: REQ-002 (input validation)
102
+ - File: `src/foo/baz.ts` (modify)
103
+ - Test: `tests/foo/baz.test.ts` (new)
104
+ - Verify: `npm test -- --grep "validateInput"`
105
+ - Commit: `feat(trading): add input validation for trade entries`
106
+ - Logic: check side is 'long'|'short', prices > 0, quantity > 0
107
+ - [ ] Task 3 — Write integration tests
108
+ - Req: REQ-001, REQ-002 (integration coverage)
109
+ - File: `tests/foo/bar.test.ts` (modify)
110
+ - Test: N/A — this IS the test task
111
+ - Verify: `npm test -- --grep "trading" && npx tsc --noEmit`
112
+ - Commit: `test(trading): add integration tests for edge cases`
113
+ - Cases: happy path, empty input, negative values, overflow
114
+
115
+ ## Failure Scenarios
116
+ <What should happen when things go wrong — coder MUST implement these>
117
+
118
+ | When | Then | Error Type |
119
+ |------|------|-----------|
120
+ | entries is empty array | return zero-value ProfitResult | No error (valid edge case) |
121
+ | entry has negative price | throw ValidationError("price must be positive") | ValidationError |
122
+ | entry has quantity = 0 | throw ValidationError("quantity must be > 0") | ValidationError |
123
+ | calculation overflows Number.MAX_SAFE_INTEGER | use BigInt or throw OverflowError | OverflowError |
124
+
125
+ ## Performance Constraints
126
+ <Non-functional requirements — skip if not applicable>
127
+
128
+ | Metric | Requirement | Why |
129
+ |--------|-------------|-----|
130
+ | Input size | Must handle 10,000 entries | Production data volume |
131
+ | Response time | < 100ms for 10K entries | Real-time dashboard |
132
+ | Memory | < 50MB for 10K entries | Container memory limit |
133
+
134
+ ## Rejection Criteria (DO NOT)
135
+ <Anti-patterns the coder MUST avoid — things that seem right but are wrong>
136
+
137
+ - ❌ DO NOT use `toFixed()` for financial calculations — use Decimal.js or integer cents
138
+ - ❌ DO NOT mutate the input array — create new objects (immutability rule)
139
+ - ❌ DO NOT use `any` type — full TypeScript strict
140
+ - ❌ DO NOT import from Phase 2+ files — this phase is self-contained
141
+
142
+ ## Cross-Phase Context
143
+ <What this phase assumes from previous phases / what future phases expect from this one>
144
+
145
+ - **Assumes**: Phase 1 created `src/shared/types.ts` with base types
146
+ - **Exports for Phase 3**: `calculateProfit()` will be imported by `src/dashboard/PnLCard.tsx`
147
+ - **Interface contract**: ProfitResult shape MUST NOT change — Phase 3 depends on it
148
+
149
+ ## Acceptance Criteria
150
+ - [ ] All tasks marked done
151
+ - [ ] Tests pass with 80%+ coverage on new code
152
+ - [ ] No TypeScript errors (`tsc --noEmit` passes)
153
+ - [ ] Failure scenarios all handled (table above)
154
+ - [ ] Performance: calculateProfit(10K entries) < 100ms
155
+ - [ ] No `any` types, no mutation, no `toFixed()` for money
156
+
157
+ ## Traceability Matrix
158
+ | Req ID | Requirement | Task(s) | Test(s) | Status |
159
+ |--------|-------------|---------|---------|--------|
160
+ | REQ-001 | P&L calculation with fees | Task 1 | `tests/foo/bar.test.ts` | ⬚ |
161
+ | REQ-002 | Input validation | Task 2 | `tests/foo/baz.test.ts` | ⬚ |
162
+
163
+ Every requirement from BA's Requirements Document MUST appear in this matrix. Missing requirement = incomplete phase. `completion-gate` checks this matrix during verification.
164
+
165
+ ## Files Touched
166
+ - `src/foo/bar.ts` — new
167
+ - `src/foo/baz.ts` — modify
168
+ - `tests/foo/bar.test.ts` — new
169
+ ```
170
+
171
+ Must be self-contained — coder should NOT need to read master plan or other phases to execute.
172
+
173
+ ---
174
+
175
+ ## Inline Plan Template (Trivial Tasks)
176
+
177
+ For trivial tasks (1-2 phases, < 5 files, < 100 LOC):
178
+
179
+ ```
180
+ ## Plan: [Task Name]
181
+
182
+ ### Changes
183
+ 1. [file]: [what to change] — [function signature]
184
+ 2. [file]: [what to change]
185
+
186
+ ### Tests
187
+ - [test file]: [test cases]
188
+
189
+ ### Risks
190
+ - [risk]: [mitigation]
191
+
192
+ Awaiting approval.
193
+ ```
@@ -0,0 +1,44 @@
1
+ # Wave-Based Task Grouping
2
+
3
+ > Reference for `plan` skill — Step 3 (Decompose into Phases).
4
+ > Load this when writing wave-structured task lists inside a phase.
5
+
6
+ ## Wave Format
7
+
8
+ Tasks inside a phase MUST be organized into **waves** based on dependency analysis. Independent tasks within the same wave can execute in parallel.
9
+
10
+ ```
11
+ ## Tasks
12
+
13
+ ### Wave 1 (parallel — no dependencies)
14
+ - [ ] Task 1 — Create types/interfaces
15
+ - File: `src/types.ts` (new)
16
+ - ...
17
+ - [ ] Task 2 — Create validation schema
18
+ - File: `src/validation.ts` (new)
19
+ - ...
20
+
21
+ ### Wave 2 (depends on Wave 1)
22
+ - [ ] Task 3 — Implement core logic (imports types from Task 1)
23
+ - File: `src/core.ts` (new)
24
+ - depends_on: [Task 1]
25
+ - ...
26
+
27
+ ### Wave 3 (depends on Wave 2)
28
+ - [ ] Task 4 — Wire into API endpoint (imports core from Task 3)
29
+ - File: `src/routes/api.ts` (modify)
30
+ - depends_on: [Task 3]
31
+ - ...
32
+ - [ ] Task 5 — Write integration tests (tests core from Task 3)
33
+ - File: `tests/core.test.ts` (new)
34
+ - depends_on: [Task 3]
35
+ - ...
36
+ ```
37
+
38
+ ## Wave Rules
39
+
40
+ - **Wave 1** = tasks with zero dependencies (types, schemas, configs) — always first
41
+ - **Subsequent waves**: a task goes in the earliest wave where ALL its `depends_on` tasks are in prior waves
42
+ - Tasks within the same wave have NO dependencies on each other → safe for parallel dispatch
43
+ - `depends_on` field is MANDATORY for Wave 2+ tasks — explicit is better than implicit
44
+ - `team` orchestrator can dispatch wave tasks as parallel subagents; solo `cook` executes sequentially within a wave but respects wave ordering
@@ -0,0 +1,53 @@
1
+ # Workflow Registry (4-View)
2
+
3
+ > Reference for `plan` skill — Step 4.5.
4
+ > Load this when building a Workflow Registry for complex features (4+ phases OR 3+ user-facing workflows).
5
+
6
+ ## When to Use
7
+
8
+ Build this registry BEFORE writing phase files for complex features. It catches missing pieces, dead ends, and integration gaps at plan time — not implementation time.
9
+
10
+ **Skip conditions**: trivial tasks, inline plans, single-workflow features.
11
+
12
+ > Source: agency-agents (msitarzewski/agency-agents, 50.8k★): "Every route is an entry point. Every worker is a workflow. If it's missing from the registry, it doesn't exist."
13
+
14
+ ## 4-View Format
15
+
16
+ ```markdown
17
+ ## Workflow Registry
18
+
19
+ ### View 1: By Workflow
20
+ | Workflow | Entry Point | Components Touched | Exit Point | Phase |
21
+ |----------|-------------|-------------------|------------|-------|
22
+ | User signup | POST /auth/register | AuthService, UserRepo, EmailService | 201 + email sent | Phase 1 |
23
+ | Password reset | POST /auth/reset | AuthService, EmailService, TokenRepo | 200 + reset email | Phase 2 |
24
+
25
+ ### View 2: By Component
26
+ | Component | Used By Workflows | Owner Phase | Status |
27
+ |-----------|-------------------|-------------|--------|
28
+ | AuthService | signup, login, reset | Phase 1 | Planned |
29
+ | EmailService | signup, reset, invite | Phase 2 | Planned |
30
+ | TokenRepo | reset, invite | Phase 2 | Missing ← RED FLAG |
31
+
32
+ ### View 3: By User Journey
33
+ | Journey | Steps (workflow chain) | Happy Path | Error Path |
34
+ |---------|----------------------|------------|------------|
35
+ | New user → first action | signup → verify email → login → onboard | 4 steps | signup fail, email bounce |
36
+
37
+ ### View 4: By State
38
+ | Step | User Sees | DB State | Logs | Operator Sees |
39
+ |------|-----------|----------|------|---------------|
40
+ | After signup | "Check your email" | user.status=pending | user.created event | New user in admin |
41
+ | After verify | Dashboard | user.status=active | user.verified event | Active user count +1 |
42
+ ```
43
+
44
+ ## Validation Rules
45
+
46
+ - Every component in View 2 MUST appear in at least one workflow in View 1 — orphaned components = dead code
47
+ - Every workflow in View 1 MUST map to a phase — unphased workflows will be forgotten
48
+ - **"Missing" status in View 2 = red flag** — component needed but not planned in any phase → add to a phase or create new phase
49
+ - Every user journey step in View 3 MUST have a corresponding state row in View 4
50
+
51
+ ## Output Placement
52
+
53
+ Add the registry to the master plan file (it fits within the 80-line budget when tables are compact). Phase files reference it but don't duplicate it.
@@ -3,7 +3,7 @@ name: preflight
3
3
  description: Pre-commit quality gate that catches "almost right" code. Goes beyond linting — checks logic correctness, error handling, regressions, and completeness.
4
4
  metadata:
5
5
  author: runedev
6
- version: "0.3.0"
6
+ version: "0.6.0"
7
7
  layer: L2
8
8
  model: sonnet
9
9
  group: quality
@@ -158,6 +158,41 @@ Verify that new code ships complete:
158
158
 
159
159
  If any completeness item is missing, flag as **WARN** with: what is missing, which file needs it.
160
160
 
161
+ ### Step 4.2 — Coherence Check
162
+
163
+ Verify that new code is **consistent with existing project patterns** — not just correct, but coherent with the codebase it lives in.
164
+
165
+ | Check | What To Look For | Severity |
166
+ |-------|------------------|----------|
167
+ | Naming conventions | New functions/variables follow project's existing naming style (camelCase, snake_case, etc.) | WARN |
168
+ | File organization | New files placed in correct directory per project structure (e.g., utils/ not lib/, components/ not ui/) | WARN |
169
+ | Import patterns | Uses project's established import style (absolute vs relative, barrel exports vs direct) | WARN |
170
+ | Error handling style | Matches project's existing pattern (Result type, try/catch, error codes) | WARN |
171
+ | State management | Uses same state approach as rest of project (Zustand, context, stores) | BLOCK if different paradigm |
172
+ | API patterns | Follows existing response format, middleware chain, auth pattern | BLOCK if diverges |
173
+ | Design system usage | Uses existing design tokens/components, not inline overrides | WARN |
174
+
175
+ **Detection**: Read 2-3 existing files in the same directory as the change. Compare patterns. Flag divergences.
176
+
177
+ **Skip if**: Project has no established patterns (greenfield, <5 files), or CLAUDE.md/conventions.md explicitly says "no conventions yet."
178
+
179
+ > Source: Fission-AI/OpenSpec (32.8k★) — Coherence axis: "follows design.md? matches project patterns?"
180
+
181
+ ### Step 4.3 — Eval Verification
182
+
183
+ If `.rune/evals/` directory exists with eval definition files, verify eval results as part of the quality gate.
184
+
185
+ | Check | Action | Severity |
186
+ |-------|--------|----------|
187
+ | Capability eval defined but not run | Feature has `.rune/evals/<feature>.md` with CAP-* entries but no results | WARN: "Capability evals defined but not executed" |
188
+ | Regression eval failing | Any REG-* eval with status=fail | BLOCK: "Regression detected — existing behavior broken" |
189
+ | Capability eval below threshold | CAP-* eval pass@k below defined threshold | WARN: "Capability eval below threshold (X% vs Y% required)" |
190
+ | No eval file for new feature | New feature added (detected by new test files + new source files) but no `.rune/evals/` entry | INFO: "Consider defining capability evals for new feature" |
191
+
192
+ **Skip if**: No `.rune/evals/` directory exists (project hasn't adopted eval-driven development).
193
+
194
+ > Source: affaan-m/everything-claude-code (91.9k★) — eval-driven development as quality gate.
195
+
161
196
  ### Step 4.5 — Domain Quality Hooks
162
197
 
163
198
  Apply domain-specific quality checks based on detected file types in the diff. These extend the generic completeness checks in Step 4 with deeper domain validation.
@@ -204,6 +239,38 @@ When a domain pack is installed (e.g., `@rune-pro/finance`, `@rune-pro/legal`),
204
239
  - `src/billing/invoice.ts:42` — WARN: price calculation uses `toFixed(2)` instead of `Intl.NumberFormat`
205
240
  ```
206
241
 
242
+ ### Step 4.8 — Preflight Composite Score
243
+
244
+ After all domain hooks (Step 4.5) and completeness checks (Step 4) complete, compute a **Preflight Health Score** to make the verdict numeric and comparable across runs.
245
+
246
+ ### Formula
247
+
248
+ ```
249
+ Preflight Score = (Logic × 0.30) + (Error Handling × 0.20) + (Completeness × 0.20) + (Coherence × 0.15) + (Regression Risk × 0.15)
250
+ ```
251
+
252
+ **5 verification axes** (Completeness + Correctness via Logic + Coherence — 3D verification model):
253
+
254
+ Each dimension is scored per staged files:
255
+ - 0 BLOCK findings in dimension → 100
256
+ - 1 BLOCK → dimension capped at 30
257
+ - 1 WARN → dimension capped at 75
258
+ - Each additional WARN → subtract 10 (floor: 40)
259
+
260
+ ### Grade Thresholds
261
+
262
+ | Score | Grade | Verdict |
263
+ |-------|-------|---------|
264
+ | 90–100 | Excellent | PASS |
265
+ | 75–89 | Good | PASS with notes |
266
+ | 60–74 | Fair | WARN |
267
+ | 40–59 | Poor | WARN (escalate to developer) |
268
+ | 0–39 | Critical | BLOCK |
269
+
270
+ Score is appended to the Preflight Report footer. Useful for tracking quality trend across sprints when cook logs preflight scores to `.rune/metrics/`.
271
+
272
+ > Source: zubair-trabzada/geo-seo-claude (2.7k★) — weighted formula, 5-tier thresholds, comparable across runs.
273
+
207
274
  ### Step 5 — Security Sub-Check
208
275
  Invoke `rune:sentinel` on the changed files. Attach sentinel's output verbatim under the "Security" section of the preflight report. If sentinel returns BLOCK, preflight verdict is also BLOCK.
209
276
 
@@ -237,9 +304,17 @@ Report PASS, WARN, or BLOCK. For WARN, list each item the developer must acknowl
237
304
  - `api/users.ts` — new POST endpoint missing input validation schema
238
305
  - `components/Form.tsx` — no loading state during submission
239
306
 
307
+ ### Coherence
308
+ - `api/users.ts` — uses `res.json()` but project convention is `sendResponse()` wrapper
309
+ - `utils/newHelper.ts` — placed in utils/ but project uses helpers/ directory
310
+
240
311
  ### Security (from sentinel)
241
312
  - [sentinel findings if any]
242
313
 
314
+ ### Composite Score
315
+ - Logic: [score] | Error: [score] | Completeness: [score] | Coherence: [score] | Regression: [score]
316
+ - **Preflight Score**: [weighted value] → Grade: [Excellent/Good/Fair/Poor/Critical]
317
+
243
318
  ### Verdict
244
319
  WARN — 3 issues found (0 blocking, 3 must-acknowledge). Resolve before commit or explicitly acknowledge each WARN.
245
320
  ```
@@ -252,6 +327,16 @@ WARN — 3 issues found (0 blocking, 3 must-acknowledge). Resolve before commit
252
327
  4. MUST verify error messages are user-friendly and don't leak internal details
253
328
  5. MUST check that async operations have proper error handling and cleanup
254
329
 
330
+ ## Returns
331
+
332
+ | Artifact | Format | Location |
333
+ |----------|--------|----------|
334
+ | Preflight report | Markdown | inline (chat output) |
335
+ | Issue list (BLOCK/WARN by category) | Markdown list | inline |
336
+ | Preflight health score | Markdown table | inline (footer of report) |
337
+ | Spec compliance verdict | Markdown table | inline |
338
+ | Domain quality findings | Markdown section | inline |
339
+
255
340
  ## Sharp Edges
256
341
 
257
342
  | Failure Mode | Severity | Mitigation |
@@ -413,6 +413,16 @@ Rollback point: git tag rune-rescue-baseline (set in Phase 0)
413
413
  - **Rollback Tag**: [git tag name]
414
414
  ```
415
415
 
416
+ ## Returns
417
+
418
+ | Artifact | Format | Location |
419
+ |----------|--------|----------|
420
+ | Rescue state | Markdown | `RESCUE-STATE.md` (updated each session) |
421
+ | Characterization tests | Source files | Written by `rune:safeguard` per module |
422
+ | Refactored modules | Source files | Modified in-place, committed per surgery session |
423
+ | Health score comparison | Inline (Rescue Report) | Baseline vs final autopsy scores |
424
+ | Rescue Report | Markdown (inline) | Emitted at session end (per module and final) |
425
+
416
426
  ## Sharp Edges
417
427
 
418
428
  Known failure modes for this skill. Check these before declaring done.
@@ -309,6 +309,17 @@ SELF-VALIDATION (run before emitting report):
309
309
  - Narrative report emitted
310
310
  - No code was modified
311
311
 
312
+ ## Returns
313
+
314
+ | Artifact | Format | Location |
315
+ |----------|--------|----------|
316
+ | Retrospective narrative report | Markdown (~800-1500 words) | inline |
317
+ | Retro JSON snapshot | JSON | `.rune/retros/{YYYY-MM-DD}.json` |
318
+ | Per-person breakdown | Markdown sections | inline |
319
+ | Action items + habits | Ordered lists | inline |
320
+
312
321
  ## Cost Profile
313
322
 
314
323
  ~3000-5000 tokens input (git history parsing), ~2000-4000 tokens output (narrative). Sonnet for analysis quality. Runs infrequently (weekly/sprint cadence).
324
+
325
+ **Scope guardrail:** retro is read-only — it analyzes and reports. It does NOT modify code, create PRs, or change any files except its own output artifacts in `.rune/retros/`.