@kodax-ai/kodax 0.7.85 → 0.7.86

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 (63) hide show
  1. package/CHANGELOG.md +93 -1
  2. package/README.md +1867 -1841
  3. package/README_CN.md +1136 -1130
  4. package/dist/chunks/{agent-OQ37XUWF.js → agent-IO6TXNCV.js} +1 -1
  5. package/dist/chunks/argument-completer-JMICSGL6.js +2 -0
  6. package/dist/chunks/chunk-2RAXDUC7.js +379 -0
  7. package/dist/chunks/{chunk-MJ4G5ZCW.js → chunk-A5VQGXH2.js} +1 -1
  8. package/dist/chunks/{chunk-TBBY2DKE.js → chunk-AAFFS6RU.js} +2 -2
  9. package/dist/chunks/{chunk-IA246OAN.js → chunk-B36G256E.js} +2 -2
  10. package/dist/chunks/{chunk-3E4OSFP2.js → chunk-G5FGIRDJ.js} +136 -137
  11. package/dist/chunks/{chunk-RSOAHVUR.js → chunk-GVGLYVG4.js} +1 -1
  12. package/dist/chunks/chunk-MFCPQZ7E.js +519 -0
  13. package/dist/chunks/chunk-Q6UAGROD.js +415 -0
  14. package/dist/chunks/{chunk-IWRNGH4M.js → chunk-R4EHASEN.js} +5 -5
  15. package/dist/chunks/{chunk-ZVOXWLT6.js → chunk-U6HNMLNN.js} +226 -214
  16. package/dist/chunks/{chunk-ODRLFQQH.js → chunk-UKCDCVMD.js} +1 -1
  17. package/dist/chunks/{chunk-CZCEFGQG.js → chunk-XA4ENCAH.js} +1 -1
  18. package/dist/chunks/{chunk-SR4E5FQK.js → chunk-XUKLF26Q.js} +2 -2
  19. package/dist/chunks/{compaction-config-3WLLNN57.js → compaction-config-5RMG22CY.js} +1 -1
  20. package/dist/chunks/{construction-bootstrap-CZ6NWEWQ.js → construction-bootstrap-4DGAYOWH.js} +1 -1
  21. package/dist/chunks/{dist-NFLLOZWF.js → dist-DFW7MXT7.js} +1 -1
  22. package/dist/chunks/host-6MMHYTI5.js +2 -0
  23. package/dist/chunks/run-manager-ISQSWCAM.js +2 -0
  24. package/dist/chunks/{utils-KFLK3EHJ.js → utils-LV7FHKYN.js} +1 -1
  25. package/dist/index.d.ts +8 -8
  26. package/dist/index.js +1 -1
  27. package/dist/kodax_bootstrap.js +1 -1
  28. package/dist/kodax_cli.js +1459 -1411
  29. package/dist/kodax_resume.js +78 -76
  30. package/dist/runtime-worker.js +1467 -1419
  31. package/dist/sandbox-workspace-session.js +346 -302
  32. package/dist/sdk-a2a.d.ts +5 -5
  33. package/dist/sdk-a2a.js +1 -1
  34. package/dist/sdk-agent.js +1 -1
  35. package/dist/sdk-coding.d.ts +8 -8
  36. package/dist/sdk-coding.js +1 -1
  37. package/dist/sdk-experimental-memory.js +1 -1
  38. package/dist/sdk-mcp.js +1 -1
  39. package/dist/sdk-repl.d.ts +9 -11
  40. package/dist/sdk-repl.js +1 -1
  41. package/dist/sdk-runtime.d.ts +14 -6
  42. package/dist/sdk-runtime.js +1 -1
  43. package/dist/sdk-sandbox.d.ts +1 -1
  44. package/dist/sdk-sandbox.js +1 -1
  45. package/dist/sdk-session.d.ts +3 -3
  46. package/dist/sdk-session.js +1 -1
  47. package/dist/sdk-skills.js +1 -1
  48. package/dist/semantic-worker.js +63 -64
  49. package/dist/types-chunks/{bash-prefix-extractor.d-BnZQDirs.d.ts → bash-prefix-extractor.d-QqKtuLZm.d.ts} +9 -3
  50. package/dist/types-chunks/{guardrail.d-BCkgaWT1.d.ts → guardrail.d-Y_AIh8-I.d.ts} +1 -7
  51. package/dist/types-chunks/{public-api.d-N6G6Jw8X.d.ts → public-api.d-Cg-4GTbK.d.ts} +1 -1
  52. package/dist/types-chunks/{repl.d-BkTIOkJD.d.ts → repl.d-Bhrbueab.d.ts} +4 -4
  53. package/dist/types-chunks/{sdk-session-DLkZTOc-.d.ts → sdk-session-fQ_KENev.d.ts} +1 -1
  54. package/dist/types-chunks/{shell-command-sets.d-BrLw-WN9.d.ts → shell-command-sets.d-DRGjd_7Q.d.ts} +1 -1
  55. package/dist/types-chunks/{types.d-Ch3BD97c.d.ts → types.d-BRrJU4pb.d.ts} +1 -1
  56. package/dist/types-chunks/{utils.d-BI-kjuev.d.ts → utils.d-BIhh_BqE.d.ts} +3 -3
  57. package/package.json +1 -1
  58. package/dist/chunks/argument-completer-IMRSIF2N.js +0 -2
  59. package/dist/chunks/chunk-2XJQNFVR.js +0 -379
  60. package/dist/chunks/chunk-CDWYKVZC.js +0 -482
  61. package/dist/chunks/chunk-RTFVMEF6.js +0 -415
  62. package/dist/chunks/host-LWUSSCWH.js +0 -2
  63. package/dist/chunks/run-manager-PBMOVP7A.js +0 -2
package/README.md CHANGED
@@ -1,605 +1,605 @@
1
- <p align="center">
2
- <picture>
3
- <source media="(prefers-color-scheme: dark)" srcset="assets/logo-dark.svg">
4
- <source media="(prefers-color-scheme: light)" srcset="assets/logo-light.svg">
5
- <img src="assets/logo-light.svg" alt="KodaX" width="640">
6
- </picture>
7
- </p>
8
-
9
- <p align="center">
10
- <b>Source-available AI coding agent on every LLM you can reach.</b><br>
11
- Anthropic · OpenAI · DeepSeek · Kimi · Zhipu · MiniMax · MiMo · Ark · Qwen · Gemini · Codex.<br>
12
- REPL · CLI · library · Node-free single binary.
13
- </p>
14
-
15
- <p align="center">
16
- <a href="https://www.npmjs.com/package/@kodax-ai/kodax"><img alt="npm version" src="https://img.shields.io/npm/v/@kodax-ai/kodax?style=flat-square&color=cb3837"></a>
17
- <a href="LICENSE"><img alt="license" src="https://img.shields.io/badge/license-KAI--FCL_1.0-orange?style=flat-square"></a>
18
- <a href="https://github.com/icetomoyo/KodaX/stargazers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/icetomoyo/KodaX?style=flat-square&logo=github&color=f1c40f"></a>
19
- <a href="https://github.com/icetomoyo/KodaX/actions"><img alt="CI" src="https://img.shields.io/github/actions/workflow/status/icetomoyo/KodaX/release.yml?style=flat-square&label=release"></a>
20
- <img alt="providers" src="https://img.shields.io/badge/LLMs-16_aliases_+_custom-2ecc71?style=flat-square">
21
- </p>
22
-
23
- <p align="center">
24
- <a href="#install-in-30-seconds">Install</a> ·
25
- <a href="#four-ways-to-use-kodax">Usage</a> ·
26
- <a href="#sdk-usage">SDK</a> ·
27
- <a href="CHANGELOG.md">Changelog</a> ·
28
- <a href="docs/FEATURE_LIST.md">Roadmap</a> ·
29
- <a href="https://github.com/icetomoyo/KodaX/discussions">Discussions</a> ·
30
- <a href="README_CN.md">中文 README</a>
31
- </p>
32
-
33
- <p align="center">
34
- <img src="kodax-hd.gif" alt="KodaX in action" width="880">
35
- </p>
36
-
37
- ---
38
-
39
- ## Install in 30 seconds
40
-
41
- ```bash
42
- npm i -g @kodax-ai/kodax
43
-
44
- # Pick any one you have an API key for (`kodax setup --help` lists all):
45
- export ZHIPU_API_KEY=... # ANTHROPIC_API_KEY / OPENAI_API_KEY / DEEPSEEK_API_KEY /
46
- # KIMI_API_KEY / KIMI_CODE_API_KEY / QWEN_API_KEY /
47
- # QWEN_TOKEN_API_KEY / ZHIPU_CODING_API_KEY /
48
- # ZAI_CODING_API_KEY / MINIMAX_CODING_API_KEY /
49
- # MIMO_API_KEY / MIMO_CODING_API_KEY / ARK_CODING_API_KEY
50
-
51
- kodax
52
- ```
53
-
54
- That's it. You're in the REPL — ask anything in natural language. On a new
55
- machine, bare interactive `kodax` first checks for supported API-key environment
56
- variables. If none exists, KodaX only prints Windows, macOS, and Linux setup
57
- instructions and exits without creating configuration or collecting a key.
58
- After setting the variable, close the current terminal, open a new one, and run
59
- `kodax` again. If a supported credential exists but no provider is selected,
60
- KodaX opens the provider/model metadata setup. Use `kodax setup` to rerun the
61
- flow, `kodax setup --custom` for a guided custom provider, and
62
- `kodax setup --help` (or REPL `/setup --help`) for paths, provider variables,
63
- commands, and shortcuts. Interactive setup also checks the optional ASRT sandbox once:
64
- Windows may show a one-time UAC prompt; macOS/Linux report any required
65
- Seatbelt/bubblewrap dependencies. Declining or missing a dependency does not
66
- break ordinary permission handling, and normal startup will not keep reminding
67
- you.
68
-
69
- > **No-Node target machines:** download a Bun-compiled single binary for Windows / macOS / Linux × x64 + arm64 from the [GitHub Releases](https://github.com/icetomoyo/KodaX/releases) page. See [docs/release.md](docs/release.md) for the build pipeline.
70
-
71
- ---
72
-
73
- ## Four ways to use KodaX
74
-
75
- | Form | Command / Import | When to use it |
76
- |---|---|---|
77
- | **REPL** | `kodax` | Interactive multi-turn coding session with streaming UI, permissions, slash commands |
78
- | **CLI** | `kodax -p "your task"` | One-shot scripted task, CI runs, batch processing |
79
- | **Library** | `import { runKodaX } from '@kodax-ai/kodax'` | Embed in your own tool / agent / web service |
80
- | **Single binary** | `./kodax` | Distribute to machines that don't have Node installed |
81
-
82
- ---
83
-
84
- ## Why KodaX
85
-
86
- <table>
87
- <tr>
88
- <td width="33%" align="center" valign="top">
89
- <h3>🇨🇳 6 China-native LLMs</h3>
90
- <sub>Zhipu · Kimi · MiniMax · MiMo · Ark · Qwen</sub>
91
- <br><br>
92
- First-class adapters with cross-provider <a href="benchmark/EVAL_GUIDELINES.md">prompt-eval calibration</a> on a canonical 5-alias panel — not OpenAI-compat shims.
93
- </td>
94
- <td width="33%" align="center" valign="top">
95
- <h3>📦 Single-file binary</h3>
96
- <sub>Bun --compile · Win / macOS / Linux · x64 + arm64</sub>
97
- <br><br>
98
- No Node required on the target machine. Drop one file, run anywhere — restricted envs, CI runners, air-gapped boxes.
99
- </td>
100
- <td width="33%" align="center" valign="top">
101
- <h3>🌳 Branchable session lineage</h3>
102
- <sub>Fork · rewind · parallel edit</sub>
103
- <br><br>
104
- Conversation history is a DAG, not a list. Powers the upcoming <b>KodaX Space</b> desktop app.
105
- </td>
106
- </tr>
107
- <tr>
108
- <td align="center" valign="top">
109
- <h3>🤖 Multi-agent by default</h3>
110
- <sub>V2 Worker single-loop + Sidecar Verifier + async children</sub>
111
- <br><br>
112
- <code>spawn_agent</code>, <code>send_message</code>, <code>followup_task</code>, <code>interrupt_agent</code>, multi-instance auto-coordination with content-hash safety net.
113
- </td>
114
- <td align="center" valign="top">
115
- <h3>🧩 Skills + self-construction</h3>
116
- <sub>Markdown skills, NL triggers</sub>
117
- <br><br>
118
- 5-stage self-modification staircase (scaffold → validate → stage → test → activate) gated by an 8-invariant admission contract.
119
- </td>
120
- <td align="center" valign="top">
121
- <h3>🛠 50+ built-in tools</h3>
122
- <sub>File · shell · search · MCP · ACP</sub>
123
- <br><br>
124
- Repo intelligence, semantic search, git worktree, web fetch — all addressable through one clean tool surface.
125
- </td>
126
- </tr>
127
- </table>
128
-
129
- ## How KodaX compares
130
-
131
- | Feature | **KodaX** | Claude Code | Aider | Codex CLI | Cursor | Cline |
132
- |---|---|---|---|---|---|---|
133
- | Source license | ⚠️ KAI-FCL, non-commercial | ❌ Source-available | ✅ Apache&nbsp;2.0 | ✅ Apache&nbsp;2.0 | ❌ Proprietary | ✅ Apache&nbsp;2.0 |
134
- | Node-free single binary | ✅ Bun | ❌ Node | ❌ Python | ✅ Rust | ❌ Electron | ❌ Extension |
135
- | Native China providers<br><sub>(Zhipu · Kimi · MiniMax · MiMo · Ark · Qwen)</sub> | ✅ 6 native | ❌ | ⚠ via LiteLLM | ❌ OpenAI-first | ❌ no provider menu | ⚠ Kimi / Qwen / DeepSeek |
136
- | Branchable session lineage | ✅ fork & rewind | ⚠ routines / sessions | ❌ | ❌ | ❌ | ⚠ checkpoints |
137
- | Multi-agent + MCP + 50+ tools | ✅ all three | ✅ all three | ⚠ tools, no MCP | ✅ all three | ⚠ Composer + MCP | ✅ all three |
138
-
139
- <sub>Data verified May 2026 against public docs ([Claude Code](https://github.com/anthropics/claude-code) · [Aider](https://aider.chat/docs/llms.html) · [Codex CLI](https://github.com/openai/codex) · [Cursor](https://cursor.com) · [Cline](https://github.com/cline/cline)). ⚠ = partial / requires extra setup / not first-class. Corrections welcome via PR.</sub>
140
-
141
- ## Detailed Setup
142
-
143
- > The `npm i -g @kodax-ai/kodax` one-liner above is the fastest path. This section is for building from source, configuring custom providers, or using KodaX as a library.
144
-
145
- ### 1. Build the CLI from source
146
-
147
- ```bash
148
- git clone https://github.com/icetomoyo/KodaX.git
149
- cd KodaX
150
- npm install
151
- npm run build
152
- npm link
153
- ```
154
-
155
- ### 2. Configure a provider
156
-
157
- KodaX reads API keys from environment variables. For built-in providers, the fastest path is:
158
-
159
- ```bash
160
- # Interactive metadata-only provider/model setup (does not collect a key)
161
- kodax setup
162
-
163
- # Guided custom OpenAI/Anthropic-compatible provider
164
- kodax setup --custom
165
-
166
- # Complete guide; does not change files
167
- kodax setup --help
168
- ```
169
-
170
- Setup checks these active files and matching `*.example.jsonc` references:
171
-
172
- - `~/.kodax/config.json` and `~/.kodax/config.example.jsonc`
173
- - `~/.kodax/integrations/mcp.json`
174
- - `~/.kodax/integrations/extensions.json`
175
- - `~/.kodax/integrations/a2a.json`
176
-
177
- The core active file remains strict JSON. The first line of the annotated
178
- `config.example.jsonc` points to all split files and documents every supported
179
- core setting. Setup preserves existing files and stages readable legacy
180
- `config.json#mcpServers` / `config.json#extensions` before creating empty
181
- authoritative split files. It tells you the exact environment-variable name to
182
- set and exits so you can restart the terminal. Existing active files are
183
- validated first; an invalid file is reported without creating or overwriting
184
- configuration. For a custom provider, setup asks for an `apiKeyEnv` name such
185
- as `MY_LLM_API_KEY`, not the API key itself. `config.json` stores that name
186
- only; after setup, set the environment variable with exactly that name to the
187
- provider's actual API key. KodaX does not set the OS environment variable for
188
- you. You can also configure it directly:
189
-
190
- ```bash
191
- # macOS / Linux
192
- export ZHIPU_API_KEY=your_api_key
193
-
194
- # PowerShell
195
- $env:ZHIPU_API_KEY="your_api_key"
196
- ```
197
-
198
- ### 2.1 Activate the optional sandbox
199
-
200
- `kodax setup` and first-run setup check sandbox readiness. You can inspect or
201
- activate it explicitly:
202
-
203
- ```bash
204
- kodax sandbox doctor
205
- kodax sandbox setup
206
- ```
207
-
208
- - Windows uses a restricted sandbox account and network policy. A normal
209
- terminal is sufficient; approve the one-time UAC prompt.
210
- - macOS uses Seatbelt/`sandbox-exec` and requires ripgrep
211
- (`brew install ripgrep`).
212
- - Linux uses bubblewrap and requires `bubblewrap`, `socat`, and `ripgrep`
213
- (install them with your distro's `apt`, `dnf`, or `pacman`).
214
-
215
- KodaX never runs `sudo` or a package manager automatically. If the sandbox is
216
- not active, deterministic safe operations and Auto[LLM] decisions keep the
217
- same permission behavior; only OS-level containment is absent. Ordinary runs
218
- do not repeatedly prompt for setup. In the REPL, `/sandbox` refreshes readiness
219
- and diagnostics without activating the backend or requesting elevation.
220
- Per-command sandbox routing remains internal and is not shown in normal command
221
- history. SDK embedders can use the same capability independently through
222
- `@kodax-ai/kodax/sandbox`; see the
223
- [SDK sandbox guide](public_docs/sdk/embedder-guide.md#30-standalone-sandbox-sdk-v0778).
224
-
225
- Credential-shaped environment variables are filtered from model-issued shell
226
- commands by default. To expose exact host variables to those command targets,
227
- including ASRT, add only their names to the user-level core config:
228
-
229
- ```json
230
- {
231
- "sandbox": {
232
- "envPass": ["GH_TOKEN", "GITHUB_TOKEN", "OPENAI_API_KEY"]
233
- }
234
- }
235
- ```
236
-
237
- The default list is empty. Values remain in the host environment and are never
238
- stored in `config.json`; project configuration cannot extend the list.
239
- Matching is exact (case-insensitive on Windows), and execution-control
240
- variables such as `NODE_OPTIONS` and `BASH_ENV` remain blocked. Restart KodaX
241
- after changing the host variables or this setting; stop/restart a persistent
242
- KodaX daemon so it receives the new environment and configuration.
243
- SDK callers pass the same shape per Run as `KodaXOptions.sandbox`, so concurrent
244
- Runs can use different lists without mutating process-global configuration.
245
-
246
- For Qwen Token Plan, select `qwen-token-plan` and use its separate credential;
247
- `QWEN_API_KEY` does not authenticate this route:
248
-
249
- ```bash
250
- export QWEN_TOKEN_API_KEY=your_api_key
251
- kodax --provider qwen-token-plan
252
- ```
253
-
254
- For CLI defaults, create `~/.kodax/config.json`:
255
-
256
- ```json
257
- {
258
- "provider": "zhipu-coding",
259
- "effort": "auto"
260
- }
261
- ```
262
-
263
- If you need a custom base URL or an OpenAI/Anthropic-compatible endpoint, define a custom provider in the same config file:
264
-
265
- ```json
266
- {
267
- "provider": "my-openai-compatible",
268
- "customProviders": [
269
- {
270
- "name": "my-openai-compatible",
271
- "protocol": "openai",
272
- "baseUrl": "https://example.com/v1",
273
- "apiKeyEnv": "MY_LLM_API_KEY",
274
- "model": "my-model",
275
- "userAgentMode": "compat",
276
- "reasoning": {
277
- "efforts": ["off", "low", "medium", "high", "max"],
278
- "default": "high"
279
- }
280
- }
281
- ]
282
- }
283
- ```
284
-
285
- Here, `"apiKeyEnv": "MY_LLM_API_KEY"` is a reference to an environment-variable
286
- name, not an API key value. Put the custom provider's actual API key in the
287
- `MY_LLM_API_KEY` environment variable, then close the current terminal and open
288
- a new one before running `kodax`.
289
-
290
- `userAgentMode` defaults to `"compat"`, which sends `KodaX` instead of the official SDK User-Agent. Switch it to `"sdk"` only when your gateway expects the upstream SDK header.
291
- For custom reasoning models, `reasoning: { efforts, default }` is the preferred v0.7.57 shape; use `"reasoning": "none"` for models without thinking capability. SDK hosts should render effort pickers from `reasoningProfile.supportedEfforts` / `defaultEffort` rather than assuming a fixed five-option ladder.
292
-
293
- #### OpenAI-compatible reasoning providers
294
-
295
- Some OpenAI-compatible reasoning models require KodaX to replay the previous assistant turn's `reasoning_content` on later requests. DeepSeek V4 thinking mode is the known load-bearing case. Built-in DeepSeek already opts in; custom providers must say so explicitly:
296
-
297
- ```json
298
- {
299
- "customProviders": [
300
- {
301
- "name": "my-deepseek-v4",
302
- "protocol": "openai",
303
- "baseUrl": "https://example.com/v1",
304
- "apiKeyEnv": "MY_DEEPSEEK_API_KEY",
305
- "model": "deepseek-v4-flash",
306
- "maxOutputTokensField": "max_tokens",
307
- "reasoningPreset": "deepseek-v4-flash-openai",
308
- "replayReasoningContent": true
309
- }
310
- ]
311
- }
312
- ```
313
-
314
- DeepSeek Chat Completions uses `max_tokens`; OpenAI proper defaults to
315
- `max_completion_tokens`. Keep `replayReasoningContent` unset or `false` for
316
- OpenAI proper and gateways that reject unknown assistant-message fields. If one
317
- gateway routes mixed models, prefer per-model overrides for both fields:
318
-
319
- ```json
320
- {
321
- "models": [
322
- {
323
- "id": "deepseek-v4-flash",
324
- "maxOutputTokensField": "max_tokens",
325
- "reasoningPreset": "deepseek-v4-flash-openai",
326
- "replayReasoningContent": true
327
- },
328
- { "id": "gpt-5", "replayReasoningContent": false }
329
- ]
330
- }
331
- ```
332
-
333
- If a custom endpoint is confirmed to support cache-affinity routing, set
334
- `"promptCacheAffinity": true`. Anthropic-compatible requests then receive the
335
- opaque logical-context key as `metadata.user_id`; OpenAI-compatible requests
336
- receive `prompt_cache_key`. The default is `false` because some strict
337
- compatible gateways reject unknown request fields. Do not enable it solely
338
- because an endpoint claims protocol compatibility.
339
-
340
- Sidecar verifier judge calls use provider-level forced tool choice when supported. If a compatible endpoint rejects the `tool_choice` parameter, KodaX retries that verifier request once without forced tool choice and still fails open rather than blocking the main Worker.
341
-
342
- #### Opting a custom provider into image / vision input (FEATURE_134 v0.7.40)
343
-
344
- If your custom provider's underlying model supports image input (vision), add a `capabilityProfile.multimodalSupport: "image-input"` block so KodaX does not artificially block multimodal requests at the SA-path policy gate. Built-in vision-capable aliases (Anthropic, OpenAI, compatible aliases such as Kimi, Qwen, Zhipu, MiniMax, MiMo, Ark, plus Gemini-CLI via the CLI's `@<path>` file-include syntax) already ship with this flag enabled by default. DeepSeek V4 and Codex-CLI are text-only; custom providers need to opt in when their underlying model supports image input.
345
-
346
- ```json
347
- {
348
- "customProviders": [
349
- {
350
- "name": "my-vision-provider",
351
- "protocol": "openai",
352
- "baseUrl": "https://example.com/v1",
353
- "apiKeyEnv": "MY_LLM_API_KEY",
354
- "model": "my-vision-model",
355
- "capabilityProfile": {
356
- "transport": "native-api",
357
- "conversationSemantics": "full-history",
358
- "mcpSupport": "none",
359
- "contextFidelity": "full",
360
- "toolCallingFidelity": "full",
361
- "sessionSupport": "full",
362
- "longRunningSupport": "full",
363
- "multimodalSupport": "image-input",
364
- "evidenceSupport": "full"
365
- }
366
- }
367
- ]
368
- }
369
- ```
370
-
371
- The serializer layer (`packages/llm/src/providers/anthropic.ts:770` for Anthropic-compat, `openai.ts:904` for OpenAI-compat) forwards image blocks automatically through base-class inheritance. The flag only gates whether KodaX's policy layer pre-rejects multimodal requests — the model-level vision contract remains your upstream provider's responsibility. If the model is actually text-only, you'll see the real upstream API error instead of a KodaX-side rejection.
372
-
373
- ### 3. Start in REPL or run a one-shot task
374
-
375
- ```bash
376
- # Interactive REPL
377
- kodax
378
-
379
- # Then ask naturally inside the REPL
380
- Read package.json and summarize the architecture
381
- /mode
382
- /help
383
-
384
- # One-shot CLI usage
385
- kodax "Review this repository and summarize the architecture"
386
- kodax --session review "Find the riskiest parts of src/"
387
- kodax --session review "Give me concrete fix suggestions"
388
- ```
389
-
390
- ### 4. Use it as a library
391
-
392
- Library usage still expects API keys from environment variables. If you want custom provider names or base URLs in code, register them explicitly:
393
-
394
- ```typescript
395
- import { registerCustomProviders, runKodaX } from '@kodax-ai/kodax';
396
-
397
- registerCustomProviders([
398
- {
399
- name: 'my-openai-compatible',
400
- protocol: 'openai',
401
- baseUrl: 'https://example.com/v1',
402
- apiKeyEnv: 'MY_LLM_API_KEY',
403
- model: 'my-model',
404
- userAgentMode: 'compat',
405
- },
406
- ]);
407
-
408
- const result = await runKodaX(
409
- {
410
- provider: 'my-openai-compatible',
411
- effort: 'auto',
412
- },
413
- 'Explain this codebase'
414
- );
415
- ```
416
-
417
- > **Embedding KodaX inside another app?** (KodaX Space, IDE extensions, custom CLIs)
418
- > See [public_docs/sdk/embedder-guide.md](public_docs/sdk/embedder-guide.md) for the runtime-mutation
419
- > surface (`startKodaX` + `RunningSession`), MCP popout manager API (`McpManager`),
420
- > Skill `` !`cmd` `` host hook, and per-app data dir namespacing (`getAppDataDir`).
421
-
422
- ## Runtime SDK and daemon
423
-
424
- SDK hosts can use `@kodax-ai/kodax/runtime` in three forms: inline embedded for
425
- lowest latency, Worker-hosted embedded for private state plus hard V8 disposal,
426
- or a local daemon shared by REPL, Space, IDE adapters, and custom SDK clients.
427
- All three expose the same `KodaXRuntime` services.
428
-
429
- ```ts
430
- import { createKodaXRuntime } from '@kodax-ai/kodax/runtime';
431
-
432
- const isolated = await createKodaXRuntime({
433
- mode: 'embedded',
434
- isolation: 'worker',
435
- requirements: { hardDispose: true },
436
- });
437
- ```
438
-
439
- Inline is private and lowest-overhead; Worker is private and hard-disposable;
440
- daemon is process-isolated and shared. `runtime.close()` closes private
441
- inline/Worker ownership, but only detaches one daemon client. Contradictory
442
- isolation options fail instead of silently selecting a weaker mode. Worker
443
- isolation is a V8 fault boundary, not a security sandbox.
444
-
445
- Because a daemon is intentionally persistent, tests that auto-start one must
446
- also run `kodax daemon stop --home <dir> --profile <name>` (or send authenticated
447
- `runtime.shutdown`) before deleting their temporary home. A remaining Node
448
- process is not safe to kill by name alone; verify its command line and owner.
449
-
450
- ```bash
451
- kodax daemon start
452
- kodax daemon stop --profile default
453
- kodax --runtime-mode daemon
454
- kodax -p "Review this repository" --runtime-mode daemon
455
- ```
456
-
457
- All CLI task forms now use the same Runtime path: interactive REPL, positional
458
- prompts, slash-command prompts, and `kodax -p`. Select the persistent default in
459
- `~/.kodax/config.json`:
460
-
461
- ```json
462
- {
463
- "runtimeMode": "daemon"
464
- }
465
- ```
466
-
467
- Resolution order is explicit CLI/SDK option > environment variable >
468
- `config.json` > built-in default (`embedded`). `KODAX_RUNTIME_MODE=daemon` is a
469
- temporary environment override. The same rule applies to other paired settings,
470
- for example `provider` ↔ `KODAX_PROVIDER` and `effort` ↔ `KODAX_EFFORT`.
471
- JSON names stay camelCase while environment names use `KODAX_UPPER_SNAKE_CASE`.
472
-
473
- By default, daemon state, config, and runtime session storage use the exact
474
- resolved `KODAX_HOME` (normally `<OS user home>/.kodax`), so CLI and SDK clients
475
- converge on the same local daemon even when `KODAX_HOME` is an arbitrary custom
476
- directory. The high-level `createKodaXRuntime({ mode: 'daemon' })` API starts or
477
- reuses that daemon unless you pass an explicit endpoint/transport or
478
- `autoStartDaemon: false`. An explicit `--home <dir>` or `homeDir` selects the
479
- isolated `<dir>/.kodax` namespace for tests, CI, or project-local experiments.
480
-
481
- **v0.7.71 packaged Electron patch:** packaged/asar Electron hosts can use daemon
482
- auto-start without relaunching the GUI. `ELECTRON_RUN_AS_NODE` is limited to a
483
- bootstrap-only child exec boundary and removed before daemon or ordinary user
484
- child code loads. The default-enabled Electron `RunAsNode` fuse is required;
485
- hosts that disable it must start the daemon through ordinary Node/KodaX CLI and
486
- connect in attach-only mode. For SDK calls, `homeDir` is the CLI-style base
487
- directory that owns `.kodax`, not the `.kodax` path itself.
488
-
489
- **v0.7.75 Windows GUI stabilization candidate:** Runtime Worker-reachable
490
- non-interactive subprocesses request hidden Windows consoles across memory/Git,
491
- provider CLI/ACP, LSP, clipboard, worktree, review, extension-command,
492
- checkpoint, and sandbox paths. Explicit editor, terminal, and PTY behavior is
493
- unchanged. The SDK bundle includes a static child-process audit and a packaged
494
- Electron 20-query console-visibility regression. Product-level packaged KodaX
495
- Space verification remains useful but does not gate SDK packaging or
496
- publication.
497
-
498
- The same candidate distinguishes optional post-completion offers from
499
- clarification required to finish the current request, emits budget-approval
500
- state only for eligible Sidecar revisions, and preserves structured blocked
501
- reasons across embedded and daemon Runtime boundaries.
502
-
503
- **v0.7.76 Kimi Code catalog refresh:** `kimi-code` now defaults to the official
504
- `k3-256k` Model ID and sends it unchanged. `kimi-for-coding` remains selectable
505
- for K2.7 Code, alongside `kimi-for-coding-highspeed` and the 1M `k3` tier. K3
506
- supports `low` / `high` / `max` reasoning with `high` as default; the 256K
507
- route supports image input but not video input.
508
-
509
- **v0.7.77 release:** AMA now chooses and composes six named
510
- problem-solving patterns through the existing Actor control plane instead of
511
- using a fixed topology or hidden Workflow. Optional strategy metadata becomes
512
- a bounded, fact-only `PatternTrace`; the existing Sidecar remains the only
513
- terminal-answer quality judge. Governed memory can also react sparsely after a
514
- tool failure, verification failure, or committed compaction and place at most
515
- three prompt-safe, low-authority evidence items before the next Action-LLM
516
- request. The default path adds no selector model call; SDK hosts may opt into
517
- `memoryRecallRunner` in process. Public `kimi` also gains the 1M `kimi-k3`
518
- route while retaining K2.7 Code as its default. See the
519
- [v0.7.77 design](docs/features/v0.7.77.md) and
520
- [release checklist](docs/release.md#v0777-release-ready-candidate-verification).
521
- The frozen F274/F275 paid evaluation completed with `recommend-ship` from the
522
- final F274 Layer 2/Layer 3 reviews and the F275 pilot review, followed by a
523
- joint `SHIP` decision for the deterministic contracts. Semantic memory
524
- selection remains experimental and host opt-in; no task-quality, token, or
525
- latency improvement is claimed.
526
-
527
- **v0.7.78 evidence-gated learning, setup, and permission/sandbox release:**
528
- Background learning is Memory-first. Only repeated independently verified
529
- evidence, or an explicit preserve-as-Skill request with verified terminal
530
- evidence, can admit a low-risk declarative Skill to a bounded immutable
531
- project canary; three exact-revision uses and independently verified success
532
- are required before automatic project trust. Every revision remains visible
533
- and reversible in `/learn`. Protected/formal Skills, global promotion, and
534
- Extension authoring remain explicit user actions.
535
-
536
- First-run setup now creates and validates the split core/MCP/Extensions/A2A
537
- files and annotated templates without overwriting existing configuration or
538
- collecting secrets. Auto[LLM] admits precisely modeled ordinary reads and
539
- workspace/temp mutations before classifier latency, retries classifier
540
- infrastructure failure once, then falls back at the Accept-edits boundary
541
- without switching to rules. ASRT is optional execution containment rather
542
- than permission authority; `/sandbox` is the explicit diagnostic surface, and
543
- SDK hosts can use the standalone `/sandbox` subpath without a silent
544
- unsandboxed fallback. KodaX's workspace containment denies reads from common
545
- home credential paths and the complete resolved agent home without turning
546
- ordinary external reads into an allowlist. See the
547
- [v0.7.78 design](docs/features/v0.7.78.md), the
548
- [release checklist](docs/release.md#v0778-release-verification), and
549
- [SDK guide sections 29–30](public_docs/sdk/embedder-guide.md#29-evidence-gated-background-skill-learning-feature_263-v0778).
550
-
551
- The release closure also preserves intent across adjacent surfaces: static
552
- Skill instructions load in Edit/Plan without granting later side effects,
1
+ <p align="center">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="assets/logo-dark.svg">
4
+ <source media="(prefers-color-scheme: light)" srcset="assets/logo-light.svg">
5
+ <img src="assets/logo-light.svg" alt="KodaX" width="640">
6
+ </picture>
7
+ </p>
8
+
9
+ <p align="center">
10
+ <b>Source-available AI coding agent on every LLM you can reach.</b><br>
11
+ Anthropic · OpenAI · DeepSeek · Kimi · Zhipu · MiniMax · MiMo · Ark · Qwen · Gemini · Codex.<br>
12
+ REPL · CLI · library · Node-free single binary.
13
+ </p>
14
+
15
+ <p align="center">
16
+ <a href="https://www.npmjs.com/package/@kodax-ai/kodax"><img alt="npm version" src="https://img.shields.io/npm/v/@kodax-ai/kodax?style=flat-square&color=cb3837"></a>
17
+ <a href="LICENSE"><img alt="license" src="https://img.shields.io/badge/license-KAI--FCL_1.0-orange?style=flat-square"></a>
18
+ <a href="https://github.com/icetomoyo/KodaX/stargazers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/icetomoyo/KodaX?style=flat-square&logo=github&color=f1c40f"></a>
19
+ <a href="https://github.com/icetomoyo/KodaX/actions"><img alt="CI" src="https://img.shields.io/github/actions/workflow/status/icetomoyo/KodaX/release.yml?style=flat-square&label=release"></a>
20
+ <img alt="providers" src="https://img.shields.io/badge/LLMs-16_aliases_+_custom-2ecc71?style=flat-square">
21
+ </p>
22
+
23
+ <p align="center">
24
+ <a href="#install-in-30-seconds">Install</a> ·
25
+ <a href="#four-ways-to-use-kodax">Usage</a> ·
26
+ <a href="#sdk-usage">SDK</a> ·
27
+ <a href="CHANGELOG.md">Changelog</a> ·
28
+ <a href="docs/FEATURE_LIST.md">Roadmap</a> ·
29
+ <a href="https://github.com/icetomoyo/KodaX/discussions">Discussions</a> ·
30
+ <a href="README_CN.md">中文 README</a>
31
+ </p>
32
+
33
+ <p align="center">
34
+ <img src="kodax-hd.gif" alt="KodaX in action" width="880">
35
+ </p>
36
+
37
+ ---
38
+
39
+ ## Install in 30 seconds
40
+
41
+ ```bash
42
+ npm i -g @kodax-ai/kodax
43
+
44
+ # Pick any one you have an API key for (`kodax setup --help` lists all):
45
+ export ZHIPU_API_KEY=... # ANTHROPIC_API_KEY / OPENAI_API_KEY / DEEPSEEK_API_KEY /
46
+ # KIMI_API_KEY / KIMI_CODE_API_KEY / QWEN_API_KEY /
47
+ # QWEN_TOKEN_API_KEY / ZHIPU_CODING_API_KEY /
48
+ # ZAI_CODING_API_KEY / MINIMAX_CODING_API_KEY /
49
+ # MIMO_API_KEY / MIMO_CODING_API_KEY / ARK_CODING_API_KEY
50
+
51
+ kodax
52
+ ```
53
+
54
+ That's it. You're in the REPL — ask anything in natural language. On a new
55
+ machine, bare interactive `kodax` first checks for supported API-key environment
56
+ variables. If none exists, KodaX only prints Windows, macOS, and Linux setup
57
+ instructions and exits without creating configuration or collecting a key.
58
+ After setting the variable, close the current terminal, open a new one, and run
59
+ `kodax` again. If a supported credential exists but no provider is selected,
60
+ KodaX opens the provider/model metadata setup. Use `kodax setup` to rerun the
61
+ flow, `kodax setup --custom` for a guided custom provider, and
62
+ `kodax setup --help` (or REPL `/setup --help`) for paths, provider variables,
63
+ commands, and shortcuts. Interactive setup also checks the optional ASRT sandbox once:
64
+ Windows may show a one-time UAC prompt; macOS/Linux report any required
65
+ Seatbelt/bubblewrap dependencies. Declining or missing a dependency does not
66
+ break ordinary permission handling, and normal startup will not keep reminding
67
+ you.
68
+
69
+ > **No-Node target machines:** download a Bun-compiled single binary for Windows / macOS / Linux × x64 + arm64 from the [GitHub Releases](https://github.com/icetomoyo/KodaX/releases) page. See [docs/release.md](docs/release.md) for the build pipeline.
70
+
71
+ ---
72
+
73
+ ## Four ways to use KodaX
74
+
75
+ | Form | Command / Import | When to use it |
76
+ |---|---|---|
77
+ | **REPL** | `kodax` | Interactive multi-turn coding session with streaming UI, permissions, slash commands |
78
+ | **CLI** | `kodax -p "your task"` | One-shot scripted task, CI runs, batch processing |
79
+ | **Library** | `import { runKodaX } from '@kodax-ai/kodax'` | Embed in your own tool / agent / web service |
80
+ | **Single binary** | `./kodax` | Distribute to machines that don't have Node installed |
81
+
82
+ ---
83
+
84
+ ## Why KodaX
85
+
86
+ <table>
87
+ <tr>
88
+ <td width="33%" align="center" valign="top">
89
+ <h3>🇨🇳 6 China-native LLMs</h3>
90
+ <sub>Zhipu · Kimi · MiniMax · MiMo · Ark · Qwen</sub>
91
+ <br><br>
92
+ First-class adapters with cross-provider <a href="benchmark/EVAL_GUIDELINES.md">prompt-eval calibration</a> on a canonical 5-alias panel — not OpenAI-compat shims.
93
+ </td>
94
+ <td width="33%" align="center" valign="top">
95
+ <h3>📦 Single-file binary</h3>
96
+ <sub>Bun --compile · Win / macOS / Linux · x64 + arm64</sub>
97
+ <br><br>
98
+ No Node required on the target machine. Drop one file, run anywhere — restricted envs, CI runners, air-gapped boxes.
99
+ </td>
100
+ <td width="33%" align="center" valign="top">
101
+ <h3>🌳 Branchable session lineage</h3>
102
+ <sub>Fork · rewind · parallel edit</sub>
103
+ <br><br>
104
+ Conversation history is a DAG, not a list. Powers the upcoming <b>KodaX Space</b> desktop app.
105
+ </td>
106
+ </tr>
107
+ <tr>
108
+ <td align="center" valign="top">
109
+ <h3>🤖 Multi-agent by default</h3>
110
+ <sub>V2 Worker single-loop + Sidecar Verifier + async children</sub>
111
+ <br><br>
112
+ <code>spawn_agent</code>, <code>send_message</code>, <code>followup_task</code>, <code>interrupt_agent</code>, multi-instance auto-coordination with content-hash safety net.
113
+ </td>
114
+ <td align="center" valign="top">
115
+ <h3>🧩 Skills + self-construction</h3>
116
+ <sub>Markdown skills, NL triggers</sub>
117
+ <br><br>
118
+ 5-stage self-modification staircase (scaffold → validate → stage → test → activate) gated by an 8-invariant admission contract.
119
+ </td>
120
+ <td align="center" valign="top">
121
+ <h3>🛠 50+ built-in tools</h3>
122
+ <sub>File · shell · search · MCP · ACP</sub>
123
+ <br><br>
124
+ Repo intelligence, semantic search, git worktree, web fetch — all addressable through one clean tool surface.
125
+ </td>
126
+ </tr>
127
+ </table>
128
+
129
+ ## How KodaX compares
130
+
131
+ | Feature | **KodaX** | Claude Code | Aider | Codex CLI | Cursor | Cline |
132
+ |---|---|---|---|---|---|---|
133
+ | Source license | ⚠️ KAI-FCL, non-commercial | ❌ Source-available | ✅ Apache&nbsp;2.0 | ✅ Apache&nbsp;2.0 | ❌ Proprietary | ✅ Apache&nbsp;2.0 |
134
+ | Node-free single binary | ✅ Bun | ❌ Node | ❌ Python | ✅ Rust | ❌ Electron | ❌ Extension |
135
+ | Native China providers<br><sub>(Zhipu · Kimi · MiniMax · MiMo · Ark · Qwen)</sub> | ✅ 6 native | ❌ | ⚠ via LiteLLM | ❌ OpenAI-first | ❌ no provider menu | ⚠ Kimi / Qwen / DeepSeek |
136
+ | Branchable session lineage | ✅ fork & rewind | ⚠ routines / sessions | ❌ | ❌ | ❌ | ⚠ checkpoints |
137
+ | Multi-agent + MCP + 50+ tools | ✅ all three | ✅ all three | ⚠ tools, no MCP | ✅ all three | ⚠ Composer + MCP | ✅ all three |
138
+
139
+ <sub>Data verified May 2026 against public docs ([Claude Code](https://github.com/anthropics/claude-code) · [Aider](https://aider.chat/docs/llms.html) · [Codex CLI](https://github.com/openai/codex) · [Cursor](https://cursor.com) · [Cline](https://github.com/cline/cline)). ⚠ = partial / requires extra setup / not first-class. Corrections welcome via PR.</sub>
140
+
141
+ ## Detailed Setup
142
+
143
+ > The `npm i -g @kodax-ai/kodax` one-liner above is the fastest path. This section is for building from source, configuring custom providers, or using KodaX as a library.
144
+
145
+ ### 1. Build the CLI from source
146
+
147
+ ```bash
148
+ git clone https://github.com/icetomoyo/KodaX.git
149
+ cd KodaX
150
+ npm install
151
+ npm run build
152
+ npm link
153
+ ```
154
+
155
+ ### 2. Configure a provider
156
+
157
+ KodaX reads API keys from environment variables. For built-in providers, the fastest path is:
158
+
159
+ ```bash
160
+ # Interactive metadata-only provider/model setup (does not collect a key)
161
+ kodax setup
162
+
163
+ # Guided custom OpenAI/Anthropic-compatible provider
164
+ kodax setup --custom
165
+
166
+ # Complete guide; does not change files
167
+ kodax setup --help
168
+ ```
169
+
170
+ Setup checks these active files and matching `*.example.jsonc` references:
171
+
172
+ - `~/.kodax/config.json` and `~/.kodax/config.example.jsonc`
173
+ - `~/.kodax/integrations/mcp.json`
174
+ - `~/.kodax/integrations/extensions.json`
175
+ - `~/.kodax/integrations/a2a.json`
176
+
177
+ The core active file remains strict JSON. The first line of the annotated
178
+ `config.example.jsonc` points to all split files and documents every supported
179
+ core setting. Setup preserves existing files and stages readable legacy
180
+ `config.json#mcpServers` / `config.json#extensions` before creating empty
181
+ authoritative split files. It tells you the exact environment-variable name to
182
+ set and exits so you can restart the terminal. Existing active files are
183
+ validated first; an invalid file is reported without creating or overwriting
184
+ configuration. For a custom provider, setup asks for an `apiKeyEnv` name such
185
+ as `MY_LLM_API_KEY`, not the API key itself. `config.json` stores that name
186
+ only; after setup, set the environment variable with exactly that name to the
187
+ provider's actual API key. KodaX does not set the OS environment variable for
188
+ you. You can also configure it directly:
189
+
190
+ ```bash
191
+ # macOS / Linux
192
+ export ZHIPU_API_KEY=your_api_key
193
+
194
+ # PowerShell
195
+ $env:ZHIPU_API_KEY="your_api_key"
196
+ ```
197
+
198
+ ### 2.1 Activate the optional sandbox
199
+
200
+ `kodax setup` and first-run setup check sandbox readiness. You can inspect or
201
+ activate it explicitly:
202
+
203
+ ```bash
204
+ kodax sandbox doctor
205
+ kodax sandbox setup
206
+ ```
207
+
208
+ - Windows uses a restricted sandbox account and network policy. A normal
209
+ terminal is sufficient; approve the one-time UAC prompt.
210
+ - macOS uses Seatbelt/`sandbox-exec` and requires ripgrep
211
+ (`brew install ripgrep`).
212
+ - Linux uses bubblewrap and requires `bubblewrap`, `socat`, and `ripgrep`
213
+ (install them with your distro's `apt`, `dnf`, or `pacman`).
214
+
215
+ KodaX never runs `sudo` or a package manager automatically. If the sandbox is
216
+ not active, deterministic safe operations and Auto[LLM] decisions keep the
217
+ same permission behavior; only OS-level containment is absent. Ordinary runs
218
+ do not repeatedly prompt for setup. In the REPL, `/sandbox` refreshes readiness
219
+ and diagnostics without activating the backend or requesting elevation.
220
+ Per-command sandbox routing remains internal and is not shown in normal command
221
+ history. SDK embedders can use the same capability independently through
222
+ `@kodax-ai/kodax/sandbox`; see the
223
+ [SDK sandbox guide](public_docs/sdk/embedder-guide.md#30-standalone-sandbox-sdk-v0778).
224
+
225
+ Credential-shaped environment variables are filtered from model-issued shell
226
+ commands by default. To expose exact host variables to those command targets,
227
+ including ASRT, add only their names to the user-level core config:
228
+
229
+ ```json
230
+ {
231
+ "sandbox": {
232
+ "envPass": ["GH_TOKEN", "GITHUB_TOKEN", "OPENAI_API_KEY"]
233
+ }
234
+ }
235
+ ```
236
+
237
+ The default list is empty. Values remain in the host environment and are never
238
+ stored in `config.json`; project configuration cannot extend the list.
239
+ Matching is exact (case-insensitive on Windows), and execution-control
240
+ variables such as `NODE_OPTIONS` and `BASH_ENV` remain blocked. Restart KodaX
241
+ after changing the host variables or this setting; stop/restart a persistent
242
+ KodaX daemon so it receives the new environment and configuration.
243
+ SDK callers pass the same shape per Run as `KodaXOptions.sandbox`, so concurrent
244
+ Runs can use different lists without mutating process-global configuration.
245
+
246
+ For Qwen Token Plan, select `qwen-token-plan` and use its separate credential;
247
+ `QWEN_API_KEY` does not authenticate this route:
248
+
249
+ ```bash
250
+ export QWEN_TOKEN_API_KEY=your_api_key
251
+ kodax --provider qwen-token-plan
252
+ ```
253
+
254
+ For CLI defaults, create `~/.kodax/config.json`:
255
+
256
+ ```json
257
+ {
258
+ "provider": "zhipu-coding",
259
+ "effort": "auto"
260
+ }
261
+ ```
262
+
263
+ If you need a custom base URL or an OpenAI/Anthropic-compatible endpoint, define a custom provider in the same config file:
264
+
265
+ ```json
266
+ {
267
+ "provider": "my-openai-compatible",
268
+ "customProviders": [
269
+ {
270
+ "name": "my-openai-compatible",
271
+ "protocol": "openai",
272
+ "baseUrl": "https://example.com/v1",
273
+ "apiKeyEnv": "MY_LLM_API_KEY",
274
+ "model": "my-model",
275
+ "userAgentMode": "compat",
276
+ "reasoning": {
277
+ "efforts": ["off", "low", "medium", "high", "max"],
278
+ "default": "high"
279
+ }
280
+ }
281
+ ]
282
+ }
283
+ ```
284
+
285
+ Here, `"apiKeyEnv": "MY_LLM_API_KEY"` is a reference to an environment-variable
286
+ name, not an API key value. Put the custom provider's actual API key in the
287
+ `MY_LLM_API_KEY` environment variable, then close the current terminal and open
288
+ a new one before running `kodax`.
289
+
290
+ `userAgentMode` defaults to `"compat"`, which sends `KodaX` instead of the official SDK User-Agent. Switch it to `"sdk"` only when your gateway expects the upstream SDK header.
291
+ For custom reasoning models, `reasoning: { efforts, default }` is the preferred v0.7.57 shape; use `"reasoning": "none"` for models without thinking capability. SDK hosts should render effort pickers from `reasoningProfile.supportedEfforts` / `defaultEffort` rather than assuming a fixed five-option ladder.
292
+
293
+ #### OpenAI-compatible reasoning providers
294
+
295
+ Some OpenAI-compatible reasoning models require KodaX to replay the previous assistant turn's `reasoning_content` on later requests. DeepSeek V4 thinking mode is the known load-bearing case. Built-in DeepSeek already opts in; custom providers must say so explicitly:
296
+
297
+ ```json
298
+ {
299
+ "customProviders": [
300
+ {
301
+ "name": "my-deepseek-v4",
302
+ "protocol": "openai",
303
+ "baseUrl": "https://example.com/v1",
304
+ "apiKeyEnv": "MY_DEEPSEEK_API_KEY",
305
+ "model": "deepseek-v4-flash",
306
+ "maxOutputTokensField": "max_tokens",
307
+ "reasoningPreset": "deepseek-v4-flash-openai",
308
+ "replayReasoningContent": true
309
+ }
310
+ ]
311
+ }
312
+ ```
313
+
314
+ DeepSeek Chat Completions uses `max_tokens`; OpenAI proper defaults to
315
+ `max_completion_tokens`. Keep `replayReasoningContent` unset or `false` for
316
+ OpenAI proper and gateways that reject unknown assistant-message fields. If one
317
+ gateway routes mixed models, prefer per-model overrides for both fields:
318
+
319
+ ```json
320
+ {
321
+ "models": [
322
+ {
323
+ "id": "deepseek-v4-flash",
324
+ "maxOutputTokensField": "max_tokens",
325
+ "reasoningPreset": "deepseek-v4-flash-openai",
326
+ "replayReasoningContent": true
327
+ },
328
+ { "id": "gpt-5", "replayReasoningContent": false }
329
+ ]
330
+ }
331
+ ```
332
+
333
+ If a custom endpoint is confirmed to support cache-affinity routing, set
334
+ `"promptCacheAffinity": true`. Anthropic-compatible requests then receive the
335
+ opaque logical-context key as `metadata.user_id`; OpenAI-compatible requests
336
+ receive `prompt_cache_key`. The default is `false` because some strict
337
+ compatible gateways reject unknown request fields. Do not enable it solely
338
+ because an endpoint claims protocol compatibility.
339
+
340
+ Sidecar verifier judge calls use provider-level forced tool choice when supported. If a compatible endpoint rejects the `tool_choice` parameter, KodaX retries that verifier request once without forced tool choice and still fails open rather than blocking the main Worker.
341
+
342
+ #### Opting a custom provider into image / vision input (FEATURE_134 v0.7.40)
343
+
344
+ If your custom provider's underlying model supports image input (vision), add a `capabilityProfile.multimodalSupport: "image-input"` block so KodaX does not artificially block multimodal requests at the SA-path policy gate. Built-in vision-capable aliases (Anthropic, OpenAI, compatible aliases such as Kimi, Qwen, Zhipu, MiniMax, MiMo, Ark, plus Gemini-CLI via the CLI's `@<path>` file-include syntax) already ship with this flag enabled by default. DeepSeek V4 and Codex-CLI are text-only; custom providers need to opt in when their underlying model supports image input.
345
+
346
+ ```json
347
+ {
348
+ "customProviders": [
349
+ {
350
+ "name": "my-vision-provider",
351
+ "protocol": "openai",
352
+ "baseUrl": "https://example.com/v1",
353
+ "apiKeyEnv": "MY_LLM_API_KEY",
354
+ "model": "my-vision-model",
355
+ "capabilityProfile": {
356
+ "transport": "native-api",
357
+ "conversationSemantics": "full-history",
358
+ "mcpSupport": "none",
359
+ "contextFidelity": "full",
360
+ "toolCallingFidelity": "full",
361
+ "sessionSupport": "full",
362
+ "longRunningSupport": "full",
363
+ "multimodalSupport": "image-input",
364
+ "evidenceSupport": "full"
365
+ }
366
+ }
367
+ ]
368
+ }
369
+ ```
370
+
371
+ The serializer layer (`packages/llm/src/providers/anthropic.ts:770` for Anthropic-compat, `openai.ts:904` for OpenAI-compat) forwards image blocks automatically through base-class inheritance. The flag only gates whether KodaX's policy layer pre-rejects multimodal requests — the model-level vision contract remains your upstream provider's responsibility. If the model is actually text-only, you'll see the real upstream API error instead of a KodaX-side rejection.
372
+
373
+ ### 3. Start in REPL or run a one-shot task
374
+
375
+ ```bash
376
+ # Interactive REPL
377
+ kodax
378
+
379
+ # Then ask naturally inside the REPL
380
+ Read package.json and summarize the architecture
381
+ /mode
382
+ /help
383
+
384
+ # One-shot CLI usage
385
+ kodax "Review this repository and summarize the architecture"
386
+ kodax --session review "Find the riskiest parts of src/"
387
+ kodax --session review "Give me concrete fix suggestions"
388
+ ```
389
+
390
+ ### 4. Use it as a library
391
+
392
+ Library usage still expects API keys from environment variables. If you want custom provider names or base URLs in code, register them explicitly:
393
+
394
+ ```typescript
395
+ import { registerCustomProviders, runKodaX } from '@kodax-ai/kodax';
396
+
397
+ registerCustomProviders([
398
+ {
399
+ name: 'my-openai-compatible',
400
+ protocol: 'openai',
401
+ baseUrl: 'https://example.com/v1',
402
+ apiKeyEnv: 'MY_LLM_API_KEY',
403
+ model: 'my-model',
404
+ userAgentMode: 'compat',
405
+ },
406
+ ]);
407
+
408
+ const result = await runKodaX(
409
+ {
410
+ provider: 'my-openai-compatible',
411
+ effort: 'auto',
412
+ },
413
+ 'Explain this codebase'
414
+ );
415
+ ```
416
+
417
+ > **Embedding KodaX inside another app?** (KodaX Space, IDE extensions, custom CLIs)
418
+ > See [public_docs/sdk/embedder-guide.md](public_docs/sdk/embedder-guide.md) for the runtime-mutation
419
+ > surface (`startKodaX` + `RunningSession`), MCP popout manager API (`McpManager`),
420
+ > Skill `` !`cmd` `` host hook, and per-app data dir namespacing (`getAppDataDir`).
421
+
422
+ ## Runtime SDK and daemon
423
+
424
+ SDK hosts can use `@kodax-ai/kodax/runtime` in three forms: inline embedded for
425
+ lowest latency, Worker-hosted embedded for private state plus hard V8 disposal,
426
+ or a local daemon shared by REPL, Space, IDE adapters, and custom SDK clients.
427
+ All three expose the same `KodaXRuntime` services.
428
+
429
+ ```ts
430
+ import { createKodaXRuntime } from '@kodax-ai/kodax/runtime';
431
+
432
+ const isolated = await createKodaXRuntime({
433
+ mode: 'embedded',
434
+ isolation: 'worker',
435
+ requirements: { hardDispose: true },
436
+ });
437
+ ```
438
+
439
+ Inline is private and lowest-overhead; Worker is private and hard-disposable;
440
+ daemon is process-isolated and shared. `runtime.close()` closes private
441
+ inline/Worker ownership, but only detaches one daemon client. Contradictory
442
+ isolation options fail instead of silently selecting a weaker mode. Worker
443
+ isolation is a V8 fault boundary, not a security sandbox.
444
+
445
+ Because a daemon is intentionally persistent, tests that auto-start one must
446
+ also run `kodax daemon stop --home <dir> --profile <name>` (or send authenticated
447
+ `runtime.shutdown`) before deleting their temporary home. A remaining Node
448
+ process is not safe to kill by name alone; verify its command line and owner.
449
+
450
+ ```bash
451
+ kodax daemon start
452
+ kodax daemon stop --profile default
453
+ kodax --runtime-mode daemon
454
+ kodax -p "Review this repository" --runtime-mode daemon
455
+ ```
456
+
457
+ All CLI task forms now use the same Runtime path: interactive REPL, positional
458
+ prompts, slash-command prompts, and `kodax -p`. Select the persistent default in
459
+ `~/.kodax/config.json`:
460
+
461
+ ```json
462
+ {
463
+ "runtimeMode": "daemon"
464
+ }
465
+ ```
466
+
467
+ Resolution order is explicit CLI/SDK option > environment variable >
468
+ `config.json` > built-in default (`embedded`). `KODAX_RUNTIME_MODE=daemon` is a
469
+ temporary environment override. The same rule applies to other paired settings,
470
+ for example `provider` ↔ `KODAX_PROVIDER` and `effort` ↔ `KODAX_EFFORT`.
471
+ JSON names stay camelCase while environment names use `KODAX_UPPER_SNAKE_CASE`.
472
+
473
+ By default, daemon state, config, and runtime session storage use the exact
474
+ resolved `KODAX_HOME` (normally `<OS user home>/.kodax`), so CLI and SDK clients
475
+ converge on the same local daemon even when `KODAX_HOME` is an arbitrary custom
476
+ directory. The high-level `createKodaXRuntime({ mode: 'daemon' })` API starts or
477
+ reuses that daemon unless you pass an explicit endpoint/transport or
478
+ `autoStartDaemon: false`. An explicit `--home <dir>` or `homeDir` selects the
479
+ isolated `<dir>/.kodax` namespace for tests, CI, or project-local experiments.
480
+
481
+ **v0.7.71 packaged Electron patch:** packaged/asar Electron hosts can use daemon
482
+ auto-start without relaunching the GUI. `ELECTRON_RUN_AS_NODE` is limited to a
483
+ bootstrap-only child exec boundary and removed before daemon or ordinary user
484
+ child code loads. The default-enabled Electron `RunAsNode` fuse is required;
485
+ hosts that disable it must start the daemon through ordinary Node/KodaX CLI and
486
+ connect in attach-only mode. For SDK calls, `homeDir` is the CLI-style base
487
+ directory that owns `.kodax`, not the `.kodax` path itself.
488
+
489
+ **v0.7.75 Windows GUI stabilization candidate:** Runtime Worker-reachable
490
+ non-interactive subprocesses request hidden Windows consoles across memory/Git,
491
+ provider CLI/ACP, LSP, clipboard, worktree, review, extension-command,
492
+ checkpoint, and sandbox paths. Explicit editor, terminal, and PTY behavior is
493
+ unchanged. The SDK bundle includes a static child-process audit and a packaged
494
+ Electron 20-query console-visibility regression. Product-level packaged KodaX
495
+ Space verification remains useful but does not gate SDK packaging or
496
+ publication.
497
+
498
+ The same candidate distinguishes optional post-completion offers from
499
+ clarification required to finish the current request, emits budget-approval
500
+ state only for eligible Sidecar revisions, and preserves structured blocked
501
+ reasons across embedded and daemon Runtime boundaries.
502
+
503
+ **v0.7.76 Kimi Code catalog refresh:** `kimi-code` now defaults to the official
504
+ `k3-256k` Model ID and sends it unchanged. `kimi-for-coding` remains selectable
505
+ for K2.7 Code, alongside `kimi-for-coding-highspeed` and the 1M `k3` tier. K3
506
+ supports `low` / `high` / `max` reasoning with `high` as default; the 256K
507
+ route supports image input but not video input.
508
+
509
+ **v0.7.77 release:** AMA now chooses and composes six named
510
+ problem-solving patterns through the existing Actor control plane instead of
511
+ using a fixed topology or hidden Workflow. Optional strategy metadata becomes
512
+ a bounded, fact-only `PatternTrace`; the existing Sidecar remains the only
513
+ terminal-answer quality judge. Governed memory can also react sparsely after a
514
+ tool failure, verification failure, or committed compaction and place at most
515
+ three prompt-safe, low-authority evidence items before the next Action-LLM
516
+ request. The default path adds no selector model call; SDK hosts may opt into
517
+ `memoryRecallRunner` in process. Public `kimi` also gains the 1M `kimi-k3`
518
+ route while retaining K2.7 Code as its default. See the
519
+ [v0.7.77 design](docs/features/v0.7.77.md) and
520
+ [release checklist](docs/release.md#v0777-release-ready-candidate-verification).
521
+ The frozen F274/F275 paid evaluation completed with `recommend-ship` from the
522
+ final F274 Layer 2/Layer 3 reviews and the F275 pilot review, followed by a
523
+ joint `SHIP` decision for the deterministic contracts. Semantic memory
524
+ selection remains experimental and host opt-in; no task-quality, token, or
525
+ latency improvement is claimed.
526
+
527
+ **v0.7.78 evidence-gated learning, setup, and permission/sandbox release:**
528
+ Background learning is Memory-first. Only repeated independently verified
529
+ evidence, or an explicit preserve-as-Skill request with verified terminal
530
+ evidence, can admit a low-risk declarative Skill to a bounded immutable
531
+ project canary; three exact-revision uses and independently verified success
532
+ are required before automatic project trust. Every revision remains visible
533
+ and reversible in `/learn`. Protected/formal Skills, global promotion, and
534
+ Extension authoring remain explicit user actions.
535
+
536
+ First-run setup now creates and validates the split core/MCP/Extensions/A2A
537
+ files and annotated templates without overwriting existing configuration or
538
+ collecting secrets. Auto[LLM] admits precisely modeled ordinary reads and
539
+ workspace/temp mutations before classifier latency, retries classifier
540
+ infrastructure failure once, then falls back at the Accept-edits boundary
541
+ without switching to rules. ASRT is optional execution containment rather
542
+ than permission authority; `/sandbox` is the explicit diagnostic surface, and
543
+ SDK hosts can use the standalone `/sandbox` subpath without a silent
544
+ unsandboxed fallback. KodaX's workspace containment denies reads from common
545
+ home credential paths and the complete resolved agent home without turning
546
+ ordinary external reads into an allowlist. See the
547
+ [v0.7.78 design](docs/features/v0.7.78.md), the
548
+ [release checklist](docs/release.md#v0778-release-verification), and
549
+ [SDK guide sections 29–30](public_docs/sdk/embedder-guide.md#29-evidence-gated-background-skill-learning-feature_263-v0778).
550
+
551
+ The release closure also preserves intent across adjacent surfaces: static
552
+ Skill instructions load in Edit/Plan without granting later side effects,
553
553
  dynamic Skill commands require an explicit host-controlled executor, root AMA
554
554
  handles explicit remember/correct/forget requests immediately through the
555
555
  governed `memory_intent` control plane while exceptional or inferred changes
556
556
  remain reviewable, Workflow Actor waits remain
557
- unbounded unless the workflow sets a deadline, and Runtime Auto capability v4
558
- advertises `fallbackPersistsEngine:false` across embedded, Worker, and daemon
559
- hosts. Actor ownership additionally uses Runtime identity rather than PID alone,
560
- so PID reuse cannot pin a crashed owner. The resume Session picker also renders
561
- timestamps in the host's local timezone.
562
-
563
- **v0.7.79 release:** Configured outbound A2A Agents can persist two
564
- independent, default-deny network permissions: private-address access and
565
- non-loopback plaintext HTTP. The embedded Worker and shared daemon reconcile
566
- and execute the same authorized configuration. Runtime embedders also gain one
567
- authoritative Session status, bounded read-only diagnostics, byte-preserving
568
- Session export, strict transcript observation, a provenance-checked ordinary
569
- conversation projection, and bounded streaming-event coalescing with
570
- capability-gated idle daemon upgrade. Standalone child-process, Session lineage,
571
- shell cleanup, packaged sidecar, and parallel admission paths receive the
572
- corresponding release hardening.
573
-
574
- OpenAI-compatible custom providers can now choose `max_tokens` or
575
- `max_completion_tokens` per provider or model. DeepSeek V4 Flash and Pro use
576
- separate reasoning profiles and are advertised as text-only. See the
577
- [v0.7.79 design](docs/features/v0.7.79.md) and
578
- [release checklist](docs/release.md#v0779-release-preparation).
579
- FEATURE_280 was explicitly rescheduled to v0.7.81 (then to v0.7.86 on
580
- 2026-08-04) and is not represented as shipped by this release.
581
- Issue 256 was explicitly rescheduled to v0.7.84 and is likewise not represented
582
- as shipped by this release.
583
-
584
- **v0.7.80 hardening release:** The CLI honors `worker.configuredA2A` in
585
- `~/.kodax/config.json`: the embedded Runtime becomes Worker-hosted and loads
586
- the configured A2A plane inside the Worker owner, so configured outbound
587
- Agents appear as `external:<name>` in `list_dispatchable_agents` and can be
588
- dispatched with `spawn_agent`. The mode rejects configured MCP servers or
589
- Extensions (they cannot cross the Worker boundary); use the default inline
590
- Runtime to retain those capabilities. Worker-hosted embedded CLI sessions also
591
- reduce run options to the JSON-safe wire DTO exactly like daemon mode instead of
592
- crashing with `RuntimeTransportBoundaryError`. Auto permission analysis no
593
- longer treats ordinary search scopes and tool metadata as unresolved, and a
594
- `max_tokens`-truncated classifier retry uses a 1024-token budget (Issue 275).
595
- Managed AMA turns now bound one uninterrupted tool loop by a 500-iteration
596
- panic fuse that resets on every idle-yield resume — a runaway-loop breaker,
597
- never a cumulative task budget — and a fused Runner fails with a structured
598
- `RunnerIterationLimitError` carrying the recovery transcript. Managed-run
599
- repetition loops are closed; parallel review and delegation guidance are
600
- restored and tightened. FEATURE_278/279/282/283/285 were explicitly
601
- rescheduled to v0.7.85, so v0.7.80 remains a debug/patch slot and no incomplete
602
- feature is represented as shipped. See the
557
+ unbounded unless the workflow sets a deadline, and Runtime Auto capability v4
558
+ advertises `fallbackPersistsEngine:false` across embedded, Worker, and daemon
559
+ hosts. Actor ownership additionally uses Runtime identity rather than PID alone,
560
+ so PID reuse cannot pin a crashed owner. The resume Session picker also renders
561
+ timestamps in the host's local timezone.
562
+
563
+ **v0.7.79 release:** Configured outbound A2A Agents can persist two
564
+ independent, default-deny network permissions: private-address access and
565
+ non-loopback plaintext HTTP. The embedded Worker and shared daemon reconcile
566
+ and execute the same authorized configuration. Runtime embedders also gain one
567
+ authoritative Session status, bounded read-only diagnostics, byte-preserving
568
+ Session export, strict transcript observation, a provenance-checked ordinary
569
+ conversation projection, and bounded streaming-event coalescing with
570
+ capability-gated idle daemon upgrade. Standalone child-process, Session lineage,
571
+ shell cleanup, packaged sidecar, and parallel admission paths receive the
572
+ corresponding release hardening.
573
+
574
+ OpenAI-compatible custom providers can now choose `max_tokens` or
575
+ `max_completion_tokens` per provider or model. DeepSeek V4 Flash and Pro use
576
+ separate reasoning profiles and are advertised as text-only. See the
577
+ [v0.7.79 design](docs/features/v0.7.79.md) and
578
+ [release checklist](docs/release.md#v0779-release-preparation).
579
+ FEATURE_280 was explicitly rescheduled to v0.7.81 (then to v0.7.86 on
580
+ 2026-08-04) and is not represented as shipped by this release.
581
+ Issue 256 was explicitly rescheduled to v0.7.84 and is likewise not represented
582
+ as shipped by this release.
583
+
584
+ **v0.7.80 hardening release:** The CLI honors `worker.configuredA2A` in
585
+ `~/.kodax/config.json`: the embedded Runtime becomes Worker-hosted and loads
586
+ the configured A2A plane inside the Worker owner, so configured outbound
587
+ Agents appear as `external:<name>` in `list_dispatchable_agents` and can be
588
+ dispatched with `spawn_agent`. The mode rejects configured MCP servers or
589
+ Extensions (they cannot cross the Worker boundary); use the default inline
590
+ Runtime to retain those capabilities. Worker-hosted embedded CLI sessions also
591
+ reduce run options to the JSON-safe wire DTO exactly like daemon mode instead of
592
+ crashing with `RuntimeTransportBoundaryError`. Auto permission analysis no
593
+ longer treats ordinary search scopes and tool metadata as unresolved, and a
594
+ `max_tokens`-truncated classifier retry uses a 1024-token budget (Issue 275).
595
+ Managed AMA turns now bound one uninterrupted tool loop by a 500-iteration
596
+ panic fuse that resets on every idle-yield resume — a runaway-loop breaker,
597
+ never a cumulative task budget — and a fused Runner fails with a structured
598
+ `RunnerIterationLimitError` carrying the recovery transcript. Managed-run
599
+ repetition loops are closed; parallel review and delegation guidance are
600
+ restored and tightened. FEATURE_278/279/282/283/285 were explicitly
601
+ rescheduled to v0.7.85, so v0.7.80 remains a debug/patch slot and no incomplete
602
+ feature is represented as shipped. See the
603
603
  [v0.7.80 release checklist](docs/release.md#v0780-release-preparation).
604
604
 
605
605
  **v0.7.81 Runtime interrupt integrity release:** Active-Run inputs submitted
@@ -656,1252 +656,1278 @@ changes. Issue 256's remaining Worker owner-lease boundary is still open and
656
656
  is scheduled for v0.7.86; this release does not claim descendant-closure proof
657
657
  for that unresolved portion. See the [v0.7.85 release checklist](docs/release.md#v0785-release-preparation).
658
658
 
659
+ **v0.7.86 hardening release:** this patch release adds atomic recovery for
660
+ abandoned inline Runtime owners, process-start identity checks for Runtime and
661
+ learning locks, and Windows sandbox lifecycle attestation. Sandbox ACL owner
662
+ markers are durable and serialized across Runtime profiles; stop waits for
663
+ termination proof before ACL recovery, preserves combined cleanup failures, and
664
+ fences later filesystem effects instead of replaying a command whose process
665
+ tree was not proven drained. POSIX workspace sessions initialize fresh
666
+ `KODAX_HOME` policy roots before admission, settle workspace-local warm-up
667
+ within the Shell abort/deadline, and retire invalid sessions after lease-cleanup failure while
668
+ applying the same fail-closed replacement rule. Windows
669
+ workspace Shell calls also preserve the case-insensitive `PATH`/`Path` contract,
670
+ derive bounded PATH/executable read grants, and carry quoted `cmd.exe` arguments
671
+ through the broker without re-parsing. Commands with the same canonical
672
+ workspace, Agent Home, filesystem, toolchain, and network policy can share one
673
+ Windows sandbox policy group across KodaX processes. The filesystem-effect
674
+ coordinator now waits through its 30-second stale-owner proof window during a
675
+ legitimate process handoff, without extending the one-second fail-closed
676
+ boundary for conflicting effect categories. An incompatible policy or
677
+ pre-start sandbox infrastructure failure returns the already-authorized command
678
+ to normal permission execution; a command that started or may have started is
679
+ never replayed. Runtime sandbox capability v3 fences upgrades from older daemon
680
+ policy revisions. Issue
681
+ 256's remaining Worker owner-lease boundary
682
+ stays open and is scheduled for v0.7.87. See the
683
+ [v0.7.86 release checklist](docs/release.md#v0786-release-preparation).
684
+
659
685
  The v0.7.77 release also adds an opt-in, host-configurable Shell Execution Contract.
660
- Runtime Session settings or an individual Run can select `pwsh`, Windows
661
- PowerShell, `cmd`, `bash`, `zsh`, or an explicit Git Bash executable; KodaX
662
- resolves the shell environment in the effective project cwd and then executes
663
- the command through that same interpreter. Resolved environments are isolated
664
- by contract and cwd, expire after a bounded TTL, and can be explicitly
665
- refreshed. Provider credentials and execution-control variables are removed
666
- before profile/setup code and again before the command starts. Credential-shaped
667
- variables are also filtered on the legacy platform-shell path; explicit names
668
- in user-level `sandbox.envPass` are restored only for the final command target.
669
- When `shellExecution` is absent, the established interpreter path is unchanged. See
670
- [SDK Embedder Guide section 28](public_docs/sdk/embedder-guide.md#28-host-configurable-shell-execution-contract-v0777)
671
- and the [Issue 214 regression guide](docs/test-guides/ISSUE_214_v0.7.77_REGRESSION_GUIDE.md).
672
-
673
- Kimi Code requests also receive a stable, opaque prompt-cache affinity key
674
- derived from the logical Runtime context. It is reused across Runs, retries,
675
- fallback, resume, and compaction; recursive child Agents receive distinct keys
676
- based on their canonical Agent path rather than their temporary transcript
677
- Session. Public Kimi and official OpenAI use the corresponding
678
- `prompt_cache_key` field, while other compatible gateways remain opt-in because
679
- some reject unknown request fields. This improves routing stability but cannot
680
- override Provider TTL or cache sharding. See the
681
- [Issue 215 regression guide](docs/test-guides/ISSUE_215_v0.7.77_REGRESSION_GUIDE.md).
682
- Codex CLI cache reads/writes and Gemini CLI cache reads now flow through the
683
- CLI bridge and Runtime diagnostics without estimation. A reported `0` remains
684
- distinct from an unreported field; see the
685
- [Issue 216 regression guide](docs/test-guides/ISSUE_216_v0.7.77_REGRESSION_GUIDE.md).
686
- The bridge also starts the first native CLI turn fresh, resumes only a native
687
- session ID reported by that CLI, creates fresh ACP sessions for stateless
688
- calls, recreates a closed pseudo transport, and validates the process exit even
689
- after a terminal CLI event. User cancellation stays quiet, while hard/idle
690
- timeout aborts remain failures eligible for Runtime recovery, and a CLI that
691
- reports success but never exits is terminated at its configured deadline; see the
692
- [Issue 217 regression guide](docs/test-guides/ISSUE_217_v0.7.77_REGRESSION_GUIDE.md).
693
-
694
- One daemon owns many sessions. Different sessions may run concurrently; starts
695
- within the same session are queued so that only one run is active for that
696
- session. Multiple `kodax` processes can attach to the same daemon and open or
697
- observe the same session. FEATURE_269 adds atomic snapshot-plus-stream joining,
698
- durable idempotent mutations, revision-safe settings and grants, transport-safe
699
- AskUser/permission responses, run-scoped credential and Host Tool bridges, and
700
- one daemon/inline Coder owner fence. In-flight external effects are never
701
- blindly replayed after a crash; clients receive explicit interrupted/unknown
702
- terminal facts and resync when `runtimeId` changes.
703
-
704
- Space and IDE hosts should require these capabilities through the Runtime SDK.
705
- Partner remains on its private inline Runtime and must use a distinct product
706
- data/session root. A missing daemon capability is an error, not permission to
707
- silently fall back to inline Coder.
708
-
709
- For the full host-integration contract, including inline/Worker/daemon selection,
710
- multi-client permission handling, config/catalog/MCP admin APIs, artifacts,
711
- context diagnostics, and daemon protocol schemas, see
712
- [public_docs/sdk/embedder-guide.md §17](public_docs/sdk/embedder-guide.md#17-runtime-sdk-worker-isolation-and-local-daemon-feature_253-feature_257).
713
-
714
- The Space/IDE shared-daemon contract is documented in
715
- [SDK Embedder Guide section 23](public_docs/sdk/embedder-guide.md#23-shared-coder-daemon-for-space-and-ide-hosts-feature_269-v0769).
716
-
717
- **v0.7.72–v0.7.73 Runtime permission contract:** Auto Mode is owned by the Runtime session,
718
- not by a UI hook. It reuses its LLM/rules guardrail across turns, classifies
719
- before the shared permission bridge, and persists explicit engine selection.
720
- The same session settings can select a classifier model and bounded
721
- timeout; `auto` defaults to LLM classification and fails with a recoverable
722
- configuration error when no effective classifier model exists, rather than
723
- silently falling back. In v0.7.78, classifier failures retry once and then use
724
- the Accept-edits safety boundary; they never change the engine to rules.
725
- Runtime permission prompts offer opaque, exact
726
- allow-once/session/persistent grant suggestions; persistent grants are
727
- daemon-owned and revisioned. Host plan exit is exposed only when the host
728
- supplies an approval callback. See the [Runtime Auto Mode integration guide](public_docs/sdk/embedder-guide.md#24-runtime-owned-auto-mode-and-plan-approval-bridges-v0772v0773).
729
-
730
- ## Repo Intelligence
731
-
732
- KodaX ships with built-in repo intelligence (`repo_overview`, `module_context`, `symbol_context`, `process_context`, `impact_estimate`, and related tools) that helps the coding agent understand large codebases without ad-hoc grep/glob exploration.
733
-
734
- Use `/repo-intel status` in the REPL to inspect the active engine. The former standalone `repointel` host skill has been removed; repo intelligence is built into KodaX and requires no external installation.
735
-
736
- ```bash
737
- # Pick a runtime mode (auto | full | light | off)
738
- kodax --repo-intelligence full --repo-intelligence-trace
739
- ```
740
-
741
- ## Architecture
742
-
743
- KodaX uses a **monorepo architecture** with npm workspaces. Source layout currently has 4 workspace packages; published as a single bundled npm package `@kodax-ai/kodax` with 12 SDK subpath exports (`/agent`, `/llm`, `/coding`, `/media`, `/repl`, `/skills`, `/mcp`, `/session`, `/runtime`, `/sandbox`, `/a2a`, `/experimental-memory`; ADR-024 + ADR-032 + ADR-038, with ADR-036 consolidation):
744
-
745
- ```
746
- KodaX/
747
- ├── packages/ # 4 workspace packages (FEATURE_194 v0.7.43)
748
- │ ├── llm/ # @kodax-ai/llm - LLM abstraction (16 built-in provider aliases)
749
- │ │ └── providers/ # Anthropic, OpenAI, DeepSeek, Kimi, MiMo, MiniMax, Zhipu, Ark, …
750
- │ │
751
- │ ├── agent/ # @kodax-ai/agent - Generic Agent framework
752
- │ │ ├── actors/ # Runtime-owned Actor tree, scheduler, mailbox, events
753
- │ │ ├── session-lineage/ # branchable session tree (inline v0.7.43)
754
- │ │ ├── capabilities/
755
- │ │ │ ├── mcp/ # MCP integration (inline v0.7.43)
756
- │ │ │ └── skills/ # Skills standard implementation + builtin (inline v0.7.43)
757
- │ │ └── tracing/ # tracing / observability (inline v0.7.43)
758
- │ │
759
- │ ├── coding/ # @kodax-ai/coding - Coding Agent (tools + prompts)
760
- │ │ ├── tools/ # 50+ tools: read, write, edit, bash, glob, grep, undo,
761
- │ │ │ # spawn_agent, send_message, followup_task, wait_agent,
762
- │ │ │ # ask_user_question, repo-intelligence, …
763
- │ │ └── repo-intelligence/ # incl. protocol.ts (inline v0.7.43)
764
- │ │
765
- │ └── repl/ # @kodax-ai/repl - Interactive terminal UI (Ink TUI)
766
-
767
- ├── src/ # CLI entry + SDK subpath entries
768
- │ ├── kodax_cli.ts # Main CLI entry point (bin: `kodax`)
769
- │ └── sdk-*.ts # SDK subpath re-exports → @kodax-ai/kodax/{agent,llm,coding,media,repl,skills,mcp,session,runtime,sandbox,a2a,experimental-memory}
770
-
771
- └── package.json # Publish-shaped exports; release.mjs only toggles private during pack/publish
772
- ```
773
-
774
- ### Package Dependencies
775
-
776
- ```
777
- ┌──────────────────┐
778
- │ kodax (root) │
779
- │ CLI Entry │
780
- └────────┬─────────┘
781
-
782
- ┌──────────────┴──────────────┐
783
- │ │
784
- ▼ ▼
785
- ┌──────────────┐ ┌────────────────┐
786
- │@kodax-ai/repl│ │@kodax-ai/coding│
787
- │ UI Layer │ │ Tools+Prompts │
788
- └──────┬───────┘ └──────┬─────────┘
789
- │ │
790
- │ ┌──────────────┴──────────────┐
791
- │ │ │
792
- ▼ ▼ ▼
793
- ┌──────────────┐ ┌──────────────────────────┐ ┌──────────────┐
794
- │@kodax-ai/ │ │@kodax-ai/agent │ │@kodax-ai/llm │
795
- │coding (via │ │Runner + fan-out + │ │LLM Abstract │
796
- │above) │ │idle-yield + session- │ │(16 aliases) │
797
- │ │ │lineage + skills + mcp + │ │ │
798
- │ │ │tracing (FEATURE_194) │ │ │
799
- └──────────────┘ └──────────────────────────┘ └──────────────┘
800
- ```
801
-
802
- ### Package Overview
803
-
804
- Source-side workspace package names (`@kodax-ai/*`). npm consumers install the single bundled `@kodax-ai/kodax` package and import from SDK subpaths — see [Source-side vs npm-published surface](#source-side-vs-npm-published-surface) and [SDK Usage](#sdk-usage) below.
805
-
806
- | Workspace package | Purpose | Key Dependencies |
807
- |---------|---------|------------------|
808
- | `@kodax-ai/llm` | LLM abstraction (16 built-in provider aliases + custom registration) | @anthropic-ai/sdk, openai |
686
+ Runtime Session settings or an individual Run can select `pwsh`, Windows
687
+ PowerShell, `cmd`, `bash`, `zsh`, or an explicit Git Bash executable; KodaX
688
+ resolves the shell environment in the effective project cwd and then executes
689
+ the command through that same interpreter. Resolved environments are isolated
690
+ by contract and cwd, expire after a bounded TTL, and can be explicitly
691
+ refreshed. Provider credentials and execution-control variables are removed
692
+ before profile/setup code and again before the command starts. Credential-shaped
693
+ variables are also filtered on the legacy platform-shell path; explicit names
694
+ in user-level `sandbox.envPass` are restored only for the final command target.
695
+ When `shellExecution` is absent, the established interpreter path is unchanged. See
696
+ [SDK Embedder Guide section 28](public_docs/sdk/embedder-guide.md#28-host-configurable-shell-execution-contract-v0777)
697
+ and the [Issue 214 regression guide](docs/test-guides/ISSUE_214_v0.7.77_REGRESSION_GUIDE.md).
698
+
699
+ Kimi Code requests also receive a stable, opaque prompt-cache affinity key
700
+ derived from the logical Runtime context. It is reused across Runs, retries,
701
+ fallback, resume, and compaction; recursive child Agents receive distinct keys
702
+ based on their canonical Agent path rather than their temporary transcript
703
+ Session. Public Kimi and official OpenAI use the corresponding
704
+ `prompt_cache_key` field, while other compatible gateways remain opt-in because
705
+ some reject unknown request fields. This improves routing stability but cannot
706
+ override Provider TTL or cache sharding. See the
707
+ [Issue 215 regression guide](docs/test-guides/ISSUE_215_v0.7.77_REGRESSION_GUIDE.md).
708
+ Codex CLI cache reads/writes and Gemini CLI cache reads now flow through the
709
+ CLI bridge and Runtime diagnostics without estimation. A reported `0` remains
710
+ distinct from an unreported field; see the
711
+ [Issue 216 regression guide](docs/test-guides/ISSUE_216_v0.7.77_REGRESSION_GUIDE.md).
712
+ The bridge also starts the first native CLI turn fresh, resumes only a native
713
+ session ID reported by that CLI, creates fresh ACP sessions for stateless
714
+ calls, recreates a closed pseudo transport, and validates the process exit even
715
+ after a terminal CLI event. User cancellation stays quiet, while hard/idle
716
+ timeout aborts remain failures eligible for Runtime recovery, and a CLI that
717
+ reports success but never exits is terminated at its configured deadline; see the
718
+ [Issue 217 regression guide](docs/test-guides/ISSUE_217_v0.7.77_REGRESSION_GUIDE.md).
719
+
720
+ One daemon owns many sessions. Different sessions may run concurrently; starts
721
+ within the same session are queued so that only one run is active for that
722
+ session. Multiple `kodax` processes can attach to the same daemon and open or
723
+ observe the same session. FEATURE_269 adds atomic snapshot-plus-stream joining,
724
+ durable idempotent mutations, revision-safe settings and grants, transport-safe
725
+ AskUser/permission responses, run-scoped credential and Host Tool bridges, and
726
+ one daemon/inline Coder owner fence. In-flight external effects are never
727
+ blindly replayed after a crash; clients receive explicit interrupted/unknown
728
+ terminal facts and resync when `runtimeId` changes.
729
+
730
+ Space and IDE hosts should require these capabilities through the Runtime SDK.
731
+ Partner remains on its private inline Runtime and must use a distinct product
732
+ data/session root. A missing daemon capability is an error, not permission to
733
+ silently fall back to inline Coder.
734
+
735
+ For the full host-integration contract, including inline/Worker/daemon selection,
736
+ multi-client permission handling, config/catalog/MCP admin APIs, artifacts,
737
+ context diagnostics, and daemon protocol schemas, see
738
+ [public_docs/sdk/embedder-guide.md §17](public_docs/sdk/embedder-guide.md#17-runtime-sdk-worker-isolation-and-local-daemon-feature_253-feature_257).
739
+
740
+ The Space/IDE shared-daemon contract is documented in
741
+ [SDK Embedder Guide section 23](public_docs/sdk/embedder-guide.md#23-shared-coder-daemon-for-space-and-ide-hosts-feature_269-v0769).
742
+
743
+ **v0.7.72–v0.7.73 Runtime permission contract:** Auto Mode is owned by the Runtime session,
744
+ not by a UI hook. It reuses its LLM/rules guardrail across turns, classifies
745
+ before the shared permission bridge, and persists explicit engine selection.
746
+ The same session settings can select a classifier model and bounded
747
+ timeout; `auto` defaults to LLM classification and fails with a recoverable
748
+ configuration error when no effective classifier model exists, rather than
749
+ silently falling back. In v0.7.78, classifier failures retry once and then use
750
+ the Accept-edits safety boundary; they never change the engine to rules.
751
+ Runtime permission prompts offer opaque, exact
752
+ allow-once/session/persistent grant suggestions; persistent grants are
753
+ daemon-owned and revisioned. Host plan exit is exposed only when the host
754
+ supplies an approval callback. See the [Runtime Auto Mode integration guide](public_docs/sdk/embedder-guide.md#24-runtime-owned-auto-mode-and-plan-approval-bridges-v0772v0773).
755
+
756
+ ## Repo Intelligence
757
+
758
+ KodaX ships with built-in repo intelligence (`repo_overview`, `module_context`, `symbol_context`, `process_context`, `impact_estimate`, and related tools) that helps the coding agent understand large codebases without ad-hoc grep/glob exploration.
759
+
760
+ Use `/repo-intel status` in the REPL to inspect the active engine. The former standalone `repointel` host skill has been removed; repo intelligence is built into KodaX and requires no external installation.
761
+
762
+ ```bash
763
+ # Pick a runtime mode (auto | full | light | off)
764
+ kodax --repo-intelligence full --repo-intelligence-trace
765
+ ```
766
+
767
+ ## Architecture
768
+
769
+ KodaX uses a **monorepo architecture** with npm workspaces. Source layout currently has 4 workspace packages; published as a single bundled npm package `@kodax-ai/kodax` with 12 SDK subpath exports (`/agent`, `/llm`, `/coding`, `/media`, `/repl`, `/skills`, `/mcp`, `/session`, `/runtime`, `/sandbox`, `/a2a`, `/experimental-memory`; ADR-024 + ADR-032 + ADR-038, with ADR-036 consolidation):
770
+
771
+ ```
772
+ KodaX/
773
+ ├── packages/ # 4 workspace packages (FEATURE_194 v0.7.43)
774
+ │ ├── llm/ # @kodax-ai/llm - LLM abstraction (16 built-in provider aliases)
775
+ │ │ └── providers/ # Anthropic, OpenAI, DeepSeek, Kimi, MiMo, MiniMax, Zhipu, Ark, …
776
+ │ │
777
+ │ ├── agent/ # @kodax-ai/agent - Generic Agent framework
778
+ │ │ ├── actors/ # Runtime-owned Actor tree, scheduler, mailbox, events
779
+ │ │ ├── session-lineage/ # branchable session tree (inline v0.7.43)
780
+ │ │ ├── capabilities/
781
+ │ │ │ ├── mcp/ # MCP integration (inline v0.7.43)
782
+ │ │ │ └── skills/ # Skills standard implementation + builtin (inline v0.7.43)
783
+ │ │ └── tracing/ # tracing / observability (inline v0.7.43)
784
+ │ │
785
+ │ ├── coding/ # @kodax-ai/coding - Coding Agent (tools + prompts)
786
+ │ │ ├── tools/ # 50+ tools: read, write, edit, bash, glob, grep, undo,
787
+ │ │ │ # spawn_agent, send_message, followup_task, wait_agent,
788
+ │ │ │ # ask_user_question, repo-intelligence, …
789
+ │ │ └── repo-intelligence/ # incl. protocol.ts (inline v0.7.43)
790
+ │ │
791
+ │ └── repl/ # @kodax-ai/repl - Interactive terminal UI (Ink TUI)
792
+
793
+ ├── src/ # CLI entry + SDK subpath entries
794
+ │ ├── kodax_cli.ts # Main CLI entry point (bin: `kodax`)
795
+ │ └── sdk-*.ts # SDK subpath re-exports → @kodax-ai/kodax/{agent,llm,coding,media,repl,skills,mcp,session,runtime,sandbox,a2a,experimental-memory}
796
+
797
+ └── package.json # Publish-shaped exports; release.mjs only toggles private during pack/publish
798
+ ```
799
+
800
+ ### Package Dependencies
801
+
802
+ ```
803
+ ┌──────────────────┐
804
+ │ kodax (root) │
805
+ │ CLI Entry │
806
+ └────────┬─────────┘
807
+
808
+ ┌──────────────┴──────────────┐
809
+ │ │
810
+ ▼ ▼
811
+ ┌──────────────┐ ┌────────────────┐
812
+ │@kodax-ai/repl│ │@kodax-ai/coding│
813
+ │ UI Layer │ │ Tools+Prompts │
814
+ └──────┬───────┘ └──────┬─────────┘
815
+ │ │
816
+ │ ┌──────────────┴──────────────┐
817
+ │ │ │
818
+ ▼ ▼ ▼
819
+ ┌──────────────┐ ┌──────────────────────────┐ ┌──────────────┐
820
+ │@kodax-ai/ │ │@kodax-ai/agent │ │@kodax-ai/llm │
821
+ │coding (via │ │Runner + fan-out + │ │LLM Abstract │
822
+ │above) │ │idle-yield + session- │ │(16 aliases) │
823
+ │ │ │lineage + skills + mcp + │ │ │
824
+ │ │ │tracing (FEATURE_194) │ │ │
825
+ └──────────────┘ └──────────────────────────┘ └──────────────┘
826
+ ```
827
+
828
+ ### Package Overview
829
+
830
+ Source-side workspace package names (`@kodax-ai/*`). npm consumers install the single bundled `@kodax-ai/kodax` package and import from SDK subpaths — see [Source-side vs npm-published surface](#source-side-vs-npm-published-surface) and [SDK Usage](#sdk-usage) below.
831
+
832
+ | Workspace package | Purpose | Key Dependencies |
833
+ |---------|---------|------------------|
834
+ | `@kodax-ai/llm` | LLM abstraction (16 built-in provider aliases + custom registration) | @anthropic-ai/sdk, openai |
809
835
  | `@kodax-ai/agent` | Generic Agent framework — Runner, fan-out, idle-yield, media/input artifacts, session-lineage, capabilities (mcp + skills), tracing (ADR-036 v0.7.43 consolidation; subpaths: `/media`, `/session-lineage`, `/capabilities/mcp`, `/capabilities/skills`, `/tracing`) | @kodax-ai/llm, fflate, jimp, yaml |
810
- | `@kodax-ai/coding` | Coding Agent — 50+ tools (incl. canonical Actor collaboration tools) + role prompts + auto-continue + repo-intelligence protocol | @kodax-ai/llm, @kodax-ai/agent |
811
- | `@kodax-ai/repl` | Complete interactive terminal UI (Ink/React, permission modes, commands, streaming) | @kodax-ai/coding, ink, react |
812
-
813
- ### Source-side vs npm-published surface
814
-
815
- KodaX has two layers that consumers should understand separately:
816
-
817
- - **Source-side**: 4 workspace packages above (what developers see when reading the repo).
818
- - **npm-published**: a single bundled package `@kodax-ai/kodax` with 12 SDK subpaths (what SDK consumers `import` from). The subpaths are split into two roles:
819
- - **Full-package subpaths** (`/agent`, `/llm`, `/coding`, `/repl`) — each one maps 1:1 to a source workspace and exposes its complete public API.
820
- - **Integration and narrow subpaths** (`/media`, `/skills`, `/mcp`, `/session`, `/runtime`, `/sandbox`, `/a2a`, `/experimental-memory`) — focused host surfaces. `/a2a` composes the neutral F258 plane with the Runtime facade; it does not add A2A wire types to `/agent`.
821
-
822
- | Source package | npm subpath | Type | What you get | Example consumer |
823
- |---|---|---|---|---|
824
- | `packages/llm` | `@kodax-ai/kodax/llm` | Full package | 16-alias LLM abstraction (108 exports) | Standalone LLM clients |
825
- | `packages/agent` | `@kodax-ai/kodax/agent` | Full package | Runner / fan-out / external-agent plane / session-lineage / capabilities / tracing (331 exports) | Custom agent frameworks |
826
- | `packages/agent` | `@kodax-ai/kodax/skills` | **Narrow subset** | Skills system only — `SkillRegistry` / `loadFullSkill` / `expandSkillForLLM` / ... (26 exports = pre-v0.7.43 `@kodax-ai/skills` complete API) | Skill loaders, IDE plugins |
827
- | `packages/agent` | `@kodax-ai/kodax/mcp` | **Narrow subset** | MCP only — `McpCapabilityProvider` / `createMcpTransport` / `searchMcpCatalog` / ... (23 exports) | MCP server hosts |
828
- | `packages/agent` | `@kodax-ai/kodax/media` | **Narrow subset** | Structured image/file/video input-artifact helpers (22 exports) | Desktop hosts and multimodal clients |
836
+ | `@kodax-ai/coding` | Coding Agent — 50+ tools (incl. canonical Actor collaboration tools) + role prompts + auto-continue + repo-intelligence protocol | @kodax-ai/llm, @kodax-ai/agent |
837
+ | `@kodax-ai/repl` | Complete interactive terminal UI (Ink/React, permission modes, commands, streaming) | @kodax-ai/coding, ink, react |
838
+
839
+ ### Source-side vs npm-published surface
840
+
841
+ KodaX has two layers that consumers should understand separately:
842
+
843
+ - **Source-side**: 4 workspace packages above (what developers see when reading the repo).
844
+ - **npm-published**: a single bundled package `@kodax-ai/kodax` with 12 SDK subpaths (what SDK consumers `import` from). The subpaths are split into two roles:
845
+ - **Full-package subpaths** (`/agent`, `/llm`, `/coding`, `/repl`) — each one maps 1:1 to a source workspace and exposes its complete public API.
846
+ - **Integration and narrow subpaths** (`/media`, `/skills`, `/mcp`, `/session`, `/runtime`, `/sandbox`, `/a2a`, `/experimental-memory`) — focused host surfaces. `/a2a` composes the neutral F258 plane with the Runtime facade; it does not add A2A wire types to `/agent`.
847
+
848
+ | Source package | npm subpath | Type | What you get | Example consumer |
849
+ |---|---|---|---|---|
850
+ | `packages/llm` | `@kodax-ai/kodax/llm` | Full package | 16-alias LLM abstraction (108 exports) | Standalone LLM clients |
851
+ | `packages/agent` | `@kodax-ai/kodax/agent` | Full package | Runner / fan-out / external-agent plane / session-lineage / capabilities / tracing (331 exports) | Custom agent frameworks |
852
+ | `packages/agent` | `@kodax-ai/kodax/skills` | **Narrow subset** | Skills system only — `SkillRegistry` / `loadFullSkill` / `expandSkillForLLM` / ... (26 exports = pre-v0.7.43 `@kodax-ai/skills` complete API) | Skill loaders, IDE plugins |
853
+ | `packages/agent` | `@kodax-ai/kodax/mcp` | **Narrow subset** | MCP only — `McpCapabilityProvider` / `createMcpTransport` / `searchMcpCatalog` / ... (23 exports) | MCP server hosts |
854
+ | `packages/agent` | `@kodax-ai/kodax/media` | **Narrow subset** | Structured image/file/video input-artifact helpers (22 exports) | Desktop hosts and multimodal clients |
829
855
  | `packages/agent` | `@kodax-ai/kodax/experimental-memory` | **Experimental subset** | Thin F228-backed `MemoryAgent` / `MemorySession` lifecycle plus additive `MemoryManagementAgent` list/remember/forget | SDK hosts explicitly evaluating FEATURE_260 / FEATURE_292 |
830
- | `packages/coding` | `@kodax-ai/kodax/coding` | Full package | Coding agent + 50+ tools + repo-intelligence (505 exports) | Build a Claude Code-shape product |
831
- | `packages/repl` | `@kodax-ai/kodax/repl` | Full package | Ink TUI + permission modes + commands (217 exports) | Terminal-UI consumers |
832
- | `packages/repl` | `@kodax-ai/kodax/session` | **Narrow subset** | Session management only — `listSessions` / `loadFullTranscript` / `appendClientNotice` / `forkSession` / `compactSession` / `watchSessions` / ... (17 exports) | IDE plugins and desktop hosts reading session history |
833
- | `src` | `@kodax-ai/kodax/runtime` | Host API | Embedded/Worker/daemon runtime facade, sessions/runs/events/permissions/catalog/MCP/artifacts/diagnostics/external agents, daemon protocol schema (10 exports) | SDK hosts, Space/IDE clients, daemon clients |
834
- | `src` | `@kodax-ai/kodax/sandbox` | Host API | Explicit ASRT capability/doctor/setup and host-owned contained command execution; unavailability never means silent ordinary execution | SDK hosts that need standalone process containment |
835
- | `src` | `@kodax-ai/kodax/a2a` | Integration edge | A2A 1.0 Agent Card discovery, JSON-RPC/SSE F258 executor, safe fetch policy, and authenticated Runtime-backed Agent server | Agent orchestrators and KodaX hosts |
836
-
837
- **Rule of thumb**: if you need Runner / Agent / fan-out, import from `/agent`. If you only need skills or mcp APIs, import from `/skills` or `/mcp` to get a smaller bundle. The narrow subsets are subsets of the full packages — they do **not** expose extra symbols.
838
-
839
- **Dynamic Workflows (FEATURE_217, v0.7.49)**: the domain-neutral workflow runtime is part of `/agent` — `import { createWorkflowRuntime, runWorkflow, WorkflowAbortError, WorkflowLimitError } from '@kodax-ai/kodax/agent'`. The coding-side integration (agent backend + built-in workflows + saved-workflow discovery/generation: `createCodingWorkflowBackend`, `runWorkflowFromOptions`, `parallelInvestigation`, `discoverSavedWorkflows`, `generateWorkflowFromOptions`, …) is part of `/coding`. FEATURE_217 is the v0.7.49 home for the full Dynamic Workflow product loop: `/workflow create <request>` generates restricted scripts, `/workflow save <runId> <name>` stores `.workflow.json` rerunnable workflows, generated/saved scripts coordinate agents through `WorkflowApi`, run lifecycle state stays observable, opt-in `isolation:"worktree"` routes selected children to parent-managed worktrees, and all file/shell effects still pass through agent tools and the existing permission gates. There is **no** separate `@kodax-ai/kodax/agent/workflow` root-package subpath; source-package consumers of `@kodax-ai/agent` can still use that package's `./workflow` subpath.
840
-
841
- **Workflow Process Surface (FEATURE_229, v0.7.50)**: workflow progress is now a reusable Agent-layer process contract rather than private REPL text. SDK hosts can subscribe to `WorkflowProcessEvent`/poll `WorkflowProcessSnapshot`, use `createWorkflowRunManager` and `createWorkflowLifecycleController` for stop/pause/resume/result/artifact/delete/prune/identity/preflight controls, and receive ANSI-free provenance fields (`source`, `sourceRunId`, `sourceWorkflowName`, `savedWorkflowName`, `revisionOf`) plus `resultSummary`. `/coding` owns the coding workflow backend and run graph, `/repl` renders the same snapshots, and the terminal UI is not the hidden source of truth. `KodaXEvents` callbacks also take an optional metadata arg (`KodaXToolEventMeta` / `KodaXActivityEventMeta` / `KodaXWorkflowEventMeta`) so a host can attribute every child-agent tool/thinking/progress event to its workflow run and child id without a second event protocol, and generated/saved workflow scripts pass `validateRestrictedWorkflowSource` (compile + source-policy check) plus a generator repair/smoke loop before they run. See [docs/ADR.md ADR-040](docs/ADR.md) for the layering rationale.
842
-
843
- **Host Reads Persisted History (FEATURE_230 + FEATURE_234, v0.7.51; v0.7.63 hardening)**: additive closures for hosts that read persisted state. **Durable tool transcript replay** — a resumed session now replays the tool cards the assistant used instead of degrading to text-only. `messages` / `lineage` stay canonical; `SessionData.uiHistory` becomes a bounded, sanitized, terminal-only replay cache. The SDK transcript contract is explicit: `loadSession()` = active model context, `loadFullTranscript()` = append-order host scrollback with typed entries (`message` / `compaction` / `branch_summary` / `rewind_marker` / `client_notice` / `task_result`) plus clone provenance (`logicalId` / `sourceEntryId`), `uiHistory` = optional replay cache, and tool cards can always be reconstructed from canonical messages. Hosts can persist local slash output with `appendClientNotice()` without entering model context, and workflow/child completions expose structured `taskResults[]` instead of requiring `<task-completed>` parsing. `rewind_marker` is an audit entry for host scrollback only and is excluded from model-context messages. **Workflow run host attribution** — `WorkflowProcessTrackerOptions` / `WorkflowProcessSnapshot` gain a host-owned opaque `hostMetadata?: Record<string, string>` that the SDK stores, persists to `run.json`, and echoes back (including after a restart) without interpreting it, so a host can map a run to the session/surface that launched it with zero side table. Unstamped/legacy runs honestly echo `hostMetadata === undefined`. See [docs/features/v0.7.51.md](docs/features/v0.7.51.md).
844
-
845
- **Inline Workflow Authoring (FEATURE_246, v0.7.58; F270 update in v0.7.72)**: the Worker can author and run a workflow inline via the model-callable `run_workflow` tool when Workflow intent is explicit. It scouts the codebase first, bakes concrete findings into child prompts, and runs the script through the sandbox, static-validation, and postcondition-verification pipeline. F270 retires AMAW and complexity-driven activation; AMA keeps explicit `/workflow`, named/SDK, and natural-language Workflow requests. Workflow child Agents now run on the unified Actor control plane. See [docs/features/v0.7.58.md](docs/features/v0.7.58.md), [docs/features/v0.7.72.md](docs/features/v0.7.72.md), and ADR-044/046/047/048/049/055.
846
-
847
- **Historical Workflow Activation Tiers (FEATURE_248 + FEATURE_249, v0.7.59; superseded by F270 in v0.7.72)**: v0.7.59 introduced AMAW and explicit-request AMA behavior. F270 retires AMAW and its complexity-driven directive. SA remains solo; AMA is the single adaptive multi-Agent mode and activates Workflow only from explicit Workflow intent. See [docs/features/v0.7.59.md](docs/features/v0.7.59.md) and [docs/features/v0.7.72.md](docs/features/v0.7.72.md).
848
-
849
- **Progressive Disclosure on the Managed Tool Path (FEATURE_250, v0.7.60; current policy corrected in v0.7.74)**: the deferred-tool mechanism applies to the managed AMA path as well as SA. The current deferred set contains exactly 11 tools: six repo-intelligence tools, four web/code discovery tools, and `run_workflow`. Their `input_schema` remains directly callable while `tool_search` provides the full description on demand. The five fixed `mcp_*` facades and the `get_goal` / `create_goal` / `update_goal` lifecycle tools stay resident with their complete contracts. The v0.7.74 goal correction adds only about 109 estimated schema tokens versus the former hints (`get_goal` is actually 12 tokens smaller when resident), removes a discovery round trip, and changes no tool schema, handler, permission, goal state, or compaction-protection behavior. See [docs/features/v0.7.60.md](docs/features/v0.7.60.md) and [docs/features/v0.7.74.md](docs/features/v0.7.74.md#feature_250-v0774-correction-resident-goal-lifecycle-tools).
850
-
851
- **Context-Efficient Tool Results + Workflow Quality Preflight (FEATURE_251 + FEATURE_252, v0.7.61; corrected 2026-07-14)**: local tools collect complete output and apply only contract-equivalent normalization that is strictly shorter; command-specific lossy Bash filters are off by default, and compound Bash uses no semantic adapter. One owner evaluates the complete parallel-result batch against the final provider request: it solves the largest final input `Pmax` for which `Pmax + output reserve + max(2048, 3% of Pmax) <= context window`, then admits only the remaining physical capacity. Results stay verbatim whenever they fit; only real overflow persists the complete value and emits `KODAX_RESULT_INCOMPLETE`. History keeps the same physical-capacity safety rule: no default lossy microcompaction below capacity, summary-first at pressure, and typed failure without silent deletion when a recoverable request cannot be formed. FEATURE_272 supersedes FEATURE_251 only for the default major-compaction trigger. FEATURE_252's deterministic pre-start workflow contract lint is unchanged. See [docs/features/v0.7.61.md](docs/features/v0.7.61.md) and [docs/ADR.md ADR-050](docs/ADR.md).
852
-
853
- **Reliable Always-On Context Compaction (FEATURE_272, v0.7.74)**: automatic major compaction cannot be disabled. Its percentage trigger defaults to 75% and clamps to 15-90%; optional `triggerTokens` is inactive when omitted/zero, otherwise the smaller percentage, absolute, and physical-capacity threshold wins. The protected raw tail is 20% of that effective trigger. One transaction summarizes the complete eligible prefix, preserves every genuine user request through an exact ledger, and emits success only after a physically valid token reduction and awaited durable commit. Before raw bodies are evicted, the Session owner durably flushes their exact lineage; stable entry IDs merge the sidecar and slim Session without duplicates. Root and persistent child Agents can recover omitted user/assistant/tool details through bounded `session_history_search` → `session_history_read`, with children isolated to hidden worker Sessions and never granted root-history access. SDK/Runtime clients use revision-bound `transcriptSearch`, pages, and lossless chunks. Hidden reasoning, system instructions, and synthetic checkpoints are excluded from model search. See [the feature design](docs/features/v0.7.74.md), [SDK guide §25](public_docs/sdk/embedder-guide.md#25-always-on-context-compaction-and-bounded-transcript-recovery-v0774), and [ADR-057](docs/ADR.md#adr-057-large-compaction-is-an-always-on-context-scoped-full-coverage-transaction).
854
-
855
- **Mailbox-Driven Agent Coordination (FEATURE_273, v0.7.74)**: `wait_agent` is now a true model-facing mailbox yield with one bounded `timeout_ms`, not an Actor progress/event reader. It wakes for scoped Agent messages or completions, root user input, interruption, or timeout; progress remains available to UI/SDK snapshot, replay, and long-poll consumers without resampling the parent model. The tool returns only a wake acknowledgement, while authenticated Agent evidence and structured task metadata enter the next safe model boundary once. Unacknowledged root completions survive a hard restart, same-process Runtime rebuilds deduplicate by child turn ID, and acknowledged or legacy historical completions are not replayed. Use `list_agents` for tree state and `agent_output` for a targeted known result. See [the feature design](docs/features/v0.7.74.md#feature_273-mailbox-driven-agent-wait-and-telemetrycontrol-separation), [SDK guide §26](public_docs/sdk/embedder-guide.md#26-agent-mailbox-control-versus-sdk-event-telemetry-v0774), and [ADR-058](docs/ADR.md#adr-058-model-agent-wait-is-mailbox-control-not-event-telemetry).
856
-
857
- **Active-Run Interrupt Input (v0.7.74)**: embedded Runtime and the shared daemon advertise `interruptInput:1`. `runtime.runs.submitInput()` queues an immutable, ordered input for the current active Actor Run; all inputs admitted before one safe Runner boundary are delivered FIFO as separate user messages in the next LLM request, without creating continuation Runs. Queued/delivered state is visible in typed Run snapshots/events, delivery is acknowledged against the exact consumed IDs, and terminal cleanup prevents undelivered input from leaking into later Runs.
858
-
859
- **External Agent SDK Plane (FEATURE_258, v0.7.67)**: `/agent` exports the protocol-neutral executor, registration, policy, credential-broker, artifact-policy, catalog, and durable task contracts. `/runtime` exposes the installed plane through `admin.agentRegistrations`, `agents`, and `agentTasks`, with the same DTO service methods over embedded and daemon clients. Executor factories are host functions: install them in an inline owner or while creating a new in-process daemon owner; they cannot be injected through an existing daemon connection or across a Runtime Worker boundary. Plane shutdown is terminal: pending waits and all later service calls reject. Restricted Workflow scripts preserve validated `phase` and external `target` routing. See the [complete owner/consumer recipes and safety contract](public_docs/sdk/embedder-guide.md#18-external-agent-executor-plane-feature_258-v0767).
860
-
861
- **Cost-Disciplined Workflow SDK (FEATURE_259, v0.7.67)**: SDK callers configure run-scoped `modelTiers` and `workflow.maxConcurrency`, while workflow authors express semantic `fast` / `balanced` / `deep` intent. Terminal workflow events expose resolved tier/source/fallback/usage/duration facts, and each durable `run.json` contains an `efficiencyReport` with token coverage, role/tier starts, packet-read topology, review waves, and quality-gate outcomes. See the [routing and telemetry contract](public_docs/sdk/embedder-guide.md#20-cost-disciplined-workflow-routing-and-telemetry-feature_259-v0767).
862
-
863
- **Paged Session Listing (FEATURE_261, v0.7.67)**: both `/session` `listSessions()` and `runtime.sessions.list()` accept an exact `surface` filter and opaque continuation `cursor`; each returned summary carries the cursor for the next page. Filtering happens before the page limit, so a host does not need to over-fetch mixed surfaces. See the [pagination recipes](public_docs/sdk/embedder-guide.md#19-session-surface-filtering-and-cursor-pagination-feature_261-v0767).
864
-
856
+ | `packages/coding` | `@kodax-ai/kodax/coding` | Full package | Coding agent + 50+ tools + repo-intelligence (505 exports) | Build a Claude Code-shape product |
857
+ | `packages/repl` | `@kodax-ai/kodax/repl` | Full package | Ink TUI + permission modes + commands (217 exports) | Terminal-UI consumers |
858
+ | `packages/repl` | `@kodax-ai/kodax/session` | **Narrow subset** | Session management only — `listSessions` / `loadFullTranscript` / `appendClientNotice` / `forkSession` / `compactSession` / `watchSessions` / ... (17 exports) | IDE plugins and desktop hosts reading session history |
859
+ | `src` | `@kodax-ai/kodax/runtime` | Host API | Embedded/Worker/daemon runtime facade, sessions/runs/events/permissions/catalog/MCP/artifacts/diagnostics/external agents, daemon protocol schema (10 exports) | SDK hosts, Space/IDE clients, daemon clients |
860
+ | `src` | `@kodax-ai/kodax/sandbox` | Host API | Explicit ASRT capability/doctor/setup and host-owned contained command execution; unavailability never means silent ordinary execution | SDK hosts that need standalone process containment |
861
+ | `src` | `@kodax-ai/kodax/a2a` | Integration edge | A2A 1.0 Agent Card discovery, JSON-RPC/SSE F258 executor, safe fetch policy, and authenticated Runtime-backed Agent server | Agent orchestrators and KodaX hosts |
862
+
863
+ **Rule of thumb**: if you need Runner / Agent / fan-out, import from `/agent`. If you only need skills or mcp APIs, import from `/skills` or `/mcp` to get a smaller bundle. The narrow subsets are subsets of the full packages — they do **not** expose extra symbols.
864
+
865
+ **Dynamic Workflows (FEATURE_217, v0.7.49)**: the domain-neutral workflow runtime is part of `/agent` — `import { createWorkflowRuntime, runWorkflow, WorkflowAbortError, WorkflowLimitError } from '@kodax-ai/kodax/agent'`. The coding-side integration (agent backend + built-in workflows + saved-workflow discovery/generation: `createCodingWorkflowBackend`, `runWorkflowFromOptions`, `parallelInvestigation`, `discoverSavedWorkflows`, `generateWorkflowFromOptions`, …) is part of `/coding`. FEATURE_217 is the v0.7.49 home for the full Dynamic Workflow product loop: `/workflow create <request>` generates restricted scripts, `/workflow save <runId> <name>` stores `.workflow.json` rerunnable workflows, generated/saved scripts coordinate agents through `WorkflowApi`, run lifecycle state stays observable, opt-in `isolation:"worktree"` routes selected children to parent-managed worktrees, and all file/shell effects still pass through agent tools and the existing permission gates. There is **no** separate `@kodax-ai/kodax/agent/workflow` root-package subpath; source-package consumers of `@kodax-ai/agent` can still use that package's `./workflow` subpath.
866
+
867
+ **Workflow Process Surface (FEATURE_229, v0.7.50)**: workflow progress is now a reusable Agent-layer process contract rather than private REPL text. SDK hosts can subscribe to `WorkflowProcessEvent`/poll `WorkflowProcessSnapshot`, use `createWorkflowRunManager` and `createWorkflowLifecycleController` for stop/pause/resume/result/artifact/delete/prune/identity/preflight controls, and receive ANSI-free provenance fields (`source`, `sourceRunId`, `sourceWorkflowName`, `savedWorkflowName`, `revisionOf`) plus `resultSummary`. `/coding` owns the coding workflow backend and run graph, `/repl` renders the same snapshots, and the terminal UI is not the hidden source of truth. `KodaXEvents` callbacks also take an optional metadata arg (`KodaXToolEventMeta` / `KodaXActivityEventMeta` / `KodaXWorkflowEventMeta`) so a host can attribute every child-agent tool/thinking/progress event to its workflow run and child id without a second event protocol, and generated/saved workflow scripts pass `validateRestrictedWorkflowSource` (compile + source-policy check) plus a generator repair/smoke loop before they run. See [docs/ADR.md ADR-040](docs/ADR.md) for the layering rationale.
868
+
869
+ **Host Reads Persisted History (FEATURE_230 + FEATURE_234, v0.7.51; v0.7.63 hardening)**: additive closures for hosts that read persisted state. **Durable tool transcript replay** — a resumed session now replays the tool cards the assistant used instead of degrading to text-only. `messages` / `lineage` stay canonical; `SessionData.uiHistory` becomes a bounded, sanitized, terminal-only replay cache. The SDK transcript contract is explicit: `loadSession()` = active model context, `loadFullTranscript()` = append-order host scrollback with typed entries (`message` / `compaction` / `branch_summary` / `rewind_marker` / `client_notice` / `task_result`) plus clone provenance (`logicalId` / `sourceEntryId`), `uiHistory` = optional replay cache, and tool cards can always be reconstructed from canonical messages. Hosts can persist local slash output with `appendClientNotice()` without entering model context, and workflow/child completions expose structured `taskResults[]` instead of requiring `<task-completed>` parsing. `rewind_marker` is an audit entry for host scrollback only and is excluded from model-context messages. **Workflow run host attribution** — `WorkflowProcessTrackerOptions` / `WorkflowProcessSnapshot` gain a host-owned opaque `hostMetadata?: Record<string, string>` that the SDK stores, persists to `run.json`, and echoes back (including after a restart) without interpreting it, so a host can map a run to the session/surface that launched it with zero side table. Unstamped/legacy runs honestly echo `hostMetadata === undefined`. See [docs/features/v0.7.51.md](docs/features/v0.7.51.md).
870
+
871
+ **Inline Workflow Authoring (FEATURE_246, v0.7.58; F270 update in v0.7.72)**: the Worker can author and run a workflow inline via the model-callable `run_workflow` tool when Workflow intent is explicit. It scouts the codebase first, bakes concrete findings into child prompts, and runs the script through the sandbox, static-validation, and postcondition-verification pipeline. F270 retires AMAW and complexity-driven activation; AMA keeps explicit `/workflow`, named/SDK, and natural-language Workflow requests. Workflow child Agents now run on the unified Actor control plane. See [docs/features/v0.7.58.md](docs/features/v0.7.58.md), [docs/features/v0.7.72.md](docs/features/v0.7.72.md), and ADR-044/046/047/048/049/055.
872
+
873
+ **Historical Workflow Activation Tiers (FEATURE_248 + FEATURE_249, v0.7.59; superseded by F270 in v0.7.72)**: v0.7.59 introduced AMAW and explicit-request AMA behavior. F270 retires AMAW and its complexity-driven directive. SA remains solo; AMA is the single adaptive multi-Agent mode and activates Workflow only from explicit Workflow intent. See [docs/features/v0.7.59.md](docs/features/v0.7.59.md) and [docs/features/v0.7.72.md](docs/features/v0.7.72.md).
874
+
875
+ **Progressive Disclosure on the Managed Tool Path (FEATURE_250, v0.7.60; current policy corrected in v0.7.74)**: the deferred-tool mechanism applies to the managed AMA path as well as SA. The current deferred set contains exactly 11 tools: six repo-intelligence tools, four web/code discovery tools, and `run_workflow`. Their `input_schema` remains directly callable while `tool_search` provides the full description on demand. The five fixed `mcp_*` facades and the `get_goal` / `create_goal` / `update_goal` lifecycle tools stay resident with their complete contracts. The v0.7.74 goal correction adds only about 109 estimated schema tokens versus the former hints (`get_goal` is actually 12 tokens smaller when resident), removes a discovery round trip, and changes no tool schema, handler, permission, goal state, or compaction-protection behavior. See [docs/features/v0.7.60.md](docs/features/v0.7.60.md) and [docs/features/v0.7.74.md](docs/features/v0.7.74.md#feature_250-v0774-correction-resident-goal-lifecycle-tools).
876
+
877
+ **Context-Efficient Tool Results + Workflow Quality Preflight (FEATURE_251 + FEATURE_252, v0.7.61; corrected 2026-07-14)**: local tools collect complete output and apply only contract-equivalent normalization that is strictly shorter; command-specific lossy Bash filters are off by default, and compound Bash uses no semantic adapter. One owner evaluates the complete parallel-result batch against the final provider request: it solves the largest final input `Pmax` for which `Pmax + output reserve + max(2048, 3% of Pmax) <= context window`, then admits only the remaining physical capacity. Results stay verbatim whenever they fit; only real overflow persists the complete value and emits `KODAX_RESULT_INCOMPLETE`. History keeps the same physical-capacity safety rule: no default lossy microcompaction below capacity, summary-first at pressure, and typed failure without silent deletion when a recoverable request cannot be formed. FEATURE_272 supersedes FEATURE_251 only for the default major-compaction trigger. FEATURE_252's deterministic pre-start workflow contract lint is unchanged. See [docs/features/v0.7.61.md](docs/features/v0.7.61.md) and [docs/ADR.md ADR-050](docs/ADR.md).
878
+
879
+ **Reliable Always-On Context Compaction (FEATURE_272, v0.7.74)**: automatic major compaction cannot be disabled. Its percentage trigger defaults to 75% and clamps to 15-90%; optional `triggerTokens` is inactive when omitted/zero, otherwise the smaller percentage, absolute, and physical-capacity threshold wins. The protected raw tail is 20% of that effective trigger. One transaction summarizes the complete eligible prefix, preserves every genuine user request through an exact ledger, and emits success only after a physically valid token reduction and awaited durable commit. Before raw bodies are evicted, the Session owner durably flushes their exact lineage; stable entry IDs merge the sidecar and slim Session without duplicates. Root and persistent child Agents can recover omitted user/assistant/tool details through bounded `session_history_search` → `session_history_read`, with children isolated to hidden worker Sessions and never granted root-history access. SDK/Runtime clients use revision-bound `transcriptSearch`, pages, and lossless chunks. Hidden reasoning, system instructions, and synthetic checkpoints are excluded from model search. See [the feature design](docs/features/v0.7.74.md), [SDK guide §25](public_docs/sdk/embedder-guide.md#25-always-on-context-compaction-and-bounded-transcript-recovery-v0774), and [ADR-057](docs/ADR.md#adr-057-large-compaction-is-an-always-on-context-scoped-full-coverage-transaction).
880
+
881
+ **Mailbox-Driven Agent Coordination (FEATURE_273, v0.7.74)**: `wait_agent` is now a true model-facing mailbox yield with one bounded `timeout_ms`, not an Actor progress/event reader. It wakes for scoped Agent messages or completions, root user input, interruption, or timeout; progress remains available to UI/SDK snapshot, replay, and long-poll consumers without resampling the parent model. The tool returns only a wake acknowledgement, while authenticated Agent evidence and structured task metadata enter the next safe model boundary once. Unacknowledged root completions survive a hard restart, same-process Runtime rebuilds deduplicate by child turn ID, and acknowledged or legacy historical completions are not replayed. Use `list_agents` for tree state and `agent_output` for a targeted known result. See [the feature design](docs/features/v0.7.74.md#feature_273-mailbox-driven-agent-wait-and-telemetrycontrol-separation), [SDK guide §26](public_docs/sdk/embedder-guide.md#26-agent-mailbox-control-versus-sdk-event-telemetry-v0774), and [ADR-058](docs/ADR.md#adr-058-model-agent-wait-is-mailbox-control-not-event-telemetry).
882
+
883
+ **Active-Run Interrupt Input (v0.7.74)**: embedded Runtime and the shared daemon advertise `interruptInput:1`. `runtime.runs.submitInput()` queues an immutable, ordered input for the current active Actor Run; all inputs admitted before one safe Runner boundary are delivered FIFO as separate user messages in the next LLM request, without creating continuation Runs. Queued/delivered state is visible in typed Run snapshots/events, delivery is acknowledged against the exact consumed IDs, and terminal cleanup prevents undelivered input from leaking into later Runs.
884
+
885
+ **External Agent SDK Plane (FEATURE_258, v0.7.67)**: `/agent` exports the protocol-neutral executor, registration, policy, credential-broker, artifact-policy, catalog, and durable task contracts. `/runtime` exposes the installed plane through `admin.agentRegistrations`, `agents`, and `agentTasks`, with the same DTO service methods over embedded and daemon clients. Executor factories are host functions: install them in an inline owner or while creating a new in-process daemon owner; they cannot be injected through an existing daemon connection or across a Runtime Worker boundary. Plane shutdown is terminal: pending waits and all later service calls reject. Restricted Workflow scripts preserve validated `phase` and external `target` routing. See the [complete owner/consumer recipes and safety contract](public_docs/sdk/embedder-guide.md#18-external-agent-executor-plane-feature_258-v0767).
886
+
887
+ **Cost-Disciplined Workflow SDK (FEATURE_259, v0.7.67)**: SDK callers configure run-scoped `modelTiers` and `workflow.maxConcurrency`, while workflow authors express semantic `fast` / `balanced` / `deep` intent. Terminal workflow events expose resolved tier/source/fallback/usage/duration facts, and each durable `run.json` contains an `efficiencyReport` with token coverage, role/tier starts, packet-read topology, review waves, and quality-gate outcomes. See the [routing and telemetry contract](public_docs/sdk/embedder-guide.md#20-cost-disciplined-workflow-routing-and-telemetry-feature_259-v0767).
888
+
889
+ **Paged Session Listing (FEATURE_261, v0.7.67)**: both `/session` `listSessions()` and `runtime.sessions.list()` accept an exact `surface` filter and opaque continuation `cursor`; each returned summary carries the cursor for the next page. Filtering happens before the page limit, so a host does not need to over-fetch mixed surfaces. See the [pagination recipes](public_docs/sdk/embedder-guide.md#19-session-surface-filtering-and-cursor-pagination-feature_261-v0767).
890
+
865
891
  **Experimental Memory Agent SDK (FEATURE_260 + FEATURE_292)**: `/experimental-memory` exposes the source-compatible `MemoryAgent`/`MemorySession` lifecycle plus the additive `MemoryManagementAgent` facade when `createMemoryAgent()` receives a `MemoryManagementController`. That facade provides governed `list()`, `remember()`, and `forget()` through the same plane used by the conversation-first product surface. Passive recall is zero-wait; `query()` is read-only and deliberate; recalled content stays low-authority, and safety/scope gates remain deterministic. See the [direct session and boundary guide](public_docs/sdk/embedder-guide.md#21-experimental-governed-memory--experimental-memory-feature_260--feature_275--feature_292-v0768v0785).
866
-
867
- **Bidirectional A2A 1.0 (FEATURE_267, v0.7.69)**: `/a2a` discovers allowed Agent Cards and installs a JSON-RPC/SSE executor through the existing F258 plane. Configured outbound Agents are also registered automatically as `external:<name>` in embedded CLI and user-daemon Runtimes, so the main Agent can orchestrate them without host code. One `a2a.json` may hold many outbound registrations and at most one inbound server, which publishes either the Runtime default or one validated `~/.kodax/agents/*.md` Agent behind an authenticated Runtime facade. The built-in listener is loopback-only and will not return a port blocked by Fetch-compatible clients; public deployment uses `handle()` behind host-owned TLS and authorization. A2A 0.3, gRPC, HTTP+JSON, push notifications, and automatic public exposure are not advertised. See the [client/server recipes and security boundaries](public_docs/sdk/embedder-guide.md#22-bidirectional-a2a-10--a2a-feature_267-v0769).
868
-
869
- **A2A interoperability and authentication hardening** keeps a discovered
870
- interface on the trusted Agent Card origin and sends credentials only when one
871
- complete Card/Skill security requirement is satisfiable. The no-code client
872
- supports HTTP Bearer compatibility and OAuth 2.0 Client Credentials; for OAuth,
873
- an external Authorization Server issues short-lived access tokens and KodaX
874
- caches them only in memory. Inbound `a2a serve` can validate RFC 9068 JWT access
875
- tokens from an external issuer/JWKS, but never signs or issues production
876
- tokens itself. It resolves its provider from CLI, then environment, config, and
877
- the built-in default; a Markdown Agent can pin its own provider. Input
878
- continuation resumes the original Runtime run, task history and retention are
879
- bounded with stable cursor pagination, and authenticated SSE is correlated
880
- before falling back to polling after an early normal EOF. Only direct remote
881
- artifacts, broker-staged outputs, and outputs from a successfully admitted
882
- Skill script can be published; ordinary workspace writes and local paths stay
883
- private.
884
-
885
- This authentication and per-Agent activation hardening is a post-release
886
- closure of the v0.7.69 F267/F268 design and ships in the v0.7.71 patch; it is
887
- not a claim that older v0.7.69 binaries contained the
888
- later OAuth profiles.
889
-
890
- **v0.7.70 MCP discovery hardening** uses exact capability IDs and revisioned
891
- cursors while admitting results against real physical capacity. Compact CJK
892
- queries are segmented, and a cross-language lexical zero match either returns a
893
- lossless bounded grouped inventory or one concise retry in the catalog language.
894
- Partial provider failure remains explicit rather than disappearing into an
895
- apparently complete result.
896
-
897
- The complete built-in path is available without writing TypeScript:
898
-
899
- ```bash
900
- # Call another A2A Agent
901
- kodax a2a add research https://agent.example/.well-known/agent-card.json --effect read
902
- kodax a2a test research
903
- kodax a2a call research "Summarize this topic"
904
-
905
- # Explicitly authorize a private plaintext endpoint (prefer HTTPS when available)
906
- kodax a2a add intranet http://10.20.30.40/.well-known/agent-card.json \
907
- --allow-private --allow-insecure-http --effect read
908
-
909
- # Stage an OAuth-protected Agent, then hot-activate/deactivate it
910
- export RESEARCH_A2A_CLIENT_SECRET='provisioned-by-your-authorization-server'
911
- # PowerShell: $env:RESEARCH_A2A_CLIENT_SECRET='provisioned-by-your-authorization-server'
912
- # PowerShell: run the command on one line or replace each trailing \ with a backtick.
913
- kodax a2a add reviewer https://reviewer.example/.well-known/agent-card.json \
914
- --disabled --effect read --oauth-scheme enterprise-oauth \
915
- --oauth-issuer https://identity.example/ \
916
- --oauth-token-url https://identity.example/oauth/token \
917
- --oauth-client-id kodax-reviewer \
918
- --oauth-client-secret-env RESEARCH_A2A_CLIENT_SECRET \
919
- --oauth-scope a2a.invoke --oauth-resource https://reviewer.example/
920
- kodax a2a enable reviewer
921
- kodax a2a disable reviewer # blocks new dispatch; does not cancel in-flight tasks
922
-
923
- # Expose the Runtime default Agent, or pass a name from ~/.kodax/agents/*.md
924
- export KODAX_A2A_TOKEN='replace-with-a-long-random-token'
925
- # PowerShell: $env:KODAX_A2A_TOKEN='replace-with-a-long-random-token'
926
- kodax a2a expose # or: kodax a2a expose document-agent
927
- kodax a2a serve # loopback http://127.0.0.1:8765
928
- ```
929
-
930
- MCP, A2A, and Extension declarations live in one user file per domain under
931
- `~/.kodax/integrations/`. Use `kodax config paths`,
932
- `kodax config template <core|mcp|a2a|extensions>`,
933
- `kodax integrations migrate --apply`, and the `kodax mcp`, `kodax a2a`, or
934
- `kodax extensions` commands to manage them. Migration imports only legacy
935
- `config.json#mcpServers` and `config.json#extensions`; A2A has no legacy source.
936
- It never overwrites an existing destination. The first MCP/Extension mutation
937
- can stage legacy entries. Remove legacy keys only with
938
- `--apply --cleanup-legacy`, after reviewing destination files and
939
- literal-secret warnings. Running
940
- CLI/daemon hosts retain the
941
- last valid revision, atomically replace the complete MCP provider, reconcile
942
- Extensions per entry, and hot-register outbound A2A Agents. Each A2A entry has
943
- a desired `enabled` switch; `kodax a2a list` shows configuration, while the
944
- owning Runtime is authoritative for live applied registrations. Disabled
945
- entries are not fetched during automatic reconciliation and, after the owning
946
- Runtime applies the revision, cannot accept new dispatch. The mutation command
947
- itself is not cross-process acknowledgement. `a2a add --disabled` still checks
948
- the Card by default unless `--no-test` is supplied, while `a2a test` performs
949
- discovery/security planning without requesting an OAuth token. The fixed
950
- `KODAX_A2A_TOKEN` example is an operator-provisioned compatibility credential;
951
- KodaX does not generate or issue it. Disabled entries remain available for
952
- later re-enable. Private-address access and non-loopback plaintext HTTP are
953
- independent, persisted, default-deny permissions (`--allow-private` and
954
- `--allow-insecure-http`); exact loopback HTTP remains available without either.
955
- OAuth token endpoints retain their stricter HTTPS-or-exact-loopback rule.
956
- Worker-hosted SDK Runtimes can load this same configured plane inside the Worker
957
- owner with `worker: { configuredA2A: true }`. The CLI honors the same opt-in
958
- from `~/.kodax/config.json` (`"worker": { "configuredA2A": true }`) by creating
959
- a Worker-hosted embedded Runtime that loads the configured A2A plane. `a2a serve` loads
960
- its configured MCP/Extension capability surface before listening and pins that
961
- execution authority; it hot-reloads publication, authentication, and limits.
962
-
963
- A2A configuration migration and retained task ownership are separate. If a
964
- v0.7.70 task store must remain addressable after the realm-aware upgrade, stop
965
- the A2A server, run `kodax a2a migrate-tasks` to inspect the exact-owner plan,
966
- then apply it with `--apply --confirm-server-stopped`. OAuth migration also
967
- requires the known historical `--subject`; normal serving never guesses or
968
- dual-reads a legacy owner key.
969
-
970
- Agent, Skill, Extension-tool authority, workspace, tool-policy, or task-store
971
- changes require an explicit server restart. Managed
972
- A2A contexts default to `~/kodax_a2a_server_workspace/<runtime-profile>/contexts/`.
973
- Exact Skill scripts require the opt-in isolated policy and a passing
974
- `kodax sandbox doctor` (`kodax sandbox setup` performs the explicit Windows
975
- one-time provisioning).
976
-
977
- ---
978
-
979
- ## Features
980
-
981
- - **Modular Architecture** - Use as CLI, as a library, or as a Node-free single binary
982
- - **16 Built-in Provider Aliases** - Anthropic, OpenAI, DeepSeek, Kimi, Kimi Code, Qwen, Qwen Token Plan, Zhipu, Zhipu Coding, Zai Coding, MiniMax Coding, MiMo Coding, MiMo, Ark Coding, Gemini CLI, Codex CLI - plus user-defined OpenAI/Anthropic-compatible providers
983
- - **Dynamic Workflows + SDK Process Surface** - Generate/reuse capability-routed workflows, observe live progress through `WorkflowProcessSnapshot`, and control workflow lifecycle from SDK hosts without parsing REPL output
984
- - **V2 Worker single-loop + Sidecar Verifier (default)** - Single-agent main loop with an out-of-band Sidecar Verifier as Stop-hook (claudecode-shape; FEATURE_184 v0.7.42, ADR-030). Verifier returns accept/revise/blocked verdict on Worker text-only termination. The pre-v0.7.43 V1 chain is retired, `emit_handoff` is deleted, accept-verdict UI silently passes through, and content-aware gating skips trivial-chat sidecar calls. Adaptive child steering uses the canonical Actor collaboration tools with idle-yield waiting; specialist routing uses `spawn_agent(agent_id=...)`.
985
- - **Reasoning Effort** - Effort-first control (`off/auto/low/medium/high` plus model-supported extras) across providers
986
- - **Streaming Output** - Real-time response display
987
- - **Session Management** - JSONL format with branchable session lineage tree
988
- - **Skills System** - Natural language triggering, extensible, role-projected in AMA
989
- - **Repo Intelligence** - Built-in full/light repository intelligence with native KodaX auto-injection lane
990
- - **Rich Tool Surface** - 50+ built-in tools across file ops, shell, search, repo intelligence, MCP capabilities, git worktree, and agent control
991
- - **Permission Control** - 3 permission modes with pattern-based control
992
- - **Standalone Binary** - `bun --compile` releases for Win/macOS/Linux x64+arm64, no Node.js required on target machines
993
- - **Cross-Platform** - Windows/macOS/Linux
994
- - **TypeScript Native** - Full type safety and IDE support
995
-
996
- ---
997
-
998
- ## Installation
999
-
1000
- ### As CLI Tool
1001
-
1002
- ```bash
1003
- # Clone repository
1004
- git clone https://github.com/icetomoyo/KodaX.git
1005
- cd KodaX
1006
-
1007
- # Install dependencies (includes workspace packages)
1008
- npm install
1009
-
1010
- # Build the monorepo
1011
- npm run build
1012
-
1013
- # Link globally (development mode)
1014
- npm link
1015
-
1016
- # Now you can use 'kodax' anywhere
1017
- kodax "your task"
1018
- ```
1019
-
1020
- ### As Standalone Binary (no Node required on target)
1021
-
1022
- KodaX can be packaged into a single executable + a small `builtin/` sidecar directory using `bun --compile`. The target machine does **not** need Node.js or any other runtime.
1023
-
1024
- Supported targets: `win-x64`, `linux-x64`, `linux-arm64`, `darwin-x64`, `darwin-arm64`. Win7 / pre-glibc-2.27 distros / LoongArch are not supported.
1025
-
1026
- **Build locally**:
1027
-
1028
- ```bash
1029
- # Install Bun once on your build machine
1030
- npm i -g bun # or scoop/brew/curl install — see docs/release.md
1031
-
1032
- npm run build:binary # Current host platform (fastest)
1033
- npm run build:binary:all # All five targets in sequence
1034
- node scripts/build-binary.mjs --target=linux-arm64 # Specific target
1035
- ```
1036
-
1037
- Output lives under `dist/binary/<target>/`:
1038
-
1039
- ```
1040
- dist/binary/linux-x64/
1041
- ├── kodax # ~60 MB Bun-compiled executable
1042
- ├── builtin/ # Sidecar built-in skills
1043
- ├── provider-capabilities.json
1044
- ├── semantic-worker.js # Repo-intelligence Worker
1045
- ├── runtime-worker.js # SDK Runtime Worker
1046
- └── constructed-handler-worker.js # Constructed-tool Worker
1047
- ```
1048
-
1049
- Smoke-test: `dist/binary/<host>/kodax --version`.
1050
-
1051
- **Automated release**: pushing a `v*` git tag triggers `.github/workflows/release.yml`, which builds all five targets on native runners, runs smoke tests, and publishes a GitHub Release with archives + SHA256SUMS. Use the `workflow_dispatch` button in the Actions UI to test the pipeline without tagging.
1052
-
1053
- See [docs/release.md](docs/release.md) for full details on build flags, archive layout, troubleshooting, and the build-time `KODAX_BUNDLED` / `KODAX_VERSION` defines.
1054
-
1055
- ### As Library
1056
-
1057
- ```bash
1058
- npm install @kodax-ai/kodax
1059
- ```
1060
-
1061
- ```typescript
1062
- import { runKodaX } from '@kodax-ai/kodax';
1063
-
1064
- process.env.ZHIPU_API_KEY = process.env.ZHIPU_API_KEY ?? 'your_api_key';
1065
-
1066
- const result = await runKodaX({
1067
- provider: 'zhipu-coding',
1068
- effort: 'auto',
1069
- events: {
1070
- onTextDelta: (text) => process.stdout.write(text),
1071
- onComplete: () => console.log('\nDone!'),
1072
- },
1073
- }, 'your task');
1074
-
1075
- console.log(result.lastText);
1076
- ```
1077
-
1078
- #### SDK Subpath Imports (v0.7.39+)
1079
-
1080
- For smaller surface and tree-shake-friendly imports, the SDK is also exposed via subpath exports — pick only the package(s) you need:
1081
-
1082
- ```typescript
1083
- import { Runner } from '@kodax-ai/kodax/agent'; // agent runtime
1084
- import { getProvider } from '@kodax-ai/kodax/llm'; // LLM abstraction (16 aliases)
1085
- import { runKodaX } from '@kodax-ai/kodax/coding'; // coding tools + prompts
1086
- import { createImageArtifactFromPath } from '@kodax-ai/kodax/media'; // input artifacts
1087
- import { SkillRegistry } from '@kodax-ai/kodax/skills'; // zero-dep skill loader
1088
- import { loadConfig } from '@kodax-ai/kodax/repl'; // REPL config / session helpers
1089
- import { createMcpManager } from '@kodax-ai/kodax/mcp'; // MCP popout manager (v0.7.42)
1090
- import { listSessions } from '@kodax-ai/kodax/session'; // session history helpers
1091
- import { createKodaXRuntime } from '@kodax-ai/kodax/runtime'; // embedded/daemon runtime API
1092
- import { runKodaXSandboxed } from '@kodax-ai/kodax/sandbox'; // standalone ASRT containment
1093
- import { createKodaXA2AServer } from '@kodax-ai/kodax/a2a'; // A2A 1.0 client/server edge
1094
- import { createMemoryAgent } from '@kodax-ai/kodax/experimental-memory'; // opt-in memory SDK
1095
- ```
1096
-
1097
- All 13 SDK entries (root + 12 subpaths) share internal code via ESM chunk splitting — importing from `/agent` does not pull in `/repl`'s Ink + React surface.
1098
-
1099
- For the complete host-facing contract — including embedded/Worker/daemon ownership,
1100
- external-agent registration and task control, session cursor pagination, workflow
1101
- model-tier routing, and efficiency telemetry — see the
1102
- [SDK Embedder Integration Guide](public_docs/sdk/embedder-guide.md).
1103
-
1104
- > **ESM-only.** The SDK is published as ES Modules. In a CommonJS context (Electron main process, legacy Webpack CJS bundles, `require()`-based code) you must use `await import(...)` instead of `require()`. See [public_docs/sdk/embedder-guide.md §5](public_docs/sdk/embedder-guide.md#5-consuming-from-a-commonjs-context-electron-main-cjs-bundles) for the canonical recipe + the technical reason most subpaths cannot ship a dual ESM/CJS build.
1105
-
1106
- For CLI users, provider defaults live in `~/.kodax/config.json`. For library users, API keys are still read from environment variables; if you need custom base URLs or provider aliases, use `registerCustomProviders()` as shown above.
1107
-
1108
- ---
1109
-
1110
- ## Usage
1111
-
1112
- ### REPL Quickstart
1113
-
1114
- Running `kodax` with no prompt starts the interactive REPL.
1115
-
1116
- ```bash
1117
- kodax
1118
- ```
1119
-
1120
- Inside the REPL you can type normal requests or slash commands:
1121
-
1122
- ```text
1123
- Read package.json and summarize the architecture
1124
- /model
1125
- /mode
1126
- /help
1127
- ```
1128
-
1129
- ### CLI Quickstart
1130
-
1131
- ```bash
1132
- # Set API key
1133
- export ZHIPU_API_KEY=your_api_key
1134
-
1135
- # Basic usage
1136
- kodax "Help me create a TypeScript project"
1137
-
1138
- # Choose a provider explicitly
1139
- kodax --provider openai --model gpt-5.4 "Create a REST API"
1140
-
1141
- # Use higher reasoning effort
1142
- kodax --effort high "Review this architecture"
1143
- ```
1144
-
1145
- ### Session Workflows
1146
-
1147
- Use a session when you want memory across turns. Without a session, each CLI call is independent.
1148
-
1149
- ```bash
1150
- # No memory: two separate calls
1151
- kodax "Read src/auth.ts"
1152
- kodax "Summarize it"
1153
-
1154
- # With memory: same session
1155
- kodax --session my-project "Read package.json"
1156
- kodax --session my-project "Summarize it"
1157
- kodax --session my-project "How should I fix the first issue?"
1158
-
1159
- # Session management
1160
- kodax -r # Search, page, and select a non-empty session
1161
- kodax -r <session-id> # Resume a known session directly
1162
- kodax -r "Review runtime" # Resume a unique exact title; duplicates open the picker
1163
- kodax --session list # List up to 50 non-empty sessions
1164
- kodax --session cleanup-acp # Preview strictly matched empty ACP-test pollution
1165
- ```
1166
-
1167
- Bare `-r` opens an interactive picker with incremental search, arrow/PageUp/PageDown
1168
- navigation, Tab completion, full selected-session ID display, and Enter-to-resume.
1169
- An explicit value checks the complete session ID first, then an exact
1170
- case-insensitive title; duplicate titles open a narrowed picker instead of
1171
- silently choosing one. The picker loads before the full CLI, so session listing
1172
- remains responsive. After selection it hands terminal input to the resumed
1173
- REPL; Esc releases the picker's stdin ownership and immediately returns to the
1174
- invoking shell. Session replay preserves each recorded message/event timestamp.
1175
-
1176
- Cleanup is preview-only unless
1177
- `--apply-session-cleanup` is also provided; matching sessions are archived rather
1178
- than permanently deleted.
1179
-
1180
- ### Session Patterns
1181
-
1182
- ```bash
1183
- # ❌ No memory: two independent calls
1184
- kodax "Read src/auth.ts" # Agent reads and responds
1185
- kodax "Summarize it" # Agent doesn't know what to summarize
1186
-
1187
- # ✅ With memory: same session
1188
- kodax --session auth-review "Read src/auth.ts"
1189
- kodax --session auth-review "Summarize it" # Agent knows to summarize auth.ts
1190
- kodax --session auth-review "How to fix first issue" # Agent has context
1191
- ```
1192
-
1193
- ### Workflow Examples
1194
-
1195
- ```bash
1196
- # Code review (multi-turn conversation)
1197
- kodax --session review "Review src/ directory"
1198
- kodax --session review "Focus on security issues"
1199
- kodax --session review "Give me fix suggestions"
1200
-
1201
- # Project development (continuous session)
1202
- kodax --session todo-app "Create a Todo application"
1203
- kodax --session todo-app "Add delete functionality"
1204
- kodax --session todo-app "Write tests"
1205
- ```
1206
-
1207
- ### CLI Reference
1208
-
1209
- ```text
1210
- kodax Start the interactive REPL
1211
- -h, --help [topic] Show help or topic help
1212
- -p, --print <text> Run a single task and exit
1213
- -c, --continue Continue the most recent non-empty conversation in this directory
1214
- -r, --resume [value] Resume by ID/exact title, or open the searchable picker
1215
- -m, --provider Provider to use
1216
- --model <name> Override the model
1217
- --reasoning <mode> off | auto | quick | balanced | deep
1218
- -t, --thinking Compatibility alias for --reasoning auto
1219
- -s, --session <op> Session ID or legacy session operation
1220
- -j, --parallel Enable parallel tool execution
1221
- --max-iter <n> Max iterations
1222
- ```
1223
-
1224
- ### Permission Control
1225
-
1226
- KodaX provides 3 permission modes for fine-grained control:
1227
-
1228
- | Mode | Description | Tools Need Confirmation |
1229
- |------|-------------|------------------------|
1230
- | `plan` | Read-only planning mode | All modification tools blocked |
1231
- | `accept-edits` | Auto-accept file edits | bash only |
1232
- | `auto` | Runtime-owned LLM/rules classification within the project boundary | Only explicit classifier escalation |
1233
-
1234
- ```bash
1235
- # In REPL, use /mode command
1236
- /mode plan # Switch to plan mode (read-only)
1237
- /mode accept-edits # Switch to accept-edits mode
1238
- /mode auto # Switch to Runtime-owned Auto Mode
1239
- /auto # Alias for auto
1240
-
1241
- # Check current mode
1242
- /mode
1243
- ```
1244
-
1245
- **Features:**
1246
- - In `accept-edits` mode, choosing "always" can persist safe Bash allow-patterns
1247
- - Plan mode includes system prompt context for LLM awareness
1248
- - Sensitive/protected or unresolved targets enter Auto[LLM]/approval review;
1249
- ordinary reads outside the project are allowed
1250
- - Pattern-based permission: Allow specific Bash commands (e.g., `Bash(npm install)`)
1251
- - Unified diff display for write/edit operations
1252
- - Auto Mode first admits exactly modeled safe reads and workspace/temp
1253
- mutations without classifier latency. Remaining actions are reviewed against
1254
- bounded user intent and exact operation facts; a safe verdict creates no
1255
- pending approval request. Classifier failures retry once, then use the
1256
- Accept-edits safety boundary rather than silently switching to Auto[rules].
1257
- - Shift-Tab cycles `Plan -> Edits -> Auto`; Shift+Enter inserts a newline. Auto
1258
- immediately displays `Auto[LLM]` or `Auto[RULES]`, and rapid mode changes are
1259
- persisted in input order. `Auto[RULES]` remains an explicit/manual engine;
1260
- use `/auto-engine llm` to select LLM classification.
1261
- - Runtime-backed prompts can offer exact `allow once`, `allow this session`,
1262
- and `always allow` choices. Return the Runtime-issued opaque suggestion;
1263
- never derive or widen a permission rule from the displayed command or path.
1264
- Persistent grants are daemon-owned, revisioned, and can be listed/revoked
1265
- through `runtime.permissions` by an authorized SDK host. Dynamic shell
1266
- commands deliberately receive no persistent-grant suggestion.
1267
-
1268
- `kodax -c` skips zero-message ACP/bootstrap placeholders even when they are
1269
- newer than the last real conversation. The same newest non-empty rule applies
1270
- to Ink, classic, one-shot CLI, and coding-runtime auto-resume; an explicit
1271
- session ID always wins. Interactive resume also restores the saved workspace
1272
- runtime before relative shell commands or the next model turn.
1273
-
1274
- ### CLI Help Topics
1275
-
1276
- Get detailed help for specific topics:
1277
-
1278
- ```bash
1279
- # Basic help
1280
- kodax -h
1281
- kodax --help
1282
-
1283
- # Detailed topic help
1284
- kodax -h sessions # Session management details
1285
- kodax -h init # Long-running project initialization
1286
- kodax -h project # Project mode / harness workflow
1287
- kodax -h auto # Auto-continue mode
1288
- kodax -h provider # LLM provider configuration
1289
- kodax -h thinking # Thinking/reasoning effort and compatibility modes
1290
- kodax -h team # Multi-agent parallel execution
1291
- kodax -h print # Print configuration
1292
- ```
1293
-
1294
- ### Environment Variables
1295
-
1296
- KodaX recognizes a number of environment variables for tuning runtime behavior. The most commonly used ones are listed below; for the full list, search the repo for `process.env.KODAX_`.
1297
-
1298
- #### `KODAX_MAX_OUTPUT_TOKENS`
1299
-
1300
- Overrides the per-turn `max_tokens` value sent to **every** provider (Anthropic, OpenAI, Zhipu, Kimi, MiniMax, Qwen, DeepSeek, MiMo, Gemini, Codex, …). Set to a positive integer; unset or non-numeric values are ignored. This is an **explicit user intent**: when set, it wins over the provider's model descriptor cap, over the provider config default, and over the global `KODAX_MAX_TOKENS` fallback. RST defense is handled at the provider config layer (`streamMaxDurationMs` watchdog + non-streaming fallback in `packages/llm/src/providers/registry.ts`), so this variable is purely an output-budget knob.
1301
-
1302
- ```bash
1303
- # Allow up to 48K output tokens per turn (use a higher cap when generating long files)
1304
- export KODAX_MAX_OUTPUT_TOKENS=48000
1305
- kodax "generate the full implementation"
1306
-
1307
- # Unset to restore default behavior
1308
- unset KODAX_MAX_OUTPUT_TOKENS
1309
- ```
1310
-
1311
- Precedence used by every provider's `getEffectiveMaxOutputTokens()` (see `packages/llm/src/providers/base.ts`):
1312
-
1313
- 1. One-shot per-request override (agent-loop escalation / context-overflow recovery — internal)
1314
- 2. **`KODAX_MAX_OUTPUT_TOKENS`** (this variable, explicit user intent)
1315
- 3. Active model descriptor's `maxOutputTokens` (FEATURE_098 per-model cap)
1316
- 4. Provider config default
1317
- 5. Global `KODAX_MAX_TOKENS` fallback
1318
-
1319
- Related variables: `KODAX_MAX_TOKENS` (global fallback when no provider/model cap applies), `KODAX_ESCALATED_MAX_OUTPUT_TOKENS` (escalation budget used by the agent loop when a turn returns `stop_reason: max_tokens`).
1320
-
1321
- > **Retired in v0.7.42**: `KODAX_RST_PRONE_PROVIDERS` and `KODAX_WRITE_TURN_MAX_TOKENS` (the v0.7.28 P2b write-turn cap mechanism) are no longer recognized. The 2026-04 bench measured RST as time-based (zhipu-coding 308s server kill window), not payload-size-based, so the cap was retired in favor of the per-provider `streamMaxDurationMs` watchdog + non-streaming fallback chain (configured in `registry.ts`). Existing env exports become silent no-ops; remove them from shell profiles when convenient.
1322
-
1323
- #### Sidecar verifier diagnostics
1324
-
1325
- Use these when diagnosing Worker text-only completion stalls or custom provider verifier behavior:
1326
-
1327
- ```bash
1328
- export KODAX_VERIFIER_LOG=1
1329
- export KODAX_VERIFIER_PROVIDER=anthropic
1330
- export KODAX_VERIFIER_MODEL=claude-haiku-4-5-20251001
1331
- ```
1332
-
1333
- - `KODAX_VERIFIER_LOG=1` shows verifier gate/elapsed/trace information and is equivalent to `"verifierLog": true` in `~/.kodax/config.json`.
1334
- - `KODAX_VERIFIER_PROVIDER` + `KODAX_VERIFIER_MODEL` route the verifier to a separate provider/model instead of inheriting the main Worker model. Set both together.
1335
- - `KODAX_VERIFIER_ALWAYS=1` forces the verifier to fire on every text-only completion for debugging/regression sweeps.
1336
-
1337
- SDK/headless hosts can observe actionable Sidecar Verifier messages via
1338
- `KodaXEvents.onSidecarMessage`; JSONL output emits the same payload as
1339
- `sidecar.message`. Only `revise` and `blocked` verdicts are surfaced; `accept`
1340
- stays silent.
1341
-
1342
- ## Advanced Library Usage
1343
-
1344
- #### Simple Mode (runKodaX)
1345
-
1346
- ```typescript
1347
- import { runKodaX, KodaXEvents } from '@kodax-ai/kodax';
1348
-
1349
- const events: KodaXEvents = {
1350
- onTextDelta: (text) => process.stdout.write(text),
1351
- onThinkingDelta: (text) => console.log(`Thinking delta: ${text.length} chars`),
1352
- onToolResult: (result) => console.log(`Tool ${result.name}: ${result.content.slice(0, 100)}`),
1353
- onSidecarMessage: (event) => console.log(`[sidecar:${event.verdict}] ${event.content}`),
1354
- onComplete: () => console.log('\nDone!'),
1355
- onError: (e) => console.error(e.message),
1356
- };
1357
-
1358
- const result = await runKodaX({
1359
- provider: 'zhipu-coding',
1360
- effort: 'auto',
1361
- events,
1362
- }, 'What is 1+1?');
1363
-
1364
- console.log(result.lastText);
1365
- ```
1366
-
1367
- #### Continuous Session (KodaXClient)
1368
-
1369
- ```typescript
1370
- import { KodaXClient } from '@kodax-ai/kodax';
1371
-
1372
- const client = new KodaXClient({
1373
- provider: 'zhipu-coding',
1374
- effort: 'auto',
1375
- events: {
1376
- onTextDelta: (t) => process.stdout.write(t),
1377
- },
1378
- });
1379
-
1380
- // First message
1381
- await client.send('Read package.json');
1382
-
1383
- // Continue same session
1384
- await client.send('Summarize it');
1385
-
1386
- console.log(client.getSessionId());
1387
- ```
1388
-
1389
- #### Custom Session Storage
1390
-
1391
- ```typescript
1392
- import { runKodaX, KodaXSessionStorage, KodaXMessage } from '@kodax-ai/kodax';
1393
-
1394
- class MyDatabaseStorage implements KodaXSessionStorage {
1395
- async save(id: string, data: { messages: KodaXMessage[]; title: string; gitRoot: string }) {
1396
- // Save to your database
1397
- }
1398
- async load(id: string) {
1399
- // Load from your database
1400
- return null;
1401
- }
1402
- }
1403
-
1404
- await runKodaX({
1405
- provider: 'zhipu-coding',
1406
- session: {
1407
- id: 'my-session-123',
1408
- storage: new MyDatabaseStorage(),
1409
- },
1410
- events: { ... },
1411
- }, 'task');
1412
- ```
1413
-
1414
- ### Library Modes Comparison
1415
-
1416
- | Feature | runKodaX | KodaXClient |
1417
- |---------|----------|-------------|
1418
- | **Message Memory** | ❌ No | ✅ Yes |
1419
- | **Call Style** | Function | Class instance |
1420
- | **Context** | Independent each time | Accumulates |
1421
- | **Use Case** | Single tasks, batch processing | Interactive dialogue, multi-step tasks |
1422
-
1423
- ---
1424
-
1425
- ## SDK Usage
1426
-
1427
- KodaX ships as a single npm package `@kodax-ai/kodax` with 12 SDK subpath exports (ADR-024 v0.7.39 + ADR-032 v0.7.42 + ADR-038 v0.7.49 + v0.7.56 `/media` + v0.7.64 `/runtime` + v0.7.68 `/experimental-memory` + v0.7.69 `/a2a` + v0.7.78 `/sandbox`). Each subpath is tree-shake-friendly so consumers pull only what they need:
1428
-
1429
- ```bash
1430
- npm install @kodax-ai/kodax
1431
- ```
1432
-
1433
- ```typescript
1434
- import { runKodaX } from '@kodax-ai/kodax'; // root: CLI helpers + runKodaX
1435
- import { Runner, runFanOut } from '@kodax-ai/kodax/agent'; // generic Agent framework
1436
- import { getProvider } from '@kodax-ai/kodax/llm'; // 16-alias LLM abstraction
1437
- import { KODAX_TOOLS } from '@kodax-ai/kodax/coding'; // tools + prompts + agent loop
1438
- import { createImageArtifactFromPath } from '@kodax-ai/kodax/media'; // input artifact helpers
1439
- import { runInkInteractiveMode } from '@kodax-ai/kodax/repl'; // Ink TUI entrypoint
1440
- import { SkillRegistry } from '@kodax-ai/kodax/skills'; // zero-dep skill loader
1441
- import { createMcpManager } from '@kodax-ai/kodax/mcp'; // MCP popout manager (v0.7.42)
1442
- import { listSessions } from '@kodax-ai/kodax/session'; // session history helpers
1443
- import { createKodaXRuntime } from '@kodax-ai/kodax/runtime'; // embedded/daemon runtime API
1444
- import { runKodaXSandboxed } from '@kodax-ai/kodax/sandbox'; // explicit standalone containment
1445
- import { createKodaXA2AServer } from '@kodax-ai/kodax/a2a'; // A2A 1.0 client/server edge
1446
- import { createMemoryAgent } from '@kodax-ai/kodax/experimental-memory'; // opt-in experimental memory SDK
1447
- ```
1448
-
1449
- > The SDK is **ESM-only**. CommonJS consumers (Electron main / Webpack CJS / `require()` callers) must use `await import('@kodax-ai/kodax/...')` — see [public_docs/sdk/embedder-guide.md §5](public_docs/sdk/embedder-guide.md#5-consuming-from-a-commonjs-context-electron-main-cjs-bundles).
1450
-
1451
- ### `@kodax-ai/kodax/llm` — LLM Abstraction
1452
-
1453
- 16 built-in provider aliases (Anthropic, OpenAI, DeepSeek, Kimi, Kimi-Code, Qwen, Qwen-Token-Plan, Zhipu, Zhipu-Coding, Zai-Coding, MiniMax-Coding, MiMo, MiMo-Coding, Ark-Coding, Gemini-CLI, Codex-CLI) + custom provider registration.
1454
-
1455
- ```typescript
1456
- import { getProvider, KodaXBaseProvider } from '@kodax-ai/kodax/llm';
1457
-
1458
- const provider = getProvider('anthropic');
1459
- const stream = await provider.streamCompletion(
1460
- [{ role: 'user', content: 'Hello!' }],
1461
- { onTextDelta: (text) => process.stdout.write(text) }
1462
- );
1463
-
1464
- for await (const result of stream) {
1465
- if (result.type === 'text') { /* … */ }
1466
- else if (result.type === 'tool_use') { /* … */ }
1467
- }
1468
- ```
1469
-
1470
- **Key Features**: unified provider interface · streaming · reasoning effort (`off/auto/low/medium/high` plus model-supported extras) · per-provider retry + error handling · zero business-logic dependencies.
1471
-
1472
- ### `@kodax-ai/kodax/agent` — Agent Framework (standalone-consumable)
1473
-
1474
- ADR-021 standalone-consumable: `@kodax-ai/agent` has **zero inbound `@kodax-ai/coding` dependency** — you can wire any tool surface on top of it.
1475
-
1476
- ```typescript
1477
- import {
1478
- Runner,
1479
- runFanOut,
1480
- runWithIdleYield,
1481
- createAgentActorController,
1482
- generateSessionId,
1483
- estimateTokens,
1484
- DefaultSummaryCompaction,
1485
- } from '@kodax-ai/kodax/agent';
1486
-
1487
- // Bounded-concurrency fan-out with abort + structured progress events (v0.7.39 FEATURE_120)
1488
- const result = await runFanOut({
1489
- bundles: [{ id: 'a', task: 'audit-foo' }, { id: 'b', task: 'audit-bar' }],
1490
- maxParallel: 4,
1491
- run: async (bundle) => doWork(bundle),
1492
- });
1493
-
1494
- // Runtime-owned Actor identity tree (inject an executor before starting Turns)
1495
- const actors = await createAgentActorController();
1496
- const tree = actors.list('/root');
1497
-
1498
- // Pluggable compaction policy (FEATURE_081)
1499
- const policy = new DefaultSummaryCompaction({ thresholdRatio: 0.8, keepRecent: 10 });
1500
- ```
1501
-
1502
- `DefaultSummaryCompaction` is a standalone agent-layer primitive for custom
1503
- loops. It does not replace or disable KodaX's always-on coding-runtime policy
1504
- described under FEATURE_272 above.
1505
-
892
+
893
+ **Bidirectional A2A 1.0 (FEATURE_267, v0.7.69)**: `/a2a` discovers allowed Agent Cards and installs a JSON-RPC/SSE executor through the existing F258 plane. Configured outbound Agents are also registered automatically as `external:<name>` in embedded CLI and user-daemon Runtimes, so the main Agent can orchestrate them without host code. One `a2a.json` may hold many outbound registrations and at most one inbound server, which publishes either the Runtime default or one validated `~/.kodax/agents/*.md` Agent behind an authenticated Runtime facade. The built-in listener is loopback-only and will not return a port blocked by Fetch-compatible clients; public deployment uses `handle()` behind host-owned TLS and authorization. A2A 0.3, gRPC, HTTP+JSON, push notifications, and automatic public exposure are not advertised. See the [client/server recipes and security boundaries](public_docs/sdk/embedder-guide.md#22-bidirectional-a2a-10--a2a-feature_267-v0769).
894
+
895
+ **A2A interoperability and authentication hardening** keeps a discovered
896
+ interface on the trusted Agent Card origin and sends credentials only when one
897
+ complete Card/Skill security requirement is satisfiable. The no-code client
898
+ supports HTTP Bearer compatibility and OAuth 2.0 Client Credentials; for OAuth,
899
+ an external Authorization Server issues short-lived access tokens and KodaX
900
+ caches them only in memory. Inbound `a2a serve` can validate RFC 9068 JWT access
901
+ tokens from an external issuer/JWKS, but never signs or issues production
902
+ tokens itself. It resolves its provider from CLI, then environment, config, and
903
+ the built-in default; a Markdown Agent can pin its own provider. Input
904
+ continuation resumes the original Runtime run, task history and retention are
905
+ bounded with stable cursor pagination, and authenticated SSE is correlated
906
+ before falling back to polling after an early normal EOF. Only direct remote
907
+ artifacts, broker-staged outputs, and outputs from a successfully admitted
908
+ Skill script can be published; ordinary workspace writes and local paths stay
909
+ private.
910
+
911
+ This authentication and per-Agent activation hardening is a post-release
912
+ closure of the v0.7.69 F267/F268 design and ships in the v0.7.71 patch; it is
913
+ not a claim that older v0.7.69 binaries contained the
914
+ later OAuth profiles.
915
+
916
+ **v0.7.70 MCP discovery hardening** uses exact capability IDs and revisioned
917
+ cursors while admitting results against real physical capacity. Compact CJK
918
+ queries are segmented, and a cross-language lexical zero match either returns a
919
+ lossless bounded grouped inventory or one concise retry in the catalog language.
920
+ Partial provider failure remains explicit rather than disappearing into an
921
+ apparently complete result.
922
+
923
+ The complete built-in path is available without writing TypeScript:
924
+
925
+ ```bash
926
+ # Call another A2A Agent
927
+ kodax a2a add research https://agent.example/.well-known/agent-card.json --effect read
928
+ kodax a2a test research
929
+ kodax a2a call research "Summarize this topic"
930
+
931
+ # Explicitly authorize a private plaintext endpoint (prefer HTTPS when available)
932
+ kodax a2a add intranet http://10.20.30.40/.well-known/agent-card.json \
933
+ --allow-private --allow-insecure-http --effect read
934
+
935
+ # Stage an OAuth-protected Agent, then hot-activate/deactivate it
936
+ export RESEARCH_A2A_CLIENT_SECRET='provisioned-by-your-authorization-server'
937
+ # PowerShell: $env:RESEARCH_A2A_CLIENT_SECRET='provisioned-by-your-authorization-server'
938
+ # PowerShell: run the command on one line or replace each trailing \ with a backtick.
939
+ kodax a2a add reviewer https://reviewer.example/.well-known/agent-card.json \
940
+ --disabled --effect read --oauth-scheme enterprise-oauth \
941
+ --oauth-issuer https://identity.example/ \
942
+ --oauth-token-url https://identity.example/oauth/token \
943
+ --oauth-client-id kodax-reviewer \
944
+ --oauth-client-secret-env RESEARCH_A2A_CLIENT_SECRET \
945
+ --oauth-scope a2a.invoke --oauth-resource https://reviewer.example/
946
+ kodax a2a enable reviewer
947
+ kodax a2a disable reviewer # blocks new dispatch; does not cancel in-flight tasks
948
+
949
+ # Expose the Runtime default Agent, or pass a name from ~/.kodax/agents/*.md
950
+ export KODAX_A2A_TOKEN='replace-with-a-long-random-token'
951
+ # PowerShell: $env:KODAX_A2A_TOKEN='replace-with-a-long-random-token'
952
+ kodax a2a expose # or: kodax a2a expose document-agent
953
+ kodax a2a serve # loopback http://127.0.0.1:8765
954
+ ```
955
+
956
+ MCP, A2A, and Extension declarations live in one user file per domain under
957
+ `~/.kodax/integrations/`. Use `kodax config paths`,
958
+ `kodax config template <core|mcp|a2a|extensions>`,
959
+ `kodax integrations migrate --apply`, and the `kodax mcp`, `kodax a2a`, or
960
+ `kodax extensions` commands to manage them. Migration imports only legacy
961
+ `config.json#mcpServers` and `config.json#extensions`; A2A has no legacy source.
962
+ It never overwrites an existing destination. The first MCP/Extension mutation
963
+ can stage legacy entries. Remove legacy keys only with
964
+ `--apply --cleanup-legacy`, after reviewing destination files and
965
+ literal-secret warnings. Running
966
+ CLI/daemon hosts retain the
967
+ last valid revision, atomically replace the complete MCP provider, reconcile
968
+ Extensions per entry, and hot-register outbound A2A Agents. Each A2A entry has
969
+ a desired `enabled` switch; `kodax a2a list` shows configuration, while the
970
+ owning Runtime is authoritative for live applied registrations. Disabled
971
+ entries are not fetched during automatic reconciliation and, after the owning
972
+ Runtime applies the revision, cannot accept new dispatch. The mutation command
973
+ itself is not cross-process acknowledgement. `a2a add --disabled` still checks
974
+ the Card by default unless `--no-test` is supplied, while `a2a test` performs
975
+ discovery/security planning without requesting an OAuth token. The fixed
976
+ `KODAX_A2A_TOKEN` example is an operator-provisioned compatibility credential;
977
+ KodaX does not generate or issue it. Disabled entries remain available for
978
+ later re-enable. Private-address access and non-loopback plaintext HTTP are
979
+ independent, persisted, default-deny permissions (`--allow-private` and
980
+ `--allow-insecure-http`); exact loopback HTTP remains available without either.
981
+ OAuth token endpoints retain their stricter HTTPS-or-exact-loopback rule.
982
+ Worker-hosted SDK Runtimes can load this same configured plane inside the Worker
983
+ owner with `worker: { configuredA2A: true }`. The CLI honors the same opt-in
984
+ from `~/.kodax/config.json` (`"worker": { "configuredA2A": true }`) by creating
985
+ a Worker-hosted embedded Runtime that loads the configured A2A plane. `a2a serve` loads
986
+ its configured MCP/Extension capability surface before listening and pins that
987
+ execution authority; it hot-reloads publication, authentication, and limits.
988
+
989
+ A2A configuration migration and retained task ownership are separate. If a
990
+ v0.7.70 task store must remain addressable after the realm-aware upgrade, stop
991
+ the A2A server, run `kodax a2a migrate-tasks` to inspect the exact-owner plan,
992
+ then apply it with `--apply --confirm-server-stopped`. OAuth migration also
993
+ requires the known historical `--subject`; normal serving never guesses or
994
+ dual-reads a legacy owner key.
995
+
996
+ Agent, Skill, Extension-tool authority, workspace, tool-policy, or task-store
997
+ changes require an explicit server restart. Managed
998
+ A2A contexts default to `~/kodax_a2a_server_workspace/<runtime-profile>/contexts/`.
999
+ Exact Skill scripts require the opt-in isolated policy and a passing
1000
+ `kodax sandbox doctor` (`kodax sandbox setup` performs the explicit Windows
1001
+ one-time provisioning).
1002
+
1003
+ ---
1004
+
1005
+ ## Features
1006
+
1007
+ - **Modular Architecture** - Use as CLI, as a library, or as a Node-free single binary
1008
+ - **16 Built-in Provider Aliases** - Anthropic, OpenAI, DeepSeek, Kimi, Kimi Code, Qwen, Qwen Token Plan, Zhipu, Zhipu Coding, Zai Coding, MiniMax Coding, MiMo Coding, MiMo, Ark Coding, Gemini CLI, Codex CLI - plus user-defined OpenAI/Anthropic-compatible providers
1009
+ - **Dynamic Workflows + SDK Process Surface** - Generate/reuse capability-routed workflows, observe live progress through `WorkflowProcessSnapshot`, and control workflow lifecycle from SDK hosts without parsing REPL output
1010
+ - **V2 Worker single-loop + Sidecar Verifier (default)** - Single-agent main loop with an out-of-band Sidecar Verifier as Stop-hook (claudecode-shape; FEATURE_184 v0.7.42, ADR-030). Verifier returns accept/revise/blocked verdict on Worker text-only termination. The pre-v0.7.43 V1 chain is retired, `emit_handoff` is deleted, accept-verdict UI silently passes through, and content-aware gating skips trivial-chat sidecar calls. Adaptive child steering uses the canonical Actor collaboration tools with idle-yield waiting; specialist routing uses `spawn_agent(agent_id=...)`.
1011
+ - **Reasoning Effort** - Effort-first control (`off/auto/low/medium/high` plus model-supported extras) across providers
1012
+ - **Streaming Output** - Real-time response display
1013
+ - **Session Management** - JSONL format with branchable session lineage tree
1014
+ - **Skills System** - Natural language triggering, extensible, role-projected in AMA
1015
+ - **Repo Intelligence** - Built-in full/light repository intelligence with native KodaX auto-injection lane
1016
+ - **Rich Tool Surface** - 50+ built-in tools across file ops, shell, search, repo intelligence, MCP capabilities, git worktree, and agent control
1017
+ - **Permission Control** - 3 permission modes with pattern-based control
1018
+ - **Standalone Binary** - `bun --compile` releases for Win/macOS/Linux x64+arm64, no Node.js required on target machines
1019
+ - **Cross-Platform** - Windows/macOS/Linux
1020
+ - **TypeScript Native** - Full type safety and IDE support
1021
+
1022
+ ---
1023
+
1024
+ ## Installation
1025
+
1026
+ ### As CLI Tool
1027
+
1028
+ ```bash
1029
+ # Clone repository
1030
+ git clone https://github.com/icetomoyo/KodaX.git
1031
+ cd KodaX
1032
+
1033
+ # Install dependencies (includes workspace packages)
1034
+ npm install
1035
+
1036
+ # Build the monorepo
1037
+ npm run build
1038
+
1039
+ # Link globally (development mode)
1040
+ npm link
1041
+
1042
+ # Now you can use 'kodax' anywhere
1043
+ kodax "your task"
1044
+ ```
1045
+
1046
+ ### As Standalone Binary (no Node required on target)
1047
+
1048
+ KodaX can be packaged into a single executable + a small `builtin/` sidecar directory using `bun --compile`. The target machine does **not** need Node.js or any other runtime.
1049
+
1050
+ Supported targets: `win-x64`, `linux-x64`, `linux-arm64`, `darwin-x64`, `darwin-arm64`. Win7 / pre-glibc-2.27 distros / LoongArch are not supported.
1051
+
1052
+ **Build locally**:
1053
+
1054
+ ```bash
1055
+ # Install Bun once on your build machine
1056
+ npm i -g bun # or scoop/brew/curl install — see docs/release.md
1057
+
1058
+ npm run build:binary # Current host platform (fastest)
1059
+ npm run build:binary:all # All five targets in sequence
1060
+ node scripts/build-binary.mjs --target=linux-arm64 # Specific target
1061
+ ```
1062
+
1063
+ Output lives under `dist/binary/<target>/`:
1064
+
1065
+ ```
1066
+ dist/binary/linux-x64/
1067
+ ├── kodax # ~60 MB Bun-compiled executable
1068
+ ├── builtin/ # Sidecar built-in skills
1069
+ ├── provider-capabilities.json
1070
+ ├── semantic-worker.js # Repo-intelligence Worker
1071
+ ├── runtime-worker.js # SDK Runtime Worker
1072
+ └── constructed-handler-worker.js # Constructed-tool Worker
1073
+ ```
1074
+
1075
+ Smoke-test: `dist/binary/<host>/kodax --version`.
1076
+
1077
+ **Automated release**: pushing a `v*` git tag triggers `.github/workflows/release.yml`, which builds all five targets on native runners, runs smoke tests, and publishes a GitHub Release with archives + SHA256SUMS. Use the `workflow_dispatch` button in the Actions UI to test the pipeline without tagging.
1078
+
1079
+ See [docs/release.md](docs/release.md) for full details on build flags, archive layout, troubleshooting, and the build-time `KODAX_BUNDLED` / `KODAX_VERSION` defines.
1080
+
1081
+ ### As Library
1082
+
1083
+ ```bash
1084
+ npm install @kodax-ai/kodax
1085
+ ```
1086
+
1087
+ ```typescript
1088
+ import { runKodaX } from '@kodax-ai/kodax';
1089
+
1090
+ process.env.ZHIPU_API_KEY = process.env.ZHIPU_API_KEY ?? 'your_api_key';
1091
+
1092
+ const result = await runKodaX({
1093
+ provider: 'zhipu-coding',
1094
+ effort: 'auto',
1095
+ events: {
1096
+ onTextDelta: (text) => process.stdout.write(text),
1097
+ onComplete: () => console.log('\nDone!'),
1098
+ },
1099
+ }, 'your task');
1100
+
1101
+ console.log(result.lastText);
1102
+ ```
1103
+
1104
+ #### SDK Subpath Imports (v0.7.39+)
1105
+
1106
+ For smaller surface and tree-shake-friendly imports, the SDK is also exposed via subpath exports — pick only the package(s) you need:
1107
+
1108
+ ```typescript
1109
+ import { Runner } from '@kodax-ai/kodax/agent'; // agent runtime
1110
+ import { getProvider } from '@kodax-ai/kodax/llm'; // LLM abstraction (16 aliases)
1111
+ import { runKodaX } from '@kodax-ai/kodax/coding'; // coding tools + prompts
1112
+ import { createImageArtifactFromPath } from '@kodax-ai/kodax/media'; // input artifacts
1113
+ import { SkillRegistry } from '@kodax-ai/kodax/skills'; // zero-dep skill loader
1114
+ import { loadConfig } from '@kodax-ai/kodax/repl'; // REPL config / session helpers
1115
+ import { createMcpManager } from '@kodax-ai/kodax/mcp'; // MCP popout manager (v0.7.42)
1116
+ import { listSessions } from '@kodax-ai/kodax/session'; // session history helpers
1117
+ import { createKodaXRuntime } from '@kodax-ai/kodax/runtime'; // embedded/daemon runtime API
1118
+ import { runKodaXSandboxed } from '@kodax-ai/kodax/sandbox'; // standalone ASRT containment
1119
+ import { createKodaXA2AServer } from '@kodax-ai/kodax/a2a'; // A2A 1.0 client/server edge
1120
+ import { createMemoryAgent } from '@kodax-ai/kodax/experimental-memory'; // opt-in memory SDK
1121
+ ```
1122
+
1123
+ All 13 SDK entries (root + 12 subpaths) share internal code via ESM chunk splitting — importing from `/agent` does not pull in `/repl`'s Ink + React surface.
1124
+
1125
+ For the complete host-facing contract — including embedded/Worker/daemon ownership,
1126
+ external-agent registration and task control, session cursor pagination, workflow
1127
+ model-tier routing, and efficiency telemetry — see the
1128
+ [SDK Embedder Integration Guide](public_docs/sdk/embedder-guide.md).
1129
+
1130
+ > **ESM-only.** The SDK is published as ES Modules. In a CommonJS context (Electron main process, legacy Webpack CJS bundles, `require()`-based code) you must use `await import(...)` instead of `require()`. See [public_docs/sdk/embedder-guide.md §5](public_docs/sdk/embedder-guide.md#5-consuming-from-a-commonjs-context-electron-main-cjs-bundles) for the canonical recipe + the technical reason most subpaths cannot ship a dual ESM/CJS build.
1131
+
1132
+ For CLI users, provider defaults live in `~/.kodax/config.json`. For library users, API keys are still read from environment variables; if you need custom base URLs or provider aliases, use `registerCustomProviders()` as shown above.
1133
+
1134
+ ---
1135
+
1136
+ ## Usage
1137
+
1138
+ ### REPL Quickstart
1139
+
1140
+ Running `kodax` with no prompt starts the interactive REPL.
1141
+
1142
+ ```bash
1143
+ kodax
1144
+ ```
1145
+
1146
+ Inside the REPL you can type normal requests or slash commands:
1147
+
1148
+ ```text
1149
+ Read package.json and summarize the architecture
1150
+ /model
1151
+ /mode
1152
+ /help
1153
+ ```
1154
+
1155
+ ### CLI Quickstart
1156
+
1157
+ ```bash
1158
+ # Set API key
1159
+ export ZHIPU_API_KEY=your_api_key
1160
+
1161
+ # Basic usage
1162
+ kodax "Help me create a TypeScript project"
1163
+
1164
+ # Choose a provider explicitly
1165
+ kodax --provider openai --model gpt-5.4 "Create a REST API"
1166
+
1167
+ # Use higher reasoning effort
1168
+ kodax --effort high "Review this architecture"
1169
+ ```
1170
+
1171
+ ### Session Workflows
1172
+
1173
+ Use a session when you want memory across turns. Without a session, each CLI call is independent.
1174
+
1175
+ ```bash
1176
+ # No memory: two separate calls
1177
+ kodax "Read src/auth.ts"
1178
+ kodax "Summarize it"
1179
+
1180
+ # With memory: same session
1181
+ kodax --session my-project "Read package.json"
1182
+ kodax --session my-project "Summarize it"
1183
+ kodax --session my-project "How should I fix the first issue?"
1184
+
1185
+ # Session management
1186
+ kodax -r # Search, page, and select a non-empty session
1187
+ kodax -r <session-id> # Resume a known session directly
1188
+ kodax -r "Review runtime" # Resume a unique exact title; duplicates open the picker
1189
+ kodax --session list # List up to 50 non-empty sessions
1190
+ kodax --session cleanup-acp # Preview strictly matched empty ACP-test pollution
1191
+ ```
1192
+
1193
+ Bare `-r` opens an interactive picker with incremental search, arrow/PageUp/PageDown
1194
+ navigation, Tab completion, full selected-session ID display, and Enter-to-resume.
1195
+ An explicit value checks the complete session ID first, then an exact
1196
+ case-insensitive title; duplicate titles open a narrowed picker instead of
1197
+ silently choosing one. The picker loads before the full CLI, so session listing
1198
+ remains responsive. After selection it hands terminal input to the resumed
1199
+ REPL; Esc releases the picker's stdin ownership and immediately returns to the
1200
+ invoking shell. Session replay preserves each recorded message/event timestamp.
1201
+
1202
+ Cleanup is preview-only unless
1203
+ `--apply-session-cleanup` is also provided; matching sessions are archived rather
1204
+ than permanently deleted.
1205
+
1206
+ ### Session Patterns
1207
+
1208
+ ```bash
1209
+ # ❌ No memory: two independent calls
1210
+ kodax "Read src/auth.ts" # Agent reads and responds
1211
+ kodax "Summarize it" # Agent doesn't know what to summarize
1212
+
1213
+ # ✅ With memory: same session
1214
+ kodax --session auth-review "Read src/auth.ts"
1215
+ kodax --session auth-review "Summarize it" # Agent knows to summarize auth.ts
1216
+ kodax --session auth-review "How to fix first issue" # Agent has context
1217
+ ```
1218
+
1219
+ ### Workflow Examples
1220
+
1221
+ ```bash
1222
+ # Code review (multi-turn conversation)
1223
+ kodax --session review "Review src/ directory"
1224
+ kodax --session review "Focus on security issues"
1225
+ kodax --session review "Give me fix suggestions"
1226
+
1227
+ # Project development (continuous session)
1228
+ kodax --session todo-app "Create a Todo application"
1229
+ kodax --session todo-app "Add delete functionality"
1230
+ kodax --session todo-app "Write tests"
1231
+ ```
1232
+
1233
+ ### CLI Reference
1234
+
1235
+ ```text
1236
+ kodax Start the interactive REPL
1237
+ -h, --help [topic] Show help or topic help
1238
+ -p, --print <text> Run a single task and exit
1239
+ -c, --continue Continue the most recent non-empty conversation in this directory
1240
+ -r, --resume [value] Resume by ID/exact title, or open the searchable picker
1241
+ -m, --provider Provider to use
1242
+ --model <name> Override the model
1243
+ --reasoning <mode> off | auto | quick | balanced | deep
1244
+ -t, --thinking Compatibility alias for --reasoning auto
1245
+ -s, --session <op> Session ID or legacy session operation
1246
+ -j, --parallel Enable parallel tool execution
1247
+ --max-iter <n> Max iterations
1248
+ ```
1249
+
1250
+ ### Permission Control
1251
+
1252
+ KodaX provides 3 permission modes for fine-grained control:
1253
+
1254
+ | Mode | Description | Tools Need Confirmation |
1255
+ |------|-------------|------------------------|
1256
+ | `plan` | Read-only planning mode | All modification tools blocked |
1257
+ | `accept-edits` | Auto-accept file edits | bash only |
1258
+ | `auto` | Runtime-owned LLM/rules classification within the project boundary | Only explicit classifier escalation |
1259
+
1260
+ ```bash
1261
+ # In REPL, use /mode command
1262
+ /mode plan # Switch to plan mode (read-only)
1263
+ /mode accept-edits # Switch to accept-edits mode
1264
+ /mode auto # Switch to Runtime-owned Auto Mode
1265
+ /auto # Alias for auto
1266
+
1267
+ # Check current mode
1268
+ /mode
1269
+ ```
1270
+
1271
+ **Features:**
1272
+ - In `accept-edits` mode, choosing "always" can persist safe Bash allow-patterns
1273
+ - Plan mode includes system prompt context for LLM awareness
1274
+ - Sensitive/protected or unresolved targets enter Auto[LLM]/approval review;
1275
+ ordinary reads outside the project are allowed
1276
+ - Pattern-based permission: Allow specific Bash commands (e.g., `Bash(npm install)`)
1277
+ - Unified diff display for write/edit operations
1278
+ - Auto Mode first admits exactly modeled safe reads and workspace/temp
1279
+ mutations without classifier latency. Remaining actions are reviewed against
1280
+ bounded user intent and exact operation facts; a safe verdict creates no
1281
+ pending approval request. Classifier failures retry once, then use the
1282
+ Accept-edits safety boundary rather than silently switching to Auto[rules].
1283
+ - Shift-Tab cycles `Plan -> Edits -> Auto`; Shift+Enter inserts a newline. Auto
1284
+ immediately displays `Auto[LLM]` or `Auto[RULES]`, and rapid mode changes are
1285
+ persisted in input order. `Auto[RULES]` remains an explicit/manual engine;
1286
+ use `/auto-engine llm` to select LLM classification.
1287
+ - Runtime-backed prompts can offer exact `allow once`, `allow this session`,
1288
+ and `always allow` choices. Return the Runtime-issued opaque suggestion;
1289
+ never derive or widen a permission rule from the displayed command or path.
1290
+ Persistent grants are daemon-owned, revisioned, and can be listed/revoked
1291
+ through `runtime.permissions` by an authorized SDK host. Dynamic shell
1292
+ commands deliberately receive no persistent-grant suggestion.
1293
+
1294
+ `kodax -c` skips zero-message ACP/bootstrap placeholders even when they are
1295
+ newer than the last real conversation. The same newest non-empty rule applies
1296
+ to Ink, classic, one-shot CLI, and coding-runtime auto-resume; an explicit
1297
+ session ID always wins. Interactive resume also restores the saved workspace
1298
+ runtime before relative shell commands or the next model turn.
1299
+
1300
+ ### CLI Help Topics
1301
+
1302
+ Get detailed help for specific topics:
1303
+
1304
+ ```bash
1305
+ # Basic help
1306
+ kodax -h
1307
+ kodax --help
1308
+
1309
+ # Detailed topic help
1310
+ kodax -h sessions # Session management details
1311
+ kodax -h init # Long-running project initialization
1312
+ kodax -h project # Project mode / harness workflow
1313
+ kodax -h auto # Auto-continue mode
1314
+ kodax -h provider # LLM provider configuration
1315
+ kodax -h thinking # Thinking/reasoning effort and compatibility modes
1316
+ kodax -h team # Multi-agent parallel execution
1317
+ kodax -h print # Print configuration
1318
+ ```
1319
+
1320
+ ### Environment Variables
1321
+
1322
+ KodaX recognizes a number of environment variables for tuning runtime behavior. The most commonly used ones are listed below; for the full list, search the repo for `process.env.KODAX_`.
1323
+
1324
+ #### `KODAX_MAX_OUTPUT_TOKENS`
1325
+
1326
+ Overrides the per-turn `max_tokens` value sent to **every** provider (Anthropic, OpenAI, Zhipu, Kimi, MiniMax, Qwen, DeepSeek, MiMo, Gemini, Codex, …). Set to a positive integer; unset or non-numeric values are ignored. This is an **explicit user intent**: when set, it wins over the provider's model descriptor cap, over the provider config default, and over the global `KODAX_MAX_TOKENS` fallback. RST defense is handled at the provider config layer (`streamMaxDurationMs` watchdog + non-streaming fallback in `packages/llm/src/providers/registry.ts`), so this variable is purely an output-budget knob.
1327
+
1328
+ ```bash
1329
+ # Allow up to 48K output tokens per turn (use a higher cap when generating long files)
1330
+ export KODAX_MAX_OUTPUT_TOKENS=48000
1331
+ kodax "generate the full implementation"
1332
+
1333
+ # Unset to restore default behavior
1334
+ unset KODAX_MAX_OUTPUT_TOKENS
1335
+ ```
1336
+
1337
+ Precedence used by every provider's `getEffectiveMaxOutputTokens()` (see `packages/llm/src/providers/base.ts`):
1338
+
1339
+ 1. One-shot per-request override (agent-loop escalation / context-overflow recovery — internal)
1340
+ 2. **`KODAX_MAX_OUTPUT_TOKENS`** (this variable, explicit user intent)
1341
+ 3. Active model descriptor's `maxOutputTokens` (FEATURE_098 per-model cap)
1342
+ 4. Provider config default
1343
+ 5. Global `KODAX_MAX_TOKENS` fallback
1344
+
1345
+ Related variables: `KODAX_MAX_TOKENS` (global fallback when no provider/model cap applies), `KODAX_ESCALATED_MAX_OUTPUT_TOKENS` (escalation budget used by the agent loop when a turn returns `stop_reason: max_tokens`).
1346
+
1347
+ > **Retired in v0.7.42**: `KODAX_RST_PRONE_PROVIDERS` and `KODAX_WRITE_TURN_MAX_TOKENS` (the v0.7.28 P2b write-turn cap mechanism) are no longer recognized. The 2026-04 bench measured RST as time-based (zhipu-coding 308s server kill window), not payload-size-based, so the cap was retired in favor of the per-provider `streamMaxDurationMs` watchdog + non-streaming fallback chain (configured in `registry.ts`). Existing env exports become silent no-ops; remove them from shell profiles when convenient.
1348
+
1349
+ #### Sidecar verifier diagnostics
1350
+
1351
+ Use these when diagnosing Worker text-only completion stalls or custom provider verifier behavior:
1352
+
1353
+ ```bash
1354
+ export KODAX_VERIFIER_LOG=1
1355
+ export KODAX_VERIFIER_PROVIDER=anthropic
1356
+ export KODAX_VERIFIER_MODEL=claude-haiku-4-5-20251001
1357
+ ```
1358
+
1359
+ - `KODAX_VERIFIER_LOG=1` shows verifier gate/elapsed/trace information and is equivalent to `"verifierLog": true` in `~/.kodax/config.json`.
1360
+ - `KODAX_VERIFIER_PROVIDER` + `KODAX_VERIFIER_MODEL` route the verifier to a separate provider/model instead of inheriting the main Worker model. Set both together.
1361
+ - `KODAX_VERIFIER_ALWAYS=1` forces the verifier to fire on every text-only completion for debugging/regression sweeps.
1362
+
1363
+ SDK/headless hosts can observe actionable Sidecar Verifier messages via
1364
+ `KodaXEvents.onSidecarMessage`; JSONL output emits the same payload as
1365
+ `sidecar.message`. Only `revise` and `blocked` verdicts are surfaced; `accept`
1366
+ stays silent.
1367
+
1368
+ ## Advanced Library Usage
1369
+
1370
+ #### Simple Mode (runKodaX)
1371
+
1372
+ ```typescript
1373
+ import { runKodaX, KodaXEvents } from '@kodax-ai/kodax';
1374
+
1375
+ const events: KodaXEvents = {
1376
+ onTextDelta: (text) => process.stdout.write(text),
1377
+ onThinkingDelta: (text) => console.log(`Thinking delta: ${text.length} chars`),
1378
+ onToolResult: (result) => console.log(`Tool ${result.name}: ${result.content.slice(0, 100)}`),
1379
+ onSidecarMessage: (event) => console.log(`[sidecar:${event.verdict}] ${event.content}`),
1380
+ onComplete: () => console.log('\nDone!'),
1381
+ onError: (e) => console.error(e.message),
1382
+ };
1383
+
1384
+ const result = await runKodaX({
1385
+ provider: 'zhipu-coding',
1386
+ effort: 'auto',
1387
+ events,
1388
+ }, 'What is 1+1?');
1389
+
1390
+ console.log(result.lastText);
1391
+ ```
1392
+
1393
+ #### Continuous Session (KodaXClient)
1394
+
1395
+ ```typescript
1396
+ import { KodaXClient } from '@kodax-ai/kodax';
1397
+
1398
+ const client = new KodaXClient({
1399
+ provider: 'zhipu-coding',
1400
+ effort: 'auto',
1401
+ events: {
1402
+ onTextDelta: (t) => process.stdout.write(t),
1403
+ },
1404
+ });
1405
+
1406
+ // First message
1407
+ await client.send('Read package.json');
1408
+
1409
+ // Continue same session
1410
+ await client.send('Summarize it');
1411
+
1412
+ console.log(client.getSessionId());
1413
+ ```
1414
+
1415
+ #### Custom Session Storage
1416
+
1417
+ ```typescript
1418
+ import { runKodaX, KodaXSessionStorage, KodaXMessage } from '@kodax-ai/kodax';
1419
+
1420
+ class MyDatabaseStorage implements KodaXSessionStorage {
1421
+ async save(id: string, data: { messages: KodaXMessage[]; title: string; gitRoot: string }) {
1422
+ // Save to your database
1423
+ }
1424
+ async load(id: string) {
1425
+ // Load from your database
1426
+ return null;
1427
+ }
1428
+ }
1429
+
1430
+ await runKodaX({
1431
+ provider: 'zhipu-coding',
1432
+ session: {
1433
+ id: 'my-session-123',
1434
+ storage: new MyDatabaseStorage(),
1435
+ },
1436
+ events: { ... },
1437
+ }, 'task');
1438
+ ```
1439
+
1440
+ ### Library Modes Comparison
1441
+
1442
+ | Feature | runKodaX | KodaXClient |
1443
+ |---------|----------|-------------|
1444
+ | **Message Memory** | ❌ No | ✅ Yes |
1445
+ | **Call Style** | Function | Class instance |
1446
+ | **Context** | Independent each time | Accumulates |
1447
+ | **Use Case** | Single tasks, batch processing | Interactive dialogue, multi-step tasks |
1448
+
1449
+ ---
1450
+
1451
+ ## SDK Usage
1452
+
1453
+ KodaX ships as a single npm package `@kodax-ai/kodax` with 12 SDK subpath exports (ADR-024 v0.7.39 + ADR-032 v0.7.42 + ADR-038 v0.7.49 + v0.7.56 `/media` + v0.7.64 `/runtime` + v0.7.68 `/experimental-memory` + v0.7.69 `/a2a` + v0.7.78 `/sandbox`). Each subpath is tree-shake-friendly so consumers pull only what they need:
1454
+
1455
+ ```bash
1456
+ npm install @kodax-ai/kodax
1457
+ ```
1458
+
1459
+ ```typescript
1460
+ import { runKodaX } from '@kodax-ai/kodax'; // root: CLI helpers + runKodaX
1461
+ import { Runner, runFanOut } from '@kodax-ai/kodax/agent'; // generic Agent framework
1462
+ import { getProvider } from '@kodax-ai/kodax/llm'; // 16-alias LLM abstraction
1463
+ import { KODAX_TOOLS } from '@kodax-ai/kodax/coding'; // tools + prompts + agent loop
1464
+ import { createImageArtifactFromPath } from '@kodax-ai/kodax/media'; // input artifact helpers
1465
+ import { runInkInteractiveMode } from '@kodax-ai/kodax/repl'; // Ink TUI entrypoint
1466
+ import { SkillRegistry } from '@kodax-ai/kodax/skills'; // zero-dep skill loader
1467
+ import { createMcpManager } from '@kodax-ai/kodax/mcp'; // MCP popout manager (v0.7.42)
1468
+ import { listSessions } from '@kodax-ai/kodax/session'; // session history helpers
1469
+ import { createKodaXRuntime } from '@kodax-ai/kodax/runtime'; // embedded/daemon runtime API
1470
+ import { runKodaXSandboxed } from '@kodax-ai/kodax/sandbox'; // explicit standalone containment
1471
+ import { createKodaXA2AServer } from '@kodax-ai/kodax/a2a'; // A2A 1.0 client/server edge
1472
+ import { createMemoryAgent } from '@kodax-ai/kodax/experimental-memory'; // opt-in experimental memory SDK
1473
+ ```
1474
+
1475
+ > The SDK is **ESM-only**. CommonJS consumers (Electron main / Webpack CJS / `require()` callers) must use `await import('@kodax-ai/kodax/...')` — see [public_docs/sdk/embedder-guide.md §5](public_docs/sdk/embedder-guide.md#5-consuming-from-a-commonjs-context-electron-main-cjs-bundles).
1476
+
1477
+ ### `@kodax-ai/kodax/llm` — LLM Abstraction
1478
+
1479
+ 16 built-in provider aliases (Anthropic, OpenAI, DeepSeek, Kimi, Kimi-Code, Qwen, Qwen-Token-Plan, Zhipu, Zhipu-Coding, Zai-Coding, MiniMax-Coding, MiMo, MiMo-Coding, Ark-Coding, Gemini-CLI, Codex-CLI) + custom provider registration.
1480
+
1481
+ ```typescript
1482
+ import { getProvider, KodaXBaseProvider } from '@kodax-ai/kodax/llm';
1483
+
1484
+ const provider = getProvider('anthropic');
1485
+ const stream = await provider.streamCompletion(
1486
+ [{ role: 'user', content: 'Hello!' }],
1487
+ { onTextDelta: (text) => process.stdout.write(text) }
1488
+ );
1489
+
1490
+ for await (const result of stream) {
1491
+ if (result.type === 'text') { /* … */ }
1492
+ else if (result.type === 'tool_use') { /* … */ }
1493
+ }
1494
+ ```
1495
+
1496
+ **Key Features**: unified provider interface · streaming · reasoning effort (`off/auto/low/medium/high` plus model-supported extras) · per-provider retry + error handling · zero business-logic dependencies.
1497
+
1498
+ ### `@kodax-ai/kodax/agent` — Agent Framework (standalone-consumable)
1499
+
1500
+ ADR-021 standalone-consumable: `@kodax-ai/agent` has **zero inbound `@kodax-ai/coding` dependency** — you can wire any tool surface on top of it.
1501
+
1502
+ ```typescript
1503
+ import {
1504
+ Runner,
1505
+ runFanOut,
1506
+ runWithIdleYield,
1507
+ createAgentActorController,
1508
+ generateSessionId,
1509
+ estimateTokens,
1510
+ DefaultSummaryCompaction,
1511
+ } from '@kodax-ai/kodax/agent';
1512
+
1513
+ // Bounded-concurrency fan-out with abort + structured progress events (v0.7.39 FEATURE_120)
1514
+ const result = await runFanOut({
1515
+ bundles: [{ id: 'a', task: 'audit-foo' }, { id: 'b', task: 'audit-bar' }],
1516
+ maxParallel: 4,
1517
+ run: async (bundle) => doWork(bundle),
1518
+ });
1519
+
1520
+ // Runtime-owned Actor identity tree (inject an executor before starting Turns)
1521
+ const actors = await createAgentActorController();
1522
+ const tree = actors.list('/root');
1523
+
1524
+ // Pluggable compaction policy (FEATURE_081)
1525
+ const policy = new DefaultSummaryCompaction({ thresholdRatio: 0.8, keepRecent: 10 });
1526
+ ```
1527
+
1528
+ `DefaultSummaryCompaction` is a standalone agent-layer primitive for custom
1529
+ loops. It does not replace or disable KodaX's always-on coding-runtime policy
1530
+ described under FEATURE_272 above.
1531
+
1506
1532
  **Key Features**: `Runner` + per-step lifecycle · `runFanOut` (bounded-concurrency + abort + progress events) · `runWithIdleYield` (chat-while-waiting) · `AgentActorController` / `AgentTurnScheduler` · session-id generation · provider-neutral O(n) token estimation · `CompactionPolicy` interface.
1507
-
1508
- ### `@kodax-ai/kodax/skills` — Skills System
1509
-
1510
- Zero external dependencies. Markdown-based skill files with natural-language triggers and variable resolution.
1511
-
1512
- ```typescript
1513
- import {
1514
- SkillRegistry,
1515
- discoverSkills,
1516
- executeSkill,
1517
- type SkillContext,
1518
- } from '@kodax-ai/kodax/skills';
1519
-
1520
- const skills = await discoverSkills(['/path/to/skills']);
1521
- const registry = new SkillRegistry();
1522
- await registry.registerSkills(skills);
1523
-
1524
- const result = await executeSkill({
1525
- skillId: 'code-review',
1526
- arguments: { target: 'src/' },
1527
- workingDirectory: process.cwd(),
1528
- });
1529
- ```
1530
-
1531
- **Key Features**: zero deps · markdown-based skill files · natural-language triggering · variable resolution · built-in skills included.
1532
-
1533
- ### `@kodax-ai/kodax/coding` — Coding Agent
1534
-
1535
- Complete coding agent: 50+ tools (`read`/`write`/`edit`/`bash`/`grep`/`glob` plus `spawn_agent`/`send_message`/`followup_task`/`wait_agent`/`interrupt_agent`/`list_agents`/`agent_output`) + Worker role prompt + Sidecar Verifier (out-of-band Stop-hook) + agent loop + auto-continue + session management.
1536
-
1537
- ```typescript
1538
- import { runKodaX, KodaXClient, KODAX_TOOLS } from '@kodax-ai/kodax/coding';
1539
-
1540
- // Single-task helper
1541
- const result = await runKodaX({
1542
- provider: 'zhipu-coding',
1543
- effort: 'auto',
1544
- events: { onTextDelta: (text) => process.stdout.write(text) },
1545
- }, 'Read package.json and explain the dependencies');
1546
-
1547
- // Continuous session
1548
- const client = new KodaXClient({
1549
- provider: 'anthropic',
1550
- effort: 'auto',
1551
- events: { /* … */ },
1552
- });
1553
- await client.send('Create a new file');
1554
- await client.send('Add a function to it'); // Has context from previous message
1555
- ```
1556
-
1557
- **Key Features**: 50+ built-in tools (see [Tools](#tools)) · V2 Worker single-loop + Sidecar Verifier (FEATURE_184 v0.7.42 / V1 chain fully retired by FEATURE_193 v0.7.43) · Runtime-owned Actor collaboration and safe-boundary steering (FEATURE_270, v0.7.72) · idle-yield waiting · specialist routing via `spawn_agent(agent_id=...)` · auto-continue · session lineage.
1558
-
1559
- ### `@kodax-ai/kodax/repl` — Interactive Terminal UI
1560
-
1561
- Ink/React-based interactive REPL. Permission modes, command system, themed streaming display.
1562
-
1563
- ```typescript
1564
- import { runInkInteractiveMode } from '@kodax-ai/kodax/repl';
1565
-
1566
- // Usually used via the `kodax` bin command; can be embedded:
1567
- // - Interactive terminal UI (Ink components)
1568
- // - Permission control (auto/plan/accept-edits modes)
1569
- // - Command system (/help, /mode, /clear, /status, …)
1570
- // - Skills integration
1571
- // - Theme support
1572
- await runInkInteractiveMode({ provider: 'zhipu-coding', effort: 'auto' });
1573
- ```
1574
-
1575
- **Key Features**: Ink-based React components · 3 permission modes (auto / plan / accept-edits) · built-in commands · real-time streaming display · context-usage indicator.
1576
-
1577
- ### Package Dependency Graph (workspace internal)
1578
-
1579
- ```
1580
- @kodax-ai/llm (zero business-logic deps)
1581
-
1582
- @kodax-ai/agent (depends @kodax-ai/llm; ADR-021 standalone-consumable;
1583
- inlines session-lineage + capabilities/{mcp,skills} +
1584
- tracing per ADR-036 v0.7.43)
1585
-
1586
- @kodax-ai/coding (depends llm + agent; inlines repo-intelligence/protocol per ADR-036)
1587
-
1588
- @kodax-ai/repl (depends coding + ink + react)
1589
- ```
1590
-
1591
- **Subpath Recommendations**:
1592
-
1593
- | Use Case | Subpath | Why |
1594
- |----------|---------|-----|
1595
- | Only need LLM abstraction | `@kodax-ai/kodax/llm` | Minimal deps; 16 built-in aliases |
1596
- | Building custom agent | `@kodax-ai/kodax/agent` | Runner + fan-out + idle-yield + session-lineage + capabilities |
1597
- | Coding tasks | `@kodax-ai/kodax/coding` | Complete coding agent + tools |
1598
- | Terminal app | `@kodax-ai/kodax/repl` | Full interactive experience |
1599
- | Runtime host / daemon client | `@kodax-ai/kodax/runtime` | Sessions, runs, events, permissions, catalog, MCP, artifacts, diagnostics |
1533
+
1534
+ ### `@kodax-ai/kodax/skills` — Skills System
1535
+
1536
+ Zero external dependencies. Markdown-based skill files with natural-language triggers and variable resolution.
1537
+
1538
+ ```typescript
1539
+ import {
1540
+ SkillRegistry,
1541
+ discoverSkills,
1542
+ executeSkill,
1543
+ type SkillContext,
1544
+ } from '@kodax-ai/kodax/skills';
1545
+
1546
+ const skills = await discoverSkills(['/path/to/skills']);
1547
+ const registry = new SkillRegistry();
1548
+ await registry.registerSkills(skills);
1549
+
1550
+ const result = await executeSkill({
1551
+ skillId: 'code-review',
1552
+ arguments: { target: 'src/' },
1553
+ workingDirectory: process.cwd(),
1554
+ });
1555
+ ```
1556
+
1557
+ **Key Features**: zero deps · markdown-based skill files · natural-language triggering · variable resolution · built-in skills included.
1558
+
1559
+ ### `@kodax-ai/kodax/coding` — Coding Agent
1560
+
1561
+ Complete coding agent: 50+ tools (`read`/`write`/`edit`/`bash`/`grep`/`glob` plus `spawn_agent`/`send_message`/`followup_task`/`wait_agent`/`interrupt_agent`/`list_agents`/`agent_output`) + Worker role prompt + Sidecar Verifier (out-of-band Stop-hook) + agent loop + auto-continue + session management.
1562
+
1563
+ ```typescript
1564
+ import { runKodaX, KodaXClient, KODAX_TOOLS } from '@kodax-ai/kodax/coding';
1565
+
1566
+ // Single-task helper
1567
+ const result = await runKodaX({
1568
+ provider: 'zhipu-coding',
1569
+ effort: 'auto',
1570
+ events: { onTextDelta: (text) => process.stdout.write(text) },
1571
+ }, 'Read package.json and explain the dependencies');
1572
+
1573
+ // Continuous session
1574
+ const client = new KodaXClient({
1575
+ provider: 'anthropic',
1576
+ effort: 'auto',
1577
+ events: { /* … */ },
1578
+ });
1579
+ await client.send('Create a new file');
1580
+ await client.send('Add a function to it'); // Has context from previous message
1581
+ ```
1582
+
1583
+ **Key Features**: 50+ built-in tools (see [Tools](#tools)) · V2 Worker single-loop + Sidecar Verifier (FEATURE_184 v0.7.42 / V1 chain fully retired by FEATURE_193 v0.7.43) · Runtime-owned Actor collaboration and safe-boundary steering (FEATURE_270, v0.7.72) · idle-yield waiting · specialist routing via `spawn_agent(agent_id=...)` · auto-continue · session lineage.
1584
+
1585
+ ### `@kodax-ai/kodax/repl` — Interactive Terminal UI
1586
+
1587
+ Ink/React-based interactive REPL. Permission modes, command system, themed streaming display.
1588
+
1589
+ ```typescript
1590
+ import { runInkInteractiveMode } from '@kodax-ai/kodax/repl';
1591
+
1592
+ // Usually used via the `kodax` bin command; can be embedded:
1593
+ // - Interactive terminal UI (Ink components)
1594
+ // - Permission control (auto/plan/accept-edits modes)
1595
+ // - Command system (/help, /mode, /clear, /status, …)
1596
+ // - Skills integration
1597
+ // - Theme support
1598
+ await runInkInteractiveMode({ provider: 'zhipu-coding', effort: 'auto' });
1599
+ ```
1600
+
1601
+ **Key Features**: Ink-based React components · 3 permission modes (auto / plan / accept-edits) · built-in commands · real-time streaming display · context-usage indicator.
1602
+
1603
+ ### Package Dependency Graph (workspace internal)
1604
+
1605
+ ```
1606
+ @kodax-ai/llm (zero business-logic deps)
1607
+
1608
+ @kodax-ai/agent (depends @kodax-ai/llm; ADR-021 standalone-consumable;
1609
+ inlines session-lineage + capabilities/{mcp,skills} +
1610
+ tracing per ADR-036 v0.7.43)
1611
+
1612
+ @kodax-ai/coding (depends llm + agent; inlines repo-intelligence/protocol per ADR-036)
1613
+
1614
+ @kodax-ai/repl (depends coding + ink + react)
1615
+ ```
1616
+
1617
+ **Subpath Recommendations**:
1618
+
1619
+ | Use Case | Subpath | Why |
1620
+ |----------|---------|-----|
1621
+ | Only need LLM abstraction | `@kodax-ai/kodax/llm` | Minimal deps; 16 built-in aliases |
1622
+ | Building custom agent | `@kodax-ai/kodax/agent` | Runner + fan-out + idle-yield + session-lineage + capabilities |
1623
+ | Coding tasks | `@kodax-ai/kodax/coding` | Complete coding agent + tools |
1624
+ | Terminal app | `@kodax-ai/kodax/repl` | Full interactive experience |
1625
+ | Runtime host / daemon client | `@kodax-ai/kodax/runtime` | Sessions, runs, events, permissions, catalog, MCP, artifacts, diagnostics |
1600
1626
  | Experimental governed memory | `@kodax-ai/kodax/experimental-memory` | Governed `MemoryAgent` list/remember/forget and scoped `MemorySession` recall/outcome contracts |
1601
-
1602
- ---
1603
-
1604
- | Provider | Environment Variable | Reasoning Support | Default Model |
1605
- |----------|----------------------|-------------------|---------------|
1606
- | anthropic | `ANTHROPIC_API_KEY` | Native | claude-sonnet-4-6 (`claude-opus-4-6` / `claude-haiku-4-5` via `/model`) |
1607
- | openai | `OPENAI_API_KEY` | Native | gpt-5.3-codex (`gpt-5.4` / `gpt-5.3-codex-spark` via `/model`) |
1608
- | kimi | `KIMI_API_KEY` | Native | kimi-k2.7-code (262,144-token context; `kimi-k3` 1M / `kimi-k2.7-code-highspeed` / `kimi-k2.6` / `kimi-k2.5` via `/model`) |
1609
- | kimi-code | `KIMI_CODE_API_KEY` | Native | k3-256k (Moderato+, 256K, direct upstream ID; `k3` 1M / `kimi-for-coding` K2.7 Code / `kimi-for-coding-highspeed` via `/model`) |
1610
- | qwen | `QWEN_API_KEY` | Native | qwen3.5-plus |
1611
- | qwen-token-plan | `QWEN_TOKEN_API_KEY` | Native | qwen3.8-max (Anthropic-compat; legacy `qwen3.8-max-preview` plus `qwen3.7-max` / `qwen3.7-plus` / `qwen3.6-flash` / `glm-5.2` / `deepseek-v4-pro` via `/model`; all 1M context; image input on both Qwen 3.8 IDs / 3.7 Plus / 3.6 Flash) |
1612
- | zhipu | `ZHIPU_API_KEY` | Native | glm-5 (`glm-5.2` 1M ctx / `glm-5.1` / `glm-5-turbo` via `/model`) |
1613
- | zhipu-coding | `ZHIPU_CODING_API_KEY` | Native | glm-5.2 (1M ctx; legacy `glm-5.1` and `glm-5-turbo` remain selectable via `/model`) |
1614
- | zai-coding | `ZAI_CODING_API_KEY` | Native | glm-5.2 (Zhipu Coding Plan overseas mirror via `api.z.ai`, Anthropic-compat — same model lineup as `zhipu-coding`, served from outside CN) |
1615
- | minimax-coding | `MINIMAX_CODING_API_KEY` | Native | MiniMax-M3 (Frontier Coding, native multimodal + 1M ctx; legacy `MiniMax-M2.7` / `MiniMax-M2.7-highspeed` remain selectable via `/model`) |
1616
- | mimo | `MIMO_API_KEY` | Native | mimo-v2.5-pro (Xiaomi MiMo pay-per-token, Anthropic-compat) |
1617
- | mimo-coding | `MIMO_CODING_API_KEY` | Native | mimo-v2.5-pro (Xiaomi Token Plan, Anthropic-compat) |
1618
- | ark-coding | `ARK_CODING_API_KEY` | Native | glm-5.2 (Volcengine Ark Coding Plan — GLM-5.2 (alias: `glm-latest`) · Kimi K2.7 Code / K2.6 · MiniMax M3 / M2.7 · DeepSeek V4 Pro / V4 Flash · Doubao Seed 2.0 Code / Pro / Lite · Doubao Seed Code) |
1619
- | deepseek | `DEEPSEEK_API_KEY` | Native | deepseek-v4-flash (`deepseek-v4-pro` via `/model`) |
1620
- | gemini-cli | Provider CLI authentication (no KodaX API-key variable) | Prompt-only / CLI bridge | (via gemini CLI) |
1621
- | codex-cli | Provider CLI authentication (no KodaX API-key variable) | Prompt-only / CLI bridge | (via codex CLI) |
1622
-
1623
- > **Custom providers**: any OpenAI- or Anthropic-compatible endpoint can be added via `customProviders[]` in `~/.kodax/config.json` (CLI) or `registerCustomProviders()` (library). See the [Quick Start](#2-configure-a-provider) for the configuration shape.
1624
-
1625
- ### Examples
1626
-
1627
- ```bash
1628
- # Use Zhipu Coding
1629
- kodax --provider zhipu-coding --thinking "Help me optimize this code"
1630
-
1631
- # Use OpenAI
1632
- export OPENAI_API_KEY=your_key
1633
- kodax --provider openai "Create a REST API"
1634
-
1635
- # Resume last session
1636
- kodax --session resume
1637
-
1638
- # List all sessions
1639
- kodax --session list
1640
-
1641
- # Parallel tool execution
1642
- kodax --parallel "Read package.json and tsconfig.json"
1643
-
1644
- # Adaptive multi-agent (AMA) mode — V2 Worker single-loop with Actor collaboration
1645
- kodax --agent-mode ama "Analyze code structure, check test coverage, find bugs"
1646
- ```
1647
-
1648
- ---
1649
-
1650
- ## Tools
1651
-
1652
- KodaX ships 50+ built-in tools, grouped below. They are registered as a single flat tool surface to the LLM; the categories here are just for navigation.
1653
-
1654
- ### File operations
1655
- | Tool | Description |
1656
- |------|-------------|
1657
- | `read` | Read file contents (supports offset/limit) |
1658
- | `write` | Write a new file or fully rewrite an existing one |
1659
- | `edit` | Exact string replacement (supports `replace_all`) |
1660
- | `multi_edit` | Atomic batch of independent edits to one file |
1661
- | `insert_after_anchor` | Insert content after a unique anchor without rewriting the file |
1662
- | `undo` | Revert the last file modification |
1663
-
1664
- ### Shell & search
1665
- | Tool | Description |
1666
- |------|-------------|
1667
- | `bash` | Execute a shell command (supports `run_in_background`; complete capture with recoverable capacity fallback) |
1668
- | `glob` | Find files by pattern |
1669
- | `grep` | Regex content search (context lines, multiline, file-type filter, pagination) |
1670
- | `code_search` | Lower-noise code search (extension-provider aware) |
1671
- | `semantic_lookup` | Symbol/module/process-aware search backed by repo intelligence |
1672
- | `web_search` | Discovery-oriented web search with trust + freshness signals |
1673
- | `web_fetch` | Fetch a specific URL with provenance hints |
1674
-
1675
- ### Repo Intelligence (working tools)
1676
- | Tool | Description |
1677
- |------|-------------|
1678
- | `repo_overview` | Summarize structure, key areas, entry hints, intelligence snapshot |
1679
- | `changed_scope` | Which files/areas/categories the current diff touches |
1680
- | `changed_diff` | Paged diff slice for a single file |
1681
- | `changed_diff_bundle` | Paged diff slices for multiple files in one call |
1682
- | `module_context` | Module capsule (deps, entries, symbols, tests, docs) |
1683
- | `symbol_context` | Definition + probable callers/callees + alternatives |
1684
- | `process_context` | Approximate static execution capsule for an entry |
1685
- | `impact_estimate` | Blast radius for a symbol/path/module |
1686
-
1687
- ### MCP capabilities (when MCP servers are configured)
1688
- | Tool | Description |
1689
- |------|-------------|
1690
- | `mcp_search` / `mcp_describe` / `mcp_call` | Discover and invoke MCP tools through the shared capability runtime |
1691
- | `mcp_read_resource` / `mcp_get_prompt` | Read MCP resources and prompts |
1692
-
1693
- ### Git worktree
1694
- | Tool | Description |
1695
- |------|-------------|
1696
- | `worktree_create` | Create a new worktree on an isolated branch for safe agent work |
1697
- | `worktree_remove` | Remove a worktree (with safety checks) |
1698
-
1699
- ### Agent control & UX
1700
- | Tool | Description |
1701
- |------|-------------|
1702
- | `spawn_agent` | Create a named child Actor and start its first Turn under inherited capabilities, session capacity, and root work budget. |
1703
- | `send_message` | Commit bounded information to an Actor mailbox without starting a new Turn. |
1704
- | `followup_task` | Join a running Actor at a safe boundary or atomically start a new Turn for an idle Actor. |
1705
- | `wait_agent` | Yield on scoped mailbox/user/interruption/timeout activity; returns a wake acknowledgement and never uses Actor progress as a model wake source. |
1706
- | `interrupt_agent` | Request interruption of an active Turn while preserving Actor identity. |
1707
- | `list_agents` | Inspect the caller-visible Actor subtree and Turn states. |
1708
- | `agent_output` | Read bounded durable output for an authorized Actor/Turn. |
1709
- | `ask_user_question` | Single/multi-select or free-text prompt back to the user |
1710
- | `exit_plan_mode` | Present a finalized plan only when the active REPL/host supplied an approval callback |
1711
- | `run_workflow` | Author and run a deterministic Workflow protocol in AMA only when Workflow intent is explicit; complexity alone never activates it. Child Agents share the Actor control plane. Async / idle-yield. (FEATURE_246; FEATURE_270 v0.7.72) |
1712
- | `emit_managed_protocol` | Internal managed-task protocol side-channel for role payloads (verdict). V2 Worker single-loop + Sidecar Verifier is the default since v0.7.42 (FEATURE_184); V1 chain retired in v0.7.43 (FEATURE_193). |
1713
-
1714
- ---
1715
-
1716
- ## Skills System
1717
-
1718
- KodaX includes a built-in Skills system that can be triggered by natural language:
1719
-
1720
- ```bash
1721
- # Natural language triggering (no explicit /skill needed)
1722
- kodax "帮我审查代码" # Triggers code-review skill
1723
- kodax "写测试用例" # Triggers tdd skill
1724
- kodax "提交代码" # Triggers git-workflow skill
1725
-
1726
- # Explicit skill command
1727
- kodax /skill:code-review
1728
- ```
1729
-
1730
- Built-in skills include:
1731
- - **code-review** - Code review and quality analysis
1732
- - **tdd** - Test-driven development workflow
1733
- - **git-workflow** - Git commit and workflow automation
1734
-
1735
- Skills are stored in `~/.kodax/skills/` and can be extended with custom skills.
1736
- F263 background learning is Memory-first: a single correction does not create
1737
- a Skill. Repeated independently verified evidence can create a low-risk,
1738
- immutable project-scoped testing revision for at most three exact-revision
1739
- uses. Promotion requires independently verified success. Use `/learn` to
1740
- inspect, disable, rollback, trust, or reject learned revisions. Protected or
1741
- formal Skills, user-global promotion, and Extension authoring remain explicit
1742
- user actions.
1743
-
1744
- ### Promote a learned Skill to the user catalog
1745
-
1746
- Automatic canary activation and user-catalog promotion are different:
1747
-
1748
- - independently verified canary success changes `testing` to
1749
- `active_learned` inside the project-scoped Learned Area;
1750
- - `/learn promote` is an explicit ownership transfer that copies one exact
1751
- reviewed `ready` or `active_learned` revision into the formal user Skill
1752
- catalog and changes its lifecycle to `promoted_user`.
1753
-
1754
- Inspect the revision first, then promote it by name, slug, or exact capability
1755
- ID:
1756
-
1757
- ```text
1758
- /learn show normalize-release-notes
1759
- /learn promote normalize-release-notes --scope user
1760
- ```
1761
-
1762
- `--scope user` is the only supported scope and may be omitted. Invalid scopes,
1763
- unknown options, duplicate scope options, and extra operands fail without
1764
- changing the catalog. Promotion writes to the configured KodaX user Skill
1765
- directory—normally `~/.kodax/skills/<slug>/SKILL.md`—and never overwrites
1766
- different formal Skill content.
1767
-
1768
- Use `/learn promote --help`, `/learn help promote`, or
1769
- `/help learn promote` for the dedicated command reference. In the Ink Learning
1770
- Center, open `/learn`, select an `active_learned` Skill, and choose
1771
- **Promote to user catalog**.
1772
-
1773
- ---
1774
-
1775
- ## Commands (CLI)
1776
-
1777
- Commands are `/xxx` shortcuts in CLI:
1778
-
1779
- ```bash
1780
- kodax /review src/auth.ts
1781
- kodax /test
1782
- ```
1783
-
1784
- Commands are stored in `~/.kodax/commands/`:
1785
- - `.md` files → Prompt commands (content used as prompt)
1786
- - `.ts/.js` files → Programmable commands
1787
-
1788
- ---
1789
-
1790
- ## API Exports
1791
-
1792
- ```typescript
1793
- // Main functions
1794
- export { runKodaX, KodaXClient };
1795
-
1796
- // Types
1797
- export type {
1798
- KodaXEvents, KodaXOptions, KodaXResult,
1799
- KodaXMessage, KodaXContentBlock,
1800
- KodaXSessionStorage, KodaXToolDefinition
1801
- };
1802
-
1803
- // Tools
1804
- export { KODAX_TOOLS, KODAX_TOOL_REQUIRED_PARAMS, executeTool };
1805
-
1806
- // Providers
1807
- export { getProvider, KODAX_PROVIDERS, KodaXBaseProvider };
1808
-
1809
- // Utilities
1810
- export {
1811
- estimateTokens,
1812
- getGitRoot, getGitContext, getEnvContext, getProjectSnapshot,
1813
- checkPromiseSignal
1814
- };
1815
- ```
1816
-
1817
- ---
1818
-
1819
- ## Development
1820
-
1821
- ```bash
1822
- # Development mode (using tsx)
1823
- npm run dev "your task"
1824
-
1825
- # Build
1826
- npm run build
1827
-
1828
- # Optional: only build workspace packages
1829
- npm run build:packages
1830
-
1831
- # Build standalone binary (current platform / all platforms)
1832
- npm run build:binary
1833
- npm run build:binary:all
1834
-
1835
- # Run tests
1836
- npm test
1837
-
1838
- # Eval-driven development tests (provider matrices, identity round-trip, etc.)
1839
- npm run test:eval
1840
-
1841
- # Clean
1842
- npm run clean
1843
- ```
1844
-
1845
- ### Repo Intelligence cache directories
1846
-
1847
- KodaX uses one repo-intelligence cache root with separate built-in engine profiles:
1848
-
1849
- - `.agent/repo-intelligence/`
1850
- - Full-engine repo-intelligence artifacts and existing task-engine snapshots.
1851
- - `.agent/repo-intelligence/light/`
1852
- - Light-mode heuristic index artifacts.
1853
-
1854
- They are intentionally separated so:
1855
-
1856
- - full and light profiles can be rebuilt independently.
1857
- - light-mode confidence/capability state cannot be mistaken for full-engine state.
1858
- - future cache migrations can delete one profile without corrupting the other.
1859
-
1860
- `.agent/repo-intelligence/` is local generated state and should not be committed.
1861
-
1862
- ---
1863
-
1864
- ## Code Style
1865
-
1866
- ### Comment Guidelines
1867
-
1868
- KodaX uses an **English-first** comment style with selective Chinese brief notes for complex logic.
1869
-
1870
- | Situation | Style | Example |
1871
- |-----------|-------|---------|
1872
- | Import/Export | English only | `// Import dependencies` |
1873
- | Simple constants | English only | `// Max retry count` |
1874
- | Simple logic | English only | `// Return if null` |
1875
- | **Business rules** | English + Chinese | `// Skip tool_result - 跳过工具结果块` |
1876
- | **Platform compatibility** | English + Chinese | `// Windows path handling - Windows 路径处理` |
1877
- | **Performance optimization** | English + Chinese | `// Debounce to prevent flicker - 防抖避免闪烁` |
1878
-
1879
- ---
1880
-
1881
- ## Documentation
1882
-
1883
- - [README_CN.md](README_CN.md) - Chinese Documentation
1884
- - [public_docs/sdk/embedder-guide.md](public_docs/sdk/embedder-guide.md) - SDK hosting, shared Runtime daemon, Auto Mode, v0.7.74 compaction/history recovery, Agent telemetry, and active-run input contracts
1885
- - [docs/release.md](docs/release.md) - Standalone binary build & release pipeline
1886
- - [docs/PRD.md](docs/PRD.md) - Product Requirements
1887
- - [docs/ADR.md](docs/ADR.md) - Architecture Decisions
1888
- - [docs/HLD.md](docs/HLD.md) - High-Level Design
1889
- - [docs/DD.md](docs/DD.md) - Detailed Design
1890
- - [docs/FEATURE_LIST.md](docs/FEATURE_LIST.md) - Feature Tracking
1891
- - [docs/test-guides/](docs/test-guides/) - Feature-specific test guides
1892
- - [CHANGELOG.md](CHANGELOG.md) - Version History (v0.7.0+; [archive](docs/CHANGELOG_ARCHIVE.md) for older)
1893
-
1894
- ---
1895
-
1896
- ## License
1897
-
1898
- [KodaX-AI Fair Core License (KAI-FCL) 1.0](LICENSE) - Copyright 2026 [icetomoyo](mailto:icetomoyo@gmail.com).
1899
-
1900
- KAI-FCL is source-available / fair-core, not OSI open source. Commercial,
1901
- enterprise, managed deployment, paid service, or customer redistribution use
1902
- requires KodaX-AI authorization and a valid entitlement where required.
1903
-
1904
- Official KodaX 0.7.70 and later distributions use KAI-FCL or accompanying
1905
- KodaX-AI customer terms. Historical tags, archives, binaries, npm packages, or
1906
- other copies already distributed with Apache-2.0 notices remain Apache-2.0 for
1907
- those specific copies.
1627
+
1628
+ ---
1629
+
1630
+ | Provider | Environment Variable | Reasoning Support | Default Model |
1631
+ |----------|----------------------|-------------------|---------------|
1632
+ | anthropic | `ANTHROPIC_API_KEY` | Native | claude-sonnet-4-6 (`claude-opus-4-6` / `claude-haiku-4-5` via `/model`) |
1633
+ | openai | `OPENAI_API_KEY` | Native | gpt-5.3-codex (`gpt-5.4` / `gpt-5.3-codex-spark` via `/model`) |
1634
+ | kimi | `KIMI_API_KEY` | Native | kimi-k2.7-code (262,144-token context; `kimi-k3` 1M / `kimi-k2.7-code-highspeed` / `kimi-k2.6` / `kimi-k2.5` via `/model`) |
1635
+ | kimi-code | `KIMI_CODE_API_KEY` | Native | k3-256k (Moderato+, 256K, direct upstream ID; `k3` 1M / `kimi-for-coding` K2.7 Code / `kimi-for-coding-highspeed` via `/model`) |
1636
+ | qwen | `QWEN_API_KEY` | Native | qwen3.5-plus |
1637
+ | qwen-token-plan | `QWEN_TOKEN_API_KEY` | Native | qwen3.8-max (Anthropic-compat; legacy `qwen3.8-max-preview` plus `qwen3.7-max` / `qwen3.7-plus` / `qwen3.6-flash` / `glm-5.2` / `deepseek-v4-pro` via `/model`; all 1M context; image input on both Qwen 3.8 IDs / 3.7 Plus / 3.6 Flash) |
1638
+ | zhipu | `ZHIPU_API_KEY` | Native | glm-5 (`glm-5.2` 1M ctx / `glm-5.1` / `glm-5-turbo` via `/model`) |
1639
+ | zhipu-coding | `ZHIPU_CODING_API_KEY` | Native | glm-5.2 (1M ctx; legacy `glm-5.1` and `glm-5-turbo` remain selectable via `/model`) |
1640
+ | zai-coding | `ZAI_CODING_API_KEY` | Native | glm-5.2 (Zhipu Coding Plan overseas mirror via `api.z.ai`, Anthropic-compat — same model lineup as `zhipu-coding`, served from outside CN) |
1641
+ | minimax-coding | `MINIMAX_CODING_API_KEY` | Native | MiniMax-M3 (Frontier Coding, native multimodal + 1M ctx; legacy `MiniMax-M2.7` / `MiniMax-M2.7-highspeed` remain selectable via `/model`) |
1642
+ | mimo | `MIMO_API_KEY` | Native | mimo-v2.5-pro (Xiaomi MiMo pay-per-token, Anthropic-compat) |
1643
+ | mimo-coding | `MIMO_CODING_API_KEY` | Native | mimo-v2.5-pro (Xiaomi Token Plan, Anthropic-compat) |
1644
+ | ark-coding | `ARK_CODING_API_KEY` | Native | glm-5.2 (Volcengine Ark Coding Plan — GLM-5.2 (alias: `glm-latest`) · Kimi K2.7 Code / K2.6 · MiniMax M3 / M2.7 · DeepSeek V4 Pro / V4 Flash · Doubao Seed 2.0 Code / Pro / Lite · Doubao Seed Code) |
1645
+ | deepseek | `DEEPSEEK_API_KEY` | Native | deepseek-v4-flash (`deepseek-v4-pro` via `/model`) |
1646
+ | gemini-cli | Provider CLI authentication (no KodaX API-key variable) | Prompt-only / CLI bridge | (via gemini CLI) |
1647
+ | codex-cli | Provider CLI authentication (no KodaX API-key variable) | Prompt-only / CLI bridge | (via codex CLI) |
1648
+
1649
+ > **Custom providers**: any OpenAI- or Anthropic-compatible endpoint can be added via `customProviders[]` in `~/.kodax/config.json` (CLI) or `registerCustomProviders()` (library). See the [Quick Start](#2-configure-a-provider) for the configuration shape.
1650
+
1651
+ ### Examples
1652
+
1653
+ ```bash
1654
+ # Use Zhipu Coding
1655
+ kodax --provider zhipu-coding --thinking "Help me optimize this code"
1656
+
1657
+ # Use OpenAI
1658
+ export OPENAI_API_KEY=your_key
1659
+ kodax --provider openai "Create a REST API"
1660
+
1661
+ # Resume last session
1662
+ kodax --session resume
1663
+
1664
+ # List all sessions
1665
+ kodax --session list
1666
+
1667
+ # Parallel tool execution
1668
+ kodax --parallel "Read package.json and tsconfig.json"
1669
+
1670
+ # Adaptive multi-agent (AMA) mode — V2 Worker single-loop with Actor collaboration
1671
+ kodax --agent-mode ama "Analyze code structure, check test coverage, find bugs"
1672
+ ```
1673
+
1674
+ ---
1675
+
1676
+ ## Tools
1677
+
1678
+ KodaX ships 50+ built-in tools, grouped below. They are registered as a single flat tool surface to the LLM; the categories here are just for navigation.
1679
+
1680
+ ### File operations
1681
+ | Tool | Description |
1682
+ |------|-------------|
1683
+ | `read` | Read file contents (supports offset/limit) |
1684
+ | `write` | Write a new file or fully rewrite an existing one |
1685
+ | `edit` | Exact string replacement (supports `replace_all`) |
1686
+ | `multi_edit` | Atomic batch of independent edits to one file |
1687
+ | `insert_after_anchor` | Insert content after a unique anchor without rewriting the file |
1688
+ | `undo` | Revert the last file modification |
1689
+
1690
+ ### Shell & search
1691
+ | Tool | Description |
1692
+ |------|-------------|
1693
+ | `bash` | Execute a shell command (supports `run_in_background`; complete capture with recoverable capacity fallback) |
1694
+ | `glob` | Find files by pattern |
1695
+ | `grep` | Regex content search (context lines, multiline, file-type filter, pagination) |
1696
+ | `code_search` | Lower-noise code search (extension-provider aware) |
1697
+ | `semantic_lookup` | Symbol/module/process-aware search backed by repo intelligence |
1698
+ | `web_search` | Discovery-oriented web search with trust + freshness signals |
1699
+ | `web_fetch` | Fetch a specific URL with provenance hints |
1700
+
1701
+ ### Repo Intelligence (working tools)
1702
+ | Tool | Description |
1703
+ |------|-------------|
1704
+ | `repo_overview` | Summarize structure, key areas, entry hints, intelligence snapshot |
1705
+ | `changed_scope` | Which files/areas/categories the current diff touches |
1706
+ | `changed_diff` | Paged diff slice for a single file |
1707
+ | `changed_diff_bundle` | Paged diff slices for multiple files in one call |
1708
+ | `module_context` | Module capsule (deps, entries, symbols, tests, docs) |
1709
+ | `symbol_context` | Definition + probable callers/callees + alternatives |
1710
+ | `process_context` | Approximate static execution capsule for an entry |
1711
+ | `impact_estimate` | Blast radius for a symbol/path/module |
1712
+
1713
+ ### MCP capabilities (when MCP servers are configured)
1714
+ | Tool | Description |
1715
+ |------|-------------|
1716
+ | `mcp_search` / `mcp_describe` / `mcp_call` | Discover and invoke MCP tools through the shared capability runtime |
1717
+ | `mcp_read_resource` / `mcp_get_prompt` | Read MCP resources and prompts |
1718
+
1719
+ ### Git worktree
1720
+ | Tool | Description |
1721
+ |------|-------------|
1722
+ | `worktree_create` | Create a new worktree on an isolated branch for safe agent work |
1723
+ | `worktree_remove` | Remove a worktree (with safety checks) |
1724
+
1725
+ ### Agent control & UX
1726
+ | Tool | Description |
1727
+ |------|-------------|
1728
+ | `spawn_agent` | Create a named child Actor and start its first Turn under inherited capabilities, session capacity, and root work budget. |
1729
+ | `send_message` | Commit bounded information to an Actor mailbox without starting a new Turn. |
1730
+ | `followup_task` | Join a running Actor at a safe boundary or atomically start a new Turn for an idle Actor. |
1731
+ | `wait_agent` | Yield on scoped mailbox/user/interruption/timeout activity; returns a wake acknowledgement and never uses Actor progress as a model wake source. |
1732
+ | `interrupt_agent` | Request interruption of an active Turn while preserving Actor identity. |
1733
+ | `list_agents` | Inspect the caller-visible Actor subtree and Turn states. |
1734
+ | `agent_output` | Read bounded durable output for an authorized Actor/Turn. |
1735
+ | `ask_user_question` | Single/multi-select or free-text prompt back to the user |
1736
+ | `exit_plan_mode` | Present a finalized plan only when the active REPL/host supplied an approval callback |
1737
+ | `run_workflow` | Author and run a deterministic Workflow protocol in AMA only when Workflow intent is explicit; complexity alone never activates it. Child Agents share the Actor control plane. Async / idle-yield. (FEATURE_246; FEATURE_270 v0.7.72) |
1738
+ | `emit_managed_protocol` | Internal managed-task protocol side-channel for role payloads (verdict). V2 Worker single-loop + Sidecar Verifier is the default since v0.7.42 (FEATURE_184); V1 chain retired in v0.7.43 (FEATURE_193). |
1739
+
1740
+ ---
1741
+
1742
+ ## Skills System
1743
+
1744
+ KodaX includes a built-in Skills system that can be triggered by natural language:
1745
+
1746
+ ```bash
1747
+ # Natural language triggering (no explicit /skill needed)
1748
+ kodax "帮我审查代码" # Triggers code-review skill
1749
+ kodax "写测试用例" # Triggers tdd skill
1750
+ kodax "提交代码" # Triggers git-workflow skill
1751
+
1752
+ # Explicit skill command
1753
+ kodax /skill:code-review
1754
+ ```
1755
+
1756
+ Built-in skills include:
1757
+ - **code-review** - Code review and quality analysis
1758
+ - **tdd** - Test-driven development workflow
1759
+ - **git-workflow** - Git commit and workflow automation
1760
+
1761
+ Skills are stored in `~/.kodax/skills/` and can be extended with custom skills.
1762
+ F263 background learning is Memory-first: a single correction does not create
1763
+ a Skill. Repeated independently verified evidence can create a low-risk,
1764
+ immutable project-scoped testing revision for at most three exact-revision
1765
+ uses. Promotion requires independently verified success. Use `/learn` to
1766
+ inspect, disable, rollback, trust, or reject learned revisions. Protected or
1767
+ formal Skills, user-global promotion, and Extension authoring remain explicit
1768
+ user actions.
1769
+
1770
+ ### Promote a learned Skill to the user catalog
1771
+
1772
+ Automatic canary activation and user-catalog promotion are different:
1773
+
1774
+ - independently verified canary success changes `testing` to
1775
+ `active_learned` inside the project-scoped Learned Area;
1776
+ - `/learn promote` is an explicit ownership transfer that copies one exact
1777
+ reviewed `ready` or `active_learned` revision into the formal user Skill
1778
+ catalog and changes its lifecycle to `promoted_user`.
1779
+
1780
+ Inspect the revision first, then promote it by name, slug, or exact capability
1781
+ ID:
1782
+
1783
+ ```text
1784
+ /learn show normalize-release-notes
1785
+ /learn promote normalize-release-notes --scope user
1786
+ ```
1787
+
1788
+ `--scope user` is the only supported scope and may be omitted. Invalid scopes,
1789
+ unknown options, duplicate scope options, and extra operands fail without
1790
+ changing the catalog. Promotion writes to the configured KodaX user Skill
1791
+ directory—normally `~/.kodax/skills/<slug>/SKILL.md`—and never overwrites
1792
+ different formal Skill content.
1793
+
1794
+ Use `/learn promote --help`, `/learn help promote`, or
1795
+ `/help learn promote` for the dedicated command reference. In the Ink Learning
1796
+ Center, open `/learn`, select an `active_learned` Skill, and choose
1797
+ **Promote to user catalog**.
1798
+
1799
+ ---
1800
+
1801
+ ## Commands (CLI)
1802
+
1803
+ Commands are `/xxx` shortcuts in CLI:
1804
+
1805
+ ```bash
1806
+ kodax /review src/auth.ts
1807
+ kodax /test
1808
+ ```
1809
+
1810
+ Commands are stored in `~/.kodax/commands/`:
1811
+ - `.md` files → Prompt commands (content used as prompt)
1812
+ - `.ts/.js` files → Programmable commands
1813
+
1814
+ ---
1815
+
1816
+ ## API Exports
1817
+
1818
+ ```typescript
1819
+ // Main functions
1820
+ export { runKodaX, KodaXClient };
1821
+
1822
+ // Types
1823
+ export type {
1824
+ KodaXEvents, KodaXOptions, KodaXResult,
1825
+ KodaXMessage, KodaXContentBlock,
1826
+ KodaXSessionStorage, KodaXToolDefinition
1827
+ };
1828
+
1829
+ // Tools
1830
+ export { KODAX_TOOLS, KODAX_TOOL_REQUIRED_PARAMS, executeTool };
1831
+
1832
+ // Providers
1833
+ export { getProvider, KODAX_PROVIDERS, KodaXBaseProvider };
1834
+
1835
+ // Utilities
1836
+ export {
1837
+ estimateTokens,
1838
+ getGitRoot, getGitContext, getEnvContext, getProjectSnapshot,
1839
+ checkPromiseSignal
1840
+ };
1841
+ ```
1842
+
1843
+ ---
1844
+
1845
+ ## Development
1846
+
1847
+ ```bash
1848
+ # Development mode (using tsx)
1849
+ npm run dev "your task"
1850
+
1851
+ # Build
1852
+ npm run build
1853
+
1854
+ # Optional: only build workspace packages
1855
+ npm run build:packages
1856
+
1857
+ # Build standalone binary (current platform / all platforms)
1858
+ npm run build:binary
1859
+ npm run build:binary:all
1860
+
1861
+ # Run tests
1862
+ npm test
1863
+
1864
+ # Eval-driven development tests (provider matrices, identity round-trip, etc.)
1865
+ npm run test:eval
1866
+
1867
+ # Clean
1868
+ npm run clean
1869
+ ```
1870
+
1871
+ ### Repo Intelligence cache directories
1872
+
1873
+ KodaX uses one repo-intelligence cache root with separate built-in engine profiles:
1874
+
1875
+ - `.agent/repo-intelligence/`
1876
+ - Full-engine repo-intelligence artifacts and existing task-engine snapshots.
1877
+ - `.agent/repo-intelligence/light/`
1878
+ - Light-mode heuristic index artifacts.
1879
+
1880
+ They are intentionally separated so:
1881
+
1882
+ - full and light profiles can be rebuilt independently.
1883
+ - light-mode confidence/capability state cannot be mistaken for full-engine state.
1884
+ - future cache migrations can delete one profile without corrupting the other.
1885
+
1886
+ `.agent/repo-intelligence/` is local generated state and should not be committed.
1887
+
1888
+ ---
1889
+
1890
+ ## Code Style
1891
+
1892
+ ### Comment Guidelines
1893
+
1894
+ KodaX uses an **English-first** comment style with selective Chinese brief notes for complex logic.
1895
+
1896
+ | Situation | Style | Example |
1897
+ |-----------|-------|---------|
1898
+ | Import/Export | English only | `// Import dependencies` |
1899
+ | Simple constants | English only | `// Max retry count` |
1900
+ | Simple logic | English only | `// Return if null` |
1901
+ | **Business rules** | English + Chinese | `// Skip tool_result - 跳过工具结果块` |
1902
+ | **Platform compatibility** | English + Chinese | `// Windows path handling - Windows 路径处理` |
1903
+ | **Performance optimization** | English + Chinese | `// Debounce to prevent flicker - 防抖避免闪烁` |
1904
+
1905
+ ---
1906
+
1907
+ ## Documentation
1908
+
1909
+ - [README_CN.md](README_CN.md) - Chinese Documentation
1910
+ - [public_docs/sdk/embedder-guide.md](public_docs/sdk/embedder-guide.md) - SDK hosting, shared Runtime daemon, Auto Mode, v0.7.74 compaction/history recovery, Agent telemetry, and active-run input contracts
1911
+ - [docs/release.md](docs/release.md) - Standalone binary build & release pipeline
1912
+ - [docs/PRD.md](docs/PRD.md) - Product Requirements
1913
+ - [docs/ADR.md](docs/ADR.md) - Architecture Decisions
1914
+ - [docs/HLD.md](docs/HLD.md) - High-Level Design
1915
+ - [docs/DD.md](docs/DD.md) - Detailed Design
1916
+ - [docs/FEATURE_LIST.md](docs/FEATURE_LIST.md) - Feature Tracking
1917
+ - [docs/test-guides/](docs/test-guides/) - Feature-specific test guides
1918
+ - [CHANGELOG.md](CHANGELOG.md) - Version History (v0.7.0+; [archive](docs/CHANGELOG_ARCHIVE.md) for older)
1919
+
1920
+ ---
1921
+
1922
+ ## License
1923
+
1924
+ [KodaX-AI Fair Core License (KAI-FCL) 1.0](LICENSE) - Copyright 2026 [icetomoyo](mailto:icetomoyo@gmail.com).
1925
+
1926
+ KAI-FCL is source-available / fair-core, not OSI open source. Commercial,
1927
+ enterprise, managed deployment, paid service, or customer redistribution use
1928
+ requires KodaX-AI authorization and a valid entitlement where required.
1929
+
1930
+ Official KodaX 0.7.70 and later distributions use KAI-FCL or accompanying
1931
+ KodaX-AI customer terms. Historical tags, archives, binaries, npm packages, or
1932
+ other copies already distributed with Apache-2.0 notices remain Apache-2.0 for
1933
+ those specific copies.