@kyo-so/cli 0.1.0 → 0.3.0

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.ja.md ADDED
@@ -0,0 +1,297 @@
1
+ # Kyo-so
2
+
3
+ [English](README.md) | [日本語](README.ja.md) | [简体中文](README.zh-CN.md)
4
+
5
+ この翻訳は英語版より古い場合があります。最新の情報は英語版 README を参照してください。
6
+
7
+ Kyo-so (Kyoso / 協奏) は、AI coding workflow 向けの MCP-native、ACP-powered な multi-agent review gate です。
8
+
9
+ 「協奏」という名前には、複数の独立した奏者がそれぞれの役割を保ちながら、ひとつの成果をつくるという意味を込めています。
10
+
11
+ Kyo-so は Codex と Claude の reviewer を連携させ、次のレビューを行います。
12
+
13
+ - implementation plan review
14
+ - CISA Secure by Design gate による security review
15
+ - 実装後の diff review
16
+
17
+ Kyoso はコード変更を適用しません。
18
+
19
+ ## Quick Start
20
+
21
+ グローバルインストールは不要です。Kyoso は `npx` または `bunx` で実行します。
22
+
23
+ ### Claude Only / Codex Only
24
+
25
+ Kyoso は Claude だけ、または Codex だけでも実行できます。利用できない backend は `kyoso.config.ts` で無効化してください。例は `examples/claude-only.config.ts` と `examples/codex-only.config.ts` にあります。
26
+
27
+ single-agent mode では、残った backend が `combined_reviewer` として 1 回だけ実行され、implementation と architecture/security の両方を確認します。JSON output には `reviewMode: "single_agent"` と `agentsUsed` が入り、Markdown output には cross-model verification が行われていないことと disagreements が N/A であることを表示します。
28
+
29
+ この mode では独立した cross-model validation はなく、自己レビュー bias が残ります。一方で、別プロセスの read-only review、temporary snapshots、adversarial review prompts、secret scanning、deterministic gates は利用できます。
30
+
31
+ ### Claude Code
32
+
33
+ 1. Claude 認証を準備します。
34
+
35
+ ```bash
36
+ claude setup-token
37
+ ```
38
+
39
+ このコマンドで得た `CLAUDE_CODE_OAUTH_TOKEN` を設定するか、直接 API 課金を使う場合は `ANTHROPIC_API_KEY` を設定します。
40
+
41
+ 2. MCP を登録し、review skill をインストールします。
42
+
43
+ ```bash
44
+ npx @kyo-so/cli setup claude-code --write
45
+ bunx @kyo-so/cli setup claude-code --write
46
+ ```
47
+
48
+ 3. セットアップを確認します。
49
+
50
+ ```bash
51
+ npx @kyo-so/cli doctor
52
+ bunx @kyo-so/cli doctor
53
+ ```
54
+
55
+ 4. Claude Code からレビューを依頼します。
56
+
57
+ ```text
58
+ Use Kyoso plan_review on this plan before implementation.
59
+ ```
60
+
61
+ ### Codex
62
+
63
+ 1. Codex 認証を準備します。
64
+
65
+ ```bash
66
+ codex login
67
+ ```
68
+
69
+ 2. MCP を登録し、review skill をインストールします。
70
+
71
+ ```bash
72
+ npx @kyo-so/cli setup codex --write
73
+ bunx @kyo-so/cli setup codex --write
74
+ ```
75
+
76
+ 3. セットアップを確認します。
77
+
78
+ ```bash
79
+ npx @kyo-so/cli doctor
80
+ bunx @kyo-so/cli doctor
81
+ ```
82
+
83
+ 4. Codex からレビューを依頼します。
84
+
85
+ ```text
86
+ Use Kyoso diff_review on the current diff. I need a second opinion before merging.
87
+ ```
88
+
89
+ 手動セットアップ用の例は `examples/codex-config.toml` と `examples/claude-code-mcp.json` にあります。
90
+
91
+ ## Install / Run
92
+
93
+ ```bash
94
+ npx @kyo-so/cli mcp
95
+ bunx @kyo-so/cli mcp
96
+ ```
97
+
98
+ Naming note: npm パッケージは `@kyo-so/cli` (製品名 Kyo-so に対応) で、インストールされる CLI コマンドは短い `kyoso` です。
99
+
100
+ ローカル開発:
101
+
102
+ ```bash
103
+ safe-chain bun install
104
+ safe-chain bun run typecheck
105
+ safe-chain bun test
106
+ safe-chain bun run build
107
+ ```
108
+
109
+ パッケージ化された CLI を実行するには Node.js 20 以降が必要です。
110
+
111
+ 既知の配布リスク: `@modelcontextprotocol/server` にはまだ stable release がありません。Kyoso は現在 prerelease API を pin しているため、MCP SDK API の変更に追従する follow-up release が必要になる場合があります。
112
+
113
+ ## CLI
114
+
115
+ 通常の実行経路は `npx @kyo-so/cli` と `bunx @kyo-so/cli` です。以下の例では、この prefix を `kyoso` と省略しています。
116
+
117
+ ```bash
118
+ kyoso plan --goal "Review this OAuth callback plan" --plan plan.md
119
+ kyoso security --goal "Review this auth diff" --diff changes.patch
120
+ kyoso diff --base main --head HEAD
121
+ kyoso doctor
122
+ kyoso init
123
+ kyoso setup codex
124
+ kyoso setup claude-code
125
+ ```
126
+
127
+ ## Usage Examples
128
+
129
+ 選択したコードと一緒に implementation plan をレビューします。
130
+
131
+ ```bash
132
+ kyoso plan \
133
+ --goal "Review the OAuth callback implementation plan" \
134
+ --plan plan.md \
135
+ --file src/auth/callback.ts
136
+ ```
137
+
138
+ 結果は上から順に読んでください。`Decision` は deterministic gate の結果、`Findings` は必要な変更、`Tests to Add` は承認前に Kyoso が期待する regression checks です。
139
+
140
+ patch に対して CISA Secure by Design security review を実行します。
141
+
142
+ ```bash
143
+ kyoso security \
144
+ --goal "Review auth changes for tenant isolation and secure defaults" \
145
+ --diff changes.patch \
146
+ --json
147
+ ```
148
+
149
+ JSON output では、`cisaSecureByDesign` に 4 つの gate dimensions が表示されます。customer security outcomes の `fail` は review を block します。warning-level dimensions は通常 `approve_with_changes` になります。
150
+
151
+ Kyoso を Codex または Claude Code の MCP server として登録し、client から `plan_review` を呼び出します。
152
+
153
+ ```toml
154
+ # See examples/codex-config.toml
155
+ [mcp_servers.kyoso]
156
+ command = "npx"
157
+ args = ["-y", "@kyo-so/cli", "mcp", "--network", "model_only"]
158
+ ```
159
+
160
+ client request の例:
161
+
162
+ ```text
163
+ Use Kyoso plan_review on this plan and the selected auth files. I need a second opinion before implementing.
164
+ ```
165
+
166
+ ## MCP
167
+
168
+ ```bash
169
+ npx @kyo-so/cli mcp --network model_only
170
+ bunx @kyo-so/cli mcp --network model_only
171
+ ```
172
+
173
+ `--network` を省略すると、Kyoso は `model_only` を使用します。これは Kyoso が backend agents からの通信を model-provider traffic のみにすることを期待する policy-level constraint です。OS-level network isolation ではありません。
174
+
175
+ Kyoso が公開する MCP tools は次の 3 つだけです。
176
+
177
+ - `plan_review`
178
+ - `security_review`
179
+ - `diff_review`
180
+
181
+ MCP stdout は protocol messages 専用です。logs は stderr または local audit traces に出力されます。
182
+
183
+ ## Skill
184
+
185
+ 同梱の `kyoso-review` skill は意図的に狭い用途にしています。Kyoso、multi-agent review、plan review、security review、CISA Secure by Design review、diff review を明示的に依頼したときだけ trigger されるべきです。
186
+
187
+ `npx @kyo-so/cli setup codex --write` と `bunx @kyo-so/cli setup codex --write` は、既定で `.agents/skills/kyoso-review/` にコピーします。`--global` を追加すると `~/.agents/skills/kyoso-review/` にコピーします。
188
+
189
+ `npx @kyo-so/cli setup claude-code --write` と `bunx @kyo-so/cli setup claude-code --write` は、既定で `.claude/skills/kyoso-review/` にコピーします。`--global` を追加すると `~/.claude/skills/kyoso-review/` にコピーします。
190
+
191
+ ## Safety Model
192
+
193
+ Kyoso MVP は disposable temporary snapshot と policy-level write denial を使用します。完全な OS sandbox ではありません。リスクを理解していない場合、untrusted repositories に対して Kyoso を実行しないでください。
194
+
195
+ Secret detection は best-effort です。Kyoso は request、selected files、diff 内で secret らしき値を検出すると、その値を redact し、既定では backend agents の実行前に block します。
196
+
197
+ Kyoso は provider credentials を保存しません。Child agent environment variables は allowlist されます。
198
+
199
+ Repository content、plans、diffs、selected files は backend prompts 内で untrusted data として扱われます。Kyoso はそれらを `<untrusted-content>` tags で包み、その中にある instructions に従わないよう agents に指示します。最終判断は schema-constrained findings から導出されます。agents は files の書き込みや commands の実行ができず、judge は deterministic decision を変更できません。
200
+
201
+ ## Agent Auth
202
+
203
+ Codex は利用可能な場合、local `codex` login を使用します。既定の subscription-backed path では API key は不要です。
204
+
205
+ Claude は 2 つの auth paths をサポートします。
206
+
207
+ - `ANTHROPIC_API_KEY`: direct Anthropic API billing
208
+ - `CLAUDE_CODE_OAUTH_TOKEN`: `claude setup-token` から得る subscription auth
209
+
210
+ Claude credentials が両方設定されている場合、Kyoso は既定で `CLAUDE_CODE_OAUTH_TOKEN` だけを Claude child agent に forward します。`ANTHROPIC_API_KEY` だけを forward するには、`agents.claude.auth.preferApiKey: true` を設定してください。
211
+
212
+ Default child-agent env allowlist:
213
+
214
+ | Agent | Provider env |
215
+ | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
216
+ | Codex | `CODEX_API_KEY`, `OPENAI_API_KEY`, `CODEX_HOME`, `CODEX_ACCESS_TOKEN` |
217
+ | Claude | `ANTHROPIC_API_KEY`, `CLAUDE_CODE_OAUTH_TOKEN`, `ANTHROPIC_MODEL`, `ANTHROPIC_BASE_URL`, `CLAUDE_CONFIG_DIR`, `CLAUDE_CODE_USE_BEDROCK`, `CLAUDE_CODE_USE_VERTEX`, `CLAUDE_CODE_USE_FOUNDRY` |
218
+
219
+ Kyoso は subprocesses の起動に必要な最小限の runtime env も forward します: `PATH`, `HOME`, `TMPDIR`, `TEMP`, `TMP`, `LANG`, `LC_ALL`, `SHELL`, `USER`, `USERNAME`, `SystemRoot`。
220
+
221
+ ## Agent Models
222
+
223
+ `agents.<name>.model` を省略すると、各 agent 独自の default を使用します。Codex は `~/.codex/config.toml` などの local Codex config を使用し、Claude は adapter default を使用します。
224
+
225
+ ```ts
226
+ export default defineConfig({
227
+ agents: {
228
+ codex: {
229
+ model: "gpt-5.5",
230
+ },
231
+ claude: {
232
+ model: "claude-sonnet-5",
233
+ },
234
+ },
235
+ });
236
+ ```
237
+
238
+ Kyoso は model pins を adapter-supported configuration に mapping します。
239
+
240
+ - Claude: `agents.claude.env` または whitelisted parent env で未設定の場合に `ANTHROPIC_MODEL` を設定します。
241
+ - Codex: `CODEX_CONFIG` が未設定の場合、`CODEX_CONFIG={"model":"..."}` を設定します。model pin と他の Codex session config を組み合わせるには、`agents.codex.env.CODEX_CONFIG` を直接設定してください。
242
+
243
+ ## Audit
244
+
245
+ Audit traces は次の場所に書き込まれます。
246
+
247
+ ```text
248
+ .kyoso/traces/<yyyy-mm-dd>/<traceId>.jsonl
249
+ ```
250
+
251
+ Raw agent output と raw file contents は既定で無効です。
252
+
253
+ `.kyoso/traces/` を Git に含めないでください。`kyoso init` は `.kyoso/` を `.gitignore` に追加し、この repository も同じ設定にしています。`audit.includeRawAgentOutput` を有効にすると、traces に sensitive review output が残る場合があります。local retention policy に従って古い traces を定期的に削除してください。
254
+
255
+ ## Config
256
+
257
+ `kyoso.config.ts` は trust-on-first-use approval の後にのみ load されます。Trusted hashes は `~/.kyoso/trusted-configs.json` に保存されます。
258
+
259
+ TypeScript config files は任意の code を実行できます。TTY では、untrusted config を実行する前に Kyoso が確認します。MCP や CI のような non-interactive mode では、untrusted config は skip され、defaults が使われます。現在の config hash を明示的に trust するには `--trust-config` を渡し、常に defaults を使うには `--ignore-config` を渡してください。
260
+
261
+ Default agent timeouts は Codex 120 秒、Claude 240 秒です。MCP clients は tool calls に少なくとも 360 秒を許可してください。
262
+
263
+ Judge LLMs は optional です。OpenAI judge を使うには `OPENAI_API_KEY` または `CODEX_API_KEY` を設定し、Anthropic judge を使うには `ANTHROPIC_API_KEY` を設定します。Optional overrides:
264
+
265
+ - `OPENAI_BASE_URL`: OpenAI-compatible API base URL
266
+ - `KYOSO_OPENAI_JUDGE_MODEL`: OpenAI judge model, default `gpt-5.4-mini`
267
+ - `KYOSO_ANTHROPIC_JUDGE_MODEL`: Anthropic judge model, default `claude-haiku-4-5`
268
+
269
+ Judge defaults は意図的に lightweight models を使用します。より強い judge を使う場合は、`KYOSO_ANTHROPIC_JUDGE_MODEL` に `claude-sonnet-5` のような Sonnet-class model を設定してください。
270
+
271
+ Subscription-only setup:
272
+
273
+ - Codex: local `codex` login を使用
274
+ - Claude: `claude setup-token` を実行し、`CLAUDE_CODE_OAUTH_TOKEN` を設定
275
+ - Judge: API keys を設定しないことで、Kyoso は `deterministic_fallback` を使用
276
+ - `OPENAI_API_KEY` が存在するときに OpenAI judge calls を避けるには、`judgeProvider: "none"` を設定
277
+
278
+ Team admins は organization Usage credits も確認してください。Credits が有効な場合、subscription limits を超える billing behavior は Kyoso の外側で制御されます。
279
+
280
+ ## Troubleshooting
281
+
282
+ - MCP timeout: client tool timeouts を少なくとも 360 秒に設定してください。Kyoso defaults は Codex 120 秒、Claude 240 秒です。
283
+ - Fresh npm release: safe-chain などの minimum-package-age protection により、publish 直後は `npx @kyo-so/cli` の解決が一時的に block される場合があります。
284
+ - Non-interactive config: `--trust-config` を渡さない限り、untrusted `kyoso.config.ts` は skip されます。
285
+
286
+ ## Development
287
+
288
+ - `KYOSO_TEST_FAKE_AGENTS=1`: test-only fake ACP agents; production では設定しないでください。
289
+ - `KYOSO_KEEP_TEMP=1`: local debugging 用に temporary snapshots を保持します。
290
+
291
+ ## License
292
+
293
+ Kyoso は GNU Affero General Public License v3.0 or later (`AGPL-3.0-or-later`) で licensed されています。
294
+
295
+ Kyoso は separate CLI または MCP server process として使うことを想定しています。Kyoso を他の program に embedding、importing、linking する場合、license implications が異なる可能性があります。
296
+
297
+ Copyright (C) 2026 Hokuto TAKEMIYA (hokupod).
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Kyo-so
2
2
 
3
+ [English](README.md) | [日本語](README.ja.md) | [简体中文](README.zh-CN.md)
4
+
3
5
  Kyo-so (Kyoso / 協奏) is an MCP-native, ACP-powered multi-agent review gate for AI coding workflows.
4
6
 
5
7
  The Japanese word 協奏 translates to concerto in English: multiple independent players performing one coordinated piece.
@@ -12,11 +14,83 @@ It coordinates Codex and Claude reviewers for:
12
14
 
13
15
  Kyoso does not apply code changes.
14
16
 
15
- ## Install
17
+ ## Quick Start
18
+
19
+ No global install is required. Run Kyoso through `npx` or `bunx`.
20
+
21
+ ### Claude Only / Codex Only
22
+
23
+ Kyoso can run when only Claude or only Codex is available. Disable the missing backend in `kyoso.config.ts` using `examples/claude-only.config.ts` or `examples/codex-only.config.ts`.
24
+
25
+ In single-agent mode, the remaining backend runs once as `combined_reviewer` and covers both implementation and architecture/security focus areas. JSON output includes `reviewMode: "single_agent"` and `agentsUsed`; Markdown output states that cross-model verification was not performed and marks disagreements as N/A.
26
+
27
+ This mode does not provide independent cross-model validation and may retain self-review bias. It still provides a separate read-only review process, temporary snapshots, adversarial review prompts, secret scanning, and deterministic gates.
28
+
29
+ ### Claude Code
30
+
31
+ 1. Prepare Claude authentication.
32
+
33
+ ```bash
34
+ claude setup-token
35
+ ```
36
+
37
+ Set `CLAUDE_CODE_OAUTH_TOKEN` from that command, or set `ANTHROPIC_API_KEY` for direct API billing.
38
+
39
+ 2. Register MCP and install the review skill.
40
+
41
+ ```bash
42
+ npx @kyo-so/cli setup claude-code --write
43
+ bunx @kyo-so/cli setup claude-code --write
44
+ ```
45
+
46
+ 3. Verify the setup.
47
+
48
+ ```bash
49
+ npx @kyo-so/cli doctor
50
+ bunx @kyo-so/cli doctor
51
+ ```
52
+
53
+ 4. Ask for a review from Claude Code.
54
+
55
+ ```text
56
+ Use Kyoso plan_review on this plan before implementation.
57
+ ```
58
+
59
+ ### Codex
60
+
61
+ 1. Prepare Codex authentication.
62
+
63
+ ```bash
64
+ codex login
65
+ ```
66
+
67
+ 2. Register MCP and install the review skill.
68
+
69
+ ```bash
70
+ npx @kyo-so/cli setup codex --write
71
+ bunx @kyo-so/cli setup codex --write
72
+ ```
73
+
74
+ 3. Verify the setup.
75
+
76
+ ```bash
77
+ npx @kyo-so/cli doctor
78
+ bunx @kyo-so/cli doctor
79
+ ```
80
+
81
+ 4. Ask for a review from Codex.
82
+
83
+ ```text
84
+ Use Kyoso diff_review on the current diff. I need a second opinion before merging.
85
+ ```
86
+
87
+ Manual setup examples are kept in `examples/codex-config.toml` and `examples/claude-code-mcp.json`.
88
+
89
+ ## Install / Run
16
90
 
17
91
  ```bash
18
- bunx @kyo-so/cli mcp
19
92
  npx @kyo-so/cli mcp
93
+ bunx @kyo-so/cli mcp
20
94
  ```
21
95
 
22
96
  Naming note: the npm package is `@kyo-so/cli` (matching the product name Kyo-so), while the installed CLI command is the shorter `kyoso`.
@@ -36,12 +110,16 @@ Known distribution risk: `@modelcontextprotocol/server` has no stable release ye
36
110
 
37
111
  ## CLI
38
112
 
113
+ `npx @kyo-so/cli` and `bunx @kyo-so/cli` are the normal execution paths. The examples below abbreviate that prefix as `kyoso`.
114
+
39
115
  ```bash
40
116
  kyoso plan --goal "Review this OAuth callback plan" --plan plan.md
41
117
  kyoso security --goal "Review this auth diff" --diff changes.patch
42
118
  kyoso diff --base main --head HEAD
43
119
  kyoso doctor
44
120
  kyoso init
121
+ kyoso setup codex
122
+ kyoso setup claude-code
45
123
  ```
46
124
 
47
125
  ## Usage Examples
@@ -73,8 +151,8 @@ Register Kyoso with Codex or Claude Code as an MCP server, then call `plan_revie
73
151
  ```toml
74
152
  # See examples/codex-config.toml
75
153
  [mcp_servers.kyoso]
76
- command = "kyoso"
77
- args = ["mcp", "--network", "model_only"]
154
+ command = "npx"
155
+ args = ["-y", "@kyo-so/cli", "mcp", "--network", "model_only"]
78
156
  ```
79
157
 
80
158
  Example client request:
@@ -86,7 +164,8 @@ Use Kyoso plan_review on this plan and the selected auth files. I need a second
86
164
  ## MCP
87
165
 
88
166
  ```bash
89
- kyoso mcp --network model_only
167
+ npx @kyo-so/cli mcp --network model_only
168
+ bunx @kyo-so/cli mcp --network model_only
90
169
  ```
91
170
 
92
171
  When `--network` is omitted, Kyoso uses `model_only`. This means Kyoso expects only model-provider traffic from backend agents. It is a policy-level constraint, not OS-level network isolation.
@@ -99,6 +178,14 @@ Kyoso exposes exactly these MCP tools:
99
178
 
100
179
  MCP stdout is reserved for protocol messages. Logs go to stderr or local audit traces.
101
180
 
181
+ ## Skill
182
+
183
+ The bundled `kyoso-review` skill is intentionally narrow. It should trigger only when you explicitly ask for Kyoso, multi-agent review, plan review, security review, CISA Secure by Design review, or diff review.
184
+
185
+ `npx @kyo-so/cli setup codex --write` and `bunx @kyo-so/cli setup codex --write` copy it to `.agents/skills/kyoso-review/` by default. Add `--global` to copy it to `~/.agents/skills/kyoso-review/`.
186
+
187
+ `npx @kyo-so/cli setup claude-code --write` and `bunx @kyo-so/cli setup claude-code --write` copy it to `.claude/skills/kyoso-review/` by default. Add `--global` to copy it to `~/.claude/skills/kyoso-review/`.
188
+
102
189
  ## Safety Model
103
190
 
104
191
  Kyoso MVP uses a disposable temporary snapshot and policy-level write denial. It is not a full OS sandbox. Do not run Kyoso against untrusted repositories unless you understand the risk.
@@ -188,6 +275,12 @@ Subscription-only setup:
188
275
 
189
276
  Team admins should also check organization Usage credits. If credits are enabled, billing behavior beyond subscription limits is controlled outside Kyoso.
190
277
 
278
+ ## Troubleshooting
279
+
280
+ - MCP timeout: set client tool timeouts to at least 360 seconds. Kyoso defaults are Codex 120 seconds and Claude 240 seconds.
281
+ - Fresh npm release: minimum-package-age protection in tools such as safe-chain may briefly block `npx @kyo-so/cli` resolution after publish.
282
+ - Non-interactive config: untrusted `kyoso.config.ts` is skipped unless you pass `--trust-config`.
283
+
191
284
  ## Development
192
285
 
193
286
  - `KYOSO_TEST_FAKE_AGENTS=1`: test-only fake ACP agents; do not set in production.