botnote 0.2.15 → 0.2.17

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 (138) hide show
  1. package/README.md +26 -506
  2. package/dist/bin.js +28 -21
  3. package/dist/bin.js.map +1 -1
  4. package/dist/config.d.ts +0 -4
  5. package/dist/config.js +0 -31
  6. package/dist/config.js.map +1 -1
  7. package/dist/mcp/http-client.d.ts +6 -5
  8. package/dist/mcp/http-client.js +28 -4
  9. package/dist/mcp/http-client.js.map +1 -1
  10. package/dist/mcp/server.js +16 -16
  11. package/dist/mcp/server.js.map +1 -1
  12. package/dist/mcp/stdio.d.ts +8 -0
  13. package/dist/mcp/stdio.js +46 -0
  14. package/dist/mcp/stdio.js.map +1 -0
  15. package/package.json +8 -40
  16. package/dist/cli.d.ts +0 -1
  17. package/dist/cli.js +0 -186
  18. package/dist/cli.js.map +0 -1
  19. package/dist/db/client.d.ts +0 -14
  20. package/dist/db/client.js +0 -16
  21. package/dist/db/client.js.map +0 -1
  22. package/dist/db/migrate.d.ts +0 -1
  23. package/dist/db/migrate.js +0 -57
  24. package/dist/db/migrate.js.map +0 -1
  25. package/dist/db/migrations/0001_init.sql +0 -89
  26. package/dist/db/migrations/0002_tasks_due_at.sql +0 -16
  27. package/dist/db/migrations/0003_task_priority_and_sequence.sql +0 -45
  28. package/dist/db/migrations/0004_pinned.sql +0 -8
  29. package/dist/db/migrations/0005_nullable_title_and_parent.sql +0 -5
  30. package/dist/db/migrations/0006_project_color_icon.sql +0 -3
  31. package/dist/db/migrations/0007_tokens.sql +0 -14
  32. package/dist/db/migrations/0008_simplify_kinds_drop_actors.sql +0 -21
  33. package/dist/db/migrations/0009_sessions.sql +0 -14
  34. package/dist/db/migrations/0010_completed_at.sql +0 -17
  35. package/dist/db/migrations/0011_completed_at_backfill_fix.sql +0 -14
  36. package/dist/db/migrations/0012_completed_at_backfill_due.sql +0 -16
  37. package/dist/db/migrations/0013_due_at_noon_utc.sql +0 -13
  38. package/dist/db/migrations/0014_recoverable_api_tokens.sql +0 -3
  39. package/dist/db/migrations/0015_collapse_delayed_archived_statuses.sql +0 -18
  40. package/dist/db/migrations/0016_embedding_settings.sql +0 -23
  41. package/dist/db/migrations/0017_recurrence_rules.sql +0 -55
  42. package/dist/db/migrations/0018_project_archived_at.sql +0 -8
  43. package/dist/db/migrations/0019_project_status.sql +0 -20
  44. package/dist/db/migrations/0020_project_archived_status.sql +0 -20
  45. package/dist/db/migrations/0021_workspace_settings.sql +0 -18
  46. package/dist/db/migrations/0022_recurrence_split.sql +0 -13
  47. package/dist/db/migrations/0023_comment_kind.sql +0 -24
  48. package/dist/db/migrations/0024_memory_access.sql +0 -12
  49. package/dist/db/migrations/0025_soft_delete.sql +0 -12
  50. package/dist/db/migrations/0026_sequence_counter.sql +0 -61
  51. package/dist/db/migrations/0027_self_parent_repair.sql +0 -10
  52. package/dist/db/migrations/0028_workspaces.sql +0 -65
  53. package/dist/db/migrations/0029_drop_global_uniques.sql +0 -38
  54. package/dist/db/migrations/0030_entity_actor_token.sql +0 -12
  55. package/dist/db/migrations/0031_entity_revisions.sql +0 -19
  56. package/dist/db/migrations/0032_touch_respects_explicit_updated_at.sql +0 -18
  57. package/dist/db/schema.d.ts +0 -2023
  58. package/dist/db/schema.js +0 -245
  59. package/dist/db/schema.js.map +0 -1
  60. package/dist/rest/attribution.d.ts +0 -22
  61. package/dist/rest/attribution.js +0 -62
  62. package/dist/rest/attribution.js.map +0 -1
  63. package/dist/rest/auth.d.ts +0 -47
  64. package/dist/rest/auth.js +0 -116
  65. package/dist/rest/auth.js.map +0 -1
  66. package/dist/rest/routes.d.ts +0 -3
  67. package/dist/rest/routes.js +0 -831
  68. package/dist/rest/routes.js.map +0 -1
  69. package/dist/rest/server.d.ts +0 -28
  70. package/dist/rest/server.js +0 -276
  71. package/dist/rest/server.js.map +0 -1
  72. package/dist/service/blockers.d.ts +0 -37
  73. package/dist/service/blockers.js +0 -46
  74. package/dist/service/blockers.js.map +0 -1
  75. package/dist/service/dates.d.ts +0 -19
  76. package/dist/service/dates.js +0 -52
  77. package/dist/service/dates.js.map +0 -1
  78. package/dist/service/embedding.d.ts +0 -75
  79. package/dist/service/embedding.js +0 -318
  80. package/dist/service/embedding.js.map +0 -1
  81. package/dist/service/embedding_settings.d.ts +0 -16
  82. package/dist/service/embedding_settings.js +0 -82
  83. package/dist/service/embedding_settings.js.map +0 -1
  84. package/dist/service/entities.d.ts +0 -96
  85. package/dist/service/entities.js +0 -628
  86. package/dist/service/entities.js.map +0 -1
  87. package/dist/service/feedback.d.ts +0 -13
  88. package/dist/service/feedback.js +0 -50
  89. package/dist/service/feedback.js.map +0 -1
  90. package/dist/service/hierarchy.d.ts +0 -31
  91. package/dist/service/hierarchy.js +0 -76
  92. package/dist/service/hierarchy.js.map +0 -1
  93. package/dist/service/index.d.ts +0 -10
  94. package/dist/service/index.js +0 -10
  95. package/dist/service/index.js.map +0 -1
  96. package/dist/service/locks.d.ts +0 -25
  97. package/dist/service/locks.js +0 -34
  98. package/dist/service/locks.js.map +0 -1
  99. package/dist/service/opening_brief.d.ts +0 -24
  100. package/dist/service/opening_brief.js +0 -210
  101. package/dist/service/opening_brief.js.map +0 -1
  102. package/dist/service/projects.d.ts +0 -9
  103. package/dist/service/projects.js +0 -59
  104. package/dist/service/projects.js.map +0 -1
  105. package/dist/service/recurrence.d.ts +0 -93
  106. package/dist/service/recurrence.js +0 -799
  107. package/dist/service/recurrence.js.map +0 -1
  108. package/dist/service/revisions.d.ts +0 -31
  109. package/dist/service/revisions.js +0 -53
  110. package/dist/service/revisions.js.map +0 -1
  111. package/dist/service/scope.d.ts +0 -14
  112. package/dist/service/scope.js +0 -19
  113. package/dist/service/scope.js.map +0 -1
  114. package/dist/service/search.d.ts +0 -34
  115. package/dist/service/search.js +0 -198
  116. package/dist/service/search.js.map +0 -1
  117. package/dist/service/sessions.d.ts +0 -24
  118. package/dist/service/sessions.js +0 -89
  119. package/dist/service/sessions.js.map +0 -1
  120. package/dist/service/tasks.d.ts +0 -48
  121. package/dist/service/tasks.js +0 -354
  122. package/dist/service/tasks.js.map +0 -1
  123. package/dist/service/tokens.d.ts +0 -21
  124. package/dist/service/tokens.js +0 -71
  125. package/dist/service/tokens.js.map +0 -1
  126. package/dist/service/transfer.d.ts +0 -64
  127. package/dist/service/transfer.js +0 -629
  128. package/dist/service/transfer.js.map +0 -1
  129. package/dist/service/types.d.ts +0 -770
  130. package/dist/service/types.js +0 -272
  131. package/dist/service/types.js.map +0 -1
  132. package/dist/service/workspace_settings.d.ts +0 -9
  133. package/dist/service/workspace_settings.js +0 -49
  134. package/dist/service/workspace_settings.js.map +0 -1
  135. package/web/dist/assets/index-C0u0ZrR4.css +0 -1
  136. package/web/dist/assets/index-CwZxw-xa.js +0 -235
  137. package/web/dist/favicon.svg +0 -13
  138. package/web/dist/index.html +0 -22
package/README.md CHANGED
@@ -1,537 +1,57 @@
1
1
  # botnote
2
2
 
3
- Notion for bots. A single binary that stores projects, tasks, notes, and agent memory — and exposes them to AI agents via MCP and REST.
3
+ Command-line client and MCP stdio server for [botnote](https://botnote.net),
4
+ the agent-first task + memory store.
4
5
 
5
- ## Why
6
+ This package only talks to a botnote daemon over HTTP. The daemon itself ships
7
+ separately as [`botnote-server`](https://www.npmjs.com/package/botnote-server).
6
8
 
7
- Agents work best with one stable, queryable, write-friendly source of truth — not a stack of Notion + Jira + Slack + scratch files. botnote is that source of truth, scoped to one user, deployable in 60 seconds.
8
-
9
- Three things only:
10
-
11
- 1. **Project management** — projects and tasks with status, priority, due dates, and stable identifiers.
12
- 2. **Note-taking** — free-form Markdown notes, tagged, searchable, and optionally pinned.
13
- 3. **Memory for agents** — hybrid retrieval (BM25 + vector + time decay), opening brief auto-bundles AGENTS.md + recent context.
14
-
15
- ## Design
16
-
17
- - Storage: Postgres + pgvector + tsvector. Single dedicated docker container.
18
- - Single multi-kind entity table — `task / note` discriminated by `kind` column.
19
- - Search: hybrid retrieval — tsvector BM25 + pgvector cosine + time decay, merged via Reciprocal Rank Fusion (k=60).
20
- - Embeddings: OpenAI `text-embedding-3-small` at 384 dimensions, written asynchronously. Falls back to BM25-only if no API key.
21
- - API: MCP server (stdio) + REST API (Fastify on `:4280`) over a shared service layer.
22
- - Every write records `actorKind` (human / agent / system); `idempotencyKey` is supported on writes.
23
- - All MCP tools carry `2025-03-26` annotations: `readOnlyHint`, `idempotentHint`, `destructiveHint`, `openWorldHint`.
24
-
25
- ## Quick start
26
-
27
- Requires: Node 20+, pnpm, Docker.
28
-
29
- ### CLI install
30
-
31
- On client machines, install the portable CLI from npm:
9
+ ## Install
32
10
 
33
11
  ```bash
34
12
  npm i -g botnote
35
13
  botnote login
36
14
  ```
37
15
 
38
- `botnote login` stores the daemon URL and bearer token in
39
- `~/.config/botnote/config.json`. The default URL is `http://127.0.0.1:4280`, the
40
- daemon on the same machine, which needs no token. From another machine enter
41
- your instance's URL (for example `https://botnote.example.com`) plus a token
42
- from Settings -> API tokens. Every client surface (CLI, MCP server, plugins)
43
- shares that one default; nothing ever falls back to a third-party host. New API tokens remain copyable from Settings; tokens
44
- created before recoverable storage was added only show their prefix and should
45
- be regenerated if the full value was lost.
46
-
47
- Security note: newly-created API tokens are stored recoverably in the database
48
- so Settings can copy them later. Treat the database and backups as
49
- secret-bearing material, and revoke tokens if either is exposed.
50
-
51
- ### Authentication
16
+ `botnote login` stores the daemon URL and an optional bearer token in
17
+ `~/.config/botnote/config.json`. The default URL is `http://127.0.0.1:4280`, a
18
+ daemon on the same machine, which needs no token. `BOTNOTE_URL` and
19
+ `BOTNOTE_TOKEN` override the saved values.
52
20
 
53
- Auth is enforced when `BOTNOTE_REQUIRE_AUTH=1`, or when `BOTNOTE_PASSWORD` is
54
- set and the flag is left unset. Every `/v1/*` request then needs a bearer token
55
- (`Authorization: Bearer bn_...`) or the session cookie from the web login. The
56
- one exception is a direct connection from the daemon host itself: loopback
57
- callers need no token, so the local CLI and plugins keep working with zero
58
- config. The decision is made on the TCP peer address, never on headers, so
59
- binding `BOTNOTE_HOST=0.0.0.0` on a LAN or VPS does not open the API.
60
-
61
- | Var | Default | Meaning |
62
- |-----|---------|---------|
63
- | `BOTNOTE_REQUIRE_AUTH` | `1` if `BOTNOTE_PASSWORD` is set, else `0` | Enforce cookie/bearer on `/v1/*` |
64
- | `BOTNOTE_TRUST_LOCALHOST` | `1` | `0` makes loopback callers present a credential too |
65
- | `BOTNOTE_TRUST_PROXY` | `loopback` | Peers whose `x-forwarded-for` / `cf-connecting-ip` are believed: `loopback`, an IP, or an IPv4 CIDR, comma-separated |
66
-
67
- Behind Cloudflare Tunnel, nginx or Caddy on the same host the defaults are
68
- right. If the proxy runs on another machine, list its address in
69
- `BOTNOTE_TRUST_PROXY`; otherwise its forwarded headers are ignored and rate
70
- limiting keys on the proxy itself.
71
-
72
- The Claude Code, Codex, and Cursor plugins call `botnote mcp`, so installing
73
- the npm package is enough for plugin runtime on machines that do not have a
74
- botnote source checkout.
75
-
76
- ### CLI commands
77
-
78
- Read:
79
-
80
- ```bash
81
- botnote projects # all projects
82
- botnote today # today + overdue
83
- botnote tasks --status open
84
- botnote search "backup policy"
85
- ```
86
-
87
- Write — every command takes a `KEY-SEQ` identifier (`OPS-12`, case-insensitive)
88
- or a UUID:
21
+ ## Use
89
22
 
90
23
  ```bash
24
+ botnote today # today + overdue tasks
91
25
  botnote task "Rotate the staging certs" --project OPS --due 2026-10-01
92
- botnote note "Staging certs expire yearly on Oct 1" --project OPS --pin
93
-
94
- botnote update OPS-12 --status in_progress --priority high
95
- botnote update OPS-12 --due 2026-10-08 # or --due none to clear it
96
- botnote update OPS-12 --title "..." --project INFRA --tags certs,staging
97
-
98
- botnote comment OPS-12 "Renewed staging, prod still pending"
99
- botnote done OPS-12 --comment "Both environments renewed"
100
- ```
101
-
102
- `--status` accepts `open`, `in_progress`, `done`, `rejected`; `--priority`
103
- accepts `urgent`, `high`, `medium`, `low`, `none`. A date-only `--due` is
104
- stored at noon UTC so it reads as the same day in every timezone.
105
-
106
- ### Local daemon development
107
-
108
- ```bash
109
- # 1. Spin up postgres (port 55434, pgvector extension)
110
- docker compose up -d
111
-
112
- # 2. Install deps
113
- pnpm install
114
-
115
- # 3. Apply schema
116
- DATABASE_URL=postgres://botnote:botnote@127.0.0.1:55434/botnote pnpm db:migrate
117
-
118
- # 4. Boot REST + Swagger UI
119
- DATABASE_URL=postgres://botnote:botnote@127.0.0.1:55434/botnote pnpm dev
120
- ```
121
-
122
- Then:
123
-
124
- - REST API: <http://localhost:4280>
125
- - Swagger UI: <http://localhost:4280/docs>
126
- - OpenAPI JSON: <http://localhost:4280/docs/json>
127
-
128
- Embeddings are optional. Set `OPENAI_API_KEY` to enable hybrid (BM25 + cosine) search; without it, search is BM25-only.
129
-
130
- ### Tests
131
-
132
- Tests must run against a disposable database whose name contains `test`. The
133
- helper refuses any other database name so local test runs do not touch a live
134
- botnote instance.
135
-
136
- ```bash
137
- docker compose up -d
138
- docker exec botnote-postgres createdb -U botnote botnote_test || true
139
-
140
- DATABASE_URL=postgres://botnote:botnote@127.0.0.1:55434/botnote_test pnpm db:migrate
141
- BOTNOTE_TEST_DATABASE_URL=postgres://botnote:botnote@127.0.0.1:55434/botnote_test pnpm test
142
- ```
143
-
144
- ### Releasing
145
-
146
- Releases publish from CI. Bump the version and push the tag:
147
-
148
- ```bash
149
- pnpm version patch -m "Release %s" # bumps package.json + every plugin manifest, commits, tags
150
- git push --follow-tags
151
- ```
152
-
153
- The `v*` tag triggers `.github/workflows/publish-npm.yml`, which typechecks,
154
- runs the full test suite, builds, and publishes to npm through OIDC trusted
155
- publishing. No npm token is involved, and `npm publish` should never be run
156
- from a developer machine — a local publish will fail, and npm reports that
157
- failure as a misleading `404 Not Found - PUT`.
158
-
159
- Check a release with `gh run list --workflow=publish-npm.yml` and
160
- `npm view botnote version`. The registry manifest updates a few minutes before
161
- the tarball finishes reaching the CDN, so a brief `npx botnote@<version>` 404
162
- right after a successful publish is expected.
163
-
164
- Updating the daemon on a host is separate from releasing:
165
-
166
- ```bash
167
- pnpm build && launchctl kickstart -k gui/$(id -u)/com.botnote.daemon
168
- ```
169
-
170
- ## REST endpoints
171
-
172
- Project status values are `planned`, `active`, `watching`, `paused`, and
173
- `archived`. `archivedAt` records when a project entered the archived status.
174
-
175
- | method | path | summary |
176
- |---|---|---|
177
- | `POST` | `/v1/projects` | Create project |
178
- | `GET` | `/v1/projects` | List non-archived projects (`?includeArchived=true` includes archived) |
179
- | `GET` | `/v1/projects/:id` | Fetch project |
180
- | `PATCH` | `/v1/projects/:id` | Update project status or metadata |
181
- | `GET` | `/v1/projects/by-key/:key` | Fetch by key |
182
- | `POST` | `/v1/projects/:id/opening-brief` | Opening brief |
183
- | `POST` | `/v1/opening-brief` | Workspace or project opening brief |
184
- | `POST` | `/v1/tasks` | Create task |
185
- | `POST` | `/v1/tasks/:id/recurrence` | Configure task recurrence |
186
- | `GET` | `/v1/tasks/:id/recurrence` | Fetch task recurrence |
187
- | `PATCH` | `/v1/recurrences/:id` | Update recurrence rule |
188
- | `POST` | `/v1/tasks/:id/skip-occurrence` | Skip current recurring occurrence |
189
- | `POST` | `/v1/recurrences/:id/stop` | Stop recurrence series |
190
- | `POST` | `/v1/notes` | Create note |
191
- | `GET` | `/v1/entities/:id` | Fetch entity |
192
- | `GET` | `/v1/projects/by-key/:key/entities/by-seq/:seq` | Fetch entity by identifier (e.g. `DEMO-12`) |
193
- | `PATCH` | `/v1/entities/:id` | Update entity |
194
- | `DELETE` | `/v1/entities/:id` | Delete entity |
195
- | `GET` | `/v1/entities/:id/related` | List related entities |
196
- | `POST` | `/v1/entities/:id/links` | Link entity to another |
197
- | `POST` | `/v1/recent` | Recent activity |
198
- | `POST` | `/v1/search` | Hybrid search |
199
- | `POST` | `/v1/tasks/range` | Scheduled, overdue, and backlog tasks |
200
- | `GET` | `/v1/settings/embedding` | Embedding provider/model/key status + vector coverage |
201
- | `PATCH` | `/v1/settings/embedding` | Update embedding provider/model/key settings |
202
- | `POST` | `/v1/settings/embedding/backfill` | Queue missing embeddings for existing rows |
203
- | `GET` | `/v1/tokens` | List API tokens |
204
- | `POST` | `/v1/tokens` | Create API token |
205
- | `DELETE` | `/v1/tokens/:id` | Revoke API token |
206
- | `GET` | `/v1/export` | Stream the workspace as JSON Lines (`?vectors=1` includes embeddings) |
207
- | `POST` | `/v1/import` | Load a JSON Lines dump (`content-type: application/x-ndjson`); returns an import report |
208
- | `POST` | `/v1/auth/login` | Master-password login; sets httpOnly session cookie |
209
- | `POST` | `/v1/auth/logout` | Clear session cookie and revoke the session |
210
- | `GET` | `/v1/auth/whoami` | Confirm auth state and how the caller authenticated |
211
- | `GET` | `/health` | Health check |
212
-
213
- Schemas: see `/docs` (Swagger UI) or `/docs/json` (OpenAPI 3).
214
-
215
- ### Example: create a project + write a task + search
216
-
217
- ```bash
218
- A=http://localhost:4280
219
-
220
- PID=$(curl -s -X POST $A/v1/projects \
221
- -H 'content-type: application/json' \
222
- -d '{"key":"DEMO","name":"Demo","agentsMd":"ALWAYS run tests"}' \
223
- | jq -r .id)
224
-
225
- curl -s -X POST $A/v1/tasks \
226
- -H 'content-type: application/json' \
227
- -d "{\"projectId\":\"$PID\",\"title\":\"Ship botnote v1\",\"actorKind\":\"human\"}"
228
-
229
- curl -s -X POST $A/v1/search \
230
- -H 'content-type: application/json' \
231
- -d "{\"query\":\"ship\",\"projectId\":\"$PID\"}"
232
- ```
233
-
234
- ### Recurring tasks
235
-
236
- Recurring tasks are normal task rows plus a recurrence rule. Configure a first
237
- dated task, then attach a rule. Completing the current occurrence generates the
238
- next occurrence idempotently.
239
-
240
- Scheduled recurrences are also materialized by the REST daemon through the end
241
- of the current day at startup and on a short background interval, so daily
242
- tasks and fixed meetings appear even when nobody opens the calendar first.
243
- Future occurrences beyond today are not pre-created; calendar previews should
244
- stay virtual so sequence numbers are only assigned to real task rows.
245
-
246
- ```bash
247
- botnote task "Attend weekly lab meeting" \
248
- --project LAB \
249
- --due 2026-06-26 \
250
- --repeat weekly \
251
- --on FR \
252
- --anchor scheduled
253
-
254
- botnote task "Review backups" \
255
- --project OPS \
256
- --due 2026-06-26 \
257
- --repeat monthly \
258
- --anchor completion
259
-
260
- botnote recurrence OPS-12
261
- botnote skip OPS-12 --reason "holiday"
262
- botnote stop-recurrence OPS-12
263
- ```
264
-
265
- Use `scheduled` for calendar-like events, meetings, and fixed routines. Use
266
- `completion` for maintenance work where the next due date should be calculated
267
- from when the previous occurrence was actually completed.
268
-
269
- ## Your data
270
-
271
- Everything in a workspace can leave as one JSON Lines file and come back
272
- without loss: UUIDs, `KEY-SEQ` numbers, timestamps, who wrote what, links
273
- between items, recurrence rules, edit history and the trash.
274
-
275
- ```bash
276
- botnote export --out backup.jsonl # projects, entities, edges, rules, history, settings
277
- botnote export --vectors --out full.jsonl # also the embeddings (large; skipped by default)
278
- botnote import backup.jsonl # into the daemon that `botnote whoami` points at
279
- ```
280
-
281
- The first line is a header (`formatVersion`, `botnoteVersion`, `exportedAt`,
282
- source workspace); every other line is one record whose `type` names its
283
- table. Records are written in dependency order, so both commands stream and
284
- never hold the whole dump in memory.
285
-
286
- Importing is idempotent: a record whose id already exists is skipped, so a
287
- partial import can be re-run. Rows owned by another workspace, projects whose
288
- key is already taken, or children whose parent is missing are reported as
289
- conflicts and left out instead of aborting the import (the CLI exits 3 when
290
- there were any). Entities that arrive without a vector are re-embedded in the
291
- background. API tokens and the embedding API key are never exported.
292
-
293
- ## Plugin
294
-
295
- The plugin bundles the MCP server, workflow skills/commands, and a curator
296
- subagent. All workflows route through MCP, so no separate task or memory MCP
297
- setup is required.
298
-
299
- Prefer the plugin installs below: they bundle MCP wiring (URL/token prompts)
300
- and skills in one step. The skills CLI at the end of this section is a
301
- skills-only fallback for agents without a plugin system.
302
-
303
- ### Claude Code
304
-
305
- ```text
306
- # In Claude Code
307
- /plugin marketplace add botnote-dev/botnote
308
- /plugin install botnote@botnote
309
-
310
- # Claude Code will prompt for:
311
- # botnote_url -> leave empty on the daemon host (http://127.0.0.1:4280);
312
- # elsewhere your instance URL, e.g. https://botnote.example.com
313
- # botnote_token -> bearer from Settings -> API tokens; skip on loopback
314
- ```
315
-
316
- Slash commands:
317
-
318
- ```text
319
- /botnote:today # today + overdue
320
- /botnote:remember "..." # capture a note via MCP
321
- /botnote:recall "..." # hybrid search
322
- /botnote:start-work DEMO-12 # pick up a task with project context
323
- /botnote:done # mark current focus done
324
- /botnote:add-task "..." # capture a task without starting it
325
- /botnote:show-todo # workspace task/context summary
326
- ```
327
-
328
- Plugin distribution lives at
329
- [botnote-dev/botnote](https://github.com/botnote-dev/botnote). The MCP server
330
- inside the plugin uses the URL + token from the install prompt. A global
331
- `botnote` CLI install is optional: the plugin runs `npx -y botnote@<plugin-version> mcp`
332
- when no matching local CLI is available.
333
-
334
- ### Codex
335
-
336
- Add the plugin through `/settings -> plugin` in Codex, or add this marketplace
337
- from the public repository without a full source checkout:
338
-
339
- ```bash
340
- codex plugin marketplace add https://github.com/botnote-dev/botnote.git \
341
- --sparse .agents/plugins \
342
- --sparse plugins/botnote
343
-
344
- codex plugin add botnote@botnote-plugins
345
- ```
346
-
347
- The sparse checkout must include `.agents/plugins`, because Codex discovers the
348
- marketplace manifest from `.agents/plugins/marketplace.json`.
349
-
350
- For local plugin development, add this marketplace entry to
351
- `.agents/plugins/marketplace.json` in the repo:
352
-
353
- ```json
354
- {
355
- "name": "botnote-plugins",
356
- "interface": { "displayName": "botnote Plugins" },
357
- "plugins": [
358
- {
359
- "name": "botnote",
360
- "source": { "source": "local", "path": "./plugins/botnote" },
361
- "policy": { "installation": "AVAILABLE", "authentication": "ON_INSTALL" },
362
- "category": "Productivity"
363
- }
364
- ]
365
- }
366
- ```
367
-
368
- Then install/enable from the Codex plugin UI, or use:
369
-
370
- ```bash
371
- codex plugin marketplace add .
372
- codex plugin add botnote@botnote-plugins
373
- ```
374
-
375
- For synced Codex settings, include this in `~/.codex/config.toml` or the
376
- rendered config template:
377
-
378
- ```toml
379
- [plugins."botnote@botnote-plugins"]
380
- enabled = true
381
-
382
- [marketplaces.botnote-plugins]
383
- source_type = "local"
384
- source = "/absolute/path/to/botnote"
385
- ```
386
-
387
- The Codex plugin starts `./scripts/run-mcp.sh`. It reads
388
- `~/.config/botnote/config.json` when available, otherwise leaves the URL to the
389
- CLI default (`http://127.0.0.1:4280`), uses a matching `botnote` CLI from PATH
390
- when present, and otherwise runs the exact plugin version with
391
- `npx -y botnote@<plugin-version> mcp`. Set `BOTNOTE_URL` and `BOTNOTE_TOKEN`
392
- when the daemon runs on another machine.
393
-
394
- ### Cursor
395
-
396
- Cursor-compatible plugin metadata lives in `.cursor-plugin/marketplace.json`.
397
- The marketplace points at the same `plugins/botnote` bundle, so Cursor gets the
398
- same MCP server and workflow skills without a second plugin implementation.
399
-
400
- ```bash
401
- # Marketplace root for Cursor plugin clients:
402
- https://github.com/botnote-dev/botnote
403
- ```
404
-
405
- The Cursor plugin manifest is `plugins/botnote/.cursor-plugin/plugin.json` and
406
- uses the same `botnote_url` / `botnote_token` settings as the Claude Code
407
- plugin.
408
-
409
- ### Skills-only fallback: skills CLI
410
-
411
- For agents without a plugin system, the
412
- [skills CLI](https://github.com/vercel-labs/skills) can install the workflow
413
- skills into 70+ agents:
414
-
415
- ```bash
416
- npx skills add botnote-dev/botnote # install all 7 skills
417
- npx skills update # refresh to the latest version later
418
- npx skills list # see what is installed where
419
- ```
420
-
421
- The skills CLI installs `SKILL.md` files only — it does not set up the botnote
422
- MCP server the skills depend on.
423
- Wire up the MCP server once per machine:
424
-
425
- ```bash
426
- # Claude Code
427
- claude mcp add botnote \
428
- -e BOTNOTE_URL=https://botnote.example.com \
429
- -e BOTNOTE_TOKEN=<token from Settings -> API tokens> \
430
- -- npx -y botnote mcp
431
-
432
- # Codex
433
- codex mcp add botnote \
434
- --env BOTNOTE_URL=https://botnote.example.com \
435
- --env BOTNOTE_TOKEN=<token> \
436
- -- npx -y botnote mcp
26
+ botnote worklog OPS-12 "Renewed staging, prod still pending"
27
+ botnote done OPS-12 --worklog "Both environments renewed"
28
+ botnote search "backup policy"
29
+ botnote --help # every command
437
30
  ```
438
31
 
439
- On the daemon host drop both env vars: the default is `http://127.0.0.1:4280`
440
- and loopback needs no token.
32
+ ## MCP
441
33
 
442
- ### Known limitation: restart sessions after a plugin update
443
-
444
- Plugin clients (Claude Code, Codex, Cursor) cache the plugin under a
445
- version-numbered directory and delete the old one on update. A session that
446
- was already running keeps pointing at the old paths, so its skills fail to
447
- load and its MCP launcher may refuse to start until the session is restarted.
448
- This is client cache behavior, not something the plugin can compensate for —
449
- after updating the plugin, start a fresh session.
450
-
451
- ## MCP tools
452
-
453
- botnote exposes the following tools + resources over stdio.
454
-
455
- ### Tools
456
-
457
- | tool | annotations | what it does |
458
- |---|---|---|
459
- | `opening_brief` | `readOnly` | Project or workspace context bundle (AGENTS.md + pinned notes + open tasks + recent) |
460
- | `search` | `readOnly` | Hybrid retrieval over tasks and notes |
461
- | `recent` | `readOnly` | Recent activity, filterable |
462
- | `list_projects` | `readOnly` | List non-archived projects (`includeArchived` includes archived) |
463
- | `get_project` | `readOnly` | Fetch a project by UUID or key, including AGENTS.md |
464
- | `create_project` | — | Create a project |
465
- | `update_project` | `destructive idempotent` | Update project status, name, color, icon, or AGENTS.md |
466
- | `get_entity` | `readOnly` | Fetch one task or note by UUID |
467
- | `get_entity_by_key` | `readOnly` | Fetch one task or note by human-readable identifier, e.g. `DEMO-12` |
468
- | `create_task` | `idempotent` | Create a structured task |
469
- | `configure_recurrence` | `idempotent` | Attach or update a recurrence rule for a dated task |
470
- | `get_recurrence` | `readOnly` | Read a task's recurrence rule and current series state |
471
- | `skip_occurrence` | `destructive` | Skip the current recurring occurrence and advance the series |
472
- | `stop_recurrence` | `destructive` | Disable future occurrences for a recurrence series |
473
- | `remember` | `idempotent` | Create a free-form note |
474
- | `update_entity` | `destructive` | Mutate task or note fields |
475
- | `related` | `readOnly` | List child notes/tasks for an entity |
476
- | `link` | `idempotent` | Create typed edge between entities |
477
-
478
- ### Resource
479
-
480
- - `botnote://workspace` — workspace overview: project index + most recent activity (text/markdown).
481
-
482
- ### Direct MCP fallback
483
-
484
- Plugin install is preferred. For a raw MCP client, build/install the CLI and
485
- run:
34
+ `botnote mcp` runs the MCP server on stdio. The botnote plugins for Claude
35
+ Code, Codex and Cursor start it for you; for any other MCP client:
486
36
 
487
37
  ```json
488
38
  {
489
39
  "mcpServers": {
490
40
  "botnote": {
491
- "command": "botnote",
492
- "args": ["mcp"],
493
- "env": {
494
- "BOTNOTE_URL": "http://127.0.0.1:4280"
495
- }
41
+ "command": "npx",
42
+ "args": ["-y", "botnote", "mcp"],
43
+ "env": { "BOTNOTE_URL": "http://127.0.0.1:4280" }
496
44
  }
497
45
  }
498
46
  }
499
47
  ```
500
48
 
501
- ## Per-project AGENTS.md
502
-
503
- The whole point of botnote's `agents_md` field is to push project-level conventions into agents' working context without per-session prompt engineering.
504
-
505
- Recommended structure (< 200 lines, imperative tone):
506
-
507
- ```markdown
508
- ## Critical
509
- - NEVER commit .env or credentials.
510
- - ALWAYS run `pnpm typecheck` before commit.
511
-
512
- ## Stack
513
- - Node 20 + TypeScript ESM, pnpm.
514
- - Postgres + drizzle ORM.
515
-
516
- ## Layout
517
- - src/db/, src/service/, src/rest/, src/mcp/
518
-
519
- ## Rules
520
- - Idempotent writes via `idempotency_key`.
521
- - No console.log outside cli.ts.
522
- ```
523
-
524
- Each MCP tool call inside a project should be preceded by `opening_brief({ projectId })` so the agent has AGENTS.md + recent context loaded.
525
-
526
- ## Status
49
+ ## Running the daemon
527
50
 
528
- Actively developed and self-hosted at <https://botnote.net>. The shipped
529
- surface covers projects, tasks, and notes with hybrid search (BM25 + optional
530
- vector embeddings), recurring tasks, a web UI (list / board / calendar views),
531
- the REST API and MCP server documented above, and the editor plugin for Claude
532
- Code, Codex, and Cursor. See `AGENTS.md` for codebase conventions and the `BOT`
533
- project in botnote for ongoing work.
51
+ `botnote serve` starts `botnote-server` from your PATH, or through
52
+ `npx -y botnote-server@<this version>` when it is not installed.
534
53
 
535
54
  ## License
536
55
 
537
- MIT.
56
+ MIT. The daemon (`botnote-server`) is AGPL-3.0-only; see
57
+ [LICENSING.md](https://github.com/botnote-dev/botnote/blob/main/LICENSING.md).
package/dist/bin.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { execFileSync } from "node:child_process";
2
+ import { spawnSync } from "node:child_process";
3
3
  import { createReadStream, createWriteStream, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
4
4
  import path from "node:path";
5
5
  import readline from "node:readline/promises";
@@ -86,7 +86,7 @@ Usage:
86
86
  botnote logout Wipe the saved token
87
87
  botnote whoami Show config status
88
88
 
89
- botnote serve Run the REST + web daemon (same as: node dist/cli.js)
89
+ botnote serve Run the daemon (botnote-server on PATH, else npx botnote-server)
90
90
  botnote mcp Run the MCP stdio server (for plugin/agent integration)
91
91
 
92
92
  botnote projects [--all] List projects
@@ -101,11 +101,11 @@ Usage:
101
101
  Create a task
102
102
  botnote note "<body>" [--project KEY] [--pin]
103
103
  Create a note (no title)
104
- botnote done TASK [--comment "..."] Mark a task done, optionally with a worklog entry
104
+ botnote done TASK [--worklog "..."] Mark a task done, optionally with a worklog entry
105
105
  botnote update TASK [--status S] [--priority P] [--due YYYY-MM-DD|none]
106
106
  [--title "..."] [--project KEY] [--tags a,b]
107
107
  Update a task or note
108
- botnote comment TASK "<body>" Append a worklog comment
108
+ botnote worklog TASK "<body>" Append a worklog entry
109
109
  botnote recurrence TASK Show recurrence for a task
110
110
  botnote skip TASK [--reason "..."] Skip current recurring occurrence
111
111
  botnote stop-recurrence TASK Stop a task's recurrence series
@@ -411,7 +411,7 @@ async function cmdUpdate(args) {
411
411
  async function cmdDone(args) {
412
412
  const identifier = args.positional[0];
413
413
  if (!identifier) {
414
- console.error('usage: botnote done TASK [--comment "..."]');
414
+ console.error('usage: botnote done TASK [--worklog "..."]');
415
415
  process.exit(1);
416
416
  }
417
417
  const target = await resolveEntity(identifier);
@@ -419,27 +419,27 @@ async function cmdDone(args) {
419
419
  console.log(`✓ done ${describeEntity(identifier, updated)}`);
420
420
  // A closing worklog entry is what the next session reads first, so make it
421
421
  // one command instead of two.
422
- if (typeof args.flags.comment === "string") {
423
- await callApi("POST", `/v1/entities/${target.id}/comments`, {
424
- body: args.flags.comment,
422
+ if (typeof args.flags.worklog === "string") {
423
+ await callApi("POST", `/v1/entities/${target.id}/worklog`, {
424
+ body: args.flags.worklog,
425
425
  actorKind: "human"
426
426
  });
427
- console.log(" worklog comment added");
427
+ console.log(" worklog entry added");
428
428
  }
429
429
  }
430
- async function cmdComment(args) {
430
+ async function cmdWorklog(args) {
431
431
  const [identifier, ...bodyParts] = args.positional;
432
432
  const body = bodyParts.join(" ").trim();
433
433
  if (!identifier || !body) {
434
- console.error('usage: botnote comment TASK "<body>"');
434
+ console.error('usage: botnote worklog TASK "<body>"');
435
435
  process.exit(1);
436
436
  }
437
437
  const target = await resolveEntity(identifier);
438
- const comment = await callApi("POST", `/v1/entities/${target.id}/comments`, {
438
+ const entry = await callApi("POST", `/v1/entities/${target.id}/worklog`, {
439
439
  body,
440
440
  actorKind: "human"
441
441
  });
442
- console.log(`✓ commented on ${identifier} (${comment.id.slice(0, 8)})`);
442
+ console.log(`✓ logged on ${identifier} (${entry.id.slice(0, 8)})`);
443
443
  }
444
444
  async function cmdRecurrence(args) {
445
445
  const identifier = args.positional[0];
@@ -569,13 +569,20 @@ async function cmdImport(args) {
569
569
  }
570
570
  }
571
571
  function cmdServe() {
572
- // Re-exec into the existing daemon entry. dist/cli.js is sibling of dist/bin.js.
573
- const cli = path.resolve(path.dirname(new URL(import.meta.url).pathname), "cli.js");
574
- execFileSync(process.execPath, [cli], { stdio: "inherit" });
572
+ // The daemon is its own package (botnote-server, AGPL-3.0); this CLI only
573
+ // launches it so it can stay MIT and dependency-light.
574
+ const run = (cmd, argv) => spawnSync(cmd, argv, { stdio: "inherit" });
575
+ let result = run("botnote-server", []);
576
+ if (result.error?.code === "ENOENT") {
577
+ result = run("npx", ["-y", `botnote-server@${VERSION}`]);
578
+ }
579
+ if (result.error)
580
+ throw result.error;
581
+ process.exitCode = result.status ?? 1;
575
582
  }
576
- function cmdMcp() {
577
- const cli = path.resolve(path.dirname(new URL(import.meta.url).pathname), "cli.js");
578
- execFileSync(process.execPath, [cli, "mcp"], { stdio: "inherit" });
583
+ async function cmdMcp() {
584
+ const { runMcpStdio } = await import("./mcp/stdio.js");
585
+ await runMcpStdio();
579
586
  }
580
587
  async function main() {
581
588
  const [, , subcommand, ...rest] = process.argv;
@@ -632,8 +639,8 @@ async function main() {
632
639
  return cmdDone(args);
633
640
  case "update":
634
641
  return cmdUpdate(args);
635
- case "comment":
636
- return cmdComment(args);
642
+ case "worklog":
643
+ return cmdWorklog(args);
637
644
  case "search":
638
645
  return cmdSearch(args);
639
646
  case "export":