opencode-self-improvement 0.7.0 → 0.8.0
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 +6 -3
- package/package.json +1 -1
- package/src/index.ts +1 -1
- package/src/status.ts +28 -9
package/README.md
CHANGED
|
@@ -365,9 +365,12 @@ same data (`memory_status` tool under the hood; no model call):
|
|
|
365
365
|
- **CONTEXT** — exact chars + estimated tokens riding now, % of the budget,
|
|
366
366
|
requests the current epoch has ridden, session-lifetime totals, and how
|
|
367
367
|
many requests abstained (silence is a feature)
|
|
368
|
-
- **CACHE** —
|
|
369
|
-
|
|
370
|
-
|
|
368
|
+
- **CACHE** — the receipts, in plain language: cache busts this session
|
|
369
|
+
(0 = memory has never rewritten a byte of your history), the measured
|
|
370
|
+
share of prompt tokens the provider served from cache (≥90% reads =
|
|
371
|
+
"memory is cache-invisible"), or — when the provider reports no usage at
|
|
372
|
+
all — the structural proof instead: the same block bytes rode every
|
|
373
|
+
request with zero busts
|
|
371
374
|
- **INJECTED BLOCK** — the verbatim block riding your prompts, or an explicit
|
|
372
375
|
"abstained: no vocabulary overlap"
|
|
373
376
|
- **RECENT BLOCKED WRITES** — that `memory_remember` that didn't stick,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-self-improvement",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
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/src/index.ts
CHANGED
|
@@ -570,7 +570,7 @@ const impl = {
|
|
|
570
570
|
editor.add(validated(EmptyArgs, {
|
|
571
571
|
name: "memory_status",
|
|
572
572
|
description:
|
|
573
|
-
"Plain-text memory report for chat clients (desktop/web/IDE), same sections as the terminal /memory panel: CONTEXT (this session's injected block, budget use, cumulative ride and abstentions), CACHE (
|
|
573
|
+
"Plain-text memory report for chat clients (desktop/web/IDE), same sections as the terminal /memory panel: CONTEXT (this session's injected block, budget use, cumulative ride and abstentions), CACHE (plain-language cache receipts: bust count, and the provider-reported share of prompt tokens served from cache — the proof that memory never mutates your prefix), the block verbatim, recent blocked writes with gate reasons, and store stats. Reads only — no model call.",
|
|
574
574
|
options: direct,
|
|
575
575
|
async execute(): Promise<{ content: string }> {
|
|
576
576
|
// In-process truth: the live epoch + ledger, fresher than any file.
|
package/src/status.ts
CHANGED
|
@@ -262,15 +262,34 @@ export function cacheLines(p: StatusPayload): string[] {
|
|
|
262
262
|
const st = p.stats ?? emptyStats();
|
|
263
263
|
const inv =
|
|
264
264
|
st.invalidations === 0
|
|
265
|
-
?
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
265
|
+
? [
|
|
266
|
+
" cache busts 0 — memory has never rewritten a byte of your past",
|
|
267
|
+
" conversation, so the provider can serve history from cache",
|
|
268
|
+
]
|
|
269
|
+
: [
|
|
270
|
+
` cache busts ${st.invalidations} this session · last ${
|
|
271
|
+
st.lastInvalidation ? `${st.lastInvalidation.at.slice(11, 19)} (${st.lastInvalidation.reason})` : "-"
|
|
272
|
+
}`,
|
|
273
|
+
" each memory write between turns costs exactly one; the",
|
|
274
|
+
" prefix re-warms on the following turn",
|
|
275
|
+
];
|
|
269
276
|
const rate = cacheRate(p.measured);
|
|
270
|
-
const
|
|
271
|
-
?
|
|
272
|
-
|
|
273
|
-
|
|
277
|
+
const receipts = rate
|
|
278
|
+
? [
|
|
279
|
+
` receipts ${fmtCount(rate.read)}/${fmtCount(rate.prompt)} prompt tok served from cache (${rate.pct}%)`,
|
|
280
|
+
rate.pct >= 90
|
|
281
|
+
? " — memory is cache-invisible: the same bytes ride every turn"
|
|
282
|
+
: " — below ~90% something re-bills the whole history each turn",
|
|
283
|
+
]
|
|
284
|
+
: [
|
|
285
|
+
" receipts provider reports no cache usage yet — structural proof:",
|
|
286
|
+
` the same block bytes rode ${st.epochRequests} request(s) with ${st.invalidations} busts`,
|
|
287
|
+
];
|
|
288
|
+
return [
|
|
289
|
+
...inv,
|
|
290
|
+
...receipts,
|
|
291
|
+
` recomputes ${p.recomputes} block builds since server start (all sessions)`,
|
|
292
|
+
];
|
|
274
293
|
}
|
|
275
294
|
|
|
276
295
|
/**
|
|
@@ -292,7 +311,7 @@ export function renderMemoryReport(input: {
|
|
|
292
311
|
);
|
|
293
312
|
} else {
|
|
294
313
|
out.push("CONTEXT", ...contextLines(status));
|
|
295
|
-
out.push("", "CACHE", ...cacheLines(status));
|
|
314
|
+
out.push("", "CACHE — the receipts on your prompt-cache cost", ...cacheLines(status));
|
|
296
315
|
out.push("", "INJECTED BLOCK (verbatim)");
|
|
297
316
|
if (status.block) out.push(...status.block.split("\n").map((l) => ` ${l}`));
|
|
298
317
|
else
|