@azure-id/orc 0.56.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/CHANGELOG.md +2367 -2218
  2. package/README-id.md +49 -107
  3. package/README.md +45 -133
  4. package/bin/build-agents.js +18 -11
  5. package/bin/cli.js +33060 -29855
  6. package/bin/onboarding-content.js +0 -3
  7. package/bin/test-run.js +491 -0
  8. package/bin/verify-contracts.js +4256 -3277
  9. package/bin/verify-package.js +563 -498
  10. package/bin/webui/api.js +1186 -1163
  11. package/bin/webui/app.html +9 -0
  12. package/bin/webui/css/06-responsive.css +120 -108
  13. package/bin/webui/css/panels/extra.css +29 -0
  14. package/bin/webui/css/panels/lanes.css +134 -0
  15. package/bin/webui/css/panels/settings.css +79 -3
  16. package/bin/webui/fixtures/extra.js +2036 -1934
  17. package/bin/webui/fixtures/flow.js +2 -2
  18. package/bin/webui/fixtures/index.js +503 -486
  19. package/bin/webui/fixtures/lanes.js +218 -0
  20. package/bin/webui/fixtures/settings.js +261 -34
  21. package/bin/webui/fixtures/stats.js +3 -3
  22. package/bin/webui/i18n/TERMS.md +135 -134
  23. package/bin/webui/i18n/en/extra.json +345 -313
  24. package/bin/webui/i18n/en/lanes.json +29 -0
  25. package/bin/webui/i18n/en/nav.json +1 -0
  26. package/bin/webui/i18n/en/overview.json +2 -0
  27. package/bin/webui/i18n/en/settings.json +16 -5
  28. package/bin/webui/i18n/id/extra.json +345 -313
  29. package/bin/webui/i18n/id/lanes.json +29 -0
  30. package/bin/webui/i18n/id/nav.json +1 -0
  31. package/bin/webui/i18n/id/overview.json +2 -0
  32. package/bin/webui/i18n/id/settings.json +15 -4
  33. package/bin/webui/js/01-i18n.js +1 -0
  34. package/bin/webui/js/panels/extra.js +3199 -3011
  35. package/bin/webui/js/panels/lanes.js +259 -0
  36. package/bin/webui/js/panels/overview.js +10 -0
  37. package/bin/webui/js/panels/settings.js +149 -3
  38. package/package.json +39 -39
  39. package/templates/agents/MODEL-MAPPING.md +23 -35
  40. package/templates/agents/orc-executor-opus-4-7-high.md +1 -1
  41. package/templates/agents/orc-executor-opus-4-7-med.md +1 -1
  42. package/templates/agents/orc-executor-opus-4-8-high.md +1 -1
  43. package/templates/agents/orc-executor-opus-5-high.md +1 -1
  44. package/templates/agents/orc-executor-opus-5-low.md +1 -1
  45. package/templates/agents/orc-executor-opus-5-med.md +1 -1
  46. package/templates/agents/orc-retro-opus-5-med.md +73 -73
  47. package/templates/agents/orc-retro-sonnet-5-high.md +72 -72
  48. package/templates/agents/orc-trace-writer-haiku-4-5.md +107 -107
  49. package/templates/commands/orc-route.md +1 -1
  50. package/templates/commands/orc.md +1 -1
  51. package/templates/skills/_shared/README.md +7 -3
  52. package/templates/skills/_shared/config-precedence.md +198 -0
  53. package/templates/skills/_shared/drift-recovery.md +1 -1
  54. package/templates/skills/_shared/extra-dispatch.md +159 -7
  55. package/templates/skills/_shared/interview.md +1 -1
  56. package/templates/skills/_shared/opus5-only.md +9 -7
  57. package/templates/skills/_shared/phases/README.md +82 -0
  58. package/templates/skills/{orc/references → _shared/phases}/analyst-gates.md +15 -3
  59. package/templates/skills/_shared/phases/execution.md +143 -0
  60. package/templates/skills/{orc/references → _shared/phases}/house-rules.md +13 -1
  61. package/templates/skills/{orc/references → _shared/phases}/intake.md +15 -2
  62. package/templates/skills/_shared/phases/mock-example.md +56 -0
  63. package/templates/skills/{orc/references → _shared/phases}/plan-handoff.md +16 -3
  64. package/templates/skills/_shared/phases/planning.md +135 -0
  65. package/templates/skills/_shared/phases/preflight.md +76 -0
  66. package/templates/skills/_shared/phases/review.md +53 -0
  67. package/templates/skills/_shared/phases/scoring.md +65 -0
  68. package/templates/skills/{orc/references → _shared/phases}/security-checklist.md +12 -1
  69. package/templates/skills/_shared/phases/security.md +55 -0
  70. package/templates/skills/_shared/phases/ship.md +88 -0
  71. package/templates/skills/{orc/references/stop-and-resume.md → _shared/phases/stop-resume.md} +169 -160
  72. package/templates/skills/_shared/phases/summary.md +48 -0
  73. package/templates/skills/_shared/phases/testgen.md +51 -0
  74. package/templates/skills/{orc/references/trace-protocol.md → _shared/phases/trace.md} +49 -6
  75. package/templates/skills/_shared/phases/verify.md +70 -0
  76. package/templates/skills/{orc/references → _shared/phases}/wave-grouping.md +14 -2
  77. package/templates/skills/{orc/references → _shared/phases}/wiki-consult.md +13 -1
  78. package/templates/skills/_shared/read-ladder.md +48 -0
  79. package/templates/skills/context-combiner/SKILL.md +214 -187
  80. package/templates/skills/orc/README.md +148 -150
  81. package/templates/skills/orc/SKILL.md +70 -358
  82. package/templates/skills/orc/config.md +137 -389
  83. package/templates/skills/orc/examples/full-run-mock.md +1 -1
  84. package/templates/skills/orc/references/effort-and-mode.md +16 -18
  85. package/templates/skills/orc/references/phases/intake.md +47 -0
  86. package/templates/skills/orc/references/phases/integration.md +19 -0
  87. package/templates/skills/orc/references/preflight-report.md +4 -4
  88. package/templates/skills/orc/references/ultra-mode.md +117 -123
  89. package/templates/skills/orc/schemas/planning-output.md +279 -279
  90. package/templates/skills/orc/subskills/orc-planner/SKILL.md +260 -264
  91. package/templates/skills/orc/subskills/orc-pr/stack-gate.md +4 -1
  92. package/templates/skills/orc-aftermath/SKILL.md +153 -136
  93. package/templates/skills/orc-analyze/SKILL.md +247 -220
  94. package/templates/skills/orc-analyze/references/branching.md +51 -51
  95. package/templates/skills/orc-analyze/references/thin-input.md +1 -1
  96. package/templates/skills/orc-analyze-mini/SKILL.md +128 -112
  97. package/templates/skills/orc-boundary/SKILL.md +244 -208
  98. package/templates/skills/orc-brainstorm/SKILL.md +372 -339
  99. package/templates/skills/orc-budget/SKILL.md +243 -225
  100. package/templates/skills/orc-challenge/README.md +1 -1
  101. package/templates/skills/orc-challenge/SKILL.md +293 -255
  102. package/templates/skills/orc-challenge/examples/council-full-roster.md +1 -1
  103. package/templates/skills/orc-claude/SKILL.md +216 -199
  104. package/templates/skills/orc-diy/README.md +2 -1
  105. package/templates/skills/orc-diy/SKILL.md +129 -70
  106. package/templates/skills/orc-diy/references/blocks/analyze.md +1 -1
  107. package/templates/skills/orc-diy/references/compile.md +21 -7
  108. package/templates/skills/orc-diy/references/flow-schema.md +2 -2
  109. package/templates/skills/orc-doc/SKILL.md +44 -7
  110. package/templates/skills/orc-explain/SKILL.md +19 -0
  111. package/templates/skills/orc-export/SKILL.md +26 -5
  112. package/templates/skills/orc-fast/SKILL.md +215 -187
  113. package/templates/skills/orc-grill/SKILL.md +233 -207
  114. package/templates/skills/orc-handoff/SKILL.md +223 -204
  115. package/templates/skills/orc-learn/SKILL.md +176 -156
  116. package/templates/skills/orc-mini/SKILL.md +41 -23
  117. package/templates/skills/orc-pact/SKILL.md +250 -218
  118. package/templates/skills/orc-pattern/SKILL.md +149 -124
  119. package/templates/skills/orc-poly/SKILL.md +237 -216
  120. package/templates/skills/orc-poly/references/gather.md +1 -1
  121. package/templates/skills/orc-pr-driver/SKILL.md +196 -167
  122. package/templates/skills/orc-pr-driver/references/orc-run-split.md +1 -1
  123. package/templates/skills/orc-pr-setup/SKILL.md +212 -184
  124. package/templates/skills/orc-quick/README.md +2 -2
  125. package/templates/skills/orc-quick/SKILL.md +45 -12
  126. package/templates/skills/orc-quick/references/dispatch-gate.md +2 -3
  127. package/templates/skills/orc-retro/SKILL.md +244 -222
  128. package/templates/skills/orc-retro/examples/retro-mock.md +171 -171
  129. package/templates/skills/orc-route/SKILL.md +183 -165
  130. package/templates/skills/orc-verify/SKILL.md +100 -86
  131. package/templates/skills/orc-wiki/SKILL.md +55 -206
  132. package/templates/skills/orc-wiki/references/phases/phase-0.md +71 -0
  133. package/templates/skills/orc-wiki/references/phases/phase-1.md +35 -0
  134. package/templates/skills/orc-wiki/references/phases/phase-2.md +52 -0
  135. package/templates/skills/orc-wiki/references/phases/phase-3.md +57 -0
  136. package/templates/skills/orc-wiki/references/phases/phase-3c.md +36 -0
  137. package/templates/agents/orc-advisor-fable-5.md +0 -50
  138. package/templates/agents/orc-analyst-fable-5.md +0 -115
  139. package/templates/agents/orc-judge-fable-5.md +0 -79
  140. package/templates/agents/orc-planner-fable-5.md +0 -152
  141. package/templates/agents/orc-reviewer-fable-5.md +0 -57
  142. package/templates/skills/_shared/fable5-override.md +0 -56
  143. package/templates/skills/orc-diy/references/blocks/execution.md +0 -42
  144. package/templates/skills/orc-diy/references/blocks/mock-example.md +0 -22
  145. package/templates/skills/orc-diy/references/blocks/planning.md +0 -34
  146. package/templates/skills/orc-diy/references/blocks/review.md +0 -18
  147. package/templates/skills/orc-diy/references/blocks/scoring.md +0 -16
  148. package/templates/skills/orc-diy/references/blocks/security.md +0 -25
  149. package/templates/skills/orc-diy/references/blocks/ship.md +0 -25
  150. package/templates/skills/orc-diy/references/blocks/summary.md +0 -18
  151. package/templates/skills/orc-diy/references/blocks/testgen.md +0 -17
  152. package/templates/skills/orc-diy/references/blocks/trace.md +0 -28
  153. package/templates/skills/orc-diy/references/blocks/verify.md +0 -25
@@ -1,187 +1,214 @@
1
- ---
2
- name: context-combiner
3
- description: >
4
- Combines 2+ RELATED, already-confirmed ORC analyses (from orc-analyze) into
5
- ONE merged, deduped, conflict-resolved requirement context before build. Use
6
- when the user analyzed multiple related documents within the same scope and
7
- chose "pass to context-combiner" at orc-analyze's Phase F. Verifies the source
8
- analyses actually overlap (shared files/requirements/scope) and challenges the
9
- user if they look unrelated; pools ALL source requirements into one table and
10
- reconciles them (exact/semantic duplicates, partial overlaps split — never
11
- collapsed, conflicts, ordering) one issue at a time; proves NOTHING WAS LOST
12
- via a source coverage matrix and a 100% coverage gate before handoff;
13
- spot-checks inherited evidence and marks stale anchors; writes
14
- combined-report.md + combined-requirement-spec.md (the merged spec reuses the
15
- requirement-spec schema, so the planner/build pipeline is unchanged). Full
16
- lane only (Opus 5 high). The orchestrator DISPATCHES this to a subagent —
17
- it never combines itself, and the combiner never builds or spawns subagents.
18
- ---
19
-
20
- # CONTEXT-COMBINER
21
-
22
- The orchestrator stays on top and **dispatches a Context Combiner subagent
23
- (orc-context-combiner-opus-5-high)** with a list of 2+ confirmed analysis
24
- spec paths. It never combines itself. The combiner merges related, ALREADY
25
- code-grounded analyses — it does not re-analyze the repo from scratch.
26
-
27
- Purpose: turn 2+ related, confirmed requirement-specs (same user scope) into ONE
28
- merged, deduped, conflict-resolved requirement set a planner can build from as if
29
- it were a single analysis — with PROOF that no source requirement was lost.
30
-
31
- ## Hard rules
32
-
33
- 1. **Dispatched, not self-run.** The orchestrator coordinates; the Combiner
34
- subagent (Opus 5 high) reads the specs and reconciles them against each
35
- other. The combiner NEVER builds and NEVER spawns subagents.
36
- 2. **Related only — verify + challenge.** The user asserted relatedness at the
37
- Phase F gate, but the combiner MUST verify real overlap (shared files,
38
- overlapping requirements, shared scope). If overlap is weak/empty, it
39
- challenges: "combine anyway / keep separate" — and records the decision.
40
- 3. **Trust confirmed sources — but spot-check freshness.** Source specs are
41
- already code-grounded with evidence. The combiner INHERITS their `file:line`
42
- evidence — it does not re-derive the code. It only reconciles the specs
43
- against EACH OTHER, plus ONE bounded freshness pass: for each inherited
44
- anchor, confirm the file still exists and the line still plausibly matches
45
- (Read just that region — never a re-analysis). A failed check marks the row's
46
- evidence `STALE` — never silently carried. STALE evidence on a buildable
47
- requirement becomes a Phase D challenge (re-anchor / proceed anyway / drop).
48
- Record the repo state checked against as `combined_against` (git HEAD short
49
- sha) in both artifacts.
50
- 4. **Resolve conflicts one at a time.** Every cross-source conflict, duplicate,
51
- and ordering dependency is raised as a 2–3 option challenge with ONE
52
- **recommended** option + a one-line reason. Wait, record, continue. Never
53
- batch. Keep asking until the combined context is clear (no open conflict).
54
- 5. **Conservation — nothing is lost, and you must prove it.** Every source
55
- requirement ID gets EXACTLY ONE outcome in the Source coverage matrix
56
- (merged / deduped-into / split-across / conflict-resolved / dropped).
57
- `dropped` is legal ONLY with a recorded user decision from a Phase D
58
- challenge. **When in doubt, keep both rows** — a redundant requirement costs
59
- the planner a dedupe; a lost one costs the build a feature. The conservation
60
- gate (Phase E) blocks artifact handoff until `coverage_pct` is 100.
61
- 6. **Two artifacts, spec derived from report.** `combined-report.md` (human,
62
- source of truth) and `combined-requirement-spec.md` DERIVED from it (schemas/).
63
- 7. **Never build on unresolved.** If a conflict is left unresolved, record it as
64
- an open question and refuse handoff to build until it is resolved.
65
- 8. **Checkpoint decisions eagerly.** Every challenge verdict is appended to
66
- `combine-decisions.md` in the internal folder THE MOMENT it is given
67
- (question, options, choice, timestamp). On resume/compaction, replay that
68
- file and continue from the first unanswered item — never re-ask a recorded
69
- decision, never lose one.
70
- 9. Usage: report handoff + remind the user to run `/usage`. Never invoke it.
71
- 10. **Never open a run of your own.** The combiner has no slash command; it is
72
- always dispatched from `orc-analyze` Phase F while that run's trace is still
73
- open. So: do NOT write `log_dir/.current`, do NOT create a trace file, do
74
- NOT emit `FINISH`. Your `DISPATCH`/`RETURN`, every Phase D verdict and the
75
- Phase E conservation result belong to the **dispatching lane's** end-of-run
76
- packet — the hook segments your work as its own `PHASE-EDGE` family
77
- (`combine`) inside that same file. Bootstrapping here would split the
78
- analyze run across two files and invent a lane nothing can open. See
79
- `../orc/references/trace-protocol.md`.
80
-
81
- ## Phase A — Load sources
82
- Read every source `requirement-spec.md` (2+) the orchestrator hands you, plus
83
- their reports. Confirm you have ≥2. Note each source's scope, mode, depth.
84
- Record `combined_against` = current git HEAD short sha.
85
- **Scale guard:** if sources > 4, warn that merge quality and token cost degrade
86
- and offer staged combining (combine the two most related first, then fold in
87
- the next against the combined result). Record the choice in
88
- `combine-decisions.md`.
89
-
90
- ## Phase B Verify relatedness
91
- Compute overlap across sources:
92
- - shared `files[]` between specs,
93
- - overlapping/duplicate requirement statements,
94
- - shared scope string.
95
- If overlap is strong proceed. If weak/empty CHALLENGE (recommended-option):
96
- "These share {N} files / no overlapping requirements — combine anyway
97
- (recommended only if you're sure) or keep separate?" Record the verdict in the
98
- report's Relatedness check. If the user chooses **keep separate**, STOP the run:
99
- do NOT proceed to Phase C or write any `combined-*` artifact — return to the
100
- orchestrator with `combined: false` (the analyses stay separate; the orchestrator
101
- falls back to per-analysis stop/build).
102
-
103
- ## Phase C Pool, then reconcile
104
-
105
- **C.0 Pool first, never pairwise.** Normalize ALL source requirements into ONE
106
- pooled table (`source_id` e.g. A.R1, statement, files, evidence, depth of its
107
- source). Then cluster pooled rows by shared files/behavior and detect issues
108
- WITHIN clusters. This scales to N sources pairwise comparison misses
109
- three-way interactions and is forbidden.
110
-
111
- **C.1Classify every cluster:**
112
- - **EXACT-DUPLICATE** — same requirement, same wording → merge into one row,
113
- tracking `from: [A.Rx, B.Ry]`.
114
- - **SEMANTIC-DUPLICATE** same effect, different wording → merge, but QUOTE
115
- both original statements in the report so intent nuance isn't erased. If the
116
- equivalence is not obvious, it's a Phase D challenge, not a silent merge.
117
- - **PARTIAL-OVERLAP** one requirement subsumes or intersects another →
118
- **SPLIT into a shared row + residue row(s)**; never collapse. Residue rows
119
- keep their own `from[]` and evidence. Ambiguous splits are Phase D challenges.
120
- - **CONFLICT** — source A and source B require contradictory things on the same
121
- file/behavior.
122
- - **ORDERING** — one source depends on another's change existing first. Record
123
- as structured pairs (`before` / `after` merged IDs), not free text.
124
-
125
- **C.2Reconcile beyond requirements.** Cross-check `assumptions_resolved` and
126
- `alternatives` across sources too: contradictory resolved assumptions are a
127
- CONFLICT (Phase D); alternatives anchored to a merged/split requirement are
128
- re-pointed at the merged ID.
129
-
130
- **C.3Evidence freshness spot-check** (per Hard rule 3): verify each inherited
131
- anchor still exists; mark failures `STALE`.
132
-
133
- Anything ambiguous becomes a Phase D challenge.
134
-
135
- ## Phase D Challenge (interactive, recommended options, one at a time)
136
- For every CONFLICT / ambiguous DUPLICATE or PARTIAL-OVERLAP split / ORDERING
137
- decision / STALE-evidence-on-buildable / proposed drop, ask a single focused
138
- 2–3 option question with ONE **recommended** option + a one-line reason. Wait,
139
- record, continue. Never batch. Append every verdict to `combine-decisions.md`
140
- immediately (Hard rule 8). Keep going until nothing is unresolved.
141
-
142
- ## Phase E — Conservation gate (before any artifact is written)
143
- Build the **Source coverage matrix**: one row per source requirement ID with
144
- exactly one Outcome `merged #N` / `deduped-into #N` / `split-across →
145
- #N,#M` / `conflict-resolved → #N` / `dropped (user decision ref)`. Then check:
146
- - every source ID appears exactly once (no unaccounted IDs, no double-counting),
147
- - the union of `from[]` across merged rows equals the non-dropped source set,
148
- - every `dropped` row cites a recorded decision in `combine-decisions.md`.
149
- `coverage_pct` = accounted source IDs / total source IDs × 100. If it is not
150
- 100 fix the merge (or raise the missing challenge), do NOT proceed.
151
- `handoff_ready` = (`coverage_pct` == 100) AND (no open conflict).
152
-
153
- ## Phase F Write combined artifacts
154
- 1. Write `combined-report.md` (schemas/combined-report.md) into
155
- `.claude/skills/orc/analyzer/combined-{name}/` (internal): Relatedness check,
156
- Merged requirements (deduped, ordered, evidence inherited, STALE flagged,
157
- `depth_from` when sources differ in depth), **Source coverage matrix**
158
- (Phase E), **Additional context (do not build)** merged from the sources
159
- (anchors re-pointed at the merged requirement; dedupe ONLY when the evidence
160
- anchor is the same `file:line` AND the notes convey the same constraint —
161
- otherwise keep both; non-actionable, omit if none), Cross-scope conflicts &
162
- decisions, Open questions, Handoff readiness.
163
- 2. Derive `combined-requirement-spec.md` (schemas/combined-requirement-spec.md)
164
- FROM the confirmed combined report, in the same internal folder. Reuse the
165
- base requirement-spec shape + `combined_from`, `cross_scope`, and the
166
- `coverage` block.
167
-
168
- ## Phase G Return & branch
169
- Return to the orchestrator: `combined_report_path`, `combined_spec_path`,
170
- `combined_from[]`, `conflicts_resolved[]`, `coverage_pct`, `dropped[]`
171
- (source IDs dropped by user decision), `stale_evidence[]` (rows flagged STALE),
172
- `handoff_ready: bool` (open/unresolved items are NOT a return field they live
173
- in the report's Open questions section, reachable via `combined_report_path`).
174
- The orchestrator then offers the user (plain language):
175
- - **Stop here** → COPY `combined-report.md` OUT to `{report_out_dir}/combined-{name}/`
176
- and stop.
177
- - **Pass to orc build** hand `combined-requirement-spec.md` back to the
178
- orchestrator, which continues at Phase 1 (Requirement Planner) and runs the
179
- full pipeline. The combiner NEVER builds directly.
180
-
181
- **Gate the build option on `handoff_ready`:** if `handoff_ready` is false (an
182
- unresolved conflict remains per Hard rule 7, or `coverage_pct` < 100 per Hard
183
- rule 5), the orchestrator offers ONLY **Stop here** the build option is
184
- withheld until the open conflict is resolved and coverage is complete.
185
-
186
- ## No mini variant
187
- Full lane only. `orc-analyze-mini` / `orc-mini` do not use the combiner.
1
+ ---
2
+ name: context-combiner
3
+ description: >
4
+ Combines 2+ RELATED, already-confirmed ORC analyses (from orc-analyze) into
5
+ ONE merged, deduped, conflict-resolved requirement context before build. Use
6
+ when the user analyzed multiple related documents within the same scope and
7
+ chose "pass to context-combiner" at orc-analyze's Phase F. Verifies the source
8
+ analyses actually overlap (shared files/requirements/scope) and challenges the
9
+ user if they look unrelated; pools ALL source requirements into one table and
10
+ reconciles them (exact/semantic duplicates, partial overlaps split — never
11
+ collapsed, conflicts, ordering) one issue at a time; proves NOTHING WAS LOST
12
+ via a source coverage matrix and a 100% coverage gate before handoff;
13
+ spot-checks inherited evidence and marks stale anchors; writes
14
+ combined-report.md + combined-requirement-spec.md (the merged spec reuses the
15
+ requirement-spec schema, so the planner/build pipeline is unchanged). Full
16
+ lane only (Opus 5 high). The orchestrator DISPATCHES this to a subagent —
17
+ it never combines itself, and the combiner never builds or spawns subagents.
18
+ ---
19
+
20
+ # CONTEXT-COMBINER
21
+
22
+ The orchestrator stays on top and **dispatches a Context Combiner subagent
23
+ (orc-context-combiner-opus-5-high)** with a list of 2+ confirmed analysis
24
+ spec paths. It never combines itself. The combiner merges related, ALREADY
25
+ code-grounded analyses — it does not re-analyze the repo from scratch.
26
+
27
+ Purpose: turn 2+ related, confirmed requirement-specs (same user scope) into ONE
28
+ merged, deduped, conflict-resolved requirement set a planner can build from as if
29
+ it were a single analysis — with PROOF that no source requirement was lost.
30
+
31
+ ## Hard rules
32
+
33
+ 1. **Dispatched, not self-run.** The orchestrator coordinates; the Combiner
34
+ subagent (Opus 5 high) reads the specs and reconciles them against each
35
+ other. The combiner NEVER builds and NEVER spawns subagents.
36
+ 2. **Related only — verify + challenge.** The user asserted relatedness at the
37
+ Phase F gate, but the combiner MUST verify real overlap (shared files,
38
+ overlapping requirements, shared scope). If overlap is weak/empty, it
39
+ challenges: "combine anyway / keep separate" — and records the decision.
40
+ 3. **Trust confirmed sources — but spot-check freshness.** Source specs are
41
+ already code-grounded with evidence. The combiner INHERITS their `file:line`
42
+ evidence — it does not re-derive the code. It only reconciles the specs
43
+ against EACH OTHER, plus ONE bounded freshness pass: for each inherited
44
+ anchor, confirm the file still exists and the line still plausibly matches
45
+ (Read just that region — never a re-analysis). A failed check marks the row's
46
+ evidence `STALE` — never silently carried. STALE evidence on a buildable
47
+ requirement becomes a Phase D challenge (re-anchor / proceed anyway / drop).
48
+ Record the repo state checked against as `combined_against` (git HEAD short
49
+ sha) in both artifacts.
50
+ 4. **Resolve conflicts one at a time.** Every cross-source conflict, duplicate,
51
+ and ordering dependency is raised as a 2–3 option challenge with ONE
52
+ **recommended** option + a one-line reason. Wait, record, continue. Never
53
+ batch. Keep asking until the combined context is clear (no open conflict).
54
+ 5. **Conservation — nothing is lost, and you must prove it.** Every source
55
+ requirement ID gets EXACTLY ONE outcome in the Source coverage matrix
56
+ (merged / deduped-into / split-across / conflict-resolved / dropped).
57
+ `dropped` is legal ONLY with a recorded user decision from a Phase D
58
+ challenge. **When in doubt, keep both rows** — a redundant requirement costs
59
+ the planner a dedupe; a lost one costs the build a feature. The conservation
60
+ gate (Phase E) blocks artifact handoff until `coverage_pct` is 100.
61
+ 6. **Two artifacts, spec derived from report.** `combined-report.md` (human,
62
+ source of truth) and `combined-requirement-spec.md` DERIVED from it (schemas/).
63
+ 7. **Never build on unresolved.** If a conflict is left unresolved, record it as
64
+ an open question and refuse handoff to build until it is resolved.
65
+ 8. **Checkpoint decisions eagerly.** Every challenge verdict is appended to
66
+ `combine-decisions.md` in the internal folder THE MOMENT it is given
67
+ (question, options, choice, timestamp). On resume/compaction, replay that
68
+ file and continue from the first unanswered item — never re-ask a recorded
69
+ decision, never lose one.
70
+ 9. Usage: report handoff + remind the user to run `/usage`. Never invoke it.
71
+ 10. **Never open a run of your own.** The combiner has no slash command; it is
72
+ always dispatched from `orc-analyze` Phase F while that run's trace is still
73
+ open. So: do NOT write `log_dir/.current`, do NOT create a trace file, do
74
+ NOT emit `FINISH`. Your `DISPATCH`/`RETURN`, every Phase D verdict and the
75
+ Phase E conservation result belong to the **dispatching lane's** end-of-run
76
+ packet — the hook segments your work as its own `PHASE-EDGE` family
77
+ (`combine`) inside that same file. Bootstrapping here would split the
78
+ analyze run across two files and invent a lane nothing can open. See
79
+ `../_shared/phases/trace.md`.
80
+
81
+ ## Phases
82
+
83
+ `orc lane phases context-combiner --json` is this lane's pipeline: the ordered list, where
84
+ each phase lives, and how much of it to read. **The CLI owns the order** — never
85
+ derive it from the headings below, and never renumber or rename one without the
86
+ manifest, because a `read: section` pointer names a HEADING and a renamed heading
87
+ is a pointer into nothing.
88
+
89
+ ## Phase A — Load sources
90
+ Read every source `requirement-spec.md` (2+) the orchestrator hands you, plus
91
+ their reports. Confirm you have ≥2. Note each source's scope, mode, depth.
92
+ Record `combined_against` = current git HEAD short sha.
93
+ **Scale guard:** if sources > 4, warn that merge quality and token cost degrade
94
+ and offer staged combining (combine the two most related first, then fold in
95
+ the next against the combined result). Record the choice in
96
+ `combine-decisions.md`.
97
+
98
+ ## Phase B Verify relatedness
99
+ Compute overlap across sources:
100
+ - shared `files[]` between specs,
101
+ - overlapping/duplicate requirement statements,
102
+ - shared scope string.
103
+ If overlap is strong proceed. If weak/empty → CHALLENGE (recommended-option):
104
+ "These share {N} files / no overlapping requirements — combine anyway
105
+ (recommended only if you're sure) or keep separate?" Record the verdict in the
106
+ report's Relatedness check. If the user chooses **keep separate**, STOP the run:
107
+ do NOT proceed to Phase C or write any `combined-*` artifact — return to the
108
+ orchestrator with `combined: false` (the analyses stay separate; the orchestrator
109
+ falls back to per-analysis stop/build).
110
+
111
+ ## Phase C — Pool, then reconcile
112
+
113
+ **C.0 Pool first, never pairwise.** Normalize ALL source requirements into ONE
114
+ pooled table (`source_id` e.g. A.R1, statement, files, evidence, depth of its
115
+ source). Then cluster pooled rows by shared files/behavior and detect issues
116
+ WITHIN clusters. This scales to N sources pairwise comparison misses
117
+ three-way interactions and is forbidden.
118
+
119
+ **C.1 Classify every cluster:**
120
+ - **EXACT-DUPLICATE** — same requirement, same wording merge into one row,
121
+ tracking `from: [A.Rx, B.Ry]`.
122
+ - **SEMANTIC-DUPLICATE** — same effect, different wording merge, but QUOTE
123
+ both original statements in the report so intent nuance isn't erased. If the
124
+ equivalence is not obvious, it's a Phase D challenge, not a silent merge.
125
+ - **PARTIAL-OVERLAP**one requirement subsumes or intersects another →
126
+ **SPLIT into a shared row + residue row(s)**; never collapse. Residue rows
127
+ keep their own `from[]` and evidence. Ambiguous splits are Phase D challenges.
128
+ - **CONFLICT** — source A and source B require contradictory things on the same
129
+ file/behavior.
130
+ - **ORDERING**one source depends on another's change existing first. Record
131
+ as structured pairs (`before` / `after` merged IDs), not free text.
132
+
133
+ **C.2 Reconcile beyond requirements.** Cross-check `assumptions_resolved` and
134
+ `alternatives` across sources too: contradictory resolved assumptions are a
135
+ CONFLICT (Phase D); alternatives anchored to a merged/split requirement are
136
+ re-pointed at the merged ID.
137
+
138
+ **C.3 Evidence freshness spot-check** (per Hard rule 3): verify each inherited
139
+ anchor still exists; mark failures `STALE`.
140
+
141
+ Anything ambiguous becomes a Phase D challenge.
142
+
143
+ ## Phase D Challenge (interactive, recommended options, one at a time)
144
+ For every CONFLICT / ambiguous DUPLICATE or PARTIAL-OVERLAP split / ORDERING
145
+ decision / STALE-evidence-on-buildable / proposed drop, ask a single focused
146
+ 2–3 option question with ONE **recommended** option + a one-line reason. Wait,
147
+ record, continue. Never batch. Append every verdict to `combine-decisions.md`
148
+ immediately (Hard rule 8). Keep going until nothing is unresolved.
149
+
150
+ ## Phase E Conservation gate (before any artifact is written)
151
+ Build the **Source coverage matrix**: one row per source requirement ID with
152
+ exactly one Outcome — `merged → #N` / `deduped-into → #N` / `split-across →
153
+ #N,#M` / `conflict-resolved #N` / `dropped (user decision ref)`. Then check:
154
+ - every source ID appears exactly once (no unaccounted IDs, no double-counting),
155
+ - the union of `from[]` across merged rows equals the non-dropped source set,
156
+ - every `dropped` row cites a recorded decision in `combine-decisions.md`.
157
+ `coverage_pct` = accounted source IDs / total source IDs × 100. If it is not
158
+ 100 fix the merge (or raise the missing challenge), do NOT proceed.
159
+ `handoff_ready` = (`coverage_pct` == 100) AND (no open conflict).
160
+
161
+ ## Phase F Write combined artifacts
162
+ 1. Write `combined-report.md` (schemas/combined-report.md) into
163
+ `.claude/skills/orc/analyzer/combined-{name}/` (internal): Relatedness check,
164
+ Merged requirements (deduped, ordered, evidence inherited, STALE flagged,
165
+ `depth_from` when sources differ in depth), **Source coverage matrix**
166
+ (Phase E), **Additional context (do not build)** merged from the sources
167
+ (anchors re-pointed at the merged requirement; dedupe ONLY when the evidence
168
+ anchor is the same `file:line` AND the notes convey the same constraint —
169
+ otherwise keep both; non-actionable, omit if none), Cross-scope conflicts &
170
+ decisions, Open questions, Handoff readiness.
171
+ 2. Derive `combined-requirement-spec.md` (schemas/combined-requirement-spec.md)
172
+ FROM the confirmed combined report, in the same internal folder. Reuse the
173
+ base requirement-spec shape + `combined_from`, `cross_scope`, and the
174
+ `coverage` block.
175
+
176
+ ## Phase G — Return & branch
177
+ Return to the orchestrator: `combined_report_path`, `combined_spec_path`,
178
+ `combined_from[]`, `conflicts_resolved[]`, `coverage_pct`, `dropped[]`
179
+ (source IDs dropped by user decision), `stale_evidence[]` (rows flagged STALE),
180
+ `handoff_ready: bool` (open/unresolved items are NOT a return field — they live
181
+ in the report's Open questions section, reachable via `combined_report_path`).
182
+ The orchestrator then offers the user (plain language):
183
+ - **Stop here** COPY `combined-report.md` OUT to `{report_out_dir}/combined-{name}/`
184
+ and stop.
185
+ - **Pass to orc build** → hand `combined-requirement-spec.md` back to the
186
+ orchestrator, which continues at Phase 1 (Requirement Planner) and runs the
187
+ full pipeline. The combiner NEVER builds directly.
188
+
189
+ **Gate the build option on `handoff_ready`:** if `handoff_ready` is false (an
190
+ unresolved conflict remains per Hard rule 7, or `coverage_pct` < 100 per Hard
191
+ rule 5), the orchestrator offers ONLY **Stop here** — the build option is
192
+ withheld until the open conflict is resolved and coverage is complete.
193
+
194
+ ## No mini variant
195
+ Full lane only. `orc-analyze-mini` / `orc-mini` do not use the combiner.
196
+
197
+ ## Config
198
+
199
+ Resolve with `orc lane config context-combiner --json` and obey `effective`. Never merge
200
+ `.claude/orc.config.yaml` yourself, and never re-derive a precedence. Exit ≠ 0 →
201
+ say so and use `../_shared/config-precedence.md`'s documented defaults, out
202
+ loud. Nothing this lane reads is contested, gated or a stop, so it owes no
203
+ preflight line and has no gate to honour.
204
+
205
+ ## Calls
206
+
207
+ **ONE catalogue, and it is not you:** `orc lane calls context-combiner --json` names every
208
+ CLI call this lane makes, each with its exit-code contract, its cost, when to run
209
+ it, and what an EMPTY answer means. Never invent a spelling, never re-word an
210
+ exit code, and never re-derive a state word — the CLI's state words are the only
211
+ state words, and **an exit code is an ANSWER wherever that contract says so, not
212
+ a failure**. A call the answer does not name is a call this lane does not make.
213
+ Exit ≠ 0 from the catalogue itself → say the CLI is unavailable and name the
214
+ command you are about to run, out loud, before running it.