mudra-skills 1.0.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 (149) hide show
  1. package/.claude-plugin/plugin.json +19 -0
  2. package/CLAUDE.md +35 -0
  3. package/bin/install.js +25 -0
  4. package/package.json +28 -0
  5. package/skills/mudra-master/SKILL.md +202 -0
  6. package/skills/mudra-master/mudra-preview/SKILL.md +151 -0
  7. package/skills/mudra-master/mudra-preview/assets/ar-menu.html +382 -0
  8. package/skills/mudra-master/mudra-preview/assets/document-scroller.html +468 -0
  9. package/skills/mudra-master/mudra-preview/assets/drum-machine.html +788 -0
  10. package/skills/mudra-master/mudra-preview/assets/emg-visualizer.html +390 -0
  11. package/skills/mudra-master/mudra-preview/assets/generative-art.html +408 -0
  12. package/skills/mudra-master/mudra-preview/assets/gesture-assistant.html +342 -0
  13. package/skills/mudra-master/mudra-preview/assets/gesture-speech.html +444 -0
  14. package/skills/mudra-master/mudra-preview/assets/hands-free-desktop.html +376 -0
  15. package/skills/mudra-master/mudra-preview/assets/model-rotator.html +365 -0
  16. package/skills/mudra-master/mudra-preview/assets/mudra-duel.html +3200 -0
  17. package/skills/mudra-master/mudra-preview/assets/mudra-monitor.html +1451 -0
  18. package/skills/mudra-master/mudra-preview/assets/mudra-ultimate-template.html +891 -0
  19. package/skills/mudra-master/mudra-preview/assets/music-sequencer.html +455 -0
  20. package/skills/mudra-master/mudra-preview/assets/neural-pong.html +380 -0
  21. package/skills/mudra-master/mudra-preview/assets/neural-snake.html +364 -0
  22. package/skills/mudra-master/mudra-preview/assets/presentation-controller.html +345 -0
  23. package/skills/mudra-master/mudra-preview/assets/pressure-painter.html +285 -0
  24. package/skills/mudra-master/mudra-preview/assets/runner.html +1812 -0
  25. package/skills/mudra-master/mudra-preview/assets/smart-home.html +461 -0
  26. package/skills/mudra-master/mudra-preview/assets/space-invaders.html +1154 -0
  27. package/skills/mudra-master/mudra-preview/assets/waterful-ring-toss.html +1624 -0
  28. package/skills/mudra-master/mudra-preview/references/agent_protocol.json +646 -0
  29. package/skills/mudra-master/mudra-preview/references/promt.md +16829 -0
  30. package/skills/mudra-master/mudra-xr/SKILL.md +245 -0
  31. package/skills/mudra-master/mudra-xr/assets/demos/3dgs-walkthrough.html +242 -0
  32. package/skills/mudra-master/mudra-xr/assets/demos/aisimulator.html +792 -0
  33. package/skills/mudra-master/mudra-xr/assets/demos/balloonpop.html +422 -0
  34. package/skills/mudra-master/mudra-xr/assets/demos/ballpit.html +284 -0
  35. package/skills/mudra-master/mudra-xr/assets/demos/drone.html +41 -0
  36. package/skills/mudra-master/mudra-xr/assets/demos/gemini-icebreakers.html +338 -0
  37. package/skills/mudra-master/mudra-xr/assets/demos/gemini-xrobject.html +302 -0
  38. package/skills/mudra-master/mudra-xr/assets/demos/math3d.html +188 -0
  39. package/skills/mudra-master/mudra-xr/assets/demos/measure.html +247 -0
  40. package/skills/mudra-master/mudra-xr/assets/demos/occlusion.html +251 -0
  41. package/skills/mudra-master/mudra-xr/assets/demos/rain.html +498 -0
  42. package/skills/mudra-master/mudra-xr/assets/demos/screenwiper.html +432 -0
  43. package/skills/mudra-master/mudra-xr/assets/demos/splash.html +519 -0
  44. package/skills/mudra-master/mudra-xr/assets/demos/webcam_gestures.html +253 -0
  45. package/skills/mudra-master/mudra-xr/assets/demos/xremoji.html +833 -0
  46. package/skills/mudra-master/mudra-xr/assets/demos/xrpoet.html +151 -0
  47. package/skills/mudra-master/mudra-xr/assets/samples/depthmap.html +266 -0
  48. package/skills/mudra-master/mudra-xr/assets/samples/depthmesh.html +100 -0
  49. package/skills/mudra-master/mudra-xr/assets/samples/game_rps.html +1099 -0
  50. package/skills/mudra-master/mudra-xr/assets/samples/gestures_custom.html +467 -0
  51. package/skills/mudra-master/mudra-xr/assets/samples/gestures_heuristic.html +256 -0
  52. package/skills/mudra-master/mudra-xr/assets/samples/lighting.html +163 -0
  53. package/skills/mudra-master/mudra-xr/assets/samples/mesh_detection.html +46 -0
  54. package/skills/mudra-master/mudra-xr/assets/samples/modelviewer.html +183 -0
  55. package/skills/mudra-master/mudra-xr/assets/samples/paint.html +133 -0
  56. package/skills/mudra-master/mudra-xr/assets/samples/planar-vst.html +45 -0
  57. package/skills/mudra-master/mudra-xr/assets/samples/reticle.html +95 -0
  58. package/skills/mudra-master/mudra-xr/assets/samples/skybox_agent.html +384 -0
  59. package/skills/mudra-master/mudra-xr/assets/samples/sound.html +390 -0
  60. package/skills/mudra-master/mudra-xr/assets/samples/ui.html +496 -0
  61. package/skills/mudra-master/mudra-xr/assets/samples/virtual-screens.html +808 -0
  62. package/skills/mudra-master/mudra-xr/assets/templates/0_basic.html +64 -0
  63. package/skills/mudra-master/mudra-xr/assets/templates/1_ui.html +107 -0
  64. package/skills/mudra-master/mudra-xr/assets/templates/2_hands.html +183 -0
  65. package/skills/mudra-master/mudra-xr/assets/templates/3_depth.html +89 -0
  66. package/skills/mudra-master/mudra-xr/assets/templates/4_stereo.html +84 -0
  67. package/skills/mudra-master/mudra-xr/assets/templates/5_camera.html +117 -0
  68. package/skills/mudra-master/mudra-xr/assets/templates/6_ai.html +154 -0
  69. package/skills/mudra-master/mudra-xr/assets/templates/7_ai_live.html +253 -0
  70. package/skills/mudra-master/mudra-xr/assets/templates/8_objects.html +95 -0
  71. package/skills/mudra-master/mudra-xr/assets/templates/9_xr-toggle.html +90 -0
  72. package/skills/mudra-master/mudra-xr/assets/templates/heuristic_hand_gestures.html +102 -0
  73. package/skills/mudra-master/mudra-xr/assets/templates/meshes.html +47 -0
  74. package/skills/mudra-master/mudra-xr/assets/templates/planes.html +47 -0
  75. package/skills/mudra-master/mudra-xr/assets/templates/uikit.html +187 -0
  76. package/skills/mudra-master/mudra-xr/references/agent_protocol.json +878 -0
  77. package/skills/mudra-master/mudra-xr/references/promt.md +1516 -0
  78. package/skills/mudra-preview/SKILL.md +151 -0
  79. package/skills/mudra-preview/assets/ar-menu.html +382 -0
  80. package/skills/mudra-preview/assets/document-scroller.html +468 -0
  81. package/skills/mudra-preview/assets/drum-machine.html +788 -0
  82. package/skills/mudra-preview/assets/emg-visualizer.html +390 -0
  83. package/skills/mudra-preview/assets/generative-art.html +408 -0
  84. package/skills/mudra-preview/assets/gesture-assistant.html +342 -0
  85. package/skills/mudra-preview/assets/gesture-speech.html +444 -0
  86. package/skills/mudra-preview/assets/hands-free-desktop.html +376 -0
  87. package/skills/mudra-preview/assets/model-rotator.html +365 -0
  88. package/skills/mudra-preview/assets/mudra-duel.html +3200 -0
  89. package/skills/mudra-preview/assets/mudra-monitor.html +1451 -0
  90. package/skills/mudra-preview/assets/mudra-ultimate-template.html +891 -0
  91. package/skills/mudra-preview/assets/music-sequencer.html +455 -0
  92. package/skills/mudra-preview/assets/neural-pong.html +380 -0
  93. package/skills/mudra-preview/assets/neural-snake.html +364 -0
  94. package/skills/mudra-preview/assets/presentation-controller.html +345 -0
  95. package/skills/mudra-preview/assets/pressure-painter.html +285 -0
  96. package/skills/mudra-preview/assets/runner.html +1812 -0
  97. package/skills/mudra-preview/assets/smart-home.html +461 -0
  98. package/skills/mudra-preview/assets/space-invaders.html +1154 -0
  99. package/skills/mudra-preview/assets/waterful-ring-toss.html +1624 -0
  100. package/skills/mudra-preview/references/agent_protocol.json +646 -0
  101. package/skills/mudra-preview/references/promt.md +16829 -0
  102. package/skills/mudra-xr/SKILL.md +245 -0
  103. package/skills/mudra-xr/assets/demos/3dgs-walkthrough.html +242 -0
  104. package/skills/mudra-xr/assets/demos/aisimulator.html +792 -0
  105. package/skills/mudra-xr/assets/demos/balloonpop.html +422 -0
  106. package/skills/mudra-xr/assets/demos/ballpit.html +284 -0
  107. package/skills/mudra-xr/assets/demos/drone.html +41 -0
  108. package/skills/mudra-xr/assets/demos/gemini-icebreakers.html +338 -0
  109. package/skills/mudra-xr/assets/demos/gemini-xrobject.html +302 -0
  110. package/skills/mudra-xr/assets/demos/math3d.html +188 -0
  111. package/skills/mudra-xr/assets/demos/measure.html +247 -0
  112. package/skills/mudra-xr/assets/demos/occlusion.html +251 -0
  113. package/skills/mudra-xr/assets/demos/rain.html +498 -0
  114. package/skills/mudra-xr/assets/demos/screenwiper.html +432 -0
  115. package/skills/mudra-xr/assets/demos/splash.html +519 -0
  116. package/skills/mudra-xr/assets/demos/webcam_gestures.html +253 -0
  117. package/skills/mudra-xr/assets/demos/xremoji.html +833 -0
  118. package/skills/mudra-xr/assets/demos/xrpoet.html +151 -0
  119. package/skills/mudra-xr/assets/samples/depthmap.html +266 -0
  120. package/skills/mudra-xr/assets/samples/depthmesh.html +100 -0
  121. package/skills/mudra-xr/assets/samples/game_rps.html +1099 -0
  122. package/skills/mudra-xr/assets/samples/gestures_custom.html +467 -0
  123. package/skills/mudra-xr/assets/samples/gestures_heuristic.html +256 -0
  124. package/skills/mudra-xr/assets/samples/lighting.html +163 -0
  125. package/skills/mudra-xr/assets/samples/mesh_detection.html +46 -0
  126. package/skills/mudra-xr/assets/samples/modelviewer.html +183 -0
  127. package/skills/mudra-xr/assets/samples/paint.html +133 -0
  128. package/skills/mudra-xr/assets/samples/planar-vst.html +45 -0
  129. package/skills/mudra-xr/assets/samples/reticle.html +95 -0
  130. package/skills/mudra-xr/assets/samples/skybox_agent.html +384 -0
  131. package/skills/mudra-xr/assets/samples/sound.html +390 -0
  132. package/skills/mudra-xr/assets/samples/ui.html +496 -0
  133. package/skills/mudra-xr/assets/samples/virtual-screens.html +808 -0
  134. package/skills/mudra-xr/assets/templates/0_basic.html +64 -0
  135. package/skills/mudra-xr/assets/templates/1_ui.html +107 -0
  136. package/skills/mudra-xr/assets/templates/2_hands.html +183 -0
  137. package/skills/mudra-xr/assets/templates/3_depth.html +89 -0
  138. package/skills/mudra-xr/assets/templates/4_stereo.html +84 -0
  139. package/skills/mudra-xr/assets/templates/5_camera.html +117 -0
  140. package/skills/mudra-xr/assets/templates/6_ai.html +154 -0
  141. package/skills/mudra-xr/assets/templates/7_ai_live.html +253 -0
  142. package/skills/mudra-xr/assets/templates/8_objects.html +95 -0
  143. package/skills/mudra-xr/assets/templates/9_xr-toggle.html +90 -0
  144. package/skills/mudra-xr/assets/templates/heuristic_hand_gestures.html +102 -0
  145. package/skills/mudra-xr/assets/templates/meshes.html +47 -0
  146. package/skills/mudra-xr/assets/templates/planes.html +47 -0
  147. package/skills/mudra-xr/assets/templates/uikit.html +187 -0
  148. package/skills/mudra-xr/references/agent_protocol.json +878 -0
  149. package/skills/mudra-xr/references/promt.md +1516 -0
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "mudra",
3
+ "description": "Claude Code skills for building Mudra Band apps — generate 2D flat/screen apps, 3D/XR experiences, or let the router auto-classify and hand off.",
4
+ "version": "1.0.0",
5
+ "author": {
6
+ "name": "Wearable Devices",
7
+ "email": "jabbour.d@wearabledevices.co.il"
8
+ },
9
+ "homepage": "https://github.com/wearable-devices/mudra-skills",
10
+ "repository": "https://github.com/wearable-devices/mudra-skills",
11
+ "license": "MIT",
12
+ "keywords": [
13
+ "mudra",
14
+ "wearable",
15
+ "gestures",
16
+ "xr",
17
+ "webxr"
18
+ ]
19
+ }
package/CLAUDE.md ADDED
@@ -0,0 +1,35 @@
1
+ # Mudra Plugin
2
+
3
+ This plugin provides skills for generating Mudra Band apps.
4
+
5
+ Use `/mudra-master` (or just describe an app idea) to build a 2D or 3D/XR app controlled by the Mudra Band wristband.
6
+
7
+ ## Skills
8
+
9
+ - **mudra-master** — router: classifies prompt as 2D / 3D / ASK / DECLINE, then hands off
10
+ - **mudra-preview** — generates single-file HTML 2D apps
11
+ - **mudra-xr** — generates single-file HTML 3D/XR apps using XR Blocks
12
+
13
+ ## Canonical Nine-Signal Table
14
+
15
+ | Signal | Type | Use for |
16
+ |---|---|---|
17
+ | `gesture` | discrete | finger pinches (index, middle, ring, little, thumb, grab) |
18
+ | `button` | discrete | hardware button press/release |
19
+ | `pressure` | analog | continuous squeeze force (0–1) |
20
+ | `navigation` | pointer | 2D cursor delta (x, y) — Pointer mode |
21
+ | `nav_direction` | discrete | swipe direction (up/down/left/right) — Direction mode |
22
+ | `imu_acc` | analog | accelerometer (x, y, z) — IMU mode |
23
+ | `imu_gyro` | analog | gyroscope (x, y, z) — IMU mode |
24
+ | `snc` | analog | 3-channel bio signal, batched arrays per channel |
25
+ | `battery` | discrete | battery level |
26
+
27
+ **Motion-mode exclusivity (non-negotiable):** each app uses exactly one of `navigation` XOR `nav_direction` XOR `imu_acc`+`imu_gyro`. The additive signals (`gesture`, `pressure`, `snc`, `battery`) combine freely with any mode.
28
+
29
+ ## Protocol Rules
30
+
31
+ - WebSocket at `ws://127.0.0.1:8766`
32
+ - Subscribe one signal per command, key `signal` (singular): `{ "command": "subscribe", "signal": "<name>" }`
33
+ - Never use `signals` (plural) or batch subscribe
34
+ - Always wrap with `MudraWebSocket` class (includes mock fallback)
35
+ - Every app must include: mock fallback, always-visible simulator panel, keyboard shortcuts, connection-status indicator
package/bin/install.js ADDED
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'fs';
3
+ import path from 'path';
4
+ import { fileURLToPath } from 'url';
5
+ import { execSync } from 'child_process';
6
+
7
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
8
+ const pluginSrc = path.resolve(__dirname, '..');
9
+ const homeDir = process.env.HOME || process.env.USERPROFILE;
10
+ const target = path.join(homeDir, '.claude', 'plugins', 'mudra');
11
+
12
+ fs.mkdirSync(target, { recursive: true });
13
+ execSync(`cp -r "${pluginSrc}/." "${target}"`);
14
+
15
+ console.log('');
16
+ console.log('Mudra skills installed successfully!');
17
+ console.log('');
18
+ console.log('Next steps:');
19
+ console.log(' 1. Restart Claude Code, or run /reload-plugins');
20
+ console.log(' 2. Use the skills:');
21
+ console.log(' /mudra:mudra-master — auto-classify and route');
22
+ console.log(' /mudra:mudra-preview — generate 2D app');
23
+ console.log(' /mudra:mudra-xr — generate 3D/XR app');
24
+ console.log('');
25
+ console.log(`Plugin location: ${target}`);
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "mudra-skills",
3
+ "version": "1.0.0",
4
+ "description": "Claude Code skills for building Mudra Band apps — 2D, 3D/XR, or auto-classified",
5
+ "type": "module",
6
+ "bin": {
7
+ "mudra-skills": "bin/install.js"
8
+ },
9
+ "author": {
10
+ "name": "Wearable Devices",
11
+ "email": "jabbour.d@wearabledevices.co.il"
12
+ },
13
+ "homepage": "https://github.com/wearable-devices/mudra-skills",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/wearable-devices/mudra-skills.git"
17
+ },
18
+ "license": "MIT",
19
+ "keywords": [
20
+ "claude-code",
21
+ "plugin",
22
+ "mudra",
23
+ "wearable",
24
+ "gestures",
25
+ "xr",
26
+ "webxr"
27
+ ]
28
+ }
@@ -0,0 +1,202 @@
1
+ ---
2
+ name: mudra-master
3
+ version: 2.2.0
4
+ description: Master router for Mudra Band app builds. Use when the user describes an app, experience, prototype, timer, counter, or tool to build with the Mudra Band but has not made clear whether they want a 2D (flat/screen) or 3D (spatial/XR/VR/AR) version. This skill classifies the prompt deterministically and hands off the original prompt verbatim to either mudra-preview (2D) or mudra-xr (3D), asking exactly one 2D-or-3D disambiguation question only when the dimension cannot be inferred. Do not use for pure code edits, repo questions, or any request that is not a Mudra-app build.
5
+ ---
6
+ # Mudra Master Skill
7
+
8
+ Route an incoming Mudra-Band app-build prompt to the correct child skill — `mudra-preview` for 2D (flat/screen) apps, `mudra-xr` for 3D/XR/VR/AR apps — with a single disambiguation question only when the dimension is unclear.
9
+
10
+ This skill emits no app artifacts of its own. Its sole outputs are a routing decision, an optional one-line reasoning note, and at most one invocation of a child skill. Every invocation is ephemeral: no log files, no cached state, no persisted history.
11
+
12
+ ## When this skill activates
13
+
14
+ Activate when the user:
15
+
16
+ - Describes something they want to **build / make / create / prototyp e** with the Mudra Band — an app, experience, tool, timer, counter, demo, game, dashboard, visualizer, panel, or scene — AND
17
+ - Has not made clear whether they want a 2D (screen-based) or 3D (spatial / XR / VR / AR) version.
18
+
19
+ I have 2 sklills and I want to build other skill master that can use both skill, how it can be done ?
20
+
21
+
22
+
23
+ and what the structure should look like ?Prefer letting `mudra-preview` or `mudra-xr` activate directly when Claude Code's skill-discovery heuristic matches a child skill's description confidently on an explicit-dimension prompt. This skill is the router for ambiguous prompts and the safe fallback for explicit-dimension prompts that still reach it.
24
+
25
+ ### The verbatim-prompt rule (FR-012)
26
+
27
+ At no point may the agent modify, summarise, enrich, rephrase, prefix, suffix, or markdown-wrap the user's prompt. The string received is the exact string passed as `args` to the child skill, trimmed only at its leading and trailing whitespace edges. No "Build a 2D …" rewrites. No context injection. No examples appended.
28
+
29
+ ## Classification algorithm
30
+
31
+ Evaluate these rules top-to-bottom against the user's trimmed, lowercased prompt. **First match wins.** First-match-wins plus a fixed rule order plus a fixed cue list is what makes this router deterministic (FR-015): the same prompt string always produces the same classification.
32
+
33
+ Before running any rule: if the trimmed prompt is **empty**, do NOT run the classification rules. Emit exactly `What would you like to build?` and stop the turn. The user's next message is a fresh invocation.
34
+
35
+ | # | Rule | Outcome |
36
+ | - | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
37
+ | 1 | Prompt contains BOTH whole-word `2d` AND whole-word `3d` | `ASK` (source=`LITERAL`) — never guess when both dimension markers are explicit |
38
+ | 2 | Prompt contains whole-word `2d` and NOT whole-word `3d` | `TWO_D` (source=`LITERAL`, triggering_token=`2D`) |
39
+ | 3 | Prompt contains whole-word `3d` and NOT whole-word `2d` | `THREE_D` (source=`LITERAL`, triggering_token=`3D`) |
40
+ | 4 | Prompt matches ≥1 token from the 3D cue list AND ≥1 token from the 2D cue list | `ASK` (source=`CUE`) |
41
+ | 5 | Prompt matches ≥1 token from the 3D cue list and NO token from the 2D cue list | `THREE_D` (source=`CUE`, triggering_token = the first 3D cue that matched, listed in cue-list order below) |
42
+ | 6 | Prompt matches ≥1 token from the 2D cue list and NO token from the 3D cue list | `TWO_D` (source=`CUE`, triggering_token = the first 2D cue that matched, listed in cue-list order below) |
43
+ | 7 | Prompt contains NONE of the in-scope build verbs/nouns listed below | `DECLINE` (source=`OUT_OF_SCOPE`) |
44
+ | 8 | None of the above matched | `ASK` (source=`LITERAL`) — ambiguous prompt, no cue, no literal marker |
45
+
46
+ **In-scope build verbs/nouns** (Rule 7 passes if AT LEAST ONE appears in the prompt, case-insensitive, whole-word or contiguous substring):
47
+
48
+ `build`, `make`, `create`, `prototype`, `generate`, `app`, `experience`, `tool`, `timer`, `counter`, `demo`, `game`, `dashboard`, `visualizer`, `visualiser`, `panel`, `scene`, `widget`, `ui`.
49
+
50
+ ### 3D cue tokens
51
+
52
+ **Fixed built-in constant. Changing this list requires a new `version` bump in this SKILL.md's frontmatter (FR-018).**
53
+
54
+ Whole-word match (case-insensitive): `XR`, `VR`, `AR`.
55
+
56
+ Contiguous-substring match (case-insensitive): `immersive`, `spatial`, `room-scale`, `world-space`, `in 3d space`, `headset`, `stereo`.
57
+
58
+ Rule-5 evaluation order is the order above: `XR` is checked first, then `VR`, `AR`, `immersive`, `spatial`, `room-scale`, `world-space`, `in 3d space`, `headset`, `stereo`. The first cue that matches is the `triggering_token`, rendered in its display form (uppercase for acronyms; as-listed for the rest).
59
+
60
+ ### 2D cue tokens
61
+
62
+ **Fixed built-in constant. Changing this list requires a new `version` bump in this SKILL.md's frontmatter (FR-018).**
63
+
64
+ Whole-word match (case-insensitive): `flat`, `HUD`.
65
+
66
+ Contiguous-substring match (case-insensitive): `on-screen`, `on my screen`, `dashboard`, `screen-based`.
67
+
68
+ Rule-6 evaluation order is the order above: `flat` first, then `HUD`, `on-screen`, `on my screen`, `dashboard`, `screen-based`.
69
+
70
+ ## Disambiguation question
71
+
72
+ When Rule 1, Rule 4, or Rule 8 yields an `ASK` outcome, emit exactly this text and then **stop the turn**. Do NOT call any tool. Do NOT re-state or re-request the prompt. Do NOT ask any follow-up beyond this one question — FR-008 / SC-003 forbid a second question:
73
+
74
+ ```
75
+ Your prompt doesn't specify whether this should be a 2D (flat/screen)
76
+ or 3D (spatial/XR) experience. Which should I build?
77
+
78
+ A) 2D — screen-based
79
+ B) 3D — spatial/XR
80
+ ```
81
+
82
+ ## ASK-reply interpretation
83
+
84
+ After the disambiguation question has been emitted, the user's next message is their reply. Classify it with these rules (first match wins, against the trimmed, lowercased reply):
85
+
86
+ | Reply pattern | Outcome |
87
+ | --------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
88
+ | Contains `2d`, equals `a`, `option a`, `screen`, `flat`, `flat ui`, `screen-based`, or clearly picks 2D | `TWO_D` (source=`ASK_REPLY`) |
89
+ | Contains `3d`, equals `b`, `option b`, `spatial`, `xr`, `vr`, `ar`, `immersive`, or clearly picks 3D | `THREE_D` (source=`ASK_REPLY`) |
90
+ | Anything else (`either`, `you pick`, blank, nonsense) | `TWO_D` (source=`ASK_DEFAULT`) — emit the default-notice reasoning note before hand-off (FR-010) |
91
+
92
+ Once a reply is classified, route the **original prompt** (the one from before the disambiguation question was asked) — NOT the user's reply text — to the chosen child skill (FR-009).
93
+
94
+ ## Out-of-scope decline
95
+
96
+ When Rule 7 yields `DECLINE`, emit this template, filling only the `<brief reason>` slot with one short human-readable clause (e.g., `a code-refactoring request`, `a question about this repository`, `a file-listing request`). Do NOT call any tool. Do NOT ask 2D-or-3D (FR-014 / SC-007):
97
+
98
+ ```
99
+ I only dispatch Mudra-controlled 2D or 3D app builds. Your request looks
100
+ like <brief reason>. Try rephrasing as a "build / prototype / make a
101
+ [thing]" request, or invoke the underlying tool directly.
102
+ ```
103
+
104
+ ## Hand-off
105
+
106
+ For every outcome in `{TWO_D, THREE_D}`, emit the appropriate pre-hand-off text (if any) and then issue **exactly one** `Skill` tool call. Between classification and hand-off there must be no other tool calls — no `Write`, no `Bash`, no `Read`, no logging, no file writes, no state (FR-019).
107
+
108
+ ### Pre-hand-off reasoning note, by classification source
109
+
110
+ | Classification source | Reasoning note emitted before the Skill call |
111
+ | ------------------------------------- | ---------------------------------------------------------------- |
112
+ | `LITERAL` (Rules 2, 3) | (none — self-evident from the user's own words) |
113
+ | `CUE`, outcome=`THREE_D` (Rule 5) | `Routing to 3D skill — detected '<triggering_token>' cue.` |
114
+ | `CUE`, outcome=`TWO_D` (Rule 6) | `Routing to 2D skill — detected '<triggering_token>' cue.` |
115
+ | `ASK_REPLY` | (none — the user just answered; the reasoning is their reply) |
116
+ | `ASK_DEFAULT` | `Defaulting to 2D — your reply didn't clearly pick 2D or 3D.` |
117
+
118
+ Example for an inferred-3D case, prompt `build me a VR meditation app`: emit `Routing to 3D skill — detected 'VR' cue.` then call the Skill tool. `<triggering_token>` is rendered in display form (acronyms uppercase).
119
+
120
+ ### Skill tool invocation
121
+
122
+ For `outcome=TWO_D` (any source):
123
+
124
+ ```
125
+ Skill(skill="mudra-preview", args="<original prompt, byte-for-byte verbatim, trimmed only at the edges>")
126
+ ```
127
+
128
+ For `outcome=THREE_D` (any source):
129
+
130
+ ```
131
+ Skill(skill="mudra-xr", args="<original prompt, byte-for-byte verbatim, trimmed only at the edges>")
132
+ ```
133
+
134
+ `args` is the ORIGINAL prompt — not the user's disambiguation reply, not a rewritten version, not a prefixed version. Exactly what the user first typed. Invoke the Skill tool exactly once per routing decision. No retries. No fan-out to both children. No wrapper context in `args`.
135
+
136
+ ## Execution flow (summary)
137
+
138
+ ```
139
+ user prompt
140
+
141
+
142
+ [empty? YES → "What would you like to build?" | STOP]
143
+ │ NO
144
+
145
+ [Classification rules 1–8, first-match-wins]
146
+
147
+ ├── TWO_D → [emit reasoning note if any] → Skill(mudra-preview, args=prompt) → DONE
148
+ ├── THREE_D → [emit reasoning note if any] → Skill(mudra-xr, args=prompt) → DONE
149
+ ├── DECLINE → [emit out-of-scope template] → DONE
150
+ └── ASK → [emit disambiguation question] → STOP TURN → await user reply
151
+
152
+
153
+ [ASK-reply rules]
154
+
155
+ ├── TWO_D (ASK_REPLY) → Skill(mudra-preview, args=ORIGINAL prompt) → DONE
156
+ ├── TWO_D (ASK_DEFAULT) → [emit default-notice] → Skill(mudra-preview, args=ORIGINAL prompt) → DONE
157
+ └── THREE_D (ASK_REPLY) → Skill(mudra-xr, args=ORIGINAL prompt) → DONE
158
+ ```
159
+
160
+ ## Onboarding contract — defer to children (feature 008)
161
+
162
+ The locked onboarding modal contract (DOM, CSS, JS, branding string, close behavior, app-aware filter) is owned by the **child** skills:
163
+
164
+ - 2D apps → `mudra-preview/references/promt.md` § "Onboarding Modal (mandatory, STRICT) — feature 008-strict-onboarding-templates" — see "Close behavior" subsection
165
+ - 3D apps → `mudra-xr/references/promt.md` § "Section 17" **and** `mudra-xr-2/references/xr_build_rules.md` § "§21" — both encode the same locked contract including the close-behavior table.
166
+
167
+ Binding contracts live at `specs/008-strict-onboarding-templates/contracts/onboarding-block.md` and `…/actions-array.md`.
168
+
169
+ The contract guarantees a uniform close model across all routed apps:
170
+
171
+ - The `<dialog>` is opened via `root.showModal()` on page load (never the HTML `open` attribute — non-modal dialogs let an underlying canvas intercept clicks).
172
+ - Both `Continue` and `×` close the modal via the same `closeOb` handler (no skip-vs-save split).
173
+ - Escape closes; `?` reopens (2D always, 3D outside immersive XR).
174
+ - The help-pill `#mudra-onboarding-help` is the mouse/touch re-open path.
175
+
176
+ This router MUST NOT:
177
+
178
+ - Mention the onboarding modal in its prompt-trimming or hand-off logic.
179
+ - Append, prefix, or inject any "include onboarding" / "use template N" / "skip close button" hint to `args`.
180
+ - Suggest a different layout, branding string, CTA label, or close behavior.
181
+ - Override or weaken any rule in the child contract (FR-012, FR-019).
182
+
183
+ The verbatim-prompt rule above already implies all of this — the router never modifies the user's prompt. This subsection exists to make the deferral explicit so future router edits do not accidentally introduce onboarding rules at the router layer.
184
+
185
+ ## Guarantees (invariants the router must preserve)
186
+
187
+ 1. **Deterministic** — the same prompt string always yields the same classification (FR-015).
188
+ 2. **Verbatim hand-off** — `args` is byte-identical to the user's original prompt, trimmed only at the edges (FR-012 / SC-006).
189
+ 3. **Exactly one Skill call per routed outcome** — never zero (silent guess), never two (fan-out) (FR-002).
190
+ 4. **At most one disambiguation question per turn** — never two (SC-003).
191
+ 5. **No persisted state** — no files written, no logs, no caches, no console decision records (FR-019).
192
+ 6. **Explicit beats inferred** — literal `2D`/`3D` markers always win over any cue match (FR-016).
193
+ 7. **No child-skill modification** — routing never reads or edits anything under `.claude/skills/mudra-preview/` or `.claude/skills/mudra-xr/` (FR-011).
194
+ 8. **No onboarding-layer overrides** (feature 008) — router never edits or weakens the locked onboarding contract owned by the child skills.
195
+
196
+ ## Not this skill's job
197
+
198
+ - Generating HTML files — that's `mudra-preview` (2D) or `mudra-xr` (3D).
199
+ - Selecting templates, inferring motion modes, or wiring Mudra signals — child-skill concerns.
200
+ - Explaining WHY a user should pick 2D vs 3D — the disambiguation question is one line, no advice.
201
+ - Refactoring code, answering repo questions, running shell commands — decline these via Rule 7.
202
+ - Logging, persisting, or summarising routing decisions — explicitly forbidden in v1 (FR-019).
@@ -0,0 +1,151 @@
1
+ ---
2
+ name: mudra-preview
3
+ version: 2.2.0
4
+ description: Generate a working Mudra Band interactive app preview as a single-file HTML. Use when the user describes a Mudra-controlled experience (gesture, pressure, navigation, IMU, SNC), wants to prototype a Mudra Companion app, or asks to build/preview a Mudra app.
5
+ ---
6
+
7
+ # Mudra Preview
8
+
9
+ Generate a complete, working single-file HTML app controlled by Mudra Band signals.
10
+
11
+ **Mandatory feature (v1.1.0, updated v1.4.0):** Every generated app MUST
12
+ include a Manual/Mudra **Mode toggle** as defined in `references/promt.md`
13
+ § "Mode Toggle (Manual / Mudra) — Required". Manual is the default; Mudra
14
+ opens a single WebSocket lazily and disables the simulator panel so signals
15
+ come only from the band.
16
+
17
+ **Removed in v1.4.0:** Do **not** render a "Band disconnected" overlay,
18
+ toast, or any other separate disconnect alert. Connection state is
19
+ communicated **only** through the existing connection-status pill (which
20
+ shows "Connecting…" / "Connected" / "Disconnected"). No extra notice,
21
+ no banner, no modal.
22
+
23
+ **Branding (v1.4.0):** The footer/badge text MUST be exactly
24
+ **"Created by Mudra"** — never "Created with Mudra Studio" or any
25
+ other variant.
26
+
27
+ **Mandatory feature (v1.2.0):** Connection state MUST reflect the **band**, not
28
+ the WebSocket. The Companion service accepts socket connections even when no
29
+ band is paired, so flipping to "Connected" on `ws.onopen` is a lie. Every
30
+ generated app MUST send `{command:"get_status"}` on open and poll it every
31
+ 2 s while in Mudra mode, and only show "Connected" when the response has
32
+ `data.device.state === "connected"`. See `references/promt.md` §
33
+ "Disconnect detection — band state via `get_status` polling (mandatory)".
34
+
35
+ The canonical protocol is in `references/agent_protocol.json` (v2.0).
36
+
37
+ ## Steps
38
+
39
+ 1. **Read the full instructions** from `references/promt.md` inside the skill base directory. That file contains the complete protocol contract, signal compatibility rules, the Mode Toggle architecture (mandatory), build defaults, and sample catalog — follow all of it.
40
+
41
+ 2. **Infer intent** from the user's description (or the args passed to this skill). Fill gaps with smart defaults. Ask only if there is genuine ambiguity (e.g., `gesture` vs `pressure`, `navigation` vs `nav_direction`, or directional motion vs IMU+Biometric bundle).
42
+
43
+ 3. **Select the best-matching template** from `assets/` inside the skill base directory. Use the selection rule from `references/promt.md` (motion mode → interaction pattern → signal overlap).
44
+
45
+ 4. **Generate the app** as a single self-contained HTML file:
46
+ - Follow every rule in `references/promt.md` (protocol contract, signal compatibility, mock WebSocket, theme, fallbacks)
47
+ - Choose a color palette that matches the concept — never default to dark unless the concept calls for it
48
+ - Include the Mudra badge, connection indicator, telemetry HUD, simulator panel (see below), and keyboard fallbacks
49
+
50
+ ### Simulator Panel (Required)
51
+
52
+ Every generated app MUST include a **compact, always-visible simulator panel** with one button set per subscribed signal. The user must be able to trigger every signal with a click — so they can test without the band, or alongside it.
53
+
54
+ **Layout rules**
55
+ - One thin horizontal strip (usually in or just below the header, or pinned to the bottom edge).
56
+ - **Always visible** — do NOT hide when the band is connected.
57
+ - Group by signal. Use short labels so it stays compact (e.g., `Tap`, `2Tap`, `Twist`, `↑`, `↓`, `Roll L`).
58
+ - Reuse the existing `.btn` style from the chosen template.
59
+ - No drawers, no collapse, no accordion — one click to fire.
60
+
61
+ **Buttons per signal** (only render the groups for signals the app actually subscribes to)
62
+
63
+ | Signal | Buttons |
64
+ |---|---|
65
+ | `gesture` | `Tap`, `2Tap`, `Twist`, `2Twist` |
66
+ | `nav_direction` | `↑`, `↓`, `←`, `→`, `Roll L`, `Roll R` |
67
+ | `navigation` | `↑`, `↓`, `←`, `→` (each click emits one delta event of ±8) |
68
+ | `pressure` | Slider `0–100%` (or `−` / `+` buttons if horizontal space is tight) |
69
+ | `button` | `Press`, `Release` |
70
+ | `imu_acc` | `Tilt X`, `Tilt Y`, `Tilt Z` (each fires a 5-frame burst at ±2 m/s²) |
71
+ | `imu_gyro` | `Rot X`, `Rot Y`, `Rot Z` (each fires a 5-frame burst at ±10 deg/s) |
72
+ | `snc` | `Spike` (injects a burst of elevated samples on all 3 channels) |
73
+
74
+ **How each button must fire**
75
+ - `gesture` buttons → `ws.send(JSON.stringify({ command: 'trigger_gesture', data: { type: '<name>' } }))`. This works both when connected to the real band (round-trips through the service) and when the mock is active (mock echoes it back).
76
+ - **All other signals** → emit locally by calling the same handler `ws.onmessage` would dispatch. Example:
77
+ ```js
78
+ function simDir(direction) {
79
+ // same path the real signal would take
80
+ handleNavDirection({ direction, timestamp: Date.now() });
81
+ hudDir.textContent = direction;
82
+ }
83
+ ```
84
+ Always update the telemetry HUD from the sim button, same as the real signal would.
85
+
86
+ 5. **Save the output** to `preview/<concept-name>.html` in the project root (create the `preview/` directory if it doesn't exist). Use a short kebab-case name derived from the concept (e.g., `preview/drum-machine.html`).
87
+
88
+ 6. **Report the file path** so the user can open it in a browser immediately.
89
+
90
+ ## Default Signal Set (v1.3.0 — Required)
91
+
92
+ Unless the user explicitly asks for a different signal, every generated
93
+ app MUST restrict itself to **at most these signals** (subject to the
94
+ exclusivity rules below):
95
+
96
+ 1. **One** of `pressure` **or** `gesture` — never both. `gesture` and
97
+ `pressure` are mutually exclusive.
98
+ - **Tap exclusivity rule** (within `gesture`): use `tap` OR `double_tap`
99
+ — **never both together** unless the user explicitly names both (e.g.,
100
+ "use single tap for X and double tap for Y").
101
+ - `tap` → frequent/lightweight: counter increment, navigation step,
102
+ toggle, next/back, select, trigger. **Default choice.**
103
+ - `double_tap` → only when the user explicitly requests it by name.
104
+ Never pair it with `tap` as a default two-action scheme.
105
+ - Generic synonyms ("tap", "click", "press") → `tap`.
106
+ - When an app needs **two distinct gesture actions** (e.g., forward +
107
+ backward), pair `tap` with `twist` — not with `double_tap`.
108
+ `double_tap` is reserved for explicit user requests only.
109
+ 2. **One** directional signal — either `nav_direction` **or**
110
+ `navigation`, never both.
111
+
112
+ Rules:
113
+
114
+ - Drop any of the above if the concept does not need it (e.g., a pure
115
+ tap-counter subscribes to `gesture` only and skips the directional
116
+ signal).
117
+ - **`gesture` and `pressure` are mutually exclusive** — pick one
118
+ interaction model per app. Tap/twist concepts → `gesture`. Analog
119
+ concepts (volume, brush, throttle) → `pressure`.
120
+ - `nav_direction` and `navigation` are **mutually exclusive per app** —
121
+ pick the one that fits the interaction (discrete swipes →
122
+ `nav_direction`; continuous cursor/scroll → `navigation`). Never wire
123
+ both into the same app.
124
+ - **IMU+Biometric bundle (`imu_acc` + `imu_gyro` + `snc`) is
125
+ inseparable.** If the concept needs any one of them, subscribe to all
126
+ three. The bundle is **mutually exclusive** with `navigation` and
127
+ `nav_direction` — pick directional motion OR the IMU+Biometric bundle,
128
+ never both.
129
+ - Other gesture subtypes (`twist`, `double_twist`, etc.) and other
130
+ signals (`button`, `imu_acc`, `imu_gyro`, `snc`, `battery`) are
131
+ **off by default**. Only include them when the user's prompt names
132
+ them, names a synonym from the Signal Inference table in
133
+ `references/promt.md` § "Signal Inference Reference", or describes
134
+ an interaction that genuinely cannot be expressed with the defaults
135
+ (e.g., "tilt to steer" → IMU+Biometric bundle; "hold to charge" →
136
+ `button`).
137
+ - The simulator panel must mirror whichever subset the app actually
138
+ subscribes to — do not render buttons for signals that are not wired.
139
+
140
+ ## Quick Reference
141
+
142
+ - WebSocket endpoint: `ws://127.0.0.1:8766` (bare URL — NOT `/events`)
143
+ - Mode toggle (Manual / Mudra) is **mandatory** in every generated app — see `references/promt.md` § "Mode Toggle (Manual / Mudra) — Required"
144
+ - Lazy WS lifecycle: open on Manual→Mudra, close on Mudra→Manual. Manual mode opens NO WebSocket.
145
+ - Subscribe one signal per command: `{ "command": "subscribe", "signal": "<name>" }` — singular `signal`, never `signals`, never an array
146
+ - Motion modes are mutually exclusive: Pointer (`navigation`+`button`) / Direction (`nav_direction`) / IMU+Biometric (`imu_acc`+`imu_gyro`+`snc`, always all three together)
147
+ - IMU+Biometric bundle: `imu_acc`, `imu_gyro`, `snc` always subscribed together — never partially. The bundle is mutually exclusive with `navigation` and `nav_direction`.
148
+ - `gesture` and `pressure` are mutually exclusive — never combine them
149
+ - `button` and `battery` combine freely (subject to the Pointer XOR — `button` belongs to Pointer mode and never combines with `nav_direction`)
150
+ - **Navigation sensitivity is gentle by default**: keyboard `step = 3`, sim button `±3`, cursor multiplier `0.002`. Raise only when the prompt explicitly asks for fast/snappy movement. See `references/promt.md` § "Navigation sensitivity defaults".
151
+ - Canonical protocol JSON: `references/agent_protocol.json` (v2.0)