orbitmap 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/README.md +9 -9
  2. package/dist/adapters/cloud.d.ts +16 -1
  3. package/dist/adapters/cloud.js +13 -2
  4. package/dist/adapters/cloud.js.map +1 -1
  5. package/dist/adapters/local/adapter.d.ts +3 -0
  6. package/dist/adapters/local/adapter.js +3 -1
  7. package/dist/adapters/local/adapter.js.map +1 -1
  8. package/dist/adapters/local/entities/planning.d.ts +8 -2
  9. package/dist/adapters/local/entities/planning.js +34 -3
  10. package/dist/adapters/local/entities/planning.js.map +1 -1
  11. package/dist/adapters/local/entities/tasks.d.ts +1 -1
  12. package/dist/adapters/local/entities/tasks.js +33 -1
  13. package/dist/adapters/local/entities/tasks.js.map +1 -1
  14. package/dist/adapters/local/entities/work-items.d.ts +12 -1
  15. package/dist/adapters/local/entities/work-items.js +42 -13
  16. package/dist/adapters/local/entities/work-items.js.map +1 -1
  17. package/dist/adapters/local/lists.d.ts +1 -1
  18. package/dist/adapters/local/lists.js +1 -1
  19. package/dist/adapters/local/lists.js.map +1 -1
  20. package/dist/adapters/local/rules.d.ts +1 -1
  21. package/dist/adapters/local/rules.js +1 -0
  22. package/dist/adapters/local/rules.js.map +1 -1
  23. package/dist/adapters/local/types.d.ts +1 -1
  24. package/dist/adapters/types.d.ts +32 -0
  25. package/dist/agent-instructions.d.ts +16 -15
  26. package/dist/agent-instructions.js +126 -91
  27. package/dist/agent-instructions.js.map +1 -1
  28. package/dist/commands/create.d.ts +1 -0
  29. package/dist/commands/create.js +17 -6
  30. package/dist/commands/create.js.map +1 -1
  31. package/dist/commands/emit-instructions.d.ts +26 -0
  32. package/dist/commands/emit-instructions.js +68 -0
  33. package/dist/commands/emit-instructions.js.map +1 -0
  34. package/dist/commands/ideas.d.ts +17 -0
  35. package/dist/commands/ideas.js +35 -2
  36. package/dist/commands/ideas.js.map +1 -1
  37. package/dist/commands/intent.d.ts +22 -0
  38. package/dist/commands/intent.js +84 -10
  39. package/dist/commands/intent.js.map +1 -1
  40. package/dist/commands/mission.d.ts +1 -0
  41. package/dist/commands/mission.js +1 -1
  42. package/dist/commands/mission.js.map +1 -1
  43. package/dist/commands/orbit.d.ts +1 -0
  44. package/dist/commands/orbit.js +1 -1
  45. package/dist/commands/orbit.js.map +1 -1
  46. package/dist/commands/setup-agent.d.ts +67 -13
  47. package/dist/commands/setup-agent.js +283 -28
  48. package/dist/commands/setup-agent.js.map +1 -1
  49. package/dist/commands/start.js +2 -1
  50. package/dist/commands/start.js.map +1 -1
  51. package/dist/commands/status.d.ts +1 -0
  52. package/dist/commands/status.js +7 -1
  53. package/dist/commands/status.js.map +1 -1
  54. package/dist/errors.d.ts +25 -1
  55. package/dist/errors.js +10 -2
  56. package/dist/errors.js.map +1 -1
  57. package/dist/index.js +60 -15
  58. package/dist/index.js.map +1 -1
  59. package/dist/list-options.d.ts +1 -1
  60. package/dist/list-options.js +1 -1
  61. package/dist/list-options.js.map +1 -1
  62. package/dist/output.js +12 -0
  63. package/dist/output.js.map +1 -1
  64. package/dist/work-log.js +8 -0
  65. package/dist/work-log.js.map +1 -1
  66. package/dist/write-target.d.ts +13 -3
  67. package/dist/write-target.js +40 -3
  68. package/dist/write-target.js.map +1 -1
  69. package/package.json +1 -1
@@ -137,13 +137,49 @@ TL;DRs, areas, mission, task counts, the pair). Pair unchanged → the intent ha
137
137
  moved: SAY SO in one line and keep working from what you hold — no full fetch. Pair
138
138
  changed → re-fetch (\`intent show IN-x\`, with \`--no-logs\` when the log tail is not
139
139
  needed) and remember the new pair in the focus file.`;
140
+ // ── Shared block: the KEEP/DROP TEST (IS-vw765j) ───────────────────────────────
141
+ //
142
+ // ONE definition rendered into all four gate skills. It used to be four byte-identical
143
+ // copies, which is why the contradiction below survived so long: `code_change` is a
144
+ // caller-authorable type, yet the drop list forbade exactly what such an entry is — a
145
+ // fact git already holds. Six worker-built tasks on IN-5pdqkq produced 1 blocker, 8
146
+ // decisions, 12 notes and ZERO code_change entries, every worker obeying the rules
147
+ // correctly. The exemption below resolves it; keeping the block in one place is what
148
+ // makes the next correction a one-line change.
149
+ //
150
+ // The bullet indent differs between skills (execute uses `- `, the three gate skills
151
+ // ` - `), so the caller passes it in; continuation lines sit two spaces further in.
152
+ export function worklogKeepDropTest(indent = '') {
153
+ const c = `${indent} `;
154
+ return `${indent}- KEEP/DROP TEST — log a \`decision\` when ANY of these is true: an alternative was
155
+ ${c}considered and REJECTED (record which, and why it lost); a non-obvious assumption or
156
+ ${c}constraint was LOCKED IN; a choice was made that a later reader would otherwise
157
+ ${c}re-litigate. Do NOT log: restating the outcome, design or plan (they are already
158
+ ${c}fields on the intent); confirming something already written down elsewhere; mechanical
159
+ ${c}facts recoverable from git, CI or the tracker (test counts, file lists, commit hashes);
160
+ ${c}progress narration ("started X", "working on Y").
161
+ ${c}KEEP → "Parallelised the build across four subagents; the Laravel slices were split by
162
+ ${c}file ownership to avoid collisions in one working tree." — records the rejected
163
+ ${c}alternative (one agent per repo) and why it lost.
164
+ ${c}DROP → "make verify green at 2415 passed after merging all four agents." — a mechanical
165
+ ${c}fact already in the commit message and the CI output.
166
+ ${c}EXEMPTION — \`code_change\` is the one type the "mechanical facts" rule does NOT
167
+ ${c}forbid. Work that ships closes with ONE entry naming WHAT shipped and where: the
168
+ ${c}shape of the change, never a file listing, which the \`[TS-x]\` commit already
169
+ ${c}carries. Use it too for changes git CANNOT see — a config flipped in a dashboard, a
170
+ ${c}migration run against a live database, an external system mutated. Without this a
171
+ ${c}task records why every decision was made and never what was built.`;
172
+ }
140
173
  // ── Skill: orbitmap (core) — §8.3 ──────────────────────────────────────────────
141
174
  export const SKILL_ORBITMAP_FRONTMATTER = `---
142
175
  name: orbitmap
143
176
  description: >
144
- OrbitMap project management via the orbitmap CLI. Use when the user mentions OrbitMap,
145
- orbit, tasks, backlog, missions, intents, ideas, issues, vibes, or asks to track,
146
- plan, or log work. Entry point: object model, context resolution, command reference.
177
+ OrbitMap project management via the orbitmap CLI the entry point other orbitmap-*
178
+ skills require. Use whenever the user wants to build, add, change or fix something, in
179
+ whatever words they use do not wait for OrbitMap vocabulary — as well as when they
180
+ mention OrbitMap, orbit, tasks, backlog, missions, intents, ideas, issues, vibes, or ask
181
+ to track, plan, or log work. Covers the object model, context resolution, and command
182
+ reference.
147
183
  ---`;
148
184
  export const SKILL_ORBITMAP_BODY = `# OrbitMap CLI — core
149
185
 
@@ -164,10 +200,9 @@ MCP tool schemas are the authority. Never edit the workspace data files directly
164
200
  ## General behaviour
165
201
  - Always prioritise the user's direct request. If the user asks you to do something
166
202
  (read a file, write code, answer a question), handle that first.
167
- - Only interact with OrbitMap when the user explicitly asks you to (e.g. "check my
168
- tasks", "start a task", "what's on my backlog", "log this idea").
169
203
  - When the user mentions OrbitMap, orbit, task, backlog, or project-management concepts
170
- in the context of tracking work, use \`orbitmap\` commands to handle the request.
204
+ in the context of tracking work — in whatever words they use — use \`orbitmap\` commands
205
+ to handle the request.
171
206
 
172
207
  ## Object model
173
208
  - Workspace = team level. Area = repo-level scope (formerly Project) — tasks, vibes and
@@ -177,6 +212,14 @@ MCP tool schemas are the authority. Never edit the workspace data files directly
177
212
  outside a task. Task (TS-) = unit of work.
178
213
  - Entity numbers (TS-xxxxxx etc.) are accepted by every command that takes an id.
179
214
 
215
+ ## Naming workitems in output
216
+ Refer to a workitem by its NAME together with its key, at first mention in any message,
217
+ summary or report — "Align skills and validators (IN-b2h63q)". NEVER a bare key: a key
218
+ alone is unreadable to the user, who tracks the work by name. Keep no key-to-name mapping
219
+ anywhere — not in a file, not in memory. Every list, \`show\` and context response already
220
+ pairs the two, so take the name from the response you already have; if you do not have it,
221
+ fetch the item rather than emitting the key on its own.
222
+
180
223
  ${SESSION_FOCUS_SECTION}
181
224
 
182
225
  ${FRESHNESS_SECTION}
@@ -189,10 +232,9 @@ ${FRESHNESS_SECTION}
189
232
  lists and no bodies — fetch deeper on demand (\`orbitmap intent show IN-x\`,
190
233
  \`orbitmap tasks --intent IN-x\`, \`orbitmap doc <slug>\`). Never list areas and never
191
234
  ask the user "which area?" before you have read it.
192
- - You work in a WORKSPACE, not inside a single area. Missions, intents
193
- and documents are workspace-level and take no area a document is exactly ONE copy,
194
- global to the workspace, never per-area. Tasks, vibes, issues and ideas are
195
- AREA-scoped.
235
+ - You work in a WORKSPACE, not inside a single area. Missions and intents are
236
+ workspace-level and take no area. Documents live at area OR workspace level.
237
+ Tasks, vibes, issues and ideas are AREA-scoped.
196
238
  - Missions and intents outrank individual tasks. Asked to work on "what matters", take the
197
239
  active mission and open intents from context and pick work that serves them.
198
240
  - The area follows from the directory, never from a question to the user:
@@ -248,7 +290,7 @@ backlog, todo, in_progress, in_review, review_changes, done, blocked.
248
290
  - Tasks: \`orbitmap tasks [--status s1,s2] [--intent IN-x]\`, \`orbitmap task TS-x\`,
249
291
  \`orbitmap get <ID>\`,
250
292
  \`orbitmap start [TS-x]\`, \`orbitmap status TS-x <status> [--delivery <d>]\`,
251
- \`orbitmap create "title" [--intent IN-x|--mission MS-x] [--priority p]\`,
293
+ \`orbitmap create "title" [--intent IN-x] [--priority p]\`,
252
294
  \`orbitmap subtask TS-parent "title"\`, \`orbitmap assign TS-x [agent]\`,
253
295
  \`orbitmap dep add|remove TS-a TS-b\`, \`orbitmap log TS-x "msg" --type <t>\`
254
296
  - Issues: \`orbitmap issue register|list|show|status|resolve\`
@@ -276,7 +318,7 @@ description: >
276
318
  the user's), and "work on TS-x" runs a single tracked task (starting/resuming,
277
319
  logging, finishing with the correct status, git branches and delivery status). Use
278
320
  whenever executing a planned intent or implementing, resuming, or finishing a
279
- tracked task.
321
+ tracked task. Requires the \`orbitmap\` core skill.
280
322
  ---`;
281
323
  export const SKILL_EXECUTE_BODY = `# Executing OrbitMap work
282
324
 
@@ -393,13 +435,18 @@ MCP tool schemas are the authority. Never edit the workspace data files directly
393
435
  delivered or honestly blocked and the gates are green vs baseline. An unfixable intent
394
436
  test or a design contradiction → STOP and ask the user: that is intent-level risk, the
395
437
  one thing that interrupts.
396
- 8. **Report + resume note.** Leave every repo checked out on its BASE branch — the
397
- intent branch is named in the report, not left underfoot. Report in chat: what
398
- shipped, what was decided, what is blocked and why, deviations from the plan, gate
399
- results vs baseline. Write ONE resume
400
- point: \`orbitmap log IN-x "Resume point: …" --type note\`. The intent STAYS \`build\`;
401
- merging and closing are the USER'S. The merge EVENT whoever performs it — is what
402
- later flips the tasks to \`--delivery merged\`.
438
+ 8. **Report + move the intent to in_review.** Leave every repo checked out on its BASE
439
+ branch — the intent branch is named in the report, not left underfoot. Report in
440
+ chat: what shipped, what was decided, what is blocked and why, deviations from the
441
+ plan, gate results vs baseline. Write ONE resume
442
+ point: \`orbitmap log IN-x "Resume point: …" --type note\`. Before the transition, run
443
+ \`orbitmap intent show IN-x --slim\` and verify every task is \`in_review\`, \`done\`, or
444
+ \`blocked\` with a logged blocker an \`in_progress\` task means a fold step was
445
+ skipped; fix it before moving on. Then end the run:
446
+ \`orbitmap intent update IN-x --status in_review --log <entries>\` — the transition's
447
+ response carries an Instructions section (it will ask for release notes); FOLLOW it.
448
+ Merging and closing to \`done\` are the USER'S. The merge EVENT — whoever performs
449
+ it — is what later flips the tasks to \`--delivery merged\`.
403
450
 
404
451
  **No subagent runtime?** Same flow, serial: do steps 4–7 yourself, task by task, with the
405
452
  worker contract as your own build rules. The contract is the outcome, not the parallelism.
@@ -421,7 +468,7 @@ digraph orbitmap_execute {
421
468
  "Regressions or intent-test failures?" [shape=diamond];
422
469
  "Fix findings, scoped tests per fix" [shape=box];
423
470
  "Intent-level risk: stop and ask the user" [shape=box];
424
- "Report + resume note; intent stays build; user merges" [shape=doublecircle];
471
+ "Report + resume note; intent update --status in_review; user merges" [shape=doublecircle];
425
472
 
426
473
  "Premise: intent at build, tasks with instructions?" -> "Refuse politely; point at the missing gate" [label="no"];
427
474
  "Premise: intent at build, tasks with instructions?" -> "Baseline: full gate per touched repo, results recorded" [label="yes"];
@@ -439,7 +486,7 @@ digraph orbitmap_execute {
439
486
  "Regressions or intent-test failures?" -> "Fix findings, scoped tests per fix" [label="yes"];
440
487
  "Fix findings, scoped tests per fix" -> "Impact pass: full gate per repo, diff vs baseline (+contract steps)" [label="re-run"];
441
488
  "Fix findings, scoped tests per fix" -> "Intent-level risk: stop and ask the user" [label="unfixable / contradiction"];
442
- "Regressions or intent-test failures?" -> "Report + resume note; intent stays build; user merges" [label="no"];
489
+ "Regressions or intent-test failures?" -> "Report + resume note; intent update --status in_review; user merges" [label="no"];
443
490
  }
444
491
  \`\`\`
445
492
 
@@ -476,18 +523,7 @@ digraph orbitmap_execute {
476
523
  \`blocker\` goes in as \`note\`, with \`--meta\` carrying any unusual structure. There is
477
524
  deliberately NO \`other\` type. NEVER write \`status_change\` — the server authors it on
478
525
  every transition and the API rejects it from clients.
479
- - KEEP/DROP TEST — log a \`decision\` when ANY of these is true: an alternative was
480
- considered and REJECTED (record which, and why it lost); a non-obvious assumption or
481
- constraint was LOCKED IN; a choice was made that a later reader would otherwise
482
- re-litigate. Do NOT log: restating the outcome, design or plan (they are already
483
- fields on the intent); confirming something already written down elsewhere; mechanical
484
- facts recoverable from git, CI or the tracker (test counts, file lists, commit hashes);
485
- progress narration ("started X", "working on Y").
486
- KEEP → "Parallelised the build across four subagents; the Laravel slices were split by
487
- file ownership to avoid collisions in one working tree." — records the rejected
488
- alternative (one agent per repo) and why it lost.
489
- DROP → "make verify green at 2415 passed after merging all four agents." — a mechanical
490
- fact already in the commit message and the CI output.
526
+ ${worklogKeepDropTest()}
491
527
  - Promote to the parent intent — TWO filters, BOTH must pass: the entry is a \`decision\` or
492
528
  \`blocker\` (never \`note\`/\`code_change\`), AND it passes the keep/drop test. Then ALSO
493
529
  write a SECOND, separately-worded entry for a reader who never saw the task:
@@ -533,7 +569,9 @@ digraph orbitmap_execute {
533
569
 
534
570
  ## Rules
535
571
  - Flow A never merges, never pushes to the default branch, never closes tasks or the
536
- intent as \`done\` — the run ends at \`in_review\` on the intent branch, intent at \`build\`.
572
+ intent as \`done\` — the run ends with \`orbitmap intent update IN-x --status in_review
573
+ --log …\` (follow the Instructions the transition returns); merging and \`done\` are
574
+ the user's.
537
575
  - Baseline before any change; "no new bugs" = no failure absent from the baseline.
538
576
  - The fix loop is goal-based — no round cap; termination is delivered-or-blocked plus
539
577
  green gates, never a retry budget.
@@ -599,6 +637,12 @@ it blocks, a discovery or risk outside your boundary, what a failing check revea
599
637
  NOT file lists, test counts, or progress narration. 1–3 entries on a normal task —
600
638
  losing nothing is the goal, volume is not.
601
639
 
640
+ Close with ONE \`code_change\` entry naming WHAT you shipped and where — the shape of the
641
+ change, never a file listing, which the \`[TS-x]\` commit already carries. It is the one
642
+ type the "not mechanical facts" rule above does not forbid: without it your task records
643
+ why every decision was made and never what was built. Use it too for anything git cannot
644
+ see — a config flipped in a dashboard, a migration run against a live database.
645
+
602
646
  ## Report — your final text goes to the orchestrator, not to a user
603
647
  Structure it as:
604
648
  - **Files changed** — every file, one line each on what changed and why.
@@ -620,7 +664,7 @@ description: >
620
664
  cross-task notes in the intent plan field, and a doc-update-after-green step; then creates
621
665
  the tasks and hands off to orbitmap-execute. Use for "plan this intent", "break this down
622
666
  into tasks", an intent entering \`plan\` status — and for general planning (missions,
623
- intents, promoting ideas, triaging issues).
667
+ intents, promoting ideas, triaging issues). Requires the \`orbitmap\` core skill.
624
668
  ---`;
625
669
  export const SKILL_PLAN_BODY = `# Planning a design into executable tasks
626
670
 
@@ -723,18 +767,7 @@ task/issue that has an intent; the CLI enforces this.
723
767
  \`orbitmap intent update IN-x --areas <slug>,<slug>\` (the distinct areas of the
724
768
  tasks you are creating). Declared areas feed session-focus matching for every later
725
769
  session.
726
- - KEEP/DROP TEST — log a \`decision\` when ANY of these is true: an alternative was
727
- considered and REJECTED (record which, and why it lost); a non-obvious assumption or
728
- constraint was LOCKED IN; a choice was made that a later reader would otherwise
729
- re-litigate. Do NOT log: restating the outcome, design or plan (they are already
730
- fields on the intent); confirming something already written down elsewhere; mechanical
731
- facts recoverable from git, CI or the tracker (test counts, file lists, commit hashes);
732
- progress narration ("started X", "working on Y").
733
- KEEP → "Parallelised the build across four subagents; the Laravel slices were split by
734
- file ownership to avoid collisions in one working tree." — records the rejected
735
- alternative (one agent per repo) and why it lost.
736
- DROP → "make verify green at 2415 passed after merging all four agents." — a mechanical
737
- fact already in the commit message and the CI output.
770
+ ${worklogKeepDropTest(' ')}
738
771
  - LOG IT THE MOMENT IT IS AGREED, not batched at the end:
739
772
  \`orbitmap log IN-x "<the decision and why — task shape, sequencing, area>" --type decision\`.
740
773
  An abandoned session must still leave its decisions recorded.
@@ -755,8 +788,10 @@ task/issue that has an intent; the CLI enforces this.
755
788
  add or fix tasks and re-check. Do NOT proceed while a gap remains.
756
789
  7. Write cross-task PLANNING NOTES + a short SUMMARY to the intent \`plan\` field —
757
790
  \`orbitmap intent update IN-x --plan "<notes>"\`: decisions valid for all tasks,
758
- sequencing rationale, and the coverage argument. This REPLACES any seed notes that were
759
- in the field you have already absorbed them.
791
+ sequencing rationale, and the coverage argument. AUTHOR THE FIELD AS: a summary
792
+ paragraph first, then a line containing only \`---\`, then the body. The server reads the
793
+ part before \`---\` as the field's TL;DR and flags a field written without one.
794
+ This REPLACES any seed notes that were in the field — you have already absorbed them.
760
795
  8. Ensure a final DOC-UPDATE task exists: after the implementation is done and all tests
761
796
  are green, update the OrbitMap documentation (see the \`orbitmap-docs\` skill).
762
797
  9. SELF-REVIEW the plan with fresh eyes (see the Self-review section) and fix issues inline.
@@ -847,12 +882,15 @@ triaging issues):
847
882
  - **Missions:** \`orbitmap mission list|show MS-x\`; \`orbitmap mission create "name"
848
883
  [--outcome "…"] [--start d] [--end d]\`; \`orbitmap mission status MS-x
849
884
  active|completed|cancelled\` (activating fails while another is active — complete/cancel
850
- it first); \`orbitmap mission link|unlink MS-x IN-y|TS-y|IS-y|ID-y\`. A mission status
885
+ it first); \`orbitmap mission link|unlink MS-x --type task|issue|idea|intent --id <uuid>\`
886
+ (the linked object goes by UUID — this endpoint rejects display numbers). A mission status
851
887
  change takes the same repeatable \`--log <type>:<content>\` and is refused (422) without
852
888
  at least one entry — \`cancelled\` above all needs its \`decision:"<why abandoned>"\`.
853
889
  \`orbitmap log MS-x "…" --type …\` logs against a mission outside a transition.
854
- - **Intents:** \`orbitmap intent create "name" [--outcome "…"] [--design "…"] [--plan "…"]
855
- [--mission MS-x]\`, statuses new design plan build done (or cancelled). The
890
+ - **Intents:** \`orbitmap intent create "name" [--outcome "…"] [--design "…"] [--plan "…"]\`
891
+ (there is no \`--mission\` flag attach after creation with \`orbitmap mission link MS-x
892
+ --type intent --id <uuid>\`), statuses new → design → plan → build → done (or
893
+ cancelled). The
856
894
  \`outcome\` is the north star, \`design\` the agreed solution, \`plan\` the agreed build
857
895
  plan — produced by the \`orbitmap-brainstorm\` / \`orbitmap-design\` / \`orbitmap-plan\`
858
896
  gates respectively.
@@ -897,7 +935,8 @@ description: >
897
935
  time until the outcome is AGREED, writes that outcome to the intent's outcome field, and
898
936
  files useful asides to the design (and, when relevant, plan) fields for the later gates.
899
937
  Use for "I have an idea", "brainstorm this", "let's think through X", "what should we
900
- build/do about X", shaping an intent's outcome, or an intent at \`new\` status.
938
+ build/do about X", shaping an intent's outcome, or an intent at \`new\` status. Requires
939
+ the \`orbitmap\` core skill.
901
940
  ---`;
902
941
  export const SKILL_BRAINSTORM_BODY = `# Framing an idea into an outcome
903
942
 
@@ -943,6 +982,9 @@ you hand to \`orbitmap-design\` (and, through the plan field, to \`orbitmap-plan
943
982
  ONE question. Prefer proposing a sensible default for the user to correct over an open
944
983
  interrogation. Aim for the few highest-leverage questions — "one question at a time" sets
945
984
  the pace, not the total count.
985
+ - **Answer before asking.** When the user's turn contains a question, answer it first —
986
+ completely — before asking your own. Never return a question with a question; an
987
+ unanswered user question makes every next question feel like an interrogation.
946
988
  - **Lead with a recommendation.** Present options and the outcome conversationally, leading
947
989
  with the option you recommend and WHY — never a flat, neutral menu with no steer.
948
990
  - **YAGNI.** Cut every want that does not serve the outcome; a smaller outcome ships.
@@ -992,18 +1034,7 @@ you hand to \`orbitmap-design\` (and, through the plan field, to \`orbitmap-plan
992
1034
  and for whom, what success looks like, the constraints. As you go, capture the user's
993
1035
  opinions, preferences and context as notes; these outrank your own ideas in the design
994
1036
  stage, so record them faithfully.
995
- - KEEP/DROP TEST — log a \`decision\` when ANY of these is true: an alternative was
996
- considered and REJECTED (record which, and why it lost); a non-obvious assumption or
997
- constraint was LOCKED IN; a choice was made that a later reader would otherwise
998
- re-litigate. Do NOT log: restating the outcome, design or plan (they are already
999
- fields on the intent); confirming something already written down elsewhere; mechanical
1000
- facts recoverable from git, CI or the tracker (test counts, file lists, commit hashes);
1001
- progress narration ("started X", "working on Y").
1002
- KEEP → "Parallelised the build across four subagents; the Laravel slices were split by
1003
- file ownership to avoid collisions in one working tree." — records the rejected
1004
- alternative (one agent per repo) and why it lost.
1005
- DROP → "make verify green at 2415 passed after merging all four agents." — a mechanical
1006
- fact already in the commit message and the CI output.
1037
+ ${worklogKeepDropTest(' ')}
1007
1038
  - LOG IT THE MOMENT IT PASSES, not batched at the end: \`orbitmap log IN-x "<what was
1008
1039
  decided and why>" --type decision\`. An abandoned session must still leave its decisions
1009
1040
  recorded. If the intent does not exist yet, create it (step 4) at the first passing
@@ -1019,7 +1050,10 @@ you hand to \`orbitmap-design\` (and, through the plan field, to \`orbitmap-plan
1019
1050
  4. Persist (create or refine). Update an existing unprocessed intent, or create one:
1020
1051
  \`orbitmap intent update IN-x --outcome "<agreed outcome>" [--design "<design notes>"] [--plan "<plan notes>"]\`
1021
1052
  / \`orbitmap intent create "<name>" --outcome "<agreed outcome>" [--design "…"] [--plan "…"]\`.
1022
- The agreed **outcome** goes in the outcome field. Route the captured notes by type
1053
+ The agreed **outcome** goes in the outcome field. AUTHOR EVERY FIELD THE SAME WAY: a
1054
+ summary paragraph first, then a line containing only \`---\`, then the body. The server
1055
+ reads the part before \`---\` as the field's TL;DR and flags a field written without one.
1056
+ Route the captured notes by type —
1023
1057
  HOW / tech / UX → the **design** field; build-order / task ideas / execution risks → the
1024
1058
  **plan** field (OPTIONAL — only if the conversation produced any). Mark the user's notes
1025
1059
  as the user's in both fields; you may add your own, kept separate. The design gate reads
@@ -1108,7 +1142,8 @@ description: >
1108
1142
  technical spec, and UX (when there's UI), one question at a time, then writes the
1109
1143
  result to the intent's design field. Use for "design this intent", "let's design X", or
1110
1144
  an intent entering \`design\` status. Use it once the outcome is agreed; if the outcome is
1111
- still missing or vague, step aside to \`orbitmap-brainstorm\` first.
1145
+ still missing or vague, step aside to \`orbitmap-brainstorm\` first. Requires the
1146
+ \`orbitmap\` core skill.
1112
1147
  ---`;
1113
1148
  export const SKILL_DESIGN_BODY = `# Designing an intent's solution
1114
1149
 
@@ -1152,6 +1187,9 @@ holds a real design doc instead of raw notes, treat it as existing design to ref
1152
1187
  ONE question. Prefer proposing a sensible default for the user to correct over an open
1153
1188
  interrogation. Aim for the few highest-leverage questions — "one question at a time" sets
1154
1189
  the pace, not the total count.
1190
+ - **Answer before asking.** When the user's turn contains a question, answer it first —
1191
+ completely — before asking your own. Never return a question with a question; an
1192
+ unanswered user question makes every next question feel like an interrogation.
1155
1193
  - **Lead with a recommendation.** When you propose approaches or technical options, lead
1156
1194
  with the one you recommend and WHY — never a flat, neutral menu with no steer.
1157
1195
  - **YAGNI.** Cut every part of the design that does not serve the outcome; a smaller
@@ -1207,18 +1245,7 @@ well-bounded units are easier to build, review, and reason about.
1207
1245
  cases, data/API shape. Continuously check whether the emerging design actually delivers
1208
1246
  the outcome, and surface any gap where it would not. Capture the user's decisions and
1209
1247
  the reasoning behind them as you go — those decisions are part of the design.
1210
- - KEEP/DROP TEST — log a \`decision\` when ANY of these is true: an alternative was
1211
- considered and REJECTED (record which, and why it lost); a non-obvious assumption or
1212
- constraint was LOCKED IN; a choice was made that a later reader would otherwise
1213
- re-litigate. Do NOT log: restating the outcome, design or plan (they are already
1214
- fields on the intent); confirming something already written down elsewhere; mechanical
1215
- facts recoverable from git, CI or the tracker (test counts, file lists, commit hashes);
1216
- progress narration ("started X", "working on Y").
1217
- KEEP → "Parallelised the build across four subagents; the Laravel slices were split by
1218
- file ownership to avoid collisions in one working tree." — records the rejected
1219
- alternative (one agent per repo) and why it lost.
1220
- DROP → "make verify green at 2415 passed after merging all four agents." — a mechanical
1221
- fact already in the commit message and the CI output.
1248
+ ${worklogKeepDropTest(' ')}
1222
1249
  - LOG IT THE MOMENT IT IS AGREED, not batched at the end: \`orbitmap log IN-x "<the choice
1223
1250
  and why, incl. what it rules out>" --type decision\`. An abandoned session must still
1224
1251
  leave its decisions recorded.
@@ -1249,7 +1276,10 @@ well-bounded units are easier to build, review, and reason about.
1249
1276
  5. Present the draft in sections scaled to their complexity (a few sentences when simple,
1250
1277
  more when nuanced); after each section ask whether it looks right, and get the user's
1251
1278
  approval before writing anything.
1252
- 6. Write it: \`orbitmap intent update IN-x --design "<doc>"\`. This REPLACES any framing
1279
+ 6. Write it: \`orbitmap intent update IN-x --design "<doc>"\`. AUTHOR THE FIELD AS: a
1280
+ summary paragraph first, then a line containing only \`---\`, then the body. The server
1281
+ reads the part before \`---\` as the field's TL;DR and flags a field written without one.
1282
+ This REPLACES any framing
1253
1283
  notes that were in the field — you have already absorbed them into the doc. When the
1254
1284
  spec names the repos the build will touch, declare them on the intent in the same
1255
1285
  update — \`--areas <slug>,<slug>\` — so session-focus matching works from declared data.
@@ -1347,14 +1377,14 @@ name: orbitmap-docs
1347
1377
  description: >
1348
1378
  Reading and updating OrbitMap documents (specs, architecture, guides, decisions).
1349
1379
  Use when the user asks to read, import, or update project documentation tracked in
1350
- OrbitMap.
1380
+ OrbitMap. Requires the \`orbitmap\` core skill.
1351
1381
  ---`;
1352
1382
  export const SKILL_DOCS_BODY = `# OrbitMap documents
1353
1383
 
1354
- Documents are workspace-level: exactly ONE copy per workspace, never per-area. No document
1355
- command takes an area, and their metadata (slug, when to use) already rides the context
1356
- payload your session focus was matched from (see Session focus in the \`orbitmap\` skill —
1357
- ensure, don't re-call).
1384
+ Documents live at area or workspace level: \`orbitmap docs\` lists every document you can
1385
+ reach your areas' documents plus the workspace-level ones — and their metadata (slug,
1386
+ when to use) already rides the context payload your session focus was matched from (see
1387
+ Session focus in the \`orbitmap\` skill — ensure, don't re-call).
1358
1388
 
1359
1389
  ## Goal
1360
1390
  Read and update OrbitMap documents efficiently: pull only the context you need (TOC →
@@ -1379,8 +1409,10 @@ for the full content, read that file instead of printing the content into the
1379
1409
  conversation.
1380
1410
 
1381
1411
  ## Editing
1382
- - Import a new document: \`orbitmap doc-import <file.md> --title "…" --type
1383
- spec|architecture|api|guide|decision|changelog|other [--context "…"]\`.
1412
+ - Import a new document: \`orbitmap doc-import <title> --file <file.md> --type
1413
+ spec|architecture|api|guide|decision|changelog|other [--context "…"]\`. It lands
1414
+ area-level, resolved from the current directory; add \`--workspace-id <slug-or-uuid>\`
1415
+ to create it workspace-level instead.
1384
1416
  - Update: \`orbitmap doc-update <slug> --file <file.md>\` (replaces content, bumps
1385
1417
  version).
1386
1418
  - To change an OrbitMap document, ALWAYS go through these commands — NEVER edit files
@@ -1431,7 +1463,7 @@ export const SKILLS = [
1431
1463
  },
1432
1464
  ];
1433
1465
  // ── The thin always-on hook (CLAUDE.md / AGENTS.md) ────────────────────────────
1434
- // Claude variant — §8.2, verbatim (without the markers, which buildClaudeHook adds).
1466
+ // Claude variant — §8.2, verbatim (without the markers, which buildClaudeBlock adds).
1435
1467
  export const THIN_HOOK_CLAUDE = `## OrbitMap
1436
1468
 
1437
1469
  Work is tracked in OrbitMap via the \`orbitmap\` CLI. You work in a WORKSPACE, which can span
@@ -1440,11 +1472,13 @@ the workspace itself, not to any one repo.
1440
1472
  Load the OrbitMap skills whenever the user wants to build, add, change or fix something, in
1441
1473
  whatever words they use — do not wait for OrbitMap vocabulary. Load them too when they talk
1442
1474
  about tracking work (backlog, tasks, missions, intents, ideas, issues, documents, planning).
1475
+ Load the core skill 'orbitmap' first, before any other orbitmap-* skill — they all build on it.
1443
1476
  Nothing gets built before it is framed: a feature, component or behaviour change gets an intent
1444
1477
  — outcome (brainstorm) → design → plan → build (execute), one gate at a time, written to the
1445
1478
  intent as you go. Small self-contained work (a typo, an obvious one-file fix) is just a task.
1446
1479
  NEVER finish a task, intent or mission without a final \`orbitmap log\` entry and a status update;
1447
- the final entry closes a record that already exists. Finished work defaults to \`in_review\`, not \`done\`.`;
1480
+ the final entry closes a record that already exists. Finished work defaults to \`in_review\`, not \`done\`.
1481
+ OrbitMap tool responses may carry an Instructions section — act on it before continuing.`;
1448
1482
  // Non-Claude variant: same rules, but points at the inlined sections below instead of
1449
1483
  // skills that these agents cannot load.
1450
1484
  export const THIN_HOOK_GENERIC = `## OrbitMap
@@ -1459,7 +1493,8 @@ Nothing gets built before it is framed: a feature, component or behaviour change
1459
1493
  — outcome (brainstorm) → design → plan → build (execute), one gate at a time, written to the
1460
1494
  intent as you go. Small self-contained work (a typo, an obvious one-file fix) is just a task.
1461
1495
  NEVER finish a task, intent or mission without a final \`orbitmap log\` entry and a status update;
1462
- the final entry closes a record that already exists. Finished work defaults to \`in_review\`, not \`done\`.`;
1496
+ the final entry closes a record that already exists. Finished work defaults to \`in_review\`, not \`done\`.
1497
+ OrbitMap tool responses may carry an Instructions section — act on it before continuing.`;
1463
1498
  // ── Assembly helpers ───────────────────────────────────────────────────────────
1464
1499
  /** Build one SKILL.md file (frontmatter + body) for Claude. */
1465
1500
  export function buildSkillFile(skill) {
@@ -1482,7 +1517,7 @@ export const SKILL_SCOPE_CAVEAT_PROJECT = 'These skills are installed at PROJECT
1482
1517
  * `scope` is where the accompanying skill files were installed — see
1483
1518
  * {@link SKILL_SCOPE_CAVEAT_PROJECT}.
1484
1519
  */
1485
- export function buildClaudeHook(scope = 'user') {
1520
+ export function buildClaudeBlock(scope = 'user') {
1486
1521
  const body = scope === 'project' ? `${THIN_HOOK_CLAUDE}\n${SKILL_SCOPE_CAVEAT_PROJECT}` : THIN_HOOK_CLAUDE;
1487
1522
  return `${MARKER_START}\n${body}\n${MARKER_END}`;
1488
1523
  }
@@ -1 +1 @@
1
- {"version":3,"file":"agent-instructions.js","sourceRoot":"","sources":["../src/agent-instructions.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,EAAE;AACF,oFAAoF;AACpF,oFAAoF;AACpF,wEAAwE;AACxE,EAAE;AACF,2DAA2D;AAC3D,oFAAoF;AACpF,oFAAoF;AACpF,oFAAoF;AACpF,+EAA+E;AAC/E,qEAAqE;AACrE,6EAA6E;AAC7E,oFAAoF;AACpF,4DAA4D;AAC5D,8EAA8E;AAC9E,6EAA6E;AAC7E,kFAAkF;AAClF,8EAA8E;AAC9E,qFAAqF;AACrF,sFAAsF;AACtF,uFAAuF;AACvF,uFAAuF;AACvF,yFAAyF;AACzF,mFAAmF;AACnF,qFAAqF;AACrF,4EAA4E;AAC5E,oFAAoF;AACpF,kFAAkF;AAClF,2EAA2E;AAC3E,0DAA0D;AAC1D,0CAA0C;AAC1C,wFAAwF;AACxF,wFAAwF;AACxF,sEAAsE;AACtE,qFAAqF;AACrF,qFAAqF;AACrF,iFAAiF;AACjF,wFAAwF;AACxF,sFAAsF;AACtF,+CAA+C;AAC/C,EAAE;AACF,gFAAgF;AAChF,qFAAqF;AACrF,qFAAqF;AACrF,qFAAqF;AACrF,2EAA2E;AAE3E,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GACtB,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,iBAAiB,CACjD,CAAC,OAAO,CAAC;AAEV;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAEzD;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,mBAAmB,KAAK,WAAW,MAAM,CAAC;AAEzE,6EAA6E;AAC7E,MAAM,CAAC,MAAM,UAAU,GAAG,uB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
12
12
  fromIssue?: string;
13
13
  intent?: string;
14
+ mission?: string;
14
15
  orbit?: string;
15
16
  }): Promise<void>;
@@ -1,15 +1,25 @@
1
1
  import { createAdapter } from '../adapters/factory.js';
2
2
  import { confirmWriteTarget } from '../write-target.js';
3
- import { formatOutput, printError, printSuccess } from '../output.js';
3
+ import { formatOutput, printError, printSuccess, printValidationError } from '../output.js';
4
4
  export async function createCommand(title, options) {
5
+ // Mutually exclusive by design (TS-bh8d25): a task under an intent reaches its
6
+ // mission THROUGH the intent, so the server rejects both together with a 422.
7
+ // Rejecting here — before the write-target prompt and before any request — turns
8
+ // that round trip into an immediate, actionable message.
9
+ if (options.intent && options.mission) {
10
+ printValidationError('--intent and --mission are mutually exclusive — a task under an intent reaches ' +
11
+ 'the mission through the intent. Provide only one (or set the mission on the intent).', options.json);
12
+ return;
13
+ }
5
14
  try {
6
15
  await confirmWriteTarget('create task', options);
7
16
  const client = await createAdapter(options.area);
8
- // Every object reference below — the issue, the intent, the orbit, the agent — travels
9
- // VERBATIM. `POST /tasks` validates `source_issue_id`, `intent_id`, `orbit_id` and
10
- // `agent_id` with `App\Rules\EntityRef` (shape only) and resolves the uuid / display
11
- // number / bare code / slug server-side (TS-av6332), answering 404 ISSUE_NOT_FOUND,
12
- // INTENT_NOT_FOUND, ORBIT_NOT_FOUND or AGENT_NOT_FOUND when the reference is unknown.
17
+ // Every object reference below — the issue, the intent, the mission, the orbit, the
18
+ // agent — travels VERBATIM. `POST /tasks` validates `source_issue_id`, `intent_id`,
19
+ // `mission_id`, `orbit_id` and `agent_id` with `App\Rules\EntityRef` (shape only) and
20
+ // resolves the uuid / display number / bare code / slug server-side (TS-av6332),
21
+ // answering 404 ISSUE_NOT_FOUND, INTENT_NOT_FOUND, MISSION_NOT_FOUND, ORBIT_NOT_FOUND
22
+ // or AGENT_NOT_FOUND when the reference is unknown.
13
23
  // Resolving any of them here would duplicate server logic and cost an extra round trip —
14
24
  // which is exactly what `--from-issue` used to pay for a `GET /issues/{id_or_number}`.
15
25
  const response = (await client.createTask({
@@ -23,6 +33,7 @@ export async function createCommand(title, options) {
23
33
  agent_instructions: options.instructions,
24
34
  source_issue_id: options.fromIssue,
25
35
  intent_id: options.intent,
36
+ mission_id: options.mission,
26
37
  orbit_id: options.orbit,
27
38
  }));
28
39
  if (options.json) {
@@ -1 +1 @@
1
- {"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAoBtE,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,KAAa,EACb,OAcC;IAED,IAAI,CAAC;QACH,MAAM,kBAAkB,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QACjD,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAEjD,uFAAuF;QACvF,mFAAmF;QACnF,qFAAqF;QACrF,oFAAoF;QACpF,sFAAsF;QACtF,yFAAyF;QACzF,uFAAuF;QACvF,MAAM,QAAQ,GAAG,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC;YACxC,KAAK;YACL,WAAW,EAAE,OAAO,CAAC,IAAI;YACzB,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,gBAAgB,EAAE,OAAO,CAAC,MAAM;YAChC,QAAQ,EAAE,OAAO,CAAC,OAAO;YACzB,WAAW,EAAE,OAAO,CAAC,MAAM;YAC3B,kBAAkB,EAAE,OAAO,CAAC,YAAY;YACxC,eAAe,EAAE,OAAO,CAAC,SAAS;YAClC,SAAS,EAAE,OAAO,CAAC,MAAM;YACzB,QAAQ,EAAE,OAAO,CAAC,KAAK;SACxB,CAAC,CAAmB,CAA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CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;YAC1C,OAAO;QACT,CAAC;QAED,MAAM,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC;QACxB,IAAI,GAAG,GAAG,iBAAiB,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,cAAc,IAAI,CAAC,CAAC,WAAW,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,QAAQ,GAAG,CAAC;QACzG,yFAAyF;QACzF,wFAAwF;QACxF,yFAAyF;QACzF,qDAAqD;QACrD,IAAI,CAAC,CAAC,mBAAmB,EAAE,CAAC;YAC1B,GAAG,IAAI,qBAAqB,CAAC,CAAC,mBAAmB,IAAI,OAAO,CAAC,SAAS,sBAAsB,CAAC;QAC/F,CAAC;QACD,IAAI,CAAC,CAAC,oBAAoB,EAAE,CAAC;YAC3B,GAAG,IAAI,cAAc,CAAC,CAAC,oBAAoB,EAAE,CAAC;QAChD,CAAC;QACD,IAAI,CAAC,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC;YACxB,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;gBAC5B,GAAG,IAAI,cAAc,CAAC,EAAE,CAAC;YAC3B,CAAC;QACH,CAAC;QACD,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC3B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * `orbitmap emit-instructions` — the hook relay (IN-pp967d, TS-9r98vv).
3
+ *
4
+ * Reads a Claude Code hook payload (JSON) on stdin, lifts an Instructions block out of
5
+ * `tool_response.stdout` (marker contract pinned by tests/intent-instructions.test.ts:
6
+ * header `/^Instructions \(/` at column 0, body lines indented two spaces, interior
7
+ * blank lines allowed) and re-emits it as hook `additionalContext` so it lands at
8
+ * instruction tier instead of data tier.
9
+ *
10
+ * Deliberately dumb: no OrbitMap semantics, no network, no adapter — a new producer of
11
+ * the marker (PreToolUse, SessionStart, another command) needs no change here, and the
12
+ * command runs on every matching Bash call, so it must do no work beyond parse → grep →
13
+ * print. On any problem (malformed JSON, missing fields, no block) it exits 0 silently:
14
+ * a hook that throws is worse than one that says nothing.
15
+ */
16
+ /**
17
+ * Extracts the Instructions block from a tool's stdout, or null when there is none.
18
+ *
19
+ * Rule: the block starts at the first line matching /^Instructions \(/ and extends over
20
+ * every following line that begins with two spaces. A blank line is part of the block
21
+ * only when a later two-space-indented line follows it before the block ends (interior
22
+ * blank lines belong to the body); the block ends at the first line that is neither
23
+ * blank nor two-space-indented, and a trailing run of blank lines is excluded.
24
+ */
25
+ export declare function extractInstructionsBlock(stdout: string): string | null;
26
+ export declare function emitInstructionsCommand(input?: NodeJS.ReadableStream): Promise<void>;
@@ -0,0 +1,68 @@
1
+ /**
2
+ * `orbitmap emit-instructions` — the hook relay (IN-pp967d, TS-9r98vv).
3
+ *
4
+ * Reads a Claude Code hook payload (JSON) on stdin, lifts an Instructions block out of
5
+ * `tool_response.stdout` (marker contract pinned by tests/intent-instructions.test.ts:
6
+ * header `/^Instructions \(/` at column 0, body lines indented two spaces, interior
7
+ * blank lines allowed) and re-emits it as hook `additionalContext` so it lands at
8
+ * instruction tier instead of data tier.
9
+ *
10
+ * Deliberately dumb: no OrbitMap semantics, no network, no adapter — a new producer of
11
+ * the marker (PreToolUse, SessionStart, another command) needs no change here, and the
12
+ * command runs on every matching Bash call, so it must do no work beyond parse → grep →
13
+ * print. On any problem (malformed JSON, missing fields, no block) it exits 0 silently:
14
+ * a hook that throws is worse than one that says nothing.
15
+ */
16
+ /**
17
+ * Extracts the Instructions block from a tool's stdout, or null when there is none.
18
+ *
19
+ * Rule: the block starts at the first line matching /^Instructions \(/ and extends over
20
+ * every following line that begins with two spaces. A blank line is part of the block
21
+ * only when a later two-space-indented line follows it before the block ends (interior
22
+ * blank lines belong to the body); the block ends at the first line that is neither
23
+ * blank nor two-space-indented, and a trailing run of blank lines is excluded.
24
+ */
25
+ export function extractInstructionsBlock(stdout) {
26
+ const lines = stdout.split('\n');
27
+ const start = lines.findIndex((line) => /^Instructions \(/.test(line));
28
+ if (start === -1)
29
+ return null;
30
+ let end = start + 1; // exclusive index just past the last confirmed block line
31
+ for (let i = start + 1; i < lines.length; i++) {
32
+ const line = lines[i];
33
+ if (line.startsWith(' ')) {
34
+ end = i + 1; // confirms this line and any blank run before it
35
+ }
36
+ else if (line !== '') {
37
+ break; // neither blank nor indented — the block is over
38
+ }
39
+ // blank line: tentatively skipped; included only if a later indented line confirms it
40
+ }
41
+ return lines.slice(start, end).join('\n');
42
+ }
43
+ async function readStream(input) {
44
+ const chunks = [];
45
+ for await (const chunk of input) {
46
+ chunks.push(typeof chunk === 'string' ? Buffer.from(chunk, 'utf8') : chunk);
47
+ }
48
+ return Buffer.concat(chunks).toString('utf8');
49
+ }
50
+ export async function emitInstructionsCommand(input = process.stdin) {
51
+ try {
52
+ const payload = JSON.parse(await readStream(input));
53
+ const eventName = payload?.hook_event_name;
54
+ const stdout = payload?.tool_response?.stdout;
55
+ if (typeof eventName !== 'string' || typeof stdout !== 'string' || stdout === '')
56
+ return;
57
+ const block = extractInstructionsBlock(stdout);
58
+ if (block === null)
59
+ return;
60
+ console.log(JSON.stringify({
61
+ hookSpecificOutput: { hookEventName: eventName, additionalContext: block },
62
+ }));
63
+ }
64
+ catch {
65
+ // Silent by design — never break the hook chain. Exit code stays 0.
66
+ }
67
+ }
68
+ //# sourceMappingURL=emit-instructions.js.map