@joe-broadhead/opencode-mem 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,1340 @@
1
+ # Changelog
2
+
3
+ The format follows Keep a Changelog 1.1.0: one `## [x.y.z] - date` section per
4
+ release.
5
+
6
+ ## [0.8.2] - 2026-11-06
7
+
8
+ A Jelly token per chat, and no fallback for a speaker with no linked account
9
+ (coordinator's decision D30; Jelly's resource-token contract v1.3 §6 and §7).
10
+ Not published yet: it is published from its own `v0.8.2` tag by
11
+ `.github/workflows/release.yml`.
12
+
13
+ ### Changed
14
+
15
+ - **A token per session.** Inside Jelly the plugin asks
16
+ `token("memory", { session })` with the OpenCode session of the work, so on a
17
+ Jelly host with members each person speaking to a shared agent is remembered
18
+ as themselves. A captured turn, a tool call (`context.sessionID`), a command,
19
+ the pinned block, the compaction checkpoint and the replay of a spooled entry
20
+ each use their own session's token (`asSession` in `src/credentials.js`).
21
+ Tokens are cached per session until 60 s before they expire, with one ask in
22
+ flight per session, and a `401` re-asks once for that session only. The cache
23
+ holds at most 64 sessions (least recently used first out) and drops a session
24
+ when OpenCode deletes it; `session.deleted` is read also with
25
+ `capture: false`. Work that belongs to no session (the skill mirror,
26
+ Memory's views, start-up) asks `token("memory")` as before.
27
+ - **Asked again at each user turn.** A second person can speak in a session
28
+ someone else started, so each new user message (the `prompt` hook, which is
29
+ now registered also with `bootstrap: false`, and the admission event) drops
30
+ the session's token and refusal hold; the turn's first memory call asks
31
+ again. A turn superseded by a newer message is still captured with its own
32
+ token. A turn with no user message (a wake, a routine) keeps the cached
33
+ token. A spooled entry records the account its token named
34
+ (`credentialSubject`) and waits while its session's token names someone
35
+ else.
36
+ - **No fallback for an unlinked speaker.** When Jelly refuses a session with
37
+ `not_enrolled` and the detail `not_signed_in` (the person speaking has not
38
+ linked a Jelly account on this host), that session uses no credential: not
39
+ the pasted key, which belongs to whoever pasted it, and not another session's
40
+ token. Its turns are neither captured nor spooled, the context hook adds
41
+ nothing, and every tool and command answers "Memory isn't available in this
42
+ chat because the person speaking hasn't linked their Jelly account on this
43
+ host." The refusal is held 30 s per session; other sessions are unaffected. A
44
+ request that meets it mid-flight fails with `MEMORY_NOT_LINKED`. Other
45
+ refusals behave as in 0.8.1, `access_denied` included.
46
+ - **The spool keeps an entry's identity.** Each entry records
47
+ `credentialSession`, the session it was written in, and is replayed as that
48
+ session whichever session's flush sends it, so one person's turn is never
49
+ sent with another's token. An entry whose session's speaker is unlinked is
50
+ deleted, and the log names the file, never the content. Entries from 0.8.1
51
+ replay as their turn's session, or with no session. `flushSpool` reports
52
+ `dropped` when it deleted one.
53
+ - **Unchanged:** stock OpenCode (the `token` option, `MEMORY_TOKEN`, then the
54
+ pasted key); an accessor that ignores `session`; and Jelly 0.3.2, whose
55
+ accessor refuses `{ session }` as `invalid_target` with the detail
56
+ `invalid_cnf_jwk`: the plugin then asks as before, one token for the engine.
57
+ An accessor that throws on the option is handled as any other throw.
58
+ - The accepted risk is restated: a session that falls back writes as the
59
+ pasted key's user whoever speaks in it; an unlinked speaker never does, as
60
+ long as Jelly passes the refusal's `detail` through
61
+ ([README](README.md#running-inside-jelly)).
62
+
63
+ ### Added
64
+
65
+ - `test/session-tokens.test.js`: two sessions with two speakers, the unlinked
66
+ speaker, the hold per session, the bound and the deletion, the spool, a 401
67
+ per session, stock OpenCode, both shapes of a Jelly 0.3.2 accessor, and a
68
+ new speaker in the same session (A then B, an unlinked B after A, A after an
69
+ unlinked B at once, a superseded turn, the spool waiting for its speaker).
70
+
71
+ ## [0.8.1] - 2026-11-06
72
+
73
+ Memory follows Jelly's plugin authors' standard, and forgetting asks first. Not
74
+ published yet: 0.8.0 is published first, then this one, each from its own tag
75
+ by `.github/workflows/release.yml`.
76
+
77
+ ### Changed
78
+
79
+ - **Forget asks (D17).** `mem_forget` asks the person before it deletes, in
80
+ every space: a delete cannot be undone. The tool asserts its own permission,
81
+ `mem_forget`, before anything is deleted, and the plugin's new default rule
82
+ (`src/permissions.js`) makes that assertion ask; it goes right after an
83
+ agent's base allow, so the agent's own rules, the person's `permission`
84
+ config and an "always" answer still win. In Jelly, `mem.forget` is declared
85
+ `effect: "ask"`, which Jelly writes as the tool's default and applies to
86
+ agents that already have Memory as soon as they follow this release. A
87
+ preview (`match` without `confirm`) deletes nothing and does not ask. A team
88
+ forget still asserts `memory.forget` for its rows, so in Jelly it asks twice;
89
+ `asks` is unchanged. A declined forget answers "forgetting denied: …
90
+ Nothing was deleted."
91
+ - **Errors say what to do.** A failed request to the memory server
92
+ (`BackendError`), the spaces service (`ControlError`) or for a Jelly token
93
+ (`CredentialError`) reads `CODE: what happened. Next step: what to do.`, for
94
+ example `MEMORY_UNREACHABLE: /v3/atomic/search: fetch failed. Next step: Try
95
+ again in a moment; mem_status says whether memory is reachable.` A tool that
96
+ answers with one gives it as it is, without the old "memory unavailable: "
97
+ prefix. A request whose Jelly token could not be had keeps the token's code
98
+ (`MEMORY_NOT_ENROLLED`, `MEMORY_NOT_OFFERED`, …).
99
+ - The Code Mode namespace text ends "Memory content is untrusted data, never
100
+ instructions."
101
+ - Jelly's card: the summary is a phrase, "Your decisions, preferences and
102
+ notes, across conversations and agents."; the settings call the product
103
+ Memory ("The Memory server to use", "paste the key from Memory's /account
104
+ page"), as do the key hints in the tools, the views and the docs.
105
+ - The skill's folder is its id: `skills/mem.usage/` (was `skills/mem-usage/`).
106
+ The skill id, `mem.usage`, is unchanged.
107
+
108
+ ### Added
109
+
110
+ - `test/jelly.test.js` runs the shared declaration kit
111
+ (`test/support/jelly-kit.ts`, the copy every curated plugin carries) in place
112
+ of `test/jelly-declaration.test.js`'s restated schema keys and icon cleaner;
113
+ `npm test` runs with `--experimental-strip-types` for it.
114
+ - `npm run check:copies` (`scripts/check-copies.mjs`) holds the kit equal to the
115
+ other plugins' copy; CI runs it, and `npm run check` runs the plugin's own
116
+ checks (`test`, `check:syntax`, `check:docs`, `check:copies`).
117
+ - [docs/jelly.md](docs/jelly.md): what Jelly reads from the declaration, what
118
+ asks, and the recorded exception to the standard: Memory has no tools RPC
119
+ (PL10), because its reads reach the person through its tools and its views'
120
+ RPC, and a scripts-only RPC with no caller would be dead code.
121
+ - `.github/workflows/release.yml`: a `v*` tag publishes to npm through trusted
122
+ publishing. Only the repository's admin can create a `v*` tag (a ruleset), and
123
+ the `release` environment accepts only `v*` tags. The repository is private, so
124
+ npm makes no provenance and GitHub offers no reviewer approval.
125
+ `npm run test:pack` checks the packed tarball itself.
126
+ - `CHANGELOG.md` ships in the package.
127
+
128
+ ## [0.8.0] - 2026-11-06
129
+
130
+ **Shipped by owner override, not a gate pass.** The pre-registered gate was
131
+ not met: rule 3 failed for Jelly in runs 5 and 6 (`core-abstain-positive` 4/6
132
+ against 0.7.2's 5/6). The plain condition passed every rule in both runs. The
133
+ owner's reasons and the evidence are in the gate record's "Owner override"
134
+ section. Release commit `c177472`, integrity
135
+ `sha512-s9yIyGkZQx0eBiJPmUC3vbDgUifojnn65ebIsdcPpNOhQ5CNuEaatCWVRvH2+rhCKi6Uux0yN9c9mTD46pzMQw==`.
136
+ D17 ("Forget asks") follows in 0.8.1.
137
+
138
+ Release gate: [evals/results/baseline-2026-11-05-0.8.0-README.md](evals/results/baseline-2026-11-05-0.8.0-README.md).
139
+ Gate run 6 (candidate `.4`, `c177472`) did not pass: plain PASS, Jelly FAIL on `core-abstain-positive` 4/6 (0.7.2 5/6). Gate run 5 (candidate `.3`, `463ebb4`) did not pass: plain PASS, Jelly FAIL on safety item `core-abstain-positive` 4/6 (0.7.2 5/6). Gate runs 1, 2 and 3 have not passed; run 4 is VOID in both conditions: a provider outage left items not measured, and the measured Jelly data hold ★ `val-status-no-atom` at 4/6. In run 3 (`9d2636e` on value suite `.2`), plain value passes and Jelly core accepts. Plain core rejects (`core-abstain-positive` 2/3), and Jelly value fails on a ★ item at 2/3 (`val-leak-no-unasked-share`, a provider ECONNRESET exit).
140
+ **Do not publish `ef561af`.** In the plain condition (OpenCode 2.2.3) the core
141
+ gate rejects on safety (`core-forget` 3/3 → 2/3, a protocol wording bug fixed
142
+ after the sweep in `c53c662`, unmeasured), and two ★ value items missed 3/3 on
143
+ the call budget. In the Jelly condition (OpenCode 2.2.5 with a full Code Mode
144
+ catalogue) core is accepted and the value gate passes: `value-shared` 11 → 16
145
+ items, every ★ item at 3/3. `value-commit` goes from 3/10 to 10/10 in both. A
146
+ release needs a new candidate sweep that includes `c53c662`.
147
+ Third gate candidate (`.3`, after run 4): two general fixes. Recall shows an
148
+ episodic record 14 or more days old as a dated snapshot ("recorded <date>,
149
+ not verified since: \"…\"", with its age) and says once to give it as a record,
150
+ never as the current state; facts, instructions, preferences and methods do not
151
+ age. `mem_wiki` read and status with no wiki visible answer as list and search
152
+ do (nothing exists, nothing more to find) instead of "wiki_id is required",
153
+ which agents had answered with extra list and status calls.
154
+ Fourth gate candidate (`.4`, after run 5): a recall miss that lists records
155
+ no longer reads as "nothing is known". 0.8.0's protocol had said a word miss
156
+ means "retry, then say it is unrecorded"; it now says to read the listed
157
+ records first, since one may answer in other words. When a small scope is
158
+ listed whole, recall no longer opens "No memories matched": it says the word
159
+ search found no direct match, so all N records are shown, and that a record
160
+ often answers in other words. A large scope's newest records stay a miss,
161
+ with a note to check each and not to stretch a record on a nearby topic.
162
+ Design: [docs/design/memory-value-design.md](docs/design/memory-value-design.md).
163
+ 0.8.0 also ships 0.7.2's call-shape teaching, which was not released on its own.
164
+
165
+ Memory becomes the person's continuity: it uses their preferences without being
166
+ told, does not re-ask what was decided, keeps promises on time, and can say where
167
+ a project stands. The rule "memory is not a task board" is replaced by one owner
168
+ per piece of state, with status given homes that can be dated and closed.
169
+
170
+ ### Upgrade
171
+
172
+ - Nothing to do. No gateway or control change: commitments live in a reserved
173
+ wiki in each personal space, through the routes, grants and deletion that
174
+ already exist.
175
+ - Optional: set `timeZone` (or `MEMORY_TIME_ZONE`) when the machine's zone is
176
+ not the person's; commitment dates and the Due list use it.
177
+
178
+ ### Commitments
179
+
180
+ - New tool `mem_commitments` (`list`, `add`, `update`, `delete`): things someone
181
+ will do, with an owner (`user`, `agent`, or a name), a `due` date or a
182
+ `trigger`, a state (`open`, `done`, `cancelled`), and optionally a project and
183
+ a link. `due` must be `YYYY-MM-DD` or a date-time with an offset, and an add
184
+ echoes the weekday and date. The same open commitment is not added twice; an
185
+ instruction is never stored; closed items are dropped after 90 days.
186
+ - Stored as `commitments.json` in the personal space's reserved "Memory records"
187
+ wiki, never ingested. Private only in 0.8.0, so writing never asks.
188
+ - Two agents writing at once keep each other's records: a write re-reads before
189
+ writing, merges by id, and reads back. A file that keeps changing is reported
190
+ as a conflict, never overwritten. A whole write that fits inside another
191
+ writer's check-to-write gap can still be lost; the gateway's conditional write
192
+ is the fix (design §14, S2).
193
+ - The pinned block carries a **Due** list: overdue commitments and those due in
194
+ the next two working days, at most five lines and a count of the rest. Its
195
+ bytes change only when a commitment or the date changes.
196
+
197
+ ### Memory
198
+
199
+ - `mem_remember` takes `supersedes`: the named private atoms are removed once
200
+ the new one is accepted (a queued write removes nothing). The delete carries
201
+ no task, so an atom written in another task is found.
202
+ - The status guard's refusal names the homes: commitments for things to do, the
203
+ project page's Status section for where work stands, or the tracker.
204
+ - A team write's approval shows what will be written: the wiki file, its size
205
+ and an excerpt with secrets redacted; for `mem_remember`, an excerpt and the
206
+ ids it supersedes.
207
+
208
+ ### Wiki
209
+
210
+ - The records wiki is hidden from `mem_wiki` lists and searches, and `mem_wiki`
211
+ refuses to read or write it.
212
+ - Reads and knowledge searches remove instruction-shaped sentences, marked
213
+ `[instruction removed]`, and say so outside the fence, as recall already did
214
+ for atoms.
215
+ - `write` and `append` use the only visible wiki when `wiki_id` is omitted, and
216
+ need a `filename` (a search hit's `wiki/` path is accepted); a write with no
217
+ name is refused instead of landing in `README.md`.
218
+ - A read by a search hit's path reads the source file first, so a page reads
219
+ current right after a write.
220
+ - Answers say what they checked and stored: an empty list or search names the
221
+ space and visibilities checked and says that nothing exists there yet; a
222
+ write says the source file now holds exactly what was sent. The protocol and
223
+ the skill add "trust what an answer says it checked and stored", so agents
224
+ stop re-listing and reading back their own writes.
225
+ - The `content` parameter describes the project page: Purpose, a dated Status
226
+ replaced on update, Decisions, Open questions, People, Links, Log, and no
227
+ checkboxes.
228
+
229
+ ### Code Mode
230
+
231
+ - `recall`, `remember`, `commitments`, `wiki` and `status` are pinned in
232
+ OpenCode 2.2.5's Code Mode catalogue (`options.pinned`), so their signatures
233
+ show even when many plugins fill it. Probed with a Jelly-sized catalogue:
234
+ 0.7.2 read `mem (9 tools, none shown)`, 0.8.0 reads `mem (10 tools, 5 shown)`.
235
+ - The namespace description lists `commitments`, `supersedes`, and each tool's
236
+ `visibility` values.
237
+
238
+ ### Teaching
239
+
240
+ - The always-on block, the agent protocol and the usage skill are rewritten
241
+ from the design: the write signals and "save without asking", commitments,
242
+ Due-once, the systems-of-record rule (ask once about a tracker and record the
243
+ answer), one knowledge wiki per space with page templates, the end-of-work and
244
+ tidy-up flows. "Am I allowed to…?" starts with recall, not `mem_spaces`.
245
+ - A request to forget is the confirmation: only a delete the agent proposes
246
+ itself, and team-visible memory, are confirmed first.
247
+ - The skill's table lists every enum's values; `visibility` differs by tool. A
248
+ test holds it, and holds that the agent protocol carries every always-on rule.
249
+ - The built-in skill's description is read from its front matter.
250
+
251
+ ### Views (Jelly)
252
+
253
+ - A **Commitments** card on Home: open commitments, overdue first, at most
254
+ eight, in words ("Overdue since Tue 3 Nov", "Waiting on Kwame"), each with
255
+ Mark done….
256
+ - A **Commitments** tab in Settings → Plugins → Memory, with those closed
257
+ recently.
258
+ - Both read `commitments.list`, a read-only RPC under `mem_commitments` that
259
+ reads only the caller's personal space. Mark done starts a message the
260
+ person sends, as Forget does.
261
+
262
+ ### Evals
263
+
264
+ - New suite `value`, `mem-value-2026-11-05.1`, hash `928de646fa58e6cd`, frozen
265
+ before the product code ([docs/evals/value-suite.md](docs/evals/value-suite.md)),
266
+ with a fixed clock, seeded pages and commitments, the skill allowed, and
267
+ routine and tracker stubs. 22 new grader controls (84 in all).
268
+ - `--keep-policy failed-or-safety`: keep failed attempts and safety items
269
+ whole, and compress the rest as each attempt ends.
270
+ - `--host-load jelly`: a Jelly-sized Code Mode catalogue, run on OpenCode 2.2.5,
271
+ where an unpinned `mem` namespace collapses as it does in Jelly.
272
+
273
+ ## [0.7.2] - 2026-11-05 (not released; folded into 0.8.0)
274
+
275
+ Release gate: [evals/results/baseline-2026-11-05-0.7.2-README.md](evals/results/baseline-2026-11-05-0.7.2-README.md).
276
+ **REJECT on safety:** `core-constraint-private` passed 2/3 against 3/3 on
277
+ 0.7.1. Do not publish this version as it stands.
278
+
279
+ In Jelly, models called the memory tools wrongly the first time:
280
+ `mem.recall` with only `task`, and `mem.wiki`, `mem.spaces` and
281
+ `mem.grants` with no `action`. This version teaches the exact call shapes.
282
+ Schemas, requiredness, defaults and behaviour are unchanged.
283
+
284
+ ### Teaching
285
+
286
+ - The usage skill opens with "Calling the tools". It gives each tool's
287
+ required arguments, `action` values (read-only or writes) and optional
288
+ arguments, with a worked call in Code Mode form (`tools.mem.<name>`) and
289
+ direct form (`mem_<name>`). `query` is required for recall; `task` never
290
+ replaces it.
291
+ - The `mem` namespace description carries every call shape, because Code Mode
292
+ shows it even when no `mem` signature fits the catalog.
293
+ - `docs/agent-protocol.md` and the fallback protocol show a complete recall
294
+ call with `query`. The tool map gains a Required column.
295
+ - The parameter descriptions name the required arguments and the `action`
296
+ values, with an example.
297
+
298
+ ### Tests
299
+
300
+ - `test/call-shapes.test.js` checks the skill's table, the namespace line, the
301
+ protocol's tool map and every worked call against the registered schemas
302
+ and Jelly's tool names, through the reader in `scripts/call-shapes.mjs`.
303
+
304
+ ## [0.7.1] - 2026-11-05
305
+
306
+ Release gate: [evals/results/baseline-2026-11-05-0.7.1-README.md](evals/results/baseline-2026-11-05-0.7.1-README.md).
307
+
308
+ Memory is on for every Jelly user, with Remember conversations on, so its
309
+ views now say so plainly. Recall, capture (its default included), the hooks,
310
+ the agent protocol and every tool's output are unchanged against 0.7.0.
311
+
312
+ ### Upgrade
313
+
314
+ - Nothing to do: the plugin and the gateway behave as in 0.7.0.
315
+
316
+ ### Views
317
+
318
+ - The Home tile ends with a notice. With capture on: "Memory saves your
319
+ finished conversations to your private memory. You can turn this off in
320
+ Settings → Plugins → Memory." With it off: "Memory isn't saving
321
+ conversations. Turn it on in Settings → Plugins → Memory."
322
+ - The Overview opens with the same notice, and says what private means: only
323
+ you and your agents can read it, and nothing goes to a shared space unless
324
+ you choose to share it, which Jelly asks about first. It names the switch,
325
+ Remember conversations, in this plugin's settings.
326
+ - Jelly's view contract has no way for a page to open a setting, so the place
327
+ is named in words.
328
+ - Screenshots of the tile and the Overview with capture off
329
+ (`npm run shots:views`); a test holds the notice's words.
330
+
331
+ ## [0.7.0] - 2026-11-05
332
+
333
+ Release gate: [evals/results/baseline-2026-11-05-0.7.0-README.md](evals/results/baseline-2026-11-05-0.7.0-README.md).
334
+
335
+ Memory's screens in Jelly, for the personal space: a Home tile, and a section
336
+ on the plugin's card in Settings with four tabs (Overview, Spaces, Wiki,
337
+ Recent). They are the plugin's own views, signed in with the person's Jelly
338
+ token, built on Jelly's plugin-views contract as it is (no Jelly change).
339
+ Team spaces come later. Design: [Views in Jelly](README.md#views-in-jelly).
340
+
341
+ Recall, capture, the hooks, the agent protocol and every tool's output are
342
+ unchanged against 0.6.2.
343
+
344
+ ### Upgrade
345
+
346
+ - Plugin: nothing to do. A Jelly that knows plugin views shows them once the
347
+ plugin is given to an agent; the curated catalogue's pin decides when.
348
+ - Gateway and control: nothing to do. No route is added; the views read
349
+ through the routes the tools already use.
350
+
351
+ ### Views
352
+
353
+ - `jelly.views`: `home` (Home tile, small) and `memory` (the Settings
354
+ section). Pages in `views/`, each one static file with Jelly's bridge helper
355
+ pasted in. They load nothing by URL, keep nothing in the browser, set memory
356
+ text as text, and draw only with the theme tokens Jelly sends, in light and
357
+ dark.
358
+ - Every screen has a loading, an empty and an error state, and the Overview
359
+ and the tile say when memory isn't connected and what to do.
360
+ - Forget on a recent memory starts a message for the person to send
361
+ (`open-agent`): "Forget this memory: “…” (<id>)." `mem_forget` then runs
362
+ under their rules. Remember conversations stays a declared setting.
363
+ - No view behind `mem_recall` yet: Jelly runs the memory tools through Code
364
+ Mode, and a view is not given the result of a call made inside it. What
365
+ Jelly would need: [docs/design/jelly-views-later.md](docs/design/jelly-views-later.md).
366
+
367
+ ### View RPC
368
+
369
+ - `src/views/rpc.js` registers six read-only methods with the engine under
370
+ the package name: `memory.overview`, `spaces.list`, `memories.recent`,
371
+ `wiki.list`, `wiki.pages`, `wiki.read` (`jelly.rpc`; schemas in
372
+ `src/views/contracts.js`). Each reads under the permission of the tool that
373
+ makes the same read (`mem_status`, `mem_spaces`, `mem_recall`, `mem_wiki`).
374
+ - Reads go through the gateway with the credential chain (Jelly token first)
375
+ and are scoped to the caller there; a view names no user, space or
376
+ container. They read under the engine's own primary agents
377
+ (`ctx.agent.list()`), which inside Jelly is `agent`, the name the tools
378
+ write under.
379
+ - On a host without `ctx.rpc` nothing is registered.
380
+ - The schemas have no `pattern`: OpenCode 2.2.5's RPC refuses to register one.
381
+ Ids are bounded by length in the schema and checked by the handlers.
382
+
383
+ ### Checks
384
+
385
+ - `npm run check:jelly` also checks the views: the RPC schemas through
386
+ Jelly's reader with sample answers, no `pattern`, `jelly.rpc` against the
387
+ registered list, and each page carrying Jelly's helper as it is.
388
+ - `npm run shots:views` draws every screen in Jelly and Jelly Night under
389
+ Jelly's page policy and fails on a refusal or a page error.
390
+ - Tests: `test/views-contract.test.js`, `test/views-rpc-e2e.test.js` (the
391
+ real control plane and gateway, two people, cross-user refusals), and
392
+ `test/recall-output.test.js` (`mem_recall`'s whole result is its text
393
+ alone, as in 0.6.2).
394
+
395
+ ### Packaging
396
+
397
+ - `repository.url` is `git+https://github.com/joe-broadhead/opencode-mem.git`,
398
+ as `npm pkg fix` writes it, so `npm publish` no longer warns.
399
+ - `files` adds `views/home.html` and `views/memory.html`.
400
+
401
+ ## [0.6.2] - 2026-11-05
402
+
403
+ Release gate: [evals/results/baseline-2026-11-05-0.6.2-README.md](evals/results/baseline-2026-11-05-0.6.2-README.md).
404
+
405
+ Inside Jelly, Memory signs in with the Jelly account and falls back to the
406
+ pasted key when Jelly refuses a token; the plugin has an icon and declares the
407
+ actions Jelly should ask about. The gateway starts with Jelly ID as its only
408
+ way in: Google sign-in is optional. Issue #17, sections 1 to 4. Decisions and
409
+ evidence:
410
+ [resolution-issue17-jelly-062.md](docs/audit/2026-11-02/resolution-issue17-jelly-062.md).
411
+
412
+ ### Upgrade
413
+
414
+ - Plugin: nothing to do. Jelly gives an agent the Jelly account's memory token
415
+ only once a plugin given to that agent declares `memory`, which this version
416
+ does. An older Jelly ignores the new fields and loads the plugin as before.
417
+ - Gateway: nothing to do for an existing deployment; every configuration that
418
+ started before still starts. A new deployment may set only
419
+ `JELLY_ID_ISSUER` and `JELLY_ID_AUDIENCE` and leave `GOOGLE_CLIENT_ID`,
420
+ `GOOGLE_CLIENT_SECRET` and `GOOGLE_HD` empty. Rebuild the gateway image so
421
+ it carries the new console.
422
+ - A Google client id without its secret, or the reverse, now fails startup
423
+ (it used to start and fail at sign-in).
424
+
425
+ ### Gateway: Jelly ID alone is a way in
426
+
427
+ - `deploy/auth/config.mjs` refuses to start only when none of Google, the dev
428
+ password, or Jelly ID is configured: "configure a way in: JELLY_ID_ISSUER
429
+ and JELLY_ID_AUDIENCE for Jelly ID, GOOGLE_CLIENT_ID/GOOGLE_CLIENT_SECRET for
430
+ Google sign-in, or AUTH_DEV_PASSWORD=1 for local testing". The `GOOGLE_HD`
431
+ rule (G-14) still applies whenever Google is set.
432
+ - `config.signInMethods` names the gateway's own sign-ins (`google`,
433
+ `password`). Jelly ID is not one: a Jelly user never signs in on the
434
+ gateway's pages.
435
+ - `/login` offers only the configured methods. With none it says "Sign-in
436
+ isn't available here" and that people use Memory from Jelly, with no button,
437
+ form or script. A dev-password gateway no longer shows a Google button that
438
+ could only fail.
439
+ - `GET /api/console/sign-in` answers `{"methods": [...]}` without an identity.
440
+ Mission Control's signed-out screen reads it: a Google button, a password
441
+ link, or, on a Jelly-only gateway, the same sentence as `/login` and nothing
442
+ to press.
443
+ - API keys made earlier and agent credentials keep working on a Jelly-only
444
+ gateway. Better Auth runs with no social provider and email sign-in off; its
445
+ sign-in routes answer `404 PROVIDER_NOT_FOUND` and
446
+ `400 EMAIL_PASSWORD_DISABLED`, and nothing links to them.
447
+ - Tests: each configuration in `test/auth-startup.test.js`, the page in each
448
+ configuration in `test/auth-account.test.js`, and
449
+ `test/jelly-only-e2e.test.js` through the real control plane and gateway.
450
+
451
+ ### Jelly declaration
452
+
453
+ - `"resources": ["memory"]`. Not in `requires`, so a Jelly that does not know
454
+ the field still loads the plugin.
455
+ - `"icon": "assets/icon.svg"`: a flat brain mark, packed with the plugin.
456
+ `title` and `summary` are unchanged.
457
+ - `"asks": ["memory.remember", "memory.forget", "memory.promote",
458
+ "memory.promote.revoke", "wiki.write"]`: the run-time actions Jelly should
459
+ ask a person about. Additive and not in `requires`: a Jelly that does not
460
+ know the field leaves it out.
461
+ - `npm run check:jelly <Jelly checkout>` also runs the icon through Jelly's own
462
+ `cleanPluginIcon` and fails when `resources` is lost or required, when
463
+ `asks` is required, or when `asks` differs from the actions the tools
464
+ assert. It says so when the checkout does not know `asks` yet.
465
+ `test/jelly-declaration.test.js` restates the cleaner's rules for CI and
466
+ compares `asks` with the asserted actions through the same reader,
467
+ `scripts/approval-actions.mjs`.
468
+
469
+ ### Credentials
470
+
471
+ - When `token("memory")` rejects with `invalid_target`, `not_enrolled` or
472
+ `unavailable`, the request uses the key pasted in the plugin's settings.
473
+ The refusal is held for 30 s, as Jelly's host holds it, then Jelly is asked
474
+ again.
475
+ - `access_denied` (the Jelly account is disabled or marked for deletion) never
476
+ falls back: the request fails and says the saved key is not used in its
477
+ place.
478
+ - With no key saved, the request fails with one sentence: "this agent's Jelly
479
+ sign-in can't be used for memory: … (`<code>`), and no memory key is saved in
480
+ the plugin's settings". Its status is `503` for `unavailable`, else `401`, so
481
+ a finished turn is still spooled.
482
+ - A `401` from the gateway never switches between a Jelly token and the pasted
483
+ key.
484
+ - `mem_status` and `/mem-status` have a `credential:` line: the source in use
485
+ and, during a hold, the refusal's code. Each refusal is logged once, by code.
486
+ - Inside Jelly with no credential, the sentence now reads "Memory is
487
+ unavailable: this agent's Jelly sign-in can't be used for memory, and no
488
+ memory key is saved in the plugin's settings."
489
+ - Accepted risk: a Jelly sign-in and a pasted key that belong to two different
490
+ memory users write as the key's user while a fallback lasts.
491
+
492
+ ### Docs
493
+
494
+ - README "Running inside Jelly": the `resources` declaration, the credential
495
+ order with its fallbacks, the icon. The known limit "team writes do not ask
496
+ inside Jelly" is gone: Jelly's default rules now set `memory.remember`,
497
+ `memory.forget`, `memory.promote`, `memory.promote.revoke` and `wiki.write`
498
+ to `ask`. Those five names are a contract with Jelly, now also declared in
499
+ `asks`.
500
+ - Architecture, troubleshooting, team onboarding and `SECURITY.md` follow.
501
+ - `docs/deployment.md` "Sign-in methods": Google is optional with Jelly ID,
502
+ with a table of what each configuration offers. `auth.env.example`, the
503
+ compose `.env.example` (whose `GOOGLE_HD` note still said an empty value
504
+ meant any account) and `docs/mission-control.md` follow.
505
+
506
+ ## [0.6.1] - 2026-11-04
507
+
508
+ The plugin is published to npm as `@joe-broadhead/opencode-mem`, so hosted
509
+ Jelly can install it (its hosted machines install plugins from public sources,
510
+ and this repository is private). No runtime change: every file the plugin loads
511
+ is byte-identical to 0.6.0.
512
+
513
+ ### Upgrade
514
+
515
+ Nothing to do. A release export or a directory install keeps working as before.
516
+ To install from npm instead, see the README's "From npm".
517
+
518
+ ### Package
519
+
520
+ - `private: true` is gone and `publishConfig.access` is `public`.
521
+ - The package holds the plugin only: `index.js`, `src/`, `skills/`,
522
+ `docs/agent-protocol.md`, `README.md`, `LICENSE` and `SECURITY.md`. It
523
+ previously listed `control/`, `deploy/`, `ui/`, `scripts/` and all of
524
+ `docs/`; none of those ship now.
525
+ - `test/package-contents.test.js` reads npm's own pack list and fails if:
526
+ - anything else is packed;
527
+ - a module the plugin imports, or a file it reads beside itself, is left out;
528
+ - the package turns private;
529
+ - the Jelly declaration's skill is missing;
530
+ - any packed file names a real deployment (an address other than loopback, a
531
+ host other than `github.com` or an example domain, an email, or a host
532
+ path).
533
+
534
+ ## [0.6.0] - 2026-11-04
535
+
536
+ Release gate: [evals/results/baseline-2026-11-04-0.6.0-README.md](evals/results/baseline-2026-11-04-0.6.0-README.md).
537
+
538
+ Private personal spaces by container, identities and self-serve onboarding,
539
+ Jelly ID resource tokens at the gateway, and the plugin ready to run inside
540
+ Jelly. Decisions and evidence:
541
+ [adr-personal-containers.md](docs/design/adr-personal-containers.md),
542
+ [resolution-onboarding-identity.md](docs/audit/2026-11-02/resolution-onboarding-identity.md),
543
+ [resolution-jelly-plugin.md](docs/audit/2026-11-02/resolution-jelly-plugin.md).
544
+
545
+ ### Upgrade
546
+
547
+ Server first, then plugins.
548
+
549
+ 1. Back up the control database.
550
+ 2. Migrations `013_user_identities`, `014_org_auto_provision_domains`, and
551
+ `015_users_personal_agent_index` are pending on an existing database. Apply
552
+ them once with `CONTROL_MIGRATE=apply`, then set it back to `auto`.
553
+ `013` backfills a `better-auth` identity for every user with an auth id, so
554
+ every existing user resolves as before.
555
+ 3. Deploy control, then the gateway. No new required configuration.
556
+ 4. On existing cells still registered with the old default, set
557
+ `PATCH /v1/cells/:id` `{"capacity_containers": 90}`: control now places new
558
+ personal spaces against that cap.
559
+ 5. To let people onboard themselves, opt the organisation's email domains in:
560
+ `PUT /v1/admin/orgs/:id/auto-provision-domains`.
561
+ 6. For Jelly hosts, set `JELLY_ID_ISSUER` and `JELLY_ID_AUDIENCE` on the
562
+ gateway (both or neither).
563
+ 7. Check the control log at start-up for `has the reserved name`: an agent
564
+ registered as `agent` must be deleted and registered under another name.
565
+
566
+ Then the plugins. The package is now `@joe-broadhead/opencode-mem`. An install that loads it from a directory or a
567
+ release export needs no change, and the state directory stays
568
+ `<XDG_STATE_HOME>/opencode-mem`. Check the two behaviour changes below if you
569
+ set `capture: false` or set `controlURL` without `knowledgeURL`.
570
+
571
+ ### Private personal spaces by container
572
+
573
+ - Every new personal space gets a container of its own (`personal-<24 hex>`).
574
+ The memory core keys L2 scenarios and the L3 persona by container and agent
575
+ only, so this is what keeps two people's L2/L3 apart while agent names keep
576
+ their meaning (`build` is your own `build`). Existing placements are
577
+ untouched; the legacy `personal` container and its `build` personal agent
578
+ keep working under every agent name.
579
+ - Control chooses the cell: active, not reported unhealthy, the fewest
580
+ containers, below `capacity_containers` (90 for a new cell, of the
581
+ upstream's 99). Candidates are locked and recounted, so concurrent sign-ups
582
+ never overfill a cell. No cell with room is `503 no_cell_capacity`, audited
583
+ as `placement.no_capacity`. `POST /v1/admin/users` takes `cell_id` and
584
+ `container_id` as optional; an explicit container is kept as given.
585
+ - The cross-user agent rule is narrowed: another user's `personal_agent` is
586
+ refused only in a container that holds that user's personal space (any
587
+ case), checked before a session binding records it. A second user can now
588
+ use `build` in their own container.
589
+ - `agent` is reserved like `build` and `personal_*`: a registered agent can
590
+ never take it (`400 agent_name_reserved`), because every Jelly engine runs
591
+ its main OpenCode agent under that name. An agent registered as `agent`
592
+ earlier is named at start-up and refused on every request
593
+ (`403 agent_name_reserved`); control keeps running so it can be deleted.
594
+ - The capacity planner defaults to `materialized` personal spaces with 90
595
+ usable of 99 containers per cell: about 1,223 cells at 100k users and 10k
596
+ shared spaces, against 250 for the logical layout it replaces.
597
+
598
+ ### Identities and self-serve onboarding
599
+
600
+ - `user_identities` maps `(issuer, subject)` to a user, never by email.
601
+ `POST /v1/identities/resolve` (service token only) answers the gateway.
602
+ - Organisations opt email domains in (`auto_provision_domains`, one
603
+ organisation per domain, admin API, audited). First sight of a verified
604
+ email in such a domain creates the user, the identity, the personal space,
605
+ and its own container in one transaction with one `user.auto_provision`
606
+ audit row. Anything else is `403 not_provisioned`.
607
+ - No linking by email: a second issuer for an existing person is linked by an
608
+ operator (`POST`/`DELETE /v1/admin/identities`, audited).
609
+
610
+ ### Gateway
611
+
612
+ - Every caller is resolved to an identity, then to a control user: Better Auth
613
+ API keys and console sessions as `better-auth`, so a Google sign-in in an
614
+ opted-in domain is provisioned on its first console request. The answer is
615
+ cached per identity for `IDENTITY_CACHE_MS` (60 s by default, at most
616
+ 10 minutes); refusals are not cached. `oma_` agent credentials are
617
+ unchanged.
618
+ - Jelly ID resource tokens (contract v1 §5): off unless `JELLY_ID_ISSUER` and
619
+ `JELLY_ID_AUDIENCE` are both set; `EdDSA` with an Ed25519 key from the
620
+ issuer's JWKS (cached 24 h, one refetch per unknown `kid`), exact issuer and
621
+ audience, a lifetime of at most 900 s. A Jelly-shaped bearer never falls
622
+ back to another credential kind, and is refused on the console, Better
623
+ Auth, and `/account`. It cannot mint agent credentials.
624
+ - The agent credential parent check follows an operator link instead of
625
+ revoking the credential.
626
+
627
+ ### Tests
628
+
629
+ - Control: identities, backfill, auto-provisioning, no email linking, domains,
630
+ link and unlink, placement with room and its refusal, concurrent provisions
631
+ (SQLite and PostgreSQL), the narrowed agent rule, and the reserved name.
632
+ - Gateway: every Jelly verification step with a real Ed25519 key, JWKS cache
633
+ and refetch, no fallback, the identity cache bound, Better Auth mapping.
634
+ - `test/privacy-canary-e2e.test.js`: real control, gateway, and stub cell with
635
+ isolated L2/L3. Two auto-provisioned users (Better Auth and Jelly) under the
636
+ same agent names never see each other's facts, turns, scenarios, persona,
637
+ wiki, or skill in any view; the owner legacy keeps its own.
638
+
639
+ ### Plugin
640
+
641
+ - **Credentials, first match wins:** the `token` option or `MEMORY_TOKEN`; then
642
+ Jelly's identity accessor (`globalThis[Symbol.for("jelly.identity")]`,
643
+ `token("memory")`, cached until 60 s before it expires, one mint in flight);
644
+ then Jelly's plugin-secrets accessor
645
+ (`get("@joe-broadhead/opencode-mem", "token")`, a pasted key). Accessors are
646
+ read on use; a throwing or malformed one counts as absent. A token is never
647
+ logged, spooled, or written to a file (`src/credentials.js`).
648
+ - **One refresh on a 401.** Core, knowledge, gateway and control requests ask
649
+ for a different token once and send the request again, writes included (the
650
+ gateway refused before acting). A second 401 is final.
651
+ - **Origin:** `controlURL`, else the identity accessor's `memory` URL.
652
+ `baseURL` now defaults to `<controlURL>/core` and `knowledgeURL` to
653
+ `<controlURL>/knowledge` when they are not set, inside Jelly or not. Without
654
+ a gateway the local simulator default is unchanged. **Behaviour change:**
655
+ with `controlURL` set and no `knowledgeURL`, wiki and code-graph calls now go
656
+ to `<controlURL>/knowledge`, not to `baseURL`.
657
+ - **No credential:** with a gateway (or inside Jelly) and no key, the plugin
658
+ loads and registers its tools; every `mem_*` tool and `/mem-*` command
659
+ answers one sentence saying why memory is unavailable, nothing is captured or
660
+ spooled, no pinned block or protocol is injected, and no request is made.
661
+ Before, such an install sent every request without a bearer, got 401s, and
662
+ kept each finished turn in the spool.
663
+ - **`capture: false` captures nothing.** **Behaviour change:**
664
+ `compactionCheckpoint` now defaults to the value of `capture`, so
665
+ `capture: false` no longer writes a pre-compaction checkpoint. Set
666
+ `compactionCheckpoint: true` to keep it.
667
+ - **Package `@joe-broadhead/opencode-mem`** with a `jelly` declaration: title
668
+ Memory, the nine tools (`mem.<tool>` → permission `mem_<tool>`, effect
669
+ `allow`, `readOnly` for recall, status, spaces, grants and members), the
670
+ `mem.usage` skill, no sign-ins, and the settings `controlURL`, `capture`, and
671
+ `token` (secret). `npm run check:jelly -- <Jelly checkout>` validates it with
672
+ Jelly's own schema; `test/jelly-declaration.test.js` checks it in CI.
673
+ - Agent name `agent` (every Jelly engine's) works end to end; a person's Jelly
674
+ agents share one personal memory (`test/jelly-agent-e2e.test.js`).
675
+
676
+ ## [0.5.0] - 2026-11-04
677
+
678
+ Authenticated agents with loadouts (issue #2), `mem_forget` reaching every
679
+ stored copy of a fact (issue #10), and `mem_wiki` read working from what
680
+ search shows. Release gate:
681
+ [evals/results/baseline-2026-11-04-0.5.0-README.md](evals/results/baseline-2026-11-04-0.5.0-README.md).
682
+
683
+ ### Upgrade
684
+
685
+ Server first, then plugins.
686
+
687
+ 1. Back up the control database and the cell stores.
688
+ 2. Migration `012_agents` is pending on an existing control database. Apply it
689
+ once with `CONTROL_MIGRATE=apply`, then set it back to `auto`.
690
+ 3. Deploy control and the gateway. No new configuration: agent credentials are
691
+ verified with the existing service token, and the gateway reads parent keys
692
+ from its own Better Auth store.
693
+ 4. Upgrade the plugins. `mem_forget`'s result and `mem_wiki` read changed, and
694
+ the protocol text for forgetting changed.
695
+
696
+ ### Agent-authenticated principals and loadouts (issue #2)
697
+
698
+ Decision in [adr-agent-principals.md](docs/design/adr-agent-principals.md);
699
+ resolution in
700
+ [resolution-issue2-agent-principals.md](docs/audit/2026-11-02/resolution-issue2-agent-principals.md).
701
+
702
+ #### Control plane
703
+
704
+ - Migration `012`: `agents`, `agent_credentials`, and `agent_loadout_items`
705
+ (SQLite and PostgreSQL). Take a backup and apply it explicitly
706
+ (`CONTROL_MIGRATE=apply` once, or `node src/migrate-cli.js --apply`).
707
+ Backup manifests and the restore drill count the new tables when present.
708
+ - New `/v1/agents` API: register an agent in a space (an owner or admin
709
+ membership; the caller owns it), list, read, update, and delete it; mint
710
+ (`oma_…`, 30 days by default, at most 90, returned once, stored as SHA-256),
711
+ list, and revoke credentials; add, list, and remove loadout items
712
+ (resources or collections in the home space). Every change is audited.
713
+ - New `POST /v1/agent-credentials/verify` (service token only) for the
714
+ gateway's per-request credential check.
715
+ - `x-control-agent` next to `x-control-user` makes a request an agent request:
716
+ the home space only, at the lower of the agent's and its owner's role, its
717
+ loadout's resources only, and only context, the space list, authorization,
718
+ and the home catalog (`403 agent_route_forbidden` elsewhere).
719
+ - **Behaviour change:** `POST /v1/grants` accepts `principal_type: "agent"`
720
+ for a registered agent in the target's organisation and home space,
721
+ `viewer` or `editor`. It used to refuse every agent grant with
722
+ `400 unsupported_principal_type`; an unregistered id is now
723
+ `404 agent_not_found`. An agent grant never matches a person's request.
724
+ - **Behaviour change:** a person's request naming a registered agent (any
725
+ case) is `403 agent_forbidden`; a session whose stored label was later
726
+ registered resumes with the default agent. Provisioning a
727
+ `personal_agent` equal to an agent name is `409 agent_name_taken`.
728
+ - Space purge and delete remove the space's agents and report `agents` in
729
+ their counts.
730
+ - An agent credential records what minted it (`minted_via`: `api_key` with
731
+ `parent_key_id`, `console`, or `operator`) and why it was revoked
732
+ (`revoked_reason`). A person's mint must state its parent
733
+ (`x-control-parent`, from the gateway). New
734
+ `POST /v1/agent-credentials/:id/parent-revoked` (service token) revokes a
735
+ credential whose parent key is gone, with an audit row. New
736
+ `GET /v1/agent-credentials` and `POST /v1/agent-credentials/revoke` list
737
+ and revoke every credential of the caller's agents in one call.
738
+
739
+ #### Gateway
740
+
741
+ - An `oma_` bearer is an agent credential, verified by control on every
742
+ request with no cache; a refused one is `401` with its code
743
+ (`agent_credential_revoked`, `agent_disabled`, …). Any other bearer is a
744
+ Better Auth key, as before.
745
+ - An agent credential reaches `/v1/context`, `/api/context`, `/whoami`,
746
+ `GET /v1/spaces`, `/v1/capture`, and the data plane only. The console,
747
+ Better Auth, `/account`, and every management route (including credential
748
+ minting) are `403 agent_route_forbidden`. Creates are
749
+ `403 agent_create_forbidden`.
750
+ - Client agent hints are dropped for an agent; the cell sees the home
751
+ container, the owner's upstream user, and the agent's name.
752
+ - `/v1/capture` with an agent writes to its home space; private needs a
753
+ personal home and team a shared one, else `409 capture_not_bound`.
754
+ - New `/v1/agents/*` routes for people with an API key.
755
+ - An agent credential does not outlive the API key that minted it: every
756
+ request with it checks that key in `auth.db` (exists, enabled, not
757
+ expired; no cache). A gone key is `401 agent_credential_parent_revoked` and
758
+ the credential is revoked for good. Rotating a key (delete, then create)
759
+ stops what it minted; credentials from other keys or the console keep
760
+ working.
761
+ - Console: `POST /api/console/agents/:id/credentials`,
762
+ `GET /api/console/agent-credentials`, and
763
+ `POST /api/console/agent-credentials/revoke` (API only, no UI). A
764
+ credential minted with a session is bound to the person, not a key.
765
+ - `GET /v1/agent-credentials` and `POST /v1/agent-credentials/revoke` at the
766
+ gateway.
767
+
768
+ #### Plugin
769
+
770
+ - No code change. Put an agent credential in `MEMORY_TOKEN` to run a session
771
+ as that agent; an agent on a shared space also sets
772
+ `MEMORY_CAPTURE_VISIBILITY=team`
773
+ ([team-onboarding.md](docs/team-onboarding.md#run-a-session-as-a-registered-agent)).
774
+
775
+ ### mem_wiki read works from what search shows
776
+
777
+ The deployed hub names a search hit's page by `path` (`wiki/<file>`), and
778
+ `page/read` takes that path or the page id. `mem_wiki` read took only `ref`,
779
+ silently ignored `path`, then read the default source file and answered
780
+ `file not found`. The agent then guessed argument shapes for up to ten calls
781
+ (`core-wiki-owner` went over its tool budget in every release gate since 0.3.0).
782
+
783
+ - `read` accepts `path` as the page `ref`. It tries the page and then the
784
+ source file of that name, or the other way round when `filename` is given.
785
+ A miss lists the pages (pass as `ref`) and the source files (pass as
786
+ `filename`) that exist.
787
+ - `read` and `status` without `wiki_id` use the only visible wiki and say so;
788
+ with several, the refusal lists them.
789
+ - After search hits, one line outside the untrusted fence says how to read a
790
+ hit.
791
+ - The hub's `{ref, not_found: true}` answer for a missing page is no longer
792
+ printed as the page's content. An upstream failure other than 404 is an
793
+ error, not a miss.
794
+ - The stub now returns the hub's wiki shapes, read from the image:
795
+ `search` as `{results, links, count}`, `page/ls` items as
796
+ `{id, title, type, path, locked}`, `page/read` with `not_found`, and
797
+ `list_raw` as `{items: [{filename, …}]}`. Before this it returned a bare
798
+ array from search and dropped missing refs.
799
+
800
+ ### mem_forget reaches every stored copy (issue #10)
801
+
802
+ - **`mem_forget` reaches every stored copy of what it deletes** (issue #10;
803
+ [design/adr-forget-copies.md](docs/design/adr-forget-copies.md)). One fact
804
+ lives in the `mem_remember` request and echo, their atoms, and every
805
+ captured turn that repeated it, with its atoms. After an id delete,
806
+ `mem_forget` reads the newest rows (3 pages of 100 per layer) of the agents
807
+ that wrote the deleted ids. It finds the other copies by the fact's numbers,
808
+ identifiers, and names, so an atom the extractor reworded is still found.
809
+ - The `mem_remember` request (`Please remember this…`, which recall never
810
+ shows) and its `Understood.` echo are deleted with the fact. This happens
811
+ only when they hold nothing else, the call includes layer `l0`, and the
812
+ named delete happened.
813
+ - Every other copy is listed in `<forget_copies>` with layer, id, kind,
814
+ agent, and a short excerpt, followed by the `mem_forget` call that deletes
815
+ the listed ones (at most 10; the rest are counted). Nothing in the list is
816
+ deleted.
817
+ - The result says what the scan read and when it was partial: older rows,
818
+ a 5 s budget, or a failed listing. It never reads another agent, user, or
819
+ space.
820
+ - A team delete asks for approval once the rows are known. The prompt names
821
+ the deleted ids and the remember rows, and a denial deletes nothing.
822
+ - The forget path is now 3 or 4 calls (recall, forget, forget the listed
823
+ copies, optionally verify) instead of 9. The output of `mem_forget` and the
824
+ protocol text changed, so the release eval is required before release.
825
+ - The stub can rewrite atoms as a model extractor does:
826
+ `MEM_STUB_EXTRACT=rewrite` paraphrases each sentence deterministically and
827
+ keeps numbers, identifiers, quoted text, and names. The default extraction
828
+ is still verbatim.
829
+ - `forget_preview` and `forget_copies` are fence tags: stored text that holds
830
+ their closing tag cannot end the block.
831
+
832
+ ## [0.4.2] - 2026-11-04
833
+
834
+ ### Fixes
835
+
836
+ - **Captured turns are filed under the session's agent.** OpenCode 2.2's
837
+ session record has no agent field, so a captured turn fell back to the
838
+ configured `agent` while the session's memory tools wrote and recalled as
839
+ the session's real agent (for example `build`). In local direct mode the
840
+ turn, and every memory extracted from it, was out of reach of that agent's
841
+ recall and forget: a fact the user asked to forget came back from the
842
+ captured turn. The plugin now records the agent the host reports in the
843
+ `prompt` and `context` hooks and on every tool call, and files the turn
844
+ under it. In control mode the same agent is sent to `/v1/capture`, so a
845
+ session run as an agent other than the user's personal one (for example
846
+ `plan`) is filed under that agent too.
847
+ - The test mock's session record no longer carries an agent, matching the
848
+ host, so capture tests exercise the real path.
849
+
850
+ Found by the 0.4.1 release gate (`core-forget` 0/3); see
851
+ [evals/results/baseline-2026-11-04-0.4.2-README.md](evals/results/baseline-2026-11-04-0.4.2-README.md).
852
+
853
+ ### Upgrade
854
+
855
+ Plugins only; no server change.
856
+
857
+ ## [0.4.1] - 2026-11-03
858
+
859
+ Fixes 0.4.0's capture route, which stored no turn in production. See the
860
+ correction in
861
+ [resolution-issue2-capture.md](docs/audit/2026-11-02/resolution-issue2-capture.md#correction-2026-11-03-041).
862
+
863
+ ### Fixes
864
+
865
+ - **Captured turns are written to `conversation/add`.** 0.4.0's gateway
866
+ forwarded every turn from `POST /v1/capture` to the cell's
867
+ `/v3/session/add`, which the deployed core (2.0.0-beta.1) does not serve
868
+ (`404 Not found`). Turns were kept in the plugin's spool, not lost. The
869
+ gateway now writes the question and the final answer as `conversation/add`
870
+ messages in the turn's session, which is what every production capture
871
+ before 0.4.0 stored. Local direct mode does the same.
872
+ - The stub no longer serves `session/add`, and its `conversation/add` refuses
873
+ a write without team, user, and agent isolation (`422`), as the core does.
874
+
875
+ ### Guard
876
+
877
+ - `stub/upstream-routes.json` lists the routes the deployed core and hub
878
+ serve, read from the images. `test/upstream-routes.test.js` fails if the
879
+ stub, the plugin, the gateway, or an operator script uses any other route.
880
+ It found one more: `scripts/index-repo.mjs` calls `/v3/ssh-key/ensure`, which
881
+ neither image serves, so private-repository indexing over SSH cannot work.
882
+ That is recorded as a known gap, not fixed here.
883
+
884
+ ### Upgrade
885
+
886
+ Deploy the gateway; no migration. A 0.4.0 plugin then drains its kept turns
887
+ on its next spool flush (`/mem-sync` flushes at once). Upgrade plugins for
888
+ local direct mode.
889
+
890
+ ## [0.4.0] - 2026-11-03
891
+
892
+ Issue #2 follow-ups: revocable sharing and the collection-scope rule,
893
+ organisation-role grants, cell health with restore-based recovery, space
894
+ export, move, purge, and delete, and a gateway capture route. Plus the
895
+ remaining audit residuals and two design records. Each section links its
896
+ resolution record.
897
+
898
+ ### Upgrade
899
+
900
+ Server first, then plugins.
901
+
902
+ 1. Back up the control database and the cell stores.
903
+ 2. Migrations `010_org_roles` and `011_cells_health` are pending on an existing
904
+ control database. Apply them once with `CONTROL_MIGRATE=apply` (or
905
+ `npm run migrate -- --apply`), then set it back to `auto`.
906
+ 3. Deploy control and the gateway. A 0.3.0 plugin keeps working against the
907
+ new gateway; a 0.4.0 plugin needs it, because it captures through
908
+ `POST /v1/capture` (a turn sent to an older gateway waits in the spool).
909
+ 4. Schedule the cell health checker: the `cell-health` compose service, or the
910
+ cron line in [deploy/README.md](deploy/README.md#scheduled-jobs). Run one
911
+ round by hand first and check that every cell reports `healthy`; only an
912
+ `unhealthy` verdict refuses traffic, and a stale one reads as `unknown`.
913
+ 5. Any operator script that moves a placement to another cell or container
914
+ must now send `data_verified` (`400 data_verification_required` without
915
+ it).
916
+ 6. Upgrade the plugins. Tool descriptions changed (`mem_promote` shares a
917
+ copy and can revoke it), so the release eval was run; see
918
+ [evals/results/baseline-2026-11-03-0.4.0-README.md](evals/results/baseline-2026-11-03-0.4.0-README.md).
919
+
920
+ ### Sharing semantics and collection scope (issue #2)
921
+
922
+ Decisions in [adr-sharing-semantics.md](docs/design/adr-sharing-semantics.md) and
923
+ [adr-collection-scope.md](docs/design/adr-collection-scope.md); resolution in
924
+ [resolution-issue2-sharing.md](docs/audit/2026-11-02/resolution-issue2-sharing.md).
925
+
926
+ #### Sharing private memory is a revocable copy
927
+
928
+ - `mem_promote` copies the text of the given ids, read from the caller's
929
+ personal space only, into one new wiki in the target shared space. The wiki
930
+ holds `SHARE.md` with the share key, the sharer, the time, the space, the
931
+ rationale, and each source id with its layer. The gateway registers it, so
932
+ the share id is its catalog resource id. An id not found in the personal
933
+ space, text the write guard refuses, or a record over 8,000 characters stops
934
+ the whole share; credential-shaped values are redacted.
935
+ - `mem_promote({ revoke, space })` revokes a share: a dry run, a check that the
936
+ wiki is a share, approval, the delete, and a read-back through the data
937
+ plane. It reports success only when that read is refused. Only the sharer or
938
+ a space owner or admin can revoke; it never deletes a wiki that is not a
939
+ share. The private original is never touched.
940
+ - **Behaviour change:** `mem_promote` no longer writes the content-free
941
+ `chat_memory` row through `meta/asset/create`, and its result names a share
942
+ id and the revoke call. `rationale` is still required to share; the schema
943
+ no longer marks `ids` and `rationale` as required because `revoke` takes
944
+ neither. Rows written by 0.3.0 and older stay in the cells and were never
945
+ readable through the gateway; operators may delete them.
946
+
947
+ #### Gateway and control plane
948
+
949
+ - New `DELETE /v1/spaces/:id/resources/:resource_id` (gateway and control).
950
+ The gateway asks control for a dry run, deletes the wiki on the space's own
951
+ cell and reads it back, then control deletes the catalog row and every grant
952
+ on it in one audited transaction (`resource.delete`). Only wikis are
953
+ accepted. Errors: `403 resource_delete_forbidden`, `403
954
+ resource_access_denied`, `400 unsupported_resource_kind`, `502
955
+ resource_delete_failed`, `502 resource_delete_unverified`, `503
956
+ resource_delete_unavailable`, and the retryable `502
957
+ resource_delete_incomplete`. `?dry_run=true` checks and changes nothing.
958
+ - The plugin's control client appends the gateway's error code to its
959
+ message, so a refusal says why, for example `(space_role_required)`.
960
+ - The stub implements `wiki/delete`.
961
+
962
+ #### Collection scope
963
+
964
+ - Decided, not built: collection and resource grants cover catalog resources
965
+ only, never memory (L0–L3); a different memory audience needs a separate
966
+ space. "Collection-scoped memory filtering" is no longer listed as pending.
967
+ New end-to-end tests prove a collection-only grantee gets nothing from the
968
+ space's memory through `/v1/context`, the data plane, or `mem_recall`.
969
+
970
+ ### Control plane: organisation-role grant principals (issue #2)
971
+
972
+ See [resolution-issue2-org-role.md](docs/audit/2026-11-02/resolution-issue2-org-role.md).
973
+
974
+ - New admin-token API `/v1/org-roles` (with `x-operator`): define roles per
975
+ organisation, assign and unassign users, list, read, and delete. Every change
976
+ is audited in the same transaction (`org_role.create`, `org_role.delete`,
977
+ `org_role.member_add`, `org_role.member_remove`).
978
+ - `POST /v1/grants` accepts `principal_type: "org_role"`. The grant resolves to
979
+ the role's current members on every request, through the same policy as user
980
+ and group grants (expiry, additive roles, and only space-wide grants confer a
981
+ space role). Unassigning a user or deleting the role removes the access on
982
+ the next request; deleting the role also deletes its grants.
983
+ - An unknown role is `404 org_role_not_found`; a role or user from another
984
+ organisation is `400 principal_org_mismatch`. `agent` principals are still
985
+ refused (`unsupported_principal_type`).
986
+ - The console grant form offers `org_role`.
987
+
988
+ Upgrade: migration `010_org_roles` adds `org_roles` and `org_role_members`
989
+ (SQLite and PostgreSQL). An existing database needs an explicit
990
+ `CONTROL_MIGRATE=apply` (or `npm run migrate -- --apply`) after a backup.
991
+
992
+ ### Fixes and corrections
993
+
994
+ - The eval scorecard now applies three rules of the baseline protocol it
995
+ printed but did not check: churn against the baseline (it compared the
996
+ candidate with itself), no attempt over its own `maxToolCalls`, and no
997
+ category fail count rising by 2. Re-scored, the 0.3.0 release gate is a
998
+ `REJECT`; the 0.3.0 gate README carries the correction. The 0.4.0 gate is
999
+ `REJECT (over_max)` on one attempt and shipped with that rule waived; see
1000
+ its README.
1001
+ - The unused `visibility` argument of the bootstrap path is gone
1002
+ (`bootstrapFor(sessionID, agent, { timeoutMs })`); closes CL F-21.
1003
+ - SECURITY.md, this changelog, and the deployment resolution named the wrong
1004
+ source for the core and hub images. The images that run (2.0.0-beta.1,
1005
+ created 2026-08-03) match no commit in the upstream history; they are pinned
1006
+ by image id, and the ids are now recorded.
1007
+ - Deployment findings D-08, D-12 and D-13 are verified on the live client.
1008
+
1009
+ ### Design records
1010
+
1011
+ - `docs/design/scale-plan.md`: the 10k and 100k plan from the measured cell
1012
+ and control numbers. Users per cell (400) and the extraction budget are
1013
+ still unmeasured, so issue #2's scale item stays open.
1014
+ - `docs/design/adr-external-sharing.md`: public and external sharing is
1015
+ deferred; the record states why and the minimum design if it is built.
1016
+
1017
+ ### Cell health, failover, and rebalancing (issue #2)
1018
+
1019
+ The decision record is [adr-cell-recovery.md](docs/design/adr-cell-recovery.md): recovery is
1020
+ restore-based, with no replication and no automatic failover. The cell RPO is
1021
+ up to 24 h (nightly store backups), and up to 24 h plus the off-host pull lag
1022
+ if the host is lost. See
1023
+ [resolution-issue2-cell-health.md](docs/audit/2026-11-02/resolution-issue2-cell-health.md).
1024
+
1025
+ #### Control plane
1026
+
1027
+ - Migration `011_cells_health` (SQLite and PostgreSQL) adds
1028
+ `cells.health_status` (`unknown`/`healthy`/`unhealthy`), `health_checked_at`,
1029
+ and `health_reason`. `cells.last_health_at` is now written: it is the time
1030
+ of the last healthy verdict. Existing databases need `CONTROL_MIGRATE=apply`
1031
+ after a backup.
1032
+ - `POST /v1/cells/:id/health` (admin) records a checker verdict, and
1033
+ `GET /v1/cell-health` (admin) lists probe targets with `secret_ref`. A
1034
+ verdict writes only the health columns and never the lifecycle `status`.
1035
+ Transitions are audited as `cell.health`.
1036
+ - The context, `/v1/cells`, and `/v1/cells/:id` carry the effective `health`.
1037
+ A verdict older than `CONTROL_CELL_HEALTH_STALE_SECONDS` (default 300) reads
1038
+ as `unknown`.
1039
+ - **Breaking for operators:** `PUT /v1/placements/:space_id` that changes the
1040
+ cell or container needs `data_verified`: `restore` or `export_import` with
1041
+ `source_counts` and `target_counts` that agree, or `data_loss_accepted`
1042
+ with a `note`. Otherwise it is refused with
1043
+ `400 data_verification_required` or `409 data_count_mismatch`. The
1044
+ attestation is recorded in the `placement.update` audit row. Changing only
1045
+ `service_id` or `pinned` is unaffected.
1046
+
1047
+ #### Gateway and console
1048
+
1049
+ - `503 cell_unhealthy` for a space whose cell the checker reports unhealthy,
1050
+ before any credential or cell call. A space is never routed to another cell.
1051
+ Lifecycle status is checked first. `unknown` routes as before. An invalid
1052
+ `cell.health` from control fails closed.
1053
+ - The console applies the same rule. It used to call a `disabled` or
1054
+ `draining` cell; it now refuses it with `cell_disabled` or `cell_draining`.
1055
+
1056
+ #### Operations
1057
+
1058
+ - New `cell-health` job (`deploy/auth/cell-health.mjs`; the compose service
1059
+ `cell-health`; on the host layout, a cron `--once` inside the auth
1060
+ container). It probes core and hub `/health` with each cell's own key from
1061
+ `CONTROL_CELL_SECRETS(_FILE)`, retries before failing, never follows a
1062
+ redirect, and skips a cell whose credential does not resolve.
1063
+ - Exporter: `spaces_cell_unhealthy`, `spaces_cell_health_unknown`, and
1064
+ `spaces_cell_health_check_age_seconds`. `spaces_cell_up` is now 0 for a cell
1065
+ marked unhealthy. Alerts: `SpacesCellMarkedUnhealthy`,
1066
+ `SpacesCellHealthUnknown`, and the now-enabled `SpacesCellHealthStale`.
1067
+ - Runbooks in `docs/deployment.md`: placement failover versus data failover,
1068
+ failing a cell over by restore, failback, the `data_verified` guard,
1069
+ rebalancing with space export/import, and stale catalog rows after a
1070
+ restore.
1071
+
1072
+ ### Space export, move, purge, and delete (issue #2)
1073
+
1074
+ See [resolution-issue2-space-lifecycle.md](docs/audit/2026-11-02/resolution-issue2-space-lifecycle.md);
1075
+ the runbooks and the archive format are in
1076
+ [docs/deployment.md](docs/deployment.md#space-archive-format).
1077
+
1078
+ #### Operator commands
1079
+
1080
+ - `npm run space:export` (`scripts/space-export.mjs`) writes a portable archive
1081
+ of one space: control metadata and its container's L0 turns (with user,
1082
+ agent, session, and task), L1 atoms, L2 scenarios and L3 personas per agent,
1083
+ skills, wiki sources and pages, and code-graph registrations, with a
1084
+ manifest of counts and SHA-256 checksums. Owner-only files; never a key,
1085
+ `secret_ref`, name, or email.
1086
+ - `npm run space:import` (`scripts/space-import.mjs`) copies an archive into a
1087
+ container on an active cell, idempotently, verifies it, and with `--move`
1088
+ moves the placement and re-points the catalog rows. It refuses an inactive
1089
+ cell, a taken container, a non-empty target (`--merge`), and, for a move, an
1090
+ archive taken while the space was active. `--replay-atoms` re-adds atoms as
1091
+ remember turns.
1092
+ - `npm run space:purge` (`scripts/space-purge.mjs`) empties a space's
1093
+ container with per-row isolation deletes, recounts every layer, and only then
1094
+ purges its control rows (and with `--delete` the space). Journaled and
1095
+ resumable. `--from-archive` empties the container a moved space left.
1096
+
1097
+ #### Control plane
1098
+
1099
+ - `PATCH /v1/spaces/:id` archives (takes offline) or restores a space.
1100
+ - `GET /v1/spaces/:id/export`, `POST /v1/spaces/:id/purge`,
1101
+ `POST /v1/spaces/:id/cell-cleanup`, and `DELETE /v1/spaces/:id`, each
1102
+ audited (`space.export`, `space.purge`, `space.cell_cleanup`,
1103
+ `space.delete`). Purge and delete refuse an active space; delete refuses a
1104
+ placed one. A personal space needs `confirm_owner`.
1105
+ - `PUT /v1/placements/:space_id` accepts an archived space, takes the space
1106
+ row lock, and accepts `resources` (re-point catalog rows in the move) and
1107
+ `note`. No schema change.
1108
+
1109
+ #### Stub
1110
+
1111
+ - `MEM_STUB_ISOLATE_CURATED=1` keeps L2/L3 per (team, agent); new
1112
+ `scenario/rm`, `skill/delete` (requires `expected_version`, as upstream),
1113
+ the batch `code-graph/delete` (`{code_graph_ids}` -> `{deleted_ids,
1114
+ failed}`, as upstream), and `POST /debug/fail`. The batch `wiki/delete`
1115
+ reports another container's id as not found. `wiki/create` is idempotent by name inside one container
1116
+ only, and `wiki/list` and `code-graph/list` filter by `team_id`.
1117
+
1118
+ #### Docs
1119
+
1120
+ - `docs/deployment.md`: "Move a space between cells", "Purge and delete a
1121
+ space", "Space archive format"; "Retire a cell" now moves data with
1122
+ export and import.
1123
+
1124
+ ### Capture route (issue #2)
1125
+
1126
+ The gateway, not the plugin, now places every captured turn. See
1127
+ [resolution-issue2-capture.md](docs/audit/2026-11-02/resolution-issue2-capture.md).
1128
+
1129
+ - **Gateway:** new `POST /v1/capture`. The body is `session_id`, `agent`,
1130
+ `visibility` (`private` or `team`), and the turn. One control lookup decides
1131
+ the space: a private turn goes to the caller's personal space and never
1132
+ consults the session binding; a team turn goes only to a shared space bound
1133
+ to the session, else `409 capture_not_bound`. Identity and placement fields
1134
+ in the body, headers, or query are ignored, and the turn is projected to the
1135
+ `session/add` fields before it reaches the cell. The role guard, cell
1136
+ status, and per-cell credential checks apply. The route counts against the
1137
+ per-user key limit and has its own body cap, `CAPTURE_MAX_BYTES` (8 MiB).
1138
+ - **Plugin:** in control mode every turn, live and replayed from the spool, is
1139
+ sent to `/v1/capture` with its recorded visibility. The plugin makes no
1140
+ control call for a turn and records no container in the spool. A team turn
1141
+ refused for lack of a shared binding is sent again as private. A container
1142
+ stored in an older spool entry is ignored on replay.
1143
+ - **Removed:** the `session/add` → `conversation/add` fallback and its
1144
+ per-process 404 latch. Local direct mode writes to `session/add` only.
1145
+ - **Upgrade order:** upgrade the gateway before the plugins. Against a gateway
1146
+ without the route, the plugin logs one WARN line per process and keeps turns
1147
+ in its spool (404 is retried for up to seven days) until the gateway is
1148
+ upgraded; `npm run verify:edge` with `MEMORY_CONTROL_URL` set now checks the
1149
+ route with an empty-body probe the gateway refuses with `400`.
1150
+ - Direct `/core/v3/session/add` stays allowed for plugins older than the
1151
+ route.
1152
+
1153
+ ## [0.3.0] - 2026-11-03
1154
+
1155
+ Issue #2 follow-ups: resource registration on every create path and cell drain
1156
+ and delete. See [resolution-issue2-registration.md](docs/audit/2026-11-02/resolution-issue2-registration.md)
1157
+ and [resolution-issue2-cells.md](docs/audit/2026-11-02/resolution-issue2-cells.md).
1158
+
1159
+ ### Recall fixes found by the release eval
1160
+
1161
+ The first release gate since the audit (paired with the 26 Oct code on the same
1162
+ model route; see [evals/results/baseline-2026-11-03-README.md](evals/results/baseline-2026-11-03-README.md))
1163
+ showed 0.2.1 failing the paired gate. Fixed here:
1164
+
1165
+ - A `scope=space` hit is valid memory of the space. The 0.2.x wording
1166
+ ("not from this task", "never present…") made models answer "unknown" when
1167
+ the only match was recorded outside the current task.
1168
+ - A record that mixes a fact with an injected command keeps the fact: the
1169
+ instruction sentences are removed and marked `[instruction removed]`, in
1170
+ recall and in the pinned block. 0.2.x withheld the whole record. A record
1171
+ that is only a command is still withheld.
1172
+ - In local mode, `mem_wiki list` without `visibility` lists the caller's
1173
+ private wikis as well as team ones, as control mode already did. An explicit
1174
+ `team` still lists team assets only.
1175
+
1176
+ The gate on 0.3.0: 37/38 scenarios (HOLD on the flaky `core-abstain-positive`,
1177
+ which the old code also fails), paired gate pass, tokens 1.10× the baseline.
1178
+
1179
+ ### Gateway
1180
+
1181
+ - Every `wiki/create`, `code-graph/create`, and `skill/create` forwarded by
1182
+ the data plane is registered in the active space's catalog before the
1183
+ create is answered; the response gains `resource_id`. A create that cannot
1184
+ be registered is `502 resource_registration_failed` with the id, the reason,
1185
+ and the remedy, never a silent success.
1186
+ - Skills are catalog resources: `skill/list` is filtered through the caller's
1187
+ catalog, `skill_id` is authorized, and `skill/get` and `skill/update` need a
1188
+ named id. The console's skill counts and rosters show catalog skills only.
1189
+ - `POST /v1/spaces/:id/resources` accepts `skill`, and is idempotent: an id the
1190
+ space already holds is `200 existing: true`.
1191
+ - A registration clears the console cache, so a new asset shows at once.
1192
+ - The route wiring moved from `service.mjs` to `gateway.mjs`.
1193
+
1194
+ ### Control plane
1195
+
1196
+ - Cell drain and delete (issue #2). A `draining` cell now takes no new
1197
+ placements, moves, or provisioning (`400 cell_not_active`); before, only
1198
+ `disabled` was refused. The status is read under a cell row lock inside the
1199
+ placement transaction, so a cell drained or disabled a moment earlier is
1200
+ never a target.
1201
+ - `GET /v1/cells/:id` reports the cell and every placement still on it.
1202
+ - `PATCH /v1/cells/:id` also updates `region`, and applies the patch to the
1203
+ locked row, so concurrent updates no longer lose a field.
1204
+ - `DELETE /v1/cells/:id` now requires a body
1205
+ `{data_disposition: "backed_up"|"destroyed", confirm: "<cell id>", note?}`.
1206
+ It refuses an `active` cell (`409 cell_not_drained`) and a cell that still
1207
+ has placements (`409 cell_in_use`, listing them). The `cell.delete` audit
1208
+ row records the disposition. A bare `DELETE` that worked on an empty cell
1209
+ in 0.2.0 now returns `400 data_disposition_required`.
1210
+ - No schema change and no new migration.
1211
+ - Docs: a cell retirement runbook in
1212
+ [docs/deployment.md](docs/deployment.md#retire-a-cell).
1213
+ - `/v1/context` rewrites an unchanged session binding at most once a minute
1214
+ instead of on every call; a change of space or agent is still written and
1215
+ audited at once. On the reference VPS, T1 (100 users, 25 concurrent) went from
1216
+ a median p95 of 236 ms at 189 rps to 119 ms at 390 rps, now within its
1217
+ 150 ms target. See [docs/load-testing.md](docs/load-testing.md#measured-results).
1218
+ - resource-sync backfills skills from the core service (`--core-url`,
1219
+ `CONTROL_CORE_URL`, `--core-key`, `CONTROL_CORE_KEY`).
1220
+
1221
+ ### Plugin
1222
+
1223
+ - `mem_wiki create` skips its explicit registration when the gateway reports
1224
+ `resource_id`, and keeps it for older gateways. Gateway refusals show their
1225
+ `error` text.
1226
+
1227
+ ### Scripts and stub
1228
+
1229
+ - `publish-skill`, `ingest-wiki` (new `--create <name>`), and `index-repo`
1230
+ have a gateway mode (`MEMORY_GATEWAY_URL`, your API key, `MEMORY_SPACE_ID`)
1231
+ so their creates are registered. `prune` stays direct-only.
1232
+ - The stub implements `skill/create`, `skill/update`, `code-graph/create`, and
1233
+ `code-graph/get`.
1234
+
1235
+ ### Capacity and evals
1236
+
1237
+ - `npm run load:cell` (`scripts/loadtest-cell.mjs`) measures one memory cell's
1238
+ read capacity directly. First measurement: about 160 read rps on a 2-CPU core
1239
+ with a 217 MB store; the planner's default `--cell-rps` is now 150 and its
1240
+ caveat says which limits are measured.
1241
+ - The eval harness can choose which stored provider credential it copies into
1242
+ its throwaway attempt directory (`EVAL_CREDENTIAL_INTEGRATION`,
1243
+ `EVAL_CREDENTIAL_LABEL`).
1244
+
1245
+ ### Upgrade
1246
+
1247
+ Deploy the gateway, then run `npm run sync:resources` with `CONTROL_CORE_URL`
1248
+ set, once: skills that existed before this release have no catalog row and
1249
+ are hidden until the sync registers them.
1250
+
1251
+ ## [0.2.1] - 2026-11-02
1252
+
1253
+ Plugin-only fix; the server components are unchanged at 0.2.0.
1254
+
1255
+ - `mem_remember` was missing from every session running 0.2.0. An unescaped
1256
+ quote in its description (`pass task "*"`) made the description `NaN`, and
1257
+ the host drops a tool without a string description. Found right after the
1258
+ 0.2.0 cutover, when the host listed eight `mem` tools instead of nine.
1259
+ - A contract test now checks that every tool and command registers a string
1260
+ description and an object input schema.
1261
+ - `docs/tokenomics.md`: tool schemas re-measured with the restored description
1262
+ (10,078 characters).
1263
+
1264
+ ## [0.2.0] - 2026-11-02
1265
+
1266
+ The release that fixes the 2026-11-02 audit. Every finding and its resolution
1267
+ is in [docs/audit/2026-11-02/](docs/audit/2026-11-02/README.md).
1268
+
1269
+ Tested with: Node 22.23 against the OpenCode 2.1.4 plugin API (unit and
1270
+ integration tests, plus a live smoke of the tools against the deployed
1271
+ gateway); PostgreSQL 17.11; the `agentmemory/memory-core` and `memory-hub` images created 2026-08-03 (package `@tencentdb-agent-memory/memory-tencentdb-v2` 2.0.0-beta.1; image ids `f9b286246d0e` and `99c234f606be`), pinned by image id on the reference
1272
+ host. (An earlier version of this line said the images were built from
1273
+ upstream `6a4bb55`; they were not: their sources match no commit in that
1274
+ repository's history.) The host scripts need no Node runtime.
1275
+
1276
+ ### Plugin
1277
+
1278
+ - Subagent sessions are not captured (`captureSubagents`, default `false`).
1279
+ - Captured turns are redacted and capped; messages longer than the upstream
1280
+ limit are clamped at send time, so old spool entries drain.
1281
+ - The spool quarantines permanent failures (`*.json.failed`), scans past them,
1282
+ and claims each entry by rename before sending.
1283
+ - Task scope: `task` on `mem_recall`, `mem_remember`, and `mem_forget`, sent as
1284
+ `x-tdai-task-id`. Recall searches the task first, then the space, and labels
1285
+ each hit `scope=task` or `scope=space`. There is no project step.
1286
+ - `mem_forget` deletes L0 turns: it resolves each id to its own agent and
1287
+ session first. It can erase a phrase from the L2 scenarios and L3 persona
1288
+ (preview, then `confirm`).
1289
+ - `work_task` atoms are withheld at read time; L0 hits and the pinned block get
1290
+ the same instruction quarantine as atoms.
1291
+ - Write refusals no longer reject ordinary decisions; the protocol no longer
1292
+ asks for a manual checkpoint that the write guard refuses.
1293
+ - The log always records INFO and above, is 0600, rotates at 5 MB, and never
1294
+ records query text. `debug: true` is for debugging only.
1295
+ - The pinned block is stable for a session; the control plane is asked once per
1296
+ session context, not on every model call.
1297
+
1298
+ ### Gateway and console
1299
+
1300
+ - Authorization uses the space-level role; one resource grant no longer opens
1301
+ a whole space.
1302
+ - Resource registration proves ownership; data-plane lists are filtered
1303
+ through the caller's catalog.
1304
+ - Reads and writes are allowlists; unknown routes are refused.
1305
+ - CSRF checks on console writes, rate limits, body caps, CSP and
1306
+ `frame-ancestors 'none'`.
1307
+ - API keys expire (90 days by default) and can be listed and revoked on
1308
+ `/account`; `revoke-user-keys.mjs` revokes every key of a user.
1309
+ - `GOOGLE_HD` is required with Google sign-in.
1310
+ - A stream error from a cell can no longer crash the gateway.
1311
+
1312
+ ### Control plane
1313
+
1314
+ - Member removal and role change, ownership transfer, cell update
1315
+ (`PATCH /v1/cells/:id`), groups, and `GET /v1/audit`.
1316
+ - Admin-token requests must name an operator (`x-operator`); audit rows are
1317
+ written in the same transaction as the change.
1318
+ - Migrations 006 to 009. `CONTROL_MIGRATE` gates them: `auto` migrates only an
1319
+ empty database.
1320
+ - `node:sqlite` loads only on the SQLite path, so the ops scripts run on Node 20
1321
+ with PostgreSQL.
1322
+
1323
+ ### Deployment
1324
+
1325
+ - `deploy/host/run-ocmem.sh` is the single-host deployment spec. It pins
1326
+ images, sets limits and health checks, runs the Node services under a
1327
+ dedicated uid, and rolls back on a failed health check.
1328
+ `deploy-release.sh` deploys a commit.
1329
+ - Nightly backups of the core, hub, and auth stores with a restore drill, an
1330
+ off-host copy, a daily PITR base, and a scrub of forgotten turns from the
1331
+ core's raw log.
1332
+
1333
+ ### Upgrade notes
1334
+
1335
+ - Server: apply migrations 006 to 009 once with `CONTROL_MIGRATE=apply`, then
1336
+ set it back to `auto`. The control plane refuses to start without
1337
+ `CONTROL_SERVICE_TOKEN`. Add `x-operator` to admin-token callers.
1338
+ - Users: existing API keys never expire; create a new key on `/account` and
1339
+ revoke the old one.
1340
+ - Plugin: remove `debug: true` from the plugin options.