clew-code 0.2.28 → 0.2.30
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 +38 -28
- package/bin/clew.cjs +2 -2
- package/dist/main.js +2318 -2331
- package/docs/architecture.html +90 -91
- package/docs/changelog.html +141 -150
- package/docs/cli-reference.html +89 -90
- package/docs/commands.html +10 -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/personal-profile.html +3 -3
- 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 +165 -165
- package/scripts/auto-close-duplicates.ts +277 -0
- package/scripts/backfill-duplicate-comments.ts +213 -0
- package/scripts/codegraph.ts +221 -0
- package/scripts/comment-on-duplicates.sh +95 -0
- package/scripts/edit-issue-labels.sh +84 -0
- package/scripts/final-peer-rename.mjs +46 -0
- package/scripts/fix-encoding.mjs +83 -0
- package/scripts/fix-inconsistencies.mjs +67 -0
- package/scripts/generate-docs.ts +307 -0
- package/scripts/gh.sh +96 -0
- package/scripts/install.ps1 +37 -0
- package/scripts/install.sh +49 -0
- package/scripts/issue-lifecycle.ts +38 -0
- package/scripts/lifecycle-comment.ts +53 -0
- package/scripts/normalize-html.mjs +37 -0
- package/scripts/preload.ts +159 -0
- package/scripts/rename-content-peer-to-swarm.mjs +67 -0
- package/scripts/rename-hooks-mesh.mjs +6 -0
- package/scripts/rename-peer-to-swarm.mjs +62 -0
- package/scripts/run_devcontainer_claude_code.ps1 +152 -0
- package/scripts/scrape.py +82 -0
- package/scripts/session.ts +195 -0
- package/scripts/sweep.ts +168 -0
- package/scripts/write-discovery-test.cjs +93 -0
- package/scripts/write-discovery-test2.cjs +65 -0
- package/scripts/write-server-final.cjs +108 -0
- package/scripts/write-server-test.cjs +69 -0
- package/scripts/write-server-test2.cjs +99 -0
- package/scripts/write-server-test3.cjs +59 -0
- package/scripts/write-server-test4.cjs +108 -0
- package/scripts/write-server-v2.cjs +142 -0
- package/scripts/write-server-v2b.cjs +129 -0
- package/scripts/write-server-v2c.cjs +136 -0
- package/scripts/write-store-test.cjs +12 -0
- package/scripts/write-store-test2.cjs +163 -0
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,7 +25,7 @@ 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 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
|
|
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
|
|
|
@@ -34,10 +34,10 @@ Clew Code is a reverse-engineered reimplementation of [Claude Code](https://gith
|
|
|
34
34
|
## Features
|
|
35
35
|
|
|
36
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
|
+
- **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, ReadArtifact,
|
|
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
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
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
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`.
|
|
@@ -46,20 +46,19 @@ Clew Code is a reverse-engineered reimplementation of [Claude Code](https://gith
|
|
|
46
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.
|
|
47
47
|
- **MCP — Model Context Protocol** — connect external tools via stdio (local subprocesses), SSE (remote servers with OAuth), or DirectConnect (in-process plugin servers).
|
|
48
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).
|
|
49
|
-
- **
|
|
49
|
+
- **8 permission modes** — default, ask, plan, auto, acceptEdits, bypassPermissions, dontAsk, guardian. Granular allow/deny rules with pattern matching.
|
|
50
50
|
|
|
51
51
|
---
|
|
52
52
|
|
|
53
|
-
## Concepts: Agents, Subagents,
|
|
53
|
+
## Concepts: Agents, Subagents, and Peers
|
|
54
54
|
|
|
55
55
|
Clew Code has several execution layers. They are related, but they do different jobs:
|
|
56
56
|
|
|
57
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`.
|
|
58
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.
|
|
59
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.
|
|
60
|
-
- **LAN
|
|
61
|
-
- **Process
|
|
62
|
-
- **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.
|
|
63
62
|
|
|
64
63
|
Typical flows:
|
|
65
64
|
|
|
@@ -70,17 +69,9 @@ User
|
|
|
70
69
|
-> short-lived subagent, e.g. Explore
|
|
71
70
|
```
|
|
72
71
|
|
|
73
|
-
```text
|
|
74
|
-
External editor / external agent
|
|
75
|
-
-> ACP
|
|
76
|
-
-> shared ACP-to-mesh boundary
|
|
77
|
-
-> Process Mesh provider, e.g. codex
|
|
78
|
-
-> external CLI process
|
|
79
|
-
```
|
|
80
|
-
|
|
81
72
|
```text
|
|
82
73
|
Clew instance A
|
|
83
|
-
-> LAN
|
|
74
|
+
-> LAN Peer
|
|
84
75
|
-> Clew instance B
|
|
85
76
|
-> local agent, daemon task, or process worker
|
|
86
77
|
```
|
|
@@ -89,9 +80,8 @@ Use the layers by intent:
|
|
|
89
80
|
|
|
90
81
|
- Need a quick independent read-only investigation? Use an `Explore` subagent.
|
|
91
82
|
- Need long-running coordination between named workers? Use teammates/swarm.
|
|
92
|
-
- Need another Clew instance on the LAN? Use `/
|
|
93
|
-
- Need
|
|
94
|
-
- 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.
|
|
95
85
|
|
|
96
86
|
Other runtime concepts:
|
|
97
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.
|
|
@@ -102,6 +92,27 @@ Other runtime concepts:
|
|
|
102
92
|
|
|
103
93
|
---
|
|
104
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.
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
105
116
|
## Install
|
|
106
117
|
|
|
107
118
|
```bash
|
|
@@ -155,9 +166,9 @@ clew
|
|
|
155
166
|
❯ /status # current provider, model, context info
|
|
156
167
|
❯ /goal "tests pass" # track task completion
|
|
157
168
|
❯ /maxmode on # parallel candidate generation
|
|
158
|
-
❯ /
|
|
169
|
+
❯ /peer discover # find other Clew instances on LAN
|
|
159
170
|
❯ /mcp list # connected MCP servers
|
|
160
|
-
❯ /
|
|
171
|
+
❯ /daemon # background autonomous loop
|
|
161
172
|
|
|
162
173
|
# One-shot mode (pipe-friendly)
|
|
163
174
|
clew -p "summarize CHANGELOG.md"
|
|
@@ -186,7 +197,7 @@ export GEMINI_API_KEY=...
|
|
|
186
197
|
## Commands
|
|
187
198
|
|
|
188
199
|
<details>
|
|
189
|
-
<summary><strong>
|
|
200
|
+
<summary><strong>21 slash commands</strong></summary>
|
|
190
201
|
|
|
191
202
|
```
|
|
192
203
|
/model Switch provider or model
|
|
@@ -204,9 +215,8 @@ export GEMINI_API_KEY=...
|
|
|
204
215
|
/bridge Bridge mode config
|
|
205
216
|
/agent Background agent dispatch & subcommands
|
|
206
217
|
/agents TUI Agent dashboard (operational view)
|
|
207
|
-
/
|
|
218
|
+
/peer Collaborate with Clew instances on LAN
|
|
208
219
|
/remote WebSocket remote control
|
|
209
|
-
/loop 24/7 autonomous agent loop
|
|
210
220
|
/daemon Autonomous daemon dashboard
|
|
211
221
|
/task Scheduled tasks
|
|
212
222
|
/memory Long-term memory search and management
|
|
@@ -240,7 +250,7 @@ src/
|
|
|
240
250
|
│ ├── maxMode/ # Candidate runner + evaluator
|
|
241
251
|
│ ├── lsp/ # LSP integration
|
|
242
252
|
│ └── Supervisor/ # Agent supervisor IPC
|
|
243
|
-
├──
|
|
253
|
+
├── peer/ # PeerServer + PeerDiscovery (agent-to-agent)
|
|
244
254
|
├── memory/ # Long-term memory (SQLite, FTS5)
|
|
245
255
|
├── bridge/ # WebSocket bridge + relay
|
|
246
256
|
├── components/ # Ink terminal UI components
|
package/bin/clew.cjs
CHANGED