bajaclaw 0.14.19 → 0.14.20

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 (2) hide show
  1. package/README.md +124 -537
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -7,20 +7,14 @@
7
7
  ██╔══██╗██╔══██║██ ██║██╔══██║ ██║ ██║ ██╔══██║██║███╗██║
8
8
  ██████╔╝██║ ██║╚█████╔╝██║ ██║ ╚██████╗███████╗██║ ██║╚███╔███╔╝
9
9
  ╚═════╝ ╚═╝ ╚═╝ ╚════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝╚═╝ ╚═╝ ╚══╝╚══╝
10
- autonomous agents on your terms · MIT · v0.14.18
10
+ autonomous agents on your terms · MIT · v0.14.20
11
11
  ```
12
12
 
13
- **BajaClaw is a long-running agent runtime for the `claude` CLI.** It turns
14
- the one-shot `claude -p` command into an always-on, scheduled, memory-backed,
15
- skill-matching autonomous agent - with a local dashboard, multiple profiles,
16
- OS-native scheduling, and first-class MCP integration.
13
+ I wanted my `claude` CLI to keep working in the background. BajaClaw does that.
17
14
 
18
- You install it once. It sets itself up. You run `bajaclaw start`. It goes.
15
+ It adds memory, skill matching, scheduled cycles, telegram and discord bridges, a local dashboard, and MCP integration on top of the regular claude CLI. Uses whatever login your `claude` already uses. I don't store credentials anywhere.
19
16
 
20
- > The name is a tribute to Baja Blast - the author's favorite soda. The
21
- > dashboard ships in that same tropical-lime teal on purpose.
22
-
23
- ---
17
+ Named after Baja Blast. The dashboard is that same teal on purpose.
24
18
 
25
19
  ## Install
26
20
 
@@ -28,621 +22,214 @@ You install it once. It sets itself up. You run `bajaclaw start`. It goes.
28
22
  npm install -g bajaclaw
29
23
  ```
30
24
 
31
- That's it. The post-install runs `bajaclaw setup` automatically, which:
32
-
33
- - Creates the default profile at `~/.bajaclaw/profiles/default/`
34
- - Writes the matching agent descriptor at `~/.claude/agents/default/default.md`
35
- - Registers BajaClaw as an MCP server in your desktop MCP config
36
- - Runs the health check and tells you if anything's off
37
-
38
- **Requirements**: Node 20+ and the `claude` CLI backend on your `PATH`.
39
- BajaClaw drives the backend as a subprocess - whatever login/subscription
40
- that CLI uses is what BajaClaw uses. BajaClaw itself never sees credentials.
41
-
42
- First run, end-to-end:
43
-
44
- ```
45
- npm install -g bajaclaw # installs + auto-setup
46
- bajaclaw chat # interactive REPL (new in v0.11)
47
- bajaclaw start # or run one scheduled cycle
48
- ```
49
-
50
- `bajaclaw chat` drops you into a turn-by-turn conversation with your
51
- agent. Shows model / effort / context / 5h & weekly usage in the
52
- header; per-turn status line reports tokens, cost, duration. Slash
53
- commands: `/help`, `/model`, `/effort`, `/stats`, `/compact`, `/exit`.
54
- See [docs/chat.md](docs/chat.md).
55
-
56
- > Prefer to track the bleeding edge? `npm install -g github:backyarddd/BajaClaw`
57
- > installs straight from main (runs the `prepare` script to build `dist/`).
58
-
59
- No profile name to pick. No config to fill in. No decisions to make.
60
-
61
- ---
62
-
63
- ## What it actually does
64
-
65
- A BajaClaw **cycle** is one pass of the 13-step loop in
66
- [`src/agent.ts`](src/agent.ts):
67
-
68
- 1. Load the profile config
69
- 2. Open the SQLite DB and apply migrations
70
- 3. Check the circuit breaker + rate limiter
71
- 4. Pop a task from the queue (or generate a heartbeat prompt if empty)
72
- 5. Full-text recall the top 10 relevant memories
73
- 6. Load `AGENT.md`, `SOUL.md`, `HEARTBEAT.md`
74
- 7. Score all available skills against the task; inject the top 3
75
- 8. Merge the MCP config (desktop + profile + agent)
76
- 9. Assemble the final system prompt
77
- 10. Exec `claude -p` with `--model`, `--max-turns`, `--allowedTools`,
78
- `--disallowedTools`, `--mcp-config`, `--output-format json`
79
- 11. Parse the JSON response; persist the cycle row
80
- 12. Post-cycle Haiku call extracts 0-5 durable memories into the FTS table
81
- 13. Dispatch follow-ups (channel replies, queued tasks, reflection cycle)
82
-
83
- You can run a cycle manually (`bajaclaw start`), schedule it (`bajaclaw
84
- daemon install`), or trigger it externally (`bajaclaw trigger <event>`).
85
- Cycles are idempotent - safe to re-run.
25
+ Post-install runs `bajaclaw setup` for you. It creates a default profile at `~/.bajaclaw/profiles/default/`, registers BajaClaw as an MCP server, and runs a health check.
86
26
 
87
- ---
27
+ Needs Node 22+ and the `claude` CLI on your PATH.
88
28
 
89
- ## Integration with the Claude ecosystem
29
+ Bleeding edge: `npm install -g github:backyarddd/BajaClaw`.
90
30
 
91
- BajaClaw is designed to slot *into* your existing Claude Code setup, not
92
- replace it. Everything you've already configured for `claude` is inherited
93
- for free.
94
-
95
- ### Claude Code agent descriptors
96
-
97
- Every BajaClaw profile writes a standard agent frontmatter file to
98
- `~/.claude/agents/<profile>/<name>.md`. That means the moment you run
99
- `bajaclaw setup`, a new `@default` agent appears inside Claude Code itself.
100
- You can invoke it from a Claude Code session the same way you invoke any
101
- other agent. The BajaClaw profile is the durable side; the Claude Code
102
- descriptor is the handle.
103
-
104
- ### Claude Code skills - compatible format, **isolated scope**
105
-
106
- A BajaClaw skill is a `SKILL.md` file with YAML frontmatter - byte-for-byte
107
- the same shape Claude Code uses. But BajaClaw reads only BajaClaw-owned
108
- directories:
109
-
110
- | priority | path |
111
- |---|---|
112
- | 1 | `<agent-dir>/skills/` |
113
- | 2 | `~/.bajaclaw/profiles/<name>/skills/` |
114
- | 3 | `~/.bajaclaw/skills/` |
115
- | 4 | `<repo>/skills/` (built-ins) |
116
-
117
- `~/.claude/skills/` is **not** read automatically - that keeps the two
118
- agents from stepping on each other's skill libraries.
119
-
120
- **Porting skills from Claude Code is a one-liner:**
31
+ ## First run
121
32
 
122
33
  ```
123
- bajaclaw skill port # copy all from ~/.claude/skills
124
- bajaclaw skill port --names my-skill # just one
125
- bajaclaw skill port --link # symlink (live sync from Claude Code)
126
- bajaclaw skill port --scope profile --profile default
34
+ bajaclaw chat # interactive REPL
35
+ bajaclaw start # run one cycle against the default profile
36
+ bajaclaw dashboard # http://localhost:7337
37
+ bajaclaw daemon start # run continuously in the background
127
38
  ```
128
39
 
129
- When BajaClaw matches skills for a cycle, scoring is:
130
- - Trigger phrase hit: +5
131
- - Name token hit: +2
132
- - Description token hit: +1
40
+ The default profile has full tool access and auto model routing. Edit `~/.bajaclaw/profiles/default/config.json` to tighten.
133
41
 
134
- Top 3 (where score > 0) are injected into the system prompt as `# Active
135
- Skills`. See [`docs/skills.md`](docs/skills.md).
42
+ More: [docs/chat.md](docs/chat.md), [docs/commands.md](docs/commands.md).
136
43
 
137
- ### Self-knowledge (built-in guides)
44
+ ## What a cycle is
138
45
 
139
- BajaClaw knows how to configure itself. Ship 13 built-in skills describe
140
- the procedure for every integration - ask your agent in plain language:
46
+ One cycle: pop a task, recall memories, match skills, merge MCP, run `claude -p`, store the result, extract new memories.
141
47
 
142
- > "Help me set up Telegram."
143
- > "Walk me through connecting Discord."
144
- > "Switch to Opus for this profile."
145
- > "Turn on memory sync."
48
+ Full loop: [docs/architecture.md](docs/architecture.md).
146
49
 
147
- The matching skill (`setup-telegram`, `setup-discord`, `configure-model`,
148
- `setup-memory-sync`, …) fires, the agent sees the full procedure with
149
- Quick Reference / Procedure / Pitfalls / Verification sections, and walks
150
- you through it (running the right `bajaclaw` subcommands via Bash when
151
- useful).
50
+ ## Channels
152
51
 
153
- Run them directly from the CLI too:
52
+ Connect your agent to telegram or discord so you can chat from your phone.
154
53
 
155
54
  ```
156
- bajaclaw guide # list all guides
157
- bajaclaw guide telegram # print the telegram setup walkthrough
158
- bajaclaw guide mcp-port # print the MCP port walkthrough
55
+ bajaclaw channel add default telegram --token <BOT_TOKEN>
56
+ bajaclaw channel add default discord --token <BOT_TOKEN> --channel-id <ID>
159
57
  ```
160
58
 
161
- Built-in guides cover: `telegram`, `discord`, `heartbeat`, `daemon`,
162
- `dashboard`, `mcp-port`, `memory-sync`, `profile`, `self-update`,
163
- `uninstall`, `model`, `effort`, `tools`.
59
+ Images and videos in the chat get downloaded, video frames get extracted with ffmpeg, all of it gets attached to the task. On sonnet or opus cycles the agent sends a plan ack up front and milestone pings while it works, so you know it's actually doing the thing.
164
60
 
165
- ### Auto-generated skills
61
+ [docs/channels.md](docs/channels.md)
166
62
 
167
- After any cycle that uses 5+ tools (configurable), BajaClaw calls the
168
- backend once more to decide whether the procedure is worth saving. If yes,
169
- it writes a structured `SKILL.md` with When-to-use / Quick-reference /
170
- Procedure / Pitfalls / Verification sections into
171
- `~/.bajaclaw/skills/auto/<name>/` for review.
63
+ ## Skills
172
64
 
173
- This is BajaClaw's take on the "create a skill after a complex task"
174
- behavior from agents like Hermes - capture procedures the first time you
175
- solve them so repeats are faster.
176
-
177
- Candidates live in `auto/` until you promote them:
65
+ Drop a `SKILL.md` in `~/.bajaclaw/skills/<name>/`. The matcher picks it up on the next cycle and injects it into the prompt when the triggers hit. Compatible with the Claude Code skill format plus openclaw and hermes variants.
178
66
 
179
67
  ```
180
- bajaclaw skill review # print every candidate
181
- bajaclaw skill promote <name> # move candidate into user scope
68
+ bajaclaw skill install clawhub:<slug>
69
+ bajaclaw skill port # copy from ~/.claude/skills
70
+ bajaclaw skill new my-skill
182
71
  ```
183
72
 
184
- Tune the trigger in the profile's `config.json`:
73
+ Auto-generated skills land automatically after complex cycles and activate right away.
185
74
 
186
- ```json
187
- { "autoSkill": { "enabled": true, "minToolUses": 5, "maxPerDay": 10 } }
188
- ```
75
+ [docs/skills.md](docs/skills.md)
189
76
 
190
- ### MCP - isolated by default
77
+ ## MCP
191
78
 
192
- BajaClaw uses its own MCP config. The desktop CLI's `mcpServers` is **not**
193
- inherited by default. Merge order per cycle (highest wins):
79
+ BajaClaw is an MCP server and also consumes MCP.
194
80
 
195
- 1. `<profile>/agent-mcp-config.json`
196
- 2. `<profile>/mcp-config.json`
197
- 3. `~/.bajaclaw/mcp-config.json` (user-global BajaClaw)
198
- 4. Desktop CLI config - **only if `mergeDesktopMcp: true`** in the profile
81
+ As a server, it exposes your profiles, memories, cycles, and schedules as resources, plus tools for memory search, task create, agent status, and skill list. Auto-registers with Claude Desktop during `bajaclaw setup`.
199
82
 
200
- Port servers from Claude Code on demand:
83
+ As a consumer, it reads its own MCP config by default. Port servers from Claude Code on demand:
201
84
 
202
85
  ```
203
- bajaclaw mcp port --list # show what Claude Code has
204
- bajaclaw mcp port # copy every server into BajaClaw
205
- bajaclaw mcp port --names fs git # just these two
206
- bajaclaw mcp port --force # overwrite existing BajaClaw entries
86
+ bajaclaw mcp port --list
87
+ bajaclaw mcp port
88
+ bajaclaw mcp serve --stdio
207
89
  ```
208
90
 
209
- Or set `"mergeDesktopMcp": true` in a profile's config to inherit the
210
- desktop MCP list on every cycle (pre-0.4 behavior).
211
-
212
- BajaClaw's own MCP entry (`bajaclaw`) is skipped automatically during port
213
- to avoid self-references.
214
-
215
- ### MCP - expose
216
-
217
- BajaClaw is itself an MCP server. `bajaclaw setup` auto-registers it so your
218
- desktop MCP client (Claude Desktop and anything else that reads that config)
219
- can query BajaClaw's state directly.
91
+ [docs/integration.md](docs/integration.md)
220
92
 
221
- **Resources:**
93
+ ## OpenAI-compatible HTTP endpoint
222
94
 
223
- - `bajaclaw://profiles` - list of profiles
224
- - `bajaclaw://profile/<n>/agents`
225
- - `bajaclaw://profile/<n>/memories` - FTS5-searchable
226
- - `bajaclaw://profile/<n>/cycles` - recent cycle history
227
- - `bajaclaw://profile/<n>/schedules`
228
-
229
- **Tools:**
230
-
231
- - `bajaclaw_memory_search({ query, limit, profile })`
232
- - `bajaclaw_task_create({ agent, task, priority })`
233
- - `bajaclaw_agent_status({ agent })`
234
- - `bajaclaw_skill_list({ profile })`
235
-
236
- Which means: from any MCP client, you can ask "what does BajaClaw remember
237
- about X?" or "queue a task for the default agent" - without leaving your
238
- current session.
239
-
240
- Run it manually with `bajaclaw mcp serve --stdio` or as HTTP SSE with
241
- `bajaclaw mcp serve --port 8765`.
242
-
243
- ### Claude Code memory sync
244
-
245
- Set `memorySync: true` in the profile config and BajaClaw will:
246
-
247
- - Ingest new/modified files in `~/.claude/memory/` into its FTS table before
248
- each cycle
249
- - Write a digest to `~/.claude/memory/bajaclaw-<profile>.md` after each
250
- cycle, so Claude Code sessions can see what BajaClaw has been learning
251
-
252
- Disabled by default - memory sharing is deliberate, not automatic. See
253
- [`docs/memory.md`](docs/memory.md).
254
-
255
- ### Sub-agent delegation
256
-
257
- For heavy coding work, an agent using the `code` template plans and then
258
- delegates to a dedicated Claude Code sub-session via `delegateCoding` in
259
- [`src/delegation.ts`](src/delegation.ts). The orchestrator never writes code
260
- itself - that keeps its transcript reviewable before any code exists. See
261
- [`docs/integration.md`](docs/integration.md).
262
-
263
- ---
264
-
265
- ## First-run
95
+ Drive any OpenAI-compatible tool with your agent.
266
96
 
267
97
  ```
268
- bajaclaw start # runs a cycle against the default profile
269
- bajaclaw start --dry-run # shows the assembled prompt + exact argv
270
- bajaclaw dashboard # http://localhost:7337 - live cycle feed, memories
271
- bajaclaw daemon install # schedule a 15-minute heartbeat via your OS
272
- bajaclaw daemon start # supervisor loop with exponential backoff
273
- ```
274
-
275
- The default profile has **full tool access** - Read, Write, Edit, Bash,
276
- Grep, Glob, WebSearch, WebFetch, plus every MCP tool you've configured. It's
277
- a real autonomous agent, not a sandboxed assistant.
278
-
279
- To tighten it later, edit `~/.bajaclaw/profiles/default/config.json`:
280
-
281
- ```json
282
- {
283
- "name": "default",
284
- "template": "custom",
285
- "model": "auto",
286
- "effort": "medium",
287
- "maxTurns": 10,
288
- "allowedTools": ["Read", "Write", "Edit", "Bash"],
289
- "disallowedTools": []
290
- }
98
+ bajaclaw serve # localhost:8765
99
+ bajaclaw serve --api-key $(openssl rand -hex 32) # with auth
291
100
  ```
292
101
 
293
- ---
102
+ Works with Cursor, Open WebUI, LibreChat, LangChain, the `openai` SDK, anything that posts to `/v1/chat/completions`. The `model` field in the request is a profile name. Each request is a full cycle.
294
103
 
295
- ## Multiple agents (optional)
104
+ [docs/api.md](docs/api.md)
296
105
 
297
- The default profile is enough for most people. If you want more:
106
+ ## Multiple agents
298
107
 
299
108
  ```
300
109
  bajaclaw init researcher --template research
301
110
  bajaclaw init triage --template support
302
111
  bajaclaw init coder --template code
303
- ```
304
-
305
- Each gets its own DB, skills, schedule, logs. Switch between them with:
306
-
307
- ```
308
112
  bajaclaw start researcher
309
- BAJACLAW_PROFILE=triage bajaclaw daemon start
310
113
  ```
311
114
 
312
- **Templates:**
313
-
314
- | template | shape |
315
- |---|---|
316
- | `custom` | blank slate, full tools - the default |
317
- | `research` | research + synthesis + artifacts; full tools |
318
- | `outreach` | email prospecting + drafting |
319
- | `support` | inbox triage + reply drafts |
320
- | `social` | content drafting + scheduling |
321
- | `code` | orchestrator; delegates to a coding sub-agent (read-only itself) |
322
-
323
- ---
324
-
325
- ## Auto model (default)
115
+ Templates: `custom`, `research`, `outreach`, `support`, `social`, `code`. Each profile gets its own DB, skills, schedule, and logs.
326
116
 
327
- New profiles ship with `model: auto`. Before every cycle, BajaClaw
328
- classifies the task and routes it to the cheapest capable model:
117
+ [docs/agents.md](docs/agents.md)
329
118
 
330
- | tier | when it fires | context budget |
331
- |---|---|---|
332
- | **Haiku** | triage, status checks, heartbeats, very short tasks | 3 memories, 1 skill, 4 turns |
333
- | **Sonnet** | normal work, answers, summaries | 5 memories, 2 skills, 8 turns |
334
- | **Opus** | planning, coding, refactoring, deep research, reflection | 7 memories, 3 skills, 14 turns |
119
+ ## Auto model routing
335
120
 
336
- The classifier is a heuristic - zero extra backend calls for routing.
337
- Post-cycle memory extract + auto-skill synthesis are **skipped**
338
- entirely for Haiku cycles. This keeps cheap tasks cheap.
121
+ New profiles default to `model: auto`. Before each cycle, a heuristic routes the task:
339
122
 
340
- Override per profile:
341
-
342
- ```
343
- bajaclaw model # show current + list
344
- bajaclaw model auto # (default) route per task
345
- bajaclaw model claude-opus-4-7 # pin to a single model
346
- ```
347
-
348
- ## Use BajaClaw as an OpenAI-compatible HTTP endpoint
349
-
350
- ```
351
- bajaclaw serve # 127.0.0.1:8765, no auth
352
- bajaclaw serve --api-key $(openssl rand -hex 32) # with auth
353
- bajaclaw serve --host 0.0.0.0 --api-key <key> # bind all (auth required)
354
- ```
355
-
356
- Anything that speaks the OpenAI chat API - Cursor, Open WebUI, LibreChat,
357
- `openai` SDKs, curl, LangChain, LlamaIndex - can drive BajaClaw as an LLM.
358
- The request's `model` field is a profile name; each request is one full
359
- cycle (memory recall, skill matching, MCP inheritance, backend call,
360
- post-cycle extract).
361
-
362
- ```
363
- curl http://localhost:8765/v1/chat/completions \
364
- -H "Content-Type: application/json" \
365
- -d '{
366
- "model": "default",
367
- "messages": [{"role": "user", "content": "what is on my plate today"}]
368
- }'
369
- ```
370
-
371
- ```python
372
- from openai import OpenAI
373
- client = OpenAI(base_url="http://localhost:8765/v1", api_key="any")
374
- r = client.chat.completions.create(
375
- model="default",
376
- messages=[{"role": "user", "content": "hello"}],
377
- )
378
- print(r.choices[0].message.content)
379
- ```
380
-
381
- Endpoints: `GET /health`, `GET /v1/models`, `POST /v1/chat/completions`
382
- (non-stream + SSE), `POST /v1/bajaclaw/cycle` (native full `CycleOutput`),
383
- `POST /v1/bajaclaw/tasks` (enqueue without waiting). Non-localhost binds
384
- require `--api-key`. Full reference + client examples in
385
- [`docs/api.md`](docs/api.md). Guided setup: `bajaclaw guide api`.
386
-
387
- ---
388
-
389
- ## Auto-update
390
-
391
- BajaClaw checks the npm registry at most once per 24h. When a newer version
392
- is published, a one-line notice appears after any command:
393
-
394
- ```
395
- ╭──────────────────────────────────────────────────────────────╮
396
- │ update available 0.3.0 → 0.4.0 · run: bajaclaw update │
397
- ╰──────────────────────────────────────────────────────────────╯
398
- ```
399
-
400
- Commands:
401
-
402
- ```
403
- bajaclaw update --check # print delta, don't install
404
- bajaclaw update --yes # install immediately
405
- ```
406
-
407
- On a global npm install, update runs `npm install -g bajaclaw@latest`.
408
- On a git clone, it runs `git pull && npm install && npm run build`. Silence
409
- the notice with `BAJACLAW_NO_UPDATE_NOTICE=1`.
410
-
411
- ---
123
+ | tier | when |
124
+ |---|---|
125
+ | Haiku | triage, status checks, heartbeats, very short tasks |
126
+ | Sonnet | normal work, answers, summaries |
127
+ | Opus | planning, coding, refactoring, deep research |
412
128
 
413
- ## Setup / Reset / Uninstall
129
+ Zero extra backend calls for routing. Haiku cycles skip post-cycle memory extract and auto-skill synthesis to keep cheap tasks cheap.
414
130
 
415
131
  ```
416
- bajaclaw setup # idempotent bootstrap; safe to re-run
417
- bajaclaw setup --profile foo # use a different default profile name
418
- bajaclaw uninstall # dry-run - shows what would be removed
419
- bajaclaw uninstall --yes # actually tear everything down
420
- bajaclaw uninstall --yes --keep-data # remove integrations, keep ~/.bajaclaw/
132
+ bajaclaw model # show current
133
+ bajaclaw model claude-opus-4-7 # pin a model
134
+ bajaclaw model auto # back to routing
421
135
  ```
422
136
 
423
- `setup` is the re-run button. If the MCP registration gets knocked out of
424
- the desktop config, or the agent descriptor is missing, or you moved your
425
- home directory - `bajaclaw setup` fixes it all without touching existing
426
- data.
427
-
428
- `uninstall` tears down everything BajaClaw has created:
137
+ ## Memory
429
138
 
430
- - Stops any running daemons (via pid file)
431
- - Removes OS scheduler entries (launchd plist / systemd unit / crontab line
432
- / schtasks entry) for every profile
433
- - Removes `~/.claude/agents/<profile>/` dirs for every profile
434
- - Removes the `bajaclaw` MCP entry from every desktop MCP config it finds
435
- - Removes `~/.claude/memory/bajaclaw-*.md` sync files
436
- - Removes `~/.bajaclaw/` entirely (unless `--keep-data`)
139
+ Every cycle pulls the top 10 relevant memories via FTS5 full-text search and injects them into the prompt. Post-cycle, a fast haiku pass reads the (task, response) pair and writes 0-5 new facts.
437
140
 
438
- It does **not** `npm uninstall` itself - that's one command you still run by
439
- hand, printed at the end of the teardown.
141
+ Optional two-way sync with Claude Code memory via `memorySync: true` in `config.json`.
440
142
 
441
- ---
143
+ [docs/memory.md](docs/memory.md)
442
144
 
443
- ## What's in `~/.bajaclaw/`
145
+ ## Dashboard
444
146
 
445
147
  ```
446
- ~/.bajaclaw/
447
- ├── profiles/
448
- │ └── default/
449
- │ ├── config.json # name, template, model, tools, channels
450
- │ ├── bajaclaw.db # SQLite + FTS5
451
- │ ├── AGENT.md # operating guide (edited freely)
452
- │ ├── SOUL.md # identity / voice
453
- │ ├── HEARTBEAT.md # `<cron> | <task>` schedule entries
454
- │ ├── skills/ # profile-scoped skills
455
- │ ├── logs/YYYY-MM-DD.jsonl # 30-day rotation
456
- │ ├── mcp-config.json # profile MCP additions
457
- │ ├── .mcp-merged.json # regenerated each cycle
458
- │ └── daemon.pid / daemon.log # when daemon is running
459
- ├── skills/ # user-global skills
460
- │ └── auto/ # reflection-generated candidates
461
- └── .update-check.json # 24h update-check cache
462
- ```
463
-
464
- Every profile is self-contained. Delete one directory and that profile is
465
- gone. Back one up and you can restore it anywhere.
466
-
467
- ---
468
-
469
- ## Memory
470
-
471
- Every cycle queries an FTS5 virtual table over `memories.content` with the
472
- current task's terms; the top 10 matches land in the prompt as `# Recalled
473
- Memories`. After the cycle finishes, a 1-turn Haiku call reads the
474
- (task, response) pair and emits up to 5 structured facts as JSON:
475
-
476
- ```json
477
- {"memories": [
478
- {"kind": "decision", "content": "Use PostgreSQL 16 for the new service."},
479
- {"kind": "fact", "content": "Alice owns the billing pipeline."}
480
- ]}
148
+ bajaclaw dashboard
481
149
  ```
482
150
 
483
- Those facts become FTS-indexed rows with `source=cycle` and
484
- `source_cycle_id=<id>`. Next cycle, they're eligible for recall again.
151
+ Single HTML file at `http://localhost:7337`. Nine views: Overview, Chat, Cycles, Memory, Tasks, Schedules, Skills, Channels, Settings. Chat lives in-dashboard with full cycle metadata per message. Cycle rows are clickable and open a drawer with the prompt preview, response, model, cost, tokens, and timing.
485
152
 
486
- Kinds are a soft taxonomy - BajaClaw doesn't enforce them: `fact`,
487
- `decision`, `preference`, `todo`, `reference`, `claude-code`, `imported`.
153
+ Daemon auto-starts the dashboard when it boots. Change the port in `config.json`.
488
154
 
489
- Full detail: [`docs/memory.md`](docs/memory.md).
155
+ ## Safety
490
156
 
491
- ---
157
+ - Circuit breaker: 5 consecutive failed cycles open it for 15 minutes.
158
+ - Rate limit: 30 cycles/hour/profile.
159
+ - Cycle serialization: one `claude` subprocess per profile at a time.
160
+ - `bajaclaw start --dry-run` prints the full prompt and argv without executing.
161
+ - `bajaclaw uninstall` without `--yes` prints the teardown plan and changes nothing.
162
+ - Per-cycle USD cap via `maxBudgetUsd` in `config.json`.
163
+ - Per-cycle timeout via `cycleTimeoutMs` (default 10 min).
164
+ - No telemetry. The only outbound call on its own behalf is the once-per-24h update check to the npm registry.
492
165
 
493
- ## Channels (optional)
166
+ [docs/security.md](docs/security.md) · [docs/fair-use.md](docs/fair-use.md)
494
167
 
495
- BajaClaw ships optional adapters for **Telegram** and **Discord** bots.
496
- They're `optionalDependencies` - not installed unless you use them.
168
+ ## Setup, reset, uninstall
497
169
 
498
170
  ```
499
- bajaclaw channel add default telegram --token <BOT_TOKEN>
500
- bajaclaw channel add default discord --token <BOT_TOKEN> --channel-id <ID>
171
+ bajaclaw setup # safe to rerun; repairs integrations
172
+ bajaclaw uninstall # dry-run plan
173
+ bajaclaw uninstall --yes # actually tear down
174
+ bajaclaw uninstall --yes --keep-data # keep ~/.bajaclaw/, remove integrations
501
175
  ```
502
176
 
503
- Inbound messages (from an allowlist of sender IDs) are normalized into the
504
- tasks queue. The next cycle picks them up. Outbound replies route back
505
- through the same channel.
506
-
507
- Details + allowlist config: [`docs/channels.md`](docs/channels.md).
508
-
509
- Out of scope in v0.3: WhatsApp, Signal, iMessage, Slack, voice.
510
-
511
- ---
512
-
513
- ## Dashboard
177
+ ## On-disk layout
514
178
 
515
179
  ```
516
- bajaclaw dashboard
180
+ ~/.bajaclaw/
181
+ profiles/
182
+ default/
183
+ config.json # model, effort, tools, channels, timeouts, budgets
184
+ bajaclaw.db # SQLite + FTS5
185
+ AGENT.md # operating guide (edit freely)
186
+ SOUL.md # identity / voice
187
+ HEARTBEAT.md # schedule entries
188
+ skills/ # profile-scoped skills
189
+ logs/YYYY-MM-DD.jsonl
190
+ skills/ # user-global skills
191
+ mcp-config.json # user-global MCP servers
517
192
  ```
518
193
 
519
- Single HTML file served at `http://localhost:7337` (port in `config.json`).
520
- Dark theme, vanilla JS, Tailwind CDN. Live cycle feed, FTS-searchable
521
- memory browser, schedule editor, inbox/tasks list. Reads directly from the
522
- SQLite DB - no extra service.
523
-
524
- ---
525
-
526
- ## Safety + fair use
527
-
528
- BajaClaw is a thin wrapper around the `claude` CLI. It never sees your
529
- credentials, never calls the Anthropic API directly, and only uses
530
- documented CLI flags. See [`docs/fair-use.md`](docs/fair-use.md) for
531
- the full boundary story.
532
-
533
- Built-in guards:
534
-
535
- - **Circuit breaker**: 5 consecutive failed cycles open the breaker for 15
536
- minutes.
537
- - **Rate limiter**: 30 cycles/hour/profile by default.
538
- - **Cycle serialization**: at most one `claude` subprocess per profile at
539
- a time (see [`src/concurrency.ts`](src/concurrency.ts)). HTTP API hits
540
- queue instead of spawning parallel processes.
541
- - **Auto tier caps**: Haiku cycles use fewer memories/skills/turns than
542
- Sonnet, and Sonnet less than Opus. Small tasks stay small.
543
- - **Dry run**: `bajaclaw start --dry-run` prints the full prompt + exact
544
- argv without executing.
545
- - **Dry install**: `bajaclaw uninstall` without `--yes` prints the plan and
546
- changes nothing.
547
- - **No shell string concat**: every `execa` call uses an argv array with
548
- `shell: false`.
549
- - **Skill install requires confirmation**: `BAJACLAW_CONFIRM=yes` in env,
550
- full SKILL.md printed before writing.
551
- - **No telemetry**: the only outbound call BajaClaw makes on its own behalf
552
- is the once-per-24h update check to the npm registry.
553
-
554
- See [`docs/security.md`](docs/security.md) and
555
- [`docs/fair-use.md`](docs/fair-use.md).
556
-
557
- ---
558
-
559
- ## Command reference
560
-
561
- Full detail in [`docs/commands.md`](docs/commands.md). Summary:
194
+ ## Command cheat sheet
562
195
 
563
196
  | command | purpose |
564
197
  |---|---|
565
- | `setup` | idempotent first-run bootstrap; run anytime to repair integrations |
566
- | `uninstall` | full teardown (or `--keep-data` to keep your profiles) |
567
- | `init <name>` | scaffold an additional named profile |
568
- | `start [profile]` | run one cycle (auto-bootstraps default profile if missing) |
569
- | `dry-run [profile]` | print the assembled prompt + argv, no exec |
570
- | `status [profile]` | per-profile stats |
571
- | `health [profile]` | breaker + rate-limit state |
572
- | `doctor` | toolchain + backend verification |
573
- | `dashboard [profile]` | serve dashboard HTML |
574
- | `daemon` | supervisor loop (start/stop/status/logs/install/run/restart) |
575
- | `mcp` | consume + expose (list/add/remove/serve/register/port) |
576
- | `skill` | list/new/install/review/promote/port |
577
- | `profile` | list/create/switch/delete |
578
- | `channel` | add/remove/list telegram + discord bridges |
579
- | `trigger [profile] <event>` | enqueue a task |
580
- | `migrate [profile]` | import from a foreign profile dir |
581
- | `model [id] [profile]` | show/set the model (lists known if no id) |
582
- | `effort [level] [profile]` | show/set effort (low/medium/high) |
583
- | `guide [topic]` | print a built-in setup walkthrough |
198
+ | `chat` | interactive REPL |
199
+ | `start [profile]` | run one cycle |
200
+ | `dashboard` | serve HTTP UI |
201
+ | `daemon start/stop/status/logs/install` | background supervisor |
202
+ | `channel add/remove/list` | telegram + discord bridges |
203
+ | `skill install/port/new/review/promote` | skill lifecycle |
204
+ | `mcp port/serve/register/add/remove/list` | MCP consume + expose |
205
+ | `profile init/list/switch/delete` | manage profiles |
584
206
  | `serve` | OpenAI-compatible HTTP endpoint |
585
- | `update` | check for / install a newer version |
586
- | `banner` | print the ASCII banner |
587
-
588
- **Environment variables:**
589
-
590
- | var | effect |
591
- |---|---|
592
- | `BAJACLAW_PROFILE` | default profile when `[profile]` is omitted |
593
- | `BAJACLAW_DEFAULT_PROFILE` | override the "default" profile name |
594
- | `BAJACLAW_HOME` | override `~/.bajaclaw/` |
595
- | `CLAUDE_HOME` | override `~/.claude/` |
596
- | `BAJACLAW_DRY_RUN=1` | force all cycles to dry-run |
597
- | `BAJACLAW_VERBOSE=1` | mirror log events to stdout |
598
- | `BAJACLAW_CONFIRM=yes` | allow `skill install` to write |
599
- | `BAJACLAW_NO_UPDATE_NOTICE=1` | silence the post-command update notice |
600
-
601
- ---
602
-
603
- ## Architecture
604
-
605
- ```
606
- OS scheduler ┌──────────────────┐
607
- (launchd / ─────▶ │ agent cycle (13) │
608
- systemd / │ runOnce → CLI │
609
- cron / └─────┬────────────┘
610
- schtasks) │
611
-
612
- ┌───────────┐ ┌──────────────┐ ┌────────────┐
613
- │ dashboard │ ◀──│ SQLite (WAL) │ │ claude CLI │
614
- │ (HTML) │ │ + FTS5 │ ◀──│ subprocess │
615
- └───────────┘ └──────────────┘ │ --mcp │
616
- └─────┬──────┘
617
- ┌───────────┐ │
618
- │ desktop │ ┌─────▼──────┐
619
- │ MCP client│ ◀─── bajaclaw:// ◀──── │ MCP servers│
620
- └───────────┘ (resources + │ (inherited)│
621
- tools) └────────────┘
622
- ```
207
+ | `model / effort / guide` | per-profile knobs |
208
+ | `setup / uninstall / update / doctor` | lifecycle |
623
209
 
624
- Deeper in [`docs/architecture.md`](docs/architecture.md).
210
+ Full reference in [docs/commands.md](docs/commands.md).
625
211
 
626
- ---
212
+ Environment variables: `BAJACLAW_PROFILE`, `BAJACLAW_HOME`, `CLAUDE_HOME`, `BAJACLAW_DRY_RUN`, `BAJACLAW_VERBOSE`, `BAJACLAW_NO_UPDATE_NOTICE`.
627
213
 
628
214
  ## Docs
629
215
 
630
- - [`architecture.md`](docs/architecture.md) - module map, cycle, on-disk layout
631
- - [`integration.md`](docs/integration.md) - Claude Code + MCP seams in detail
632
- - [`commands.md`](docs/commands.md) - full command reference
633
- - [`agents.md`](docs/agents.md) - profiles, templates, AGENT.md / SOUL.md / HEARTBEAT.md
634
- - [`skills.md`](docs/skills.md) - scoping, matching, self-generated skills
635
- - [`memory.md`](docs/memory.md) - FTS5 recall + extract, cross-tool sync
636
- - [`heartbeat.md`](docs/heartbeat.md) - scheduling + supervisor
637
- - [`channels.md`](docs/channels.md)
638
- - [`api.md`](docs/api.md) - OpenAI-compatible HTTP endpoint - Telegram + Discord
639
- - [`security.md`](docs/security.md) - threat model + mitigations
640
- - [`fair-use.md`](docs/fair-use.md) - how BajaClaw stays a thin wrapper
641
- - [`troubleshooting.md`](docs/troubleshooting.md) - common fixes
642
- - [`faq.md`](docs/faq.md) - frequently asked
643
- - [`contributing.md`](docs/contributing.md) - dev setup, style, release
644
-
645
- ---
216
+ - [Architecture](docs/architecture.md)
217
+ - [Commands](docs/commands.md)
218
+ - [Agents and profiles](docs/agents.md)
219
+ - [Chat REPL](docs/chat.md)
220
+ - [Skills](docs/skills.md)
221
+ - [Memory](docs/memory.md)
222
+ - [Heartbeat and scheduling](docs/heartbeat.md)
223
+ - [Channels (telegram + discord)](docs/channels.md)
224
+ - [HTTP API](docs/api.md)
225
+ - [Subagents](docs/subagents.md)
226
+ - [Compaction](docs/compaction.md)
227
+ - [Integration with Claude Code](docs/integration.md)
228
+ - [Security](docs/security.md)
229
+ - [Fair use](docs/fair-use.md)
230
+ - [Troubleshooting](docs/troubleshooting.md)
231
+ - [FAQ](docs/faq.md)
232
+ - [Contributing](docs/contributing.md)
646
233
 
647
234
  ## License
648
235
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bajaclaw",
3
- "version": "0.14.19",
3
+ "version": "0.14.20",
4
4
  "description": "BajaClaw - autonomous agents on your terms",
5
5
  "type": "module",
6
6
  "bajaclaw": {