lazyclaw 4.2.2 → 5.0.0

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.
Files changed (67) hide show
  1. package/README.ko.md +44 -0
  2. package/README.md +172 -353
  3. package/agents.mjs +19 -3
  4. package/channels/handoff.mjs +41 -0
  5. package/channels/loader.mjs +124 -0
  6. package/channels/matrix.mjs +417 -0
  7. package/channels/telegram.mjs +362 -0
  8. package/channels/threads.mjs +116 -0
  9. package/cli.mjs +730 -27
  10. package/daemon.mjs +111 -0
  11. package/gateway/device_auth.mjs +664 -0
  12. package/gateway/http_gateway.mjs +304 -0
  13. package/mas/agent_memory.mjs +35 -34
  14. package/mas/agent_turn.mjs +30 -1
  15. package/mas/confidence.mjs +108 -0
  16. package/mas/index_db.mjs +242 -0
  17. package/mas/mention_router.mjs +75 -4
  18. package/mas/nudge.mjs +97 -0
  19. package/mas/prompt_stack.mjs +80 -0
  20. package/mas/provider_adapters.mjs +83 -0
  21. package/mas/redact.mjs +46 -0
  22. package/mas/skill_synth.mjs +331 -0
  23. package/mas/tool_runner.mjs +19 -48
  24. package/mas/tools/browser.mjs +77 -0
  25. package/mas/tools/clarify.mjs +36 -0
  26. package/mas/tools/coding.mjs +109 -0
  27. package/mas/tools/delegation.mjs +53 -0
  28. package/mas/tools/edit.mjs +36 -0
  29. package/mas/tools/git.mjs +110 -0
  30. package/mas/tools/ha.mjs +34 -0
  31. package/mas/tools/learning.mjs +168 -0
  32. package/mas/tools/media.mjs +105 -0
  33. package/mas/tools/os.mjs +152 -0
  34. package/mas/tools/patch.mjs +91 -0
  35. package/mas/tools/recall.mjs +103 -0
  36. package/mas/tools/registry.mjs +93 -0
  37. package/mas/tools/scheduling.mjs +62 -0
  38. package/mas/tools/skill_view.mjs +43 -0
  39. package/mas/tools/web.mjs +137 -0
  40. package/mas/toolsets.mjs +64 -0
  41. package/mas/trajectory_export.mjs +169 -0
  42. package/mas/trajectory_store.mjs +179 -0
  43. package/mas/user_modeler.mjs +108 -0
  44. package/package.json +22 -3
  45. package/providers/codex_cli.mjs +200 -0
  46. package/providers/gemini_cli.mjs +179 -0
  47. package/providers/registry.mjs +61 -1
  48. package/sandbox/base.mjs +82 -0
  49. package/sandbox/confiners/bubblewrap.mjs +21 -0
  50. package/sandbox/confiners/firejail.mjs +16 -0
  51. package/sandbox/confiners/landlock.mjs +14 -0
  52. package/sandbox/confiners/seatbelt.mjs +28 -0
  53. package/sandbox/daytona.mjs +37 -0
  54. package/sandbox/docker.mjs +91 -0
  55. package/sandbox/index.mjs +67 -0
  56. package/sandbox/local.mjs +59 -0
  57. package/sandbox/modal.mjs +53 -0
  58. package/sandbox/singularity.mjs +39 -0
  59. package/sandbox/ssh.mjs +56 -0
  60. package/sandbox.mjs +11 -127
  61. package/scripts/hermes-import.mjs +111 -0
  62. package/scripts/migrate-v5.mjs +342 -0
  63. package/scripts/openclaw-import.mjs +71 -0
  64. package/sessions.mjs +20 -1
  65. package/skills.mjs +101 -8
  66. package/skills_curator.mjs +323 -0
  67. package/workspace.mjs +18 -3
package/README.md CHANGED
@@ -1,427 +1,246 @@
1
- # 🦞 lazyclaw
1
+ # lazyclaw
2
2
 
3
- [![npm](https://img.shields.io/npm/v/lazyclaw.svg)](https://www.npmjs.com/package/lazyclaw)
4
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
5
- [![Node](https://img.shields.io/badge/node-%E2%89%A518-blue.svg)](https://nodejs.org/)
3
+ <img src="docs/assets/sleepy-sloth-source.png" alt="lazyclaw sloth" width="120" align="right">
6
4
 
7
- **A lazy, elegant terminal CLI for Claude / OpenAI / Gemini / Ollama.**
5
+ **A terminal agent whose learning loop runs free on your Claude Pro subscription.**
8
6
 
9
- One Node CLI that talks to every major LLM provider, runs multi-step workflows as a DAG, exposes a local HTTP gateway, and ships with the niceties you actually want at the prompt: an ASCII banner on launch, Cursor-style slash-command ghost autocomplete (right-arrow accepts), persistent chat sessions, and cost rate cards.
7
+ Chat with any provider. Train the skill bank, user model, and reflection pass on `claude-cli` $0. One SQLite + FTS5 store remembers every session. Hand the same conversation off between TUI, Slack, Discord, Telegram, Matrix, Email, and Voice.
10
8
 
11
- > Standalone CLI. A companion dashboard, [LazyClaude](https://github.com/cmblir/LazyClaude), wraps the same providers in a web UI — but `lazyclaw` needs nothing from it: `npm i -g lazyclaw` and go.
9
+ [![npm](https://img.shields.io/npm/v/lazyclaw.svg)](https://www.npmjs.com/package/lazyclaw)
10
+ [![Node](https://img.shields.io/badge/node-%E2%89%A518-blue.svg)](https://nodejs.org/)
11
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
12
12
 
13
- Every subcommand at a glance — `lazyclaw --help`:
13
+ ```bash
14
+ npx lazyclaw onboard # 15 seconds to a working CLI
15
+ ```
16
+
17
+ <img src="docs/screenshots/help.png" alt="lazyclaw subcommand reference" width="820">
14
18
 
15
- <img src="docs/screenshots/help.png" alt="lazyclaw --help — full subcommand reference" width="760">
19
+ *한국어: [README.ko.md](./README.ko.md)*
16
20
 
17
21
  ---
18
22
 
19
- ## Install
23
+ ## Why lazyclaw
20
24
 
21
- ```bash
22
- npm install -g lazyclaw
23
- lazyclaw version
24
- ```
25
+ Four things no other terminal agent CLI does together:
25
26
 
26
- Requires **Node 18+**. Works on macOS / Linux / WSL. Windows native PowerShell mostly works but the ghost-text + ANSI banner are TTY-gated and may fall back to plain prompts.
27
+ 1. **Split chat and trainer providers.** Pay-per-token for chat, $0 subscription for the learning loop. Or vice versa.
28
+ 2. **Recall across every CLI.** One FTS5 index over sessions, skills, trajectories, and memory.
29
+ 3. **Cross-channel handoff.** `/handoff slack <channel-id>` moves the live conversation; context follows.
30
+ 4. **Six sandbox backends, one API.** `local` / `docker` / `ssh` / `singularity` / `modal` / `daytona`.
27
31
 
28
- ## First run
32
+ ## Known limitations (v5.1 roadmap)
29
33
 
30
- ```bash
31
- lazyclaw onboard # arrow-key picker; defaults to claude-cli (no key)
32
- lazyclaw status # current provider/model + masked key
33
- lazyclaw doctor # validate config + provider registry
34
- ```
34
+ Calibrate expectations before reading the rest:
35
35
 
36
- `onboard` writes `~/.lazyclaw/config.json`. Move it with `LAZYCLAW_CONFIG_DIR=/elsewhere`. For automation: `--non-interactive --provider X --model Y [--api-key Z]`.
36
+ - `recall` is callable from inside chat today; the top-level `lazyclaw recall ...` CLI shape ships in v5.1.
37
+ - `lazyclaw sandbox` exposes `list | test | add | use`; the `sandbox run --backend ...` shape lands in v5.1.
38
+ - `codex-cli` and `gemini-cli` provider modules are tracked but not yet registered in the main runtime.
39
+ - E2E matrix ships with 32 of 48 flows marked `test.skip` pending v5.1 wiring; the min-green-set is documented in `tests/e2e/phaseH-e2e-matrix.spec.ts`.
37
40
 
38
- <img src="docs/screenshots/onboard.png" alt="lazyclaw onboard --non-interactive — writes config.json, prints JSON result" width="760">
41
+ ## Install
39
42
 
40
- <img src="docs/screenshots/doctor.png" alt="lazyclaw doctor — config + provider registry health check" width="760">
43
+ ```bash
44
+ # Try it (no install)
45
+ npx lazyclaw onboard && lazyclaw chat
41
46
 
42
- ### Subscription mode (no API key)
47
+ # Keep it
48
+ npm install -g lazyclaw
43
49
 
44
- If you already have **Claude Code** installed and signed in (Pro / Max / Team subscription), pick the **`claude-cli`** provider during onboard. lazyclaw shells out to the local `claude` binary, so requests bill against your existing subscription quota instead of pay-per-token API credit. No `sk-ant-` key needed.
50
+ # Hack on it
51
+ git clone https://github.com/cmblir/lazyclaw && cd lazyclaw
52
+ npm install && npm link
53
+ ```
45
54
 
46
55
  ```bash
47
- lazyclaw onboard --non-interactive --provider claude-cli --model claude-opus-4-7
48
- lazyclaw status
49
- # → { provider: "claude-cli", model: "claude-opus-4-7", hasApiKey: false }
56
+ lazyclaw version
57
+ # → { "version": "5.0.0", "nodeVersion": "v20.11.0", "platform": "darwin" }
50
58
  ```
51
59
 
52
- Same flow for `ollama` (local models, also keyless).
53
-
54
- ### Pay-per-token mode (API key)
60
+ Requires **Node 18+**. macOS / Linux / WSL are first-class. Native PowerShell runs but ghost-text and the ANSI banner fall back to plain prompts.
55
61
 
56
- Pick `anthropic` / `openai` / `gemini` and supply the matching key:
62
+ ## First run
57
63
 
58
64
  ```bash
59
- lazyclaw onboard --non-interactive --provider openai \
60
- --model gpt-4.1 --api-key sk-...
65
+ lazyclaw onboard # arrow-key picker; defaults to claude-cli (no key)
66
+ # writes ~/.lazyclaw/config.json
61
67
  ```
62
68
 
63
- `onboard` only prompts for an api-key when the picked provider's `requiresApiKey` is true (the picker labels each row `[subscription]` / `[api key]` / `[no key]` so the choice is explicit).
64
-
65
- ### Built-in OpenAI-compatible vendors
66
-
67
- Eight popular OpenAI-compatible services ship as first-class providers — pick one in the setup picker (no `+ Add custom` walkthrough needed) or set the matching environment variable and they Just Work:
68
-
69
- | Provider | Models include | Env var |
70
- |---|---|---|
71
- | `nim` | `meta/llama-3.1-405b-instruct`, `nvidia/llama-3.1-nemotron-70b-instruct`, `deepseek-ai/deepseek-r1`, `mistralai/mixtral-8x22b-instruct-v0.1` | `NVIDIA_API_KEY` (or `NIM_API_KEY`) |
72
- | `openrouter` | `anthropic/claude-3.5-sonnet`, `openai/gpt-4o`, `meta-llama/llama-3.1-405b-instruct`, `deepseek/deepseek-r1` | `OPENROUTER_API_KEY` |
73
- | `groq` | `llama-3.3-70b-versatile`, `mixtral-8x7b-32768`, `deepseek-r1-distill-llama-70b` | `GROQ_API_KEY` |
74
- | `together` | `meta-llama/Llama-3.3-70B-Instruct-Turbo`, `Qwen/Qwen2.5-72B-Instruct-Turbo`, `deepseek-ai/DeepSeek-V3` | `TOGETHER_API_KEY` |
75
- | `xai` | `grok-2-latest`, `grok-2-vision-1212` | `XAI_API_KEY` (or `GROK_API_KEY`) |
76
- | `deepseek` | `deepseek-chat`, `deepseek-reasoner` | `DEEPSEEK_API_KEY` |
77
- | `mistral` | `mistral-large-latest`, `codestral-latest`, `pixtral-large-latest` | `MISTRAL_API_KEY` |
78
- | `fireworks` | `accounts/fireworks/models/llama-v3p3-70b-instruct`, `…/deepseek-r1` | `FIREWORKS_API_KEY` |
69
+ <img src="docs/screenshots/onboard.png" alt="lazyclaw onboard --non-interactive" width="720">
79
70
 
80
71
  ```bash
81
- # NVIDIA NIM via env var — no `lazyclaw onboard` needed
82
- export NVIDIA_API_KEY=nvapi-...
83
- lazyclaw chat --provider nim --model meta/llama-3.1-405b-instruct
84
-
85
- # Or commit the choice to ~/.lazyclaw/config.json
86
- lazyclaw onboard --non-interactive --provider nim \
87
- --model nvidia/llama-3.1-nemotron-70b-instruct --api-key nvapi-...
72
+ lazyclaw status # { provider, model, hasApiKey }
73
+ lazyclaw doctor # validates config + provider registry + index.db
88
74
  ```
89
75
 
90
- Need a vendor that's **not** built-in? `+ Add a custom OpenAI-compatible endpoint…` inside the setup picker (or `lazyclaw providers add <name> --base-url <url>`) still works for vLLM / LM Studio / private gateways / anything else that speaks the OpenAI v1 wire format.
91
-
92
- ### `orchestrator` — multi-agent dispatch as a provider
93
-
94
- `orchestrator` is a synthetic provider that composes the others. A chat message hitting `PROVIDERS.orchestrator` triggers a three-phase pipeline instead of a single 1:1 call:
76
+ Move the config dir with `LAZYCLAW_CONFIG_DIR=/elsewhere`. For automation, add `--non-interactive --provider X --model Y [--api-key Z]`.
95
77
 
96
- 1. **PLAN** the *planner* provider decomposes the request into 2–5 parallel subtasks (JSON-only system prompt; fences / prose tolerated).
97
- 2. **EXECUTE** — each subtask is dispatched round-robin across the *workers*. Replies stream inline so you watch progress in real time.
98
- 3. **SYNTHESIS** — the planner re-enters with every worker's output and writes the final user-facing answer.
78
+ ## The trainer split $0 learning on your Claude Pro subscription
99
79
 
100
- Configure in `~/.lazyclaw/config.json`:
80
+ v5 separates two provider slots in your config: `provider` (chat — the hot path) and `trainer.provider` (skill synthesis, user-model updates, reflection — bursty, cheap). They are wired independently, so a Pro/Max subscription can power the learning loop while chat runs through any provider, paid or local. lazyclaw is the **only** terminal agent CLI that splits these two roles.
101
81
 
102
- ```json
82
+ ```jsonc
83
+ // ~/.lazyclaw/config.json
103
84
  {
104
- "provider": "orchestrator",
105
- "orchestrator": {
106
- "planner": "claude-cli:claude-opus-4-7",
107
- "workers": [
108
- "claude-cli:claude-sonnet-4-6",
109
- "openai:gpt-4o",
110
- "gemini:gemini-2.5-pro",
111
- "nim:meta/llama-3.1-405b-instruct"
112
- ],
113
- "maxSubtasks": 5
85
+ "provider": "openai", // chat: pay-per-token
86
+ "model": "gpt-4.1",
87
+ "trainer": {
88
+ "provider": "claude-cli", // trainer: $0 on Pro/Max
89
+ "model": "claude-haiku-4-5",
90
+ "schedule": "nightly",
91
+ "budget": { "maxCallsPerDay": 200, "usdPerDay": 0.50 }
114
92
  }
115
93
  }
116
94
  ```
117
95
 
118
- Then `lazyclaw chat` (or any other entry point that ends up calling a provider `lazyclaw agent`, the daemon's `POST /agent` / `POST /chat`, the dashboard chat tab) routes through the orchestrator. Each worker's api-key is resolved through the same chain a direct chat would use (`authProfiles` → `customProviders` → built-in env var → legacy `cfg['api-key']`).
96
+ The canonical default is `trainer.provider = "auto"` resolves to `claude-cli` when a Pro/Max session is detected, else mirrors the chat provider.
119
97
 
120
- Defaults fall back gracefully: `planner` defaults to `cfg.provider`/`cfg.model`, `workers` defaults to `[planner]` (single-agent chain, still benefits from plan + synthesis structure). Self-recursion (`planner: "orchestrator"`) is rejected up front.
98
+ **Three configs covering the common cases:**
121
99
 
122
- You can skip the JSON entirely and configure via `lazyclaw onboard` / `lazyclaw setup` (the picker lands on the orchestrator and walks you through a planner + workers wizard) **or** via the dedicated CLI:
100
+ | Setup | `provider` | `trainer.provider` | Cost |
101
+ |---|---|---|---|
102
+ | Subscription only | `claude-cli` | `claude-cli` | $0 |
103
+ | Hybrid (recommended) | `openai` / any | `claude-cli` | chat-only |
104
+ | Pure API | `openai` / any | `openai` / any | both metered |
123
105
 
124
- ```bash
125
- lazyclaw orchestrator status
126
- lazyclaw orchestrator set-planner claude-cli:claude-opus-4-7
127
- lazyclaw orchestrator workers add openai:gpt-4o
128
- lazyclaw orchestrator workers add gemini:gemini-2.5-pro
129
- lazyclaw orchestrator workers set claude-cli:claude-sonnet-4-6,nim:meta/llama-3.1-405b-instruct # bulk replace
130
- lazyclaw orchestrator set-max-subtasks 5
131
- lazyclaw orchestrator clear # wipe cfg.orchestrator
132
- lazyclaw config set provider orchestrator # route chats through it
133
- ```
106
+ Full JSONC examples and the `auto` resolution rules: [docs/trainer-recipes.md](./docs/trainer-recipes.md).
134
107
 
135
- ## Launcher (no-arg `lazyclaw`)
108
+ ## Provider matrix
136
109
 
137
- Running `lazyclaw` with no subcommand drops into an arrow-key launcher with every subcommand laid out as a menu. Navigation:
110
+ | Chat provider | Trainer provider | Auth |
111
+ |---|---|---|
112
+ | `claude-cli` | `claude-cli` | subscription (Pro/Max) |
113
+ | `anthropic` | `anthropic` | API key |
114
+ | `openai` | `openai` | API key |
115
+ | `gemini` | `gemini` | API key |
116
+ | `ollama` | `ollama` | local (no key) |
117
+ | `nim` / `openrouter` / `groq` / `together` / `xai` / `deepseek` / `mistral` / `fireworks` | — | API key (OpenAI-compatible) |
138
118
 
139
- | Key | What it does |
140
- |---|---|
141
- | `↑` / `↓` / `Home` / `End` / `PgUp` / `PgDn` | Move the selection |
142
- | `Enter` | Run the highlighted item |
143
- | `q` / `Esc` / `Ctrl-C` | Leave lazyclaw |
144
- | `/` | Open an inline slash-command prompt |
119
+ Plus two meta-providers, usable in either slot:
120
+ - `orchestrator` — composes any of the above into a multi-agent pipeline ([docs/multi-agent.md](./docs/multi-agent.md))
121
+ - `custom` any OpenAI-compatible v1 endpoint with your own base URL + key
145
122
 
146
- Slash commands at the launcher (typed after `/`):
123
+ <img src="docs/screenshots/providers.png" alt="lazyclaw providers info model list + capabilities" width="720">
147
124
 
148
- | Slash | What it does |
149
- |---|---|
150
- | `/exit` / `/quit` | Leave lazyclaw |
151
- | `/help` | List launcher slash commands inline |
152
- | `/version` | Print version + node + platform |
125
+ ## What it ships
153
126
 
154
- The slash buffer lives just below the menu — backspace edits it, deleting past `/` returns to menu mode, and `Esc` cancels slash mode without leaving lazyclaw.
127
+ ### Around 50 tools plus MCP
128
+ A unified registry covers fs, exec, web, os, coding, git (5 read + 2 sensitive), scheduling, delegation, media, ha, clarify, browser, and learning groups. Sensitive tools route through an approval hook. Bring external servers in over stdio MCP.
155
129
 
156
- ## Interactive chat
130
+ ### Channels that hand off
131
+ First-class channels for Slack, Discord, Telegram, Matrix, Email, and Voice. Signal and WhatsApp ship as full implementations with external runtime dependencies (`signal-cli` for Signal; `whatsapp-web.js` browser automation with QR-on-first-run for WhatsApp). Move a live conversation between any two with `/handoff <target> <externalId>` — no other agent CLI does cross-channel handoff.
157
132
 
158
133
  ```bash
159
- lazyclaw chat # banner + active provider/model + REPL
160
- lazyclaw chat --pick # arrow-key picker before the prompt
161
- lazyclaw chat --session daily # persist turns to ~/.lazyclaw/sessions/daily.jsonl
162
- lazyclaw chat --skill review,style # compose named skills as the system prompt
134
+ lazyclaw channels install @lazyclaw/channel-discord
135
+ # inside Slack: /handoff discord <channel-id>
136
+ # inside Discord: /handoff tui <thread-id>
163
137
  ```
164
138
 
165
- What you see on launch (TTY only):
139
+ Slack is built-in and does not need `channels install`. The plugin loader expects `@lazyclaw/channel-<name>` npm package names.
166
140
 
167
- ```text
168
- ╭──────────────────────────────╮
169
- │ _ │
170
- │ | |__ _ _____ _ _ │
171
- │ | / _` |_ / || | '_| │
172
- │ |_\__,_/__\_, |_| │
173
- │ LazyClaw |__/ 3.99.11 │
174
- ╰──────────────────────────────╯
141
+ ### Personas that compose
142
+ Swap personality per channel without losing session memory. Layers compose top-down: global SOUL → workspace SOUL → active personality → agent role → user model (USER.md) → skill bank → memory core → recent trajectory tail. See [docs/persona-cookbook.md](./docs/persona-cookbook.md).
175
143
 
176
- provider · anthropic
177
- model · claude-opus-4-7
178
- slash · /help · /model · /provider · /exit
179
- hint · → to accept the suggested command, Tab to cycle
144
+ ### Loops and scheduled goals
145
+ Durable foreground or `--detach` loops; cron-scheduled goals with channel fan-out. State lives in `~/.lazyclaw/loops/<id>/` and survives restart. See [docs/loop-goal-preflight.md](./docs/loop-goal-preflight.md).
180
146
 
181
-
182
- ```
147
+ ### A TUI that ghosts the right answer
148
+ Ink-based UI with two-column splash, sloth ASCII banner, Cursor-style ghost autocomplete (`→` accepts, `Tab` cycles), interrupt-and-redirect REPL, multiline editor, and a fixed 4-line footer with live cost rate cards.
183
149
 
184
- Slash commands inside the REPL:
150
+ ## Command reference
185
151
 
186
- | Slash | What it does |
152
+ | Command | Purpose |
187
153
  |---|---|
188
- | `/help` | List slash commands |
189
- | `/status` | Print provider + model + masked key |
190
- | `/provider` | Open the family / provider / model arrow picker |
191
- | `/provider X` | Switch active provider directly by name |
192
- | `/model` | Open the per-provider model picker (type-filter + live `/v1/models` fetch) |
193
- | `/model X` | Switch model directly. Accepts unified `provider/model` form |
194
- | `/skill a,b` | Replace the system prompt with a composition of named skills |
195
- | `/loop "<prompt>" [--max N] [--until "<regex>"]` | Repeat one prompt N times (default 3, cap 50). `--until` short-circuits when the regex matches. Ctrl-C aborts the loop. |
196
- | `/loop "..." --use-memory --recall "<query>"` | Inject `~/.lazyclaw/memory/core.md` and the top-3 matching episodic/recent fragments into the system slot per iteration |
197
- | `/goal` | List active goals |
198
- | `/goal <name>` | Switch the chat to the goal's session (subsequent turns persist to `goal:<name>.jsonl`) |
199
- | `/goal add <name> [--desc "..."] [--cron "<spec>"]` | Register a persistent goal; `--cron` schedules `lazyclaw goal tick <name>` |
200
- | `/goal close <name> [done\|abandoned]` | Close the goal and uninstall its cron entry |
201
- | `/memory [core\|recent\|episodic [topic]]` | Show layered memory contents |
202
- | `/dream` | Consolidate `recent.jsonl` into per-topic `episodic/<topic>.md` files |
203
- | `/agent` / `/agent list` | List registered multi-agent agents |
204
- | `/agent show <name>` | Print the agent's JSON record |
205
- | `/agent add <name> [role text…]` | Register an agent with the default tool whitelist `[bash, read, write, grep]` |
206
- | `/agent remove <name>` | Delete the agent's record |
207
- | `/team` / `/team list` | List teams + lead + members + Slack channel |
208
- | `/team add <name> --agents a,b,c [--lead a] [--channel #x]` | Create a team |
209
- | `/team remove <name>` | Delete the team |
210
- | `/usage` | Message count + chars + cumulative token totals |
211
- | `/new` / `/reset` | Wipe history and start over |
212
- | `/exit` | Leave the chat REPL (returns to the launcher when chat was opened from it) |
213
-
214
- **Cursor-style ghost autocomplete**: type `/` and the longest matching slash command appears in dim grey after the cursor. **`→`** accepts; **`Tab`** cycles. **Ctrl-C** during a streaming reply aborts that turn (not the whole process); **Ctrl-C** at an empty prompt exits.
215
-
216
- ## One-shot (no REPL)
217
-
218
- ```bash
219
- lazyclaw agent "summarize: $(cat file.md)"
220
- lazyclaw agent - < prompt.txt # stdin
221
- lazyclaw agent "..." --provider openai --model gpt-4.1
222
- lazyclaw agent "..." --skill review # compose system prompt
223
- lazyclaw agent "..." --usage # token counts on stderr
224
- lazyclaw agent "..." --cost # USD when rates configured
225
- ```
226
-
227
- ## Loops and goals (durable agents)
228
-
229
- ```bash
230
- # Repeat one prompt N times against the active provider. Foreground
231
- # blocks the terminal; --detach forks a worker and prints {loopId,
232
- # pid, statePath}. Worker state under ~/.lazyclaw/loops/<id>/.
233
- lazyclaw loop "fix the failing tests" --max 5 --until "DONE"
234
- lazyclaw loop "ship checklist" --max 10 --detach --session daily
235
- lazyclaw loops list
236
- lazyclaw loops show <loopId>
237
- lazyclaw loops tail <loopId>
238
- lazyclaw loops kill <loopId> # SIGTERM; repeat within 5s for SIGKILL
239
-
240
- # Goals: persistent objectives with optional cron schedule + channel fan-out.
241
- lazyclaw goal add ship-v4 --desc "Ship v4" --cron "0 9 * * 1-5"
242
- lazyclaw goal list
243
- lazyclaw goal tick ship-v4 --force
244
- lazyclaw goal channel add ship-v4 slack:#deploys
245
- lazyclaw goal close ship-v4 done # also uninstalls the cron entry
246
-
247
- # Memory: ~/.lazyclaw/memory/{core.md,recent.jsonl,episodic/*.md}
248
- lazyclaw memory show core
249
- lazyclaw memory show recent
250
- lazyclaw memory dream # consolidate recent → episodic files
251
- lazyclaw memory edit core # open $EDITOR
252
- ```
253
-
254
- For Slack fan-out, set `SLACK_BOT_TOKEN` (xoxb-...) in `~/.lazyclaw/.env`.
255
- Tokens never appear in goal records or logs. Socket Mode inbound also
256
- needs `SLACK_APP_TOKEN` (xapp-...) and `SLACK_SIGNING_SECRET`.
257
-
258
- ## Multi-agent Slack teams (v4.1)
259
-
260
- Drive a small team of named agents through a single Slack thread. The
261
- lead agent receives the user's request, decides who else on the team
262
- should weigh in, `@mentions` them, and the router runs each mentioned
263
- agent in turn through the full tool-use loop (bash / read / write /
264
- grep) before handing control back. The thread terminates when the lead
265
- emits the literal marker `[[TASK_DONE]]` or the per-task iteration
266
- budget runs out. Each agent's reply is mirrored into the Slack thread
267
- under its own persona (`chat:write.customize` makes the username + icon
268
- match the agent in Slack's UI).
269
-
270
- ```bash
271
- # 1) Register agents — system prompt + provider + per-agent tool whitelist
272
- lazyclaw agent add planner --role "Project planner" --provider anthropic --model claude-opus-4-7
273
- lazyclaw agent add backend --role "Backend engineer" --provider anthropic --model claude-opus-4-7
274
- lazyclaw agent add frontend --role "Frontend engineer" --provider openai --model gpt-4.1
275
- lazyclaw agent list
276
-
277
- # 2) Group them into a team that talks in a specific Slack channel
278
- lazyclaw team add shop --agents planner,backend,frontend --lead planner --channel '#shop'
279
-
280
- # 3) Open a task — posts a root message into the team's channel, returns
281
- # the task id and the Slack thread_ts.
282
- lazyclaw task start --team shop --title "ship checkout flow" --description "MVP scope"
283
-
284
- # 4) Drive one user turn through the mention router. The lead replies,
285
- # @mentions teammates, they run tool-use loops, hand back to the lead.
286
- lazyclaw task tick t_20260518_xxxxxx "go" --max-turns 12
287
-
288
- # 5) Inspect the conversation (text, markdown, or raw JSON)
289
- lazyclaw task transcript t_20260518_xxxxxx --format md > thread.md
290
- lazyclaw task show t_20260518_xxxxxx
291
- lazyclaw task done t_20260518_xxxxxx # or `abandon` — also posts a closing message
292
-
293
- # 6) Agent memory carries lessons forward across tasks (v4.2). The
294
- # router auto-fires a ≤6-bullet reflection per participating agent
295
- # when a task transitions to done. Manual control:
296
- lazyclaw agent memory show planner
297
- lazyclaw agent memory edit planner # opens $EDITOR
298
- lazyclaw agent memory clear planner
299
- lazyclaw agent reflect planner --task t_20260518_xxxxxx
300
- # Flip auto reflection off per agent: edit ~/.lazyclaw/agents/<name>.json
301
- # and set "memoryWrite": "off" (other values: "auto" default, "manual").
302
- ```
303
-
304
- Slack inbound (a user pings `@lazyclaw` in a channel, the bot replies)
305
- runs through the Socket Mode listener:
306
-
307
- ```bash
308
- lazyclaw slack listen # foreground; connects, reacts with :eyes:, replies in thread
309
- ```
310
-
311
- The CLI is mirrored by daemon HTTP routes (`GET/POST/PATCH/DELETE
312
- /agents|teams|tasks`, `GET /tasks/<id>/transcript`) and by the
313
- browser dashboard's Agents / Teams / Tasks tabs:
314
-
315
- ```bash
316
- lazyclaw dashboard # opens http://127.0.0.1:<port>/ in the default browser
317
- ```
318
-
319
- Slack app prerequisites — bot token scopes `app_mentions:read`,
320
- `chat:write`, `chat:write.customize`, `im:history`, `im:read`,
321
- `im:write`, `channels:history`, `reactions:write`; Socket Mode enabled;
322
- app token scope `connections:write`; invite the bot into every team
323
- channel. Tokens live exclusively in `~/.lazyclaw/.env` and never appear
324
- in agent/team/task records or logs.
325
-
326
- For the full data model + phase plan, see `docs/multi-agent.md`.
327
-
328
- ## Providers / sessions / skills
329
-
330
- ```bash
331
- lazyclaw providers list # all registered providers
332
- lazyclaw providers info anthropic
333
- lazyclaw providers test anthropic # 1-token reachability probe
334
-
335
- lazyclaw sessions list # persisted chats
336
- lazyclaw sessions show daily
337
- lazyclaw sessions search "deploy"
338
- lazyclaw sessions export daily > daily.md
339
- lazyclaw sessions clear daily
340
-
341
- lazyclaw skills list # markdown skill bundles
342
- lazyclaw skills show review
343
- lazyclaw skills install ./my-skill.md
344
- lazyclaw skills remove review
345
- ```
346
-
347
- <img src="docs/screenshots/providers.png" alt="lazyclaw providers info anthropic — model list + capabilities" width="760">
348
-
349
- ## Workflows (DAG / sequential / persistent)
350
-
351
- ```bash
352
- lazyclaw run my-job ./flow.mjs # sequential, resumable
353
- lazyclaw run my-job ./flow.mjs --parallel --concurrency 4 # in-memory DAG
354
- lazyclaw run my-job ./flow.mjs --parallel-persistent # DAG + checkpoints
355
- lazyclaw resume my-job ./flow.mjs # resume a stalled run
356
-
357
- lazyclaw inspect # list every session
358
- lazyclaw inspect my-job --summary
359
- lazyclaw inspect my-job --critical-path ./flow.mjs # bottleneck finder
360
- lazyclaw inspect my-job --slowest 5
361
- ```
362
-
363
- State at `./.workflow-state/<id>/` (override with `LAZYCLAW_WORKFLOW_STATE_DIR=...`).
364
-
365
- ## Local HTTP gateway
366
-
367
- ```bash
368
- lazyclaw daemon # bind a free port; prints { port, url }
369
- lazyclaw daemon --port 19600
370
- lazyclaw daemon --auth-token $(openssl rand -hex 16)
371
- lazyclaw daemon --rate-limit 60 --log info # 60 req/min/IP, JSON access logs
372
- lazyclaw daemon --once # serve a single request, then exit
373
- ```
374
-
375
- ## Cost rate cards
376
-
377
- ```bash
378
- lazyclaw rates list
379
- lazyclaw rates set anthropic/claude-opus-4-7 \
380
- --in 15 --out 75 --cache-read 1.5 --cache-create 18.75
381
- lazyclaw rates copy anthropic/claude-opus-4-7 anthropic/claude-opus-4-6
382
- lazyclaw rates delete openai/gpt-3.5-turbo
383
- lazyclaw rates validate
384
- ```
154
+ | `lazyclaw` | Interactive menu; type a slash command or pick a subcommand |
155
+ | `lazyclaw onboard` | Arrow-key setup; writes `~/.lazyclaw/config.json` |
156
+ | `lazyclaw status` | Print active provider / model / masked key |
157
+ | `lazyclaw doctor` | Validate config, provider registry, FTS5 index |
158
+ | `lazyclaw chat` | Interactive REPL with ghost autocomplete + slash commands |
159
+ | `lazyclaw agent "<prompt>"` | One-shot generate; supports stdin |
160
+ | `lazyclaw run \| resume \| inspect` | DAG / sequential / persistent workflow jobs (`--dir <state-dir>`) |
161
+ | `lazyclaw config get\|set\|list\|edit\|validate` | Dotted-key config access |
162
+ | `lazyclaw sandbox list\|test\|add\|use` | Manage sandbox backends |
163
+ | `lazyclaw channels install\|list\|remove` | Channel plugin lifecycle (`@lazyclaw/channel-<name>`) |
164
+ | `lazyclaw trajectories export --format ...` | Export to atropos / axolotl / openai-ft / jsonl |
165
+ | `lazyclaw personality use\|list\|show` | Activate / inspect personas |
166
+ | `lazyclaw migrate v5` | v4 v5 with backup |
167
+ | `lazyclaw version` / `lazyclaw help` | Version + subcommand help |
168
+
169
+ In-REPL slash commands include `/help`, `/status`, `/provider`, `/model`, `/skill`, `/loop`, `/goal`, `/memory`, `/agent`, `/team`, `/handoff`, `/personality`, `/exit`. Depth lives in `lazyclaw <cmd> --help` and the docs below.
170
+
171
+ ## Migrating from v4
172
+
173
+ > [!IMPORTANT]
174
+ > `lazyclaw migrate v5` backs up your existing `~/.lazyclaw/` to `backup-v4-<ts>/` before rewriting anything. Don't skip the backup — the SQLite schema and skill frontmatter both change shape.
175
+
176
+ - **What changed**: split `trainer` provider block, new `~/.lazyclaw/index.db` (SQLite + FTS5), per-day JSONL trajectory sink, persona file directory, kebab-case provider IDs (`claude-cli`, `gemini-cli`, ...), additive SKILL.md frontmatter (`group`, `trained_by`, `confidence`, `cross_cli_tested`).
177
+ - **Migrate**:
178
+ ```bash
179
+ npm install -g lazyclaw@5
180
+ lazyclaw migrate v5
181
+ ```
182
+ - **Rollback**: restore `~/.lazyclaw/backup-v4-<ts>/` and `npm install -g lazyclaw@4`.
183
+
184
+ Full guide: [docs/migration-v4-to-v5.md](./docs/migration-v4-to-v5.md).
185
+
186
+ ## CLI vs Channels quick reference
187
+
188
+ | Capability | TUI | Slack / Discord / Telegram |
189
+ |---|---|---|
190
+ | Start a chat | `lazyclaw chat` | `@lazyclaw <message>` |
191
+ | Hand off to another surface | `/handoff slack <channel-id>` | `/handoff tui <thread-id>` |
192
+ | Recall across history | `/recall "<query>"` inside chat (top-level CLI v5.1) | `/recall "<query>"` inside chat |
193
+ | Switch persona | `/personality use terse` | `/personality use terse` |
194
+ | Switch model | `/model <name>` | `/model <name>` |
195
+ | Show status | `lazyclaw status` | `@lazyclaw status` |
385
196
 
386
- `/usage` and `--cost` use these to compute USD totals locally no provider call.
197
+ Channel plugins implement a shared `channels/base.mjs` contract, so the surface you address them through is interchangeable.
387
198
 
388
- ## Config + bundles
199
+ ## Configuration
389
200
 
390
- ```bash
391
- lazyclaw config path # → ~/.lazyclaw/config.json
392
- lazyclaw config get provider
393
- lazyclaw config set provider openai
394
- lazyclaw config list
395
- lazyclaw config edit # opens $EDITOR
396
- lazyclaw config validate
397
-
398
- lazyclaw export > backup.json # config + skills (+ optional sessions)
399
- lazyclaw import --from backup.json
201
+ ```jsonc
202
+ // ~/.lazyclaw/config.json
203
+ {
204
+ "provider": "claude-cli",
205
+ "model": "claude-opus-4-7",
206
+ "trainer": {
207
+ "provider": "auto", // "auto" | claude-cli | anthropic | openai | gemini | ollama
208
+ "model": "claude-haiku-4-5",
209
+ "schedule": "nightly",
210
+ "budget": { "maxCallsPerDay": 200, "usdPerDay": 0.50 }
211
+ },
212
+ "sandbox": { "backend": "local" }, // local | docker | ssh | singularity | modal | daytona
213
+ "channels": { "slack": { "enabled": true } },
214
+ "persona": { "active": "default" },
215
+ "orchestra": { "learning": { "crossCliDampenFactor": 0.85 } }
216
+ }
400
217
  ```
401
218
 
402
- ## Shell completion
219
+ Override the config directory with `LAZYCLAW_CONFIG_DIR=/path`. Workflow state moves with `LAZYCLAW_WORKFLOW_STATE_DIR=/path`. Channel tokens live exclusively in `~/.lazyclaw/.env`. Full schema in `lazyclaw config --help` and the docs.
403
220
 
404
- ```bash
405
- lazyclaw completion bash >> ~/.bashrc
406
- lazyclaw completion zsh >> ~/.zshrc
407
- ```
221
+ ## Security and privacy
408
222
 
409
- ## File locations
223
+ > [!WARNING]
224
+ > **`~/.lazyclaw/config.json` is trusted code.** Values resolved with `$(...)` execute at config load. Treat the file like a shell rc — never paste an untrusted snippet without reading it first.
410
225
 
411
- | Path | Purpose |
412
- |---|---|
413
- | `~/.lazyclaw/config.json` | provider, model, api-key, skills, rates |
414
- | `~/.lazyclaw/sessions/*.jsonl` | persisted chat sessions |
415
- | `~/.lazyclaw/skills/*.md` | installed skill bundles |
416
- | `./.workflow-state/<id>/` | per-session workflow checkpoints (cwd-relative) |
226
+ - **Trainer transcripts stay local.** Skill synthesis and user-model writes go through your configured trainer provider only; there is no hosted lazyclaw service.
227
+ - **Sandbox backends enforce different blast radii.** `local` runs as you; `docker` / `singularity` / `daytona` isolate; `ssh` / `modal` move execution off-host. Pick per task.
228
+ - **Secrets are redacted** from trajectories and synthesised skills (`sk-...`, `ghp_...`, `AKIA...`, bearer tokens, `*_KEY=...`, PEM blocks). Channel tokens live in `~/.lazyclaw/.env` and are never logged.
417
229
 
418
- `LAZYCLAW_CONFIG_DIR=...` moves the first three; `LAZYCLAW_WORKFLOW_STATE_DIR=...` moves the last.
230
+ ## Documentation
419
231
 
420
- ---
232
+ - [docs/migration-v4-to-v5.md](./docs/migration-v4-to-v5.md) — full v4 → v5 walkthrough + rollback
233
+ - [docs/trainer-recipes.md](./docs/trainer-recipes.md) — $0, hybrid, offline, and `auto` trainer configs
234
+ - [docs/persona-cookbook.md](./docs/persona-cookbook.md) — layered persona compose stack + skin import
235
+ - [docs/multi-agent.md](./docs/multi-agent.md) — orchestrator pipeline + Slack team data model
236
+ - [docs/loop-goal-preflight.md](./docs/loop-goal-preflight.md) — durable loops and cron-scheduled goals
237
+ - [docs/agent-memory.md](./docs/agent-memory.md) — per-agent memory, reflection, and skill synthesis
238
+ - [CHANGELOG.md](./CHANGELOG.md) — release notes (Keep a Changelog)
239
+ - [README.ko.md](./README.ko.md) — Korean companion
421
240
 
422
- ## Issues / contributing
241
+ ## Community
423
242
 
424
- Source lives in [cmblir/lazyclaw](https://github.com/cmblir/lazyclaw). Issues and PRs welcome.
243
+ Source and issues: [cmblir/lazyclaw](https://github.com/cmblir/lazyclaw). PRs welcome.
425
244
 
426
245
  ## License
427
246