claude-dev-env 2.0.1 → 2.1.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 (127) hide show
  1. package/CLAUDE.md +1 -1
  2. package/agents/clean-coder.md +31 -1
  3. package/audit-rubrics/prompts/category-e-dead-code.md +2 -2
  4. package/bin/install.test.mjs +2 -2
  5. package/docs/CLAUDE.md +6 -3
  6. package/docs/CODE_RULES.md +5 -1
  7. package/docs/agent-spawn-protocol.md +39 -0
  8. package/docs/nas-ssh-invocation.md +23 -0
  9. package/docs/worker-completion-gate.md +33 -0
  10. package/hooks/blocking/CLAUDE.md +1 -0
  11. package/hooks/blocking/code_rules_dead_module_constant.py +11 -5
  12. package/hooks/blocking/code_rules_shared.py +126 -47
  13. package/hooks/blocking/config/CLAUDE.md +2 -0
  14. package/hooks/blocking/config/verified_commit_constants.py +8 -1
  15. package/hooks/blocking/config/verified_commit_context_constants.py +21 -0
  16. package/hooks/blocking/config/verified_commit_gate_output_constants.py +14 -0
  17. package/hooks/blocking/conftest.py +36 -30
  18. package/hooks/blocking/convergence_gate_blocker.py +76 -8
  19. package/hooks/blocking/plain_language_blocker.py +8 -0
  20. package/hooks/blocking/state_description_blocker.py +4 -1
  21. package/hooks/blocking/test_code_rules_enforcer_dead_module_constant.py +58 -0
  22. package/hooks/blocking/test_code_rules_enforcer_dead_module_constant_alias.py +133 -0
  23. package/hooks/blocking/test_code_rules_shared.py +120 -20
  24. package/hooks/blocking/test_convergence_gate_blocker.py +146 -0
  25. package/hooks/blocking/test_plain_language_blocker.py +15 -0
  26. package/hooks/blocking/test_state_description_blocker.py +15 -0
  27. package/hooks/blocking/test_verification_verdict_store.py +12 -0
  28. package/hooks/blocking/test_verified_commit_config_bootstrap.py +18 -0
  29. package/hooks/blocking/test_verified_commit_docs_delta.py +176 -0
  30. package/hooks/blocking/test_verified_commit_gate_additional_context.py +134 -0
  31. package/hooks/blocking/tests/test_pii_prevention_blocker.py +0 -1
  32. package/hooks/blocking/tests/test_verified_commit_gate.py +41 -0
  33. package/hooks/blocking/verified_commit_config_bootstrap.py +22 -10
  34. package/hooks/blocking/verified_commit_gate.py +113 -568
  35. package/hooks/blocking/verified_commit_gate_parts/CLAUDE.md +28 -0
  36. package/hooks/blocking/verified_commit_gate_parts/__init__.py +1 -0
  37. package/hooks/blocking/verified_commit_gate_parts/command_tokenization.py +174 -0
  38. package/hooks/blocking/verified_commit_gate_parts/deny_payload.py +53 -0
  39. package/hooks/blocking/verified_commit_gate_parts/deny_reason.py +80 -0
  40. package/hooks/blocking/verified_commit_gate_parts/directory_resolution.py +170 -0
  41. package/hooks/blocking/verified_commit_gate_parts/gated_invocations.py +205 -0
  42. package/hooks/blocking/verified_commit_gate_parts/tests/conftest.py +10 -0
  43. package/hooks/blocking/verified_commit_gate_parts/tests/test_command_tokenization.py +94 -0
  44. package/hooks/blocking/verified_commit_gate_parts/tests/test_deny_payload.py +17 -0
  45. package/hooks/blocking/verified_commit_gate_parts/tests/test_deny_reason.py +38 -0
  46. package/hooks/blocking/verified_commit_gate_parts/tests/test_directory_resolution.py +71 -0
  47. package/hooks/blocking/verified_commit_gate_parts/tests/test_gated_invocations.py +61 -0
  48. package/hooks/hooks_constants/CLAUDE.md +4 -1
  49. package/hooks/hooks_constants/code_rules_path_utils_constants.py +1 -0
  50. package/hooks/hooks_constants/convergence_gate_blocker_constants.py +36 -0
  51. package/hooks/hooks_constants/dead_module_constant_constants.py +8 -0
  52. package/hooks/hooks_constants/harness_scratchpad_constants.py +10 -9
  53. package/hooks/hooks_constants/mypy_integration_constants.py +16 -0
  54. package/hooks/hooks_constants/pii_prevention_constants.py +1 -0
  55. package/hooks/validators/mypy_integration.py +145 -24
  56. package/hooks/validators/python_antipattern_checks.py +16 -0
  57. package/hooks/validators/run_all_validators.py +9 -3
  58. package/hooks/validators/test_mypy_integration.py +154 -0
  59. package/hooks/validators/test_python_antipattern_checks.py +112 -1
  60. package/hooks/validators/test_run_all_validators_pretooluse.py +16 -0
  61. package/package.json +1 -1
  62. package/rules/CLAUDE.md +3 -3
  63. package/rules/agent-spawn-protocol.md +5 -43
  64. package/rules/code-standards.md +1 -36
  65. package/rules/env-var-table-code-drift.md +2 -21
  66. package/rules/hook-prose-matches-detector.md +5 -16
  67. package/rules/nas-ssh-invocation.md +3 -15
  68. package/rules/no-historical-clutter.md +7 -49
  69. package/rules/no-inline-destructive-literals.md +3 -5
  70. package/rules/package-inventory-stale-entry.md +7 -32
  71. package/rules/re-stage-before-commit.md +6 -23
  72. package/rules/shell-invocation-policy.md +1 -1
  73. package/rules/vault-context.md +3 -3
  74. package/rules/verified-commit-gate-skip.md +28 -0
  75. package/rules/workers-done-before-complete.md +2 -30
  76. package/scripts/claude_chain_runner.py +39 -3
  77. package/scripts/dev_env_scripts_constants/claude_chain_constants.py +3 -0
  78. package/scripts/test_claude_chain_runner.py +112 -0
  79. package/scripts/test_grok_headless_runner.py +0 -1
  80. package/skills/auditing-claude-config/CLAUDE.md +2 -1
  81. package/skills/auditing-claude-config/SKILL.md +114 -176
  82. package/skills/auditing-claude-config/reference/probe-hook.md +74 -0
  83. package/skills/autoconverge/CLAUDE.md +1 -0
  84. package/skills/autoconverge/SKILL.md +310 -346
  85. package/skills/autoconverge/reference/CLAUDE.md +1 -0
  86. package/skills/autoconverge/reference/copilot-findings.md +51 -0
  87. package/skills/closeout/SKILL.md +7 -9
  88. package/skills/copilot-finding-triage/SKILL.md +5 -7
  89. package/skills/copilot-review/CLAUDE.md +3 -2
  90. package/skills/copilot-review/SKILL.md +119 -155
  91. package/skills/copilot-review/templates/subagent-prompt.md +49 -0
  92. package/skills/everything-search/SKILL.md +7 -1
  93. package/skills/fresh-branch/CLAUDE.md +6 -9
  94. package/skills/fresh-branch/SKILL.md +84 -33
  95. package/skills/fresh-branch/scripts/create_fresh_branch.py +445 -0
  96. package/skills/fresh-branch/scripts/fresh_branch_scripts_constants/__init__.py +1 -0
  97. package/skills/fresh-branch/scripts/fresh_branch_scripts_constants/fresh_branch_cli_constants.py +74 -0
  98. package/skills/fresh-branch/scripts/test_create_fresh_branch.py +670 -0
  99. package/skills/orchestrator/SKILL.md +161 -147
  100. package/skills/pr-converge/SKILL.md +277 -422
  101. package/skills/pr-converge/reference/CLAUDE.md +1 -0
  102. package/skills/pr-converge/reference/progress-checklist.md +168 -0
  103. package/skills/pr-converge/test_step5_host_branch.py +8 -6
  104. package/skills/pr-loop-cloud-transport/SKILL.md +1 -1
  105. package/skills/privacy-hygiene/SKILL.md +68 -115
  106. package/skills/privacy-hygiene/reference/sweep-procedure.md +62 -0
  107. package/skills/session-log/CLAUDE.md +2 -1
  108. package/skills/session-log/SKILL.md +4 -26
  109. package/skills/session-log/templates/frontmatter.md +40 -0
  110. package/skills/skill-builder/CLAUDE.md +8 -7
  111. package/skills/skill-builder/SKILL.md +26 -11
  112. package/skills/skill-builder/references/CLAUDE.md +3 -1
  113. package/skills/skill-builder/references/delegation-map.md +21 -12
  114. package/skills/skill-builder/references/description-field.md +9 -11
  115. package/skills/skill-builder/references/deterministic-elements.md +218 -0
  116. package/skills/skill-builder/references/self-audit-checklist.md +62 -45
  117. package/skills/skill-builder/references/skill-modularity.md +8 -9
  118. package/skills/skill-builder/templates/CLAUDE.md +2 -2
  119. package/skills/skill-builder/templates/gap-analysis.md +15 -0
  120. package/skills/skill-builder/workflows/CLAUDE.md +5 -5
  121. package/skills/skill-builder/workflows/improve-skill.md +18 -9
  122. package/skills/skill-builder/workflows/new-skill.md +23 -15
  123. package/skills/skill-builder/workflows/polish-skill.md +28 -21
  124. package/system-prompts/CLAUDE.md +3 -3
  125. package/docs/agents-md-alignment-plan.md +0 -123
  126. package/docs/emotion-informed-prompt-design.md +0 -362
  127. package/rules/es-exe-file-search.md +0 -17
@@ -21,106 +21,118 @@ delegating to Sonnet-5 workers came out cheaper and faster
21
21
  than a solo frontier agent held to the same verification rigor, with
22
22
  84-98% of the team's input tokens billed at the worker rate.
23
23
 
24
- Under this skill the session
25
- is the orchestrator. It spawns and resumes executor subagents
26
- `clean-coder` and the like and those executors do every bit of the
27
- execution: the code edits, the build runs, the test runs. The orchestrating
28
- session drives the plan and routes hard decisions to the shared advisor
29
- (Claude: warm `session-advisor`; a third-party host: Claude CLI advisor via the chain runner).
30
-
31
- ## Gotchas
32
-
33
- - **Double invocation duplicates the reminder loop.** A second `/orchestrator`
34
- in the same session schedules a second refresh loop. Check whether the loop
35
- is already running before you schedule one (see the invocation guard in
36
- Process step 1).
37
- - **The orchestrating session never executes.** The moment it edits a file or
38
- runs the tests itself, the pairing breaks and the executor's warm context is
39
- wasted. Hand every code edit and every build or test run to an executor; keep
40
- the orchestrating session's own tool use to orchestration and light
41
- verification reads. Hard decisions go to the shared advisor (Claude:
42
- `session-advisor` via SendMessage; a third-party host: Claude CLI advisor via the chain).
43
- - **Flat ad hoc spawns bypass routing.** Every execution task goes through a
44
- workflow-backed spawn or workflow resume so the required agent type, model,
45
- prompt packet, and sidecar metadata stay attached to the work.
46
- - **Wrong agent or model is an enforcement failure.** If a task category maps
47
- to `clean-coder` on `opus`, a `general-purpose` Sonnet spawn is not a cost
48
- optimization; it is the wrong executor for the contract.
49
- - **Resuming an unnamed background agent needs its agentId.** A background
50
- spawn returns an `agentId` (format `a...-...`); keep it so `SendMessage` can
51
- reach that agent later. A named agent is reachable by name.
52
- - **Only the orchestrating session owns the shared advisor's lifecycle.** An
53
- executor that finds the advisor unreachable (Claude warm agent, or Claude
54
- CLI bind on a third-party host) reports that upward; it never spawns a replacement itself.
24
+ Under this skill the session is the orchestrator. It spawns and resumes
25
+ executor subagents — `clean-coder` and the like and those executors do
26
+ every bit of the execution: the code edits, the build runs, the test
27
+ runs. The orchestrating session drives the plan, keeps the run artifacts
28
+ and the ledger current, and routes hard decisions to the shared advisor.
29
+ The moment it edits a file or runs a test itself, the pairing breaks —
30
+ its own tool use stays orchestration, run-artifact writes, and light
31
+ verification reads.
32
+
33
+ ## Design rule thin prompts, thick artifacts, thin skill
34
+
35
+ Three faces of one rule (reading pinned by the audit spec on
36
+ jl-cmd/claude-dev-env#174: thin means high-signal, not short; thick
37
+ context lives outside the window, reachable by pointers):
38
+
39
+ - **Thin prompts.** A spawn prompt is a dispatch ticket: one task,
40
+ pointers to the artifacts that hold the context, one done-check, a thin
41
+ return contract. The prompt can be thin because the context is thick
42
+ elsewhere.
43
+ - **Thick artifacts.** Durable run state lives in files the run
44
+ charter, one assignment file per task, result records written once,
45
+ read by every agent that needs them, and still there when any one
46
+ agent's context is gone.
47
+ - **Thin skill.** This file holds only what changes decisions at
48
+ orchestration time. Standing policy lives where it loads once:
49
+ [`_shared/advisor/advisor-protocol.md`](../../_shared/advisor/advisor-protocol.md)
50
+ for everything advisor, the agent definitions for executor discipline.
55
51
 
56
52
  ## Process
57
53
 
58
- 1. **Check whether the refresh loop is already running this
59
- session.** If it is, do not schedule a second loop. Reuse any live
60
- shared advisor bind (Claude warm `session-advisor`, or a third-party host's
61
- Claude CLI bind run step 3 only when none exists yet), then skip straight to step 4.
62
-
63
- 2. **Register the discipline reminder.** schedule it with
64
- `ScheduleWakeup` at `delaySeconds: 1800`, prompt `/orchestrator-refresh`,
65
- where each refresh re-schedules the next one.
66
-
67
- 3. **Bind a shared advisor before any executor.** Detect the host profile
68
- first (see Host profiles in
69
- [`_shared/advisor/advisor-protocol.md`](../../_shared/advisor/advisor-protocol.md)).
70
- On a **Claude host**, follow the Warm-up procedure in that doc (Agent spawn
71
- of `session-advisor`). Compute the model floor as the max of the
72
- orchestrating session's own tier and the highest model in the Workflow Agent
73
- Routing table below (for example, max(Sonnet, Opus) = Opus when those are
74
- the tiers in play). That floor is a lower bound only — the Claude spawn walk
75
- tries top-down from Fable down to that floor per
76
- [`_shared/advisor/advisor-protocol.md`](../../_shared/advisor/advisor-protocol.md);
77
- it is not a "spawn only at the floor" rule. Paste the **Claude host**
78
- Advisor block from that doc, with the resolved agent name filled in, into
79
- every executor's spawn prompt. On a **third-party host**, skip the Agent spawn —
80
- bind a max-tier Claude advisor through the protocol's CLI Claude-chain path
81
- (Fable high, then Opus max; `claude_chain_runner.py` for account usage
82
- failover). Paste the **Third-party host** Advisor block from that doc into every
83
- executor's spawn prompt — never the Claude SendMessage block. Every row in
84
- the routing table is a consumer of the shared advisor, not just this
85
- session. The orchestrating session owns the shared advisor's lifecycle end
86
- to end (Agent spawn or CLI bind, drift handling per the shared doc,
87
- shutdown at task end); executors only ever SendMessage the warm agent
88
- (Claude) or report to this session so it can consult the CLI advisor
89
- (a third-party host). When the CLI chain cannot bind, fail closed and report
90
- to the user — do not answer the four signals as this third-party session.
91
-
92
- 4. **Orchestrate the task.** Hold the plan and the user conversation. Execute
93
- workflow-backed spawns or resumes using the routing table below, and keep
94
- driving while they work. Every executor spawn includes the host-matched
95
- Advisor block from step 3. Your own tool use stays orchestration and light
96
- verification reads. Keep your task list updated religiously.
97
-
98
- 5. **Consult the shared advisor at hard decisions.** Every consumer — each
99
- executor and this session — consults when one of these holds (same list as
100
- the protocol and Advisor block):
101
- - A nontrivial plan is about to be locked in and acted on.
102
- - The consumer believes its assigned work is finished.
103
- - A commit, push, or other hard-to-reverse action is about to run.
104
- - The same failure has come back more than once, or progress has stalled.
105
- - The chosen approach is being reconsidered.
106
-
107
- **Claude host:** consult the shared `session-advisor` via `SendMessage`.
108
- **Third-party host:** executors report to this orchestrating session; this session
109
- consults the bound Claude CLI advisor (`claude_chain_runner.py` +
110
- `--resume`) and relays the four-signal reply (no Agent-tool
111
- `session-advisor`, no SendMessage to one). Every consult gets back one of
112
- four signals (ENDORSE, CORRECTION, PLAN, or STOP). When the CLI advisor is
113
- unreachable, fail closed and surface that to the user — do not invent a
114
- signal as this session. See `agents/session-advisor.md` for what each
115
- signal means and
54
+ 1. **Invocation guard.** One `/orchestrator` per session. When the
55
+ refresh loop is already running, do not schedule a second one; reuse
56
+ the live advisor bind and go to step 4.
57
+ 2. **Register the discipline reminder.** Schedule it with
58
+ `ScheduleWakeup` at `delaySeconds: 1800`, prompt
59
+ `/orchestrator-refresh`, where each refresh re-schedules the next one.
60
+ 3. **Bind the shared advisor before any executor.** Follow
116
61
  [`_shared/advisor/advisor-protocol.md`](../../_shared/advisor/advisor-protocol.md)
117
- for the consult format.
62
+ end to end: detect the host profile, compute the floor from the
63
+ orchestrator consumer set — this session plus every tier in the
64
+ routing table (its Model floor section) — walk the ladder top-down,
65
+ and fail closed when nothing binds. This session owns the advisor's
66
+ whole lifecycle (its Lifecycle ownership section); executors only ever
67
+ message the warm agent or report here, and an executor that finds the
68
+ advisor unreachable reports that upward — it never spawns a
69
+ replacement itself.
70
+ 4. **Write the run artifacts** (next section) before the first spawn.
71
+ 5. **Orchestrate.** Hold the plan and the user conversation. Spawn each
72
+ task with a ticket (Spawn ticket section), keep driving while
73
+ executors work, and keep the ledger reconciled (Task ledger
74
+ discipline).
75
+ 6. **Consult the advisor at hard decisions.** The trigger list, consult
76
+ format, and reply handling live in the protocol's "Consulting the
77
+ warm agent" section; both this session and every executor are
78
+ consumers. Replies open with one of ENDORSE, CORRECTION, PLAN, or
79
+ STOP — `agents/session-advisor.md` defines each signal.
80
+
81
+ ## Run state lives in artifacts
82
+
83
+ Write these before the first spawn, default home `docs/plans/<run-slug>/`
84
+ in the repo the run works on (working files, not committed):
85
+
86
+ - **Run charter** — the goal, the repo root, the advisor name and host
87
+ profile. One file every ticket points at.
88
+ - **One assignment file per task** — scope, file list, constraints, the
89
+ acceptance check, baseline command output. The thick context goes
90
+ here. `/prompt-generator` authors the assignment once at plan time,
91
+ and every ticket for that task reuses it — that reuse is what
92
+ satisfies the agent-spawn-protocol context check at each spawn.
93
+ - **Results merge into run state.** An executor's product is its
94
+ artifact — the branch diff, the test output, the report its agent type
95
+ may write — and its reply is thin: status, artifact paths, blockers.
96
+ The orchestrating session records each result into the run's result
97
+ files as it reconciles the ledger.
98
+
99
+ Correctness never rides on any agent's private context: when an executor
100
+ dies or hangs, point a fresh spawn at the same assignment file plus its
101
+ partial results and the run continues.
102
+
103
+ ## Spawn ticket — the whole prompt
104
+
105
+ Every executor spawn prompt is this shape:
106
+
107
+ ```
108
+ Task: <one sentence, one deliverable>
109
+ Read first: <assignment file path>; <run charter path>
110
+ Touch only: <files or globs>
111
+ Done when: <one mechanical check — a command, a test, a diff scope>
112
+ Return: status, artifact paths, blockers — nothing else.
113
+
114
+ <host-matched Advisor block from advisor-protocol.md, advisor name filled in>
115
+ ```
116
+
117
+ - **Size the task by its done-check.** The right task is the largest
118
+ unit that fits one sentence plus pointers, has one mechanical
119
+ done-check, and needs no mid-run clarification. A task that does not
120
+ fit gets split in the plan — never padded into a longer prompt.
121
+ Explore fan-outs run tiny; a `clean-coder` assignment can carry a
122
+ whole scoped feature.
123
+ - **Do not restate what the agent definition carries.** The routing
124
+ table picks the definition, and `clean-coder` already holds the code
125
+ discipline. The ticket adds the task, the pointers, and the Advisor
126
+ block only.
127
+ - **The Advisor block is the one pasted paragraph.** It is host-matched
128
+ at bind time and written to be self-contained (the protocol's Advisor
129
+ block section) — paste it; do not point at it.
118
130
 
119
131
  ## Workflow Agent Routing
120
132
 
121
- Every delegated task runs through a workflow-backed agent invocation. Do not
122
- spawn a flat subagent directly when a workflow invocation or workflow resume is
123
- available.
133
+ Every delegated task runs through a workflow-backed agent invocation. Do
134
+ not spawn a flat subagent directly when a workflow invocation or
135
+ workflow resume is available.
124
136
 
125
137
  | Work | Agent type | Model |
126
138
  |---|---|---|
@@ -132,76 +144,78 @@ available.
132
144
 
133
145
  Routing rules:
134
146
 
135
- - Use a workflow invocation or resume for each row above. The workflow prompt
136
- must name the selected agent type, model, work category, task scope, and
137
- expected output.
138
- - Resume a warm workflow agent before creating a new workflow run when the warm
139
- agent holds the relevant context.
140
- - `clean-coder` owns code edits. `code-verifier` owns verification. The same
141
- workflow agent never grades work it wrote.
142
- - PR-description workflows include the actual changed-file list in the prompt
143
- and verify the final body against that file list before posting or returning
144
- it.
145
- - Exploration workflows return file paths, line numbers, and direct evidence;
146
- they do not write code or mutate repo state.
147
+ - Each row spawns workflow-backed with a ticket; the routing row and the
148
+ ticket together carry the agent type, model, task, and return
149
+ contract. A task category that maps to `clean-coder` on `opus` is not
150
+ served by a `general-purpose` Sonnet spawn the table is the
151
+ contract, not a cost suggestion.
152
+ - Resume a warm workflow agent before creating a new workflow run when
153
+ the warm agent holds the relevant context.
154
+ - `clean-coder` owns code edits. `code-verifier` owns verification. The
155
+ same workflow agent never grades work it wrote.
156
+ - PR-description workflows include the actual changed-file list in the
157
+ prompt and verify the final body against that file list before posting
158
+ or returning it.
159
+ - Exploration workflows return file paths, line numbers, and direct
160
+ evidence; they do not write code or mutate repo state.
147
161
  - Fan-out worker fleets use the **grok-spawn** skill when that skill is
148
- installed and grok is usable (`grok_worker_preflight.py` soft gate). The
149
- Claude Code Agent tool remains the Claude-host alternative for in-process
150
- workers.
151
-
152
- ## Agent reuse (non-negotiable)
153
-
154
- - **Resume before you spawn, always.** A warm agent (active within the past 59 minutes) carries its context and
155
- cached tokens; a fresh spawn starts cold and pays to rebuild both.
156
- Resume the existing workflow agent by name or `agentId` when it holds
157
- relevant context. Prefer that path every time an existing workflow agent
158
- matches the routing table.
159
- - **Spawn a fresh agent only when** no existing agent holds relevant context,
160
- or a genuine task switch needs a clean context.
161
- - **Name the agent to resume.** When a PLAN from the shared advisor fits a warm
162
- agent, name which agent to resume and where.
162
+ installed and grok is usable (`grok_worker_preflight.py` soft gate).
163
+ The Claude Code Agent tool remains the Claude-host alternative for
164
+ in-process workers.
165
+
166
+ ## Agent reuse
167
+
168
+ - **Resume before you spawn.** A warm agent (active within the past 59
169
+ minutes) carries its context and cached tokens; a fresh spawn pays to
170
+ rebuild both. Resume by name, or by `agentId` for an unnamed
171
+ background spawn keep the `agentId` (format `a...-...`) from the
172
+ spawn result so `SendMessage` can reach that agent later.
173
+ - **Spawn a fresh agent only when** no existing agent holds relevant
174
+ context, or a genuine task switch needs a clean context.
175
+ - **Reuse is a cost rule, not a correctness dependency.** The run
176
+ artifacts keep every executor replaceable (Run state section).
177
+ - **Name the agent to resume.** When a PLAN from the shared advisor fits
178
+ a warm agent, name which agent to resume and where.
163
179
 
164
180
  ## Task ledger discipline
165
181
 
166
- The task list is the run's ledger, and it must be reconcilable against the live
167
- agents at any moment. Four invariants hold at all times:
182
+ The task list is the run's ledger, and it must be reconcilable against
183
+ the live agents at any moment. Four invariants hold at all times:
168
184
 
169
- 1. **No untracked work.** Every unit of delegated work has a task BEFORE its
170
- executor spawns — TaskCreate first, then Agent.
171
- 2. **Ownership is live.** At spawn, set the task `in_progress` with `owner` =
172
- the executor's agent name. One task, one owner.
173
- 3. **Completion follows evidence.** A task turns `completed` only when the
174
- executor's result is back AND merged into run state — never on dispatch,
175
- never on a self-report alone (see `workers-done-before-complete`).
176
- 4. **Dependencies mirror the plan.** Phase order is encoded as `blockedBy`
177
- links, updated the moment the plan changes.
185
+ 1. **No untracked work.** Every unit of delegated work has a task BEFORE
186
+ its executor spawns — TaskCreate first, then Agent.
187
+ 2. **Ownership is live.** At spawn, set the task `in_progress` with
188
+ `owner` = the executor's agent name. One task, one owner.
189
+ 3. **Completion follows evidence.** A task turns `completed` only when
190
+ the executor's result is back AND merged into run state — the run's
191
+ result files and the task record — never on dispatch, never on a
192
+ self-report alone (see `workers-done-before-complete`).
193
+ 4. **Dependencies mirror the plan.** Phase order is encoded as
194
+ `blockedBy` links, updated the moment the plan changes.
178
195
 
179
- Reconcile on every state change (spawn, completion notification, plan change)
180
- and on every `/orchestrator-refresh` firing.
196
+ Reconcile on every state change (spawn, completion notification, plan
197
+ change) and on every `/orchestrator-refresh` firing.
181
198
 
182
199
  ## Constraints
183
200
 
184
201
  - One `/orchestrator` per session; the invocation guard blocks a second
185
202
  reminder loop.
186
- - The orchestrating session orchestrates and routes hard decisions to the
187
- shared advisor (host-matched path in step 5), but never edits code or runs a
188
- build or test itself executors do that.
189
- - Delegated execution uses workflow-backed agent invocations and follows the
190
- Workflow Agent Routing table exactly.
191
- - One shared advisor per orchestrated session, owned by the orchestrating
192
- session (see
193
- [`_shared/advisor/advisor-protocol.md`](../../_shared/advisor/advisor-protocol.md))
194
- — on Claude, executors consult a warm `session-advisor` via SendMessage; on
195
- a third-party host, executors report here and this session relays the Claude CLI advisor.
196
- Executors never spawn or respawn the advisor.
197
- - Reuse a warm agent over a cold spawn whenever one holds relevant context.
203
+ - The orchestrating session never edits code or runs a build or test
204
+ itself executors do that. Its own tool use stays orchestration,
205
+ run-artifact writes, and light verification reads.
206
+ - Every delegated task carries a ledger entry, an assignment artifact,
207
+ and a workflow-backed spawn with a ticket, routed by the table.
208
+ - One shared advisor per orchestrated session, owned by this session per
209
+ the protocol; executors never spawn, respawn, or shut it down.
198
210
 
199
211
  ## File Index
200
212
 
201
213
  | File | Purpose |
202
214
  |---|---|
203
- | `SKILL.md` | Orchestrator strategy, workflow routing contract, shared-advisor consult protocol, reuse rules, and constraints. |
215
+ | `SKILL.md` | Orchestrator strategy: design rule, process, run artifacts, spawn ticket, routing table, reuse rules, ledger invariants, constraints. |
204
216
 
205
217
  ## Folder Map
206
218
 
207
- - `SKILL.md` — complete orchestrator workflow instructions.
219
+ - `SKILL.md` — complete orchestrator workflow instructions. Advisor
220
+ policy lives in
221
+ [`_shared/advisor/advisor-protocol.md`](../../_shared/advisor/advisor-protocol.md).