@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
package/README.md CHANGED
@@ -26,7 +26,7 @@ Mesh: A ↔ B ↔ C (B fails = A reaches C via D→E)
26
26
  D ↔ E ↔ F
27
27
  ```
28
28
 
29
- ## What's New (v2.2.2)
29
+ ## What's New (v2.3.0)
30
30
 
31
31
  - **UI/UX Pro Max Integration** — 161 palettes, 84 styles, 73 font pairings, 161 reasoning rules from [UI/UX Pro Max](https://github.com/nextlevelbuilder/ui-ux-pro-max-skill) (MIT, 42.8k★) meshed into `design` skill + `@rune/ui` pack
32
32
  - **11 Core Skill Enrichments** — deviation rules, repair operators, evidence quality gate, decision classification, debug knowledge base, CSO discipline, YAGNI pushback, formal pause/resume
@@ -54,6 +54,17 @@ Step-by-step execution flow.
54
54
  Structured output that calling skills can consume.
55
55
  ```
56
56
 
57
+ ## Returns
58
+
59
+ Explicit output contract so calling skills know exactly what to expect.
60
+
61
+ | Field | Type | Description |
62
+ |-------|------|-------------|
63
+ | `field_name` | type | What this field contains and when it's populated |
64
+ | `status` | enum | e.g., `DONE` / `DONE_WITH_CONCERNS` / `BLOCKED` |
65
+
66
+ Why: Without explicit return schemas, calling skills guess at output structure. This causes silent failures when output format changes. Every L1/L2 skill MUST have a Returns section.
67
+
57
68
  ## Constraints
58
69
 
59
70
  3-7 MUST/MUST NOT rules specific to this skill.
@@ -101,3 +112,7 @@ Why: Completion-gate validates claims generically. Self-Validation catches domai
101
112
  ## Cost Profile
102
113
 
103
114
  Estimated token usage per invocation.
115
+
116
+ **Scope guardrail**: [Terminal boundary statement — what this skill must NOT do even if asked. Examples: "Do not write code — only produce plans.", "Do not modify files outside the target module.", "Do not execute fixes — only diagnose and hand off to fix."]
117
+
118
+ Why: Without terminal guardrails, agents drift into adjacent responsibilities. A review skill starts fixing code, a plan skill starts implementing, a debug skill starts deploying. The guardrail is the last line in the skill file — a final reminder of scope boundaries before the agent acts.
package/docs/index.html CHANGED
@@ -62,7 +62,7 @@
62
62
  <canvas id="mesh-canvas"></canvas>
63
63
  </div>
64
64
  <div class="hero-content">
65
- <p class="hero-badge">v2.2.2 &mdash; 58 skills &bull; 8 platforms &bull; MIT</p>
65
+ <p class="hero-badge">v2.3.0 &mdash; 59 skills &bull; 8 platforms &bull; MIT</p>
66
66
  <h1>Less skills.<br><span class="accent">Deeper connections.</span></h1>
67
67
  <p class="hero-sub">A mesh ecosystem for AI coding assistants. Skills call each other bidirectionally, forming resilient workflows that adapt when things go wrong.</p>
68
68
  <div class="hero-actions">
@@ -839,12 +839,42 @@ claude plugin install rune</code></pre>
839
839
  </div>
840
840
 
841
841
  <!-- Step 4: Success -->
842
- <div id="pay-step-4" class="pay-step" hidden>
843
- <div class="pay-success-icon">&#10003;</div>
844
- <h3>Payment Received!</h3>
845
- <p class="pay-subtitle">A GitHub invitation has been sent to <strong id="pay-success-user"></strong></p>
846
- <p class="pay-hint">Check your email for the invitation to <code>rune-kit/rune-pro</code></p>
847
- <button class="btn btn-primary" style="width:100%;margin-top:20px" onclick="closePayment()">Done</button>
842
+ <div id="pay-step-4" class="pay-step pay-success" hidden>
843
+ <div class="pay-success-badge">
844
+ <svg class="pay-success-check" viewBox="0 0 52 52" width="52" height="52">
845
+ <circle class="pay-success-circle" cx="26" cy="26" r="24" fill="none" stroke="currentColor" stroke-width="2.5"/>
846
+ <path class="pay-success-tick" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" d="M15 27l7 7 15-15"/>
847
+ </svg>
848
+ </div>
849
+ <h3 class="pay-success-title">You're in!</h3>
850
+ <p class="pay-success-sub">A GitHub repo invitation is on its way to <strong id="pay-success-user"></strong></p>
851
+
852
+ <div class="pay-success-steps">
853
+ <div class="pay-success-step">
854
+ <span class="pay-success-num">1</span>
855
+ <div>
856
+ <strong>Check your GitHub email</strong>
857
+ <span>Look for an invite from <code>noreply@github.com</code> — usually within 1 minute</span>
858
+ </div>
859
+ </div>
860
+ <div class="pay-success-step">
861
+ <span class="pay-success-num">2</span>
862
+ <div>
863
+ <strong>Accept the invitation</strong>
864
+ <span>Click "View invitation" to join the private repo</span>
865
+ </div>
866
+ </div>
867
+ <div class="pay-success-step">
868
+ <span class="pay-success-num">3</span>
869
+ <div>
870
+ <strong>Install your packs</strong>
871
+ <span id="pay-success-install">Follow the setup guide in the repo README</span>
872
+ </div>
873
+ </div>
874
+ </div>
875
+
876
+ <button class="btn btn-primary pay-success-done" onclick="closePayment()">Got it</button>
877
+ <p class="pay-success-help">Didn't get the invite? Check spam, or email <a href="mailto:claude@theio.vn">claude@theio.vn</a></p>
848
878
  </div>
849
879
 
850
880
  <!-- Step 5: International — GitHub username + Polar checkout -->
@@ -861,6 +891,45 @@ claude plugin install rune</code></pre>
861
891
  <button id="pay-intl-submit" class="btn btn-pro" style="width:100%;margin-top:16px" onclick="startPolarCheckout()">Pay with Card / PayPal</button>
862
892
  <p class="pay-hint" style="margin-top:12px">You'll be redirected to Polar's secure checkout page</p>
863
893
  </div>
894
+
895
+ <!-- Step 6: Success (Vietnamese — for SePay flow) -->
896
+ <div id="pay-step-6" class="pay-step pay-success notranslate" translate="no" hidden>
897
+ <div class="pay-success-badge">
898
+ <svg class="pay-success-check" viewBox="0 0 52 52" width="52" height="52">
899
+ <circle class="pay-success-circle" cx="26" cy="26" r="24" fill="none" stroke="currentColor" stroke-width="2.5"/>
900
+ <path class="pay-success-tick" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" d="M15 27l7 7 15-15"/>
901
+ </svg>
902
+ </div>
903
+ <h3 class="pay-success-title">Thanh toán thành công!</h3>
904
+ <p class="pay-success-sub">Lời mời truy cập repo đã được gửi đến <strong id="pay-success-user-vn"></strong></p>
905
+
906
+ <div class="pay-success-steps">
907
+ <div class="pay-success-step">
908
+ <span class="pay-success-num">1</span>
909
+ <div>
910
+ <strong>Kiểm tra email GitHub</strong>
911
+ <span>Tìm email mời từ <code>noreply@github.com</code> — thường trong vòng 1 phút</span>
912
+ </div>
913
+ </div>
914
+ <div class="pay-success-step">
915
+ <span class="pay-success-num">2</span>
916
+ <div>
917
+ <strong>Chấp nhận lời mời</strong>
918
+ <span>Nhấn "View invitation" để vào private repo</span>
919
+ </div>
920
+ </div>
921
+ <div class="pay-success-step">
922
+ <span class="pay-success-num">3</span>
923
+ <div>
924
+ <strong>Cài đặt skill packs</strong>
925
+ <span id="pay-success-install-vn">Làm theo hướng dẫn trong README của repo</span>
926
+ </div>
927
+ </div>
928
+ </div>
929
+
930
+ <button class="btn btn-primary pay-success-done" onclick="closePayment()">Xong</button>
931
+ <p class="pay-success-help">Chưa nhận được? Kiểm tra spam, hoặc email <a href="mailto:claude@theio.vn">claude@theio.vn</a></p>
932
+ </div>
864
933
  </div>
865
934
  </div>
866
935
 
package/docs/script.js CHANGED
@@ -227,8 +227,9 @@ function closePayment() {
227
227
  }
228
228
 
229
229
  function showPayStep(n) {
230
- for (let i = 1; i <= 5; i++) {
231
- document.getElementById('pay-step-' + i).hidden = (i !== n);
230
+ for (let i = 1; i <= 6; i++) {
231
+ const el = document.getElementById('pay-step-' + i);
232
+ if (el) el.hidden = (i !== n);
232
233
  }
233
234
  }
234
235
 
@@ -290,7 +291,7 @@ async function startPolarCheckout() {
290
291
  const data = await res.json();
291
292
  if (!data.success || !data.url) throw new Error(data.error || 'Failed to create checkout');
292
293
 
293
- // Redirect to Polar checkout page
294
+ // Redirect to Polar checkout page (context embedded in success_url by worker)
294
295
  window.location.href = data.url;
295
296
  } catch (err) {
296
297
  errorEl.textContent = err.message;
@@ -365,8 +366,14 @@ function startPolling(github) {
365
366
  if (data.status === 'delivered') {
366
367
  clearInterval(payState.pollTimer);
367
368
  payState.pollTimer = null;
368
- document.getElementById('pay-success-user').textContent = github;
369
- showPayStep(4);
369
+ // VN users → Vietnamese success (step 6)
370
+ const vnUser = document.getElementById('pay-success-user-vn');
371
+ if (vnUser) vnUser.textContent = github;
372
+ const vnInstall = document.getElementById('pay-success-install-vn');
373
+ if (vnInstall && (payState.product === 'rune-biz' || payState.product === 'RUNE-BIZ')) {
374
+ vnInstall.textContent = 'Bạn nhận cả Pro + Business packs — xem README trong repo';
375
+ }
376
+ showPayStep(6);
370
377
  } else if (data.status === 'underpaid') {
371
378
  document.getElementById('pay-status').innerHTML =
372
379
  '<span style="color:var(--loss)">&#9888; Amount too low. Please transfer the exact amount.</span>';
@@ -452,17 +459,37 @@ function startPolling(github) {
452
459
  (function checkPolarReturn() {
453
460
  const params = new URLSearchParams(window.location.search);
454
461
  if (params.get('polar') === 'success') {
462
+ // Read context from URL (embedded by worker in success_url)
463
+ const github = params.get('gh') || 'your GitHub account';
464
+ const product = params.get('pkg') || '';
465
+
455
466
  // Clean URL
456
467
  window.history.replaceState({}, '', window.location.pathname);
468
+
457
469
  // Show success message
458
470
  const modal = document.getElementById('pay-modal');
459
471
  if (modal) {
460
472
  modal.hidden = false;
461
473
  document.body.style.overflow = 'hidden';
462
- document.getElementById('pay-success-user').textContent = 'you';
474
+ showSuccessForProduct(product, github);
463
475
  for (let i = 1; i <= 5; i++) {
464
476
  document.getElementById('pay-step-' + i).hidden = (i !== 4);
465
477
  }
466
478
  }
467
479
  }
468
480
  })();
481
+
482
+ // Update success page based on product context
483
+ function showSuccessForProduct(product, github) {
484
+ const el = document.getElementById('pay-success-user');
485
+ if (el) el.textContent = github || 'your GitHub account';
486
+
487
+ const installEl = document.getElementById('pay-success-install');
488
+ if (!installEl) return;
489
+
490
+ if (product === 'rune-biz' || product === 'RUNE-BIZ') {
491
+ installEl.textContent = 'You get Pro + Business packs — check the repo README for setup';
492
+ } else {
493
+ installEl.textContent = 'Follow the setup guide in the repo README';
494
+ }
495
+ }
package/docs/style.css CHANGED
@@ -653,6 +653,68 @@ font[style] > font { vertical-align: unset !important; }
653
653
  }
654
654
  @keyframes spin { to { transform: rotate(360deg); } }
655
655
  .pay-hint { font-size: 12px; color: var(--text-muted); text-align: center; margin-top: 12px; line-height: 1.5; }
656
+ /* Success page */
657
+ .pay-success { text-align: center; }
658
+
659
+ .pay-success-badge {
660
+ width: 72px; height: 72px; border-radius: 50%;
661
+ background: var(--accent-dim); color: var(--accent);
662
+ display: flex; align-items: center; justify-content: center;
663
+ margin: 0 auto 20px;
664
+ animation: successPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
665
+ }
666
+
667
+ .pay-success-circle {
668
+ stroke-dasharray: 151; stroke-dashoffset: 151;
669
+ animation: successCircle 0.6s 0.2s ease-out forwards;
670
+ }
671
+ .pay-success-tick {
672
+ stroke-dasharray: 40; stroke-dashoffset: 40;
673
+ animation: successTick 0.4s 0.6s ease-out forwards;
674
+ }
675
+
676
+ @keyframes successPop { 0% { transform: scale(0); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
677
+ @keyframes successCircle { to { stroke-dashoffset: 0; } }
678
+ @keyframes successTick { to { stroke-dashoffset: 0; } }
679
+
680
+ .pay-success-title {
681
+ font-family: var(--font-display); font-size: 26px; font-weight: 700;
682
+ margin-bottom: 6px; color: var(--text-primary);
683
+ }
684
+ .pay-success-sub {
685
+ font-size: 14px; color: var(--text-secondary); margin-bottom: 24px;
686
+ }
687
+
688
+ .pay-success-steps {
689
+ text-align: left; display: flex; flex-direction: column; gap: 14px;
690
+ background: var(--accent-dim); border-radius: var(--radius-md);
691
+ padding: 20px; margin-bottom: 24px;
692
+ }
693
+ .pay-success-step {
694
+ display: flex; align-items: flex-start; gap: 12px;
695
+ }
696
+ .pay-success-num {
697
+ flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
698
+ background: var(--accent); color: #fff; font-size: 13px; font-weight: 700;
699
+ display: flex; align-items: center; justify-content: center;
700
+ margin-top: 1px;
701
+ }
702
+ .pay-success-step strong {
703
+ display: block; font-size: 14px; color: var(--text-primary); margin-bottom: 2px;
704
+ }
705
+ .pay-success-step span {
706
+ font-size: 13px; color: var(--text-secondary); line-height: 1.4;
707
+ }
708
+
709
+ .pay-success-done {
710
+ width: 100%; margin-bottom: 12px;
711
+ }
712
+ .pay-success-help {
713
+ font-size: 12px; color: var(--text-secondary); opacity: 0.7;
714
+ }
715
+ .pay-success-help a { color: var(--accent); }
716
+
717
+ /* Legacy (keep for backwards compat) */
656
718
  .pay-success-icon {
657
719
  width: 64px; height: 64px; border-radius: 50%; background: var(--accent);
658
720
  color: #fff; font-size: 32px; display: flex; align-items: center; justify-content: center;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rune-kit/rune",
3
- "version": "2.2.6",
4
- "description": "58-skill mesh for AI coding assistants — 5-layer architecture, 200+ connections, 8 platforms (Claude Code, Cursor, Windsurf, Antigravity, Codex, OpenCode, OpenClaw, Generic)",
3
+ "version": "2.3.0",
4
+ "description": "59-skill mesh for AI coding assistants — 5-layer architecture, 200+ connections, 8 platforms (Claude Code, Cursor, Windsurf, Antigravity, Codex, OpenCode, OpenClaw, Generic)",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "rune": "./compiler/bin/rune.js"
@@ -9,11 +9,12 @@
9
9
  "scripts": {
10
10
  "build": "node compiler/bin/rune.js build",
11
11
  "doctor": "node compiler/bin/rune.js doctor && node scripts/version-sync-check.js",
12
- "test": "node --test compiler/__tests__/*.test.js",
12
+ "test": "node --test compiler/__tests__/*.test.js scripts/__tests__/*.test.js",
13
+ "test:coverage": "c8 --reporter=text --reporter=lcov node --test compiler/__tests__/*.test.js scripts/__tests__/*.test.js",
13
14
  "lint": "biome check .",
14
15
  "lint:fix": "biome check --fix .",
15
16
  "format": "biome format --write .",
16
- "ci": "biome check . && node --test compiler/__tests__/*.test.js && node compiler/bin/rune.js doctor",
17
+ "ci": "biome check . && node --test compiler/__tests__/*.test.js scripts/__tests__/*.test.js && node compiler/bin/rune.js doctor",
17
18
  "version-check": "node scripts/version-sync-check.js",
18
19
  "prepublishOnly": "node scripts/version-sync-check.js"
19
20
  },
@@ -57,6 +58,7 @@
57
58
  "url": "https://github.com/rune-kit/rune/issues"
58
59
  },
59
60
  "devDependencies": {
60
- "@biomejs/biome": "^2.4.7"
61
+ "@biomejs/biome": "^2.4.7",
62
+ "c8": "^10.1.3"
61
63
  }
62
64
  }
@@ -266,6 +266,18 @@ Trigger: plan involves auth, crypto, payment, or user data handling.
266
266
  - Findings formatted for consumption by cook Phase 3 (if PROCEED) or plan (if REVISE)
267
267
  - Strength Notes section acknowledges well-designed aspects of the plan
268
268
 
269
+ ## Returns
270
+
271
+ | Artifact | Format | Location |
272
+ |----------|--------|----------|
273
+ | Adversary Report | Markdown | inline (stdout) |
274
+ | Threat findings | Structured list (CRITICAL/HIGH/MEDIUM) | inline |
275
+ | Risk matrix per dimension | Table | inline |
276
+ | Verdict + remediation list | Markdown | inline |
277
+ | Hardened plan notes (if PROCEED) | Text | passed to cook Phase 3 |
278
+
269
279
  ## Cost Profile
270
280
 
271
281
  ~4000-8000 tokens input (plan + codebase context), ~2000-3000 tokens output. Opus model for adversarial depth. Runs once per feature plan — high cost justified by preventing wasted implementation cycles.
282
+
283
+ **Scope guardrail:** adversary reviews THE PLAN only — never audits existing codebase quality or rewrites code.
@@ -3,7 +3,7 @@ name: audit
3
3
  description: Comprehensive project audit — security, dependencies, code quality, architecture, performance, infra, docs, and mesh analytics. Delegates to specialist skills and generates an 8-dimension health score.
4
4
  metadata:
5
5
  author: runedev
6
- version: "0.1.0"
6
+ version: "0.3.0"
7
7
  layer: L2
8
8
  model: sonnet
9
9
  group: quality
@@ -56,6 +56,24 @@ Determine:
56
56
 
57
57
  **Output before proceeding:** Brief project profile, stack summary, and which Framework-Specific Checks will be applied.
58
58
 
59
+ ### Phase 0.5: Context-Building (Pure Understanding)
60
+
61
+ <HARD-GATE>
62
+ This phase is FORBIDDEN from producing findings. No BLOCKs, no WARNs, no issues. Context-building only.
63
+ Rushed context = hallucinated vulnerabilities. Slow is fast.
64
+ </HARD-GATE>
65
+
66
+ For each critical module (entry points, auth, data layer, core business logic):
67
+ 1. Read line-by-line. Note at minimum:
68
+ - **3 invariants**: What MUST always be true for this code to work? (e.g., "user is authenticated before reaching this handler")
69
+ - **5 assumptions**: What does this code assume about its inputs, environment, and callers?
70
+ - **3 risks**: What could break if assumptions are violated?
71
+ 2. Record findings as context notes — these feed into Phases 1-7, NOT into the final report directly
72
+
73
+ **Why**: Without this phase, the auditor pattern-matches against known vulnerability lists and hallucinates findings that don't exist in THIS specific codebase. The invariants + assumptions ground all later analysis in reality.
74
+
75
+ > Source: trailofbits/skills (3.7k★) — mandatory pure context phase before findings.
76
+
59
77
  ---
60
78
 
61
79
  ### Phase 1: Dependency Audit
@@ -364,6 +382,36 @@ Use `Write` to save `AUDIT-REPORT.md` to the project root with the full findings
364
382
 
365
383
  Call `rune:journal` to record: audit date, overall health score, verdict, and CRITICAL count.
366
384
 
385
+ ## Weighted Composite Scoring
386
+
387
+ Each dimension score feeds into a weighted composite formula that produces a single comparable health score. Use this formula to compute **Overall Health** — not a simple average.
388
+
389
+ ### Scoring Formula
390
+
391
+ ```
392
+ Overall = (Security × 0.25) + (Code Quality × 0.20) + (Architecture × 0.15)
393
+ + (Dependencies × 0.15) + (Performance × 0.10) + (Infrastructure × 0.08)
394
+ + (Documentation × 0.07)
395
+ ```
396
+
397
+ Mesh Analytics (Phase 8) is advisory — it contributes 0 to the weighted score but informs the verdict narrative.
398
+
399
+ ### Grade Thresholds
400
+
401
+ | Score Range | Grade | Verdict | Action |
402
+ |-------------|-------|---------|--------|
403
+ | 90–100 | Excellent | PASS | Routine audit in 3 months |
404
+ | 75–89 | Good | PASS | Address MEDIUM items next sprint |
405
+ | 60–74 | Fair | WARNING | Fix HIGH items within 2 weeks |
406
+ | 40–59 | Poor | FAIL | Fix CRITICAL + HIGH within 1 week |
407
+ | 0–39 | Critical | FAIL | Emergency response — CRITICAL items block all new work |
408
+
409
+ ### Why Weighted (not average)
410
+
411
+ Security issues cause exponential blast — a 3/10 security score with all other dimensions at 9/10 = overall 72 (Fair), not 8.1 (Good). The formula ensures security and code quality dominate the verdict. Comparable across runs: if Overall moves from 68 → 74 after fixes, the project measurably improved.
412
+
413
+ > Source: zubair-trabzada/geo-seo-claude (2.7k★) — explicit weighted formula with 5-tier grade thresholds.
414
+
367
415
  ## Severity Levels
368
416
 
369
417
  ```
@@ -411,6 +459,10 @@ Apply confidence filtering: only report findings with >80% confidence. Consolida
411
459
  | Documentation | [n] |
412
460
  | Mesh Analytics | [n] |
413
461
 
462
+ ### Composite Score
463
+ - **Formula**: (Security×0.25) + (Code Quality×0.20) + (Architecture×0.15) + (Dependencies×0.15) + (Performance×0.10) + (Infrastructure×0.08) + (Documentation×0.07)
464
+ - **Weighted Score**: [computed value] → Grade: [Excellent/Good/Fair/Poor/Critical]
465
+
414
466
  ### Top Priority Actions
415
467
  1. [action] — [file:line] — [why it matters]
416
468
 
@@ -444,6 +496,16 @@ Report saved to: AUDIT-REPORT.md
444
496
  | Deps Gate | dependency-doctor report received before assembling final report | Invoke rune:dependency-doctor — do not skip |
445
497
  | Report Gate | All 8 phases completed before writing AUDIT-REPORT.md | Complete all phases, note skipped ones |
446
498
 
499
+ ## Returns
500
+
501
+ | Artifact | Format | Location |
502
+ |----------|--------|----------|
503
+ | Audit report | Markdown | `AUDIT-REPORT.md` (project root) |
504
+ | 8-dimension health score | Markdown table | `AUDIT-REPORT.md` + inline |
505
+ | Weighted composite score + grade | Markdown | inline + `AUDIT-REPORT.md` |
506
+ | Mesh analytics section | Markdown table | inline + `AUDIT-REPORT.md` |
507
+ | Journal entry | Text | `.rune/adr/` (via `rune:journal`) |
508
+
447
509
  ## Sharp Edges
448
510
 
449
511
  | Failure Mode | Severity | Mitigation |
@@ -195,6 +195,18 @@ Known failure modes for this skill. Check these before declaring done.
195
195
  - journal called with health score and surgery queue
196
196
  - Autopsy Report emitted with overall health tier and top-3 issues
197
197
 
198
+ ## Returns
199
+
200
+ | Artifact | Format | Location |
201
+ |----------|--------|----------|
202
+ | Health score per module | Scored table (0-100) | inline |
203
+ | RESCUE-REPORT.md | Markdown + Mermaid | project root |
204
+ | Surgery queue (priority order) | Ordered list | RESCUE-REPORT.md |
205
+ | Git archaeology findings | Bash output + summary | inline |
206
+ | Journal entry | Text | via `journal` L3 |
207
+
198
208
  ## Cost Profile
199
209
 
200
210
  ~5000-10000 tokens input, ~2000-4000 tokens output. Opus for deep analysis. Most expensive L2 skill but runs once per rescue.
211
+
212
+ **Scope guardrail:** autopsy assesses — it does not refactor. All surgery is delegated to `surgeon` after the report is complete.
@@ -311,6 +311,15 @@ Saved to `.rune/features/<feature-name>/requirements.md`
311
311
  6. MUST ask ONE question at a time — don't overwhelm user with 5 questions at once
312
312
  7. MUST NOT skip BA for non-trivial tasks — "just build it" gets redirected to Question 1
313
313
 
314
+ ## Returns
315
+
316
+ | Artifact | Format | Location |
317
+ |----------|--------|----------|
318
+ | Requirements document | Markdown | `.rune/features/<feature-name>/requirements.md` |
319
+ | User stories with acceptance criteria | Markdown (GIVEN/WHEN/THEN) | inline + requirements.md |
320
+ | Scope definition (in/out/assumptions) | Markdown sections | requirements.md |
321
+ | Non-functional requirements table | Markdown table | requirements.md |
322
+
314
323
  ## Sharp Edges
315
324
 
316
325
  Known failure modes for this skill. Check these before declaring done.
@@ -299,6 +299,15 @@ Choose Option B if [specific hedge condition].
299
299
  Proceeding to rune:plan with Option A. Constraints to honor: [list].
300
300
  ```
301
301
 
302
+ ## Returns
303
+
304
+ | Artifact | Format | Location |
305
+ |----------|--------|----------|
306
+ | Option matrix (2-3 Discovery / 3-5 Rescue) | Markdown sections | inline (chat output) |
307
+ | Trade-off analysis per option | Markdown (pros/cons/effort/risk) | inline |
308
+ | Single recommendation with hedge condition | Markdown | inline |
309
+ | Approved design document | Markdown | `docs/plans/<feature>.md` |
310
+
302
311
  ## Sharp Edges
303
312
 
304
313
  Known failure modes for this skill. Check these before declaring done.
@@ -326,3 +335,5 @@ Known failure modes for this skill. Check these before declaring done.
326
335
  ## Cost Profile
327
336
 
328
337
  ~2000-5000 tokens input, ~1000-2500 tokens output. Opus for creative reasoning depth. Runs infrequently — only when creative exploration is needed.
338
+
339
+ **Scope guardrail:** Brainstorm produces options and a recommendation — never implementation code or an execution plan. All code and planning begins only after user approves an approach and `rune:plan` is invoked.
@@ -4,7 +4,7 @@ description: "Validates agent claims against evidence trail. Catches 'done' with
4
4
  user-invocable: false
5
5
  metadata:
6
6
  author: runedev
7
- version: "1.5.0"
7
+ version: "1.6.0"
8
8
  layer: L3
9
9
  model: haiku
10
10
  group: validation
@@ -126,11 +126,24 @@ IF no evidence found:
126
126
  → UNCONFIRMED (agent may be right but didn't prove it)
127
127
  ```
128
128
 
129
+ **3-Axis verification** — categorize each claim into one of three axes, then ensure all axes are covered:
130
+
131
+ | Axis | Question | Example Claims |
132
+ |------|----------|----------------|
133
+ | **Completeness** | Were all planned tasks done? All specs implemented? | "implemented feature X", "all TODO items done", "migration created" |
134
+ | **Correctness** | Does output match spec intent? Do tests verify real behavior? | "tests pass", "build succeeds", "lint clean", "fixed the bug" |
135
+ | **Coherence** | Does it follow project patterns? Consistent with existing code? | "follows conventions", "uses existing patterns", "no new deps needed" |
136
+
137
+ If an axis has ZERO claims → flag as gap: "No [Completeness/Correctness/Coherence] evidence found — agent may have skipped this dimension."
138
+
139
+ > Source: Fission-AI/OpenSpec (32.8k★) — 3-dimensional verification beyond pass/fail.
140
+
129
141
  **Adversarial validation checklist** (run AFTER initial verdicts):
130
142
  1. Re-read each CONFIRMED claim — is the evidence actually proving THIS claim, or a different one?
131
143
  2. Check for **partial completion** — did the agent do 80% but claim 100%? (e.g., "implemented feature" but only the happy path)
132
144
  3. Check for **scope mismatch** — does the evidence prove the SPECIFIC claim or a broader/narrower version?
133
145
  4. If all claims are CONFIRMED on first pass, apply **skeptic sweep**: re-examine the weakest 2 claims with heightened scrutiny
146
+ 5. Check **axis coverage** — are all 3 axes (Completeness/Correctness/Coherence) represented? Missing axis = investigation gap
134
147
 
135
148
  ### Step 4 — Report
136
149
 
@@ -241,6 +254,7 @@ Completion Gate Report with status (CONFIRMED/UNCONFIRMED/CONTRADICTED), claim v
241
254
  - All completion claims extracted from agent output
242
255
  - Each claim matched against tool output evidence
243
256
  - Verdict table emitted with claim/evidence/verdict for each item
257
+ - All 3 verification axes (Completeness/Correctness/Coherence) have at least one claim checked
244
258
  - Overall verdict: CONFIRMED / UNCONFIRMED / CONTRADICTED
245
259
  - If not CONFIRMED: specific gaps listed with remediation steps
246
260
 
@@ -4,7 +4,7 @@ description: "Context window management. Auto-triggered when context is filling
4
4
  user-invocable: false
5
5
  metadata:
6
6
  author: runedev
7
- version: "0.4.0"
7
+ version: "0.6.0"
8
8
  layer: L3
9
9
  model: haiku
10
10
  group: state
@@ -130,6 +130,23 @@ In addition to tool-call counting, monitor context window percentage when availa
130
130
  Debounce: emit advisory max once per 5 tool calls to avoid noise.
131
131
  Tool-call thresholds (Steps 1-2) remain the primary signal. Percentage advisory is supplementary — use when CLI status bar data is available.
132
132
 
133
+ ## Iterative Retrieval (Context-Loading Strategy)
134
+
135
+ When loading context for a task (Phase 1 of cook, or onboard), use a 4-phase retrieval loop instead of loading everything at once:
136
+
137
+ ```
138
+ 1. DISPATCH (broad): Search with initial task keywords → get 5-10 candidate files
139
+ 2. EVALUATE: Score each file's relevance (0-1). Note codebase-specific terminology discovered
140
+ 3. REFINE: Use discovered terms to search again with better keywords
141
+ 4. LOOP: Repeat max 3 cycles. STOP when 3 high-relevance files found (not 10 mediocre ones)
142
+ ```
143
+
144
+ **Why**: The first search cycle reveals codebase-specific terms (custom class names, project conventions, internal APIs) that produce much better results in cycle 2. Loading 3 deeply relevant files beats loading 10 surface-level matches.
145
+
146
+ **Key rule**: Stop at 3 high-relevance files, not 10 mediocre ones. Quality > quantity for context loading.
147
+
148
+ > Source: affaan-m/everything-claude-code (91.9k★) — 4-phase iterative retrieval.
149
+
133
150
  ## Context Health Levels
134
151
 
135
152
  ```
@@ -158,6 +175,71 @@ Note: These are tool call counts, NOT token percentages. Claude Code does not ex
158
175
  - Blockers: [if any]
159
176
  ```
160
177
 
178
+ ## Strategic Compact Decision Table
179
+
180
+ When ORANGE or RED is reached, use this table to determine whether compaction is safe at the current boundary:
181
+
182
+ | Transition | Compact? | Reason |
183
+ |-----------|----------|--------|
184
+ | Research → Planning | YES | Research findings summarize well; key decisions survive |
185
+ | Planning → Implementation | YES | Plan is in files (.rune/plan-*.md); context can reload from artifacts |
186
+ | Debug → Next feature | YES | Debug findings are in Debug Report; fix has the diagnosis |
187
+ | Mid-implementation (Phase 4) | **NO** | Losing file paths, partial changes, and test state is catastrophic |
188
+ | After failed approach → Pivot | YES | Failed approach should be discarded; fresh context helps |
189
+ | Quality (Phase 5) → Verify | **NO** | Quality findings reference specific file:line in current context |
190
+ | After commit (Phase 7) | YES | Work is persisted in git; safe boundary |
191
+
192
+ **What survives compaction**: Task description, file paths mentioned, key decisions, plan reference, current phase.
193
+ **What is lost**: Full file contents read, intermediate reasoning, exact error messages, tool output details.
194
+
195
+ > Source: affaan-m/everything-claude-code (91.9k★) — strategic compact timing decision table.
196
+
197
+ ## Context Budget Audit (Baseline Cost Awareness)
198
+
199
+ MCP tool schemas and agent descriptions consume significant baseline context before any work begins. This section helps identify and reduce invisible context waste.
200
+
201
+ ### Token Cost Reference
202
+
203
+ | Source | Approx. Cost | Loaded When |
204
+ |--------|-------------|-------------|
205
+ | Each MCP tool schema | ~500 tokens | Session start (always) |
206
+ | Each agent description | ~200-400 tokens | Every `Task()` invocation |
207
+ | CLAUDE.md | ~100-2000 tokens | Session start (always) |
208
+ | Skill SKILL.md (full load) | ~500-3000 tokens | When skill is invoked |
209
+
210
+ ### Budget Rules
211
+
212
+ | Rule | Threshold | Action |
213
+ |------|-----------|--------|
214
+ | Max MCP servers | <10 active | Disable unused MCP servers in settings |
215
+ | Max MCP tools | <80 total | Remove or consolidate bloated MCP servers |
216
+ | Agent descriptions | Only load needed | Use specific `subagent_type` to avoid loading all descriptions |
217
+ | CLAUDE.md size | <150 lines | Move detailed docs to `.rune/` files, keep CLAUDE.md as index |
218
+
219
+ ### Audit Procedure
220
+
221
+ When context health is YELLOW or worse, or when onboard detects >80 MCP tools:
222
+
223
+ 1. Count total MCP tool schemas loaded (from session start messages)
224
+ 2. Count agent descriptions available
225
+ 3. Estimate baseline cost: `(tools × 500) + (agents × 300) + CLAUDE.md tokens`
226
+ 4. If baseline >15% of estimated context window → flag as **Context Budget Warning**
227
+ 5. Rank MCP servers by tool count — suggest disabling servers with most tools and least usage
228
+
229
+ ### Report Addition
230
+
231
+ When Context Budget Warning fires, append to Context Health report:
232
+
233
+ ```
234
+ ### Context Budget
235
+ - **Baseline cost**: ~[N]k tokens ([X]% of estimated window)
236
+ - **MCP tools loaded**: [count] across [N] servers
237
+ - **Top consumers**: [server1] ([N] tools), [server2] ([N] tools)
238
+ - **Recommendation**: Disable [server] to save ~[N]k tokens
239
+ ```
240
+
241
+ > Source: affaan-m/everything-claude-code (91.9k★) — MCP token cost awareness and budget rules.
242
+
161
243
  ## Constraints
162
244
 
163
245
  1. MUST preserve context fidelity — no summarizing away critical details