@astrosheep/keiyaku 0.1.65 β†’ 0.1.68

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.
package/README.md CHANGED
@@ -1,105 +1,150 @@
1
- # 🀝 Keiyaku
1
+ # Keiyaku
2
2
 
3
- **Keiyaku** is an MCP server designed for the **Architect-Minion workflow**. It enforces a strict, review-driven protocol for iterative coding tasks.
3
+ Keiyaku is an MCP server that runs a contract-style workflow for AI-assisted coding in Git repos: isolate work on a dedicated `keiyaku/*` branch, iterate in rounds with review, then submit a final petition for judgment.
4
4
 
5
- Instead of messy, unstructured chat, Keiyaku turns every task into a formal "Keiyaku": a branch-based, multi-round journey with a clear beginning, a traced middle, and a definitive end.
5
+ This README is for users of the tool (MCP clients). It intentionally does not document repo maintenance workflows.
6
6
 
7
- ## πŸš€ Why Keiyaku?
7
+ ## Philosophy
8
8
 
9
- - **Zero Mess**: Every task lives in its own `keiyaku/*` branch. Your main branch stays pristine.
10
- - **Traceable Logic**: Every iteration is documented in `KEIYAKU_TRACE.md`. You can literally see the AI's "learning curve" (or mistakes).
11
- - **Strict Guardrails**: No "Done" until you say so. No merging until the criteria are met.
12
- - **Human-in-the-Loop**: Designed for humans who actually want to review the code before it hits production.
9
+ Keiyaku is opinionated on purpose:
13
10
 
14
- ## πŸ”„ The Lifecycle
11
+ - Isolation over β€œchat edits”: work happens on a dedicated `keiyaku/*` branch so your base branch stays clean.
12
+ - Explicit contracts: the goal/rules/criteria live in `KEIYAKU.md` so β€œwhat are we doing?” is always answered by a file, not a scrolling chat.
13
+ - Review-driven iteration: you drive the rounds; the tool optimizes for diffs and verification, not vibes.
14
+ - Verdict-gated finish: the contract ends via `petition` (CLAIM/FORFEIT) so β€œdone” is an explicit decision with gates (oath + scores).
15
15
 
16
- The workflow is a simple, non-negotiable loop:
16
+ ## When To Use Which Tool
17
17
 
18
- 1. **Start**: Initiate the keiyaku. Creates a branch, locks the mission in `KEIYAKU.md`, and starts Round 1.
19
- 2. **Iterate** (N times): Review the work, give feedback, and launch the next round.
20
- 3. **Verdict**: The final verdict. `DONE` (merge & clean) or `DROP` (nuke the branch).
18
+ - Use `ask` for investigation: summarize, locate relevant code, run tests/scripts, debug a failure. No branch required.
19
+ - Use `summon`/`drive` for non-trivial code changes that should be isolated and iterated.
20
+ - Use `petition` only when you believe the criteria are met (CLAIM) or when you want to discard the contract (FORFEIT).
21
21
 
22
- > Note: Tool names are preset-dependent. The defaults are shown in the next section.
22
+ ## How It Works
23
23
 
24
- ## πŸ›  Available Tools
24
+ Keiyaku formalizes a task into:
25
25
 
26
- | Tool | Action | Description |
27
- | :--- | :--- | :--- |
28
- | **`summon`** | Start | Define the goal, rules, and criteria. Starts the first round. |
29
- | **`drive`** | Iterate | Provide feedback based on the previous round's output. |
30
- | **`ask`** | Reason | Pure read-only analysis session. No code changes, just brain power. |
31
- | **`present`** | Finish | Finalize the task. Requires a quality check (the "Oath"). |
32
- | **`help`** | Help | Show the current rules + preset usage guide. |
26
+ - A signed contract (`KEIYAKU.md`) that defines goal, rules, and verification criteria
27
+ - A round trace (`KEIYAKU_TRACE.md`) that records iterations
28
+ - A final petition (`petition`) that requests a CLAIM or FORFEIT verdict
33
29
 
34
- ## 🎨 Flavor Your Workflow
30
+ Default workflow:
35
31
 
36
- Bored with generic tool names? Keiyaku supports **Term Presets**.
32
+ `ask` (anytime) | `summon` -> [`drive` | `ask`]* -> `petition`
37
33
 
38
- ### How to set
34
+ Typical loop:
39
35
 
40
- Set `KEIYAKU_TERM_PRESET` in the MCP server env (recommended), or in your shell before launching the server.
36
+ 1. `summon`: provide `title`, `goal`, `criteria` (plus any rules/context). Repo must be clean.
37
+ 2. Review the round output and repo diff.
38
+ 3. `drive`: issue the next directive (fixes, refinements, tests, cleanup).
39
+ 4. `ask`: optionally verify independently (tests, static checks, targeted inspection).
40
+ 5. `petition`:
41
+ - `CLAIM` to request acceptance (requires oath + 0-10 scores).
42
+ - `FORFEIT` to abandon and discard the contract.
41
43
 
42
- - **Valid values**: `default`, `pocket`, `mischief` (case-insensitive). If omitted, defaults to `default`.
44
+ ## Tools (Default Preset)
43
45
 
44
- - **`default`**: `summon` β†’ `drive` β†’ `present` (Professional)
45
- - **`pocket`**: `choose_you` β†’ `command` β†’ `capture` (Gotta code 'em all)
46
- - **`mischief`**: `oi` β†’ `neh` β†’ `yoshi` (For those who like a little attitude)
46
+ Keiyaku registers the following MCP tools:
47
47
 
48
- `ask` is also renamed by preset (`ask` / `pokedex` / `eeto`). `help` stays `help` across presets.
48
+ - `summon`: start a contract, create/enter a `keiyaku/*` branch, run round 1
49
+ - `drive`: run the next round (mutates the repo)
50
+ - `ask`: stateless delegation (analysis, running tests/scripts, debugging). No keiyaku branch required.
51
+ - `petition`: submit `CLAIM` or `FORFEIT` to close the contract (verdict-gated)
52
+ - `status`: read-only contract/protocol status and readiness hints
53
+ - `help`: usage guide and protocol notes
49
54
 
50
- ### What it changes (and what it doesn't)
55
+ Term presets: currently only `default` is supported (`KEIYAKU_TERM_PRESET=default`).
51
56
 
52
- - **Changes**: tool names/titles/descriptions, the "identity" label, and the set of allowed profile display names (see next section).
53
- - **Doesn't change**: core behavior (branching, protocol files, verdict rules).
57
+ ## Install / Run
54
58
 
55
- ### Choose a profile name
59
+ Global install:
56
60
 
57
- Each run/round can pick a profile via tool input `name`, or globally via `KEIYAKU_SUBAGENT_NAME_OVERRIDE`.
58
-
59
- - `default`: `B-tier`, `A-tier`, `S-tier` (also accepts internal names `agent-a|agent-b|agent-c`)
60
- - `pocket`: `grub`, `sparky`, `titan`
61
- - `mischief`: `imp`, `minion`, `mastermind`
62
-
63
- ### Prevent nested subagents
64
-
65
- Set `KEIYAKU_DISABLE_SUBAGENT_SPAWN=1` to block any subagent spawn attempts in the current process.
66
- Keiyaku automatically injects this env var into spawned Codex/Gemini runs so they cannot recursively trigger another Keiyaku subagent run.
61
+ ```bash
62
+ npm install -g @astrosheep/keiyaku
63
+ keiyaku --version
64
+ ```
67
65
 
68
- ## πŸ“¦ Setup
66
+ Via npx:
69
67
 
70
- ### 1. Install
71
68
  ```bash
72
- npm install -g keiyaku
69
+ npx -y @astrosheep/keiyaku --version
73
70
  ```
74
71
 
75
- ### 2. Configure MCP (Example: Claude Desktop)
76
- Add this to your `claude_desktop_config.json`:
72
+ ## MCP Setup
73
+
74
+ ### Claude Desktop (stdio)
77
75
 
78
76
  ```json
79
77
  {
80
78
  "mcpServers": {
81
79
  "keiyaku": {
82
80
  "command": "npx",
83
- "args": ["-y", "keiyaku"],
84
- "env": {
85
- "KEIYAKU_TERM_PRESET": "mischief"
86
- }
81
+ "args": ["-y", "@astrosheep/keiyaku"]
87
82
  }
88
83
  }
89
84
  }
90
85
  ```
91
86
 
92
- ## πŸ“œ Protocol Files
87
+ ### Streamable HTTP
88
+
89
+ ```bash
90
+ KEIYAKU_MCP_TRANSPORT=streamable-http \
91
+ KEIYAKU_MCP_HTTP_HOST=127.0.0.1 \
92
+ KEIYAKU_MCP_HTTP_PORT=3000 \
93
+ npx -y @astrosheep/keiyaku
94
+ ```
95
+
96
+ Endpoint: `http://127.0.0.1:3000/mcp`
97
+
98
+ ## What Gets Written To Your Repo
99
+
100
+ Keiyaku writes protocol artifacts into the target repository:
101
+
102
+ - `KEIYAKU.md`: the active contract (goal/rules/criteria)
103
+ - `KEIYAKU_TRACE.md`: round-by-round trace
104
+ - `KEIYAKU.draft.md`: optional recovery draft when start fails
105
+ - `.keiyaku/response/*.md`: persisted responses for `summon`, `drive`, and `ask`
106
+ - `.keiyaku/draft/*`: internal drafts (used for recovery and workflow safety)
107
+
108
+ If you do not want these tracked, add:
93
109
 
94
- When a keiyaku is active, two files are maintained in your repo:
95
- - `KEIYAKU.md`: The immutable "Constitution" of the task.
96
- - `KEIYAKU_TRACE.md`: The history of every round, feedback, and result.
110
+ - `.keiyaku/draft/`
111
+ - `.keiyaku/response/`
97
112
 
98
- Project-level law lives in:
99
- - `.keiyaku/base-rules.md`: Global rules inherited by every keiyaku.
100
- - `ask` also injects `.keiyaku/base-rules.md` as **reference rules context** (it may be unrelated to some asks).
113
+ to `.gitignore`.
114
+
115
+ ## Key Environment Variables
116
+
117
+ Server / transport:
118
+
119
+ - `KEIYAKU_MCP_TRANSPORT`: `stdio` (default) or `streamable-http`
120
+ - `KEIYAKU_MCP_HTTP_HOST`: default `127.0.0.1`
121
+ - `KEIYAKU_MCP_HTTP_PORT`: default `3000`
122
+
123
+ Preset / naming:
124
+
125
+ - `KEIYAKU_TERM_PRESET`: only `default` is supported
126
+ - `KEIYAKU_SUBAGENT_NAME_OVERRIDE`: overrides the default subagent display name
127
+
128
+ Subagent execution:
129
+
130
+ - `KEIYAKU_DISABLE_SUBAGENT_SPAWN`: when `1`, blocks Keiyaku MCP server startup
131
+ - `KEIYAKU_FAKE_SUBAGENT`: `0` | `1` | `abort-wait` (stub subagent execution)
132
+ - `KEIYAKU_AGENT_[A|B|C]_PROVIDER`: `codex` | `gemini` | `opencode`
133
+ - `KEIYAKU_AGENT_[A|B|C]_MODEL`: optional model override for that profile
134
+ - `KEIYAKU_AGENT_[A|B|C]_REASONING_EFFORT`: `low` | `medium` | `high` (codex only)
135
+ - `KEIYAKU_AGENT_[A|B|C]_COMMAND`: program name override (single token)
136
+
137
+ Workflow:
138
+
139
+ - `KEIYAKU_INCREMENTAL_DIFF_MODE`: `targeted` (default) | `stat` | `unified`
140
+ - `KEIYAKU_CLOSE_OATH`: overrides the required petition oath template
141
+
142
+ Print the full env template with defaults:
143
+
144
+ ```bash
145
+ keiyaku dump-env
146
+ ```
101
147
 
102
- *Note: These files are automatically cleaned up (or committed) when you `present` (or preset equivalent) the keiyaku.*
148
+ ## License
103
149
 
104
- ---
105
- "Keep your branches clean and your minions in line." β€” Mischief preset
150
+ MIT