@rune-kit/rune 2.2.6 → 2.3.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 (91) hide show
  1. package/README.md +395 -389
  2. package/compiler/__tests__/tier-override.test.js +158 -0
  3. package/compiler/adapters/antigravity.js +3 -8
  4. package/compiler/adapters/codex.js +3 -8
  5. package/compiler/adapters/cursor.js +3 -8
  6. package/compiler/adapters/generic.js +3 -8
  7. package/compiler/adapters/openclaw.js +4 -9
  8. package/compiler/adapters/opencode.js +3 -8
  9. package/compiler/adapters/windsurf.js +3 -8
  10. package/compiler/bin/rune.js +34 -1
  11. package/compiler/emitter.js +94 -5
  12. package/compiler/transforms/branding.js +10 -3
  13. package/docs/ARCHITECTURE.md +3 -3
  14. package/docs/SKILL-TEMPLATE.md +15 -0
  15. package/docs/VISION.md +3 -3
  16. package/docs/guides/index.html +14 -14
  17. package/docs/index.html +82 -13
  18. package/docs/script.js +33 -6
  19. package/docs/skills/index.html +832 -832
  20. package/docs/style.css +62 -0
  21. package/extensions/ai-ml/PACK.md +7 -0
  22. package/extensions/content/PACK.md +7 -0
  23. package/extensions/mobile/PACK.md +9 -9
  24. package/extensions/zalo/PACK.md +9 -0
  25. package/package.json +8 -6
  26. package/skills/adversary/SKILL.md +12 -0
  27. package/skills/audit/SKILL.md +526 -467
  28. package/skills/autopsy/SKILL.md +12 -0
  29. package/skills/ba/SKILL.md +349 -342
  30. package/skills/brainstorm/SKILL.md +11 -0
  31. package/skills/completion-gate/SKILL.md +260 -249
  32. package/skills/context-engine/SKILL.md +77 -1
  33. package/skills/context-pack/SKILL.md +160 -0
  34. package/skills/cook/SKILL.md +648 -958
  35. package/skills/cook/references/deviation-rules.md +19 -0
  36. package/skills/cook/references/error-recovery.md +37 -0
  37. package/skills/cook/references/exit-conditions.md +31 -0
  38. package/skills/cook/references/loop-detection.md +39 -0
  39. package/skills/cook/references/mid-run-signals.md +31 -0
  40. package/skills/cook/references/output-format.md +40 -0
  41. package/skills/cook/references/pack-detection.md +82 -0
  42. package/skills/cook/references/pause-resume-template.md +38 -0
  43. package/skills/cook/references/rfc-template.md +52 -0
  44. package/skills/cook/references/sharp-edges.md +24 -0
  45. package/skills/cook/references/subagent-status.md +38 -0
  46. package/skills/db/SKILL.md +12 -0
  47. package/skills/debug/SKILL.md +392 -362
  48. package/skills/deploy/SKILL.md +10 -0
  49. package/skills/deploy/references/post-deploy-integration.md +192 -0
  50. package/skills/design/SKILL.md +9 -0
  51. package/skills/docs/SKILL.md +12 -0
  52. package/skills/docs-seeker/SKILL.md +11 -0
  53. package/skills/fix/SKILL.md +281 -249
  54. package/skills/incident/SKILL.md +10 -0
  55. package/skills/launch/SKILL.md +12 -0
  56. package/skills/logic-guardian/SKILL.md +11 -0
  57. package/skills/marketing/SKILL.md +13 -0
  58. package/skills/mcp-builder/SKILL.md +13 -0
  59. package/skills/onboard/SKILL.md +50 -2
  60. package/skills/perf/SKILL.md +11 -0
  61. package/skills/plan/SKILL.md +342 -688
  62. package/skills/plan/references/completeness-scoring.md +36 -0
  63. package/skills/plan/references/outcome-block.md +40 -0
  64. package/skills/plan/references/plan-templates.md +193 -0
  65. package/skills/plan/references/wave-planning.md +44 -0
  66. package/skills/plan/references/workflow-registry.md +52 -0
  67. package/skills/preflight/SKILL.md +360 -280
  68. package/skills/rescue/SKILL.md +11 -0
  69. package/skills/research/SKILL.md +149 -150
  70. package/skills/retro/SKILL.md +11 -0
  71. package/skills/review/SKILL.md +489 -396
  72. package/skills/review-intake/SKILL.md +11 -0
  73. package/skills/safeguard/SKILL.md +12 -0
  74. package/skills/scaffold/SKILL.md +10 -0
  75. package/skills/scope-guard/SKILL.md +11 -0
  76. package/skills/scout/SKILL.md +9 -0
  77. package/skills/sentinel/SKILL.md +296 -425
  78. package/skills/sentinel/references/config-protection.md +52 -0
  79. package/skills/sentinel/references/destructive-commands.md +39 -0
  80. package/skills/sentinel/references/domain-hooks.md +73 -0
  81. package/skills/sentinel/references/framework-patterns.md +46 -0
  82. package/skills/sentinel/references/owasp-patterns.md +69 -0
  83. package/skills/sentinel/references/secret-patterns.md +40 -0
  84. package/skills/sentinel/references/skill-content-guard.md +54 -0
  85. package/skills/session-bridge/SKILL.md +56 -2
  86. package/skills/skill-forge/SKILL.md +47 -2
  87. package/skills/skill-router/{SKILL.md → skill.md} +446 -365
  88. package/skills/surgeon/SKILL.md +12 -0
  89. package/skills/team/SKILL.md +34 -1
  90. package/skills/test/SKILL.md +585 -427
  91. package/skills/watchdog/references/webhook-health-checks.md +243 -0
@@ -0,0 +1,19 @@
1
+ # Deviation Rules — When Implementation Diverges from Plan
2
+
3
+ When implementation diverges from the approved plan, classify the deviation and act accordingly.
4
+
5
+ ## Rule Table
6
+
7
+ | Rule | Scope | Action | Example |
8
+ |------|-------|--------|---------|
9
+ | R1: Bug fix | Code doesn't work as planned | Auto-fix, continue | Test fails due to typo, missing import |
10
+ | R2: Security fix | Vulnerability discovered | Auto-fix, continue | SQL injection, XSS, hardcoded secret |
11
+ | R3: Blocking fix | Can't proceed without change | Auto-fix, continue | Missing dependency, wrong API signature |
12
+ | R4: Architectural change | Different approach than planned | **ASK user first** | New database table, changed API contract, different library |
13
+
14
+ ## Guidance
15
+
16
+ **R1-R3**: Security primitives and correctness fixes are NOT features — fix silently.
17
+
18
+ **R4**: If you catch yourself thinking "this is a better way" — STOP and ask.
19
+ The plan was approved for a reason. Architectural deviations require explicit user consent before proceeding.
@@ -0,0 +1,37 @@
1
+ # Error Recovery — Phase Failure Handling
2
+
3
+ What to do when each phase fails, plus repair operators to use before escalating.
4
+
5
+ ## Phase Failure Table
6
+
7
+ | Phase | If this fails... | Do this... |
8
+ |-------|-----------------|------------|
9
+ | 1 UNDERSTAND | scout finds nothing relevant | Proceed with plan, note limited context |
10
+ | 2 PLAN | Task too complex | Break into smaller tasks, consider `rune:team` |
11
+ | 3 TEST | Can't write tests (no test framework) | Skip TDD, write tests after implementation |
12
+ | 4 IMPLEMENT | Fix hits repeated bugs | `rune:debug` (max 3 loops) → re-plan → if still blocked → **Approach Pivot Gate** → `rune:brainstorm(rescue)` |
13
+ | 5a PREFLIGHT | Logic issues found | Fix → re-run preflight |
14
+ | 5b SENTINEL | Security CRITICAL found | Fix immediately → re-run (mandatory) |
15
+ | 5c REVIEW | Code quality issues | Fix CRITICAL/HIGH → re-review (max 2 loops) |
16
+ | 6 VERIFY | Build/lint/type fails | Fix → re-run verification |
17
+
18
+ ## Repair Operators (before escalation)
19
+
20
+ When a task fails during Phase 4 (IMPLEMENT), apply these operators in order before escalating.
21
+
22
+ | Operator | When | Action |
23
+ |----------|------|--------|
24
+ | **RETRY** | Transient failure (network, timeout, flaky test) | Re-run same approach, max 2 attempts |
25
+ | **DECOMPOSE** | Task too complex, partial progress | Split into 2-3 smaller tasks, continue |
26
+ | **PRUNE** | Approach fundamentally wrong | Remove failed code, try different approach from plan |
27
+
28
+ ## Retry Budget
29
+
30
+ **2 repair attempts per task.**
31
+
32
+ After 2 failures → escalate:
33
+ - Same error both times → `debug` for root cause
34
+ - Different errors → `plan` to redesign the task
35
+ - All approaches exhausted → `brainstorm(rescue)` for alternative category
36
+
37
+ Do NOT ask user until repair budget is spent.
@@ -0,0 +1,31 @@
1
+ # Exit Conditions — Autonomous Loop Caps
2
+
3
+ Every cook invocation inside `team` or autonomous workflows MUST respect these exit conditions.
4
+ These caps prevent runaway loops and force escalation before context exhaustion.
5
+
6
+ ## Hard Caps
7
+
8
+ ```
9
+ MAX_DEBUG_LOOPS: 3 per error area (already enforced in Phase 4)
10
+ MAX_QUALITY_LOOPS: 2 re-runs of Phase 5 (fix→recheck cycle)
11
+ MAX_REPLAN: 1 re-plan per cook session (Phase 4 re-plan check)
12
+ MAX_PIVOT: 1 approach pivot per cook session (Approach Pivot Gate)
13
+ MAX_FIXES: 30 per session (hard cap — fix's WTF-likelihood self-regulation)
14
+ WTF_THRESHOLD: 20% quality decay risk → STOP fixing, commit progress, re-assess
15
+ TIMEOUT_SIGNAL: If context-watch reports ORANGE, wrap up current phase and checkpoint
16
+ ```
17
+
18
+ ## Escalation Chain
19
+
20
+ ```
21
+ debug-fix (3x) → re-plan (1x) → approach pivot via brainstorm rescue (1x) → THEN escalate to user
22
+ ```
23
+
24
+ Never surrender before exhausting the pivot. Never spin indefinitely.
25
+
26
+ ## Triggered State
27
+
28
+ If any exit condition triggers without resolution:
29
+ - Cook emits `BLOCKED` status with full details (phase, blocker, what was tried)
30
+ - Execution stops
31
+ - User must make a decision before cook can resume
@@ -0,0 +1,39 @@
1
+ # Hash-Based Loop Detection — Content-Aware Stuck Detection
2
+
3
+ The Analysis Paralysis Guard (5-read counter in SKILL.md) catches obvious paralysis.
4
+ This catches **same-input-same-output loops** — where the agent keeps calling the same tool
5
+ with the same arguments and getting the same result, making zero progress.
6
+
7
+ Source: goclaw (832★) — SHA256-based loop detection distinguishes true stuck loops from productive retries.
8
+
9
+ ## Detection Logic
10
+
11
+ Track mentally (no actual SHA256 required):
12
+
13
+ ```
14
+ For each tool call, track:
15
+ argsHash = fingerprint(tool_name + arguments)
16
+ resultHash = fingerprint(result content)
17
+
18
+ IF same argsHash AND same resultHash seen before:
19
+ consecutive_identical += 1
20
+ ELSE:
21
+ consecutive_identical = 0
22
+
23
+ Thresholds:
24
+ 3 identical calls → WARN: "Loop detected — same tool, same args, same result 3x. Change approach."
25
+ 5 identical calls → FORCE STOP: "True stuck loop. Must try different tool or different arguments."
26
+ ```
27
+
28
+ ## Key Distinction
29
+
30
+ Retry-with-different-result is **NOT** a loop (e.g., re-running tests after a fix).
31
+ Only same-input-AND-same-output counts.
32
+
33
+ ## Common Loop Patterns
34
+
35
+ | Pattern | Looks Like | Actually |
36
+ |---------|-----------|----------|
37
+ | Re-reading same file after failed edit | `Read(file.ts)` → same content 3x | Agent forgot what it read — act on existing knowledge |
38
+ | Re-running same failing test without code change | `Bash(npm test)` → same failure 3x | No code was changed between runs — fix first, then test |
39
+ | Grepping same pattern across different paths | `Grep("pattern", src/)` → `Grep("pattern", lib/)` → same 0 results | Pattern doesn't exist — change search terms |
@@ -0,0 +1,31 @@
1
+ # Mid-Run Signal Detection — Two-Stage Intent Classification
2
+
3
+ When user sends a message DURING cook execution (mid-phase), classify intent before acting.
4
+ Source: goclaw (832★) — two-stage intent classification prevents expensive LLM calls for simple signals.
5
+
6
+ ## Stage 1 — Keyword Fast-Path
7
+
8
+ No LLM reasoning needed. Applies when message is <60 chars.
9
+
10
+ | Pattern | Intent | Action |
11
+ |---------|--------|--------|
12
+ | "stop", "cancel", "dừng", "abort" | `Cancel` | Save progress → emit Cook Report with status BLOCKED → stop |
13
+ | "status", "tiến độ", "progress", "where are you" | `StatusQuery` | Reply with current phase + task + % estimate → resume |
14
+ | "wait", "pause", "đợi" | `Pause` | Create `.rune/.continue-here.md` → WIP commit → stop |
15
+ | "skip this", "bỏ qua", "next" | `Steer` | Skip current task → proceed to next task/phase |
16
+
17
+ ## Stage 2 — Context Classification
18
+
19
+ Applies when NO keyword match AND message is >60 chars.
20
+
21
+ | Intent | Signal | Action |
22
+ |--------|--------|--------|
23
+ | `Steer` | Modifies scope but keeps goal ("actually use Redis instead of Memcached") | Update plan inline, note deviation in Cook Report |
24
+ | `NewTask` | Unrelated to current work ("also fix the login page") | Log to `.rune/backlog.md`, continue current task. Announce: "Noted for later — staying on current task." |
25
+ | `Clarification` | Answers a question cook asked, or provides missing context | Absorb into current phase context, resume |
26
+
27
+ ## Priority Rule
28
+
29
+ Cancel and Pause are **safety signals** — they take absolute priority over all other classifications.
30
+ If ambiguous between Cancel and Steer → ask: "Did you mean stop, or change approach?"
31
+ Never queue user messages — process immediately.
@@ -0,0 +1,40 @@
1
+ # Cook Report — Output Format
2
+
3
+ Full format for the Cook Report emitted at the end of every cook session.
4
+ Also defines the NEXUS Deliverables table format used when cook is invoked by `team`.
5
+
6
+ ## Cook Report Format
7
+
8
+ ```
9
+ ## Cook Report: [Task Name]
10
+ - **Status**: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED
11
+ - **Phases**: [list of completed phases]
12
+ - **Files Changed**: [count] ([list])
13
+ - **Tests**: [passed]/[total] ([coverage]%)
14
+ - **Quality**: preflight [PASS/WARN] | sentinel [PASS/WARN] | review [PASS/WARN]
15
+ - **Commit**: [hash] — [message]
16
+
17
+ ### Deliverables (NEXUS response — when invoked by team)
18
+ | # | Deliverable | Status | Evidence |
19
+ |---|-------------|--------|----------|
20
+ | 1 | [from handoff] | DELIVERED | [file path or test output quote] |
21
+ | 2 | [from handoff] | DELIVERED | [file path or test output quote] |
22
+ | 3 | [from handoff] | PARTIAL | [what's missing and why] |
23
+
24
+ ### Concerns (if DONE_WITH_CONCERNS)
25
+ - [concern]: [impact assessment] — [suggested remediation]
26
+
27
+ ### Decisions Made
28
+ - [decision]: [rationale]
29
+
30
+ ### Session State
31
+ - Saved to .rune/decisions.md
32
+ - Saved to .rune/progress.md
33
+ ```
34
+
35
+ ## Usage Rules
36
+
37
+ - When cook is invoked **standalone** (not by team): Deliverables table is optional
38
+ - When cook is invoked by **team** with a NEXUS Handoff: Deliverables table is **MANDATORY** — team uses it to track acceptance criteria across streams
39
+ - Cook Report MUST contain actual commit hash, not placeholder
40
+ - Self-Validation must pass before emitting the report
@@ -0,0 +1,82 @@
1
+ # L4 Pack Detection — Signal → Pack Mapping
2
+
3
+ This file defines the full signal-to-pack mapping used in Phase 1.5 (DOMAIN CONTEXT).
4
+ When a signal in the codebase or task description matches a row below, load the corresponding pack.
5
+
6
+ ## Split Pack Protocol (context-efficient)
7
+
8
+ - `Read` the matching PACK.md index (~60-80 lines) — contains triggers, skill table, connections, workflows
9
+ - Match the task to the specific skill name in the index's Skills Included table
10
+ - `Read` only the matching skill file(s) from `skills/` subdirectory (e.g., `extensions/backend/skills/auth.md`)
11
+ - Load max 2-3 skill files per invocation — not all skills in the pack
12
+ - Pack-level constraints (from index's Connections and Sharp Edges sections) always apply
13
+
14
+ ## Monolith Pack Protocol (legacy)
15
+
16
+ If no `format: split` in PACK.md frontmatter, read the full PACK.md and extract the matching `### skill-name` section.
17
+
18
+ ## Signal → Pack Table
19
+
20
+ | Signal in Codebase or Task | Pack | File |
21
+ |---|---|---|
22
+ | `*.tsx`, `*.svelte`, `*.vue`, Tailwind, CSS modules | `@rune/ui` | `extensions/ui/PACK.md` |
23
+ | Express/Fastify/NestJS routes, API endpoints | `@rune/backend` | `extensions/backend/PACK.md` |
24
+ | Dockerfile, `.github/workflows/`, Terraform | `@rune/devops` | `extensions/devops/PACK.md` |
25
+ | `react-native`, `expo`, `flutter`, `ios/`, `android/` | `@rune/mobile` | `extensions/mobile/PACK.md` |
26
+ | Auth, OWASP, secrets, PCI/HIPAA markers | `@rune/security` | `extensions/security/PACK.md` |
27
+ | Trading, charts, market data, `decimal.js` | `@rune/trading` | `extensions/trading/PACK.md` |
28
+ | Multi-tenant, billing, `stripe`, subscription | `@rune/saas` | `extensions/saas/PACK.md` |
29
+ | Cart, checkout, inventory, Shopify | `@rune/ecommerce` | `extensions/ecommerce/PACK.md` |
30
+ | `openai`, `anthropic`, embeddings, RAG, LLM | `@rune/ai-ml` | `extensions/ai-ml/PACK.md` |
31
+ | `three`, `pixi`, `phaser`, `*.glsl`, game loop | `@rune/gamedev` | `extensions/gamedev/PACK.md` |
32
+ | CMS, blog, MDX, `i18next`, SEO | `@rune/content` | `extensions/content/PACK.md` |
33
+ | Analytics, tracking, A/B test, funnel | `@rune/analytics` | `extensions/analytics/PACK.md` |
34
+ | Chrome extension, `manifest.json`, service worker, content script | `@rune/chrome-ext` | `extensions/chrome-ext/PACK.md` |
35
+ | PRD, roadmap, KPI, release notes, `.rune/business/` | `@rune-pro/product` | `extensions/pro-product/PACK.md` |
36
+ | Sales outreach, pipeline, call prep, competitive intel | `@rune-pro/sales` | `extensions/pro-sales/PACK.md` |
37
+ | Data science, SQL, dashboard, statistical testing, ETL | `@rune-pro/data-science` | `extensions/pro-data-science/PACK.md` |
38
+ | Support ticket, KB article, escalation, SLA, FAQ | `@rune-pro/support` | `extensions/pro-support/PACK.md` |
39
+ | Budget, expense, revenue forecast, P&L, cash flow, runway | `@rune-pro/finance` | `extensions/pro-finance/PACK.md` |
40
+ | Contract, NDA, compliance, GDPR, IP, legal incident | `@rune-pro/legal` | `extensions/pro-legal/PACK.md` |
41
+ | JD, resume, interview, hiring, onboarding, compensation, HR policy | `@rune-pro/hr` | `extensions/pro-hr/PACK.md` |
42
+ | Enterprise search, cross-system, knowledge graph, federated query | `@rune-pro/enterprise-search` | `extensions/pro-enterprise-search/PACK.md` |
43
+ | Zalo Mini App, ZMP, `zalo-mini-app`, ZNS, Zalo OA | `@rune/zalo` | `extensions/zalo/PACK.md` |
44
+
45
+ ## After Match Found
46
+
47
+ If ≥1 pack matches:
48
+ - Use `Read` to load the matching PACK.md (index if split, full if monolith)
49
+ - For split packs: identify the relevant skill from the index table, then `Read` only that skill file from `skills/` subdirectory
50
+ - For monolith packs: extract the relevant `### skill-name` section from the PACK.md body
51
+ - Apply pack constraints alongside cook's own constraints for the rest of the workflow
52
+ - Announce: "Loaded @rune/[pack] → [skill-name] (split)" or "Loaded @rune/[pack] → [skill-name] (full)"
53
+
54
+ If 0 packs match: skip silently, proceed to Phase 2.
55
+
56
+ ## Workflow Command Detection
57
+
58
+ After a pack is matched, check if the user's request maps to a named workflow in the pack's Workflows table.
59
+
60
+ **Detection rules:**
61
+ 1. Explicit command: user types `/rune <pack> <workflow>` (e.g., `/rune finance monthly-close`)
62
+ 2. Implicit match: task description contains workflow trigger keywords from the Workflows table
63
+ 3. Single-skill shortcut: `/rune <pack> <skill>` routes directly to one skill
64
+
65
+ **If a workflow matches:**
66
+ 1. Read the Workflows section of the matched PACK.md
67
+ 2. Extract the skill sequence (e.g., `expense-analysis → financial-reporting → cash-flow-optimization`)
68
+ 3. Execute skills in order — each skill's output feeds the next as context
69
+ 4. Thread state via `.rune/<pack>/` artifacts (each skill reads previous skill's output file)
70
+
71
+ **If no workflow matches:**
72
+ - Fall back to single-skill detection (match task to best skill from the Skills table)
73
+ - This is the current default behavior
74
+
75
+ **Workflow examples:**
76
+ | Command | Pack | Workflow | Skill Sequence |
77
+ |---------|------|----------|----------------|
78
+ | `/rune finance monthly-close` | finance | monthly-close | expense-analysis → financial-reporting → cash-flow |
79
+ | `/rune hr full-cycle` | hr | full-cycle | jd-writer → resume-screener → interview-planner → scorecard |
80
+ | `/rune search "query"` | enterprise-search | search | query-planner → source-connector → result-merger → permission-guard |
81
+ | `/rune sales prep` | sales | prep | account-research → call-preparation → competitive-intel |
82
+ | `/rune product feature` | product | feature | feature-spec → roadmap → metrics-tracking |
@@ -0,0 +1,38 @@
1
+ # Pause/Resume Template — Formal Mid-Phase Handoff
2
+
3
+ This file defines the `.continue-here.md` format used when cook must pause mid-phase
4
+ (context limit, user break, session end before phase completes).
5
+
6
+ ## When to Use
7
+
8
+ When cook cannot complete the current phase in one session:
9
+ - Context limit approaching (context-watch ORANGE)
10
+ - User explicitly requests a break ("pause", "đợi", "wait")
11
+ - Session end is forced before phase completes
12
+
13
+ ## `.rune/.continue-here.md` Format
14
+
15
+ ```markdown
16
+ ## Continue Here
17
+ - **Phase**: [current phase number and name]
18
+ - **Task**: [current task within phase — e.g., "Task 3 of 5"]
19
+ - **Completed**: [list of tasks done this session]
20
+ - **Remaining**: [list of tasks not yet started]
21
+ - **Decisions**: [any decisions made this session]
22
+ - **Blockers**: [if any — what's stuck and why]
23
+ - **WIP Files**: [files modified but not yet committed]
24
+ ```
25
+
26
+ ## Pause Protocol
27
+
28
+ 1. Create `.rune/.continue-here.md` with the format above
29
+ 2. Create a WIP commit: `wip: cook phase N paused at task M`
30
+ 3. Stop execution
31
+
32
+ ## Resume Protocol
33
+
34
+ Phase 0 (RESUME CHECK) detects `.continue-here.md` → resumes from exact task position.
35
+
36
+ This is more granular than Phase 0's plan-level resume — it resumes **within** a phase, not just between phases.
37
+
38
+ After successful resume and phase completion → delete `.continue-here.md`.
@@ -0,0 +1,52 @@
1
+ # RFC Template — Breaking Change Gate
2
+
3
+ This file contains the RFC artifact format used in Phase 2.5 (RFC GATE).
4
+ Write this artifact to `.rune/rfc/RFC-<NNN>-<slug>.md` whenever a breaking change is detected.
5
+
6
+ ## Auto-Trigger Conditions (ANY triggers this gate)
7
+
8
+ - Plan includes `BREAKING CHANGE` annotation
9
+ - Plan modifies a public API signature (added/removed/changed parameters)
10
+ - Plan alters database schema (migration required)
11
+ - Plan removes or renames an exported function/type used by other modules
12
+ - Plan changes authentication/authorization flow
13
+
14
+ ## Skip Conditions
15
+
16
+ Non-breaking changes, internal refactors, new features with no API surface change.
17
+
18
+ ## RFC Artifact Format
19
+
20
+ ```markdown
21
+ # RFC-<NNN>: <Title>
22
+
23
+ **Date**: [YYYY-MM-DD]
24
+ **Author**: [agent or user]
25
+ **Status**: Proposed | Approved | Rejected
26
+ **Impact**: [list affected consumers — modules, services, users]
27
+
28
+ ## What Changes
29
+ [Specific breaking change — old behavior → new behavior]
30
+
31
+ ## Why
32
+ [Business/technical justification — why breaking is necessary]
33
+
34
+ ## Migration Path
35
+ [Step-by-step guide for consumers to adapt]
36
+ [Include code examples: before → after]
37
+
38
+ ## Rollback Plan
39
+ [How to revert if the change causes issues]
40
+
41
+ ## Affected Systems
42
+ | System | Impact | Migration Effort |
43
+ |--------|--------|-----------------|
44
+ | [module/service] | [description] | [low/medium/high] |
45
+ ```
46
+
47
+ ## Gate Protocol
48
+
49
+ Present RFC to user for approval. User responds:
50
+ - **"approved"** → proceed to Phase 3
51
+ - **"rejected"** → revise plan
52
+ - **"deferred"** → skip breaking change, implement non-breaking alternative
@@ -0,0 +1,24 @@
1
+ # Sharp Edges — Known Failure Modes
2
+
3
+ Check these before declaring done. These are the most common ways cook goes wrong.
4
+
5
+ | Failure Mode | Severity | Mitigation |
6
+ |---|---|---|
7
+ | Skipping scout to "save time" on a simple task | CRITICAL | Scout Gate blocks this — Phase 1 is mandatory regardless of perceived simplicity |
8
+ | Writing code without user-approved plan | HIGH | Plan Gate: do NOT proceed to Phase 3 without explicit approval ("go", "proceed", "yes") |
9
+ | Claiming "all tests pass" without showing output | HIGH | Constraint 7 blocks this — show actual test runner output via completion-gate |
10
+ | Entering debug↔fix loop more than 3 times without escalating | MEDIUM | After 3 loops → re-plan → if still blocked → Approach Pivot Gate → brainstorm(rescue) |
11
+ | Surrendering "no solution" without triggering Approach Pivot Gate | CRITICAL | MUST invoke brainstorm(rescue) before telling user "can't be done" — pivot to different category first |
12
+ | Re-planning with the same approach category after it fundamentally failed | HIGH | Re-plan = revise steps within same approach. If CATEGORY is wrong → Approach Pivot Gate, not re-plan |
13
+ | Not escalating to sentinel:opus on security-sensitive tasks | MEDIUM | Auth, crypto, payment code → sentinel must run at opus, not sonnet |
14
+ | Running Phase 5 checks sequentially instead of parallel | MEDIUM | Launch preflight+sentinel+review as parallel Task agents for speed |
15
+ | Saying "done" without evidence trail | CRITICAL | completion-gate validates claims — UNCONFIRMED = BLOCK |
16
+ | Analysis paralysis — 5+ reads without writing | HIGH | Analysis Paralysis Guard: act on incomplete info or report BLOCKED with specific missing piece |
17
+ | Fast mode on security-relevant code | HIGH | Fast mode auto-excludes auth/crypto/payments — never fast-track security code |
18
+ | Loading all phase files at once into context | HIGH | Phase File Gate: load ONLY the active phase file — one phase per session |
19
+ | Resuming without checking master plan | MEDIUM | Phase 0 (RESUME CHECK) runs before Phase 1 — detects existing plans |
20
+ | Treating user "stop"/"cancel" as scope change | CRITICAL | Mid-Run Signal Detection: Cancel/Pause are safety signals with absolute priority — never reinterpret as Steer or NewTask |
21
+ | Same tool+args+result called 3+ times without progress | HIGH | Hash-Based Loop Detection: 3x warn, 5x force stop. Only same-input-AND-same-output counts |
22
+ | Ignoring mid-run user messages during autonomous execution | HIGH | Two-stage intent classification: keyword fast-path for simple signals, context for longer. Never queue messages. |
23
+ | Breaking change shipped without RFC review | CRITICAL | Phase 2.5 RFC Gate: any breaking change MUST have RFC artifact + user approval before implementation |
24
+ | Runaway fix loop — fix introduces more bugs than it resolves | HIGH | fix v0.5.0 WTF-likelihood self-regulation: >20% decay = STOP. Hard cap 30 fixes/session via MAX_FIXES exit condition |
@@ -0,0 +1,38 @@
1
+ # Subagent Status Protocol
2
+
3
+ When cook completes (whether standalone or invoked by `team`), it MUST return one of four statuses.
4
+ Sub-skills invoked by cook (fix, test, review, sentinel, etc.) MUST also return one of these statuses
5
+ so cook can route accordingly.
6
+
7
+ ## Status Table
8
+
9
+ | Status | Meaning | Cook Action |
10
+ |--------|---------|-------------|
11
+ | `DONE` | Task complete, no issues | Proceed to next phase |
12
+ | `DONE_WITH_CONCERNS` | Task complete but issues noted (e.g., "tests pass but a performance regression observed") | Proceed, but append concern to `.rune/progress.md` and surface in Cook Report; address in Phase 5 (QUALITY) or next review cycle |
13
+ | `NEEDS_CONTEXT` | Cannot proceed without more information (missing requirement, ambiguous spec, unknown environment) | Pause execution. Ask user the specific question(s) blocking progress. Resume from the same phase after answer received. |
14
+ | `BLOCKED` | Hard blocker — cannot continue regardless of context (broken dependency, fundamental incompatibility, exhausted escalation chain) | Trigger escalation chain: debug-fix (3x) → re-plan (1x) → brainstorm rescue (1x) → then escalate to user with full details |
15
+
16
+ ## Message Formats
17
+
18
+ ### DONE_WITH_CONCERNS
19
+
20
+ Append to `.rune/progress.md`:
21
+ ```
22
+ [CONCERN][phase][timestamp] <sub-skill>: <concern description>
23
+ ```
24
+
25
+ ### NEEDS_CONTEXT
26
+
27
+ State exactly:
28
+ 1. What is unknown
29
+ 2. Why it blocks progress
30
+ 3. The two most likely answers (to help the user respond quickly)
31
+
32
+ ### BLOCKED
33
+
34
+ Include:
35
+ 1. The phase
36
+ 2. The sub-skill that emitted BLOCKED
37
+ 3. The specific blocker
38
+ 4. What was already attempted
@@ -251,6 +251,18 @@ Known failure modes for this skill. Check these before declaring done.
251
251
  - Schema changelog updated in .rune/schema-changelog.md
252
252
  - Structured DB Report emitted with PASS/WARN/BLOCK verdict
253
253
 
254
+ ## Returns
255
+
256
+ | Artifact | Format | Location |
257
+ |----------|--------|----------|
258
+ | Migration file (up) | SQL or ORM-specific | `migrations/<timestamp>_<name>/` |
259
+ | Rollback script (down) | SQL or ORM-specific | same migration directory |
260
+ | Schema changelog entry | Markdown | `.rune/schema-changelog.md` |
261
+ | Index recommendations | Structured list | inline (DB Report) |
262
+ | DB Report with verdict | Markdown (PASS/WARN/BLOCK) | inline |
263
+
254
264
  ## Cost Profile
255
265
 
256
266
  ~2000-6000 tokens input, ~800-2000 tokens output. Sonnet for migration generation quality.
267
+
268
+ **Scope guardrail:** db generates and validates migrations — it does not run them in production. Execution is delegated to `verification` in test environments only.