opencode-self-improvement 0.27.0 → 0.28.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-self-improvement",
3
- "version": "0.27.0",
3
+ "version": "0.28.1",
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": {
@@ -78,7 +78,13 @@ export function buildCapturePrompt(
78
78
  "- scope: short area name (e.g. auth, api, build).",
79
79
  '- status: "open" for a live planning thread; otherwise "settled".',
80
80
  "- content: one self-contained fact, 20-600 characters, useful in a NEW session.",
81
- "- kw: 3-5 search keywords for how a DIFFERENT session would ask for this — synonyms and alternate names, other verb forms, the literal command or file name. They are indexed for retrieval and never shown to a model. Omit (or []) when the content already uses those words.",
81
+ // #409 RESULTS §29-30: retrieval alignment is a WRITE-side property. The
82
+ // same lesson scored zero (outside the recall window) as session diary and
83
+ // ranked 1-7 for the terse symptom queries agents actually issue when it
84
+ // opened with the observable trigger. The kw rule below is the bridge;
85
+ // this rule makes the content itself searchable and self-explanatory.
86
+ '- For `learning` and `blocker` rows, START the content with the observable trigger a future session will hit — the failing command, the error text, the wrong number — then the fact, as "When <symptom>: <fact>". A lesson written as a session diary ("In this session we fixed...") shares no words with the query a future session will type, and will never be recalled.',
87
+ "- kw: 3-5 search keywords for how a DIFFERENT session would ask for this — synonyms and alternate names, other verb forms, the literal command or file name, and the words of the symptom itself (the failing command name, a distinctive error substring, the wrong figure's subject). They are indexed for retrieval and never shown to a model. Omit (or []) when the content already uses those words.",
82
88
  "- guided: true ONLY when the user STATED this fact in their own words — a value, rate, number, rule or correction that appears in a user: line or the REQUESTS block. Omit guided for anything the agent discovered by itself.",
83
89
  '- When guided AND the value names a declared code symbol, also output "ref": that symbol exactly as declared (e.g. "TAX_RATE"), "claim": the user\'s value alone (e.g. "0.0825", at most 32 characters), and "klass": "spec" when the user is the authority on the value (a rate, a requirement) or "behavior" when the row describes how working code behaves. Omit all three when no single declared constant is involved.',
84
90
  '- If it is unclear whether the user is specifying a requirement or describing working code, omit "klass". Never guess authority; an unclassified row remains plain guidance without a conflict verdict.',
@@ -46,7 +46,7 @@
46
46
  // compared as a sorted multiset of literals and a pair that disagrees on
47
47
  // them is never a copy.
48
48
  import type { Memory } from "../store/model/memory.ts";
49
- import { haystack, words } from "./score.ts";
49
+ import { words } from "./score.ts";
50
50
 
51
51
  export const DEDUPE_ENV = "OPENCODE_MEMORY_DEDUP";
52
52
 
@@ -121,15 +121,17 @@ function sameDroppedChunks(a: Memory, b: Memory): boolean {
121
121
  }
122
122
 
123
123
  /**
124
- * A row's own tokens: everything except the `type` and `scope` values, which
125
- * the same-scope requirement already guarantees are shared and which made short
126
- * unrelated rows look like copies.
124
+ * A row's own tokens: built DIRECTLY from the content and keyword fields.
125
+ * Never from `haystack()` — the identifier tokenizer (#417) splits a
126
+ * snake_case scope like `auth_token_refresh_policy` into auth/token/refresh/
127
+ * policy, and deleting only the whole scope/type strings left those words
128
+ * standing in for content: two unrelated non-Latin rows in one scope shared
129
+ * a Jaccard-1 metadata vocabulary, cleared MIN_CONTENT on scope tokens alone,
130
+ * and dedup hid one (#421, post-merge report on #417).
127
131
  */
128
132
  export function contentTokens(m: Memory): Set<string> {
129
- const out = new Set(words(haystack(m)));
130
- out.delete(m.type.toLowerCase());
131
- out.delete(m.scope.toLowerCase());
132
- return out;
133
+ const text = m.content + (m.kw?.length ? ` ${m.kw.join(" ")}` : "");
134
+ return new Set(words(text));
133
135
  }
134
136
 
135
137
  function hasPolarity(tokens: Set<string>): boolean {