@rayss-dev/openclaude 0.28.0-by-rayss

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.
package/LICENSE ADDED
@@ -0,0 +1,29 @@
1
+ NOTICE
2
+
3
+ This repository contains code derived from Anthropic's Claude Code CLI.
4
+
5
+ The original Claude Code source is proprietary software:
6
+ Copyright (c) Anthropic PBC. All rights reserved.
7
+ Subject to Anthropic's Commercial Terms of Service.
8
+
9
+ Modifications and additions by OpenClaude contributors are offered under
10
+ the MIT License where legally permissible:
11
+
12
+ MIT License
13
+ Copyright (c) 2026 OpenClaude contributors (modifications only)
14
+
15
+ Permission is hereby granted, free of charge, to any person obtaining
16
+ a copy of the modifications made by OpenClaude contributors, to deal
17
+ in those modifications without restriction, including without limitation
18
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
19
+ and/or sell copies, subject to the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be included
22
+ in all copies or substantial portions of the modifications.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
25
+
26
+ The underlying derived code remains subject to Anthropic's copyright.
27
+ This project does not have Anthropic's authorization to distribute
28
+ their proprietary source. Users and contributors should evaluate their
29
+ own legal position.
package/README.md ADDED
@@ -0,0 +1,511 @@
1
+ <div align="center">
2
+ <img src="docs/assets/openclaude-wordmark.png" alt="OpenClaude — Open terminal for any LLM" width="830">
3
+
4
+ <p>
5
+ <a href="https://trendshift.io/repositories/25807?utm_source=trendshift-badge&amp;utm_medium=badge&amp;utm_campaign=badge-trendshift-25807" target="_blank" rel="noopener noreferrer"><img src="https://trendshift.io/api/badge/trendshift/repositories/25807/daily?language=TypeScript" alt="Gitlawb%2Fopenclaude | Trendshift" width="250" height="55"/></a>
6
+ <a href="https://trendshift.io/repositories/25807?utm_source=trendshift-badge&amp;utm_medium=badge&amp;utm_campaign=badge-trendshift-25807" target="_blank" rel="noopener noreferrer"><img src="https://trendshift.io/api/badge/trendshift/repositories/25807/monthly?language=TypeScript" alt="Gitlawb%2Fopenclaude | Trendshift" width="250" height="55"/></a>
7
+ <a href="https://trendshift.io/repositories/25807?utm_source=repository-badge&amp;utm_medium=badge&amp;utm_campaign=badge-repository-25807" target="_blank" rel="noopener noreferrer"><img src="https://trendshift.io/api/badge/repositories/25807" alt="Gitlawb%2Fopenclaude | Trendshift" width="250" height="55"/></a>
8
+ </p>
9
+ </div>
10
+
11
+ OpenClaude is an open-source coding-agent CLI for cloud and local model providers.
12
+
13
+ Use OpenAI-compatible APIs, Gemini, GitHub Models, Codex OAuth, Codex, Ollama, Atomic Chat, and other supported backends while keeping one terminal-first workflow: prompts, tools, agents, MCP, slash commands, and streaming output.
14
+
15
+ [![PR Checks](https://github.com/rayss868/openclaude/actions/workflows/pr-checks.yml/badge.svg?branch=main)](https://github.com/rayss868/openclaude/actions/workflows/pr-checks.yml)
16
+ [![Release](https://img.shields.io/github/v/tag/rayss868/openclaude?label=release&color=0ea5e9)](https://github.com/rayss868/openclaude/tags)
17
+ [![npm downloads](https://img.shields.io/npm/dm/@rayss-dev/openclaude)](https://www.npmjs.com/package/@rayss-dev/openclaude)
18
+ [![Discussions](https://img.shields.io/badge/discussions-open-7c3aed)](https://github.com/rayss868/openclaude/discussions)
19
+ [![Discord](https://img.shields.io/badge/Discord-join-5865F2?logo=discord&logoColor=white)](https://discord.gg/k68zFR6AcB)
20
+ [![X](https://img.shields.io/badge/X-@rayss868-000000?logo=x&logoColor=white)](https://x.com/gitlawb)
21
+ [![Security Policy](https://img.shields.io/badge/security-policy-0f766e)](SECURITY.md)
22
+ [![License](https://img.shields.io/badge/license-MIT-2563eb)](LICENSE)
23
+
24
+ OpenClaude is also mirrored to GitLawb:
25
+ [gitlawb.com/node/repos/z6MkqDnb/openclaude](https://gitlawb.com/node/repos/z6MkqDnb/openclaude)
26
+
27
+ [Quick Start](#quick-start) | [Setup Guides](#setup-guides) | [Providers](#supported-providers) | [Development](#development) | [VS Code Extension](#vs-code-extension) | [Partners](#partners) | [Community](#community)
28
+
29
+ ## Partners
30
+
31
+ <table align="center">
32
+ <tr>
33
+ <td align="center" width="150" height="80">
34
+ <a href="https://gitlawb.com">
35
+ <img src="https://gitlawb.com/logo.png" alt="GitLawb logo" width="72">
36
+ </a>
37
+ </td>
38
+ <td align="center" width="150" height="80">
39
+ <a href="https://bankr.bot">
40
+ <img src="https://bankr.bot/favicon.svg" alt="Bankr.bot logo" width="72">
41
+ </a>
42
+ </td>
43
+ <td align="center" width="150" height="80">
44
+ <a href="https://atomic.chat/">
45
+ <img src="docs/assets/atomic-chat-logo.png" alt="Atomic Chat logo" width="72">
46
+ </a>
47
+ </td>
48
+ <td align="center" width="150" height="80">
49
+ <a href="https://mimo.mi.com">
50
+ <img src="https://mimo.xiaomi.com/mimo-v2-pro/assets/logo.svg" alt="Xiaomi MiMo logo" width="136">
51
+ </a>
52
+ </td>
53
+ <td align="center" width="150" height="80">
54
+ <a href="https://www.atlascloud.ai/">
55
+ <img src="docs/assets/atlas-cloud-banner.png" alt="Atlas Cloud logo" width="136">
56
+ </a>
57
+ </td>
58
+ </tr>
59
+ <tr>
60
+ <td align="center"><a href="https://gitlawb.com"><strong>GitLawb</strong></a></td>
61
+ <td align="center"><a href="https://bankr.bot"><strong>Bankr.bot</strong></a></td>
62
+ <td align="center"><a href="https://atomic.chat/"><strong>Atomic Chat</strong></a></td>
63
+ <td align="center"><a href="https://mimo.mi.com"><strong>Xiaomi MiMo</strong></a></td>
64
+ <td align="center"><a href="https://www.atlascloud.ai/"><strong>Atlas Cloud</strong></a></td>
65
+ </tr>
66
+ <tr>
67
+ <td align="center" width="150" height="80">
68
+ <a href="https://aimlapi.com/">
69
+ <picture>
70
+ <source media="(prefers-color-scheme: dark)" srcset="docs/assets/aimlapi-logo-dark.svg">
71
+ <img src="docs/assets/aimlapi-logo.svg" alt="AI/ML API logo" width="136">
72
+ </picture>
73
+ </a>
74
+ </td>
75
+ <td align="center" width="150" height="80">
76
+ <a href="https://novita.ai/">
77
+ <img src="docs/assets/novita-logo.png" alt="Novita AI logo" width="120">
78
+ </a>
79
+ </td>
80
+ </tr>
81
+ <tr>
82
+ <td align="center"><a href="https://aimlapi.com/"><strong>AI/ML API</strong></a></td>
83
+ <td align="center"><a href="https://novita.ai/"><strong>Novita AI</strong></a></td>
84
+ </tr>
85
+ </table>
86
+
87
+ ## Why OpenClaude
88
+
89
+ - One CLI across cloud APIs and local model backends — no per-provider tooling
90
+ - Guided provider setup and saved profiles with `/provider`
91
+ - Coding-agent workflows in one place: bash, file tools, grep, glob, agents, tasks, MCP, and web tools
92
+ - A bundled VS Code extension for launch integration and theme support
93
+ - A pixel-art hero companion who fires an arrow every time you press Enter (really — see [Meet your buddy](#meet-your-buddy))
94
+
95
+ ## Quick Start
96
+
97
+ ### Install
98
+
99
+ OpenClaude requires Node.js `>=22.0.0` for npm installs and runtime. Bun is
100
+ only needed for source builds and local development.
101
+
102
+ ```bash
103
+ npm install -g @rayss-dev/openclaude@latest
104
+ ```
105
+
106
+ If you're on Arch Linux, you can install OpenClaude from the community-maintained [AUR package](https://aur.archlinux.org/packages/openclaude):
107
+ ```bash
108
+ paru -S openclaude
109
+ ```
110
+
111
+ If the install later reports `ripgrep not found`, install ripgrep system-wide and confirm `rg --version` works in the same terminal before starting OpenClaude.
112
+
113
+ **Verify / troubleshoot installed version:**
114
+
115
+ ```bash
116
+ openclaude --version
117
+ npm view @rayss-dev/openclaude dist-tags
118
+ npm install -g @rayss-dev/openclaude@latest
119
+ ```
120
+
121
+ ### Start
122
+
123
+ ```bash
124
+ openclaude
125
+ ```
126
+
127
+ Inside OpenClaude:
128
+
129
+ - run `/provider` for guided provider setup and saved profiles
130
+ - run `/onboard-github` for GitHub Models onboarding
131
+
132
+ > **Note:** OpenClaude does not automatically load project `.env` files. We recommend using the `/provider` command for setup, which saves provider profiles and credentials in `.openclaude-profile.json`. If you prefer environment variables, export them explicitly or run `openclaude --provider-env-file .env` for provider/setup variables. Export runtime/debug knobs from your shell or launcher.
133
+
134
+ ### Resume or fork a conversation
135
+
136
+ Resume an existing conversation by session ID, or continue the most recent
137
+ conversation in the current directory:
138
+
139
+ ```bash
140
+ openclaude --resume <session-id>
141
+ openclaude --continue
142
+ ```
143
+
144
+ Add `--fork-session` to branch the conversation history into a new session ID
145
+ instead of reusing the original transcript:
146
+
147
+ ```bash
148
+ openclaude --resume <session-id> --fork-session
149
+ openclaude --continue --fork-session
150
+ ```
151
+
152
+ Forking is conversation branching only. It does not create filesystem isolation,
153
+ copy your working tree, or create a git worktree branch.
154
+
155
+ ### Background sessions
156
+
157
+ Run long non-interactive prompts detached from the current terminal:
158
+
159
+ ```bash
160
+ openclaude --bg "fix failing tests"
161
+ openclaude --bg --name auth-refactor "refactor auth middleware"
162
+ openclaude ps
163
+ openclaude logs auth-refactor
164
+ openclaude logs auth-refactor -f
165
+ openclaude kill auth-refactor
166
+ ```
167
+
168
+ Background sessions are local child processes. OpenClaude does not start a daemon
169
+ or network service, and permission/provider/model/settings flags are passed to
170
+ the child process the same way they are for a foreground `--print` run. Session
171
+ metadata and logs are stored under the resolved OpenClaude config directory,
172
+ usually `~/.openclaude/bg-sessions/`; `OPENCLAUDE_CONFIG_DIR` can point
173
+ OpenClaude somewhere else. `CLAUDE_CONFIG_DIR` is ignored for OpenClaude
174
+ background-session storage. Session names can be reused after older sessions
175
+ reach a terminal state; use the session ID to inspect older logs with the same
176
+ name.
177
+
178
+ `openclaude attach <id-or-name>` currently reports the matching session and
179
+ points to `openclaude logs <id> -f`; full terminal reattach is not implemented
180
+ for local background sessions yet.
181
+
182
+ ### OpenClaude config cutover
183
+
184
+ OpenClaude stores its own config under `~/.openclaude` and `~/.openclaude.json`
185
+ by default. It does not read `~/.claude`, project `.claude/` directories, or
186
+ `CLAUDE_CONFIG_DIR`; new users can start with an empty OpenClaude config and do
187
+ not need Claude Code installed.
188
+
189
+ If you previously used OpenClaude with `.claude` paths, migrate intentionally:
190
+ copy only the settings, commands, agents, skills, scheduled tasks, or other files
191
+ you personally created for OpenClaude into the matching `.openclaude` location.
192
+ Do not blanket-copy `.claude`, and do not copy Claude Code credentials or auth
193
+ files. For provider authentication, prefer running OpenClaude's provider setup
194
+ again or exporting provider-specific environment variables.
195
+
196
+ ### Fastest OpenAI setup
197
+
198
+ macOS / Linux:
199
+
200
+ ```bash
201
+ export CLAUDE_CODE_USE_OPENAI=1
202
+ export OPENAI_API_KEY=sk-your-key-here
203
+ export OPENAI_MODEL=gpt-4o
204
+
205
+ openclaude
206
+ ```
207
+
208
+ Windows PowerShell:
209
+
210
+ ```powershell
211
+ $env:CLAUDE_CODE_USE_OPENAI="1"
212
+ $env:OPENAI_API_KEY="sk-your-key-here"
213
+ $env:OPENAI_MODEL="gpt-4o"
214
+
215
+ openclaude
216
+ ```
217
+
218
+ ### Fastest local Ollama setup
219
+
220
+ macOS / Linux:
221
+
222
+ ```bash
223
+ export CLAUDE_CODE_USE_OPENAI=1
224
+ export OPENAI_BASE_URL=http://localhost:11434/v1
225
+ export OPENAI_MODEL=qwen2.5-coder:7b
226
+
227
+ openclaude
228
+ ```
229
+
230
+ Windows PowerShell:
231
+
232
+ ```powershell
233
+ $env:CLAUDE_CODE_USE_OPENAI="1"
234
+ $env:OPENAI_BASE_URL="http://localhost:11434/v1"
235
+ $env:OPENAI_MODEL="qwen2.5-coder:7b"
236
+
237
+ openclaude
238
+ ```
239
+
240
+ For Ollama, OpenClaude uses Ollama's native chat API and requests a 32768-token
241
+ context window on each chat request so same-session history is not silently
242
+ truncated by Ollama's OpenAI-compatible shim. Set `OPENCLAUDE_OLLAMA_NUM_CTX`
243
+ or `OLLAMA_CONTEXT_LENGTH` if you need a different request-level context size.
244
+ See [Advanced Setup](docs/advanced-setup.md#ollama-context-length) for
245
+ verification with `ollama ps`.
246
+
247
+ ## Setup Guides
248
+
249
+ Beginner-friendly guides:
250
+
251
+ - [Non-Technical Setup](docs/non-technical-setup.md)
252
+ - [Windows Quick Start](docs/quick-start-windows.md)
253
+ - [macOS / Linux Quick Start](docs/quick-start-mac-linux.md)
254
+
255
+ Advanced and source-build guides:
256
+
257
+ - [Advanced Setup](docs/advanced-setup.md)
258
+ - [Smart Auto-Routing](docs/smart-routing.md)
259
+ - [Agent Routing and Step Limits](docs/agent-routing.md)
260
+ - [Headless gRPC Server](docs/grpc-server.md)
261
+ - [Repo Map (codebase intelligence)](docs/repo-map.md)
262
+ - [Android Install](ANDROID_INSTALL.md)
263
+
264
+ ## Supported Providers
265
+
266
+ | Provider | Setup Path | Notes |
267
+ | --- | --- | --- |
268
+ | OpenAI-compatible | `/provider` or env vars | Works with OpenAI, OpenRouter, DeepSeek, Groq, Mistral, LM Studio, and other compatible `/v1` servers |
269
+ | Z.AI GLM Coding Plan | `/provider` or OpenAI-compatible env vars | Uses `OPENAI_API_KEY` at `https://api.z.ai/api/coding/paas/v4` and defaults to `glm-5.2` |
270
+ | AI/ML API | `/provider` or `AIMLAPI_API_KEY` ([setup guide](docs/aimlapi-setup.md)) | Uses `https://api.aimlapi.com/v1`, auto-detects the OpenAI-compatible route from `AIMLAPI_API_KEY`, sends OpenClaude attribution headers, and discovers chat-capable models from the public `/models` catalog |
271
+ | ApiSmart | `/provider` or `APISMART_API_KEY` | Uses `https://gw.apismart.ai/v1`, defaults to `DEEPSEEK_V4_FLASH`, and supports optional `APISMART_MODEL` plus authenticated model discovery |
272
+ | Hicap | `/provider` or OpenAI-compatible env vars | Uses `api-key` auth, discovers models from unauthenticated `/models`, and supports Responses mode for `gpt-` models |
273
+ | Fireworks AI | `/provider` or env vars | First-class provider with 276 curated models (DeepSeek, Qwen, Llama, Gemma, and more); uses `FIREWORKS_API_KEY` |
274
+ | LongCat | `/provider` or env vars | Meituan LongCat OpenAI-compatible API at `https://api.longcat.chat/openai/v1`; uses `LONGCAT_API_KEY` and defaults to `LongCat-2.0` |
275
+ | ClinePass | `/provider` or env vars | AI model gateway with usage limits (5hr, weekly, monthly); uses `CLINE_API_KEY` at `https://api.cline.bot/api/v1` |
276
+ | Gemini | `/provider` or env vars | Supports API key only |
277
+ | GitHub Models | `/onboard-github` | Interactive onboarding with saved credentials |
278
+ | Codex OAuth | `/provider` | Opens ChatGPT sign-in in your browser and stores Codex credentials securely |
279
+ | Codex | `/provider` | Uses existing Codex CLI auth, OpenClaude secure storage, or env credentials |
280
+ | Gitlawb Opengateway | Startup default, `/provider`, or env vars | Smart gateway at `https://opengateway.gitlawb.com/v1`; requires an API key from https://gitlawb.com/opengateway/keys and routes Xiaomi MiMo and GMI Cloud partner models by `OPENAI_MODEL` |
281
+ | OpenCode Zen | `/provider` or env vars | Pay-as-you-go AI gateway (48 models); uses `OPENCODE_API_KEY` via `https://opencode.ai/zen/v1`; shared key with OpenCode Go |
282
+ | OpenCode Go | `/provider` or env vars | $10/mo subscription for open models (13 models); uses `OPENCODE_API_KEY` via `https://opencode.ai/zen/go/v1`; shared key with OpenCode Zen |
283
+ | Xiaomi MiMo | `/provider` or env vars | OpenAI-compatible API at `https://mimo.mi.com`; uses `MIMO_API_KEY` and defaults to `mimo-v2.5-pro` |
284
+ | NEAR AI | `/provider` or env vars | Unified gateway (Claude, GPT, Gemini + TEE open models); uses `NEARAI_API_KEY` at `https://cloud-api.near.ai/v1` |
285
+ | Cloudflare Workers AI | `/provider` or env vars | OpenAI-compatible API at `https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/ai/v1`; uses `CLOUDFLARE_API_TOKEN`. Replace `<ACCOUNT_ID>` with your Cloudflare account id. |
286
+ | Ollama | `/provider` or env vars | Local inference with no API key |
287
+ | Atomic Chat | `/provider`, env vars, or `bun run dev:atomic-chat` | Local Model Provider; auto-detects loaded models |
288
+ | Bedrock / Vertex / Foundry | env vars | Anthropic-family cloud routes; Vertex is for Claude on Vertex AI, not arbitrary Model Garden models |
289
+
290
+ ## What Works
291
+
292
+ - **Tool-driven coding workflows**: Bash, file read/write/edit, grep, glob, agents, tasks, MCP, and slash commands
293
+ - **Streaming responses**: Real-time token output and tool progress
294
+ - **Tool calling**: Multi-step tool loops with model calls, tool execution, and follow-up responses
295
+ - **Images**: URL and base64 image inputs for providers that support vision
296
+ - **Provider profiles**: Guided setup plus saved user-level provider profile support
297
+ - **Local and remote model backends**: Cloud APIs, local servers, and Apple Silicon local inference
298
+ - **Codebase intelligence (repo map)**: Structural map of the repository ranked by PageRank importance, auto-injected into context when the `REPO_MAP` flag is enabled or the `REPO_MAP` environment variable is set. Inspect with `/repomap` (2048-token default). See [docs/repo-map.md](docs/repo-map.md) for details.
299
+ - **A companion with signature moves**: A truecolor pixel-art hero who lives beside your prompt and reacts when you work. See below.
300
+
301
+ ## Custom Enhancements (by-rayss builds)
302
+
303
+ This fork adds reliability, UX, and agent-loop improvements on top of upstream OpenClaude.
304
+
305
+ ### Anti-stall continuation loop
306
+ - Auto-continues when a model returns an empty response after tool use
307
+ - Nudges the AI to continue tool work when it stops without calling `TaskComplete`
308
+ - Honors `TaskComplete` at loop end (not call site); no nudge while it waits on a background agent
309
+ - Multi-lingual continuation signals, including Indonesian
310
+ - `TaskComplete` requires a final summary; exempt from identical-input blocking
311
+ - No continuation nudge when the AI ends with a question
312
+
313
+ ### Timeout and watchdog fixes
314
+ - Removed the default hard query timeout — queries run until completion
315
+ - Bash timeout raised from 2 minutes to 30 minutes, then unlimited (`Infinity`) so long-running commands are never terminated
316
+ - Watchdog deadlines use `performance.now()` so NTP/clock jumps cannot kill queries
317
+
318
+ ### Model picker and discovery
319
+ - Inline search/filter in `/model` plus a "Press / to search" hint
320
+ - Enables model discovery for remote custom OpenAI-compatible endpoints
321
+ - Model discovery loads in the background when opening `/model`
322
+ - `maxContextWindow` works as a hard cap; custom-route (`routeId === 'custom'`) fallback restored
323
+
324
+ ### API resilience
325
+ - Retries transport failures, truncated streams, and connections terminated by server or proxy
326
+ - Discovery cache replaces stale partitions instead of piling them up
327
+
328
+ ### Loop and agent behavior
329
+ - `verificationAgent` toggle in `/config`
330
+ - Natural-language cadence routing with AI conversion
331
+ - AI instructed to use `AskUserQuestion` for questions and `run_in_background` for long-running commands
332
+ - Images saved to temp files instead of embedding base64 in context
333
+ - Default 50-turn REPL limit removed
334
+
335
+ ### MCP and config fixes
336
+ - Global `disabledMcpServers` fallback when projects have none configured
337
+ - MCP validation errors include the tool schema for faster AI learning
338
+
339
+ ## Meet Your Buddy
340
+
341
+ Run `/buddy` to hatch a companion — a truecolor pixel-art hero who stands
342
+ beside your prompt, idles, blinks, and fires their signature move every time
343
+ you submit a message:
344
+
345
+ ```
346
+ /buddy hatch (first run) or pet your companion
347
+ /buddy set robinhood the green archer — arrow shot on every Enter
348
+ /buddy set kaio gold-haired warrior — charges a full-width energy wave
349
+ /buddy set strawhat stretchy punch that snaps back
350
+ /buddy set merlin twinkling sparkle stream
351
+ /buddy set kage spinning shuriken
352
+ /buddy set ember dragon fire with a real heat gradient
353
+ /buddy set corsair cannonball with smoke trail
354
+ /buddy name Robin rename your companion
355
+ /buddy set random back to your rolled hero
356
+ ```
357
+
358
+ Companions respect `prefersReducedMotion`, degrade gracefully to line art in
359
+ low-color terminals, and can be silenced with `/buddy mute`. Requires a
360
+ terminal at least 100 columns wide for the full sprite.
361
+
362
+ ## Provider Notes
363
+
364
+ OpenClaude supports multiple providers, but behavior is not identical across all of them.
365
+
366
+ - Anthropic-specific features may not exist on other providers
367
+ - Tool quality depends heavily on the selected model
368
+ - Smaller local models can struggle with long multi-step tool flows
369
+ - Some providers impose lower output caps than the CLI defaults, and OpenClaude adapts where possible
370
+ - AI/ML API uses the OpenAI-compatible route, defaults to `gpt-4o`, and only surfaces chat-capable models from its public catalog
371
+ - Gitlawb Opengateway is the fresh-install startup default and requires an API key from https://gitlawb.com/opengateway/keys. It uses one OpenAI-compatible base URL; switch between `mimo-*` and `google/gemini-3.1-flash-lite-preview` with `/model`, and do not pin the base URL to `/v1/xiaomi-mimo`.
372
+ - Z.AI GLM Coding Plan uses `https://api.z.ai/api/coding/paas/v4` with `glm-5.2` by default. Use `glm-5.2?reasoning=high` for enhanced reasoning, `glm-5.2?reasoning=xhigh` to request Z.AI `reasoning_effort=max`, or `glm-5.2?thinking=disabled` for faster direct answers.
373
+ - Xiaomi MiMo uses `api-key` header auth on the direct OpenAI-compatible route and currently does not support `/usage` reporting in OpenClaude
374
+ - GitHub Copilot serializes sub-agent execution by default to reduce Premium Request consumption — see [Agent Routing and Step Limits](docs/agent-routing.md#github-copilot-sub-agent-optimization) for tuning
375
+
376
+ For best results, use models with strong tool/function calling support.
377
+
378
+ ## Agents
379
+
380
+ Route different agents to different models (cost optimization, splitting work
381
+ by model strength), cap sub-agent tool steps with `maxSteps`, and tune GitHub
382
+ Copilot sub-agent behavior. All settings-driven:
383
+
384
+ - per-agent provider/model overrides via `agentModels` + `agentRouting` in `~/.openclaude.json`
385
+ - model-only routes that reuse your current provider's credentials
386
+ - built-in agents (`Explore`, `Plan`, `verification`) routable by type name
387
+
388
+ See [Agent Routing and Step Limits](docs/agent-routing.md) for the full guide.
389
+
390
+ ## Web Search and Fetch
391
+
392
+ By default, `WebSearch` works on non-Anthropic models using DuckDuckGo. This gives GPT-4o, DeepSeek, Gemini, Ollama, and other OpenAI-compatible providers a free web search path out of the box.
393
+
394
+ > **Note:** DuckDuckGo fallback works by scraping search results and may be rate-limited, blocked, or subject to DuckDuckGo's Terms of Service. If you want a more reliable supported option, configure Firecrawl.
395
+
396
+ For Anthropic-native backends and Codex responses, OpenClaude keeps the native provider web search behavior.
397
+
398
+ `WebFetch` works, but its basic HTTP plus HTML-to-markdown path can still fail on JavaScript-rendered sites or sites that block plain HTTP requests.
399
+
400
+ Set a [Firecrawl](https://firecrawl.dev) API key if you want Firecrawl-powered search/fetch behavior:
401
+
402
+ ```bash
403
+ export FIRECRAWL_API_KEY=your-key-here
404
+ ```
405
+
406
+ With Firecrawl enabled:
407
+
408
+ - `WebSearch` can use Firecrawl's search API while DuckDuckGo remains the default free path for non-Claude models
409
+ - `WebFetch` uses Firecrawl's scrape endpoint instead of raw HTTP, handling JS-rendered pages correctly
410
+
411
+ Free tier at [firecrawl.dev](https://firecrawl.dev) includes 500 credits. The key is optional.
412
+
413
+ ## Headless gRPC Server
414
+
415
+ OpenClaude can run as a headless gRPC service with bidirectional streaming —
416
+ integrate its agentic capabilities into other applications, CI/CD pipelines,
417
+ or custom UIs. Start it with `npm run dev:grpc`; a test CLI client ships with
418
+ the repo. See [Headless gRPC Server](docs/grpc-server.md) for configuration
419
+ and client generation from `src/proto/openclaude.proto`.
420
+
421
+ ## Development
422
+
423
+ Use Node.js `>=22.0.0` and Bun `1.3.13` or newer for source builds.
424
+
425
+ ```bash
426
+ bun install
427
+ bun run build
428
+ node dist/cli.mjs
429
+ ```
430
+
431
+ Day-to-day commands:
432
+
433
+ - `bun run dev` — build and launch from source
434
+ - `bun test` — full unit suite (Bun's built-in runner)
435
+ - `bun test path/to/file.test.ts` — focused runs for the areas you touch
436
+ - `bun run test:coverage` — coverage to `coverage/lcov.info` plus a visual report at `coverage/index.html` (`bun run test:coverage:ui` rebuilds just the UI)
437
+ - `bun run smoke` — smoke checks
438
+ - `bun run doctor:runtime`, `bun run verify:privacy`, `bun run security:pr-scan -- --base origin/main`
439
+
440
+ Focused suites: `bun run test:provider`, `bun run test:provider-recommendation`.
441
+
442
+ To benchmark the launcher module compile cache, build the CLI and run:
443
+
444
+ ```bash
445
+ bun run build
446
+ bun run benchmark:startup
447
+ ```
448
+
449
+ The benchmark requires Node `>=22.8.0`, where the compile-cache API was added;
450
+ the built OpenClaude launcher continues to support the declared Node `>=22.0.0`
451
+ runtime range.
452
+
453
+ The benchmark defaults to 30 separate-process warm runs and 10 isolated
454
+ empty-cache runs. It reports the median, IQR, MAD, first cache-populating run,
455
+ first warm-up, Node/OS/CPU details, bundle size, and commit. Direct bundle
456
+ timings are included only as a secondary diagnostic; the full launcher result
457
+ is the decision signal. Use
458
+ `bun run benchmark:startup -- --warm-runs 40 --cold-runs 10` to request a
459
+ larger sample set. The benchmark records results without enforcing a timing
460
+ threshold in CI.
461
+
462
+ OpenClaude leaves Node's standard compile-cache controls authoritative. Set
463
+ `NODE_DISABLE_COMPILE_CACHE=1` to disable the optimization, including for V8
464
+ coverage runs that require uncached compilation.
465
+
466
+ Recommended validation before opening a PR:
467
+
468
+ - `bun run build`
469
+ - `bun run smoke`
470
+ - `bun run test:coverage` when your change affects shared runtime or provider logic
471
+ - focused `bun test ...` runs for the files and flows you changed
472
+
473
+ ## Repository Structure
474
+
475
+ - `src/` - core CLI/runtime
476
+ - `scripts/` - build, verification, and maintenance scripts
477
+ - `docs/` - setup, contributor, and project documentation
478
+ - `vscode-extension/openclaude-vscode/` - VS Code extension
479
+ - `.github/` - repo automation, templates, and CI configuration
480
+ - `bin/` - CLI launcher entrypoints
481
+
482
+ ## VS Code Extension
483
+
484
+ The repo includes a VS Code extension in [`vscode-extension/openclaude-vscode`](vscode-extension/openclaude-vscode) for OpenClaude launch integration, provider-aware Control Center, in-editor chat, theme support, and optional **Microsoft Foundry / Azure OpenAI** configuration (endpoint, API version, deployment, API key via Secret Storage) injected into launched terminals. See that folder's [README](vscode-extension/openclaude-vscode/README.md).
485
+
486
+ ## Security
487
+
488
+ If you believe you found a security issue, see [SECURITY.md](SECURITY.md).
489
+
490
+ ## Community
491
+
492
+ - Use [GitHub Discussions](https://github.com/rayss868/openclaude/discussions) for Q&A, ideas, and community conversation
493
+ - Use [GitHub Issues](https://github.com/rayss868/openclaude/issues) for confirmed bugs and actionable feature work
494
+ - Join the [Discord](https://discord.gg/k68zFR6AcB) to chat with the community in real time
495
+ - Follow [@rayss868 on X](https://x.com/gitlawb) for updates and announcements
496
+
497
+ ## Contributing
498
+
499
+ Contributions are welcome. For larger changes, open an issue first so the
500
+ scope is clear before implementation. See [Development](#development) for the
501
+ build, test, and pre-PR validation commands.
502
+
503
+ ## Disclaimer
504
+
505
+ OpenClaude is an independent community project and is not affiliated with, endorsed by, or sponsored by Anthropic.
506
+
507
+ OpenClaude originated from the Claude Code codebase and has since been substantially modified to support multiple providers and open use. "Claude" and "Claude Code" are trademarks of Anthropic PBC. See [LICENSE](LICENSE) for details.
508
+
509
+ ## License
510
+
511
+ MIT for OpenClaude contributors' modifications; the derived Claude Code remains Anthropic's. [See more](LICENSE).
@@ -0,0 +1,13 @@
1
+ import { join, win32 } from 'path'
2
+ import { pathToFileURL } from 'url'
3
+
4
+ export function getDistImportSpecifier(baseDir) {
5
+ if (/^[A-Za-z]:\\/.test(baseDir)) {
6
+ const distPath = win32.join(baseDir, '..', 'dist', 'cli.mjs')
7
+ return `file:///${distPath.replace(/\\/g, '/')}`
8
+ }
9
+
10
+ const joinImpl = join
11
+ const distPath = joinImpl(baseDir, '..', 'dist', 'cli.mjs')
12
+ return pathToFileURL(distPath).href
13
+ }
@@ -0,0 +1,13 @@
1
+ import assert from 'node:assert/strict'
2
+ import test from 'node:test'
3
+
4
+ import { getDistImportSpecifier } from './import-specifier.mjs'
5
+
6
+ test('builds a file URL import specifier for dist/cli.mjs', () => {
7
+ const specifier = getDistImportSpecifier('C:\\repo\\bin')
8
+
9
+ assert.equal(
10
+ specifier,
11
+ 'file:///C:/repo/dist/cli.mjs',
12
+ )
13
+ })
@@ -0,0 +1,17 @@
1
+ import * as nodeModule from 'node:module'
2
+
3
+ /** @typedef {{ enableCompileCache?: () => unknown }} CompileCacheModule */
4
+
5
+ /**
6
+ * @param {CompileCacheModule} [module=nodeModule]
7
+ */
8
+ export function enableNodeCompileCacheIfAvailable(module = nodeModule) {
9
+ const enable = module.enableCompileCache
10
+ if (typeof enable !== 'function') return
11
+
12
+ try {
13
+ enable()
14
+ } catch {
15
+ // Compile caching is optional and must never block startup.
16
+ }
17
+ }