newcraw 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +692 -0
  3. package/README.zh-CN.md +338 -0
  4. package/cli-acp.js +82 -0
  5. package/cli.js +105 -0
  6. package/dist/REPL-74GZVSMY.js +42 -0
  7. package/dist/REPL-74GZVSMY.js.map +7 -0
  8. package/dist/acp-A55ZRIPP.js +1357 -0
  9. package/dist/acp-A55ZRIPP.js.map +7 -0
  10. package/dist/agentsValidate-XWFIEHJ2.js +373 -0
  11. package/dist/agentsValidate-XWFIEHJ2.js.map +7 -0
  12. package/dist/ask-4ACYU23S.js +126 -0
  13. package/dist/ask-4ACYU23S.js.map +7 -0
  14. package/dist/autoUpdater-O2WHHSGP.js +17 -0
  15. package/dist/autoUpdater-O2WHHSGP.js.map +7 -0
  16. package/dist/chunk-2UO3BFZH.js +16 -0
  17. package/dist/chunk-2UO3BFZH.js.map +7 -0
  18. package/dist/chunk-3C73U2IU.js +2970 -0
  19. package/dist/chunk-3C73U2IU.js.map +7 -0
  20. package/dist/chunk-3U5X4VWP.js +2613 -0
  21. package/dist/chunk-3U5X4VWP.js.map +7 -0
  22. package/dist/chunk-755HIAI3.js +95 -0
  23. package/dist/chunk-755HIAI3.js.map +7 -0
  24. package/dist/chunk-7ZFLZNOW.js +21 -0
  25. package/dist/chunk-7ZFLZNOW.js.map +7 -0
  26. package/dist/chunk-A44DGORI.js +49 -0
  27. package/dist/chunk-A44DGORI.js.map +7 -0
  28. package/dist/chunk-AXWJI6N5.js +11 -0
  29. package/dist/chunk-AXWJI6N5.js.map +7 -0
  30. package/dist/chunk-B26ZUMJI.js +515 -0
  31. package/dist/chunk-B26ZUMJI.js.map +7 -0
  32. package/dist/chunk-BHNQGSLO.js +96 -0
  33. package/dist/chunk-BHNQGSLO.js.map +7 -0
  34. package/dist/chunk-BUI6KGVA.js +164 -0
  35. package/dist/chunk-BUI6KGVA.js.map +7 -0
  36. package/dist/chunk-DY5D4SS7.js +936 -0
  37. package/dist/chunk-DY5D4SS7.js.map +7 -0
  38. package/dist/chunk-EENI5HG7.js +498 -0
  39. package/dist/chunk-EENI5HG7.js.map +7 -0
  40. package/dist/chunk-EXPWPWA4.js +654 -0
  41. package/dist/chunk-EXPWPWA4.js.map +7 -0
  42. package/dist/chunk-FHOCKJOW.js +766 -0
  43. package/dist/chunk-FHOCKJOW.js.map +7 -0
  44. package/dist/chunk-GPKVTIYJ.js +191 -0
  45. package/dist/chunk-GPKVTIYJ.js.map +7 -0
  46. package/dist/chunk-H5BCUDEN.js +794 -0
  47. package/dist/chunk-H5BCUDEN.js.map +7 -0
  48. package/dist/chunk-INJSFEKL.js +47 -0
  49. package/dist/chunk-INJSFEKL.js.map +7 -0
  50. package/dist/chunk-JX5ZQYTQ.js +12 -0
  51. package/dist/chunk-JX5ZQYTQ.js.map +7 -0
  52. package/dist/chunk-KQSHIOZK.js +24 -0
  53. package/dist/chunk-KQSHIOZK.js.map +7 -0
  54. package/dist/chunk-L6WKZEK4.js +1609 -0
  55. package/dist/chunk-L6WKZEK4.js.map +7 -0
  56. package/dist/chunk-LC4CL3YJ.js +124 -0
  57. package/dist/chunk-LC4CL3YJ.js.map +7 -0
  58. package/dist/chunk-MXSB7IOZ.js +1097 -0
  59. package/dist/chunk-MXSB7IOZ.js.map +7 -0
  60. package/dist/chunk-N5OHRWG2.js +249 -0
  61. package/dist/chunk-N5OHRWG2.js.map +7 -0
  62. package/dist/chunk-NQE3GGE3.js +19 -0
  63. package/dist/chunk-NQE3GGE3.js.map +7 -0
  64. package/dist/chunk-QF6YDTME.js +139 -0
  65. package/dist/chunk-QF6YDTME.js.map +7 -0
  66. package/dist/chunk-QTX7AJFQ.js +240 -0
  67. package/dist/chunk-QTX7AJFQ.js.map +7 -0
  68. package/dist/chunk-S3ZAJPYZ.js +515 -0
  69. package/dist/chunk-S3ZAJPYZ.js.map +7 -0
  70. package/dist/chunk-S5Y5IF2H.js +735 -0
  71. package/dist/chunk-S5Y5IF2H.js.map +7 -0
  72. package/dist/chunk-SBE6Y327.js +836 -0
  73. package/dist/chunk-SBE6Y327.js.map +7 -0
  74. package/dist/chunk-T25Z3JMG.js +17 -0
  75. package/dist/chunk-T25Z3JMG.js.map +7 -0
  76. package/dist/chunk-T6VKT5FR.js +196 -0
  77. package/dist/chunk-T6VKT5FR.js.map +7 -0
  78. package/dist/chunk-TSGGSPYD.js +151 -0
  79. package/dist/chunk-TSGGSPYD.js.map +7 -0
  80. package/dist/chunk-TY3CCSAT.js +24 -0
  81. package/dist/chunk-TY3CCSAT.js.map +7 -0
  82. package/dist/chunk-U224EQOS.js +34 -0
  83. package/dist/chunk-U224EQOS.js.map +7 -0
  84. package/dist/chunk-U7S4MEYP.js +95 -0
  85. package/dist/chunk-U7S4MEYP.js.map +7 -0
  86. package/dist/chunk-ULVAAZ2U.js +30517 -0
  87. package/dist/chunk-ULVAAZ2U.js.map +7 -0
  88. package/dist/chunk-WWLFALT7.js +128 -0
  89. package/dist/chunk-WWLFALT7.js.map +7 -0
  90. package/dist/chunk-XJQATPV7.js +23 -0
  91. package/dist/chunk-XJQATPV7.js.map +7 -0
  92. package/dist/chunk-XMGUQHMF.js +72 -0
  93. package/dist/chunk-XMGUQHMF.js.map +7 -0
  94. package/dist/chunk-XOMW5QTV.js +472 -0
  95. package/dist/chunk-XOMW5QTV.js.map +7 -0
  96. package/dist/chunk-Y7VZUSIM.js +1256 -0
  97. package/dist/chunk-Y7VZUSIM.js.map +7 -0
  98. package/dist/chunk-YVNBXMIP.js +511 -0
  99. package/dist/chunk-YVNBXMIP.js.map +7 -0
  100. package/dist/chunk-YYPJWXSA.js +145 -0
  101. package/dist/chunk-YYPJWXSA.js.map +7 -0
  102. package/dist/cli-BW34VKCN.js +3917 -0
  103. package/dist/cli-BW34VKCN.js.map +7 -0
  104. package/dist/commands-4CNZZBTE.js +46 -0
  105. package/dist/commands-4CNZZBTE.js.map +7 -0
  106. package/dist/config-XKRCXCSS.js +81 -0
  107. package/dist/config-XKRCXCSS.js.map +7 -0
  108. package/dist/context-T5CR3RP6.js +30 -0
  109. package/dist/context-T5CR3RP6.js.map +7 -0
  110. package/dist/costTracker-2G3ZI2JF.js +19 -0
  111. package/dist/costTracker-2G3ZI2JF.js.map +7 -0
  112. package/dist/customCommands-OCUMXZDN.js +25 -0
  113. package/dist/customCommands-OCUMXZDN.js.map +7 -0
  114. package/dist/env-DYDNFB4D.js +22 -0
  115. package/dist/env-DYDNFB4D.js.map +7 -0
  116. package/dist/index.js +34 -0
  117. package/dist/index.js.map +7 -0
  118. package/dist/kodeAgentSessionId-KTGFX2BE.js +13 -0
  119. package/dist/kodeAgentSessionId-KTGFX2BE.js.map +7 -0
  120. package/dist/kodeAgentSessionLoad-ZKR2VGHO.js +18 -0
  121. package/dist/kodeAgentSessionLoad-ZKR2VGHO.js.map +7 -0
  122. package/dist/kodeAgentSessionResume-NFZCTIBZ.js +16 -0
  123. package/dist/kodeAgentSessionResume-NFZCTIBZ.js.map +7 -0
  124. package/dist/kodeAgentStreamJson-VIXFTYL5.js +13 -0
  125. package/dist/kodeAgentStreamJson-VIXFTYL5.js.map +7 -0
  126. package/dist/kodeAgentStreamJsonSession-6CKTK6AF.js +131 -0
  127. package/dist/kodeAgentStreamJsonSession-6CKTK6AF.js.map +7 -0
  128. package/dist/kodeAgentStructuredStdio-SI5C7AAD.js +10 -0
  129. package/dist/kodeAgentStructuredStdio-SI5C7AAD.js.map +7 -0
  130. package/dist/kodeHooks-5RXJRDCY.js +36 -0
  131. package/dist/kodeHooks-5RXJRDCY.js.map +7 -0
  132. package/dist/llm-QJA3QMXR.js +3118 -0
  133. package/dist/llm-QJA3QMXR.js.map +7 -0
  134. package/dist/llmLazy-VCEV22DK.js +15 -0
  135. package/dist/llmLazy-VCEV22DK.js.map +7 -0
  136. package/dist/loader-CKNYMPCZ.js +28 -0
  137. package/dist/loader-CKNYMPCZ.js.map +7 -0
  138. package/dist/mcp-2SZTOKZX.js +49 -0
  139. package/dist/mcp-2SZTOKZX.js.map +7 -0
  140. package/dist/mentionProcessor-O7NWOH6S.js +211 -0
  141. package/dist/mentionProcessor-O7NWOH6S.js.map +7 -0
  142. package/dist/messages-PRKIHXMK.js +65 -0
  143. package/dist/messages-PRKIHXMK.js.map +7 -0
  144. package/dist/model-WG6RA25G.js +30 -0
  145. package/dist/model-WG6RA25G.js.map +7 -0
  146. package/dist/openai-VQLYFQ6B.js +29 -0
  147. package/dist/openai-VQLYFQ6B.js.map +7 -0
  148. package/dist/outputStyles-VQ57E3B6.js +28 -0
  149. package/dist/outputStyles-VQ57E3B6.js.map +7 -0
  150. package/dist/package.json +4 -0
  151. package/dist/pluginRuntime-NWOLU73K.js +218 -0
  152. package/dist/pluginRuntime-NWOLU73K.js.map +7 -0
  153. package/dist/pluginValidation-R7B6QQ6T.js +17 -0
  154. package/dist/pluginValidation-R7B6QQ6T.js.map +7 -0
  155. package/dist/prompts-W4V4Y67M.js +48 -0
  156. package/dist/prompts-W4V4Y67M.js.map +7 -0
  157. package/dist/query-GFFKKURO.js +50 -0
  158. package/dist/query-GFFKKURO.js.map +7 -0
  159. package/dist/responsesStreaming-2AIT6GHG.js +10 -0
  160. package/dist/responsesStreaming-2AIT6GHG.js.map +7 -0
  161. package/dist/ripgrep-SVBVC46X.js +17 -0
  162. package/dist/ripgrep-SVBVC46X.js.map +7 -0
  163. package/dist/skillMarketplace-5Z7Y6FTD.js +37 -0
  164. package/dist/skillMarketplace-5Z7Y6FTD.js.map +7 -0
  165. package/dist/state-X3R7BV7A.js +16 -0
  166. package/dist/state-X3R7BV7A.js.map +7 -0
  167. package/dist/theme-4VA64EWF.js +14 -0
  168. package/dist/theme-4VA64EWF.js.map +7 -0
  169. package/dist/toolPermissionContext-I3IXPVED.js +17 -0
  170. package/dist/toolPermissionContext-I3IXPVED.js.map +7 -0
  171. package/dist/toolPermissionSettings-35DJQEKG.js +18 -0
  172. package/dist/toolPermissionSettings-35DJQEKG.js.map +7 -0
  173. package/dist/tools-USOBTPOI.js +47 -0
  174. package/dist/tools-USOBTPOI.js.map +7 -0
  175. package/dist/userInput-NID2UYXG.js +312 -0
  176. package/dist/userInput-NID2UYXG.js.map +7 -0
  177. package/dist/uuid-VA3KVASX.js +9 -0
  178. package/dist/uuid-VA3KVASX.js.map +7 -0
  179. package/dist/yoga.wasm +0 -0
  180. package/package.json +135 -0
  181. package/scripts/binary-utils.cjs +61 -0
  182. package/scripts/cli-acp-wrapper.cjs +82 -0
  183. package/scripts/cli-wrapper.cjs +105 -0
  184. package/scripts/postinstall.js +144 -0
  185. package/web/dist/assets/index-COAJqX1Z.css +1 -0
  186. package/web/dist/assets/index-CzS_4LmC.js +179 -0
  187. package/web/dist/index.html +14 -0
  188. package/yoga.wasm +0 -0
package/README.md ADDED
@@ -0,0 +1,692 @@
1
+ # Kode - AI Coding
2
+ <img width="991" height="479" alt="image" src="https://github.com/user-attachments/assets/c1751e92-94dc-4e4a-9558-8cd2d058c1a1" /> <br>
3
+ [![npm version](https://badge.fury.io/js/@shareai-lab%2Fkode.svg)](https://www.npmjs.com/package/@shareai-lab/kode)
4
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
5
+ [![AGENTS.md](https://img.shields.io/badge/AGENTS.md-Compatible-brightgreen)](https://agents.md)
6
+
7
+ [中文文档](README.zh-CN.md) | [Contributing](CONTRIBUTING.md) | [Documentation](docs/README.md)
8
+
9
+ <img width="90%" alt="image" src="https://github.com/user-attachments/assets/fdce7017-8095-429d-b74e-07f43a6919e1" />
10
+
11
+ <img width="90%" alt="2c0ad8540f2872d197c7b17ae23d74f5" src="https://github.com/user-attachments/assets/f220cc27-084d-468e-a3f4-d5bc44d84fac" />
12
+
13
+ <img width="90%" alt="f266d316d90ddd0db5a3d640c1126930" src="https://github.com/user-attachments/assets/90ec7399-1349-4607-b689-96613b3dc3e2" />
14
+
15
+
16
+ <img width="90%" alt="image" src="https://github.com/user-attachments/assets/b30696ce-5ab1-40a0-b741-c7ef3945dba0" />
17
+
18
+
19
+ ## 📢 Update Log
20
+
21
+ **2025-12-22**: Native-first distribution (Windows OOTB). Kode prefers a cached native binary and falls back to the Node.js runtime when needed. See `docs/binary-distribution.md`.
22
+
23
+
24
+ ## 🤝 AGENTS.md Standard Support
25
+
26
+ Kode supports the [AGENTS.md standard](https://agents.md): a simple, open format for guiding coding agents, used by 60k+ open-source projects.
27
+
28
+ ### Full Compatibility with Multiple Standards
29
+
30
+ - ✅ **AGENTS.md** - Native support for the OpenAI-initiated standard format
31
+ - ✅ **Legacy `.claude` compatibility** - Reads `.claude` directories and `CLAUDE.md` when present (see `docs/compatibility.md`)
32
+ - ✅ **Subagent System** - Advanced agent delegation and task orchestration
33
+ - ✅ **Cross-platform** - Works with 20+ AI models and providers
34
+
35
+ Use `# Your documentation request` to generate and maintain your AGENTS.md file automatically, while preserving compatibility with existing `.claude` workflows.
36
+
37
+ ### Instruction Discovery (Codex-compatible)
38
+
39
+ - Kode reads project instructions by walking from the Git repo root → current working directory.
40
+ - In each directory, it prefers `AGENTS.override.md` over `AGENTS.md` (at most one file per directory).
41
+ - Discovered files are concatenated root → leaf (combined size capped at 32 KiB by default; override with `KODE_PROJECT_DOC_MAX_BYTES`).
42
+ - If `CLAUDE.md` exists in the current directory, Kode also reads it as a legacy instruction file.
43
+
44
+ ## Overview
45
+
46
+ Kode is a powerful AI assistant that lives in your terminal. It can understand your codebase, edit files, run commands, and handle entire workflows for you.
47
+
48
+ > **⚠️ Security Notice**: Kode runs in YOLO mode by default (equivalent to the `--dangerously-skip-permissions` flag), bypassing all permission checks for maximum productivity. YOLO mode is recommended only for trusted, secure environments when working on non-critical projects. If you're working with important files or using models of questionable capability, we strongly recommend using `kode --safe` to enable permission checks and manual approval for all operations.
49
+ >
50
+ > **📊 Model Performance**: For optimal performance, we recommend using newer, more capable models designed for autonomous task completion. Avoid older Q&A-focused models like GPT-4o or Gemini 2.5 Pro, which are optimized for answering questions rather than sustained independent task execution. Choose models specifically trained for agentic workflows and extended reasoning capabilities.
51
+
52
+ ## Network & Privacy
53
+
54
+ - Kode does not send product telemetry/analytics by default.
55
+ - Network requests happen only when you explicitly use networked features:
56
+ - Model provider requests (Anthropic/OpenAI-compatible endpoints you configure)
57
+ - Web tools (`WebFetch`, `WebSearch`)
58
+ - Plugin marketplace downloads (GitHub/URL sources) and OAuth flows (when used)
59
+ - Optional update checks (opt-in via `autoUpdaterStatus: enabled`)
60
+
61
+ <img width="600" height="577" alt="image" src="https://github.com/user-attachments/assets/8b46a39d-1ab6-4669-9391-14ccc6c5234c" />
62
+
63
+ ## Features
64
+
65
+ ### Core Capabilities
66
+ - 🤖 **AI-Powered Assistance** - Uses advanced AI models to understand and respond to your requests
67
+ - 🔄 **Multi-Model Collaboration** - Flexibly switch and combine multiple AI models to leverage their unique strengths
68
+ - 🦜 **Expert Model Consultation** - Use `@ask-model-name` to consult specific AI models for specialized analysis
69
+ - 👤 **Intelligent Agent System** - Use `@run-agent-name` to delegate tasks to specialized subagents
70
+ - 📝 **Code Editing** - Directly edit files with intelligent suggestions and improvements
71
+ - 🔍 **Codebase Understanding** - Analyzes your project structure and code relationships
72
+ - 🚀 **Command Execution** - Run shell commands and see results in real-time
73
+ - 🛠️ **Workflow Automation** - Handle complex development tasks with simple prompts
74
+
75
+ ### Authoring Comfort
76
+ - `Option+G` (Alt+G) opens your message in your preferred editor (respects `$EDITOR`/`$VISUAL`; falls back to code/nano/vim/notepad) and returns the text to the prompt when you close it.
77
+ - `Option+Enter` inserts a newline inside the prompt without sending; plain Enter submits. `Option+M` cycles the active model.
78
+
79
+ ### 🎯 Advanced Intelligent Completion System
80
+ Our state-of-the-art completion system provides unparalleled coding assistance:
81
+
82
+ #### Smart Fuzzy Matching
83
+ - **Hyphen-Aware Matching** - Type `dao` to match `run-agent-dao-qi-harmony-designer`
84
+ - **Abbreviation Support** - `dq` matches `dao-qi`, `nde` matches `node`
85
+ - **Numeric Suffix Handling** - `py3` intelligently matches `python3`
86
+ - **Multi-Algorithm Fusion** - Combines 7+ matching algorithms for best results
87
+
88
+ #### Intelligent Context Detection
89
+ - **No @ Required** - Type `gp5` directly to match `@ask-gpt-5`
90
+ - **Auto-Prefix Addition** - Tab/Enter automatically adds `@` for agents and models
91
+ - **Mixed Completion** - Seamlessly switch between commands, files, agents, and models
92
+ - **Smart Prioritization** - Results ranked by relevance and usage frequency
93
+
94
+ #### Unix Command Optimization
95
+ - **500+ Common Commands** - Curated database of frequently used Unix/Linux commands
96
+ - **System Intersection** - Only shows commands that actually exist on your system
97
+ - **Priority Scoring** - Common commands appear first (git, npm, docker, etc.)
98
+ - **Real-time Loading** - Dynamic command discovery from system PATH
99
+
100
+ ### User Experience
101
+ - 🎨 **Interactive UI** - Beautiful terminal interface with syntax highlighting
102
+ - 🔌 **Tool System** - Extensible architecture with specialized tools for different tasks
103
+ - 💾 **Context Management** - Smart context handling to maintain conversation continuity
104
+ - 📋 **AGENTS.md Integration** - Use `# documentation requests` to auto-generate and maintain project documentation
105
+
106
+ ## Installation
107
+
108
+ ```bash
109
+ npm install -g @shareai-lab/kode
110
+ ```
111
+
112
+ > **🇨🇳 For users in China**: If you encounter network issues, use a mirror registry:
113
+ > ```bash
114
+ > npm install -g @shareai-lab/kode --registry=https://registry.npmmirror.com
115
+ > ```
116
+
117
+ Dev channel (latest features):
118
+
119
+ ```bash
120
+ npm install -g @shareai-lab/kode@dev
121
+ ```
122
+
123
+ After installation, you can use any of these commands:
124
+ - `kode` - Primary command
125
+ - `kwa` - Kode With Agent (alternative)
126
+ - `kd` - Ultra-short alias
127
+
128
+ ### Native binaries (Windows OOTB)
129
+
130
+ - No WSL/Git Bash required.
131
+ - On `postinstall`, Kode will best-effort download a native binary from GitHub Releases into `${KODE_BIN_DIR:-~/.kode/bin}/<version>/<platform>-<arch>/kode(.exe)`.
132
+ - The wrapper (`cli.js`) prefers the native binary and falls back to the Node.js runtime (`node dist/index.js`) when needed.
133
+
134
+ Overrides:
135
+ - Mirror downloads: `KODE_BINARY_BASE_URL`
136
+ - Disable download: `KODE_SKIP_BINARY_DOWNLOAD=1`
137
+ - Cache directory: `KODE_BIN_DIR`
138
+
139
+ See `docs/binary-distribution.md`.
140
+
141
+ ### Configuration / API keys
142
+
143
+ - Global config (models, pointers, theme, etc): `~/.kode.json` (or `<KODE_CONFIG_DIR>/config.json` when `KODE_CONFIG_DIR`/`CLAUDE_CONFIG_DIR` is set).
144
+ - Project/local settings (output style, etc): `./.kode/settings.json` and `./.kode/settings.local.json` (legacy `.claude` is supported for some features).
145
+ - Configure models via `/model` (UI) or `kode models import/export` (YAML). Details: `docs/develop/configuration.md`.
146
+
147
+ ## Usage
148
+
149
+ ### Interactive Mode
150
+ Start an interactive session:
151
+ ```bash
152
+ kode
153
+ # or
154
+ kwa
155
+ # or
156
+ kd
157
+ ```
158
+
159
+ ### Non-Interactive Mode
160
+ Get a quick response:
161
+ ```bash
162
+ kode -p "explain this function" path/to/file.js
163
+ # or
164
+ kwa -p "explain this function" path/to/file.js
165
+ ```
166
+
167
+ ### ACP (Agent Client Protocol)
168
+
169
+ Run Kode as an ACP agent server (stdio JSON-RPC), for clients like Toad/Zed:
170
+
171
+ ```bash
172
+ kode-acp
173
+ # or
174
+ kode --acp
175
+ ```
176
+
177
+ Toad example:
178
+
179
+ ```bash
180
+ toad acp "kode-acp"
181
+ ```
182
+
183
+ More: `docs/acp.md`.
184
+
185
+ ### Using the @ Mention System
186
+
187
+ Kode supports a powerful @ mention system for intelligent completions:
188
+
189
+ #### 🦜 Expert Model Consultation
190
+ ```bash
191
+ # Consult specific AI models for expert opinions
192
+ @ask-claude-sonnet-4 How should I optimize this React component for performance?
193
+ @ask-gpt-5 What are the security implications of this authentication method?
194
+ @ask-o1-preview Analyze the complexity of this algorithm
195
+ ```
196
+
197
+ #### 👤 Specialized Agent Delegation
198
+ ```bash
199
+ # Delegate tasks to specialized subagents
200
+ @run-agent-simplicity-auditor Review this code for over-engineering
201
+ @run-agent-architect Design a microservices architecture for this system
202
+ @run-agent-test-writer Create comprehensive tests for these modules
203
+ ```
204
+
205
+ #### 📁 Smart File References
206
+ ```bash
207
+ # Reference files and directories with auto-completion
208
+ @packages/core/src/query/index.ts
209
+ @docs/README.md
210
+ @.env.example
211
+ ```
212
+
213
+ The @ mention system provides intelligent completions as you type, showing available models, agents, and files.
214
+
215
+ ### MCP Servers (Extensions)
216
+
217
+ Kode can connect to MCP servers to extend tools and context.
218
+
219
+ - Config files: `.mcp.json` (recommended) or `.mcprc` in your project root. See `docs/mcp.md`.
220
+ - CLI:
221
+
222
+ ```bash
223
+ kode mcp add
224
+ kode mcp list
225
+ kode mcp get <name>
226
+ kode mcp remove <name>
227
+ ```
228
+
229
+ Example `.mcprc`:
230
+
231
+ ```json
232
+ {
233
+ "my-sse-server": { "type": "sse", "url": "http://127.0.0.1:3333/sse" }
234
+ }
235
+ ```
236
+
237
+ ### Permissions & Approvals
238
+
239
+ - Default mode skips most prompts for speed.
240
+ - Safe mode: `kode --safe` requires approval for Bash commands and file writes/edits.
241
+ - Plan mode: the assistant may ask to enter plan mode to draft a plan file; while in plan mode, only read-only/planning tools (and the plan file) are allowed until you approve exiting plan mode.
242
+
243
+ ### Paste & Images
244
+
245
+ - Multi-line/large paste is inserted as a placeholder and expanded on submit.
246
+ - Pasting multiple existing file paths inserts `@path` mentions automatically (quoted when needed).
247
+ - Image paste (macOS): press `Ctrl+V` to attach clipboard images; you can paste multiple images before sending.
248
+
249
+ ### System Sandbox (Linux)
250
+
251
+ - In safe mode (or with `KODE_SYSTEM_SANDBOX=1`), agent-triggered Bash tool calls try to run inside a `bwrap` sandbox when available.
252
+ - Network is disabled by default; set `KODE_SYSTEM_SANDBOX_NETWORK=inherit` to allow network.
253
+ - Set `KODE_SYSTEM_SANDBOX=required` to fail closed if sandbox cannot be started.
254
+ - See `docs/system-sandbox.md` for details and platform notes.
255
+
256
+ ### Troubleshooting
257
+
258
+ - Models: use `/model`, or `kode models import kode-models.yaml`, and ensure required API key env vars exist.
259
+ - Windows: if the native binary download is blocked/offline, set `KODE_BINARY_BASE_URL` (mirror) or `KODE_SKIP_BINARY_DOWNLOAD=1` (skip download); the wrapper will fall back to the Node.js runtime (`dist/index.js`).
260
+ - MCP: use `kode mcp list` to check server status; tune `MCP_CONNECTION_TIMEOUT_MS`, `MCP_SERVER_CONNECTION_BATCH_SIZE`, and `MCP_TOOL_TIMEOUT` if servers are slow.
261
+ - Sandbox: install `bwrap` (bubblewrap) on Linux, or set `KODE_SYSTEM_SANDBOX=0` to disable.
262
+
263
+ ### AGENTS.md Documentation Mode
264
+
265
+ Use the `#` prefix to generate and maintain your AGENTS.md documentation:
266
+
267
+ ```bash
268
+ # Generate setup instructions
269
+ # How do I set up the development environment?
270
+
271
+ # Create testing documentation
272
+ # What are the testing procedures for this project?
273
+
274
+ # Document deployment process
275
+ # Explain the deployment pipeline and requirements
276
+ ```
277
+
278
+ This mode automatically formats responses as structured documentation and appends them to your AGENTS.md file.
279
+
280
+ ### Docker Usage
281
+
282
+ #### Alternative: Build from local source
283
+
284
+ ```bash
285
+ # Clone the repository
286
+ git clone https://github.com/shareAI-lab/Kode.git
287
+ cd Kode
288
+
289
+ # Build the image locally
290
+ docker build --no-cache -t kode .
291
+
292
+ # Run in your project directory
293
+ cd your-project
294
+ docker run -it --rm \
295
+ -v $(pwd):/workspace \
296
+ -v ~/.kode:/root/.kode \
297
+ -v ~/.kode.json:/root/.kode.json \
298
+ -w /workspace \
299
+ kode
300
+ ```
301
+
302
+ #### Docker Configuration Details
303
+
304
+ The Docker setup includes:
305
+
306
+ - **Volume Mounts**:
307
+ - `$(pwd):/workspace` - Mounts your current project directory
308
+ - `~/.kode:/root/.kode` - Preserves your kode configuration directory between runs
309
+ - `~/.kode.json:/root/.kode.json` - Preserves your kode global configuration file between runs
310
+
311
+ - **Working Directory**: Set to `/workspace` inside the container
312
+
313
+ - **Interactive Mode**: Uses `-it` flags for interactive terminal access
314
+
315
+ - **Cleanup**: `--rm` flag removes the container after exit
316
+
317
+ **Note**: Kode uses both `~/.kode` directory for additional data (like memory files) and `~/.kode.json` file for global configuration.
318
+
319
+ The first time you run the Docker command, it will build the image. Subsequent runs will use the cached image for faster startup.
320
+
321
+ You can use the onboarding to set up the model, or `/model`.
322
+ If you don't see the models you want on the list, you can manually set them in `/config`
323
+ As long as you have an openai-like endpoint, it should work.
324
+
325
+ ### Commands
326
+
327
+ - `/help` - Show available commands
328
+ - `/model` - Change AI model settings
329
+ - `/config` - Open configuration panel
330
+ - `/agents` - Manage subagents
331
+ - `/output-style` - Set the output style
332
+ - `/statusline` - Configure a custom status line command
333
+ - `/cost` - Show token usage and costs
334
+ - `/clear` - Clear conversation history
335
+ - `/init` - Initialize project context
336
+ - `/plugin` - Manage plugins/marketplaces (skills, commands)
337
+
338
+ ## Agents / Subagents
339
+
340
+ Kode supports subagents (agent templates) for delegation and task orchestration.
341
+
342
+ - Agents are loaded from `.kode/agents` and `.claude/agents` (user + project), plus plugins/policy and `--agents`.
343
+ - Manage in the UI: `/agents` (creates new agents under `./.claude/agents` / `~/.claude/agents` by default).
344
+ - Run via mentions: `@run-agent-<agentType> ...`
345
+ - Run via tooling: `Task(subagent_type: "<agentType>", ...)`
346
+ - CLI flags: `--agents <json>` (inject agents for this run), `--setting-sources user,project,local` (control which sources are loaded)
347
+
348
+ Minimal agent file example (`./.kode/agents/reviewer.md`):
349
+
350
+ ```md
351
+ ---
352
+ name: reviewer
353
+ description: "Review diffs for correctness, security, and simplicity"
354
+ tools: ["Read", "Grep"]
355
+ model: inherit
356
+ ---
357
+
358
+ Be strict. Point out bugs and risky changes. Prefer small, targeted fixes.
359
+ ```
360
+
361
+ Model field notes:
362
+ - Compatibility aliases: `inherit`, `opus`, `sonnet`, `haiku` (mapped to model pointers)
363
+ - Kode selectors (via `/model`): pointers (`main|task|compact|quick`), profile name, modelName, or `provider:modelName` (e.g. `openai:o3`)
364
+
365
+ Validate agent templates:
366
+
367
+ ```bash
368
+ kode agents validate
369
+ ```
370
+
371
+ See `docs/agents-system.md`.
372
+
373
+ ## Skills & Plugins
374
+
375
+ Kode supports the [Agent Skills](https://agentskills.io) open format for extending agent capabilities:
376
+ - **Agent Skills** format (`SKILL.md`) - see [specification](https://agentskills.io/specification)
377
+ - **Marketplace compatibility** (`.kode-plugin/marketplace.json`, legacy `.claude-plugin/marketplace.json`)
378
+ - **Install from any repository** using [`add-skill` CLI](https://github.com/vercel-labs/add-skill)
379
+
380
+ ### Quick install with add-skill
381
+
382
+ Install skills from any git repository:
383
+
384
+ ```bash
385
+ # Install from GitHub
386
+ npx add-skill vercel-labs/agent-skills -a kode
387
+
388
+ # Install to global directory
389
+ npx add-skill vercel-labs/agent-skills -a kode -g
390
+
391
+ # Install specific skills
392
+ npx add-skill vercel-labs/agent-skills -a kode -s pdf -s xlsx
393
+ ```
394
+
395
+ ### Install skills from a marketplace
396
+
397
+ ```bash
398
+ # Add a marketplace (local path, GitHub owner/repo, or URL)
399
+ kode plugin marketplace add ./path/to/marketplace-repo
400
+ kode plugin marketplace add owner/repo
401
+ kode plugin marketplace list
402
+
403
+ # Install a plugin pack (installs skills/commands)
404
+ kode plugin install document-skills@anthropic-agent-skills --scope user
405
+
406
+ # Project-scoped install (writes to ./.kode/...)
407
+ kode plugin install document-skills@anthropic-agent-skills --scope project
408
+
409
+ # Disable/enable an installed plugin
410
+ kode plugin disable document-skills@anthropic-agent-skills --scope user
411
+ kode plugin enable document-skills@anthropic-agent-skills --scope user
412
+ ```
413
+
414
+ Interactive equivalents:
415
+
416
+ ```text
417
+ /plugin marketplace add owner/repo
418
+ /plugin install document-skills@anthropic-agent-skills --scope user
419
+ ```
420
+
421
+ ### Use skills
422
+
423
+ - In interactive mode, run a skill as a slash command: `/pdf`, `/xlsx`, etc.
424
+ - Kode can also invoke skills automatically via the `Skill` tool when relevant.
425
+
426
+ ### Create a skill (Agent Skills)
427
+
428
+ Create `./.kode/skills/<skill-name>/SKILL.md` (project) or `~/.kode/skills/<skill-name>/SKILL.md` (user):
429
+
430
+ ```md
431
+ ---
432
+ name: my-skill
433
+ description: Describe what this skill does and when to use it.
434
+ allowed-tools: Read Bash(git:*) Bash(jq:*)
435
+ ---
436
+
437
+ # Skill instructions
438
+ ```
439
+
440
+ Naming rules:
441
+ - `name` must match the folder name
442
+ - Lowercase letters/numbers/hyphens only, 1–64 chars
443
+
444
+ Compatibility:
445
+ - Kode also discovers `.claude/skills` and `.claude/commands` for legacy compatibility.
446
+
447
+ ### Distribute skills
448
+
449
+ - Marketplace repo: publish a repo containing `.kode-plugin/marketplace.json` listing plugin packs and their `skills` directories (legacy `.claude-plugin/marketplace.json` is also supported).
450
+ - Plugin repo: for full plugins (beyond skills), include `.kode-plugin/plugin.json` at the plugin root and keep all paths relative (`./...`).
451
+
452
+ See `docs/skills.md` for a compact reference and examples.
453
+
454
+ ### Output styles
455
+
456
+ Use output styles to switch system-prompt behavior.
457
+
458
+ - Select: `/output-style` (menu) or `/output-style <style>`
459
+ - Built-ins: `default`, `Explanatory`, `Learning`
460
+ - Stored per-project in `./.kode/settings.local.json` as `outputStyle` (legacy `.claude/settings.local.json` is supported)
461
+ - Custom styles: Markdown files under `output-styles/` in `.claude`/`.kode` user + project locations
462
+ - Plugins can provide styles under `output-styles/` (or manifest `outputStyles`); plugin styles are namespaced as `<plugin>:<style>`
463
+
464
+ See `docs/output-styles.md`.
465
+
466
+ ## Multi-Model Intelligent Collaboration
467
+
468
+ Unlike single-model CLIs, Kode implements **true multi-model collaboration**, allowing you to fully leverage the unique strengths of different AI models.
469
+
470
+ ### 🏗️ Core Technical Architecture
471
+
472
+ #### 1. **ModelManager Multi-Model Manager**
473
+ We designed a unified `ModelManager` system that supports:
474
+ - **Model Profiles**: Each model has an independent configuration file containing API endpoints, authentication, context window size, cost parameters, etc.
475
+ - **Model Pointers**: Users can configure default models for different purposes in the `/model` command:
476
+ - `main`: Default model for main Agent
477
+ - `task`: Default model for SubAgent
478
+ - `compact`: Model used for automatic context compression when nearing the context window
479
+ - `quick`: Fast model for simple operations and utilities
480
+ - **Dynamic Model Switching**: Support runtime model switching without restarting sessions, maintaining context continuity
481
+
482
+ #### 📦 Shareable Model Config (YAML)
483
+
484
+ You can export/import model profiles + pointers as a team-shareable YAML file. By default, exports do **not** include plaintext API keys (use env vars instead).
485
+
486
+ ```bash
487
+ # Export to a file (or omit --output to print to stdout)
488
+ kode models export --output kode-models.yaml
489
+
490
+ # Import (merge by default)
491
+ kode models import kode-models.yaml
492
+
493
+ # Replace existing profiles instead of merging
494
+ kode models import --replace kode-models.yaml
495
+
496
+ # List configured profiles + pointers
497
+ kode models list
498
+ ```
499
+
500
+ Example `kode-models.yaml`:
501
+
502
+ ```yaml
503
+ version: 1
504
+ profiles:
505
+ - name: OpenAI Main
506
+ provider: openai
507
+ modelName: gpt-4o
508
+ maxTokens: 8192
509
+ contextLength: 128000
510
+ apiKey:
511
+ fromEnv: OPENAI_API_KEY
512
+ pointers:
513
+ main: gpt-4o
514
+ task: gpt-4o
515
+ compact: gpt-4o
516
+ quick: gpt-4o
517
+ ```
518
+
519
+ #### 2. **TaskTool Intelligent Task Distribution**
520
+ Our specially designed `TaskTool` (Architect tool) implements:
521
+ - **Subagent Mechanism**: Can launch multiple sub-agents to process tasks in parallel
522
+ - **Model Parameter Passing**: Users can specify which model SubAgents should use in their requests
523
+ - **Default Model Configuration**: SubAgents use the model configured by the `task` pointer by default
524
+
525
+ #### 3. **AskExpertModel Expert Consultation Tool**
526
+ We specially designed the `AskExpertModel` tool:
527
+ - **Expert Model Invocation**: Allows temporarily calling specific expert models to solve difficult problems during conversations
528
+ - **Model Isolation Execution**: Expert model responses are processed independently without affecting the main conversation flow
529
+ - **Knowledge Integration**: Integrates expert model insights into the current task
530
+
531
+ #### 🎯 Flexible Model Switching
532
+ - **Option+M Quick Switch**: Press Option+M in the input box to cycle the main conversation model
533
+ - **`/model` Command**: Use `/model` command to configure and manage multiple model profiles, set default models for different purposes
534
+ - **User Control**: Users can specify specific models for task processing at any time
535
+
536
+ #### 🔄 Intelligent Work Allocation Strategy
537
+
538
+ **Architecture Design Phase**
539
+ - Use **o3 model** or **GPT-5 model** to explore system architecture and formulate sharp and clear technical solutions
540
+ - These models excel in abstract thinking and system design
541
+
542
+ **Solution Refinement Phase**
543
+ - Use **gemini model** to deeply explore production environment design details
544
+ - Leverage its deep accumulation in practical engineering and balanced reasoning capabilities
545
+
546
+ **Code Implementation Phase**
547
+ - Use **Qwen Coder model**, **Kimi k2 model**, **GLM-4.5 model**, or **Claude Sonnet 4 model** for specific code writing
548
+ - These models have strong performance in code generation, file editing, and engineering implementation
549
+ - Support parallel processing of multiple coding tasks through subagents
550
+
551
+ **Problem Solving**
552
+ - When encountering complex problems, consult expert models like **o3 model**, **Claude Opus 4.1 model**, or **Grok 4 model**
553
+ - Obtain deep technical insights and innovative solutions
554
+
555
+ #### 💡 Practical Application Scenarios
556
+
557
+ ```bash
558
+ # Example 1: Architecture Design
559
+ "Use o3 model to help me design a high-concurrency message queue system architecture"
560
+
561
+ # Example 2: Multi-Model Collaboration
562
+ "First use GPT-5 model to analyze the root cause of this performance issue, then use Claude Sonnet 4 model to write optimization code"
563
+
564
+ # Example 3: Parallel Task Processing
565
+ "Use Qwen Coder model as subagent to refactor these three modules simultaneously"
566
+
567
+ # Example 4: Expert Consultation
568
+ "This memory leak issue is tricky, ask Claude Opus 4.1 model separately for solutions"
569
+
570
+ # Example 5: Code Review
571
+ "Have Kimi k2 model review the code quality of this PR"
572
+
573
+ # Example 6: Complex Reasoning
574
+ "Use Grok 4 model to help me derive the time complexity of this algorithm"
575
+
576
+ # Example 7: Solution Design
577
+ "Have GLM-4.5 model design a microservice decomposition plan"
578
+ ```
579
+
580
+ ### 🛠️ Key Implementation Mechanisms
581
+
582
+ #### **Configuration System**
583
+ ```typescript
584
+ // Example of multi-model configuration support
585
+ {
586
+ "modelProfiles": [
587
+ { "name": "o3", "provider": "openai", "modelName": "o3", "apiKey": "...", "maxTokens": 1024, "contextLength": 128000, "isActive": true, "createdAt": 1710000000000 },
588
+ { "name": "qwen", "provider": "alibaba", "modelName": "qwen-coder", "apiKey": "...", "maxTokens": 1024, "contextLength": 128000, "isActive": true, "createdAt": 1710000000001 }
589
+ ],
590
+ "modelPointers": {
591
+ "main": "o3", // Main conversation model
592
+ "task": "qwen-coder", // Sub-agent model
593
+ "compact": "o3", // Context compression model
594
+ "quick": "o3" // Quick operations model
595
+ }
596
+ }
597
+ ```
598
+
599
+ #### **Cost Tracking System**
600
+ - **Usage Statistics**: Use `/cost` command to view token usage and costs for each model
601
+ - **Multi-Model Cost Comparison**: Track usage costs of different models in real-time
602
+ - **History Records**: Save cost data for each session
603
+
604
+ #### **Context Manager**
605
+ - **Context Inheritance**: Maintain conversation continuity when switching models
606
+ - **Context Window Adaptation**: Automatically adjust based on different models' context window sizes
607
+ - **Session State Preservation**: Ensure information consistency during multi-model collaboration
608
+
609
+ ### 🚀 Advantages of Multi-Model Collaboration
610
+
611
+ 1. **Maximized Efficiency**: Each task is handled by the most suitable model
612
+ 2. **Cost Optimization**: Use lightweight models for simple tasks, powerful models for complex tasks
613
+ 3. **Parallel Processing**: Multiple models can work on different subtasks simultaneously
614
+ 4. **Flexible Switching**: Switch models based on task requirements without restarting sessions
615
+ 5. **Leveraging Strengths**: Combine advantages of different models for optimal overall results
616
+
617
+ ### 📊 Comparison (Single-model CLI)
618
+
619
+ | Feature | Kode | Single-model CLI |
620
+ |---------|------|-----------------|
621
+ | Number of Supported Models | Unlimited, configurable for any model | Only supports one model |
622
+ | Model Switching | ✅ Option+M quick switch | ❌ Requires session restart |
623
+ | Parallel Processing | ✅ Multiple SubAgents work in parallel | ❌ Single-threaded processing |
624
+ | Cost Tracking | ✅ Separate statistics for multiple models | ❌ Single model cost |
625
+ | Task Model Configuration | ✅ Different default models for different purposes | ❌ Same model for all tasks |
626
+ | Expert Consultation | ✅ AskExpertModel tool | ❌ Not supported |
627
+
628
+ This multi-model collaboration capability makes Kode a true **AI Development Workbench**, not just a single AI assistant.
629
+
630
+ ## Development
631
+
632
+ Kode is built with modern tools and requires [Bun](https://bun.sh) for development.
633
+
634
+ ### Install Bun
635
+
636
+ ```bash
637
+ # macOS/Linux
638
+ curl -fsSL https://bun.sh/install | bash
639
+
640
+ # Windows
641
+ powershell -c "irm bun.sh/install.ps1 | iex"
642
+ ```
643
+
644
+ ### Setup Development Environment
645
+
646
+ ```bash
647
+ # Clone the repository
648
+ git clone https://github.com/shareAI-lab/kode.git
649
+ cd kode
650
+
651
+ # Install dependencies
652
+ bun install
653
+
654
+ # Run in development mode
655
+ bun run dev
656
+ ```
657
+
658
+ ### Build
659
+
660
+ ```bash
661
+ bun run build
662
+ ```
663
+
664
+ ### Testing
665
+
666
+ ```bash
667
+ # Run tests
668
+ bun test
669
+
670
+ # Test the CLI
671
+ ./cli.js --help
672
+ ```
673
+
674
+ ## Contributing
675
+
676
+ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
677
+
678
+ ## License
679
+
680
+ Apache 2.0 License - see [LICENSE](LICENSE) for details.
681
+
682
+ ## Thanks
683
+
684
+ - Some code from @dnakov's anonkode
685
+ - Some UI learned from gemini-cli
686
+ - Some system design learned from upstream agent CLIs
687
+
688
+ ## Support
689
+
690
+ - 📚 [Documentation](docs/)
691
+ - 🐛 [Report Issues](https://github.com/shareAI-lab/kode/issues)
692
+ - 💬 [Discussions](https://github.com/shareAI-lab/kode/discussions)