opencode-self-improvement 0.30.5 → 0.31.1
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/README.md +71 -244
- package/docs/auto-capture-evidence.md +8 -1
- package/docs/contradiction-authority.md +40 -4
- package/docs/development.md +23 -3
- package/docs/export-import.md +61 -0
- package/docs/flags.md +10 -2
- package/docs/import-quarantine.md +18 -2
- package/docs/injection-cost.md +10 -5
- package/docs/install.md +45 -0
- package/docs/options.md +41 -0
- package/docs/pre-release-ritual.md +4 -0
- package/docs/recall-quality.md +56 -0
- package/docs/repo-scoping.md +29 -5
- package/docs/secret-redaction.md +51 -0
- package/docs/store-concurrency.md +14 -1
- package/docs/surfaces.md +39 -0
- package/docs/troubleshooting.md +29 -0
- package/docs/use-ledger.md +61 -0
- package/docs/write-gates.md +17 -2
- package/docs/write-latency.md +25 -0
- package/package.json +1 -1
- package/src/capture/candidates.ts +1 -1
- package/src/capture/prompt.ts +1 -1
- package/src/capture/runtime.ts +19 -17
- package/src/capture/triggers.ts +1 -1
- package/src/consolidate/propose.ts +1 -1
- package/src/core/config/paths.ts +1 -1
- package/src/events.ts +2 -2
- package/src/gate/gate.ts +1 -1
- package/src/identity/session-context.ts +1 -1
- package/src/index.ts +18 -18
- package/src/init/run.ts +1 -1
- package/src/init/stamp.ts +1 -1
- package/src/inject/digest.ts +1 -1
- package/src/inject/epochs.ts +2 -2
- package/src/recall/gate.ts +30 -4
- package/src/status/report.ts +4 -4
- package/src/status/store-summary.ts +1 -1
- package/src/store/files/load.ts +1 -1
- package/src/store/lock.ts +1 -1
- package/src/store/prune.ts +1 -1
- package/src/store/tombstones/rejection.ts +1 -1
- package/src/store/tombstones/tombstone.ts +1 -1
- package/src/store/undo.ts +1 -1
- package/src/tools/consolidate.ts +2 -2
- package/src/tools/decay.ts +1 -1
- package/src/tools/deps.ts +1 -1
- package/src/tools/evidence.ts +1 -1
- package/src/tools/merge-review.ts +1 -1
- package/src/tools/recall.ts +15 -6
- package/src/tools/status-tool.ts +1 -1
- package/src/tools/update.ts +1 -1
- package/src/viewer/mutate.ts +1 -1
- /package/src/{command → init}/ensure.ts +0 -0
- /package/src/{hits → telemetry}/ledger.ts +0 -0
- /package/src/{evidence → telemetry}/record.ts +0 -0
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Opencode-Self-Improvement
|
|
2
2
|
|
|
3
|
-
Durable memory for [opencode](https://opencode.ai): the decisions, commands and facts an agent should
|
|
3
|
+
Durable memory for [opencode](https://opencode.ai): the decisions, commands and facts an agent should still know next week, plus a one-command per-repo setup.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Say "we use Bun, not npm — npm keeps breaking the lockfile" on Monday. A session you start on Tuesday already knows it, and why. A memory that turns out wrong is superseded, never deleted, and `memory_undo` rolls it back.
|
|
6
6
|
|
|
7
|
-
Every figure
|
|
7
|
+
Every figure here carries a marker: **measured** (read off a live store), **bench** (a deterministic synthetic workload, reproducible with the command printed under the table), or **illustrative** (sample output showing shape, not a measurement). A number without a marker is a claim that has not been checked.
|
|
8
8
|
|
|
9
9
|
## Quick start
|
|
10
10
|
|
|
@@ -17,122 +17,80 @@ Every figure in this README carries a provenance marker: **measured** (read off
|
|
|
17
17
|
}
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
**2. Restart opencode.**
|
|
20
|
+
**2. Restart opencode.** On the desktop app a later config edit needs `opencode service restart`: relaunching the app leaves the background service, and the options it already parsed, alive.
|
|
21
21
|
|
|
22
|
-
**3. Run `/repo-init`** in each repo you work in. It stores
|
|
23
|
-
|
|
24
|
-
Needs Bun 1.3.0 or newer in the opencode build (the tested floor); older Bun reports a startup warning.
|
|
25
|
-
|
|
26
|
-
On opencode v2 the CLI works too:
|
|
27
|
-
|
|
28
|
-
```sh
|
|
29
|
-
opencode plugin add opencode-self-improvement
|
|
30
|
-
opencode plugin update opencode-self-improvement
|
|
31
|
-
```
|
|
22
|
+
**3. Run `/repo-init`** in each repo you work in. It stores that repo's test / build / lint / typecheck commands as memories, so the next session does not rediscover them. Rerun `/repo-init force` after a refactor.
|
|
32
23
|
|
|
33
24
|
After that, memory is just conversation: ask the agent to remember something and it sticks.
|
|
34
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).
|
|
27
|
+
|
|
35
28
|
## What you get
|
|
36
29
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
- **Write gates
|
|
40
|
-
- **
|
|
41
|
-
- **
|
|
42
|
-
- **
|
|
43
|
-
- **
|
|
44
|
-
- **
|
|
45
|
-
- **
|
|
46
|
-
- **Export / import (JSONL)** — back the store up or move it between machines; every imported row re-enters through the
|
|
47
|
-
- **Surfaces** — a
|
|
48
|
-
- **Secret redaction** — credential-shaped values
|
|
30
|
+
Think of it as a lab notebook the agent keeps for your repo, plus a librarian who checks every entry before filing it.
|
|
31
|
+
|
|
32
|
+
- **Write gates — a CI check for facts.** A memory citing `parseHeader()` in a file you deleted is refused before it is stored, not after a future session trusts it. Near-duplicates collapse, and a contradiction with a retired memory is rejected. Every refusal lands in `memory_evidence` with its reason.
|
|
33
|
+
- **Budgeted injection.** Relevant memories ride the prompt on their own, capped at `injectBudget` characters. The block is cache-stable: a write somewhere else in the store does not cost you a cache miss.
|
|
34
|
+
- **Repo scoping.** Every row carries the repo that wrote it, so project A's facts never surface in project B. A preference you want everywhere goes in with `memory_remember global: true`.
|
|
35
|
+
- **Nothing is deleted.** `memory_update` supersedes the old row, `memory_forget` records a retirement, `memory_undo` restores a snapshot.
|
|
36
|
+
- **Memory-aware compaction** — a long session hands its durable facts to the summarizer instead of losing them.
|
|
37
|
+
- **Safe across concurrent sessions** — a reader sees the previous store file or the new one, never half of either.
|
|
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).
|
|
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
|
+
- **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).
|
|
49
44
|
|
|
50
45
|
Memory is stored outside every repository, under `~/.config/opencode/memory` by default (override with `OPENCODE_MEMORY_DIR`). To start over, delete that directory.
|
|
51
46
|
|
|
52
|
-
A write publishes a **complete replacement file** under a per-file lock, so a concurrent reader sees the previous file or the new one, never a partial record. New store directories are `0700` and new files `0600` on POSIX, subject to a more restrictive umask. A memory root on SMB, NFS or a OneDrive-mounted folder is **not supported** — the lock's write-ahead log needs shared memory that SQLite cannot mmap there. Lock scope and why it is one file rather than the store, the Windows reader handle that can refuse a replacement, permission migration and what it does not revoke: [docs/store-concurrency.md](docs/store-concurrency.md).
|
|
53
|
-
|
|
54
47
|
## Options
|
|
55
48
|
|
|
56
|
-
Zero configuration is the default.
|
|
57
|
-
|
|
58
|
-
```json
|
|
59
|
-
{
|
|
60
|
-
"plugins": [{ "package": "opencode-self-improvement", "options": { "injectBudget": 1200, "frontierBudget": 3600 } }]
|
|
61
|
-
}
|
|
62
|
-
```
|
|
49
|
+
Zero configuration is the default. Two options change what the model sees:
|
|
63
50
|
|
|
64
51
|
| Option | Default | What it does |
|
|
65
52
|
| --- | --- | --- |
|
|
66
|
-
| `injectBudget` | `1200` | Character cap on the injected relevance block and each contextual pull
|
|
67
|
-
| `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.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
| `captureModel` | — | `"provider/id"` model used for auto-capture. Required when `autoCapture` is on; missing or invalid disables capture with a startup warning. |
|
|
71
|
-
| `captureMax` | `3` | Maximum candidates proposed per capture pass. |
|
|
72
|
-
| `captureOnCompact` | `true` | When `autoCapture` is on, also mine the transcript at compaction, before the summarizer replaces it. Its 5-minute cooldown is separate from the turn-end one, so the two triggers' hit-rates stay measurable. Setting it while `autoCapture` is off does nothing and reports a startup warning. |
|
|
73
|
-
| `captureGuidedRules` | `false` | POC: deterministic guided-candidate pre-pass. The user's own lines decide which stated values or rules are guided (numbers, rates, currency, explicit rule assertions) and attach the verbatim quote; the capture model may phrase such a row but cannot clear the flag or the quote, and a guided quote the user never wrote is refused at the write boundary instead of silently stripped. Fires alongside the model pass only — no extra model calls. |
|
|
74
|
-
| `notifyBlocked` | `true` | Terminal (TUI) only: toast when a write gate blocks a write. Blocks are always in `memory_evidence` either way. |
|
|
53
|
+
| `injectBudget` | `1200` | Character cap on the injected relevance block and each contextual pull. |
|
|
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
|
+
|
|
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.
|
|
75
57
|
|
|
76
|
-
|
|
58
|
+
## Auto-capture
|
|
77
59
|
|
|
78
|
-
|
|
79
|
-
| --- | --- |
|
|
80
|
-
| `OPENCODE_MEMORY_DIR` | Store location (default `~/.config/opencode/memory`). |
|
|
81
|
-
| `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. See [Export and move between machines](#export-and-move-between-machines). |
|
|
82
|
-
| `OPENCODE_MEMORY_INJECT_BUDGET` | Fallback for `injectBudget`. |
|
|
83
|
-
| `OPENCODE_MEMORY_FRONTIER_BUDGET` | Fallback for `frontierBudget`. |
|
|
84
|
-
| `OPENCODE_MEMORY_DEDUP` | Near-duplicate suppression inside a `memory_recall` window. **ON by default at `0.8`** (content-token Jaccard, same scope): the newest copy of a near-clone is kept and the rest skipped, so the window fills with distinct facts. Rows that disagree on a negation word are never suppressed. `0` restores the plain top-`limit` slice. |
|
|
85
|
-
| `OPENCODE_MEMORY_SYMPTOM` | **ON by default**: `learning` and `blocker` rows must open their content with the observable trigger a future session will hit — `"When <symptom>: <fact>"`. Set `off` (or `0`/`false`) for automation holding a pre-convention backlog. `scripts/symptom-fixer.ts` repairs old rows offline. |
|
|
86
|
-
| `OPENCODE_MEMORY_QUERY_GATE` | **ON by default**: a `memory_recall` match must share **two** whole words once the query has three content words — the rule the injected relevance block already applies. Set `off` for the matcher's permissive one-word admission. |
|
|
87
|
-
| `OPENCODE_COMMANDS_DIR` | Where the plugin mirrors its slash commands (default `~/.config/opencode/commands`). |
|
|
88
|
-
| `OPENCODE_VIEWER_HOST` | Interface the editor binds to (default `127.0.0.1`). A non-loopback bind serves the store over plain HTTP with no authentication — only do it on a network you control. See [Surfaces](#surfaces). |
|
|
89
|
-
| `OPENCODE_VIEWER_PORT` | Admin editor port (default `8787`). |
|
|
90
|
-
| `OPENCODE_VIEWER_ALLOWED_HOSTS` | Comma-separated hosts beyond loopback. See [Surfaces](#surfaces). |
|
|
60
|
+
Auto-capture is the part that notices facts on its own instead of waiting to be asked. At the end of a turn — and again at compaction, before the summarizer replaces the transcript — one cheap model pass reads what just happened and proposes up to `captureMax` candidates (default 3). They face the same four write gates as anything you save by hand, and a 5-minute cooldown per session and trigger bounds the spend.
|
|
91
61
|
|
|
92
|
-
|
|
62
|
+
It is **on by default** and needs no model name to run. With `captureModel` unset, each pass uses the model your session is already using, or the host default. Name `captureModel` only to pin one model: an explicit value that is not `provider/id` turns auto-capture off with a startup warning rather than substituting a model you did not choose.
|
|
93
63
|
|
|
94
|
-
|
|
64
|
+
**What that default means for your data.** Because the switch is on, installing this plugin sends a copy of the conversation to your configured model at every turn-end and every compaction. The copy excludes reasoning content and runs through the credential scrubber first, and anything the pass proposes still faces the same write gates as a manual save — but the read itself is real, and it goes out over your provider. Set `autoCapture: false` if you do not want that:
|
|
95
65
|
|
|
96
|
-
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"plugins": [{ "package": "opencode-self-improvement", "options": { "autoCapture": false } }]
|
|
69
|
+
}
|
|
70
|
+
```
|
|
97
71
|
|
|
98
|
-
|
|
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.
|
|
99
73
|
|
|
100
|
-
What
|
|
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".
|
|
101
75
|
|
|
102
|
-
**Am I armed?** `memory_evidence` answers on the `plugin_load` line: `capture=
|
|
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.
|
|
103
77
|
|
|
104
78
|
## How memory is written
|
|
105
79
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
Four gates run before anything is stored, and each emits an ordered evidence line:
|
|
80
|
+
A memory is a claim about your code, so it gets checked like one. Four gates run before anything is stored, and each emits an ordered evidence line:
|
|
109
81
|
|
|
110
82
|
1. **GATE-1 — code references resolve.** Call signatures and paths embedded in the memory are checked against your live source tree.
|
|
111
83
|
2. **GATE-2 — no stale memory applies here.** References that drifted out of date are superseded or the write is blocked.
|
|
112
84
|
3. **GATE-3 — no duplicates.** Near-duplicates collapse into the existing row; a contradiction with a superseded memory is rejected.
|
|
113
85
|
4. **GATE-4 — promotion or block.** The row lands, or the call returns the reason.
|
|
114
86
|
|
|
115
|
-
Nothing is deleted
|
|
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).
|
|
116
88
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
`contradictionSurface` defaults to `true`; set it to `false` to keep plain guidance without code checks. Guided capture can attach a declared constant's `ref`, the user's value as `claim`, and an authority `klass`:
|
|
120
|
-
|
|
121
|
-
| Captured statement | Class | Verdict on a detected conflict |
|
|
122
|
-
| --- | --- | --- |
|
|
123
|
-
| User states the required value for a declared constant | `spec` | The user is the authority; change the constant to the stated requirement. |
|
|
124
|
-
| User describes how working code behaves | `behavior` | Code is the authority; keep the constant and raise the mismatch with the user. |
|
|
125
|
-
| Authority is unclear | Omit `klass` | Keep plain guidance and its staleness caveat; emit no CONFLICT verdict. |
|
|
126
|
-
|
|
127
|
-
The code check accepts only a unique top-level `const` with a literal value, runs inside fixed source budgets, and refuses to decide anything it cannot read. Its limits, and the accepted residual — a user-stated **wrong spec** still classifies as `spec` and its verdict follows that requirement — are in [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/contradiction-authority.md](docs/contradiction-authority.md).
|
|
128
90
|
|
|
129
91
|
## Repo scoping
|
|
130
92
|
|
|
131
|
-
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. `
|
|
132
|
-
|
|
133
|
-
Injection, recall, the frontier block, compaction, `memory_forget` and decay see the current repo plus global rows, resolved from the calling session's identity at flow entry. 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`.
|
|
134
|
-
|
|
135
|
-
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/repo-scoping.md](docs/repo-scoping.md).
|
|
136
94
|
|
|
137
95
|
## What memory is worth, measured
|
|
138
96
|
|
|
@@ -158,20 +116,18 @@ Two results. Only two are quoted, each with its `n` and the seat it ran on, beca
|
|
|
158
116
|
|
|
159
117
|
## Token cost and caching
|
|
160
118
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
- **
|
|
164
|
-
- **
|
|
165
|
-
- **
|
|
166
|
-
- **
|
|
167
|
-
- **Receipts, not claims.** The plugin reads each turn's `tokens.cache` accounting and shows the actual hit rate next to the badge, with the session's `output` and `reasoning` split. A host that reports neither shows nothing, never a zero.
|
|
168
|
-
- **Auto-capture bills separately, and it is an estimate.** Capture is its own model call made after the turn, so it appears in no session's usage, and the host exposes no receipt for it. `memory_status` reports chars/4 with `receipt=none` and the words "estimate, no provider receipt". Quote that number as an estimate or not at all.
|
|
119
|
+
Injecting memory costs prompt bytes, and prompt bytes are what a provider bills against. So the plugin treats the injected block like a cached HTTP response: it is recomputed only when the content the model is actually reading changes, and until then it is delivered byte-identically and served from cache.
|
|
120
|
+
|
|
121
|
+
- **The frozen bytes are the authority, not the store fingerprint.** A row promoted elsewhere in the store that changes nothing visible costs no cache bust. A memory *you* saved in this session is already in your own transcript, so it does not bust your cache either; a correction of a row you are riding, or anything another session, the viewer or an import wrote, still lands on your next request.
|
|
122
|
+
- **Two concepts, not one.** A free-text prompt must share at least two distinct concepts with a memory to be injected; one- and two-word queries need only one. Identifier spellings count once: `getUserAccount`, `get_user_account`, `get-user-account` and `get.user.account` are one concept rather than four ([#409](https://github.com/abogartz/opencode-self-improvement/issues/409)).
|
|
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
|
+
- **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.
|
|
169
125
|
|
|
170
|
-
**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
|
|
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`.
|
|
171
127
|
|
|
172
128
|
## Recall quality
|
|
173
129
|
|
|
174
|
-
No vector database, no embedding model, no API key.
|
|
130
|
+
No vector database, no embedding model, no API key: a keyword matcher. That is a trade, and here is the price, measured against classic BM25 on a deterministic eval (store of 200, k=3 — the production injection limit). **Bench**:
|
|
175
131
|
|
|
176
132
|
| Query, vs. the stored memory | share | R@1 | R@3 | with `kw` R@1 | with `kw` R@3 |
|
|
177
133
|
| --- | ---: | ---: | ---: | ---: | ---: |
|
|
@@ -181,56 +137,34 @@ No vector database, no embedding model, no API key. **Bench** — what the keywo
|
|
|
181
137
|
|
|
182
138
|
"with `kw`" is the same matcher over the same store with each row's write-time keywords indexed; the only changed variable is the index.
|
|
183
139
|
|
|
184
|
-
- **
|
|
185
|
-
- **
|
|
186
|
-
- **
|
|
187
|
-
- **`memory_recall` returns 5 rows
|
|
188
|
-
- **Caveats.** The dataset is synthetic (52 memories / 105 queries, a fictional project), its class mix is deliberately adversarial, and scoring is single-gold.
|
|
140
|
+
- **Most in-project prompts are lexical** (`bun test`, "the rate limiter", "staging deploys"): 98–100% R@3, flat from store size 50 to 500.
|
|
141
|
+
- **A zero-overlap paraphrase is the real limit, and write time is where you answer it.** "How we deploy" will not match a session that types "ship to staging" unless you say so: `memory_remember` asks each row for 3–5 `kw` aliases — other names, other verb forms, the literal command — indexed and never rendered. Strict R@1 0% → 26%, near R@1 28% → 67%. Narrowed, not removed.
|
|
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
|
+
- **`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.
|
|
189
144
|
|
|
190
|
-
Full methodology and all store sizes: `bench/recall-results.md`.
|
|
191
|
-
|
|
192
|
-
```sh
|
|
193
|
-
bun run bench:recall
|
|
194
|
-
```
|
|
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`.
|
|
195
146
|
|
|
196
147
|
## Write latency
|
|
197
148
|
|
|
198
|
-
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**
|
|
199
|
-
|
|
200
|
-
| Call forms in the write | Shipped | One scan per form |
|
|
201
|
-
| --- | ---: | ---: |
|
|
202
|
-
| 1 | 17ms | 105ms |
|
|
203
|
-
| 3 | 15ms | 136ms |
|
|
204
|
-
| 5 | 20ms | 169ms |
|
|
205
|
-
|
|
206
|
-
The shipped column is flat: the tree is walked once no matter how many references the write cites.
|
|
207
|
-
|
|
208
|
-
```sh
|
|
209
|
-
bun run bench:write
|
|
210
|
-
```
|
|
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).
|
|
211
150
|
|
|
212
151
|
## The store keeps score
|
|
213
152
|
|
|
214
|
-
The plugin keeps a
|
|
153
|
+
The plugin keeps a use ledger — a due-date card for every row: who looked at it, when, and how it reached them. It is append-only, never ingested as a memory, and reported in `memory_status` and the `/memory` panel.
|
|
215
154
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
24.1 KB total · 604 B per row · 1.3 rows/day (30d)
|
|
221
|
-
```
|
|
155
|
+
- **Use has three distinct sources** — the row rode the injected block, `memory_recall` returned it, or a grep/read pull appended it — because "the model asked" and "the harness offered" are different facts. No prompt content is stored: the ledger keeps a scan-truncated string from the *memory* side, never your message.
|
|
156
|
+
- **Reinforcement is a tie-break only** (`useBoost ≤ 1.0`): a recently used row wins a tie and can never outrank a real score gap.
|
|
157
|
+
- **`never retrieved` is stated, not acted on.** Pruning is your decision.
|
|
158
|
+
- **Aggregate STORE counts are machine-wide by decision (#213 B)** — they describe the store on this machine, not your slice of it. Privacy applies to the content surfaces instead: `memory_evidence` and the recent-blocked-writes list follow each reader's repository visibility (#306).
|
|
222
159
|
|
|
223
|
-
|
|
224
|
-
- **No prompt content is stored.** The ledger keeps a scan-truncated string from the *memory* side, never your message.
|
|
225
|
-
- **Reinforcement is a tie-break only** (`useBoost ≤ 1.0`): a recently used row wins a tie and can never outrank a real score gap. In consolidation the most recently used member of a cluster is never the merge loser.
|
|
226
|
-
- **`never retrieved` is stated, not acted on.** Pruning is your decision. Retired rows cannot inherit reinforcement: ledger rows are verified against the store on read.
|
|
227
|
-
- **Aggregate STORE counts are machine-wide by decision (#213 B).** They count every repository's rows in the shared store on this machine, never just the reading session's repository — the numbers describe the store, not your slice of it. Privacy applies to the content surfaces instead: `memory_evidence` and the recent-blocked-writes list in `memory_status` and `/memory` follow each reader's repository visibility (#306).
|
|
228
|
-
- **Capture lag** is how stale the newest message was when auto-capture fired. The line prints only when at least one `capture_lag` sample exists, which needs auto-capture to have fired — see [Auto-capture is experimental](#auto-capture-is-experimental).
|
|
160
|
+
Sample `STORE` output, the credit rule and its throttle, the consolidation tie-break, and capture lag: [docs/use-ledger.md](docs/use-ledger.md).
|
|
229
161
|
|
|
230
162
|
## Consolidation
|
|
231
163
|
|
|
232
164
|
`memory_consolidate` finds near-duplicates and proposes merges. It writes nothing; each proposal prints the exact `memory_merge_review` call that resolves it, and resolving is supersede-not-delete.
|
|
233
165
|
|
|
166
|
+
The rule is: never merge two entries unless every question that used to find either one still finds the merged row.
|
|
167
|
+
|
|
234
168
|
- **Deterministic.** The canonical row is the survivor's prose verbatim plus the absorbed rows' aliases as keywords. No model rewrites anything.
|
|
235
169
|
- **Proven by recorded reads.** Every read the ledger recorded for a cluster is replayed against the merged store, and a merge is proposed only when the canonical row catches at least as many of the cluster's own reads as the best single member did alone. A cluster with no recorded reads is reported as *unmeasured* and never merged on resemblance.
|
|
236
170
|
|
|
@@ -238,91 +172,15 @@ STORE
|
|
|
238
172
|
|
|
239
173
|
## Secret redaction
|
|
240
174
|
|
|
241
|
-
One best-effort credential rule set (`src/secrets.ts`) replaces recognized values with `[redacted]
|
|
242
|
-
|
|
243
|
-
- over the auto-capture prompt before it leaves the plugin — the complete transcript is redacted *before* the character budget crops it, so a credential cut in half still matches its pattern;
|
|
244
|
-
- at the write gate, before content is hashed or analysed;
|
|
245
|
-
- again in the final write choke point used by gated writes and by the viewer's edit and restore paths;
|
|
246
|
-
- at the durable audit boundaries — every evidence line, every supersede field written into a retired row, and every deletion-audit reason.
|
|
247
|
-
|
|
248
|
-
So a recognized credential cannot persist in `evidence/`, in `deletions.logfmt`, or in a tombstoned row, whichever path carried it.
|
|
249
|
-
|
|
250
|
-
Covered: OpenAI `sk-`, GitHub `ghp_` / `gho_` / `github_pat_`, Slack `xoxb-` / `xoxp-`, AWS `AKIA`, Google `AIza`, bearer tokens containing digits, PEM private-key blocks, and high-entropy values assigned to names ending in `_KEY`, `_TOKEN`, `_SECRET` or `_PASSWORD` (plus `password`).
|
|
251
|
-
|
|
252
|
-
Limits worth knowing:
|
|
253
|
-
|
|
254
|
-
- It can miss hex-only secrets, low-diversity passwords, and credentials written in prose without an assignment.
|
|
255
|
-
- Credential-shaped `scope`, `tags` or `issue` metadata is rejected rather than silently rewritten.
|
|
256
|
-
- `memory_remember` still replies `Remembered` when content was redacted, so the stored text can differ from what was sent.
|
|
257
|
-
- Redaction is forward-only: existing stores are not scrubbed. `memory_export` scrubs credentials out of `content`, `issue`, `scope`, `tags` and `kw` as it serialises, so the file that leaves the machine carries `[redacted]` where a stored row still holds a token; the store itself is untouched, and origin stamps (`repo`, `repoPath`) are written as stored. The scrubber is a best-effort sweep over known token families and high-entropy credential-shaped values — an exotic credential can survive it, so an export is still a file you hand out deliberately.
|
|
175
|
+
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).
|
|
258
176
|
|
|
259
177
|
## Export and move between machines
|
|
260
178
|
|
|
261
|
-
`memory_export` writes the
|
|
262
|
-
|
|
263
|
-
Both tools are model-facing, so a path is not a privilege: an export cannot write to `~/.gitconfig` or anywhere else outside the store, and an import cannot read outside it. Symbolic links are resolved before the check — including an `exports/` directory that is itself a link — so a link cannot carry a request out of the store. Exports are written `0600` and opened `O_NOFOLLOW` (both POSIX; on Windows the check before the write is the only guard). (Hardlinks are beyond any path check: a link planted inside `exports/` shares an inode with its target. That, and a narrow window on intermediate path components, are the boundary's known limits.) To move a store between machines, copy the file in:
|
|
264
|
-
|
|
265
|
-
```
|
|
266
|
-
Export my memories # -> <memory-root>/exports/<timestamp>-<unique>.jsonl
|
|
267
|
-
# …copy that file to the other machine's <memory-root>/…
|
|
268
|
-
Import <memory-root>/memories.jsonl # memory_import
|
|
269
|
-
```
|
|
270
|
-
|
|
271
|
-
An operator running a one-off migration can restore the old anywhere-on-disk behavior with `OPENCODE_MEMORY_ALLOW_OUTSIDE_PATHS=1`. It is read from the plugin process's own environment, so a model cannot grant it to itself through a tool argument.
|
|
272
|
-
|
|
273
|
-
Every imported row re-enters through the same four gates as `memory_remember` (tagged `import`, original tags preserved), and the tool reports a tally:
|
|
274
|
-
|
|
275
|
-
| Outcome | Meaning |
|
|
276
|
-
| --- | --- |
|
|
277
|
-
| `promoted` | passed the gates and was stored |
|
|
278
|
-
| `collapsed` | near-duplicate of an existing memory; nothing written |
|
|
279
|
-
| `blocked` | rejected by a gate; reason in `memory_evidence` |
|
|
280
|
-
| `skipped` | malformed line; never reached the gates |
|
|
281
|
-
| `downgraded` | imported as settled because its `status:"open"` could not be vouched for |
|
|
282
|
-
|
|
283
|
-
Import and auto-capture also scan incoming prose for instruction-override, role-header and download/execute patterns. A promoted match is tagged `quarantine` and withheld from recall, prompt and frontier injection, compaction anchors, contextual pull, consolidation and decay; review it in the viewer's **quarantined** filter.
|
|
284
|
-
|
|
285
|
-
This is a heuristic review queue, not a prompt-injection detector: legitimate documentation can match, and several forms evade it. What the screen covers, what it misses, how an existing store is re-tagged, what releasing quarantine does and what it leaves alone, and why direct `memory_remember` and viewer edits are not scanned: [docs/import-quarantine.md](docs/import-quarantine.md).
|
|
179
|
+
`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).
|
|
286
180
|
|
|
287
181
|
## Surfaces
|
|
288
182
|
|
|
289
|
-
Same data behind each one (`memory_status`; no model call).
|
|
290
|
-
|
|
291
|
-
**Terminal (opencode CLI)** — the plugin ships a TUI half (`@opencode/plugin/tui`) that loads automatically:
|
|
292
|
-
|
|
293
|
-
- **Footer badge** — illustrative `● mem 1157/1200c · cache 96%`: the injected block against its budget, plus the measured session prompt-cache hit rate. The dot is green (stable and warm), yellow (recent recompute, or 50–90% reads) or red (last turn served almost nothing from cache); `—` until the first assistant turn, and `—` throughout on a provider that reports no cache usage.
|
|
294
|
-
- **`/memory`** — session panel: **CONTEXT** (chars and estimated tokens riding now, % of budget, the full memory section riding the prompt — digest + frontier + block — requests this epoch has ridden, session totals, abstentions), **CACHE** (busts this session and the measured cache-served share of prompt tokens), **INJECTED BLOCK** (the verbatim block, or an explicit abstention), **RECENT BLOCKED WRITES** (with gate reasons), **STORE** (active / superseded / open / scopes, plus `malformed` when a row's `ts` is not a valid ISO instant — those rows are skipped by every reader). Keys: `r` refresh, `f` fullscreen.
|
|
295
|
-
- **Block toast** when a write is refused (`"notifyBlocked": false` to silence).
|
|
296
|
-
|
|
297
|
-
**Desktop / web / IDE** — the terminal slots do not exist there, so use the self-installed **`/memory-report`** chat command: the same sections rendered in the conversation.
|
|
298
|
-
|
|
299
|
-
**Browser editor** — `bun memory-view`, then http://127.0.0.1:8787. Bound to loopback; requests are checked against `Host` and `Origin`, so other hosts must be listed explicitly in `OPENCODE_VIEWER_ALLOWED_HOSTS`. Listing a non-loopback host serves the store over plain HTTP with no authentication — only do it on a network you control.
|
|
300
|
-
|
|
301
|
-
## Installing a specific version
|
|
302
|
-
|
|
303
|
-
An unpinned entry resolves `@latest` exactly once and is never re-resolved afterwards, so updates are deliberate: `opencode plugin update opencode-self-improvement`. To pin, append `@<version>` — see [npm](https://www.npmjs.com/package/opencode-self-improvement) for what is current.
|
|
304
|
-
|
|
305
|
-
<details>
|
|
306
|
-
<summary>Install from a clone (development)</summary>
|
|
307
|
-
|
|
308
|
-
```sh
|
|
309
|
-
git clone https://github.com/abogartz/opencode-self-improvement.git
|
|
310
|
-
cd opencode-self-improvement
|
|
311
|
-
bun install
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
Then point the `plugins` entry at the local file instead:
|
|
315
|
-
|
|
316
|
-
```json
|
|
317
|
-
{
|
|
318
|
-
"$schema": "https://opencode.ai/config.json",
|
|
319
|
-
"plugins": ["/full/path/to/opencode-self-improvement/index.ts"]
|
|
320
|
-
}
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
After changes, `git pull` and restart opencode.
|
|
324
|
-
|
|
325
|
-
</details>
|
|
183
|
+
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).
|
|
326
184
|
|
|
327
185
|
## Development
|
|
328
186
|
|
|
@@ -332,45 +190,14 @@ Nothing merges without the full gate; CI runs it as required checks (`lint`, `te
|
|
|
332
190
|
bun run gate # typecheck + lint + unit tests + terminal smoke & BDD
|
|
333
191
|
bun run gate:hooks # once per clone: run the gate on `git push`
|
|
334
192
|
bun run format # apply the shared two-space TypeScript/TSX style
|
|
335
|
-
bun run format:check # check formatting without changing files
|
|
336
193
|
```
|
|
337
194
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
`bun run lint` checks lint rules and TypeScript/TSX formatting; CI calls the same command. Lint warnings remain advisory, while formatting differences fail the check. Markdown commands, prose, JSON data and historical benchmark records are outside the formatter's scope.
|
|
341
|
-
|
|
342
|
-
Use Bun **1.4.4** for development checks, matching CI. `bun run test` and `bun run test:e2e` run files across at most four worker processes with Bun's file isolation; cases inside each file stay sequential because fixtures share environment variables and module state. The local gate uses those same scripts. To diagnose order-dependent failures in the original shared-process mode, run `bun test ./test/` or `bun test ./e2e/ --timeout 240000` directly.
|
|
343
|
-
|
|
344
|
-
**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. Then the unit tests for the pieces, then the code until everything is green. If no scenario turns red first, the feature has no observable contract.
|
|
345
|
-
|
|
346
|
-
`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`. A `test-windows` leg also runs the suite on Windows; it reports without gating merges.
|
|
195
|
+
Use Bun **1.4.4** for development checks, matching CI. `bun run test` and `bun run test:e2e` run files across at most four worker processes; cases inside each file stay sequential because fixtures share environment variables and module state.
|
|
347
196
|
|
|
348
|
-
**
|
|
349
|
-
|
|
350
|
-
### Before a release
|
|
351
|
-
|
|
352
|
-
```sh
|
|
353
|
-
bun scripts/test-sweep.ts --validate # every pattern still lands on one site
|
|
354
|
-
bun scripts/test-sweep.ts --selftest # the instrument can still go red
|
|
355
|
-
bun scripts/test-sweep.ts --fail-on-survivors # exits 4 when anything survives
|
|
356
|
-
```
|
|
197
|
+
**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`.
|
|
357
198
|
|
|
358
|
-
|
|
199
|
+
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).
|
|
359
200
|
|
|
360
201
|
## Troubleshooting
|
|
361
202
|
|
|
362
|
-
|
|
363
|
-
| --- | --- |
|
|
364
|
-
| `memory_*` tools not available | The plugin didn't load. Restart opencode and check the `plugins` entry in your config. |
|
|
365
|
-
| `memory_remember` says blocked | A gate rejected the write: a stale code reference, a cited path that doesn't exist in the repo, overlap with a superseded memory, or an ambiguous claim. The reason is in `memory_evidence`; rephrase against current code and retry. |
|
|
366
|
-
| `invalid arguments to memory_*` | The call didn't match the tool's input schema; nothing was done and the message names the offending fields. Gate blocks look different (`blocked at GATE (…)`). |
|
|
367
|
-
| STORE shows `N malformed` | A daily file has a `ts=` that is not a valid ISO instant (typically a hand-edit). Every reader skips those rows; fix the `ts=` or restore the file with `memory_undo`. |
|
|
368
|
-
| `memory store is busy` | A store write exhausted its 5s lock-wait budget. Appends, rewrites, and restores refuse that mutation rather than proceed unlocked and risk losing another writer's rows. 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. |
|
|
369
|
-
| Stray `*.logfmt.lock` or `*.tmp` in the store | Write bookkeeping left by an older release; safe to delete while nothing is writing. Current releases leave `.store-lock.<file>.sqlite` beside each store file and `.store-batch.<name>.sqlite`: coordination state, holding no rows, one file per lock, safe to delete while nothing is writing. |
|
|
370
|
-
| 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. |
|
|
371
|
-
| `/repo-init` missing from the command list | The self-install couldn't write to `~/.config/opencode/commands/`. Create it and restart, or ask the model to "init memory for this repo" — the same tool. |
|
|
372
|
-
| `memory_init` rejects a call naming `mode` | The code-graph integration was removed (#231) and the tool schema refuses unknown arguments — drop `mode` from the call. Stamps written by older versions (their text carries `graph=`/`mode=`) still read fine; no re-init is forced. |
|
|
373
|
-
| 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. |
|
|
374
|
-
| `Error: Plugin is not configured` right after `plugin add` | An opencode bug ([#54654](https://github.com/anomalyco/opencode/issues/54654)), not a config problem: the first `plugin list/check/update` against a cold background service reads the plugin inventory before activation finishes. The plugin is installed and loading — just run the command again. |
|
|
375
|
-
| Auto-capture does nothing | Auto-capture is **experimental and has never fired on a verified live store** — see [Auto-capture is experimental](#auto-capture-is-experimental). `memory_evidence` says which case you are in from the `plugin_load` line: `capture=off` (option not on), `invalid_model` (`captureModel` must be `provider/id`; a bad one disables capture with a startup warning), `no_capabilities` (host did not expose what capture needs), or `capture=on`. `captureOnCompact` alone does nothing. `capture=on` with no `auto_capture_*` line after a session is the open bug, not your config. Rejected candidates log as evidence, not errors. On desktop, changing any of these options needs `opencode service restart`. |
|
|
376
|
-
| Reset all memories | Stop any running opencode session first, then delete `~/.config/opencode/memory/`. On Windows the delete fails with `EBUSY` while a session is live: the store lock is an open SQLite connection, and Windows will not delete a directory that contains one. |
|
|
203
|
+
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.
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
# Auto-capture: what the evidence covers
|
|
2
2
|
|
|
3
|
+
Three different claims get confused constantly, so this file names them
|
|
4
|
+
separately: the event fires, the write survives, and a live store with a live
|
|
5
|
+
model completes a pass. The first two are shown. The third has never been
|
|
6
|
+
observed.
|
|
7
|
+
|
|
3
8
|
What has been established about auto-capture, by what kind of evidence,
|
|
4
9
|
and what remains unverified. The status and the arm/diagnose answer stay
|
|
5
10
|
in the README; this is the record behind them.
|
|
6
11
|
|
|
12
|
+
## What has been established
|
|
13
|
+
|
|
7
14
|
What is established, from tests and fixtures (no live store involved):
|
|
8
15
|
|
|
9
16
|
- **The trigger events are ones the host actually emits.** Capture subscribes to `session.execution.succeeded` and `session.execution.interrupted`, the two turn-end events present in a recording of the desktop service (`test/fixtures/host-events.jsonl`). `session.idle`, `session.status` and `session.execution.failed` are *declared* by the host but absent from that recording, so they deliberately do not trigger capture; `test/event-fidelity.test.ts` refuses a trigger that is only declared. An earlier revision subscribed to `session.idle` and stayed silent for days with no signal — reading a declared event as an emitted one is the failure that fixture exists to prevent.
|
|
@@ -16,7 +23,7 @@ What is established, from tests and fixtures (no live store involved):
|
|
|
16
23
|
|
|
17
24
|
- **The availability policy is measured against its alternatives, and against its own measuring stick.** `bun run bench:availability` (`bench/availability-results.md`) runs one capture pass over a 197-row store five times — no check, tag (as shipped), drop-at-read (the P3 preview), drop-hardened, and the original rule replayed from the pinned `362655c` module — with the byte budget swept over five sizes and the background resampled at 0/30/90/180 rows, because a claim measured at one budget or one store size is a claim about that budget. Tagging keeps all 10 new transport facts and retrieves 14 of 14 retrievable queries at every budget and every store size, where the original rule keeps 6 of 10 and retrieves 7 at every budget: that rule deleted four of ten new facts on a command mention alone, and a deleted fact cannot be retrieved. The ceiling is stated next to every recall figure and measured on the exact rows the arms retrieve: 14 of the 21 curated transport queries retrieve their own gold when that gold is the ONLY row in the store, so the tag arm's 14 is the achievable maximum and 9/21 was never 43% recall. The counterfactual is printed beside it — strip the keywords the capture reply carries and the ceiling falls to 9/21, because five of these pairs are retrievable only through the keyword list. A 25-case bank of every adversarial verdict this matcher has been found guilty of is re-decided on every run, one repo per case, and asserted in `bun test` because CI runs no bench. Writing those controls found two defects in the bench itself — verdicts keyed on `ts`, which is not unique when a pass writes rows in one millisecond, and a byte column summed across 21 queries and labelled per-block — and the corrected numbers are in the file. The report also states what it cannot measure: the check marks 6 of 16 rows a pass writes and 0 of 180 background rows, and that 0 is a fixture artefact rather than a base rate, because no seeded row quotes the tracked tree. It also tests the tag's justification directly: empty the tracked text and all 6 verdicts disappear, which is the property a read-time policy would keep and a delete would not.
|
|
18
25
|
|
|
19
|
-
What
|
|
26
|
+
## What has not been established
|
|
20
27
|
|
|
21
28
|
- That a live host with a live model completes a capture end to end. The event and the pass are no longer in doubt — `e2e/capture.test.ts` shows a real `opencode run` turn firing a real pass — but no `auto_capture_*` line and no `capture_lag` line exists anywhere in the maintainer's evidence history (checked 2026-10-26 through 2026-10-29), and #404 found the mechanism by which a CLI session would produce none even when everything else works — the fix is on this branch, but no live store has been observed completing a pass yet. A live trial armed on 2026-10-26 was stood down on 2026-10-29 without ever firing, so it answered nothing.
|
|
22
29
|
- Anything about quality on a live store. What auto-capture would write, how often it duplicates a memory you would have written yourself, and what it costs remain unmeasured. `bench/capture-trigger-results.md` is a **bench** simulation of trigger *timing* with a scripted extractor — its compaction world captured 0 rows and 4 of its 6 controls report FAIL. It answers "which moment is worth mining", not "does the shipped feature work".
|