@azure-id/orc 1.8.2 → 1.9.1

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 (65) hide show
  1. package/CHANGELOG.md +299 -0
  2. package/README-id.md +68 -51
  3. package/README.md +60 -45
  4. package/bin/cli.js +301 -39
  5. package/bin/graph-audit.js +235 -0
  6. package/bin/graph-extract.js +308 -3
  7. package/bin/graph-gain.js +23 -3
  8. package/bin/graph-map.js +9 -1
  9. package/bin/graph-query.js +152 -10
  10. package/bin/graph-shard.js +6 -1
  11. package/bin/graph-signals.js +287 -4
  12. package/bin/graph.js +717 -658
  13. package/bin/verify-contracts.js +277 -61
  14. package/bin/verify-package.js +19 -1
  15. package/bin/webui/fixtures/knowledge.js +21 -4
  16. package/bin/webui/i18n/en/knowledge.json +5 -2
  17. package/bin/webui/i18n/id/knowledge.json +5 -2
  18. package/bin/webui/js/panels/knowledge.js +21 -2
  19. package/mock-run/orc-quick.md +141 -113
  20. package/package.json +1 -1
  21. package/templates/agents/MODEL-MAPPING.md +15 -5
  22. package/templates/agents/orc-executor-haiku-4-5.md +19 -1
  23. package/templates/agents/orc-executor-opus-4-7-high.md +19 -1
  24. package/templates/agents/orc-executor-opus-4-7-med.md +19 -1
  25. package/templates/agents/orc-executor-opus-4-8-high.md +19 -1
  26. package/templates/agents/orc-executor-opus-5-high.md +19 -1
  27. package/templates/agents/orc-executor-opus-5-low.md +19 -1
  28. package/templates/agents/orc-executor-opus-5-med.md +19 -1
  29. package/templates/agents/orc-executor-sonnet-4-6-high.md +19 -1
  30. package/templates/agents/orc-executor-sonnet-4-6-med.md +19 -1
  31. package/templates/agents/orc-executor-sonnet-5-high.md +19 -1
  32. package/templates/agents/orc-planner-mini-opus-5-med.md +75 -69
  33. package/templates/agents/orc-planner-mini-sonnet-5-high.md +73 -67
  34. package/templates/agents/orc-recon-opus-5-low.md +109 -0
  35. package/templates/agents/orc-recon-sonnet-4-6-med.md +109 -0
  36. package/templates/commands/orc-mini.md +10 -12
  37. package/templates/commands/orc-quick.md +20 -33
  38. package/templates/hooks/README.md +11 -1
  39. package/templates/hooks/orc-graph-hook.js +53 -7
  40. package/templates/hooks/orc-trace.js +476 -471
  41. package/templates/skills/_shared/code-graph.md +56 -17
  42. package/templates/skills/_shared/phases/execution.md +4 -4
  43. package/templates/skills/_shared/phases/planning.md +3 -3
  44. package/templates/skills/_shared/phases/preflight.md +1 -1
  45. package/templates/skills/_shared/phases/review.md +3 -1
  46. package/templates/skills/_shared/phases/rules.md +172 -159
  47. package/templates/skills/_shared/phases/ship.md +1 -1
  48. package/templates/skills/_shared/phases/trace.md +4 -2
  49. package/templates/skills/_shared/phases/wiki-consult.md +9 -5
  50. package/templates/skills/_shared/read-ladder.md +14 -1
  51. package/templates/skills/_shared/return-validation.md +22 -0
  52. package/templates/skills/context-combiner/SKILL.md +13 -13
  53. package/templates/skills/orc/SKILL.md +1 -1
  54. package/templates/skills/orc/subskills/orc-execution/core.md +171 -159
  55. package/templates/skills/orc-fast/SKILL.md +3 -3
  56. package/templates/skills/orc-mini/SKILL.md +145 -137
  57. package/templates/skills/orc-mini/examples/mini-run-mock.md +64 -50
  58. package/templates/skills/orc-mini/references/complexity.md +119 -0
  59. package/templates/skills/orc-quick/README.md +495 -423
  60. package/templates/skills/orc-quick/SKILL.md +157 -212
  61. package/templates/skills/orc-quick/references/context-doc.md +145 -114
  62. package/templates/skills/orc-quick/references/defect.md +101 -0
  63. package/templates/skills/orc-quick/references/dispatch-gate.md +55 -24
  64. package/templates/skills/orc-quick/references/gh-mode.md +148 -127
  65. package/templates/skills/orc-quick/references/look.md +107 -0
@@ -26,7 +26,7 @@ Escalate one step at a time. Stop at the step that answers the question.
26
26
 
27
27
  ## Step 0 — ask the graph (always first; the CLI decides if it is on)
28
28
 
29
- Before step 1, run `orc graph ctx <symbol|file[:line]> --if-enabled --json`
29
+ Before step 1, run `orc graph ctx <symbol|file[:line]> --if-enabled --json --brief`
30
30
  yourself. You do not need to know whether the graph is on. Exit 0 → the card
31
31
  answers step 1 and step 2 together: where the symbol is, its line range, who
32
32
  calls or uses it, what it calls, and which effects it has. Then continue at
@@ -40,6 +40,19 @@ footer says how many lines it cut. Use it for the CALLER'S range, the callee's,
40
40
  the neighbour you will not touch. **It never replaces exception 1**: a file you
41
41
  will EDIT is read IN FULL with `Read` first, because an `old_string` rebuilt
42
42
  from a printed range is the same corruption bug as one rebuilt from an outline.
43
+ **`--callers-source` adds six lines around each confident call site (≤ 5)**
44
+ (v1.9.1), charged against the same `--budget` after everything else. A file you
45
+ will EDIT is still read in full with `Read` first — this is for the callers you
46
+ will not touch.
47
+
48
+ **Ask a language server when the card cannot be exact** (v1.9.1). If the card
49
+ answers `AMBIGUOUS (n)` for a callee, or `← maybe <n>` for callers, and an `LSP`
50
+ tool is available in this session, run `LSP findReferences` (callers) or
51
+ `goToDefinition` (a callee) at the card's `lsp_at` — file, line, character —
52
+ before any Grep. A language server's answer is EXACT; the card's `AMBIGUOUS` is a
53
+ list of candidates. Without an LSP tool, or with `lsp_at: null`, the ladder
54
+ continues as before.
55
+
43
56
  Exit 3 (off) → skip step 0 for the rest of the task. Exit 1 (no index) or 4 (not
44
57
  in the graph) → step 1 as before. Name the card targets you used in
45
58
  `graph_used`. Both exceptions below apply unchanged.
@@ -231,6 +231,28 @@ A rule the slice could not honour because this lane structurally cannot do it
231
231
  comes back as `unsupported_request`, relayed as a gap. **Never a guessed
232
232
  compromise.**
233
233
 
234
+ ## 5d. Reproduce-first attestation (when a `repro` was requested — v1.9.0)
235
+
236
+ A slice that carried `repro: {required: true, kind, hint}` must come back with a
237
+ `repro` field. Either both runs, quoted verbatim, or an honest `none`:
238
+
239
+ ```
240
+ repro: { command, before: {exit_code, tail}, after: {exit_code, tail} }
241
+ repro: none — <one line of reason>
242
+ ```
243
+
244
+ Two malformed shapes, and they are the whole point of the field. **`status=done`
245
+ with `before.exit_code` 0** means the "reproduction" never failed, so it proved
246
+ nothing; **`status=done` with a non-zero `after.exit_code`** means the bug is
247
+ still there. Either one is a failure of the return, not a finding about the
248
+ code. A `repro: none` is a valid answer — a defect with no reachable entry point
249
+ and no runner cannot be shown red — and the lane says **not reproduced** out
250
+ loud rather than letting a green suite imply a fixed bug.
251
+
252
+ `repro` is required ONLY when the slice carried `repro.required: true`. A slice
253
+ that asked for none gets none back, exactly like `tdd_spec`, `wiki_used` and
254
+ `graph_used`.
255
+
234
256
  ## 6. Worktree delta (post-wave, every lane that dispatches executors)
235
257
 
236
258
  Compare `git status --short` before and after each dispatch. A path that
@@ -11,10 +11,10 @@ description: >
11
11
  collapsed, conflicts, ordering) one issue at a time; proves NOTHING WAS LOST
12
12
  via a source coverage matrix and a 100% coverage gate before handoff;
13
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.
14
+ combined-report.md + combined-requirement-spec.md, which reuse the
15
+ requirement-spec schema, so the planner/build pipeline is unchanged. Full
16
+ lane only. The orchestrator DISPATCHES this to a subagent — it never
17
+ combines itself, and the combiner never spawns subagents.
18
18
  ---
19
19
 
20
20
  # CONTEXT-COMBINER
@@ -211,12 +211,12 @@ exit code, and never re-derive a state word — the CLI's state words are the on
211
211
  state words, and **an exit code is an ANSWER wherever that contract says so, not
212
212
  a failure**. A call the answer does not name is a call this lane does not make.
213
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.
215
-
216
- ## Rules — the anti-slop card (`../_shared/phases/rules.md`)
217
-
218
- `orc rules slice --lane context-combiner --json` is the ONLY assembler; never build
219
- the card here. It rides under the house rules and above the task —
220
- **house rules > your project's rules > ORC's own packs** — and its `line` prints
221
- VERBATIM at preflight. Returns gain `rules_applied[]`, `rules_conflicts[]` (a gap,
222
- never a silent choice) and `rules_overridden[]`.
214
+ command you are about to run, out loud, before running it.
215
+
216
+ ## Rules — the anti-slop card (`../_shared/phases/rules.md`)
217
+
218
+ `orc rules slice --lane context-combiner --json` is the ONLY assembler; never build
219
+ the card here. It rides under the house rules and above the task —
220
+ **house rules > your project's rules > ORC's own packs** — and its `line` prints
221
+ VERBATIM at preflight. Returns gain `rules_applied[]`, `rules_conflicts[]` (a gap,
222
+ never a silent choice) and `rules_overridden[]`.
@@ -205,7 +205,7 @@ them; they are never dispatched as subagents).
205
205
  - Phase 5.5 → `../_shared/phases/security-checklist.md`; 6.5 → `subskills/orc-testgen/`
206
206
  - Phase 8 → `subskills/orc-pr/SKILL.md` (template `subskills/orc-pr/pr.md`);
207
207
  stack gate → `subskills/orc-pr/stack-gate.md` + `_shared/pr-templates.md`
208
- - Code graph cache, NEVER skipped (§0 of the contract) — `orc graph status --if-enabled --heal --json` at preflight BEFORE the first dispatch (builds or updates it) · ONE `orc graph ctx <declared files>` call per slice · `orc graph map` FIRST at planning (orientation — before any Glob, before `impact`) then `orc graph impact` + `orc graph cochange`, `orc graph changes` at review · `orc graph coverage` before you trust a card's silence · `orc graph update` + `orc graph notes` at every wave close and ship · print each JSON `line`, copy each `trace` VERBATIM (CLI-resolved) → `../_shared/code-graph.md`
208
+ - Code graph cache, NEVER skipped (§0 of the contract) — `orc graph status --if-enabled --heal --json` at preflight BEFORE the first dispatch (builds or updates it) · ONE `orc graph ctx <declared files>` call per slice · `orc graph map` FIRST at planning (orientation — before any Glob, before `impact`) then `orc graph impact` + `orc graph cochange`, `orc graph changes` at review · `orc graph coverage` before you trust a card's silence · `orc graph update` + `orc graph notes` at every wave close and ship · every `--json` read carries `--brief` · print each JSON `line`, copy each `trace` VERBATIM (CLI-resolved) → `../_shared/code-graph.md`
209
209
  - Schemas (you own; pass slices only): `schemas/intent-spec.md`,
210
210
  `schemas/planning-output.md`, `schemas/checkpoint.md`
211
211
  - Worked example (orient only — never execute from it) → `examples/full-run-mock.md`
@@ -1,159 +1,171 @@
1
- # orc-execution — Core (mode-neutral)
2
-
3
- A procedure specification: inputs, steps, outputs. Executed by a spawned
4
- subagent; the orchestrator never runs this itself.
5
-
6
- ## Input slice (you receive exactly this; you cannot pull more)
7
-
8
- - task_id, description, spec_ref
9
- - declared_files[] — the files you are expected to touch (incl. tests)
10
- - acceptance[] — this task's sliced definition-of-done lines (from the
11
- plan); self-check your diff against them before returning
12
- - constraints[] — HARD RULES from the intent-spec, plus the task's
13
- `spec_invariants` (analyst do-not-build invariants)
14
- appended verbatim at slice assembly; never violate
15
- - pattern — the resolved code-pattern for this task's language, or
16
- null. When present: {conventions[] you MUST MATCH,
17
- invariants[] that are BLOCKING, validation_gate[]
18
- (enforceable acceptance checks you must SATISFY —
19
- advisory lines are marked and informational),
20
- pattern_version}. Agnostic
21
- tasks carry invariants only (no conventions, no gate).
22
- - wiki — project-wiki grounding for this task, or absent:
23
- page CONTENT (full/mini) or page PATHS to read first
24
- (fast), plus the freshness tier in force. Precedence
25
- is always `code > fresh wiki > stale wiki (hints) >
26
- model priors` — on any wiki-vs-code conflict the code
27
- wins. You MUST return `wiki_used` naming the pages
28
- you actually read, or `none`; see the return
29
- contract. Absent on a task the orchestrator grounded
30
- without the wiki.
31
- - crosslink — the cross-repo boundary contract for a call site in
32
- this task, or null. Present ONLY when a declared file
33
- touches a boundary the orchestrator resolved from
34
- `.claude/orc/crosslink/needs.json` + cache. It is
35
- ADVISORY hints ("cross-repo fresh/aging/stale wiki")
36
- labeled with an effective tier — MATCH the field
37
- names/types/errors it states, but it never overrides
38
- local code and there is nothing to attest (no return
39
- field). Absent on any task with no boundary.
40
- - gotchas — 0–3 repair-memory entries whose `scope` glob matches
41
- this task's declared_files, or absent. Each is one
42
- failure THIS PROJECT already hit and fixed
43
- {trigger, symptom, cause, fix}. Read them as a
44
- "don't re-pay for this" list, not as requirements:
45
- they never override `acceptance[]`, `constraints[]`
46
- or the pattern's invariants. Absent = no match, which
47
- is the normal case — never treat absence as a signal.
48
- Canonical: `.claude/skills/_shared/gotchas.md`.
49
- - tdd_spec — this task's plan-time acceptance tests, or null
50
- (TDD off, or every entry scoped out as
51
- covered-by-existing / no-behavior / no-runner —
52
- null is NOT "untested"). Present = the failing tests
53
- a PAIRED TDD task already materialized, which your
54
- work must
55
- turn GREEN, plus `tdd_loop_max` (the repair cap).
56
- Never edit a TDD test to make it pass — a test
57
- that looks wrong is a spec bug: return it, don't
58
- fix it.
59
- - house_rules — the standing behavioral card (injected literally,
60
- never a pointer): surgical changes, simplicity-first,
61
- no unrequested scope, boring-solution preference
62
- - rules_card — the anti-slop card from `orc rules slice`, injected
63
- literally directly under `house_rules`: the project's
64
- rules, then ORC's. A project rule beats an ORC rule;
65
- `house_rules` beat both on code and behaviour only.
66
- Carried → return `rules_applied[]`,
67
- `rules_conflicts[]`, `rules_overridden[]`
68
- (`../../../_shared/return-validation.md` §5c)
69
- - log_digest — compacted decisions from prior waves; absorb before working
70
- - worktree_path — null unless worktrees mode
71
- - model, effort — informational (already applied by the caller)
72
-
73
- ## Procedure
74
-
75
- 1. Absorb log_digest — prior DECISIONs/INTERFACEs/ANSWERs bind you.
76
- 2. Read spec_ref if provided.
77
- 2a. **Read on the ladder** (`../../../_shared/read-ladder.md`): locate
78
- (Grep/Glob) → outline → the ±40 lines around the anchor → full. Stop at the
79
- step that answers the question; two full reads with no answer is
80
- `needs_context`, not a third. TWO EXCEPTIONS — every `declared_files` path is
81
- a FULL read before you edit it (an `old_string` rebuilt from an outline is a
82
- corruption bug), and build/test output is always read whole.
83
- 3. Perform the task within `worktree_path` (or the current tree if null).
84
- Obey every `house_rules` line, then every `rules_card` rule (two rules that
85
- disagree go in `rules_conflicts[]`, never a silent choice). Follow every constraint. If `pattern` is present, MATCH its conventions,
86
- satisfy every BLOCKING invariant, and satisfy every enforceable
87
- `validation_gate[]` line (re-read your diff to confirm before returning;
88
- advisory gate lines are informational — never add tooling to meet one);
89
- if `pattern` is null but carries invariants (agnostic), still satisfy them and
90
- imitate the neighboring files you read. Create/update tests for what you build.
91
- **UI task + a `frontend-design` skill present in the environment** (check
92
- `.claude/skills/frontend-design/` or the plugin dir): read its SKILL.md and
93
- apply its guidance to the UI work — skip silently when absent.
94
- 4. **Run the proof, capture the evidence:** if the project has a runnable build
95
- or test setup, run it for your changes and capture {command, exit_code, the
96
- last ~5 output lines} — QUOTED VERBATIM, never paraphrased, never predicted.
97
- No runner → set `no_runner_detected: true` instead. Never claim green you
98
- did not observe. With a `tdd_spec`: run ITS tests too — implement → test →
99
- repair up to `tdd_loop_max` iterations; still red at the cap → stop and
100
- return `tdd_state: red` honestly (the failing tests listed in unmet[]).
101
- 5. **Self-check before returning:** re-read your diff against every
102
- `acceptance[]` line and every `constraints[]` rule. Anything you could not
103
- satisfy goes in `unmet[]` — and a non-empty `unmet[]` means status `partial`
104
- (or `failed`), never `done`. An honest partial beats a false done.
105
- 6. **Milestone pings:** after each declared file completed or logical subtask
106
- done, emit a brief progress ping: {percent, files_written[], notes}. These
107
- bound what a mid-wave stop can save — do not skip them.
108
- 7. Stay within your task. Discovering needed context outside your slice →
109
- emit the needs_context return (below). Do NOT fetch it yourself.
110
-
111
- ## Return contract (emit EXACTLY this structure; the caller validates)
112
-
113
- - task_id
114
- - actual_model — the model id quoted VERBATIM from your system prompt
115
- ("The exact model ID is …"); NEVER inferred from priors;
116
- `unknown` if no such line exists. Lets the caller catch
117
- a silent tier downgrade (claimed-vs-actual model check)
118
- - actual_effort — the value of $CLAUDE_EFFORT (read via Bash at start)
119
- - status: done | failed | partial | needs_context
120
- - actual_files[] — every file you truly touched (audited vs declared)
121
- - evidence — {command, exit_code, tail} of the build/test you ran,
122
- quoted VERBATIM (like actual_model — never invented).
123
- REQUIRED when status=done and the project has a
124
- runnable build/test; null when it has none
125
- - no_runner_detected — true ONLY when the project exposes no runnable
126
- build/test (explains a null evidence); else absent
127
- - unmet[] — acceptance[]/constraints[] lines you could NOT
128
- satisfy. MUST be empty when status=done — a
129
- non-empty unmet[] forces partial/failed
130
- - log_entries[] — cross-cutting decisions for the decision log,
131
- tagged DECISION | CONSTRAINT | INTERFACE
132
- - failure_reason — REQUIRED when status=failed (the why); else null
133
- - progress — {percent, files_written[], notes} when partial; else null
134
- - context_request — REQUIRED when status=needs_context: what you need
135
- and why (e.g. "needs T1's type enum interface");
136
- else null
137
- - pattern_version — the `pattern.pattern_version` you applied; null if no
138
- pattern was supplied
139
- - invariants_checked — true ONLY if you verified every BLOCKING invariant in
140
- `pattern` against your diff; false/null if no invariants
141
- were supplied. A pattern task returning false/absent here
142
- is a malformed return
143
- - tdd_state — green | red | null. REQUIRED when the slice carried a
144
- `tdd_spec`: green ONLY after its tests pass (run quoted
145
- in `evidence`); red = cap hit/unresolved (failing tests
146
- in unmet[]); null only without a tdd_spec. status=done
147
- with red is malformed
148
- - gotcha_recorded — REQUIRED when this return CLOSES a repair loop (you
149
- drove a tdd_spec test red → green): the entry body
150
- {trigger, symptom, cause, fix, scope}, or `none` + a
151
- one-line reason. Absent on a repair-closing return is
152
- malformed; not required when nothing was repaired. A
153
- loop that hit `tdd_loop_max` and STOPPED returns
154
- `none` — an unsolved failure is not a gotcha. You
155
- RETURN it; the caller writes the file
156
-
157
- Malformed returns are treated as failure by the caller. needs_context is
158
- capped at 2 per task — a third means the slice or plan is wrong and escalates
159
- to the user.
1
+ # orc-execution — Core (mode-neutral)
2
+
3
+ A procedure specification: inputs, steps, outputs. Executed by a spawned
4
+ subagent; the orchestrator never runs this itself.
5
+
6
+ ## Input slice (you receive exactly this; you cannot pull more)
7
+
8
+ - task_id, description, spec_ref
9
+ - declared_files[] — the files you are expected to touch (incl. tests)
10
+ - acceptance[] — this task's sliced definition-of-done lines (from the
11
+ plan); self-check your diff against them before returning
12
+ - constraints[] — HARD RULES from the intent-spec, plus the task's
13
+ `spec_invariants` (analyst do-not-build invariants)
14
+ appended verbatim at slice assembly; never violate
15
+ - pattern — the resolved code-pattern for this task's language, or
16
+ null. When present: {conventions[] you MUST MATCH,
17
+ invariants[] that are BLOCKING, validation_gate[]
18
+ (enforceable acceptance checks you must SATISFY —
19
+ advisory lines are marked and informational),
20
+ pattern_version}. Agnostic
21
+ tasks carry invariants only (no conventions, no gate).
22
+ - wiki — project-wiki grounding for this task, or absent:
23
+ page CONTENT (full/mini) or page PATHS to read first
24
+ (fast), plus the freshness tier in force. Precedence
25
+ is always `code > fresh wiki > stale wiki (hints) >
26
+ model priors` — on any wiki-vs-code conflict the code
27
+ wins. You MUST return `wiki_used` naming the pages
28
+ you actually read, or `none`; see the return
29
+ contract. Absent on a task the orchestrator grounded
30
+ without the wiki.
31
+ - crosslink — the cross-repo boundary contract for a call site in
32
+ this task, or null. Present ONLY when a declared file
33
+ touches a boundary the orchestrator resolved from
34
+ `.claude/orc/crosslink/needs.json` + cache. It is
35
+ ADVISORY hints ("cross-repo fresh/aging/stale wiki")
36
+ labeled with an effective tier — MATCH the field
37
+ names/types/errors it states, but it never overrides
38
+ local code and there is nothing to attest (no return
39
+ field). Absent on any task with no boundary.
40
+ - gotchas — 0–3 repair-memory entries whose `scope` glob matches
41
+ this task's declared_files, or absent. Each is one
42
+ failure THIS PROJECT already hit and fixed
43
+ {trigger, symptom, cause, fix}. Read them as a
44
+ "don't re-pay for this" list, not as requirements:
45
+ they never override `acceptance[]`, `constraints[]`
46
+ or the pattern's invariants. Absent = no match, which
47
+ is the normal case — never treat absence as a signal.
48
+ Canonical: `.claude/skills/_shared/gotchas.md`.
49
+ - tdd_spec — this task's plan-time acceptance tests, or null
50
+ (TDD off, or every entry scoped out as
51
+ covered-by-existing / no-behavior / no-runner —
52
+ null is NOT "untested"). Present = the failing tests
53
+ a PAIRED TDD task already materialized, which your
54
+ work must
55
+ turn GREEN, plus `tdd_loop_max` (the repair cap).
56
+ Never edit a TDD test to make it pass — a test
57
+ that looks wrong is a spec bug: return it, don't
58
+ fix it.
59
+ - repro — {required: true, kind: test | command, hint} on a
60
+ DEFECT task, else absent. Present = show the bug is
61
+ real BEFORE fixing it: `test` when the project has a
62
+ runner, `command` when it has none. Absent = this is
63
+ not a defect report; never invent a reproduction
64
+ - house_rules — the standing behavioral card (injected literally,
65
+ never a pointer): surgical changes, simplicity-first,
66
+ no unrequested scope, boring-solution preference
67
+ - rules_card — the anti-slop card from `orc rules slice`, injected
68
+ literally directly under `house_rules`: the project's
69
+ rules, then ORC's. A project rule beats an ORC rule;
70
+ `house_rules` beat both on code and behaviour only.
71
+ Carried → return `rules_applied[]`,
72
+ `rules_conflicts[]`, `rules_overridden[]`
73
+ (`../../../_shared/return-validation.md` §5c)
74
+ - log_digest — compacted decisions from prior waves; absorb before working
75
+ - worktree_path — null unless worktrees mode
76
+ - model, effort — informational (already applied by the caller)
77
+
78
+ ## Procedure
79
+
80
+ 1. Absorb log_digest — prior DECISIONs/INTERFACEs/ANSWERs bind you.
81
+ 2. Read spec_ref if provided.
82
+ 2a. **Read on the ladder** (`../../../_shared/read-ladder.md`): locate
83
+ (Grep/Glob) → outline → the ±40 lines around the anchor → full. Stop at the
84
+ step that answers the question; two full reads with no answer is
85
+ `needs_context`, not a third. TWO EXCEPTIONS — every `declared_files` path is
86
+ a FULL read before you edit it (an `old_string` rebuilt from an outline is a
87
+ corruption bug), and build/test output is always read whole.
88
+ 3. Perform the task within `worktree_path` (or the current tree if null).
89
+ Obey every `house_rules` line, then every `rules_card` rule (two rules that
90
+ disagree go in `rules_conflicts[]`, never a silent choice). Follow every constraint. If `pattern` is present, MATCH its conventions,
91
+ satisfy every BLOCKING invariant, and satisfy every enforceable
92
+ `validation_gate[]` line (re-read your diff to confirm before returning;
93
+ advisory gate lines are informational — never add tooling to meet one);
94
+ if `pattern` is null but carries invariants (agnostic), still satisfy them and
95
+ imitate the neighboring files you read. Create/update tests for what you build.
96
+ **UI task + a `frontend-design` skill present in the environment** (check
97
+ `.claude/skills/frontend-design/` or the plugin dir): read its SKILL.md and
98
+ apply its guidance to the UI work — skip silently when absent.
99
+ 4. **Run the proof, capture the evidence:** if the project has a runnable build
100
+ or test setup, run it for your changes and capture {command, exit_code, the
101
+ last ~5 output lines} — QUOTED VERBATIM, never paraphrased, never predicted.
102
+ No runner → set `no_runner_detected: true` instead. Never claim green you
103
+ did not observe. With a `tdd_spec`: run ITS tests too — implement → test →
104
+ repair up to `tdd_loop_max` iterations; still red at the cap → stop and
105
+ return `tdd_state: red` honestly (the failing tests listed in unmet[]).
106
+ 5. **Self-check before returning:** re-read your diff against every
107
+ `acceptance[]` line and every `constraints[]` rule. Anything you could not
108
+ satisfy goes in `unmet[]` — and a non-empty `unmet[]` means status `partial`
109
+ (or `failed`), never `done`. An honest partial beats a false done.
110
+ 6. **Milestone pings:** after each declared file completed or logical subtask
111
+ done, emit a brief progress ping: {percent, files_written[], notes}. These
112
+ bound what a mid-wave stop can save — do not skip them.
113
+ 7. Stay within your task. Discovering needed context outside your slice →
114
+ emit the needs_context return (below). Do NOT fetch it yourself.
115
+
116
+ ## Return contract (emit EXACTLY this structure; the caller validates)
117
+
118
+ - task_id
119
+ - actual_model — the model id quoted VERBATIM from your system prompt
120
+ ("The exact model ID is …"); NEVER inferred from priors;
121
+ `unknown` if no such line exists. Lets the caller catch
122
+ a silent tier downgrade (claimed-vs-actual model check)
123
+ - actual_effort — the value of $CLAUDE_EFFORT (read via Bash at start)
124
+ - status: done | failed | partial | needs_context
125
+ - actual_files[] — every file you truly touched (audited vs declared)
126
+ - evidence — {command, exit_code, tail} of the build/test you ran,
127
+ quoted VERBATIM (like actual_model — never invented).
128
+ REQUIRED when status=done and the project has a
129
+ runnable build/test; null when it has none
130
+ - no_runner_detected — true ONLY when the project exposes no runnable
131
+ build/test (explains a null evidence); else absent
132
+ - unmet[] — acceptance[]/constraints[] lines you could NOT
133
+ satisfy. MUST be empty when status=done — a
134
+ non-empty unmet[] forces partial/failed
135
+ - log_entries[] — cross-cutting decisions for the decision log,
136
+ tagged DECISION | CONSTRAINT | INTERFACE
137
+ - failure_reason — REQUIRED when status=failed (the why); else null
138
+ - progress — {percent, files_written[], notes} when partial; else null
139
+ - context_request — REQUIRED when status=needs_context: what you need
140
+ and why (e.g. "needs T1's type enum interface");
141
+ else null
142
+ - pattern_version — the `pattern.pattern_version` you applied; null if no
143
+ pattern was supplied
144
+ - invariants_checked — true ONLY if you verified every BLOCKING invariant in
145
+ `pattern` against your diff; false/null if no invariants
146
+ were supplied. A pattern task returning false/absent here
147
+ is a malformed return
148
+ - tdd_state — green | red | null. REQUIRED when the slice carried a
149
+ `tdd_spec`: green ONLY after its tests pass (run quoted
150
+ in `evidence`); red = cap hit/unresolved (failing tests
151
+ in unmet[]); null only without a tdd_spec. status=done
152
+ with red is malformed
153
+ - repro — REQUIRED when the slice carried
154
+ `repro.required: true`; else absent. {command, before:
155
+ {exit_code, tail}, after: {exit_code, tail}} quoted
156
+ VERBATIM, or `none` + a one-line reason. status=done
157
+ with before.exit_code 0 (never red) or a non-zero
158
+ after.exit_code (still red) is malformed. Canonical:
159
+ `.claude/skills/_shared/return-validation.md` §5d
160
+ - gotcha_recorded — REQUIRED when this return CLOSES a repair loop (you
161
+ drove a tdd_spec test red → green): the entry body
162
+ {trigger, symptom, cause, fix, scope}, or `none` + a
163
+ one-line reason. Absent on a repair-closing return is
164
+ malformed; not required when nothing was repaired. A
165
+ loop that hit `tdd_loop_max` and STOPPED returns
166
+ `none` — an unsolved failure is not a gotcha. You
167
+ RETURN it; the caller writes the file
168
+
169
+ Malformed returns are treated as failure by the caller. needs_context is
170
+ capped at 2 per task — a third means the slice or plan is wrong and escalates
171
+ to the user.
@@ -74,9 +74,9 @@ hand off to orc-mini via the fallback contract below. Never stop the chat.
74
74
 
75
75
  **e. Code graph cache — NOT a gate, and never skipped** (`../_shared/code-graph.md` §0). Every call carries
76
76
  `--if-enabled`: exit 3 = off → print `graph: off` once, make no other graph call. Print each JSON `line`; put
77
- each `trace` in the next packet VERBATIM. (1) **Here:** `orc graph status --if-enabled --heal --json` builds or
78
- updates the cache itself. (2) **F2 slice:** ONE `orc graph ctx <declared files> --if-enabled --json` → its `card`
79
- is the `graph` block; the return carries `graph_used`. (3) **F3 GREEN:** `orc graph update --if-enabled --json`,
77
+ each `trace` in the next packet VERBATIM. (1) **Here:** `orc graph status --if-enabled --heal --json --brief` builds or
78
+ updates the cache itself. (2) **F2 slice:** ONE `orc graph ctx <declared files> --if-enabled --json --brief` → its `card`
79
+ is the `graph` block; the return carries `graph_used`. (3) **F3 GREEN:** `orc graph update --if-enabled --json --brief`,
80
80
  then one `orc graph notes pending` batch — the next run starts from this cache. A missing graph never falls back.
81
81
 
82
82
  **d. Extra — a PROBE, not a gate (P0).** Run `orc extra resolve --slot fast-executor --json` (0 = extra, 1 = Claude) — **a gate that is never probed is a gate that is always off**, and without this step the lane silently runs on Claude however `extra_enabled` and `orc extra role` were set. `extra` → print the `extra:` line HERE and carry the answer into F2; `claude` → print nothing, never fall back, never stop.