clew-code 0.2.27 → 0.2.29
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 +77 -42
- package/dist/main.js +2519 -2504
- package/docs/architecture.html +90 -91
- package/docs/changelog.html +141 -150
- package/docs/cli-reference.html +89 -90
- package/docs/commands.html +13 -9
- package/docs/daemon.html +62 -62
- package/docs/generated/providers.html +625 -0
- package/docs/generated/tools.html +559 -0
- package/docs/index.html +10 -13
- package/docs/internals/long-term-memory-design.md +173 -89
- package/docs/js/main.js +438 -437
- package/docs/personal-profile.html +113 -0
- package/docs/providers.html +625 -87
- package/docs/quick-start.html +81 -81
- package/docs/tools.html +551 -175
- package/docs/troubleshooting.html +86 -86
- package/package.json +6 -9
package/README.md
CHANGED
|
@@ -12,8 +12,8 @@ A multi-provider AI coding CLI that codes, learns your preferences, coordinates
|
|
|
12
12
|
[](https://github.com/ClewCode/ClewCode/graphs/contributors)
|
|
13
13
|
[](https://github.com/ClewCode/ClewCode/releases)
|
|
14
14
|
[](https://www.npmjs.com/package/clew-code)
|
|
15
|
-
[](https://github.com/ClewCode/ClewCode/actions/workflows/ci.yml)
|
|
16
|
+
[](#license)
|
|
17
17
|
[](#installation)
|
|
18
18
|
[](https://bun.sh)
|
|
19
19
|
|
|
@@ -25,35 +25,40 @@ A multi-provider AI coding CLI that codes, learns your preferences, coordinates
|
|
|
25
25
|
|
|
26
26
|
## Hacking in public
|
|
27
27
|
|
|
28
|
-
Clew Code is a
|
|
28
|
+
Clew Code is a reverse-engineered reimplementation of [Claude Code](https://github.com/anthropics/claude-code) (Anthropic), rebuilt from the ground up to be **multi-provider** — you're not locked into one API. As of this writing the project ships agent-to-agent LAN peer coordination, a preference-learning engine, autonomous background loops, multi-pass context compaction, MCP integration, plan mode with full bypass permissions, goal verification, Max Mode parallel candidates, structured checkpoints, automated memory consolidation, and 27+ provider adapters.
|
|
29
29
|
|
|
30
|
-
>
|
|
30
|
+
> Reverse-engineered from Claude Code. Rebuilt for every provider.
|
|
31
31
|
|
|
32
32
|
---
|
|
33
33
|
|
|
34
34
|
## Features
|
|
35
35
|
|
|
36
|
-
- **27 providers** — Anthropic, OpenAI, Google Gemini, DeepSeek, Groq, xAI (Grok), Mistral, Cohere, Perplexity, Cerebras, Moonshot (Kimi), Zhipu (GLM), NVIDIA NIM, OpenRouter,
|
|
37
|
-
- **
|
|
36
|
+
- **27+ providers** — Anthropic, OpenAI, Google Gemini & Code Assist, DeepSeek, Groq, xAI (Grok), Mistral, Cohere, Perplexity, Cerebras, Moonshot (Kimi), Zhipu (GLM), NVIDIA NIM, OpenRouter, OpenCode, KiloCode, Ollama (local), Together AI, Fireworks AI, Deep Infra, SiliconFlow, Hugging Face, Poe, DigitalOcean, Cline, OpenCode Go. Switch mid-session.
|
|
37
|
+
- **Peer-to-peer LAN** — find other Clew instances on the same machine (file registry) or across machines (UDP multicast). Assign tasks, set roles, execute remote commands — 15 peer AI tools let your agent coordinate autonomously via `/peer` commands.
|
|
38
38
|
|
|
39
39
|
- **Autonomous agent loop** — file-backed persistent task queue, lease-based concurrency, exponential backoff retry, dead-letter management. Cron scheduler for recurring jobs. Max 3 concurrent workers.
|
|
40
|
-
- **50+ built-in tools** — Read, Write, Edit, Glob, Grep, Bash, WebSearch, WebFetch, Browser (Playwright), PR (create/list/view/review/merge/status), NotebookEdit, JsonPath,
|
|
40
|
+
- **50+ built-in tools** — Read, Write, Edit, Glob, Grep, Bash, WebSearch, WebFetch, Browser (Playwright), PR (create/list/view/review/merge/status), NotebookEdit, JsonPath, ReadArtifact, peer tools (15 LAN coordination tools), MCP tools, ProcessPeer (exec/pty), plan mode with full bypass permissions, multi-pass context compaction.
|
|
41
|
+
- **Goal system** — `/goal` tracks task completion with heuristic pre-checks (exit codes, test output, lint results). Goal chains with `then` syntax. Auto-integrates with AFK mode and the autonomous loop.
|
|
42
|
+
- **Goal Verifier** — When the agent attempts to terminate, an independent LLM verifier reviews the conversation against the goal text. If unsatisfied, the gap is reported as metadata for automatic re-prompting.
|
|
43
|
+
- **Max Mode** — parallel candidate generation (default 3 per turn) using forked agents. Selects the best response via LLM judge (model-as-judge) with heuristic fallback. Toggle with `/maxmode`.
|
|
44
|
+
- **Structured checkpoints** — automatic progress snapshots at 20%/45%/70% milestones with notes scratchpad (`notes.md`) for main-agent findings. Multi-cycle rebuild from checkpoints during compaction preserves layered context (decisions → notes → blockers → next steps).
|
|
45
|
+
- **Project memory promotion** — at the 70% checkpoint, stable information (active files, persistent decisions, notes) is promoted to `MEMORY.md` for cross-session persistence.
|
|
46
|
+
- **Automated memory consolidation** — Dream process (7-day cycle) merges duplicate insights and creates weekly digests. Distill process (30-day cycle) extracts reusable patterns and generates skill suggestions.
|
|
41
47
|
- **MCP — Model Context Protocol** — connect external tools via stdio (local subprocesses), SSE (remote servers with OAuth), or DirectConnect (in-process plugin servers).
|
|
42
48
|
- **Skills, plugins, hooks** — extend without touching source. Skills via `SKILL.md`, plugins with manifest, hooks at every lifecycle stage (PreToolUse, PostToolUse, PreBash, PostPrompt, PreAcceptEdit).
|
|
43
|
-
- **
|
|
49
|
+
- **8 permission modes** — default, ask, plan, auto, acceptEdits, bypassPermissions, dontAsk, guardian. Granular allow/deny rules with pattern matching.
|
|
44
50
|
|
|
45
51
|
---
|
|
46
52
|
|
|
47
|
-
## Concepts: Agents, Subagents,
|
|
53
|
+
## Concepts: Agents, Subagents, and Peers
|
|
48
54
|
|
|
49
55
|
Clew Code has several execution layers. They are related, but they do different jobs:
|
|
50
56
|
|
|
51
|
-
- **Agent:** An AI worker with a prompt, model, tools, and permissions. The main chat session is an agent. Custom agents live in `.
|
|
57
|
+
- **Agent:** An AI worker with a prompt, model, tools, and permissions. The main chat session is an agent. Custom agents live in `.clew/agents/*.md`, and built-ins include `Explore`, `Plan`, and `general-purpose`.
|
|
52
58
|
- **Subagent:** A short-lived child agent launched by another agent through the `Agent` tool. Use subagents for independent work such as codebase exploration, test triage, or review. The built-in `Explore` agent is read-only and is the right choice for parallel "go inspect this area" tasks.
|
|
53
59
|
- **Teammate / Swarm:** A longer-lived agent team member with an identity, mailbox, task coordination, and optional pane/tmux or in-process execution. Use this when agents need to keep working together across multiple turns, not for isolated one-shot exploration.
|
|
54
|
-
- **LAN
|
|
55
|
-
- **Process
|
|
56
|
-
- **ACP:** An external protocol boundary. Editors, IDEs, REST clients, or other agents can send work into Clew through ACP. ACP should normalize the external request and route execution through Clew's internal layers instead of hardcoding a provider in every ACP entry point.
|
|
60
|
+
- **LAN Peer:** A network of Clew instances on the same machine or LAN. `/peer` discovers peers, sends messages, assigns tasks, and runs commands on other Clew nodes.
|
|
61
|
+
- **Process Peer:** A local process-backed worker layer. It delegates a prompt to an external CLI/provider such as Codex using `exec` or `pty`, then returns stdout, stderr, exit code, timeout state, and progress.
|
|
57
62
|
|
|
58
63
|
Typical flows:
|
|
59
64
|
|
|
@@ -64,17 +69,9 @@ User
|
|
|
64
69
|
-> short-lived subagent, e.g. Explore
|
|
65
70
|
```
|
|
66
71
|
|
|
67
|
-
```text
|
|
68
|
-
External editor / external agent
|
|
69
|
-
-> ACP
|
|
70
|
-
-> shared ACP-to-mesh boundary
|
|
71
|
-
-> Process Mesh provider, e.g. codex
|
|
72
|
-
-> external CLI process
|
|
73
|
-
```
|
|
74
|
-
|
|
75
72
|
```text
|
|
76
73
|
Clew instance A
|
|
77
|
-
-> LAN
|
|
74
|
+
-> LAN Peer
|
|
78
75
|
-> Clew instance B
|
|
79
76
|
-> local agent, daemon task, or process worker
|
|
80
77
|
```
|
|
@@ -83,13 +80,36 @@ Use the layers by intent:
|
|
|
83
80
|
|
|
84
81
|
- Need a quick independent read-only investigation? Use an `Explore` subagent.
|
|
85
82
|
- Need long-running coordination between named workers? Use teammates/swarm.
|
|
86
|
-
- Need another Clew instance on the LAN? Use `/
|
|
87
|
-
- Need
|
|
88
|
-
- Need Clew to run a local external worker such as Codex? Use Process Mesh.
|
|
83
|
+
- Need another Clew instance on the LAN? Use `/peer`.
|
|
84
|
+
- Need Clew to run a local external worker such as Codex? Use Process Peer.
|
|
89
85
|
|
|
90
86
|
Other runtime concepts:
|
|
91
87
|
- **Plan mode:** Full-access planning mode with bypass permissions — explore, read, write, and edit files freely. Plan files persist to `.clew/plans/long-term-plan.md` with task progress snapshot.
|
|
92
88
|
- **Multi-pass compaction:** Automatic chunk-based context compression with recursive re-compaction when context exceeds the model window.
|
|
89
|
+
- **Goal verification:** When the agent declares a task done, an independent LLM call reviews the conversation against the goal text and reports specific gaps if unsatisfied (attached as `goalGap` in result metadata).
|
|
90
|
+
- **Max Mode:** Generates N parallel candidate responses per turn via forked agents, then selects the best one via LLM judge with heuristic fallback. Toggle with `/maxmode`.
|
|
91
|
+
- **Checkpoints:** Structured snapshots at 20%/45%/70% progress milestones. Includes a `notes.md` scratchpad for the main agent's findings. Used for layered multi-cycle rebuild during compaction.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Profiles: Coding vs Personal
|
|
96
|
+
|
|
97
|
+
Clew Code has two profiles you switch between with `/profile`:
|
|
98
|
+
|
|
99
|
+
- **Coding profile** (`/profile coding`) — default. Directly implement software changes: inspect repo, edit files, run validation.
|
|
100
|
+
- **Personal profile** (`/profile personal`) — command center mode. Plan, split tasks, **delegate** code work to a Codex worker via `process_peer`, then review and summarize results.
|
|
101
|
+
|
|
102
|
+
### How personal delegation works
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
You → personal profile → understand requirement → plan approach
|
|
106
|
+
→ /delegate skill → ProcessPeer → Codex worker
|
|
107
|
+
→ worker implements → report back → you review
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
In personal profile, you never edit files directly — the `delegate` skill spawns a Codex worker with a structured task prompt (goal, scope, constraints, validation criteria) and reports what was done, what passed/failed, and what's blocked. Use personal profile when you want to orchestrate rather than implement.
|
|
111
|
+
|
|
112
|
+
Profile and last-used permission mode are saved between sessions.
|
|
93
113
|
|
|
94
114
|
---
|
|
95
115
|
|
|
@@ -144,9 +164,11 @@ clew
|
|
|
144
164
|
# In-session commands
|
|
145
165
|
❯ /help # list everything
|
|
146
166
|
❯ /status # current provider, model, context info
|
|
147
|
-
❯ /
|
|
167
|
+
❯ /goal "tests pass" # track task completion
|
|
168
|
+
❯ /maxmode on # parallel candidate generation
|
|
169
|
+
❯ /peer discover # find other Clew instances on LAN
|
|
148
170
|
❯ /mcp list # connected MCP servers
|
|
149
|
-
❯ /
|
|
171
|
+
❯ /daemon # background autonomous loop
|
|
150
172
|
|
|
151
173
|
# One-shot mode (pipe-friendly)
|
|
152
174
|
clew -p "summarize CHANGELOG.md"
|
|
@@ -167,7 +189,7 @@ export DEEPSEEK_API_KEY=...
|
|
|
167
189
|
export GROQ_API_KEY=...
|
|
168
190
|
export OPENROUTER_API_KEY=...
|
|
169
191
|
export OLLAMA_HOST=http://localhost:11434
|
|
170
|
-
export
|
|
192
|
+
export GEMINI_API_KEY=...
|
|
171
193
|
```
|
|
172
194
|
|
|
173
195
|
---
|
|
@@ -175,14 +197,17 @@ export COPILOT_GITHUB_TOKEN=gho_...
|
|
|
175
197
|
## Commands
|
|
176
198
|
|
|
177
199
|
<details>
|
|
178
|
-
<summary><strong>
|
|
200
|
+
<summary><strong>21 slash commands</strong></summary>
|
|
179
201
|
|
|
180
202
|
```
|
|
181
203
|
/model Switch provider or model
|
|
182
204
|
/status Provider, session, context info
|
|
183
205
|
/doctor Diagnostics
|
|
206
|
+
/profile Switch between coding and personal profiles
|
|
184
207
|
/context Active context usage
|
|
185
208
|
/compact Compress conversation history
|
|
209
|
+
/goal Track and verify task completion
|
|
210
|
+
/maxmode Toggle parallel candidate generation
|
|
186
211
|
/mcp MCP server management
|
|
187
212
|
/code-review Review changed files for bugs
|
|
188
213
|
/simplify Cleanup-focused review
|
|
@@ -190,11 +215,12 @@ export COPILOT_GITHUB_TOKEN=gho_...
|
|
|
190
215
|
/bridge Bridge mode config
|
|
191
216
|
/agent Background agent dispatch & subcommands
|
|
192
217
|
/agents TUI Agent dashboard (operational view)
|
|
193
|
-
/
|
|
218
|
+
/peer Collaborate with Clew instances on LAN
|
|
194
219
|
/remote WebSocket remote control
|
|
195
|
-
/loop 24/7 autonomous agent loop
|
|
196
220
|
/daemon Autonomous daemon dashboard
|
|
197
221
|
/task Scheduled tasks
|
|
222
|
+
/memory Long-term memory search and management
|
|
223
|
+
/tasks Curated task list management
|
|
198
224
|
```
|
|
199
225
|
|
|
200
226
|
</details>
|
|
@@ -214,13 +240,18 @@ src/
|
|
|
214
240
|
├── commands/ # Slash command implementations
|
|
215
241
|
├── tools/ # 50+ built-in tools
|
|
216
242
|
├── services/
|
|
217
|
-
│ ├── ai/ # Provider manager + 27 providers
|
|
243
|
+
│ ├── ai/ # Provider manager + 27+ providers
|
|
218
244
|
│ ├── mcp/ # MCP client + auth + transports
|
|
219
245
|
│ ├── plugins/ # Plugin hooks + marketplace
|
|
220
246
|
│ ├── autonomous/ # Agent loop + task queue + cron
|
|
247
|
+
│ ├── checkpoint/ # Structured progress checkpoints
|
|
248
|
+
│ ├── goal/ # Goal evaluation and verification
|
|
249
|
+
│ ├── longTermMemory/ # Dream (7d) + Distill (30d) consolidation
|
|
250
|
+
│ ├── maxMode/ # Candidate runner + evaluator
|
|
221
251
|
│ ├── lsp/ # LSP integration
|
|
222
252
|
│ └── Supervisor/ # Agent supervisor IPC
|
|
223
|
-
├──
|
|
253
|
+
├── peer/ # PeerServer + PeerDiscovery (agent-to-agent)
|
|
254
|
+
├── memory/ # Long-term memory (SQLite, FTS5)
|
|
224
255
|
├── bridge/ # WebSocket bridge + relay
|
|
225
256
|
├── components/ # Ink terminal UI components
|
|
226
257
|
├── state/ # AppState management
|
|
@@ -278,15 +309,19 @@ We welcome contributions. Read [CONTRIBUTING.md](CONTRIBUTING.md), [CODE_OF_COND
|
|
|
278
309
|
## Changelog
|
|
279
310
|
|
|
280
311
|
<details>
|
|
281
|
-
<summary><strong>v0.2.
|
|
282
|
-
|
|
283
|
-
- **
|
|
284
|
-
-
|
|
285
|
-
- **
|
|
286
|
-
- **
|
|
287
|
-
-
|
|
288
|
-
- **
|
|
289
|
-
- **
|
|
312
|
+
<summary><strong>v0.2.22 — 2026-06-15</strong></summary>
|
|
313
|
+
|
|
314
|
+
- **Max Mode** — parallel candidate generation (default 3 per turn), `/maxmode` command
|
|
315
|
+
- **Goal system** — `/goal` with heuristic pre-checks, goal chains (`then`), AFK integration
|
|
316
|
+
- **Structured checkpoints** — progress snapshots at 20%/45%/70%, session rebuild from checkpoints
|
|
317
|
+
- **Dream process** — 7-day automated memory consolidation cycle
|
|
318
|
+
- **Distill process** — 30-day pattern extraction and reusable skill generation
|
|
319
|
+
- **Video input** — paste mp4/mov/webm to video-capable models (Gemini, GPT-5.x)
|
|
320
|
+
- **Image & Video generation** — `GenerateImage` (DALL-E 3, Imagen 3) and `GenerateVideo` (Runway Gen-4)
|
|
321
|
+
- **Profile system** — `/profile` switches between `coding` and `personal` profiles
|
|
322
|
+
- **Execution modes** — `/mode` with `safe`, `yolo`, `afk`, `review-only`, `browser-safe`
|
|
323
|
+
- **ReadArtifact tool** — read truncated large outputs in chunks
|
|
324
|
+
- **Bounded tool output** — 200-line cap with disk persistence for large results
|
|
290
325
|
|
|
291
326
|
</details>
|
|
292
327
|
|