@rune-kit/rune 2.3.3 → 2.4.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 (53) hide show
  1. package/README.md +51 -1
  2. package/compiler/__tests__/scripts-bundling.test.js +284 -0
  3. package/compiler/__tests__/tier-override.test.js +41 -0
  4. package/compiler/adapters/antigravity.js +4 -0
  5. package/compiler/adapters/codex.js +4 -0
  6. package/compiler/adapters/cursor.js +4 -0
  7. package/compiler/adapters/generic.js +4 -0
  8. package/compiler/adapters/openclaw.js +4 -0
  9. package/compiler/adapters/opencode.js +4 -0
  10. package/compiler/adapters/windsurf.js +4 -0
  11. package/compiler/emitter.js +85 -5
  12. package/compiler/transforms/scripts-path.js +18 -0
  13. package/extensions/zalo/PACK.md +20 -1
  14. package/extensions/zalo/references/conversation-management.md +214 -0
  15. package/extensions/zalo/references/eval-scenarios.md +157 -0
  16. package/extensions/zalo/references/listen-mode.md +237 -0
  17. package/extensions/zalo/references/mcp-production.md +274 -0
  18. package/extensions/zalo/references/multi-account-proxy.md +224 -0
  19. package/extensions/zalo/references/vietqr-banking.md +160 -0
  20. package/package.json +2 -3
  21. package/skills/marketing/SKILL.md +3 -0
  22. package/skills/sentinel/SKILL.md +4 -1
  23. package/skills/sentinel/references/auth-crypto-reference.md +192 -0
  24. package/skills/sentinel/references/desktop-security.md +201 -0
  25. package/skills/sentinel/references/supply-chain.md +160 -0
  26. package/skills/slides/SKILL.md +142 -0
  27. package/skills/slides/scripts/build-deck.js +158 -0
  28. package/docs/ANTIGRAVITY-GAP-ANALYSIS.md +0 -369
  29. package/docs/ARCHITECTURE.md +0 -332
  30. package/docs/COMMUNITY-PACKS.md +0 -109
  31. package/docs/CONTRIBUTING-L4.md +0 -215
  32. package/docs/CROSS-IDE-ANALYSIS.md +0 -164
  33. package/docs/EXTENSION-TEMPLATE.md +0 -126
  34. package/docs/MESH-RULES.md +0 -34
  35. package/docs/MULTI-PLATFORM.md +0 -804
  36. package/docs/SKILL-DEPTH-AUDIT.md +0 -191
  37. package/docs/SKILL-TEMPLATE.md +0 -118
  38. package/docs/TRADE-MATRIX.md +0 -327
  39. package/docs/VERSIONING.md +0 -91
  40. package/docs/VISION.md +0 -263
  41. package/docs/assets/demo-subtitles.srt +0 -215
  42. package/docs/assets/end-card.html +0 -276
  43. package/docs/assets/mesh-diagram.html +0 -654
  44. package/docs/assets/thumbnail.html +0 -295
  45. package/docs/guides/cli.md +0 -403
  46. package/docs/guides/index.html +0 -1450
  47. package/docs/index.html +0 -1005
  48. package/docs/references/claudekit-analysis.md +0 -414
  49. package/docs/references/voltagent-analysis.md +0 -189
  50. package/docs/script.js +0 -495
  51. package/docs/skills/index.html +0 -832
  52. package/docs/style.css +0 -958
  53. package/docs/video-demo-plan.md +0 -172
@@ -1,804 +0,0 @@
1
- # Rune Multi-Platform Architecture
2
-
3
- > Version: 0.1.0 | Status: Design | Target: 2-week build
4
-
5
- ## 1. Principles
6
-
7
- 1. **ALL 49 skills on ALL platforms** — no Lite version, no tiering, no skipping infrastructure skills.
8
- 2. **Zero knowledge loss** — every workflow step, constraint, HARD-GATE, sharp edge ships everywhere.
9
- 3. **Single source of truth** — `skills/*.md` is canonical. Other platforms get compiled output.
10
- 4. **Platform affects delivery format, not content quality.**
11
- 5. **Adapter pattern** — adding a new platform = one new adapter file (~100 LOC).
12
-
13
- ## 2. Platform Target Matrix
14
-
15
- | Platform | Output Dir | File Format | Cross-Ref Mechanism | Subagent Support | Hook Support |
16
- |----------|-----------|-------------|---------------------|-----------------|--------------|
17
- | Claude Code | passthrough (no compile) | SKILL.md | `Skill("rune:<name>")` | `context: fork`, `agent:` | hooks.json (JS) |
18
- | Cursor | `.cursor/rules/` | `rune-<name>.mdc` | `@file:rune-<name>.mdc` | None | None (inline MUST) |
19
- | Windsurf | `.windsurf/rules/` | `rune-<name>.md` | Prose: "Follow rune-<name> rule" | None | None (inline MUST) |
20
- | Antigravity | `.agent/rules/` | `rune-<name>.md` | File reference | None | None (inline MUST) |
21
- | Generic | `.ai/rules/` | `rune-<name>.md` | Prose reference | None | None (inline MUST) |
22
-
23
- ## 3. Compiler Architecture
24
-
25
- ### 3.1 Three-Stage Pipeline
26
-
27
- ```
28
- skills/*.md ──► PARSE ──► TRANSFORM ──► EMIT ──► .cursor/rules/*.mdc
29
- extensions/*.md │ .windsurf/rules/*.md
30
- │ .agent/rules/*.md
31
- (middleware chain)
32
- ```
33
-
34
- **Parse**: Extract frontmatter (YAML), body (markdown), and cross-references from SKILL.md files.
35
- **Transform**: Apply platform-agnostic middleware functions (reference rewriting, tool name mapping, directive removal).
36
- **Emit**: Write platform-specific output files with correct structure, naming, and wrapping.
37
-
38
- ### 3.2 Parser Output (Intermediate Representation)
39
-
40
- ```typescript
41
- interface ParsedSkill {
42
- name: string; // from frontmatter
43
- description: string; // from frontmatter
44
- layer: "L0" | "L1" | "L2" | "L3";
45
- model: "haiku" | "sonnet" | "opus";
46
- group: string;
47
- contextFork: boolean; // context: fork present?
48
- agentType: string | null; // agent: general-purpose, etc.
49
- body: string; // full markdown body
50
- crossRefs: CrossRef[]; // extracted rune:<name> references
51
- toolRefs: ToolRef[]; // extracted tool name references
52
- hardGates: string[]; // <HARD-GATE> blocks
53
- sections: Map<string, string>; // ## Section Name -> content
54
- }
55
-
56
- interface CrossRef {
57
- raw: string; // "rune:scout", "rune:cook"
58
- skillName: string; // "scout", "cook"
59
- line: number; // line number in source
60
- context: string; // surrounding text for rewrite
61
- }
62
-
63
- interface ToolRef {
64
- raw: string; // "Read", "Write", "Edit", "Glob", "Grep", "Bash", "TodoWrite"
65
- line: number;
66
- context: string;
67
- }
68
- ```
69
-
70
- ### 3.3 Transform Pipeline
71
-
72
- Transforms are composable middleware functions. Order matters.
73
-
74
- ```
75
- 1. stripFrontmatterDirectives — remove context:fork, agent:, or rewrite for platform
76
- 2. rewriteCrossReferences — rune:cook → platform-native reference
77
- 3. rewriteToolNames — `Read` → platform equivalent or generic term
78
- 4. rewriteModelHints — model: opus → remove or convert to comment
79
- 5. inlineHookConstraints — hook behaviors → embedded MUST/NEVER rules
80
- 6. rewriteSubagentDelegation — "Launch 3 parallel agents" → sequential workflow
81
- 7. addPlatformPreamble — platform-specific header/metadata
82
- 8. addBranding — Rune attribution + Claude Code CTA
83
- ```
84
-
85
- Each transform is a pure function: `(skill: ParsedSkill, config: PlatformConfig) => ParsedSkill`.
86
-
87
- ### 3.4 Emitter
88
-
89
- Each platform adapter provides an emitter that:
90
- 1. Determines output file path and name
91
- 2. Wraps content in platform-specific format (e.g., Cursor .mdc frontmatter)
92
- 3. Writes the file
93
-
94
- ## 4. Platform Adapter Interface
95
-
96
- ```typescript
97
- interface PlatformAdapter {
98
- /** Platform identifier */
99
- name: string;
100
-
101
- /** Where compiled rules go, relative to project root */
102
- outputDir: string;
103
-
104
- /** File extension for rule files */
105
- fileExtension: string;
106
-
107
- /**
108
- * Transform a cross-reference like "rune:cook" into platform-native format.
109
- * @param skillName - e.g., "cook"
110
- * @param context - surrounding sentence for contextual rewrite
111
- * @returns replacement string
112
- */
113
- transformReference(skillName: string, context: string): string;
114
-
115
- /**
116
- * Transform Claude Code tool names to platform equivalents.
117
- * @param toolName - e.g., "Read", "Edit", "Bash"
118
- * @returns platform-appropriate term
119
- */
120
- transformToolName(toolName: string): string;
121
-
122
- /**
123
- * Generate platform-specific file header/frontmatter.
124
- * @param skill - parsed skill data
125
- * @returns string to prepend to file
126
- */
127
- generateHeader(skill: ParsedSkill): string;
128
-
129
- /**
130
- * Generate platform-specific file footer (branding, CTA).
131
- * @returns string to append to file
132
- */
133
- generateFooter(): string;
134
-
135
- /**
136
- * Transform subagent/parallel execution instructions.
137
- * @param instruction - original parallel execution text
138
- * @returns sequential workflow text, or platform equivalent
139
- */
140
- transformSubagentInstruction(instruction: string): string;
141
-
142
- /**
143
- * Platform-specific post-processing on final output.
144
- * @param content - fully transformed markdown
145
- * @returns final output string
146
- */
147
- postProcess(content: string): string;
148
- }
149
- ```
150
-
151
- ### 4.1 Adapter: Claude Code (Passthrough)
152
-
153
- ```javascript
154
- // adapters/claude.js
155
- module.exports = {
156
- name: "claude",
157
- outputDir: null, // no compilation — source IS the output
158
- fileExtension: ".md",
159
- transformReference: (name, ctx) => ctx, // no change
160
- transformToolName: (name) => name, // no change
161
- generateHeader: () => "",
162
- generateFooter: () => "",
163
- transformSubagentInstruction: (inst) => inst,
164
- postProcess: (content) => content,
165
- };
166
- ```
167
-
168
- ### 4.2 Adapter: Cursor
169
-
170
- ```javascript
171
- // adapters/cursor.js
172
- module.exports = {
173
- name: "cursor",
174
- outputDir: ".cursor/rules",
175
- fileExtension: ".mdc",
176
-
177
- transformReference(skillName, context) {
178
- // rune:cook → @rune-cook.mdc (Cursor file reference)
179
- return context
180
- .replace(/`rune:${skillName}`/g, `\`@rune-${skillName}.mdc\``)
181
- .replace(/rune:${skillName}/g, `@rune-${skillName}.mdc`);
182
- },
183
-
184
- transformToolName(toolName) {
185
- // Cursor uses same tool names but without the Skill() invocation system
186
- const map = {
187
- "Read": "read the file",
188
- "Write": "write the file",
189
- "Edit": "edit the file",
190
- "Glob": "search for files by pattern",
191
- "Grep": "search file contents",
192
- "Bash": "run a terminal command",
193
- "TodoWrite": "track progress with todos",
194
- };
195
- return map[toolName] || toolName;
196
- },
197
-
198
- generateHeader(skill) {
199
- // Cursor .mdc frontmatter format
200
- return [
201
- "---",
202
- `description: "${skill.description}"`,
203
- `globs: []`,
204
- `alwaysApply: ${skill.layer === "L0"}`,
205
- "---",
206
- "",
207
- ].join("\n");
208
- },
209
-
210
- generateFooter() {
211
- return [
212
- "",
213
- "---",
214
- "> Rune Skill Mesh — https://github.com/rune-kit/rune",
215
- "> Full experience with subagents, hooks, and adaptive routing: use Rune on Claude Code.",
216
- ].join("\n");
217
- },
218
-
219
- transformSubagentInstruction(instruction) {
220
- return instruction
221
- .replace(/Launch \d+ (parallel )?agents?/gi, "Execute the following steps sequentially")
222
- .replace(/as independent Task agents/gi, "one at a time")
223
- .replace(/PARALLEL EXECUTION:/gi, "SEQUENTIAL EXECUTION:");
224
- },
225
-
226
- postProcess(content) {
227
- // Remove context: fork and agent: lines from any remaining references
228
- return content
229
- .replace(/^context: fork\n/gm, "")
230
- .replace(/^agent: general-purpose\n/gm, "");
231
- },
232
- };
233
- ```
234
-
235
- ### 4.3 Adapter: Windsurf
236
-
237
- ```javascript
238
- // adapters/windsurf.js
239
- module.exports = {
240
- name: "windsurf",
241
- outputDir: ".windsurf/rules",
242
- fileExtension: ".md",
243
-
244
- transformReference(skillName, context) {
245
- // Prose reference: "Follow the rune-<name> rule"
246
- return context
247
- .replace(/`rune:${skillName}`/g, `the \`rune-${skillName}\` rule file`)
248
- .replace(/rune:${skillName}/g, `the rune-${skillName} rule file`);
249
- },
250
-
251
- transformToolName(toolName) {
252
- // Windsurf uses generic terms
253
- const map = {
254
- "Read": "read the file",
255
- "Write": "write/create the file",
256
- "Edit": "edit the file",
257
- "Glob": "find files matching a pattern",
258
- "Grep": "search for text in files",
259
- "Bash": "run a shell command",
260
- "TodoWrite": "track task progress",
261
- };
262
- return map[toolName] || toolName;
263
- },
264
-
265
- generateHeader(skill) {
266
- return `# rune-${skill.name}\n\n> Layer: ${skill.layer} | Group: ${skill.group}\n\n`;
267
- },
268
-
269
- generateFooter() {
270
- return [
271
- "",
272
- "---",
273
- "> Rune Skill Mesh — https://github.com/rune-kit/rune",
274
- "> Full experience with subagents, hooks, and adaptive routing: use Rune on Claude Code.",
275
- ].join("\n");
276
- },
277
-
278
- transformSubagentInstruction(instruction) {
279
- return instruction
280
- .replace(/Launch \d+ (parallel )?agents?/gi, "Execute the following steps in order")
281
- .replace(/as independent Task agents/gi, "sequentially")
282
- .replace(/PARALLEL EXECUTION:/gi, "SEQUENTIAL EXECUTION:");
283
- },
284
-
285
- postProcess(content) {
286
- return content
287
- .replace(/^context: fork\n/gm, "")
288
- .replace(/^agent: general-purpose\n/gm, "");
289
- },
290
- };
291
- ```
292
-
293
- ### 4.4 Adapter: Google Antigravity
294
-
295
- ```javascript
296
- // adapters/antigravity.js
297
- module.exports = {
298
- name: "antigravity",
299
- outputDir: ".agent/rules",
300
- fileExtension: ".md",
301
- // Same patterns as windsurf — Antigravity uses markdown rules in .agent/
302
- // Inherits windsurf patterns with different outputDir
303
- // ... (identical transform logic, different header)
304
-
305
- generateHeader(skill) {
306
- return `# rune-${skill.name}\n\n> Rune ${skill.layer} Skill | ${skill.group}\n\n`;
307
- },
308
- };
309
- ```
310
-
311
- ### 4.5 Adding a New Platform
312
-
313
- Create one file: `compiler/adapters/<platform>.js` implementing the `PlatformAdapter` interface. Register it in `compiler/adapters/index.js`. Done. No other changes needed.
314
-
315
- ## 5. Cross-Reference Resolution
316
-
317
- The mesh is Rune's core value. Here is how it works per platform:
318
-
319
- ### 5.1 Reference Patterns in Source
320
-
321
- ```
322
- Pattern 1: `rune:cook` — backtick-wrapped reference
323
- Pattern 2: rune:cook — bare reference
324
- Pattern 3: Use `rune:scout` — instruction to invoke
325
- Pattern 4: REQUIRED SUB-SKILL: Use `rune:X` — hard requirement
326
- Pattern 5: invoke `rune:debug` — conditional invocation
327
- Pattern 6: → invoke `rune:plan` — flow arrow reference
328
- ```
329
-
330
- ### 5.2 Resolution Strategy
331
-
332
- The parser uses a regex to find all `rune:<name>` patterns and records them as `CrossRef` entries. The transformer then rewrites each based on the platform adapter.
333
-
334
- ```javascript
335
- // Cross-reference regex (handles both backtick-wrapped and bare)
336
- const CROSS_REF_PATTERN = /`?rune:([a-z][\w-]*)`?/g;
337
- ```
338
-
339
- ### 5.3 Platform-Specific Output
340
-
341
- | Source | Claude Code | Cursor | Windsurf / Antigravity |
342
- |--------|------------|--------|------------------------|
343
- | `Use rune:scout` | `Use rune:scout` (unchanged) | `Use @rune-scout.mdc` | `Follow the rune-scout rule file` |
344
- | `REQUIRED SUB-SKILL: Use rune:plan` | unchanged | `REQUIRED: Follow @rune-plan.mdc` | `REQUIRED: Follow the rune-plan rule file` |
345
- | `invoke rune:debug` | unchanged | `follow @rune-debug.mdc` | `follow the rune-debug rule file` |
346
-
347
- ### 5.4 Mesh Integrity Check
348
-
349
- After compilation, the `rune doctor` command verifies:
350
- - Every cross-reference target exists as an output file on the target platform
351
- - No dangling references (skill A references skill B, but B was disabled in config)
352
- - Layer discipline preserved (L3 does not reference L1 in compiled output)
353
-
354
- ## 6. Tool Name Transformation
355
-
356
- ### 6.1 Transformation Map
357
-
358
- Tool names appear in backticks in SKILL.md files. The transformer rewrites them contextually:
359
-
360
- ```javascript
361
- const TOOL_PATTERNS = {
362
- // Pattern: `ToolName` in instruction context
363
- // Match: Use `Read` to examine | Use `Bash` to run
364
- regex: /Use `(Read|Write|Edit|Glob|Grep|Bash|TodoWrite)`/g,
365
-
366
- // Also match standalone references
367
- standalone: /`(Read|Write|Edit|Glob|Grep|Bash|TodoWrite)`/g,
368
- };
369
- ```
370
-
371
- ### 6.2 Contextual Rewriting (Not Blind Replace)
372
-
373
- The transformer preserves the instruction intent:
374
-
375
- | Source | Cursor / Windsurf Output |
376
- |--------|--------------------------|
377
- | `Use Read to examine key files` | `Read the key files to examine them` |
378
- | `Use Bash to run tests` | `Run tests in the terminal` |
379
- | `Use Glob to find files matching` | `Find files matching the pattern` |
380
- | `Use Grep to search for patterns` | `Search file contents for patterns` |
381
- | `Use Write to create test files` | `Create the test files` |
382
- | `Use Edit for modifying existing files` | `Modify the existing files` |
383
- | `TodoWrite: [...]` | `Track progress: [...]` |
384
-
385
- The key insight: other platforms have the same capabilities (read, write, search, run commands) but without named tool APIs. The instructions become natural language that any AI agent can follow.
386
-
387
- ## 7. Hook Constraint Inlining
388
-
389
- Claude Code hooks (hooks.json) enforce behaviors programmatically. Other platforms get these as inline rules.
390
-
391
- ### 7.1 Hook-to-Instruction Mapping
392
-
393
- | Hook | Type | Inlined Instruction |
394
- |------|------|---------------------|
395
- | `secrets-scan` | PreToolUse(Bash) | `MUST NOT: Never run commands containing hardcoded secrets, API keys, or tokens. Scan all shell commands for secret patterns before execution.` |
396
- | `auto-format` | PostToolUse(Edit) | `MUST: After editing JS/TS files, ensure code follows project formatting conventions (Prettier/ESLint).` |
397
- | `typecheck` | PostToolUse(Edit) | `MUST: After editing .ts/.tsx files, verify TypeScript compilation succeeds (no type errors).` |
398
- | `context-watch` | PreToolUse(Edit) | `SHOULD: Monitor your context usage. If working on a long task, summarize progress before context fills up.` |
399
- | `pre-tool-guard` | PreToolUse(Read) | (no equivalent needed — platform handles file access) |
400
- | `metrics-collector` | PostToolUse(Skill) | (no equivalent — metrics are Claude Code plugin feature) |
401
- | `session-start` | SessionStart | (no equivalent — platform handles session init) |
402
- | `pre-compact` | PreCompact | `MUST: Before summarizing/compacting context, save important decisions and progress to project files.` |
403
- | `post-session-reflect` | Stop | `SHOULD: Before ending, save architectural decisions and progress to .rune/ directory for future sessions.` |
404
-
405
- ### 7.2 Injection Strategy
406
-
407
- Hook instructions are injected as a `## Platform Constraints` section at the top of EVERY compiled skill file (after the header, before the first skill section). This ensures the AI agent sees them regardless of which skill it reads.
408
-
409
- Only relevant hooks are injected per skill — a skill that never uses `Edit` does not get the auto-format instruction.
410
-
411
- ## 8. CLI Commands
412
-
413
- ### 8.1 `rune init`
414
-
415
- Interactive setup for a new project.
416
-
417
- ```
418
- $ npx rune init
419
-
420
- ? Select your AI platform:
421
- ❯ Claude Code (native plugin — no compilation needed)
422
- Cursor
423
- Windsurf
424
- Google Antigravity
425
- Other / Generic
426
-
427
- ? Select extension packs to enable:
428
- ◉ @rune/ui
429
- ◉ @rune/backend
430
- ◯ @rune/devops
431
- ◯ @rune/mobile
432
- ◯ @rune/security
433
- ◉ @rune/trading
434
- ...
435
-
436
- ? Disable any core skills? (advanced)
437
- All 49 skills enabled by default. Enter skill names to disable, or press Enter to keep all.
438
-
439
- ✓ Created rune.config.json
440
- ✓ Run `npx rune build` to compile rules for Cursor
441
- ```
442
-
443
- For Claude Code: `rune init` detects the platform and outputs "No compilation needed — Rune is already active via the plugin system."
444
-
445
- ### 8.2 `rune build`
446
-
447
- Compile skills for the configured platform.
448
-
449
- ```
450
- $ npx rune build
451
-
452
- [parse] 49 skills parsed (0 errors)
453
- [parse] 12 extension packs parsed
454
- [transform] Platform: cursor
455
- [transform] Rewriting 187 cross-references
456
- [transform] Rewriting 95 tool name references
457
- [transform] Inlining 5 hook constraints
458
- [transform] Converting 12 subagent instructions to sequential
459
- [emit] Writing 49 skill files to .cursor/rules/
460
- [emit] Writing 12 extension files to .cursor/rules/
461
- [emit] Writing 1 index file (rune-index.mdc)
462
- [verify] All cross-references resolve ✓
463
- [verify] No dangling references ✓
464
-
465
- ✓ Built 62 rule files in .cursor/rules/ (312ms)
466
- ```
467
-
468
- **Flags:**
469
- - `--platform <name>` — override platform from config
470
- - `--skills <list>` — build only specific skills
471
- - `--dry-run` — show what would be written without writing
472
- - `--verbose` — show per-file transform details
473
-
474
- ### 8.3 `rune sync`
475
-
476
- Watch source skills and rebuild on change. For development/contribution.
477
-
478
- ```
479
- $ npx rune sync
480
-
481
- [watch] Watching skills/ and extensions/ for changes...
482
- [sync] skills/cook/SKILL.md changed → rebuilding rune-cook.mdc
483
- [sync] Built 1 file (45ms)
484
- ```
485
-
486
- ### 8.4 `rune doctor`
487
-
488
- Validate the compiled output.
489
-
490
- ```
491
- $ npx rune doctor
492
-
493
- [check] Platform: cursor
494
- [check] Config: rune.config.json ✓
495
- [check] Output dir: .cursor/rules/ ✓
496
- [check] Skill files: 49/49 present ✓
497
- [check] Extension files: 12/12 present ✓
498
- [check] Cross-references: 187/187 resolve ✓
499
- [check] Layer discipline: no violations ✓
500
- [check] Source freshness: all output files match source ✓
501
- [warn] 2 skills disabled in config: browser-pilot, video-creator
502
-
503
- ✓ Rune installation healthy
504
- ```
505
-
506
- ## 9. Repository Structure
507
-
508
- New directories added to the Rune repo:
509
-
510
- ```
511
- rune/
512
- ├── compiler/ # NEW — multi-platform compiler
513
- │ ├── cli.js # CLI entry point (rune init/build/sync/doctor)
514
- │ ├── parser.js # SKILL.md → ParsedSkill IR
515
- │ ├── transformer.js # Platform-agnostic transform pipeline
516
- │ ├── emitter.js # IR → platform-specific output files
517
- │ ├── watcher.js # File watcher for rune sync
518
- │ ├── doctor.js # Validation logic for rune doctor
519
- │ ├── adapters/ # Platform adapters
520
- │ │ ├── index.js # Adapter registry
521
- │ │ ├── claude.js # Passthrough (no-op)
522
- │ │ ├── cursor.js # .cursor/rules/*.mdc
523
- │ │ ├── windsurf.js # .windsurf/rules/*.md
524
- │ │ ├── antigravity.js # .agent/rules/*.md
525
- │ │ └── generic.js # .ai/rules/*.md (fallback)
526
- │ └── transforms/ # Individual transform functions
527
- │ ├── cross-references.js # rune:<name> rewriting
528
- │ ├── tool-names.js # Read/Write/Edit/etc. rewriting
529
- │ ├── frontmatter.js # context:fork, agent:, model: handling
530
- │ ├── subagents.js # Parallel → sequential conversion
531
- │ ├── hooks.js # Hook behavior inlining
532
- │ └── branding.js # Footer CTA injection
533
- ├── package.json # NEW — add bin: { "rune": "compiler/cli.js" }
534
- ├── skills/ # UNCHANGED — canonical source
535
- ├── extensions/ # UNCHANGED — canonical source
536
- ├── hooks/ # UNCHANGED — Claude Code only
537
- ├── scripts/ # UNCHANGED — existing validation
538
- └── docs/
539
- └── MULTI-PLATFORM.md # THIS FILE
540
- ```
541
-
542
- **Total new code: ~1200 LOC JavaScript** (parser ~200, transforms ~400, adapters ~300, CLI ~200, doctor ~100).
543
-
544
- ## 10. rune.config.json Schema
545
-
546
- ```jsonc
547
- {
548
- // Schema version
549
- "$schema": "https://rune-kit.github.io/rune/config-schema.json",
550
- "version": 1,
551
-
552
- // Target platform — determines which adapter is used
553
- "platform": "cursor", // "claude" | "cursor" | "windsurf" | "antigravity" | "generic"
554
-
555
- // Rune source location (default: node_modules/rune or global install)
556
- "source": "node_modules/@rune-kit/rune",
557
-
558
- // Core skills configuration
559
- "skills": {
560
- // All 49 enabled by default. Disable individual skills here.
561
- "disabled": [],
562
-
563
- // Per-skill overrides (rare — for advanced users)
564
- "overrides": {
565
- // Example: force a skill to always be included even in minimal builds
566
- // "cook": { "alwaysApply": true }
567
- }
568
- },
569
-
570
- // Extension packs configuration
571
- "extensions": {
572
- // Which L4 packs are active for this project
573
- "enabled": [
574
- "@rune/ui",
575
- "@rune/backend",
576
- "@rune/trading"
577
- ]
578
- // Packs not listed here are not compiled into output
579
- },
580
-
581
- // Output configuration
582
- "output": {
583
- // Override output directory (default: platform-specific)
584
- "dir": null,
585
-
586
- // Generate an index file listing all skills
587
- "index": true,
588
-
589
- // Include cost profile section in output (some teams strip this)
590
- "includeCostProfile": true
591
- }
592
- }
593
- ```
594
-
595
- **Validation rules:**
596
- - `platform` is required, must be one of the known adapters or "generic"
597
- - `skills.disabled` entries must match actual skill names
598
- - `extensions.enabled` entries must match actual pack names
599
- - If `platform` is "claude", build is a no-op (log message, exit 0)
600
-
601
- ## 11. CI Pipeline
602
-
603
- ### 11.1 GitHub Actions: Build All Platforms
604
-
605
- ```yaml
606
- # .github/workflows/build-platforms.yml
607
- name: Build All Platforms
608
-
609
- on:
610
- push:
611
- paths:
612
- - 'skills/**'
613
- - 'extensions/**'
614
- - 'compiler/**'
615
- pull_request:
616
- paths:
617
- - 'skills/**'
618
- - 'extensions/**'
619
- - 'compiler/**'
620
-
621
- jobs:
622
- validate-source:
623
- runs-on: ubuntu-latest
624
- steps:
625
- - uses: actions/checkout@v4
626
- - uses: actions/setup-node@v4
627
- with:
628
- node-version: 20
629
- - run: node scripts/validate-skills.js
630
- - run: node scripts/validate-mesh.js
631
- - run: node scripts/validate-pack.js
632
-
633
- build-platforms:
634
- needs: validate-source
635
- runs-on: ubuntu-latest
636
- strategy:
637
- matrix:
638
- platform: [cursor, windsurf, antigravity, generic]
639
- steps:
640
- - uses: actions/checkout@v4
641
- - uses: actions/setup-node@v4
642
- with:
643
- node-version: 20
644
- - run: node compiler/cli.js build --platform ${{ matrix.platform }} --output dist/${{ matrix.platform }}
645
- - run: node compiler/cli.js doctor --platform ${{ matrix.platform }} --output dist/${{ matrix.platform }}
646
- - uses: actions/upload-artifact@v4
647
- with:
648
- name: rune-${{ matrix.platform }}
649
- path: dist/${{ matrix.platform }}/
650
-
651
- test-compiler:
652
- runs-on: ubuntu-latest
653
- steps:
654
- - uses: actions/checkout@v4
655
- - uses: actions/setup-node@v4
656
- with:
657
- node-version: 20
658
- - run: npm test
659
- ```
660
-
661
- ### 11.2 Release Flow
662
-
663
- On git tag `v*`:
664
- 1. Build all platforms
665
- 2. Create GitHub release with platform-specific archives
666
- 3. Users download their platform's archive or use `npx @rune-kit/rune init`
667
-
668
- ## 12. Branding and CTA
669
-
670
- Every compiled skill file includes a footer that:
671
- 1. Attributes Rune as the source
672
- 2. Points to the full Claude Code experience (without being obnoxious)
673
-
674
- ### 12.1 Footer Template
675
-
676
- ```markdown
677
- ---
678
- > **Rune Skill Mesh** — 49 skills, 170+ connections
679
- > Source: https://github.com/rune-kit/rune
680
- > For the full experience with subagents, hooks, adaptive routing, and mesh analytics — use Rune as a Claude Code plugin.
681
- ```
682
-
683
- ### 12.2 Rules
684
-
685
- - Footer is appended to EVERY compiled file (not just some)
686
- - Footer is a markdown blockquote (visually distinct, not mixed with instructions)
687
- - No "Lite" branding anywhere — the skills ARE Rune, not a reduced version
688
- - The CTA mentions specific features that only Claude Code provides (subagents, hooks, adaptive routing)
689
- - No pricing or upsell language — Rune is free everywhere
690
-
691
- ## 13. Personalization Flow
692
-
693
- ### 13.1 `rune init` User Experience
694
-
695
- ```
696
- $ npx @rune-kit/rune init
697
-
698
- ╭──────────────────────────────────────╮
699
- │ Rune — Less skills. Deeper connections. │
700
- ╰──────────────────────────────────────╯
701
-
702
- Detected: .cursor/ directory → Cursor
703
-
704
- ? Confirm platform: Cursor
705
- ? Your project type: (select all that apply)
706
- ◉ Web Frontend (React, Vue, Svelte)
707
- ◉ Backend API (Express, FastAPI, etc.)
708
- ◯ Mobile (React Native, Flutter)
709
- ◯ DevOps (Docker, CI/CD)
710
- ◯ Trading / Finance
711
- ◯ AI / ML
712
- ◯ Game Development
713
- ◯ E-commerce
714
- ◯ SaaS Platform
715
- ◯ Content / Blog
716
-
717
- → Enabling: @rune/ui, @rune/backend (2 packs)
718
- → All 49 core skills enabled
719
-
720
- ✓ Created rune.config.json
721
- ✓ Built 61 rule files in .cursor/rules/
722
- ✓ Added .cursor/rules/ to .gitignore (compiled output)
723
-
724
- Next: Start coding. Rune skills are active in your AI assistant.
725
- ```
726
-
727
- ### 13.2 Platform Auto-Detection
728
-
729
- ```javascript
730
- function detectPlatform(projectRoot) {
731
- if (fs.existsSync(path.join(projectRoot, '.claude-plugin'))) return 'claude';
732
- if (fs.existsSync(path.join(projectRoot, '.cursor'))) return 'cursor';
733
- if (fs.existsSync(path.join(projectRoot, '.windsurf'))) return 'windsurf';
734
- if (fs.existsSync(path.join(projectRoot, '.agent'))) return 'antigravity';
735
- return 'generic';
736
- }
737
- ```
738
-
739
- ### 13.3 Skill Enable/Disable
740
-
741
- Users can disable skills they do not need:
742
-
743
- ```json
744
- {
745
- "skills": {
746
- "disabled": ["browser-pilot", "video-creator", "asset-creator"]
747
- }
748
- }
749
- ```
750
-
751
- When a skill is disabled:
752
- - Its file is NOT emitted
753
- - Cross-references TO it from other skills get a note: `(skill disabled in rune.config.json)`
754
- - Cross-references FROM it are irrelevant (file does not exist)
755
- - `rune doctor` warns about disabled skills that are referenced by enabled skills
756
-
757
- ## 14. Implementation Plan
758
-
759
- ### Week 1: Core Compiler
760
-
761
- | Day | Task | LOC |
762
- |-----|------|-----|
763
- | 1 | Parser: SKILL.md frontmatter + body + cross-ref extraction | 200 |
764
- | 2 | Transforms: cross-references, tool names, frontmatter stripping | 200 |
765
- | 3 | Transforms: subagent rewrite, hook inlining, branding | 200 |
766
- | 4 | Adapters: cursor, windsurf, antigravity, generic | 300 |
767
- | 5 | Emitter + CLI (build command) | 200 |
768
-
769
- ### Week 2: CLI + Polish
770
-
771
- | Day | Task | LOC |
772
- |-----|------|-----|
773
- | 6 | CLI: init command with prompts + platform detection | 150 |
774
- | 7 | CLI: doctor command + sync (file watcher) | 150 |
775
- | 8 | Tests: parser, each transform, each adapter | 300 |
776
- | 9 | CI pipeline + rune.config.json schema validation | 100 |
777
- | 10 | Docs, README updates, manual testing on Cursor + Windsurf | — |
778
-
779
- **Total: ~1800 LOC** (1200 compiler + 300 tests + 300 CLI/config).
780
-
781
- ## 15. What This Design Explicitly Does NOT Do
782
-
783
- 1. **No runtime on other platforms** — compiled output is static markdown. No hooks, no metrics, no adaptive routing. These are Claude Code exclusives.
784
- 2. **No skill content reduction** — every HARD-GATE, Sharp Edge, Mesh Gate, constraint ships verbatim.
785
- 3. **No multi-platform hooks system** — hooks become inline instructions. Building a hook runtime for Cursor/Windsurf is out of scope and unnecessary.
786
- 4. **No platform-specific skill variants** — one source, compiled output. No `cook-cursor.md` vs `cook-windsurf.md` maintained separately.
787
- 5. **No skill execution engine** — the AI agent reads the rules and follows them. Rune does not execute skills; it provides the instructions.
788
-
789
- ## 16. Migration Path
790
-
791
- For existing Claude Code users: nothing changes. `rune init` detects Claude Code and exits cleanly.
792
-
793
- For new platform users:
794
- 1. `npx @rune-kit/rune init` in their project
795
- 2. Select platform + packs
796
- 3. `rune build`
797
- 4. Commit the compiled rules directory
798
- 5. Start working — AI assistant picks up Rune rules automatically
799
-
800
- For platform switchers (e.g., Cursor to Windsurf):
801
- 1. Edit `rune.config.json` → change platform
802
- 2. `rune build`
803
- 3. Delete old platform's rules directory
804
- 4. Done