opencode-self-improvement 0.33.2 → 0.33.3

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 (25) hide show
  1. package/README.md +32 -18
  2. package/docs/README.md +70 -0
  3. package/docs/adr/README.md +16 -0
  4. package/docs/{export-import.md → internals/export-import.md} +2 -2
  5. package/docs/{import-quarantine.md → internals/import-quarantine.md} +1 -1
  6. package/docs/{pre-release-ritual.md → internals/pre-release-ritual.md} +2 -2
  7. package/docs/{write-latency.md → internals/write-latency.md} +1 -1
  8. package/docs/{flags.md → reference/flags.md} +3 -2
  9. package/docs/{install.md → reference/install.md} +1 -1
  10. package/docs/{options.md → reference/options.md} +8 -5
  11. package/docs/{surfaces.md → reference/surfaces.md} +1 -1
  12. package/docs/{troubleshooting.md → reference/troubleshooting.md} +1 -1
  13. package/package.json +1 -1
  14. package/tui.ts +1 -1
  15. package/vendor/opencode-memory/README.md +8 -0
  16. /package/docs/{auto-capture-evidence.md → internals/auto-capture-evidence.md} +0 -0
  17. /package/docs/{contradiction-authority.md → internals/contradiction-authority.md} +0 -0
  18. /package/docs/{development.md → internals/development.md} +0 -0
  19. /package/docs/{injection-cost.md → internals/injection-cost.md} +0 -0
  20. /package/docs/{recall-quality.md → internals/recall-quality.md} +0 -0
  21. /package/docs/{repo-scoping.md → internals/repo-scoping.md} +0 -0
  22. /package/docs/{secret-redaction.md → internals/secret-redaction.md} +0 -0
  23. /package/docs/{store-concurrency.md → internals/store-concurrency.md} +0 -0
  24. /package/docs/{use-ledger.md → internals/use-ledger.md} +0 -0
  25. /package/docs/{write-gates.md → internals/write-gates.md} +0 -0
package/README.md CHANGED
@@ -23,7 +23,7 @@ Every figure here carries a marker: **measured** (read off a live store), **benc
23
23
 
24
24
  After that, memory is just conversation: ask the agent to remember something and it sticks.
25
25
 
26
- Other install routes — `opencode plugin add`, the Bun version floor, how an unpinned entry resolves `@latest`, and pointing the entry at a checkout: [docs/install.md](docs/install.md).
26
+ Other install routes — `opencode plugin add`, the Bun version floor, how an unpinned entry resolves `@latest`, and pointing the entry at a checkout: [docs/reference/install.md](docs/reference/install.md).
27
27
 
28
28
  ## What you get
29
29
 
@@ -36,9 +36,9 @@ Think of it as a lab notebook the agent keeps for your repo, plus a librarian wh
36
36
  - **Memory-aware compaction** — a long session hands its durable facts to the summarizer instead of losing them.
37
37
  - **Safe across concurrent sessions** — a reader sees the previous store file or the new one, never half of either.
38
38
  - **Decay and consolidation** — `memory_decay` retires stale open threads, `memory_consolidate` proposes near-duplicate merges. Both are dry-run-first and write nothing you did not approve.
39
- - **Export / import (JSONL)** — back the store up or move it between machines; every imported row re-enters through the same gates. See [Export and move between machines](docs/export-import.md).
40
- - **Surfaces** — a footer badge, the `/memory` panel, `/memory-report` for chat clients, and a browser admin editor. See [docs/surfaces.md](docs/surfaces.md).
41
- - **Secret redaction** — credential-shaped values become `[redacted]`. See [docs/secret-redaction.md](docs/secret-redaction.md).
39
+ - **Export / import (JSONL)** — back the store up or move it between machines; every imported row re-enters through the same gates. See [Export and move between machines](docs/internals/export-import.md).
40
+ - **Surfaces** — a footer badge, the `/memory` panel, `/memory-report` for chat clients, and a browser admin editor. See [docs/reference/surfaces.md](docs/reference/surfaces.md).
41
+ - **Secret redaction** — credential-shaped values become `[redacted]`. See [docs/internals/secret-redaction.md](docs/internals/secret-redaction.md).
42
42
  - **`memory_*` tools** — `memory_remember`, `memory_recall`, `memory_update`, `memory_forget`, `memory_undo`, `memory_status`, `memory_evidence`, `memory_export`, `memory_import`, `memory_decay`, `memory_consolidate`, `memory_merge_review`, `memory_list`, `memory_init`.
43
43
  - **Auto-capture** — at the end of a turn, and again at compaction, one cheap model pass reads what just happened and proposes facts worth keeping. They face the same write gates as anything you save by hand. On by default, and it inherits your session's model; `autoCapture: false` turns it off. See [Auto-capture](#auto-capture).
44
44
 
@@ -53,7 +53,7 @@ Zero configuration is the default. Two options change what the model sees:
53
53
  | `injectBudget` | `1200` | Character cap on the injected relevance block and each contextual pull. |
54
54
  | `frontierBudget` | `3 × injectBudget` | Character cap on the session-start open-threads block. A thread longer than the budget is not injected and is reported as omitted. |
55
55
 
56
- Everything else goes in the object form of the plugin entry, and is documented once with its invalid-value rule: the capture options, `contradictionSurface`, `notifyBlocked`, and every environment variable in [docs/options.md](docs/options.md). Read [docs/flags.md](docs/flags.md) before flipping `OPENCODE_MEMORY_DEDUP`, `OPENCODE_MEMORY_SYMPTOM` or `OPENCODE_MEMORY_QUERY_GATE` — each switches off behaviour a measurement decided, and each has an invalid-value rule that surprises people.
56
+ Everything else goes in the object form of the plugin entry, and is documented once with its invalid-value rule: the capture options, `contradictionSurface`, `notifyBlocked`, and every environment variable in [docs/reference/options.md](docs/reference/options.md). Read [docs/reference/flags.md](docs/reference/flags.md) before flipping `OPENCODE_MEMORY_DEDUP`, `OPENCODE_MEMORY_SYMPTOM` or `OPENCODE_MEMORY_QUERY_GATE` — each switches off behaviour a measurement decided, and each has an invalid-value rule that surprises people.
57
57
 
58
58
  ## Auto-capture
59
59
 
@@ -71,7 +71,7 @@ It is **on by default** and needs no model name to run. With `captureModel` unse
71
71
 
72
72
  **The honest caveat.** The trigger fires and the write survives on a real host: `e2e/capture.test.ts` drives `opencode run` and a capture pass starts in 12 of 12 runs. What has not been seen is a live store completing a pass — no `auto_capture_*` line exists anywhere in the maintainer's evidence history — and nothing about quality is measured: what auto-capture would write, how often it duplicates a memory you would have written yourself, and what it costs. Because the switch is on by default, that unmeasured pass runs on every install unless you turn it off; `autoCapture: false` is the one-line answer if you would rather wait for the numbers.
73
73
 
74
- What has been established, and by which kind of evidence, is itemised in [docs/auto-capture-evidence.md](docs/auto-capture-evidence.md). Read that file before quoting any figure in it — two of the entries are defects found in the measuring bench itself, and the corrected numbers are the ones recorded there. `bench/capture-trigger-results.md` is a **bench** simulation of trigger *timing* with a scripted extractor; it answers "which moment is worth mining", not "does this earn its keep".
74
+ What has been established, and by which kind of evidence, is itemised in [docs/internals/auto-capture-evidence.md](docs/internals/auto-capture-evidence.md). Read that file before quoting any figure in it — two of the entries are defects found in the measuring bench itself, and the corrected numbers are the ones recorded there. `bench/capture-trigger-results.md` is a **bench** simulation of trigger *timing* with a scripted extractor; it answers "which moment is worth mining", not "does this earn its keep".
75
75
 
76
76
  **Am I armed?** `memory_evidence` answers on the `plugin_load` line: `capture=on` (the default), `capture=off` (`autoCapture: false`), `invalid_model`, `no_capabilities`, or `switch_mismatch`. `capture=on` plus no `auto_capture_*` line after a session means the pass did not complete, not that your configuration is wrong; #404 found that mechanism and its fix is merged. On desktop this needs `opencode service restart` after an edit — relaunching the app keeps the old service and its already-parsed options alive.
77
77
 
@@ -84,13 +84,13 @@ A memory is a claim about your code, so it gets checked like one. Four gates run
84
84
  3. **GATE-3 — no duplicates.** Near-duplicates collapse into the existing row; a contradiction with a superseded memory is rejected.
85
85
  4. **GATE-4 — promotion or block.** The row lands, or the call returns the reason.
86
86
 
87
- Nothing is deleted. `memory_update` supersedes the old row and `memory_forget` records a retirement, so history stays readable, and `memory_undo` restores a snapshot when a change turns out wrong. `memory_update` picks its row by `query` — an id, a clock fragment such as `00:11:22.123`, or a unique substring of its text — and a query that matches nothing, or several rows, writes nothing and says so. What carries over to the new row, what a `PARTIAL` reply means for the rows on disk, and what promotion evidence samples: [docs/write-gates.md](docs/write-gates.md).
87
+ Nothing is deleted. `memory_update` supersedes the old row and `memory_forget` records a retirement, so history stays readable, and `memory_undo` restores a snapshot when a change turns out wrong. `memory_update` picks its row by `query` — an id, a clock fragment such as `00:11:22.123`, or a unique substring of its text — and a query that matches nothing, or several rows, writes nothing and says so. What carries over to the new row, what a `PARTIAL` reply means for the rows on disk, and what promotion evidence samples: [docs/internals/write-gates.md](docs/internals/write-gates.md).
88
88
 
89
- **Guided constants (#349 / #351, experimental).** You and the code disagree about a constant, and who is right depends on what you said: capture records whether you stated the required value (`spec` — you are the authority) or described how working code behaves (`behavior` — code is the authority), and the CONFLICT verdict follows that class. The verdict table, what the code check will read, and the accepted residual: [docs/contradiction-authority.md](docs/contradiction-authority.md).
89
+ **Guided constants (#349 / #351, experimental).** You and the code disagree about a constant, and who is right depends on what you said: capture records whether you stated the required value (`spec` — you are the authority) or described how working code behaves (`behavior` — code is the authority), and the CONFLICT verdict follows that class. The verdict table, what the code check will read, and the accepted residual: [docs/internals/contradiction-authority.md](docs/internals/contradiction-authority.md).
90
90
 
91
91
  ## Repo scoping
92
92
 
93
- Rows are stamped with your git origin (an id that survives re-clones and moves between machines) or, without an origin, a hash of the normalized directory path. Reads — injection, recall, the frontier block, compaction, `memory_forget` and decay — see the current repo plus global rows. Writes follow the stricter direction: a named session whose repository cannot be resolved has **no write target**, so `memory_remember`, `memory_update`, `memory_import` and auto-capture refuse it (evidence `write_refused`) rather than stamp your content into another workspace or publish it as an unstamped row. Preferences that should follow you everywhere go in with `memory_remember global: true`. Identity derivation and legacy hashes, evidence attribution when a session moves repositories mid-operation, and the viewer's separate admin seat: [docs/repo-scoping.md](docs/repo-scoping.md).
93
+ Rows are stamped with your git origin (an id that survives re-clones and moves between machines) or, without an origin, a hash of the normalized directory path. Reads — injection, recall, the frontier block, compaction, `memory_forget` and decay — see the current repo plus global rows. Writes follow the stricter direction: a named session whose repository cannot be resolved has **no write target**, so `memory_remember`, `memory_update`, `memory_import` and auto-capture refuse it (evidence `write_refused`) rather than stamp your content into another workspace or publish it as an unstamped row. Preferences that should follow you everywhere go in with `memory_remember global: true`. Identity derivation and legacy hashes, evidence attribution when a session moves repositories mid-operation, and the viewer's separate admin seat: [docs/internals/repo-scoping.md](docs/internals/repo-scoping.md).
94
94
 
95
95
  ## What memory is worth, measured
96
96
 
@@ -123,7 +123,7 @@ Injecting memory costs prompt bytes, and prompt bytes are what a provider bills
123
123
  - **Things you said outright ride first.** A row auto-capture tagged `user-guided` — "the correct sales tax rate is 8.25%" — rides ahead of the lexical picks, newest-first, at most three, inside the budget. Only auto-capture mints the tag; `memory_remember`, updates and imports strip it, because always-riding priority is a poisoning amplifier.
124
124
  - **Budgets are hard, receipts are real.** The block and each pull are capped at `injectBudget` characters, the frontier at `frontierBudget`, trimmed at whole-memory boundaries. The badge shows the provider's own `tokens.cache` accounting; a host that reports nothing shows nothing. Auto-capture is the one place with no receipt at all — it is its own call after the turn — so `memory_status` prints it as `receipt=none`, an estimate.
125
125
 
126
- **Bench** — on a deterministic workload the shipped policy injects **12.3% fewer characters** than the naive policy, measured over the whole memory section: bytes on a synthetic run, not tokens and not a provider bill. The four-policy table, what the invalidation counter does and does not count, what the workload cannot show, and an author-reported provider audit (input tokens only, not a total and not a saving): [docs/injection-cost.md](docs/injection-cost.md). Reproduce the byte workload with `bun run bench`.
126
+ **Bench** — on a deterministic workload the shipped policy injects **12.3% fewer characters** than the naive policy, measured over the whole memory section: bytes on a synthetic run, not tokens and not a provider bill. The four-policy table, what the invalidation counter does and does not count, what the workload cannot show, and an author-reported provider audit (input tokens only, not a total and not a saving): [docs/internals/injection-cost.md](docs/internals/injection-cost.md). Reproduce the byte workload with `bun run bench`.
127
127
 
128
128
  ## Recall quality
129
129
 
@@ -142,11 +142,11 @@ No vector database, no embedding model, no API key: a keyword matcher. That is a
142
142
  - **Exact keyword lookup.** In a long `memory_recall` query, one complete authored keyword can identify a single visible candidate. Automatic prompt injection still requires two shared concepts for long queries.
143
143
  - **`memory_recall` returns 5 rows, not 20.** A live audit of 1,090 recall events found a rank-1 row used in a later tool call at 3.4x the rate of a random store row, and ranks 11–20 at 1.16x — noise. Pass `limit` for a wider sweep.
144
144
 
145
- The abstain-by-design rule, the permutation control behind the `kw` numbers, and the eval's caveats — a synthetic dataset, an adversarial class mix, single-gold scoring: [docs/recall-quality.md](docs/recall-quality.md). Full methodology and all store sizes: `bench/recall-results.md`. Reproduce with `bun run bench:recall`.
145
+ The abstain-by-design rule, the permutation control behind the `kw` numbers, and the eval's caveats — a synthetic dataset, an adversarial class mix, single-gold scoring: [docs/internals/recall-quality.md](docs/internals/recall-quality.md). Full methodology and all store sizes: `bench/recall-results.md`. Reproduce with `bun run bench:recall`.
146
146
 
147
147
  ## Write latency
148
148
 
149
- A write that cites code references builds one tree index — a single recursive walk that prunes `node_modules` and VCS directories — shared by GATE-1 and GATE-2, and reads each source file at most once. **Bench** on a 5,300-file fixture: 17ms, 15ms and 20ms for 1, 3 and 5 embedded call forms, against 105ms, 136ms and 169ms for one scan per form. The shipped column is flat because the tree is walked once no matter how many references the write cites. The fixture, the table and `bun run bench:write`: [docs/write-latency.md](docs/write-latency.md).
149
+ A write that cites code references builds one tree index — a single recursive walk that prunes `node_modules` and VCS directories — shared by GATE-1 and GATE-2, and reads each source file at most once. **Bench** on a 5,300-file fixture: 17ms, 15ms and 20ms for 1, 3 and 5 embedded call forms, against 105ms, 136ms and 169ms for one scan per form. The shipped column is flat because the tree is walked once no matter how many references the write cites. The fixture, the table and `bun run bench:write`: [docs/internals/write-latency.md](docs/internals/write-latency.md).
150
150
 
151
151
  ## The store keeps score
152
152
 
@@ -163,7 +163,7 @@ two distinct failing turns and two rides with unknown outcomes. Totals cover
163
163
  the store; individual rows follow repository visibility. Check the underlying
164
164
  memory before acting on a candidate. Gate failures alone cannot establish harm.
165
165
 
166
- Sample `STORE` output, the credit rule and its throttle, the consolidation tie-break, and capture lag: [docs/use-ledger.md](docs/use-ledger.md).
166
+ Sample `STORE` output, the credit rule and its throttle, the consolidation tie-break, and capture lag: [docs/internals/use-ledger.md](docs/internals/use-ledger.md).
167
167
 
168
168
  ## Consolidation
169
169
 
@@ -178,15 +178,19 @@ The rule is: never merge two entries unless every question that used to find eit
178
178
 
179
179
  ## Secret redaction
180
180
 
181
- One best-effort credential rule set (`src/secrets.ts`) replaces recognized values with `[redacted]`, and it runs at every boundary a credential could persist: the auto-capture prompt before it leaves the plugin, the write gate before content is hashed or analysed, the final write choke point used by gated writes and the viewer's edit and restore paths, and every durable audit line. Covered patterns, and the limits that matter — hex-only secrets and prose credentials it can miss, forward-only scrubbing, and the fact that deleting a row copies it rather than scrubbing it: [docs/secret-redaction.md](docs/secret-redaction.md).
181
+ One best-effort credential rule set (`src/secrets.ts`) replaces recognized values with `[redacted]`, and it runs at every boundary a credential could persist: the auto-capture prompt before it leaves the plugin, the write gate before content is hashed or analysed, the final write choke point used by gated writes and the viewer's edit and restore paths, and every durable audit line. Covered patterns, and the limits that matter — hex-only secrets and prose credentials it can miss, forward-only scrubbing, and the fact that deleting a row copies it rather than scrubbing it: [docs/internals/secret-redaction.md](docs/internals/secret-redaction.md).
182
182
 
183
183
  ## Export and move between machines
184
184
 
185
- `memory_export` writes the store as JSONL **as its caller can read it**: from a plugin session that means your repository plus global rows. `memory_import` reads such a file back, and every imported row re-enters through the same four gates as `memory_remember` (tagged `import`, original tags preserved). Both tools are model-facing, so a path is not a privilege: it must stay inside the store, and a symbolic link cannot carry a request out of it. The reply is a tally — `promoted`, `collapsed`, `blocked`, `skipped`, `downgraded` — not a yes/no. The move step by step, the file format, the confinement limits and the quarantine screen: [docs/export-import.md](docs/export-import.md).
185
+ `memory_export` writes the store as JSONL **as its caller can read it**: from a plugin session that means your repository plus global rows. `memory_import` reads such a file back, and every imported row re-enters through the same four gates as `memory_remember` (tagged `import`, original tags preserved). Both tools are model-facing, so a path is not a privilege: it must stay inside the store, and a symbolic link cannot carry a request out of it. The reply is a tally — `promoted`, `collapsed`, `blocked`, `skipped`, `downgraded` — not a yes/no. The move step by step, the file format, the confinement limits and the quarantine screen: [docs/internals/export-import.md](docs/internals/export-import.md).
186
186
 
187
187
  ## Surfaces
188
188
 
189
- Same data behind each one (`memory_status`; no model call): the terminal **footer badge** — the injected block against its budget plus the measured session prompt-cache hit rate, with the dot color telling you whether the cache is warm — the **`/memory`** session panel, **`/memory-report`** for chat clients where the terminal slots do not exist, and a loopback-only **browser editor** (`bun memory-view`). What each shows, the badge colors, and what binding the editor to a non-loopback host costs you: [docs/surfaces.md](docs/surfaces.md).
189
+ Same data behind each one (`memory_status`; no model call): the terminal **footer badge** — the injected block against its budget plus the measured session prompt-cache hit rate, with the dot color telling you whether the cache is warm — the **`/memory`** session panel, **`/memory-report`** for chat clients where the terminal slots do not exist, and a loopback-only **browser editor** (`bun memory-view`). What each shows, the badge colors, and what binding the editor to a non-loopback host costs you: [docs/reference/surfaces.md](docs/reference/surfaces.md).
190
+
191
+ ## Documentation
192
+
193
+ Every document under `docs/`, one line each with its audience and summary: [docs/README.md](docs/README.md). The accepted architecture decisions, with status and supersession: [docs/adr/README.md](docs/adr/README.md).
190
194
 
191
195
  ## Development
192
196
 
@@ -202,8 +206,18 @@ Use Bun **1.4.4** for development checks, matching CI. `bun run test` and `bun r
202
206
 
203
207
  **Feature order is BDD-first.** A new feature starts by adding or fixing a scenario in `e2e/` that describes the behavior as a user would observe it — before implementation code and before unit tests. If no scenario turns red first, the feature has no observable contract. `e2e/` boots the **real opencode CLI** in a fully isolated instance against a scripted fake model — no API keys, no shared store. It needs `opencode` on `PATH` locally, or `OPENCODE_BIN`.
204
208
 
205
- How the local commands map to CI job names, what the smoke suite really boots, why the published surface is decided by `package.json` `files`, and the pre-release mutation sweep with its artifact policy: [docs/development.md](docs/development.md) and [docs/pre-release-ritual.md](docs/pre-release-ritual.md).
209
+ How the local commands map to CI job names, what the smoke suite really boots, why the published surface is decided by `package.json` `files`, and the pre-release mutation sweep with its artifact policy: [docs/internals/development.md](docs/internals/development.md) and [docs/internals/pre-release-ritual.md](docs/internals/pre-release-ritual.md).
210
+
211
+ ## Layout
212
+
213
+ Two root files are shims, and both exist because OpenCode finds plugins two
214
+ different ways. **Loose plugin discovery** reads `<config>/plugins/<name>/index.ts`
215
+ and, next to it, a sibling `tui.ts` — so the repository root carries `index.ts`
216
+ (re-exporting `src/index.ts`) and `tui.ts` (re-exporting the default of
217
+ `src/tui/panel.tsx`). **Package installs** resolve through `package.json`
218
+ `exports` instead: `"."` → `./index.ts` and `"./tui"` → `./src/tui/panel.tsx`.
219
+ Real code lives under `src/`, one directory per module.
206
220
 
207
221
  ## Troubleshooting
208
222
 
209
- The whole list, one row per problem with its fix, is in [docs/troubleshooting.md](docs/troubleshooting.md): tools not available, a blocked `memory_remember`, an argument-schema rejection, `memory store is busy`, a store on a network share, a stale plugin after an update, auto-capture doing nothing, malformed rows, stray lock files, a missing `/repo-init`, and a clean reset on Windows.
223
+ The whole list, one row per problem with its fix, is in [docs/reference/troubleshooting.md](docs/reference/troubleshooting.md): tools not available, a blocked `memory_remember`, an argument-schema rejection, `memory store is busy`, a store on a network share, a stale plugin after an update, auto-capture doing nothing, malformed rows, stray lock files, a missing `/repo-init`, and a clean reset on Windows.
package/docs/README.md ADDED
@@ -0,0 +1,70 @@
1
+ # Documentation index
2
+
3
+ Every document under `docs/`, with its audience and a one-sentence summary.
4
+ User-facing material lives in [`reference/`](reference/), maintainer evidence
5
+ and design notes in [`internals/`](internals/), and decision records in
6
+ [`adr/`](adr/). The [README](../README.md) holds the quick start; this file
7
+ is the map. A new document anywhere under `docs/` must gain a line below —
8
+ `test/doc-links.test.ts` fails the build when one does not.
9
+
10
+ ## Using the plugin
11
+
12
+ - [Install variants and the version floor](reference/install.md) — users: the install
13
+ paths beyond the README's three steps, how updates are resolved, and the
14
+ supported version floor.
15
+ - [Options and environment variables](reference/options.md) — users: every knob in one
16
+ place, including what an invalid value does.
17
+ - [Research flags](reference/flags.md) — users who want the why: the three flags that
18
+ encode a measured finding rather than a preference, and the evidence behind
19
+ each.
20
+ - [Surfaces](reference/surfaces.md) — users: the four ways to see the same data, all
21
+ reading `memory_status` with no model call.
22
+ - [Troubleshooting, full list](reference/troubleshooting.md) — users: every problem and
23
+ its fix, the common ones and the rarer ones.
24
+ - [Export, import, and moving a store between machines](internals/export-import.md) —
25
+ users moving a store: the JSONL contract, and why you get what you can read.
26
+
27
+ ## How it works, and what the measurements say
28
+
29
+ - [Auto-capture: what the evidence covers](internals/auto-capture-evidence.md) —
30
+ maintainers: separates the three claims people confuse — the event fires,
31
+ the write survives, the live store agrees.
32
+ - [Contradiction authority: the code check and its limits](internals/contradiction-authority.md) —
33
+ maintainers: how the plugin decides when what you said and what the code
34
+ says disagree.
35
+ - [Write gates and promotion evidence](internals/write-gates.md) — maintainers: how a
36
+ memory claim is checked before it lands, the way a pull request is.
37
+ - [Repo scoping: identity, visibility and write refusal](internals/repo-scoping.md) —
38
+ maintainers: the repository label on every row, checked on the way in and
39
+ the way out.
40
+ - [Store concurrency, publication and permissions](internals/store-concurrency.md) —
41
+ maintainers: replacing a store file while other sessions read it — a book
42
+ swap, not a page rewrite.
43
+ - [Import, quarantine and the viewer's edit path](internals/import-quarantine.md) —
44
+ maintainers: a quarantined row stays in the store, withheld from everything
45
+ the model reads.
46
+ - [Secret redaction: what it covers and what it cannot](internals/secret-redaction.md) —
47
+ maintainers: the best-effort credential rules and the limits of a metal
48
+ detector.
49
+ - [The use ledger](internals/use-ledger.md) — maintainers: who looked at a row, when,
50
+ and how it reached them.
51
+ - [Injection epochs and their measured cost](internals/injection-cost.md) —
52
+ maintainers: how often the bytes in front of the model actually change, and
53
+ what that costs.
54
+ - [Recall quality: what the keyword matcher gives up](internals/recall-quality.md) —
55
+ maintainers: where word-overlap matching finds a memory and where it
56
+ misses.
57
+ - [Write latency: one tree walk per write](internals/write-latency.md) — maintainers:
58
+ why a write that cites code references scans the source tree once, not once
59
+ per reference.
60
+
61
+ ## Developing the plugin
62
+
63
+ - [Development internals](internals/development.md) — contributors: what the local
64
+ commands really run, what the smoke suite boots, and how the published npm
65
+ surface is decided.
66
+ - [Pre-release ritual: mutation sweep and artifact policy](internals/pre-release-ritual.md) —
67
+ release owners: break one claimed invariant on purpose and see whether
68
+ anything notices.
69
+ - [Architecture decisions](adr/README.md) — everyone: the accepted designs,
70
+ with status and supersession.
@@ -0,0 +1,16 @@
1
+ # Architecture decision records
2
+
3
+ One row per decision. `supersedes` and `superseded by` keep the chain
4
+ readable: a reader can tell an accepted decision from a retired one without
5
+ opening the file.
6
+
7
+ | ID | Title | Status | Supersedes | Superseded by |
8
+ | ---- | ----------------------------------------------------------------------------------------- | ---------------- | ---------- | ------------- |
9
+ | 0001 | [Two-concept admission for the recall tool](0001-two-concept-recall-admission.md) | accepted (2026-11) | — | — |
10
+ | 0002 | [Near-duplicate suppression inside the recall window](0002-window-dedup.md) | accepted (2026-11) | — | — |
11
+ | 0003 | [Identifier-aware tokenizer at two granularities](0003-identifier-tokenizer.md) | accepted (2026-11) | — | — |
12
+ | 0004 | [Viewer startup token on non-loopback binds](0004-viewer-startup-token.md) | accepted (2026-11) | — | — |
13
+ | 0005 | [Two-phase teardown for capture passes](0005-capture-teardown-phases.md) | accepted (2026-11) | — | — |
14
+ | 0006 | [Capture prompt integrity: redaction order and faithful citation](0006-capture-prompt-integrity.md) | accepted (2026-11) | — | — |
15
+ | 0007 | [Symptom-first opening for learning and blocker rows](0007-symptom-first-capture.md) | accepted (2026-11) | — | — |
16
+ | 0008 | [Availability verdicts tag rows; they never refuse them](0008-availability-tags-not-refusals.md) | accepted (2026-11) | — | — |
@@ -44,7 +44,7 @@ it to itself.
44
44
  The line format, what an import will believe about `status:"open"`, and the two
45
45
  confinement limits no path check closes (a hard link inside `exports/`, and the
46
46
  looser check on intermediate components):
47
- [docs/import-quarantine.md](import-quarantine.md).
47
+ [docs/internals/import-quarantine.md](import-quarantine.md).
48
48
 
49
49
  ## Quarantine
50
50
 
@@ -58,4 +58,4 @@ Review the queue in the viewer's **quarantined** filter.
58
58
  What the screen covers, what it misses, how an existing store is re-tagged, what
59
59
  releasing quarantine does and what it leaves alone, and why direct
60
60
  `memory_remember` and viewer edits are not scanned:
61
- [docs/import-quarantine.md](import-quarantine.md).
61
+ [docs/internals/import-quarantine.md](import-quarantine.md).
@@ -6,7 +6,7 @@ store where you can read it, and is withheld from everything the model reads.
6
6
  What the prose screen catches and misses, how an existing store gets
7
7
  re-tagged, what releasing quarantine does, and which writes it does not
8
8
  cover. The export contract and the import tally are in
9
- [docs/export-import.md](export-import.md).
9
+ [docs/internals/export-import.md](export-import.md).
10
10
 
11
11
  Import and auto-capture also scan incoming prose for a small set of instruction-override, role-header, and download/execute patterns. Matching rows still face every write gate; a promoted match is tagged `quarantine` and withheld from recall, prompt/frontier injection, compaction anchors, contextual pull, scope/type listings, consolidation proposals, and decay. Decay previews do not quote these rows, and applied decay leaves them in the human review queue. The import reply counts quarantined promotions, gate evidence records pattern identifiers without copying the matched prose, and `/memory-report` lists review IDs for the caller's repository.
12
12
 
@@ -17,11 +17,11 @@ The output is a canonical mutation score — killed over total, with equivalent
17
17
 
18
18
  Run it when you want to know whether the suite still has teeth — after changing tests or coverage, or as a pre-release gate with `bun scripts/test-sweep.ts --fail-on-survivors`, which exits 4 when anything survives. Two lighter checks come first: `bun scripts/test-sweep.ts --validate` confirms every mutation pattern still lands on exactly one source site without running the suite, and `bun scripts/test-sweep.ts --selftest` plants a mutation in a trivially-tested pure function and fails unless the suite kills it — proof the instrument itself can go red.
19
19
 
20
- **Pre-release ritual (decided 2026-11-04, #72):** before pushing a release commit, a human runs `--validate`, then `--selftest`, then `--fail-on-survivors`, and records the mutation score and the survivor list in `bench/RESULTS.md` beside the published evidence. Cadence is pre-release only, run by a person: the sweep is a full suite per mutant and never belongs in CI, where it would cost more than it informs. Survivors become entries on the unpinned-invariant list, not red checks.
20
+ **Pre-release ritual (decided 2026-11-04, #72):** before pushing a release commit, a human runs `--validate`, then `--selftest`, then `--fail-on-survivors`, and records the mutation score and the survivor list in `bench/mutation-sweep.md` (its own file, because `bun run bench` regenerates `bench/results.md` in full). Cadence is pre-release only, run by a person: the sweep is a full suite per mutant and never belongs in CI, where it would cost more than it informs. Survivors become entries on the unpinned-invariant list, not red checks.
21
21
 
22
22
  ### Bench artifacts stay out of git
23
23
 
24
- Raw sweep output is regenerable measurement data, and it was the largest tracked content in the repository. It is not committed (#232). A clone carries the published summaries — `bench/RESULTS.md` and the `bench/*-results.md` files — and the inputs those summaries are rebuilt from. History is not rewritten: the old blobs stay in earlier revisions, so this shrinks new checkouts, not the archive.
24
+ Raw sweep output is regenerable measurement data, and it was the largest tracked content in the repository. It is not committed (#232). A clone carries the published summaries — `bench/results.md` and the `bench/*-results.md` files — and the inputs those summaries are rebuilt from. History is not rewritten: the old blobs stay in earlier revisions, so this shrinks new checkouts, not the archive.
25
25
 
26
26
  | Artifact | How to get it back |
27
27
  | --- | --- |
@@ -22,4 +22,4 @@ bun run bench:write
22
22
  ```
23
23
 
24
24
  What each gate does with what the walk finds:
25
- [docs/write-gates.md](write-gates.md).
25
+ [docs/internals/write-gates.md](write-gates.md).
@@ -2,8 +2,9 @@
2
2
 
3
3
  The three flags that encode a measured finding rather than a preference:
4
4
  what each one enforces, the evidence behind it, and what an invalid value
5
- does. The README names the three and points here; this file is the whole
6
- behaviour.
5
+ does. These are not the general option surface — every other knob lives in
6
+ [Options and environment variables](options.md). The README names the three
7
+ and points here; this file is the whole behaviour.
7
8
 
8
9
  `OPENCODE_MEMORY_SYMPTOM` is the clearest case. A lesson saved as "in this
9
10
  session we fixed the flaky test" shares no words with the query a future
@@ -42,4 +42,4 @@ A config edit needs a restart to take effect. On the desktop app, relaunching th
42
42
  app is not enough: the background service stays alive with the options it already
43
43
  parsed, so use `opencode service restart`. That is also why `memory_evidence` can
44
44
  report a `capture=` value your config no longer contains. See
45
- [docs/troubleshooting.md](troubleshooting.md).
45
+ [docs/reference/troubleshooting.md](troubleshooting.md).
@@ -1,7 +1,10 @@
1
1
  # Options and environment variables
2
2
 
3
- Every knob, in one place. The README keeps the ones you are likely to set; this
4
- file is the complete reference, including what an invalid value does.
3
+ Every knob, in one place — the general option surface. The three flags that
4
+ encode a measured finding rather than a preference are documented separately
5
+ in [Research flags](flags.md). The README keeps the ones you are likely to
6
+ set; this file is the complete reference, including what an invalid value
7
+ does.
5
8
 
6
9
  ## Plugin options
7
10
 
@@ -17,7 +20,7 @@ Set them in the object form of the plugin entry in `opencode.json(c)`:
17
20
  | --- | --- | --- |
18
21
  | `injectBudget` | `1200` | Character cap on the injected relevance block and each contextual pull; trimmed at whole-memory boundaries. Env fallback: `OPENCODE_MEMORY_INJECT_BUDGET`. |
19
22
  | `frontierBudget` | `3 × injectBudget` | Character cap on the session-start open-threads block. A thread longer than the budget is not injected and is reported as omitted. Env fallback: `OPENCODE_MEMORY_FRONTIER_BUDGET`. |
20
- | `contradictionSurface` | `true` | Experimental: compare guided constant claims with bounded source reads and render a class-specific CONFLICT verdict. Set `false` to skip code checks and retain plain guidance. See [docs/contradiction-authority.md](contradiction-authority.md). |
23
+ | `contradictionSurface` | `true` | Experimental: compare guided constant claims with bounded source reads and render a class-specific CONFLICT verdict. Set `false` to skip code checks and retain plain guidance. See [docs/internals/contradiction-authority.md](../internals/contradiction-authority.md). |
21
24
  | `notifyBlocked` | `true` | Terminal (TUI) only: toast when a write gate blocks a write. Blocks are always in `memory_evidence` either way. |
22
25
  | `autoCapture` | `true` | Master switch for auto-capture. On, so a plain install mines turn ends and compactions. Set `false` for no capture model call at all. |
23
26
  | `captureModel` | inherits | `"provider/id"` model used for auto-capture. Unset means the model the session is using, else the host default. An explicit value that is not `provider/id` disables capture with a startup warning rather than substituting a model. |
@@ -30,7 +33,7 @@ Set them in the object form of the plugin entry in `opencode.json(c)`:
30
33
  | Variable | Purpose |
31
34
  | --- | --- |
32
35
  | `OPENCODE_MEMORY_DIR` | Store location (default `~/.config/opencode/memory`). |
33
- | `OPENCODE_MEMORY_ALLOW_OUTSIDE_PATHS` | Operator-only. When truthy, `memory_export`/`memory_import` accept paths anywhere on disk instead of confining themselves to the store. Off by default. It is read from the plugin process's own environment, so a model cannot grant it to itself through a tool argument. See [docs/import-quarantine.md](import-quarantine.md). |
36
+ | `OPENCODE_MEMORY_ALLOW_OUTSIDE_PATHS` | Operator-only. When truthy, `memory_export`/`memory_import` accept paths anywhere on disk instead of confining themselves to the store. Off by default. It is read from the plugin process's own environment, so a model cannot grant it to itself through a tool argument. See [docs/internals/import-quarantine.md](../internals/import-quarantine.md). |
34
37
  | `OPENCODE_MEMORY_INJECT_BUDGET` | Fallback for `injectBudget`. |
35
38
  | `OPENCODE_MEMORY_FRONTIER_BUDGET` | Fallback for `frontierBudget`. |
36
39
  | `OPENCODE_COMMANDS_DIR` | Where the plugin mirrors its slash commands (default `~/.config/opencode/commands`). |
@@ -38,4 +41,4 @@ Set them in the object form of the plugin entry in `opencode.json(c)`:
38
41
  | `OPENCODE_VIEWER_PORT` | Admin editor port (default `8787`). |
39
42
  | `OPENCODE_VIEWER_ALLOWED_HOSTS` | Comma-separated hosts beyond loopback. |
40
43
 
41
- `OPENCODE_MEMORY_DEDUP`, `OPENCODE_MEMORY_SYMPTOM` and `OPENCODE_MEMORY_QUERY_GATE` are documented separately in [docs/flags.md](flags.md): they switch behaviour that a measurement decided, so the evidence behind each one matters more than the default.
44
+ `OPENCODE_MEMORY_DEDUP`, `OPENCODE_MEMORY_SYMPTOM` and `OPENCODE_MEMORY_QUERY_GATE` are documented separately in [docs/reference/flags.md](flags.md): they switch behaviour that a measurement decided, so the evidence behind each one matters more than the default.
@@ -36,4 +36,4 @@ plain HTTP with no authentication — only do it on a network you control.
36
36
 
37
37
  The viewer is a trusted admin seat. Its edits and deleted-entry restores skip the
38
38
  model-facing grounding and deduplication gates but honor the same value
39
- rejections: [docs/import-quarantine.md](import-quarantine.md).
39
+ rejections: [docs/internals/import-quarantine.md](../internals/import-quarantine.md).
@@ -26,4 +26,4 @@ The seven cases a session actually hits.
26
26
  | `memory store is busy` | A store write exhausted its 5s lock-wait budget, so the mutation is refused rather than run unlocked. Retry after contention clears. An operation spanning several files or steps may have completed earlier steps; refusal is not a rollback of those steps. If the reply reports `PARTIAL`, inspect the named rows and `memory_evidence` / `memory_undo` before retrying. A process that is killed releases the lock when it dies — there is no stale window to wait out. |
27
27
  | Writes report a disk I/O error and the store is on a share | The lock's write-ahead log needs mmap'd shared memory, which SQLite does not support on network filesystems. SMB, NFS and OneDrive-mounted roots are unsupported — move `OPENCODE_MEMORY_DIR` to local disk. |
28
28
  | Stale plugin after an update | `opencode plugin update opencode-self-improvement` (or bump the pinned `@version` in the `plugins` entry) and restart opencode. On desktop use `opencode service restart`: relaunching the app leaves the background service — and the plugin version and options it already parsed — alive. |
29
- | Auto-capture does nothing | `memory_evidence` says which case you are in from the `plugin_load` line: `capture=on` (the default), `capture=off` (you set `autoCapture: false`), `invalid_model`, `no_capabilities` or `switch_mismatch`. `capture=on` with no `auto_capture_*` line after a session means the pass did not complete, and is not your configuration — see [Auto-capture](../README.md#auto-capture). On desktop, changing any of these options needs `opencode service restart`. The same `plugin_load` line carries `subscribed=[…]`, listing the event types that subscription really reacts to. |
29
+ | Auto-capture does nothing | `memory_evidence` says which case you are in from the `plugin_load` line: `capture=on` (the default), `capture=off` (you set `autoCapture: false`), `invalid_model`, `no_capabilities` or `switch_mismatch`. `capture=on` with no `auto_capture_*` line after a session means the pass did not complete, and is not your configuration — see [Auto-capture](../../README.md#auto-capture). On desktop, changing any of these options needs `opencode service restart`. The same `plugin_load` line carries `subscribed=[…]`, listing the event types that subscription really reacts to. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-self-improvement",
3
- "version": "0.33.2",
3
+ "version": "0.33.3",
4
4
  "description": "Durable memory for opencode: remember facts, decisions, and commands across sessions, plus a one-command per-repo setup (/repo-init).",
5
5
  "main": "index.ts",
6
6
  "exports": {
package/tui.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  // Convenience re-export for the loose plugin-discovery layout
2
2
  // (<config>/plugins/<name>/index.ts + tui.ts). Package installs resolve
3
- // "./tui" through package.json exports to src/tui.tsx directly.
3
+ // "./tui" through package.json exports to src/tui/panel.tsx directly.
4
4
  export { default } from "./src/tui/panel.tsx";
@@ -0,0 +1,8 @@
1
+ # Vendored: opencode-memory license
2
+
3
+ Only the upstream `LICENSE` is vendored here, and deliberately so: this
4
+ repository does not copy opencode-memory source files. It reproduces the
5
+ upstream logfmt store format — see `src/store/files/load.ts` — and extends
6
+ it, so the MIT attribution for the format is what has to ship. The upstream
7
+ project is `github.com/shuans/opencode-memory` (MIT, Copyright (c) 2025
8
+ Kris). Nothing else is missing from this directory.
File without changes