@kodax-ai/kodax 0.7.39

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 (82) hide show
  1. package/CHANGELOG.md +1350 -0
  2. package/LICENSE +191 -0
  3. package/README.md +1170 -0
  4. package/README_CN.md +659 -0
  5. package/dist/acp_events.d.ts +109 -0
  6. package/dist/acp_logger.d.ts +20 -0
  7. package/dist/acp_server.d.ts +92 -0
  8. package/dist/builtin/code-review/SKILL.md +63 -0
  9. package/dist/builtin/git-workflow/SKILL.md +84 -0
  10. package/dist/builtin/skill-creator/SKILL.md +122 -0
  11. package/dist/builtin/skill-creator/agents/analyzer.md +12 -0
  12. package/dist/builtin/skill-creator/agents/comparator.md +13 -0
  13. package/dist/builtin/skill-creator/agents/grader.md +13 -0
  14. package/dist/builtin/skill-creator/references/schemas.md +227 -0
  15. package/dist/builtin/skill-creator/scripts/aggregate-benchmark.d.ts +46 -0
  16. package/dist/builtin/skill-creator/scripts/aggregate-benchmark.js +209 -0
  17. package/dist/builtin/skill-creator/scripts/analyze-benchmark.d.ts +46 -0
  18. package/dist/builtin/skill-creator/scripts/analyze-benchmark.js +289 -0
  19. package/dist/builtin/skill-creator/scripts/compare-runs.d.ts +62 -0
  20. package/dist/builtin/skill-creator/scripts/compare-runs.js +333 -0
  21. package/dist/builtin/skill-creator/scripts/generate-review.d.ts +33 -0
  22. package/dist/builtin/skill-creator/scripts/generate-review.js +415 -0
  23. package/dist/builtin/skill-creator/scripts/grade-evals.d.ts +73 -0
  24. package/dist/builtin/skill-creator/scripts/grade-evals.js +405 -0
  25. package/dist/builtin/skill-creator/scripts/improve-description.d.ts +23 -0
  26. package/dist/builtin/skill-creator/scripts/improve-description.js +161 -0
  27. package/dist/builtin/skill-creator/scripts/init-skill.d.ts +14 -0
  28. package/dist/builtin/skill-creator/scripts/init-skill.js +153 -0
  29. package/dist/builtin/skill-creator/scripts/install-skill.d.ts +29 -0
  30. package/dist/builtin/skill-creator/scripts/install-skill.js +176 -0
  31. package/dist/builtin/skill-creator/scripts/package-skill.d.ts +38 -0
  32. package/dist/builtin/skill-creator/scripts/package-skill.js +124 -0
  33. package/dist/builtin/skill-creator/scripts/quick-validate.d.ts +8 -0
  34. package/dist/builtin/skill-creator/scripts/quick-validate.js +166 -0
  35. package/dist/builtin/skill-creator/scripts/run-eval.d.ts +66 -0
  36. package/dist/builtin/skill-creator/scripts/run-eval.js +356 -0
  37. package/dist/builtin/skill-creator/scripts/run-loop.d.ts +49 -0
  38. package/dist/builtin/skill-creator/scripts/run-loop.js +243 -0
  39. package/dist/builtin/skill-creator/scripts/run-trigger-eval.d.ts +58 -0
  40. package/dist/builtin/skill-creator/scripts/run-trigger-eval.js +225 -0
  41. package/dist/builtin/skill-creator/scripts/utils.js +273 -0
  42. package/dist/builtin/tdd/SKILL.md +56 -0
  43. package/dist/chunks/chunk-4E76FLZ3.js +2 -0
  44. package/dist/chunks/chunk-7LQ2NCHF.js +1221 -0
  45. package/dist/chunks/chunk-HUAU4KB3.js +2 -0
  46. package/dist/chunks/chunk-N2VZ2MJF.js +11 -0
  47. package/dist/chunks/chunk-SF7WD7E5.js +2 -0
  48. package/dist/chunks/chunk-SONW6AC7.js +14 -0
  49. package/dist/chunks/chunk-WEEQZYZS.js +460 -0
  50. package/dist/chunks/chunk-XI75LZIO.js +30 -0
  51. package/dist/chunks/compaction-config-YL4SWWII.js +2 -0
  52. package/dist/chunks/construction-bootstrap-XSE7ZABG.js +5 -0
  53. package/dist/chunks/devtools-MOFU7YQF.js +2 -0
  54. package/dist/chunks/dist-AMUYI7R5.js +2 -0
  55. package/dist/chunks/dist-WKW4CBG6.js +2 -0
  56. package/dist/chunks/utils-3HW4KOGE.js +2 -0
  57. package/dist/cli_commands.d.ts +17 -0
  58. package/dist/cli_option_helpers.d.ts +49 -0
  59. package/dist/cli_option_helpers.test.d.ts +1 -0
  60. package/dist/constructed_cli.d.ts +82 -0
  61. package/dist/constructed_cli.test.d.ts +1 -0
  62. package/dist/index.d.ts +10 -0
  63. package/dist/index.js +9 -0
  64. package/dist/kodax_cli.d.ts +7 -0
  65. package/dist/kodax_cli.js +1882 -0
  66. package/dist/sdk-agent.d.ts +15 -0
  67. package/dist/sdk-agent.js +2 -0
  68. package/dist/sdk-coding.d.ts +20 -0
  69. package/dist/sdk-coding.js +2 -0
  70. package/dist/sdk-llm.d.ts +15 -0
  71. package/dist/sdk-llm.js +2 -0
  72. package/dist/sdk-repl.d.ts +21 -0
  73. package/dist/sdk-repl.js +2 -0
  74. package/dist/sdk-skills.d.ts +16 -0
  75. package/dist/sdk-skills.js +2 -0
  76. package/dist/self_modify_cli.d.ts +81 -0
  77. package/dist/self_modify_cli.test.d.ts +9 -0
  78. package/dist/skill_cli.d.ts +15 -0
  79. package/dist/skill_cli.test.d.ts +1 -0
  80. package/package.json +143 -0
  81. package/scripts/kodax-bin.cjs +27 -0
  82. package/scripts/production-env.cjs +16 -0
package/README.md ADDED
@@ -0,0 +1,1170 @@
1
+ # KodaX
2
+
3
+ Extreme Lightweight Coding Agent - TypeScript Implementation
4
+
5
+ ## Overview
6
+
7
+ KodaX is a **modular, lightweight AI coding agent** built with TypeScript. It supports **12 LLM providers**, works as both a CLI tool and a library, ships an optional **Node-free standalone binary**, and includes a Scout-first adaptive multi-agent workflow for long-running coding tasks.
8
+
9
+ **Core Philosophy**: Transparent, Flexible, Minimalist
10
+
11
+ **Why KodaX?**
12
+
13
+ | Question | KodaX answer |
14
+ |---------|--------------|
15
+ | Why not only use Claude Code? | KodaX is easier to inspect, modify, self-host, and switch across providers. |
16
+ | Why not only use an SDK? | KodaX already gives you a CLI, sessions, tools, permissions, and skills out of the box. |
17
+ | Why use it as a codebase? | The architecture is small enough to understand and customize without wading through thousands of files. |
18
+ | Why use it in production tools? | The packages are separated cleanly, so you can reuse only the layer you need. |
19
+
20
+ **KodaX vs hosted coding assistants**
21
+
22
+ | Feature | KodaX | Typical hosted coding assistant |
23
+ |---------|-------|----------------------------------|
24
+ | **Architecture** | Modular (5 packages), library-friendly | Usually product-first, less reusable as code |
25
+ | **Provider choice** | 12 providers (incl. Anthropic, OpenAI, DeepSeek, Kimi, Qwen, Zhipu, MiniMax, MiMo, Gemini CLI, Codex CLI) + custom OpenAI/Anthropic-compatible providers | Often optimized for one provider |
26
+ | **Customization** | Edit prompts, tools, skills, session flow directly | Limited extension surface |
27
+ | **Codebase clarity** | Small TypeScript monorepo | Often much larger and harder to trace |
28
+ | **Distribution** | npm install / global link / **standalone binary** (Bun --compile, no Node required on target) | Closed-source installer or web app |
29
+ | **Learning value** | Good for understanding agent internals | More black-box |
30
+
31
+ ## Quick Start
32
+
33
+ ### 1. Install and build the CLI
34
+
35
+ ```bash
36
+ git clone https://github.com/icetomoyo/KodaX.git
37
+ cd KodaX
38
+ npm install
39
+ npm run build
40
+ npm link
41
+ ```
42
+
43
+ ### 2. Configure a provider
44
+
45
+ KodaX reads API keys from environment variables. For built-in providers, the fastest path is:
46
+
47
+ ```bash
48
+ # macOS / Linux
49
+ export ZHIPU_API_KEY=your_api_key
50
+
51
+ # PowerShell
52
+ $env:ZHIPU_API_KEY="your_api_key"
53
+ ```
54
+
55
+ For CLI defaults, create `~/.kodax/config.json`:
56
+
57
+ ```json
58
+ {
59
+ "provider": "zhipu-coding",
60
+ "reasoningMode": "auto"
61
+ }
62
+ ```
63
+
64
+ If you need a custom base URL or an OpenAI/Anthropic-compatible endpoint, define a custom provider in the same config file:
65
+
66
+ ```json
67
+ {
68
+ "provider": "my-openai-compatible",
69
+ "customProviders": [
70
+ {
71
+ "name": "my-openai-compatible",
72
+ "protocol": "openai",
73
+ "baseUrl": "https://example.com/v1",
74
+ "apiKeyEnv": "MY_LLM_API_KEY",
75
+ "model": "my-model",
76
+ "userAgentMode": "compat"
77
+ }
78
+ ]
79
+ }
80
+ ```
81
+
82
+ `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.
83
+
84
+ ### 3. Start in REPL or run a one-shot task
85
+
86
+ ```bash
87
+ # Interactive REPL
88
+ kodax
89
+
90
+ # Then ask naturally inside the REPL
91
+ Read package.json and summarize the architecture
92
+ /mode
93
+ /help
94
+
95
+ # One-shot CLI usage
96
+ kodax "Review this repository and summarize the architecture"
97
+ kodax --session review "Find the riskiest parts of src/"
98
+ kodax --session review "Give me concrete fix suggestions"
99
+ ```
100
+
101
+ ### 4. Use it as a library
102
+
103
+ Library usage still expects API keys from environment variables. If you want custom provider names or base URLs in code, register them explicitly:
104
+
105
+ ```typescript
106
+ import { registerCustomProviders, runKodaX } from '@kodax-ai/kodax';
107
+
108
+ registerCustomProviders([
109
+ {
110
+ name: 'my-openai-compatible',
111
+ protocol: 'openai',
112
+ baseUrl: 'https://example.com/v1',
113
+ apiKeyEnv: 'MY_LLM_API_KEY',
114
+ model: 'my-model',
115
+ userAgentMode: 'compat',
116
+ },
117
+ ]);
118
+
119
+ const result = await runKodaX(
120
+ {
121
+ provider: 'my-openai-compatible',
122
+ reasoningMode: 'auto',
123
+ },
124
+ 'Explain this codebase'
125
+ );
126
+ ```
127
+
128
+ ## Core Workflows
129
+
130
+ - **CLI coding assistant**: run one-off tasks or stay in a session for multi-step work.
131
+ - **Skills-driven workflows**: trigger built-in or custom skills from natural language.
132
+ - **Project Mode / harness engineering**: bootstrap a long-running project, keep project truth on disk, and execute through verifier-gated `/project` flows.
133
+ - **Embeddable library**: reuse the provider layer, session layer, or full coding agent in your own app.
134
+
135
+ ## Repo Intelligence Premium
136
+
137
+ KodaX now supports a split repo-intelligence architecture:
138
+
139
+ - **Public OSS baseline** lives in the public `KodaX` repo and keeps `CLI`, `REPL`, `ACP`, library imports, and repo-aware tools working even when no premium component is installed.
140
+ - **Premium intelligence** lives in the sibling private repo `KodaX-private` and runs through the local `repointel` daemon / CLI frontdoor.
141
+ - **KodaX native mode** is the flagship experience. It can prefetch repo intelligence before routing and prompt building, while other hosts such as Codex / Claude Code / OpenCode use the same premium tool through thin skills.
142
+
143
+ ### Runtime modes
144
+
145
+ KodaX supports these repo-intelligence modes:
146
+
147
+ - `off`: strict benchmark baseline. Disable the repo-intelligence working plane entirely while keeping `/repointel` control commands available.
148
+ - `oss`: use only the public OSS baseline.
149
+ - `premium-shared`: use the premium engine, but without the native KodaX auto lane. This is useful for comparing KodaX against other hosts.
150
+ - `premium-native`: use the premium engine through the KodaX native bridge. This is the best local experience.
151
+ - `auto`: user-facing convenience mode. KodaX resolves it to `premium-native` when the premium daemon is reachable, otherwise it falls back to `oss`.
152
+
153
+ ### Quick usage
154
+
155
+ Run KodaX with explicit repo-intelligence mode flags:
156
+
157
+ ```bash
158
+ # OSS baseline only
159
+ kodax --repo-intelligence oss
160
+
161
+ # Premium native mode with trace output
162
+ kodax --repo-intelligence premium-native --repo-intelligence-trace
163
+
164
+ # Compare against the shared premium path
165
+ kodax --repo-intelligence premium-shared --repo-intelligence-trace
166
+ ```
167
+
168
+ You can also set the same behavior through config or environment variables:
169
+
170
+ ```powershell
171
+ $env:KODAX_REPO_INTELLIGENCE_MODE = "premium-native"
172
+ $env:KODAX_REPO_INTELLIGENCE_TRACE = "1"
173
+ $env:KODAX_REPOINTEL_BIN = "C:\Tools\repointel\repointel.exe"
174
+ ```
175
+
176
+ Official `KodaX-private` releases should now publish only the native `repointel` package. The older offline bundle remains useful for internal/manual validation, but it should not be the normal end-user release artifact.
177
+
178
+ ### REPL mode
179
+
180
+ It is not CLI-only. REPL mode supports the same repo-intelligence runtime modes.
181
+
182
+ The most direct premium-native REPL flow is:
183
+
184
+ ```powershell
185
+ Set-Location <path-to-your-KodaX-clone>
186
+ kodax --repo-intelligence premium-native --repo-intelligence-trace
187
+ ```
188
+
189
+ If you save the premium settings in `~/.kodax/config.json`, plain REPL startup is enough:
190
+
191
+ ```powershell
192
+ kodax
193
+ ```
194
+
195
+ Inside REPL, repo intelligence is still consumed automatically by the normal KodaX flow, and there are also lightweight status/control commands:
196
+
197
+ - `/status`: shows a compact repo-intelligence summary together with the normal session status output.
198
+ - `/repointel` or `/repointel status`: shows the current repo-intelligence state in more detail.
199
+ - `/repointel mode premium-native|premium-shared|oss|off|auto`: switches the current mode and writes it back to user config.
200
+ - `/repointel trace on|off|toggle`: turns repo-intelligence trace output on or off.
201
+ - `/repointel warm`: tries to warm or start the local premium service. If it cannot be started, KodaX reports the failure clearly and continues with the normal fallback path.
202
+
203
+ The most important fields to watch are:
204
+
205
+ - `mode`: the resolved runtime mode, such as `oss`, `premium-shared`, or `premium-native`
206
+ - `engine`: the actual engine in use, `oss` or `premium`
207
+ - `bridge`: `none`, `shared`, or `native`
208
+ - `status`: typically `ok`, `limited`, or `unavailable`
209
+
210
+ The practical difference between the two premium modes is:
211
+
212
+ - `premium-native`: the flagship KodaX path. KodaX can prefetch and inject repo intelligence earlier in its native runtime flow.
213
+ - `premium-shared`: still uses premium, but intentionally avoids the KodaX-native auto lane so you can compare against the shared multi-host path.
214
+ - `oss`: keep the public baseline repo tools and OSS intelligence only.
215
+ - `off`: strict disable for repo-intelligence working tools and auto injection. `/repointel` remains available as the control plane.
216
+
217
+ ### User-level config
218
+
219
+ Repo-intelligence premium settings are supported in the user config file `~/.kodax/config.json`.
220
+
221
+ Supported fields:
222
+
223
+ - `repoIntelligenceMode`
224
+ - `repointelEndpoint`
225
+ - `repointelBin`
226
+ - `repoIntelligenceTrace`
227
+
228
+ Recommended end-user example when `repointel` is installed but not on `PATH`:
229
+
230
+ ```json
231
+ {
232
+ "provider": "zhipu-coding",
233
+ "reasoningMode": "auto",
234
+ "repoIntelligenceMode": "premium-native",
235
+ "repointelBin": "C:\\Tools\\repointel\\repointel.exe",
236
+ "repoIntelligenceTrace": false
237
+ }
238
+ ```
239
+
240
+ For normal user installs, the preferred setup is to install the premium tool so the `repointel` command is already on `PATH`, in which case this is usually enough:
241
+
242
+ ```json
243
+ {
244
+ "repoIntelligenceMode": "premium-native"
245
+ }
246
+ ```
247
+
248
+ If `repointel` is not on `PATH`, `repointelBin` can point to the installed native executable, for example:
249
+
250
+ ```json
251
+ {
252
+ "repoIntelligenceMode": "premium-native",
253
+ "repointelBin": "C:\\Tools\\repointel\\repointel.exe"
254
+ }
255
+ ```
256
+
257
+ For author same-parent local development, it is still valid to point `repointelBin` at the sibling private source build:
258
+
259
+ ```json
260
+ {
261
+ "repoIntelligenceMode": "premium-native",
262
+ "repointelEndpoint": "http://127.0.0.1:47891",
263
+ "repointelBin": "C:\\path\\to\\KodaX-private\\packages\\repointel-cli\\dist\\index.js",
264
+ "repoIntelligenceTrace": true
265
+ }
266
+ ```
267
+
268
+ `repointelEndpoint` is optional in normal installs. It only tells KodaX which local premium daemon address to use, and the default `http://127.0.0.1:47891` is usually enough unless you deliberately run a non-default endpoint.
269
+
270
+ For same-parent author local development, `repointelBin` can still point to the sibling private build output.
271
+
272
+ These config values are loaded by both CLI mode and REPL mode, and they are bridged into the runtime environment automatically.
273
+
274
+ ### Config template
275
+
276
+ The repo now includes a user-facing config template:
277
+
278
+ - `config.example.jsonc`
279
+
280
+ Copy it to `~/.kodax/config.json`, then adjust provider and repo-intelligence settings as needed.
281
+
282
+ ### Local same-parent development
283
+
284
+ The intended phase-1 development layout is to clone both repos under the same parent directory, for example:
285
+
286
+ - Public repo: `<parent>/KodaX`
287
+ - Private repo: `<parent>/KodaX-private`
288
+
289
+ Typical local workflow:
290
+
291
+ ```powershell
292
+ # 1. Build the public repo
293
+ Set-Location <parent>\KodaX
294
+ npm install
295
+ npm run build
296
+
297
+ # 2. Build the private premium repo
298
+ Set-Location <parent>\KodaX-private
299
+ npm install
300
+ npm run build
301
+
302
+ # 3. Warm or start the premium daemon
303
+ node .\packages\repointel-cli\dist\index.js warm "{}"
304
+
305
+ # 4. Run KodaX in premium-native mode
306
+ Set-Location <parent>\KodaX
307
+ npm run dev -- --repo-intelligence premium-native --repo-intelligence-trace
308
+ ```
309
+
310
+ ### How KodaX behaves after the split
311
+
312
+ - If premium is unavailable, KodaX automatically falls back to the OSS baseline. Startup, imports, and public tools keep working.
313
+ - If premium is available, `premium-native` uses the daemon client directly and injects repo intelligence earlier than shared-host integrations.
314
+ - Trace-enabled runs can be used to compare `off`, `oss`, `premium-shared`, and `premium-native` on the same task, including mode, engine, bridge, daemon latency, cache hits, and capsule token estimates.
315
+
316
+ ### External hosts
317
+
318
+ Codex, Claude Code, and OpenCode are intentionally thinner in phase 1:
319
+
320
+ - they install the shared Repointel skill
321
+ - they call the same local premium tool
322
+ - they do **not** ship a separate OSS fallback engine
323
+
324
+ Install the shared thin skill from the public repo:
325
+
326
+ ```powershell
327
+ # Cross-platform primary entrypoint
328
+ node .\clients\repointel\scripts\install.mjs --host codex
329
+ node .\clients\repointel\scripts\install.mjs --host claude --workspace-root C:\path\to\workspace
330
+ node .\clients\repointel\scripts\install.mjs --host opencode --workspace-root C:\path\to\workspace
331
+ ```
332
+
333
+ Useful helper scripts:
334
+
335
+ - `clients/repointel/scripts/demo.mjs`: run a local premium demo flow against a temporary endpoint.
336
+ - `clients/repointel/scripts/doctor.mjs`: inspect local premium setup, bridge status, daemon reachability, and host skill installation.
337
+ - `clients/repointel/scripts/install.mjs`: install the shared thin skill into Codex / Claude / OpenCode host paths.
338
+
339
+ The installable shared skill itself lives at:
340
+
341
+ - `clients/repointel/SKILL.md`
342
+
343
+ ## Architecture
344
+
345
+ KodaX uses a **monorepo architecture** with npm workspaces. Source layout has 9 workspace packages; published as a single bundled npm package `@kodax-ai/kodax` with 5 SDK subpath exports (ADR-022 + ADR-024, v0.7.39):
346
+
347
+ ```
348
+ KodaX/
349
+ ├── packages/
350
+ │ ├── ai/ # @kodax-ai/llm - LLM abstraction (12 providers)
351
+ │ │ └── providers/ # Anthropic, OpenAI, DeepSeek, Kimi, MiMo, MiniMax, Zhipu, Ark, …
352
+ │ │
353
+ │ ├── agent/ # @kodax-ai/agent - Generic Agent framework
354
+ │ │ └── orchestration/ # Runner, runFanOut, runWithIdleYield, ChildTaskRegistry
355
+ │ │
356
+ │ ├── skills/ # @kodax-ai/skills - Skills standard implementation
357
+ │ │ └── builtin/ # Built-in skills (code-review, tdd, git-workflow)
358
+ │ │
359
+ │ ├── coding/ # @kodax-ai/coding - Coding Agent (tools + prompts)
360
+ │ │ └── tools/ # 30+ tools: read, write, edit, bash, glob, grep, undo,
361
+ │ │ # dispatch_child_task, send_message, task_stop,
362
+ │ │ # ask_user_question, repo-intelligence, …
363
+ │ │
364
+ │ ├── repl/ # @kodax-ai/repl - Interactive terminal UI (Ink TUI)
365
+ │ ├── mcp/ # @kodax-ai/mcp - MCP integration
366
+ │ ├── repointel-protocol/ # @kodax-ai/repointel-protocol - repo-intel protocol
367
+ │ ├── session-lineage/ # @kodax-ai/session-lineage - branchable session tree
368
+ │ └── tracing/ # @kodax-ai/tracing - tracing / observability
369
+
370
+ ├── src/ # CLI entry + 5 SDK subpath entries (sdk-{agent,llm,coding,repl,skills}.ts)
371
+ │ ├── kodax_cli.ts # Main CLI entry point (bin: `kodax`)
372
+ │ └── sdk-*.ts # SDK subpath re-exports → @kodax-ai/kodax/{agent,llm,coding,repl,skills}
373
+
374
+ └── package.json # Root workspace config; release.mjs rewrites name + injects subpath exports
375
+ ```
376
+
377
+ ### Package Dependencies
378
+
379
+ ```
380
+ ┌──────────────────┐
381
+ │ kodax (root) │
382
+ │ CLI Entry │
383
+ └────────┬─────────┘
384
+
385
+ ┌──────────────┴──────────────┐
386
+ │ │
387
+ ▼ ▼
388
+ ┌──────────────┐ ┌────────────────┐
389
+ │@kodax-ai/repl│ │@kodax-ai/coding│
390
+ │ UI Layer │ │ Tools+Prompts │
391
+ └──────┬───────┘ └──────┬─────────┘
392
+ │ │
393
+ │ ┌──────────────┼──────────────┐
394
+ │ │ │ │
395
+ ▼ ▼ ▼ ▼
396
+ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌─────────────┐
397
+ │@kodax-ai/ │ │@kodax-ai/ │ │@kodax-ai/llm │ │ External │
398
+ │skills │ │agent │ │LLM Abstract │ │ SDKs │
399
+ │(zero deps) │ │Runner + │ │(12 providers)│ │ │
400
+ │ │ │fan-out + │ │ │ │ │
401
+ │ │ │idle-yield │ │ │ │ │
402
+ └──────────────┘ └──────────────┘ └──────────────┘ └─────────────┘
403
+ ```
404
+
405
+ ### Package Overview
406
+
407
+ Source-side workspace package names (`@kodax-ai/*`). npm consumers install the single bundled `@kodax-ai/kodax` package and import from SDK subpaths — see [SDK Usage](#sdk-usage) below.
408
+
409
+ | Workspace package | Purpose | Key Dependencies |
410
+ |---------|---------|------------------|
411
+ | `@kodax-ai/llm` | LLM abstraction (12 providers + custom registration) | @anthropic-ai/sdk, openai |
412
+ | `@kodax-ai/agent` | Generic Agent framework — Runner, fan-out, idle-yield, session, tokenization (ADR-021 standalone-consumable) | @kodax-ai/llm, js-tiktoken |
413
+ | `@kodax-ai/skills` | Skills standard implementation | Zero external deps |
414
+ | `@kodax-ai/coding` | Coding Agent — 30+ tools (incl. `dispatch_child_task` / `send_message` / `task_stop`) + role prompts + auto-continue | @kodax-ai/llm, @kodax-ai/agent, @kodax-ai/skills |
415
+ | `@kodax-ai/repl` | Complete interactive terminal UI (Ink/React, permission modes, commands, streaming) | @kodax-ai/coding, ink, react |
416
+
417
+ ---
418
+
419
+ ## Features
420
+
421
+ - **Modular Architecture** - Use as CLI, as a library, or as a Node-free single binary
422
+ - **12 LLM Providers** - Anthropic, OpenAI, DeepSeek, Kimi, Kimi Code, Qwen, Zhipu, Zhipu Coding, MiniMax Coding, MiMo Coding (Xiaomi Token Plan), Gemini CLI, Codex CLI — plus user-defined OpenAI/Anthropic-compatible providers
423
+ - **Worker + Evaluator AMA (V2, default)** - Adaptive multi-agent with H0/H1/H2 harness levels. Worker single-loop replaces the V1 Scout/Planner/Generator chain (FEATURE_114, v0.7.36); structural Evaluator gate preserved. Async child steering via `dispatch_child_task` + `send_message` + `task_stop` with idle-yield wait (FEATURE_120 / FEATURE_155, v0.7.39).
424
+ - **Reasoning Modes** - Unified `off/auto/quick/balanced/deep` interface across providers
425
+ - **Streaming Output** - Real-time response display
426
+ - **Session Management** - JSONL format with branchable session lineage tree
427
+ - **Skills System** - Natural language triggering, extensible, role-projected in AMA
428
+ - **Repo Intelligence** - OSS baseline + optional `repointel` premium engine, with native KodaX auto-injection lane
429
+ - **Rich Tool Surface** - 30+ built-in tools across file ops, shell, search, repo intelligence, MCP capabilities, git worktree, and agent control
430
+ - **Permission Control** - 3 permission modes with pattern-based control
431
+ - **Standalone Binary** - `bun --compile` releases for Win/macOS/Linux x64+arm64, no Node.js required on target machines
432
+ - **Cross-Platform** - Windows/macOS/Linux
433
+ - **TypeScript Native** - Full type safety and IDE support
434
+
435
+ ---
436
+
437
+ ## Installation
438
+
439
+ ### As CLI Tool
440
+
441
+ ```bash
442
+ # Clone repository
443
+ git clone https://github.com/icetomoyo/KodaX.git
444
+ cd KodaX
445
+
446
+ # Install dependencies (includes workspace packages)
447
+ npm install
448
+
449
+ # Build the monorepo
450
+ npm run build
451
+
452
+ # Link globally (development mode)
453
+ npm link
454
+
455
+ # Now you can use 'kodax' anywhere
456
+ kodax "your task"
457
+ ```
458
+
459
+ ### As Standalone Binary (no Node required on target)
460
+
461
+ 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.
462
+
463
+ Supported targets: `win-x64`, `linux-x64`, `linux-arm64`, `darwin-x64`, `darwin-arm64`. Win7 / pre-glibc-2.27 distros / LoongArch are not supported.
464
+
465
+ **Build locally**:
466
+
467
+ ```bash
468
+ # Install Bun once on your build machine
469
+ npm i -g bun # or scoop/brew/curl install — see docs/release.md
470
+
471
+ npm run build:binary # Current host platform (fastest)
472
+ npm run build:binary:all # All five targets in sequence
473
+ node scripts/build-binary.mjs --target=linux-arm64 # Specific target
474
+ ```
475
+
476
+ Output lives under `dist/binary/<target>/`:
477
+
478
+ ```
479
+ dist/binary/linux-x64/
480
+ ├── kodax # ~60 MB Bun-compiled executable
481
+ └── builtin/ # Sidecar built-in skills
482
+ ```
483
+
484
+ Smoke-test: `dist/binary/<host>/kodax --version`.
485
+
486
+ **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.
487
+
488
+ 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.
489
+
490
+ ### As Library
491
+
492
+ ```bash
493
+ npm install @kodax-ai/kodax
494
+ ```
495
+
496
+ ```typescript
497
+ import { runKodaX } from '@kodax-ai/kodax';
498
+
499
+ process.env.ZHIPU_API_KEY = process.env.ZHIPU_API_KEY ?? 'your_api_key';
500
+
501
+ const result = await runKodaX({
502
+ provider: 'zhipu-coding',
503
+ reasoningMode: 'auto',
504
+ events: {
505
+ onTextDelta: (text) => process.stdout.write(text),
506
+ onComplete: () => console.log('\nDone!'),
507
+ },
508
+ }, 'your task');
509
+
510
+ console.log(result.lastText);
511
+ ```
512
+
513
+ #### SDK Subpath Imports (v0.7.39+)
514
+
515
+ For smaller surface and tree-shake-friendly imports, the SDK is also exposed via subpath exports — pick only the package(s) you need:
516
+
517
+ ```typescript
518
+ import { Runner } from '@kodax-ai/kodax/agent'; // agent runtime
519
+ import { createProvider } from '@kodax-ai/kodax/llm'; // LLM abstraction (12 providers)
520
+ import { runKodaX } from '@kodax-ai/kodax/coding'; // coding tools + prompts
521
+ import { SkillRegistry } from '@kodax-ai/kodax/skills'; // zero-dep skill loader
522
+ import { loadConfig } from '@kodax-ai/kodax/repl'; // REPL config / session helpers
523
+ ```
524
+
525
+ All 6 entries (root + 5 subpaths) share internal code via ESM chunk splitting — importing from `/agent` does not pull in `/repl`'s Ink + React surface.
526
+
527
+ 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.
528
+
529
+ ---
530
+
531
+ ## Usage
532
+
533
+ ### REPL Quickstart
534
+
535
+ Running `kodax` with no prompt starts the interactive REPL.
536
+
537
+ ```bash
538
+ kodax
539
+ ```
540
+
541
+ Inside the REPL you can type normal requests or slash commands:
542
+
543
+ ```text
544
+ Read package.json and summarize the architecture
545
+ /model
546
+ /mode
547
+ /help
548
+ ```
549
+
550
+ ### CLI Quickstart
551
+
552
+ ```bash
553
+ # Set API key
554
+ export ZHIPU_API_KEY=your_api_key
555
+
556
+ # Basic usage
557
+ kodax "Help me create a TypeScript project"
558
+
559
+ # Choose a provider explicitly
560
+ kodax --provider openai --model gpt-5.4 "Create a REST API"
561
+
562
+ # Use a deeper reasoning mode
563
+ kodax --reasoning deep "Review this architecture"
564
+ ```
565
+
566
+ ### Session Workflows
567
+
568
+ Use a session when you want memory across turns. Without a session, each CLI call is independent.
569
+
570
+ ```bash
571
+ # No memory: two separate calls
572
+ kodax "Read src/auth.ts"
573
+ kodax "Summarize it"
574
+
575
+ # With memory: same session
576
+ kodax --session my-project "Read package.json"
577
+ kodax --session my-project "Summarize it"
578
+ kodax --session my-project "How should I fix the first issue?"
579
+
580
+ # Session management
581
+ kodax --session list
582
+ kodax --session resume "continue"
583
+ ```
584
+
585
+ ### Session Patterns
586
+
587
+ ```bash
588
+ # ❌ No memory: two independent calls
589
+ kodax "Read src/auth.ts" # Agent reads and responds
590
+ kodax "Summarize it" # Agent doesn't know what to summarize
591
+
592
+ # ✅ With memory: same session
593
+ kodax --session auth-review "Read src/auth.ts"
594
+ kodax --session auth-review "Summarize it" # Agent knows to summarize auth.ts
595
+ kodax --session auth-review "How to fix first issue" # Agent has context
596
+ ```
597
+
598
+ ### Workflow Examples
599
+
600
+ ```bash
601
+ # Code review (multi-turn conversation)
602
+ kodax --session review "Review src/ directory"
603
+ kodax --session review "Focus on security issues"
604
+ kodax --session review "Give me fix suggestions"
605
+
606
+ # Project development (continuous session)
607
+ kodax --session todo-app "Create a Todo application"
608
+ kodax --session todo-app "Add delete functionality"
609
+ kodax --session todo-app "Write tests"
610
+ ```
611
+
612
+ ### CLI Reference
613
+
614
+ ```text
615
+ kodax Start the interactive REPL
616
+ -h, --help [topic] Show help or topic help
617
+ -p, --print <text> Run a single task and exit
618
+ -c, --continue Continue the most recent conversation in this directory
619
+ -r, --resume [id] Resume a session by ID, or the latest session
620
+ -m, --provider Provider to use
621
+ --model <name> Override the model
622
+ --reasoning <mode> off | auto | quick | balanced | deep
623
+ -t, --thinking Compatibility alias for --reasoning auto
624
+ -s, --session <op> Session ID or legacy session operation
625
+ -j, --parallel Enable parallel tool execution
626
+ --max-iter <n> Max iterations
627
+ ```
628
+
629
+ ### Permission Control
630
+
631
+ KodaX provides 3 permission modes for fine-grained control:
632
+
633
+ | Mode | Description | Tools Need Confirmation |
634
+ |------|-------------|------------------------|
635
+ | `plan` | Read-only planning mode | All modification tools blocked |
636
+ | `accept-edits` | Auto-accept file edits | bash only |
637
+ | `auto-in-project` | Full auto within project | None (project-scoped) |
638
+
639
+ ```bash
640
+ # In REPL, use /mode command
641
+ /mode plan # Switch to plan mode (read-only)
642
+ /mode accept-edits # Switch to accept-edits mode
643
+ /mode auto-in-project # Switch to auto-in-project mode
644
+ /auto # Alias for auto-in-project
645
+
646
+ # Check current mode
647
+ /mode
648
+ ```
649
+
650
+ **Features:**
651
+ - In `accept-edits` mode, choosing "always" can persist safe Bash allow-patterns
652
+ - Plan mode includes system prompt context for LLM awareness
653
+ - Permanent protection zones: `.kodax/`, `~/.kodax/`, paths outside project
654
+ - Pattern-based permission: Allow specific Bash commands (e.g., `Bash(npm install)`)
655
+ - Unified diff display for write/edit operations
656
+
657
+ ### CLI Help Topics
658
+
659
+ Get detailed help for specific topics:
660
+
661
+ ```bash
662
+ # Basic help
663
+ kodax -h
664
+ kodax --help
665
+
666
+ # Detailed topic help
667
+ kodax -h sessions # Session management details
668
+ kodax -h init # Long-running project initialization
669
+ kodax -h project # Project mode / harness workflow
670
+ kodax -h auto # Auto-continue mode
671
+ kodax -h provider # LLM provider configuration
672
+ kodax -h thinking # Thinking/reasoning mode
673
+ kodax -h team # Multi-agent parallel execution
674
+ kodax -h print # Print configuration
675
+ ```
676
+
677
+ ## Advanced Library Usage
678
+
679
+ #### Simple Mode (runKodaX)
680
+
681
+ ```typescript
682
+ import { runKodaX, KodaXEvents } from '@kodax-ai/kodax';
683
+
684
+ const events: KodaXEvents = {
685
+ onTextDelta: (text) => process.stdout.write(text),
686
+ onThinkingDelta: (text) => console.log(`Thinking delta: ${text.length} chars`),
687
+ onToolResult: (result) => console.log(`Tool ${result.name}: ${result.content.slice(0, 100)}`),
688
+ onComplete: () => console.log('\nDone!'),
689
+ onError: (e) => console.error(e.message),
690
+ };
691
+
692
+ const result = await runKodaX({
693
+ provider: 'zhipu-coding',
694
+ reasoningMode: 'auto',
695
+ events,
696
+ }, 'What is 1+1?');
697
+
698
+ console.log(result.lastText);
699
+ ```
700
+
701
+ #### Continuous Session (KodaXClient)
702
+
703
+ ```typescript
704
+ import { KodaXClient } from '@kodax-ai/kodax';
705
+
706
+ const client = new KodaXClient({
707
+ provider: 'zhipu-coding',
708
+ reasoningMode: 'auto',
709
+ events: {
710
+ onTextDelta: (t) => process.stdout.write(t),
711
+ },
712
+ });
713
+
714
+ // First message
715
+ await client.send('Read package.json');
716
+
717
+ // Continue same session
718
+ await client.send('Summarize it');
719
+
720
+ console.log(client.getSessionId());
721
+ ```
722
+
723
+ #### Custom Session Storage
724
+
725
+ ```typescript
726
+ import { runKodaX, KodaXSessionStorage, KodaXMessage } from '@kodax-ai/kodax';
727
+
728
+ class MyDatabaseStorage implements KodaXSessionStorage {
729
+ async save(id: string, data: { messages: KodaXMessage[]; title: string; gitRoot: string }) {
730
+ // Save to your database
731
+ }
732
+ async load(id: string) {
733
+ // Load from your database
734
+ return null;
735
+ }
736
+ }
737
+
738
+ await runKodaX({
739
+ provider: 'zhipu-coding',
740
+ session: {
741
+ id: 'my-session-123',
742
+ storage: new MyDatabaseStorage(),
743
+ },
744
+ events: { ... },
745
+ }, 'task');
746
+ ```
747
+
748
+ ### Library Modes Comparison
749
+
750
+ | Feature | runKodaX | KodaXClient |
751
+ |---------|----------|-------------|
752
+ | **Message Memory** | ❌ No | ✅ Yes |
753
+ | **Call Style** | Function | Class instance |
754
+ | **Context** | Independent each time | Accumulates |
755
+ | **Use Case** | Single tasks, batch processing | Interactive dialogue, multi-step tasks |
756
+
757
+ ---
758
+
759
+ ## SDK Usage
760
+
761
+ KodaX ships as a single npm package `@kodax-ai/kodax` with 5 SDK subpath exports (ADR-024, v0.7.39). Each subpath is tree-shake-friendly so consumers pull only what they need:
762
+
763
+ ```bash
764
+ npm install @kodax-ai/kodax
765
+ ```
766
+
767
+ ```typescript
768
+ import { runKodaX } from '@kodax-ai/kodax'; // root: CLI helpers + runKodaX
769
+ import { Runner, runFanOut } from '@kodax-ai/kodax/agent'; // generic Agent framework
770
+ import { getProvider } from '@kodax-ai/kodax/llm'; // 12-provider LLM abstraction
771
+ import { KODAX_TOOLS } from '@kodax-ai/kodax/coding'; // tools + prompts + agent loop
772
+ import { InkREPL } from '@kodax-ai/kodax/repl'; // Ink TUI components
773
+ import { SkillRegistry } from '@kodax-ai/kodax/skills'; // zero-dep skill loader
774
+ ```
775
+
776
+ ### `@kodax-ai/kodax/llm` — LLM Abstraction
777
+
778
+ 12 built-in providers (Anthropic, OpenAI, DeepSeek, Kimi, Kimi-Code, Qwen, Zhipu, Zhipu-Coding, MiniMax-Coding, MiMo-Coding, Ark-Coding, Gemini-CLI, Codex-CLI) + custom provider registration.
779
+
780
+ ```typescript
781
+ import { getProvider, KodaXBaseProvider } from '@kodax-ai/kodax/llm';
782
+
783
+ const provider = getProvider('anthropic');
784
+ const stream = await provider.streamCompletion(
785
+ [{ role: 'user', content: 'Hello!' }],
786
+ { onTextDelta: (text) => process.stdout.write(text) }
787
+ );
788
+
789
+ for await (const result of stream) {
790
+ if (result.type === 'text') { /* … */ }
791
+ else if (result.type === 'tool_use') { /* … */ }
792
+ }
793
+ ```
794
+
795
+ **Key Features**: unified provider interface · streaming · reasoning modes (`off/auto/quick/balanced/deep`) · per-provider retry + error handling · zero business-logic dependencies.
796
+
797
+ ### `@kodax-ai/kodax/agent` — Agent Framework (standalone-consumable)
798
+
799
+ ADR-021 standalone-consumable: `@kodax-ai/agent` has **zero inbound `@kodax-ai/coding` dependency** — you can wire any tool surface on top of it.
800
+
801
+ ```typescript
802
+ import {
803
+ Runner,
804
+ runFanOut,
805
+ runWithIdleYield,
806
+ registerChildTask,
807
+ type ChildTaskRegistry,
808
+ generateSessionId,
809
+ estimateTokens,
810
+ DefaultSummaryCompaction,
811
+ } from '@kodax-ai/kodax/agent';
812
+
813
+ // Bounded-concurrency fan-out with abort + structured progress events (v0.7.39 FEATURE_120)
814
+ const result = await runFanOut({
815
+ bundles: [{ id: 'a', task: 'audit-foo' }, { id: 'b', task: 'audit-bar' }],
816
+ maxParallel: 4,
817
+ run: async (bundle) => doWork(bundle),
818
+ });
819
+
820
+ // Idle-yield wait — pause when out of useful work, resume when a wake event arrives
821
+ await runWithIdleYield({ runOnce, computeSnapshot, registry, messageQueue, agentId });
822
+
823
+ // Pluggable compaction policy (FEATURE_081)
824
+ const policy = new DefaultSummaryCompaction({ thresholdRatio: 0.8, keepRecent: 10 });
825
+ ```
826
+
827
+ **Key Features**: `Runner` + per-step lifecycle · `runFanOut` (bounded-concurrency + abort + progress events) · `runWithIdleYield` (chat-while-waiting) · `ChildTaskRegistry` / `TaskAbortRegistry` · session-id generation · tiktoken-based token estimation · `CompactionPolicy` interface.
828
+
829
+ ### `@kodax-ai/kodax/skills` — Skills System
830
+
831
+ Zero external dependencies. Markdown-based skill files with natural-language triggers and variable resolution.
832
+
833
+ ```typescript
834
+ import {
835
+ SkillRegistry,
836
+ discoverSkills,
837
+ executeSkill,
838
+ type SkillContext,
839
+ } from '@kodax-ai/kodax/skills';
840
+
841
+ const skills = await discoverSkills(['/path/to/skills']);
842
+ const registry = new SkillRegistry();
843
+ await registry.registerSkills(skills);
844
+
845
+ const result = await executeSkill({
846
+ skillId: 'code-review',
847
+ arguments: { target: 'src/' },
848
+ workingDirectory: process.cwd(),
849
+ });
850
+ ```
851
+
852
+ **Key Features**: zero deps · markdown-based skill files · natural-language triggering · variable resolution · built-in skills included.
853
+
854
+ ### `@kodax-ai/kodax/coding` — Coding Agent
855
+
856
+ Complete coding agent: 30+ tools (`read`/`write`/`edit`/`bash`/`grep`/`glob`/`dispatch_child_task`/`send_message`/`task_stop`/...) + role prompts (Worker / Evaluator) + agent loop + auto-continue + session management.
857
+
858
+ ```typescript
859
+ import { runKodaX, KodaXClient, KODAX_TOOLS } from '@kodax-ai/kodax/coding';
860
+
861
+ // Single-task helper
862
+ const result = await runKodaX({
863
+ provider: 'zhipu-coding',
864
+ reasoningMode: 'auto',
865
+ events: { onTextDelta: (text) => process.stdout.write(text) },
866
+ }, 'Read package.json and explain the dependencies');
867
+
868
+ // Continuous session
869
+ const client = new KodaXClient({
870
+ provider: 'anthropic',
871
+ reasoningMode: 'auto',
872
+ events: { /* … */ },
873
+ });
874
+ await client.send('Create a new file');
875
+ await client.send('Add a function to it'); // Has context from previous message
876
+ ```
877
+
878
+ **Key Features**: 30+ built-in tools (see [Tools](#tools)) · Worker+Evaluator V2 chain (FEATURE_114, v0.7.36 default) · async child steering via `send_message` / `task_stop` (FEATURE_120, v0.7.39) · idle-yield wait mechanic (FEATURE_155, v0.7.38) · auto-continue · session lineage.
879
+
880
+ ### `@kodax-ai/kodax/repl` — Interactive Terminal UI
881
+
882
+ Ink/React-based interactive REPL. Permission modes, command system, themed streaming display.
883
+
884
+ ```typescript
885
+ import { InkREPL } from '@kodax-ai/kodax/repl';
886
+
887
+ // Usually used via the `kodax` bin command; can be embedded:
888
+ // - Interactive terminal UI (Ink components)
889
+ // - Permission control (auto/plan/accept-edits modes)
890
+ // - Command system (/help, /mode, /clear, /status, …)
891
+ // - Skills integration
892
+ // - Theme support
893
+ ```
894
+
895
+ **Key Features**: Ink-based React components · 3 permission modes (auto / plan / accept-edits) · built-in commands · real-time streaming display · context-usage indicator.
896
+
897
+ ### Package Dependency Graph (workspace internal)
898
+
899
+ ```
900
+ @kodax-ai/llm (zero business-logic deps)
901
+
902
+ @kodax-ai/agent (depends @kodax-ai/llm; ADR-021 standalone-consumable)
903
+
904
+ @kodax-ai/skills (zero external deps) → @kodax-ai/coding (depends llm + agent + skills)
905
+
906
+ @kodax-ai/repl (depends coding + ink + react)
907
+ ```
908
+
909
+ **Subpath Recommendations**:
910
+
911
+ | Use Case | Subpath | Why |
912
+ |----------|---------|-----|
913
+ | Only need LLM abstraction | `@kodax-ai/kodax/llm` | Minimal deps; 12 providers |
914
+ | Building custom agent | `@kodax-ai/kodax/agent` | Runner + fan-out + idle-yield + sessions |
915
+ | Using skills system | `@kodax-ai/kodax/skills` | Zero deps, pure skills |
916
+ | Coding tasks | `@kodax-ai/kodax/coding` | Complete coding agent + tools |
917
+ | Terminal app | `@kodax-ai/kodax/repl` | Full interactive experience |
918
+
919
+ ---
920
+
921
+ | Provider | Environment Variable | Reasoning Support | Default Model |
922
+ |----------|----------------------|-------------------|---------------|
923
+ | anthropic | `ANTHROPIC_API_KEY` | Native | claude-sonnet-4-6 |
924
+ | openai | `OPENAI_API_KEY` | Native | gpt-5.3-codex |
925
+ | kimi | `KIMI_API_KEY` | Native | kimi-k2.6 |
926
+ | kimi-code | `KIMI_API_KEY` | Native | kimi-for-coding |
927
+ | qwen | `QWEN_API_KEY` | Native | qwen3.5-plus |
928
+ | zhipu | `ZHIPU_API_KEY` | Native | glm-5 |
929
+ | zhipu-coding | `ZHIPU_API_KEY` | Native | glm-5 |
930
+ | minimax-coding | `MINIMAX_API_KEY` | Native | MiniMax-M2.7 |
931
+ | mimo-coding | `MIMO_API_KEY` | Native | mimo-v2.5-pro (Xiaomi Token Plan, Anthropic-compat) |
932
+ | ark-coding | `ARK_API_KEY` | Native | glm-5.1 (Volcengine Ark Coding Plan, multi-model gateway, Anthropic-compat) |
933
+ | deepseek | `DEEPSEEK_API_KEY` | Native | deepseek-v4-flash |
934
+ | gemini-cli | `GEMINI_API_KEY` | Prompt-only / CLI bridge | (via gemini CLI) |
935
+ | codex-cli | `OPENAI_API_KEY` | Prompt-only / CLI bridge | (via codex CLI) |
936
+
937
+ > **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.
938
+
939
+ ### Examples
940
+
941
+ ```bash
942
+ # Use Zhipu Coding
943
+ kodax --provider zhipu-coding --thinking "Help me optimize this code"
944
+
945
+ # Use OpenAI
946
+ export OPENAI_API_KEY=your_key
947
+ kodax --provider openai "Create a REST API"
948
+
949
+ # Resume last session
950
+ kodax --session resume
951
+
952
+ # List all sessions
953
+ kodax --session list
954
+
955
+ # Parallel tool execution
956
+ kodax --parallel "Read package.json and tsconfig.json"
957
+
958
+ # Adaptive multi-agent (AMA) mode — Scout-first fan-out for multi-file work
959
+ kodax --agent-mode ama "Analyze code structure, check test coverage, find bugs"
960
+ ```
961
+
962
+ ---
963
+
964
+ ## Tools
965
+
966
+ KodaX ships 30+ built-in tools, grouped below. They are registered as a single flat tool surface to the LLM; the categories here are just for navigation.
967
+
968
+ ### File operations
969
+ | Tool | Description |
970
+ |------|-------------|
971
+ | `read` | Read file contents (supports offset/limit) |
972
+ | `write` | Write a new file or fully rewrite an existing one |
973
+ | `edit` | Exact string replacement (supports `replace_all`) |
974
+ | `multi_edit` | Atomic batch of independent edits to one file |
975
+ | `insert_after_anchor` | Insert content after a unique anchor without rewriting the file |
976
+ | `undo` | Revert the last file modification |
977
+
978
+ ### Shell & search
979
+ | Tool | Description |
980
+ |------|-------------|
981
+ | `bash` | Execute a shell command (supports `run_in_background`, output truncation) |
982
+ | `glob` | Find files by pattern |
983
+ | `grep` | Regex content search (context lines, multiline, file-type filter, pagination) |
984
+ | `code_search` | Lower-noise code search (extension-provider aware) |
985
+ | `semantic_lookup` | Symbol/module/process-aware search backed by repo intelligence |
986
+ | `web_search` | Discovery-oriented web search with trust + freshness signals |
987
+ | `web_fetch` | Fetch a specific URL with provenance hints |
988
+
989
+ ### Repo Intelligence (working tools)
990
+ | Tool | Description |
991
+ |------|-------------|
992
+ | `repo_overview` | Summarize structure, key areas, entry hints, intelligence snapshot |
993
+ | `changed_scope` | Which files/areas/categories the current diff touches |
994
+ | `changed_diff` | Paged diff slice for a single file |
995
+ | `changed_diff_bundle` | Paged diff slices for multiple files in one call |
996
+ | `module_context` | Module capsule (deps, entries, symbols, tests, docs) |
997
+ | `symbol_context` | Definition + probable callers/callees + alternatives |
998
+ | `process_context` | Approximate static execution capsule for an entry |
999
+ | `impact_estimate` | Blast radius for a symbol/path/module |
1000
+
1001
+ ### MCP capabilities (when MCP servers are configured)
1002
+ | Tool | Description |
1003
+ |------|-------------|
1004
+ | `mcp_search` / `mcp_describe` / `mcp_call` | Discover and invoke MCP tools through the shared capability runtime |
1005
+ | `mcp_read_resource` / `mcp_get_prompt` | Read MCP resources and prompts |
1006
+
1007
+ ### Git worktree
1008
+ | Tool | Description |
1009
+ |------|-------------|
1010
+ | `worktree_create` | Create a new worktree on an isolated branch for safe agent work |
1011
+ | `worktree_remove` | Remove a worktree (with safety checks) |
1012
+
1013
+ ### Agent control & UX
1014
+ | Tool | Description |
1015
+ |------|-------------|
1016
+ | `dispatch_child_task` | Spawn a sub-agent for an independent investigation/edit task. Optional `model_hint: 'fast' \| 'balanced' \| 'deep'` (advisory; routing no-op until FEATURE_102 v0.7.45). |
1017
+ | `send_message` | Append an instruction to an in-flight child's queue — surfaces as `<coordinator-instruction>` at the child's next turn boundary. Coordinator-only. (FEATURE_120, v0.7.39) |
1018
+ | `task_stop` | Request graceful exit of a specific child. Current tool finishes atomically, then the child sees a `<coordinator-stop-request>` and emits a final summary. Coordinator-only. (FEATURE_120, v0.7.39) |
1019
+ | `ask_user_question` | Single/multi-select or free-text prompt back to the user |
1020
+ | `exit_plan_mode` | Present a finalized plan for approval (REPL only) |
1021
+ | `emit_managed_protocol` | Internal managed-task protocol side-channel for role payloads (handoff / verdict). V2 chain (Worker→Evaluator) is the default since v0.7.36 (FEATURE_114). |
1022
+
1023
+ ---
1024
+
1025
+ ## Skills System
1026
+
1027
+ KodaX includes a built-in Skills system that can be triggered by natural language:
1028
+
1029
+ ```bash
1030
+ # Natural language triggering (no explicit /skill needed)
1031
+ kodax "帮我审查代码" # Triggers code-review skill
1032
+ kodax "写测试用例" # Triggers tdd skill
1033
+ kodax "提交代码" # Triggers git-workflow skill
1034
+
1035
+ # Explicit skill command
1036
+ kodax /skill:code-review
1037
+ ```
1038
+
1039
+ Built-in skills include:
1040
+ - **code-review** - Code review and quality analysis
1041
+ - **tdd** - Test-driven development workflow
1042
+ - **git-workflow** - Git commit and workflow automation
1043
+
1044
+ Skills are stored in `~/.kodax/skills/` and can be extended with custom skills.
1045
+
1046
+ ---
1047
+
1048
+ ## Commands (CLI)
1049
+
1050
+ Commands are `/xxx` shortcuts in CLI:
1051
+
1052
+ ```bash
1053
+ kodax /review src/auth.ts
1054
+ kodax /test
1055
+ ```
1056
+
1057
+ Commands are stored in `~/.kodax/commands/`:
1058
+ - `.md` files → Prompt commands (content used as prompt)
1059
+ - `.ts/.js` files → Programmable commands
1060
+
1061
+ ---
1062
+
1063
+ ## API Exports
1064
+
1065
+ ```typescript
1066
+ // Main functions
1067
+ export { runKodaX, KodaXClient };
1068
+
1069
+ // Types
1070
+ export type {
1071
+ KodaXEvents, KodaXOptions, KodaXResult,
1072
+ KodaXMessage, KodaXContentBlock,
1073
+ KodaXSessionStorage, KodaXToolDefinition
1074
+ };
1075
+
1076
+ // Tools
1077
+ export { KODAX_TOOLS, KODAX_TOOL_REQUIRED_PARAMS, executeTool };
1078
+
1079
+ // Providers
1080
+ export { getProvider, KODAX_PROVIDERS, KodaXBaseProvider };
1081
+
1082
+ // Utilities
1083
+ export {
1084
+ estimateTokens,
1085
+ getGitRoot, getGitContext, getEnvContext, getProjectSnapshot,
1086
+ checkPromiseSignal
1087
+ };
1088
+ ```
1089
+
1090
+ ---
1091
+
1092
+ ## Development
1093
+
1094
+ ```bash
1095
+ # Development mode (using tsx)
1096
+ npm run dev "your task"
1097
+
1098
+ # Build
1099
+ npm run build
1100
+
1101
+ # Optional: only build workspace packages
1102
+ npm run build:packages
1103
+
1104
+ # Build standalone binary (current platform / all platforms)
1105
+ npm run build:binary
1106
+ npm run build:binary:all
1107
+
1108
+ # Run tests
1109
+ npm test
1110
+
1111
+ # Eval-driven development tests (provider matrices, identity round-trip, etc.)
1112
+ npm run test:eval
1113
+
1114
+ # Clean
1115
+ npm run clean
1116
+ ```
1117
+
1118
+ ### Repo Intelligence cache directories
1119
+
1120
+ KodaX now uses two repo-intelligence cache locations on disk:
1121
+
1122
+ - `.agent/repo-intelligence/`
1123
+ - OSS baseline repo-intelligence artifacts and existing task-engine snapshots.
1124
+ - `.repointel/`
1125
+ - Premium `repointel` workspace cache shared by the local daemon/native frontdoor.
1126
+
1127
+ They are intentionally separated so:
1128
+
1129
+ - OSS fallback stays available even when premium is disabled or unavailable.
1130
+ - Premium cache does not pollute OSS artifacts.
1131
+ - KodaX and other hosts can share the same premium workspace cache.
1132
+
1133
+ `.repointel/` is a local generated directory and should not be committed.
1134
+
1135
+ ---
1136
+
1137
+ ## Code Style
1138
+
1139
+ ### Comment Guidelines
1140
+
1141
+ KodaX uses an **English-first** comment style with selective Chinese brief notes for complex logic.
1142
+
1143
+ | Situation | Style | Example |
1144
+ |-----------|-------|---------|
1145
+ | Import/Export | English only | `// Import dependencies` |
1146
+ | Simple constants | English only | `// Max retry count` |
1147
+ | Simple logic | English only | `// Return if null` |
1148
+ | **Business rules** | English + Chinese | `// Skip tool_result - 跳过工具结果块` |
1149
+ | **Platform compatibility** | English + Chinese | `// Windows path handling - Windows 路径处理` |
1150
+ | **Performance optimization** | English + Chinese | `// Debounce to prevent flicker - 防抖避免闪烁` |
1151
+
1152
+ ---
1153
+
1154
+ ## Documentation
1155
+
1156
+ - [README_CN.md](README_CN.md) - Chinese Documentation
1157
+ - [docs/release.md](docs/release.md) - Standalone binary build & release pipeline
1158
+ - [docs/PRD.md](docs/PRD.md) - Product Requirements
1159
+ - [docs/ADR.md](docs/ADR.md) - Architecture Decisions
1160
+ - [docs/HLD.md](docs/HLD.md) - High-Level Design
1161
+ - [docs/DD.md](docs/DD.md) - Detailed Design
1162
+ - [docs/FEATURE_LIST.md](docs/FEATURE_LIST.md) - Feature Tracking
1163
+ - [docs/test-guides/](docs/test-guides/) - Feature-specific test guides
1164
+ - [CHANGELOG.md](CHANGELOG.md) - Version History (v0.7.0+; [archive](docs/CHANGELOG_ARCHIVE.md) for older)
1165
+
1166
+ ---
1167
+
1168
+ ## License
1169
+
1170
+ [Apache License 2.0](LICENSE) - Copyright 2026 [icetomoyo](mailto:icetomoyo@gmail.com)