clew-code 0.3.1 → 0.3.3
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 +181 -113
- package/dist/generated/version.json +1 -1
- package/dist/main.js +2948 -3258
- package/package.json +1 -1
- package/docs/.nojekyll +0 -0
- package/docs/_config.yml +0 -3
- package/docs/architecture.html +0 -90
- package/docs/assets/clew-agent-loop.png +0 -0
- package/docs/assets/clew-general-architecture.png +0 -0
- package/docs/assets/clew-mcp-architecture.png +0 -0
- package/docs/assets/clew-p2p-swarm.png +0 -0
- package/docs/assets/clew.svg +0 -33
- package/docs/changelog.html +0 -141
- package/docs/cli-reference.html +0 -89
- package/docs/commands.html +0 -161
- package/docs/configuration.html +0 -85
- package/docs/contributing.html +0 -91
- package/docs/css/styles.css +0 -545
- package/docs/daemon.html +0 -62
- package/docs/features/bridge-mode.html +0 -62
- package/docs/features/evals.html +0 -58
- package/docs/features/searxng-search.html +0 -59
- package/docs/features/sentry-setup.html +0 -62
- package/docs/generated/providers.html +0 -625
- package/docs/generated/tools.html +0 -559
- package/docs/index.html +0 -182
- package/docs/installation.html +0 -77
- package/docs/internals/claude-ai-backend-dependencies.md +0 -278
- package/docs/internals/growthbook-ab-testing.html +0 -70
- package/docs/internals/hidden-features.html +0 -82
- package/docs/internals/long-term-memory-design.md +0 -173
- package/docs/js/main.js +0 -438
- package/docs/loop.html +0 -69
- package/docs/mcp.html +0 -99
- package/docs/models.html +0 -81
- package/docs/permission-model.html +0 -86
- package/docs/personal-profile.html +0 -113
- package/docs/plugins.html +0 -84
- package/docs/providers.html +0 -625
- package/docs/quick-start.html +0 -81
- package/docs/research-memory.html +0 -71
- package/docs/security.html +0 -71
- package/docs/skills.html +0 -67
- package/docs/swarm.html +0 -78
- package/docs/tools.html +0 -559
- package/docs/troubleshooting.html +0 -86
- package/docs/voice-mode.html +0 -79
package/docs/index.html
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<title>Clew Code — Multi-Provider AI Coding Agent</title>
|
|
7
|
-
<meta name="description" content="The open-source AI coding agent with 27 providers, LAN peer coordination, autonomous agent loop, MCP integration, and 50+ built-in tools.">
|
|
8
|
-
<link rel="icon" type="image/svg+xml" href="assets/clew.svg">
|
|
9
|
-
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
10
|
-
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap" rel="stylesheet">
|
|
11
|
-
<link rel="stylesheet" href="css/styles.css">
|
|
12
|
-
</head>
|
|
13
|
-
<body>
|
|
14
|
-
<header class="header"></header>
|
|
15
|
-
<div id="sidebarOverlay" class="sidebar-overlay"></div>
|
|
16
|
-
<aside id="sidebar" class="sidebar"></aside>
|
|
17
|
-
|
|
18
|
-
<div class="content-wrap">
|
|
19
|
-
<div class="content">
|
|
20
|
-
|
|
21
|
-
<section class="hero">
|
|
22
|
-
<div class="badge"><span class="dot"></span> v0.2.22 — Multi-Provider AI Coding Agent</div>
|
|
23
|
-
<h1>Code with <span class="hl">any</span> AI.</h1>
|
|
24
|
-
<p>Clew Code is an open-source AI coding agent that runs in your terminal,
|
|
25
|
-
coordinates across machines on your LAN, and works with 27 different
|
|
26
|
-
AI providers — no lock-in.</p>
|
|
27
|
-
<div class="hero-actions">
|
|
28
|
-
<a href="quick-start.html" class="btn btn-p">Get Started →</a>
|
|
29
|
-
<a href="installation.html" class="btn btn-ghost">Installation</a>
|
|
30
|
-
<a href="https://github.com/ClewCode/ClewCode" class="btn btn-ghost" target="_blank">GitHub</a>
|
|
31
|
-
</div>
|
|
32
|
-
</section>
|
|
33
|
-
|
|
34
|
-
<div class="term">
|
|
35
|
-
<div class="term-bar">
|
|
36
|
-
<span class="term-dot"></span><span class="term-dot"></span><span class="term-dot"></span>
|
|
37
|
-
<span class="term-title">clew</span>
|
|
38
|
-
</div>
|
|
39
|
-
<div class="term-body"><span class="p">❯</span> clew
|
|
40
|
-
<span class="d">│ Starting Clew Code v0.2.22 …</span>
|
|
41
|
-
<span class="d">│ Select a provider:</span>
|
|
42
|
-
<span class="h">│ ● Anthropic</span>
|
|
43
|
-
<span class="h">│ ● OpenAI</span>
|
|
44
|
-
○ Google Gemini
|
|
45
|
-
○ DeepSeek
|
|
46
|
-
○ Ollama (local)
|
|
47
|
-
…
|
|
48
|
-
<span class="p">❯</span> /model deepseek-v4-flash
|
|
49
|
-
|
|
50
|
-
<span class="p">❯</span> /peer discover
|
|
51
|
-
<span class="d">│ Found 2 peers on LAN</span>
|
|
52
|
-
|
|
53
|
-
<span class="p">❯</span> write a web scraper in Go<span class="term-cursor"></span></div>
|
|
54
|
-
</div>
|
|
55
|
-
|
|
56
|
-
<div class="stats">
|
|
57
|
-
<div class="stat"><div class="stat-num">27</div><div class="stat-lbl">Providers</div></div>
|
|
58
|
-
<div class="stat"><div class="stat-num">50+</div><div class="stat-lbl">Built-in Tools</div></div>
|
|
59
|
-
<div class="stat"><div class="stat-num">15</div><div class="stat-lbl">Peer Tools</div></div>
|
|
60
|
-
<div class="stat"><div class="stat-num">7</div><div class="stat-lbl">Permission Modes</div></div>
|
|
61
|
-
</div>
|
|
62
|
-
|
|
63
|
-
<h2 id="features">Features</h2>
|
|
64
|
-
<div class="grid">
|
|
65
|
-
<div class="card">
|
|
66
|
-
<h3><span class="card-icon">🤖</span>27 Providers</h3>
|
|
67
|
-
<p>Anthropic, OpenAI, Google Gemini, DeepSeek, Groq, Mistral, Ollama, OpenRouter, and 19 more. Switch mid-session with <code>/model</code>.</p>
|
|
68
|
-
</div>
|
|
69
|
-
<div class="card">
|
|
70
|
-
<h3><span class="card-icon">🌐</span>LAN Peer</h3>
|
|
71
|
-
<p>Discover peers, assign tasks, execute remote commands, and coordinate across machines via UDP multicast or file registry.</p>
|
|
72
|
-
<span class="tag">15 tools</span>
|
|
73
|
-
</div>
|
|
74
|
-
<div class="card">
|
|
75
|
-
<h3><span class="card-icon">🔄</span>Autonomous Loop</h3>
|
|
76
|
-
<p>Persistent task queue, lease-based concurrency, exponential-backoff retry, dead-letter management, and cron scheduling.</p>
|
|
77
|
-
</div>
|
|
78
|
-
<div class="card">
|
|
79
|
-
<h3><span class="card-icon">🔌</span>MCP Integration</h3>
|
|
80
|
-
<p>Model Context Protocol via stdio, SSE with OAuth, or DirectConnect for in-process plugin servers.</p>
|
|
81
|
-
</div>
|
|
82
|
-
<div class="card">
|
|
83
|
-
<h3><span class="card-icon">🛠️</span>50+ Built-in Tools</h3>
|
|
84
|
-
<p>Read, Write, Edit, Bash, WebSearch, WebFetch, Browser (Playwright), PR, NotebookEdit, JsonPath, and more.</p>
|
|
85
|
-
</div>
|
|
86
|
-
<div class="card">
|
|
87
|
-
<h3><span class="card-icon">⚡</span>3 Execution Layers</h3>
|
|
88
|
-
<p>Subagents (one-shot), Swarm/Teammates (long-running), Process Peer (Codex via exec/pty).</p>
|
|
89
|
-
</div>
|
|
90
|
-
<div class="card">
|
|
91
|
-
<h3><span class="card-icon">🧩</span>Skills & Plugins</h3>
|
|
92
|
-
<p>Extend via SKILL.md, plugin manifests with lifecycle hooks at every stage (PreToolUse, PostBash, and more).</p>
|
|
93
|
-
</div>
|
|
94
|
-
<div class="card">
|
|
95
|
-
<h3><span class="card-icon">🔒</span>7 Permission Modes</h3>
|
|
96
|
-
<p>Default, ask, plan, auto, acceptEdits, bypassPermissions, dontAsk — with granular allow/deny rule patterns.</p>
|
|
97
|
-
</div>
|
|
98
|
-
<div class="card">
|
|
99
|
-
<h3><span class="card-icon">📋</span>Plan Mode</h3>
|
|
100
|
-
<p>Full-access planning with bypass permissions. Explore, read, write, and edit freely. Plans persist with progress snapshots.</p>
|
|
101
|
-
</div>
|
|
102
|
-
<div class="card">
|
|
103
|
-
<h3><span class="card-icon">🧠</span>Memory System</h3>
|
|
104
|
-
<p>Persistent auto-memory, topic indexing, session digests with weekly/monthly consolidation — like human memory decay.</p>
|
|
105
|
-
</div>
|
|
106
|
-
<div class="card">
|
|
107
|
-
<h3><span class="card-icon">🌐</span>Web UI & Remote</h3>
|
|
108
|
-
<p>Local WebSocket server with one-time auth tokens, optional NAT-traversal relay, and session management.</p>
|
|
109
|
-
</div>
|
|
110
|
-
<div class="card">
|
|
111
|
-
<h3><span class="card-icon">🎨</span>Image & Video Generation</h3>
|
|
112
|
-
<p>AI-callable tools for DALL-E 3, Imagen 3, OpenRouter image models, and Runway Gen-4. Auto-discovers models from provider APIs.</p>
|
|
113
|
-
</div>
|
|
114
|
-
<div class="card">
|
|
115
|
-
<h3><span class="card-icon">📦</span>Multi-Pass Compaction</h3>
|
|
116
|
-
<p>Automatic chunk-based context compression with recursive re-compaction when context exceeds the model window.</p>
|
|
117
|
-
</div>
|
|
118
|
-
</div>
|
|
119
|
-
|
|
120
|
-
<h2 id="quick-start">Quick Start</h2>
|
|
121
|
-
<div class="code-block-wrap">
|
|
122
|
-
<div class="code-block-header">
|
|
123
|
-
<span>bash</span>
|
|
124
|
-
<button class="copy-btn" onclick="navigator.clipboard.writeText(this.nextElementSibling.textContent);this.textContent='Copied';setTimeout(()=>this.textContent='Copy',1500)">Copy</button>
|
|
125
|
-
</div>
|
|
126
|
-
<pre><code class="language-bash">npm install -g clew-code
|
|
127
|
-
cd my-project
|
|
128
|
-
clew
|
|
129
|
-
|
|
130
|
-
# Inside the REPL:
|
|
131
|
-
# /model openai # pick a provider
|
|
132
|
-
# /help # list all commands
|
|
133
|
-
# /peer discover # find peers on LAN</code></pre>
|
|
134
|
-
</div>
|
|
135
|
-
|
|
136
|
-
<h2 id="concepts">Core Concepts</h2>
|
|
137
|
-
<p>Clew Code has several execution layers, each serving a different purpose:</p>
|
|
138
|
-
<div class="grid">
|
|
139
|
-
<div class="card">
|
|
140
|
-
<h3><span class="card-icon">🎯</span>Agent</h3>
|
|
141
|
-
<p>An AI worker with a prompt, model, tools, and permissions. The main chat session is an agent. Custom agents live in <code>.clew/agents/*.md</code>.</p>
|
|
142
|
-
</div>
|
|
143
|
-
<div class="card">
|
|
144
|
-
<h3><span class="card-icon">🧪</span>Subagent</h3>
|
|
145
|
-
<p>A short-lived child agent for independent work like codebase exploration or test triage. The built-in <code>Explore</code> agent is read-only.</p>
|
|
146
|
-
</div>
|
|
147
|
-
<div class="card">
|
|
148
|
-
<h3><span class="card-icon">🐝</span>Teammate / Swarm</h3>
|
|
149
|
-
<p>A longer-lived agent team member with identity, mailbox, task coordination, and optional pane/tmux execution.</p>
|
|
150
|
-
</div>
|
|
151
|
-
<div class="card">
|
|
152
|
-
<h3><span class="card-icon">🌐</span>LAN Peer</h3>
|
|
153
|
-
<p>A network of Clew instances on the same machine or LAN. <code>/peer</code> discovers peers, sends messages, and assigns tasks.</p>
|
|
154
|
-
</div>
|
|
155
|
-
<div class="card">
|
|
156
|
-
<h3><span class="card-icon">⚙️</span>Process Peer</h3>
|
|
157
|
-
<p>Local process-backed worker. Delegates prompts to external CLIs like Codex using exec or pty modes.</p>
|
|
158
|
-
</div>
|
|
159
|
-
</div>
|
|
160
|
-
</div>
|
|
161
|
-
</div>
|
|
162
|
-
|
|
163
|
-
<button class="back-to-top" id="backToTop" onclick="window.scrollTo({top:0,behavior:'smooth'})">↑</button>
|
|
164
|
-
|
|
165
|
-
<script src="js/main.js"></script>
|
|
166
|
-
<script>
|
|
167
|
-
// Back to top button
|
|
168
|
-
(function(){
|
|
169
|
-
var btn = document.getElementById('backToTop');
|
|
170
|
-
if (!btn) return;
|
|
171
|
-
window.addEventListener('scroll', function(){
|
|
172
|
-
if (window.scrollY > 400) {
|
|
173
|
-
btn.classList.add('visible');
|
|
174
|
-
} else {
|
|
175
|
-
btn.classList.remove('visible');
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
})();
|
|
179
|
-
</script>
|
|
180
|
-
</body>
|
|
181
|
-
</html>
|
|
182
|
-
|
package/docs/installation.html
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<title>Installation — Clew Code</title>
|
|
7
|
-
<meta name="description" content="Install Clew Code via npm or build from source.">
|
|
8
|
-
<link rel="icon" type="image/svg+xml" href="assets/clew.svg">
|
|
9
|
-
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
10
|
-
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap" rel="stylesheet">
|
|
11
|
-
<link rel="stylesheet" href="css/styles.css">
|
|
12
|
-
</head>
|
|
13
|
-
<body>
|
|
14
|
-
<header class="header"></header>
|
|
15
|
-
<div id="sidebarOverlay" class="sidebar-overlay"></div>
|
|
16
|
-
<aside id="sidebar" class="sidebar"></aside>
|
|
17
|
-
|
|
18
|
-
<div class="content-wrap">
|
|
19
|
-
<div class="content">
|
|
20
|
-
|
|
21
|
-
<div class="breadcrumbs"><a href="index.html">Home</a><span class="sep">/</span><span class="current">Installation</span></div>
|
|
22
|
-
|
|
23
|
-
<h1>Installation</h1>
|
|
24
|
-
|
|
25
|
-
<h2 id="npm">Install via npm</h2>
|
|
26
|
-
<pre><code class="language-bash">npm install -g clew-code
|
|
27
|
-
|
|
28
|
-
# Verify installation
|
|
29
|
-
clew --version
|
|
30
|
-
</code></pre>
|
|
31
|
-
|
|
32
|
-
<h2 id="build">Build from Source</h2>
|
|
33
|
-
<pre><code class="language-bash">git clone https://github.com/ClewCode/ClewCode.git
|
|
34
|
-
cd ClewCode
|
|
35
|
-
bun install
|
|
36
|
-
bun run build
|
|
37
|
-
bun run start
|
|
38
|
-
</code></pre>
|
|
39
|
-
|
|
40
|
-
<h2 id="requirements">Requirements</h2>
|
|
41
|
-
<table>
|
|
42
|
-
<thead>
|
|
43
|
-
<tr><th>Dependency</th><th>Minimum Version</th></tr>
|
|
44
|
-
</thead>
|
|
45
|
-
<tbody>
|
|
46
|
-
<tr><td>Bun</td><td>1.3+</td></tr>
|
|
47
|
-
<tr><td>Node.js</td><td>18+</td></tr>
|
|
48
|
-
<tr><td>Git</td><td>Any modern version</td></tr>
|
|
49
|
-
<tr><td>Provider API key</td><td>At least one (see <a href="providers.html">providers</a>)</td></tr>
|
|
50
|
-
</tbody>
|
|
51
|
-
</table>
|
|
52
|
-
|
|
53
|
-
<h2 id="platform">Platform Notes</h2>
|
|
54
|
-
|
|
55
|
-
<h3>macOS</h3>
|
|
56
|
-
<p>Works out of the box on both Apple Silicon and Intel Macs.</p>
|
|
57
|
-
|
|
58
|
-
<h3>Linux</h3>
|
|
59
|
-
<p>No special dependencies required.</p>
|
|
60
|
-
|
|
61
|
-
<h3>Windows</h3>
|
|
62
|
-
<p>Requires Git Bash, WSL, or PowerShell. Some features (e.g., ComputerUse) are Windows-only.</p>
|
|
63
|
-
<pre><code class="language-powershell">Remove-Item -Recurse -Force node_modules
|
|
64
|
-
bun install
|
|
65
|
-
bun run dev
|
|
66
|
-
</code></pre>
|
|
67
|
-
|
|
68
|
-
<h2 id="verify">Verify Installation</h2>
|
|
69
|
-
<pre><code class="language-bash">clew --version
|
|
70
|
-
# Should print v0.2.22 or later
|
|
71
|
-
</code></pre>
|
|
72
|
-
</div>
|
|
73
|
-
</div>
|
|
74
|
-
|
|
75
|
-
<script src="js/main.js"></script>
|
|
76
|
-
</body>
|
|
77
|
-
</html>
|
|
@@ -1,278 +0,0 @@
|
|
|
1
|
-
# Systems That Depend on the claude.ai / Anthropic Backend
|
|
2
|
-
|
|
3
|
-
Audit of the clewcode (claudecode) codebase: subsystems that hardcode the
|
|
4
|
-
claude.ai OAuth / CCR (Claude Code Remote) backend and therefore **do not
|
|
5
|
-
work when the user is signed in with a non-Anthropic provider** (OpenAI,
|
|
6
|
-
Google, DeepSeek, OpenRouter, xAI, Mistral, Groq, Ollama, etc.).
|
|
7
|
-
|
|
8
|
-
A subsystem is considered claude.ai-bound if it requires:
|
|
9
|
-
|
|
10
|
-
- the `getClaudeAIOAuthTokens()` access token, **or**
|
|
11
|
-
- the `isClaudeAISubscriber()` / `hasProfileScope()` account state, **or**
|
|
12
|
-
- a direct HTTP call to a `claude.ai` / `api.claude.ai` / `cse_*` / `session_*`
|
|
13
|
-
endpoint, **or**
|
|
14
|
-
- the `BRIDGE_MODE` build flag plus a GrowthBook gate.
|
|
15
|
-
|
|
16
|
-
Everything else (core query loop, most tools, commands, agents, plugins,
|
|
17
|
-
skills, memory) routes through `ProviderManager` and works with any
|
|
18
|
-
configured provider.
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
## 1. Authentication and account
|
|
23
|
-
|
|
24
|
-
| Subsystem | Key files | Why it is bound |
|
|
25
|
-
| --- | --- | --- |
|
|
26
|
-
| OAuth login | `src/services/oauth/client.ts`, `src/commands/login/login.tsx`, `src/commands/logout/logout.tsx` | `claude auth login` opens a browser to `claude.ai/oauth/authorize`; tokens are stored against `oauthAccount` |
|
|
27
|
-
| Auth core | `src/utils/auth.ts` | Exports `getClaudeAIOAuthTokens`, `isClaudeAISubscriber`, `hasProfileScope`, `getOauthAccountInfo` — all read from the claude.ai OAuth keychain |
|
|
28
|
-
| API-key verification | `src/hooks/useApiKeyVerification.ts` | POSTs the key to `api.anthropic.com/v1/messages` to confirm it is live |
|
|
29
|
-
|
|
30
|
-
**Provider-agnostic path available:** the LLM call itself routes through
|
|
31
|
-
`ProviderManager`. Auth-only checks (do we have a key for provider X?) are
|
|
32
|
-
the bound part; the actual generation is fine.
|
|
33
|
-
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
## 2. Bridge / Remote Control (CCR)
|
|
37
|
-
|
|
38
|
-
Two parallel systems:
|
|
39
|
-
|
|
40
|
-
### 2a. Legacy CCR bridge (claude.ai-bound)
|
|
41
|
-
|
|
42
|
-
~30 files in `src/bridge/` — the original Claude Code Remote, tied to
|
|
43
|
-
claude.ai OAuth.
|
|
44
|
-
|
|
45
|
-
| Subsystem | Key files | Why it is bound |
|
|
46
|
-
| --- | --- | --- |
|
|
47
|
-
| Bridge main loop | `src/bridge/bridgeMain.ts` | WebSocket dialer to `wss://…claude.ai`, spawns workers, requires OAuth token |
|
|
48
|
-
| Entitlement gate | `src/bridge/bridgeEnabled.ts` | `feature('BRIDGE_MODE')` + `isClaudeAISubscriber()` + GrowthBook `tengu_ccr_bridge`; emits a specific error if any check fails |
|
|
49
|
-
| Remote core | `src/bridge/remoteBridgeCore.ts`, `src/bridge/replBridge.ts`, `src/bridge/replBridgeHandle.ts`, `src/bridge/replBridgeTransport.ts` | Long-lived socket for forwarding events between local session and claude.ai |
|
|
50
|
-
| API client | `src/bridge/bridgeApi.ts`, `src/bridge/codeSessionApi.ts`, `src/bridge/bridgeConfig.ts` | Hit `BASE_API_URL` (claude.ai) with bearer token; includes 403 suppression for bridge-specific errors |
|
|
51
|
-
| Auth/secret handshake | `src/bridge/workSecret.ts`, `src/bridge/trustedDevice.ts`, `src/bridge/jwtUtils.ts` | Decode worker secrets signed by claude.ai; cache trusted device tokens |
|
|
52
|
-
| Session spawning | `src/bridge/sessionRunner.ts`, `src/bridge/createSession.ts`, `src/bridge/types.ts` | Spawn sessions in claude.ai-hosted workers |
|
|
53
|
-
| Session ID compat | `src/bridge/sessionIdCompat.ts` | `cse_*` ↔ `session_*` shim against the claude.ai frontend |
|
|
54
|
-
| Init paths | `src/bridge/initReplBridge.ts`, `src/bridge/envLessBridgeConfig.ts`, `src/bridge/replBridge.ts` | v1 (env) and v2 (env-less) startup paths |
|
|
55
|
-
| UI | `src/components/BridgeDialog.tsx`, `src/hooks/useReplBridge.tsx` | Renders the "share to claude.ai" affordance |
|
|
56
|
-
| Command | `src/commands/bridge/bridge.tsx` | `/bridge` slash command |
|
|
57
|
-
| SDK transports | `src/cli/transports/ccrClient.ts`, `WebSocketTransport.ts`, `SSETransport.ts`, `HybridTransport.ts`, `transportUtils.ts` | Wire format the headless SDK uses to talk to CCR |
|
|
58
|
-
| Background remote | `src/utils/background/remote/preconditions.ts`, `src/utils/background/remote/remoteSession.ts` | Background reconnection, polling, alive checks |
|
|
59
|
-
|
|
60
|
-
### 2b. Bridge v2 — provider-agnostic Remote Control (clewcode fork)
|
|
61
|
-
|
|
62
|
-
New standalone system in `src/remote/` that works without claude.ai.
|
|
63
|
-
Runs a local WebSocket server with one-time auth tokens, session
|
|
64
|
-
management, and an optional relay for NAT traversal.
|
|
65
|
-
|
|
66
|
-
| Subsystem | Key files | Description |
|
|
67
|
-
| --- | --- | --- |
|
|
68
|
-
| Server | `src/remote/RemoteServer.ts` | WebSocket server with HTTP health/metrics API |
|
|
69
|
-
| Auth | `src/remote/tokenStore.ts` | SHA-256 hashed one-time token generation and validation |
|
|
70
|
-
| Relay | `src/remote/RelayClient.ts` | Optional NAT-traversal relay mode |
|
|
71
|
-
| Types | `src/remote/types.ts` | Shared types for the v2 protocol |
|
|
72
|
-
| Command | `src/commands/remote/remote.ts`, `src/commands/remote/index.ts` | `/remote listen|connect|token` |
|
|
73
|
-
| UI | `src/hooks/useRemoteBridge.tsx`, `src/components/RemoteServerStatus.tsx` | Session bridge hook + connection status component |
|
|
74
|
-
| Tests | `src/remote/RemoteServer.test.ts` | 5 tests: health, auth, session lifecycle |
|
|
75
|
-
|
|
76
|
-
---
|
|
77
|
-
|
|
78
|
-
## 3. MCP — claude.ai Connectors
|
|
79
|
-
|
|
80
|
-
User-installed MCP servers (Gmail, Calendar, Notion, etc.) are
|
|
81
|
-
provisioned through the claude.ai web UI and addressed by
|
|
82
|
-
`/v1/mcp/connectors/...` on the claude.ai backend.
|
|
83
|
-
|
|
84
|
-
| Subsystem | Key files | Why it is bound |
|
|
85
|
-
| --- | --- | --- |
|
|
86
|
-
| Connector client | `src/services/mcp/claudeai.ts` | Lists and connects MCP servers known to the user's claude.ai account |
|
|
87
|
-
| Channel notifications | `src/services/mcp/channelNotification.ts` | Channel-based message routing via claude.ai |
|
|
88
|
-
| Settings UI | `src/components/mcp/MCPSettings.tsx`, `src/components/mcp/MCPRemoteServerMenu.tsx` | Toggles claude.ai-managed servers |
|
|
89
|
-
| Discovery/normalization | `src/services/mcp/normalize.ts`, `src/services/mcp/config.ts`, `src/services/mcp/client.ts`, `src/services/mcp/useManageMCPConnections.ts` | Treat the claude.ai connector list as one of the MCP sources |
|
|
90
|
-
| Utility | `src/services/mcp/utils.ts` | Shared helpers; some paths assume OAuth token presence |
|
|
91
|
-
|
|
92
|
-
**Provider-agnostic path available:** standard MCP servers configured
|
|
93
|
-
locally in `~/.claude.json` or `.mcp.json` work fine. The bound part is
|
|
94
|
-
the **claude.ai-hosted** connector directory.
|
|
95
|
-
|
|
96
|
-
---
|
|
97
|
-
|
|
98
|
-
## 4. Claude-in-Chrome Extension
|
|
99
|
-
|
|
100
|
-
The official browser-automation extension talks back to a claude.ai
|
|
101
|
-
control plane for install telemetry, deep-link handoff, and an
|
|
102
|
-
extension-managed MCP server.
|
|
103
|
-
|
|
104
|
-
| Subsystem | Key files | Why it is bound |
|
|
105
|
-
| --- | --- | --- |
|
|
106
|
-
| Onboarding | `src/components/ClaudeInChromeOnboarding.tsx` | Wizard assumes claude.ai login |
|
|
107
|
-
| Install command | `src/commands/chrome/chrome.tsx` | `claude chrome install` flow |
|
|
108
|
-
| Portable setup | `src/utils/claudeInChrome/setupPortable.ts` | Bundles the extension |
|
|
109
|
-
| MCP server | `src/utils/claudeInChrome/mcpServer.ts` | Exposes Chrome tools; tied to extension auth |
|
|
110
|
-
| Notification hook | `src/hooks/useChromeExtensionNotification.tsx` | Surfaces extension events to the TUI |
|
|
111
|
-
|
|
112
|
-
---
|
|
113
|
-
|
|
114
|
-
## 5. Teleport / Desktop Handoff
|
|
115
|
-
|
|
116
|
-
Move a running session between machines via a claude.ai-mediated
|
|
117
|
-
relay.
|
|
118
|
-
|
|
119
|
-
| Subsystem | Key files | Why it is bound |
|
|
120
|
-
| --- | --- | --- |
|
|
121
|
-
| Teleport core | `src/utils/teleport.tsx`, `src/utils/teleport/api.ts`, `src/utils/teleport/gitBundle.ts`, `src/utils/teleport/environments.ts` | Encodes session state, POSTs to claude.ai, decodes on the other side |
|
|
122
|
-
| Setup command | `src/commands/remote-setup/api.ts` | `/remote-setup` |
|
|
123
|
-
| Env command | `src/commands/remote-env/index.ts` | `/remote-env` |
|
|
124
|
-
| UI | `src/components/DesktopHandoff.tsx` | Pairing screen |
|
|
125
|
-
|
|
126
|
-
---
|
|
127
|
-
|
|
128
|
-
## 6. Remote Agents / Tasks
|
|
129
|
-
|
|
130
|
-
Spin work off to a claude.ai-hosted worker instead of running locally.
|
|
131
|
-
|
|
132
|
-
| Subsystem | Key files | Why it is bound |
|
|
133
|
-
| --- | --- | --- |
|
|
134
|
-
| Task type | `src/tasks/RemoteAgentTask/RemoteAgentTask.tsx` | Lifecycle of a remote-task entry |
|
|
135
|
-
| Tool | `src/tools/RemoteTriggerTool/RemoteTriggerTool.ts`, `src/tools/RemoteTriggerTool/prompt.ts` | LLM-callable tool to trigger a remote job |
|
|
136
|
-
| Skill | `src/skills/bundled/scheduleRemoteAgents.ts` | Bundled skill for scheduled remote runs |
|
|
137
|
-
| Spawning | `src/utils/swarm/spawnUtils.ts` | Worker spawn helper |
|
|
138
|
-
|
|
139
|
-
---
|
|
140
|
-
|
|
141
|
-
## 7. Subscription, billing, and quotas
|
|
142
|
-
|
|
143
|
-
Anything that displays "you have N requests left" or "upgrade to Pro" is
|
|
144
|
-
talking to claude.ai's entitlements API.
|
|
145
|
-
|
|
146
|
-
| Subsystem | Key files | Why it is bound |
|
|
147
|
-
| --- | --- | --- |
|
|
148
|
-
| Limits | `src/services/claudeAiLimits.ts` | Per-user, per-model rate-limit numbers |
|
|
149
|
-
| Quota | `src/services/api/ultrareviewQuota.ts`, `src/commands/review/ultrareviewCommand.tsx` | Ultrareview credit balance |
|
|
150
|
-
| Extra usage | `src/utils/extraUsage.ts` | Overage toggle state |
|
|
151
|
-
| Billing | `src/utils/billing.ts` | Subscription tier, payment method display |
|
|
152
|
-
| Rate-limit UI | `src/components/messages/RateLimitMessage.tsx`, `src/commands/rate-limit-options/index.ts` | Renders claude.ai-shaped limit messages |
|
|
153
|
-
| Upgrade | `src/commands/upgrade/upgrade.tsx` | Links to claude.ai/upgrade |
|
|
154
|
-
| Cost | `src/commands/cost/cost.ts`, `src/commands/cost/index.ts` | Pulls usage from claude.ai billing |
|
|
155
|
-
| Switch-subscription hook | `src/hooks/notifs/useCanSwitchToExistingSubscription.tsx` | Tells the UI whether to show the "switch plan" banner |
|
|
156
|
-
|
|
157
|
-
---
|
|
158
|
-
|
|
159
|
-
## 8. Settings / policy sync
|
|
160
|
-
|
|
161
|
-
| Subsystem | Key files | Why it is bound |
|
|
162
|
-
| --- | --- | --- |
|
|
163
|
-
| User settings sync | `src/services/settingsSync/index.ts` | `theme`, `notifChannels`, etc. mirrored to claude.ai |
|
|
164
|
-
| Managed settings | `src/services/remoteManagedSettings/index.ts`, `src/services/remoteManagedSettings/syncCache.ts` | Org admin policies (allowed tools, blocked commands) |
|
|
165
|
-
| Team memory | `src/services/teamMemorySync/index.ts` | Shared memdir scoped to a workspace |
|
|
166
|
-
| Policy limits | `src/services/policyLimits/index.ts` | Org-level rate caps |
|
|
167
|
-
|
|
168
|
-
---
|
|
169
|
-
|
|
170
|
-
## 9. Voice input
|
|
171
|
-
|
|
172
|
-
| Subsystem | Key files | Why it is bound |
|
|
173
|
-
| --- | --- | --- |
|
|
174
|
-
| STT streaming | `src/services/voiceStreamSTT.ts` | Streams audio to a claude.ai WebSocket for transcription |
|
|
175
|
-
| Mode gate | `src/voice/voiceModeEnabled.ts`, `src/hooks/useVoiceEnabled.ts` | Checks subscription before exposing the mic button |
|
|
176
|
-
|
|
177
|
-
---
|
|
178
|
-
|
|
179
|
-
## 10. Reviews and PR automations
|
|
180
|
-
|
|
181
|
-
| Subsystem | Key files | Why it is bound |
|
|
182
|
-
| --- | --- | --- |
|
|
183
|
-
| Review (remote) | `src/commands/review/reviewRemote.ts` | Off-host review of a PR |
|
|
184
|
-
| Ultrareview | `src/commands/review/ultrareviewCommand.tsx`, `src/services/api/ultrareviewQuota.ts` | Heavy async review job with quota |
|
|
185
|
-
| Autofix PR | `src/commands/autofix-pr/autofixPr.ts` | Opens a remediation PR on a remote worker |
|
|
186
|
-
| Git helpers | `src/utils/git.ts`, `src/utils/gitDiff.ts` | Some code paths push to claude.ai endpoints (PR preview, comment posting) |
|
|
187
|
-
|
|
188
|
-
---
|
|
189
|
-
|
|
190
|
-
## 11. Fast mode / model capabilities
|
|
191
|
-
|
|
192
|
-
| Subsystem | Key files | Why it is bound |
|
|
193
|
-
| --- | --- | --- |
|
|
194
|
-
| Fast mode | `src/utils/fastMode.ts` | "turbo" preference stored on claude.ai side |
|
|
195
|
-
| 1M context gate | `src/utils/model/check1mAccess.ts` | Per-user entitlement check |
|
|
196
|
-
| Capabilities | `src/utils/model/modelCapabilities.ts`, `src/utils/model/modelOptions.ts` | Some flags only resolve for claude.ai-issued tokens |
|
|
197
|
-
| Beta flags | `src/utils/betas.ts` | Reads user's claude.ai beta opt-ins |
|
|
198
|
-
|
|
199
|
-
---
|
|
200
|
-
|
|
201
|
-
## 12. Telemetry and analytics
|
|
202
|
-
|
|
203
|
-
| Subsystem | Key files | Why it is bound |
|
|
204
|
-
| --- | --- | --- |
|
|
205
|
-
| BigQuery export | `src/utils/telemetry/bigqueryExporter.ts` | Forwards events to Anthropic's first-party tables |
|
|
206
|
-
| First-party event log | `src/services/analytics/firstPartyEventLoggingExporter.ts` | Hardcoded endpoint |
|
|
207
|
-
| Metrics opt-out | `src/services/api/metricsOptOut.ts` | Reads the per-user telemetry preference from claude.ai |
|
|
208
|
-
| Referral | `src/services/api/referral.ts` | Referral credit API on claude.ai |
|
|
209
|
-
| Auth check | `src/services/api/claude.ts`, `src/services/api/withRetry.ts`, `src/services/api/usage.ts`, `src/services/api/errors.ts`, `src/services/api/anthropicClient.ts`, `src/services/api/bootstrap.ts` | `getClaudeAIOAuthTokens()` callers |
|
|
210
|
-
| API base | `src/constants/oauth.ts` | Defines `BASE_API_URL` (claude.ai) and OAuth client ID |
|
|
211
|
-
|
|
212
|
-
---
|
|
213
|
-
|
|
214
|
-
## 13. Notices and supporting UI
|
|
215
|
-
|
|
216
|
-
| Subsystem | Key files | Why it is bound |
|
|
217
|
-
| --- | --- | --- |
|
|
218
|
-
| Channels notice | `src/components/LogoV2/ChannelsNotice.tsx` | Subscription-channel cross-promo |
|
|
219
|
-
| Status notices | `src/utils/statusNoticeDefinitions.tsx`, `src/utils/status.tsx` | Some notices render only for claude.ai subscribers |
|
|
220
|
-
| Logo V2 utils | `src/utils/logoV2Utils.ts` | Feature flag for claude.ai-only logo |
|
|
221
|
-
| `useApiKeyVerification` | `src/hooks/useApiKeyVerification.ts` | Verifies Anthropic API key shape |
|
|
222
|
-
|
|
223
|
-
---
|
|
224
|
-
|
|
225
|
-
## Provider-agnostic systems (for contrast)
|
|
226
|
-
|
|
227
|
-
These are the major surfaces that **do** work with any provider:
|
|
228
|
-
|
|
229
|
-
- `src/query.ts`, `src/QueryEngine.ts` — message building, tool loop
|
|
230
|
-
- `src/services/ai/ProviderManager.ts`, `src/services/ai/providerRegistry.ts`,
|
|
231
|
-
`src/services/ai/providers.json`, `src/services/ai/adapter/*` — provider
|
|
232
|
-
routing and adapters
|
|
233
|
-
- `src/services/ai/contentBlockUtils.ts`, `toolCallParser.ts`,
|
|
234
|
-
`errorNormalizer.ts`, `usageNormalizer.ts` — cross-provider normalization
|
|
235
|
-
- All built-in tools in `src/tools/` that do not call claude.ai
|
|
236
|
-
(Bash, FileEdit, FileRead, Grep, Glob, WebFetch, WebSearch via
|
|
237
|
-
provider-agnostic providers, ExitPlanMode, etc.)
|
|
238
|
-
- `src/services/tools/`, `src/services/tools/StreamingToolExecutor.ts` —
|
|
239
|
-
tool execution pipeline
|
|
240
|
-
- `src/commands/` slash commands that do not call bridge/MCP-connector
|
|
241
|
-
endpoints
|
|
242
|
-
- `src/agentRuntime/`, `src/services/autonomous/`, `src/coordinator/` —
|
|
243
|
-
agent and task infrastructure
|
|
244
|
-
- `src/plugins/`, `src/skills/` — plugin and skill systems
|
|
245
|
-
- `src/memdir/`, `src/research/` — local memory and research
|
|
246
|
-
- `src/services/Supervisor/`, `src/services/SessionLifecycle/`,
|
|
247
|
-
`src/services/SessionMemory/` — session and supervision
|
|
248
|
-
- `src/services/lsp/` — language server integration
|
|
249
|
-
- `src/voice/sherpa-onnx-tts`, local TTS paths
|
|
250
|
-
- `src/upstreamproxy/`, `src/services/api/` pure HTTP helpers
|
|
251
|
-
- `src/state/`, `src/screens/`, `src/components/` — generic TUI
|
|
252
|
-
|
|
253
|
-
---
|
|
254
|
-
|
|
255
|
-
## Implications for the fork
|
|
256
|
-
|
|
257
|
-
If the goal of the clewcode fork is to be a **truly multi-provider
|
|
258
|
-
coding agent**, the following are the load-bearing claude.ai dependencies
|
|
259
|
-
that need a strategy (stub, replace, or accept the limitation):
|
|
260
|
-
|
|
261
|
-
1. **CCR bridge** (`src/bridge/`, `src/remote/`, `src/cli/transports/*`)
|
|
262
|
-
— by far the largest single bound surface. Either re-target at a
|
|
263
|
-
self-hosted relay or accept it as claude.ai-only.
|
|
264
|
-
2. **MCP claude.ai connectors** (`src/services/mcp/claudeai.ts`,
|
|
265
|
-
related UI) — separate from local MCP, this is the user's claude.ai
|
|
266
|
-
connector directory.
|
|
267
|
-
3. **OAuth login** (`src/services/oauth/client.ts`) — the entry point
|
|
268
|
-
to everything above. A non-Anthropic provider login leaves the entire
|
|
269
|
-
bound surface off-limits.
|
|
270
|
-
4. **Subscription / billing / quota** displays — pure UI; trivial to
|
|
271
|
-
guard, but the data sources are claude.ai-only.
|
|
272
|
-
5. **Claude-in-Chrome extension** — a bundled extension tightly coupled
|
|
273
|
-
to claude.ai auth.
|
|
274
|
-
6. **Teleport, autofix PR, ultrareview, remote agents** — feature
|
|
275
|
-
groups that depend on CCR workers.
|
|
276
|
-
|
|
277
|
-
Everything outside the list above should already work with the configured
|
|
278
|
-
provider through `ProviderManager`.
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<title>A/B Testing — Clew Code</title>
|
|
7
|
-
<meta name="description" content="Feature flags and A/B testing with GrowthBook in Clew Code.">
|
|
8
|
-
<link rel="icon" type="image/svg+xml" href="../assets/clew.svg">
|
|
9
|
-
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
10
|
-
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap" rel="stylesheet">
|
|
11
|
-
<link rel="stylesheet" href="../css/styles.css">
|
|
12
|
-
</head>
|
|
13
|
-
<body>
|
|
14
|
-
<header class="header"></header>
|
|
15
|
-
<div id="sidebarOverlay" class="sidebar-overlay"></div>
|
|
16
|
-
<aside id="sidebar" class="sidebar"></aside>
|
|
17
|
-
|
|
18
|
-
<div class="content-wrap">
|
|
19
|
-
<div class="content">
|
|
20
|
-
|
|
21
|
-
<div class="breadcrumbs"><a href="../index.html">Home</a><span class="sep">/</span><span class="current">A/B Testing</span></div>
|
|
22
|
-
|
|
23
|
-
<h1>A/B Testing with GrowthBook</h1>
|
|
24
|
-
<p class="sub">Feature flags and experimentation using GrowthBook.</p>
|
|
25
|
-
|
|
26
|
-
<h2 id="overview">Overview</h2>
|
|
27
|
-
<p>Clew Code integrates with <a href="https://www.growthbook.io/">GrowthBook</a> for feature flag management and A/B testing. This allows gradual rollout of new features, targeted experiments, and configuration-driven behavior changes.</p>
|
|
28
|
-
|
|
29
|
-
<h2 id="architecture">Architecture</h2>
|
|
30
|
-
<p>GrowthBook is integrated via the <code>@growthbook/growthbook</code> SDK. Feature flags are evaluated at runtime and can control:</p>
|
|
31
|
-
<ul>
|
|
32
|
-
<li>UI component visibility</li>
|
|
33
|
-
<li>Behavioral variations (e.g., different prompt templates)</li>
|
|
34
|
-
<li>Provider selection defaults</li>
|
|
35
|
-
<li>Beta feature access</li>
|
|
36
|
-
<li>Experimental tool availability</li>
|
|
37
|
-
</ul>
|
|
38
|
-
|
|
39
|
-
<h2 id="configuration">Configuration</h2>
|
|
40
|
-
<p>Set the GrowthBook API key in your environment:</p>
|
|
41
|
-
<pre><code class="language-bash">export GROWTHBOOK_API_KEY=your-api-key
|
|
42
|
-
</code></pre>
|
|
43
|
-
|
|
44
|
-
<p>Or configure in <code>.clew/settings.json</code>:</p>
|
|
45
|
-
<pre><code class="language-json">{
|
|
46
|
-
"growthbook": {
|
|
47
|
-
"apiKey": "your-api-key",
|
|
48
|
-
"attributes": {
|
|
49
|
-
"environment": "development"
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
</code></pre>
|
|
54
|
-
|
|
55
|
-
<h2 id="current-flags">Current Feature Flags</h2>
|
|
56
|
-
<table>
|
|
57
|
-
<thead>
|
|
58
|
-
<tr><th>Flag</th><th>Purpose</th></tr>
|
|
59
|
-
</thead>
|
|
60
|
-
<tbody>
|
|
61
|
-
<tr><td><code>BRIDGE_MODE</code></td><td>Enable/disable Bridge v1 (CCR) functionality</td></tr>
|
|
62
|
-
<tr><td><code>tengu_ccr_bridge</code></td><td>GrowthBook-gated CCR bridge access</td></tr>
|
|
63
|
-
</tbody>
|
|
64
|
-
</table>
|
|
65
|
-
</div>
|
|
66
|
-
</div>
|
|
67
|
-
|
|
68
|
-
<script src="../js/main.js"></script>
|
|
69
|
-
</body>
|
|
70
|
-
</html>
|