orbitmap 0.4.2 → 0.4.4

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 (164) hide show
  1. package/README.md +112 -18
  2. package/dist/adapters/cloud.d.ts +63 -21
  3. package/dist/adapters/cloud.js +108 -29
  4. package/dist/adapters/cloud.js.map +1 -1
  5. package/dist/adapters/factory.d.ts +3 -0
  6. package/dist/adapters/factory.js +8 -1
  7. package/dist/adapters/factory.js.map +1 -1
  8. package/dist/adapters/local/adapter.d.ts +17 -20
  9. package/dist/adapters/local/adapter.js +28 -21
  10. package/dist/adapters/local/adapter.js.map +1 -1
  11. package/dist/adapters/local/context.d.ts +1 -1
  12. package/dist/adapters/local/context.js +10 -2
  13. package/dist/adapters/local/context.js.map +1 -1
  14. package/dist/adapters/local/entities/planning.d.ts +5 -1
  15. package/dist/adapters/local/entities/planning.js +16 -3
  16. package/dist/adapters/local/entities/planning.js.map +1 -1
  17. package/dist/adapters/local/entities/tasks.d.ts +9 -1
  18. package/dist/adapters/local/entities/tasks.js +47 -5
  19. package/dist/adapters/local/entities/tasks.js.map +1 -1
  20. package/dist/adapters/local/entities/work-items.d.ts +14 -30
  21. package/dist/adapters/local/entities/work-items.js +63 -47
  22. package/dist/adapters/local/entities/work-items.js.map +1 -1
  23. package/dist/adapters/local/rules.d.ts +4 -4
  24. package/dist/adapters/local/rules.js +4 -19
  25. package/dist/adapters/local/rules.js.map +1 -1
  26. package/dist/adapters/local/shapes.d.ts +27 -7
  27. package/dist/adapters/local/shapes.js +41 -5
  28. package/dist/adapters/local/shapes.js.map +1 -1
  29. package/dist/adapters/local/store.d.ts +55 -6
  30. package/dist/adapters/local/store.js +122 -8
  31. package/dist/adapters/local/store.js.map +1 -1
  32. package/dist/adapters/local/types.d.ts +11 -2
  33. package/dist/adapters/local/types.js +9 -2
  34. package/dist/adapters/local/types.js.map +1 -1
  35. package/dist/adapters/types.d.ts +30 -20
  36. package/dist/agent-instructions.d.ts +43 -12
  37. package/dist/agent-instructions.js +1133 -170
  38. package/dist/agent-instructions.js.map +1 -1
  39. package/dist/area-directories.d.ts +75 -0
  40. package/dist/area-directories.js +162 -0
  41. package/dist/area-directories.js.map +1 -0
  42. package/dist/area-grouping.d.ts +55 -0
  43. package/dist/area-grouping.js +72 -0
  44. package/dist/area-grouping.js.map +1 -0
  45. package/dist/commands/areas.js +30 -2
  46. package/dist/commands/areas.js.map +1 -1
  47. package/dist/commands/assign.d.ts +1 -0
  48. package/dist/commands/assign.js +2 -0
  49. package/dist/commands/assign.js.map +1 -1
  50. package/dist/commands/context.d.ts +95 -0
  51. package/dist/commands/context.js +104 -2
  52. package/dist/commands/context.js.map +1 -1
  53. package/dist/commands/create.d.ts +1 -0
  54. package/dist/commands/create.js +19 -14
  55. package/dist/commands/create.js.map +1 -1
  56. package/dist/commands/dep.js +5 -8
  57. package/dist/commands/dep.js.map +1 -1
  58. package/dist/commands/doc-import.d.ts +1 -0
  59. package/dist/commands/doc-import.js +8 -26
  60. package/dist/commands/doc-import.js.map +1 -1
  61. package/dist/commands/doc-patch.js +16 -52
  62. package/dist/commands/doc-patch.js.map +1 -1
  63. package/dist/commands/doc-share.js +4 -0
  64. package/dist/commands/doc-share.js.map +1 -1
  65. package/dist/commands/doc-update.js +4 -8
  66. package/dist/commands/doc-update.js.map +1 -1
  67. package/dist/commands/doc.js +7 -12
  68. package/dist/commands/doc.js.map +1 -1
  69. package/dist/commands/docs-cache.js +23 -10
  70. package/dist/commands/docs-cache.js.map +1 -1
  71. package/dist/commands/docs.js +29 -10
  72. package/dist/commands/docs.js.map +1 -1
  73. package/dist/commands/get.js +8 -10
  74. package/dist/commands/get.js.map +1 -1
  75. package/dist/commands/ideas.d.ts +3 -1
  76. package/dist/commands/ideas.js +26 -49
  77. package/dist/commands/ideas.js.map +1 -1
  78. package/dist/commands/init.d.ts +24 -1
  79. package/dist/commands/init.js +0 -0
  80. package/dist/commands/init.js.map +1 -1
  81. package/dist/commands/intent.d.ts +16 -0
  82. package/dist/commands/intent.js +61 -18
  83. package/dist/commands/intent.js.map +1 -1
  84. package/dist/commands/issues.d.ts +3 -1
  85. package/dist/commands/issues.js +47 -72
  86. package/dist/commands/issues.js.map +1 -1
  87. package/dist/commands/log.d.ts +14 -2
  88. package/dist/commands/log.js +35 -20
  89. package/dist/commands/log.js.map +1 -1
  90. package/dist/commands/mission.d.ts +8 -0
  91. package/dist/commands/mission.js +58 -18
  92. package/dist/commands/mission.js.map +1 -1
  93. package/dist/commands/orbit.d.ts +7 -1
  94. package/dist/commands/orbit.js +13 -24
  95. package/dist/commands/orbit.js.map +1 -1
  96. package/dist/commands/setup-agent.d.ts +97 -4
  97. package/dist/commands/setup-agent.js +273 -40
  98. package/dist/commands/setup-agent.js.map +1 -1
  99. package/dist/commands/setup-mcp.d.ts +2 -0
  100. package/dist/commands/setup-mcp.js +17 -40
  101. package/dist/commands/setup-mcp.js.map +1 -1
  102. package/dist/commands/start.d.ts +43 -0
  103. package/dist/commands/start.js +158 -3
  104. package/dist/commands/start.js.map +1 -1
  105. package/dist/commands/status.d.ts +1 -0
  106. package/dist/commands/status.js +5 -15
  107. package/dist/commands/status.js.map +1 -1
  108. package/dist/commands/subtask.d.ts +1 -0
  109. package/dist/commands/subtask.js +9 -2
  110. package/dist/commands/subtask.js.map +1 -1
  111. package/dist/commands/task-edit-content.js +4 -8
  112. package/dist/commands/task-edit-content.js.map +1 -1
  113. package/dist/commands/task.d.ts +7 -0
  114. package/dist/commands/task.js +5 -2
  115. package/dist/commands/task.js.map +1 -1
  116. package/dist/commands/tasks.d.ts +35 -0
  117. package/dist/commands/tasks.js +45 -9
  118. package/dist/commands/tasks.js.map +1 -1
  119. package/dist/commands/vibes.d.ts +3 -1
  120. package/dist/commands/vibes.js +41 -31
  121. package/dist/commands/vibes.js.map +1 -1
  122. package/dist/config.d.ts +11 -0
  123. package/dist/config.js +14 -1
  124. package/dist/config.js.map +1 -1
  125. package/dist/doc-cache.d.ts +74 -5
  126. package/dist/doc-cache.js +106 -22
  127. package/dist/doc-cache.js.map +1 -1
  128. package/dist/enums.d.ts +26 -0
  129. package/dist/enums.js +53 -0
  130. package/dist/enums.js.map +1 -0
  131. package/dist/errors.d.ts +67 -0
  132. package/dist/errors.js +82 -0
  133. package/dist/errors.js.map +1 -1
  134. package/dist/index.js +169 -60
  135. package/dist/index.js.map +1 -1
  136. package/dist/mcp-config.d.ts +42 -1
  137. package/dist/mcp-config.js +82 -2
  138. package/dist/mcp-config.js.map +1 -1
  139. package/dist/oauth.js +10 -10
  140. package/dist/output.d.ts +12 -0
  141. package/dist/output.js +39 -1
  142. package/dist/output.js.map +1 -1
  143. package/dist/paths.d.ts +40 -0
  144. package/dist/paths.js +174 -9
  145. package/dist/paths.js.map +1 -1
  146. package/dist/project-config.d.ts +42 -1
  147. package/dist/project-config.js +51 -0
  148. package/dist/project-config.js.map +1 -1
  149. package/dist/work-log.d.ts +104 -0
  150. package/dist/work-log.js +181 -0
  151. package/dist/work-log.js.map +1 -0
  152. package/dist/workspace-resolve.d.ts +179 -9
  153. package/dist/workspace-resolve.js +288 -20
  154. package/dist/workspace-resolve.js.map +1 -1
  155. package/dist/write-target.d.ts +56 -0
  156. package/dist/write-target.js +170 -0
  157. package/dist/write-target.js.map +1 -0
  158. package/package.json +3 -2
  159. package/dist/commands/create-project.d.ts +0 -6
  160. package/dist/commands/create-project.js +0 -28
  161. package/dist/commands/create-project.js.map +0 -1
  162. package/dist/commands/projects.d.ts +0 -3
  163. package/dist/commands/projects.js +0 -28
  164. package/dist/commands/projects.js.map +0 -1
@@ -1,26 +1,50 @@
1
1
  // Single source of truth for all OrbitMap agent-facing instruction text.
2
2
  //
3
+ // THIS FILE IS THE CANONICAL HOME of the skills. `orbitmap init` installs them; the
4
+ // copies under `~/.claude/skills/` (or a project's `.claude/skills/`) are INSTALLS,
5
+ // not sources. Edit here, then re-install — never the other way around.
6
+ //
3
7
  // Two layers, mirroring how the OrbitMap MCP server works:
4
8
  // 1. THIN_HOOK — always-on, injected into CLAUDE.md / AGENTS.md (~10 lines).
5
9
  // Equivalent of the MCP "system instructions" that are always
6
10
  // in the system prompt. Guarantees the agent always knows the
7
11
  // project uses OrbitMap and knows the workflow skeleton.
8
- // 2. The four skills — the deep, on-demand layer. Equivalent of the MCP tool
9
- // catalogue (INSTRUCTIONS_FULL), split by topic:
10
- // orbitmap — object model, context, command map
11
- // orbitmap-working — task lifecycle, logging, git/delivery
12
- // orbitmap-planningmissions, intents, ideas, issues
13
- // orbitmap-docsdocuments
12
+ // 2. The skills — the deep, on-demand layer: the four gates of the
13
+ // product-building flow plus the entry point and docs:
14
+ // orbitmap entry point: object model, context,
15
+ // command map
16
+ // orbitmap-brainstormgate 1: idea → agreed outcome
17
+ // orbitmap-designgate 2: outcome → design doc
18
+ // orbitmap-plan — gate 3: design → executable tasks
19
+ // (+ general planning entities)
20
+ // orbitmap-execute — gate 4: execution, two flows. Flow A
21
+ // ("execute IN-x") orchestrates a whole
22
+ // intent: parallel workers in dependency
23
+ // waves, baseline + impact test gates, a
24
+ // goal-based fix loop, ending in_review on
25
+ // an intent branch. Flow B ("work on
26
+ // TS-x") runs one task inline. Ships a
27
+ // reference file, references/
28
+ // worker-contract.md, that dispatched
29
+ // workers read INSTEAD of the skill
30
+ // (see SkillDef.references).
31
+ // orbitmap-docs — documents
14
32
  // Shipped two ways:
15
33
  // - Claude: one `.claude/skills/<name>/SKILL.md` per skill,
16
- // loaded on demand (zero per-turn context cost).
17
- // - non-Claude: all four bodies concatenated into the agent
34
+ // plus any `references/*` files, loaded on demand
35
+ // (zero per-turn context cost).
36
+ // - non-Claude: all skill BODIES concatenated into the agent
18
37
  // config file (no skill ecosystem to lean on).
38
+ // Reference files are not inlined: without
39
+ // subagent dispatch, Flow A runs serially and the
40
+ // worker contract folds into the executor's own
41
+ // rules.
19
42
  //
20
- // The content below is normative: it is transcribed from §8 of
21
- // `docs/local-mode-poc-spec.md`, which is itself the MCP oracle
22
- // (`orbitmap-mcp/src/orbitmap_mcp/instructions.py`, INSTRUCTIONS_FULL) translated into
23
- // CLI-command vocabulary. Do not paraphrase it; change the spec first.
43
+ // History: the original four skills (orbitmap, orbitmap-execute, orbitmap-plan,
44
+ // orbitmap-docs) were transcribed from §8 of `docs/local-mode-poc-spec.md`, itself a
45
+ // CLI translation of the MCP oracle (`orbitmap-mcp/.../instructions.py`). The skills
46
+ // have since evolved past that spec worklog wiring, the keep/drop test, and the v2
47
+ // whole-intent execute flow — so THIS FILE is now normative, not the spec.
24
48
  export const MARKER_START = '<!-- ORBITMAP_START -->';
25
49
  export const MARKER_END = '<!-- ORBITMAP_END -->';
26
50
  /** The core skill name (entry point). Kept for backwards compatibility. */
@@ -40,6 +64,15 @@ through the \`orbitmap\` CLI (run with \`npx orbitmap …\` if not on PATH). The
40
64
  identically in cloud mode and local-files mode — never assume which one is active, and
41
65
  never read or write the workspace's data files directly. The CLI is the only interface.
42
66
 
67
+ ## Goal
68
+ Operate OrbitMap correctly: always start from \`orbitmap context\`, act on the active mission
69
+ and open intents, write every item to the area the work belongs to, and go through the CLI
70
+ only — never the data files.
71
+
72
+ **Interface:** every action below is an OrbitMap operation — run the \`orbitmap\` CLI command
73
+ shown, or its equivalent MCP tool when this session uses MCP; \`orbitmap <cmd> --help\` and the
74
+ MCP tool schemas are the authority. Never edit the workspace data files directly.
75
+
43
76
  ## General behaviour
44
77
  - Always prioritise the user's direct request. If the user asks you to do something
45
78
  (read a file, write code, answer a question), handle that first.
@@ -57,11 +90,35 @@ never read or write the workspace's data files directly. The CLI is the only int
57
90
  - Entity numbers (TS-xxxxxx etc.) are accepted by every command that takes an id.
58
91
 
59
92
  ## Context
60
- - Area resolves automatically (config/env). Override per call with \`--area <slug>\`.
61
- - If a command fails asking for area context, run \`orbitmap areas\` to list areas, then
62
- retry with \`--area\`.
63
- - \`orbitmap context\` shows who you are, the workspace, and the active area. Run it when
64
- unsure.
93
+ - START HERE, always: \`orbitmap context\`. \`orbitmap context\` is authoritative and returns
94
+ in ONE call everything a session needs the agent, the workspace, the areas you work in,
95
+ the active mission, open intents, your tasks and the documents. Never list areas and never
96
+ ask the user "which area?" before you have read it.
97
+ - You work in a WORKSPACE, not inside a single area. Missions, intents
98
+ and documents are workspace-level and take no area — a document is exactly ONE copy,
99
+ global to the workspace, never per-area. Tasks, vibes, issues and ideas are
100
+ AREA-scoped.
101
+ - Missions and intents outrank individual tasks. Asked to work on "what matters", take the
102
+ active mission and open intents from context and pick work that serves them.
103
+ - The area follows from the directory, never from a question to the user:
104
+ \`.orbitmap/config.json\` maps directories → area slugs at the workspace root, and each
105
+ area directory carries its own \`.orbitmap/config.json\` marker naming its area. That
106
+ config is the only source of truth — never hard-code area names anywhere.
107
+ So: do area-scoped work from the directory it belongs to and let the CLI resolve it.
108
+ - \`--area <slug>\` is an OVERRIDE for a single call, not part of normal usage — reach for it
109
+ only to read or write outside the area the current directory resolves to.
110
+ - If a command fails with \`AREA_CONTEXT_REQUIRED\`, its details list the mapped
111
+ directories: cd into the right one, or retry with \`--area <slug>\`.
112
+ - WRITES: the resolved area is a default for *reading*, never a statement of where the
113
+ work belongs. Before creating anything area-scoped (task, subtask, issue, vibe),
114
+ derive the target area from the work itself (which repo/package it lives in) and pass
115
+ \`--area <slug>\` if that differs from the area the CLI echoes. If the work itself is
116
+ genuinely ambiguous, ASK THE USER; do not guess. There is no
117
+ \`move\` command: a write in the wrong area has to be recreated.
118
+ - Every write echoes its scope on stderr: \`creates in area <slug> (source: …)\` when it
119
+ creates an object, \`scoped to area <slug> (source: …)\` when it changes one by id. A
120
+ \`source\` of \`global ~/.orbitmap/config.json\` is a machine-wide leftover that nothing
121
+ here chose — treat it as unconfirmed and pass \`--area\` explicitly.
65
122
 
66
123
  ## Task statuses
67
124
  backlog, todo, in_progress, in_review, review_changes, done, blocked.
@@ -69,7 +126,8 @@ backlog, todo, in_progress, in_review, review_changes, done, blocked.
69
126
  \`orbitmap tasks --status backlog\` when the user asks about the backlog.
70
127
 
71
128
  ## Command reference (all commands accept --json)
72
- - Context: \`orbitmap context\`, \`orbitmap areas\`, \`orbitmap overview\`
129
+ - Context: \`orbitmap context\` (start here), \`orbitmap overview\`, \`orbitmap areas\`
130
+ (rarely needed — context already lists the areas you work in)
73
131
  - Tasks: \`orbitmap tasks [--status s1,s2]\`, \`orbitmap task TS-x\`, \`orbitmap get <ID>\`,
74
132
  \`orbitmap start [TS-x]\`, \`orbitmap status TS-x <status> [--delivery <d>]\`,
75
133
  \`orbitmap create "title" [--intent IN-x|--mission MS-x] [--priority p]\`,
@@ -87,155 +145,1016 @@ backlog, todo, in_progress, in_review, review_changes, done, blocked.
87
145
  - If OrbitMap is unreachable (network down / workspace directory unavailable), inform
88
146
  the user and continue the primary work without logging. Do NOT retry failed orbitmap
89
147
  calls in a loop — report the issue and proceed with the task.`;
90
- // ── Skill: orbitmap-working§8.4 ─────────────────────────────────────────────
91
- export const SKILL_WORKING_FRONTMATTER = `---
92
- name: orbitmap-working
148
+ // ── Skill: orbitmap-execute (v2 whole-intent orchestration + single-task flow) ──
149
+ export const SKILL_EXECUTE_FRONTMATTER = `---
150
+ name: orbitmap-execute
93
151
  description: >
94
- Working on OrbitMap tasks: starting/resuming, logging work, decisions and blockers,
95
- finishing with the correct status, git branches and delivery status. Use whenever
96
- implementing, resuming, or finishing a tracked task.
152
+ Executing OrbitMap work the fourth gate of the product-building flow. Two flows:
153
+ "execute IN-x" delivers a whole planned intent in the background (parallel worker
154
+ waves, per-task tests, the intent test, an impact pass against a baseline, a
155
+ goal-based fix loop, everything ending in_review on an intent branch — merging stays
156
+ the user's), and "work on TS-x" runs a single tracked task (starting/resuming,
157
+ logging, finishing with the correct status, git branches and delivery status). Use
158
+ whenever executing a planned intent or implementing, resuming, or finishing a
159
+ tracked task.
97
160
  ---`;
98
- export const SKILL_WORKING_BODY = `# Working on OrbitMap tasks
161
+ export const SKILL_EXECUTE_BODY = `# Executing OrbitMap work
99
162
 
100
- ## Task workflow (on user request)
101
- When the user asks you to work on tasks:
102
- 1. \`orbitmap tasks --status in_progress\` check for unfinished work.
103
- 2. If found \`orbitmap task TS-x\` read the work log resume from the resume point.
104
- 3. If not \`orbitmap start\` auto-picks the first todo task, sets it in_progress and
105
- prints full context (description, agent_instructions, logs).
106
- 4. If no tasks → inform the user.
107
- Use \`orbitmap start TS-x\` to begin a specific task; \`orbitmap task TS-x\` only inspects.
163
+ ## Goal
164
+ Deliver work and leave Orb an accurate record. Flow A takes a PLANNED intent to delivered:
165
+ every task built and tested, the intent test and an impact pass green against a pre-run
166
+ baseline, all tasks \`in_review\` on an intent branch merging and closing stay the user's.
167
+ Flow B takes ONE tracked task from start to a correct finish. Both end with the right
168
+ statuses, delivery and worklog so the next agent can resume.
108
169
 
109
- ## Rules
110
- - Work on ONE task at a time.
111
- - Always read agent_instructions from the task before implementing. Task-level
112
- agent_instructions take precedence over area-level instructions.
113
- - Only work on subtasks assigned to you; do not pick up other agents' subtasks.
114
- - Do NOT mark a parent task done while it has unfinished subtasks, unless the user
115
- explicitly asks.
116
-
117
- ## Logging
170
+ **Interface:** every action below is an OrbitMap operation — run the \`orbitmap\` CLI command
171
+ shown, or its equivalent MCP tool when this session uses MCP; \`orbitmap <cmd> --help\` and the
172
+ MCP tool schemas are the authority. Never edit the workspace data files directly.
173
+
174
+ ## Choosing a flow
175
+ - "execute IN-x", "deliver this intent", "run the plan" **Flow A** (orchestration).
176
+ - "work on TS-x", "start a task", a vague "work on what's important" → **Flow B**.
177
+ - Flow A dispatches workers that follow \`references/worker-contract.md\` (shipped next to
178
+ this file) — a worker reads that contract, not this skill.
179
+
180
+ ## Key principles
181
+ - **The contract is the outcome, not a checklist.** The run works as long as needed to
182
+ deliver the intent with all gates green — never "tried N times, giving up".
183
+ - **Autonomy: decide and log.** A judgment call within the design → decide, keep going,
184
+ log it if it passes the keep/drop test. A stuck task → \`blocked\` with a logged blocker
185
+ while the REST of the intent continues. Interrupt the user ONLY for intent-level risk: a
186
+ design contradiction, an unfixable intent test. Never a silent skip; never the whole run
187
+ dying for one task.
188
+ - **No new bugs, checkably.** Capture a test BASELINE before touching anything. A
189
+ regression is a failure NOT in the baseline — pre-existing failures/flakes are neither
190
+ blamed on the run nor silently counted green. What the run broke, the run fixes.
191
+ - **Merging is human.** The run holds commit authority only — never merge, never push to
192
+ the default branch, never close tasks or the intent as \`done\`. The branch is the user's
193
+ review boundary.
194
+ - **Distrust and verify.** Instructions age; the tree is the truth. Re-grep any claim a
195
+ task's instructions make about the code ("X lives in Y", "verified list of call sites")
196
+ before relying on it.
197
+ - **The orchestrator owns shared state.** Workers never run git, never write OrbitMap,
198
+ never use the shared test DB, never format, never change dependencies — commits, logs,
199
+ statuses, formatting and test gates all happen at fold time, in the orchestrator.
200
+ - **Never end the run to wait.** Shared gates QUEUE safely: run them in the foreground
201
+ and wait on the command (generous timeout); an overrun that gets backgrounded resumes
202
+ you on completion. Ending your turn is only for: run COMPLETE, or hard-blocked and
203
+ logged — a background run that yields to "wait for a signal" is a dead run.
204
+
205
+ ## Flow A — execute IN-x (whole intent)
206
+ 1. **Premise check.** \`orbitmap intent show IN-x\`: it must exist, be at status \`build\`,
207
+ and have tasks with agent_instructions. Anything missing → refuse politely and point at
208
+ the missing gate (\`orbitmap-brainstorm\` for no outcome, \`orbitmap-design\` for no
209
+ design, \`orbitmap-plan\` for no tasks). Read the outcome, design, plan field and work
210
+ log in full — they are the run's spec.
211
+ 2. **Repos & baseline.** The touched repos follow from the tasks' areas — an intent may
212
+ span several. Resolve each area to a directory in this order: the workspace's mapped
213
+ directories (\`orbitmap context\` / \`.orbitmap/config.json\`), the workspace or repo
214
+ CLAUDE.md (repo tables), the area's own description (\`orbitmap areas\` — descriptions
215
+ often name the repo). NEVER guess a directory: an unmappable area blocks its tasks and
216
+ their dependents, logged, while the rest of the run continues. Each repo's BASE branch
217
+ is where its work lands per the workspace docs (e.g. develop); undocumented → the
218
+ repo's current default branch, decide-and-log. Then run each touched repo's full gate
219
+ once; record suite counts and every pre-existing failure/flake. Reuse a baseline when
220
+ the repo's HEAD already has a green result recorded this session. A gate that cannot
221
+ COMPLETE (a pre-existing hang) is itself a finding: register it as an issue, then
222
+ baseline by subsets so every suite is still covered, and compare like with like.
223
+ 3. **Branch.** In each touched repo, create \`intent/<IN-number>-<name-slug>\` (e.g.
224
+ \`intent/7bcc4y-execute-skill-v2\`) from its base branch (step 2). Honor a task's own
225
+ \`branch_name\` only when that task genuinely needs isolation.
226
+ 4. **Wave loop** — repeat while runnable tasks remain:
227
+ - Ready-set: unstarted tasks whose dependencies are all folded; \`blocked\` tasks and
228
+ tasks depending on them drop out (log a blocker on those left unrunnable).
229
+ - Size the wave by GATE CONTENTION, not a constant: tasks needing the shared test DB
230
+ ≤4 concurrent (the gate serialises anyway); light, file-disjoint tasks (docs,
231
+ separate repos) as wide as the ready-set — 10+ is fine.
232
+ - Dispatch one worker (subagent) per task. Prompt = the task number, its
233
+ agent_instructions PASTED VERBATIM (workers get no CLI credentials — never make one
234
+ fetch its own spec), the repo path, the exact files it owns, and one line: "Follow
235
+ references/worker-contract.md of the orbitmap-execute skill." Worktree isolation
236
+ ONLY when same-repo tasks in the wave overlap on files; otherwise slice the wave
237
+ file-disjoint in one tree; cross-repo needs nothing.
238
+ - FOLD the workers' results sequentially in dependency order, a gate between folds:
239
+ integrate one task → scoped tests → formatter → commit \`[TS-x] …\` (one commit may
240
+ carry several tasks that verify as one unit) → log per the keep/drop test →
241
+ \`orbitmap status TS-x in_review --delivery on_branch\`.
242
+ - A task neither the worker nor the fold can save → \`orbitmap log TS-x "Blocked: …"
243
+ --type blocker\` + \`orbitmap status TS-x blocked\` — the run CONTINUES without it.
244
+ Its dependents leave the ready-set with their own logged blocker but KEEP their
245
+ status (backlog): they are waiting, not failed.
246
+ - Recompute the ready-set; next wave.
247
+ 5. **Intent test.** The plan gate guarantees an intent-level test task; run it LAST —
248
+ and run it AS THE ORCHESTRATOR, never a worker: it needs the shared gates and the
249
+ live app, exactly what the worker contract forbids workers.
250
+ 6. **Impact pass.** Full gate per touched repo, diffed against the baseline — a regression
251
+ is a failure not in the baseline. When an API response shape moved, also run the
252
+ contract-coupling steps (regenerate the committed spec, refresh the consumer's vendored
253
+ fixtures) before judging the gates.
254
+ 7. **Fix loop.** Every regression or intent-test failure → a fix, gated by scoped tests;
255
+ after the LAST fix the full pass runs again. NO round cap — loop until every task is
256
+ delivered or honestly blocked and the gates are green vs baseline. An unfixable intent
257
+ test or a design contradiction → STOP and ask the user: that is intent-level risk, the
258
+ one thing that interrupts.
259
+ 8. **Report + resume note.** Leave every repo checked out on its BASE branch — the
260
+ intent branch is named in the report, not left underfoot. Report in chat: what
261
+ shipped, what was decided, what is blocked and why, deviations from the plan, gate
262
+ results vs baseline. Write ONE resume
263
+ point: \`orbitmap log IN-x "Resume point: …" --type note\`. The intent STAYS \`build\`;
264
+ merging and closing are the USER'S. The merge EVENT — whoever performs it — is what
265
+ later flips the tasks to \`--delivery merged\`.
266
+
267
+ **No subagent runtime?** Same flow, serial: do steps 4–7 yourself, task by task, with the
268
+ worker contract as your own build rules. The contract is the outcome, not the parallelism.
269
+
270
+ ## Process flow (Flow A)
271
+ \`\`\`dot
272
+ digraph orbitmap_execute {
273
+ "Premise: intent at build, tasks with instructions?" [shape=diamond];
274
+ "Refuse politely; point at the missing gate" [shape=box];
275
+ "Baseline: full gate per touched repo, results recorded" [shape=box];
276
+ "Branch intent/<number>-<slug> per touched repo" [shape=box];
277
+ "Compute ready-set from dependency edges" [shape=box];
278
+ "Size wave by gate contention; dispatch workers (worktrees only on file overlap)" [shape=box];
279
+ "Fold sequentially, gate between folds: scoped tests, format, commit [TS-x], log, in_review on_branch" [shape=box];
280
+ "Stuck task: blocked + logged blocker; run continues" [shape=box];
281
+ "Runnable tasks remain?" [shape=diamond];
282
+ "Run the intent test task (last)" [shape=box];
283
+ "Impact pass: full gate per repo, diff vs baseline (+contract steps)" [shape=box];
284
+ "Regressions or intent-test failures?" [shape=diamond];
285
+ "Fix findings, scoped tests per fix" [shape=box];
286
+ "Intent-level risk: stop and ask the user" [shape=box];
287
+ "Report + resume note; intent stays build; user merges" [shape=doublecircle];
288
+
289
+ "Premise: intent at build, tasks with instructions?" -> "Refuse politely; point at the missing gate" [label="no"];
290
+ "Premise: intent at build, tasks with instructions?" -> "Baseline: full gate per touched repo, results recorded" [label="yes"];
291
+ "Baseline: full gate per touched repo, results recorded" -> "Branch intent/<number>-<slug> per touched repo";
292
+ "Branch intent/<number>-<slug> per touched repo" -> "Compute ready-set from dependency edges";
293
+ "Compute ready-set from dependency edges" -> "Size wave by gate contention; dispatch workers (worktrees only on file overlap)";
294
+ "Size wave by gate contention; dispatch workers (worktrees only on file overlap)" -> "Fold sequentially, gate between folds: scoped tests, format, commit [TS-x], log, in_review on_branch";
295
+ "Size wave by gate contention; dispatch workers (worktrees only on file overlap)" -> "Stuck task: blocked + logged blocker; run continues" [label="worker stuck"];
296
+ "Stuck task: blocked + logged blocker; run continues" -> "Runnable tasks remain?";
297
+ "Fold sequentially, gate between folds: scoped tests, format, commit [TS-x], log, in_review on_branch" -> "Runnable tasks remain?";
298
+ "Runnable tasks remain?" -> "Compute ready-set from dependency edges" [label="yes"];
299
+ "Runnable tasks remain?" -> "Run the intent test task (last)" [label="no"];
300
+ "Run the intent test task (last)" -> "Impact pass: full gate per repo, diff vs baseline (+contract steps)";
301
+ "Impact pass: full gate per repo, diff vs baseline (+contract steps)" -> "Regressions or intent-test failures?";
302
+ "Regressions or intent-test failures?" -> "Fix findings, scoped tests per fix" [label="yes"];
303
+ "Fix findings, scoped tests per fix" -> "Impact pass: full gate per repo, diff vs baseline (+contract steps)" [label="re-run"];
304
+ "Fix findings, scoped tests per fix" -> "Intent-level risk: stop and ask the user" [label="unfixable / contradiction"];
305
+ "Regressions or intent-test failures?" -> "Report + resume note; intent stays build; user merges" [label="no"];
306
+ }
307
+ \`\`\`
308
+
309
+ ## Flow B — work on TS-x (single task)
310
+ 1. \`orbitmap context\` — workspace, areas, active mission, open intents and your tasks in
311
+ one call. Never ask which area; never list areas first.
312
+ 2. Unfinished work in context (or \`orbitmap tasks --status in_progress\`) →
313
+ \`orbitmap task TS-x\` → read the work log → resume from the resume point.
314
+ 3. Otherwise pick work serving the active mission / open intents, or \`orbitmap start\` —
315
+ auto-picks the first todo task, sets it in_progress and prints full context.
316
+ \`orbitmap start TS-x\` begins a specific task; \`orbitmap task TS-x\` only inspects.
317
+ Nothing to pick up → inform the user.
318
+ 4. Read agent_instructions before implementing — task-level overrides area-level — then
319
+ distrust-and-verify their claims against the tree.
320
+ 5. Work on ONE task at a time. Implement, run the task's tests, commit \`[TS-x] …\`.
321
+ 6. Log as you work (below); finish per "End of session or task".
322
+
323
+ ## Logging (both flows)
118
324
  - \`orbitmap log TS-x "…" --type note|code_change|decision|blocker\` — work WITHIN a task.
119
325
  - \`orbitmap vibe log "…" --type discovery|exploration|fix\` — ad-hoc work outside a task.
120
- - Use \`--type decision\` when you pick between approaches, reject an alternative, or lock
121
- in a non-obvious assumption — record the choice AND the why, not just the outcome.
122
326
  - \`orbitmap idea add\` — future possibilities, NOT problems (problems →
123
327
  \`orbitmap issue register\`).
124
- - Keep log content concrete, concise, and useful for someone resuming work later.
328
+ - \`note\` is the CATCH-ALL: anything useful that is not a \`code_change\`, \`decision\` or
329
+ \`blocker\` goes in as \`note\`, with \`--meta\` carrying any unusual structure. There is
330
+ deliberately NO \`other\` type. NEVER write \`status_change\` — the server authors it on
331
+ every transition and the API rejects it from clients.
332
+ - KEEP/DROP TEST — log a \`decision\` when ANY of these is true: an alternative was
333
+ considered and REJECTED (record which, and why it lost); a non-obvious assumption or
334
+ constraint was LOCKED IN; a choice was made that a later reader would otherwise
335
+ re-litigate. Do NOT log: restating the outcome, design or plan (they are already
336
+ fields on the intent); confirming something already written down elsewhere; mechanical
337
+ facts recoverable from git, CI or the tracker (test counts, file lists, commit hashes);
338
+ progress narration ("started X", "working on Y").
339
+ KEEP → "Parallelised the build across four subagents; the Laravel slices were split by
340
+ file ownership to avoid collisions in one working tree." — records the rejected
341
+ alternative (one agent per repo) and why it lost.
342
+ DROP → "make verify green at 2415 passed after merging all four agents." — a mechanical
343
+ fact already in the commit message and the CI output.
344
+ - Promote to the parent intent — TWO filters, BOTH must pass: the entry is a \`decision\` or
345
+ \`blocker\` (never \`note\`/\`code_change\`), AND it passes the keep/drop test. Then ALSO
346
+ write a SECOND, separately-worded entry for a reader who never saw the task:
347
+ \`orbitmap log IN-x "<the decision and why>" --type decision --meta
348
+ '{"source":{"type":"task","id":"<task-uuid>"}}'\` (fall back to the TS- number if you
349
+ lack the UUID). Two distinct entries, never one shared row.
125
350
 
126
351
  ## End of session or task — MANDATORY
127
352
  - Task finished → default to **in_review** so a human verifies before closing:
128
353
  \`orbitmap log TS-x "Ready for review: …" --type note\` then
129
- \`orbitmap status TS-x in_review\`.
354
+ \`orbitmap status TS-x in_review\` (add \`--delivery on_branch\` when code was committed).
130
355
  - Task finished AND the user's prompt or the task's agent_instructions explicitly say to
131
- close without review → \`orbitmap log TS-x "Summary: …" --type note\` then
132
- \`orbitmap status TS-x done\`.
133
- - Blocked by an external dependency you cannot resolve (waiting on another task, missing
134
- access/credentials, unclear requirements, failing external service)
135
- \`orbitmap log TS-x "Blocked: <reason>" --type blocker\` then
136
- \`orbitmap status TS-x blocked\`.
137
- - Session ending, task not done but NOT blocked → \`orbitmap log TS-x "Resume point: …"
356
+ close without review → log a summary \`note\`, then \`orbitmap status TS-x done\`.
357
+ - Blocked by something outside your control → \`orbitmap log TS-x "Blocked: <reason>"
358
+ --type blocker\` then \`orbitmap status TS-x blocked\`.
359
+ - Session ending, task unfinished but NOT blocked \`orbitmap log TS-x "Resume point: …"
138
360
  --type note\` — leave status in_progress.
139
361
  - NEVER leave a task without a final log entry.
362
+ - Closing the intent (ONLY when the user explicitly asks — Flow A never does) → the
363
+ transition must carry the build phase's entries (\`--log <type>:<content>\` is
364
+ repeatable): \`orbitmap intent update IN-x --status done --log code_change:"<what was
365
+ built>" --log note:"<what remains>"\`. A transition carrying no \`--log\` is REFUSED (422)
366
+ and writes nothing at all.
140
367
 
141
368
  ### Status decision guide
142
- - **in_review**: work is finished. THE DEFAULT for completed work. The requester should
143
- verify before closing.
144
- - **done**: only when the prompt or task agent_instructions explicitly allow closing
145
- without review ("auto-close", "mark as done", "no review needed"). A user saying "do
146
- this task" is NOT permission to auto-close.
147
- - **blocked**: an external factor outside your control stops you. Always log the
148
- specific blocker.
369
+ - **in_review**: work finished. THE DEFAULT the requester verifies before closing.
370
+ - **done**: only when the prompt or agent_instructions explicitly allow closing without
371
+ review. "Do this task" is NOT permission to auto-close.
372
+ - **blocked**: an external factor stops you. Always log the specific blocker.
149
373
  - **in_progress** (keep): session ends but you can resume autonomously next time.
150
374
 
151
- ## Git workflow
152
- - When the task context contains a branch_name, create or switch to it:
153
- \`git checkout -b <branch_name>\` (or \`git checkout <branch_name>\` if it exists).
154
- - If the task has NO branch_name, work on the current branch — do not create one.
155
- - Do NOT work directly on main/master/develop unless the task has no branch_name and you
156
- are already on a feature branch.
157
-
158
- ## Delivery flow
375
+ ## Git & delivery
376
+ - Flow B: when the task context carries a \`branch_name\`, create or switch to it; without
377
+ one, stay on the current branch and never work directly on main/master/develop.
159
378
  - Commit messages: prefix the entity number with its type tag —
160
379
  \`[TS-r5d8zf] Add delivery status field\` (also \`[IS-…]\`, \`[ID-…]\`, \`[VB-…]\`).
161
- - When you committed/pushed code during the task, finish with
162
- \`orbitmap status TS-x <status> --delivery on_branch\`.
163
- - When the user asks what's in a branch/PR: \`git log target..source --oneline\`, parse
164
- \`[TS-…]\`/\`[IS-…]\` tags, report the matched entities.
165
- - When the user reports a merge or release: update the relevant tasks with
166
- \`--delivery merged\` or \`--delivery released\`.
167
-
168
- ## Planning mode (agents with a plan mode)
169
- When you create an implementation plan for a tracked task, you MUST include OrbitMap
170
- lifecycle steps as explicit plan items:
171
- - First step: reference the OrbitMap task number and title.
172
- - Last steps, always: (1) \`orbitmap log\` with a summary of all changes; (2)
173
- \`orbitmap status\` set per the status decision guide (or a resume-point log if
174
- incomplete).
175
-
176
- ## Example: completing a task (default in_review)
177
- 1. \`orbitmap tasks --status in_progress\` empty
178
- 2. \`orbitmap start\` task context
179
- 3. read agent_instructions; implement; run tests; commit with \`[TS-x]\` prefix
180
- 4. \`orbitmap log TS-x "Implemented X by doing Y" --type code_change\`
181
- 5. \`orbitmap log TS-x "Ready for review: all tests pass." --type note\`
182
- 6. \`orbitmap status TS-x in_review --delivery on_branch\``;
183
- // ── Skill: orbitmap-planning §8.5 ────────────────────────────────────────────
184
- export const SKILL_PLANNING_FRONTMATTER = `---
185
- name: orbitmap-planning
380
+ - Committed/pushed code during a task finish with \`--delivery on_branch\`.
381
+ - Asked what's in a branch/PR: \`git log target..source --oneline\`, parse the \`[TS-…]\`
382
+ tags, report the matched entities.
383
+ - The delivery status follows the merge/release EVENT, whoever performs it: on a merge
384
+ update the affected tasks with \`--delivery merged\`; on a release, \`--delivery released\`.
385
+
386
+ ## Rules
387
+ - Flow A never merges, never pushes to the default branch, never closes tasks or the
388
+ intent as \`done\` the run ends at \`in_review\` on the intent branch, intent at \`build\`.
389
+ - Baseline before any change; "no new bugs" = no failure absent from the baseline.
390
+ - The fix loop is goal-based no round cap; termination is delivered-or-blocked plus
391
+ green gates, never a retry budget.
392
+ - Decide-and-log within the design; \`blocked\` + continue for a stuck task; interrupt the
393
+ user only for intent-level risk. Never a silent skip.
394
+ - Workers follow \`references/worker-contract.md\`: no git, no OrbitMap writes, no shared
395
+ test DB, no formatter, no dependency changes — the orchestrator owns all of those.
396
+ - Flow B works on ONE task at a time.
397
+ - Always read agent_instructions before implementing, then re-verify their claims against
398
+ the tree (distrust-and-verify).
399
+ - Agents with a plan mode: an implementation plan for a tracked task MUST include the
400
+ lifecycle as explicit steps first the task number/title, last the final \`orbitmap log\`
401
+ + \`orbitmap status\` per the status decision guide.
402
+ - NEVER leave a task without a final log entry; never author \`status_change\`; an intent
403
+ transition without \`--log\` entries is refused (422).`;
404
+ // Reference files shipped WITH the orbitmap-execute skill (the worker contract that
405
+ // dispatched subagents read instead of the whole skill). See SkillDef.references for
406
+ // the shape the installer consumes.
407
+ export const SKILL_EXECUTE_REFERENCES = {
408
+ 'references/worker-contract.md': `# Worker contract — building one task for the orchestrator
409
+
410
+ You are a WORKER: a subagent dispatched by an orchestrator running the \`orbitmap-execute\`
411
+ skill. You build exactly ONE task. The orchestrator owns everything shared — git, OrbitMap
412
+ state, formatting, the test gates. Your job is the code and an honest report.
413
+
414
+ ## Read, then verify
415
+ - Read your task verbatim: \`orbitmap task TS-x\` (read-only). Its agent_instructions are
416
+ your spec; task-level instructions override area-level ones.
417
+ - DISTRUST AND VERIFY: re-grep every claim the instructions make about the tree ("X lives
418
+ in Y", "the verified list of call sites") before relying on it. Instructions age; the
419
+ tree is the truth. A claim that does not hold is a DEVIATION to report — adapt to the
420
+ real tree and say so; do not build on the false claim.
421
+
422
+ ## Boundaries — hard
423
+ - Own ONLY the files named in your dispatch prompt. A change needed elsewhere is a
424
+ finding to report, never an edit to make.
425
+ - NEVER run git — no commit, branch, stash, checkout. The orchestrator commits.
426
+ - NEVER write OrbitMap state — no \`orbitmap log\` / \`status\` / \`create\` / \`update\`.
427
+ Reading (\`orbitmap task\`, \`orbitmap doc\`) is fine.
428
+ - NEVER use the shared test DB or its Docker gate — parallel workers would collide on it.
429
+ The orchestrator runs those tests at fold time.
430
+ - NEVER run the repo formatter (it rewrites files you do not own) and NEVER change
431
+ dependencies or lockfiles. Report the need instead.
432
+
433
+ ## Build
434
+ - Implement within your file boundary, following the instructions and the repo's
435
+ conventions.
436
+ - Write the task's TESTS as instructed — they gate your task at fold time.
437
+ - Syntax-check everything you touch with cheap, isolated checks (\`php -l\`, \`tsc --noEmit\`,
438
+ \`python -m py_compile\`, a scoped non-shared test run) — never the shared gates.
439
+
440
+ ## Report — your final text goes to the orchestrator, not to a user
441
+ Structure it as:
442
+ - **Files changed** — every file, one line each on what changed and why.
443
+ - **Deviations** — every departure from the instructions (including claims that did not
444
+ survive verification), and why.
445
+ - **Out-of-scope findings** — bugs or risks outside your boundary: REPORT, never fix.
446
+ - **Uncertainties** — anything you are not sure holds. Flagged beats hidden: the
447
+ orchestrator can check in seconds what a silent guess costs in hours.
448
+ Plain and factual — the orchestrator folds, tests and commits from this report.`,
449
+ };
450
+ // ── Skill: orbitmap-plan — §8.5 ────────────────────────────────────────────
451
+ export const SKILL_PLAN_FRONTMATTER = `---
452
+ name: orbitmap-plan
186
453
  description: >
187
- Planning with OrbitMap: missions (time-boxed focus), intents (goals grouping work),
188
- promoting ideas to tasks, triaging issues, decomposing work into tasks and subtasks.
189
- Use for "plan", "roadmap", "mission", "intent", "break this down", idea or issue
190
- triage requests.
454
+ Planning an intent's design into executable tasks in OrbitMap the third gate of the
455
+ product-building flow (after design). Decomposes the agreed design into Orb-hierarchy
456
+ tasks that provably cover the intent: tests per task + an intent-level test, a coverage
457
+ hard-gate, correct-area placement, self-contained context/doc-grounded agent_instructions,
458
+ cross-task notes in the intent plan field, and a doc-update-after-green step; then creates
459
+ the tasks and hands off to orbitmap-execute. Use for "plan this intent", "break this down
460
+ into tasks", an intent entering \`plan\` status — and for general planning (missions,
461
+ intents, promoting ideas, triaging issues).
191
462
  ---`;
192
- export const SKILL_PLANNING_BODY = `# Planning in OrbitMap
463
+ export const SKILL_PLAN_BODY = `# Planning a design into executable tasks
464
+
465
+ ## Goal
466
+ Produce the intent's PLAN — a validated set of executable Orb tasks (with tests and
467
+ dependencies) that fully covers the design — and create those tasks. The task set plus the
468
+ plan-field notes are this gate's one deliverable.
469
+
470
+ **Interface:** every action below is an OrbitMap operation — run the \`orbitmap\` CLI command
471
+ shown, or its equivalent MCP tool when this session uses MCP; \`orbitmap <cmd> --help\` and the
472
+ MCP tool schemas are the authority. Never edit the workspace data files directly.
473
+
474
+ ## The outcome is the north star; the design is its communication form
475
+ The tasks you plan exist to REALISE the intent's OUTCOME — the outcome is the north star,
476
+ the direction everything heads toward. The design is NOT the end; it is the agreed
477
+ communication form that expresses HOW the outcome gets built. So plan against the design,
478
+ but keep the outcome as the test: every task, and the plan as a whole, must move the
479
+ outcome closer — and if the design and the outcome ever disagree, the OUTCOME wins; surface
480
+ the gap rather than planning to a design that misses it. Read the outcome AND the design
481
+ first; every task traces back to both. If the design is missing or too thin to plan against
482
+ (the intent has not been through the design gate), STOP and step aside to \`orbitmap-design\`
483
+ — do not decompose an unsettled design.
484
+
485
+ ## The plan field may hold seed notes
486
+ The intent's \`plan\` field may already carry seed notes — build-order, task ideas and
487
+ execution risks that the \`orbitmap-brainstorm\` gate (or the user) filed there earlier. If
488
+ it does, read them FIRST and treat them as your HIGHEST-PRIORITY input: the USER-marked
489
+ notes outrank your own ideas and any agent notes. Absorb them into the plan you build, then
490
+ let your finished plan-field write REPLACE them (absorb, then replace). If the field already
491
+ holds a real plan (notes + summary) instead of seed notes, treat it as an existing plan to
492
+ refine.
493
+
494
+ ## Key principles
495
+ - **Cover the whole design.** The plan is complete only when every part of the design maps
496
+ to at least one task and the task set, executed, delivers the outcome. Under-coverage is
497
+ the main failure mode — the coverage check is a HARD GATE, not a nicety.
498
+ - **Every task is testable, and the intent is tested.** Each task carries its own tests;
499
+ the intent gets ONE test that proves the whole outcome.
500
+ - **Every task is self-contained.** A fresh execute-agent with ZERO prior context must
501
+ succeed from the task alone — so its \`agent_instructions\` carry the task's own summary,
502
+ the Orb context and doc pointers it needs, and its acceptance/tests.
503
+ - **Flat tasks, no subtasks.** Decompose into a flat list of tasks; this gate does NOT use
504
+ subtasks. Express structure through dependencies, not nesting.
505
+ - **Dependencies live in two places.** Wire the Orb dependency EDGE (\`orbitmap dep add\`) so
506
+ \`orbitmap-execute\` can compute the ready-set and order/parallelise work — AND name the
507
+ blocker and WHY inside the dependent task's own instructions ("depends on TS-x: needs the
508
+ schema it produces"), so a zero-context agent sees it without querying the graph.
509
+ - **Right area.** Derive each task's area from the work itself (which repo/package), not
510
+ from where you happen to be; pass \`--area <slug>\` when it differs.
511
+ - **Ground in verified reality.** Read the design, the relevant doc bodies and the repo
512
+ before decomposing — never plan against a stale or assumed state.
513
+ - **Know the neighbourhood.** Reuse or extend the intent's EXISTING tasks — never silently
514
+ re-decompose work that already exists.
515
+ - **One question at a time; ask sparingly; prefer multiple choice.** When you must ask,
516
+ offer enumerable options with a recommended default; open questions are a last resort.
193
517
 
194
518
  ## Hierarchy
195
519
  Mission (MS-) → Intent (IN-) → Task (TS-) / Issue (IS-). Missions and intents are
196
- workspace-level; tasks live in areas. An intent groups the tasks/issues that realise one
197
- goal; a mission time-boxes a set of intents (and directly-attached items) toward an
198
- outcome. At most ONE mission is active at a time.
199
-
200
- ## Missions
201
- - \`orbitmap mission list\` / \`orbitmap mission show MS-x\`
202
- - \`orbitmap mission create "name" [--outcome "…"] [--start d] [--end d]\`
203
- - \`orbitmap mission status MS-x active|completed|cancelled\` — activating fails while
204
- another mission is active; complete or cancel it first.
205
- - \`orbitmap mission link MS-x IN-y|TS-y|IS-y|ID-y\` / \`mission unlink\` attach items.
206
-
207
- ## Intents
208
- - \`orbitmap intent create "name" [--mission MS-x]\`, statuses:
209
- new design plan build done (or cancelled); update with
210
- \`orbitmap intent update IN-x --status build\`.
211
- - \`orbitmap intent link IN-x TS-y|IS-y\` attaches work items to the intent.
212
- - RULE (intent-exclusive): an item linked to an intent gets its mission THROUGH the
213
- intent never set a direct mission on a task/issue that has an intent. The CLI
214
- enforces this; do not fight it.
215
-
216
- ## Planning workflow (recommended when the user asks to plan a body of work)
217
- 1. Clarify the outcome \`orbitmap mission create\` (or pick the active mission).
218
- 2. Split into goals \`orbitmap intent create\` per goal, \`mission link\` them.
219
- 3. Decompose each intent into concrete tasks
220
- \`orbitmap create "title" --intent IN-x [--priority p]\`, subtasks via
221
- \`orbitmap subtask\`.
222
- 4. Wire ordering constraints \`orbitmap dep add TS-a TS-b\` (a depends on b).
223
- 5. Review: \`orbitmap mission show MS-x\` and \`orbitmap overview\`.
224
-
225
- ## Ideas (opportunities, not problems)
226
- - Capture: \`orbitmap idea add "…" [--priority p]\`.
227
- - Review: \`orbitmap idea list\` (default pending).
228
- - Promote to work: analyse the codebase first, then \`orbitmap create "task title"
229
- --intent …\` referencing the idea in the description, then
230
- \`orbitmap idea status ID-x used\`. Reject with \`… rejected\`.
231
-
232
- ## Issues (problems)
233
- - Report: \`orbitmap issue register "title" --severity critical|high|medium|low
234
- [--description "…"]\`.
235
- - Start investigating: \`orbitmap issue status IS-x investigating\`.
236
- - Convert to work: \`orbitmap create\` a fix task, link it, and resolve with
237
- \`orbitmap issue resolve IS-x --task TS-y --resolution "…"\` (or status wont_fix /
238
- duplicate with a reason).`;
520
+ workspace-level and take no area; tasks and issues are area-scoped. An intent groups the
521
+ tasks/issues that realise one goal; a mission time-boxes a set of intents toward an
522
+ outcome. At most ONE mission is active at a time. RULE (intent-exclusive): an item linked
523
+ to an intent gets its mission THROUGH the intent — never set a direct mission on a
524
+ task/issue that has an intent; the CLI enforces this.
525
+
526
+ ## Dependencies
527
+ - **Two layers, always.** The Orb dependency EDGE (\`orbitmap dep add TS-a TS-b\` — a
528
+ depends on b) is machine-readable, so \`orbitmap-execute\` computes the ready-set, orders
529
+ work, and runs independent tasks in parallel. The one-line "depends on TS-x: <why>" in
530
+ the dependent task's \`agent_instructions\` is what a zero-context agent reads without
531
+ querying the graph. Do both for every dependency.
532
+ - **Only REAL blockers.** Add an edge only when a task genuinely cannot start until another
533
+ is done it needs that task's output (a schema, an interface, a bumped contract). Never
534
+ encode mere preference or "feels tidier" ordering: false dependencies serialise work that
535
+ could have run in parallel.
536
+ - **Depend on the smallest thing.** If a task needs just one artifact from its predecessor,
537
+ say exactly that in the note; do not over-couple whole tasks when one output suffices.
538
+ - **Keep the DAG shallow and wide.** Prefer many independent tasks over a long chain — a
539
+ deep chain forces serial execution and slows the whole intent. Split or re-cut to widen
540
+ where the design allows.
541
+ - **At least one ready task.** Some task must have NO dependencies — that is where execution
542
+ starts. A plan where everything depends on something else cannot begin; re-cut it.
543
+ - **No cycles.** If A depends on B and B on A, the task boundaries are wrong — re-cut them.
544
+ - **Cross-area dependencies are first-class.** Provider-before-consumer across repos (e.g. a
545
+ contract/schema change in one area before the tasks that re-vendor it in others) is a real
546
+ edge wire it even though the tasks live in different areas.
547
+
548
+ ## Flow
549
+ 1. Gather context. Read the intent's \`outcome\` + \`design\` + \`plan\` field
550
+ (\`orbitmap intent show IN-x\`) if the plan field holds seed notes, absorb them as
551
+ highest-priority input (see above); \`orbitmap context\`; the relevant doc BODIES (\`orbitmap doc <slug>\` — the design flagged
552
+ which); the neighbourhood (mission, sibling intents, and the intent's EXISTING tasks
553
+ do not re-decompose them). Verify against the repo before decomposing.
554
+ 2. Decompose the design into a FLAT list of concrete tasks, each placed in the CORRECT
555
+ area — \`orbitmap create "title" --intent IN-x --area <slug> [--priority p]\`. No
556
+ subtasks.
557
+ - KEEP/DROP TEST — log a \`decision\` when ANY of these is true: an alternative was
558
+ considered and REJECTED (record which, and why it lost); a non-obvious assumption or
559
+ constraint was LOCKED IN; a choice was made that a later reader would otherwise
560
+ re-litigate. Do NOT log: restating the outcome, design or plan (they are already
561
+ fields on the intent); confirming something already written down elsewhere; mechanical
562
+ facts recoverable from git, CI or the tracker (test counts, file lists, commit hashes);
563
+ progress narration ("started X", "working on Y").
564
+ KEEP → "Parallelised the build across four subagents; the Laravel slices were split by
565
+ file ownership to avoid collisions in one working tree." — records the rejected
566
+ alternative (one agent per repo) and why it lost.
567
+ DROP → "make verify green at 2415 passed after merging all four agents." — a mechanical
568
+ fact already in the commit message and the CI output.
569
+ - LOG IT THE MOMENT IT IS AGREED, not batched at the end:
570
+ \`orbitmap log IN-x "<the decision and why — task shape, sequencing, area>" --type decision\`.
571
+ An abandoned session must still leave its decisions recorded.
572
+ - Progress stops (a design gap you cannot close, a missing prerequisite) →
573
+ \`orbitmap log IN-x "Blocked: <what stopped and why>" --type blocker\`.
574
+ - \`note\` is the CATCH-ALL — anything useful that is not \`code_change\` / \`decision\` /
575
+ \`blocker\` goes in as \`note\`, with \`--meta\` for unusual structure. There is deliberately
576
+ NO \`other\` type. NEVER write \`status_change\`: the server authors it on every transition.
577
+ 3. For EACH task, write \`agent_instructions\` a zero-context execute-agent can run from
578
+ alone: a one-line SUMMARY / outcome of the task; the Orb context + the specific doc
579
+ slugs + the files/acceptance it needs; its TESTS (what to add and how to run them); and,
580
+ if it is blocked, a one-line "depends on TS-x: <why>".
581
+ 4. Add ONE intent-level test that proves the whole outcome is delivered.
582
+ 5. Wire ordering — \`orbitmap dep add TS-a TS-b\` (a depends on b) — for every dependency,
583
+ matching the "depends on" line you put in the task's instructions.
584
+ 6. COVERAGE GATE (hard): walk the design element by element and confirm each maps to a
585
+ task, and that the task set as a whole delivers the outcome. If anything is uncovered,
586
+ add or fix tasks and re-check. Do NOT proceed while a gap remains.
587
+ 7. Write cross-task PLANNING NOTES + a short SUMMARY to the intent \`plan\` field —
588
+ \`orbitmap intent update IN-x --plan "<notes>"\`: decisions valid for all tasks,
589
+ sequencing rationale, and the coverage argument. This REPLACES any seed notes that were
590
+ in the field — you have already absorbed them.
591
+ 8. Ensure a final DOC-UPDATE task exists: after the implementation is done and all tests
592
+ are green, update the OrbitMap documentation (see the \`orbitmap-docs\` skill).
593
+ 9. SELF-REVIEW the plan with fresh eyes (see the Self-review section) and fix issues inline.
594
+ 10. Present the plan (tasks + areas + tests + the coverage argument) and get the user's
595
+ approval before creating anything.
596
+ 11. On approval: create the tasks + dependency edges, then SHOW the created tasks in the
597
+ terminal (display number · title · area · its dependencies) so the user sees exactly
598
+ what landed; write the plan field; advance the intent \`plan → build\` carrying this
599
+ gate's entries — \`--log <type>:<content>\` is REPEATABLE, and \`plan → build\` takes
600
+ \`decision\` (task shape) + \`note\` (resume point):
601
+ \`orbitmap intent update IN-x --status build --log decision:"<task-shape decision + why>" --log note:"<resume point>"\`
602
+ (a transition carrying no \`--log\` is REFUSED with 422 and writes nothing); and offer
603
+ the \`orbitmap-execute\` skill by name so the user can approve and start execution right
604
+ away — do NOT auto-chain into it yourself.
605
+
606
+ ## Self-review
607
+ Before presenting, read the plan with fresh eyes — this is where a weak plan is caught:
608
+ - **Placeholders?** Every task's instructions must be concrete: real files, real
609
+ acceptance, named tests. No "TBD", "add tests", "handle edge cases", or "similar to
610
+ above" without the specifics. Fix inline.
611
+ - **Coverage holds?** Re-walk the design — every element still maps to a task, and the set
612
+ still delivers the outcome.
613
+ - **Consistent?** What a task produces (names, interfaces, files) matches what its
614
+ dependents consume; the dependency edges form a sane DAG with no cycles.
615
+ - **Right-sized?** Each task is independently testable — not a multi-day monolith, not a
616
+ trivial sliver a reviewer couldn't meaningfully gate.
617
+ Fix any issue inline; no need to re-review — just fix and move on.
618
+
619
+ ## Process flow
620
+ \`\`\`dot
621
+ digraph orbitmap_plan {
622
+ "Gather context: design + outcome + docs + neighbourhood" [shape=box];
623
+ "Design solid enough to plan?" [shape=diamond];
624
+ "Step aside to orbitmap-design" [shape=box];
625
+ "Decompose into a flat list of tasks, each in the correct area" [shape=box];
626
+ "Log decisions passing the keep/drop test, as they land" [shape=box];
627
+ "Per task: summary + context/doc-grounded instructions + tests + depends-on line" [shape=box];
628
+ "Add one intent-level test" [shape=box];
629
+ "Wire dependency edges" [shape=box];
630
+ "Coverage complete? (every design element to a task)" [shape=diamond];
631
+ "Write plan-field notes + summary" [shape=box];
632
+ "Add doc-update-after-green task" [shape=box];
633
+ "Self-review the plan (placeholders / coverage / consistency / size)" [shape=box];
634
+ "User approves the plan?" [shape=diamond];
635
+ "Create tasks + dependency edges in Orb" [shape=box];
636
+ "Show the created tasks in the terminal" [shape=box];
637
+ "Advance status plan to build, with --log entries (refused if none)" [shape=box];
638
+ "Offer orbitmap-execute (approve to start execution)" [shape=doublecircle];
639
+
640
+ "Gather context: design + outcome + docs + neighbourhood" -> "Design solid enough to plan?";
641
+ "Design solid enough to plan?" -> "Step aside to orbitmap-design" [label="no"];
642
+ "Design solid enough to plan?" -> "Decompose into a flat list of tasks, each in the correct area" [label="yes"];
643
+ "Decompose into a flat list of tasks, each in the correct area" -> "Log decisions passing the keep/drop test, as they land";
644
+ "Log decisions passing the keep/drop test, as they land" -> "Per task: summary + context/doc-grounded instructions + tests + depends-on line";
645
+ "Per task: summary + context/doc-grounded instructions + tests + depends-on line" -> "Add one intent-level test";
646
+ "Add one intent-level test" -> "Wire dependency edges";
647
+ "Wire dependency edges" -> "Coverage complete? (every design element to a task)";
648
+ "Coverage complete? (every design element to a task)" -> "Decompose into a flat list of tasks, each in the correct area" [label="no, add tasks"];
649
+ "Coverage complete? (every design element to a task)" -> "Write plan-field notes + summary" [label="yes"];
650
+ "Write plan-field notes + summary" -> "Add doc-update-after-green task";
651
+ "Add doc-update-after-green task" -> "Self-review the plan (placeholders / coverage / consistency / size)";
652
+ "Self-review the plan (placeholders / coverage / consistency / size)" -> "User approves the plan?";
653
+ "User approves the plan?" -> "Decompose into a flat list of tasks, each in the correct area" [label="no, revise"];
654
+ "User approves the plan?" -> "Create tasks + dependency edges in Orb" [label="yes"];
655
+ "Create tasks + dependency edges in Orb" -> "Show the created tasks in the terminal";
656
+ "Show the created tasks in the terminal" -> "Advance status plan to build, with --log entries (refused if none)";
657
+ "Advance status plan to build, with --log entries (refused if none)" -> "Offer orbitmap-execute (approve to start execution)";
658
+ }
659
+ \`\`\`
660
+
661
+ ## Before you hand off
662
+ - **Coverage?** Every design element maps to a task, and the set delivers the outcome.
663
+ - **Tests?** Every task has tests; one intent-level test proves the outcome.
664
+ - **Self-contained?** Every task's instructions carry summary + Orb context + doc pointers
665
+ + acceptance + any depends-on line — runnable by a zero-context agent.
666
+ - **No placeholders?** Self-review done; no vague/TBD instructions remain.
667
+ - **Areas?** Each task in the right area.
668
+ - **Dependencies?** Orb dep edges wired AND named in the dependent tasks' instructions.
669
+ - **Plan field?** Cross-task notes + a summary written to the intent \`plan\` field.
670
+ - **Doc-update?** A doc-update-after-green task is in the plan.
671
+ Then create the tasks + edges, SHOW them in the terminal, advance \`plan → build\`, and offer
672
+ \`orbitmap-execute\` — never auto-chain.
673
+
674
+ ## Planning entities (reference)
675
+ For general planning outside a single design (setting up missions, capturing ideas,
676
+ triaging issues):
677
+ - **Missions:** \`orbitmap mission list|show MS-x\`; \`orbitmap mission create "name"
678
+ [--outcome "…"] [--start d] [--end d]\`; \`orbitmap mission status MS-x
679
+ active|completed|cancelled\` (activating fails while another is active — complete/cancel
680
+ it first); \`orbitmap mission link|unlink MS-x IN-y|TS-y|IS-y|ID-y\`. A mission status
681
+ change takes the same repeatable \`--log <type>:<content>\` and is refused (422) without
682
+ at least one entry — \`cancelled\` above all needs its \`decision:"<why abandoned>"\`.
683
+ \`orbitmap log MS-x "…" --type …\` logs against a mission outside a transition.
684
+ - **Intents:** \`orbitmap intent create "name" [--outcome "…"] [--design "…"] [--plan "…"]
685
+ [--mission MS-x]\`, statuses new → design → plan → build → done (or cancelled). The
686
+ \`outcome\` is the north star, \`design\` the agreed solution, \`plan\` the agreed build
687
+ plan — produced by the \`orbitmap-brainstorm\` / \`orbitmap-design\` / \`orbitmap-plan\`
688
+ gates respectively.
689
+ - **Ideas (opportunities, not problems):** \`orbitmap idea add "…" [--priority p]\`;
690
+ \`orbitmap idea list\`; promote by analysing the codebase, then \`orbitmap create "title"
691
+ --intent …\` referencing the idea, then \`orbitmap idea status ID-x used\` (or \`rejected\`).
692
+ - **Issues (problems):** \`orbitmap issue register "title" --severity
693
+ critical|high|medium|low [--description "…"]\`; \`orbitmap issue status IS-x
694
+ investigating\`; resolve with a fix task via \`orbitmap issue resolve IS-x --task TS-y
695
+ --resolution "…"\` (or \`wont_fix\` / \`duplicate\` with a reason).
696
+
697
+ ## Rules
698
+ - Cover the whole design — the coverage check is a HARD GATE; never hand off with a gap.
699
+ - Flat tasks only — no subtasks; express structure through dependencies.
700
+ - Every task carries its tests; the intent carries one outcome-proving test.
701
+ - Every task's \`agent_instructions\` are self-contained for a zero-context agent (summary +
702
+ Orb context + doc pointers + acceptance + any depends-on line). No placeholders.
703
+ - Wire dependencies as Orb edges AND name them in the dependent tasks' instructions.
704
+ - Place each task in the correct area; derive it from the work, not the current directory.
705
+ - Self-review the plan before presenting; fix placeholders/coverage/consistency inline.
706
+ - Write cross-task notes + a summary to the intent \`plan\` field.
707
+ - Log \`decision\` entries that pass the keep/drop test (Flow step 2) as they are agreed, never
708
+ batched; \`blocker\` whenever progress stops — an abandoned session must still leave a record.
709
+ - The \`plan → build\` transition must carry the gate's entries as repeatable
710
+ \`--log <type>:<content>\` — \`decision\` (task shape) + \`note\` (resume point); without at
711
+ least one it is refused (422) and nothing is written. Never author \`status_change\` — the
712
+ server writes it.
713
+ - Include a doc-update-after-green task in every plan.
714
+ - After approval, create the tasks + edges and SHOW them in the terminal.
715
+ - Advance \`plan → build\` only after the user has approved the plan.
716
+ - Never auto-chain into execution — offer \`orbitmap-execute\` and stop.`;
717
+ // ── Skill: orbitmap-brainstorm — no MCP oracle counterpart (Orb works without superpowers) ──
718
+ export const SKILL_BRAINSTORM_FRONTMATTER = `---
719
+ name: orbitmap-brainstorm
720
+ description: >
721
+ Brainstorming an idea into an agreed outcome in OrbitMap — the first gate of the
722
+ product-building flow, run as a natural thinking-partner conversation. You MUST use this
723
+ before any creative work — creating features, building components, adding functionality,
724
+ or modifying behavior. It explores intent, requirements and constraints one question at a
725
+ time until the outcome is AGREED, writes that outcome to the intent's outcome field, and
726
+ files useful asides to the design (and, when relevant, plan) fields for the later gates.
727
+ Use for "I have an idea", "brainstorm this", "let's think through X", "what should we
728
+ build/do about X", shaping an intent's outcome, or an intent at \`new\` status.
729
+ ---`;
730
+ export const SKILL_BRAINSTORM_BODY = `# Framing an idea into an outcome
731
+
732
+ ## Goal
733
+ Produce the intent's OUTCOME — a short statement of WHAT should change and WHY, that the
734
+ user actually agrees to. That agreed outcome is this gate's deliverable; the design and
735
+ plan are later gates' jobs.
736
+
737
+ **Interface:** every action below is an OrbitMap operation — run the \`orbitmap\` CLI command
738
+ shown, or its equivalent MCP tool when this session uses MCP; \`orbitmap <cmd> --help\` and the
739
+ MCP tool schemas are the authority. Never edit the workspace data files directly.
740
+
741
+ ## From idea to agreed outcome
742
+ This is the FIRST gate of OrbitMap's product-building flow, and it is a natural
743
+ conversation — you are a thinking partner, not a form. Turn a raw idea into an outcome the
744
+ user actually AGREES to; that agreement is the ONE thing you must reach before moving on.
745
+ You are deciding WHAT should change and WHY — not designing the solution, not starting to
746
+ build. As the conversation flows it will wander into HOW and into build-order; do not block
747
+ on those — capture them as notes filed to the right downstream field (design or plan) and
748
+ steer gently back to the outcome. The agreed outcome plus those routed notes are the baton
749
+ you hand to \`orbitmap-design\` (and, through the plan field, to \`orbitmap-plan\`).
750
+
751
+ ## Key principles
752
+ - **Thinking partner, not a form.** Follow the conversation and reflect back to converge —
753
+ do not interrogate. The ONE thing you must reach is an AGREED OUTCOME; everything else
754
+ useful gets captured for later, never blocked on.
755
+ - **Gate before build.** No feature, component, or behavior change starts before the
756
+ outcome is agreed and written to OrbitMap. "Too simple to frame" is exactly where
757
+ unexamined assumptions cost the most — every idea gets an outcome, even a one-sentence
758
+ one.
759
+ - **The outcome is an agreement, not your guess.** It is the user's, in the user's words.
760
+ Never advance on an assumed or half-agreed outcome.
761
+ - **One question at a time.** Refine by dialogue, never a questionnaire dump.
762
+ - **Prefer multiple choice — open questions are a LAST RESORT.** When a question's options
763
+ can be enumerated, ALWAYS offer them as a multiple choice with a recommended default; ask
764
+ an open-ended question only when the option space genuinely cannot be enumerated. Always
765
+ include a free-text "or something else — tell me" escape.
766
+ - **Ask sparingly — earn every question.** Before asking: (1) answer it yourself from the
767
+ idea, the context and the repo — never ask what you can already determine; (2) drop it if
768
+ the answer would not change the outcome; (3) batch tightly-related micro-decisions into
769
+ ONE question. Prefer proposing a sensible default for the user to correct over an open
770
+ interrogation. Aim for the few highest-leverage questions — "one question at a time" sets
771
+ the pace, not the total count.
772
+ - **Lead with a recommendation.** Present options and the outcome conversationally, leading
773
+ with the option you recommend and WHY — never a flat, neutral menu with no steer.
774
+ - **YAGNI.** Cut every want that does not serve the outcome; a smaller outcome ships.
775
+ - **Capture the user's opinions faithfully — and mark them as the user's.** Label the
776
+ user's notes as user notes in whichever field they land (design or plan); the design and
777
+ plan gates treat user-marked notes as their highest-priority input, so do not paraphrase
778
+ away their intent. You may add your own notes too — keep them clearly separate.
779
+ - **Route notes by type (light-touch).** As the conversation surfaces useful asides, file
780
+ them to the field that will use them: HOW / tech / UX → the **design** notes; build-order
781
+ / task ideas / execution risks → the **plan** notes; WHAT / WHY stays in the outcome.
782
+ Capture the obvious and steer back — do not over-police a flowing conversation. Feeding
783
+ the plan field is OPTIONAL: only when the chat actually produced build-order material.
784
+ - **Ground in verified reality — never frame on assumptions.** Before framing, verify the
785
+ idea against the actual repo and tracker, not the plan doc's or the user's claim: is this
786
+ already built or partially shipped, is a prerequisite phase actually done, do the named
787
+ entities exist? A wrong premise wastes the whole design and build that follow.
788
+ - **Framing precedes design precedes build.** You decide WHAT and WHY here; HOW is the
789
+ design gate's job. For every point, ask "would a different answer change WHAT ships, or
790
+ only HOW it is built?" — route HOW answers (assets, routes, component structure, exact
791
+ validation) into the design notes, never into the agreed outcome. Do not slip into
792
+ solutioning.
793
+
794
+ ## Flow
795
+ 1. Gather context.
796
+ - \`orbitmap context\` and \`orbitmap intent show IN-x\` already carry the workspace,
797
+ mission, recently-used and open intents, and the target intent; read any referenced
798
+ idea (ID-) too.
799
+ - Check the repo itself — relevant files, docs, recent commits — when the outcome
800
+ touches existing code and to get all the context.
801
+ - Skim the available knowledge — the doc lists (\`available_docs\` across areas,
802
+ \`workspace_knowledge\`, \`orbit_docs\`), from the intent context if present, else
803
+ \`orbitmap docs\`. METADATA only (title / context / sections_count) — do not read bodies
804
+ here. Note which docs are relevant and record their slugs in the design notes.
805
+ - Know the neighbourhood (status matters): the MISSION's outcome + status (does this
806
+ intent serve a still-active mission?) and the SIBLING intents under that mission/orbit
807
+ with their outcomes + statuses — from the intent context if present, else
808
+ \`orbitmap mission show MS-x\` / \`orbitmap intents\`. Reconcile or link rather than frame
809
+ a duplicate/conflicting outcome; ignore siblings that are \`done\`/\`cancelled\`.
810
+ - Verify the premise before framing: is this already built or partially shipped, is any
811
+ prerequisite phase actually complete, do the named entities exist? Grep migrations /
812
+ commits / the tracker — frame on what is true NOW, not on the plan doc's claim.
813
+ 2. Clarify the idea into an outcome, ONE question at a time — the real goal, what changes
814
+ and for whom, what success looks like, the constraints. As you go, capture the user's
815
+ opinions, preferences and context as notes; these outrank your own ideas in the design
816
+ stage, so record them faithfully.
817
+ - KEEP/DROP TEST — log a \`decision\` when ANY of these is true: an alternative was
818
+ considered and REJECTED (record which, and why it lost); a non-obvious assumption or
819
+ constraint was LOCKED IN; a choice was made that a later reader would otherwise
820
+ re-litigate. Do NOT log: restating the outcome, design or plan (they are already
821
+ fields on the intent); confirming something already written down elsewhere; mechanical
822
+ facts recoverable from git, CI or the tracker (test counts, file lists, commit hashes);
823
+ progress narration ("started X", "working on Y").
824
+ KEEP → "Parallelised the build across four subagents; the Laravel slices were split by
825
+ file ownership to avoid collisions in one working tree." — records the rejected
826
+ alternative (one agent per repo) and why it lost.
827
+ DROP → "make verify green at 2415 passed after merging all four agents." — a mechanical
828
+ fact already in the commit message and the CI output.
829
+ - LOG IT THE MOMENT IT PASSES, not batched at the end: \`orbitmap log IN-x "<what was
830
+ decided and why>" --type decision\`. An abandoned session must still leave its decisions
831
+ recorded. If the intent does not exist yet, create it (step 4) at the first passing
832
+ answer and log from then on.
833
+ - Progress stops (missing access, an unanswerable question, a conflicting intent) →
834
+ \`orbitmap log IN-x "Blocked: <what stopped and why>" --type blocker\`.
835
+ - \`note\` is the CATCH-ALL — anything useful that is not \`code_change\` / \`decision\` /
836
+ \`blocker\` goes in as \`note\`, with \`--meta\` for unusual structure. There is deliberately
837
+ NO \`other\` type. NEVER write \`status_change\`: the server authors it on every transition.
838
+ 3. Present the outcome as a short, concrete statement that also names what is explicitly
839
+ OUT of scope and how success will be measured or checked. Refine it with the user until
840
+ they AGREE — never proceed on a vague or assumed outcome.
841
+ 4. Persist (create or refine). Update an existing unprocessed intent, or create one:
842
+ \`orbitmap intent update IN-x --outcome "<agreed outcome>" [--design "<design notes>"] [--plan "<plan notes>"]\`
843
+ / \`orbitmap intent create "<name>" --outcome "<agreed outcome>" [--design "…"] [--plan "…"]\`.
844
+ The agreed **outcome** goes in the outcome field. Route the captured notes by type —
845
+ HOW / tech / UX → the **design** field; build-order / task ideas / execution risks → the
846
+ **plan** field (OPTIONAL — only if the conversation produced any). Mark the user's notes
847
+ as the user's in both fields; you may add your own, kept separate. The design gate reads
848
+ the design notes and the plan gate reads the plan notes, each as its highest-priority
849
+ input.
850
+ - If you promoted an OrbitMap idea, mark it used: \`orbitmap idea status ID-x used\`.
851
+ 5. Advance the lifecycle, carrying this gate's entries — \`--log <type>:<content>\` is
852
+ REPEATABLE and \`new → design\` is decision-heavy (why this outcome, what is out of scope):
853
+ \`orbitmap intent update IN-x --status design --log decision:"<why this outcome>" --log decision:"<what is out of scope>"\`.
854
+ A transition carrying no \`--log\` is REFUSED (422) and writes nothing — not the status,
855
+ not an entry — so this is not optional.
856
+ 6. Ask the user whether to review the outcome further or start designing — offer the
857
+ \`orbitmap-design\` skill by name. Do NOT auto-chain into it yourself.
858
+
859
+ ## Process flow
860
+ \`\`\`dot
861
+ digraph orbitmap_brainstorm {
862
+ "Gather context: Orb (intents / idea) + repo (files, docs, commits)" [shape=box];
863
+ "Clarify idea into an outcome, one question at a time" [shape=box];
864
+ "Log decisions passing the keep/drop test, as they land" [shape=box];
865
+ "Capture user opinions / context as notes" [shape=box];
866
+ "Present the outcome" [shape=box];
867
+ "User agrees the outcome?" [shape=diamond];
868
+ "Create or refine intent: agreed outcome" [shape=box];
869
+ "Route notes to design/plan fields by type (marked as the user's)" [shape=box];
870
+ "Promote referenced idea to used" [shape=box];
871
+ "Advance status new to design, with --log entries (refused if none)" [shape=box];
872
+ "Offer orbitmap-design (review or design?)" [shape=doublecircle];
873
+
874
+ "Gather context: Orb (intents / idea) + repo (files, docs, commits)" -> "Clarify idea into an outcome, one question at a time";
875
+ "Clarify idea into an outcome, one question at a time" -> "Log decisions passing the keep/drop test, as they land";
876
+ "Log decisions passing the keep/drop test, as they land" -> "Capture user opinions / context as notes";
877
+ "Capture user opinions / context as notes" -> "Present the outcome";
878
+ "Present the outcome" -> "User agrees the outcome?";
879
+ "User agrees the outcome?" -> "Clarify idea into an outcome, one question at a time" [label="no, refine"];
880
+ "User agrees the outcome?" -> "Create or refine intent: agreed outcome" [label="yes"];
881
+ "Create or refine intent: agreed outcome" -> "Route notes to design/plan fields by type (marked as the user's)";
882
+ "Route notes to design/plan fields by type (marked as the user's)" -> "Promote referenced idea to used";
883
+ "Promote referenced idea to used" -> "Advance status new to design, with --log entries (refused if none)";
884
+ "Advance status new to design, with --log entries (refused if none)" -> "Offer orbitmap-design (review or design?)";
885
+ }
886
+ \`\`\`
887
+
888
+ ## After the outcome
889
+ Before handing off, review the agreed outcome with fresh eyes:
890
+ - **Vague or assumed?** Is it concrete and in the user's words, or did you fill gaps? Fix.
891
+ - **Unmeasurable?** Can you tell when it is met? If not, sharpen the success criteria.
892
+ - **Too big?** If it needs several independent designs, decompose into sibling intents and
893
+ frame the first — do not hand design an outcome that is really three outcomes.
894
+ Then write it (Flow step 4), advance \`new → design\`, and hand the baton to
895
+ \`orbitmap-design\` — never auto-chain.
896
+
897
+ ## Rules
898
+ - One question at a time — never dump a checklist of questions on the user in one turn.
899
+ - The outcome is an AGREEMENT, not your guess: never advance to \`design\` status until the
900
+ user has agreed the outcome in words.
901
+ - Mark the user's notes as the user's in whichever field they land (design or plan): the
902
+ design and plan gates treat user-marked notes as highest-priority input. Add your own
903
+ notes too, kept clearly separate.
904
+ - Route notes by type (light-touch): HOW/tech/UX → design field; build-order/task/risk →
905
+ plan field (optional); WHAT/WHY stays in the outcome. Capture and steer back; do not
906
+ over-police the conversation.
907
+ - Log \`decision\` entries that pass the keep/drop test (Flow step 2) as they land, never
908
+ batched; \`blocker\` whenever progress stops — an abandoned session must still leave a record.
909
+ - The \`new → design\` transition must carry the gate's entries as repeatable
910
+ \`--log <type>:<content>\`; without at least one it is refused (422) and nothing is written.
911
+ Never author \`status_change\` — the server writes it.
912
+ - Create-or-refine: reuse an existing unprocessed intent instead of creating a duplicate.
913
+ - Ground the outcome in verified repo/tracker reality, not the plan doc or a stated claim —
914
+ check it is still needed and still undone before framing.
915
+ - Keep the outcome WHAT/WHY: name what is OUT of scope and how success is measured; push
916
+ HOW answers into the design notes.
917
+ - If the intent already has an agreed outcome (status \`design\` or later), step aside and
918
+ point at \`orbitmap-design\` — do not re-frame a settled outcome.
919
+ - Never auto-chain into designing after framing — always ask first.`;
920
+ // ── Skill: orbitmap-design — no MCP oracle counterpart (Orb works without superpowers) ──
921
+ export const SKILL_DESIGN_FRONTMATTER = `---
922
+ name: orbitmap-design
923
+ description: >
924
+ Designing an intent's solution in OrbitMap: turns an agreed outcome into an approach,
925
+ technical spec, and UX (when there's UI), one question at a time, then writes the
926
+ result to the intent's design field. Use for "design this intent", "let's design X", or
927
+ an intent entering \`design\` status. Use it once the outcome is agreed; if the outcome is
928
+ still missing or vague, step aside to \`orbitmap-brainstorm\` first.
929
+ ---`;
930
+ export const SKILL_DESIGN_BODY = `# Designing an intent's solution
931
+
932
+ ## Goal
933
+ Produce the intent's DESIGN — a buildable, code-grounded markdown doc (approach, technical
934
+ spec, UX where there's UI) that a plan can be built from. That design doc is this gate's
935
+ one deliverable.
936
+
937
+ **Interface:** every action below is an OrbitMap operation — run the \`orbitmap\` CLI command
938
+ shown, or its equivalent MCP tool when this session uses MCP; \`orbitmap <cmd> --help\` and the
939
+ MCP tool schemas are the authority. Never edit the workspace data files directly.
940
+
941
+ ## The outcome is the north star
942
+ An intent's \`outcome\` is why the design exists — the design's only job is to bring that
943
+ outcome to life. Read it and internalize it before anything else; every question you ask
944
+ and every section you write must trace back to it. If the outcome is missing, or too
945
+ vague to design against, STOP. The framing gate comes before the solution gate: if the
946
+ outcome is missing or still vague (intent at \`new\`), step aside to \`orbitmap-brainstorm\` to
947
+ settle it first — do not design a solution for an outcome that is not solid yet.
948
+
949
+ ## The framing notes are your highest-priority input
950
+ When the \`orbitmap-brainstorm\` gate ran first, the intent's \`design\` field arrives holding
951
+ framing notes — NOT a design doc: the user's notes (marked as the user's) plus any notes
952
+ the framing agent added. Read them FIRST. The USER-marked notes are your HIGHEST-PRIORITY
953
+ input — they outrank your own ideas and the agent notes; treat the agent notes as normal
954
+ input. Absorb all of them — honor and reflect them in the design you build — then let your
955
+ finished design doc REPLACE them in the field (absorb, then replace). If the field already
956
+ holds a real design doc instead of raw notes, treat it as existing design to refine.
957
+
958
+ ## Key principles
959
+ - **Serve the outcome.** Every question and every section traces back to the outcome; if
960
+ it does not, cut it or go fix the outcome first.
961
+ - **One question at a time.** Refine by dialogue, never a questionnaire dump.
962
+ - **Prefer multiple choice — open questions are a LAST RESORT.** When a question's options
963
+ can be enumerated, ALWAYS offer them as a multiple choice with a recommended default; ask
964
+ an open-ended question only when the option space genuinely cannot be enumerated. Always
965
+ include a free-text "or something else — tell me" escape.
966
+ - **Ask sparingly — earn every question.** Before asking: (1) answer it yourself from the
967
+ outcome, the notes and the repo — never ask what you can already determine; (2) drop it
968
+ if the answer would not change the design; (3) batch tightly-related micro-decisions into
969
+ ONE question. Prefer proposing a sensible default for the user to correct over an open
970
+ interrogation. Aim for the few highest-leverage questions — "one question at a time" sets
971
+ the pace, not the total count.
972
+ - **Lead with a recommendation.** When you propose approaches or technical options, lead
973
+ with the one you recommend and WHY — never a flat, neutral menu with no steer.
974
+ - **YAGNI.** Cut every part of the design that does not serve the outcome; a smaller
975
+ design ships.
976
+ - **Ground the spec in verified current code — never assume.** Read/grep every file and
977
+ behavior you rely on before asserting it; a design with a false claim about the code
978
+ misleads the builder and is worse than none. Carry nothing forward from the outcome stage
979
+ unchecked.
980
+ - **Concrete and verbatim.** Name the exact files, classes, schemas/tokens and locked copy —
981
+ not prose behavior — so a builder can execute the design without re-deriving it.
982
+ - **Ground every proposal in the existing codebase.** Follow the patterns already there;
983
+ name the real files and classes; do not invent structure the repo does not use.
984
+
985
+ ## Working in existing codebases
986
+ Explore the current structure BEFORE proposing anything, and follow the patterns already
987
+ there — the canonical CRUD module, the sibling component you are mirroring, the existing
988
+ route. Name the concrete files and classes your design will touch or create, each grounded
989
+ in the equivalent existing pattern, so the design is buildable without re-derivation. Where
990
+ existing code in your path has a real problem (a file grown too large, a tangled boundary),
991
+ include a targeted fix as part of the design — but never propose unrelated refactoring;
992
+ stay focused on what serves this outcome.
993
+
994
+ ## Design for isolation and clarity
995
+ Break the solution into small units that each have ONE clear purpose, communicate through
996
+ well-defined interfaces, and can be understood and tested independently. For each unit you
997
+ should be able to say what it does, how it is used, and what it depends on. Two tests: can
998
+ someone understand what a unit does without reading its internals, and can you change its
999
+ internals without breaking its consumers? If not, the boundaries need work. Smaller,
1000
+ well-bounded units are easier to build, review, and reason about.
1001
+
1002
+ ## Flow
1003
+ 1. Gather context.
1004
+ - \`orbitmap intent show IN-x\` → the outcome and the design field; \`orbitmap context\`
1005
+ for the workspace and mission. If the design field holds framing notes, absorb them
1006
+ as highest-priority input (see above).
1007
+ - Check the repo — relevant files, existing patterns, docs, recent commits. You design
1008
+ against real code, so read it before proposing.
1009
+ - Pull the relevant OrbitMap docs: from the doc lists (\`available_docs\` /
1010
+ \`workspace_knowledge\` / \`orbit_docs\` — in the intent context if present, else
1011
+ \`orbitmap docs\`, plus any slugs the framing notes flagged), READ the bodies that matter
1012
+ with \`orbitmap doc <slug>\` (TOC → section → full) to ground the spec. Metadata is not
1013
+ enough at the design gate.
1014
+ - Know the neighbourhood (status matters): the MISSION's outcome + status (the design
1015
+ must serve it), the SIBLING intents under the mission/orbit with their statuses, and
1016
+ the intent's OWN tasks + issues with statuses — from the intent context if present,
1017
+ else \`orbitmap mission show MS-x\` / \`orbitmap intents\` / the intent's linked items.
1018
+ Design AROUND existing tasks — never silently re-decompose work that already exists.
1019
+ - Verify, do not assume: Read/grep each "existing" file, route or component before you
1020
+ rely on it, and re-check any claim the outcome stage carried forward.
1021
+ 2. Clarify ONE question at a time, each anchored to the outcome — "to achieve <outcome>,
1022
+ how should X work?" Cover technical decisions, UX (only if the intent has UI), edge
1023
+ cases, data/API shape. Continuously check whether the emerging design actually delivers
1024
+ the outcome, and surface any gap where it would not. Capture the user's decisions and
1025
+ the reasoning behind them as you go — those decisions are part of the design.
1026
+ - KEEP/DROP TEST — log a \`decision\` when ANY of these is true: an alternative was
1027
+ considered and REJECTED (record which, and why it lost); a non-obvious assumption or
1028
+ constraint was LOCKED IN; a choice was made that a later reader would otherwise
1029
+ re-litigate. Do NOT log: restating the outcome, design or plan (they are already
1030
+ fields on the intent); confirming something already written down elsewhere; mechanical
1031
+ facts recoverable from git, CI or the tracker (test counts, file lists, commit hashes);
1032
+ progress narration ("started X", "working on Y").
1033
+ KEEP → "Parallelised the build across four subagents; the Laravel slices were split by
1034
+ file ownership to avoid collisions in one working tree." — records the rejected
1035
+ alternative (one agent per repo) and why it lost.
1036
+ DROP → "make verify green at 2415 passed after merging all four agents." — a mechanical
1037
+ fact already in the commit message and the CI output.
1038
+ - LOG IT THE MOMENT IT IS AGREED, not batched at the end: \`orbitmap log IN-x "<the choice
1039
+ and why, incl. what it rules out>" --type decision\`. An abandoned session must still
1040
+ leave its decisions recorded.
1041
+ - Progress stops (a blocking unknown, missing access, a contradicting design) →
1042
+ \`orbitmap log IN-x "Blocked: <what stopped and why>" --type blocker\`.
1043
+ - \`note\` is the CATCH-ALL — anything useful that is not \`code_change\` / \`decision\` /
1044
+ \`blocker\` goes in as \`note\`, with \`--meta\` for unusual structure. There is deliberately
1045
+ NO \`other\` type. NEVER write \`status_change\`: the server authors it on every transition.
1046
+ 3. Explore approaches: propose 2-3 concrete approaches with their trade-offs, lead with the
1047
+ one you recommend and WHY, and let the user pick before you spec anything. YAGNI the
1048
+ rest — and record which approaches you weighed and why you rejected them.
1049
+ 4. Draft ONE markdown design doc with these sections, in order:
1050
+ - Outcome (restated)
1051
+ - How this design delivers the outcome — MANDATORY: trace the design back to the
1052
+ outcome explicitly; never skip this section
1053
+ - Approach — the chosen approach and why
1054
+ - Key decisions — the decisions taken with the user during design, each with its
1055
+ rationale, so no one silently re-litigates or reverses them later
1056
+ - Technical spec — name the concrete files / classes / components to touch or create,
1057
+ each grounded in the existing pattern it mirrors; give exact class/method names,
1058
+ schemas/tokens and locked copy for anything UI- or contract-facing, not prose alone
1059
+ - UX design (only if the intent has UI)
1060
+ - Alternatives considered / rejected — options weighed and declined, and WHY, so a
1061
+ future contributor does not re-introduce a declined option
1062
+ - Testing / verification approach — the tests to add and the gating commands to run
1063
+ (e.g. \`make contract\`, \`make verify\`)
1064
+ - Risks / open questions
1065
+ 5. Present the draft in sections scaled to their complexity (a few sentences when simple,
1066
+ more when nuanced); after each section ask whether it looks right, and get the user's
1067
+ approval before writing anything.
1068
+ 6. Write it: \`orbitmap intent update IN-x --design "<doc>"\`. This REPLACES any framing
1069
+ notes that were in the field — you have already absorbed them into the doc.
1070
+ 7. Advance the lifecycle, carrying this gate's entries — \`--log <type>:<content>\` is
1071
+ REPEATABLE and \`design → plan\` is decision-heavy (technical choices, rejected
1072
+ alternatives):
1073
+ \`orbitmap intent update IN-x --status plan --log decision:"<technical choice + why>" --log decision:"<alternative rejected + why>"\`.
1074
+ A transition carrying no \`--log\` is REFUSED (422) and writes nothing — not the status,
1075
+ not an entry — so this is not optional.
1076
+ 8. Ask the user whether to review the design further or start planning — offer the
1077
+ \`orbitmap-plan\` skill by name. Do NOT auto-chain into it yourself.
1078
+
1079
+ ## Process flow
1080
+ \`\`\`dot
1081
+ digraph orbitmap_design {
1082
+ "Gather context: outcome + notes + repo (files, patterns, docs)" [shape=box];
1083
+ "Internalize the outcome (north star)" [shape=box];
1084
+ "Outcome solid enough to design?" [shape=diamond];
1085
+ "Step aside to orbitmap-brainstorm" [shape=box];
1086
+ "Clarify one question at a time, anchored to the outcome" [shape=box];
1087
+ "Log decisions passing the keep/drop test, as they land" [shape=box];
1088
+ "Explore approaches (2-3, recommend, user picks)" [shape=box];
1089
+ "Draft the design doc (outcome-delivery trace mandatory)" [shape=box];
1090
+ "User approves the draft?" [shape=diamond];
1091
+ "Write design field (replaces framing notes)" [shape=box];
1092
+ "Advance status design to plan, with --log entries (refused if none)" [shape=box];
1093
+ "Offer orbitmap-plan (review or plan?)" [shape=doublecircle];
1094
+
1095
+ "Gather context: outcome + notes + repo (files, patterns, docs)" -> "Internalize the outcome (north star)";
1096
+ "Internalize the outcome (north star)" -> "Outcome solid enough to design?";
1097
+ "Outcome solid enough to design?" -> "Step aside to orbitmap-brainstorm" [label="no"];
1098
+ "Outcome solid enough to design?" -> "Clarify one question at a time, anchored to the outcome" [label="yes"];
1099
+ "Clarify one question at a time, anchored to the outcome" -> "Log decisions passing the keep/drop test, as they land";
1100
+ "Log decisions passing the keep/drop test, as they land" -> "Explore approaches (2-3, recommend, user picks)";
1101
+ "Explore approaches (2-3, recommend, user picks)" -> "Draft the design doc (outcome-delivery trace mandatory)";
1102
+ "Draft the design doc (outcome-delivery trace mandatory)" -> "User approves the draft?";
1103
+ "User approves the draft?" -> "Clarify one question at a time, anchored to the outcome" [label="no, refine"];
1104
+ "User approves the draft?" -> "Write design field (replaces framing notes)" [label="yes"];
1105
+ "Write design field (replaces framing notes)" -> "Advance status design to plan, with --log entries (refused if none)";
1106
+ "Advance status design to plan, with --log entries (refused if none)" -> "Offer orbitmap-plan (review or plan?)";
1107
+ }
1108
+ \`\`\`
1109
+
1110
+ ## Format
1111
+ One markdown document holds both the technical spec and the UX design (when the intent
1112
+ has UI) — there is no separate field for either. It renders wherever the intent's design
1113
+ is shown, so write it as a document a human would actually want to read.
1114
+
1115
+ ## Before you hand off
1116
+ Review the draft with fresh eyes before you write it:
1117
+ - **Placeholders?** Any TBD / TODO / vague requirement? Fix them inline.
1118
+ - **Delivers the outcome?** Does the "how this design delivers the outcome" trace actually
1119
+ hold end to end? If there is a gap where it would not, close it.
1120
+ - **Internally consistent?** Do any sections contradict, or the approach not match the
1121
+ spec? Reconcile them.
1122
+ - **Too big or ambiguous?** If it needs more than one implementation plan, note the split;
1123
+ if a requirement reads two ways, pick one and make it explicit.
1124
+ - **Schema & tenancy guardrails?** For any schema / FK / migration change, verify multi-tenancy
1125
+ (\`account_id\` isolation), RLS policies and Postgres triggers against the repo's audit
1126
+ rules before handing off; and name the gating commands the plan must run.
1127
+ - **Verified, not assumed?** Is every claim about existing code checked against the repo,
1128
+ not recalled? Fix any you have not actually Read/grepped.
1129
+ - **Concrete enough to build?** Does the Technical spec name real files/classes with exact
1130
+ names, schemas and locked copy, and does the doc carry the Key decisions,
1131
+ Alternatives-rejected, and Testing sections? If any is missing, it is not ready.
1132
+ Then write it (Flow step 6), advance \`design → plan\`, and hand the baton to
1133
+ \`orbitmap-plan\` — never auto-chain.
1134
+
1135
+ ## Rules
1136
+ - One question at a time — never dump a checklist of questions on the user in one turn.
1137
+ - If the outcome is missing or vague (intent at \`new\`), step aside to \`orbitmap-brainstorm\`
1138
+ first — do not design against an unsettled outcome.
1139
+ - If the design field holds framing notes from the \`orbitmap-brainstorm\` gate, they are your
1140
+ highest-priority input: absorb them, then let the finished doc replace them.
1141
+ - Every question, and every section of the draft, must serve the outcome; if it does
1142
+ not, cut it or go fix the outcome first.
1143
+ - The "how this design delivers the outcome" section is mandatory, not optional.
1144
+ - Ground every claim about existing code in an actual Read/grep — never assert from memory.
1145
+ - Name concrete files/classes to touch in the Technical spec, grounded in the existing
1146
+ pattern, with exact names/schemas and locked copy for UI/contract-facing pieces — never
1147
+ ship a prose-only spec.
1148
+ - Capture the user's design decisions with their rationale, and record the alternatives you
1149
+ rejected and why.
1150
+ - Log \`decision\` entries that pass the keep/drop test (Flow step 2) as they are agreed, never
1151
+ batched; \`blocker\` whenever progress stops — an abandoned session must still leave a record.
1152
+ - The \`design → plan\` transition must carry the gate's entries as repeatable
1153
+ \`--log <type>:<content>\`; without at least one it is refused (422) and nothing is written.
1154
+ Never author \`status_change\` — the server writes it.
1155
+ - Follow existing codebase patterns; propose no unrelated refactoring.
1156
+ - Never advance the intent past \`design\` status until the user has approved the draft.
1157
+ - Never auto-chain into planning after writing the design — always ask first.`;
239
1158
  // ── Skill: orbitmap-docs — §8.6 ────────────────────────────────────────────────
240
1159
  export const SKILL_DOCS_FRONTMATTER = `---
241
1160
  name: orbitmap-docs
@@ -246,6 +1165,18 @@ description: >
246
1165
  ---`;
247
1166
  export const SKILL_DOCS_BODY = `# OrbitMap documents
248
1167
 
1168
+ Documents are workspace-level: exactly ONE copy per workspace, never per-area. No document
1169
+ command takes an area, and \`orbitmap context\` already lists them.
1170
+
1171
+ ## Goal
1172
+ Read and update OrbitMap documents efficiently: pull only the context you need (TOC →
1173
+ section → full, never dump a whole doc into the conversation), and make every change
1174
+ through the CLI — never by editing the workspace files directly.
1175
+
1176
+ **Interface:** every action below is an OrbitMap operation — run the \`orbitmap\` CLI command
1177
+ shown, or its equivalent MCP tool when this session uses MCP; \`orbitmap <cmd> --help\` and the
1178
+ MCP tool schemas are the authority. Never edit the workspace data files directly.
1179
+
249
1180
  ## Choosing what to read
250
1181
  \`orbitmap docs\` lists documents with their \`context\` (when the doc is relevant) and
251
1182
  \`sections_count\`. Use context to pick the right document; use sections_count to decide
@@ -273,14 +1204,25 @@ export const SKILLS = [
273
1204
  body: SKILL_ORBITMAP_BODY,
274
1205
  },
275
1206
  {
276
- name: 'orbitmap-working',
277
- frontmatter: SKILL_WORKING_FRONTMATTER,
278
- body: SKILL_WORKING_BODY,
1207
+ name: 'orbitmap-execute',
1208
+ frontmatter: SKILL_EXECUTE_FRONTMATTER,
1209
+ body: SKILL_EXECUTE_BODY,
1210
+ references: SKILL_EXECUTE_REFERENCES,
1211
+ },
1212
+ {
1213
+ name: 'orbitmap-plan',
1214
+ frontmatter: SKILL_PLAN_FRONTMATTER,
1215
+ body: SKILL_PLAN_BODY,
1216
+ },
1217
+ {
1218
+ name: 'orbitmap-brainstorm',
1219
+ frontmatter: SKILL_BRAINSTORM_FRONTMATTER,
1220
+ body: SKILL_BRAINSTORM_BODY,
279
1221
  },
280
1222
  {
281
- name: 'orbitmap-planning',
282
- frontmatter: SKILL_PLANNING_FRONTMATTER,
283
- body: SKILL_PLANNING_BODY,
1223
+ name: 'orbitmap-design',
1224
+ frontmatter: SKILL_DESIGN_FRONTMATTER,
1225
+ body: SKILL_DESIGN_BODY,
284
1226
  },
285
1227
  {
286
1228
  name: 'orbitmap-docs',
@@ -292,40 +1234,61 @@ export const SKILLS = [
292
1234
  // Claude variant — §8.2, verbatim (without the markers, which buildClaudeHook adds).
293
1235
  export const THIN_HOOK_CLAUDE = `## OrbitMap
294
1236
 
295
- This project tracks work in OrbitMap via the \`orbitmap\` CLI (works the same whether data
296
- is in the cloud or in local files). When the user mentions tasks, backlog, missions,
297
- intents, ideas, issues, vibes, or asks you to work on / log / plan something, load the
298
- matching skill: \`orbitmap\` (context & commands), \`orbitmap-working\` (doing tasks),
299
- \`orbitmap-planning\` (missions/intents/ideas/issues), \`orbitmap-docs\` (documents).
300
- Golden rules: work on ONE task at a time; NEVER finish a task session without a final
301
- \`orbitmap log\` entry and an \`orbitmap status\` update; finished work defaults to
302
- \`in_review\`, not \`done\`. NEVER edit files inside the OrbitMap workspace directory
303
- directlyalways go through \`orbitmap\` commands.`;
1237
+ This project tracks work in OrbitMap via the \`orbitmap\` CLI (cloud or local files alike).
1238
+ You work in a WORKSPACE: run \`orbitmap context\` first one call gives the workspace, your
1239
+ areas, the active mission, open intents, tasks and documents. Never ask which area it
1240
+ follows from the directory (map in \`.orbitmap/config.json\`); missions, intents and docs
1241
+ need none. When the user mentions tasks, backlog, missions, intents, ideas, issues, vibes,
1242
+ or design, load the matching skill: \`orbitmap\` (core), \`orbitmap-execute\` (tasks),
1243
+ \`orbitmap-plan\` (missions/intents/ideas/issues), \`orbitmap-brainstorm\` (idea outcome),
1244
+ \`orbitmap-design\` (intent solutions), \`orbitmap-docs\` (documents).
1245
+ Golden rules: ONE task at a time per worker the execute skill orchestrates intents; NEVER
1246
+ finish without a final \`orbitmap log\` entry and \`orbitmap status\` update — finished work
1247
+ defaults to \`in_review\`, not \`done\`. NEVER edit workspace files directly — always use \`orbitmap\`.`;
304
1248
  // Non-Claude variant: same rules, but points at the inlined sections below instead of
305
1249
  // skills that these agents cannot load.
306
1250
  export const THIN_HOOK_GENERIC = `## OrbitMap
307
1251
 
308
- This project tracks work in OrbitMap via the \`orbitmap\` CLI (works the same whether data
309
- is in the cloud or in local files). When the user mentions tasks, backlog, missions,
310
- intents, ideas, issues, vibes, or asks you to work on / log / plan something, follow the
311
- sections below: core (context & commands), working on tasks, planning
312
- (missions/intents/ideas/issues), and documents.
313
- Golden rules: work on ONE task at a time; NEVER finish a task session without a final
314
- \`orbitmap log\` entry and an \`orbitmap status\` update; finished work defaults to
315
- \`in_review\`, not \`done\`. NEVER edit files inside the OrbitMap workspace directory
316
- directlyalways go through \`orbitmap\` commands.`;
1252
+ This project tracks work in OrbitMap via the \`orbitmap\` CLI (cloud or local files alike).
1253
+ You work in a WORKSPACE: run \`orbitmap context\` first one call gives the workspace, your
1254
+ areas, the active mission, open intents, tasks and documents. Never ask which area it
1255
+ follows from the directory (map in \`.orbitmap/config.json\`); missions, intents and docs
1256
+ need none. When the user mentions tasks, backlog, missions, intents, ideas, issues, vibes,
1257
+ or design, follow the sections below: core (context & commands), working on tasks,
1258
+ planning (missions/intents/ideas/issues), framing an idea into an outcome, designing an
1259
+ intent's solution, and documents.
1260
+ Golden rules: ONE task at a time per worker intent execution orchestrates its tasks; NEVER
1261
+ finish a task session without a final \`orbitmap log\` entry and an \`orbitmap status\` update;
1262
+ finished work defaults to \`in_review\`, not \`done\`. NEVER edit workspace files directly — always use \`orbitmap\`.`;
317
1263
  // ── Assembly helpers ───────────────────────────────────────────────────────────
318
1264
  /** Build one SKILL.md file (frontmatter + body) for Claude. */
319
1265
  export function buildSkillFile(skill) {
320
1266
  return `${skill.frontmatter}\n\n${skill.body}\n`;
321
1267
  }
322
- /** Build the thin always-on block for a Claude config file (CLAUDE.md). */
323
- export function buildClaudeHook() {
324
- return `${MARKER_START}\n${THIN_HOOK_CLAUDE}\n${MARKER_END}`;
1268
+ /**
1269
+ * One extra line appended to the Claude hook when the skills were installed at PROJECT
1270
+ * scope. `CLAUDE.md` is inherited by every sub-directory, but a project-level
1271
+ * `.claude/skills/` directory is not: a session started in a sibling or child repository
1272
+ * reads this hook and cannot load the skills it names. The hook must therefore say where
1273
+ * the skills actually are, and how to make them visible everywhere. At user scope the
1274
+ * skills are visible wherever the hook is, so no caveat is needed.
1275
+ */
1276
+ export const SKILL_SCOPE_CAVEAT_PROJECT = 'These skills are installed at PROJECT scope, in this directory\'s `.claude/skills/`. ' +
1277
+ 'If you cannot load them (e.g. this session started in a different directory), do not ' +
1278
+ 'guess the workflow — ask the user to run `orbitmap setup-agent --scope user`, which ' +
1279
+ 'installs them into `~/.claude/skills/` where every session can see them.';
1280
+ /**
1281
+ * Build the thin always-on block for a Claude config file (CLAUDE.md).
1282
+ * `scope` is where the accompanying skill files were installed — see
1283
+ * {@link SKILL_SCOPE_CAVEAT_PROJECT}.
1284
+ */
1285
+ export function buildClaudeHook(scope = 'user') {
1286
+ const body = scope === 'project' ? `${THIN_HOOK_CLAUDE}\n${SKILL_SCOPE_CAVEAT_PROJECT}` : THIN_HOOK_CLAUDE;
1287
+ return `${MARKER_START}\n${body}\n${MARKER_END}`;
325
1288
  }
326
1289
  /**
327
- * Build the markdown fallback block for non-Claude agents: the thin hook plus all four
328
- * skill bodies inlined (no skill ecosystem to lean on).
1290
+ * Build the markdown fallback block for non-Claude agents: the thin hook plus every
1291
+ * skill body inlined (no skill ecosystem to lean on).
329
1292
  */
330
1293
  export function buildGenericBlock() {
331
1294
  const bodies = SKILLS.map((skill) => skill.body).join('\n\n---\n\n');