myclaude-code 8.8.9 → 8.8.12
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/README.md +76 -876
- package/dist/cli.js +78 -76
- package/dist/login-redirect-command.js +36 -0
- package/dist/openai-responses-adapter.js +1241 -0
- package/dist/provider-command.js +427 -0
- package/dist/provider-setup.js +3655 -0
- package/dist/team-command.js +250 -0
- package/image.png +0 -0
- package/install.sh +20 -57
- package/package.json +19 -7
package/README.md
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
|
-
# myclaude v8.8.
|
|
1
|
+
# myclaude v8.8.12
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
`myclaude` is a fast-start AI coding CLI under the `我的code` brand. It is positioned around direct provider setup instead of Claude Code account login, so users can connect a compatible third-party API endpoint quickly and start working immediately.
|
|
6
|
+
|
|
7
|
+
## Why myclaude
|
|
8
|
+
|
|
9
|
+
- No official Claude Code login flow in the normal getting-started path
|
|
10
|
+
- Quick provider setup for custom Anthropic-compatible API URLs
|
|
11
|
+
- Works with third-party API gateways, relay services, and self-hosted compatible endpoints
|
|
12
|
+
- Global install without npm binary collisions
|
|
13
|
+
- Launch with `myclaude` or `mycode`, then let the native installer configure `claude`
|
|
14
|
+
- Cleaner onboarding focused on fast API URL and API key configuration
|
|
4
15
|
|
|
5
16
|
## Install
|
|
6
17
|
|
|
@@ -9,929 +20,118 @@ Requirements:
|
|
|
9
20
|
- Node.js 18 or newer
|
|
10
21
|
- macOS or Linux shell environment
|
|
11
22
|
|
|
12
|
-
|
|
23
|
+
Install globally from npm:
|
|
13
24
|
|
|
14
25
|
```bash
|
|
15
26
|
npm install -g myclaude-code
|
|
16
27
|
```
|
|
17
28
|
|
|
18
|
-
|
|
29
|
+
This installs the non-conflicting npm commands:
|
|
19
30
|
|
|
20
31
|
```bash
|
|
21
32
|
myclaude
|
|
22
33
|
mycode
|
|
23
|
-
claude
|
|
24
34
|
```
|
|
25
35
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
One-line install:
|
|
36
|
+
Then run the built-in installer once to configure the native launcher, including the `claude` command:
|
|
29
37
|
|
|
30
38
|
```bash
|
|
31
|
-
|
|
39
|
+
myclaude install --force
|
|
32
40
|
```
|
|
33
41
|
|
|
34
|
-
|
|
42
|
+
After that, you can launch with:
|
|
35
43
|
|
|
36
44
|
```bash
|
|
37
|
-
|
|
45
|
+
myclaude
|
|
46
|
+
mycode
|
|
47
|
+
claude
|
|
38
48
|
```
|
|
39
49
|
|
|
40
|
-
|
|
50
|
+
One-line install:
|
|
41
51
|
|
|
42
52
|
```bash
|
|
43
|
-
myclaude
|
|
44
|
-
mycode --version
|
|
45
|
-
claude --version
|
|
53
|
+
curl -fsSL https://unpkg.com/myclaude-code@8.8.12/install.sh | bash
|
|
46
54
|
```
|
|
47
55
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
- Source repo: `https://github.com/mycode699/myclaude-code`
|
|
51
|
-
- Release assets are generated from the tracked `dist/cli.js` bundle
|
|
52
|
-
- Create and push a tag like `v8.8.9` to trigger GitHub Actions release packaging
|
|
53
|
-
- The same tag can also publish `myclaude-code` to npm when the `NPM_TOKEN` GitHub secret is configured
|
|
54
|
-
- The workflow uploads:
|
|
55
|
-
- `myclaude-v8.8.9-node.tar.gz`
|
|
56
|
-
- `myclaude-v8.8.9-node.zip`
|
|
57
|
-
- `install.sh`
|
|
58
|
-
- `SHA256SUMS`
|
|
59
|
-
|
|
60
|
-
## Local Packaging
|
|
56
|
+
Install a specific version:
|
|
61
57
|
|
|
62
58
|
```bash
|
|
63
|
-
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
Artifacts are written to `release-artifacts/`.
|
|
67
|
-
|
|
68
|
-
## Source Note
|
|
69
|
-
|
|
70
|
-
This repository is still based on the extracted Claude Code source bundle and keeps the upstream research notes below for reference.
|
|
71
|
-
|
|
72
|
-
# Claude Code v2.1.88 — Source Code Analysis
|
|
73
|
-
|
|
74
|
-
> Extracted from npm package `@anthropic-ai/claude-code` version **2.1.88**.
|
|
75
|
-
> The published package ships a single bundled `cli.js` (~12MB). The `src/` directory in this repo contains the **unbundled TypeScript source** extracted from the npm tarball.
|
|
76
|
-
|
|
77
|
-
---
|
|
78
|
-
|
|
79
|
-
## Missing Modules Notice (108 modules)
|
|
80
|
-
|
|
81
|
-
> **This source is incomplete.** 108 modules referenced by `feature()`-gated branches are **not included** in the npm package.
|
|
82
|
-
> They exist only in Anthropic's internal monorepo and were dead-code-eliminated at compile time.
|
|
83
|
-
> They **cannot** be recovered from `cli.js`, `sdk-tools.d.ts`, or any published artifact.
|
|
84
|
-
|
|
85
|
-
### Anthropic Internal Code (~70 modules, never published)
|
|
86
|
-
|
|
87
|
-
These modules have no source files anywhere in the npm package. They are internal Anthropic infrastructure.
|
|
88
|
-
|
|
89
|
-
| Module | Purpose | Feature Gate |
|
|
90
|
-
|--------|---------|-------------|
|
|
91
|
-
| `daemon/main.js` | Background daemon supervisor | `DAEMON` |
|
|
92
|
-
| `daemon/workerRegistry.js` | Daemon worker registry | `DAEMON` |
|
|
93
|
-
| `proactive/index.js` | Proactive notification system | `PROACTIVE` |
|
|
94
|
-
| `contextCollapse/index.js` | Context collapse service (experimental) | `CONTEXT_COLLAPSE` |
|
|
95
|
-
| `contextCollapse/operations.js` | Collapse operations | `CONTEXT_COLLAPSE` |
|
|
96
|
-
| `contextCollapse/persist.js` | Collapse persistence | `CONTEXT_COLLAPSE` |
|
|
97
|
-
| `skillSearch/featureCheck.js` | Remote skill feature check | `EXPERIMENTAL_SKILL_SEARCH` |
|
|
98
|
-
| `skillSearch/remoteSkillLoader.js` | Remote skill loader | `EXPERIMENTAL_SKILL_SEARCH` |
|
|
99
|
-
| `skillSearch/remoteSkillState.js` | Remote skill state | `EXPERIMENTAL_SKILL_SEARCH` |
|
|
100
|
-
| `skillSearch/telemetry.js` | Skill search telemetry | `EXPERIMENTAL_SKILL_SEARCH` |
|
|
101
|
-
| `skillSearch/localSearch.js` | Local skill search | `EXPERIMENTAL_SKILL_SEARCH` |
|
|
102
|
-
| `skillSearch/prefetch.js` | Skill prefetch | `EXPERIMENTAL_SKILL_SEARCH` |
|
|
103
|
-
| `coordinator/workerAgent.js` | Multi-agent coordinator worker | `COORDINATOR_MODE` |
|
|
104
|
-
| `bridge/peerSessions.js` | Bridge peer session management | `BRIDGE_MODE` |
|
|
105
|
-
| `assistant/index.js` | Kairos assistant mode | `KAIROS` |
|
|
106
|
-
| `assistant/AssistantSessionChooser.js` | Assistant session picker | `KAIROS` |
|
|
107
|
-
| `compact/reactiveCompact.js` | Reactive context compaction | `CACHED_MICROCOMPACT` |
|
|
108
|
-
| `compact/snipCompact.js` | Snip-based compaction | `HISTORY_SNIP` |
|
|
109
|
-
| `compact/snipProjection.js` | Snip projection | `HISTORY_SNIP` |
|
|
110
|
-
| `compact/cachedMCConfig.js` | Cached micro-compact config | `CACHED_MICROCOMPACT` |
|
|
111
|
-
| `sessionTranscript/sessionTranscript.js` | Session transcript service | `TRANSCRIPT_CLASSIFIER` |
|
|
112
|
-
| `commands/agents-platform/index.js` | Internal agents platform | `ant` (internal) |
|
|
113
|
-
| `commands/assistant/index.js` | Assistant command | `KAIROS` |
|
|
114
|
-
| `commands/buddy/index.js` | Buddy system notifications | `BUDDY` |
|
|
115
|
-
| `commands/fork/index.js` | Fork subagent command | `FORK_SUBAGENT` |
|
|
116
|
-
| `commands/peers/index.js` | Multi-peer commands | `BRIDGE_MODE` |
|
|
117
|
-
| `commands/proactive.js` | Proactive command | `PROACTIVE` |
|
|
118
|
-
| `commands/remoteControlServer/index.js` | Remote control server | `DAEMON` + `BRIDGE_MODE` |
|
|
119
|
-
| `commands/subscribe-pr.js` | GitHub PR subscription | `KAIROS_GITHUB_WEBHOOKS` |
|
|
120
|
-
| `commands/torch.js` | Internal debug tool | `TORCH` |
|
|
121
|
-
| `commands/workflows/index.js` | Workflow commands | `WORKFLOW_SCRIPTS` |
|
|
122
|
-
| `jobs/classifier.js` | Internal job classifier | `TEMPLATES` |
|
|
123
|
-
| `memdir/memoryShapeTelemetry.js` | Memory shape telemetry | `MEMORY_SHAPE_TELEMETRY` |
|
|
124
|
-
| `services/sessionTranscript/sessionTranscript.js` | Session transcript | `TRANSCRIPT_CLASSIFIER` |
|
|
125
|
-
| `tasks/LocalWorkflowTask/LocalWorkflowTask.js` | Local workflow task | `WORKFLOW_SCRIPTS` |
|
|
126
|
-
| `protectedNamespace.js` | Internal namespace guard | `ant` (internal) |
|
|
127
|
-
| `protectedNamespace.js` (envUtils) | Protected namespace runtime | `ant` (internal) |
|
|
128
|
-
| `coreTypes.generated.js` | Generated core types | `ant` (internal) |
|
|
129
|
-
| `devtools.js` | Internal dev tools | `ant` (internal) |
|
|
130
|
-
| `attributionHooks.js` | Internal attribution hooks | `COMMIT_ATTRIBUTION` |
|
|
131
|
-
| `systemThemeWatcher.js` | System theme watcher | `AUTO_THEME` |
|
|
132
|
-
| `udsClient.js` / `udsMessaging.js` | UDS messaging client | `UDS_INBOX` |
|
|
133
|
-
| `systemThemeWatcher.js` | Theme watcher | `AUTO_THEME` |
|
|
134
|
-
|
|
135
|
-
### Feature-Gated Tools (~20 modules, DCE'd from bundle)
|
|
136
|
-
|
|
137
|
-
These tools have type signatures in `sdk-tools.d.ts` but their implementations were stripped at compile time.
|
|
138
|
-
|
|
139
|
-
| Tool | Purpose | Feature Gate |
|
|
140
|
-
|------|---------|-------------|
|
|
141
|
-
| `REPLTool` | Interactive REPL (VM sandbox) | `ant` (internal) |
|
|
142
|
-
| `SnipTool` | Context snipping | `HISTORY_SNIP` |
|
|
143
|
-
| `SleepTool` | Sleep/delay in agent loop | `PROACTIVE` / `KAIROS` |
|
|
144
|
-
| `MonitorTool` | MCP monitoring | `MONITOR_TOOL` |
|
|
145
|
-
| `OverflowTestTool` | Overflow testing | `OVERFLOW_TEST_TOOL` |
|
|
146
|
-
| `WorkflowTool` | Workflow execution | `WORKFLOW_SCRIPTS` |
|
|
147
|
-
| `WebBrowserTool` | Browser automation | `WEB_BROWSER_TOOL` |
|
|
148
|
-
| `TerminalCaptureTool` | Terminal capture | `TERMINAL_PANEL` |
|
|
149
|
-
| `TungstenTool` | Internal perf monitoring | `ant` (internal) |
|
|
150
|
-
| `VerifyPlanExecutionTool` | Plan verification | `CLAUDE_CODE_VERIFY_PLAN` |
|
|
151
|
-
| `SendUserFileTool` | Send files to users | `KAIROS` |
|
|
152
|
-
| `SubscribePRTool` | GitHub PR subscription | `KAIROS_GITHUB_WEBHOOKS` |
|
|
153
|
-
| `SuggestBackgroundPRTool` | Suggest background PRs | `KAIROS` |
|
|
154
|
-
| `PushNotificationTool` | Push notifications | `KAIROS` |
|
|
155
|
-
| `CtxInspectTool` | Context inspection | `CONTEXT_COLLAPSE` |
|
|
156
|
-
| `ListPeersTool` | List active peers | `UDS_INBOX` |
|
|
157
|
-
| `DiscoverSkillsTool` | Skill discovery | `EXPERIMENTAL_SKILL_SEARCH` |
|
|
158
|
-
|
|
159
|
-
### Text/Prompt Assets (~6 files)
|
|
160
|
-
|
|
161
|
-
These are internal prompt templates and documentation, never published.
|
|
162
|
-
|
|
163
|
-
| File | Purpose |
|
|
164
|
-
|------|---------|
|
|
165
|
-
| `yolo-classifier-prompts/auto_mode_system_prompt.txt` | Auto-mode system prompt for classifier |
|
|
166
|
-
| `yolo-classifier-prompts/permissions_anthropic.txt` | Anthropic-internal permission prompt |
|
|
167
|
-
| `yolo-classifier-prompts/permissions_external.txt` | External user permission prompt |
|
|
168
|
-
| `verify/SKILL.md` | Verification skill documentation |
|
|
169
|
-
| `verify/examples/cli.md` | CLI verification examples |
|
|
170
|
-
| `verify/examples/server.md` | Server verification examples |
|
|
171
|
-
|
|
172
|
-
### Why They're Missing
|
|
173
|
-
|
|
174
|
-
```
|
|
175
|
-
Anthropic Internal Monorepo Published npm Package
|
|
176
|
-
────────────────────────── ─────────────────────
|
|
177
|
-
feature('DAEMON') → true ──build──→ feature('DAEMON') → false
|
|
178
|
-
↓ ↓
|
|
179
|
-
daemon/main.js ← INCLUDED ──bundle─→ daemon/main.js ← DELETED (DCE)
|
|
180
|
-
tools/REPLTool ← INCLUDED ──bundle─→ tools/REPLTool ← DELETED (DCE)
|
|
181
|
-
proactive/ ← INCLUDED ──bundle─→ (referenced but absent from src/)
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
Bun's `feature()` is a **compile-time intrinsic**:
|
|
185
|
-
- Returns `true` in Anthropic's internal build → code is kept in the bundle
|
|
186
|
-
- Returns `false` in the published build → code is dead-code-eliminated
|
|
187
|
-
- The 108 modules simply do not exist anywhere in the published artifact
|
|
188
|
-
|
|
189
|
-
---
|
|
190
|
-
|
|
191
|
-
## Copyright & Disclaimer
|
|
192
|
-
|
|
193
|
-
```
|
|
194
|
-
Copyright (c) Anthropic PBC. All rights reserved.
|
|
195
|
-
|
|
196
|
-
All source code in this repository is the intellectual property of Anthropic.
|
|
197
|
-
This repository is provided strictly for technical research and educational purposes.
|
|
198
|
-
Commercial use is strictly prohibited.
|
|
199
|
-
|
|
200
|
-
If you are the copyright owner and believe this repository infringes your rights,
|
|
201
|
-
please contact the repository owner for immediate removal.
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
---
|
|
205
|
-
|
|
206
|
-
## Stats
|
|
207
|
-
|
|
208
|
-
| Item | Count |
|
|
209
|
-
|------|-------|
|
|
210
|
-
| Source files (.ts/.tsx) | ~1,884 |
|
|
211
|
-
| Lines of code | ~512,664 |
|
|
212
|
-
| Largest single file | `query.ts` (~785KB) |
|
|
213
|
-
| Built-in tools | ~40+ |
|
|
214
|
-
| Slash commands | ~80+ |
|
|
215
|
-
| Dependencies (node_modules) | ~192 packages |
|
|
216
|
-
| Runtime | Bun (compiled to Node.js >= 18 bundle) |
|
|
217
|
-
|
|
218
|
-
---
|
|
219
|
-
|
|
220
|
-
## The Agent Pattern
|
|
221
|
-
|
|
222
|
-
```
|
|
223
|
-
THE CORE LOOP
|
|
224
|
-
=============
|
|
225
|
-
|
|
226
|
-
User --> messages[] --> Claude API --> response
|
|
227
|
-
|
|
|
228
|
-
stop_reason == "tool_use"?
|
|
229
|
-
/ \
|
|
230
|
-
yes no
|
|
231
|
-
| |
|
|
232
|
-
execute tools return text
|
|
233
|
-
append tool_result
|
|
234
|
-
loop back -----------------> messages[]
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
That is the minimal agent loop. Claude Code wraps this loop
|
|
238
|
-
with a production-grade harness: permissions, streaming,
|
|
239
|
-
concurrency, compaction, sub-agents, persistence, and MCP.
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
---
|
|
243
|
-
|
|
244
|
-
## Directory Reference
|
|
245
|
-
|
|
246
|
-
```
|
|
247
|
-
src/
|
|
248
|
-
├── main.tsx # REPL bootstrap, 4,683 lines
|
|
249
|
-
├── QueryEngine.ts # SDK/headless query lifecycle engine
|
|
250
|
-
├── query.ts # Main agent loop (785KB, largest file)
|
|
251
|
-
├── Tool.ts # Tool interface + buildTool factory
|
|
252
|
-
├── Task.ts # Task types, IDs, state base
|
|
253
|
-
├── tools.ts # Tool registry, presets, filtering
|
|
254
|
-
├── commands.ts # Slash command definitions
|
|
255
|
-
├── context.ts # User input context
|
|
256
|
-
├── cost-tracker.ts # API cost accumulation
|
|
257
|
-
├── setup.ts # First-run setup flow
|
|
258
|
-
│
|
|
259
|
-
├── bridge/ # Claude Desktop / remote bridge
|
|
260
|
-
│ ├── bridgeMain.ts # Session lifecycle manager
|
|
261
|
-
│ ├── bridgeApi.ts # HTTP client
|
|
262
|
-
│ ├── bridgeConfig.ts # Connection config
|
|
263
|
-
│ ├── bridgeMessaging.ts # Message relay
|
|
264
|
-
│ ├── sessionRunner.ts # Process spawning
|
|
265
|
-
│ ├── jwtUtils.ts # JWT refresh
|
|
266
|
-
│ ├── workSecret.ts # Auth tokens
|
|
267
|
-
│ └── capacityWake.ts # Capacity-based wakeup
|
|
268
|
-
│
|
|
269
|
-
├── cli/ # CLI infrastructure
|
|
270
|
-
│ ├── handlers/ # Command handlers
|
|
271
|
-
│ └── transports/ # I/O transports (stdio, structured)
|
|
272
|
-
│
|
|
273
|
-
├── commands/ # ~80 slash commands
|
|
274
|
-
│ ├── agents/ # Agent management
|
|
275
|
-
│ ├── compact/ # Context compaction
|
|
276
|
-
│ ├── config/ # Settings management
|
|
277
|
-
│ ├── help/ # Help display
|
|
278
|
-
│ ├── login/ # Authentication
|
|
279
|
-
│ ├── mcp/ # MCP server management
|
|
280
|
-
│ ├── memory/ # Memory system
|
|
281
|
-
│ ├── plan/ # Plan mode
|
|
282
|
-
│ ├── resume/ # Session resume
|
|
283
|
-
│ ├── review/ # Code review
|
|
284
|
-
│ └── ... # 70+ more commands
|
|
285
|
-
│
|
|
286
|
-
├── components/ # React/Ink terminal UI
|
|
287
|
-
│ ├── design-system/ # Reusable UI primitives
|
|
288
|
-
│ ├── messages/ # Message rendering
|
|
289
|
-
│ ├── permissions/ # Permission dialogs
|
|
290
|
-
│ ├── PromptInput/ # Input field + suggestions
|
|
291
|
-
│ ├── LogoV2/ # Branding + welcome screen
|
|
292
|
-
│ ├── Settings/ # Settings panels
|
|
293
|
-
│ ├── Spinner.tsx # Loading indicators
|
|
294
|
-
│ └── ... # 40+ component groups
|
|
295
|
-
│
|
|
296
|
-
├── entrypoints/ # Application entry points
|
|
297
|
-
│ ├── cli.tsx # CLI main (version, help, daemon)
|
|
298
|
-
│ ├── sdk/ # Agent SDK (types, sessions)
|
|
299
|
-
│ └── mcp.ts # MCP server entry
|
|
300
|
-
│
|
|
301
|
-
├── hooks/ # React hooks
|
|
302
|
-
│ ├── useCanUseTool.tsx # Permission checking
|
|
303
|
-
│ ├── useReplBridge.tsx # Bridge connection
|
|
304
|
-
│ ├── notifs/ # Notification hooks
|
|
305
|
-
│ └── toolPermission/ # Tool permission handlers
|
|
306
|
-
│
|
|
307
|
-
├── services/ # Business logic layer
|
|
308
|
-
│ ├── api/ # Claude API client
|
|
309
|
-
│ │ ├── claude.ts # Streaming API calls
|
|
310
|
-
│ │ ├── errors.ts # Error categorization
|
|
311
|
-
│ │ └── withRetry.ts # Retry logic
|
|
312
|
-
│ ├── analytics/ # Telemetry + GrowthBook
|
|
313
|
-
│ ├── compact/ # Context compression
|
|
314
|
-
│ ├── mcp/ # MCP connection management
|
|
315
|
-
│ ├── tools/ # Tool execution engine
|
|
316
|
-
│ │ ├── StreamingToolExecutor.ts # Parallel tool runner
|
|
317
|
-
│ │ └── toolOrchestration.ts # Batch orchestration
|
|
318
|
-
│ ├── plugins/ # Plugin loader
|
|
319
|
-
│ └── settingsSync/ # Cross-device settings
|
|
320
|
-
│
|
|
321
|
-
├── state/ # Application state
|
|
322
|
-
│ ├── AppStateStore.ts # Store definition
|
|
323
|
-
│ └── AppState.tsx # React provider + hooks
|
|
324
|
-
│
|
|
325
|
-
├── tasks/ # Task implementations
|
|
326
|
-
│ ├── LocalShellTask/ # Bash command execution
|
|
327
|
-
│ ├── LocalAgentTask/ # Sub-agent execution
|
|
328
|
-
│ ├── RemoteAgentTask/ # Remote agent via bridge
|
|
329
|
-
│ ├── InProcessTeammateTask/ # In-process teammate
|
|
330
|
-
│ └── DreamTask/ # Background thinking
|
|
331
|
-
│
|
|
332
|
-
├── tools/ # 40+ tool implementations
|
|
333
|
-
│ ├── AgentTool/ # Sub-agent spawning + fork
|
|
334
|
-
│ ├── BashTool/ # Shell command execution
|
|
335
|
-
│ ├── FileReadTool/ # File reading (PDF, image, etc)
|
|
336
|
-
│ ├── FileEditTool/ # String-replace editing
|
|
337
|
-
│ ├── FileWriteTool/ # Full file creation
|
|
338
|
-
│ ├── GlobTool/ # File pattern search
|
|
339
|
-
│ ├── GrepTool/ # Content search (ripgrep)
|
|
340
|
-
│ ├── WebFetchTool/ # HTTP fetching
|
|
341
|
-
│ ├── WebSearchTool/ # Web search
|
|
342
|
-
│ ├── MCPTool/ # MCP tool wrapper
|
|
343
|
-
│ ├── SkillTool/ # Skill invocation
|
|
344
|
-
│ ├── AskUserQuestionTool/ # User interaction
|
|
345
|
-
│ └── ... # 30+ more tools
|
|
346
|
-
│
|
|
347
|
-
├── types/ # Type definitions
|
|
348
|
-
│ ├── message.ts # Message discriminated unions
|
|
349
|
-
│ ├── permissions.ts # Permission types
|
|
350
|
-
│ ├── tools.ts # Tool progress types
|
|
351
|
-
│ └── ids.ts # Branded ID types
|
|
352
|
-
│
|
|
353
|
-
├── utils/ # Utilities (largest directory)
|
|
354
|
-
│ ├── permissions/ # Permission rule engine
|
|
355
|
-
│ ├── messages/ # Message formatting
|
|
356
|
-
│ ├── model/ # Model selection logic
|
|
357
|
-
│ ├── settings/ # Settings management
|
|
358
|
-
│ ├── sandbox/ # Sandbox runtime adapter
|
|
359
|
-
│ ├── hooks/ # Hook execution
|
|
360
|
-
│ ├── memory/ # Memory system utils
|
|
361
|
-
│ ├── git/ # Git operations
|
|
362
|
-
│ ├── github/ # GitHub API
|
|
363
|
-
│ ├── bash/ # Bash execution helpers
|
|
364
|
-
│ ├── swarm/ # Multi-agent swarm
|
|
365
|
-
│ ├── telemetry/ # Telemetry reporting
|
|
366
|
-
│ └── ... # 30+ more util groups
|
|
367
|
-
│
|
|
368
|
-
└── vendor/ # Native module source stubs
|
|
369
|
-
├── audio-capture-src/ # Audio input
|
|
370
|
-
├── image-processor-src/ # Image processing
|
|
371
|
-
├── modifiers-napi-src/ # Native modifiers
|
|
372
|
-
└── url-handler-src/ # URL handling
|
|
373
|
-
```
|
|
374
|
-
|
|
375
|
-
---
|
|
376
|
-
|
|
377
|
-
## Architecture Overview
|
|
378
|
-
|
|
379
|
-
```
|
|
380
|
-
┌─────────────────────────────────────────────────────────────────────┐
|
|
381
|
-
│ ENTRY LAYER │
|
|
382
|
-
│ cli.tsx ──> main.tsx ──> REPL.tsx (interactive) │
|
|
383
|
-
│ └──> QueryEngine.ts (headless/SDK) │
|
|
384
|
-
└──────────────────────────────┬──────────────────────────────────────┘
|
|
385
|
-
│
|
|
386
|
-
▼
|
|
387
|
-
┌─────────────────────────────────────────────────────────────────────┐
|
|
388
|
-
│ QUERY ENGINE │
|
|
389
|
-
│ submitMessage(prompt) ──> AsyncGenerator<SDKMessage> │
|
|
390
|
-
│ │ │
|
|
391
|
-
│ ├── fetchSystemPromptParts() ──> assemble system prompt │
|
|
392
|
-
│ ├── processUserInput() ──> handle /commands │
|
|
393
|
-
│ ├── query() ──> main agent loop │
|
|
394
|
-
│ │ ├── StreamingToolExecutor ──> parallel tool execution │
|
|
395
|
-
│ │ ├── autoCompact() ──> context compression │
|
|
396
|
-
│ │ └── runTools() ──> tool orchestration │
|
|
397
|
-
│ └── yield SDKMessage ──> stream to consumer │
|
|
398
|
-
└──────────────────────────────┬──────────────────────────────────────┘
|
|
399
|
-
│
|
|
400
|
-
┌────────────────┼────────────────┐
|
|
401
|
-
▼ ▼ ▼
|
|
402
|
-
┌──────────────────┐ ┌─────────────────┐ ┌──────────────────┐
|
|
403
|
-
│ TOOL SYSTEM │ │ SERVICE LAYER │ │ STATE LAYER │
|
|
404
|
-
│ │ │ │ │ │
|
|
405
|
-
│ Tool Interface │ │ api/claude.ts │ │ AppState Store │
|
|
406
|
-
│ ├─ call() │ │ API client │ │ ├─ permissions │
|
|
407
|
-
│ ├─ validate() │ │ compact/ │ │ ├─ fileHistory │
|
|
408
|
-
│ ├─ checkPerms() │ │ auto-compact │ │ ├─ agents │
|
|
409
|
-
│ ├─ render() │ │ mcp/ │ │ └─ fastMode │
|
|
410
|
-
│ └─ prompt() │ │ MCP protocol │ │ │
|
|
411
|
-
│ │ │ analytics/ │ │ React Context │
|
|
412
|
-
│ 40+ Built-in: │ │ telemetry │ │ ├─ useAppState │
|
|
413
|
-
│ ├─ BashTool │ │ tools/ │ │ └─ useSetState │
|
|
414
|
-
│ ├─ FileRead │ │ executor │ │ │
|
|
415
|
-
│ ├─ FileEdit │ │ plugins/ │ └──────────────────┘
|
|
416
|
-
│ ├─ Glob/Grep │ │ loader │
|
|
417
|
-
│ ├─ AgentTool │ │ settingsSync/ │
|
|
418
|
-
│ ├─ WebFetch │ │ cross-device │
|
|
419
|
-
│ └─ MCPTool │ │ oauth/ │
|
|
420
|
-
│ │ │ auth flow │
|
|
421
|
-
└──────────────────┘ └─────────────────┘
|
|
422
|
-
│ │
|
|
423
|
-
▼ ▼
|
|
424
|
-
┌──────────────────┐ ┌─────────────────┐
|
|
425
|
-
│ TASK SYSTEM │ │ BRIDGE LAYER │
|
|
426
|
-
│ │ │ │
|
|
427
|
-
│ Task Types: │ │ bridgeMain.ts │
|
|
428
|
-
│ ├─ local_bash │ │ session mgmt │
|
|
429
|
-
│ ├─ local_agent │ │ bridgeApi.ts │
|
|
430
|
-
│ ├─ remote_agent │ │ HTTP client │
|
|
431
|
-
│ ├─ in_process │ │ workSecret.ts │
|
|
432
|
-
│ ├─ dream │ │ auth tokens │
|
|
433
|
-
│ └─ workflow │ │ sessionRunner │
|
|
434
|
-
│ │ │ process spawn │
|
|
435
|
-
│ ID: prefix+8chr │ └─────────────────┘
|
|
436
|
-
│ b=bash a=agent │
|
|
437
|
-
│ r=remote t=team │
|
|
438
|
-
└──────────────────┘
|
|
439
|
-
```
|
|
440
|
-
|
|
441
|
-
---
|
|
442
|
-
|
|
443
|
-
## Data Flow: A Single Query Lifecycle
|
|
444
|
-
|
|
445
|
-
```
|
|
446
|
-
USER INPUT (prompt / slash command)
|
|
447
|
-
│
|
|
448
|
-
▼
|
|
449
|
-
processUserInput() ← parse /commands, build UserMessage
|
|
450
|
-
│
|
|
451
|
-
▼
|
|
452
|
-
fetchSystemPromptParts() ← tools → prompt sections, CLAUDE.md memory
|
|
453
|
-
│
|
|
454
|
-
▼
|
|
455
|
-
recordTranscript() ← persist user message to disk (JSONL)
|
|
456
|
-
│
|
|
457
|
-
▼
|
|
458
|
-
┌─→ normalizeMessagesForAPI() ← strip UI-only fields, compact if needed
|
|
459
|
-
│ │
|
|
460
|
-
│ ▼
|
|
461
|
-
│ Claude API (streaming) ← POST /v1/messages with tools + system prompt
|
|
462
|
-
│ │
|
|
463
|
-
│ ▼
|
|
464
|
-
│ stream events ← message_start → content_block_delta → message_stop
|
|
465
|
-
│ │
|
|
466
|
-
│ ├─ text block ──────────────→ yield to consumer (SDK / REPL)
|
|
467
|
-
│ │
|
|
468
|
-
│ └─ tool_use block?
|
|
469
|
-
│ │
|
|
470
|
-
│ ▼
|
|
471
|
-
│ StreamingToolExecutor ← partition: concurrent-safe vs serial
|
|
472
|
-
│ │
|
|
473
|
-
│ ▼
|
|
474
|
-
│ canUseTool() ← permission check (hooks + rules + UI prompt)
|
|
475
|
-
│ │
|
|
476
|
-
│ ├─ DENY ────────────────→ append tool_result(error), continue loop
|
|
477
|
-
│ │
|
|
478
|
-
│ └─ ALLOW
|
|
479
|
-
│ │
|
|
480
|
-
│ ▼
|
|
481
|
-
│ tool.call() ← execute the tool (Bash, Read, Edit, etc.)
|
|
482
|
-
│ │
|
|
483
|
-
│ ▼
|
|
484
|
-
│ append tool_result ← push to messages[], recordTranscript()
|
|
485
|
-
│ │
|
|
486
|
-
└─────────┘ ← loop back to API call
|
|
487
|
-
│
|
|
488
|
-
▼ (stop_reason != "tool_use")
|
|
489
|
-
yield result message ← final text, usage, cost, session_id
|
|
490
|
-
```
|
|
491
|
-
|
|
492
|
-
---
|
|
493
|
-
|
|
494
|
-
## Tool System Architecture
|
|
495
|
-
|
|
496
|
-
```
|
|
497
|
-
TOOL INTERFACE
|
|
498
|
-
==============
|
|
499
|
-
|
|
500
|
-
buildTool(definition) ──> Tool<Input, Output, Progress>
|
|
501
|
-
|
|
502
|
-
Every tool implements:
|
|
503
|
-
┌────────────────────────────────────────────────────────┐
|
|
504
|
-
│ LIFECYCLE │
|
|
505
|
-
│ ├── validateInput() → reject bad args early │
|
|
506
|
-
│ ├── checkPermissions() → tool-specific authz │
|
|
507
|
-
│ └── call() → execute and return result │
|
|
508
|
-
│ │
|
|
509
|
-
│ CAPABILITIES │
|
|
510
|
-
│ ├── isEnabled() → feature gate check │
|
|
511
|
-
│ ├── isConcurrencySafe() → can run in parallel? │
|
|
512
|
-
│ ├── isReadOnly() → no side effects? │
|
|
513
|
-
│ ├── isDestructive() → irreversible ops? │
|
|
514
|
-
│ └── interruptBehavior() → cancel or block on user? │
|
|
515
|
-
│ │
|
|
516
|
-
│ RENDERING (React/Ink) │
|
|
517
|
-
│ ├── renderToolUseMessage() → input display │
|
|
518
|
-
│ ├── renderToolResultMessage() → output display │
|
|
519
|
-
│ ├── renderToolUseProgressMessage() → spinner/status │
|
|
520
|
-
│ └── renderGroupedToolUse() → parallel tool groups │
|
|
521
|
-
│ │
|
|
522
|
-
│ AI FACING │
|
|
523
|
-
│ ├── prompt() → tool description for LLM │
|
|
524
|
-
│ ├── description() → dynamic description │
|
|
525
|
-
│ └── mapToolResultToAPI() → format for API response │
|
|
526
|
-
└────────────────────────────────────────────────────────┘
|
|
527
|
-
```
|
|
528
|
-
|
|
529
|
-
### Complete Tool Inventory
|
|
530
|
-
|
|
531
|
-
```
|
|
532
|
-
FILE OPERATIONS SEARCH & DISCOVERY EXECUTION
|
|
533
|
-
═════════════════ ══════════════════════ ══════════
|
|
534
|
-
FileReadTool GlobTool BashTool
|
|
535
|
-
FileEditTool GrepTool PowerShellTool
|
|
536
|
-
FileWriteTool ToolSearchTool
|
|
537
|
-
NotebookEditTool INTERACTION
|
|
538
|
-
═══════════
|
|
539
|
-
WEB & NETWORK AGENT / TASK AskUserQuestionTool
|
|
540
|
-
════════════════ ══════════════════ BriefTool
|
|
541
|
-
WebFetchTool AgentTool
|
|
542
|
-
WebSearchTool SendMessageTool PLANNING & WORKFLOW
|
|
543
|
-
TeamCreateTool ════════════════════
|
|
544
|
-
MCP PROTOCOL TeamDeleteTool EnterPlanModeTool
|
|
545
|
-
══════════════ TaskCreateTool ExitPlanModeTool
|
|
546
|
-
MCPTool TaskGetTool EnterWorktreeTool
|
|
547
|
-
ListMcpResourcesTool TaskUpdateTool ExitWorktreeTool
|
|
548
|
-
ReadMcpResourceTool TaskListTool TodoWriteTool
|
|
549
|
-
TaskStopTool
|
|
550
|
-
TaskOutputTool SYSTEM
|
|
551
|
-
════════
|
|
552
|
-
SKILLS & EXTENSIONS ConfigTool
|
|
553
|
-
═════════════════════ SkillTool
|
|
554
|
-
SkillTool ScheduleCronTool
|
|
555
|
-
LSPTool SleepTool
|
|
556
|
-
TungstenTool
|
|
557
|
-
```
|
|
558
|
-
|
|
559
|
-
---
|
|
560
|
-
|
|
561
|
-
## Permission System
|
|
562
|
-
|
|
563
|
-
```
|
|
564
|
-
TOOL CALL REQUEST
|
|
565
|
-
│
|
|
566
|
-
▼
|
|
567
|
-
┌─ validateInput() ──────────────────────────────────┐
|
|
568
|
-
│ reject invalid inputs before any permission check │
|
|
569
|
-
└────────────────────┬───────────────────────────────┘
|
|
570
|
-
│
|
|
571
|
-
▼
|
|
572
|
-
┌─ PreToolUse Hooks ─────────────────────────────────┐
|
|
573
|
-
│ user-defined shell commands (settings.json hooks) │
|
|
574
|
-
│ can: approve, deny, or modify input │
|
|
575
|
-
└────────────────────┬───────────────────────────────┘
|
|
576
|
-
│
|
|
577
|
-
▼
|
|
578
|
-
┌─ Permission Rules ─────────────────────────────────┐
|
|
579
|
-
│ alwaysAllowRules: match tool name/pattern → auto │
|
|
580
|
-
│ alwaysDenyRules: match tool name/pattern → deny │
|
|
581
|
-
│ alwaysAskRules: match tool name/pattern → ask │
|
|
582
|
-
│ Sources: settings, CLI args, session decisions │
|
|
583
|
-
└────────────────────┬───────────────────────────────┘
|
|
584
|
-
│
|
|
585
|
-
no rule match?
|
|
586
|
-
│
|
|
587
|
-
▼
|
|
588
|
-
┌─ Interactive Prompt ───────────────────────────────┐
|
|
589
|
-
│ User sees tool name + input │
|
|
590
|
-
│ Options: Allow Once / Allow Always / Deny │
|
|
591
|
-
└────────────────────┬───────────────────────────────┘
|
|
592
|
-
│
|
|
593
|
-
▼
|
|
594
|
-
┌─ checkPermissions() ───────────────────────────────┐
|
|
595
|
-
│ Tool-specific logic (e.g. path sandboxing) │
|
|
596
|
-
└────────────────────┬───────────────────────────────┘
|
|
597
|
-
│
|
|
598
|
-
APPROVED → tool.call()
|
|
599
|
-
```
|
|
600
|
-
|
|
601
|
-
---
|
|
602
|
-
|
|
603
|
-
## Sub-Agent & Multi-Agent Architecture
|
|
604
|
-
|
|
605
|
-
```
|
|
606
|
-
MAIN AGENT
|
|
607
|
-
==========
|
|
608
|
-
│
|
|
609
|
-
┌───────────────┼───────────────┐
|
|
610
|
-
▼ ▼ ▼
|
|
611
|
-
┌──────────────┐ ┌──────────┐ ┌──────────────┐
|
|
612
|
-
│ FORK AGENT │ │ REMOTE │ │ IN-PROCESS │
|
|
613
|
-
│ │ │ AGENT │ │ TEAMMATE │
|
|
614
|
-
│ Fork process │ │ Bridge │ │ Same process │
|
|
615
|
-
│ Shared cache │ │ session │ │ Async context│
|
|
616
|
-
│ Fresh msgs[] │ │ Isolated │ │ Shared state │
|
|
617
|
-
└──────────────┘ └──────────┘ └──────────────┘
|
|
618
|
-
|
|
619
|
-
SPAWN MODES:
|
|
620
|
-
├─ default → in-process, shared conversation
|
|
621
|
-
├─ fork → child process, fresh messages[], shared file cache
|
|
622
|
-
├─ worktree → isolated git worktree + fork
|
|
623
|
-
└─ remote → bridge to Claude Code Remote / container
|
|
624
|
-
|
|
625
|
-
COMMUNICATION:
|
|
626
|
-
├─ SendMessageTool → agent-to-agent messages
|
|
627
|
-
├─ TaskCreate/Update → shared task board
|
|
628
|
-
└─ TeamCreate/Delete → team lifecycle management
|
|
629
|
-
|
|
630
|
-
SWARM MODE (feature-gated):
|
|
631
|
-
┌─────────────────────────────────────────────┐
|
|
632
|
-
│ Lead Agent │
|
|
633
|
-
│ ├── Teammate A ──> claims Task 1 │
|
|
634
|
-
│ ├── Teammate B ──> claims Task 2 │
|
|
635
|
-
│ └── Teammate C ──> claims Task 3 │
|
|
636
|
-
│ │
|
|
637
|
-
│ Shared: task board, message inbox │
|
|
638
|
-
│ Isolated: messages[], file cache, cwd │
|
|
639
|
-
└─────────────────────────────────────────────┘
|
|
640
|
-
```
|
|
641
|
-
|
|
642
|
-
---
|
|
643
|
-
|
|
644
|
-
## Context Management (Compact System)
|
|
645
|
-
|
|
646
|
-
```
|
|
647
|
-
CONTEXT WINDOW BUDGET
|
|
648
|
-
═════════════════════
|
|
649
|
-
|
|
650
|
-
┌─────────────────────────────────────────────────────┐
|
|
651
|
-
│ System Prompt (tools, permissions, CLAUDE.md) │
|
|
652
|
-
│ ══════════════════════════════════════════════ │
|
|
653
|
-
│ │
|
|
654
|
-
│ Conversation History │
|
|
655
|
-
│ ┌─────────────────────────────────────────────┐ │
|
|
656
|
-
│ │ [compacted summary of older messages] │ │
|
|
657
|
-
│ │ ═══════════════════════════════════════════ │ │
|
|
658
|
-
│ │ [compact_boundary marker] │ │
|
|
659
|
-
│ │ ─────────────────────────────────────────── │ │
|
|
660
|
-
│ │ [recent messages — full fidelity] │ │
|
|
661
|
-
│ │ user → assistant → tool_use → tool_result │ │
|
|
662
|
-
│ └─────────────────────────────────────────────┘ │
|
|
663
|
-
│ │
|
|
664
|
-
│ Current Turn (user + assistant response) │
|
|
665
|
-
└─────────────────────────────────────────────────────┘
|
|
666
|
-
|
|
667
|
-
THREE COMPRESSION STRATEGIES:
|
|
668
|
-
├─ autoCompact → triggers when token count exceeds threshold
|
|
669
|
-
│ summarizes old messages via a compact API call
|
|
670
|
-
├─ snipCompact → removes zombie messages and stale markers
|
|
671
|
-
│ (HISTORY_SNIP feature flag)
|
|
672
|
-
└─ contextCollapse → restructures context for efficiency
|
|
673
|
-
(CONTEXT_COLLAPSE feature flag)
|
|
674
|
-
|
|
675
|
-
COMPACTION FLOW:
|
|
676
|
-
messages[] ──> getMessagesAfterCompactBoundary()
|
|
677
|
-
│
|
|
678
|
-
▼
|
|
679
|
-
older messages ──> Claude API (summarize) ──> compact summary
|
|
680
|
-
│
|
|
681
|
-
▼
|
|
682
|
-
[summary] + [compact_boundary] + [recent messages]
|
|
59
|
+
curl -fsSL https://unpkg.com/myclaude-code@8.8.12/install.sh | bash -s -- 8.8.12
|
|
683
60
|
```
|
|
684
61
|
|
|
685
|
-
|
|
62
|
+
## Quick Start
|
|
686
63
|
|
|
687
|
-
|
|
64
|
+
1. Run `myclaude`
|
|
65
|
+
2. Open the API configuration flow
|
|
66
|
+
3. Add a provider or custom endpoint
|
|
67
|
+
4. Paste the API base URL and API key or token
|
|
68
|
+
5. Start using `myclaude` immediately
|
|
688
69
|
|
|
689
|
-
|
|
690
|
-
┌─────────────────────────────────────────────────────────┐
|
|
691
|
-
│ MCP ARCHITECTURE │
|
|
692
|
-
│ │
|
|
693
|
-
│ MCPConnectionManager.tsx │
|
|
694
|
-
│ ├── Server Discovery (config from settings.json) │
|
|
695
|
-
│ │ ├── stdio → spawn child process │
|
|
696
|
-
│ │ ├── sse → HTTP EventSource │
|
|
697
|
-
│ │ ├── http → Streamable HTTP │
|
|
698
|
-
│ │ ├── ws → WebSocket │
|
|
699
|
-
│ │ └── sdk → in-process transport │
|
|
700
|
-
│ │ │
|
|
701
|
-
│ ├── Client Lifecycle │
|
|
702
|
-
│ │ ├── connect → initialize → list tools │
|
|
703
|
-
│ │ ├── tool calls via MCPTool wrapper │
|
|
704
|
-
│ │ └── disconnect / reconnect with backoff │
|
|
705
|
-
│ │ │
|
|
706
|
-
│ ├── Authentication │
|
|
707
|
-
│ │ ├── OAuth 2.0 flow (McpOAuthConfig) │
|
|
708
|
-
│ │ ├── Cross-App Access (XAA / SEP-990) │
|
|
709
|
-
│ │ └── API key via headers │
|
|
710
|
-
│ │ │
|
|
711
|
-
│ └── Tool Registration │
|
|
712
|
-
│ ├── mcp__<server>__<tool> naming convention │
|
|
713
|
-
│ ├── Dynamic schema from MCP server │
|
|
714
|
-
│ ├── Permission passthrough to Claude Code │
|
|
715
|
-
│ └── Resource listing (ListMcpResourcesTool) │
|
|
716
|
-
│ │
|
|
717
|
-
└─────────────────────────────────────────────────────────┘
|
|
718
|
-
```
|
|
70
|
+
This package is intended for users who want a simpler setup path and faster access to compatible third-party providers.
|
|
719
71
|
|
|
720
|
-
|
|
72
|
+
On macOS, `myclaude` now avoids Keychain by default and stores local credentials in `~/.claude/.credentials.json` so startup does not trigger system Keychain prompts. If you explicitly want the old Keychain behavior back, launch with `MYCLAUDE_USE_KEYCHAIN=1 myclaude`.
|
|
721
73
|
|
|
722
|
-
##
|
|
723
|
-
|
|
724
|
-
```
|
|
725
|
-
Claude Desktop / Web / Cowork Claude Code CLI
|
|
726
|
-
══════════════════════════ ═════════════════
|
|
727
|
-
|
|
728
|
-
┌───────────────────┐ ┌──────────────────┐
|
|
729
|
-
│ Bridge Client │ ←─ HTTP ──→ │ bridgeMain.ts │
|
|
730
|
-
│ (Desktop App) │ │ │
|
|
731
|
-
└───────────────────┘ │ Session Manager │
|
|
732
|
-
│ ├── spawn CLI │
|
|
733
|
-
PROTOCOL: │ ├── poll status │
|
|
734
|
-
├─ JWT authentication │ ├── relay msgs │
|
|
735
|
-
├─ Work secret exchange │ └── capacityWake │
|
|
736
|
-
├─ Session lifecycle │ │
|
|
737
|
-
│ ├── create │ Backoff: │
|
|
738
|
-
│ ├── run │ ├─ conn: 2s→2m │
|
|
739
|
-
│ └─ stop │ └─ gen: 500ms→30s│
|
|
740
|
-
└─ Token refresh scheduler └──────────────────┘
|
|
741
|
-
```
|
|
74
|
+
## Commands
|
|
742
75
|
|
|
743
|
-
|
|
76
|
+
Version check:
|
|
744
77
|
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
~/.claude/projects/<hash>/sessions/
|
|
752
|
-
└── <session-id>.jsonl ← append-only log
|
|
753
|
-
├── {"type":"user",...}
|
|
754
|
-
├── {"type":"assistant",...}
|
|
755
|
-
├── {"type":"progress",...}
|
|
756
|
-
└── {"type":"system","subtype":"compact_boundary",...}
|
|
757
|
-
|
|
758
|
-
RESUME FLOW:
|
|
759
|
-
getLastSessionLog() ──> parse JSONL ──> rebuild messages[]
|
|
760
|
-
│
|
|
761
|
-
├── --continue → last session in cwd
|
|
762
|
-
├── --resume <id> → specific session
|
|
763
|
-
└── --fork-session → new ID, copy history
|
|
764
|
-
|
|
765
|
-
PERSISTENCE STRATEGY:
|
|
766
|
-
├─ User messages → await write (blocking, for crash recovery)
|
|
767
|
-
├─ Assistant msgs → fire-and-forget (order-preserving queue)
|
|
768
|
-
├─ Progress → inline write (dedup on next query)
|
|
769
|
-
└─ Flush → on result yield / cowork eager flush
|
|
78
|
+
```bash
|
|
79
|
+
myclaude --version
|
|
80
|
+
mycode --version
|
|
81
|
+
# available after running: myclaude install --force
|
|
82
|
+
claude --version
|
|
770
83
|
```
|
|
771
84
|
|
|
772
|
-
|
|
85
|
+
Login/config entry point:
|
|
773
86
|
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
```
|
|
777
|
-
DEAD CODE ELIMINATION (Bun compile-time)
|
|
778
|
-
══════════════════════════════════════════
|
|
779
|
-
|
|
780
|
-
feature('FLAG_NAME') ──→ true → included in bundle
|
|
781
|
-
──→ false → stripped from bundle
|
|
782
|
-
|
|
783
|
-
FLAGS (observed in source):
|
|
784
|
-
├─ COORDINATOR_MODE → multi-agent coordinator
|
|
785
|
-
├─ HISTORY_SNIP → aggressive history trimming
|
|
786
|
-
├─ CONTEXT_COLLAPSE → context restructuring
|
|
787
|
-
├─ DAEMON → background daemon workers
|
|
788
|
-
├─ AGENT_TRIGGERS → cron/remote triggers
|
|
789
|
-
├─ AGENT_TRIGGERS_REMOTE → remote trigger support
|
|
790
|
-
├─ MONITOR_TOOL → MCP monitoring tool
|
|
791
|
-
├─ WEB_BROWSER_TOOL → browser automation
|
|
792
|
-
├─ VOICE_MODE → voice input/output
|
|
793
|
-
├─ TEMPLATES → job classifier
|
|
794
|
-
├─ EXPERIMENTAL_SKILL_SEARCH → skill discovery
|
|
795
|
-
├─ KAIROS → push notifications, file sends
|
|
796
|
-
├─ PROACTIVE → sleep tool, proactive behavior
|
|
797
|
-
├─ OVERFLOW_TEST_TOOL → testing tool
|
|
798
|
-
├─ TERMINAL_PANEL → terminal capture
|
|
799
|
-
├─ WORKFLOW_SCRIPTS → workflow tool
|
|
800
|
-
├─ CHICAGO_MCP → computer use MCP
|
|
801
|
-
├─ DUMP_SYSTEM_PROMPT → prompt extraction (ant-only)
|
|
802
|
-
├─ UDS_INBOX → peer discovery
|
|
803
|
-
├─ ABLATION_BASELINE → experiment ablation
|
|
804
|
-
└─ UPGRADE_NOTICE → upgrade notifications
|
|
805
|
-
|
|
806
|
-
RUNTIME GATES:
|
|
807
|
-
├─ process.env.USER_TYPE === 'ant' → Anthropic-internal features
|
|
808
|
-
└─ GrowthBook feature flags → A/B experiments at runtime
|
|
87
|
+
```bash
|
|
88
|
+
myclaude auth login
|
|
809
89
|
```
|
|
810
90
|
|
|
811
|
-
|
|
91
|
+
Inside the interactive CLI, use `/provider` to switch a saved provider profile in one step. Each profile carries its API base URL, API key or token, and model routing together.
|
|
812
92
|
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
│ additionalWorkingDirectories, │
|
|
823
|
-
│ alwaysAllowRules, ← auto-approve │
|
|
824
|
-
│ alwaysDenyRules, ← auto-reject │
|
|
825
|
-
│ alwaysAskRules, ← always prompt │
|
|
826
|
-
│ isBypassPermissionsModeAvailable │
|
|
827
|
-
│ }, │
|
|
828
|
-
│ fileHistory: FileHistoryState, ← undo snapshots │
|
|
829
|
-
│ attribution: AttributionState, ← commit tracking │
|
|
830
|
-
│ verbose: boolean, │
|
|
831
|
-
│ mainLoopModel: string, ← active model │
|
|
832
|
-
│ fastMode: FastModeState, │
|
|
833
|
-
│ speculation: SpeculationState │
|
|
834
|
-
│ } │
|
|
835
|
-
│ │
|
|
836
|
-
│ React Integration: │
|
|
837
|
-
│ ├── AppStateProvider → creates store via createContext │
|
|
838
|
-
│ ├── useAppState(sel) → selector-based subscriptions │
|
|
839
|
-
│ └── useSetAppState() → immer-style updater function │
|
|
840
|
-
└──────────────────────────────────────────────────────────┘
|
|
93
|
+
```text
|
|
94
|
+
/provider
|
|
95
|
+
/provider list
|
|
96
|
+
/provider current
|
|
97
|
+
/provider validate
|
|
98
|
+
/provider repair
|
|
99
|
+
/provider use gpt54-main
|
|
100
|
+
/provider use kimi-main
|
|
101
|
+
/provider clear
|
|
841
102
|
```
|
|
842
103
|
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
## The 12 Progressive Harness Mechanisms
|
|
104
|
+
Use `/team` to inspect real local agent-team state from `~/.claude/teams` instead of getting a generic explanation.
|
|
846
105
|
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
s02 TOOL DISPATCH "Adding a tool = adding one handler"
|
|
855
|
-
Tool.ts + tools.ts: every tool registers into the dispatch
|
|
856
|
-
map. The loop stays identical. buildTool() factory provides
|
|
857
|
-
safe defaults.
|
|
858
|
-
|
|
859
|
-
s03 PLANNING "An agent without a plan drifts"
|
|
860
|
-
EnterPlanModeTool/ExitPlanModeTool + TodoWriteTool:
|
|
861
|
-
list steps first, then execute. Doubles completion rate.
|
|
862
|
-
|
|
863
|
-
s04 SUB-AGENTS "Break big tasks; clean context per subtask"
|
|
864
|
-
AgentTool + forkSubagent.ts: each child gets fresh messages[],
|
|
865
|
-
keeping the main conversation clean.
|
|
866
|
-
|
|
867
|
-
s05 KNOWLEDGE ON DEMAND "Load knowledge when you need it"
|
|
868
|
-
SkillTool + memdir/: inject via tool_result, not system prompt.
|
|
869
|
-
CLAUDE.md files loaded lazily per directory.
|
|
870
|
-
|
|
871
|
-
s06 CONTEXT COMPRESSION "Context fills up; make room"
|
|
872
|
-
services/compact/: three-layer strategy:
|
|
873
|
-
autoCompact (summarize) + snipCompact (trim) + contextCollapse
|
|
874
|
-
|
|
875
|
-
s07 PERSISTENT TASKS "Big goals → small tasks → disk"
|
|
876
|
-
TaskCreate/Update/Get/List: file-based task graph with
|
|
877
|
-
status tracking, dependencies, and persistence.
|
|
878
|
-
|
|
879
|
-
s08 BACKGROUND TASKS "Slow ops in background; agent keeps thinking"
|
|
880
|
-
DreamTask + LocalShellTask: daemon threads run commands,
|
|
881
|
-
inject notifications on completion.
|
|
882
|
-
|
|
883
|
-
s09 AGENT TEAMS "Too big for one → delegate to teammates"
|
|
884
|
-
TeamCreate/Delete + InProcessTeammateTask: persistent
|
|
885
|
-
teammates with async mailboxes.
|
|
886
|
-
|
|
887
|
-
s10 TEAM PROTOCOLS "Shared communication rules"
|
|
888
|
-
SendMessageTool: one request-response pattern drives
|
|
889
|
-
all negotiation between agents.
|
|
890
|
-
|
|
891
|
-
s11 AUTONOMOUS AGENTS "Teammates scan and claim tasks themselves"
|
|
892
|
-
coordinator/coordinatorMode.ts: idle cycle + auto-claim,
|
|
893
|
-
no need for lead to assign each task.
|
|
894
|
-
|
|
895
|
-
s12 WORKTREE ISOLATION "Each works in its own directory"
|
|
896
|
-
EnterWorktreeTool/ExitWorktreeTool: tasks manage goals,
|
|
897
|
-
worktrees manage directories, bound by ID.
|
|
106
|
+
```text
|
|
107
|
+
/team
|
|
108
|
+
/team list
|
|
109
|
+
/team current
|
|
110
|
+
/team status myteam
|
|
111
|
+
/team show myteam
|
|
898
112
|
```
|
|
899
113
|
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
## Key Design Patterns
|
|
114
|
+
Typing `agent teams` at the start of a prompt now opens the same native `/team` flow instead of sending that phrase to the model as plain text.
|
|
903
115
|
|
|
904
|
-
|
|
905
|
-
|---------|-------|---------|
|
|
906
|
-
| **AsyncGenerator streaming** | `QueryEngine`, `query()` | Full-chain streaming from API to consumer |
|
|
907
|
-
| **Builder + Factory** | `buildTool()` | Safe defaults for tool definitions |
|
|
908
|
-
| **Branded Types** | `SystemPrompt`, `asSystemPrompt()` | Prevent string/array confusion |
|
|
909
|
-
| **Feature Flags + DCE** | `feature()` from `bun:bundle` | Compile-time dead code elimination |
|
|
910
|
-
| **Discriminated Unions** | `Message` types | Type-safe message handling |
|
|
911
|
-
| **Observer + State Machine** | `StreamingToolExecutor` | Tool execution lifecycle tracking |
|
|
912
|
-
| **Snapshot State** | `FileHistoryState` | Undo/redo for file operations |
|
|
913
|
-
| **Ring Buffer** | Error log | Bounded memory for long sessions |
|
|
914
|
-
| **Fire-and-Forget Write** | `recordTranscript()` | Non-blocking persistence with ordering |
|
|
915
|
-
| **Lazy Schema** | `lazySchema()` | Defer Zod schema evaluation for performance |
|
|
916
|
-
| **Context Isolation** | `AsyncLocalStorage` | Per-agent context in shared process |
|
|
116
|
+
Recommended saved profile patterns:
|
|
917
117
|
|
|
918
|
-
|
|
118
|
+
- `gpt54-main`: `gpt-5.4` as the primary model, with `gpt-5.1` as the safest subagent and fast-helper fallback on gateways where `gpt-5.3-codex` is unstable
|
|
119
|
+
- `gpt53-all`: `gpt-5.3-codex` for the main thread, subagents, and helper requests
|
|
120
|
+
- `kimi-main` or `glm-main`: provider-native routing with that provider's API URL and token
|
|
919
121
|
|
|
920
|
-
|
|
122
|
+
Current gateway note:
|
|
921
123
|
|
|
922
|
-
|
|
124
|
+
- On the verified `ttqq.inping.com` route, `gpt-5.4` is stable for the main thread
|
|
125
|
+
- `gpt-5.1` is the current stable fallback for subagent and fast-helper slots
|
|
126
|
+
- `gpt-5.3-codex` may work intermittently, but this gateway sometimes returns upstream unauthorized errors for it
|
|
923
127
|
|
|
924
|
-
|
|
925
|
-
- `feature()` calls are Bun compile-time intrinsics — resolved during bundling
|
|
926
|
-
- `MACRO.VERSION` is injected at build time
|
|
927
|
-
- `process.env.USER_TYPE === 'ant'` sections are Anthropic-internal
|
|
928
|
-
- The compiled `cli.js` is a self-contained 12MB bundle requiring only Node.js >= 18
|
|
929
|
-
- Source maps (`cli.js.map`, 60MB) map back to these source files for debugging
|
|
930
|
-
|
|
931
|
-
**See [QUICKSTART.md](QUICKSTART.md) for build instructions and workarounds.**
|
|
128
|
+
## Release Flow
|
|
932
129
|
|
|
933
|
-
|
|
130
|
+
- Source repo: `https://github.com/mycode699/myclaude-code`
|
|
131
|
+
- GitHub Releases publish installable archives plus `install.sh`
|
|
132
|
+
- npm publishes the `myclaude-code` package for global installation
|
|
133
|
+
- Public release artifacts are generated from the tracked runtime bundle in `dist/cli.js`
|
|
934
134
|
|
|
935
|
-
##
|
|
135
|
+
## Package Focus
|
|
936
136
|
|
|
937
|
-
|
|
137
|
+
This repository is presented as the distribution and release home for `myclaude`: install it quickly, configure your preferred provider, and start using it without the usual account-login friction.
|