@astrosheep/keiyaku 2.9.11 → 2.9.12

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 (48) hide show
  1. package/README.md +62 -72
  2. package/build/.tsbuildinfo +1 -1
  3. package/build/agents/providers/claude-agent-sdk/adapter.js +15 -2
  4. package/build/cli/commands/contract/bind/meta.js +4 -4
  5. package/build/cli/commands/metadata.js +3 -2
  6. package/build/cli/commands/projection/kill/handler.js +4 -5
  7. package/build/cli/commands/shared.js +1 -1
  8. package/build/cli/commands/task/catalog.js +2 -0
  9. package/build/cli/commands/task/compose/handler.js +18 -0
  10. package/build/cli/commands/task/compose/meta.js +10 -0
  11. package/build/cli/flags.js +5 -1
  12. package/build/cli/index.js +11 -6
  13. package/build/cli/parse-flags.js +21 -21
  14. package/build/cli/parse-metadata.js +5 -2
  15. package/build/cli/parse-selectors.js +4 -4
  16. package/build/cli/parse.js +23 -23
  17. package/build/cli/projection-address.js +7 -7
  18. package/build/cli/render/task.js +27 -0
  19. package/build/cli/types.js +1 -1
  20. package/build/core/addressing.js +3 -3
  21. package/build/core/call/context.js +3 -3
  22. package/build/core/call/prompt.js +1 -1
  23. package/build/core/contract-view.js +1 -1
  24. package/build/core/draft.js +51 -22
  25. package/build/core/projection/generation/model.js +1 -1
  26. package/build/core/projection/generation/projection-generation-runner.js +13 -3
  27. package/build/core/projection/generation/transitions.js +10 -0
  28. package/build/core/projection/projection-history.js +1 -1
  29. package/build/core/projection/projection-kill.js +5 -4
  30. package/build/core/projection/projection-runner-lock.js +58 -229
  31. package/build/core/projection/projection-wait.js +2 -2
  32. package/build/core/projection/projection-wake.js +2 -0
  33. package/build/core/repository-ledger/claim-evidence.js +1 -1
  34. package/build/core/repository-ledger/current-state-store.js +455 -337
  35. package/build/core/repository-ledger/read-model.js +3 -3
  36. package/build/core/repository-ledger/write-transaction.js +15 -13
  37. package/build/core/sqlite-process-lifetime-lock.js +194 -0
  38. package/build/core/task/compose.js +327 -0
  39. package/build/core/task/index.js +1 -0
  40. package/build/core/task/settlement-git.js +69 -26
  41. package/build/core/task/task-git-store.js +1 -0
  42. package/build/core/task/task-store-repository.js +1 -0
  43. package/build/flow-error.js +6 -1
  44. package/build/generated/version.js +2 -2
  45. package/package.json +2 -2
  46. package/skills/keiyaku-akuma/SKILL.md +6 -1
  47. package/skills/keiyaku-task/SKILL.md +23 -1
  48. package/skills/keiyaku-workflow/SKILL.md +33 -18
package/README.md CHANGED
@@ -2,45 +2,56 @@
2
2
 
3
3
  契約 — a contract.
4
4
 
5
- Keiyaku is a CLI for coding agents. Not a developer tool with AI features: the
6
- intended reader of every command, receipt, and error message is a model. If a
7
- human is typing `keiyaku` by hand, something upstream has already gone wrong.
8
-
9
- The premise is old. Work you delegate to something more capable than
10
- accountable should be written down first. So here, a change begins as a
11
- contract, runs on an isolated branch, and lands only after settlement. The
12
- workers are called akuma 悪魔, devils. This is not branding. It is a
13
- reminder of the failure mode.
5
+ Keiyaku is an AI-first CLI: its user is a coding agent. Not a human writing
6
+ specs for an agent to implement an agent delegating to other agents,
7
+ running the whole loop itself: writing the terms, calling the worker,
8
+ supervising the run, settling the outcome.
9
+
10
+ That is why it is a contract system rather than a spec system. A spec relies
11
+ on someone with judgment reading it charitably; here both the worker and the
12
+ judge are models, and a model honors what you wrote, not what you meant. So
13
+ terms are binding, the worker — an akuma (悪魔, demon) — runs on an isolated
14
+ branch, gates and a reviewer judge the diff against the criteria alone, and
15
+ settlement is mechanical: the change lands on main with a commit-hash
16
+ receipt, or the branch is deleted. No human needs to be in the loop for any
17
+ step; nothing depends on anyone eyeballing anything.
14
18
 
15
19
  ```bash
16
20
  npm install -g @astrosheep/keiyaku
17
21
  ```
18
22
 
19
- Node ≥ 22.19, inside a git repository, with a clean worktree.
23
+ Node ≥ 22.19, inside a git repository with a clean worktree.
20
24
 
21
- ## Shape of a deal
25
+ ## One deal, end to end
22
26
 
23
- ```text
24
- task ─── bind ─── call ─── petition ─── claim
25
- ```
27
+ ```bash
28
+ # Write the terms: Title, Context, Objective, Design & Approach, Scope, Criteria.
29
+ # The criteria are read by the letter — precision goes here, not in prompts.
30
+ keiyaku bind - < contract.md
31
+
32
+ # Put an akuma on it. It works alone in the contract's own worktree.
33
+ keiyaku call worker-akuma --detach "fulfill the contract"
26
34
 
27
- `bind` opens a contract Title, Context, Objective, Design, Scope,
28
- Criteria and an isolated branch. A devil honors the letter of the criteria,
29
- not their spirit; the contract is where precision happens.
35
+ # It runs for as long as it needs. You are not its babysitter —
36
+ # but you can be:
37
+ keiyaku wait worker-akuma/3f21ab9e --timeout 10m
38
+ keiyaku tell worker-akuma/3f21ab9e "criteria 3 also covers the CLI output"
39
+ keiyaku kill worker-akuma/3f21ab9e # death is not an error state
30
40
 
31
- `call` projects a devil into the contract's worktree. While it runs: `tell` it
32
- things, `wait` on it, `kill` it. A finished run leaves an artifact; `revive`
33
- starts a new devil from one.
41
+ # Ask for judgment: gates run, a reviewer akuma reads the diff
42
+ # against the criteria.
43
+ keiyaku petition
34
44
 
35
- `petition` seals the delivery and enters settlement. Gates run, a reviewer
36
- reads, and then exactly one of two things happens: claim, and it lands on
37
- main — or forfeit, and the branch is gone. There is no third outcome and no
38
- quiet one.
45
+ # claim → the change lands on main, with a commit-hash receipt
46
+ # forfeit the branch is deleted; partial fulfillment is forfeiture
47
+ ```
48
+
49
+ Every step appends to the contract's ledger. `keiyaku log` replays any deal,
50
+ finished or dead, from its receipts.
39
51
 
40
- ## What state looks like
52
+ ## The board
41
53
 
42
- `keiyaku status` renders the watchtower 監視, kanshi. This is real output
43
- from this repository:
54
+ `keiyaku status` is the one screen of state. Real output:
44
55
 
45
56
  ```text
46
57
  kanshi ─────────────────────────────────────────────────────── 現世 b4c38cc
@@ -63,36 +74,14 @@ task 120
63
74
  + 108 ready · 9 blocked
64
75
  ```
65
76
 
66
- The rendering is itself under contract. `◆` may only mean a projection asserted
67
- alive — liveness is never inferred from output freshness. `⋮ 12 more` counts
68
- exactly twelve omitted rows. Durations are measured, exit codes are real, and a
69
- command that never finished says `never finished`. An agent parses this screen
70
- without heuristics because every glyph has one meaning, in writing, in
71
- [`docs/keiyaku-v3/product/ui-copy.md`](docs/keiyaku-v3/product/ui-copy.md).
72
-
73
- ## Surface
74
-
75
- | | |
76
- | --- | --- |
77
- | contract | `bind` `arc` `amend` `renew` `audit` `petition` `forfeit` `log` |
78
- | devils | `call` `tell` `wait` `kill` `revive` `status` `history` |
79
- | roster | `akuma list` `akuma show` |
80
- | tasks | `task add/show/ls/log/start/stop/hold/resume/done/drop/update/doctor` |
81
- | system | `guide` `completion` `dump-env` |
82
-
83
- Conventions an agent can rely on everywhere: a literal `-` selects stdin for
84
- long bodies; `--json` exists where structure matters; a rejected command names
85
- the legal grammar instead of guessing intent; `keiyaku <cmd> --help` is the
86
- single source of syntax.
77
+ Every glyph has exactly one meaning. `◆` is a projection asserted alive —
78
+ never inferred from output freshness. Durations are measured, exit codes are
79
+ real, and an agent parses this screen without heuristics.
87
80
 
88
- Tasks are a file-backed board inside the repository. Dependencies keep their
89
- distinct meanings — `parent`, `needs`, `supersedes`, `relates-to` — and every
90
- mutation is validated and micro-committed on its own.
81
+ ## An akuma is one Markdown file
91
82
 
92
- ## A devil is one file
93
-
94
- Filename is the name. Frontmatter selects the provider. The body is the
95
- instructions.
83
+ Filename is the name, frontmatter picks the provider and model, the body is
84
+ the standing instructions. That's all it takes to make one callable.
96
85
 
97
86
  ```markdown
98
87
  ---
@@ -104,11 +93,11 @@ Make scoped changes and run relevant tests.
104
93
  ```
105
94
 
106
95
  Providers: `codex-sdk`, `codex-app-server`, `claude-agent-sdk`,
107
- `opencode-sdk`, `pi`. Resolution is builtin, then `<KEIYAKU_HOME>/akuma/`,
108
- then `.keiyaku/akuma/`; a higher layer replaces the file whole, never
109
- field-merges.
96
+ `opencode-sdk`, `pi` one contract can be worked by any of them, and a
97
+ finished run leaves an artifact that `revive` can continue from, even across
98
+ sessions.
110
99
 
111
- `.keiyaku/settings.json` selects roles and gates, nothing else:
100
+ `.keiyaku/settings.json` assigns roles and gates:
112
101
 
113
102
  ```json
114
103
  {
@@ -118,25 +107,26 @@ field-merges.
118
107
  }
119
108
  ```
120
109
 
121
- ## What it writes
110
+ ## And the rest
122
111
 
123
112
  | | |
124
113
  | --- | --- |
125
- | `KEIYAKU.md` | the active contract |
126
- | `.keiyaku/` | devils, settings, task board, response history |
114
+ | contract | `bind` `arc` `amend` `renew` `audit` `petition` `forfeit` `log` |
115
+ | akuma | `call` `tell` `wait` `kill` `revive` `status` `history` |
116
+ | tasks | `task add/show/ls/log/start/stop/hold/resume/done/drop/update/doctor` |
117
+ | system | `guide` `completion` `dump-env` |
127
118
 
128
- ```gitignore
129
- .keiyaku/draft/
130
- .keiyaku/response/
131
- ```
119
+ `keiyaku task` is a file-backed planning board for work that isn't worth a
120
+ contract yet — typed dependencies, one micro-commit per change, promotion
121
+ into a contract when it's ready.
132
122
 
133
- ## Law
123
+ Conventions hold everywhere: a literal `-` reads stdin for long bodies,
124
+ `--json` where structure matters, and a rejected command states the legal
125
+ grammar instead of guessing intent. State lives in `KEIYAKU.md` (the active
126
+ contract) and `.keiyaku/` (akuma, settings, task board, history).
134
127
 
135
- Product and architecture law is registered in
136
- [`docs/keiyaku-v3/`](docs/keiyaku-v3/README.md). A document is normative only
137
- if the registry lists it; age, location, and confident prose grant nothing.
128
+ Full product documentation: [`docs/keiyaku-v3/`](docs/keiyaku-v3/README.md).
138
129
 
139
- Keiyaku is early and experimental. Breaking changes are intentional, and the
140
- current version is the only version.
130
+ Keiyaku is early and experimental breaking changes are intentional.
141
131
 
142
132
  MIT.