clew-code 0.4.6 → 0.4.8
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 +334 -365
- package/dist/main.js +2130 -2085
- package/package.json +162 -162
package/README.md
CHANGED
|
@@ -1,365 +1,334 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
|
|
3
|
-
<img src="assets/clew-logo-long.png" alt="Clew Code" width="520" />
|
|
4
|
-
|
|
5
|
-
# Clew Code
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
- [
|
|
40
|
-
- [
|
|
41
|
-
- [
|
|
42
|
-
- [
|
|
43
|
-
- [
|
|
44
|
-
- [
|
|
45
|
-
- [
|
|
46
|
-
- [
|
|
47
|
-
- [
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
---
|
|
105
|
-
|
|
106
|
-
##
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
clew
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
|
201
|
-
|
|
202
|
-
|
|
|
203
|
-
|
|
|
204
|
-
|
|
|
205
|
-
|
|
|
206
|
-
|
|
|
207
|
-
|
|
|
208
|
-
|
|
|
209
|
-
|
|
|
210
|
-
|
|
|
211
|
-
|
|
|
212
|
-
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
---
|
|
221
|
-
|
|
222
|
-
##
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
```
|
|
336
|
-
|
|
337
|
-
### Pre-commit check
|
|
338
|
-
|
|
339
|
-
```bash
|
|
340
|
-
bun run check:ci && bun x tsc --noEmit && bun test --bail
|
|
341
|
-
```
|
|
342
|
-
|
|
343
|
-
### Knowledge graph
|
|
344
|
-
|
|
345
|
-
This project has a pre-built knowledge graph for codebase exploration:
|
|
346
|
-
|
|
347
|
-
```bash
|
|
348
|
-
graphify query "<question>" # Ask questions about the codebase
|
|
349
|
-
graphify path "<A>" "<B>" # Trace relationships between symbols
|
|
350
|
-
graphify explain "<concept>" # Focused explanation of a concept
|
|
351
|
-
graphify update . # Refresh after code changes (AST-only, no API cost)
|
|
352
|
-
```
|
|
353
|
-
|
|
354
|
-
### Important: `.js` shadows `.ts`
|
|
355
|
-
|
|
356
|
-
`src/` has ~188 committed `.js` files next to `.ts`/`.tsx` twins (JS-to-TS migration in progress). Bun resolves `.js` import specifiers to the real `.js` file — if you edit only the `.ts` file, your change won't run at runtime. Check for a `.js` sibling and edit both.
|
|
357
|
-
|
|
358
|
-
Full developer reference in **[AGENTS.md](AGENTS.md)**.
|
|
359
|
-
|
|
360
|
-
---
|
|
361
|
-
|
|
362
|
-
## License
|
|
363
|
-
|
|
364
|
-
Clew Code is licensed under the **GPL-3.0 License**. See [LICENSE.md](LICENSE.md) for details.
|
|
365
|
-
Full release history is available in [CHANGELOG.md](CHANGELOG.md).
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<img src="assets/clew-logo-long.png" alt="Clew Code" width="520" />
|
|
4
|
+
|
|
5
|
+
# Clew Code
|
|
6
|
+
### *The agent that works where you do.*
|
|
7
|
+
|
|
8
|
+
<p align="center">
|
|
9
|
+
<a href="https://github.com/ClewCode/ClewCode/stargazers"><img src="https://img.shields.io/github/stars/ClewCode/ClewCode?style=for-the-badge&color=blue" alt="GitHub stars"></a>
|
|
10
|
+
<a href="https://github.com/ClewCode/ClewCode/releases"><img src="https://img.shields.io/github/v/release/ClewCode/ClewCode?style=for-the-badge&color=orange" alt="Release"></a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/clew-code"><img src="https://img.shields.io/npm/v/clew-code?style=for-the-badge&color=red" alt="npm"></a>
|
|
12
|
+
<a href="https://github.com/ClewCode/ClewCode/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/ClewCode/ClewCode/ci.yml?branch=main&style=for-the-badge" alt="CI"></a>
|
|
13
|
+
<a href="LICENSE.md"><img src="https://img.shields.io/badge/License-GPL--3.0-blue.svg?style=for-the-badge" alt="License"></a>
|
|
14
|
+
<a href="https://bun.sh"><img src="https://img.shields.io/badge/built%20with-Bun-ff69b4.svg?style=for-the-badge" alt="Bun"></a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
[Website](https://clew-code.org) · [Docs](https://clew-docs.pages.dev) · [Wiki](https://github.com/ClewCode/ClewCode/wiki) · [GitHub](https://github.com/ClewCode/ClewCode)
|
|
18
|
+
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
Clew Code is a terminal-native AI coding agent that lives in your repo, works with your API keys, and **doesn't phone home**. It reads your code, writes files, runs commands, and talks to any LLM you bring — all on your machine, no telemetry, no vendor lock-in.
|
|
24
|
+
|
|
25
|
+
If you want a coding assistant that feels local, fast, and doesn't ship your context to a third-party server, this is it.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Table of Contents
|
|
30
|
+
|
|
31
|
+
- [Prerequisites](#prerequisites)
|
|
32
|
+
- [Quick Install](#quick-install)
|
|
33
|
+
- [Getting Started](#getting-started)
|
|
34
|
+
- [Use Cases](#use-cases)
|
|
35
|
+
- [Features](#features)
|
|
36
|
+
- [CLI Quick Reference](#cli-quick-reference)
|
|
37
|
+
- [Screenshots](#screenshots)
|
|
38
|
+
- [Security](#security)
|
|
39
|
+
- [Documentation](#documentation)
|
|
40
|
+
- [Configuration](#configuration)
|
|
41
|
+
- [FAQ](#faq)
|
|
42
|
+
- [Architecture](#architecture)
|
|
43
|
+
- [Project Structure](#project-structure)
|
|
44
|
+
- [Development](#development)
|
|
45
|
+
- [Contributing](#contributing)
|
|
46
|
+
- [Star History](#star-history)
|
|
47
|
+
- [License](#license)
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Prerequisites
|
|
52
|
+
|
|
53
|
+
- **Node.js** 18+ or **Bun** 1.x (recommended for development)
|
|
54
|
+
- An **API key** from at least one supported provider (see [Providers docs](https://clew-docs.pages.dev/providers))
|
|
55
|
+
- *Optional:* Git, Playwright (for browser automation), microphone (for voice input)
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Quick Install
|
|
60
|
+
|
|
61
|
+
### macOS / Linux
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
curl -fsSL https://raw.githubusercontent.com/ClewCode/ClewCode/main/scripts/install.sh | bash
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Windows (PowerShell)
|
|
68
|
+
|
|
69
|
+
```powershell
|
|
70
|
+
irm https://raw.githubusercontent.com/ClewCode/ClewCode/main/scripts/install.ps1 | iex
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### npm (cross-platform)
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
npm install -g clew-code
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Getting Started
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
cd your-project
|
|
85
|
+
clew # Launch the REPL
|
|
86
|
+
clew -p "fix the tests" # One-shot mode
|
|
87
|
+
clew --resume last # Pick up where you left off
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
First launch walks you through provider setup. After that, use `/model` to switch providers mid-session.
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Use Cases
|
|
95
|
+
|
|
96
|
+
| Scenario | How Clew Code Helps |
|
|
97
|
+
|---|---|
|
|
98
|
+
| **Fix failing tests** | `clew -p "Fix the failing tests and explain what was wrong"` — reads test output, diagnoses root cause, applies fixes. |
|
|
99
|
+
| **Refactor a module** | Point it at a file, describe the target structure. Uses multi-file edit tools, git status awareness, and checkpoint rollback on mistakes. |
|
|
100
|
+
| **Research a codebase** | `/research "How does auth work?"` — searches code, docs, and web, then compiles a dossier with source references. |
|
|
101
|
+
| **Background automation** | Run `/bg` to delegate long-running tasks (migration, lint fixes) to a background agent while you keep working in the REPL. |
|
|
102
|
+
| **Cross-repo changes** | `/workspace link ../other-repo` — edit across linked projects with full context from both. |
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Features
|
|
107
|
+
|
|
108
|
+
| | |
|
|
109
|
+
|---|---|
|
|
110
|
+
| **29+ providers** | OpenAI, DeepSeek, Groq, Anthropic, Google, Ollama (local), and 22+ more. Switch mid-session with `/model`. No lock-in. |
|
|
111
|
+
| **Persistent memory** | SQLite-backed, MiMo-inspired store with importance ranking, confidence scoring, and cross-session persistence. Auto-consolidation via Dream + Distill. |
|
|
112
|
+
| **75+ tools** | Read, Write, Edit, Grep, Bash, Browser, MCP, LSP, git, web search, task management, peer coordination, media generation, voice input. |
|
|
113
|
+
| **LAN peer swarm** | Zero-config peer discovery over UDP multicast. Sync memory across machines, delegate tasks, broadcast shell commands across your network. |
|
|
114
|
+
| **MCP + Plugins + Skills** | Model Context Protocol over stdio/SSE/WebSocket. Extend with plugins, `SKILL.md` workflows, or lifecycle hooks. |
|
|
115
|
+
| **Background daemon** | Task queue with lease-based concurrency, cron scheduling, dead-letter retries, and memory maintenance. |
|
|
116
|
+
| **Goal verification + checkpoints** | Track completion with heuristic checks and independent LLM verification. Structured snapshots at 20%/45%/70% progress. |
|
|
117
|
+
| **Multi-agent architecture** | Agents, Subagents, LAN Peers, Process Peers. Personal profile turns Clew into a command center that delegates to Codex workers. |
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## CLI Quick Reference
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
-p, --prompt <text> One-shot prompt, then exit
|
|
125
|
+
-c, --continue Continue last conversation
|
|
126
|
+
-r, --resume [id] Resume a session (opens picker if no id)
|
|
127
|
+
--model <model> Override model (sonnet, opus, gemini-2.5-flash, etc.)
|
|
128
|
+
--effort <level> Reasoning effort (low|medium|high|max)
|
|
129
|
+
--agent <agent> Custom agent profile
|
|
130
|
+
--permission-mode <mode> default\|ask\|plan\|auto
|
|
131
|
+
--peer-share Start as a LAN worker peer
|
|
132
|
+
--computer Enable OS-level computer use (Windows only)
|
|
133
|
+
--debug Developer debug output
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Slash commands: `/model`, `/memory`, `/task`, `/goal`, `/compact`, `/peer`, `/mcp`, `/agent`, `/plan`, `/voice`, `/research`, `/workflow`, `/skills`, and [many more](https://clew-docs.pages.dev/cli).
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Screenshots
|
|
141
|
+
|
|
142
|
+

|
|
143
|
+
|
|
144
|
+
Clew Code running in the terminal REPL.
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Security
|
|
149
|
+
|
|
150
|
+
Clew Code runs entirely on your machine. No code or context leaves your network unless you explicitly configure a remote provider or send a web fetch.
|
|
151
|
+
|
|
152
|
+
- Prompts for permission before read, write, or terminal execution
|
|
153
|
+
- Fine-tune auto-approve rules per workspace
|
|
154
|
+
- Permission scopes: default, ask, plan, auto
|
|
155
|
+
- Guardian system for auto-review using secondary LLM
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Documentation
|
|
160
|
+
|
|
161
|
+
| Guide | Description |
|
|
162
|
+
|---|---|
|
|
163
|
+
| [Quick Start](https://clew-docs.pages.dev/quick-start) | Launch the CLI and start coding |
|
|
164
|
+
| [Installation](https://clew-docs.pages.dev/installation) | One-liner, npm, or build from source |
|
|
165
|
+
| [CLI Reference](https://clew-docs.pages.dev/cli) | Full CLI options, providers, commands |
|
|
166
|
+
| [Configuration](https://clew-docs.pages.dev/configuration) | Settings files, hooks, permission modes |
|
|
167
|
+
| [MCP Guide](https://clew-docs.pages.dev/mcp) | Connect external tools and APIs |
|
|
168
|
+
| [Plugins](https://clew-docs.pages.dev/plugins) | Lifecycle hooks and customization |
|
|
169
|
+
| [Security & Permissions](https://clew-docs.pages.dev/security-permissions) | Permission scopes, guardian system |
|
|
170
|
+
| [Skills System](https://clew-docs.pages.dev/skills) | Automate repeatable workflows |
|
|
171
|
+
| [Memory System](https://clew-docs.pages.dev/memory-system) | SQLite-backed long-term memory |
|
|
172
|
+
| [Peer-to-Peer LAN](https://clew-docs.pages.dev/peer-to-peer) | Discover, delegate, swarm commands |
|
|
173
|
+
| [Architecture](https://clew-docs.pages.dev/concepts-agents-subagents-peers) | Agents, Subagents, Peers |
|
|
174
|
+
| [Troubleshooting](https://clew-docs.pages.dev/troubleshooting) | Common issues and fixes |
|
|
175
|
+
|
|
176
|
+
Also available on the [GitHub Wiki](https://github.com/ClewCode/ClewCode/wiki).
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Configuration
|
|
181
|
+
|
|
182
|
+
Key environment variables read at startup:
|
|
183
|
+
|
|
184
|
+
| Variable | Required | Description |
|
|
185
|
+
|---|---|---|
|
|
186
|
+
| `ANTHROPIC_API_KEY` | No | Anthropic Claude models |
|
|
187
|
+
| `OPENAI_API_KEY` | No | OpenAI GPT models |
|
|
188
|
+
| `DEEPSEEK_API_KEY` | No | DeepSeek models |
|
|
189
|
+
| `GOOGLE_API_KEY` | No | Google Gemini models |
|
|
190
|
+
| `GROQ_API_KEY` | No | Groq-hosted models |
|
|
191
|
+
| `TAVILY_API_KEY` | No | Enhanced web search provider |
|
|
192
|
+
| `CLEW_DISABLE_TELEMETRY` | No | Disable anonymous usage stats (`1`) |
|
|
193
|
+
|
|
194
|
+
All provider keys can also be set via the `/model` provider setup flow or in `.clew/settings.json` under `env`.
|
|
195
|
+
|
|
196
|
+
### Enterprise audit logging
|
|
197
|
+
|
|
198
|
+
Audit logging is opt-in and writes newline-delimited JSON events for SIEM ingestion. When enabled, Clew records tool calls, tool results/failures, file read/write access, and Bash/PowerShell command execution/results.
|
|
199
|
+
|
|
200
|
+
| Variable | Required | Description |
|
|
201
|
+
|---|---|---|
|
|
202
|
+
| `CLEW_AUDIT_LOG` | No | Enable audit logging when set to `1` |
|
|
203
|
+
| `CLEW_CODE_AUDIT_LOG` | No | Alternate enable flag when set to `1` |
|
|
204
|
+
| `CLEW_AUDIT_LOG_PATH` | No | Audit log directory, relative to the project root by default (`.clew/audit`) |
|
|
205
|
+
| `CLEW_CODE_AUDIT_LOG_PATH` | No | Alternate audit log directory variable |
|
|
206
|
+
| `CLEW_AUDIT_LOG_MAX_BYTES` | No | Rotate `audit.ndjson` after this size in bytes (default: 100 MB) |
|
|
207
|
+
| `CLEW_AUDIT_LOG_MAX_FILES` | No | Number of audit log files to retain, including the active file (default: 10) |
|
|
208
|
+
| `CLEW_AUDIT_LOG_INCLUDE` | No | Comma-separated event allowlist, such as `tool.call,tool.result` |
|
|
209
|
+
| `CLEW_AUDIT_LOG_EXCLUDE` | No | Comma-separated event blocklist |
|
|
210
|
+
| `CLEW_AUDIT_LOG_MIN_LEVEL` | No | Minimum level to write: `info`, `warn`, `error`, or `audit` |
|
|
211
|
+
| `CLEW_AUDIT_LOG_CONSOLE` | No | Also mirror audit summaries to stderr when set to `1` |
|
|
212
|
+
| `CLEW_AUDIT_USER` | No | User identifier to include in each audit event |
|
|
213
|
+
|
|
214
|
+
Example:
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
CLEW_AUDIT_LOG=1 CLEW_AUDIT_LOG_PATH=.clew/audit bun run dev
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## Architecture
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
┌─ REPL ─────────────────────────────┐
|
|
226
|
+
│ Ink + React 19 ┌───────┐ │
|
|
227
|
+
│ Slash commands / skills │ Tools │ │
|
|
228
|
+
│ Streaming / history └───┬───┘ │
|
|
229
|
+
└────────┬─────────────────────┘ │
|
|
230
|
+
▼ │
|
|
231
|
+
┌─ QueryEngine ──────────────────────┘
|
|
232
|
+
│ Tool loop · Provider routing · Streaming
|
|
233
|
+
│ Context compaction · Checkpoints
|
|
234
|
+
└──┬────┬────┬────┬────┐
|
|
235
|
+
▼ ▼ ▼ ▼ ▼
|
|
236
|
+
┌────┐┌────┐┌────┐┌────┐┌──────────┐
|
|
237
|
+
│ MCP││LSP ││Git ││Web ││ Provider │
|
|
238
|
+
│ ││ ││ ││ ││ Manager │
|
|
239
|
+
└────┘└────┘└────┘└────┘└──────────┘
|
|
240
|
+
│ LAN │
|
|
241
|
+
▼ ▼ ▼
|
|
242
|
+
┌──────┐┌──────────┐┌──────────────┐
|
|
243
|
+
│ SQLite││ Peer ││ AgentRuntime │
|
|
244
|
+
│Memory ││ Server ││ Task Queue │
|
|
245
|
+
└──────┘└──────────┘└──────────────┘
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## Project Structure
|
|
251
|
+
|
|
252
|
+
```
|
|
253
|
+
src/
|
|
254
|
+
├── main.tsx # Entry point
|
|
255
|
+
├── QueryEngine.ts # Message + tool loop
|
|
256
|
+
├── commands/ # Slash command handlers
|
|
257
|
+
├── tools/ # 75+ tool implementations
|
|
258
|
+
├── services/
|
|
259
|
+
│ ├── ai/ # 29 provider adapters
|
|
260
|
+
│ ├── mcp/ # MCP client (stdio/SSE/WebSocket)
|
|
261
|
+
│ └── autonomous/ # Task queue, cron, daemon
|
|
262
|
+
├── peer/ # LAN P2P discovery + server
|
|
263
|
+
├── memory/ # SQLite memory store
|
|
264
|
+
├── skills/ # SKILL.md loader
|
|
265
|
+
├── plugins/ # Plugin system
|
|
266
|
+
└── remote/ # Bridge v2 WebSocket server
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
Full breakdown in **[AGENTS.md](AGENTS.md)**.
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## Development
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
bun run dev # Live-reload REPL
|
|
277
|
+
bun run build # Production build to dist/
|
|
278
|
+
bun test # Vitest suite
|
|
279
|
+
bun run check:ci # Biome lint + format check
|
|
280
|
+
bun x tsc --noEmit # TypeScript check
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### Full pre-commit
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
bun run check:ci && bun x tsc --noEmit && bun test --bail
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### Shadow `.js` files
|
|
290
|
+
|
|
291
|
+
`src/` has ~410 `.js` files alongside `.ts` twins (leftover from JS → TS migration). Bun resolves `.js` import specifiers to the real `.js` file on disk — it does **not** prefer the `.ts` source. If you're making a runtime fix, check for a `.js` sibling and edit **both** files.
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## FAQ
|
|
296
|
+
|
|
297
|
+
**Q: Does this send my code to a remote server?**
|
|
298
|
+
A: No. Clew Code runs entirely on your machine. Code only leaves your network if you explicitly configure a remote provider or use a web fetch tool.
|
|
299
|
+
|
|
300
|
+
**Q: Which providers are supported?**
|
|
301
|
+
A: 29+ including OpenAI, Anthropic, DeepSeek, Groq, Google, Ollama (local), and more. Switch mid-session with `/model`.
|
|
302
|
+
|
|
303
|
+
**Q: Can I use it without an internet connection?**
|
|
304
|
+
A: Yes — pair it with a local provider like Ollama running on your machine.
|
|
305
|
+
|
|
306
|
+
**Q: How is this different from Claude Code or Cursor?**
|
|
307
|
+
A: Clew Code is provider-agnostic (not locked to one LLM), fully local (no SaaS), and open source (GPL-3.0). It supports multi-provider routing, LAN peer swarms, and persistent memory.
|
|
308
|
+
|
|
309
|
+
**Q: Does it have a GUI?**
|
|
310
|
+
A: It runs in the terminal with a full TUI (Ink + React 19). Some features are also available via a web dashboard at [clew-code.org/app](https://clew-code.org/app).
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
## Contributing
|
|
315
|
+
|
|
316
|
+
Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
317
|
+
|
|
318
|
+
- Report bugs via [GitHub Issues](https://github.com/ClewCode/ClewCode/issues)
|
|
319
|
+
- Discuss ideas in [GitHub Discussions](https://github.com/ClewCode/ClewCode/discussions)
|
|
320
|
+
- Read [AGENTS.md](AGENTS.md) for architecture and code conventions
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
## Star History
|
|
325
|
+
|
|
326
|
+
[](https://star-history.com/#ClewCode/ClewCode&Date)
|
|
327
|
+
|
|
328
|
+
---
|
|
329
|
+
|
|
330
|
+
## License
|
|
331
|
+
|
|
332
|
+
GPL-3.0. See [LICENSE.md](LICENSE.md).
|
|
333
|
+
|
|
334
|
+
Release history in [CHANGELOG.md](CHANGELOG.md).
|