@astrosheep/keiyaku 4.5.7 → 4.5.8

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 (234) hide show
  1. package/README.md +10 -0
  2. package/build/integrations/marketplace/plugins/keiyaku/.claude-plugin/plugin.json +1 -1
  3. package/build/integrations/marketplace/plugins/keiyaku/.codex-plugin/plugin.json +1 -1
  4. package/build/integrations/marketplace/plugins/keiyaku/opencode.js +3 -2
  5. package/build/integrations/marketplace/plugins/keiyaku/package.json +1 -1
  6. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku/SKILL.md +10 -9
  7. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-akuma/SKILL.md +22 -1
  8. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-babysit/SKILL.md +35 -96
  9. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-bind/SKILL.md +28 -49
  10. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-task/SKILL.md +21 -15
  11. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-workflow/SKILL.md +148 -89
  12. package/build/src/akuma/abort.d.ts +2 -1
  13. package/build/src/akuma/abort.js +6 -23
  14. package/build/src/akuma/akuma-handle.js +4 -2
  15. package/build/src/akuma/akuma-observe.d.ts +2 -0
  16. package/build/src/akuma/akuma-observe.js +1 -0
  17. package/build/src/akuma/akuma-product.js +9 -7
  18. package/build/src/akuma/akuma.d.ts +372 -9
  19. package/build/src/akuma/akuma.js +31 -1
  20. package/build/src/akuma/allowed.d.ts +1 -1
  21. package/build/src/akuma/allowed.js +1 -0
  22. package/build/src/akuma/body.d.ts +6 -4
  23. package/build/src/akuma/body.js +5 -3
  24. package/build/src/akuma/call-request.d.ts +80 -0
  25. package/build/src/akuma/call-request.js +211 -0
  26. package/build/src/akuma/heart/facts.d.ts +6 -78
  27. package/build/src/akuma/heart/index.d.ts +1 -1
  28. package/build/src/akuma/heart/request-authority.d.ts +5 -4
  29. package/build/src/akuma/heart/request-authority.js +20 -34
  30. package/build/src/akuma/heart/request-rows.js +12 -23
  31. package/build/src/akuma/heart/schema.d.ts +1 -1
  32. package/build/src/akuma/heart/schema.js +5 -13
  33. package/build/src/akuma/index.d.ts +1 -1
  34. package/build/src/akuma/index.js +1 -1
  35. package/build/src/akuma/projection-read.d.ts +1 -0
  36. package/build/src/akuma/projection-read.js +8 -1
  37. package/build/src/akuma/projection.d.ts +856 -137
  38. package/build/src/akuma/projection.js +190 -0
  39. package/build/src/akuma/provider.d.ts +30 -3
  40. package/build/src/akuma/provider.js +104 -0
  41. package/build/src/akuma/providers/acp/core.d.ts +2 -2
  42. package/build/src/akuma/providers/acp/core.js +13 -6
  43. package/build/src/akuma/providers/acp/index.js +5 -4
  44. package/build/src/akuma/providers/claude/index.d.ts +3 -3
  45. package/build/src/akuma/providers/claude/index.js +16 -5
  46. package/build/src/akuma/providers/codex-app-server/events.js +1 -1
  47. package/build/src/akuma/providers/codex-app-server/index.js +18 -6
  48. package/build/src/akuma/providers/grok-build/index.js +5 -4
  49. package/build/src/akuma/providers/opencode-sdk/index.js +66 -25
  50. package/build/src/akuma/providers/opencode-sdk/session.d.ts +3 -2
  51. package/build/src/akuma/providers/opencode-sdk/session.js +28 -11
  52. package/build/src/akuma/providers/pi/index.js +42 -14
  53. package/build/src/akuma/request-lifecycle.d.ts +3 -9
  54. package/build/src/akuma/request-lifecycle.js +4 -4
  55. package/build/src/akuma/request-rendezvous.d.ts +26 -0
  56. package/build/src/akuma/request-rendezvous.js +100 -0
  57. package/build/src/akuma/request-serve.d.ts +5 -65
  58. package/build/src/akuma/request-serve.js +81 -208
  59. package/build/src/akuma/request-wire.d.ts +109 -115
  60. package/build/src/akuma/request-wire.js +63 -318
  61. package/build/src/akuma/requests.d.ts +19 -47
  62. package/build/src/akuma/requests.js +51 -107
  63. package/build/src/akuma/turn-drive.d.ts +5 -3
  64. package/build/src/akuma/turn-drive.js +32 -10
  65. package/build/src/akuma-body.d.ts +7 -2
  66. package/build/src/akuma-body.js +68 -46
  67. package/build/src/cli/accepted.d.ts +1 -1
  68. package/build/src/cli/accepted.js +2 -2
  69. package/build/src/cli/commands/akuma-invoke.d.ts +2 -0
  70. package/build/src/cli/commands/akuma-invoke.js +17 -9
  71. package/build/src/cli/commands/akuma.js +7 -7
  72. package/build/src/cli/commands/contract-invoke.d.ts +3 -2
  73. package/build/src/cli/commands/contract-invoke.js +26 -19
  74. package/build/src/cli/commands/contract.d.ts +13 -13
  75. package/build/src/cli/commands/contract.js +32 -17
  76. package/build/src/cli/commands/install.d.ts +1 -1
  77. package/build/src/cli/commands/install.js +1 -1
  78. package/build/src/cli/commands/task-invoke.d.ts +3 -0
  79. package/build/src/cli/commands/task-invoke.js +23 -140
  80. package/build/src/cli/commands/task.js +54 -20
  81. package/build/src/cli/invoke.js +39 -25
  82. package/build/src/cli/main.js +2 -1
  83. package/build/src/cli/parse.d.ts +2 -2
  84. package/build/src/cli/parse.js +37 -22
  85. package/build/src/cli/render/akuma-activity.d.ts +4 -1
  86. package/build/src/cli/render/akuma-activity.js +45 -30
  87. package/build/src/cli/render/akuma-tool.d.ts +5 -1
  88. package/build/src/cli/render/akuma.js +5 -9
  89. package/build/src/cli/render/audit.js +1 -1
  90. package/build/src/cli/render/catalog.js +80 -21
  91. package/build/src/cli/render/contract-observation.d.ts +2 -0
  92. package/build/src/cli/render/contract-observation.js +11 -0
  93. package/build/src/cli/render/contract.js +25 -65
  94. package/build/src/cli/render/kanshi-akuma.d.ts +8 -0
  95. package/build/src/cli/render/kanshi-akuma.js +111 -0
  96. package/build/src/cli/render/kanshi.js +108 -213
  97. package/build/src/cli/render/receipt.d.ts +1 -2
  98. package/build/src/cli/render/receipt.js +76 -26
  99. package/build/src/cli/render/refusal.js +2 -10
  100. package/build/src/cli/render/region.js +5 -2
  101. package/build/src/cli/render/settings.d.ts +1 -1
  102. package/build/src/cli/render/settings.js +27 -8
  103. package/build/src/cli/render/task.js +22 -5
  104. package/build/src/cli/render/terminal.d.ts +28 -0
  105. package/build/src/cli/render/terminal.js +65 -0
  106. package/build/src/cli/result.d.ts +3 -3
  107. package/build/src/cli/runtime.js +3 -1
  108. package/build/src/cli/selectors.d.ts +2 -1
  109. package/build/src/cli/selectors.js +4 -3
  110. package/build/src/cli/square-edge.js +120 -36
  111. package/build/src/cli/usage.js +2 -1
  112. package/build/src/contract-guidance.d.ts +5 -0
  113. package/build/src/contract-guidance.js +121 -0
  114. package/build/src/contract-worktree.d.ts +0 -1
  115. package/build/src/contract-worktree.js +32 -83
  116. package/build/src/coordination/sqlite-transaction-lock.d.ts +1 -0
  117. package/build/src/coordination/sqlite-transaction-lock.js +5 -0
  118. package/build/src/core/facts/codec.d.ts +2 -0
  119. package/build/src/core/facts/codec.js +4 -0
  120. package/build/src/core/verbs/placement.d.ts +6 -1
  121. package/build/src/core/verbs/placement.js +5 -3
  122. package/build/src/dispatch/index.d.ts +0 -2
  123. package/build/src/dispatch/index.js +54 -55
  124. package/build/src/git/admission.js +2 -2
  125. package/build/src/git/hooks.d.ts +9 -15
  126. package/build/src/git/hooks.js +23 -317
  127. package/build/src/git/nuke.d.ts +2 -1
  128. package/build/src/git/nuke.js +36 -18
  129. package/build/src/git/private-state-seat.d.ts +12 -0
  130. package/build/src/git/private-state-seat.js +39 -0
  131. package/build/src/git/process.d.ts +6 -0
  132. package/build/src/git/process.js +19 -7
  133. package/build/src/git/read-observation.js +29 -20
  134. package/build/src/git/reconcile.d.ts +11 -0
  135. package/build/src/git/reconcile.js +64 -11
  136. package/build/src/git/repository.d.ts +6 -2
  137. package/build/src/git/repository.js +8 -0
  138. package/build/src/git/target-placement.d.ts +1 -0
  139. package/build/src/git/target-placement.js +5 -0
  140. package/build/src/git/tender.d.ts +1 -0
  141. package/build/src/git/terminal-reconcile.d.ts +1 -1
  142. package/build/src/git/terminal-reconcile.js +22 -20
  143. package/build/src/git/workspace.d.ts +14 -0
  144. package/build/src/git/workspace.js +44 -0
  145. package/build/src/kanshi/index.d.ts +1 -1
  146. package/build/src/kanshi/read.js +16 -16
  147. package/build/src/kanshi/report.d.ts +2 -2
  148. package/build/src/library/address.d.ts +9 -3
  149. package/build/src/library/address.js +3 -2
  150. package/build/src/library/akuma-creation.d.ts +4 -3
  151. package/build/src/library/akuma-creation.js +19 -13
  152. package/build/src/library/audit.d.ts +1 -1
  153. package/build/src/library/audit.js +5 -3
  154. package/build/src/library/catalog.d.ts +3 -1
  155. package/build/src/library/catalog.js +20 -6
  156. package/build/src/library/composition.d.ts +371 -0
  157. package/build/src/library/composition.js +28 -0
  158. package/build/src/library/configuration.js +8 -2
  159. package/build/src/library/continuation.js +66 -30
  160. package/build/src/library/contract-bind.js +10 -2
  161. package/build/src/library/contract-forwarding-reconciliation-result.d.ts +96 -0
  162. package/build/src/library/contract-forwarding-reconciliation-result.js +83 -0
  163. package/build/src/library/contract-forwarding-result.d.ts +6723 -0
  164. package/build/src/library/contract-forwarding-result.js +521 -0
  165. package/build/src/library/contract-forwarding.d.ts +72 -0
  166. package/build/src/library/contract-forwarding.js +125 -0
  167. package/build/src/library/contract-handle.d.ts +36 -0
  168. package/build/src/library/contract-handle.js +313 -0
  169. package/build/src/library/contract-operations.d.ts +1044 -67
  170. package/build/src/library/contract-operations.js +190 -118
  171. package/build/src/library/contract.d.ts +11 -32
  172. package/build/src/library/contract.js +16 -289
  173. package/build/src/library/fleet-result.d.ts +1454 -0
  174. package/build/src/library/fleet-result.js +96 -0
  175. package/build/src/library/fleet.d.ts +112 -54
  176. package/build/src/library/fleet.js +211 -71
  177. package/build/src/library/input.d.ts +2 -0
  178. package/build/src/library/input.js +4 -0
  179. package/build/src/library/keiyaku.d.ts +371 -20
  180. package/build/src/library/keiyaku.js +8 -21
  181. package/build/src/library/mutation.d.ts +3 -3
  182. package/build/src/library/mutation.js +5 -9
  183. package/build/src/library/nuke.d.ts +1 -1
  184. package/build/src/library/nuke.js +4 -3
  185. package/build/src/library/reconcile.d.ts +4 -0
  186. package/build/src/library/reconcile.js +2 -0
  187. package/build/src/library/refusal.d.ts +0 -9
  188. package/build/src/library/refusal.js +0 -7
  189. package/build/src/protocol/amend.js +56 -50
  190. package/build/src/protocol/attempt.d.ts +2 -0
  191. package/build/src/protocol/attempt.js +8 -1
  192. package/build/src/protocol/completion.js +7 -0
  193. package/build/src/protocol/deliver.js +6 -2
  194. package/build/src/protocol/operations.d.ts +4 -1
  195. package/build/src/protocol/operations.js +5 -2
  196. package/build/src/protocol/placement.d.ts +1 -0
  197. package/build/src/protocol/placement.js +52 -38
  198. package/build/src/protocol/read/observation.d.ts +1 -4
  199. package/build/src/protocol/read/observation.js +2 -15
  200. package/build/src/protocol/reintegrate.js +62 -58
  201. package/build/src/protocol/review.js +5 -0
  202. package/build/src/protocol/run.js +17 -13
  203. package/build/src/runtime/proc/run.d.ts +8 -0
  204. package/build/src/runtime/proc/run.js +27 -0
  205. package/build/src/runtime/proc/termination.js +26 -22
  206. package/build/src/runtime/proc/windows-launch.exe +0 -0
  207. package/build/src/settlement/holder.d.ts +2 -1
  208. package/build/src/settlement/holder.js +15 -4
  209. package/build/src/settlement/settle.js +99 -33
  210. package/build/src/task/board.d.ts +68 -27
  211. package/build/src/task/board.js +31 -1
  212. package/build/src/task/catalog.d.ts +4 -0
  213. package/build/src/task/catalog.js +23 -0
  214. package/build/src/task/compose-language.js +33 -7
  215. package/build/src/task/compose-parser.d.ts +1 -1
  216. package/build/src/task/compose-parser.js +1 -1
  217. package/build/src/task/compose.js +2 -0
  218. package/build/src/task/index.d.ts +12 -4
  219. package/build/src/task/index.js +97 -16
  220. package/build/src/task/mutation-result.d.ts +923 -0
  221. package/build/src/task/mutation-result.js +140 -0
  222. package/build/src/task/mutation.d.ts +552 -28
  223. package/build/src/task/mutation.js +304 -97
  224. package/build/src/task/operations.d.ts +1 -4
  225. package/build/src/task/operations.js +0 -6
  226. package/build/src/task/public.d.ts +2 -0
  227. package/build/src/task/public.js +1 -0
  228. package/build/src/workspace-place.d.ts +7 -2
  229. package/build/src/workspace-place.js +34 -24
  230. package/build/src/world.d.ts +1 -0
  231. package/build/src/world.js +11 -0
  232. package/package.json +8 -6
  233. package/build/src/akuma/request-execution.d.ts +0 -8
  234. package/build/src/akuma/request-execution.js +0 -98
@@ -6,16 +6,8 @@ description: Use when authoring, binding, auditing, delivering, reviewing, amend
6
6
  # Keiyaku Workflow
7
7
 
8
8
  A Contract turns one bounded delivery into acceptable terms: bind it, work in
9
- the appointed worktree, audit the Contract, deliver, then review. When every
10
- declared gate is current, the result lands on the target ref.
11
-
12
- ## How The Delivery Moves
13
-
14
- ```text
15
- contract document -> bind -> work -> audit -> deliver -> review gates
16
- -> placement -> claimed
17
- \-> abandoned
18
- ```
9
+ the appointed worktree, audit the Contract, deliver, then satisfy its review
10
+ gates. Placement claims it when every prerequisite and gate is current.
19
11
 
20
12
  The lifecycle is `waiting -> bound -> tendered -> claimed | abandoned`;
21
13
  the last two are terminal. Reserve `--after` for true logical ordering: one
@@ -31,11 +23,27 @@ immutable. You never push it through states by hand: `deliver` and satisfied
31
23
  reviews request placement, and placement claims when every prerequisite and
32
24
  gate allows it.
33
25
 
26
+ ## The Lightest Workflow That Fits
27
+
28
+ Nothing here is required ceremony. Small work is done directly. Larger but
29
+ mechanical work can be bound and delivered without review. Tasks and Arcs
30
+ appear when the work calls for them. There are no cadences, no thresholds, and
31
+ nothing the tool core enforces about how you drive the loop — pick the lightest
32
+ shape that keeps acceptance honest.
33
+
34
34
  ## Bind
35
35
 
36
36
  Use `keiyaku-bind` to decide readiness, author one bounded Contract, choose
37
37
  bind inputs, and read the receipt. Continue here from that receipt.
38
38
 
39
+ Managed worktree hooks are transient named command arrays. Each command has a
40
+ nonblank `name`, `argv`, and `timeoutMs`; create and destroy arrays execute
41
+ serially in the current caller. There is no durable marker, frozen command
42
+ snapshot, detached runner, or per-command retry index. `--retry-hooks` reruns
43
+ the complete current phase, so hook authors own idempotence. A successful bind
44
+ receipt prints create hook names in order under `hooks create` and never prints
45
+ their argv or timeout.
46
+
39
47
  ## Work In The Contract Worktree
40
48
 
41
49
  Change and test code in the worktree the bind receipt names. `deliver` accepts
@@ -43,6 +51,32 @@ a clean worktree by default. You may commit first, or explicitly include all
43
51
  non-ignored staged, unstaged, and untracked final bytes with
44
52
  `deliver --include-dirty`.
45
53
 
54
+ ### Managed Worktree Hooks
55
+
56
+ Configure repository hooks in `<repo>/.keiyaku/settings.json` under the
57
+ `worktree` namespace. User defaults live in `~/.keiyaku/settings.json` and may
58
+ provide the same entries:
59
+
60
+ ```json
61
+ {
62
+ "worktree": {
63
+ "create": [{ "argv": ["npm", "ci"], "timeoutMs": 300000 }],
64
+ "destroy": [{ "argv": ["./scripts/teardown.sh"], "timeoutMs": 60000 }]
65
+ }
66
+ }
67
+ ```
68
+
69
+ `create` runs when the managed worktree is created; `destroy` runs during
70
+ terminal cleanup. `bind` does not print successful hook argv. A failed hook is
71
+ reported as `worktree-hook-failed`; retry it explicitly:
72
+
73
+ ```bash
74
+ keiyaku reconcile <contract> --retry-hooks
75
+ ```
76
+
77
+ The selected commands freeze per worktree and may replay after runner failure,
78
+ so keep them replay-safe.
79
+
46
80
  ## Regain The Picture
47
81
 
48
82
  Rebuild state from reads, not memory — after a compact, a handoff, or any
@@ -67,6 +101,32 @@ or an `--after` edge; read `--path` before touching a file that may belong to
67
101
  another lane. Regions are declarations only, a coarse planning signal: actual
68
102
  touched paths and conflicts remain Git's.
69
103
 
104
+ ## Hold the Fulfillment Loop
105
+
106
+ Every Contract in flight has exactly one holder of its fulfillment loop:
107
+ whoever currently turns intent into commissions and returns into decisions. By
108
+ default that is the flagship caller. Holding the loop means four things.
109
+
110
+ Decompose before delegating — delegation spends a decision already made; it is
111
+ not where the decision happens. Give every requirement in a commission or tell
112
+ a source — user intent, journaled terms, or standing authority; a hypothesis
113
+ formed mid-loop goes down as a question to investigate, or is settled first —
114
+ a real decision, a journaled amend — before it may be required. Treat returns
115
+ as input to judgment, never as the next instruction — see Review Gates. Keep
116
+ the work converging on the Objective — when successive rounds move the candidate
117
+ away from what the Contract set out to make true, judge the premise instead of
118
+ commissioning another round.
119
+
120
+ The whole loop can be handed to one Aku in a single commission. Keep the
121
+ Contract association but give that delegate the repository cwd explicitly;
122
+ automatic Contract-worktree cwd resolution is for Deliverer and Reviewer seat
123
+ commissions. The duties travel with it; the delegate decides for itself when
124
+ to cut Arcs and Tasks and when to call, tell, and review. It needs no title,
125
+ seat, or identity beyond the commission itself. After handing over, the
126
+ flagship steers only through the holder — a tell to the holder, a journaled
127
+ amend, escalation, or withdrawing the commission — and never reaches past it
128
+ to its subordinates.
129
+
70
130
  ## Commission A Contract
71
131
 
72
132
  When another agent will fulfill or review the Contract, the commissioning
@@ -95,11 +155,18 @@ frontmatter names `Contract`, then reads the listed owner documents and source
95
155
  files before acting. Do not substitute a generic repository tour for the files
96
156
  that actually govern the assignment.
97
157
 
158
+ The commission owns the question: what to work on or examine, how deep, which
159
+ risks to watch, what evidence to produce. It genuinely directs the round — a
160
+ Deliverer's brief commands the work; a Reviewer's commission frames the
161
+ examination. What it can never do is manufacture acceptance: a requirement
162
+ meant to outlive the round goes through bind or amend, and an expectation stated
163
+ in a prompt is never evidence for a finding.
164
+
98
165
  Contract association, available forwarded actions, and the brief are
99
- independent inputs. When a Reviewer should record its own verdict, include
100
- `--allowed contract.review` and say in the brief to record `--satisfied` on
101
- pass or `--unsatisfied` on failure. When a Deliverer should tender its completed
102
- candidate, include `--allowed contract.deliver` and say so in the brief.
166
+ independent inputs. Give a Reviewer `--allowed contract.review` only when it
167
+ must record its own verdict, and require it to choose `--satisfied` or
168
+ `--unsatisfied` from its independent judgment. Give a Deliverer `--allowed
169
+ contract.deliver` when it must tender its candidate.
103
170
 
104
171
  A `Deliverer` implements and verifies the terms in `Worktree`. Commission a
105
172
  `Reviewer` after delivery. The reviewer inspects the complete current Contract
@@ -107,8 +174,7 @@ worktree snapshot, not a worker report or named candidate commit, and does not
107
174
  modify it. Missing or contradictory seat, worktree, or reading list means stop
108
175
  and ask.
109
176
 
110
- Observe commissioned workers through their Contract association instead of
111
- collecting Aku ids by hand:
177
+ Observe commissioned workers through their Contract association:
112
178
 
113
179
  ```bash
114
180
  keiyaku wait kei/<contract> --all --timeout 5m
@@ -131,7 +197,11 @@ intended work is unsafe to run concurrently.
131
197
  When a complex Keiyaku cannot be split without breaking one acceptance
132
198
  boundary, organize its fulfillment into arcs. Do not hand the whole
133
199
  undifferentiated Contract to one Deliverer and trust one pass to finish it.
134
- Record and work one current chapter at a time.
200
+ Handing over a whole Contract is legitimate in exactly one form: as a transfer
201
+ of its fulfillment loop, not as one oversized Deliverer assignment. Commission
202
+ one Aku to hold the loop and let it decide when to cut Arcs and Tasks and when
203
+ to call, tell, and review. A Deliverer owes a candidate; a loop holder owes
204
+ decisions.
135
205
 
136
206
  An arc is a chapter as in a work of literature: one named part of the
137
207
  delivery's story, not a task list, progress slice, or claim that the work is
@@ -158,17 +228,17 @@ boundary. The document grammar authority is `docs/document.md`.
158
228
 
159
229
  ## Amend Or Start Over
160
230
 
161
- Use `amend` when a discovery during the same delivery changes terms but the
162
- original Objective, Design, and acceptance boundary still truthfully describe
163
- the result:
231
+ Terms change through the journal or not at all. When delivery or review reveals
232
+ the standing terms are wrong — ambiguous, contradictory, or aimed at the wrong
233
+ outcome — the holder amends, staling old evidence, or abandons and rebinds.
234
+ Remediation that works around a wrong term is the expensive way to keep a
235
+ mistake.
164
236
 
165
237
  ```bash
166
238
  keiyaku amend <contract> -
167
239
  ```
168
240
 
169
- See `amend --help` for the operation grammar. If the objective or boundary
170
- itself changed, `abandon` with a note and bind a new Contract; do not steer an
171
- old Contract onto a different delivery.
241
+ See `amend --help` for the operation grammar.
172
242
 
173
243
  ## Audit Before Delivery
174
244
 
@@ -178,14 +248,10 @@ Audit is an evidence window for a prospective delivery:
178
248
  keiyaku audit <contract> --diff
179
249
  ```
180
250
 
181
- It aggregates facts from the same candidate preparation used by `deliver`:
182
- the prospective candidate and integration identities, the requested diff, the
183
- declared Verification commands and their observed results, and the target
184
- placement observation. A terminal run may record subject-bound `verified`
185
- testimony for those observed commands; it does not deliver, request placement,
186
- satisfy a review gate, or decide whether the candidate should land. The
187
- coordinator judges the returned facts; a worker's completion report is not a
188
- substitute for them.
251
+ Audit is prospective evidence for candidate preparation, Verification, and
252
+ target placement. A terminal run may record subject-bound `verified` testimony,
253
+ but audit never delivers, requests placement, or satisfies a gate; judge its
254
+ facts rather than a worker's completion report.
189
255
 
190
256
  ## Deliver
191
257
 
@@ -200,50 +266,47 @@ Deliver when the worktree content is the candidate you intend to land:
200
266
  keiyaku deliver <contract> --include-dirty
201
267
  ```
202
268
 
203
- This example includes all non-ignored staged, unstaged, and untracked bytes in
204
- the candidate. Use `--include-dirty` only when the complete current workspace
205
- is the intended delivery; otherwise commit the intended bytes and run
206
- `keiyaku deliver <contract>`.
207
-
208
- `deliver` freshly tenders the candidate, records it, and requests placement.
209
- When a current audit attestation names the identical integration
210
- snapshot and Verification segment, deliver reuses it; otherwise it runs the
211
- declarations. Worktree, target, policy, document, Verification, or
212
- snapshot-producing option changes prevent reuse. If the workspace is dirty, the refusal
213
- lists staged, unstaged, and untracked paths, a short statistic, and the
214
- `--include-dirty` option. Use that option only when the complete current
215
- workspace is the intended delivery; dirty submodule internals cannot be
216
- included. Read the receipt:
217
-
218
- - When every gate is current, the receipt shows placement and `claimed`; the
219
- delivery is done.
220
- - When a gate is not current, the receipt shows the recorded candidate and the
221
- placement stop. This is not a failed delivery. The Contract stays
222
- `tendered` while you complete the gates.
223
- - A lag row reports an accepted physical effect that has not finished. The
224
- delivery stands; `reconcile` completes the effect later. It never changes
225
- the verdict.
269
+ Use `--include-dirty` only when the complete current workspace is the intended
270
+ candidate; otherwise commit the intended bytes first. Read the receipt for the
271
+ candidate, gate/placement stop, and any physical-effect lag. A not-complete
272
+ delivery is still a recorded `tendered` candidate.
273
+
274
+ `deliver` freshly tenders the candidate and requests placement. A current audit
275
+ attestation is reused only when its integration snapshot and Verification
276
+ segment still match; changes to the worktree, target, policy, document,
277
+ Verification, or snapshot-producing options make it stale.
226
278
 
227
279
  ## Review Gates
228
280
 
229
- A `reviewed` gate wants a recorded judgment of the current patch:
281
+ The Reviewer owns the answer. A gate review compares the full current candidate
282
+ against every journaled Criterion — the floor that cannot be reduced — and
283
+ testifies satisfied or unsatisfied over the current document identity and
284
+ worktree; satisfied requests placement. A current defect, missing, failed, or
285
+ stale required evidence, or terms too ambiguous or contradictory to judge all
286
+ yield unsatisfied, with the summary naming what blocks. Advice beyond the terms
287
+ belongs in the summary and never changes the verdict by itself.
230
288
 
231
289
  ```bash
232
290
  keiyaku review <contract> --satisfied --summary "<conclusion>"
233
291
  keiyaku review <contract> --unsatisfied --summary "<finding>"
234
292
  ```
235
293
 
236
- Have an independent reviewer inspect the delivered Contract worktree snapshot.
237
- If it should record the verdict itself, dispatch it with `--allowed
238
- contract.review` and state both verdicts in the brief. Otherwise its answer is
239
- review input for the coordinator to record.
240
- The `review` command records the verdict. `--satisfied` requests placement; if
241
- the other gates are current, the receipt shows `claimed`.
242
-
243
- Fixing findings changes the patch and makes earlier evidence stale (`?` in
244
- `status`). Audit the rework, deliver it, then review again. Record
245
- `--unsatisfied` only when the negative judgment should remain in Contract
246
- history.
294
+ One Contract, one continuing Reviewer by default: reuse the same identity
295
+ across rounds, replace it with a recorded reason when its judgment frame is
296
+ contaminated, and never carry a Reviewer across Contracts — a new Contract
297
+ always gets a new call. If it should record the verdict itself, dispatch it
298
+ with `--allowed contract.review` and require it to choose the verdict from its
299
+ independent judgment. Otherwise its answer is review input for the coordinator
300
+ to record. The `review` command records the verdict and `--satisfied` requests
301
+ placement.
302
+
303
+ A review return is input to the loop holder's judgment, never a work order in
304
+ itself. Classify before anything moves: a current defect against the terms is
305
+ fixed and re-reviewed; advice worth keeping but not owed becomes a Task or is
306
+ consciously declined; a problem with the terms goes up — journaled amend or
307
+ escalation — before any remediation is commissioned; work outside the Contract
308
+ stays outside it. Remediation that drifts the candidate away from the Objective
309
+ is evidence against the premise, not a reason for another round.
247
310
 
248
311
  ## When Multiple Contracts Overlap On One Target
249
312
 
@@ -251,16 +314,17 @@ When active Contracts write a shared surface, landing order is a coordinator
251
314
  judgment, not Contract state. Keep the decision in the workflow skill; do not
252
315
  persist a train or add a second placement authority.
253
316
 
254
- - `audit` and a reviewer's report are preliminary. `review --satisfied` is
255
- authoritative gate testimony: it requests placement and claims when
256
- delivery, prerequisites, and all gates are current. Record it only when the
257
- reviewed bytes are intended to land now.
317
+ - `audit` and a reviewer's report are preliminary; the satisfied review is the
318
+ gate-visible judgment for placement.
258
319
  - Before recording a satisfied review, or delivering a Contract with no
259
320
  declared gates, ask whether the exact patch will survive until placement. A
260
321
  pure rebase whose `ChangeId` is unchanged keeps the existing review current;
261
322
  do not re-review content addressing kept alive. Conflict resolution that
262
323
  changes the `ChangeId` makes earlier testimony stale and requires a fresh
263
- review against the resolved candidate.
324
+ review: re-inspect the resolved candidate and record new testimony. Fresh
325
+ review follows the reviewer-reuse rule above; prefer the existing independent
326
+ reviewer when its judgment frame remains sound, especially so earlier findings
327
+ can be checked within the complete fresh judgment.
264
328
  - For Contracts known to overlap, resolve the current-target integration before
265
329
  the authoritative review. Preliminary feedback may happen earlier, but it
266
330
  is not a satisfied gate until its reviewed patch is the candidate intended
@@ -273,19 +337,15 @@ persist a train or add a second placement authority.
273
337
 
274
338
  ## Target Placement
275
339
 
276
- Placement follows the Git mental model you already have:
340
+ Managed target checkouts follow Git merge semantics: unrelated staged,
341
+ unstaged, and untracked paths are preserved. Staged changes refuse only when
342
+ Git cannot carry the predecessor-to-candidate merge; overlapping worktree
343
+ changes and colliding untracked files also refuse.
277
344
 
278
- - Delivering from a managed worktree to a checked-out target behaves like a
279
- merge. Non-overlapping staged, unstaged, and untracked files in that checkout
280
- are preserved. A staged path refuses only when Git cannot carry it through
281
- the predecessor-to-candidate merge; overlapping worktree changes and
282
- colliding untracked files also refuse. The receipt lists the exact paths.
283
- The deliver or review you just ran still counts: the recorded candidate and
284
- any `✓ reviewed` verdict are kept, but nothing claims and nothing moves.
285
- The target ref, its checkout, and your bytes stay exactly where they were,
286
- and the Contract stays `tendered`.
287
- After a refusal, handle the listed paths, then `deliver` again or record a
288
- satisfied review; either command requests placement again.
345
+ Placement refusal is nonpublishing: the receipt names the reason and paths,
346
+ while the target, checkout bytes, candidate, and current review evidence remain
347
+ unchanged. Handle the listed paths, then run `deliver` again or record a
348
+ satisfied review to request placement again.
289
349
 
290
350
  ## Recover Or End
291
351
 
@@ -295,12 +355,11 @@ keiyaku abandon <contract> --note "<why>" # terminal; target untouched
295
355
  ```
296
356
 
297
357
  `reconcile` completes physical effects of already accepted placements; it does
298
- not retry an ordinary placement refusal. `abandon` ends the Contract and never
299
- touches the target.
358
+ not retry an ordinary placement refusal. Use `--retry-hooks` only for a frozen
359
+ failed hook phase. A lagging effect does not change the accepted verdict.
360
+ `abandon` ends the Contract and never touches the target.
300
361
 
301
362
  ## Routine Output
302
363
 
303
- Use default text output for normal operation and `--json` only when a script
304
- needs the public result. Use the complete `kei/...` ID, or `@...` inside a
305
- managed worktree. When a flag or stdin form is unclear, read that command's
306
- `--help` instead of guessing.
364
+ Use the complete `kei/...` ID, or `@...` inside a managed worktree. Read a
365
+ command's `--help` when its flags or stdin form are unclear.
@@ -1,2 +1,3 @@
1
- export declare function abortable<T>(operation: Promise<T>, signal: AbortSignal, disposeLate?: (value: T) => Promise<void> | void): Promise<T>;
1
+ /** Race an awaited operation against cancellation without retaining resource state. */
2
+ export declare function abortable<T>(operation: Promise<T>, signal: AbortSignal): Promise<T>;
2
3
  export declare function abortableDelay(milliseconds: number, signal?: AbortSignal): Promise<void>;
@@ -1,32 +1,15 @@
1
- export function abortable(operation, signal, disposeLate) {
1
+ /** Race an awaited operation against cancellation without retaining resource state. */
2
+ export function abortable(operation, signal) {
2
3
  signal.throwIfAborted();
3
4
  return new Promise((resolve, reject) => {
4
- let aborted = false;
5
- let settled = false;
6
- const abort = () => {
7
- aborted = true;
8
- if (!settled) {
9
- settled = true;
10
- reject(signal.reason);
11
- }
12
- };
5
+ const abort = () => reject(signal.reason);
13
6
  signal.addEventListener("abort", abort, { once: true });
14
- if (signal.aborted)
15
- abort();
16
- void operation.then(async (value) => {
7
+ operation.then((value) => {
17
8
  signal.removeEventListener("abort", abort);
18
- if (!aborted) {
19
- settled = true;
20
- resolve(value);
21
- return;
22
- }
23
- void Promise.resolve(disposeLate?.(value)).catch(() => undefined);
9
+ resolve(value);
24
10
  }, (error) => {
25
11
  signal.removeEventListener("abort", abort);
26
- if (settled)
27
- return;
28
- settled = true;
29
- reject(aborted ? signal.reason : error);
12
+ reject(error);
30
13
  });
31
14
  });
32
15
  }
@@ -110,7 +110,7 @@ export class AkumaHandle {
110
110
  throw new TypeError(`Akuma history ${name} must be a positive safe integer`);
111
111
  }
112
112
  }
113
- const limit = input.limit ?? 50;
113
+ const limit = input.limit ?? 12;
114
114
  if (!Number.isSafeInteger(limit) || limit <= 0 || limit > 5_000) {
115
115
  throw new TypeError("Akuma history limit must be a positive safe integer no greater than 5000");
116
116
  }
@@ -213,7 +213,9 @@ export class AkumaHandle {
213
213
  throw new Error(`Akuma fork point ${input.at} has a mismatched provider`);
214
214
  let childSession;
215
215
  try {
216
- childSession = (await adapter.fork({ session: point.session, at: point.historyId, cwd: point.cwd })).session;
216
+ const attempt = adapter.fork({ session: point.session, at: point.historyId, cwd: point.cwd });
217
+ childSession = (await attempt.result).session;
218
+ await attempt.closed;
217
219
  }
218
220
  catch (error) {
219
221
  return { kind: "fork-failed", diagnostic: diagnostic(error) };
@@ -10,10 +10,12 @@ export type BudgetedStatusObservation = Readonly<{
10
10
  export declare function bornStatus(paths: AkumaPaths, expected: AkuId, input: Readonly<{
11
11
  aperture: "monitoring" | "receipt";
12
12
  ordinaryBudget?: number;
13
+ admittedTellId?: string;
13
14
  }>): Promise<BudgetedStatusObservation>;
14
15
  export declare function readBudgetedStatus(worldPath: WorldRoot, id: AkuId, input: Readonly<{
15
16
  aperture: "monitoring" | "receipt";
16
17
  ordinaryBudget?: number;
18
+ admittedTellId?: string;
17
19
  }>): Promise<BudgetedStatusObservation>;
18
20
  export declare function readAkumaBirthCwd(worldPath: WorldRoot, id: AkuId): Promise<string>;
19
21
  export { selectHistory, type ActivityHistory, type ActivitySnapshot };
@@ -50,6 +50,7 @@ export async function bornStatus(paths, expected, input) {
50
50
  const selected = selectSnapshot(projectTurns(slice.rows), {
51
51
  aperture: input.aperture,
52
52
  budget: ordinarySnapshotBudget(input.ordinaryBudget),
53
+ ...(input.admittedTellId === undefined ? {} : { admittedTellId: input.admittedTellId }),
53
54
  });
54
55
  return {
55
56
  status: {
@@ -8,7 +8,8 @@ import { akuIdFromDirectoryName, akumaPaths, akumaRunRoot, archetypeName, parseA
8
8
  import { loadArchetype, listArchetypes as readArchetypes } from "./archetype.js";
9
9
  import { birthAkuma, launchAkuma } from "./publication.js";
10
10
  import { spawnAkumaBody } from "./body.js";
11
- import { injectedBodyRequests, requestBodyCall } from "./requests.js";
11
+ import { requestForwardedAkumaCall } from "./call-request.js";
12
+ import { executionChannel } from "./requests.js";
12
13
  import { decodeAllowedActions, unionAllowedActions } from "./allowed.js";
13
14
  import { settings as readSettings } from "../settings.js";
14
15
  function callReadonly(value) {
@@ -60,7 +61,7 @@ export class Akuma {
60
61
  const allowed = input.allowed === undefined
61
62
  ? archetype.allowed
62
63
  : unionAllowedActions(archetype.allowed, decodeAllowedActions(input.allowed, "Akuma call allowed"));
63
- const requests = injectedBodyRequests();
64
+ const execution = executionChannel(this.configuration.execution);
64
65
  const requestRecipe = Object.freeze({
65
66
  ...(archetype.description === undefined ? {} : { description: archetype.description }),
66
67
  provider: archetype.provider,
@@ -68,14 +69,14 @@ export class Akuma {
68
69
  ...(archetype.readonly === undefined ? {} : { readonly: archetype.readonly }),
69
70
  allowed,
70
71
  });
71
- if (requests !== null) {
72
+ if (execution.kind === "body-request") {
72
73
  const cwd = input.cwd === undefined
73
74
  ? undefined
74
75
  : context?.cwdCanonical === true
75
76
  ? input.cwd
76
77
  : await canonicalBirthCwd(input.cwd);
77
- const child = await requestBodyCall({
78
- directory: requests,
78
+ const child = await requestForwardedAkumaCall({
79
+ directory: execution.directory,
79
80
  id: randomUUID(),
80
81
  world: this.path,
81
82
  archetype: name,
@@ -140,6 +141,7 @@ export class Akuma {
140
141
  if (unknown !== undefined)
141
142
  throw new TypeError(`Akuma list input has unknown field: ${unknown}`);
142
143
  const selected = input.archetype === undefined ? undefined : archetypeName(input.archetype);
144
+ const observedAt = new Date().toISOString();
143
145
  const runRoot = akumaRunRoot(this.path);
144
146
  let names;
145
147
  try {
@@ -150,7 +152,7 @@ export class Akuma {
150
152
  }
151
153
  catch (error) {
152
154
  if (error.code === "ENOENT")
153
- return { rows: [], searched: [runRoot] };
155
+ return { observedAt, rows: [], searched: [runRoot] };
154
156
  throw error;
155
157
  }
156
158
  const rows = [];
@@ -170,7 +172,7 @@ export class Akuma {
170
172
  }
171
173
  catch { }
172
174
  }
173
- return { rows, searched: [runRoot] };
175
+ return { observedAt, rows, searched: [runRoot] };
174
176
  }
175
177
  }
176
178
  export async function callAkumaWithContext(akuma, input, context) {