@rune-kit/rune 2.11.0 → 2.12.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 (60) hide show
  1. package/README.md +58 -1
  2. package/compiler/__tests__/detect-invariants.test.js +136 -0
  3. package/compiler/__tests__/doctor-mesh.test.js +229 -0
  4. package/compiler/__tests__/hook-dispatch.test.js +91 -0
  5. package/compiler/__tests__/hooks-antigravity.test.js +118 -0
  6. package/compiler/__tests__/hooks-cursor.test.js +139 -0
  7. package/compiler/__tests__/hooks-install.test.js +305 -0
  8. package/compiler/__tests__/hooks-merge.test.js +204 -0
  9. package/compiler/__tests__/hooks-tiers.test.js +519 -0
  10. package/compiler/__tests__/hooks-windsurf.test.js +115 -0
  11. package/compiler/__tests__/inject-claude-md.test.js +152 -0
  12. package/compiler/__tests__/load-invariants.test.js +408 -0
  13. package/compiler/__tests__/onboard-invariants.test.js +240 -0
  14. package/compiler/adapters/hooks/antigravity.js +140 -0
  15. package/compiler/adapters/hooks/claude.js +166 -0
  16. package/compiler/adapters/hooks/cursor.js +191 -0
  17. package/compiler/adapters/hooks/index.js +82 -0
  18. package/compiler/adapters/hooks/tier-emitter.js +182 -0
  19. package/compiler/adapters/hooks/windsurf.js +202 -0
  20. package/compiler/bin/rune.js +196 -6
  21. package/compiler/commands/hook-dispatch.js +87 -0
  22. package/compiler/commands/hooks/install.js +120 -0
  23. package/compiler/commands/hooks/merge.js +211 -0
  24. package/compiler/commands/hooks/presets.js +116 -0
  25. package/compiler/commands/hooks/status.js +112 -0
  26. package/compiler/commands/hooks/tiers.js +221 -0
  27. package/compiler/commands/hooks/uninstall.js +94 -0
  28. package/compiler/doctor.js +236 -0
  29. package/package.json +2 -2
  30. package/skills/ba/SKILL.md +85 -1
  31. package/skills/brainstorm/SKILL.md +39 -1
  32. package/skills/browser-pilot/SKILL.md +1 -0
  33. package/skills/context-engine/SKILL.md +6 -2
  34. package/skills/design/SKILL.md +1 -0
  35. package/skills/docs-seeker/SKILL.md +1 -0
  36. package/skills/fix/SKILL.md +4 -2
  37. package/skills/hallucination-guard/SKILL.md +1 -0
  38. package/skills/journal/SKILL.md +1 -0
  39. package/skills/logic-guardian/SKILL.md +22 -4
  40. package/skills/marketing/SKILL.md +62 -1
  41. package/skills/neural-memory/SKILL.md +13 -16
  42. package/skills/onboard/SKILL.md +30 -2
  43. package/skills/onboard/references/invariants-template.md +76 -0
  44. package/skills/onboard/scripts/detect-invariants.js +439 -0
  45. package/skills/onboard/scripts/inject-claude-md.js +150 -0
  46. package/skills/onboard/scripts/onboard-invariants.js +194 -0
  47. package/skills/perf/SKILL.md +1 -0
  48. package/skills/plan/SKILL.md +2 -0
  49. package/skills/preflight/SKILL.md +1 -1
  50. package/skills/research/SKILL.md +4 -0
  51. package/skills/review/SKILL.md +4 -2
  52. package/skills/scope-guard/SKILL.md +4 -1
  53. package/skills/scout/SKILL.md +6 -0
  54. package/skills/sentinel/SKILL.md +2 -0
  55. package/skills/session-bridge/SKILL.md +53 -1
  56. package/skills/session-bridge/scripts/load-invariants.js +397 -0
  57. package/skills/slides/SKILL.md +19 -0
  58. package/skills/team/SKILL.md +2 -1
  59. package/skills/test/SKILL.md +6 -0
  60. package/skills/verification/SKILL.md +8 -0
@@ -3,7 +3,7 @@ name: marketing
3
3
  description: Create marketing assets and execute launch strategy. Generates landing copy, social banners, SEO meta, blog posts, and video scripts.
4
4
  metadata:
5
5
  author: runedev
6
- version: "0.4.0"
6
+ version: "0.5.0"
7
7
  layer: L2
8
8
  model: sonnet
9
9
  group: delivery
@@ -112,6 +112,61 @@ Using product understanding, market research, and **brand voice contract**, prod
112
112
 
113
113
  **Secondary CTA** (bottom of page)
114
114
 
115
+ ### Step 3.5 — Competitive Response Playbook
116
+
117
+ When `trend-scout` identifies active competitors or market threats, generate pre-planned counter-strategies. This turns reactive scrambling into prepared responses.
118
+
119
+ **Four Threat Scenarios:**
120
+
121
+ | Scenario | Trigger Signal | Response Window |
122
+ |----------|---------------|-----------------|
123
+ | **Price War** | Competitor drops price >20% | 24-48 hours |
124
+ | **New Market Entry** | New competitor launches in your space | 1-2 weeks |
125
+ | **Viral Competitor** | Competitor content goes viral (10x normal engagement) | 24-72 hours |
126
+ | **Fast Follower** | Competitor copies your feature within 30 days of launch | 1 week |
127
+
128
+ **For each relevant scenario, document:**
129
+
130
+ ```markdown
131
+ ## Counter-Strategy: [Scenario Name]
132
+
133
+ ### Trigger
134
+ - Signal: [what to watch for]
135
+ - Detection: [how to monitor — social listening, price tracking, etc.]
136
+ - Response window: [how fast to react]
137
+
138
+ ### Counter-Move
139
+ - **Immediate (Day 1)**: [first response — usually messaging/positioning]
140
+ - **Short-term (Week 1)**: [tactical moves — promos, content, outreach]
141
+ - **Medium-term (Month 1)**: [strategic adjustments — product, pricing, positioning]
142
+
143
+ ### Resources Required
144
+ - Team: [who needs to be involved]
145
+ - Budget: [estimated cost]
146
+ - Assets: [what to prepare in advance]
147
+
148
+ ### Success Metric
149
+ - [How to know the counter-strategy worked]
150
+
151
+ ### Pre-Built Assets
152
+ - [ ] Response messaging template
153
+ - [ ] Social post drafts
154
+ - [ ] Email to existing customers
155
+ - [ ] FAQ for sales/support team
156
+ ```
157
+
158
+ **Rules:**
159
+ - Only generate playbooks for scenarios relevant to this market (skip if no direct competitors)
160
+ - Pre-build assets NOW — when the trigger fires, you execute, not create
161
+ - Response window is real — if you can't respond in time, the playbook failed
162
+ - Test the detection mechanism — if you can't see the trigger, you can't respond
163
+
164
+ **Skip this step if:**
165
+ - Product is in a blue ocean (no direct competitors yet)
166
+ - User explicitly requests marketing assets only, no strategy
167
+
168
+ Save to `marketing/counter-playbook.md`.
169
+
115
170
  ### Step 4 — Social posts
116
171
 
117
172
  Produce ready-to-post content:
@@ -218,6 +273,7 @@ Output all assets as structured markdown sections. Present to user for review be
218
273
  After user approves, use `Write` to save:
219
274
  - `marketing/brand-voice.md` — voice contract from Step 2.5
220
275
  - `marketing/landing-copy.md` — all copy from Step 3
276
+ - `marketing/counter-playbook.md` — competitive response strategies from Step 3.5 (if competitors exist)
221
277
  - `marketing/social-posts.md` — all posts from Step 4
222
278
  - `marketing/seo-meta.json` — SEO data from Step 5
223
279
  - `marketing/seo-audit.md` — SEO audit results from Step 5.5 (if existing site)
@@ -258,12 +314,16 @@ Known failure modes for this skill. Check these before declaring done.
258
314
  | Copy not based on actual codebase features (invented value props) | HIGH | scout must run in Step 1 — features extracted from actual code, not assumptions |
259
315
  | Missing SEO keyword analysis (no research call) | MEDIUM | Step 2: research call for keyword data is mandatory for SEO section |
260
316
  | Files saved without user approval | MEDIUM | Step 7: present ALL assets to user, wait for approval before writing files |
317
+ | Counter-playbook without detection mechanism | HIGH | Every scenario needs a monitoring method — "watch for price drops" is useless without specifying WHERE to watch and HOW to automate |
318
+ | Counter-playbook with unrealistic response windows | MEDIUM | If response window is 24h but pre-built assets don't exist, the playbook will fail — either extend window or create assets NOW |
319
+ | Generating counter-playbook for blue ocean products | LOW | Skip Step 3.5 if no direct competitors — counter-strategies need someone to counter |
261
320
 
262
321
  ## Done When
263
322
 
264
323
  - scout completed and actual feature list extracted
265
324
  - Brand voice contract established (or existing one loaded)
266
325
  - Competitor/trend analysis done via trend-scout + research
326
+ - Competitive response playbook generated (if competitors exist) with pre-built asset checklist
267
327
  - Hero copy, value props, social posts, and SEO metadata generated (following brand voice)
268
328
  - SEO audit completed (if existing site) with pass/fail results
269
329
  - Visual assets requested from asset-creator
@@ -278,6 +338,7 @@ Known failure modes for this skill. Check these before declaring done.
278
338
  |----------|--------|----------|
279
339
  | Brand voice contract | Markdown | `marketing/brand-voice.md` |
280
340
  | Landing page copy | Markdown | `marketing/landing-copy.md` |
341
+ | Competitive response playbook | Markdown | `marketing/counter-playbook.md` |
281
342
  | Social media posts | Markdown | `marketing/social-posts.md` |
282
343
  | SEO metadata | JSON | `marketing/seo-meta.json` |
283
344
  | SEO audit report | Markdown | `marketing/seo-audit.md` |
@@ -55,25 +55,22 @@ Without this skill, each project is an island. With it, a caching pattern discov
55
55
 
56
56
  ## Calls (outbound)
57
57
 
58
- | Skill | When | Why |
59
- |-------|------|-----|
60
- | `session-bridge` | After Capture Mode | Sync key decisions back to `.rune/` files |
58
+ - `session-bridge` (L3): after Capture Mode — sync key decisions back to `.rune/` files
61
59
 
62
60
  ## Called By (inbound)
63
61
 
64
- | Skill | When | Why |
65
- |-------|------|-----|
66
- | `cook` | Phase 0 (resume) + Phase 8 (complete) | Recall project context at start, capture learnings at end |
67
- | `debug` | After root cause found | Capture error pattern for future recognition |
68
- | `fix` | After fix verified | Capture fix pattern (cause → solution) |
69
- | `review` | After review complete | Capture code quality insight |
70
- | `rescue` | Phase start + phase end | Recall past refactoring patterns, capture new ones |
71
- | `plan` | Before architecture decisions | Recall past decisions on similar problems |
72
- | `session-bridge` | Step 6 (cross-project extraction) | Extract generalizable patterns to nmem |
73
- | `journal` | After ADR written | Extract decision + rejected alternatives to nmem |
74
- | `context-engine` | Before compaction | Trigger Flush Mode to preserve context |
75
- | `sentinel` | After security finding | Capture vulnerability pattern |
76
- | `incident` | After resolution | Capture incident root cause + fix |
62
+ - `cook` (L1): Phase 0 (resume) + Phase 8 (complete) — recall context at start, capture learnings at end
63
+ - `rescue` (L1): phase start + phase end — recall past refactoring patterns, capture new ones
64
+ - `debug` (L2): after root cause found capture error pattern for future recognition
65
+ - `fix` (L2): after fix verified capture fix pattern (cause solution)
66
+ - `review` (L2): after review complete capture code quality insight
67
+ - `plan` (L2): before architecture decisions recall past decisions on similar problems
68
+ - `sentinel` (L2): after security finding capture vulnerability pattern
69
+ - `incident` (L2): after resolution capture incident root cause + fix
70
+ - `retro` (L2): during retrospective capture retro insights and patterns
71
+ - `session-bridge` (L3): Step 6 (cross-project extraction) extract generalizable patterns
72
+ - `journal` (L3): after ADR written extract decision + rejected alternatives
73
+ - `context-engine` (L3): before compaction trigger Flush Mode to preserve context
77
74
 
78
75
  ## Modes
79
76
 
@@ -8,7 +8,7 @@ metadata:
8
8
  model: sonnet
9
9
  group: quality
10
10
  tools: "Read, Write, Edit, Glob, Grep"
11
- emit: project.onboarded
11
+ emit: project.onboarded, invariants.seeded
12
12
  ---
13
13
 
14
14
  # onboard
@@ -39,7 +39,7 @@ Auto-generate project context for AI sessions. Scans the codebase and creates a
39
39
 
40
40
  ```
41
41
  project/
42
- ├── CLAUDE.md # Project config for AI sessions
42
+ ├── CLAUDE.md # Project config for AI sessions (with invariants pointer block)
43
43
  └── .rune/
44
44
  ├── conventions.md # Detected patterns & style
45
45
  ├── decisions.md # Empty, ready for session-bridge
@@ -47,6 +47,7 @@ project/
47
47
  ├── session-log.md # Empty, ready for session-bridge
48
48
  ├── instincts.md # Empty, ready for session-bridge instinct learning
49
49
  ├── contract.md # Project invariants enforced by cook/sentinel
50
+ ├── INVARIANTS.md # Danger zones + cross-file rules, consumed by logic-guardian
50
51
  └── DEVELOPER-GUIDE.md # Human-readable onboarding for new developers
51
52
  ```
52
53
 
@@ -114,6 +115,33 @@ Use `Write` to create each file:
114
115
  - Remove sections that don't apply (e.g., `contract.operations` for a library with no deployed service)
115
116
  - The contract is a starting point — tell the user to review and customize it
116
117
 
118
+ ### Step 5.4 — Detect Invariants (Auto-Discipline Seed)
119
+
120
+ Scan the project for rules that span files — the kind of mistake a linter cannot catch but a single agent edit can introduce. The goal is to seed `.rune/INVARIANTS.md` with ≥3 plausible rules so `logic-guardian` has something to enforce on day one.
121
+
122
+ Invoke the scanner directly:
123
+
124
+ ```bash
125
+ node skills/onboard/scripts/onboard-invariants.js --root <project-root>
126
+ ```
127
+
128
+ What it produces:
129
+ - `.rune/INVARIANTS.md` — rendered from `skills/onboard/references/invariants-template.md` plus auto-detected rules in four buckets:
130
+ - **Danger Zones** — directories with the most cross-file references
131
+ - **Critical Invariants** — shared constants exported and imported in ≥3 places
132
+ - **State Machine Rules** — reducer/switch shapes with state literal pairs
133
+ - **Cross-File Consistency** — literal tuples mirrored across ≥3 files
134
+ - `CLAUDE.md` — adds a pointer block between `<!-- @rune-invariants-pointer:start -->` and `<!-- @rune-invariants-pointer:end -->` listing top danger-zone globs so every session sees them.
135
+
136
+ Merge rules (safe re-runs):
137
+ - If `.rune/INVARIANTS.md` exists, user edits above `## Auto-detected (new)` are **never** overwritten.
138
+ - New detections replace **only** the content under `## Auto-detected (new)`.
139
+ - If a user sets `<!-- @rune-invariants-pointer:skip -->` anywhere in `CLAUDE.md`, the pointer block is not re-injected.
140
+
141
+ Emit signal `invariants.seeded` with `{danger_count, critical_count, state_count, cross_count}` when done. `session-bridge` listens in Phase 3 to surface the loudest rules at session start.
142
+
143
+ **Do not fabricate rules.** If detection yields zero results, write `_No new detections on this run._` under `## Auto-detected (new)` and move on. A quiet INVARIANTS.md is better than fake rules the user has to prune.
144
+
117
145
  ### Step 5.5 — Load Existing Instincts
118
146
 
119
147
  If `.rune/instincts.md` already exists and contains instinct entries, read it and include a summary in the Onboard Report under `### Learned Instincts`. This tells the agent what project-specific behaviors have been learned from previous sessions.
@@ -0,0 +1,76 @@
1
+ # Project Invariants
2
+
3
+ > Auto-seeded by `rune onboard`. Edit freely — your changes survive re-runs.
4
+ > Append-only: new auto-detections land under `## Auto-detected (new)` and never
5
+ > overwrite existing rules.
6
+
7
+ This file is the project's truth-source for rules that code changes must respect.
8
+ `logic-guardian` loads it as a pre-edit gate, and `session-bridge` surfaces the
9
+ most critical rules at session start so agents know the danger zones immediately.
10
+
11
+ ## How to read an entry
12
+
13
+ ```
14
+ ### <short rule title>
15
+ - **WHAT**: one-sentence statement of the rule (what must hold)
16
+ - **WHERE**: glob patterns for files this rule applies to
17
+ - **WHY**: why this rule exists — past incident, cross-file coupling,
18
+ compliance, external contract, etc.
19
+ ```
20
+
21
+ If an entry becomes stale, move it to `## Archived` with a one-line note.
22
+ Never delete — the archive is evidence of past decisions.
23
+
24
+ ---
25
+
26
+ ## Danger Zones
27
+
28
+ Paths that disproportionately affect the rest of the codebase. Test coverage,
29
+ review, and change-review should be stricter here.
30
+
31
+ <!-- auto-generated entries appear below -->
32
+
33
+ ---
34
+
35
+ ## Critical Invariants
36
+
37
+ Rules that cross file boundaries — shared constants, contract values, protocol
38
+ fields. Breaking any one silently breaks downstream code.
39
+
40
+ <!-- auto-generated entries appear below -->
41
+
42
+ ---
43
+
44
+ ## State Machine Rules
45
+
46
+ Legal transitions for state machines in the project. Illegal transitions are
47
+ often the root cause of hard-to-reproduce bugs.
48
+
49
+ <!-- auto-generated entries appear below -->
50
+
51
+ ---
52
+
53
+ ## Cross-File Consistency
54
+
55
+ Fields, enums, or schemas mirrored in multiple places. Updates must propagate
56
+ together or the project enters an inconsistent state.
57
+
58
+ <!-- auto-generated entries appear below -->
59
+
60
+ ---
61
+
62
+ ## Auto-detected (new)
63
+
64
+ New detections from the most recent `rune onboard` run. Review these, promote
65
+ the real ones into the sections above, and drop the noise.
66
+
67
+ <!-- placeholder — each run appends or replaces this block -->
68
+
69
+ ---
70
+
71
+ ## Archived
72
+
73
+ Rules that were once invariants but are no longer — kept here as history. Do
74
+ not delete; their absence later makes reasoning harder.
75
+
76
+ <!-- empty on first run -->