@astrosheep/keiyaku 2.9.10 → 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 +86 -45
  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
@@ -1,50 +1,87 @@
1
- # 契約 Keiyaku
1
+ # Keiyaku
2
2
 
3
- **You don't prompt an agent. You sign a contract with a devil.**
3
+ 契約 a contract.
4
4
 
5
- Keiyaku (契約, "contract") is a CLI where AI coding agents work under written terms: the change starts as a contract, runs on an isolated branch, and lands only after it survives your gates. The agents are called **akuma** (悪魔) — devils. Devils are excellent workers and terrible masters, which is why everything here is in writing.
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.
6
18
 
7
19
  ```bash
8
20
  npm install -g @astrosheep/keiyaku
9
21
  ```
10
22
 
11
- Node ≥ 22.19 · a git repo · a clean worktree. Dirty worktree = refused at the door.
23
+ Node ≥ 22.19, inside a git repository with a clean worktree.
12
24
 
13
- ## How a deal goes down
25
+ ## One deal, end to end
14
26
 
15
- ```text
16
- task bind call petition claim
17
- ───────► 📋 ───────► ⛓ ───────► 😈 ───────► ⚖ ───────► ✓ main
18
- the ask the contract devil at work judgement it lands
19
- ```
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
20
31
 
21
- **1 · Put it in writing.** `keiyaku bind` opens the contract — Title, Context, Objective, Design, Scope, Criteria — and an isolated branch. Devils honor the letter, never the spirit. Write "make it better" and you deserve what you get.
32
+ # Put an akuma on it. It works alone in the contract's own worktree.
33
+ keiyaku call worker-akuma --detach "fulfill the contract"
22
34
 
23
- **2 · Summon.** `keiyaku call worker-akuma "..."` projects a devil into the contract's worktree. It works; you rule: steer it mid-flight with `tell`, sit in with `wait`, banish it with `kill`. A finished run leaves an artifact `revive` raises a new devil from its remains.
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
24
40
 
25
- **3 · Judgement.** `keiyaku petition` seals the work and enters settlement. Verification gates and a reviewer stand between the devil and your main branch. **Claim** what passes. **Forfeit** burns the rest. Nothing lands quietly.
41
+ # Ask for judgment: gates run, a reviewer akuma reads the diff
42
+ # against the criteria.
43
+ keiyaku petition
26
44
 
27
- ```bash
28
- keiyaku guide # the walkthrough
29
- keiyaku status # where you stand, what blocks you
30
- keiyaku <cmd> --help # exact grammar, no folklore
45
+ # claim → the change lands on main, with a commit-hash receipt
46
+ # forfeit → the branch is deleted; partial fulfillment is forfeiture
31
47
  ```
32
48
 
33
- ## The command surface
49
+ Every step appends to the contract's ledger. `keiyaku log` replays any deal,
50
+ finished or dead, from its receipts.
34
51
 
35
- | | |
36
- | --- | --- |
37
- | **Contract** | `bind` `arc` `amend` `renew` `audit` `petition` `forfeit` `log` |
38
- | **Devils** | `call` `tell` `wait` `kill` `revive` `status` `history` |
39
- | **Roster** | `akuma list` `akuma show` |
40
- | **Tasks** | `task add/show/ls/log/start/stop/hold/resume/done/drop/update/doctor` |
41
- | **System** | `guide` `completion` `dump-env` |
52
+ ## The board
42
53
 
43
- Tasks are a file-backed board living in your repo: capture work, wire real dependency semantics (`parent` · `needs` · `supersedes` · `relates-to`), then promote a task into a contract when it's ready to bind.
54
+ `keiyaku status` is the one screen of state. Real output:
44
55
 
45
- ## Rolling your own devil
56
+ ```text
57
+ kanshi ─────────────────────────────────────────────────────── 現世 b4c38cc
58
+
59
+ keiyaku 2
60
+ □ fridge Add task arrange for atomic existing-task reorganization ▲2 · open 27m
61
+ □ hermitcrab Let task commands select a contract workspace bound 8m
62
+
63
+ akuma 2
64
+ ◆ worker-default/e03addad compose-impl @fridge up 27m · active 2s
65
+ 09:12│ told “Root review found contract-significant gaps. Continue …” — 5m12s…
66
+ ⋮ 12 more
67
+ 09:17│ said “The grouped verifier stream detached again, so I’m rerunning …”
68
+ │ ran $ node --test tests/unit/task-compose.test.ts — 38s
69
+ + 10 failed · 159 done · 4 killed
70
+
71
+ task 120
72
+ ▶ P1 centralize-repository-ledger-test-construction … in_progress · active 14h
73
+ ▶ P0 windows-common-commands-must-eliminate-git-proc… in_progress · active 3d
74
+ + 108 ready · 9 blocked
75
+ ```
76
+
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.
80
+
81
+ ## An akuma is one Markdown file
46
82
 
47
- An akuma is one Markdown file. Filename is its name, frontmatter is its body, prose is its soul:
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.
48
85
 
49
86
  ```markdown
50
87
  ---
@@ -55,10 +92,12 @@ description: Repository implementation agent
55
92
  Make scoped changes and run relevant tests.
56
93
  ```
57
94
 
58
- Providers: `codex-sdk` · `codex-app-server` · `claude-agent-sdk` · `opencode-sdk` · `pi`.
59
- Resolution: builtin < `<KEIYAKU_HOME>/akuma/` < `.keiyaku/akuma/` a higher circle replaces the file whole.
95
+ Providers: `codex-sdk`, `codex-app-server`, `claude-agent-sdk`,
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.
60
99
 
61
- `.keiyaku/settings.json` picks roles and gates, nothing else:
100
+ `.keiyaku/settings.json` assigns roles and gates:
62
101
 
63
102
  ```json
64
103
  {
@@ -68,24 +107,26 @@ Resolution: builtin < `<KEIYAKU_HOME>/akuma/` < `.keiyaku/akuma/` — a higher c
68
107
  }
69
108
  ```
70
109
 
71
- ## Paper trail
110
+ ## And the rest
72
111
 
73
- Contracts leave marks — that's the point.
74
-
75
- | Path | |
112
+ | | |
76
113
  | --- | --- |
77
- | `KEIYAKU.md` | the active contract |
78
- | `.keiyaku/` | devil roster, 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` |
79
118
 
80
- ```gitignore
81
- .keiyaku/draft/
82
- .keiyaku/response/
83
- ```
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.
84
122
 
85
- ## Fine print
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).
86
127
 
87
- The full body of law — product and architecture — lives in [`docs/keiyaku-v3/`](docs/keiyaku-v3/README.md). Start at the authority registry; nothing outside it is normative.
128
+ Full product documentation: [`docs/keiyaku-v3/`](docs/keiyaku-v3/README.md).
88
129
 
89
- Keiyaku is early and experimental, built for AI agents operating end to end, and optimized for rapid iteration. Breaking changes are intentional and unapologetic: the current version is the only version.
130
+ Keiyaku is early and experimental breaking changes are intentional.
90
131
 
91
- MIT. The devils are not.
132
+ MIT.