@kodax-ai/kodax 0.7.84 → 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 (93) hide show
  1. package/CHANGELOG.md +218 -5
  2. package/README.md +1888 -1850
  3. package/README_CN.md +1146 -1137
  4. package/dist/chunks/agent-IO6TXNCV.js +2 -0
  5. package/dist/chunks/argument-completer-JMICSGL6.js +2 -0
  6. package/dist/chunks/chunk-2RAXDUC7.js +379 -0
  7. package/dist/chunks/chunk-A5VQGXH2.js +2 -0
  8. package/dist/chunks/{chunk-OHZFGQEH.js → chunk-AAFFS6RU.js} +2 -2
  9. package/dist/chunks/chunk-B36G256E.js +679 -0
  10. package/dist/chunks/chunk-G5FGIRDJ.js +1278 -0
  11. package/dist/chunks/chunk-GVGLYVG4.js +5 -0
  12. package/dist/chunks/chunk-MFCPQZ7E.js +519 -0
  13. package/dist/chunks/chunk-Q6UAGROD.js +415 -0
  14. package/dist/chunks/chunk-R4EHASEN.js +319 -0
  15. package/dist/chunks/chunk-U6HNMLNN.js +410 -0
  16. package/dist/chunks/chunk-UH5WNJXF.js +92 -0
  17. package/dist/chunks/{chunk-WTYAZOWO.js → chunk-UKCDCVMD.js} +1 -1
  18. package/dist/chunks/chunk-XA4ENCAH.js +412 -0
  19. package/dist/chunks/{chunk-ZVPTDYDI.js → chunk-XUKLF26Q.js} +2 -2
  20. package/dist/chunks/compaction-config-5RMG22CY.js +2 -0
  21. package/dist/chunks/{construction-bootstrap-EVQ6VWSX.js → construction-bootstrap-4DGAYOWH.js} +1 -1
  22. package/dist/chunks/dist-DFW7MXT7.js +2 -0
  23. package/dist/chunks/host-6MMHYTI5.js +2 -0
  24. package/dist/chunks/run-manager-ISQSWCAM.js +2 -0
  25. package/dist/chunks/utils-LV7FHKYN.js +2 -0
  26. package/dist/index.d.ts +17 -15
  27. package/dist/index.js +2 -2
  28. package/dist/kodax_bootstrap.js +1 -1
  29. package/dist/kodax_cli.js +2074 -1615
  30. package/dist/kodax_resume.js +271 -90
  31. package/dist/runtime-worker.js +1812 -1359
  32. package/dist/sandbox-workspace-session.js +1069 -112
  33. package/dist/sdk-a2a.d.ts +11 -10
  34. package/dist/sdk-a2a.js +9 -8
  35. package/dist/sdk-agent.d.ts +39 -299
  36. package/dist/sdk-agent.js +1 -1
  37. package/dist/sdk-coding.d.ts +103 -16
  38. package/dist/sdk-coding.js +1 -1
  39. package/dist/sdk-experimental-memory.d.ts +7 -20
  40. package/dist/sdk-experimental-memory.js +1 -1
  41. package/dist/sdk-mcp.js +1 -1
  42. package/dist/sdk-media.js +1 -1
  43. package/dist/sdk-repl.d.ts +14 -15
  44. package/dist/sdk-repl.js +2 -2
  45. package/dist/sdk-runtime.d.ts +73 -24
  46. package/dist/sdk-runtime.js +1 -1
  47. package/dist/sdk-sandbox.d.ts +1 -1
  48. package/dist/sdk-sandbox.js +1 -1
  49. package/dist/sdk-session.d.ts +7 -6
  50. package/dist/sdk-session.js +1 -1
  51. package/dist/sdk-skills.d.ts +2 -2
  52. package/dist/sdk-skills.js +1 -1
  53. package/dist/semantic-worker.js +250 -64
  54. package/dist/types-chunks/{bash-prefix-extractor.d-CkdGL4rM.d.ts → bash-prefix-extractor.d-QqKtuLZm.d.ts} +137 -14
  55. package/dist/types-chunks/{capsule.d-7wQ_kM1C.d.ts → capsule.d-CN_iMqAS.d.ts} +2 -1
  56. package/dist/types-chunks/controller.d-A73Kf6tH.d.ts +105 -0
  57. package/dist/types-chunks/{controller.d-CesRxFL5.d.ts → controller.d-Dzxz22X-.d.ts} +26 -1020
  58. package/dist/types-chunks/{guardrail.d-KaIeVree.d.ts → guardrail.d-Y_AIh8-I.d.ts} +21 -21
  59. package/dist/types-chunks/{history-retrieval.d-CbCls7r0.d.ts → history-retrieval.d-Debbzn1z.d.ts} +1 -1
  60. package/dist/types-chunks/{public-api.d-DpRj8b7d.d.ts → public-api.d-Cg-4GTbK.d.ts} +3 -2
  61. package/dist/types-chunks/{repl.d-DWeC3PLW.d.ts → repl.d-Bhrbueab.d.ts} +5 -5
  62. package/dist/types-chunks/review-inbox.d-DuZqFX-z.d.ts +221 -0
  63. package/dist/types-chunks/{run-manager.d-BXBkLT0A.d.ts → run-manager.d-BS4lJfL3.d.ts} +1 -1
  64. package/dist/types-chunks/{sdk-session-DEtS6u20.d.ts → sdk-session-fQ_KENev.d.ts} +2 -2
  65. package/dist/types-chunks/{shell-command-sets.d-P2h4_KKL.d.ts → shell-command-sets.d-DRGjd_7Q.d.ts} +3 -2
  66. package/dist/types-chunks/{types-Bf3Y3mW-.d.ts → types-PHjfwebT.d.ts} +62 -190
  67. package/dist/types-chunks/{types.d-0m3PS7Ng.d.ts → types.d-BRrJU4pb.d.ts} +2 -2
  68. package/dist/types-chunks/{types.d-BbtGlKZu.d.ts → types.d-BSPlmJqf.d.ts} +25 -6
  69. package/dist/types-chunks/{types.d-CUtMr2IG.d.ts → types.d-Bo4fyMLu.d.ts} +1 -1
  70. package/dist/types-chunks/types.d-DlLBRqZ9.d.ts +1057 -0
  71. package/dist/types-chunks/{utils.d-C-eSIZ9n.d.ts → utils.d-BIhh_BqE.d.ts} +7 -4
  72. package/package.json +4 -2
  73. package/dist/chunks/agent-VMXNVYRK.js +0 -2
  74. package/dist/chunks/argument-completer-QCS6GUAE.js +0 -2
  75. package/dist/chunks/chunk-4ZI2CPUQ.js +0 -885
  76. package/dist/chunks/chunk-6UENDY33.js +0 -89
  77. package/dist/chunks/chunk-726WJGGY.js +0 -2
  78. package/dist/chunks/chunk-A7L7XTUH.js +0 -292
  79. package/dist/chunks/chunk-BBBS644N.js +0 -319
  80. package/dist/chunks/chunk-E7C4DRD2.js +0 -5
  81. package/dist/chunks/chunk-ET2BMEQQ.js +0 -655
  82. package/dist/chunks/chunk-EVXIJPZ6.js +0 -218
  83. package/dist/chunks/chunk-F44YYR6Z.js +0 -479
  84. package/dist/chunks/chunk-GRLC3N46.js +0 -385
  85. package/dist/chunks/chunk-KHEFUT6O.js +0 -5
  86. package/dist/chunks/chunk-TDJS5SFS.js +0 -348
  87. package/dist/chunks/chunk-WXHHZZRJ.js +0 -379
  88. package/dist/chunks/compaction-config-QTMFP7AF.js +0 -2
  89. package/dist/chunks/dist-XRH6CRLL.js +0 -2
  90. package/dist/chunks/host-F4TPD6WY.js +0 -2
  91. package/dist/chunks/run-manager-PYD46OGY.js +0 -2
  92. package/dist/chunks/utils-TOTTXU2I.js +0 -2
  93. package/docs/SDK_EMBEDDER_GUIDE.md +0 -5752
package/README.md CHANGED
@@ -1,604 +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](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 [docs/SDK_EMBEDDER_GUIDE.md](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](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
- dynamic Skill commands require an explicit host-controlled executor, root AMA
554
- uses the governed `memory_intent` lifecycle (including explicit intent captured
555
- before a later cancellation), Workflow Actor waits remain
556
- unbounded unless the workflow sets a deadline, and Runtime Auto capability v4
557
- advertises `fallbackPersistsEngine:false` across embedded, Worker, and daemon
558
- hosts. Actor ownership additionally uses Runtime identity rather than PID alone,
559
- so PID reuse cannot pin a crashed owner. The resume Session picker also renders
560
- timestamps in the host's local timezone.
561
-
562
- **v0.7.79 release:** Configured outbound A2A Agents can persist two
563
- independent, default-deny network permissions: private-address access and
564
- non-loopback plaintext HTTP. The embedded Worker and shared daemon reconcile
565
- and execute the same authorized configuration. Runtime embedders also gain one
566
- authoritative Session status, bounded read-only diagnostics, byte-preserving
567
- Session export, strict transcript observation, a provenance-checked ordinary
568
- conversation projection, and bounded streaming-event coalescing with
569
- capability-gated idle daemon upgrade. Standalone child-process, Session lineage,
570
- shell cleanup, packaged sidecar, and parallel admission paths receive the
571
- corresponding release hardening.
572
-
573
- OpenAI-compatible custom providers can now choose `max_tokens` or
574
- `max_completion_tokens` per provider or model. DeepSeek V4 Flash and Pro use
575
- separate reasoning profiles and are advertised as text-only. See the
576
- [v0.7.79 design](docs/features/v0.7.79.md) and
577
- [release checklist](docs/release.md#v0779-release-preparation).
578
- FEATURE_280 was explicitly rescheduled to v0.7.81 (then to v0.7.86 on
579
- 2026-08-04) and is not represented as shipped by this release.
580
- Issue 256 was explicitly rescheduled to v0.7.84 and is likewise not represented
581
- as shipped by this release.
582
-
583
- **v0.7.80 hardening release:** The CLI honors `worker.configuredA2A` in
584
- `~/.kodax/config.json`: the embedded Runtime becomes Worker-hosted and loads
585
- the configured A2A plane inside the Worker owner, so configured outbound
586
- Agents appear as `external:<name>` in `list_dispatchable_agents` and can be
587
- dispatched with `spawn_agent`. The mode rejects configured MCP servers or
588
- Extensions (they cannot cross the Worker boundary); use the default inline
589
- Runtime to retain those capabilities. Worker-hosted embedded CLI sessions also
590
- reduce run options to the JSON-safe wire DTO exactly like daemon mode instead of
591
- crashing with `RuntimeTransportBoundaryError`. Auto permission analysis no
592
- longer treats ordinary search scopes and tool metadata as unresolved, and a
593
- `max_tokens`-truncated classifier retry uses a 1024-token budget (Issue 275).
594
- Managed AMA turns now bound one uninterrupted tool loop by a 500-iteration
595
- panic fuse that resets on every idle-yield resume a runaway-loop breaker,
596
- never a cumulative task budget and a fused Runner fails with a structured
597
- `RunnerIterationLimitError` carrying the recovery transcript. Managed-run
598
- repetition loops are closed; parallel review and delegation guidance are
599
- restored and tightened. FEATURE_278/279/282/283/285 were explicitly
600
- rescheduled to v0.7.85, so v0.7.80 remains a debug/patch slot and no incomplete
601
- feature is represented as shipped. See the
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
+ dynamic Skill commands require an explicit host-controlled executor, root AMA
554
+ handles explicit remember/correct/forget requests immediately through the
555
+ governed `memory_intent` control plane while exceptional or inferred changes
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
602
603
  [v0.7.80 release checklist](docs/release.md#v0780-release-preparation).
603
604
 
604
605
  **v0.7.81 Runtime interrupt integrity release:** Active-Run inputs submitted
@@ -609,7 +610,7 @@ before KodaX reports them as delivered. Every delivered item exposes its
609
610
  restart. A multi-input safe-boundary drain keeps each prompt as a separate user
610
611
  message and maps it to its own entry. Runtime-owned persistence or provenance
611
612
  failure fails the delivery closed rather than emitting an unverifiable event.
612
- FEATURE_287 remains planned for v0.7.88; this is a non-Feature patch. See the
613
+ FEATURE_287 remains planned for v0.7.93; this is a non-Feature patch. See the
613
614
  [v0.7.81 release checklist](docs/release.md#v0781-release-preparation).
614
615
 
615
616
  **v0.7.82 Runtime causality release:** Daemon capability discovery now composes
@@ -621,7 +622,7 @@ trusted Abort remains terminal causality before credential redaction without
621
622
  overriding a real completion or independent failure. Input submission resolves
622
623
  the admitted authoritative Run before reading mutable Session history, so
623
624
  active interrupt and after-turn admission do not produce a transient
624
- `data_changed` rejection. FEATURE_287 remains planned for v0.7.88; this is a
625
+ `data_changed` rejection. FEATURE_287 remains planned for v0.7.93; this is a
625
626
  non-Feature patch. See the [v0.7.82 release checklist](docs/release.md#v0782-release-preparation).
626
627
 
627
628
  **v0.7.83 Windows daemon containment release:** Windows daemon startup creates
@@ -631,7 +632,7 @@ exports `waitForRuntimeDaemonShutdown()` and capability
631
632
  `daemonShutdownVerification:1`; CLI stop waits for both daemon and supervisor
632
633
  exit. Legacy uncontained daemons are not reported as verified and are not
633
634
  silently upgraded in place. The Worker owner-lease portion of Issue 256 remains
634
- scheduled for v0.7.85, and FEATURE_287 remains planned for v0.7.88. See the
635
+ scheduled for v0.7.85, and FEATURE_287 remains planned for v0.7.93. See the
635
636
  [v0.7.83 release checklist](docs/release.md#v0783-release-preparation).
636
637
 
637
638
  **v0.7.84 Actor settlement recovery release:** Agent progress persistence is
@@ -644,1252 +645,1289 @@ cannot rewind a local terminal Run or duplicate cancellation effects. No-op
644
645
  quiescence avoids an unnecessary Session rewrite. See the
645
646
  [v0.7.84 release checklist](docs/release.md#v0784-release-preparation).
646
647
 
648
+ **v0.7.85 release:** this release ships the F289/F290 Memory review and
649
+ lesson/verdict pipeline, F291 Session-scoped Runtime Event Journals, and F292
650
+ conversation-first Memory management with the additive experimental SDK
651
+ management facade. It also includes Actor settlement convergence, Agent Home
652
+ and learned-root guardrails, terminal startup replay avoidance, idle
653
+ repo-intelligence Worker retirement, Windows sandbox/ACL hardening, and the
654
+ matching regression guides. These include intentional runtime and system-code
655
+ changes. Issue 256's remaining Worker owner-lease boundary is still open and
656
+ is scheduled for v0.7.86; this release does not claim descendant-closure proof
657
+ for that unresolved portion. See the [v0.7.85 release checklist](docs/release.md#v0785-release-preparation).
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
+
647
685
  The v0.7.77 release also adds an opt-in, host-configurable Shell Execution Contract.
648
- Runtime Session settings or an individual Run can select `pwsh`, Windows
649
- PowerShell, `cmd`, `bash`, `zsh`, or an explicit Git Bash executable; KodaX
650
- resolves the shell environment in the effective project cwd and then executes
651
- the command through that same interpreter. Resolved environments are isolated
652
- by contract and cwd, expire after a bounded TTL, and can be explicitly
653
- refreshed. Provider credentials and execution-control variables are removed
654
- before profile/setup code and again before the command starts. Credential-shaped
655
- variables are also filtered on the legacy platform-shell path; explicit names
656
- in user-level `sandbox.envPass` are restored only for the final command target.
657
- When `shellExecution` is absent, the established interpreter path is unchanged. See
658
- [SDK Embedder Guide section 28](docs/SDK_EMBEDDER_GUIDE.md#28-host-configurable-shell-execution-contract-v0777)
659
- and the [Issue 214 regression guide](docs/test-guides/ISSUE_214_v0.7.77_REGRESSION_GUIDE.md).
660
-
661
- Kimi Code requests also receive a stable, opaque prompt-cache affinity key
662
- derived from the logical Runtime context. It is reused across Runs, retries,
663
- fallback, resume, and compaction; recursive child Agents receive distinct keys
664
- based on their canonical Agent path rather than their temporary transcript
665
- Session. Public Kimi and official OpenAI use the corresponding
666
- `prompt_cache_key` field, while other compatible gateways remain opt-in because
667
- some reject unknown request fields. This improves routing stability but cannot
668
- override Provider TTL or cache sharding. See the
669
- [Issue 215 regression guide](docs/test-guides/ISSUE_215_v0.7.77_REGRESSION_GUIDE.md).
670
- Codex CLI cache reads/writes and Gemini CLI cache reads now flow through the
671
- CLI bridge and Runtime diagnostics without estimation. A reported `0` remains
672
- distinct from an unreported field; see the
673
- [Issue 216 regression guide](docs/test-guides/ISSUE_216_v0.7.77_REGRESSION_GUIDE.md).
674
- The bridge also starts the first native CLI turn fresh, resumes only a native
675
- session ID reported by that CLI, creates fresh ACP sessions for stateless
676
- calls, recreates a closed pseudo transport, and validates the process exit even
677
- after a terminal CLI event. User cancellation stays quiet, while hard/idle
678
- timeout aborts remain failures eligible for Runtime recovery, and a CLI that
679
- reports success but never exits is terminated at its configured deadline; see the
680
- [Issue 217 regression guide](docs/test-guides/ISSUE_217_v0.7.77_REGRESSION_GUIDE.md).
681
-
682
- One daemon owns many sessions. Different sessions may run concurrently; starts
683
- within the same session are queued so that only one run is active for that
684
- session. Multiple `kodax` processes can attach to the same daemon and open or
685
- observe the same session. FEATURE_269 adds atomic snapshot-plus-stream joining,
686
- durable idempotent mutations, revision-safe settings and grants, transport-safe
687
- AskUser/permission responses, run-scoped credential and Host Tool bridges, and
688
- one daemon/inline Coder owner fence. In-flight external effects are never
689
- blindly replayed after a crash; clients receive explicit interrupted/unknown
690
- terminal facts and resync when `runtimeId` changes.
691
-
692
- Space and IDE hosts should require these capabilities through the Runtime SDK.
693
- Partner remains on its private inline Runtime and must use a distinct product
694
- data/session root. A missing daemon capability is an error, not permission to
695
- silently fall back to inline Coder.
696
-
697
- For the full host-integration contract, including inline/Worker/daemon selection,
698
- multi-client permission handling, config/catalog/MCP admin APIs, artifacts,
699
- context diagnostics, and daemon protocol schemas, see
700
- [docs/SDK_EMBEDDER_GUIDE.md §17](docs/SDK_EMBEDDER_GUIDE.md#17-runtime-sdk-worker-isolation-and-local-daemon-feature_253-feature_257).
701
-
702
- The Space/IDE shared-daemon contract is documented in
703
- [SDK Embedder Guide section 23](docs/SDK_EMBEDDER_GUIDE.md#23-shared-coder-daemon-for-space-and-ide-hosts-feature_269-v0769).
704
-
705
- **v0.7.72–v0.7.73 Runtime permission contract:** Auto Mode is owned by the Runtime session,
706
- not by a UI hook. It reuses its LLM/rules guardrail across turns, classifies
707
- before the shared permission bridge, and persists explicit engine selection.
708
- The same session settings can select a classifier model and bounded
709
- timeout; `auto` defaults to LLM classification and fails with a recoverable
710
- configuration error when no effective classifier model exists, rather than
711
- silently falling back. In v0.7.78, classifier failures retry once and then use
712
- the Accept-edits safety boundary; they never change the engine to rules.
713
- Runtime permission prompts offer opaque, exact
714
- allow-once/session/persistent grant suggestions; persistent grants are
715
- daemon-owned and revisioned. Host plan exit is exposed only when the host
716
- supplies an approval callback. See the [Runtime Auto Mode integration guide](docs/SDK_EMBEDDER_GUIDE.md#24-runtime-owned-auto-mode-and-plan-approval-bridges-v0772v0773).
717
-
718
- ## Repo Intelligence
719
-
720
- 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.
721
-
722
- 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.
723
-
724
- ```bash
725
- # Pick a runtime mode (auto | full | light | off)
726
- kodax --repo-intelligence full --repo-intelligence-trace
727
- ```
728
-
729
- ## Architecture
730
-
731
- 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):
732
-
733
- ```
734
- KodaX/
735
- ├── packages/ # 4 workspace packages (FEATURE_194 v0.7.43)
736
- │ ├── llm/ # @kodax-ai/llm - LLM abstraction (16 built-in provider aliases)
737
- │ │ └── providers/ # Anthropic, OpenAI, DeepSeek, Kimi, MiMo, MiniMax, Zhipu, Ark, …
738
- │ │
739
- │ ├── agent/ # @kodax-ai/agent - Generic Agent framework
740
- │ │ ├── actors/ # Runtime-owned Actor tree, scheduler, mailbox, events
741
- │ │ ├── session-lineage/ # branchable session tree (inline v0.7.43)
742
- │ │ ├── capabilities/
743
- │ │ │ ├── mcp/ # MCP integration (inline v0.7.43)
744
- │ │ │ └── skills/ # Skills standard implementation + builtin (inline v0.7.43)
745
- │ │ └── tracing/ # tracing / observability (inline v0.7.43)
746
- │ │
747
- │ ├── coding/ # @kodax-ai/coding - Coding Agent (tools + prompts)
748
- │ │ ├── tools/ # 50+ tools: read, write, edit, bash, glob, grep, undo,
749
- │ │ │ # spawn_agent, send_message, followup_task, wait_agent,
750
- │ │ │ # ask_user_question, repo-intelligence, …
751
- │ │ └── repo-intelligence/ # incl. protocol.ts (inline v0.7.43)
752
- │ │
753
- │ └── repl/ # @kodax-ai/repl - Interactive terminal UI (Ink TUI)
754
-
755
- ├── src/ # CLI entry + SDK subpath entries
756
- │ ├── kodax_cli.ts # Main CLI entry point (bin: `kodax`)
757
- │ └── sdk-*.ts # SDK subpath re-exports → @kodax-ai/kodax/{agent,llm,coding,media,repl,skills,mcp,session,runtime,sandbox,a2a,experimental-memory}
758
-
759
- └── package.json # Publish-shaped exports; release.mjs only toggles private during pack/publish
760
- ```
761
-
762
- ### Package Dependencies
763
-
764
- ```
765
- ┌──────────────────┐
766
- │ kodax (root) │
767
- │ CLI Entry │
768
- └────────┬─────────┘
769
-
770
- ┌──────────────┴──────────────┐
771
- │ │
772
- ▼ ▼
773
- ┌──────────────┐ ┌────────────────┐
774
- │@kodax-ai/repl│ │@kodax-ai/coding│
775
- │ UI Layer │ │ Tools+Prompts │
776
- └──────┬───────┘ └──────┬─────────┘
777
- │ │
778
- │ ┌──────────────┴──────────────┐
779
- │ │ │
780
- ▼ ▼ ▼
781
- ┌──────────────┐ ┌──────────────────────────┐ ┌──────────────┐
782
- │@kodax-ai/ │ │@kodax-ai/agent │ │@kodax-ai/llm │
783
- │coding (via │ │Runner + fan-out + │ │LLM Abstract │
784
- │above) │ │idle-yield + session- │ │(16 aliases) │
785
- │ │ │lineage + skills + mcp + │ │ │
786
- │ │ │tracing (FEATURE_194) │ │ │
787
- └──────────────┘ └──────────────────────────┘ └──────────────┘
788
- ```
789
-
790
- ### Package Overview
791
-
792
- 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.
793
-
794
- | Workspace package | Purpose | Key Dependencies |
795
- |---------|---------|------------------|
796
- | `@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 |
797
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 |
798
- | `@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 |
799
- | `@kodax-ai/repl` | Complete interactive terminal UI (Ink/React, permission modes, commands, streaming) | @kodax-ai/coding, ink, react |
800
-
801
- ### Source-side vs npm-published surface
802
-
803
- KodaX has two layers that consumers should understand separately:
804
-
805
- - **Source-side**: 4 workspace packages above (what developers see when reading the repo).
806
- - **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:
807
- - **Full-package subpaths** (`/agent`, `/llm`, `/coding`, `/repl`) — each one maps 1:1 to a source workspace and exposes its complete public API.
808
- - **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`.
809
-
810
- | Source package | npm subpath | Type | What you get | Example consumer |
811
- |---|---|---|---|---|
812
- | `packages/llm` | `@kodax-ai/kodax/llm` | Full package | 16-alias LLM abstraction (108 exports) | Standalone LLM clients |
813
- | `packages/agent` | `@kodax-ai/kodax/agent` | Full package | Runner / fan-out / external-agent plane / session-lineage / capabilities / tracing (331 exports) | Custom agent frameworks |
814
- | `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 |
815
- | `packages/agent` | `@kodax-ai/kodax/mcp` | **Narrow subset** | MCP only — `McpCapabilityProvider` / `createMcpTransport` / `searchMcpCatalog` / ... (23 exports) | MCP server hosts |
816
- | `packages/agent` | `@kodax-ai/kodax/media` | **Narrow subset** | Structured image/file/video input-artifact helpers (22 exports) | Desktop hosts and multimodal clients |
817
- | `packages/agent` | `@kodax-ai/kodax/experimental-memory` | **Experimental subset** | Thin F228-backed `MemoryAgent` / `MemorySession` contracts for scoped recall, deliberate query, observations, and outcomes | SDK hosts explicitly evaluating FEATURE_260 |
818
- | `packages/coding` | `@kodax-ai/kodax/coding` | Full package | Coding agent + 50+ tools + repo-intelligence (505 exports) | Build a Claude Code-shape product |
819
- | `packages/repl` | `@kodax-ai/kodax/repl` | Full package | Ink TUI + permission modes + commands (217 exports) | Terminal-UI consumers |
820
- | `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 |
821
- | `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 |
822
- | `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 |
823
- | `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 |
824
-
825
- **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.
826
-
827
- **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.
828
-
829
- **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.
830
-
831
- **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).
832
-
833
- **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.
834
-
835
- **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).
836
-
837
- **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).
838
-
839
- **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).
840
-
841
- **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](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).
842
-
843
- **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](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).
844
-
845
- **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.
846
-
847
- **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](docs/SDK_EMBEDDER_GUIDE.md#18-external-agent-executor-plane-feature_258-v0767).
848
-
849
- **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](docs/SDK_EMBEDDER_GUIDE.md#20-cost-disciplined-workflow-routing-and-telemetry-feature_259-v0767).
850
-
851
- **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](docs/SDK_EMBEDDER_GUIDE.md#19-session-surface-filtering-and-cursor-pagination-feature_261-v0767).
852
-
853
- **Experimental Memory Agent SDK (FEATURE_260, v0.7.68)**: `/experimental-memory` exposes the thin agent-layer `MemoryAgent` and scoped `MemorySession` lifecycle over the existing governed F228 plane. Passive recall is zero-wait; `query()` is read-only and deliberate; durable changes still require the proposal/preview/fingerprint/apply path. The Action LLM remains the final decision maker, recalled content stays low-authority, and safety/scope gates remain deterministic. See the [direct session and boundary guide](docs/SDK_EMBEDDER_GUIDE.md#21-experimental-governed-memory--experimental-memory-feature_260-v0768).
854
-
855
- **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](docs/SDK_EMBEDDER_GUIDE.md#22-bidirectional-a2a-10--a2a-feature_267-v0769).
856
-
857
- **A2A interoperability and authentication hardening** keeps a discovered
858
- interface on the trusted Agent Card origin and sends credentials only when one
859
- complete Card/Skill security requirement is satisfiable. The no-code client
860
- supports HTTP Bearer compatibility and OAuth 2.0 Client Credentials; for OAuth,
861
- an external Authorization Server issues short-lived access tokens and KodaX
862
- caches them only in memory. Inbound `a2a serve` can validate RFC 9068 JWT access
863
- tokens from an external issuer/JWKS, but never signs or issues production
864
- tokens itself. It resolves its provider from CLI, then environment, config, and
865
- the built-in default; a Markdown Agent can pin its own provider. Input
866
- continuation resumes the original Runtime run, task history and retention are
867
- bounded with stable cursor pagination, and authenticated SSE is correlated
868
- before falling back to polling after an early normal EOF. Only direct remote
869
- artifacts, broker-staged outputs, and outputs from a successfully admitted
870
- Skill script can be published; ordinary workspace writes and local paths stay
871
- private.
872
-
873
- This authentication and per-Agent activation hardening is a post-release
874
- closure of the v0.7.69 F267/F268 design and ships in the v0.7.71 patch; it is
875
- not a claim that older v0.7.69 binaries contained the
876
- later OAuth profiles.
877
-
878
- **v0.7.70 MCP discovery hardening** uses exact capability IDs and revisioned
879
- cursors while admitting results against real physical capacity. Compact CJK
880
- queries are segmented, and a cross-language lexical zero match either returns a
881
- lossless bounded grouped inventory or one concise retry in the catalog language.
882
- Partial provider failure remains explicit rather than disappearing into an
883
- apparently complete result.
884
-
885
- The complete built-in path is available without writing TypeScript:
886
-
887
- ```bash
888
- # Call another A2A Agent
889
- kodax a2a add research https://agent.example/.well-known/agent-card.json --effect read
890
- kodax a2a test research
891
- kodax a2a call research "Summarize this topic"
892
-
893
- # Explicitly authorize a private plaintext endpoint (prefer HTTPS when available)
894
- kodax a2a add intranet http://10.20.30.40/.well-known/agent-card.json \
895
- --allow-private --allow-insecure-http --effect read
896
-
897
- # Stage an OAuth-protected Agent, then hot-activate/deactivate it
898
- export RESEARCH_A2A_CLIENT_SECRET='provisioned-by-your-authorization-server'
899
- # PowerShell: $env:RESEARCH_A2A_CLIENT_SECRET='provisioned-by-your-authorization-server'
900
- # PowerShell: run the command on one line or replace each trailing \ with a backtick.
901
- kodax a2a add reviewer https://reviewer.example/.well-known/agent-card.json \
902
- --disabled --effect read --oauth-scheme enterprise-oauth \
903
- --oauth-issuer https://identity.example/ \
904
- --oauth-token-url https://identity.example/oauth/token \
905
- --oauth-client-id kodax-reviewer \
906
- --oauth-client-secret-env RESEARCH_A2A_CLIENT_SECRET \
907
- --oauth-scope a2a.invoke --oauth-resource https://reviewer.example/
908
- kodax a2a enable reviewer
909
- kodax a2a disable reviewer # blocks new dispatch; does not cancel in-flight tasks
910
-
911
- # Expose the Runtime default Agent, or pass a name from ~/.kodax/agents/*.md
912
- export KODAX_A2A_TOKEN='replace-with-a-long-random-token'
913
- # PowerShell: $env:KODAX_A2A_TOKEN='replace-with-a-long-random-token'
914
- kodax a2a expose # or: kodax a2a expose document-agent
915
- kodax a2a serve # loopback http://127.0.0.1:8765
916
- ```
917
-
918
- MCP, A2A, and Extension declarations live in one user file per domain under
919
- `~/.kodax/integrations/`. Use `kodax config paths`,
920
- `kodax config template <core|mcp|a2a|extensions>`,
921
- `kodax integrations migrate --apply`, and the `kodax mcp`, `kodax a2a`, or
922
- `kodax extensions` commands to manage them. Migration imports only legacy
923
- `config.json#mcpServers` and `config.json#extensions`; A2A has no legacy source.
924
- It never overwrites an existing destination. The first MCP/Extension mutation
925
- can stage legacy entries. Remove legacy keys only with
926
- `--apply --cleanup-legacy`, after reviewing destination files and
927
- literal-secret warnings. Running
928
- CLI/daemon hosts retain the
929
- last valid revision, atomically replace the complete MCP provider, reconcile
930
- Extensions per entry, and hot-register outbound A2A Agents. Each A2A entry has
931
- a desired `enabled` switch; `kodax a2a list` shows configuration, while the
932
- owning Runtime is authoritative for live applied registrations. Disabled
933
- entries are not fetched during automatic reconciliation and, after the owning
934
- Runtime applies the revision, cannot accept new dispatch. The mutation command
935
- itself is not cross-process acknowledgement. `a2a add --disabled` still checks
936
- the Card by default unless `--no-test` is supplied, while `a2a test` performs
937
- discovery/security planning without requesting an OAuth token. The fixed
938
- `KODAX_A2A_TOKEN` example is an operator-provisioned compatibility credential;
939
- KodaX does not generate or issue it. Disabled entries remain available for
940
- later re-enable. Private-address access and non-loopback plaintext HTTP are
941
- independent, persisted, default-deny permissions (`--allow-private` and
942
- `--allow-insecure-http`); exact loopback HTTP remains available without either.
943
- OAuth token endpoints retain their stricter HTTPS-or-exact-loopback rule.
944
- Worker-hosted SDK Runtimes can load this same configured plane inside the Worker
945
- owner with `worker: { configuredA2A: true }`. The CLI honors the same opt-in
946
- from `~/.kodax/config.json` (`"worker": { "configuredA2A": true }`) by creating
947
- a Worker-hosted embedded Runtime that loads the configured A2A plane. `a2a serve` loads
948
- its configured MCP/Extension capability surface before listening and pins that
949
- execution authority; it hot-reloads publication, authentication, and limits.
950
-
951
- A2A configuration migration and retained task ownership are separate. If a
952
- v0.7.70 task store must remain addressable after the realm-aware upgrade, stop
953
- the A2A server, run `kodax a2a migrate-tasks` to inspect the exact-owner plan,
954
- then apply it with `--apply --confirm-server-stopped`. OAuth migration also
955
- requires the known historical `--subject`; normal serving never guesses or
956
- dual-reads a legacy owner key.
957
-
958
- Agent, Skill, Extension-tool authority, workspace, tool-policy, or task-store
959
- changes require an explicit server restart. Managed
960
- A2A contexts default to `~/kodax_a2a_server_workspace/<runtime-profile>/contexts/`.
961
- Exact Skill scripts require the opt-in isolated policy and a passing
962
- `kodax sandbox doctor` (`kodax sandbox setup` performs the explicit Windows
963
- one-time provisioning).
964
-
965
- ---
966
-
967
- ## Features
968
-
969
- - **Modular Architecture** - Use as CLI, as a library, or as a Node-free single binary
970
- - **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
971
- - **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
972
- - **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=...)`.
973
- - **Reasoning Effort** - Effort-first control (`off/auto/low/medium/high` plus model-supported extras) across providers
974
- - **Streaming Output** - Real-time response display
975
- - **Session Management** - JSONL format with branchable session lineage tree
976
- - **Skills System** - Natural language triggering, extensible, role-projected in AMA
977
- - **Repo Intelligence** - Built-in full/light repository intelligence with native KodaX auto-injection lane
978
- - **Rich Tool Surface** - 50+ built-in tools across file ops, shell, search, repo intelligence, MCP capabilities, git worktree, and agent control
979
- - **Permission Control** - 3 permission modes with pattern-based control
980
- - **Standalone Binary** - `bun --compile` releases for Win/macOS/Linux x64+arm64, no Node.js required on target machines
981
- - **Cross-Platform** - Windows/macOS/Linux
982
- - **TypeScript Native** - Full type safety and IDE support
983
-
984
- ---
985
-
986
- ## Installation
987
-
988
- ### As CLI Tool
989
-
990
- ```bash
991
- # Clone repository
992
- git clone https://github.com/icetomoyo/KodaX.git
993
- cd KodaX
994
-
995
- # Install dependencies (includes workspace packages)
996
- npm install
997
-
998
- # Build the monorepo
999
- npm run build
1000
-
1001
- # Link globally (development mode)
1002
- npm link
1003
-
1004
- # Now you can use 'kodax' anywhere
1005
- kodax "your task"
1006
- ```
1007
-
1008
- ### As Standalone Binary (no Node required on target)
1009
-
1010
- 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.
1011
-
1012
- Supported targets: `win-x64`, `linux-x64`, `linux-arm64`, `darwin-x64`, `darwin-arm64`. Win7 / pre-glibc-2.27 distros / LoongArch are not supported.
1013
-
1014
- **Build locally**:
1015
-
1016
- ```bash
1017
- # Install Bun once on your build machine
1018
- npm i -g bun # or scoop/brew/curl install — see docs/release.md
1019
-
1020
- npm run build:binary # Current host platform (fastest)
1021
- npm run build:binary:all # All five targets in sequence
1022
- node scripts/build-binary.mjs --target=linux-arm64 # Specific target
1023
- ```
1024
-
1025
- Output lives under `dist/binary/<target>/`:
1026
-
1027
- ```
1028
- dist/binary/linux-x64/
1029
- ├── kodax # ~60 MB Bun-compiled executable
1030
- ├── builtin/ # Sidecar built-in skills
1031
- ├── provider-capabilities.json
1032
- ├── semantic-worker.js # Repo-intelligence Worker
1033
- ├── runtime-worker.js # SDK Runtime Worker
1034
- └── constructed-handler-worker.js # Constructed-tool Worker
1035
- ```
1036
-
1037
- Smoke-test: `dist/binary/<host>/kodax --version`.
1038
-
1039
- **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.
1040
-
1041
- 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.
1042
-
1043
- ### As Library
1044
-
1045
- ```bash
1046
- npm install @kodax-ai/kodax
1047
- ```
1048
-
1049
- ```typescript
1050
- import { runKodaX } from '@kodax-ai/kodax';
1051
-
1052
- process.env.ZHIPU_API_KEY = process.env.ZHIPU_API_KEY ?? 'your_api_key';
1053
-
1054
- const result = await runKodaX({
1055
- provider: 'zhipu-coding',
1056
- effort: 'auto',
1057
- events: {
1058
- onTextDelta: (text) => process.stdout.write(text),
1059
- onComplete: () => console.log('\nDone!'),
1060
- },
1061
- }, 'your task');
1062
-
1063
- console.log(result.lastText);
1064
- ```
1065
-
1066
- #### SDK Subpath Imports (v0.7.39+)
1067
-
1068
- For smaller surface and tree-shake-friendly imports, the SDK is also exposed via subpath exports — pick only the package(s) you need:
1069
-
1070
- ```typescript
1071
- import { Runner } from '@kodax-ai/kodax/agent'; // agent runtime
1072
- import { getProvider } from '@kodax-ai/kodax/llm'; // LLM abstraction (16 aliases)
1073
- import { runKodaX } from '@kodax-ai/kodax/coding'; // coding tools + prompts
1074
- import { createImageArtifactFromPath } from '@kodax-ai/kodax/media'; // input artifacts
1075
- import { SkillRegistry } from '@kodax-ai/kodax/skills'; // zero-dep skill loader
1076
- import { loadConfig } from '@kodax-ai/kodax/repl'; // REPL config / session helpers
1077
- import { createMcpManager } from '@kodax-ai/kodax/mcp'; // MCP popout manager (v0.7.42)
1078
- import { listSessions } from '@kodax-ai/kodax/session'; // session history helpers
1079
- import { createKodaXRuntime } from '@kodax-ai/kodax/runtime'; // embedded/daemon runtime API
1080
- import { runKodaXSandboxed } from '@kodax-ai/kodax/sandbox'; // standalone ASRT containment
1081
- import { createKodaXA2AServer } from '@kodax-ai/kodax/a2a'; // A2A 1.0 client/server edge
1082
- import { createMemoryAgent } from '@kodax-ai/kodax/experimental-memory'; // opt-in memory SDK
1083
- ```
1084
-
1085
- 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.
1086
-
1087
- For the complete host-facing contract — including embedded/Worker/daemon ownership,
1088
- external-agent registration and task control, session cursor pagination, workflow
1089
- model-tier routing, and efficiency telemetry — see the
1090
- [SDK Embedder Integration Guide](docs/SDK_EMBEDDER_GUIDE.md).
1091
-
1092
- > **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 [docs/SDK_EMBEDDER_GUIDE.md §5](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.
1093
-
1094
- 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.
1095
-
1096
- ---
1097
-
1098
- ## Usage
1099
-
1100
- ### REPL Quickstart
1101
-
1102
- Running `kodax` with no prompt starts the interactive REPL.
1103
-
1104
- ```bash
1105
- kodax
1106
- ```
1107
-
1108
- Inside the REPL you can type normal requests or slash commands:
1109
-
1110
- ```text
1111
- Read package.json and summarize the architecture
1112
- /model
1113
- /mode
1114
- /help
1115
- ```
1116
-
1117
- ### CLI Quickstart
1118
-
1119
- ```bash
1120
- # Set API key
1121
- export ZHIPU_API_KEY=your_api_key
1122
-
1123
- # Basic usage
1124
- kodax "Help me create a TypeScript project"
1125
-
1126
- # Choose a provider explicitly
1127
- kodax --provider openai --model gpt-5.4 "Create a REST API"
1128
-
1129
- # Use higher reasoning effort
1130
- kodax --effort high "Review this architecture"
1131
- ```
1132
-
1133
- ### Session Workflows
1134
-
1135
- Use a session when you want memory across turns. Without a session, each CLI call is independent.
1136
-
1137
- ```bash
1138
- # No memory: two separate calls
1139
- kodax "Read src/auth.ts"
1140
- kodax "Summarize it"
1141
-
1142
- # With memory: same session
1143
- kodax --session my-project "Read package.json"
1144
- kodax --session my-project "Summarize it"
1145
- kodax --session my-project "How should I fix the first issue?"
1146
-
1147
- # Session management
1148
- kodax -r # Search, page, and select a non-empty session
1149
- kodax -r <session-id> # Resume a known session directly
1150
- kodax -r "Review runtime" # Resume a unique exact title; duplicates open the picker
1151
- kodax --session list # List up to 50 non-empty sessions
1152
- kodax --session cleanup-acp # Preview strictly matched empty ACP-test pollution
1153
- ```
1154
-
1155
- Bare `-r` opens an interactive picker with incremental search, arrow/PageUp/PageDown
1156
- navigation, Tab completion, full selected-session ID display, and Enter-to-resume.
1157
- An explicit value checks the complete session ID first, then an exact
1158
- case-insensitive title; duplicate titles open a narrowed picker instead of
1159
- silently choosing one. The picker loads before the full CLI, so session listing
1160
- remains responsive. After selection it hands terminal input to the resumed
1161
- REPL; Esc releases the picker's stdin ownership and immediately returns to the
1162
- invoking shell. Session replay preserves each recorded message/event timestamp.
1163
-
1164
- Cleanup is preview-only unless
1165
- `--apply-session-cleanup` is also provided; matching sessions are archived rather
1166
- than permanently deleted.
1167
-
1168
- ### Session Patterns
1169
-
1170
- ```bash
1171
- # ❌ No memory: two independent calls
1172
- kodax "Read src/auth.ts" # Agent reads and responds
1173
- kodax "Summarize it" # Agent doesn't know what to summarize
1174
-
1175
- # ✅ With memory: same session
1176
- kodax --session auth-review "Read src/auth.ts"
1177
- kodax --session auth-review "Summarize it" # Agent knows to summarize auth.ts
1178
- kodax --session auth-review "How to fix first issue" # Agent has context
1179
- ```
1180
-
1181
- ### Workflow Examples
1182
-
1183
- ```bash
1184
- # Code review (multi-turn conversation)
1185
- kodax --session review "Review src/ directory"
1186
- kodax --session review "Focus on security issues"
1187
- kodax --session review "Give me fix suggestions"
1188
-
1189
- # Project development (continuous session)
1190
- kodax --session todo-app "Create a Todo application"
1191
- kodax --session todo-app "Add delete functionality"
1192
- kodax --session todo-app "Write tests"
1193
- ```
1194
-
1195
- ### CLI Reference
1196
-
1197
- ```text
1198
- kodax Start the interactive REPL
1199
- -h, --help [topic] Show help or topic help
1200
- -p, --print <text> Run a single task and exit
1201
- -c, --continue Continue the most recent non-empty conversation in this directory
1202
- -r, --resume [value] Resume by ID/exact title, or open the searchable picker
1203
- -m, --provider Provider to use
1204
- --model <name> Override the model
1205
- --reasoning <mode> off | auto | quick | balanced | deep
1206
- -t, --thinking Compatibility alias for --reasoning auto
1207
- -s, --session <op> Session ID or legacy session operation
1208
- -j, --parallel Enable parallel tool execution
1209
- --max-iter <n> Max iterations
1210
- ```
1211
-
1212
- ### Permission Control
1213
-
1214
- KodaX provides 3 permission modes for fine-grained control:
1215
-
1216
- | Mode | Description | Tools Need Confirmation |
1217
- |------|-------------|------------------------|
1218
- | `plan` | Read-only planning mode | All modification tools blocked |
1219
- | `accept-edits` | Auto-accept file edits | bash only |
1220
- | `auto` | Runtime-owned LLM/rules classification within the project boundary | Only explicit classifier escalation |
1221
-
1222
- ```bash
1223
- # In REPL, use /mode command
1224
- /mode plan # Switch to plan mode (read-only)
1225
- /mode accept-edits # Switch to accept-edits mode
1226
- /mode auto # Switch to Runtime-owned Auto Mode
1227
- /auto # Alias for auto
1228
-
1229
- # Check current mode
1230
- /mode
1231
- ```
1232
-
1233
- **Features:**
1234
- - In `accept-edits` mode, choosing "always" can persist safe Bash allow-patterns
1235
- - Plan mode includes system prompt context for LLM awareness
1236
- - Sensitive/protected or unresolved targets enter Auto[LLM]/approval review;
1237
- ordinary reads outside the project are allowed
1238
- - Pattern-based permission: Allow specific Bash commands (e.g., `Bash(npm install)`)
1239
- - Unified diff display for write/edit operations
1240
- - Auto Mode first admits exactly modeled safe reads and workspace/temp
1241
- mutations without classifier latency. Remaining actions are reviewed against
1242
- bounded user intent and exact operation facts; a safe verdict creates no
1243
- pending approval request. Classifier failures retry once, then use the
1244
- Accept-edits safety boundary rather than silently switching to Auto[rules].
1245
- - Shift-Tab cycles `Plan -> Edits -> Auto`; Shift+Enter inserts a newline. Auto
1246
- immediately displays `Auto[LLM]` or `Auto[RULES]`, and rapid mode changes are
1247
- persisted in input order. `Auto[RULES]` remains an explicit/manual engine;
1248
- use `/auto-engine llm` to select LLM classification.
1249
- - Runtime-backed prompts can offer exact `allow once`, `allow this session`,
1250
- and `always allow` choices. Return the Runtime-issued opaque suggestion;
1251
- never derive or widen a permission rule from the displayed command or path.
1252
- Persistent grants are daemon-owned, revisioned, and can be listed/revoked
1253
- through `runtime.permissions` by an authorized SDK host. Dynamic shell
1254
- commands deliberately receive no persistent-grant suggestion.
1255
-
1256
- `kodax -c` skips zero-message ACP/bootstrap placeholders even when they are
1257
- newer than the last real conversation. The same newest non-empty rule applies
1258
- to Ink, classic, one-shot CLI, and coding-runtime auto-resume; an explicit
1259
- session ID always wins. Interactive resume also restores the saved workspace
1260
- runtime before relative shell commands or the next model turn.
1261
-
1262
- ### CLI Help Topics
1263
-
1264
- Get detailed help for specific topics:
1265
-
1266
- ```bash
1267
- # Basic help
1268
- kodax -h
1269
- kodax --help
1270
-
1271
- # Detailed topic help
1272
- kodax -h sessions # Session management details
1273
- kodax -h init # Long-running project initialization
1274
- kodax -h project # Project mode / harness workflow
1275
- kodax -h auto # Auto-continue mode
1276
- kodax -h provider # LLM provider configuration
1277
- kodax -h thinking # Thinking/reasoning effort and compatibility modes
1278
- kodax -h team # Multi-agent parallel execution
1279
- kodax -h print # Print configuration
1280
- ```
1281
-
1282
- ### Environment Variables
1283
-
1284
- 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_`.
1285
-
1286
- #### `KODAX_MAX_OUTPUT_TOKENS`
1287
-
1288
- 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.
1289
-
1290
- ```bash
1291
- # Allow up to 48K output tokens per turn (use a higher cap when generating long files)
1292
- export KODAX_MAX_OUTPUT_TOKENS=48000
1293
- kodax "generate the full implementation"
1294
-
1295
- # Unset to restore default behavior
1296
- unset KODAX_MAX_OUTPUT_TOKENS
1297
- ```
1298
-
1299
- Precedence used by every provider's `getEffectiveMaxOutputTokens()` (see `packages/llm/src/providers/base.ts`):
1300
-
1301
- 1. One-shot per-request override (agent-loop escalation / context-overflow recovery — internal)
1302
- 2. **`KODAX_MAX_OUTPUT_TOKENS`** (this variable, explicit user intent)
1303
- 3. Active model descriptor's `maxOutputTokens` (FEATURE_098 per-model cap)
1304
- 4. Provider config default
1305
- 5. Global `KODAX_MAX_TOKENS` fallback
1306
-
1307
- 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`).
1308
-
1309
- > **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.
1310
-
1311
- #### Sidecar verifier diagnostics
1312
-
1313
- Use these when diagnosing Worker text-only completion stalls or custom provider verifier behavior:
1314
-
1315
- ```bash
1316
- export KODAX_VERIFIER_LOG=1
1317
- export KODAX_VERIFIER_PROVIDER=anthropic
1318
- export KODAX_VERIFIER_MODEL=claude-haiku-4-5-20251001
1319
- ```
1320
-
1321
- - `KODAX_VERIFIER_LOG=1` shows verifier gate/elapsed/trace information and is equivalent to `"verifierLog": true` in `~/.kodax/config.json`.
1322
- - `KODAX_VERIFIER_PROVIDER` + `KODAX_VERIFIER_MODEL` route the verifier to a separate provider/model instead of inheriting the main Worker model. Set both together.
1323
- - `KODAX_VERIFIER_ALWAYS=1` forces the verifier to fire on every text-only completion for debugging/regression sweeps.
1324
-
1325
- SDK/headless hosts can observe actionable Sidecar Verifier messages via
1326
- `KodaXEvents.onSidecarMessage`; JSONL output emits the same payload as
1327
- `sidecar.message`. Only `revise` and `blocked` verdicts are surfaced; `accept`
1328
- stays silent.
1329
-
1330
- ## Advanced Library Usage
1331
-
1332
- #### Simple Mode (runKodaX)
1333
-
1334
- ```typescript
1335
- import { runKodaX, KodaXEvents } from '@kodax-ai/kodax';
1336
-
1337
- const events: KodaXEvents = {
1338
- onTextDelta: (text) => process.stdout.write(text),
1339
- onThinkingDelta: (text) => console.log(`Thinking delta: ${text.length} chars`),
1340
- onToolResult: (result) => console.log(`Tool ${result.name}: ${result.content.slice(0, 100)}`),
1341
- onSidecarMessage: (event) => console.log(`[sidecar:${event.verdict}] ${event.content}`),
1342
- onComplete: () => console.log('\nDone!'),
1343
- onError: (e) => console.error(e.message),
1344
- };
1345
-
1346
- const result = await runKodaX({
1347
- provider: 'zhipu-coding',
1348
- effort: 'auto',
1349
- events,
1350
- }, 'What is 1+1?');
1351
-
1352
- console.log(result.lastText);
1353
- ```
1354
-
1355
- #### Continuous Session (KodaXClient)
1356
-
1357
- ```typescript
1358
- import { KodaXClient } from '@kodax-ai/kodax';
1359
-
1360
- const client = new KodaXClient({
1361
- provider: 'zhipu-coding',
1362
- effort: 'auto',
1363
- events: {
1364
- onTextDelta: (t) => process.stdout.write(t),
1365
- },
1366
- });
1367
-
1368
- // First message
1369
- await client.send('Read package.json');
1370
-
1371
- // Continue same session
1372
- await client.send('Summarize it');
1373
-
1374
- console.log(client.getSessionId());
1375
- ```
1376
-
1377
- #### Custom Session Storage
1378
-
1379
- ```typescript
1380
- import { runKodaX, KodaXSessionStorage, KodaXMessage } from '@kodax-ai/kodax';
1381
-
1382
- class MyDatabaseStorage implements KodaXSessionStorage {
1383
- async save(id: string, data: { messages: KodaXMessage[]; title: string; gitRoot: string }) {
1384
- // Save to your database
1385
- }
1386
- async load(id: string) {
1387
- // Load from your database
1388
- return null;
1389
- }
1390
- }
1391
-
1392
- await runKodaX({
1393
- provider: 'zhipu-coding',
1394
- session: {
1395
- id: 'my-session-123',
1396
- storage: new MyDatabaseStorage(),
1397
- },
1398
- events: { ... },
1399
- }, 'task');
1400
- ```
1401
-
1402
- ### Library Modes Comparison
1403
-
1404
- | Feature | runKodaX | KodaXClient |
1405
- |---------|----------|-------------|
1406
- | **Message Memory** | ❌ No | ✅ Yes |
1407
- | **Call Style** | Function | Class instance |
1408
- | **Context** | Independent each time | Accumulates |
1409
- | **Use Case** | Single tasks, batch processing | Interactive dialogue, multi-step tasks |
1410
-
1411
- ---
1412
-
1413
- ## SDK Usage
1414
-
1415
- 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:
1416
-
1417
- ```bash
1418
- npm install @kodax-ai/kodax
1419
- ```
1420
-
1421
- ```typescript
1422
- import { runKodaX } from '@kodax-ai/kodax'; // root: CLI helpers + runKodaX
1423
- import { Runner, runFanOut } from '@kodax-ai/kodax/agent'; // generic Agent framework
1424
- import { getProvider } from '@kodax-ai/kodax/llm'; // 16-alias LLM abstraction
1425
- import { KODAX_TOOLS } from '@kodax-ai/kodax/coding'; // tools + prompts + agent loop
1426
- import { createImageArtifactFromPath } from '@kodax-ai/kodax/media'; // input artifact helpers
1427
- import { runInkInteractiveMode } from '@kodax-ai/kodax/repl'; // Ink TUI entrypoint
1428
- import { SkillRegistry } from '@kodax-ai/kodax/skills'; // zero-dep skill loader
1429
- import { createMcpManager } from '@kodax-ai/kodax/mcp'; // MCP popout manager (v0.7.42)
1430
- import { listSessions } from '@kodax-ai/kodax/session'; // session history helpers
1431
- import { createKodaXRuntime } from '@kodax-ai/kodax/runtime'; // embedded/daemon runtime API
1432
- import { runKodaXSandboxed } from '@kodax-ai/kodax/sandbox'; // explicit standalone containment
1433
- import { createKodaXA2AServer } from '@kodax-ai/kodax/a2a'; // A2A 1.0 client/server edge
1434
- import { createMemoryAgent } from '@kodax-ai/kodax/experimental-memory'; // opt-in experimental memory SDK
1435
- ```
1436
-
1437
- > The SDK is **ESM-only**. CommonJS consumers (Electron main / Webpack CJS / `require()` callers) must use `await import('@kodax-ai/kodax/...')` — see [docs/SDK_EMBEDDER_GUIDE.md §5](docs/SDK_EMBEDDER_GUIDE.md#5-consuming-from-a-commonjs-context-electron-main-cjs-bundles).
1438
-
1439
- ### `@kodax-ai/kodax/llm` — LLM Abstraction
1440
-
1441
- 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.
1442
-
1443
- ```typescript
1444
- import { getProvider, KodaXBaseProvider } from '@kodax-ai/kodax/llm';
1445
-
1446
- const provider = getProvider('anthropic');
1447
- const stream = await provider.streamCompletion(
1448
- [{ role: 'user', content: 'Hello!' }],
1449
- { onTextDelta: (text) => process.stdout.write(text) }
1450
- );
1451
-
1452
- for await (const result of stream) {
1453
- if (result.type === 'text') { /* … */ }
1454
- else if (result.type === 'tool_use') { /* … */ }
1455
- }
1456
- ```
1457
-
1458
- **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.
1459
-
1460
- ### `@kodax-ai/kodax/agent` — Agent Framework (standalone-consumable)
1461
-
1462
- ADR-021 standalone-consumable: `@kodax-ai/agent` has **zero inbound `@kodax-ai/coding` dependency** — you can wire any tool surface on top of it.
1463
-
1464
- ```typescript
1465
- import {
1466
- Runner,
1467
- runFanOut,
1468
- runWithIdleYield,
1469
- createAgentActorController,
1470
- generateSessionId,
1471
- estimateTokens,
1472
- DefaultSummaryCompaction,
1473
- } from '@kodax-ai/kodax/agent';
1474
-
1475
- // Bounded-concurrency fan-out with abort + structured progress events (v0.7.39 FEATURE_120)
1476
- const result = await runFanOut({
1477
- bundles: [{ id: 'a', task: 'audit-foo' }, { id: 'b', task: 'audit-bar' }],
1478
- maxParallel: 4,
1479
- run: async (bundle) => doWork(bundle),
1480
- });
1481
-
1482
- // Runtime-owned Actor identity tree (inject an executor before starting Turns)
1483
- const actors = await createAgentActorController();
1484
- const tree = actors.list('/root');
1485
-
1486
- // Pluggable compaction policy (FEATURE_081)
1487
- const policy = new DefaultSummaryCompaction({ thresholdRatio: 0.8, keepRecent: 10 });
1488
- ```
1489
-
1490
- `DefaultSummaryCompaction` is a standalone agent-layer primitive for custom
1491
- loops. It does not replace or disable KodaX's always-on coding-runtime policy
1492
- described under FEATURE_272 above.
1493
-
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 |
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 |
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
+
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).
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
+
1494
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.
1495
-
1496
- ### `@kodax-ai/kodax/skills` — Skills System
1497
-
1498
- Zero external dependencies. Markdown-based skill files with natural-language triggers and variable resolution.
1499
-
1500
- ```typescript
1501
- import {
1502
- SkillRegistry,
1503
- discoverSkills,
1504
- executeSkill,
1505
- type SkillContext,
1506
- } from '@kodax-ai/kodax/skills';
1507
-
1508
- const skills = await discoverSkills(['/path/to/skills']);
1509
- const registry = new SkillRegistry();
1510
- await registry.registerSkills(skills);
1511
-
1512
- const result = await executeSkill({
1513
- skillId: 'code-review',
1514
- arguments: { target: 'src/' },
1515
- workingDirectory: process.cwd(),
1516
- });
1517
- ```
1518
-
1519
- **Key Features**: zero deps · markdown-based skill files · natural-language triggering · variable resolution · built-in skills included.
1520
-
1521
- ### `@kodax-ai/kodax/coding` — Coding Agent
1522
-
1523
- 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.
1524
-
1525
- ```typescript
1526
- import { runKodaX, KodaXClient, KODAX_TOOLS } from '@kodax-ai/kodax/coding';
1527
-
1528
- // Single-task helper
1529
- const result = await runKodaX({
1530
- provider: 'zhipu-coding',
1531
- effort: 'auto',
1532
- events: { onTextDelta: (text) => process.stdout.write(text) },
1533
- }, 'Read package.json and explain the dependencies');
1534
-
1535
- // Continuous session
1536
- const client = new KodaXClient({
1537
- provider: 'anthropic',
1538
- effort: 'auto',
1539
- events: { /* … */ },
1540
- });
1541
- await client.send('Create a new file');
1542
- await client.send('Add a function to it'); // Has context from previous message
1543
- ```
1544
-
1545
- **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.
1546
-
1547
- ### `@kodax-ai/kodax/repl` — Interactive Terminal UI
1548
-
1549
- Ink/React-based interactive REPL. Permission modes, command system, themed streaming display.
1550
-
1551
- ```typescript
1552
- import { runInkInteractiveMode } from '@kodax-ai/kodax/repl';
1553
-
1554
- // Usually used via the `kodax` bin command; can be embedded:
1555
- // - Interactive terminal UI (Ink components)
1556
- // - Permission control (auto/plan/accept-edits modes)
1557
- // - Command system (/help, /mode, /clear, /status, …)
1558
- // - Skills integration
1559
- // - Theme support
1560
- await runInkInteractiveMode({ provider: 'zhipu-coding', effort: 'auto' });
1561
- ```
1562
-
1563
- **Key Features**: Ink-based React components · 3 permission modes (auto / plan / accept-edits) · built-in commands · real-time streaming display · context-usage indicator.
1564
-
1565
- ### Package Dependency Graph (workspace internal)
1566
-
1567
- ```
1568
- @kodax-ai/llm (zero business-logic deps)
1569
-
1570
- @kodax-ai/agent (depends @kodax-ai/llm; ADR-021 standalone-consumable;
1571
- inlines session-lineage + capabilities/{mcp,skills} +
1572
- tracing per ADR-036 v0.7.43)
1573
-
1574
- @kodax-ai/coding (depends llm + agent; inlines repo-intelligence/protocol per ADR-036)
1575
-
1576
- @kodax-ai/repl (depends coding + ink + react)
1577
- ```
1578
-
1579
- **Subpath Recommendations**:
1580
-
1581
- | Use Case | Subpath | Why |
1582
- |----------|---------|-----|
1583
- | Only need LLM abstraction | `@kodax-ai/kodax/llm` | Minimal deps; 16 built-in aliases |
1584
- | Building custom agent | `@kodax-ai/kodax/agent` | Runner + fan-out + idle-yield + session-lineage + capabilities |
1585
- | Coding tasks | `@kodax-ai/kodax/coding` | Complete coding agent + tools |
1586
- | Terminal app | `@kodax-ai/kodax/repl` | Full interactive experience |
1587
- | Runtime host / daemon client | `@kodax-ai/kodax/runtime` | Sessions, runs, events, permissions, catalog, MCP, artifacts, diagnostics |
1588
- | Experimental governed memory | `@kodax-ai/kodax/experimental-memory` | Scoped `MemoryAgent` / `MemorySession` recall and outcome contracts |
1589
-
1590
- ---
1591
-
1592
- | Provider | Environment Variable | Reasoning Support | Default Model |
1593
- |----------|----------------------|-------------------|---------------|
1594
- | anthropic | `ANTHROPIC_API_KEY` | Native | claude-sonnet-4-6 (`claude-opus-4-6` / `claude-haiku-4-5` via `/model`) |
1595
- | openai | `OPENAI_API_KEY` | Native | gpt-5.3-codex (`gpt-5.4` / `gpt-5.3-codex-spark` via `/model`) |
1596
- | 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`) |
1597
- | 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`) |
1598
- | qwen | `QWEN_API_KEY` | Native | qwen3.5-plus |
1599
- | 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) |
1600
- | zhipu | `ZHIPU_API_KEY` | Native | glm-5 (`glm-5.2` 1M ctx / `glm-5.1` / `glm-5-turbo` via `/model`) |
1601
- | zhipu-coding | `ZHIPU_CODING_API_KEY` | Native | glm-5.2 (1M ctx; legacy `glm-5.1` and `glm-5-turbo` remain selectable via `/model`) |
1602
- | 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) |
1603
- | 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`) |
1604
- | mimo | `MIMO_API_KEY` | Native | mimo-v2.5-pro (Xiaomi MiMo pay-per-token, Anthropic-compat) |
1605
- | mimo-coding | `MIMO_CODING_API_KEY` | Native | mimo-v2.5-pro (Xiaomi Token Plan, Anthropic-compat) |
1606
- | 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) |
1607
- | deepseek | `DEEPSEEK_API_KEY` | Native | deepseek-v4-flash (`deepseek-v4-pro` via `/model`) |
1608
- | gemini-cli | Provider CLI authentication (no KodaX API-key variable) | Prompt-only / CLI bridge | (via gemini CLI) |
1609
- | codex-cli | Provider CLI authentication (no KodaX API-key variable) | Prompt-only / CLI bridge | (via codex CLI) |
1610
-
1611
- > **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.
1612
-
1613
- ### Examples
1614
-
1615
- ```bash
1616
- # Use Zhipu Coding
1617
- kodax --provider zhipu-coding --thinking "Help me optimize this code"
1618
-
1619
- # Use OpenAI
1620
- export OPENAI_API_KEY=your_key
1621
- kodax --provider openai "Create a REST API"
1622
-
1623
- # Resume last session
1624
- kodax --session resume
1625
-
1626
- # List all sessions
1627
- kodax --session list
1628
-
1629
- # Parallel tool execution
1630
- kodax --parallel "Read package.json and tsconfig.json"
1631
-
1632
- # Adaptive multi-agent (AMA) mode — V2 Worker single-loop with Actor collaboration
1633
- kodax --agent-mode ama "Analyze code structure, check test coverage, find bugs"
1634
- ```
1635
-
1636
- ---
1637
-
1638
- ## Tools
1639
-
1640
- 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.
1641
-
1642
- ### File operations
1643
- | Tool | Description |
1644
- |------|-------------|
1645
- | `read` | Read file contents (supports offset/limit) |
1646
- | `write` | Write a new file or fully rewrite an existing one |
1647
- | `edit` | Exact string replacement (supports `replace_all`) |
1648
- | `multi_edit` | Atomic batch of independent edits to one file |
1649
- | `insert_after_anchor` | Insert content after a unique anchor without rewriting the file |
1650
- | `undo` | Revert the last file modification |
1651
-
1652
- ### Shell & search
1653
- | Tool | Description |
1654
- |------|-------------|
1655
- | `bash` | Execute a shell command (supports `run_in_background`; complete capture with recoverable capacity fallback) |
1656
- | `glob` | Find files by pattern |
1657
- | `grep` | Regex content search (context lines, multiline, file-type filter, pagination) |
1658
- | `code_search` | Lower-noise code search (extension-provider aware) |
1659
- | `semantic_lookup` | Symbol/module/process-aware search backed by repo intelligence |
1660
- | `web_search` | Discovery-oriented web search with trust + freshness signals |
1661
- | `web_fetch` | Fetch a specific URL with provenance hints |
1662
-
1663
- ### Repo Intelligence (working tools)
1664
- | Tool | Description |
1665
- |------|-------------|
1666
- | `repo_overview` | Summarize structure, key areas, entry hints, intelligence snapshot |
1667
- | `changed_scope` | Which files/areas/categories the current diff touches |
1668
- | `changed_diff` | Paged diff slice for a single file |
1669
- | `changed_diff_bundle` | Paged diff slices for multiple files in one call |
1670
- | `module_context` | Module capsule (deps, entries, symbols, tests, docs) |
1671
- | `symbol_context` | Definition + probable callers/callees + alternatives |
1672
- | `process_context` | Approximate static execution capsule for an entry |
1673
- | `impact_estimate` | Blast radius for a symbol/path/module |
1674
-
1675
- ### MCP capabilities (when MCP servers are configured)
1676
- | Tool | Description |
1677
- |------|-------------|
1678
- | `mcp_search` / `mcp_describe` / `mcp_call` | Discover and invoke MCP tools through the shared capability runtime |
1679
- | `mcp_read_resource` / `mcp_get_prompt` | Read MCP resources and prompts |
1680
-
1681
- ### Git worktree
1682
- | Tool | Description |
1683
- |------|-------------|
1684
- | `worktree_create` | Create a new worktree on an isolated branch for safe agent work |
1685
- | `worktree_remove` | Remove a worktree (with safety checks) |
1686
-
1687
- ### Agent control & UX
1688
- | Tool | Description |
1689
- |------|-------------|
1690
- | `spawn_agent` | Create a named child Actor and start its first Turn under inherited capabilities, session capacity, and root work budget. |
1691
- | `send_message` | Commit bounded information to an Actor mailbox without starting a new Turn. |
1692
- | `followup_task` | Join a running Actor at a safe boundary or atomically start a new Turn for an idle Actor. |
1693
- | `wait_agent` | Yield on scoped mailbox/user/interruption/timeout activity; returns a wake acknowledgement and never uses Actor progress as a model wake source. |
1694
- | `interrupt_agent` | Request interruption of an active Turn while preserving Actor identity. |
1695
- | `list_agents` | Inspect the caller-visible Actor subtree and Turn states. |
1696
- | `agent_output` | Read bounded durable output for an authorized Actor/Turn. |
1697
- | `ask_user_question` | Single/multi-select or free-text prompt back to the user |
1698
- | `exit_plan_mode` | Present a finalized plan only when the active REPL/host supplied an approval callback |
1699
- | `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) |
1700
- | `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). |
1701
-
1702
- ---
1703
-
1704
- ## Skills System
1705
-
1706
- KodaX includes a built-in Skills system that can be triggered by natural language:
1707
-
1708
- ```bash
1709
- # Natural language triggering (no explicit /skill needed)
1710
- kodax "帮我审查代码" # Triggers code-review skill
1711
- kodax "写测试用例" # Triggers tdd skill
1712
- kodax "提交代码" # Triggers git-workflow skill
1713
-
1714
- # Explicit skill command
1715
- kodax /skill:code-review
1716
- ```
1717
-
1718
- Built-in skills include:
1719
- - **code-review** - Code review and quality analysis
1720
- - **tdd** - Test-driven development workflow
1721
- - **git-workflow** - Git commit and workflow automation
1722
-
1723
- Skills are stored in `~/.kodax/skills/` and can be extended with custom skills.
1724
- F263 background learning is Memory-first: a single correction does not create
1725
- a Skill. Repeated independently verified evidence can create a low-risk,
1726
- immutable project-scoped testing revision for at most three exact-revision
1727
- uses. Promotion requires independently verified success. Use `/learn` to
1728
- inspect, disable, rollback, trust, or reject learned revisions. Protected or
1729
- formal Skills, user-global promotion, and Extension authoring remain explicit
1730
- user actions.
1731
-
1732
- ### Promote a learned Skill to the user catalog
1733
-
1734
- Automatic canary activation and user-catalog promotion are different:
1735
-
1736
- - independently verified canary success changes `testing` to
1737
- `active_learned` inside the project-scoped Learned Area;
1738
- - `/learn promote` is an explicit ownership transfer that copies one exact
1739
- reviewed `ready` or `active_learned` revision into the formal user Skill
1740
- catalog and changes its lifecycle to `promoted_user`.
1741
-
1742
- Inspect the revision first, then promote it by name, slug, or exact capability
1743
- ID:
1744
-
1745
- ```text
1746
- /learn show normalize-release-notes
1747
- /learn promote normalize-release-notes --scope user
1748
- ```
1749
-
1750
- `--scope user` is the only supported scope and may be omitted. Invalid scopes,
1751
- unknown options, duplicate scope options, and extra operands fail without
1752
- changing the catalog. Promotion writes to the configured KodaX user Skill
1753
- directory—normally `~/.kodax/skills/<slug>/SKILL.md`—and never overwrites
1754
- different formal Skill content.
1755
-
1756
- Use `/learn promote --help`, `/learn help promote`, or
1757
- `/help learn promote` for the dedicated command reference. In the Ink Learning
1758
- Center, open `/learn`, select an `active_learned` Skill, and choose
1759
- **Promote to user catalog**.
1760
-
1761
- ---
1762
-
1763
- ## Commands (CLI)
1764
-
1765
- Commands are `/xxx` shortcuts in CLI:
1766
-
1767
- ```bash
1768
- kodax /review src/auth.ts
1769
- kodax /test
1770
- ```
1771
-
1772
- Commands are stored in `~/.kodax/commands/`:
1773
- - `.md` files → Prompt commands (content used as prompt)
1774
- - `.ts/.js` files → Programmable commands
1775
-
1776
- ---
1777
-
1778
- ## API Exports
1779
-
1780
- ```typescript
1781
- // Main functions
1782
- export { runKodaX, KodaXClient };
1783
-
1784
- // Types
1785
- export type {
1786
- KodaXEvents, KodaXOptions, KodaXResult,
1787
- KodaXMessage, KodaXContentBlock,
1788
- KodaXSessionStorage, KodaXToolDefinition
1789
- };
1790
-
1791
- // Tools
1792
- export { KODAX_TOOLS, KODAX_TOOL_REQUIRED_PARAMS, executeTool };
1793
-
1794
- // Providers
1795
- export { getProvider, KODAX_PROVIDERS, KodaXBaseProvider };
1796
-
1797
- // Utilities
1798
- export {
1799
- estimateTokens,
1800
- getGitRoot, getGitContext, getEnvContext, getProjectSnapshot,
1801
- checkPromiseSignal
1802
- };
1803
- ```
1804
-
1805
- ---
1806
-
1807
- ## Development
1808
-
1809
- ```bash
1810
- # Development mode (using tsx)
1811
- npm run dev "your task"
1812
-
1813
- # Build
1814
- npm run build
1815
-
1816
- # Optional: only build workspace packages
1817
- npm run build:packages
1818
-
1819
- # Build standalone binary (current platform / all platforms)
1820
- npm run build:binary
1821
- npm run build:binary:all
1822
-
1823
- # Run tests
1824
- npm test
1825
-
1826
- # Eval-driven development tests (provider matrices, identity round-trip, etc.)
1827
- npm run test:eval
1828
-
1829
- # Clean
1830
- npm run clean
1831
- ```
1832
-
1833
- ### Repo Intelligence cache directories
1834
-
1835
- KodaX uses one repo-intelligence cache root with separate built-in engine profiles:
1836
-
1837
- - `.agent/repo-intelligence/`
1838
- - Full-engine repo-intelligence artifacts and existing task-engine snapshots.
1839
- - `.agent/repo-intelligence/light/`
1840
- - Light-mode heuristic index artifacts.
1841
-
1842
- They are intentionally separated so:
1843
-
1844
- - full and light profiles can be rebuilt independently.
1845
- - light-mode confidence/capability state cannot be mistaken for full-engine state.
1846
- - future cache migrations can delete one profile without corrupting the other.
1847
-
1848
- `.agent/repo-intelligence/` is local generated state and should not be committed.
1849
-
1850
- ---
1851
-
1852
- ## Code Style
1853
-
1854
- ### Comment Guidelines
1855
-
1856
- KodaX uses an **English-first** comment style with selective Chinese brief notes for complex logic.
1857
-
1858
- | Situation | Style | Example |
1859
- |-----------|-------|---------|
1860
- | Import/Export | English only | `// Import dependencies` |
1861
- | Simple constants | English only | `// Max retry count` |
1862
- | Simple logic | English only | `// Return if null` |
1863
- | **Business rules** | English + Chinese | `// Skip tool_result - 跳过工具结果块` |
1864
- | **Platform compatibility** | English + Chinese | `// Windows path handling - Windows 路径处理` |
1865
- | **Performance optimization** | English + Chinese | `// Debounce to prevent flicker - 防抖避免闪烁` |
1866
-
1867
- ---
1868
-
1869
- ## Documentation
1870
-
1871
- - [README_CN.md](README_CN.md) - Chinese Documentation
1872
- - [docs/SDK_EMBEDDER_GUIDE.md](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
1873
- - [docs/release.md](docs/release.md) - Standalone binary build & release pipeline
1874
- - [docs/PRD.md](docs/PRD.md) - Product Requirements
1875
- - [docs/ADR.md](docs/ADR.md) - Architecture Decisions
1876
- - [docs/HLD.md](docs/HLD.md) - High-Level Design
1877
- - [docs/DD.md](docs/DD.md) - Detailed Design
1878
- - [docs/FEATURE_LIST.md](docs/FEATURE_LIST.md) - Feature Tracking
1879
- - [docs/test-guides/](docs/test-guides/) - Feature-specific test guides
1880
- - [CHANGELOG.md](CHANGELOG.md) - Version History (v0.7.0+; [archive](docs/CHANGELOG_ARCHIVE.md) for older)
1881
-
1882
- ---
1883
-
1884
- ## License
1885
-
1886
- [KodaX-AI Fair Core License (KAI-FCL) 1.0](LICENSE) - Copyright 2026 [icetomoyo](mailto:icetomoyo@gmail.com).
1887
-
1888
- KAI-FCL is source-available / fair-core, not OSI open source. Commercial,
1889
- enterprise, managed deployment, paid service, or customer redistribution use
1890
- requires KodaX-AI authorization and a valid entitlement where required.
1891
-
1892
- Official KodaX 0.7.70 and later distributions use KAI-FCL or accompanying
1893
- KodaX-AI customer terms. Historical tags, archives, binaries, npm packages, or
1894
- other copies already distributed with Apache-2.0 notices remain Apache-2.0 for
1895
- those specific copies.
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 |
1626
+ | Experimental governed memory | `@kodax-ai/kodax/experimental-memory` | Governed `MemoryAgent` list/remember/forget and scoped `MemorySession` recall/outcome contracts |
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.