@kodax-ai/kodax-cli 0.7.38

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 (44) hide show
  1. package/CHANGELOG.md +1304 -0
  2. package/LICENSE +191 -0
  3. package/README.md +1167 -0
  4. package/README_CN.md +631 -0
  5. package/dist/builtin/code-review/SKILL.md +63 -0
  6. package/dist/builtin/git-workflow/SKILL.md +84 -0
  7. package/dist/builtin/skill-creator/SKILL.md +122 -0
  8. package/dist/builtin/skill-creator/agents/analyzer.md +12 -0
  9. package/dist/builtin/skill-creator/agents/comparator.md +13 -0
  10. package/dist/builtin/skill-creator/agents/grader.md +13 -0
  11. package/dist/builtin/skill-creator/references/schemas.md +227 -0
  12. package/dist/builtin/skill-creator/scripts/aggregate-benchmark.d.ts +46 -0
  13. package/dist/builtin/skill-creator/scripts/aggregate-benchmark.js +209 -0
  14. package/dist/builtin/skill-creator/scripts/analyze-benchmark.d.ts +46 -0
  15. package/dist/builtin/skill-creator/scripts/analyze-benchmark.js +289 -0
  16. package/dist/builtin/skill-creator/scripts/compare-runs.d.ts +62 -0
  17. package/dist/builtin/skill-creator/scripts/compare-runs.js +333 -0
  18. package/dist/builtin/skill-creator/scripts/generate-review.d.ts +33 -0
  19. package/dist/builtin/skill-creator/scripts/generate-review.js +415 -0
  20. package/dist/builtin/skill-creator/scripts/grade-evals.d.ts +73 -0
  21. package/dist/builtin/skill-creator/scripts/grade-evals.js +405 -0
  22. package/dist/builtin/skill-creator/scripts/improve-description.d.ts +23 -0
  23. package/dist/builtin/skill-creator/scripts/improve-description.js +161 -0
  24. package/dist/builtin/skill-creator/scripts/init-skill.d.ts +14 -0
  25. package/dist/builtin/skill-creator/scripts/init-skill.js +153 -0
  26. package/dist/builtin/skill-creator/scripts/install-skill.d.ts +29 -0
  27. package/dist/builtin/skill-creator/scripts/install-skill.js +176 -0
  28. package/dist/builtin/skill-creator/scripts/package-skill.d.ts +38 -0
  29. package/dist/builtin/skill-creator/scripts/package-skill.js +124 -0
  30. package/dist/builtin/skill-creator/scripts/quick-validate.d.ts +8 -0
  31. package/dist/builtin/skill-creator/scripts/quick-validate.js +166 -0
  32. package/dist/builtin/skill-creator/scripts/run-eval.d.ts +66 -0
  33. package/dist/builtin/skill-creator/scripts/run-eval.js +356 -0
  34. package/dist/builtin/skill-creator/scripts/run-loop.d.ts +49 -0
  35. package/dist/builtin/skill-creator/scripts/run-loop.js +243 -0
  36. package/dist/builtin/skill-creator/scripts/run-trigger-eval.d.ts +58 -0
  37. package/dist/builtin/skill-creator/scripts/run-trigger-eval.js +225 -0
  38. package/dist/builtin/skill-creator/scripts/utils.js +278 -0
  39. package/dist/builtin/tdd/SKILL.md +56 -0
  40. package/dist/index.js +1717 -0
  41. package/dist/kodax_cli.js +1870 -0
  42. package/package.json +122 -0
  43. package/scripts/kodax-bin.cjs +27 -0
  44. package/scripts/production-env.cjs +16 -0
package/README.md ADDED
@@ -0,0 +1,1167 @@
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';
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, consisting of 5 packages:
346
+
347
+ ```
348
+ KodaX/
349
+ ├── packages/
350
+ │ ├── ai/ # @kodax/ai - Independent LLM abstraction layer
351
+ │ │ └── providers/ # 12 LLM providers (Anthropic, OpenAI, DeepSeek, MiMo, etc.)
352
+ │ │
353
+ │ ├── agent/ # @kodax/agent - Generic Agent framework
354
+ │ │ └── session/ # Session management, message handling
355
+ │ │
356
+ │ ├── skills/ # @kodax/skills - Skills standard implementation
357
+ │ │ └── builtin/ # Built-in skills (code-review, tdd, git-workflow)
358
+ │ │
359
+ │ ├── coding/ # @kodax/coding - Coding Agent (tools + prompts)
360
+ │ │ └── tools/ # Tools: read, write, edit, bash, glob, grep, undo, ask_user_question, repo-intelligence
361
+ │ │
362
+ │ └── repl/ # @kodax/repl - Interactive terminal UI
363
+ │ ├── ui/ # Ink/React components, themes
364
+ │ └── interactive/ # Commands, REPL logic
365
+
366
+ ├── src/
367
+ │ └── kodax_cli.ts # Main CLI entry point
368
+
369
+ └── package.json # Root workspace config
370
+ ```
371
+
372
+ ### Package Dependencies
373
+
374
+ ```
375
+ ┌─────────────────┐
376
+ │ kodax (root) │
377
+ │ CLI Entry │
378
+ └────────┬────────┘
379
+
380
+ ┌──────────────┴──────────────┐
381
+ │ │
382
+ ▼ ▼
383
+ ┌─────────────┐ ┌─────────────┐
384
+ │ @kodax/repl │ │@kodax/coding│
385
+ │ UI Layer │ │ Tools+Prompts│
386
+ └──────┬──────┘ └──────┬──────┘
387
+ │ │
388
+ │ ┌──────────────┼──────────────┐
389
+ │ │ │ │
390
+ ▼ ▼ ▼ ▼
391
+ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
392
+ │@kodax/skills│ │ @kodax/agent│ │ @kodax/ai │ │ External │
393
+ │(zero deps) │ │Agent Frame │ │LLM Abstract │ │ SDKs │
394
+ └─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘
395
+ ```
396
+
397
+ ### Package Overview
398
+
399
+ | Package | Purpose | Key Dependencies |
400
+ |---------|---------|------------------|
401
+ | `@kodax/ai` | Independent LLM abstraction, reusable by other projects | @anthropic-ai/sdk, openai |
402
+ | `@kodax/agent` | Generic Agent framework, session management | @kodax/ai, js-tiktoken |
403
+ | `@kodax/skills` | Skills standard implementation | Zero external deps |
404
+ | `@kodax/coding` | Coding Agent with tools and prompts | @kodax/ai, @kodax/agent, @kodax/skills |
405
+ | `@kodax/repl` | Complete interactive terminal UI | @kodax/coding, ink, react |
406
+
407
+ ---
408
+
409
+ ## Features
410
+
411
+ - **Modular Architecture** - Use as CLI, as a library, or as a Node-free single binary
412
+ - **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
413
+ - **Scout-First AMA** - Adaptive multi-agent with H0/H1/H2 harness levels, Scout-complete direct execution, and context-preserving role upgrades
414
+ - **Reasoning Modes** - Unified `off/auto/quick/balanced/deep` interface across providers
415
+ - **Streaming Output** - Real-time response display
416
+ - **Session Management** - JSONL format with branchable session lineage tree
417
+ - **Skills System** - Natural language triggering, extensible, role-projected in AMA
418
+ - **Repo Intelligence** - OSS baseline + optional `repointel` premium engine, with native KodaX auto-injection lane
419
+ - **Rich Tool Surface** - 30+ built-in tools across file ops, shell, search, repo intelligence, MCP capabilities, git worktree, and agent control
420
+ - **Permission Control** - 3 permission modes with pattern-based control
421
+ - **Standalone Binary** - `bun --compile` releases for Win/macOS/Linux x64+arm64, no Node.js required on target machines
422
+ - **Cross-Platform** - Windows/macOS/Linux
423
+ - **TypeScript Native** - Full type safety and IDE support
424
+
425
+ ---
426
+
427
+ ## Installation
428
+
429
+ ### As CLI Tool
430
+
431
+ ```bash
432
+ # Clone repository
433
+ git clone https://github.com/icetomoyo/KodaX.git
434
+ cd KodaX
435
+
436
+ # Install dependencies (includes workspace packages)
437
+ npm install
438
+
439
+ # Build the monorepo
440
+ npm run build
441
+
442
+ # Link globally (development mode)
443
+ npm link
444
+
445
+ # Now you can use 'kodax' anywhere
446
+ kodax "your task"
447
+ ```
448
+
449
+ ### As Standalone Binary (no Node required on target)
450
+
451
+ 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.
452
+
453
+ Supported targets: `win-x64`, `linux-x64`, `linux-arm64`, `darwin-x64`, `darwin-arm64`. Win7 / pre-glibc-2.27 distros / LoongArch are not supported.
454
+
455
+ **Build locally**:
456
+
457
+ ```bash
458
+ # Install Bun once on your build machine
459
+ npm i -g bun # or scoop/brew/curl install — see docs/release.md
460
+
461
+ npm run build:binary # Current host platform (fastest)
462
+ npm run build:binary:all # All five targets in sequence
463
+ node scripts/build-binary.mjs --target=linux-arm64 # Specific target
464
+ ```
465
+
466
+ Output lives under `dist/binary/<target>/`:
467
+
468
+ ```
469
+ dist/binary/linux-x64/
470
+ ├── kodax # ~60 MB Bun-compiled executable
471
+ └── builtin/ # Sidecar built-in skills
472
+ ```
473
+
474
+ Smoke-test: `dist/binary/<host>/kodax --version`.
475
+
476
+ **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.
477
+
478
+ 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.
479
+
480
+ ### As Library
481
+
482
+ ```bash
483
+ npm install @kodax-ai/kodax-cli
484
+ ```
485
+
486
+ ```typescript
487
+ import { runKodaX } from '@kodax-ai/kodax-cli';
488
+
489
+ process.env.ZHIPU_API_KEY = process.env.ZHIPU_API_KEY ?? 'your_api_key';
490
+
491
+ const result = await runKodaX({
492
+ provider: 'zhipu-coding',
493
+ reasoningMode: 'auto',
494
+ events: {
495
+ onTextDelta: (text) => process.stdout.write(text),
496
+ onComplete: () => console.log('\nDone!'),
497
+ },
498
+ }, 'your task');
499
+
500
+ console.log(result.lastText);
501
+ ```
502
+
503
+ 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.
504
+
505
+ ---
506
+
507
+ ## Usage
508
+
509
+ ### REPL Quickstart
510
+
511
+ Running `kodax` with no prompt starts the interactive REPL.
512
+
513
+ ```bash
514
+ kodax
515
+ ```
516
+
517
+ Inside the REPL you can type normal requests or slash commands:
518
+
519
+ ```text
520
+ Read package.json and summarize the architecture
521
+ /model
522
+ /mode
523
+ /help
524
+ ```
525
+
526
+ ### CLI Quickstart
527
+
528
+ ```bash
529
+ # Set API key
530
+ export ZHIPU_API_KEY=your_api_key
531
+
532
+ # Basic usage
533
+ kodax "Help me create a TypeScript project"
534
+
535
+ # Choose a provider explicitly
536
+ kodax --provider openai --model gpt-5.4 "Create a REST API"
537
+
538
+ # Use a deeper reasoning mode
539
+ kodax --reasoning deep "Review this architecture"
540
+ ```
541
+
542
+ ### Session Workflows
543
+
544
+ Use a session when you want memory across turns. Without a session, each CLI call is independent.
545
+
546
+ ```bash
547
+ # No memory: two separate calls
548
+ kodax "Read src/auth.ts"
549
+ kodax "Summarize it"
550
+
551
+ # With memory: same session
552
+ kodax --session my-project "Read package.json"
553
+ kodax --session my-project "Summarize it"
554
+ kodax --session my-project "How should I fix the first issue?"
555
+
556
+ # Session management
557
+ kodax --session list
558
+ kodax --session resume "continue"
559
+ ```
560
+
561
+ ### Session Patterns
562
+
563
+ ```bash
564
+ # ❌ No memory: two independent calls
565
+ kodax "Read src/auth.ts" # Agent reads and responds
566
+ kodax "Summarize it" # Agent doesn't know what to summarize
567
+
568
+ # ✅ With memory: same session
569
+ kodax --session auth-review "Read src/auth.ts"
570
+ kodax --session auth-review "Summarize it" # Agent knows to summarize auth.ts
571
+ kodax --session auth-review "How to fix first issue" # Agent has context
572
+ ```
573
+
574
+ ### Workflow Examples
575
+
576
+ ```bash
577
+ # Code review (multi-turn conversation)
578
+ kodax --session review "Review src/ directory"
579
+ kodax --session review "Focus on security issues"
580
+ kodax --session review "Give me fix suggestions"
581
+
582
+ # Project development (continuous session)
583
+ kodax --session todo-app "Create a Todo application"
584
+ kodax --session todo-app "Add delete functionality"
585
+ kodax --session todo-app "Write tests"
586
+ ```
587
+
588
+ ### CLI Reference
589
+
590
+ ```text
591
+ kodax Start the interactive REPL
592
+ -h, --help [topic] Show help or topic help
593
+ -p, --print <text> Run a single task and exit
594
+ -c, --continue Continue the most recent conversation in this directory
595
+ -r, --resume [id] Resume a session by ID, or the latest session
596
+ -m, --provider Provider to use
597
+ --model <name> Override the model
598
+ --reasoning <mode> off | auto | quick | balanced | deep
599
+ -t, --thinking Compatibility alias for --reasoning auto
600
+ -s, --session <op> Session ID or legacy session operation
601
+ -j, --parallel Enable parallel tool execution
602
+ --max-iter <n> Max iterations
603
+ ```
604
+
605
+ ### Permission Control
606
+
607
+ KodaX provides 3 permission modes for fine-grained control:
608
+
609
+ | Mode | Description | Tools Need Confirmation |
610
+ |------|-------------|------------------------|
611
+ | `plan` | Read-only planning mode | All modification tools blocked |
612
+ | `accept-edits` | Auto-accept file edits | bash only |
613
+ | `auto-in-project` | Full auto within project | None (project-scoped) |
614
+
615
+ ```bash
616
+ # In REPL, use /mode command
617
+ /mode plan # Switch to plan mode (read-only)
618
+ /mode accept-edits # Switch to accept-edits mode
619
+ /mode auto-in-project # Switch to auto-in-project mode
620
+ /auto # Alias for auto-in-project
621
+
622
+ # Check current mode
623
+ /mode
624
+ ```
625
+
626
+ **Features:**
627
+ - In `accept-edits` mode, choosing "always" can persist safe Bash allow-patterns
628
+ - Plan mode includes system prompt context for LLM awareness
629
+ - Permanent protection zones: `.kodax/`, `~/.kodax/`, paths outside project
630
+ - Pattern-based permission: Allow specific Bash commands (e.g., `Bash(npm install)`)
631
+ - Unified diff display for write/edit operations
632
+
633
+ ### CLI Help Topics
634
+
635
+ Get detailed help for specific topics:
636
+
637
+ ```bash
638
+ # Basic help
639
+ kodax -h
640
+ kodax --help
641
+
642
+ # Detailed topic help
643
+ kodax -h sessions # Session management details
644
+ kodax -h init # Long-running project initialization
645
+ kodax -h project # Project mode / harness workflow
646
+ kodax -h auto # Auto-continue mode
647
+ kodax -h provider # LLM provider configuration
648
+ kodax -h thinking # Thinking/reasoning mode
649
+ kodax -h team # Multi-agent parallel execution
650
+ kodax -h print # Print configuration
651
+ ```
652
+
653
+ ## Advanced Library Usage
654
+
655
+ #### Simple Mode (runKodaX)
656
+
657
+ ```typescript
658
+ import { runKodaX, KodaXEvents } from 'kodax';
659
+
660
+ const events: KodaXEvents = {
661
+ onTextDelta: (text) => process.stdout.write(text),
662
+ onThinkingDelta: (text) => console.log(`Thinking delta: ${text.length} chars`),
663
+ onToolResult: (result) => console.log(`Tool ${result.name}: ${result.content.slice(0, 100)}`),
664
+ onComplete: () => console.log('\nDone!'),
665
+ onError: (e) => console.error(e.message),
666
+ };
667
+
668
+ const result = await runKodaX({
669
+ provider: 'zhipu-coding',
670
+ reasoningMode: 'auto',
671
+ events,
672
+ }, 'What is 1+1?');
673
+
674
+ console.log(result.lastText);
675
+ ```
676
+
677
+ #### Continuous Session (KodaXClient)
678
+
679
+ ```typescript
680
+ import { KodaXClient } from 'kodax';
681
+
682
+ const client = new KodaXClient({
683
+ provider: 'zhipu-coding',
684
+ reasoningMode: 'auto',
685
+ events: {
686
+ onTextDelta: (t) => process.stdout.write(t),
687
+ },
688
+ });
689
+
690
+ // First message
691
+ await client.send('Read package.json');
692
+
693
+ // Continue same session
694
+ await client.send('Summarize it');
695
+
696
+ console.log(client.getSessionId());
697
+ ```
698
+
699
+ #### Custom Session Storage
700
+
701
+ ```typescript
702
+ import { runKodaX, KodaXSessionStorage, KodaXMessage } from 'kodax';
703
+
704
+ class MyDatabaseStorage implements KodaXSessionStorage {
705
+ async save(id: string, data: { messages: KodaXMessage[]; title: string; gitRoot: string }) {
706
+ // Save to your database
707
+ }
708
+ async load(id: string) {
709
+ // Load from your database
710
+ return null;
711
+ }
712
+ }
713
+
714
+ await runKodaX({
715
+ provider: 'zhipu-coding',
716
+ session: {
717
+ id: 'my-session-123',
718
+ storage: new MyDatabaseStorage(),
719
+ },
720
+ events: { ... },
721
+ }, 'task');
722
+ ```
723
+
724
+ ### Library Modes Comparison
725
+
726
+ | Feature | runKodaX | KodaXClient |
727
+ |---------|----------|-------------|
728
+ | **Message Memory** | ❌ No | ✅ Yes |
729
+ | **Call Style** | Function | Class instance |
730
+ | **Context** | Independent each time | Accumulates |
731
+ | **Use Case** | Single tasks, batch processing | Interactive dialogue, multi-step tasks |
732
+
733
+ ---
734
+
735
+ ## Using Individual Packages
736
+
737
+ KodaX is built with a modular architecture. Each package can be used independently:
738
+
739
+ ### @kodax/ai - LLM Abstraction Layer
740
+
741
+ Independent LLM provider abstraction, reusable in any project:
742
+
743
+ ```typescript
744
+ import { getProvider, KodaXBaseProvider } from '@kodax/ai';
745
+
746
+ // Get a provider instance
747
+ const provider = getProvider('anthropic');
748
+
749
+ // Stream completion
750
+ const stream = await provider.streamCompletion(
751
+ [{ role: 'user', content: 'Hello!' }],
752
+ { onTextDelta: (text) => process.stdout.write(text) }
753
+ );
754
+
755
+ for await (const result of stream) {
756
+ if (result.type === 'text') {
757
+ // Handle text delta
758
+ } else if (result.type === 'tool_use') {
759
+ // Handle tool call
760
+ }
761
+ }
762
+ ```
763
+
764
+ **Key Features**:
765
+ - 12 LLM providers with a unified interface
766
+ - Streaming output support
767
+ - Thinking / reasoning mode support
768
+ - Error handling and retry logic
769
+ - Zero business logic dependencies
770
+
771
+ ### @kodax/agent - Agent Framework
772
+
773
+ Generic agent framework with session management:
774
+
775
+ ```typescript
776
+ import {
777
+ generateSessionId,
778
+ estimateTokens,
779
+ type KodaXMessage
780
+ } from '@kodax/agent';
781
+ import { DefaultSummaryCompaction } from '@kodax/core';
782
+
783
+ // Generate session ID
784
+ const sessionId = generateSessionId();
785
+
786
+ // Estimate tokens
787
+ const tokens = estimateTokens(messages);
788
+
789
+ // Pluggable compaction policy (FEATURE_081, v0.7.23).
790
+ // Call `policy.shouldCompact(...)` at round boundaries, then `policy.compact(...)`.
791
+ const policy = new DefaultSummaryCompaction({
792
+ thresholdRatio: 0.8,
793
+ keepRecent: 10,
794
+ });
795
+ ```
796
+
797
+ **Key Features**:
798
+ - Session ID generation and title extraction
799
+ - Token estimation (tiktoken-based)
800
+ - Pluggable `CompactionPolicy` + `DefaultSummaryCompaction` (generic) / `LineageCompaction` (coding preset)
801
+ - Generic types for messages and tools
802
+
803
+ ### @kodax/skills - Skills System
804
+
805
+ Agent Skills standard implementation with zero external dependencies:
806
+
807
+ ```typescript
808
+ import {
809
+ SkillRegistry,
810
+ discoverSkills,
811
+ executeSkill,
812
+ type SkillContext
813
+ } from '@kodax/skills';
814
+
815
+ // Discover skills from paths
816
+ const skills = await discoverSkills(['/path/to/skills']);
817
+
818
+ // Initialize registry
819
+ const registry = getSkillRegistry();
820
+ await registry.registerSkills(skills);
821
+
822
+ // Execute a skill
823
+ const context: SkillContext = {
824
+ skillId: 'code-review',
825
+ arguments: { target: 'src/' },
826
+ workingDirectory: process.cwd()
827
+ };
828
+
829
+ const result = await executeSkill(context);
830
+ ```
831
+
832
+ **Key Features**:
833
+ - Zero external dependencies
834
+ - Markdown-based skill files
835
+ - Natural language triggering
836
+ - Variable resolution
837
+ - Built-in skills included
838
+
839
+ ### @kodax/coding - Coding Agent
840
+
841
+ Complete coding agent with tools and prompts:
842
+
843
+ ```typescript
844
+ import { runKodaX, KodaXClient, KODAX_TOOLS } from '@kodax/coding';
845
+
846
+ // Use runKodaX for single tasks
847
+ const result = await runKodaX({
848
+ provider: 'zhipu-coding',
849
+ reasoningMode: 'auto',
850
+ events: {
851
+ onTextDelta: (text) => process.stdout.write(text)
852
+ }
853
+ }, 'Read package.json and explain the dependencies');
854
+
855
+ // Or use KodaXClient for continuous sessions
856
+ const client = new KodaXClient({
857
+ provider: 'anthropic',
858
+ reasoningMode: 'auto',
859
+ events: { ... }
860
+ });
861
+
862
+ await client.send('Create a new file');
863
+ await client.send('Add a function to it'); // Has context from previous message
864
+ ```
865
+
866
+ **Key Features**:
867
+ - 30+ built-in tools across file ops, shell, search, repo intelligence, MCP, worktree, and agent control (see the [Tools](#tools) section)
868
+ - System prompts for coding tasks
869
+ - Agent loop implementation
870
+ - Session management
871
+ - Auto-continue mode
872
+
873
+ ### @kodax/repl - Interactive Terminal UI
874
+
875
+ Complete interactive REPL with Ink/React components:
876
+
877
+ ```typescript
878
+ // Usually used as CLI, but can be integrated
879
+ import { InkREPL } from '@kodax/repl';
880
+
881
+ // The REPL package provides:
882
+ // - Interactive terminal UI
883
+ // - Permission control (4 modes)
884
+ // - Command system (/help, /mode, etc.)
885
+ // - Skills integration
886
+ // - Theme support
887
+ ```
888
+
889
+ **Key Features**:
890
+ - Ink-based React components
891
+ - 3 permission modes
892
+ - Built-in commands
893
+ - Real-time streaming display
894
+ - Context usage indicator
895
+
896
+ ### Package Dependency Graph
897
+
898
+ ```
899
+ @kodax/ai (零业务依赖)
900
+
901
+ @kodax/agent (依赖 @kodax/ai)
902
+
903
+ @kodax/skills (零外部依赖) → @kodax/coding (依赖 ai, agent, skills)
904
+
905
+ @kodax/repl (依赖 coding, ink, react)
906
+ ```
907
+
908
+ **Import Recommendations**:
909
+
910
+ | Use Case | Package | Why |
911
+ |----------|---------|-----|
912
+ | Only need LLM abstraction | `@kodax/ai` | Minimal dependencies |
913
+ | Building custom agent | `@kodax/agent` | Session + messages + tokenization |
914
+ | Using skills system | `@kodax/skills` | Zero deps, pure skills |
915
+ | Coding tasks | `@kodax/coding` | Complete coding agent |
916
+ | Terminal app | `@kodax/repl` | Full interactive experience |
917
+
918
+ ---
919
+
920
+ | Provider | Environment Variable | Reasoning Support | Default Model |
921
+ |----------|----------------------|-------------------|---------------|
922
+ | anthropic | `ANTHROPIC_API_KEY` | Native | claude-sonnet-4-6 |
923
+ | openai | `OPENAI_API_KEY` | Native | gpt-5.3-codex |
924
+ | kimi | `KIMI_API_KEY` | Native | kimi-k2.6 |
925
+ | kimi-code | `KIMI_API_KEY` | Native | kimi-for-coding |
926
+ | qwen | `QWEN_API_KEY` | Native | qwen3.5-plus |
927
+ | zhipu | `ZHIPU_API_KEY` | Native | glm-5 |
928
+ | zhipu-coding | `ZHIPU_API_KEY` | Native | glm-5 |
929
+ | minimax-coding | `MINIMAX_API_KEY` | Native | MiniMax-M2.7 |
930
+ | mimo-coding | `MIMO_API_KEY` | Native | mimo-v2.5-pro (Xiaomi Token Plan, Anthropic-compat) |
931
+ | ark-coding | `ARK_API_KEY` | Native | glm-5.1 (Volcengine Ark Coding Plan, multi-model gateway, Anthropic-compat) |
932
+ | deepseek | `DEEPSEEK_API_KEY` | Native | deepseek-v4-flash |
933
+ | gemini-cli | `GEMINI_API_KEY` | Prompt-only / CLI bridge | (via gemini CLI) |
934
+ | codex-cli | `OPENAI_API_KEY` | Prompt-only / CLI bridge | (via codex CLI) |
935
+
936
+ > **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.
937
+
938
+ ### Examples
939
+
940
+ ```bash
941
+ # Use Zhipu Coding
942
+ kodax --provider zhipu-coding --thinking "Help me optimize this code"
943
+
944
+ # Use OpenAI
945
+ export OPENAI_API_KEY=your_key
946
+ kodax --provider openai "Create a REST API"
947
+
948
+ # Resume last session
949
+ kodax --session resume
950
+
951
+ # List all sessions
952
+ kodax --session list
953
+
954
+ # Parallel tool execution
955
+ kodax --parallel "Read package.json and tsconfig.json"
956
+
957
+ # Adaptive multi-agent (AMA) mode — Scout-first fan-out for multi-file work
958
+ kodax --agent-mode ama "Analyze code structure, check test coverage, find bugs"
959
+ ```
960
+
961
+ ---
962
+
963
+ ## Tools
964
+
965
+ 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.
966
+
967
+ ### File operations
968
+ | Tool | Description |
969
+ |------|-------------|
970
+ | `read` | Read file contents (supports offset/limit) |
971
+ | `write` | Write a new file or fully rewrite an existing one |
972
+ | `edit` | Exact string replacement (supports `replace_all`) |
973
+ | `multi_edit` | Atomic batch of independent edits to one file |
974
+ | `insert_after_anchor` | Insert content after a unique anchor without rewriting the file |
975
+ | `undo` | Revert the last file modification |
976
+
977
+ ### Shell & search
978
+ | Tool | Description |
979
+ |------|-------------|
980
+ | `bash` | Execute a shell command (supports `run_in_background`, output truncation) |
981
+ | `glob` | Find files by pattern |
982
+ | `grep` | Regex content search (context lines, multiline, file-type filter, pagination) |
983
+ | `code_search` | Lower-noise code search (extension-provider aware) |
984
+ | `semantic_lookup` | Symbol/module/process-aware search backed by repo intelligence |
985
+ | `web_search` | Discovery-oriented web search with trust + freshness signals |
986
+ | `web_fetch` | Fetch a specific URL with provenance hints |
987
+
988
+ ### Repo Intelligence (working tools)
989
+ | Tool | Description |
990
+ |------|-------------|
991
+ | `repo_overview` | Summarize structure, key areas, entry hints, intelligence snapshot |
992
+ | `changed_scope` | Which files/areas/categories the current diff touches |
993
+ | `changed_diff` | Paged diff slice for a single file |
994
+ | `changed_diff_bundle` | Paged diff slices for multiple files in one call |
995
+ | `module_context` | Module capsule (deps, entries, symbols, tests, docs) |
996
+ | `symbol_context` | Definition + probable callers/callees + alternatives |
997
+ | `process_context` | Approximate static execution capsule for an entry |
998
+ | `impact_estimate` | Blast radius for a symbol/path/module |
999
+
1000
+ ### MCP capabilities (when MCP servers are configured)
1001
+ | Tool | Description |
1002
+ |------|-------------|
1003
+ | `mcp_search` / `mcp_describe` / `mcp_call` | Discover and invoke MCP tools through the shared capability runtime |
1004
+ | `mcp_read_resource` / `mcp_get_prompt` | Read MCP resources and prompts |
1005
+
1006
+ ### Git worktree
1007
+ | Tool | Description |
1008
+ |------|-------------|
1009
+ | `worktree_create` | Create a new worktree on an isolated branch for safe agent work |
1010
+ | `worktree_remove` | Remove a worktree (with safety checks) |
1011
+
1012
+ ### Agent control & UX
1013
+ | Tool | Description |
1014
+ |------|-------------|
1015
+ | `dispatch_child_task` | Spawn a sub-agent for an independent investigation/edit task |
1016
+ | `ask_user_question` | Single/multi-select or free-text prompt back to the user |
1017
+ | `exit_plan_mode` | Present a finalized plan for approval (REPL only) |
1018
+ | `emit_managed_protocol` | Internal scout/planner/handoff/verdict side-channel |
1019
+
1020
+ ---
1021
+
1022
+ ## Skills System
1023
+
1024
+ KodaX includes a built-in Skills system that can be triggered by natural language:
1025
+
1026
+ ```bash
1027
+ # Natural language triggering (no explicit /skill needed)
1028
+ kodax "帮我审查代码" # Triggers code-review skill
1029
+ kodax "写测试用例" # Triggers tdd skill
1030
+ kodax "提交代码" # Triggers git-workflow skill
1031
+
1032
+ # Explicit skill command
1033
+ kodax /skill:code-review
1034
+ ```
1035
+
1036
+ Built-in skills include:
1037
+ - **code-review** - Code review and quality analysis
1038
+ - **tdd** - Test-driven development workflow
1039
+ - **git-workflow** - Git commit and workflow automation
1040
+
1041
+ Skills are stored in `~/.kodax/skills/` and can be extended with custom skills.
1042
+
1043
+ ---
1044
+
1045
+ ## Commands (CLI)
1046
+
1047
+ Commands are `/xxx` shortcuts in CLI:
1048
+
1049
+ ```bash
1050
+ kodax /review src/auth.ts
1051
+ kodax /test
1052
+ ```
1053
+
1054
+ Commands are stored in `~/.kodax/commands/`:
1055
+ - `.md` files → Prompt commands (content used as prompt)
1056
+ - `.ts/.js` files → Programmable commands
1057
+
1058
+ ---
1059
+
1060
+ ## API Exports
1061
+
1062
+ ```typescript
1063
+ // Main functions
1064
+ export { runKodaX, KodaXClient };
1065
+
1066
+ // Types
1067
+ export type {
1068
+ KodaXEvents, KodaXOptions, KodaXResult,
1069
+ KodaXMessage, KodaXContentBlock,
1070
+ KodaXSessionStorage, KodaXToolDefinition
1071
+ };
1072
+
1073
+ // Tools
1074
+ export { KODAX_TOOLS, KODAX_TOOL_REQUIRED_PARAMS, executeTool };
1075
+
1076
+ // Providers
1077
+ export { getProvider, KODAX_PROVIDERS, KodaXBaseProvider };
1078
+
1079
+ // Utilities
1080
+ export {
1081
+ estimateTokens,
1082
+ getGitRoot, getGitContext, getEnvContext, getProjectSnapshot,
1083
+ checkPromiseSignal
1084
+ };
1085
+ ```
1086
+
1087
+ ---
1088
+
1089
+ ## Development
1090
+
1091
+ ```bash
1092
+ # Development mode (using tsx)
1093
+ npm run dev "your task"
1094
+
1095
+ # Build
1096
+ npm run build
1097
+
1098
+ # Optional: only build workspace packages
1099
+ npm run build:packages
1100
+
1101
+ # Build standalone binary (current platform / all platforms)
1102
+ npm run build:binary
1103
+ npm run build:binary:all
1104
+
1105
+ # Run tests
1106
+ npm test
1107
+
1108
+ # Eval-driven development tests (provider matrices, identity round-trip, etc.)
1109
+ npm run test:eval
1110
+
1111
+ # Clean
1112
+ npm run clean
1113
+ ```
1114
+
1115
+ ### Repo Intelligence cache directories
1116
+
1117
+ KodaX now uses two repo-intelligence cache locations on disk:
1118
+
1119
+ - `.agent/repo-intelligence/`
1120
+ - OSS baseline repo-intelligence artifacts and existing task-engine snapshots.
1121
+ - `.repointel/`
1122
+ - Premium `repointel` workspace cache shared by the local daemon/native frontdoor.
1123
+
1124
+ They are intentionally separated so:
1125
+
1126
+ - OSS fallback stays available even when premium is disabled or unavailable.
1127
+ - Premium cache does not pollute OSS artifacts.
1128
+ - KodaX and other hosts can share the same premium workspace cache.
1129
+
1130
+ `.repointel/` is a local generated directory and should not be committed.
1131
+
1132
+ ---
1133
+
1134
+ ## Code Style
1135
+
1136
+ ### Comment Guidelines
1137
+
1138
+ KodaX uses an **English-first** comment style with selective Chinese brief notes for complex logic.
1139
+
1140
+ | Situation | Style | Example |
1141
+ |-----------|-------|---------|
1142
+ | Import/Export | English only | `// Import dependencies` |
1143
+ | Simple constants | English only | `// Max retry count` |
1144
+ | Simple logic | English only | `// Return if null` |
1145
+ | **Business rules** | English + Chinese | `// Skip tool_result - 跳过工具结果块` |
1146
+ | **Platform compatibility** | English + Chinese | `// Windows path handling - Windows 路径处理` |
1147
+ | **Performance optimization** | English + Chinese | `// Debounce to prevent flicker - 防抖避免闪烁` |
1148
+
1149
+ ---
1150
+
1151
+ ## Documentation
1152
+
1153
+ - [README_CN.md](README_CN.md) - Chinese Documentation
1154
+ - [docs/release.md](docs/release.md) - Standalone binary build & release pipeline
1155
+ - [docs/PRD.md](docs/PRD.md) - Product Requirements
1156
+ - [docs/ADR.md](docs/ADR.md) - Architecture Decisions
1157
+ - [docs/HLD.md](docs/HLD.md) - High-Level Design
1158
+ - [docs/DD.md](docs/DD.md) - Detailed Design
1159
+ - [docs/FEATURE_LIST.md](docs/FEATURE_LIST.md) - Feature Tracking
1160
+ - [docs/test-guides/](docs/test-guides/) - Feature-specific test guides
1161
+ - [CHANGELOG.md](CHANGELOG.md) - Version History (v0.7.0+; [archive](docs/CHANGELOG_ARCHIVE.md) for older)
1162
+
1163
+ ---
1164
+
1165
+ ## License
1166
+
1167
+ [Apache License 2.0](LICENSE) - Copyright 2026 [icetomoyo](mailto:icetomoyo@gmail.com)