@rayss-dev/openclaude 0.28.1-by-rayss → 0.28.3-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.
Files changed (5) hide show
  1. package/README.md +525 -513
  2. package/dist/acp.mjs +10231 -8141
  3. package/dist/cli.mjs +368 -374
  4. package/dist/sdk.mjs +654 -392
  5. package/package.json +1 -1
package/README.md CHANGED
@@ -1,513 +1,525 @@
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` is a true override — it wins over env vars, the catalog/discovery cache, and descriptor limits for every model (can raise as well as 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
- - Every retry drops the pooled connection and reconnects fresh — keep-alive is disabled and a new client is created so a retry never reuses the connection that just failed
327
- - `apiRetry` retry count and fixed delay editable from `/config` (attempts: 3/5/10/unlimited; delay: immediate/1s/5s/10s)
328
- - Discovery cache replaces stale partitions instead of piling them up
329
-
330
- ### Loop and agent behavior
331
- - `verificationAgent` toggle in `/config`
332
- - Natural-language cadence routing with AI conversion
333
- - AI instructed to use `AskUserQuestion` for questions and `run_in_background` for long-running commands
334
- - Images saved to temp files instead of embedding base64 in context
335
- - Default 50-turn REPL limit removed
336
-
337
- ### MCP and config fixes
338
- - Global `disabledMcpServers` fallback when projects have none configured
339
- - MCP validation errors include the tool schema for faster AI learning
340
-
341
- ## Meet Your Buddy
342
-
343
- Run `/buddy` to hatch a companion — a truecolor pixel-art hero who stands
344
- beside your prompt, idles, blinks, and fires their signature move every time
345
- you submit a message:
346
-
347
- ```
348
- /buddy hatch (first run) or pet your companion
349
- /buddy set robinhood the green archer — arrow shot on every Enter
350
- /buddy set kaio gold-haired warrior — charges a full-width energy wave
351
- /buddy set strawhat stretchy punch that snaps back
352
- /buddy set merlin twinkling sparkle stream
353
- /buddy set kage spinning shuriken
354
- /buddy set ember dragon fire with a real heat gradient
355
- /buddy set corsair cannonball with smoke trail
356
- /buddy name Robin rename your companion
357
- /buddy set random back to your rolled hero
358
- ```
359
-
360
- Companions respect `prefersReducedMotion`, degrade gracefully to line art in
361
- low-color terminals, and can be silenced with `/buddy mute`. Requires a
362
- terminal at least 100 columns wide for the full sprite.
363
-
364
- ## Provider Notes
365
-
366
- OpenClaude supports multiple providers, but behavior is not identical across all of them.
367
-
368
- - Anthropic-specific features may not exist on other providers
369
- - Tool quality depends heavily on the selected model
370
- - Smaller local models can struggle with long multi-step tool flows
371
- - Some providers impose lower output caps than the CLI defaults, and OpenClaude adapts where possible
372
- - AI/ML API uses the OpenAI-compatible route, defaults to `gpt-4o`, and only surfaces chat-capable models from its public catalog
373
- - 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`.
374
- - 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.
375
- - Xiaomi MiMo uses `api-key` header auth on the direct OpenAI-compatible route and currently does not support `/usage` reporting in OpenClaude
376
- - 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
377
-
378
- For best results, use models with strong tool/function calling support.
379
-
380
- ## Agents
381
-
382
- Route different agents to different models (cost optimization, splitting work
383
- by model strength), cap sub-agent tool steps with `maxSteps`, and tune GitHub
384
- Copilot sub-agent behavior. All settings-driven:
385
-
386
- - per-agent provider/model overrides via `agentModels` + `agentRouting` in `~/.openclaude.json`
387
- - model-only routes that reuse your current provider's credentials
388
- - built-in agents (`Explore`, `Plan`, `verification`) routable by type name
389
-
390
- See [Agent Routing and Step Limits](docs/agent-routing.md) for the full guide.
391
-
392
- ## Web Search and Fetch
393
-
394
- 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.
395
-
396
- > **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.
397
-
398
- For Anthropic-native backends and Codex responses, OpenClaude keeps the native provider web search behavior.
399
-
400
- `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.
401
-
402
- Set a [Firecrawl](https://firecrawl.dev) API key if you want Firecrawl-powered search/fetch behavior:
403
-
404
- ```bash
405
- export FIRECRAWL_API_KEY=your-key-here
406
- ```
407
-
408
- With Firecrawl enabled:
409
-
410
- - `WebSearch` can use Firecrawl's search API while DuckDuckGo remains the default free path for non-Claude models
411
- - `WebFetch` uses Firecrawl's scrape endpoint instead of raw HTTP, handling JS-rendered pages correctly
412
-
413
- Free tier at [firecrawl.dev](https://firecrawl.dev) includes 500 credits. The key is optional.
414
-
415
- ## Headless gRPC Server
416
-
417
- OpenClaude can run as a headless gRPC service with bidirectional streaming —
418
- integrate its agentic capabilities into other applications, CI/CD pipelines,
419
- or custom UIs. Start it with `npm run dev:grpc`; a test CLI client ships with
420
- the repo. See [Headless gRPC Server](docs/grpc-server.md) for configuration
421
- and client generation from `src/proto/openclaude.proto`.
422
-
423
- ## Development
424
-
425
- Use Node.js `>=22.0.0` and Bun `1.3.13` or newer for source builds.
426
-
427
- ```bash
428
- bun install
429
- bun run build
430
- node dist/cli.mjs
431
- ```
432
-
433
- Day-to-day commands:
434
-
435
- - `bun run dev` — build and launch from source
436
- - `bun test` — full unit suite (Bun's built-in runner)
437
- - `bun test path/to/file.test.ts` — focused runs for the areas you touch
438
- - `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)
439
- - `bun run smoke` — smoke checks
440
- - `bun run doctor:runtime`, `bun run verify:privacy`, `bun run security:pr-scan -- --base origin/main`
441
-
442
- Focused suites: `bun run test:provider`, `bun run test:provider-recommendation`.
443
-
444
- To benchmark the launcher module compile cache, build the CLI and run:
445
-
446
- ```bash
447
- bun run build
448
- bun run benchmark:startup
449
- ```
450
-
451
- The benchmark requires Node `>=22.8.0`, where the compile-cache API was added;
452
- the built OpenClaude launcher continues to support the declared Node `>=22.0.0`
453
- runtime range.
454
-
455
- The benchmark defaults to 30 separate-process warm runs and 10 isolated
456
- empty-cache runs. It reports the median, IQR, MAD, first cache-populating run,
457
- first warm-up, Node/OS/CPU details, bundle size, and commit. Direct bundle
458
- timings are included only as a secondary diagnostic; the full launcher result
459
- is the decision signal. Use
460
- `bun run benchmark:startup -- --warm-runs 40 --cold-runs 10` to request a
461
- larger sample set. The benchmark records results without enforcing a timing
462
- threshold in CI.
463
-
464
- OpenClaude leaves Node's standard compile-cache controls authoritative. Set
465
- `NODE_DISABLE_COMPILE_CACHE=1` to disable the optimization, including for V8
466
- coverage runs that require uncached compilation.
467
-
468
- Recommended validation before opening a PR:
469
-
470
- - `bun run build`
471
- - `bun run smoke`
472
- - `bun run test:coverage` when your change affects shared runtime or provider logic
473
- - focused `bun test ...` runs for the files and flows you changed
474
-
475
- ## Repository Structure
476
-
477
- - `src/` - core CLI/runtime
478
- - `scripts/` - build, verification, and maintenance scripts
479
- - `docs/` - setup, contributor, and project documentation
480
- - `vscode-extension/openclaude-vscode/` - VS Code extension
481
- - `.github/` - repo automation, templates, and CI configuration
482
- - `bin/` - CLI launcher entrypoints
483
-
484
- ## VS Code Extension
485
-
486
- 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).
487
-
488
- ## Security
489
-
490
- If you believe you found a security issue, see [SECURITY.md](SECURITY.md).
491
-
492
- ## Community
493
-
494
- - Use [GitHub Discussions](https://github.com/rayss868/openclaude/discussions) for Q&A, ideas, and community conversation
495
- - Use [GitHub Issues](https://github.com/rayss868/openclaude/issues) for confirmed bugs and actionable feature work
496
- - Join the [Discord](https://discord.gg/k68zFR6AcB) to chat with the community in real time
497
- - Follow [@rayss868 on X](https://x.com/gitlawb) for updates and announcements
498
-
499
- ## Contributing
500
-
501
- Contributions are welcome. For larger changes, open an issue first so the
502
- scope is clear before implementation. See [Development](#development) for the
503
- build, test, and pre-PR validation commands.
504
-
505
- ## Disclaimer
506
-
507
- OpenClaude is an independent community project and is not affiliated with, endorsed by, or sponsored by Anthropic.
508
-
509
- 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.
510
-
511
- ## License
512
-
513
- MIT for OpenClaude contributors' modifications; the derived Claude Code remains Anthropic's. [See more](LICENSE).
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
+ <picture>
78
+ <source media="(prefers-color-scheme: dark)" srcset="docs/assets/novita-logo-dark.svg">
79
+ <img src="docs/assets/novita-logo.svg" alt="Novita AI logo" width="136">
80
+ </picture>
81
+ </a>
82
+ </td>
83
+ <td align="center" width="150" height="80">
84
+ <a href="https://www.apismart.ai">
85
+ <picture>
86
+ <source media="(prefers-color-scheme: dark)" srcset="docs/assets/apismart-logo-dark.png">
87
+ <img src="docs/assets/apismart-logo.png" alt="ApiSmart logo" width="120">
88
+ </picture>
89
+ </a>
90
+ </td>
91
+ </tr>
92
+ <tr>
93
+ <td align="center"><a href="https://aimlapi.com/"><strong>AI/ML API</strong></a></td>
94
+ <td align="center"><a href="https://novita.ai/"><strong>Novita AI</strong></a></td>
95
+ <td align="center"><a href="https://www.apismart.ai"><strong>ApiSmart</strong></a></td>
96
+ </tr>
97
+ </table>
98
+
99
+ ## Why OpenClaude
100
+
101
+ - One CLI across cloud APIs and local model backends — no per-provider tooling
102
+ - Guided provider setup and saved profiles with `/provider`
103
+ - Coding-agent workflows in one place: bash, file tools, grep, glob, agents, tasks, MCP, and web tools
104
+ - A bundled VS Code extension for launch integration and theme support
105
+ - A pixel-art hero companion who fires an arrow every time you press Enter (really — see [Meet your buddy](#meet-your-buddy))
106
+
107
+ ## Quick Start
108
+
109
+ ### Install
110
+
111
+ OpenClaude requires Node.js `>=22.0.0` for npm installs and runtime. Bun is
112
+ only needed for source builds and local development.
113
+
114
+ ```bash
115
+ npm install -g @rayss-dev/openclaude@latest
116
+ ```
117
+
118
+ If you're on Arch Linux, you can install OpenClaude from the community-maintained [AUR package](https://aur.archlinux.org/packages/openclaude):
119
+ ```bash
120
+ paru -S openclaude
121
+ ```
122
+
123
+ If the install later reports `ripgrep not found`, install ripgrep system-wide and confirm `rg --version` works in the same terminal before starting OpenClaude.
124
+
125
+ **Verify / troubleshoot installed version:**
126
+
127
+ ```bash
128
+ openclaude --version
129
+ npm view @rayss-dev/openclaude dist-tags
130
+ npm install -g @rayss-dev/openclaude@latest
131
+ ```
132
+
133
+ ### Start
134
+
135
+ ```bash
136
+ openclaude
137
+ ```
138
+
139
+ Inside OpenClaude:
140
+
141
+ - run `/provider` for guided provider setup and saved profiles
142
+ - run `/onboard-github` for GitHub Models onboarding
143
+
144
+ > **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.
145
+
146
+ ### Resume or fork a conversation
147
+
148
+ Resume an existing conversation by session ID, or continue the most recent
149
+ conversation in the current directory:
150
+
151
+ ```bash
152
+ openclaude --resume <session-id>
153
+ openclaude --continue
154
+ ```
155
+
156
+ Add `--fork-session` to branch the conversation history into a new session ID
157
+ instead of reusing the original transcript:
158
+
159
+ ```bash
160
+ openclaude --resume <session-id> --fork-session
161
+ openclaude --continue --fork-session
162
+ ```
163
+
164
+ Forking is conversation branching only. It does not create filesystem isolation,
165
+ copy your working tree, or create a git worktree branch.
166
+
167
+ ### Background sessions
168
+
169
+ Run long non-interactive prompts detached from the current terminal:
170
+
171
+ ```bash
172
+ openclaude --bg "fix failing tests"
173
+ openclaude --bg --name auth-refactor "refactor auth middleware"
174
+ openclaude ps
175
+ openclaude logs auth-refactor
176
+ openclaude logs auth-refactor -f
177
+ openclaude kill auth-refactor
178
+ ```
179
+
180
+ Background sessions are local child processes. OpenClaude does not start a daemon
181
+ or network service, and permission/provider/model/settings flags are passed to
182
+ the child process the same way they are for a foreground `--print` run. Session
183
+ metadata and logs are stored under the resolved OpenClaude config directory,
184
+ usually `~/.openclaude/bg-sessions/`; `OPENCLAUDE_CONFIG_DIR` can point
185
+ OpenClaude somewhere else. `CLAUDE_CONFIG_DIR` is ignored for OpenClaude
186
+ background-session storage. Session names can be reused after older sessions
187
+ reach a terminal state; use the session ID to inspect older logs with the same
188
+ name.
189
+
190
+ `openclaude attach <id-or-name>` currently reports the matching session and
191
+ points to `openclaude logs <id> -f`; full terminal reattach is not implemented
192
+ for local background sessions yet.
193
+
194
+ ### OpenClaude config cutover
195
+
196
+ OpenClaude stores its own config under `~/.openclaude` and `~/.openclaude.json`
197
+ by default. It does not read `~/.claude`, project `.claude/` directories, or
198
+ `CLAUDE_CONFIG_DIR`; new users can start with an empty OpenClaude config and do
199
+ not need Claude Code installed.
200
+
201
+ If you previously used OpenClaude with `.claude` paths, migrate intentionally:
202
+ copy only the settings, commands, agents, skills, scheduled tasks, or other files
203
+ you personally created for OpenClaude into the matching `.openclaude` location.
204
+ Do not blanket-copy `.claude`, and do not copy Claude Code credentials or auth
205
+ files. For provider authentication, prefer running OpenClaude's provider setup
206
+ again or exporting provider-specific environment variables.
207
+
208
+ ### Fastest OpenAI setup
209
+
210
+ macOS / Linux:
211
+
212
+ ```bash
213
+ export CLAUDE_CODE_USE_OPENAI=1
214
+ export OPENAI_API_KEY=sk-your-key-here
215
+ export OPENAI_MODEL=gpt-4o
216
+
217
+ openclaude
218
+ ```
219
+
220
+ Windows PowerShell:
221
+
222
+ ```powershell
223
+ $env:CLAUDE_CODE_USE_OPENAI="1"
224
+ $env:OPENAI_API_KEY="sk-your-key-here"
225
+ $env:OPENAI_MODEL="gpt-4o"
226
+
227
+ openclaude
228
+ ```
229
+
230
+ ### Fastest local Ollama setup
231
+
232
+ macOS / Linux:
233
+
234
+ ```bash
235
+ export CLAUDE_CODE_USE_OPENAI=1
236
+ export OPENAI_BASE_URL=http://localhost:11434/v1
237
+ export OPENAI_MODEL=qwen2.5-coder:7b
238
+
239
+ openclaude
240
+ ```
241
+
242
+ Windows PowerShell:
243
+
244
+ ```powershell
245
+ $env:CLAUDE_CODE_USE_OPENAI="1"
246
+ $env:OPENAI_BASE_URL="http://localhost:11434/v1"
247
+ $env:OPENAI_MODEL="qwen2.5-coder:7b"
248
+
249
+ openclaude
250
+ ```
251
+
252
+ For Ollama, OpenClaude uses Ollama's native chat API and requests a 32768-token
253
+ context window on each chat request so same-session history is not silently
254
+ truncated by Ollama's OpenAI-compatible shim. Set `OPENCLAUDE_OLLAMA_NUM_CTX`
255
+ or `OLLAMA_CONTEXT_LENGTH` if you need a different request-level context size.
256
+ See [Advanced Setup](docs/advanced-setup.md#ollama-context-length) for
257
+ verification with `ollama ps`.
258
+
259
+ ## Setup Guides
260
+
261
+ Beginner-friendly guides:
262
+
263
+ - [Non-Technical Setup](docs/non-technical-setup.md)
264
+ - [Windows Quick Start](docs/quick-start-windows.md)
265
+ - [macOS / Linux Quick Start](docs/quick-start-mac-linux.md)
266
+
267
+ Advanced and source-build guides:
268
+
269
+ - [Advanced Setup](docs/advanced-setup.md)
270
+ - [Smart Auto-Routing](docs/smart-routing.md)
271
+ - [Agent Routing and Step Limits](docs/agent-routing.md)
272
+ - [Headless gRPC Server](docs/grpc-server.md)
273
+ - [Repo Map (codebase intelligence)](docs/repo-map.md)
274
+ - [Android Install](ANDROID_INSTALL.md)
275
+
276
+ ## Supported Providers
277
+
278
+ | Provider | Setup Path | Notes |
279
+ | --- | --- | --- |
280
+ | OpenAI-compatible | `/provider` or env vars | Works with OpenAI, OpenRouter, DeepSeek, Groq, Mistral, LM Studio, and other compatible `/v1` servers |
281
+ | 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` |
282
+ | 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 |
283
+ | 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 |
284
+ | Hicap | `/provider` or OpenAI-compatible env vars | Uses `api-key` auth, discovers models from unauthenticated `/models`, and supports Responses mode for `gpt-` models |
285
+ | Fireworks AI | `/provider` or env vars | First-class provider with 276 curated models (DeepSeek, Qwen, Llama, Gemma, and more); uses `FIREWORKS_API_KEY` |
286
+ | 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` |
287
+ | 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` |
288
+ | Gemini | `/provider` or env vars | Supports API key only |
289
+ | GitHub Models | `/onboard-github` | Interactive onboarding with saved credentials |
290
+ | Codex OAuth | `/provider` | Opens ChatGPT sign-in in your browser and stores Codex credentials securely |
291
+ | Codex | `/provider` | Uses existing Codex CLI auth, OpenClaude secure storage, or env credentials |
292
+ | 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` |
293
+ | 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 |
294
+ | 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 |
295
+ | 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` |
296
+ | 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` |
297
+ | 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. |
298
+ | Ollama | `/provider` or env vars | Local inference with no API key |
299
+ | Atomic Chat | `/provider`, env vars, or `bun run dev:atomic-chat` | Local Model Provider; auto-detects loaded models |
300
+ | Bedrock / Vertex / Foundry | env vars | Anthropic-family cloud routes; Vertex is for Claude on Vertex AI, not arbitrary Model Garden models |
301
+
302
+ ## What Works
303
+
304
+ - **Tool-driven coding workflows**: Bash, file read/write/edit, grep, glob, agents, tasks, MCP, and slash commands
305
+ - **Streaming responses**: Real-time token output and tool progress
306
+ - **Tool calling**: Multi-step tool loops with model calls, tool execution, and follow-up responses
307
+ - **Images**: URL and base64 image inputs for providers that support vision
308
+ - **Provider profiles**: Guided setup plus saved user-level provider profile support
309
+ - **Local and remote model backends**: Cloud APIs, local servers, and Apple Silicon local inference
310
+ - **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.
311
+ - **A companion with signature moves**: A truecolor pixel-art hero who lives beside your prompt and reacts when you work. See below.
312
+
313
+ ## Custom Enhancements (by-rayss builds)
314
+
315
+ This fork adds reliability, UX, and agent-loop improvements on top of upstream OpenClaude.
316
+
317
+ ### Anti-stall continuation loop
318
+ - Auto-continues when a model returns an empty response after tool use
319
+ - Nudges the AI to continue tool work when it stops without calling `TaskComplete`
320
+ - Honors `TaskComplete` at loop end (not call site); no nudge while it waits on a background agent
321
+ - Multi-lingual continuation signals, including Indonesian
322
+ - `TaskComplete` requires a final summary; exempt from identical-input blocking
323
+ - No continuation nudge when the AI ends with a question
324
+
325
+ ### Timeout and watchdog fixes
326
+ - Removed the default hard query timeout — queries run until completion
327
+ - Bash timeout raised from 2 minutes to 30 minutes, then unlimited (`Infinity`) so long-running commands are never terminated
328
+ - Watchdog deadlines use `performance.now()` so NTP/clock jumps cannot kill queries
329
+
330
+ ### Model picker and discovery
331
+ - Inline search/filter in `/model` plus a "Press / to search" hint
332
+ - Enables model discovery for remote custom OpenAI-compatible endpoints
333
+ - Model discovery loads in the background when opening `/model`
334
+ - `maxContextWindow` is a true override — it wins over env vars, the catalog/discovery cache, and descriptor limits for every model (can raise as well as cap); custom-route (`routeId === 'custom'`) fallback restored
335
+
336
+ ### API resilience
337
+ - Retries transport failures, truncated streams, and connections terminated by server or proxy
338
+ - Every retry drops the pooled connection and reconnects fresh — keep-alive is disabled and a new client is created so a retry never reuses the connection that just failed
339
+ - `apiRetry` retry count and fixed delay editable from `/config` (attempts: 3/5/10/unlimited; delay: immediate/1s/5s/10s)
340
+ - Discovery cache replaces stale partitions instead of piling them up
341
+
342
+ ### Loop and agent behavior
343
+ - `verificationAgent` toggle in `/config`
344
+ - Natural-language cadence routing with AI conversion
345
+ - AI instructed to use `AskUserQuestion` for questions and `run_in_background` for long-running commands
346
+ - Images saved to temp files instead of embedding base64 in context
347
+ - Default 50-turn REPL limit removed
348
+
349
+ ### MCP and config fixes
350
+ - Global `disabledMcpServers` fallback when projects have none configured
351
+ - MCP validation errors include the tool schema for faster AI learning
352
+
353
+ ## Meet Your Buddy
354
+
355
+ Run `/buddy` to hatch a companion — a truecolor pixel-art hero who stands
356
+ beside your prompt, idles, blinks, and fires their signature move every time
357
+ you submit a message:
358
+
359
+ ```
360
+ /buddy hatch (first run) or pet your companion
361
+ /buddy set robinhood the green archer — arrow shot on every Enter
362
+ /buddy set kaio gold-haired warrior — charges a full-width energy wave
363
+ /buddy set strawhat stretchy punch that snaps back
364
+ /buddy set merlin twinkling sparkle stream
365
+ /buddy set kage spinning shuriken
366
+ /buddy set ember dragon fire with a real heat gradient
367
+ /buddy set corsair cannonball with smoke trail
368
+ /buddy name Robin rename your companion
369
+ /buddy set random back to your rolled hero
370
+ ```
371
+
372
+ Companions respect `prefersReducedMotion`, degrade gracefully to line art in
373
+ low-color terminals, and can be silenced with `/buddy mute`. Requires a
374
+ terminal at least 100 columns wide for the full sprite.
375
+
376
+ ## Provider Notes
377
+
378
+ OpenClaude supports multiple providers, but behavior is not identical across all of them.
379
+
380
+ - Anthropic-specific features may not exist on other providers
381
+ - Tool quality depends heavily on the selected model
382
+ - Smaller local models can struggle with long multi-step tool flows
383
+ - Some providers impose lower output caps than the CLI defaults, and OpenClaude adapts where possible
384
+ - AI/ML API uses the OpenAI-compatible route, defaults to `gpt-4o`, and only surfaces chat-capable models from its public catalog
385
+ - 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`.
386
+ - 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.
387
+ - Xiaomi MiMo uses `api-key` header auth on the direct OpenAI-compatible route and currently does not support `/usage` reporting in OpenClaude
388
+ - 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
389
+
390
+ For best results, use models with strong tool/function calling support.
391
+
392
+ ## Agents
393
+
394
+ Route different agents to different models (cost optimization, splitting work
395
+ by model strength), cap sub-agent tool steps with `maxSteps`, and tune GitHub
396
+ Copilot sub-agent behavior. All settings-driven:
397
+
398
+ - per-agent provider/model overrides via `agentModels` + `agentRouting` in `~/.openclaude.json`
399
+ - model-only routes that reuse your current provider's credentials
400
+ - built-in agents (`Explore`, `Plan`, `verification`) routable by type name
401
+
402
+ See [Agent Routing and Step Limits](docs/agent-routing.md) for the full guide.
403
+
404
+ ## Web Search and Fetch
405
+
406
+ 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.
407
+
408
+ > **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.
409
+
410
+ For Anthropic-native backends and Codex responses, OpenClaude keeps the native provider web search behavior.
411
+
412
+ `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.
413
+
414
+ Set a [Firecrawl](https://firecrawl.dev) API key if you want Firecrawl-powered search/fetch behavior:
415
+
416
+ ```bash
417
+ export FIRECRAWL_API_KEY=your-key-here
418
+ ```
419
+
420
+ With Firecrawl enabled:
421
+
422
+ - `WebSearch` can use Firecrawl's search API while DuckDuckGo remains the default free path for non-Claude models
423
+ - `WebFetch` uses Firecrawl's scrape endpoint instead of raw HTTP, handling JS-rendered pages correctly
424
+
425
+ Free tier at [firecrawl.dev](https://firecrawl.dev) includes 500 credits. The key is optional.
426
+
427
+ ## Headless gRPC Server
428
+
429
+ OpenClaude can run as a headless gRPC service with bidirectional streaming —
430
+ integrate its agentic capabilities into other applications, CI/CD pipelines,
431
+ or custom UIs. Start it with `npm run dev:grpc`; a test CLI client ships with
432
+ the repo. See [Headless gRPC Server](docs/grpc-server.md) for configuration
433
+ and client generation from `src/proto/openclaude.proto`.
434
+
435
+ ## Development
436
+
437
+ Use Node.js `>=22.0.0` and Bun `1.3.13` or newer for source builds.
438
+
439
+ ```bash
440
+ bun install
441
+ bun run build
442
+ node dist/cli.mjs
443
+ ```
444
+
445
+ Day-to-day commands:
446
+
447
+ - `bun run dev` — build and launch from source
448
+ - `bun test` — full unit suite (Bun's built-in runner)
449
+ - `bun test path/to/file.test.ts` — focused runs for the areas you touch
450
+ - `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)
451
+ - `bun run smoke` — smoke checks
452
+ - `bun run doctor:runtime`, `bun run verify:privacy`, `bun run security:pr-scan -- --base origin/main`
453
+
454
+ Focused suites: `bun run test:provider`, `bun run test:provider-recommendation`.
455
+
456
+ To benchmark the launcher module compile cache, build the CLI and run:
457
+
458
+ ```bash
459
+ bun run build
460
+ bun run benchmark:startup
461
+ ```
462
+
463
+ The benchmark requires Node `>=22.8.0`, where the compile-cache API was added;
464
+ the built OpenClaude launcher continues to support the declared Node `>=22.0.0`
465
+ runtime range.
466
+
467
+ The benchmark defaults to 30 separate-process warm runs and 10 isolated
468
+ empty-cache runs. It reports the median, IQR, MAD, first cache-populating run,
469
+ first warm-up, Node/OS/CPU details, bundle size, and commit. Direct bundle
470
+ timings are included only as a secondary diagnostic; the full launcher result
471
+ is the decision signal. Use
472
+ `bun run benchmark:startup -- --warm-runs 40 --cold-runs 10` to request a
473
+ larger sample set. The benchmark records results without enforcing a timing
474
+ threshold in CI.
475
+
476
+ OpenClaude leaves Node's standard compile-cache controls authoritative. Set
477
+ `NODE_DISABLE_COMPILE_CACHE=1` to disable the optimization, including for V8
478
+ coverage runs that require uncached compilation.
479
+
480
+ Recommended validation before opening a PR:
481
+
482
+ - `bun run build`
483
+ - `bun run smoke`
484
+ - `bun run test:coverage` when your change affects shared runtime or provider logic
485
+ - focused `bun test ...` runs for the files and flows you changed
486
+
487
+ ## Repository Structure
488
+
489
+ - `src/` - core CLI/runtime
490
+ - `scripts/` - build, verification, and maintenance scripts
491
+ - `docs/` - setup, contributor, and project documentation
492
+ - `vscode-extension/openclaude-vscode/` - VS Code extension
493
+ - `.github/` - repo automation, templates, and CI configuration
494
+ - `bin/` - CLI launcher entrypoints
495
+
496
+ ## VS Code Extension
497
+
498
+ 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).
499
+
500
+ ## Security
501
+
502
+ If you believe you found a security issue, see [SECURITY.md](SECURITY.md).
503
+
504
+ ## Community
505
+
506
+ - Use [GitHub Discussions](https://github.com/rayss868/openclaude/discussions) for Q&A, ideas, and community conversation
507
+ - Use [GitHub Issues](https://github.com/rayss868/openclaude/issues) for confirmed bugs and actionable feature work
508
+ - Join the [Discord](https://discord.gg/k68zFR6AcB) to chat with the community in real time
509
+ - Follow [@rayss868 on X](https://x.com/gitlawb) for updates and announcements
510
+
511
+ ## Contributing
512
+
513
+ Contributions are welcome. For larger changes, open an issue first so the
514
+ scope is clear before implementation. See [Development](#development) for the
515
+ build, test, and pre-PR validation commands.
516
+
517
+ ## Disclaimer
518
+
519
+ OpenClaude is an independent community project and is not affiliated with, endorsed by, or sponsored by Anthropic.
520
+
521
+ 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.
522
+
523
+ ## License
524
+
525
+ MIT for OpenClaude contributors' modifications; the derived Claude Code remains Anthropic's. [See more](LICENSE).