@astrosheep/keiyaku 4.0.0 → 4.0.2

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 (308) hide show
  1. package/README.md +133 -8
  2. package/build/integrations/marketplace/plugins/keiyaku/.claude-plugin/plugin.json +2 -2
  3. package/build/integrations/marketplace/plugins/keiyaku/.codex-plugin/plugin.json +4 -4
  4. package/build/integrations/marketplace/plugins/keiyaku/opencode.js +2 -2
  5. package/build/integrations/marketplace/plugins/keiyaku/package.json +2 -2
  6. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku/SKILL.md +13 -5
  7. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-akuma/SKILL.md +91 -32
  8. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-bind/SKILL.md +134 -0
  9. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-bind/agents/openai.yaml +4 -0
  10. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-task/SKILL.md +41 -6
  11. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-workflow/SKILL.md +262 -46
  12. package/build/src/akuma/abort.d.ts +2 -0
  13. package/build/src/akuma/abort.js +50 -0
  14. package/build/src/akuma/akuma.d.ts +50 -33
  15. package/build/src/akuma/akuma.js +175 -127
  16. package/build/src/akuma/archetype.d.ts +14 -5
  17. package/build/src/akuma/archetype.js +85 -39
  18. package/build/src/akuma/body.d.ts +3 -5
  19. package/build/src/akuma/body.js +490 -183
  20. package/build/src/akuma/coordinate.d.ts +9 -0
  21. package/build/src/akuma/coordinate.js +22 -0
  22. package/build/src/akuma/heart/facts.d.ts +88 -45
  23. package/build/src/akuma/heart/facts.js +19 -8
  24. package/build/src/akuma/heart/index.d.ts +64 -55
  25. package/build/src/akuma/heart/index.js +172 -252
  26. package/build/src/akuma/heart/rows.d.ts +38 -83
  27. package/build/src/akuma/heart/rows.js +117 -155
  28. package/build/src/akuma/heart/schema.d.ts +1 -1
  29. package/build/src/akuma/heart/schema.js +61 -22
  30. package/build/src/akuma/heart/soul.d.ts +8 -0
  31. package/build/src/akuma/heart/soul.js +136 -0
  32. package/build/src/akuma/heart/storage.d.ts +47 -0
  33. package/build/src/akuma/heart/storage.js +224 -0
  34. package/build/src/akuma/heart/tells.d.ts +12 -0
  35. package/build/src/akuma/heart/tells.js +79 -0
  36. package/build/src/akuma/heart/timeline.d.ts +15 -0
  37. package/build/src/akuma/heart/timeline.js +86 -0
  38. package/build/src/akuma/identity.d.ts +2 -2
  39. package/build/src/akuma/identity.js +9 -9
  40. package/build/src/akuma/index.d.ts +10 -3
  41. package/build/src/akuma/index.js +7 -1
  42. package/build/src/akuma/projection.d.ts +176 -0
  43. package/build/src/akuma/projection.js +256 -0
  44. package/build/src/akuma/provider-recipe.d.ts +24 -0
  45. package/build/src/akuma/provider-recipe.js +100 -0
  46. package/build/src/akuma/provider.d.ts +67 -13
  47. package/build/src/akuma/provider.js +172 -105
  48. package/build/src/akuma/providers/acp/core.d.ts +19 -0
  49. package/build/src/akuma/providers/acp/core.js +159 -0
  50. package/build/src/akuma/providers/acp/events.d.ts +20 -0
  51. package/build/src/akuma/providers/acp/events.js +73 -0
  52. package/build/src/akuma/providers/acp/index.d.ts +12 -0
  53. package/build/src/akuma/providers/acp/index.js +94 -0
  54. package/build/src/akuma/providers/{claude.d.ts → claude/events.d.ts} +9 -41
  55. package/build/src/akuma/providers/claude/events.js +238 -0
  56. package/build/src/akuma/providers/claude/index.d.ts +47 -0
  57. package/build/src/akuma/providers/claude/index.js +279 -0
  58. package/build/src/akuma/providers/claude/input.d.ts +13 -0
  59. package/build/src/akuma/providers/claude/input.js +109 -0
  60. package/build/src/akuma/providers/codex-app-server/events.d.ts +1 -1
  61. package/build/src/akuma/providers/codex-app-server/events.js +15 -12
  62. package/build/src/akuma/providers/codex-app-server/index.d.ts +15 -13
  63. package/build/src/akuma/providers/codex-app-server/index.js +77 -33
  64. package/build/src/akuma/providers/grok-build/index.d.ts +4 -0
  65. package/build/src/akuma/providers/grok-build/index.js +70 -0
  66. package/build/src/akuma/providers/index.d.ts +5 -3
  67. package/build/src/akuma/providers/index.js +35 -56
  68. package/build/src/akuma/providers/opencode-sdk/events.d.ts +54 -0
  69. package/build/src/akuma/providers/opencode-sdk/events.js +235 -0
  70. package/build/src/akuma/providers/opencode-sdk/index.d.ts +33 -0
  71. package/build/src/akuma/providers/opencode-sdk/index.js +308 -0
  72. package/build/src/akuma/providers/opencode-sdk/session.d.ts +26 -0
  73. package/build/src/akuma/providers/opencode-sdk/session.js +63 -0
  74. package/build/src/akuma/providers/pi/events.d.ts +33 -0
  75. package/build/src/akuma/providers/pi/events.js +166 -0
  76. package/build/src/akuma/providers/pi/index.d.ts +11 -0
  77. package/build/src/akuma/providers/pi/index.js +191 -0
  78. package/build/src/akuma/publication.d.ts +3 -3
  79. package/build/src/akuma/publication.js +28 -40
  80. package/build/src/akuma/requests.d.ts +9 -6
  81. package/build/src/akuma/requests.js +95 -65
  82. package/build/src/alias/index.d.ts +4 -3
  83. package/build/src/alias/index.js +12 -13
  84. package/build/src/body/decode.js +7 -1
  85. package/build/src/body/region.d.ts +2 -0
  86. package/build/src/body/region.js +77 -7
  87. package/build/src/body/render.js +2 -1
  88. package/build/src/body/shape.js +7 -1
  89. package/build/src/body/verification.js +19 -4
  90. package/build/src/cli/accepted.d.ts +18 -12
  91. package/build/src/cli/accepted.js +73 -34
  92. package/build/src/cli/actor.js +3 -3
  93. package/build/src/cli/commands/akuma-invoke.d.ts +44 -19
  94. package/build/src/cli/commands/akuma-invoke.js +101 -52
  95. package/build/src/cli/commands/akuma.d.ts +27 -9
  96. package/build/src/cli/commands/akuma.js +151 -80
  97. package/build/src/cli/commands/contract.d.ts +155 -0
  98. package/build/src/cli/commands/contract.js +20 -0
  99. package/build/src/cli/commands/install.js +2 -0
  100. package/build/src/cli/commands/task-invoke.d.ts +19 -4
  101. package/build/src/cli/commands/task-invoke.js +65 -17
  102. package/build/src/cli/commands/task-query.d.ts +5 -0
  103. package/build/src/cli/commands/task-query.js +247 -0
  104. package/build/src/cli/commands/task.d.ts +3 -1
  105. package/build/src/cli/commands/task.js +52 -14
  106. package/build/src/cli/coordinates.d.ts +18 -0
  107. package/build/src/cli/coordinates.js +120 -0
  108. package/build/src/cli/draft.d.ts +8 -0
  109. package/build/src/cli/draft.js +96 -0
  110. package/build/src/cli/invoke.d.ts +9 -3
  111. package/build/src/cli/invoke.js +287 -108
  112. package/build/src/cli/main.js +54 -7
  113. package/build/src/cli/parse.d.ts +21 -117
  114. package/build/src/cli/parse.js +79 -84
  115. package/build/src/cli/render/akuma-tool-command.d.ts +6 -0
  116. package/build/src/cli/render/akuma-tool-command.js +144 -0
  117. package/build/src/cli/render/akuma-tool.d.ts +4 -2
  118. package/build/src/cli/render/akuma-tool.js +35 -5
  119. package/build/src/cli/render/akuma.d.ts +3 -1
  120. package/build/src/cli/render/akuma.js +247 -212
  121. package/build/src/cli/render/audit.d.ts +3 -0
  122. package/build/src/cli/render/audit.js +104 -0
  123. package/build/src/cli/render/catalog.d.ts +2 -0
  124. package/build/src/cli/render/catalog.js +16 -0
  125. package/build/src/cli/render/contract.d.ts +3 -3
  126. package/build/src/cli/render/contract.js +200 -54
  127. package/build/src/cli/render/kanshi.js +272 -129
  128. package/build/src/cli/render/receipt.d.ts +19 -0
  129. package/build/src/cli/render/receipt.js +106 -0
  130. package/build/src/cli/render/refusal.d.ts +16 -2
  131. package/build/src/cli/render/refusal.js +88 -3
  132. package/build/src/cli/render/region.d.ts +2 -0
  133. package/build/src/cli/render/region.js +17 -0
  134. package/build/src/cli/render/task.d.ts +2 -1
  135. package/build/src/cli/render/task.js +223 -60
  136. package/build/src/cli/render/terminal.d.ts +20 -0
  137. package/build/src/cli/render/terminal.js +121 -0
  138. package/build/src/cli/render/text.js +11 -3
  139. package/build/src/cli/result.d.ts +126 -19
  140. package/build/src/cli/usage.d.ts +1 -0
  141. package/build/src/cli/usage.js +3 -0
  142. package/build/src/contract-worktree.d.ts +44 -0
  143. package/build/src/contract-worktree.js +251 -0
  144. package/build/src/coordination/durable-file.d.ts +5 -1
  145. package/build/src/coordination/durable-file.js +57 -10
  146. package/build/src/coordination/sqlite-transaction-lock.d.ts +4 -0
  147. package/build/src/coordination/sqlite-transaction-lock.js +22 -5
  148. package/build/src/core/facts/codec.js +23 -4
  149. package/build/src/core/facts/eligibility.d.ts +1 -10
  150. package/build/src/core/facts/eligibility.js +0 -49
  151. package/build/src/core/facts/fold.js +1 -6
  152. package/build/src/core/facts/gate.d.ts +1 -0
  153. package/build/src/core/facts/gate.js +1 -0
  154. package/build/src/core/facts/observation.d.ts +3 -0
  155. package/build/src/core/facts/observation.js +12 -0
  156. package/build/src/core/facts/types.d.ts +10 -3
  157. package/build/src/core/subject.js +2 -2
  158. package/build/src/core/verbs/amend.d.ts +1 -1
  159. package/build/src/core/verbs/amend.js +3 -18
  160. package/build/src/core/verbs/bind.js +2 -16
  161. package/build/src/core/verbs/deliver.d.ts +1 -1
  162. package/build/src/core/verbs/deliver.js +14 -4
  163. package/build/src/core/verbs/placement.d.ts +1 -1
  164. package/build/src/core/verbs/placement.js +7 -9
  165. package/build/src/dispatch/index.d.ts +5 -3
  166. package/build/src/dispatch/index.js +30 -21
  167. package/build/src/duration.d.ts +10 -0
  168. package/build/src/duration.js +22 -0
  169. package/build/src/git/admission.d.ts +2 -2
  170. package/build/src/git/admission.js +33 -23
  171. package/build/src/git/hooks.d.ts +15 -0
  172. package/build/src/git/hooks.js +70 -18
  173. package/build/src/git/identity.d.ts +5 -1
  174. package/build/src/git/identity.js +23 -4
  175. package/build/src/git/integration.d.ts +48 -0
  176. package/build/src/git/integration.js +250 -0
  177. package/build/src/git/observe.d.ts +29 -15
  178. package/build/src/git/observe.js +185 -76
  179. package/build/src/git/read-observation.d.ts +41 -0
  180. package/build/src/git/read-observation.js +361 -0
  181. package/build/src/git/reconcile.d.ts +17 -5
  182. package/build/src/git/reconcile.js +305 -109
  183. package/build/src/git/repository.d.ts +41 -18
  184. package/build/src/git/repository.js +220 -114
  185. package/build/src/git/scratch.d.ts +17 -0
  186. package/build/src/git/scratch.js +73 -0
  187. package/build/src/git/target-placement.d.ts +92 -0
  188. package/build/src/git/target-placement.js +375 -0
  189. package/build/src/git/tender.d.ts +49 -0
  190. package/build/src/git/tender.js +63 -0
  191. package/build/src/git/terminal-seal.d.ts +24 -0
  192. package/build/src/git/terminal-seal.js +89 -0
  193. package/build/src/git/tree.d.ts +2 -2
  194. package/build/src/git/tree.js +4 -0
  195. package/build/src/git/workspace.d.ts +53 -0
  196. package/build/src/git/workspace.js +139 -0
  197. package/build/src/identity/selector.d.ts +6 -0
  198. package/build/src/identity/selector.js +19 -0
  199. package/build/src/index.d.ts +4 -2
  200. package/build/src/index.js +2 -1
  201. package/build/src/kanshi/index.d.ts +2 -2
  202. package/build/src/kanshi/index.js +1 -1
  203. package/build/src/kanshi/read.d.ts +7 -3
  204. package/build/src/kanshi/read.js +245 -45
  205. package/build/src/kanshi/report.d.ts +81 -6
  206. package/build/src/kanshi/select.d.ts +5 -0
  207. package/build/src/kanshi/select.js +33 -1
  208. package/build/src/library/address.d.ts +57 -0
  209. package/build/src/library/address.js +165 -0
  210. package/build/src/library/akuma-creation.d.ts +16 -7
  211. package/build/src/library/akuma-creation.js +96 -22
  212. package/build/src/library/audit.d.ts +18 -0
  213. package/build/src/library/audit.js +44 -0
  214. package/build/src/library/bind.d.ts +21 -0
  215. package/build/src/library/bind.js +56 -0
  216. package/build/src/library/catalog.d.ts +58 -0
  217. package/build/src/library/catalog.js +69 -0
  218. package/build/src/library/configuration.d.ts +6 -15
  219. package/build/src/library/configuration.js +14 -17
  220. package/build/src/library/contract.d.ts +23 -49
  221. package/build/src/library/contract.js +171 -185
  222. package/build/src/library/delivery.d.ts +24 -0
  223. package/build/src/library/delivery.js +21 -0
  224. package/build/src/library/fleet.d.ts +65 -0
  225. package/build/src/library/fleet.js +153 -0
  226. package/build/src/library/input.d.ts +3 -0
  227. package/build/src/library/input.js +19 -0
  228. package/build/src/library/keiyaku.d.ts +18 -3
  229. package/build/src/library/keiyaku.js +12 -1
  230. package/build/src/library/mutation.d.ts +39 -0
  231. package/build/src/library/mutation.js +37 -0
  232. package/build/src/library/reconcile.d.ts +29 -0
  233. package/build/src/library/reconcile.js +179 -0
  234. package/build/src/library/refusal.d.ts +21 -0
  235. package/build/src/library/refusal.js +29 -0
  236. package/build/src/library/region.d.ts +14 -1
  237. package/build/src/library/region.js +18 -4
  238. package/build/src/library/repo.d.ts +4 -13
  239. package/build/src/library/repo.js +14 -24
  240. package/build/src/protocol/attempt.d.ts +16 -3
  241. package/build/src/protocol/attempt.js +41 -10
  242. package/build/src/protocol/bind.d.ts +9 -2
  243. package/build/src/protocol/bind.js +48 -40
  244. package/build/src/protocol/intent.d.ts +57 -20
  245. package/build/src/protocol/intent.js +55 -79
  246. package/build/src/protocol/operations.d.ts +152 -43
  247. package/build/src/protocol/operations.js +482 -166
  248. package/build/src/protocol/outcome.d.ts +14 -3
  249. package/build/src/protocol/outcome.js +11 -3
  250. package/build/src/protocol/placement.d.ts +41 -0
  251. package/build/src/protocol/placement.js +147 -0
  252. package/build/src/protocol/read/documents.d.ts +2 -2
  253. package/build/src/protocol/read/documents.js +4 -4
  254. package/build/src/protocol/read/status.d.ts +18 -5
  255. package/build/src/protocol/read/status.js +73 -13
  256. package/build/src/protocol/run.d.ts +49 -7
  257. package/build/src/protocol/run.js +53 -25
  258. package/build/src/runtime/proc/line-rpc.d.ts +4 -8
  259. package/build/src/runtime/proc/line-rpc.js +22 -28
  260. package/build/src/runtime/proc/run.d.ts +23 -21
  261. package/build/src/runtime/proc/run.js +123 -89
  262. package/build/src/runtime/proc/stdio.d.ts +18 -0
  263. package/build/src/runtime/proc/stdio.js +58 -0
  264. package/build/src/settings.d.ts +7 -1
  265. package/build/src/settings.js +32 -17
  266. package/build/src/settlement/fence.d.ts +5 -0
  267. package/build/src/settlement/fence.js +14 -0
  268. package/build/src/settlement/holder.d.ts +35 -4
  269. package/build/src/settlement/holder.js +127 -28
  270. package/build/src/settlement/settle.d.ts +9 -1
  271. package/build/src/settlement/settle.js +74 -37
  272. package/build/src/task/board.d.ts +23 -5
  273. package/build/src/task/board.js +17 -10
  274. package/build/src/task/compose.d.ts +2 -2
  275. package/build/src/task/compose.js +18 -10
  276. package/build/src/task/context.d.ts +3 -3
  277. package/build/src/task/context.js +15 -20
  278. package/build/src/task/document.d.ts +2 -1
  279. package/build/src/task/document.js +15 -5
  280. package/build/src/task/index.d.ts +27 -15
  281. package/build/src/task/index.js +57 -35
  282. package/build/src/task/operations.d.ts +38 -13
  283. package/build/src/task/operations.js +80 -46
  284. package/build/src/task/query.d.ts +67 -0
  285. package/build/src/task/query.js +279 -0
  286. package/build/src/task/store.d.ts +5 -7
  287. package/build/src/task/store.js +43 -28
  288. package/build/src/verification/declaration.d.ts +1 -0
  289. package/build/src/verification/execution.d.ts +51 -0
  290. package/build/src/verification/execution.js +108 -0
  291. package/build/src/workspace-place.d.ts +41 -0
  292. package/build/src/workspace-place.js +386 -0
  293. package/build/src/world.d.ts +24 -0
  294. package/build/src/world.js +136 -0
  295. package/package.json +8 -4
  296. package/build/src/akuma/activity.d.ts +0 -66
  297. package/build/src/akuma/activity.js +0 -139
  298. package/build/src/akuma/providers/claude.js +0 -305
  299. package/build/src/context-root.d.ts +0 -4
  300. package/build/src/context-root.js +0 -15
  301. package/build/src/git/delivery.d.ts +0 -20
  302. package/build/src/git/delivery.js +0 -109
  303. package/build/src/git/verification.d.ts +0 -14
  304. package/build/src/git/verification.js +0 -56
  305. package/build/src/protocol/read/audit.d.ts +0 -25
  306. package/build/src/protocol/read/audit.js +0 -39
  307. package/build/src/verification/producer.d.ts +0 -23
  308. package/build/src/verification/producer.js +0 -54
package/README.md CHANGED
@@ -1,16 +1,141 @@
1
- # Keiyaku v4
1
+ # Keiyaku
2
2
 
3
- Keiyaku v4 is a clean implementation of an agent-facing contract workflow.
3
+ **Keiyaku is not designed for you, but for your frontier model.**
4
4
 
5
- The first milestone is intentionally narrow: a Git-backed facts kernel with
6
- per-contract append-only journals, Git-tree evidence, atomic path-set CAS,
7
- and tests that prove clone and garbage-collection durability.
5
+ **Current world:** frontier models are formidable and expensive. Cheap
6
+ models work fine, but they drift, and they always report success. And
7
+ human attention is the scarcest of the three.
8
8
 
9
- No v3 runtime code is wired into this repository.
9
+ So Keiyaku gives each of the three the right job.
10
+
11
+ **The frontier gets an exoskeleton, not a cage.** It breaks goals apart,
12
+ authors explicit contracts, commands a fleet in parallel. Its limited
13
+ context goes to decision-grade signal — the state of every contract,
14
+ never individual workers. A worker can drift, stall, or lie; a contract
15
+ cannot.
16
+
17
+ **The workers get contracts, not trust.** Terms in bytes before the
18
+ first edit; every delivery judged mechanically against the diff.
19
+ Whatever drifted or lied never reaches the board.
20
+
21
+ **You step back.** Delegate when possible — by default, everything goes
22
+ to the frontier; the verbs are its to type. Steer when necessary — the
23
+ top was never handed over. The wheel stays yours.
24
+
25
+ ---
26
+
27
+ ## What a contract looks like
28
+
29
+ ```markdown
30
+ # Ship typed Task query
31
+
32
+ ## Context
33
+ Task reads scan documents ad hoc.
34
+
35
+ ## Objective
36
+ One typed query surface over the whole board.
37
+
38
+ ## Design
39
+ A single evaluator over persisted facts.
40
+
41
+ ## Region
42
+ ```
43
+ src/task/**
44
+ tests/task-*.test.ts
45
+ ```
46
+
47
+ ## Criteria
48
+ ### Query is typed
49
+ The CLI parses a predicate; the evaluator never sees a raw shell string.
50
+
51
+ ### Reads stay Task-owned
52
+ Query reads only Task facts. No Contract. No Akuma.
53
+
54
+ ## Verification
55
+ ```bash
56
+ npm test
57
+ ```
58
+ ```
59
+
60
+ ## What a deal looks like
61
+
62
+ ```bash
63
+ keiyaku bind - < keiyaku.md # terms written; an isolated worktree appears
64
+ keiyaku call worker - # a worker goes in
65
+ keiyaku deliver # tendered; Verification runs; gates judge
66
+ keiyaku review --satisfied # attested; main moves with a commit receipt
67
+ ```
68
+
69
+ ## What the journal records
70
+
71
+ One real deal, pulled from this repo's own journal:
72
+
73
+ ```text
74
+ $ keiyaku audit kei/add-acp-provider-and-grok-build-profile
75
+
76
+ accepted audit kei/add-acp-provider-and-grok-build-profile head=0508f7eb9cb738bcab06060b13ff1a96d36e3754
77
+ report {"reworks":1,"reviews":2,"timeline":[
78
+ {"kind":"bind","at":"2026-08-14T08:18:36.224Z"},
79
+ {"kind":"deliver","at":"2026-08-14T13:02:08.339Z"},
80
+ {"kind":"attestation","gate":"reviewed","verdict":"unsatisfied","summary":
81
+ "Implementation review found no blocking code issues; authenticated official
82
+ Grok smoke remains unavailable because this host has no grok binary."},
83
+ {"kind":"attestation","gate":"verified","verdict":"satisfied","summary":"[1 bash exit 0] …"}]}
84
+ ```
85
+
86
+ The review said no — with a reason, in bytes, on the journal. The deal
87
+ did not land until the gates had current evidence.
88
+
89
+ ## The board
90
+
91
+ `keiyaku status` is the one screen. A slice of this repository, right now:
92
+
93
+ ```text
94
+ kanshi ─ 7 keiyaku · 18 akuma · 286 task ─ /Users/astrosheep/Developer/keiyaku-v4 main 9cfdca6017633e51827b9b2eba3c76a7fe08e05f
95
+
96
+ keiyaku 7
97
+ ⧗ kei/add-acp-provider-and-grok-build-profile pending-delivery
98
+ worktree · integration c5cafef6 · -> refs/heads/main
99
+ ! reviewed
100
+ ⧗ kei/align-task-cli-truth-promises waiting
101
+ ? reviewed
102
+ held by task/align-task-cli-truth-promises-for-ready-compose
103
+
104
+ akuma 18
105
+ ● aku/expert-akuma/a7aafc9e running
106
+ alias @process-custody-lead
107
+ keiyaku kei/make-process-custody-capability-honest (active)
108
+ ○ aku/design-akuma/cc53ef08 asleep
109
+ alias @timeline-design
110
+ ? aku/grok/95d90b7d stranded
111
+ alias @acp-provider-impl
112
+
113
+ task 8 · 5 ready · 2 held
114
+ ● task/align-task-cli-truth-promises-for-ready-compose in_progress
115
+ Align Task CLI truth promises for ready compose and world absence
116
+ P0 · keiyaku kei/align-task-cli-truth-promises (active)
117
+ ```
118
+
119
+ Marks accelerate scanning; the words carry the state.
120
+
121
+ ## The worker
122
+
123
+ ```markdown
124
+ ---
125
+ provider: claude-agent-sdk
126
+ model: claude-sonnet-4-5
127
+ access: write
128
+ description: Repository implementation agent
129
+ ---
130
+ Make scoped changes and run relevant tests.
131
+ ```
132
+
133
+ One Markdown file, one worker. `keiyaku call worker` summons it.
10
134
 
11
135
  ## Install
12
136
 
13
- ```sh
137
+ ```bash
14
138
  npm install -g @astrosheep/keiyaku
15
- keiyaku --help
16
139
  ```
140
+
141
+ Node ≥ 22.19. Product law lives in [`docs/`](docs/README.md).
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "keiyaku",
3
- "version": "0.1.0",
4
- "description": "Use the Keiyaku v4 contract, task, and Akuma CLI.",
3
+ "version": "0.1.0+codex.20260815181541",
4
+ "description": "Use the Keiyaku contract, task, and Akuma CLI.",
5
5
  "author": { "name": "Keiyaku" },
6
6
  "skills": "./skills/"
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "keiyaku",
3
- "version": "0.1.0",
4
- "description": "Use the Keiyaku v4 contract, task, and Akuma CLI.",
3
+ "version": "0.1.0+codex.20260815181541",
4
+ "description": "Use the Keiyaku contract, task, and Akuma CLI.",
5
5
  "author": {
6
6
  "name": "Keiyaku"
7
7
  },
@@ -9,10 +9,10 @@
9
9
  "interface": {
10
10
  "displayName": "Keiyaku",
11
11
  "shortDescription": "Use Keiyaku in Codex.",
12
- "longDescription": "Keiyaku adds the v4 agent-facing workflow CLI.",
12
+ "longDescription": "Keiyaku adds the agent-facing workflow CLI.",
13
13
  "developerName": "Keiyaku",
14
14
  "category": "Productivity",
15
15
  "capabilities": [],
16
- "defaultPrompt": "Use Keiyaku v4 to coordinate this work."
16
+ "defaultPrompt": "Use Keiyaku to coordinate this work."
17
17
  }
18
18
  }
@@ -1,11 +1,11 @@
1
1
  import { readFile } from "node:fs/promises";
2
2
  import { fileURLToPath } from "node:url";
3
3
 
4
- const skills = ["keiyaku", "keiyaku-task", "keiyaku-workflow", "keiyaku-akuma"]
4
+ const skills = ["keiyaku", "keiyaku-task", "keiyaku-bind", "keiyaku-workflow", "keiyaku-akuma"]
5
5
  .map((name) => fileURLToPath(new URL(`./skills/${name}/SKILL.md`, import.meta.url)));
6
6
 
7
7
  export default {
8
- id: "keiyaku-v4",
8
+ id: "keiyaku",
9
9
  server: async () => ({
10
10
  config: async (config) => {
11
11
  const instructions = config.instructions ?? (config.instructions = []);
@@ -1,6 +1,6 @@
1
1
  {
2
- "name": "keiyaku-v4-harness",
3
- "version": "0.1.0",
2
+ "name": "keiyaku-harness",
3
+ "version": "0.1.0+codex.20260815181541",
4
4
  "type": "module",
5
5
  "main": "./opencode.js",
6
6
  "keywords": ["pi-package"],
@@ -11,24 +11,32 @@ read `<command> --help` before using flags.
11
11
  ## Model
12
12
 
13
13
  - `task` is planning; see `keiyaku-task`.
14
- - A Contract is delivery authority; see `keiyaku-workflow`.
14
+ - A Contract is delivery authority; see `keiyaku-bind` to author and bind one,
15
+ then `keiyaku-workflow` for the remaining lifecycle.
15
16
  - An Akuma is a callable worker; see `keiyaku-akuma`.
16
17
 
18
+ Settings owns named gate sets. Omitting `--gates` selects `gates.default`, or
19
+ freezes an empty gate list when that entry is absent. `--gates <name>` selects
20
+ one configured set; it does not add a literal gate word.
21
+
17
22
  ## Quick Start
18
23
 
19
24
  ```bash
20
25
  keiyaku -C <repo> task add "title"
21
26
  keiyaku -C <repo> task start <task-id>
22
- keiyaku -C <repo> bind -
27
+ keiyaku -C <repo> bind [--task <task-id>] -
23
28
  keiyaku -C <repo> status
24
29
  keiyaku -C <repo> deliver [<contract>|@<contract>]
25
30
  keiyaku -C <repo> review [<contract>|@<contract>] --satisfied
26
31
  ```
27
32
 
28
33
  ```bash
29
- keiyaku -C <repo> call <akuma> [--contract <kei/...>] [--alias @name] [--workdir <path>] [--wait [--timeout <duration>] | -d | --detach] [--json] -
30
- keiyaku -C <repo> wait <aku/...>
31
- keiyaku -C <repo> tell <aku/...> -
34
+ keiyaku -C <cwd> call <akuma-name> [--contract <kei/...>] [--alias @name] [--wait <duration> | -d | --detach] [--json] (<prompt> | -)
35
+ keiyaku -C <repo> wait <akuma-selector>... [--any | --all]
36
+ keiyaku -C <repo> tell <aku/...|@alias> (<prompt> | -)
32
37
  ```
33
38
 
39
+ `-C` is the invocation and Akuma execution cwd. Add `--repo <path>` only when
40
+ a Contract or Dispatch reader must use a different Git repository.
41
+
34
42
  Use text by default; add `--json` when a script needs structured output.
@@ -5,46 +5,105 @@ description: Use when delegating work to, supervising, steering, inspecting, for
5
5
 
6
6
  # Keiyaku Akuma
7
7
 
8
- An Akuma is a durable callable worker projection. Its complete id is
9
- `aku/<archetype>/<hex8>`; keep that id for recovery.
8
+ An Akuma is a durable callable worker. Its complete identity is
9
+ `aku/<archetype>/<hex8>` keep it; it is how you address the same worker
10
+ later. An Alias is a movable world-local selector usable wherever a direct id
11
+ is accepted; the identity underneath never changes.
10
12
 
11
- ## Choose A Verb
13
+ ## Start One
12
14
 
13
15
  ```bash
14
- keiyaku -C <repo> call <akuma> [--contract <kei/...>] [--alias @name] [--workdir <path>] [--wait [--timeout <duration>] | -d | --detach] [--json] -
15
- keiyaku -C <repo> wait <aku/...> [--timeout <duration>]
16
- keiyaku -C <repo> tell <aku/...> -
17
- keiyaku -C <repo> interrupt <aku/...> -
18
- keiyaku -C <repo> history <aku/...>
19
- keiyaku -C <repo> fork <aku/...> --at <historyId>
20
- keiyaku -C <repo> kill <aku/...>
16
+ keiyaku -C <cwd> call <akuma-name> [--alias @name] [--wait <duration> | -d | --detach] [--json] (<prompt> | -)
21
17
  ```
22
18
 
23
- `call` starts from an Archetype, requires a final stdin body, and waits up to
24
- five minutes by default. Use `-d` or `--detach` to return after birth. `tell` continues
25
- the same projection, including after it has answered. `fork` starts a child
26
- from one exact retained answered-turn coordinate and leaves the source alone.
27
- `interrupt` puts down the current body synchronously, then records the tell;
28
- it is not terminal kill. `kill` records death and returns typed physical
29
- evidence.
19
+ Give the worker's initial prompt as one argument (quote it when it contains
20
+ spaces), or use final `-` to read it from stdin. These forms are mutually
21
+ exclusive. Decide up front whether you will stay:
30
22
 
31
- ## Observe
23
+ - The default observes up to five minutes and writes the complete answer when
24
+ it arrives inside that window. `--wait <duration>` replaces that window.
25
+ - `-d` / `--detach` returns right after birth with the AkuId. Use it when the
26
+ work outlives your attention; come back with `wait`.
27
+
28
+ `--alias @name` assigns that world-local selector to the born Akuma. If the
29
+ Alias already points elsewhere, it moves to the born Akuma. The worker's
30
+ execution cwd is exactly `-C <path>`, or your own cwd when `-C` is omitted.
31
+
32
+ ## Archetypes
33
+
34
+ An Archetype is a Markdown file at `~/.keiyaku/akuma/<name>.md`. Its
35
+ frontmatter selects the provider and may declare `model`, `effort`,
36
+ `readonly`, `network`, and `description`; the body is an optional system
37
+ prompt, and an empty body keeps the harness default. Write a new one when no
38
+ existing file grants the permissions and stance the work needs; a worker never
39
+ outgrows its Archetype mid-life.
40
+
41
+ ## Watch
42
+
43
+ ```bash
44
+ keiyaku status # deep fleet observation
45
+ keiyaku status <aku/...|@alias> # one worker's snapshot
46
+ keiyaku ls aku/ # shallow catalog; also aku/<archetype>/ and "aku/*/*"
47
+ keiyaku wait <selector>... [--any | --all] [--timeout <duration>] [--json]
48
+ ```
49
+
50
+ `wait` accepts complete ids, aliases, and Akuma globs, resolved once into a
51
+ stable deduplicated set. One member needs no mode; two or more require exactly
52
+ one of `--any` or `--all`. A timeout returns the current real snapshot — never
53
+ a fabricated timeout state — and `--any` leaves the unfinished members
54
+ running.
55
+
56
+ ## Steer
32
57
 
33
58
  ```bash
34
- keiyaku -C <repo> status
35
- keiyaku -C <repo> status <aku/...>
36
- keiyaku -C <repo> wait <aku/...> --timeout 5m
37
- keiyaku -C <repo> history <aku/...> --before <index>
38
- keiyaku -C <repo> history <aku/...> --since <index>
39
- keiyaku -C <repo> history <aku/...> --last
59
+ keiyaku tell <aku/...|@alias> (<prompt> | -)
60
+ keiyaku tell <aku/...|@alias> --interrupt (<prompt> | -)
40
61
  ```
41
62
 
42
- Bare `status` shows the compact fleet. Exact `status <aku/...>` and `wait`
43
- share the public status carrier; a wait timeout returns the current snapshot,
44
- not a fabricated timeout state. History cursors are persistent activity
45
- sequences and `--before`/`--since` are exclusive. `--last` writes only the
46
- complete answer bytes. Use `--json` when a script needs the typed values.
63
+ Give `tell` one prompt argument (quote it when it contains spaces) or final `-`
64
+ for stdin, never both.
65
+ `tell` continues the same worker: it steers a live Body in place, or when
66
+ none is running, including after an answer records the message durably and
67
+ wakes a successor. `tell --interrupt` puts down the current Body synchronously
68
+ first, then hands the message to the successor; it is not a kill. Choose plain
69
+ `tell` when the current attempt should finish with your guidance folded in;
70
+ choose `--interrupt` when the current attempt itself is the problem.
71
+
72
+ ## Take The Answer
73
+
74
+ ```bash
75
+ keiyaku history <aku/...|@alias> --last
76
+ keiyaku history <aku/...|@alias> [--before <N> | --since <N>] [--limit <N>]
77
+ ```
78
+
79
+ `--last` writes exactly the complete answer bytes of the latest answered turn
80
+ and says so plainly when no answer exists yet. Snapshot rows elsewhere may
81
+ clip long text; the terminal answer from `call`/`wait` and the bytes from
82
+ `--last` are never clipped — when you need the full result, take it from one
83
+ of those. Cursor reads page the activity timeline; `--before` and `--since`
84
+ are exclusive sequence cursors. `--limit` defaults to 50 and accepts at most
85
+ 5000 semantic rows.
86
+
87
+ ## Stop
88
+
89
+ ```bash
90
+ keiyaku kill <selector>...
91
+ ```
92
+
93
+ `kill` accepts the same id, alias, and glob selectors as `wait`. It stops the
94
+ current Body and records that it did; everything else survives — Heart,
95
+ session, history, pending Tells, and Body Requests — so a later `tell` wakes
96
+ the same worker where it left off. Killing pauses a worker; nothing is
97
+ deleted.
98
+
99
+ ## Branch
100
+
101
+ ```bash
102
+ keiyaku fork <aku/...|@alias> --at <historyId> [--alias @name]
103
+ ```
47
104
 
48
- Read the exact command help for duration syntax and provider-specific Archetype
49
- configuration. Do not use old `follow`, plural wait, `--after`, or `--at`
50
- index forms; they are not root commands.
105
+ `fork` starts a child from one exact retained answered-turn coordinate and
106
+ leaves the source untouched. It is a provider capability, not a guarantee:
107
+ when the provider cannot fork from that turn, the command refuses rather than
108
+ fabricating a fresh start. Take the `historyId` from `history` output; it must
109
+ name an answered turn.
@@ -0,0 +1,134 @@
1
+ ---
2
+ name: keiyaku-bind
3
+ description: Author and bind one Keiyaku delivery Contract. Use when deciding whether a bounded delivery is ready for Contract terms, writing those terms for an implementer, binding an existing Task with `bind --task`, choosing bind inputs, or interpreting the bind receipt and worktree handoff.
4
+ ---
5
+
6
+ # Keiyaku Bind
7
+
8
+ A Contract records a decision that already exists; writing terms does not
9
+ produce one. You supply **all high-level design and public-surface facts this
10
+ Keiyaku creates or changes**, and **all** pseudocode where ordering matters.
11
+ The worker is a cheap executor: every choice you leave open, it resolves —
12
+ possibly the way you like least, discovered at review and billed at review
13
+ prices.
14
+
15
+ ## Before You Bind
16
+
17
+ Bind is the last step of an investigation, never the first step of an idea.
18
+
19
+ - Design the delivery to the depth you could implement it yourself, against
20
+ the code as it is — not as you remember it. An unknown surfacing while
21
+ you design is the next investigation, not a detail for the worker.
22
+ - Walk the implementation path once, end to end. A step you cannot walk is
23
+ an unresolved fact.
24
+ - Observe active Contracts whose Regions intersect yours. Region overlap is a
25
+ prompt signal only; it does not by itself imply a logical conflict. The
26
+ caller decides autonomously whether to proceed in parallel or serialize.
27
+ - A decision settled elsewhere binds only its explicit words; converting it
28
+ into concrete shape is your job, and a question it left open goes back to
29
+ its decider, never to the worker.
30
+ - If the delivery must land documentation, you can draft its exact sentence
31
+ now. Cannot draft means unresolved design — "the worker will sort out the
32
+ docs" is a design gap in disguise.
33
+
34
+ Split complex work wherever independently acceptable delivery boundaries
35
+ exist. When a complex Keiyaku cannot be split without breaking one acceptance
36
+ boundary, bind one Contract and plan its fulfillment as explicit arcs. Treat
37
+ each arc as a chapter as in a work of literature, not as a task sequence.
38
+ Commission one current chapter at a time; never hand the whole undifferentiated
39
+ Contract to one Deliverer and trust it to finish everything in one pass.
40
+ Continue with `keiyaku-workflow` for the arc document and command.
41
+
42
+ Two tests close the gate:
43
+
44
+ - **Substitution.** Two workers who never met each deliver test-green from
45
+ your terms. If any external reader could tell the deliveries apart, that
46
+ fact is undecided — decide it and write it.
47
+ - **Rework.** For each blank: "if the worker picks what I like least, do I
48
+ demand rework?" Yes — write it. No — write nothing.
49
+
50
+ Public — anything visible outside the diff — is always yours to pin.
51
+ Private — helper names, decomposition, control flow — is the worker's;
52
+ its freedom comes from your genuine indifference, not from omission.
53
+
54
+ ## Author And Bind
55
+
56
+ `keiyaku -C <repo> bind --help` lists the options; only the heredoc is
57
+ stdin. Each section states what it must contain:
58
+
59
+ ~~~~bash
60
+ keiyaku -C <repo> bind - <<'KEIYAKU'
61
+ # <Delivery name — one decision, active voice; source of the kei/... identity>
62
+
63
+ ## Context
64
+ <Premises: coordinates of the governing decision or document, and facts a
65
+ reader would otherwise re-derive wrongly. Never narrative. If Objective and
66
+ Design read the same without a sentence here, delete it.>
67
+
68
+ ## Objective
69
+ <One observable end-state, judged done/not-done without reading Design.
70
+ If "and" joins independently acceptable outcomes, bind two Contracts. A
71
+ single outcome may still require several arcs during fulfillment.>
72
+
73
+ ## Design
74
+ <The closed decisions. A statement belongs here exactly when a test-green
75
+ candidate could still violate it: which module owns the change; the exact
76
+ public surface — each type with its fields, each verb with its success,
77
+ refusal, and error arms and their reason words; the persisted format; which
78
+ way data flows and where it commits or refuses; which parallel shapes are
79
+ forbidden. Helper names and equivalent control flow do not belong here —
80
+ they are the worker's.>
81
+
82
+ ```text
83
+ <pseudocode — only where ordering matters>
84
+ ```
85
+
86
+ ## Region
87
+ ```
88
+ <intended write patterns — planning evidence for overlap detection, never
89
+ ownership or the exact diff. Narrow enough that overlap is a real signal;
90
+ directory patterns end with `/`.>
91
+ ```
92
+
93
+ ## Criteria
94
+ ### <one observable condition>
95
+ <One accept/reject observation with its method: run this, observe that.
96
+ Decidable without consulting you.>
97
+
98
+ ## Verification
99
+ ```bash timeout=<honest bound>
100
+ <commands runnable exactly as written>
101
+ ```
102
+ KEIYAKU
103
+ ~~~~
104
+
105
+ Each declaration may set an individual timeout in its fence info string, using
106
+ an explicit duration unit such as `bash timeout=5m`. Omit it for an unbounded
107
+ declaration; there is no Verification-wide timeout.
108
+
109
+ For a saved document:
110
+
111
+ ```bash
112
+ keiyaku -C <repo> bind - < CONTRACT.md
113
+ keiyaku -C <repo> bind --task <task/...> - < CONTRACT.md
114
+ ```
115
+
116
+ Use `--task` only for an existing Task with scheduling or dependency value;
117
+ do not create one just to mirror the Contract.
118
+
119
+ ## Authority Order
120
+
121
+ > Settled upstream decisions and their documentation → this Contract → worker
122
+ > brief (zero authority) → review evidence (witnessed fact, never law).
123
+
124
+ Gaps flow upstream, never down: a design gap found by a worker or reviewer
125
+ returns to you, never filled silently downstream.
126
+
127
+ ## Read The Receipt
128
+
129
+ Treat the receipt as the handoff. Keep the complete `kei/...` identity, work
130
+ in the reported managed worktree when one was created, and retain the target
131
+ and gate facts it reports. A waiting receipt means prerequisites remain; it
132
+ is not a second authoring workflow.
133
+
134
+ Continue the delivery with `keiyaku-workflow`.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Keiyaku Bind"
3
+ short_description: "Author and bind a delivery Contract."
4
+ default_prompt: "Use $keiyaku-bind to author and bind this delivery."
@@ -7,7 +7,13 @@ description: "Use when planning work in a Keiyaku v4 repo: add tasks, wire depen
7
7
 
8
8
  Task is a directory-context planning product. It is separate from Contract
9
9
  delivery and Akuma execution. A task records intent; `start` does not execute
10
- it and no task command binds a Contract.
10
+ it and no task command binds a Contract. Task use is optional: create one only
11
+ when planning needs a durable reader such as priority, dependencies, readiness,
12
+ or coordination across deliveries. Do not create one as boilerplate before
13
+ binding a Contract. Contract `bind --task <task/...>` optionally associates an
14
+ existing Task through Settlement-owned TaskHolder: claim settles the current
15
+ held Task to `done`, and abandon releases it. Task Markdown carries no Contract
16
+ field.
11
17
 
12
18
  ## Lifecycle
13
19
 
@@ -55,8 +61,37 @@ keiyaku task update <task-id> --title <text>
55
61
  keiyaku task namespace [<namespace>]
56
62
  ```
57
63
 
58
- Use `--json` on any command when a script must inspect the typed result. Use
59
- `task compose -` for one atomic tree/graph edit; read its command help for the
60
- composition grammar. Relations are explicit facts: `needs` orders work,
61
- `parent` groups it, `supersedes` navigates replacement, and `relates` does not
62
- affect readiness.
64
+ Use `--json` on any command when a script must inspect the typed result.
65
+ Relations are explicit facts: `needs` orders work, `parent` groups it,
66
+ `supersedes` navigates replacement, and `relates` does not affect readiness.
67
+
68
+ ## Batch Create Or Modify
69
+
70
+ Use `task compose -` to create and modify multiple Tasks in one planning
71
+ document:
72
+
73
+ ```bash
74
+ keiyaku task compose - <<'EOF'
75
+ ns=feature
76
+ + Parent pri=0
77
+ Parent body.
78
+ + Child needs=@task/existing
79
+ @task/existing pri=1 relates+=@task/other
80
+ Replacement body.
81
+ EOF
82
+ ```
83
+
84
+ - Optional first line `ns=<segment/...>` selects the allocation namespace;
85
+ `ns=` selects root.
86
+ - `+ <title>` creates a Task. `@task/<id>` modifies an existing Task.
87
+ - Two spaces of indentation assign the preceding shallower Task as `parent`.
88
+ - Inline assignments are `pri=`, `parent=`, `needs=`, `supersedes=`, and
89
+ `relates=`. Relation values are comma-separated `@task/...` references.
90
+ - `=` replaces or clears a field. `+=` appends only to `needs`, `supersedes`,
91
+ or `relates`.
92
+ - Prose after a node replaces its body; bare `body=` clears it. Prefix body
93
+ lines beginning with `+ `, `@task/`, or `\` with one `\`.
94
+
95
+ Compose does not change Task lifecycle state. Each changed Task is admitted
96
+ independently; an incomplete result returns a canonical draft for the remaining
97
+ batch.