@astrosheep/keiyaku 4.5.11 → 4.5.13

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 (272) hide show
  1. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-workflow/SKILL.md +135 -377
  2. package/build/integrations/pi/keiyaku.ts +11 -116
  3. package/build/src/akuma/akuma-errors.d.ts +1 -0
  4. package/build/src/akuma/akuma-errors.js +1 -0
  5. package/build/src/akuma/akuma-handle.d.ts +1 -0
  6. package/build/src/akuma/akuma-handle.js +6 -7
  7. package/build/src/akuma/akuma-product.d.ts +6 -8
  8. package/build/src/akuma/akuma-product.js +141 -57
  9. package/build/src/akuma/akuma.d.ts +5 -7
  10. package/build/src/akuma/akuma.js +1 -22
  11. package/build/src/akuma/archetype.d.ts +6 -5
  12. package/build/src/akuma/archetype.js +137 -38
  13. package/build/src/akuma/body.d.ts +5 -5
  14. package/build/src/akuma/body.js +223 -63
  15. package/build/src/akuma/call-input.d.ts +4 -0
  16. package/build/src/akuma/call-input.js +21 -0
  17. package/build/src/akuma/call-request.d.ts +5 -8
  18. package/build/src/akuma/call-request.js +28 -73
  19. package/build/src/akuma/fleet-execution.d.ts +26 -0
  20. package/build/src/akuma/fleet-execution.js +109 -0
  21. package/build/src/{library/fleet-result.d.ts → akuma/fleet-observation.d.ts} +13 -57
  22. package/build/src/{library/fleet-result.js → akuma/fleet-observation.js} +4 -25
  23. package/build/src/akuma/fleet-request.d.ts +122 -0
  24. package/build/src/akuma/fleet-request.js +168 -0
  25. package/build/src/akuma/heart/facts.d.ts +23 -0
  26. package/build/src/akuma/heart/facts.js +7 -0
  27. package/build/src/akuma/heart/index.d.ts +43 -4
  28. package/build/src/akuma/heart/index.js +107 -7
  29. package/build/src/akuma/heart/request-authority.d.ts +2 -0
  30. package/build/src/akuma/heart/request-authority.js +28 -3
  31. package/build/src/akuma/heart/request-rows.d.ts +2 -0
  32. package/build/src/akuma/heart/request-rows.js +24 -5
  33. package/build/src/akuma/heart/rows.d.ts +4 -1
  34. package/build/src/akuma/heart/rows.js +46 -19
  35. package/build/src/akuma/heart/schema.d.ts +1 -1
  36. package/build/src/akuma/heart/schema.js +28 -6
  37. package/build/src/akuma/heart/storage.d.ts +1 -1
  38. package/build/src/akuma/heart/tells.d.ts +29 -0
  39. package/build/src/akuma/heart/tells.js +136 -5
  40. package/build/src/akuma/heart/timeline.js +9 -3
  41. package/build/src/akuma/projection-read.js +36 -3
  42. package/build/src/akuma/projection.js +3 -4
  43. package/build/src/akuma/provider.d.ts +4 -0
  44. package/build/src/akuma/provider.js +56 -3
  45. package/build/src/akuma/providers/claude/index.js +3 -0
  46. package/build/src/akuma/providers/codex-app-server/index.js +14 -12
  47. package/build/src/akuma/providers/pi/index.js +7 -1
  48. package/build/src/akuma/publication.js +65 -49
  49. package/build/src/akuma/request-lifecycle.d.ts +5 -4
  50. package/build/src/akuma/request-lifecycle.js +29 -16
  51. package/build/src/akuma/request-rendezvous.d.ts +15 -12
  52. package/build/src/akuma/request-rendezvous.js +80 -51
  53. package/build/src/akuma/request-serve.d.ts +1 -2
  54. package/build/src/akuma/request-serve.js +94 -39
  55. package/build/src/akuma/request-wire.d.ts +57 -26
  56. package/build/src/akuma/request-wire.js +64 -25
  57. package/build/src/akuma/turn-drive.d.ts +5 -4
  58. package/build/src/akuma/turn-drive.js +27 -11
  59. package/build/src/akuma-body.d.ts +4 -6
  60. package/build/src/akuma-body.js +19 -17
  61. package/build/src/bounded-list.d.ts +8 -0
  62. package/build/src/bounded-list.js +14 -0
  63. package/build/src/cli/accepted.d.ts +1 -1
  64. package/build/src/cli/accepted.js +1 -0
  65. package/build/src/cli/commands/akuma-invoke.js +1 -25
  66. package/build/src/cli/commands/contract-help.d.ts +5 -2
  67. package/build/src/cli/commands/contract-help.js +62 -12
  68. package/build/src/cli/commands/contract-invoke.d.ts +5 -0
  69. package/build/src/cli/commands/contract-invoke.js +26 -1
  70. package/build/src/cli/commands/contract.js +50 -18
  71. package/build/src/cli/commands/task-invoke.js +10 -2
  72. package/build/src/cli/commands/task-query.js +3 -4
  73. package/build/src/cli/coordinates.d.ts +13 -0
  74. package/build/src/cli/coordinates.js +38 -24
  75. package/build/src/cli/draft.d.ts +1 -1
  76. package/build/src/cli/invoke.js +14 -1
  77. package/build/src/cli/render/akuma-activity.d.ts +0 -1
  78. package/build/src/cli/render/akuma-activity.js +5 -38
  79. package/build/src/cli/render/akuma.js +4 -1
  80. package/build/src/cli/render/audit.js +4 -1
  81. package/build/src/cli/render/catalog.js +13 -39
  82. package/build/src/cli/render/contract.js +4 -14
  83. package/build/src/cli/render/kanshi-akuma.js +3 -8
  84. package/build/src/cli/render/kanshi.js +8 -34
  85. package/build/src/cli/render/nuke.js +7 -3
  86. package/build/src/cli/render/receipt.d.ts +1 -0
  87. package/build/src/cli/render/receipt.js +8 -0
  88. package/build/src/cli/render/refusal.js +4 -3
  89. package/build/src/cli/render/task.js +4 -37
  90. package/build/src/cli/render/terminal.d.ts +2 -6
  91. package/build/src/cli/render/terminal.js +4 -9
  92. package/build/src/cli/result.d.ts +2 -1
  93. package/build/src/contract-guidance.js +13 -3
  94. package/build/src/contract-worktree.d.ts +1 -0
  95. package/build/src/contract-worktree.js +26 -2
  96. package/build/src/core/facts/codec.d.ts +2 -1
  97. package/build/src/core/facts/codec.js +3 -0
  98. package/build/src/core/facts/gate.d.ts +2 -1
  99. package/build/src/core/facts/gate.js +63 -0
  100. package/build/src/core/verbs/abandon.d.ts +2 -1
  101. package/build/src/core/verbs/abandon.js +16 -0
  102. package/build/src/core/verbs/amend.d.ts +2 -1
  103. package/build/src/core/verbs/amend.js +20 -0
  104. package/build/src/core/verbs/arc.d.ts +2 -1
  105. package/build/src/core/verbs/arc.js +16 -0
  106. package/build/src/core/verbs/attestation.d.ts +2 -1
  107. package/build/src/core/verbs/attestation.js +16 -0
  108. package/build/src/core/verbs/bind.d.ts +2 -1
  109. package/build/src/core/verbs/bind.js +16 -0
  110. package/build/src/core/verbs/deliver.d.ts +2 -1
  111. package/build/src/core/verbs/deliver.js +16 -0
  112. package/build/src/core/verbs/placement.d.ts +2 -1
  113. package/build/src/core/verbs/placement.js +58 -1
  114. package/build/src/dispatch/association.d.ts +13 -0
  115. package/build/src/dispatch/association.js +20 -0
  116. package/build/src/dispatch/index.d.ts +6 -0
  117. package/build/src/dispatch/index.js +27 -3
  118. package/build/src/git/hooks.d.ts +9 -1
  119. package/build/src/git/hooks.js +79 -1
  120. package/build/src/git/nuke.d.ts +2 -1
  121. package/build/src/git/nuke.js +6 -11
  122. package/build/src/git/private-state-seat.d.ts +26 -1
  123. package/build/src/git/private-state-seat.js +78 -13
  124. package/build/src/git/process.d.ts +2 -0
  125. package/build/src/git/reconcile.d.ts +1 -2
  126. package/build/src/git/reconcile.js +0 -6
  127. package/build/src/git/repository.d.ts +0 -2
  128. package/build/src/git/repository.js +27 -25
  129. package/build/src/git/result-codec.d.ts +29 -0
  130. package/build/src/git/result-codec.js +306 -0
  131. package/build/src/git/target-placement.js +2 -8
  132. package/build/src/git/workspace.d.ts +2 -0
  133. package/build/src/git/workspace.js +4 -0
  134. package/build/src/index.d.ts +1 -0
  135. package/build/src/kanshi/fleet.js +1 -1
  136. package/build/src/kanshi/read.js +55 -28
  137. package/build/src/kanshi/report.d.ts +4 -3
  138. package/build/src/kanshi/select.js +14 -1
  139. package/build/src/library/address.d.ts +1 -0
  140. package/build/src/library/address.js +4 -7
  141. package/build/src/library/akuma-creation.d.ts +5 -3
  142. package/build/src/library/akuma-creation.js +90 -33
  143. package/build/src/library/audit.js +2 -1
  144. package/build/src/library/catalog.d.ts +10 -2
  145. package/build/src/library/catalog.js +65 -25
  146. package/build/src/library/composition.d.ts +1 -0
  147. package/build/src/library/composition.js +1 -0
  148. package/build/src/library/configuration.d.ts +4 -21
  149. package/build/src/library/configuration.js +2 -158
  150. package/build/src/library/continuation.d.ts +20 -1
  151. package/build/src/library/continuation.js +36 -0
  152. package/build/src/library/contract-bind.d.ts +1 -0
  153. package/build/src/library/contract-bind.js +16 -5
  154. package/build/src/library/contract-forwarding.d.ts +2 -2
  155. package/build/src/library/contract-forwarding.js +18 -4
  156. package/build/src/library/contract-handle.js +4 -3
  157. package/build/src/library/contract-operations.d.ts +5 -9
  158. package/build/src/library/contract-operations.js +34 -47
  159. package/build/src/library/contract.d.ts +11 -2
  160. package/build/src/library/contract.js +21 -1
  161. package/build/src/library/delivery.d.ts +4 -1
  162. package/build/src/library/delivery.js +47 -0
  163. package/build/src/library/fleet.d.ts +4 -136
  164. package/build/src/library/fleet.js +31 -315
  165. package/build/src/library/keiyaku.d.ts +7 -3
  166. package/build/src/library/keiyaku.js +1 -0
  167. package/build/src/library/mutation.d.ts +431 -3
  168. package/build/src/library/mutation.js +192 -19
  169. package/build/src/library/nuke.d.ts +7 -1
  170. package/build/src/library/nuke.js +18 -4
  171. package/build/src/library/reconcile.d.ts +14 -0
  172. package/build/src/library/reconcile.js +22 -8
  173. package/build/src/library/refusal.d.ts +9 -1
  174. package/build/src/library/refusal.js +76 -0
  175. package/build/src/library/region.d.ts +0 -8
  176. package/build/src/library/region.js +1 -29
  177. package/build/src/library/result-codec.d.ts +2 -0
  178. package/build/src/library/result-codec.js +12 -0
  179. package/build/src/markdown/lex.js +9 -2
  180. package/build/src/markdown/types.d.ts +2 -1
  181. package/build/src/markdown/types.js +3 -1
  182. package/build/src/plugin/akuma-signals.d.ts +12 -0
  183. package/build/src/plugin/akuma-signals.js +14 -0
  184. package/build/src/plugin/public.d.ts +51 -0
  185. package/build/src/plugin/public.js +1 -0
  186. package/build/src/plugin/runtime.d.ts +14 -0
  187. package/build/src/plugin/runtime.js +357 -0
  188. package/build/src/protocol/amend.js +3 -3
  189. package/build/src/protocol/attempt.d.ts +2 -1
  190. package/build/src/protocol/attempt.js +1 -1
  191. package/build/src/protocol/audit.d.ts +1 -1
  192. package/build/src/protocol/audit.js +1 -1
  193. package/build/src/protocol/bind.d.ts +3 -1
  194. package/build/src/protocol/bind.js +26 -0
  195. package/build/src/protocol/completion.js +0 -1
  196. package/build/src/protocol/deliver.d.ts +1 -1
  197. package/build/src/protocol/deliver.js +136 -57
  198. package/build/src/protocol/intent.d.ts +0 -1
  199. package/build/src/protocol/intent.js +0 -1
  200. package/build/src/protocol/operations.d.ts +9 -2
  201. package/build/src/protocol/operations.js +16 -1
  202. package/build/src/protocol/outcome.d.ts +3 -0
  203. package/build/src/protocol/outcome.js +17 -1
  204. package/build/src/protocol/placement.js +10 -3
  205. package/build/src/protocol/read/status.d.ts +8 -0
  206. package/build/src/protocol/read/status.js +49 -0
  207. package/build/src/protocol/reintegrate.js +10 -3
  208. package/build/src/protocol/result-codec.d.ts +22 -0
  209. package/build/src/protocol/result-codec.js +442 -0
  210. package/build/src/protocol/review.d.ts +1 -1
  211. package/build/src/protocol/review.js +81 -46
  212. package/build/src/protocol/run.d.ts +22 -2
  213. package/build/src/protocol/run.js +119 -29
  214. package/build/src/runtime/proc/lifecycle.js +1 -1
  215. package/build/src/runtime/proc/line-rpc.d.ts +7 -1
  216. package/build/src/runtime/proc/line-rpc.js +49 -9
  217. package/build/src/runtime/proc/run.d.ts +0 -1
  218. package/build/src/runtime/proc/run.js +1 -11
  219. package/build/src/runtime/proc/termination.d.ts +1 -0
  220. package/build/src/runtime/proc/termination.js +63 -18
  221. package/build/src/runtime/proc/windows-launch.exe +0 -0
  222. package/build/src/settings.d.ts +10 -0
  223. package/build/src/settings.js +88 -2
  224. package/build/src/settlement/result-codec.d.ts +2 -0
  225. package/build/src/settlement/result-codec.js +56 -0
  226. package/build/src/settlement/settle.d.ts +5 -12
  227. package/build/src/settlement/settle.js +60 -55
  228. package/build/src/task/board.d.ts +3 -0
  229. package/build/src/task/board.js +22 -4
  230. package/build/src/task/catalog.d.ts +13 -2
  231. package/build/src/task/catalog.js +59 -5
  232. package/build/src/task/compose.d.ts +4 -2
  233. package/build/src/task/compose.js +56 -30
  234. package/build/src/task/created-observation.d.ts +39 -0
  235. package/build/src/task/created-observation.js +26 -0
  236. package/build/src/task/identity.d.ts +6 -0
  237. package/build/src/task/identity.js +48 -7
  238. package/build/src/task/index.d.ts +4 -3
  239. package/build/src/task/index.js +19 -16
  240. package/build/src/task/input.d.ts +3 -1
  241. package/build/src/task/input.js +7 -4
  242. package/build/src/task/lifecycle-operations.d.ts +6 -0
  243. package/build/src/task/lifecycle-operations.js +116 -0
  244. package/build/src/task/mutation-result.d.ts +762 -20
  245. package/build/src/task/mutation-result.js +34 -9
  246. package/build/src/task/mutation.d.ts +4 -9
  247. package/build/src/task/mutation.js +17 -52
  248. package/build/src/task/operation-types.d.ts +114 -0
  249. package/build/src/task/operation-types.js +1 -0
  250. package/build/src/task/operations.d.ts +6 -113
  251. package/build/src/task/operations.js +75 -117
  252. package/build/src/task/query.d.ts +8 -11
  253. package/build/src/task/query.js +7 -14
  254. package/build/src/task/store.d.ts +11 -1
  255. package/build/src/task/store.js +169 -55
  256. package/build/src/task/view.d.ts +4 -0
  257. package/build/src/task/view.js +7 -0
  258. package/build/src/verification/declaration.d.ts +1 -0
  259. package/build/src/verification/declaration.js +18 -1
  260. package/build/src/verification/execution.d.ts +0 -1
  261. package/build/src/verification/execution.js +5 -5
  262. package/build/src/world.d.ts +0 -2
  263. package/build/src/world.js +3 -7
  264. package/package.json +17 -5
  265. package/build/src/cli/square-edge.d.ts +0 -7
  266. package/build/src/cli/square-edge.js +0 -159
  267. package/build/src/git/ref-migration.d.ts +0 -22
  268. package/build/src/git/ref-migration.js +0 -55
  269. package/build/src/library/contract-forwarding-reconciliation-result.d.ts +0 -102
  270. package/build/src/library/contract-forwarding-reconciliation-result.js +0 -92
  271. package/build/src/library/contract-forwarding-result.d.ts +0 -4270
  272. package/build/src/library/contract-forwarding-result.js +0 -521
@@ -1,381 +1,139 @@
1
1
  ---
2
2
  name: keiyaku-workflow
3
- description: Use when authoring, binding, auditing, delivering, reviewing, amending, or abandoning a Keiyaku v4 Contract.
3
+ description: Hold a Contract's fulfillment loop — the loop-holder's five decisions across the whole active loop, from a waiting or bound Contract to claimed or abandoned. Hold or delegate; shape the work into Contracts, Arcs, and Tasks; commission Deliverer and Reviewer seats; adjudicate deliver, review, and audit returns, amend or abandon; schedule landing. For the flagship or the single delegate holding a whole loop.
4
4
  ---
5
5
 
6
- # Keiyaku Workflow
7
-
8
- A Contract turns one bounded delivery into acceptable terms: bind it, work in
9
- the appointed worktree, audit the Contract, deliver, then satisfy its review
10
- gates. Placement claims it when every prerequisite and gate is current.
11
-
12
- The lifecycle is `waiting -> bound -> tendered -> claimed | abandoned`;
13
- the last two are terminal. Reserve `--after` for true logical ordering: one
14
- Contract's result must ultimately build on another's settled outcome, or their
15
- intended work has a large or irreconcilable interaction that should be
16
- sequenced. Ordinary Region overlap is not enough. Small overlaps may proceed
17
- under Git's optimistic write model and be resolved manually or by a delegated
18
- worker. At runtime prerequisites are placement obligations, not a delivery
19
- admission gate: a Contract may record `bound` and deliver before they claim,
20
- while placement waits for the current prerequisites and declared gates. Active
21
- terms may amend `--after` after `bound` or `deliver`; terminal Contracts remain
22
- immutable. You never push it through states by hand: `deliver` and satisfied
23
- reviews request placement, and placement claims when every prerequisite and
24
- gate allows it.
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
- ## Bind
35
-
36
- Use `keiyaku-bind` to decide readiness, author one bounded Contract, choose
37
- bind inputs, and read the receipt. Continue here from that receipt.
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
-
47
- ## Work In The Contract Worktree
48
-
49
- Change and test code in the worktree the bind receipt names. `deliver` accepts
50
- a clean worktree by default. You may commit first, or explicitly include all
51
- non-ignored staged, unstaged, and untracked final bytes with
52
- `deliver --include-dirty`.
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
-
80
- ## Regain The Picture
81
-
82
- Rebuild state from reads, not memory — after a compact, a handoff, or any
83
- surprising receipt, read before acting:
84
-
85
- ```bash
86
- keiyaku status # the whole board
87
- keiyaku status <contract> # lifecycle, candidate, one mark per gate
88
- keiyaku show <contract> # the exact current Contract terms
89
- keiyaku region # every active Contract's declared surfaces
90
- keiyaku region <contract> # one Contract's declared intent
91
- keiyaku region --overlap # which declared intents intersect
92
- keiyaku region --path <path> # which active Contracts declare this path
93
- ```
94
-
95
- `status` marks each gate: `✓` current satisfied, `!` current unsatisfied, `?`
96
- stale because the patch or document changed after the evidence, `○` missing.
97
- A Region is a Contract's declared write intent not ownership, not a gate,
98
- and not a Git conflict. Read the world before decomposing or commissioning
99
- into an occupied repository; read `--overlap` before choosing a landing order
100
- or an `--after` edge; read `--path` before touching a file that may belong to
101
- another lane. Regions are declarations only, a coarse planning signal: actual
102
- touched paths and conflicts remain Git's.
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
-
130
- ## Commission A Contract
131
-
132
- When another agent will fulfill or review the Contract, the commissioning
133
- harness must pass one explicit seat and one exact worktree. `--contract` or an
134
- equivalent association identifies the Contract; it does not appoint a seat.
135
- Never ask the worker to infer either value.
136
-
137
- Use this minimum handoff in the dispatch body, regardless of harness:
138
-
139
- ```text
140
- Contract: kei/...
141
- Seat: Deliverer | Reviewer
142
- Worktree: /absolute/path/from-the-bind-receipt
143
- Read first:
144
- - .keiyaku/KEIYAKU.md
145
- - <owner documents governing this delivery>
146
- - <source files named or selected from the Contract Region for this work>
147
- Objective:
148
- <the assignment's high-level intent and goal — not implementation detail,
149
- not a restatement of the Contract terms>
150
- ```
151
-
152
- Every `Read first` path is relative to `Worktree` unless it is absolute. The
153
- worker starts by reading `.keiyaku/KEIYAKU.md` in that worktree, confirms its
154
- frontmatter names `Contract`, then reads the listed owner documents and source
155
- files before acting. Do not substitute a generic repository tour for the files
156
- that actually govern the assignment.
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
-
165
- Contract association, available forwarded actions, and the brief are
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.
170
-
171
- A `Deliverer` implements and verifies the terms in `Worktree`. Commission a
172
- `Reviewer` after delivery. The reviewer inspects the complete current Contract
173
- worktree snapshot, not a worker report or named candidate commit, and does not
174
- modify it. Missing or contradictory seat, worktree, or reading list means stop
175
- and ask.
176
-
177
- Observe commissioned workers through their Contract association:
178
-
179
- ```bash
180
- keiyaku wait kei/<contract> --all --timeout 5m
181
- keiyaku wait kei/<first> kei/<second> --any --timeout 5m
182
- ```
183
-
184
- A Contract selector snapshots its dispatched workers when the command starts.
185
- Use `--all` to wait for every selected worker or `--any` to return when one
186
- finishes; an expanded set with more than one worker requires an explicit mode.
187
-
188
- ## Decompose Complex Work
189
-
190
- Complex Keiyaku should be divided along independently acceptable delivery
191
- boundaries. Use judgment to find those boundaries from the work's objectives,
192
- dependencies, Regions, and acceptance criteria; raw size or file count is not
193
- the test. Give each resulting Contract coherent terms. Connect them with
194
- `--after` only when one must proceed from another's settled result or their
195
- intended work is unsafe to run concurrently.
196
-
197
- When a complex Keiyaku cannot be split without breaking one acceptance
198
- boundary, organize its fulfillment into arcs. Do not hand the whole
199
- undifferentiated Contract to one Deliverer and trust one pass to finish it.
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.
205
-
206
- An arc is a chapter as in a work of literature: one named part of the
207
- delivery's story, not a task list, progress slice, or claim that the work is
208
- mechanically sequential. Its title names the chapter, Objective states that
209
- chapter's aim, and Brief commissions work for that chapter. When an Arc is
210
- active, stay within that current chapter. `.keiyaku/KEIYAKU.md` renders the
211
- current Arc.
212
- Record the next chapter before entering it:
213
-
214
- ```bash
215
- keiyaku arc <contract> - <<'KEIYAKU'
216
- # <chapter title>
217
-
218
- ## Objective
219
- <nonblank objective>
220
-
221
- ## Brief
222
- <nonblank dispatch brief>
223
- KEIYAKU
224
- ```
225
-
226
- All chapters live inside that Contract's single delivery and acceptance
227
- boundary. The document grammar authority is `docs/document.md`.
228
-
229
- ## Amend Or Start Over
230
-
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.
236
-
237
- ```bash
238
- keiyaku amend <contract> -
239
- ```
240
-
241
- See `amend --help` for the operation grammar.
242
-
243
- ## Audit Before Delivery
244
-
245
- Audit is an evidence window for a prospective delivery:
246
-
247
- ```bash
248
- keiyaku audit <contract> --diff
249
- ```
250
-
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.
255
-
256
- ## Deliver
257
-
258
- When the brief assigns delivery to the Deliverer, include `--allowed
259
- contract.deliver`; require it to run the command below after verification and
260
- return the receipt. Otherwise the coordinator runs it after accepting the
261
- candidate.
262
-
263
- Deliver when the worktree content is the candidate you intend to land:
264
-
265
- ```bash
266
- keiyaku deliver <contract> --include-dirty
267
- ```
268
-
269
- Each `deliver` observes the target as it stands for that invocation, prepares
270
- the candidate's current-target integration in Keiyaku-owned Git custody, runs
271
- or reuses Verification, records the candidate, and requests placement. If the
272
- target moves, read the Contract and run `audit` or `deliver` again. Keiyaku
273
- recomputes the integration; a manual rebase is optional candidate shaping, not
274
- target refresh.
275
-
276
- Deliver when the work is ready to be judged, not when Git looks tidy. `git
277
- commit` only shapes the candidate; skipping it is fine — `deliver
278
- --include-dirty` captures the complete non-ignored worktree. If delivery reports
279
- an integration conflict, run `deliver --materialize-conflict`, resolve the
280
- judged conflict in the appointed worktree, then deliver the resolved bytes with
281
- `--include-dirty`.
282
-
283
- Deliver and review answer different questions: deliver records the candidate
284
- and places and claims by itself only when every placement obligation is current;
285
- a review gate is satisfied only by review testimony over the current candidate,
286
- and a satisfied review may itself be the invocation that places and claims.
287
- Reviewing before any delivery is legal but records testimony only — it creates
288
- no candidate and authorizes nothing. A Contract without a review gate needs no
289
- review.
290
-
291
- A current audit attestation is reused only when its integration snapshot and
292
- Verification segment still match; changes to the worktree, target, policy,
293
- document, Verification, or snapshot-producing options make it stale.
294
-
295
- ## Review Gates
296
-
297
- The Reviewer owns the answer. A gate review compares the full current candidate
298
- against every journaled Criterion — the floor that cannot be reduced — and
299
- testifies satisfied or unsatisfied over the current document identity and
300
- worktree. A current defect, missing, failed, or stale required evidence, or
301
- terms too ambiguous or contradictory to judge all yield unsatisfied, with the
302
- summary naming what blocks. Advice beyond the terms belongs in the summary and
303
- never changes the verdict by itself.
304
-
305
- ```bash
306
- keiyaku review <contract> --satisfied --summary "<conclusion>"
307
- keiyaku review <contract> --unsatisfied --summary "<finding>"
308
- ```
309
-
310
- One Contract, one continuing Reviewer by default: reuse the same identity
311
- across rounds, replace it with a recorded reason when its judgment frame is
312
- contaminated, and never carry a Reviewer across Contracts — a new Contract
313
- always gets a new call. If it should record the verdict itself, dispatch it
314
- with `--allowed contract.review` and require it to choose the verdict from its
315
- independent judgment. Otherwise its answer is review input for the coordinator
316
- to record. The `review` command records the verdict and `--satisfied` requests
317
- placement.
318
-
319
- A review return is input to the loop holder's judgment, never a work order in
320
- itself. Classify before anything moves: a current defect against the terms is
321
- fixed and re-reviewed; advice worth keeping but not owed becomes a Task or is
322
- consciously declined; a problem with the terms goes up — journaled amend or
323
- escalation — before any remediation is commissioned; work outside the Contract
324
- stays outside it. Remediation that drifts the candidate away from the Objective
325
- is evidence against the premise, not a reason for another round.
326
-
327
- ## When Multiple Contracts Overlap On One Target
328
-
329
- When active Contracts write a shared surface, landing order is a coordinator
330
- judgment, not Contract state. Keep the decision in the workflow skill; do not
331
- persist a train or add a second placement authority.
332
-
333
- - `audit` and a reviewer's report are preliminary; the satisfied review is the
334
- gate-visible judgment for placement.
335
- - Before recording a satisfied review, or delivering a Contract with no
336
- declared gates, ask whether the exact patch will survive until placement. A
337
- freshly prepared current-target integration whose `ChangeId` is unchanged
338
- keeps the existing review current; do not re-review content addressing kept
339
- alive. Conflict resolution that changes the `ChangeId` makes earlier testimony
340
- stale and requires a fresh review: re-inspect the resolved candidate and record
341
- new testimony. Fresh review follows the reviewer-reuse rule above; prefer the
342
- existing independent reviewer when its judgment frame remains sound, especially
343
- so earlier findings can be checked within the complete fresh judgment.
344
- - For Contracts known to overlap, rerun `audit` or `deliver` against the current
345
- target before the authoritative review. Preliminary feedback may happen
346
- earlier, but it is not a satisfied gate until its reviewed patch is the
347
- candidate intended for placement. Land overlapping Contracts one at a time;
348
- let independent, non-overlapping Contracts proceed without ceremony. Treat
349
- overlap as a planning signal, not a correctness verdict.
350
- - After target movement, a changed candidate, or a placement refusal, read the
351
- current Contract facts again. Recompute the next landing judgment from those
352
- facts; do not rely on a remembered target or one-time integration.
353
-
354
- ## Target Placement
355
-
356
- Managed target checkouts follow Git merge semantics: unrelated staged,
357
- unstaged, and untracked paths are preserved. Staged changes refuse only when
358
- Git cannot carry the predecessor-to-candidate merge; overlapping worktree
359
- changes and colliding untracked files also refuse.
360
-
361
- Placement refusal is nonpublishing: the receipt names the reason and paths,
362
- while the target, checkout bytes, candidate, and current review evidence remain
363
- unchanged. Handle the listed paths, then run `deliver` again or record a
364
- satisfied review to request placement again.
365
-
366
- ## Recover Or End
367
-
368
- ```bash
369
- keiyaku reconcile <contract> # finish accepted lagging effects
370
- keiyaku abandon <contract> --note "<why>" # terminal; target untouched
371
- ```
372
-
373
- `reconcile` completes physical effects of already accepted placements; it does
374
- not retry an ordinary placement refusal. Use `--retry-hooks` only for a frozen
375
- failed hook phase. A lagging effect does not change the accepted verdict.
376
- `abandon` ends the Contract and never touches the target.
377
-
378
- ## Routine Output
379
-
380
- Use the complete `kei/...` ID, or `@...` inside a managed worktree. Read a
381
- command's `--help` when its flags or stdin form are unclear.
6
+ # Holding a fulfillment loop
7
+
8
+ You are the loop-holder: the one reader of this skill. Flagship and
9
+ whole-loop delegate are the same reader same decisions, same tools,
10
+ no special role or permission either way.
11
+
12
+ The state you steer: a Contract moves `waiting -> bound -> tendered ->
13
+ claimed | abandoned`; claimed and abandoned are terminal. Prerequisites
14
+ and declared gates block placement, never delivery admission. Deliver
15
+ and a satisfied review each request placement; placement claims only
16
+ when every current obligation permits.
17
+
18
+ Routing. Authoring a Contract its boundary, terms, gates — is
19
+ keiyaku-bind. Commission, call, tell, wait, permission, and history
20
+ mechanics are keiyaku-akuma. Attention across many waiting lanes is
21
+ keiyaku-babysit. Seat procedure travels with the worktree: the
22
+ generated seat skill in each appointment tells the Deliverer and
23
+ Reviewer what to do. Exact grammar for any command is that command's
24
+ help, nowhere else.
25
+
26
+ ## Decision 1 hold or delegate
27
+
28
+ Take the lightest shape that carries the work. Direct work may skip a
29
+ Contract entirely. Bounded mechanical work may take a Contract with no
30
+ review gate. Tasks and Arcs are optional planning, never ceremony owed
31
+ to the tool.
32
+
33
+ The shape is not fixed at the start. Work begun directly that grows
34
+ beyond expectation escalates midstream: bind a Contract then, and
35
+ carry the change you already have into the appointed worktree as the
36
+ candidate-in-progress. Nothing is lost by starting light; the only
37
+ mistake is continuing an oversized effort outside any acceptance
38
+ boundary because it happened to start there.
39
+
40
+ Hold the loop yourself when you will decompose or implement. Delegate
41
+ the whole loop when you steer at direction level: one commission hands
42
+ one Aku the entire loop. Delegation changes who decides, not what
43
+ exists it creates no role, state, or journal fact. A whole-loop
44
+ commission uses Contract association plus an explicit repository
45
+ working directory; the automatic Contract-worktree working directory
46
+ is for seat commissions only. Once delegated, steer through the
47
+ holder, never around it. The delegate owes decisions and coordination,
48
+ and may open Tasks, Arcs, and seat commissions beneath itself.
49
+
50
+ ## Decision 2 shape the work
51
+
52
+ Cut by what must be independently acceptable. Multiple independently
53
+ acceptable outcomes are separate Contracts. One acceptance boundary
54
+ whose work still has chapters may use Arcs — chapters inside a single
55
+ acceptance, never separately placeable. Decomposition and dependency
56
+ memory that must outlive a conversation is a Task. The failure this
57
+ decision prevents: an oversized boundary handed to one Deliverer as a
58
+ single ordinary assignment, with no chapters and no durable plan.
59
+
60
+ Authoring the Contract itself belongs to keiyaku-bind. A landing
61
+ dependency — this Contract's placement genuinely requires that one
62
+ landed — is a real `after` relation. Ordinary overlap is not: Regions
63
+ are planning evidence for your scheduling eye, never ownership and
64
+ never a gate.
65
+
66
+ ## Decision 3 — commission seats
67
+
68
+ A commission names one Contract, one seat, one worktree, and the
69
+ capabilities that seat needs. A Deliverer owes a candidate; a Reviewer
70
+ owes independent testimony. Grant only the actions required by that
71
+ duty and verify them at dispatch. A self-recording Reviewer needs
72
+ `contract.review` and therefore cannot be `--readonly`; use that flag
73
+ only when another actor records the verdict. The configuration grammar
74
+ is keiyaku-akuma's and the command's help.
75
+
76
+ The prompt conveys the rest, in words this literal:
77
+
78
+ Contract: <contract>
79
+ Seat: Deliverer (or Reviewer)
80
+ Worktree: <exact path>
81
+ Read first:
82
+ - .keiyaku/KEIYAKU.md
83
+ - <exact governing owner-law paths>
84
+ - <exact relevant source paths>
85
+ This round: <one-sentence objective>
86
+
87
+ A commission directs the round; it cannot amend acceptance. Standing
88
+ acceptance is only the journaled terms and their amendments.
89
+
90
+ Reviewer reuse is the default within one Contract while the judgment
91
+ frame stays sound; a new Contract gets a new Reviewer.
92
+
93
+ ## Decision 4 — adjudicate returns
94
+
95
+ Review is two-valued: satisfied or unsatisfied, testified over the
96
+ complete current candidate or document subject. Satisfied requests
97
+ placement and may be the invocation that claims; unsatisfied never
98
+ places. When satisfied cannot be reached, the summary names what
99
+ blocks it: the candidate, the required evidence, or the terms as
100
+ written. Advice beyond acceptance may accompany testimony and changes
101
+ no verdict. A returned Reviewer verdict is transported faithfully into
102
+ testimony, or a fresh independent review is commissioned — never
103
+ paraphrased into a different verdict. A Contract with no review gate
104
+ neither requires nor owes any review.
105
+
106
+ Deliver records the intended candidate, freshly prepares it against
107
+ the target as the target exists for that invocation, runs or reuses
108
+ Verification, and requests placement. A clean worktree delivers its
109
+ HEAD; a dirty delivery captures the complete non-ignored state as an
110
+ immutable commit without moving the branch or the real index a
111
+ prior git commit is optional shaping, never a prerequisite. Deliver
112
+ never satisfies a review gate.
113
+
114
+ Audit observes: prospective candidate, integration, Verification,
115
+ diff, target. It records no candidate and satisfies no gate.
116
+
117
+ Evidence goes stale by subject identity: a changed candidate or
118
+ amended terms stales the testimony over that subject. Amend only
119
+ while the same objective and acceptance boundary remain truthful —
120
+ amendment reshapes terms inside the same promise. When the objective
121
+ or the boundary itself has changed, abandon and bind a truthful new
122
+ Contract; do not steer old terms onto a different delivery. Abandon
123
+ ends a Contract without moving the target.
124
+
125
+ ## Decision 5 schedule landing
126
+
127
+ You schedule overlapping Contracts; nothing persists an ordering no
128
+ train exists in the tool. When the target has moved, prepare the
129
+ current-target integration before the authoritative review. A
130
+ content-equivalent preparation retains standing testimony; a changed
131
+ conflict resolution stales it. Target movement requires fresh deliver
132
+ or audit preparation.
133
+
134
+ A placement refusal preserves the candidate and the testimony and
135
+ leaves target and checkout untouched: resolve the blocking obligation
136
+ and request placement again. Reconcile finishes accepted lagging
137
+ effects; it does not retry a placement refusal. Rebuild your picture
138
+ at any time from the read surfaces — status, show, region — whose
139
+ grammar lives in their help.