@zalom/plastic 1.14.0 → 2.0.0-alpha.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 (190) hide show
  1. package/PLASTIC.md +101 -294
  2. package/README.md +5 -6
  3. package/agents/plastic-advisor.md +18 -17
  4. package/agents/plastic-enforcer.md +57 -69
  5. package/agents/plastic-executor.md +34 -20
  6. package/agents/plastic-faux-advisor.md +18 -18
  7. package/config_asks.yml +38 -0
  8. package/hooks/capture +4 -0
  9. package/hooks/check-update +12 -3
  10. package/hooks/close +5 -0
  11. package/hooks/hooks.json +9 -49
  12. package/hooks/record +4 -0
  13. package/package.json +3 -2
  14. package/scripts/agent-report +8 -9
  15. package/scripts/append-ledger +195 -0
  16. package/scripts/codex-hook +101 -95
  17. package/scripts/dashboard.rb +4 -4
  18. package/scripts/doctor.rb +106 -43
  19. package/scripts/end-intent +77 -76
  20. package/scripts/exec-worktree +11 -20
  21. package/scripts/file-session-intent +61 -0
  22. package/scripts/hook-capture +242 -0
  23. package/scripts/hook-close +34 -0
  24. package/scripts/hook-record +149 -0
  25. package/scripts/hook-session-start +95 -12
  26. package/scripts/install.rb +8 -6
  27. package/scripts/lib/agent_models.rb +1 -7
  28. package/scripts/lib/arm.rb +283 -0
  29. package/scripts/lib/backfill_intent.rb +316 -0
  30. package/scripts/lib/bridge.rb +24 -1597
  31. package/scripts/lib/doctor_core.rb +17 -88
  32. package/scripts/lib/doctor_session_ledger.rb +106 -0
  33. package/scripts/lib/exec_worktree.rb +14 -60
  34. package/scripts/lib/harness_text.rb +5 -4
  35. package/scripts/lib/hook_registry.rb +44 -107
  36. package/scripts/lib/insights.rb +3 -4
  37. package/scripts/lib/installer_core.rb +19 -30
  38. package/scripts/lib/lock.rb +6 -26
  39. package/scripts/lib/outcome_guard.rb +7 -5
  40. package/scripts/lib/project_validator.rb +30 -1
  41. package/scripts/lib/roadmap_queue.rb +3 -3
  42. package/scripts/lib/roadmap_savepoint.rb +1 -1
  43. package/scripts/lib/rule_catalog.rb +6 -3
  44. package/scripts/lib/savepoint.rb +320 -0
  45. package/scripts/lib/scaffold_intent.rb +13 -179
  46. package/scripts/lib/session_backfill.rb +184 -0
  47. package/scripts/lib/session_close.rb +84 -0
  48. package/scripts/lib/session_git.rb +469 -0
  49. package/scripts/lib/session_ledger.rb +497 -0
  50. package/scripts/lib/store_discovery.rb +1 -1
  51. package/scripts/lib/store_provisioning.rb +1 -1
  52. package/scripts/maintenance-run +7 -7
  53. package/scripts/new-intent +63 -4
  54. package/scripts/plastic-lock +94 -41
  55. package/scripts/promote-session-item +150 -0
  56. package/scripts/rebuild-graph +1 -1
  57. package/scripts/roadmap-next +2 -2
  58. package/scripts/rollback.rb +42 -3
  59. package/scripts/scaffold-intent +37 -63
  60. package/scripts/session-commit +116 -0
  61. package/scripts/spawn-preamble +5 -5
  62. package/scripts/update.rb +7 -3
  63. package/skills/agent-advisor/SKILL.md +3 -3
  64. package/skills/agent-advisor/references/advisor-protocol.md +20 -20
  65. package/skills/auto/SKILL.md +218 -317
  66. package/skills/auto/evals/evals.json +10 -10
  67. package/skills/auto/references/agent-architecture.md +102 -90
  68. package/skills/auto/references/agent-report-contract.md +4 -21
  69. package/skills/auto/references/end-tail.md +47 -53
  70. package/skills/auto/references/human-report-contract.md +8 -8
  71. package/skills/conventions/SKILL.md +1 -3
  72. package/skills/conventions/references/lifecycle-and-savepoints.md +35 -1
  73. package/skills/conventions/references/locks-and-worktrees.md +47 -55
  74. package/skills/conventions/references/maintenance-and-revisions.md +12 -12
  75. package/skills/dashboard/SKILL.md +1 -1
  76. package/skills/direct/SKILL.md +66 -0
  77. package/skills/direct/references/request-signals.md +59 -0
  78. package/skills/doctor/SKILL.md +58 -11
  79. package/skills/doctor/report.md +3 -1
  80. package/skills/install/SKILL.md +11 -9
  81. package/skills/intent-continuing/SKILL.md +131 -89
  82. package/skills/intent-continuing/references/boarding-matrix.md +34 -0
  83. package/skills/intent-continuing/references/context-management.md +2 -2
  84. package/skills/intent-creating/SKILL.md +2 -2
  85. package/skills/intent-creating/references/lifecycle.md +1 -1
  86. package/skills/intent-ending/SKILL.md +28 -37
  87. package/skills/intent-ending/evals/evals.json +4 -4
  88. package/skills/intent-executing/SKILL.md +12 -49
  89. package/skills/intent-executing/plan-reviewer-prompt.md +39 -0
  90. package/skills/intent-speccing/SKILL.md +108 -51
  91. package/skills/intent-speccing/evals/evals.json +5 -5
  92. package/skills/intent-speccing/references/per-section-fill-rules.md +4 -4
  93. package/skills/intent-speccing/references/self-verify-checklist.md +1 -2
  94. package/skills/project-creating/SKILL.md +1 -1
  95. package/skills/releasing/SKILL.md +7 -8
  96. package/skills/tutorial/SKILL.md +2 -2
  97. package/skills/tutorial/references/track-1-guided.md +16 -18
  98. package/skills/tutorial/references/track-2-auto.md +12 -13
  99. package/skills/tutorial/references/track-3-projects-and-roadmaps.md +2 -2
  100. package/templates/agents.md +4 -7
  101. package/templates/project.yml +7 -0
  102. package/templates/roadmap.md +1 -1
  103. package/templates/savepoint.md +2 -2
  104. package/templates/session-intent.md +29 -0
  105. package/agents/plastic-brainstorming.md +0 -48
  106. package/agents/plastic-future-intent-researcher.md +0 -35
  107. package/agents/plastic-intent-curator.md +0 -47
  108. package/agents/plastic-intent-discovery.md +0 -43
  109. package/agents/plastic-planner.md +0 -56
  110. package/agents/plastic-spec-specialist.md +0 -53
  111. package/hooks/auto-arm +0 -5
  112. package/hooks/bash-gate +0 -3
  113. package/hooks/continue +0 -31
  114. package/hooks/edit-gates +0 -3
  115. package/hooks/future-intent-check +0 -25
  116. package/hooks/gate-check +0 -12
  117. package/hooks/power-tools +0 -8
  118. package/scripts/hook-auto-arm +0 -51
  119. package/scripts/hook-bash-gate +0 -78
  120. package/scripts/hook-code-gate +0 -38
  121. package/scripts/hook-continue +0 -48
  122. package/scripts/hook-create-gate +0 -51
  123. package/scripts/hook-edit-gates +0 -58
  124. package/scripts/hook-future-intent-check +0 -90
  125. package/scripts/hook-gate-check +0 -169
  126. package/scripts/hook-links-gate +0 -54
  127. package/scripts/hook-lock-gate +0 -47
  128. package/scripts/hook-power-tools +0 -38
  129. package/scripts/hook-savepoint-pre +0 -32
  130. package/scripts/lib/codex_edit_gates.rb +0 -138
  131. package/scripts/lib/edit_gates.rb +0 -398
  132. package/scripts/lib/links_gate.rb +0 -140
  133. package/scripts/lib/qmd_hook.rb +0 -41
  134. package/scripts/lib/spec_header.rb +0 -83
  135. package/scripts/lib/start_intent.rb +0 -296
  136. package/scripts/start-intent +0 -89
  137. package/skills/_active-intent-gate.md +0 -26
  138. package/skills/auto/references/tiers.md +0 -100
  139. package/skills/continuing/SKILL.md +0 -34
  140. package/skills/continuing/evals/evals.json +0 -91
  141. package/skills/conventions/references/gates-and-enforcement.md +0 -53
  142. package/skills/conventions/references/tiers-and-dispatch.md +0 -135
  143. package/skills/doctor/references/gates-stuck-detection.md +0 -43
  144. package/skills/intent-brainstorming/SKILL.md +0 -118
  145. package/skills/intent-brainstorming/evals/evals.json +0 -67
  146. package/skills/intent-continuing/evals/evals.json +0 -145
  147. package/skills/intent-discovering/SKILL.md +0 -56
  148. package/skills/intent-grilling/SKILL.md +0 -108
  149. package/skills/intent-linking/SKILL.md +0 -128
  150. package/skills/intent-linking/evals/evals.json +0 -22
  151. package/skills/intent-linking/references/zettelkasten.md +0 -45
  152. package/skills/intent-locking/SKILL.md +0 -64
  153. package/skills/intent-planning/SKILL.md +0 -145
  154. package/skills/intent-planning/evals/evals.json +0 -81
  155. package/skills/intent-planning/references/plan-format.md +0 -130
  156. package/skills/intent-researching/SKILL.md +0 -123
  157. package/skills/intent-researching/evals/evals.json +0 -22
  158. package/skills/intent-savepoint/SKILL.md +0 -83
  159. package/skills/intent-savepoint/references/context-management.md +0 -32
  160. package/skills/intent-starting/SKILL.md +0 -151
  161. package/skills/intent-starting/evals/evals.json +0 -117
  162. package/skills/intent-starting/references/boarding-matrix.md +0 -35
  163. package/skills/project-continuing/SKILL.md +0 -119
  164. package/skills/project-continuing/evals/evals.json +0 -100
  165. package/skills/roadmap-continuing/SKILL.md +0 -89
  166. package/skills/roadmap-continuing/evals/evals.json +0 -82
  167. package/skills/skill-creating/SKILL.md +0 -75
  168. package/skills/skill-creating/evals/evals.json +0 -108
  169. package/skills/skill-creating/references/agents.md +0 -168
  170. package/skills/skill-creating/references/defaults-first.md +0 -23
  171. package/skills/skill-creating/references/evals.md +0 -41
  172. package/skills/skill-creating/references/hooks.md +0 -251
  173. package/skills/skill-creating/references/progressive-disclosure.md +0 -176
  174. package/skills/skill-creating/references/scripts.md +0 -166
  175. package/skills/skill-creating/references/skills.md +0 -169
  176. package/skills/skill-creating/scripts/scaffold.rb +0 -313
  177. package/skills/skill-evaluating/SKILL.md +0 -141
  178. package/skills/skill-evaluating/assets/eval-template.json +0 -12
  179. package/skills/skill-evaluating/evals/evals.json +0 -75
  180. package/skills/skill-evaluating/references/convention-checks.md +0 -76
  181. package/skills/skill-evaluating/references/eval-methodology.md +0 -154
  182. package/skills/store-curating/SKILL.md +0 -64
  183. package/skills/store-curating/evals/evals.json +0 -38
  184. package/skills/store-indexing/SKILL.md +0 -93
  185. package/skills/store-indexing/evals/evals.json +0 -22
  186. package/skills/store-indexing/references/zettelkasten-linking.md +0 -32
  187. package/skills/store-provisioning/SKILL.md +0 -55
  188. /package/skills/{project-continuing → intent-continuing}/references/board-fill.md +0 -0
  189. /package/skills/{roadmap-continuing → intent-continuing}/references/liveness-ranking.md +0 -0
  190. /package/skills/{intent-brainstorming → intent-speccing}/references/design-principles.md +0 -0
@@ -1,9 +1,10 @@
1
1
  ---
2
2
  name: plastic-auto
3
3
  description: >-
4
- Autonomous intent delivery - agent takes over How and Exec. Use when user says
5
- "auto", "take it from here", "deliver this", or when brainstorming-grill-me concludes
6
- and user confirms autonomous execution. Requires an active intent in INDEX.md.
4
+ Autonomous intent delivery - a background team takes a registered intent from How to Done.
5
+ Use when user says "auto", "take it from here", "deliver this", or when a thinking
6
+ conversation concludes and the user confirms autonomous execution. Requires an active intent
7
+ in INDEX.md.
7
8
  user-invocable: true
8
9
  ---
9
10
 
@@ -11,175 +12,128 @@ user-invocable: true
11
12
 
12
13
  Announce: "Taking over intent [ID] - [name] for autonomous delivery."
13
14
 
14
- **Advisory (not a gate).** At auto-mode start, recommend once that the user run this
15
+ **Advisory (not a rule).** At auto-mode start, recommend once that the user run this
15
16
  orchestrating main session on the best available thinking model (Fable, Opus, or whatever
16
- supersedes them) for the sharpest gating and synthesis. This is advice only: it changes no
17
- behavior and blocks nothing if ignored. It concerns the human's MAIN session; dispatched
18
- subagents keep their pinned tier and never resolve to Fable, unless an explicit
19
- `agents.models.<name>` config override names Fable for that role, in which case the override
20
- is honored as written. The two advisors, `plastic-advisor` and `plastic-faux-advisor`, are not
21
- lifecycle stage roles: the never-Fable rule governs stage agents only. Neither is ever
22
- dispatched by the auto pipeline; they are consultation roles summoned deliberately by the user
23
- or the main session, and their models are user configuration (fable and opus by default on
24
- Claude Code).
17
+ supersedes them). This is advice only: it changes no behavior. Dispatched agents keep their
18
+ configured model and never resolve to Fable unless an explicit `agents.models.<name>` config
19
+ override names Fable for that role. The two advisors, `plastic-advisor` and
20
+ `plastic-faux-advisor`, are consultation roles the user or the main session summons
21
+ deliberately; the auto pipeline never dispatches them.
25
22
 
26
23
  ## Precondition
27
24
 
28
- An active intent MUST exist in INDEX.md. If none exists, refuse: "No active intent found. Create one first with /plastic-intent-creating."
25
+ An active intent MUST exist in INDEX.md. If none exists, refuse: "No active intent found.
26
+ Create one first with /plastic-intent-creating."
29
27
 
30
- If multiple active intents exist, ask the user which one to deliver (the one question auto asks at boarding, before delivery starts).
28
+ If several active intents exist, ask the user which one to deliver (the one question auto asks
29
+ at boarding, before delivery starts).
31
30
 
32
- **Picking work when no intent is specified.** If the user says "auto" without naming an
33
- intent and none is active, consult the roadmap first (the primary planning surface), then
34
- fall back to the dashboard queue. Read the tier's mid-flight roadmap:
31
+ **Picking work when no intent is specified.** If the user says "auto" without naming an intent
32
+ and none is active, consult the roadmap first (the primary planning surface), then fall back to
33
+ the dashboard queue:
35
34
 
36
35
  ```bash
37
36
  ruby ~/.plastic/scripts/roadmap-next --roadmaps-dir <tier>/roadmaps
38
37
  ```
39
38
 
40
- Branch on `state`:
41
- - `dispatchable`: work its `dispatchable_queue` in `rank` order (the head is the next batch
42
- entry). These are the current batch's `queued` intents, parallel-safe within the batch.
43
- - `in_flight`: the frontier batch is still delivering. Report it and wait. Do NOT dispatch a
44
- later batch and do NOT fall through to the dashboard, the roadmap is live.
45
- - `none` or `exhausted`: no roadmap, or nothing left to dispatch. Fall back to the dashboard
46
- queue below. (The global store has no roadmap, so it always reports `none` and falls back.)
39
+ Branch on `state`: `dispatchable` means work its `dispatchable_queue` in `rank` order (the
40
+ current batch's `queued` intents, parallel-safe within the batch); `in_flight` means the
41
+ frontier batch is still delivering, report it and wait, never dispatch a later batch; `none` or
42
+ `exhausted` means fall back to `ruby ~/.plastic/scripts/dashboard.rb all --json` and work its
43
+ `dispatchable_queue` in `rank` order, leaving `human_only` and `next_big_thing` for the user.
47
44
 
48
- Dashboard fallback:
45
+ QMD-first (when available): when the user describes the work rather than naming an intent, run
46
+ `ruby ~/.plastic/scripts/qmd-sync search "<terms>"` before scanning the store, then open the
47
+ authoritative intent file for the hit you take over. The command is a no-op when QMD is absent.
49
48
 
50
- ```bash
51
- ruby ~/.plastic/scripts/dashboard.rb all --json
52
- ```
49
+ ## Take the intent (do this FIRST)
53
50
 
54
- Work `dispatchable_queue` in `rank` order (these are `defer`/`research` dispositions -
55
- safe to deliver autonomously). Leave `human_only` and `next_big_thing` for the user - those
56
- are `drive`/`triage` items the human should lead. See the `plastic-dashboard` skill.
57
-
58
- QMD-first (when available): when the user describes the work to deliver rather than naming an
59
- intent, before scanning the store with grep/Read run
60
- `ruby ~/.plastic/scripts/qmd-sync search "<terms>"` to surface candidate, prior, or duplicate
61
- intents, then open the authoritative intent file for the hit you take over. The command is a no-op
62
- when QMD is absent, so fall back to the existing INDEX.md / file scan. (This is discovery; the
63
- reindex step under Completion is separate.)
64
-
65
- ## Tiers (proportional auto sizing)
66
-
67
- Auto mode sizes every intent S/M/L at Why, deterministically, then matches agent topology
68
- and artifact depth to that size. Extended walkthrough: `references/tiers.md`.
69
-
70
- 1. **Sizing rule.** S = single mechanism or file cluster (hours). M = one subsystem (a
71
- day). L = cross-cutting or novel design.
72
- 2. **Two levers.** Speed comes only from artifact content DEPTH and agent TOPOLOGY. The
73
- same-structure invariant (same file set, stage order, gates, savepoint ledger) holds at
74
- every tier and in both modes. A three-line spec.md is still a spec.md, in the same
75
- place, under the same gate.
76
- 3. **Per-tier topology.** S/M: one thinker agent, one boot, two stations, sonnet
77
- executor; the thinker writes at least one real action file (one consolidated
78
- `actions/ACTION_1.md`), never an empty `actions/`. That executor runs as ONE dispatch
79
- for the whole consolidated action, with no per-task two-stage review loop
80
- (`plastic-intent-executing` holds that gate). S cuts two more things: it skips the QMD
81
- discovery deposit when chain and sources are both empty AND a size of S is already on
82
- record (a stamped `Tier: S` line in spec.md), which a first activation does not have,
83
- and it sends ONE mid-flight owner briefing, at How. M and L send all four. L: today's
84
- full team (`## Team Spin-Up` below), one `actions/ACTION_N.md` per task, and a per-task
85
- implementer plus two-stage review.
86
- 4. **Never-cut list**, any tier or mode: the independent reviewer (separate agent, fresh
87
- context, never the maker), `outcome.md` as truth of delivery, the delivery lock,
88
- worktree isolation, intent creation via skill, INDEX as status truth, the QMD reindex
89
- at End. Lightness is about ceremony, never about these guarantees.
90
- 5. **Tier record.** `Tier: S|M|L` at the top of spec.md. Convention-only: read by the
91
- orchestrator, never validated by any gate or by doctor. A separate
92
- `Settled: yes (<reason>)` line may sit directly beneath the `Tier:` line; an absent
93
- line means not settled, and settledness is independent of scope.
94
-
95
- Read `../plastic-conventions/references/tiers-and-dispatch.md` for tier sizing, agent-model
96
- config, advisor routing, and the auto-mode human report contract behind the sizing above. This
97
- path resolves relative to this skill's own installed directory.
98
-
99
- ## Arm the Lifecycle Gate (do this FIRST)
100
-
101
- Immediately after selecting the intent - before any other work - arm auto mode. This
102
- writes the session bridge that makes the code-edit gate live, so project code cannot be
103
- edited before the plan exists (the gate applies to YOU, the orchestrator):
51
+ Immediately after selecting the intent, take it for this session. One verb acquires the durable
52
+ `delivery.lock` in the intent directory (stamped `run_mode: auto`), provisions the code worktree
53
+ at `<repo>/.claude/worktrees/{id}--{slug}` on branch `plastic/{id}--{slug}`, and points this
54
+ session at the intent (`~/.plastic/store/.tmp/<session>/current`), so the record hook writes
55
+ savepoint lines and heartbeats for it instead of the day ledger:
104
56
 
105
57
  ```bash
106
- ruby -r ~/.plastic/scripts/lib/bridge -e \
107
- 'codex=ENV["CODEX_THREAD_ID"].to_s.strip; claude=ENV["CLAUDE_CODE_SESSION_ID"].to_s.strip; harness=!codex.empty? ? "codex" : (!claude.empty? ? "claude" : nil); session=!codex.empty? ? codex : (!claude.empty? ? claude : nil); Bridge.arm_auto(session, intent_id: "<ID>", intent_dir: "<STORE>/<dir>", store: "<STORE>", name: "<name>", harness: harness, agent: "plastic-enforcer", thread: (!codex.empty? ? codex : nil))'
58
+ codex="${CODEX_THREAD_ID:-}"; claude="${CLAUDE_CODE_SESSION_ID:-}"
59
+ ruby ~/.plastic/scripts/plastic-lock arm --intent-dir "<STORE>/<dir>" --mode auto \
60
+ --agent plastic-enforcer \
61
+ ${codex:+--harness codex --session "$codex" --thread "$codex"} \
62
+ ${claude:+--harness claude --session "$claude"}
108
63
  ```
109
64
 
110
- Replace `<ID>`, `<STORE>` (e.g. `~/.plastic/projects/<slug>/store` or `~/.plastic/store`),
111
- `<dir>` (the `ID--slug` directory), and `<name>`. The first argument is the session id you
112
- want the bridge keyed by: pass the hook stdin `session_id` when you have it. The executable
113
- snippet trusts a nonblank `CODEX_THREAD_ID` as Codex, otherwise a nonblank
114
- `CLAUDE_CODE_SESSION_ID` as Claude, otherwise leaves harness and thread unknown. Never guess
115
- identity from an absent runtime variable. Arming always succeeds and acquires the
116
- durable `delivery.lock` in the intent dir. For the `resolve_session` fallback chain
117
- (why arming never needs a non-empty session env var, and what the lock ownership model
118
- implies for later tool calls) read `references/end-tail.md`.
119
-
120
- **Hard rule for the rest of this run:** do NOT edit project code (anything outside the
121
- intent directory / `~/.plastic/`) until `plan.md` AND `checklist.md` exist for the intent.
122
- Honor the cycle: What → Why (spec.md) → How (plan.md + actions/ + checklist.md) → Exec.
123
-
124
- Read `../plastic-conventions/references/locks-and-worktrees.md` for delivery isolation: the
125
- single-owner lock, claims, worktrees, solo mode, and the station ledger behind the arming above.
126
-
127
- ## Flags
128
-
129
- - `--skip-permissions` - bypass hard stops on destructive actions on existing projects. Full trust mode. Default: off.
130
-
131
- ## Team Spin-Up
132
-
133
- This is the L-tier shape (see `## Tiers` above); S/M collapse it to one thinker agent.
134
-
135
- Auto mode spins up exactly ONE enforcer-led team per intent. The plastic-enforcer IS this orchestrator (you), not a separately dispatched agent, which avoids the who-gates-the-gater regress.
136
-
137
- Roster (one role per cycle stage):
138
-
139
- - **plastic-brainstorming** (Why exploration): enriches `## Context` + `### Decisions`
140
- - **plastic-spec-specialist** (`spec.md`)
141
- - **plastic-planner** (`plan.md` + `actions/` + `checklist.md`)
142
- - **plastic-executor** (code + checklist + `## Insights`)
143
- - **plastic-enforcer** (orchestrates + gates; that is YOU)
144
-
145
- Dispatch rule: sequential, one specialist per stage on one branch (the deliverables share files). Gate each deliverable against the stage's exit criteria before handing off. The How and Exec phases below default to Plastic's native dispatch (`plastic-intent-executing`) and delegate to the superpowers skills only when they are available or the user asks; do not restate the phase mechanics here.
146
-
147
- Spawn preamble (live-state injection): before dispatching any specialist, run `scripts/spawn-preamble <intent_dir> --role <role>` and PREPEND its output to that specialist's prompt. The preamble is a deterministic, filesystem-only snapshot of the active intent (id, intent line, current stage, and the provisioned code worktree path when one exists on disk) plus the honoring instruction, so every spawned agent boots with accurate live state instead of guessing. This is the authoritative L2 mechanism for harnesses whose sub-agents do not inherit a top-level session event (see [`harness-adapters.md`](https://github.com/zalom/plastic/blob/main/docs/reference/harness-adapters.md)).
148
-
149
- Dispatch-time model contract (belt-and-braces): alongside the preamble, resolve each specialist's model through the config chain (`read-config agents.models.<basename> --project <repo>`: project override, then global, then the shipped tier default) and pass it explicitly at dispatch. Never rely on the dispatched role's frontmatter alone; a resolved subagent model is never Fable,
150
- unless an explicit `agents.models.<name>` config override names Fable for that role, in which
151
- case the override is honored as written. The two advisors, `plastic-advisor` and
152
- `plastic-faux-advisor`, are not lifecycle stage roles: the never-Fable rule governs stage
153
- agents only. Neither is ever dispatched by the auto pipeline; they are consultation roles
154
- summoned deliberately by the user or the main session, and their models are user configuration
155
- (fable and opus by default on Claude Code).
156
-
157
- Completion report (require-then-synthesize): every dispatched specialist MUST end with a structured completion report as its final message. The preamble's `REPORT_CONTRACT` injects this and the role prompts carry the per-role format (see `references/agent-report-contract.md`). Because child-agent honor is best-effort across harnesses, this is decision-shaping, not a hard block. When a specialist returns no usable report (it went idle, emitted only a bare ping, or its message was lost to a mid-run interjection), run `scripts/agent-report <intent_dir> --role <role>` to synthesize a deterministic filesystem-derived report so the handoff account always exists. Use the agent-authored report when present, the synthesized one otherwise.
158
-
159
- Final-gate review: dispatch an independent reviewer subagent at the final gate only, not as a standing role.
160
-
161
- ### Delegation (subagents writing under the owner's lock)
162
-
163
- The enforcer's session owns the delivery lock. Per-stage specialists run in
164
- their own sessions and would be denied by the lock gate, so register each one
165
- as a delegate before (or when) it needs to write into the intent dir:
166
-
167
- 1. Instruct each spawned specialist to report its session id and runtime identity in its first
65
+ Replace `<STORE>` (`~/.plastic/projects/<slug>/store` or `~/.plastic/store`) and `<dir>` (the
66
+ `ID--slug` directory). The snippet trusts a nonblank `CODEX_THREAD_ID` as Codex, otherwise a
67
+ nonblank `CLAUDE_CODE_SESSION_ID` as Claude, otherwise passes no identity and the verb keys the
68
+ lock by a derived session key. Never guess identity from an absent runtime variable; an
69
+ unknown harness or thread stays unknown. Exit 1 means the lock is held, stale, excluded, or
70
+ corrupt; the message names the `plastic-doctor` verb that resolves it. Do not proceed as the
71
+ owner after an exit 1.
72
+
73
+ Read `../plastic-conventions/references/locks-and-worktrees.md` for what the lock and the
74
+ worktree mean and the station table behind them. Code edits happen only inside the worktree.
75
+
76
+ ## The shape (five steps, two agent boots)
77
+
78
+ Every auto delivery runs the same shape, ruled by the owner on 2026-08-29. There is no intent
79
+ tier and no stage agent; depth follows the work.
80
+
81
+ | Step | Who | What lands |
82
+ |---|---|---|
83
+ | 1. The lead writes How | this session | `plan.md`, at least one `actions/ACTION_N.md` carrying a failure-mode matrix (one row per operation: the failure and the test that catches it), `checklist.md` |
84
+ | 2. Adversarial plan review | boot 1, a fresh agent on `plan-reviewer-prompt.md` | a review file; the lead folds every finding into the spec, the matrix, and the tests |
85
+ | 3. Execute, tests first | boot 2, `plastic-executor` | the red commit (the matrix's tests, failing), then the code, then a green suite |
86
+ | 4. Review by risk | boot 3 only when risk calls for it (below) | a pass or a list of fixes the executor applies |
87
+ | 5. One suite run, then close | this session | `outcome.md`, `end-intent`, the roadmap ledger |
88
+
89
+ Two boots is the normal delivery; the third is the exception the risk rule names. The lead is
90
+ this session (the `plastic-enforcer` role), never a dispatched agent.
91
+
92
+ ## Team
93
+
94
+ - **plastic-enforcer**: this session. Writes the Why and How record, dispatches, folds reviews,
95
+ verifies, closes.
96
+ - **plastic-executor**: one dispatch per intent, implements the consolidated action tests first,
97
+ ticks the checklist, appends `## Insights`, drives the suite green.
98
+ - **the plan reviewer**: one dispatch before code, from `plastic-intent-executing`'s
99
+ `plan-reviewer-prompt.md`; a fresh agent, never the lead.
100
+ - **the post-execution reviewer**: dispatched only by the risk rule, from
101
+ `code-quality-reviewer-prompt.md`; a fresh agent, never the maker.
102
+
103
+ Spawn preamble (live-state injection): before dispatching any agent, run
104
+ `scripts/spawn-preamble <intent_dir> --role <role>` and PREPEND its output to the prompt. The
105
+ preamble is a deterministic, filesystem-only snapshot of the intent (id, intent line, current
106
+ stage, the worktree path when it exists) plus the honoring instruction and the report contract.
107
+
108
+ Dispatch-time model contract: resolve each agent's model through the config chain
109
+ (`read-config agents.models.<basename> --project <repo>`: project override, then global, then
110
+ the shipped default) and pass it explicitly at dispatch; never rely on the role's frontmatter
111
+ alone.
112
+
113
+ Completion report (require, then synthesize): every dispatched agent MUST end with a structured
114
+ completion report as its final message (`references/agent-report-contract.md`). When an agent
115
+ returns no usable report, run `scripts/agent-report <intent_dir> --role <role>` to synthesize a
116
+ deterministic filesystem-derived one, so the handoff account always exists.
117
+
118
+ ### Delegation (agents writing under the owner's lock)
119
+
120
+ This session owns the delivery lock. A dispatched agent runs in its own session, so register
121
+ each one as a delegate before (or when) it needs to write into the intent dir:
122
+
123
+ 1. Instruct each spawned agent to report its session id and runtime identity in its first
168
124
  message: `CODEX_THREAD_ID` for Codex, or `CLAUDE_CODE_SESSION_ID` for Claude. Use the
169
- specialist/hook identity when known; never infer a harness or model from missing context.
125
+ agent's own identity when known; never infer a harness or model from missing context.
170
126
  2. As the lock owner, run:
171
127
  `ruby ~/.plastic/scripts/plastic-lock delegate --intent-dir <intent-dir> --delegate <specialist-session-id> --harness <specialist-harness-when-known> --agent <role> --model <resolved-model-when-known> --thread <reported-CODEX_THREAD_ID-when-Codex>`
172
128
  Omit `--harness`, `--model`, or `--thread` when that value is unknown; `--agent <role>` is
173
- always known from the dispatch roster.
174
- 3. If a specialist hits a lock-gate deny, the deny message names this exact
175
- command; run it and have the specialist retry.
176
- 4. Immediately after the specialist returns, and before validating or dispatching
129
+ always known from the roster.
130
+ 3. Immediately after the specialist returns, and before validating or dispatching
177
131
  the next handoff, classify the return and record its activity status as the owner:
178
132
  - `finished` means the specialist returned a usable completion report, whether
179
133
  agent-authored or synthesized through `scripts/agent-report`.
180
134
  - `failed` means the specialist returned blocked, errored, or without a usable
181
135
  completion report that can be synthesized.
182
- 5. Record the classification with exactly one of:
136
+ 4. Record the classification with exactly one of:
183
137
  ```bash
184
138
  ruby ~/.plastic/scripts/plastic-lock delegate --intent-dir <intent-dir> \
185
139
  --delegate <specialist-session-id> --status finished --harness <same-specialist-harness-when-known> \
@@ -188,204 +142,151 @@ as a delegate before (or when) it needs to write into the intent dir:
188
142
  --delegate <specialist-session-id> --status failed --harness <same-specialist-harness-when-known> \
189
143
  --agent <same-role> --model <same-resolved-model-when-known> --thread <same-CODEX_THREAD_ID-when-Codex>
190
144
  ```
191
- Apply the same omission rule to unknown values on terminal status commands.
192
- A failed specialist stops that handoff under the normal blocker/error procedure;
193
- never dispatch the next specialist first.
145
+ Apply the same omission rule to unknown values on terminal status commands. A failed agent
146
+ stops that handoff under the error procedure; never dispatch the next agent first.
194
147
 
195
148
  Only the owner can delegate. Delegates cannot re-delegate or release.
196
149
 
197
- Headless manual gate: when running headless or in the background, still enforce gates manually rather than relying on hooks alone. The PostToolUse gate hook reads `session_id` from hook stdin, and the savepoint ledger write is decoupled from the bridge (derived from the file path, so it fires even with no session id) - these do NOT no-op. What can degrade is the bridge-keyed stage enforcement: if no session id reaches the bridge and no matching bridge is discovered, the stage-gate enforcement step exits without acting, so verify state yourself. The bridge still resolves arming via `CLAUDE_CODE_SESSION_ID` or the derived-key fallback (see the arm-gate note above).
150
+ Headless note: in a headless or background run the session id may be unset; the arm verb then
151
+ keys the lock by a derived key and the record hook still writes the savepoint ledger from the
152
+ written path. Verify the lock with `plastic-lock status` rather than assuming.
198
153
 
199
- Solo fallback: if the harness has no subagent dispatch, fall back to a single agent walking the full What, Why, How, Exec cycle yourself. This preserves current behavior.
154
+ Solo fallback: on a harness with no agent dispatch (Codex CLI today), this session walks the
155
+ five steps itself: it still writes the matrix, still writes the tests first, and reviews its own
156
+ plan against the matrix before code, saying so in `## Insights`.
200
157
 
201
158
  ## Stage-Aware Entry
202
159
 
203
- Read the active intent's `savepoint.md` FIRST (intent 81): the last line classifies the stage,
204
- and you then verify only that line's artifact before entering. Fall back to the filesystem probe
205
- below only when the ledger is missing (then rebuild it with `Bridge.rebuild_savepoint`).
160
+ Read the active intent's `savepoint.md` FIRST: the last line classifies the stage, and you
161
+ verify only that line's artifact before entering. Fall back to the filesystem probe when the
162
+ ledger is missing (then rebuild it with `Savepoint.rebuild_savepoint`).
206
163
 
207
164
  | Ledger last line | Enter |
208
165
  |---|---|
209
- | `What {id}--{slug}.md` (born) or no spec | Start / complete Why (write spec.md) |
210
- | `Why spec.md created` | Enter How |
211
- | `How plan.md created` / `How checklist.md created` / `Exec started` | Enter Exec (verify plan + checklist) |
166
+ | `What {id}--{slug}.md` (born) or no spec | Why (write spec.md) |
167
+ | `Why spec.md created` | How |
168
+ | `How plan.md created` / `How checklist.md created` / `Exec started` | Exec (verify plan, matrix, checklist) |
212
169
  | `Exec outcome.md created` | Exec done; complete the intent |
213
170
  | `Done delivered|abandoned` | Terminal; do not resume |
214
171
 
215
- Filesystem fallback (ledger missing only):
216
-
217
- | Check (in order) | Stage |
218
- |---|---|
219
- | `checklist.md` exists with some items checked | Resume Exec from last unchecked item |
220
- | `plan.md` + `checklist.md` exist (no items checked) | Enter Exec |
221
- | `spec.md` exists, no `plan.md` | Enter How |
222
- | `## Context` has content in intent file, no `spec.md` | Complete Why (fill gaps, write spec.md) |
223
- | Only `## Intent` exists | Start Why from scratch |
224
-
225
- Announce which stage you're entering and why.
226
-
227
- Notify user (What briefing, M and L only): brief per `references/human-report-contract.md`
228
- (State: the work picked up and why it matters now; Risk: scope uncertainty; Call: confirm
229
- this is worth doing, or proceed). At S this briefing does not fire; the How briefing carries it.
230
-
231
- ## Why Completion (Autonomous)
232
-
233
- When entering at Why stage:
234
-
235
- 1. Read existing `## Context` and `### Decisions` from the intent file
236
- 2. Assess gaps - what decisions are missing? What context is incomplete?
237
- 3. Self-directed research - read code, search docs, explore related intents (via wikilinks in `## Links`), web search if needed. NO questions to human.
238
- 4. Adaptive budget - assess complexity and set your own research budget:
239
- - Simple (config change, small feature): 2-3 research steps
240
- - Medium (new feature, integration): 5-8 research steps
241
- - Complex (new project, architecture): 10-15 research steps
242
- 5. Make decisions - pick best option, document in `## Context > ### Decisions` with rationale
243
- 6. Log all autonomous decisions in `## Insights` with `(autonomous)` marker: "Decision: chose X because Y (autonomous)"
244
- 7. Write `spec.md` - consolidated specification
245
- 8. Notify user (Why briefing, M and L only): brief per `references/human-report-contract.md`
246
- (State: the approach chosen, one line; Risk: the main trade-off; Call: the one decision
247
- needed, approve or pick an option). At S this briefing does not fire; the How briefing
248
- carries it.
249
-
250
- Then proceed to How.
251
-
252
- ## How Phase
253
-
254
- Every tier runs all four steps below (see `## Tiers` above). The `actions/` directory is
255
- scaffolded (with a `.gitkeep`) at intent birth; the planner then writes at least one REAL
256
- `ACTION_N.md` into it at every tier. The tier only changes step 3's granularity: S/M write
257
- one consolidated `actions/ACTION_1.md`, L writes one `actions/ACTION_N.md` per task. A
258
- `.gitkeep`-only or empty `actions/` fails the How gate.
259
-
260
- 1. If `superpowers:writing-plans` is available as a skill, delegate plan creation to it. Tell it the plan saves to the active intent's directory (not `docs/superpowers/plans/`).
261
- 2. Otherwise, write `plan.md` directly - implementation plan with numbered tasks
262
- 3. Write at least one real `ACTION_N.md` into the existing `actions/` directory, self-contained (S/M: one consolidated `ACTION_1.md`; L: one per task)
263
- 4. Write `checklist.md` - execution registry with checkboxes covering all actions
264
- 5. Notify user (How briefing, every tier): brief per `references/human-report-contract.md`
265
- (State: the plan shape, task count and what it builds; Risk: the riskiest task or
266
- dependency; Call: approve the plan to build). At S this is the ONE mid-flight briefing:
267
- fold into the same three lines what the What and Why briefings would have said (the work
268
- picked up, the approach chosen), and send it here, with the plan ready and before any
269
- code is written.
270
-
271
- Then proceed to Exec.
272
-
273
- ## Project Creation Gate
274
-
275
- If the plan calls for creating a new project (the intent is an implementation intent that needs a new codebase):
276
-
277
- 1. Determine project path from `~/.plastic/config.yml` `project_roots` or from intent context
278
- 2. **Confirm path with user** - the one human interaction added mid-delivery, and only when this gate fires:
279
- > "Creating project `<slug>` at `<path>`. Confirm path, or provide alternative."
280
- 3. Invoke `plastic-project-creating` skill
281
- 4. The global intent is now Completed (creating-project handles this)
282
- 5. The tactical mirror in the project store becomes the active intent
283
- 6. Continue execution from the project directory using the tactical intent
284
-
285
- ## Exec Phase
286
-
287
- 1. If `superpowers:subagent-driven-development` or `superpowers:executing-plans` is available, delegate execution to it
288
- 2. Otherwise invoke `plastic-intent-executing`
289
- 3. Execute actions from checklist sequentially
290
- 4. Check off items in `checklist.md` as completed
291
- 5. Append observations to `## Insights` with `(autonomous)` marker
292
- 6. Sub-agents can be spawned for parallel actions (one agent per action)
293
- 7. Notify user (Exec briefing, M and L only): brief per `references/human-report-contract.md`
294
- (State: what got built and the test result; Risk: residual failures or deviations;
295
- Call: go to review, or done). At S this briefing does not fire; the final owner report at
296
- End carries what it would have said.
172
+ Filesystem fallback, in order: `checklist.md` with items checked means resume Exec from the
173
+ first unchecked item; `plan.md` plus `checklist.md` means enter Exec; `spec.md` alone means
174
+ enter How; `## Context` with content means complete Why; only `## Intent` means start Why.
175
+
176
+ Announce which stage you are entering and why.
177
+
178
+ ## Why (the lead)
179
+
180
+ 1. Read `## Context` and `### Decisions`; assess the gaps.
181
+ 2. Research yourself: code, docs, related intents through `## Links`, the web if needed. No
182
+ questions to the human.
183
+ 3. Decide: pick the best option per gap, record it in `## Context > ### Decisions` with the
184
+ rationale, and log it in `## Insights` with the `(autonomous)` marker through
185
+ `scripts/insight-append`.
186
+ 4. Write `spec.md`.
187
+
188
+ Then How.
189
+
190
+ ## How (the lead), then the plan review
191
+
192
+ 1. Write `plan.md`: numbered steps.
193
+ 2. Write at least one real `actions/ACTION_N.md` (one consolidated `ACTION_1.md` by default;
194
+ several only when the work splits into independent, parallel-safe actions). Each action
195
+ carries the failure-mode matrix: one row per operation, the failure mode, and the test that
196
+ catches it. A `.gitkeep`-only `actions/` is not a finished How.
197
+ 3. Write `checklist.md` covering every action.
198
+ 4. Dispatch the plan reviewer (boot 1) with `plastic-intent-executing`'s
199
+ `plan-reviewer-prompt.md`, the spawn preamble, and the intent directory. Fold every finding
200
+ into the spec, the matrix, and the tests; record what was dropped and why in the action
201
+ file's review fold. A REVISE verdict is folded and not re-reviewed unless a finding changes
202
+ a decision.
203
+ 5. Notify the user (the one mid-flight briefing, per `references/human-report-contract.md`):
204
+ State, the plan shape and what it builds; Risk, the riskiest row of the matrix; Call,
205
+ proceeding to build. In auto mode this briefing informs; it does not wait.
206
+
207
+ Then Exec.
208
+
209
+ ## Exec (the executor)
210
+
211
+ 1. Dispatch `plastic-executor` (boot 2) through `plastic-intent-executing` with the whole
212
+ consolidated action pasted in: the spec decisions, the matrix, the checklist items, the
213
+ worktree path from the preamble. Tests first: the executor commits the matrix's tests red,
214
+ then builds, then drives the full suite green.
215
+ 2. Read its return by code: DONE or DONE_WITH_CONCERNS proceeds; NEEDS_CONTEXT re-dispatches
216
+ with the missing context; BLOCKED stops under the error procedure.
217
+ 3. Tick the checklist as items land (the executor does this; verify it).
218
+
219
+ ## Review by risk (boot 3, only when a rule fires)
220
+
221
+ Dispatch the post-execution reviewer with `code-quality-reviewer-prompt.md` when any of these
222
+ holds, each checkable from disk with no judgment; otherwise the green suite is the review:
223
+
224
+ 1. `git diff --name-only <red-commit>..HEAD` touches a path on the risk list in
225
+ `references/agent-architecture.md` (hooks, the lock, the arming module, the installer, a
226
+ release file).
227
+ 2. A row of any `actions/ACTION_N.md` failure-mode matrix names a test file that is not in that
228
+ diff, or a test the green run did not execute.
229
+ 3. The executor's completion report carries a status other than `delivered`, or a non-empty
230
+ `deviations` or `blockers` field.
231
+
232
+ The reviewer returns a pass or a list of fixes; the executor (re-dispatched) applies them, then
233
+ the suite runs once more.
234
+ ## Project Creation
235
+
236
+ If the plan calls for creating a new project, determine the path from `~/.plastic/config.yml`
237
+ `project_roots` or the intent context, confirm the path with the user (the one human
238
+ interaction added mid-delivery), invoke `plastic-project-creating`, and continue from the
239
+ project directory on the tactical intent.
297
240
 
298
241
  ## Permission Model - Safe-by-Default
299
242
 
300
- The agent MUST prefer non-destructive routes:
301
-
302
- | Instead of... | Do this... |
303
- |---|---|
304
- | Drop table | Rename to `_deprecated_<table>`, flag for cleanup |
305
- | Delete files | Move to `.archive/` or backup branch |
306
- | Alter column | Additive migration - new column + backfill |
307
- | Remove feature | Feature flag off, code stays until human confirms |
308
- | Database migration | Backup before migration, keep rollback path |
309
-
310
- ### Hard Stop (without `--skip-permissions`)
311
-
312
- When a genuinely destructive action on an existing project has NO safe alternative:
313
- 1. Log the proposed action in `## Insights`
314
- 2. Notify user: "Blocked on destructive action: [description]. Approve to continue, or provide alternative direction."
315
- 3. **STOP and wait for human response.** Do not proceed.
316
-
317
- With `--skip-permissions`, the agent logs the action in Insights but proceeds without stopping.
318
-
319
- ### Greenfield Exception
320
-
321
- During initial project creation, all decisions are non-destructive by definition (there's nothing to destroy). The agent has full autonomy for greenfield choices - DB engine, framework, gems, architecture.
243
+ Prefer non-destructive routes: rename instead of drop, additive migrations plus backfill, move
244
+ files instead of deleting them, feature flags off instead of removed code, a backup before a
245
+ migration. When a destructive action on an existing project has no safe alternative, log it in
246
+ `## Insights`, notify the user ("Blocked on destructive action: ..."), and STOP unless
247
+ `--skip-permissions` was given, in which case log and proceed. During initial project creation
248
+ every choice is non-destructive and the team has full autonomy.
322
249
 
323
250
  ## Completion
324
251
 
325
- Read `../plastic-conventions/references/completion-and-done.md` for what "intent done" means and
326
- the End-stage tail the steps below walk through.
327
-
328
- 1. Verify all checklist items are checked
329
- 2. Write `outcome.md` with detailed results, from `~/.plastic/templates/outcome.md`.
330
- Set the frontmatter `disposition: delivered` (this is the delivered terminal). `outcome.md`
331
- is mandatory at every terminal and self-declares its disposition (see the canonical done-marker
332
- and End tail in PLASTIC.md `## Delivery Isolation and the Single-Owner Lock`).
333
- 3. **Release (if configured)**
334
- 1. Detect project - match CWD against paths in `~/.plastic/projects.yml` to find the project slug. If no match, skip to step 4 (default commit-only behavior).
335
- 2. Read `~/.plastic/projects/{slug}/project.yml`. If the file doesn't exist or has no `release` key, skip to step 4.
336
- 3. Based on `release.on_complete`:
337
- - `commit` - git add + commit (same as default, proceed to step 4)
338
- - `commit_and_push` - git add + commit + push
339
- - `manual` - skip auto-commit, notify user: "Release configured as manual - commit when ready."
340
- 4. If `release.verify` is set, run the verify command (e.g. `bundle exec rake test`):
341
- - **Exit 0 (green):** proceed to sub-step 5
342
- - **Non-zero (red):** check `release.on_red`:
343
- - `fix_and_retry` - attempt to fix the failure, re-run verify (max 2 retries)
344
- - `stop` - write `savepoint.md` with current state, notify user: "Verify failed - savepoint written.", **STOP**
345
- - `manual` - notify user: "Verify failed: [summary]. Resolve manually."
346
- 5. If `release.on_green` has items, invoke `plastic-releasing` to handle them (tag, changelog, publish, etc.). Do NOT duplicate release logic - delegate entirely.
347
- 4. Review `## Insights` for observations that should spawn future intents. If any:
348
- - Create them (using `plastic-intent-creating` conventions)
349
- - Update `chain` in the current intent's frontmatter
350
- 5. Run the mechanical close through `plastic-intent-ending`: it owns steps 1-7 of the Done
351
- procedure (outcome/INDEX/savepoint/commit, disarm, the QMD reindex last, and the single
352
- EM-to-CTO owner report) as ONE delegation, not a series of separate one-liners restated
353
- here. `scripts/end-intent` now performs steps 1-5 itself, INCLUDING disarm (worktree
354
- release plus clearing `delivery.lock`): a single call closes the intent AND clears its
355
- lock, so exit 0 means both are done. Pass
356
- `--session` (this session's id, or rely on the `CLAUDE_CODE_SESSION_ID` fallback) so
357
- disarm resolves the right bridge, and `--index-note` with a rich Completed/Abandoned entry
358
- description (mode/tier, what shipped or why abandoned, suite result):
252
+ Read `../plastic-conventions/references/completion-and-done.md` for what "intent done" means.
253
+
254
+ 1. Verify every checklist item is checked and the suite is green once on the branch.
255
+ 2. Write `outcome.md` from `~/.plastic/templates/outcome.md` with `disposition: delivered`.
256
+ 3. Release, if configured: match the working directory against `~/.plastic/projects.yml`, read
257
+ `project.yml`'s `release` block, and act on `on_complete` (`commit`, `commit_and_push`,
258
+ `manual`), `verify` (green proceeds; red follows `on_red`: `fix_and_retry` up to twice,
259
+ `stop`, or `manual`), and `on_green` (delegate entirely to `plastic-releasing`).
260
+ 4. Review `## Insights` for observations that should become future intents; create them through
261
+ `plastic-intent-creating` and update `chain`.
262
+ 5. Close through `plastic-intent-ending`, which runs `scripts/end-intent`: outcome, INDEX,
263
+ savepoint, the store commit, and the disarm (the worktree released, `delivery.lock` cleared,
264
+ the session pointer back on the day ledger), then the QMD reindex last and the single owner
265
+ report. Pass `--session` and `--index-note`:
359
266
  ```bash
360
267
  ruby ~/.plastic/scripts/end-intent --store <store_path> --id <ID> --disposition delivered \
361
268
  --session "$CLAUDE_CODE_SESSION_ID" \
362
- --index-note "<mode, tier>; <what shipped>; <suite result>"
269
+ --index-note "<what shipped>; <suite result>"
363
270
  ```
364
- (Use `--disposition abandoned` when the intent is being moved to `## Abandoned`.) A
365
- non-zero exit needs attention before moving on: 4 means a live foreign session holds the
366
- lock (back off), 5 means the code worktree is dirty (commit/stash first, or pass
367
- `--discard-worktree-changes` deliberately), 3 means disarm ran but the lock is still
368
- present (run `/plastic-doctor check the lock status`), 6 means the structure gate refused
369
- (see the named reason on stderr; fix via the owning tool named above, then re-run). Two
370
- steps remain as separate actions after this call succeeds: Step 6 (QMD reindex, async,
371
- last) and Step 7 (the EM-to-CTO owner report, the single report the owner reads).
372
- Never leave an orphaned worktree; run `git worktree prune` on a stale reference. If any of
373
- this ever needs to change, change `plastic-intent-ending`, not this skill.
271
+ Exit 4 means a live foreign session holds the lock; 5 means the worktree is dirty (commit
272
+ first, or pass `--discard-worktree-changes` deliberately); 3 means the lock survived the
273
+ disarm (`/plastic-doctor check the lock status`); 6 means the structure check refused. Never
274
+ leave an orphaned worktree; run `git worktree prune` on a stale reference.
374
275
 
375
276
  ## Error Handling
376
277
 
377
- If the agent gets stuck (can't resolve a gap, dependency is missing, tests fail persistently):
378
- 1. Log the blocker in `## Insights`
379
- 2. Write `savepoint.md` with current state
380
- 3. Notify user: "Blocked on intent [ID] - [name]: [description]. Savepoint written."
381
- 4. **STOP.** Do not attempt workarounds that could leave the project in a broken state.
278
+ If the team gets stuck (an unresolvable gap, a missing dependency, a suite that stays red):
279
+ log the blocker in `## Insights`, make sure `savepoint.md` reflects the state, notify the user
280
+ ("Blocked on intent [ID] - [name]: ..."), and STOP. Never work around a blocker in a way that
281
+ leaves the project broken.
382
282
 
383
283
  ## References
384
284
 
385
- - Read `references/agent-architecture.md` for the full team model (the 5-role enforcer-led team, per-stage handoffs, gate ownership, headless note, solo fallback) and the orchestrator hierarchy (Main Orchestrator, Project Orchestrators, coordination loop) when spinning up the team or understanding autonomous delivery scope
386
- - Read `references/tiers.md` for the extended per-tier walkthrough (S/M/L worked examples, the collapsed one-thinker flow, the QMD-skip case for S) and rationale
387
- - Read `references/human-report-contract.md` for the human-facing per-stage briefing (the
388
- State/Risk/Call skeleton used at each "Notify user" step above, and how it differs from the
389
- internal `agent-report-contract.md`)
390
- - Read `references/end-tail.md` for the `resolve_session` fallback chain and the disarm
391
- ordering / worktree cleanup / QMD reindex rationale referenced above
285
+ - Read `references/agent-architecture.md` for the team model, the risk list, the headless note,
286
+ and the solo fallback when dispatching or when a harness has no agent dispatch.
287
+ - Read `references/human-report-contract.md` for the State/Risk/Call briefing before sending the
288
+ How briefing.
289
+ - Read `references/agent-report-contract.md` for the completion report format when reading a
290
+ dispatched agent's return or synthesizing one.
291
+ - Read `references/end-tail.md` for what `Arm.disarm` does at the End tail and why the reindex
292
+ runs last, before closing an intent.