clew-code 0.2.1

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.
@@ -0,0 +1,278 @@
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`.
@@ -0,0 +1,90 @@
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>GrowthBook A/B Testing — Clew</title>
7
+ <meta name="description" content="GrowthBook A/B testing system for feature flags, experiments, and gradual rollouts in Clew.">
8
+ <link rel="preconnect" href="https://fonts.googleapis.com">
9
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
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"><div class="header-inner"><a href="../index.html" class="logo"><span>Clew</span></a><nav class="header-nav"><a href="../index.html">Home</a><a href="../index.html#features">Features</a><a href="../index.html#commands">Commands</a><a href="../quick-start.html" class="active">Docs</a><a href="https://github.com/JonusNattapong/ClewCode" target="_blank">GitHub</a></nav><button class="menu-btn" id="menuToggle" aria-label="Toggle navigation"><span></span><span></span><span></span></button></div></header>
15
+ <div class="app"><aside class="sidebar" id="sidebar"></aside><div class="sidebar-overlay" id="sidebarOverlay"></div>
16
+ <div class="content-wrap"><main class="content">
17
+ <div class="breadcrumbs"><a href="../index.html">Home</a><span class="sep">/</span><a href="../index.html#features">Internals</a><span class="sep">/</span><span>A/B Testing</span></div>
18
+ <h1>GrowthBook A/B Testing</h1>
19
+ <p class="section-subtitle">Feature flagging and experiment management using GrowthBook for gradual rollouts, A/B tests, and targeted feature releases.</p>
20
+
21
+ <div class="callout callout-warn">
22
+ <strong>Internal Infrastructure</strong>
23
+ GrowthBook integration is used for Clew's own product development telemetry and experiment tracking. It is not a user-facing feature — this documentation is for contributors and integrators.
24
+ </div>
25
+
26
+ <h2>Overview</h2>
27
+ <p>GrowthBook provides feature flagging and A/B testing within Clew. It enables controlled rollouts of new features, experiment tracking, and targeted feature releases based on user segments. The SDK is initialized at startup and evaluates flags locally with caching for minimal latency.</p>
28
+
29
+ <h2>Architecture</h2>
30
+ <ul>
31
+ <li><strong>Feature Flags</strong> — Boolean, string, number, and JSON flag types evaluated locally</li>
32
+ <li><strong>Experiments</strong> — Multi-variant A/B tests with statistical tracking and automatic analysis</li>
33
+ <li><strong>Forced Variations</strong> — Override flag values for testing and debugging</li>
34
+ <li><strong>Sticky Bucketing</strong> — Consistent user experience across sessions based on stable identifiers</li>
35
+ <li><strong>Local Caching</strong> — Feature definitions cached after initial fetch for offline resilience</li>
36
+ </ul>
37
+
38
+ <h2>Usage in Code</h2>
39
+ <pre><code>// Check if a feature is enabled (cached evaluation)
40
+ const isEnabled = getFeatureValue_CACHED_MAY_BE_STALE(
41
+ 'tengu_plum_vx3', // Feature key
42
+ false // Default value
43
+ );
44
+ // Use the feature value
45
+ if (isEnabled) {
46
+ // New behavior path
47
+ } else {
48
+ // Control behavior path
49
+ }</code></pre>
50
+
51
+ <h2>Configuration</h2>
52
+ <table>
53
+ <tr><th>Variable</th><th>Purpose</th></tr>
54
+ <tr><td><code>GROWTHBOOK_API_HOST</code></td><td>GrowthBook API endpoint (self-hosted or cloud)</td></tr>
55
+ <tr><td><code>GROWTHBOOK_CLIENT_KEY</code></td><td>Client-side SDK key for feature flag access</td></tr>
56
+ <tr><td><code>GROWTHBOOK_FORCE_VARIATION</code></td><td>Force a specific variation for testing</td></tr>
57
+ </table>
58
+
59
+ <h2>How It Works</h2>
60
+ <ol>
61
+ <li>On startup, Clew initializes the GrowthBook SDK with the configured API host and client key</li>
62
+ <li>Feature definitions are fetched from the GrowthBook server and cached locally</li>
63
+ <li>Throughout the session, code checks feature flags using the cached evaluation function</li>
64
+ <li>Flag values are re-evaluated periodically or on explicit refresh</li>
65
+ <li>Experiment results are tracked and sent back to GrowthBook for statistical analysis</li>
66
+ <li>Forced variations can override normal bucket assignment for testing</li>
67
+ </ol>
68
+
69
+ <h2>Best Practices</h2>
70
+ <ul>
71
+ <li>Always provide a sensible default value (usually <code>false</code> for features not yet released)</li>
72
+ <li>Use descriptive, unique feature keys</li>
73
+ <li>Cache-aware design: do not rely on flag values being real-time; they are evaluated at session start</li>
74
+ <li>Clean up stale flags after experiments conclude</li>
75
+ </ul>
76
+
77
+ <footer class="footer">
78
+ <span>Clew v0.1.2 — Open Source</span>
79
+ <div class="footer-links">
80
+ <a href="https://github.com/JonusNattapong/ClewCode">GitHub</a>
81
+ <a href="https://github.com/JonusNattapong/ClewCode/issues">Issues</a>
82
+ </div>
83
+ </footer>
84
+ </main>
85
+ <nav class="toc-sidebar"></nav>
86
+ </div>
87
+ </div>
88
+ <script src="../js/main.js"></script>
89
+ </body>
90
+ </html>
@@ -0,0 +1,126 @@
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>Hidden Features & Internals — Clew</title>
7
+ <meta name="description" content="Feature-gated commands, internal-only tools, and beta flags in Clew.">
8
+ <link rel="preconnect" href="https://fonts.googleapis.com">
9
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
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">
15
+ <div class="header-inner">
16
+ <a href="../index.html" class="logo"><span>Clew</span></a>
17
+ <nav class="header-nav">
18
+ <a href="../index.html">Home</a>
19
+ <a href="../index.html#features">Features</a>
20
+ <a href="../index.html#commands">Commands</a>
21
+ <a href="../quick-start.html" class="active">Docs</a>
22
+ <a href="https://github.com/JonusNattapong/ClewCode" target="_blank">GitHub</a>
23
+ </nav>
24
+ <button class="menu-btn" id="menuToggle" aria-label="Toggle navigation"><span></span><span></span><span></span></button>
25
+ </div>
26
+ </header>
27
+ <div class="app">
28
+ <aside class="sidebar" id="sidebar"></aside>
29
+ <div class="sidebar-overlay" id="sidebarOverlay"></div>
30
+ <div class="content-wrap">
31
+ <main class="content">
32
+ <div class="breadcrumbs"><a href="../index.html">Home</a><span class="sep">/</span><a href="../index.html#features">Internals</a><span class="sep">/</span><span>Hidden Features</span></div>
33
+ <h1>Hidden Features &amp; Internals</h1>
34
+ <p class="section-subtitle">Feature-gated commands, internal-only tools, and beta flags — not visible in the standard help menu.</p>
35
+
36
+ <div class="callout callout-warn">
37
+ <strong>Internal / Beta</strong>
38
+ These features may change without notice. Most require specific environment variables or build-time feature flags.
39
+ </div>
40
+
41
+ <h2>Feature-Gated Commands</h2>
42
+ <p>From <code>src/commands.ts</code> — enabled via environment variables:</p>
43
+ <table>
44
+ <tr><th>Command</th><th>Env Variable</th><th>Description</th></tr>
45
+ <tr><td><code>/bridge</code></td><td><code>BRIDGE_MODE=1</code></td><td>WebSocket remote control and collaboration</td></tr>
46
+ <tr><td><code>/voice</code></td><td><code>VOICE_MODE=1</code></td><td>Toggle voice mode</td></tr>
47
+ <tr><td><code>/brief</code></td><td><code>KAIROS=1</code></td><td>Brief command for quick context</td></tr>
48
+ <tr><td><code>/assistant</code></td><td><code>KAIROS=1</code></td><td>Assistant mode with proactive behavior</td></tr>
49
+ </table>
50
+
51
+ <h2>Internal-Only Commands</h2>
52
+ <p>Defined in <code>INTERNAL_ONLY_COMMANDS</code> in <code>src/commands.ts</code>:</p>
53
+ <table>
54
+ <tr><th>Command</th><th>Description</th></tr>
55
+ <tr><td><code>/backfill-sessions</code></td><td>Backfill session data</td></tr>
56
+ <tr><td><code>/break-cache</code></td><td>Break internal caches</td></tr>
57
+ <tr><td><code>/bughunter</code></td><td>Automated bug hunting workflow</td></tr>
58
+ <tr><td><code>/commit-push-pr</code></td><td>Commit, push, and PR creation</td></tr>
59
+ <tr><td><code>/ctx-viz</code></td><td>Context visualization</td></tr>
60
+ <tr><td><code>/init-verifiers</code></td><td>Initialize verifiers</td></tr>
61
+ <tr><td><code>/issue</code></td><td>Issue management</td></tr>
62
+ <tr><td><code>/mock-limits</code></td><td>Mock usage limits for testing</td></tr>
63
+ <tr><td><code>/reset-limits</code></td><td>Reset usage limits</td></tr>
64
+ <tr><td><code>/ultraplan</code></td><td>Extended plan mode</td></tr>
65
+ <tr><td><code>/version</code></td><td>Show version</td></tr>
66
+ <tr><td><code>/bridge-kick</code></td><td>Bridge session management</td></tr>
67
+ <tr><td><code>/onboarding</code></td><td>Interactive onboarding wizard</td></tr>
68
+ <tr><td><code>/team-onboarding</code></td><td>Generate teammate ramp-up guide</td></tr>
69
+ <tr><td><code>/share</code></td><td>Share session</td></tr>
70
+ <tr><td><code>/summary</code></td><td>Summarize conversation</td></tr>
71
+ <tr><td><code>/teleport</code></td><td>Teleport session</td></tr>
72
+ <tr><td><code>/ant-trace</code></td><td>Anthropic-internal tracing</td></tr>
73
+ <tr><td><code>/perf-issue</code></td><td>Performance issue reporting</td></tr>
74
+ <tr><td><code>/env</code></td><td>Environment inspection</td></tr>
75
+ <tr><td><code>/oauth-refresh</code></td><td>OAuth token refresh</td></tr>
76
+ <tr><td><code>/debug-tool-call</code></td><td>Tool call debugging</td></tr>
77
+ <tr><td><code>/autofix-pr</code></td><td>Autofix PR workflow</td></tr>
78
+ </table>
79
+
80
+ <h2>Feature-Gated Tools</h2>
81
+ <table>
82
+ <tr><th>Tool</th><th>Flag / Feature</th></tr>
83
+ <tr><td><code>LSPTool</code></td><td><code>ENABLE_LSP_TOOL=1</code></td></tr>
84
+ <tr><td><code>ComputerUseTool</code></td><td><code>ENABLE_COMPUTER_USE=1</code> (Windows)</td></tr>
85
+ <tr><td><code>CodeIndexTool</code></td><td><code>CODE_INDEX</code> feature flag</td></tr>
86
+ <tr><td><code>EnterWorktreeTool / ExitWorktreeTool</code></td><td>Worktree mode enabled</td></tr>
87
+ <tr><td><code>PowerShellTool</code></td><td>PowerShell tool enabled in settings</td></tr>
88
+ <tr><td><code>CronCreateTool / CronDeleteTool / CronListTool</code></td><td><code>AGENT_TRIGGERS</code> feature</td></tr>
89
+ <tr><td><code>PushNotificationTool</code></td><td><code>KAIROS</code> feature</td></tr>
90
+ <tr><td><code>REPLTool</code></td><td><code>USER_TYPE=ant</code></td></tr>
91
+ <tr><td><code>ConfigTool / TungstenTool</code></td><td><code>USER_TYPE=ant</code></td></tr>
92
+ </table>
93
+
94
+ <h2>Build-Time Feature Flags</h2>
95
+ <ul>
96
+ <li><code>TRANSCRIPT_CLASSIFIER</code> — Enables auto permission mode with transcript-based classification</li>
97
+ <li><code>CHICAGO_MCP</code> — Enables Chicago MCP protocol features</li>
98
+ </ul>
99
+
100
+ <h2>Runtime Feature Detection</h2>
101
+ <p>Features are checked via <code>feature('FEATURE_NAME')</code> (compile-time) and <code>isEnvTruthy()</code> (runtime):</p>
102
+ <ul>
103
+ <li><code>PROACTIVE</code> / <code>KAIROS</code> — Proactive agent behavior</li>
104
+ <li><code>AGENT_TRIGGERS</code> — Scheduled and remote agent triggers</li>
105
+ <li><code>KAIROS_GITHUB_WEBHOOKS</code> — GitHub webhook subscriptions</li>
106
+ <li><code>KAIROS_PUSH_NOTIFICATION</code> — Push notification support</li>
107
+ <li><code>CONTEXT_COLLAPSE</code> — Context collapse inspection</li>
108
+ <li><code>MCP_SKILLS</code> — MCP-provided skills</li>
109
+ <li><code>CODE_INDEX</code> — Code indexing and search</li>
110
+ <li><code>COORDINATOR_MODE</code> — Multi-agent coordinator mode</li>
111
+ </ul>
112
+
113
+ <footer class="footer">
114
+ <span>Clew v0.1.2 — Open Source</span>
115
+ <div class="footer-links">
116
+ <a href="https://github.com/JonusNattapong/ClewCode">GitHub</a>
117
+ <a href="https://github.com/JonusNattapong/ClewCode/issues">Issues</a>
118
+ </div>
119
+ </footer>
120
+ </main>
121
+ <nav class="toc-sidebar"></nav>
122
+ </div>
123
+ </div>
124
+ <script src="../js/main.js"></script>
125
+ </body>
126
+ </html>