clew-code 0.2.27 → 0.2.28
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 +44 -19
- package/dist/main.js +2262 -2234
- package/docs/commands.html +3 -0
- 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/package.json +165 -165
package/README.md
CHANGED
|
@@ -25,19 +25,25 @@ 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 mesh 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,
|
|
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
37
|
- **Agent-to-agent mesh** — find other Clew instances on the same machine (file registry) or across machines (UDP multicast). Assign tasks, set roles, execute remote commands — 15 mesh AI tools (discover, run, spawn, share, join, ping, broadcast, send_message, list_roles, list_messages, set_name, set_role, disconnect, info, help) let your agent coordinate autonomously via `/mesh` 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, mesh tools (15 LAN coordination tools), MCP tools, ProcessMesh (exec/pty), plan mode with full bypass permissions, multi-pass context compaction.
|
|
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, mesh tools (15 LAN coordination tools), MCP tools, ProcessMesh (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
|
- **7 permission modes** — default, ask, plan, auto, acceptEdits, bypassPermissions, dontAsk. Granular allow/deny rules with pattern matching.
|
|
@@ -48,7 +54,7 @@ Clew Code is a fork of [Claude Code](https://github.com/anthropics/claude-code)
|
|
|
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
60
|
- **LAN Mesh:** A network of Clew instances on the same machine or LAN. `/mesh` discovers peers, sends messages, assigns tasks, and runs commands on other Clew nodes.
|
|
@@ -90,6 +96,9 @@ Use the layers by intent:
|
|
|
90
96
|
Other runtime concepts:
|
|
91
97
|
- **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
98
|
- **Multi-pass compaction:** Automatic chunk-based context compression with recursive re-compaction when context exceeds the model window.
|
|
99
|
+
- **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).
|
|
100
|
+
- **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`.
|
|
101
|
+
- **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.
|
|
93
102
|
|
|
94
103
|
---
|
|
95
104
|
|
|
@@ -144,7 +153,9 @@ clew
|
|
|
144
153
|
# In-session commands
|
|
145
154
|
❯ /help # list everything
|
|
146
155
|
❯ /status # current provider, model, context info
|
|
147
|
-
❯ /
|
|
156
|
+
❯ /goal "tests pass" # track task completion
|
|
157
|
+
❯ /maxmode on # parallel candidate generation
|
|
158
|
+
❯ /mesh discover # find other Clew instances on LAN
|
|
148
159
|
❯ /mcp list # connected MCP servers
|
|
149
160
|
❯ /loop start # background autonomous loop
|
|
150
161
|
|
|
@@ -167,7 +178,7 @@ export DEEPSEEK_API_KEY=...
|
|
|
167
178
|
export GROQ_API_KEY=...
|
|
168
179
|
export OPENROUTER_API_KEY=...
|
|
169
180
|
export OLLAMA_HOST=http://localhost:11434
|
|
170
|
-
export
|
|
181
|
+
export GEMINI_API_KEY=...
|
|
171
182
|
```
|
|
172
183
|
|
|
173
184
|
---
|
|
@@ -175,14 +186,17 @@ export COPILOT_GITHUB_TOKEN=gho_...
|
|
|
175
186
|
## Commands
|
|
176
187
|
|
|
177
188
|
<details>
|
|
178
|
-
<summary><strong>
|
|
189
|
+
<summary><strong>22 slash commands</strong></summary>
|
|
179
190
|
|
|
180
191
|
```
|
|
181
192
|
/model Switch provider or model
|
|
182
193
|
/status Provider, session, context info
|
|
183
194
|
/doctor Diagnostics
|
|
195
|
+
/profile Switch between coding and personal profiles
|
|
184
196
|
/context Active context usage
|
|
185
197
|
/compact Compress conversation history
|
|
198
|
+
/goal Track and verify task completion
|
|
199
|
+
/maxmode Toggle parallel candidate generation
|
|
186
200
|
/mcp MCP server management
|
|
187
201
|
/code-review Review changed files for bugs
|
|
188
202
|
/simplify Cleanup-focused review
|
|
@@ -190,11 +204,13 @@ export COPILOT_GITHUB_TOKEN=gho_...
|
|
|
190
204
|
/bridge Bridge mode config
|
|
191
205
|
/agent Background agent dispatch & subcommands
|
|
192
206
|
/agents TUI Agent dashboard (operational view)
|
|
193
|
-
/mesh
|
|
207
|
+
/mesh Collaborate with Clew instances on LAN
|
|
194
208
|
/remote WebSocket remote control
|
|
195
209
|
/loop 24/7 autonomous agent loop
|
|
196
210
|
/daemon Autonomous daemon dashboard
|
|
197
211
|
/task Scheduled tasks
|
|
212
|
+
/memory Long-term memory search and management
|
|
213
|
+
/tasks Curated task list management
|
|
198
214
|
```
|
|
199
215
|
|
|
200
216
|
</details>
|
|
@@ -214,13 +230,18 @@ src/
|
|
|
214
230
|
├── commands/ # Slash command implementations
|
|
215
231
|
├── tools/ # 50+ built-in tools
|
|
216
232
|
├── services/
|
|
217
|
-
│ ├── ai/ # Provider manager + 27 providers
|
|
233
|
+
│ ├── ai/ # Provider manager + 27+ providers
|
|
218
234
|
│ ├── mcp/ # MCP client + auth + transports
|
|
219
235
|
│ ├── plugins/ # Plugin hooks + marketplace
|
|
220
236
|
│ ├── autonomous/ # Agent loop + task queue + cron
|
|
237
|
+
│ ├── checkpoint/ # Structured progress checkpoints
|
|
238
|
+
│ ├── goal/ # Goal evaluation and verification
|
|
239
|
+
│ ├── longTermMemory/ # Dream (7d) + Distill (30d) consolidation
|
|
240
|
+
│ ├── maxMode/ # Candidate runner + evaluator
|
|
221
241
|
│ ├── lsp/ # LSP integration
|
|
222
242
|
│ └── Supervisor/ # Agent supervisor IPC
|
|
223
243
|
├── mesh/ # MeshServer + MeshDiscovery (agent-to-agent)
|
|
244
|
+
├── memory/ # Long-term memory (SQLite, FTS5)
|
|
224
245
|
├── bridge/ # WebSocket bridge + relay
|
|
225
246
|
├── components/ # Ink terminal UI components
|
|
226
247
|
├── state/ # AppState management
|
|
@@ -278,15 +299,19 @@ We welcome contributions. Read [CONTRIBUTING.md](CONTRIBUTING.md), [CODE_OF_COND
|
|
|
278
299
|
## Changelog
|
|
279
300
|
|
|
280
301
|
<details>
|
|
281
|
-
<summary><strong>v0.2.
|
|
282
|
-
|
|
283
|
-
- **
|
|
284
|
-
-
|
|
285
|
-
- **
|
|
286
|
-
- **
|
|
287
|
-
-
|
|
288
|
-
- **
|
|
289
|
-
- **
|
|
302
|
+
<summary><strong>v0.2.22 — 2026-06-15</strong></summary>
|
|
303
|
+
|
|
304
|
+
- **Max Mode** — parallel candidate generation (default 3 per turn), `/maxmode` command
|
|
305
|
+
- **Goal system** — `/goal` with heuristic pre-checks, goal chains (`then`), AFK integration
|
|
306
|
+
- **Structured checkpoints** — progress snapshots at 20%/45%/70%, session rebuild from checkpoints
|
|
307
|
+
- **Dream process** — 7-day automated memory consolidation cycle
|
|
308
|
+
- **Distill process** — 30-day pattern extraction and reusable skill generation
|
|
309
|
+
- **Video input** — paste mp4/mov/webm to video-capable models (Gemini, GPT-5.x)
|
|
310
|
+
- **Image & Video generation** — `GenerateImage` (DALL-E 3, Imagen 3) and `GenerateVideo` (Runway Gen-4)
|
|
311
|
+
- **Profile system** — `/profile` switches between `coding` and `personal` profiles
|
|
312
|
+
- **Execution modes** — `/mode` with `safe`, `yolo`, `afk`, `review-only`, `browser-safe`
|
|
313
|
+
- **ReadArtifact tool** — read truncated large outputs in chunks
|
|
314
|
+
- **Bounded tool output** — 200-line cap with disk persistence for large results
|
|
290
315
|
|
|
291
316
|
</details>
|
|
292
317
|
|