om-memory-system 5.1.0 → 5.3.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.
Files changed (36) hide show
  1. package/dist/adapters/opencode/in-process-client.d.ts +2 -0
  2. package/dist/adapters/opencode/in-process-client.js +16 -0
  3. package/dist/adapters/opencode/opencode-host-config.d.ts +3 -0
  4. package/dist/adapters/opencode/opencode-host-config.js +2 -0
  5. package/dist/adapters/opencode/tui-recall.d.ts +68 -0
  6. package/dist/adapters/opencode/tui-recall.js +302 -0
  7. package/dist/config-template.d.ts +1 -1
  8. package/dist/config-template.js +5 -0
  9. package/dist/config.d.ts +2 -0
  10. package/dist/config.js +3 -0
  11. package/dist/core/recall-summary.d.ts +28 -0
  12. package/dist/core/recall-summary.js +71 -0
  13. package/dist/index.js +1 -1
  14. package/dist/services/single-flight.d.ts +2 -0
  15. package/dist/services/single-flight.js +12 -0
  16. package/dist/services/visible-recall-config.d.ts +34 -0
  17. package/dist/services/visible-recall-config.js +27 -0
  18. package/dist/services/web-ensure.d.ts +11 -0
  19. package/dist/services/web-ensure.js +33 -4
  20. package/dist/services/web-server.d.ts +3 -0
  21. package/dist/services/web-server.js +26 -8
  22. package/dist/v2/adapter.js +6 -1
  23. package/dist/v2/legacy-client.js +2 -1
  24. package/dist/v2/memory-bridge.d.ts +2 -0
  25. package/dist/v2/memory-bridge.js +4 -0
  26. package/dist/v2/recall-reporter.d.ts +24 -0
  27. package/dist/v2/recall-reporter.js +128 -0
  28. package/dist/v2/recall-rpc.d.ts +51 -0
  29. package/dist/v2/recall-rpc.js +38 -0
  30. package/dist/web/assets/index-CJ_K-hMG.js +170 -0
  31. package/dist/web/assets/index-ccH97VE2.css +2 -0
  32. package/dist/web/index.html +2 -2
  33. package/opencode/tui.tsx +22 -3
  34. package/package.json +1 -1
  35. package/dist/web/assets/index-D6UWwxhU.css +0 -2
  36. package/dist/web/assets/index-DXmCX7Ga.js +0 -170
@@ -0,0 +1,2 @@
1
+ export declare function markInProcessClient<T extends object>(client: T): T;
2
+ export declare function isInProcessClient(client: unknown): boolean;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Marks a host client that talks to OpenCode in-process. The V2 legacy client
3
+ * is one: it calls the plugin context directly, so it has no HTTP transport
4
+ * and no fetch to borrow. The transport setup skips its "no host fetch"
5
+ * warning for it.
6
+ */
7
+ const IN_PROCESS_CLIENT = Symbol.for("omms.opencode.inProcessClient");
8
+ export function markInProcessClient(client) {
9
+ Object.defineProperty(client, IN_PROCESS_CLIENT, { value: true });
10
+ return client;
11
+ }
12
+ export function isInProcessClient(client) {
13
+ return (typeof client === "object" &&
14
+ client !== null &&
15
+ client[IN_PROCESS_CLIENT] === true);
16
+ }
@@ -2,6 +2,9 @@ export type HostClientConfig = {
2
2
  readonly baseUrl: string | undefined;
3
3
  readonly fetch: typeof fetch | undefined;
4
4
  readonly headers?: RequestInit["headers"];
5
+ /** Present when the host client runs in-process (OpenCode v2): no HTTP
6
+ * transport, so a missing fetch is expected and not worth a warning. */
7
+ readonly inProcess?: true;
5
8
  readonly clientKeys: readonly string[];
6
9
  readonly sdkConfigCount: number;
7
10
  };
@@ -1,3 +1,4 @@
1
+ import { isInProcessClient } from "./in-process-client.js";
1
2
  export function getHostClientConfig(ctx) {
2
3
  const client = toRecord(ctx.client);
3
4
  if (!client) {
@@ -11,6 +12,7 @@ export function getHostClientConfig(ctx) {
11
12
  baseUrl: typeof baseUrl === "string" ? baseUrl : undefined,
12
13
  fetch: isFetch(customFetch) ? customFetch : undefined,
13
14
  ...(isHeadersInit(headers) ? { headers } : {}),
15
+ ...(isInProcessClient(client) ? { inProcess: true } : {}),
14
16
  clientKeys: Object.keys(client),
15
17
  sdkConfigCount: configs.length,
16
18
  };
@@ -0,0 +1,68 @@
1
+ import { type RecallSummary } from "../../core/recall-summary.js";
2
+ /**
3
+ * Fold rows for OMMS recalls in the OpenCode terminal TUI (TDR-060). The TUI entry (`opencode/tui.tsx`)
4
+ * passes its host pieces in, so this module never imports a host SDK, storage, capture or config. Every
5
+ * host call sits behind a guard: a missing RPC handler, a failing storage call or a throwing render
6
+ * draws nothing for that part and never throws into the host. Nothing here logs: memory text must not
7
+ * reach a log.
8
+ */
9
+ /** Most rows shown at once. Older summaries of the session are dropped from the view. */
10
+ export declare const MAX_ROWS = 5;
11
+ /** Persisted fold state: only open rows are stored, keyed by `rowKey`. */
12
+ export interface FoldState {
13
+ open: Record<string, boolean>;
14
+ }
15
+ /** The slice of `ctx.client.rpc(recallRpc)` this module uses. */
16
+ export interface RecallRpcClient {
17
+ list(input: {
18
+ sessionID: string;
19
+ }): Promise<{
20
+ enabled: boolean;
21
+ items: RecallSummary[];
22
+ }>;
23
+ events: {
24
+ on(name: string, handler: (event: any) => void): unknown;
25
+ };
26
+ }
27
+ export interface TuiRecallDeps {
28
+ client: {
29
+ rpc(definition: unknown): RecallRpcClient;
30
+ };
31
+ data: {
32
+ listen(handler: (event: any) => void): unknown;
33
+ };
34
+ ui: {
35
+ slot(spec: {
36
+ append: string;
37
+ render: (input: {
38
+ sessionID?: string;
39
+ }) => unknown;
40
+ }): unknown;
41
+ };
42
+ keymap: {
43
+ layer(factory: () => unknown): unknown;
44
+ };
45
+ storage: {
46
+ store(key: string, options: {
47
+ initial: FoldState;
48
+ }): [FoldState, (change: (draft: FoldState) => void) => unknown];
49
+ };
50
+ createSignal: <T>(value: T) => [() => T, (next: T | ((previous: T) => T)) => unknown];
51
+ jsx: (tag: string, props: Record<string, unknown>) => unknown;
52
+ /** Theme colour for row text; read on each paint. */
53
+ muted: () => unknown;
54
+ /** Quiet period that collapses a burst of host events into one `list` call. */
55
+ debounceMs?: number;
56
+ }
57
+ /**
58
+ * Stable per-summary key. A summary with a server sequence number is keyed by session id and that
59
+ * number, so it survives the ring dropping older entries. An older server sends none, so the key
60
+ * falls back to the session id, a hash of mode, query and each memory's id (or headline when it
61
+ * has none), and a counter for identical summaries.
62
+ */
63
+ export declare function rowKeys(sessionID: string, summaries: RecallSummary[]): string[];
64
+ /**
65
+ * Draw one fold row per recall summary of the session in view. Returns a stop function that removes
66
+ * every hook it added.
67
+ */
68
+ export declare function startTuiRecall(deps: TuiRecallDeps): () => void;
@@ -0,0 +1,302 @@
1
+ import { callTitle, unfoldLines } from "../../core/recall-summary.js";
2
+ import { recallRpc } from "../../v2/recall-rpc.js";
3
+ /**
4
+ * Fold rows for OMMS recalls in the OpenCode terminal TUI (TDR-060). The TUI entry (`opencode/tui.tsx`)
5
+ * passes its host pieces in, so this module never imports a host SDK, storage, capture or config. Every
6
+ * host call sits behind a guard: a missing RPC handler, a failing storage call or a throwing render
7
+ * draws nothing for that part and never throws into the host. Nothing here logs: memory text must not
8
+ * reach a log.
9
+ */
10
+ /** Most rows shown at once. Older summaries of the session are dropped from the view. */
11
+ export const MAX_ROWS = 5;
12
+ const FOLD_STORE_KEY = "omms.recall.fold";
13
+ const SLOT = "session.composer.top";
14
+ const DEFAULT_DEBOUNCE_MS = 150;
15
+ /**
16
+ * Host events that pull the recall list. The server records a recall when a model step starts (the
17
+ * `context` hook), so only the events around a step, plus session creation and view changes, can
18
+ * coincide with a new recall. The end events catch a missed `recalled` push right after the step.
19
+ * The failure events are end events too: the summary is recorded in the `context` hook after
20
+ * `session.step.started` fires, so if the push is absent and the step then fails, no later event
21
+ * in this set would pull it.
22
+ * Streaming, part, message, inbox and instruction events fire dozens of times per reply and never
23
+ * change the list, so they must stay out of this set.
24
+ */
25
+ const PULL_EVENT_TYPES = new Set([
26
+ "session.created",
27
+ "session.viewed",
28
+ "session.execution.started",
29
+ "session.step.started",
30
+ "session.step.ended",
31
+ "session.execution.succeeded",
32
+ "session.step.failed",
33
+ "session.execution.failed",
34
+ ]);
35
+ function isSummary(value) {
36
+ const v = value;
37
+ return (!!v &&
38
+ (v.mode === "search" || v.mode === "recent") &&
39
+ Array.isArray(v.items) &&
40
+ v.items.every((item) => !!item && typeof item.headline === "string"));
41
+ }
42
+ /** FNV-1a, 32 bit: short, deterministic, no crypto needed for a fold key. */
43
+ function hash(text) {
44
+ let h = 0x811c9dc5;
45
+ for (let i = 0; i < text.length; i++) {
46
+ h ^= text.charCodeAt(i);
47
+ h = Math.imul(h, 0x01000193);
48
+ }
49
+ return (h >>> 0).toString(16);
50
+ }
51
+ /**
52
+ * Stable per-summary key. A summary with a server sequence number is keyed by session id and that
53
+ * number, so it survives the ring dropping older entries. An older server sends none, so the key
54
+ * falls back to the session id, a hash of mode, query and each memory's id (or headline when it
55
+ * has none), and a counter for identical summaries.
56
+ */
57
+ export function rowKeys(sessionID, summaries) {
58
+ const seen = new Map();
59
+ return summaries.map((summary) => {
60
+ if (typeof summary.seq === "number")
61
+ return `${sessionID}:${summary.seq}`;
62
+ const body = [
63
+ summary.mode,
64
+ summary.query ?? "",
65
+ ...summary.items.map((item) => item.id ?? item.headline),
66
+ ].join("\u0000");
67
+ const base = `${sessionID}:${hash(body)}`;
68
+ const count = seen.get(base) ?? 0;
69
+ seen.set(base, count + 1);
70
+ return count === 0 ? base : `${base}#${count}`;
71
+ });
72
+ }
73
+ function guard(fn) {
74
+ try {
75
+ return fn();
76
+ }
77
+ catch {
78
+ return undefined;
79
+ }
80
+ }
81
+ function release(handle) {
82
+ if (typeof handle === "function")
83
+ guard(() => handle());
84
+ }
85
+ /**
86
+ * Draw one fold row per recall summary of the session in view. Returns a stop function that removes
87
+ * every hook it added.
88
+ */
89
+ export function startTuiRecall(deps) {
90
+ const debounceMs = deps.debounceMs ?? DEFAULT_DEBOUNCE_MS;
91
+ const sessions = new Map();
92
+ const local = new Map();
93
+ let lastViewed;
94
+ let stopped = false;
95
+ let layerHandle;
96
+ // Two signals: the list changes when summaries arrive, the text changes when a row folds.
97
+ const [listRevision, setListRevision] = deps.createSignal(0);
98
+ const [foldRevision, setFoldRevision] = deps.createSignal(0);
99
+ const repaintList = () => void guard(() => setListRevision((n) => n + 1));
100
+ const repaintFold = () => void guard(() => setFoldRevision((n) => n + 1));
101
+ const rpc = guard(() => deps.client.rpc(recallRpc));
102
+ const fold = guard(() => deps.storage.store(FOLD_STORE_KEY, { initial: { open: {} } }));
103
+ const sessionState = (id) => {
104
+ let state = sessions.get(id);
105
+ if (!state) {
106
+ state = { enabled: false, summaries: [], inflight: false, dirty: false };
107
+ sessions.set(id, state);
108
+ }
109
+ return state;
110
+ };
111
+ const apply = (id, enabled, summaries) => {
112
+ const state = sessionState(id);
113
+ state.enabled = enabled;
114
+ state.summaries = summaries;
115
+ repaintList();
116
+ };
117
+ async function pull(id) {
118
+ const state = sessionState(id);
119
+ state.inflight = true;
120
+ try {
121
+ const reply = await rpc.list({ sessionID: id });
122
+ if (stopped)
123
+ return;
124
+ const ok = reply?.enabled === true && Array.isArray(reply.items);
125
+ apply(id, ok, ok ? reply.items.filter(isSummary) : []);
126
+ }
127
+ catch {
128
+ if (!stopped)
129
+ apply(id, false, []);
130
+ }
131
+ finally {
132
+ state.inflight = false;
133
+ if (state.dirty && !stopped) {
134
+ state.dirty = false;
135
+ request(id, debounceMs);
136
+ }
137
+ }
138
+ }
139
+ /** At most one `list` per session per window; a request during a call asks for one more after it. */
140
+ function request(id, delayMs) {
141
+ if (stopped || !rpc)
142
+ return;
143
+ const state = sessionState(id);
144
+ if (state.timer)
145
+ return;
146
+ if (state.inflight) {
147
+ state.dirty = true;
148
+ return;
149
+ }
150
+ state.timer = setTimeout(() => {
151
+ state.timer = undefined;
152
+ void pull(id);
153
+ }, delayMs);
154
+ state.timer.unref?.();
155
+ }
156
+ const isOpen = (key) => local.get(key) ?? guard(() => fold?.[0]?.open?.[key] === true) ?? false;
157
+ const persist = (changes) => {
158
+ if (!fold)
159
+ return;
160
+ guard(() => {
161
+ const done = fold[1]((draft) => {
162
+ draft.open ??= {};
163
+ for (const [key, open] of changes) {
164
+ if (open)
165
+ draft.open[key] = true;
166
+ else
167
+ delete draft.open[key];
168
+ }
169
+ });
170
+ Promise.resolve(done).catch(() => undefined);
171
+ });
172
+ };
173
+ const rowsFor = (id) => {
174
+ const state = sessions.get(id);
175
+ if (!state?.enabled || state.summaries.length === 0)
176
+ return [];
177
+ const keys = rowKeys(id, state.summaries);
178
+ return state.summaries
179
+ .map((summary, index) => ({ key: keys[index], summary }))
180
+ .slice(-MAX_ROWS);
181
+ };
182
+ const toggle = (key) => {
183
+ const next = !isOpen(key);
184
+ local.set(key, next);
185
+ persist([[key, next]]);
186
+ repaintFold();
187
+ };
188
+ const toggleAll = () => {
189
+ if (!lastViewed)
190
+ return;
191
+ const rows = rowsFor(lastViewed);
192
+ const target = rows.some((row) => !isOpen(row.key));
193
+ for (const row of rows)
194
+ local.set(row.key, target);
195
+ persist(rows.map((row) => [row.key, target]));
196
+ repaintFold();
197
+ };
198
+ // The host owns a keymap layer through the component that created it and removes it when that
199
+ // component is disposed. A slot remount therefore needs a fresh layer, so this runs once per render.
200
+ const registerCommand = () => {
201
+ layerHandle = guard(() => deps.keymap.layer(() => ({
202
+ mode: "global",
203
+ commands: [
204
+ {
205
+ id: "omms.recall.fold",
206
+ title: "Toggle OMMS recall rows",
207
+ palette: true,
208
+ slash: { name: "omms-recall" },
209
+ run: () => void guard(toggleAll),
210
+ },
211
+ ],
212
+ })));
213
+ };
214
+ const drawRow = ({ key, summary }) => deps.jsx("box", {
215
+ flexDirection: "column",
216
+ onMouseDown: () => void guard(() => toggle(key)),
217
+ get children() {
218
+ return [
219
+ deps.jsx("text", {
220
+ get fg() {
221
+ return guard(deps.muted);
222
+ },
223
+ get children() {
224
+ foldRevision();
225
+ return guard(() => `${isOpen(key) ? "▾" : "▸"} ● ${callTitle(summary)}`) ?? "";
226
+ },
227
+ }),
228
+ deps.jsx("text", {
229
+ get visible() {
230
+ foldRevision();
231
+ return isOpen(key);
232
+ },
233
+ get fg() {
234
+ return guard(deps.muted);
235
+ },
236
+ get children() {
237
+ foldRevision();
238
+ if (!isOpen(key))
239
+ return "";
240
+ return (guard(() => unfoldLines(summary)
241
+ .map((line) => ` ${line}`)
242
+ .join("\n")) ?? "");
243
+ },
244
+ }),
245
+ ];
246
+ },
247
+ });
248
+ const render = (input) => {
249
+ try {
250
+ // The host passes slot input as reactive props and may keep this claim mounted while the
251
+ // session in view changes, so the id is read on each paint. `tracked` makes the follow-up
252
+ // idempotent: a repaint with the same id asks for no new pull.
253
+ let tracked;
254
+ const follow = () => {
255
+ const id = guard(() => input?.sessionID);
256
+ if (id && id !== tracked) {
257
+ tracked = id;
258
+ lastViewed = id;
259
+ request(id, 0);
260
+ }
261
+ return id;
262
+ };
263
+ follow();
264
+ registerCommand();
265
+ return deps.jsx("box", {
266
+ flexDirection: "column",
267
+ get children() {
268
+ listRevision();
269
+ const id = follow();
270
+ return (id ? guard(() => rowsFor(id).map(drawRow)) : undefined) ?? [];
271
+ },
272
+ });
273
+ }
274
+ catch {
275
+ return null;
276
+ }
277
+ };
278
+ const removeSlot = guard(() => deps.ui.slot({ append: SLOT, render }));
279
+ const offPush = guard(() => rpc?.events.on("recalled", (event) => {
280
+ const id = event?.data?.sessionID;
281
+ if (typeof id === "string" && sessions.has(id))
282
+ request(id, debounceMs);
283
+ }));
284
+ // Only sessions the slot has drawn are refreshed, and an event without a session id is no hint.
285
+ const offData = guard(() => deps.data.listen((event) => {
286
+ const details = event?.details;
287
+ if (typeof details?.type !== "string" || !PULL_EVENT_TYPES.has(details.type))
288
+ return;
289
+ const id = details.data?.sessionID ?? details.properties?.sessionID;
290
+ if (typeof id === "string" && sessions.has(id))
291
+ request(id, debounceMs);
292
+ }));
293
+ return () => {
294
+ stopped = true;
295
+ for (const state of sessions.values())
296
+ clearTimeout(state.timer);
297
+ release(offData);
298
+ release(offPush);
299
+ release(removeSlot);
300
+ release(layerHandle);
301
+ };
302
+ }
@@ -3,4 +3,4 @@
3
3
  * src/config.ts until that file reached its size ceiling; the text is
4
4
  * unchanged. Shared by config.ts and the global settings writer.
5
5
  */
6
- export declare const CONFIG_TEMPLATE = "{\n // ============================================\n // omms (Opinionated Modular Memory System) Configuration\n // ============================================\n \n // Storage location for the vector database. Leave unset to use the\n // default ~/.omms/data (a legacy ~/.opencode-mem/data store is migrated\n // there automatically on first start; see docs/omms-migration.md).\n // \"storagePath\": \"~/.omms/data\",\n\n \"userEmailOverride\": \"\",\n \"userNameOverride\": \"\",\n \n // ============================================\n // Embedding Model (for similarity search)\n // ============================================\n // Local = Hugging Face / ONNX via @huggingface/transformers (not Apple MLX).\n // Remote = set embeddingApiUrl (OpenAI-compatible /embeddings); embeddingApiKey is optional.\n \n // Default: Nomic Embed v1 (768 dimensions, 8192 context, multilingual)\n \"embeddingModel\": \"Xenova/nomic-embed-text-v1\",\n\n // Opt-in Nomic task prefixes (search_document: / search_query:). After enabling,\n // re-index existing memories so store and query vectors stay aligned.\n // \"embeddingUseTaskPrefixes\": true,\n \n // Auto-detected dimensions (no need to set manually)\n // \"embeddingDimensions\": 768,\n \n // Other recommended local models:\n // \"embeddingModel\": \"Xenova/jina-embeddings-v2-base-en\", // 768 dims, English-only, 8192 context\n // \"embeddingModel\": \"Xenova/jina-embeddings-v2-small-en\", // 512 dims, faster, 8192 context\n // \"embeddingModel\": \"Xenova/all-MiniLM-L6-v2\", // 384 dims, very fast, 512 context\n // \"embeddingModel\": \"Xenova/all-mpnet-base-v2\", // 768 dims, good quality, 512 context\n \n // Optional: OpenAI-compatible API for embeddings (URL required; key only if the server needs one)\n // \"embeddingApiUrl\": \"https://api.openai.com/v1\",\n // \"embeddingApiKey\": \"env://OPENAI_API_KEY\", // or \"sk-...\" / \"file:///path/to/key\"\n // \"embeddingModel\": \"text-embedding-3-small\", // 1536 dims, auto-detected\n \n // ============================================\n // Web Server Settings\n // ============================================\n \n // Start a background import of past chats on each host's next start.\n \"autoBackfill\": true,\n // \"piBackfillModel\": \"inherit\", // or \"external\", or \"provider/model\"\n // \"opencodeBackfillModel\": \"inherit\", // or \"external\", or \"provider/model\"\n // Directory maps for history recorded in moved or deleted directories.\n // \"importPathMaps\": [{ \"from\": \"~/code/app-feat-x\", \"to\": \"~/code/app\" }],\n // Unresolved directories to hide on the Directory maps page. They stay unimported.\n // \"importIgnoredDirectories\": [\"/private/tmp/scratch\"],\n // Claude Code's folder, when it is not ~/.claude (like CLAUDE_CONFIG_DIR).\n // \"claudeConfigDir\": \"~/.claude-work\",\n\n // Register the web app to start when you log in.\n \"webServerAutoStart\": true,\n // Enable web UI for managing memories (accessible at http://localhost:4747)\n \"webServerEnabled\": true,\n \n // Port for web UI server\n \"webServerPort\": 4747,\n \n // Host address for web UI (use 127.0.0.1 for local only, 0.0.0.0 for network access)\n \"webServerHost\": \"127.0.0.1\",\n\n // Optional HTTP Basic Auth for the web UI. Accepts literal, env://, or file:// secrets.\n // \"webServerAuthPassword\": \"\",\n // \"webServerAuthUsername\": \"\",\n\n // Deprecated: imported once into the API token table, then no longer read.\n // Create API tokens on the Settings page (Keys and access) instead.\n // \"webServerApiToken\": \"env://OMMS_WEB_TOKEN\",\n \n // ============================================\n // Database Settings\n // ============================================\n \n // Maximum vectors per database shard (auto-creates new shard when limit reached)\n \"maxVectorsPerShard\": 50000,\n \n // Automatically delete old memories based on retention period\n \"autoCleanupEnabled\": true,\n \n // Days to keep memories before auto-cleanup (only if autoCleanupEnabled is true)\n \"autoCleanupRetentionDays\": 30,\n \n // Automatically detect and remove duplicate memories\n \"deduplicationEnabled\": true,\n \n // Similarity threshold (0-1) for detecting duplicates (higher = stricter)\n \"deduplicationSimilarityThreshold\": 0.90,\n \n // ============================================\n // Memory Scope Settings\n // ============================================\n\n // Default scope for memory list/search queries\n // \"project\" keeps queries within the current project, \"all-projects\" searches across all project shards\n \"memory\": {\n \"defaultScope\": \"project\"\n },\n\n // ============================================\n // Model for auto-capture and profile learning (same rule in OpenCode and Pi)\n // ============================================\n\n // Which model summarises your work, in this order:\n // 1. The host model below: opencodeProvider/opencodeModel in OpenCode,\n // piProvider/piModel in Pi. Set the model to \"inherit\" to follow\n // whatever model the session is using, or to \"external\" to send\n // every call to the external API below.\n // 2. If no host model is set: the external API (memoryModel/memoryApiUrl/\n // memoryApiKey further down).\n // 3. If neither is set: the session's own model.\n // If the host model fails and the external API is configured, the external\n // API is used instead.\n //\n // Host models go through OpenCode's or Pi's own sign-in (OAuth like Claude\n // Pro/Max, GitHub Copilot, ChatGPT, or your own key there), so no separate API\n // key is needed here.\n //\n // Examples (OpenCode names from 'opencode providers list'; Pi names from its model list):\n // \"opencodeProvider\": \"anthropic\", \"opencodeModel\": \"claude-haiku-4-5-20251001\"\n // \"opencodeProvider\": \"openai\", \"opencodeModel\": \"inherit\"\n // \"piProvider\": \"openai-codex\", \"piModel\": \"gpt-5.6-luna\"\n //\n // \"opencodeProvider\": \"anthropic\",\n // \"opencodeModel\": \"claude-haiku-4-5-20251001\",\n // \"piProvider\": \"openai-codex\",\n // \"piModel\": \"gpt-5.6-luna\",\n\n // ============================================\n // Auto-Capture Settings\n // ============================================\n \n // Auto-capture runs in the background without blocking your main session.\n // Note: Ollama may not support tool calling. Use OpenAI, Anthropic, or Groq for best results.\n \n \"autoCaptureEnabled\": true,\n \n // Provider type: \"openai-chat\" | \"openai-responses\" | \"anthropic\" | \"minimax\" | \"orcarouter\" | \"google-gemini\"\n // Note: \"openai-chat\" is a generic OpenAI API-compatible mode.\n // Any service that follows the OpenAI Chat Completions API can use it via custom \"memoryApiUrl\".\n \"memoryProvider\": \"openai-chat\",\n \n // External API (step 2 above, and the fallback when a host model fails).\n // Uncomment all 3 lines and replace memoryApiKey before use:\n // \"memoryModel\": \"gpt-4o-mini\",\n // \"memoryApiUrl\": \"https://api.openai.com/v1\",\n // \"memoryApiKey\": \"sk-...\",\n\n // API Key Formats:\n // Direct value: \"sk-...\"\n // From file: \"file://~/.config/litellm-key.txt\"\n // From env variable: \"env://LITELLM_API_KEY\"\n \n // Examples for different providers:\n // Any OpenAI-compatible endpoint can use the \"openai-chat\" provider pattern below.\n // Common examples: DeepSeek, Qwen (via Alibaba Cloud ModelStudio),\n // Zhipu GLM (BigModel platform), and Kimi (Moonshot AI platform).\n\n // OpenAI Chat Completion (default, backward compatible):\n // \"memoryProvider\": \"openai-chat\"\n // \"memoryModel\": \"gpt-4o-mini\"\n // \"memoryApiUrl\": \"https://api.openai.com/v1\"\n // \"memoryApiKey\": \"sk-...\"\n\n // DeepSeek (OpenAI-compatible example):\n // \"memoryProvider\": \"openai-chat\"\n // \"memoryModel\": \"deepseek-chat\"\n // \"memoryApiUrl\": \"https://api.deepseek.com/v1\"\n // \"memoryApiKey\": \"sk-...\"\n \n // OpenAI Responses API (recommended, with session support):\n // \"memoryProvider\": \"openai-responses\"\n // \"memoryModel\": \"gpt-4o\"\n // \"memoryApiUrl\": \"https://api.openai.com/v1\"\n // \"memoryApiKey\": \"sk-...\"\n \n // Anthropic (with session support):\n // \"memoryProvider\": \"anthropic\"\n // \"memoryModel\": \"claude-3-5-haiku-20241022\"\n // \"memoryApiUrl\": \"https://api.anthropic.com/v1\"\n // \"memoryApiKey\": \"sk-ant-...\"\n\n // MiniMax (Anthropic Messages-compatible endpoint, with session support):\n // \"memoryProvider\": \"minimax\"\n // \"memoryModel\": \"MiniMax-M3\"\n // \"memoryApiUrl\": \"https://api.minimax.io\" // global endpoint\n // \"memoryApiKey\": \"<MiniMax API key>\"\n // // China endpoint: \"memoryApiUrl\": \"https://api.minimaxi.com\"\n // // Optional adaptive thinking for MiniMax-M3:\n // \"memoryExtraParams\": { \"thinking\": { \"type\": \"adaptive\" } }\n\n // OrcaRouter (OpenAI-compatible gateway, namespaced model IDs, with session support):\n // \"memoryProvider\": \"orcarouter\"\n // \"memoryApiKey\": \"<OrcaRouter API key>\"\n // // memoryApiUrl and memoryModel are optional \u2014 they default to\n // // https://api.orcarouter.ai/v1 and \"orcarouter/auto\" (a routing alias).\n // // OrcaRouter rejects bare model names, so if you set memoryModel, use a\n // // namespaced ID such as \"openai/gpt-5.5\" or \"deepseek/deepseek-v4-flash\".\n // \"memoryModel\": \"openai/gpt-5.5\"\n\n // Groq (OpenAI-compatible, use openai-chat provider):\n // \"memoryProvider\": \"openai-chat\"\n // \"memoryModel\": \"llama-3.3-70b-versatile\"\n // \"memoryApiUrl\": \"https://api.groq.com/openai/v1\"\n // \"memoryApiKey\": \"gsk_...\"\n \n // Maximum iterations for multi-turn AI analysis (for openai-responses, anthropic, and minimax)\n \"autoCaptureMaxIterations\": 5,\n \n // Timeout per iteration in milliseconds (30 seconds default)\n \"autoCaptureIterationTimeout\": 30000,\n\n // Tries for one turn's capture, on Pi and OpenCode, 2 and 4 seconds apart. After the\n // last one fails, a turn the model could not reach goes to the capture retry queue.\n \"autoCaptureMaxRetries\": 3,\n\n // Maximum UTF-8 bytes for the auto-capture markdown context sent to the summary model.\n // Prevents HTTP 400 context overflows on models with ~131K token windows (e.g. Groq Llama).\n // Rough guide: tokens \u2248 bytes / 4 for mixed code/prose.\n \"autoCaptureMaxContextBytes\": 131072,\n \n // Days to keep AI session history before cleanup\n \"aiSessionRetentionDays\": 7,\n\n // Capture diagnostics: every capture attempt always writes one metadata line\n // (model, stop reason, sizes, outcome) to ~/.omms/omms.log, with no\n // conversation text. Set captureTrace to true to also write each attempt's\n // prompt and raw reply to ~/.omms/traces/ for debugging. Traces can contain\n // conversation content: <private> text and common API key formats are\n // redacted, files are readable only by you, and they are deleted after\n // captureTraceRetentionDays. Only this global file can turn tracing on.\n // \"captureTrace\": false,\n // \"captureTraceRetentionDays\": 7,\n // \"captureAttemptRetentionDays\": 30,\n\n // Skill learning: record each full turn (prompt, replies, tool calls with\n // their outcome, and the skills used) in ~/.omms/data/skills.db, so OMMS can\n // rank your skills and draft better versions. Off by default. A project config\n // can turn it off but never on. No model call is made to record a turn.\n // \"skillLearning\": false,\n // Remove <private> text and common API key formats before a turn is stored.\n // Global config only. Turning this off stores text as written.\n // \"skillLearningRedact\": true,\n // Folders OMMS reads skills from. Absolute or starting with ~/. Global config\n // only. Unset: ~/.agents/skills and the Claude Code folder's skills folder.\n // \"skillFolders\": [\"~/.agents/skills\"],\n\n // Capture retry queue: when a live capture fails because the model cannot be\n // reached (network error, timeout, HTTP 408, 429 or 5xx), OMMS keeps a copy of\n // the turn in ~/.omms/data and tries it again later. The copy has <private>\n // text and common API key formats removed. Turns are deleted when the retry\n // ends or after captureRetryRetentionHours (0 to 720). 0 turns the queue off.\n // Only this global file can set it.\n // \"captureRetryRetentionHours\": 72,\n\n // Temperature for AI API requests (set to false to omit parameter for models that don't support it)\n // Some reasoning models (like o1, o3, gpt-5) don't support temperature parameter\n // Set to false and add \"memoryTemperature\": false in config when using such models\n \"memoryTemperature\": 0.3,\n\n // Extra parameters to include in API request body\n // Useful for local inference servers (e.g. llama-server with --jinja) that support\n // additional parameters like disabling thinking/reasoning mode\n // Example for Qwen3 models: { \"enable_thinking\": false }\n // \"memoryExtraParams\": {},\n\n // Language for auto-capture summaries (default: \"auto\" for auto-detection)\n // Options: \"auto\", \"en\", \"id\", \"zh\", \"ja\", \"es\", \"fr\", \"de\", \"ru\", \"pt\", \"ar\", \"ko\"\n // \"autoCaptureLanguage\": \"auto\",\n\n // ============================================\n // Toast Notifications\n // ============================================\n\n // Show toast when memory is auto-captured\n \"showAutoCaptureToasts\": true,\n\n // Show toast when user profile is updated\n \"showUserProfileToasts\": true,\n\n // Show toast for error messages\n \"showErrorToasts\": true,\n\n // ============================================\n // User Profile System\n // ============================================\n\n // Analyze user prompts every N prompts to build/update your user profile\n // When N uncaptured prompts accumulate, AI will analyze them to identify:\n // - User preferences (code style, communication style, tool preferences)\n // - User patterns (recurring topics, problem domains, technical interests)\n // - User workflows (development habits, sequences, learning style)\n // - Skill level (overall and per-domain assessment)\n \"userProfileAnalysisInterval\": 10,\n\n // Days before inactive items (all types) are eligible for removal\n \"userProfileStaleDays\": 2,\n\n // Days before an inactive workflow is eligible for removal. A workflow seen\n // userProfileMinEvidenceForRetention times or more is kept.\n \"userProfileWorkflowStaleDays\": 30,\n\n // Number of preferences shown in UI\n \"userProfileDisplayPreferences\": 20,\n \n // Number of patterns shown in UI\n \"userProfileDisplayPatterns\": 15,\n \n // Number of workflows shown in UI\n \"userProfileDisplayWorkflows\": 10,\n \n // Number of preferences injected into LLM conversation context\n // Keep this small \u2014 the strongest signals are enough; more dilute LLM attention\n \"userProfileInjectPreferences\": 5,\n \n // Number of patterns injected into LLM conversation context\n \"userProfileInjectPatterns\": 5,\n \n // Number of workflows injected into LLM conversation context\n \"userProfileInjectWorkflows\": 3,\n \n // Days before preference confidence starts to decay (if not reinforced)\n // Preferences that aren't seen again will gradually lose confidence and be removed\n \"userProfileConfidenceDecayDays\": 30,\n \n // Number of profile versions to keep in changelog (for rollback/debugging)\n // Older versions are automatically cleaned up\n \"userProfileChangelogRetentionCount\": 5,\n\n // Minimum evidence count for a preference/pattern to survive confidence decay\n // Items confirmed fewer times are more likely to be pruned when confidence decays\n \"userProfileMinEvidenceForRetention\": 3,\n\n // Merge duplicate or vague profile items every N analysed prompts (about 1 model call per 100 items)\n \"userProfileAutoCleanupEnabled\": true,\n \"userProfileAutoCleanupInterval\": 500,\n\n // Enable LLM validation of existing preferences against recent behavior.\n // When enabled, each analysis round checks if top-5 preferences still match recent prompts.\n // Experimental \u2014 disabled by default.\n \"userProfileValidationEnabled\": false,\n\n // ============================================\n // Search Settings\n // ============================================\n \n // Minimum similarity score (0-1) for memory search results. Leave unset to\n // follow the default for your embedding model: 0.5 for qwen3-embedding:0.6b\n // (the only model measured), 0.6 for every other embedder.\n // \"similarityThreshold\": 0.5,\n\n // Maximum number of memories to return in search results.\n // Manual searches can ask for fewer; prompt retrieval uses this ceiling.\n \"maxMemories\": 10,\n\n // ============================================\n // Memory Context Controls\n // ============================================\n\n // Recent memories added at fresh session start (OpenCode V1 and Claude Code).\n // Pi and OpenCode V2 search the store with each prompt instead.\n \"chatMessage\": {\n \"enabled\": true,\n // Recent memories injected at session start.\n \"maxMemories\": 3,\n \"excludeCurrentSession\": true,\n // When to inject: \"first\" message of a session or \"always\".\n // \"injectOn\": \"first\",\n },\n\n // OpenCode profile-learning input limit, in UTF-8 bytes. Smaller values can\n // omit prompts from that input. Does not limit Pi or Claude Code profile input.\n \"userProfileMaxContextBytes\": 32768,\n\n // Shared budget for automatic memory context (profile text, memories, and\n // formatting) across all hosts, in approximate tokens: ceil(UTF-8 bytes / 4).\n // Covers prompt retrieval, recent-memory injection, and session-memory\n // restoration. Not an exact provider token limit or a spending limit.\n \"retrievalMaxTokens\": 2000,\n\n // ============================================\n // Advanced Settings\n // ============================================\n \n // Inject user profile into AI context (preferences, patterns, workflows)\n \"injectProfile\": true\n}\n";
6
+ export declare const CONFIG_TEMPLATE = "{\n // ============================================\n // omms (Opinionated Modular Memory System) Configuration\n // ============================================\n \n // Storage location for the vector database. Leave unset to use the\n // default ~/.omms/data (a legacy ~/.opencode-mem/data store is migrated\n // there automatically on first start; see docs/omms-migration.md).\n // \"storagePath\": \"~/.omms/data\",\n\n \"userEmailOverride\": \"\",\n \"userNameOverride\": \"\",\n \n // ============================================\n // Embedding Model (for similarity search)\n // ============================================\n // Local = Hugging Face / ONNX via @huggingface/transformers (not Apple MLX).\n // Remote = set embeddingApiUrl (OpenAI-compatible /embeddings); embeddingApiKey is optional.\n \n // Default: Nomic Embed v1 (768 dimensions, 8192 context, multilingual)\n \"embeddingModel\": \"Xenova/nomic-embed-text-v1\",\n\n // Opt-in Nomic task prefixes (search_document: / search_query:). After enabling,\n // re-index existing memories so store and query vectors stay aligned.\n // \"embeddingUseTaskPrefixes\": true,\n \n // Auto-detected dimensions (no need to set manually)\n // \"embeddingDimensions\": 768,\n \n // Other recommended local models:\n // \"embeddingModel\": \"Xenova/jina-embeddings-v2-base-en\", // 768 dims, English-only, 8192 context\n // \"embeddingModel\": \"Xenova/jina-embeddings-v2-small-en\", // 512 dims, faster, 8192 context\n // \"embeddingModel\": \"Xenova/all-MiniLM-L6-v2\", // 384 dims, very fast, 512 context\n // \"embeddingModel\": \"Xenova/all-mpnet-base-v2\", // 768 dims, good quality, 512 context\n \n // Optional: OpenAI-compatible API for embeddings (URL required; key only if the server needs one)\n // \"embeddingApiUrl\": \"https://api.openai.com/v1\",\n // \"embeddingApiKey\": \"env://OPENAI_API_KEY\", // or \"sk-...\" / \"file:///path/to/key\"\n // \"embeddingModel\": \"text-embedding-3-small\", // 1536 dims, auto-detected\n \n // ============================================\n // Web Server Settings\n // ============================================\n \n // Start a background import of past chats on each host's next start.\n \"autoBackfill\": true,\n // \"piBackfillModel\": \"inherit\", // or \"external\", or \"provider/model\"\n // \"opencodeBackfillModel\": \"inherit\", // or \"external\", or \"provider/model\"\n // Directory maps for history recorded in moved or deleted directories.\n // \"importPathMaps\": [{ \"from\": \"~/code/app-feat-x\", \"to\": \"~/code/app\" }],\n // Unresolved directories to hide on the Directory maps page. They stay unimported.\n // \"importIgnoredDirectories\": [\"/private/tmp/scratch\"],\n // Claude Code's folder, when it is not ~/.claude (like CLAUDE_CONFIG_DIR).\n // \"claudeConfigDir\": \"~/.claude-work\",\n\n // Register the web app to start when you log in.\n \"webServerAutoStart\": true,\n // Enable web UI for managing memories (accessible at http://localhost:4747)\n \"webServerEnabled\": true,\n \n // Port for web UI server\n \"webServerPort\": 4747,\n \n // Host address for web UI (use 127.0.0.1 for local only, 0.0.0.0 for network access)\n \"webServerHost\": \"127.0.0.1\",\n\n // Optional HTTP Basic Auth for the web UI. Accepts literal, env://, or file:// secrets.\n // \"webServerAuthPassword\": \"\",\n // \"webServerAuthUsername\": \"\",\n\n // Deprecated: imported once into the API token table, then no longer read.\n // Create API tokens on the Settings page (Keys and access) instead.\n // \"webServerApiToken\": \"env://OMMS_WEB_TOKEN\",\n \n // ============================================\n // Database Settings\n // ============================================\n \n // Maximum vectors per database shard (auto-creates new shard when limit reached)\n \"maxVectorsPerShard\": 50000,\n \n // Automatically delete old memories based on retention period\n \"autoCleanupEnabled\": true,\n \n // Days to keep memories before auto-cleanup (only if autoCleanupEnabled is true)\n \"autoCleanupRetentionDays\": 30,\n \n // Automatically detect and remove duplicate memories\n \"deduplicationEnabled\": true,\n \n // Similarity threshold (0-1) for detecting duplicates (higher = stricter)\n \"deduplicationSimilarityThreshold\": 0.90,\n \n // ============================================\n // Memory Scope Settings\n // ============================================\n\n // Default scope for memory list/search queries\n // \"project\" keeps queries within the current project, \"all-projects\" searches across all project shards\n \"memory\": {\n \"defaultScope\": \"project\"\n },\n\n // ============================================\n // Model for auto-capture and profile learning (same rule in OpenCode and Pi)\n // ============================================\n\n // Which model summarises your work, in this order:\n // 1. The host model below: opencodeProvider/opencodeModel in OpenCode,\n // piProvider/piModel in Pi. Set the model to \"inherit\" to follow\n // whatever model the session is using, or to \"external\" to send\n // every call to the external API below.\n // 2. If no host model is set: the external API (memoryModel/memoryApiUrl/\n // memoryApiKey further down).\n // 3. If neither is set: the session's own model.\n // If the host model fails and the external API is configured, the external\n // API is used instead.\n //\n // Host models go through OpenCode's or Pi's own sign-in (OAuth like Claude\n // Pro/Max, GitHub Copilot, ChatGPT, or your own key there), so no separate API\n // key is needed here.\n //\n // Examples (OpenCode names from 'opencode providers list'; Pi names from its model list):\n // \"opencodeProvider\": \"anthropic\", \"opencodeModel\": \"claude-haiku-4-5-20251001\"\n // \"opencodeProvider\": \"openai\", \"opencodeModel\": \"inherit\"\n // \"piProvider\": \"openai-codex\", \"piModel\": \"gpt-5.6-luna\"\n //\n // \"opencodeProvider\": \"anthropic\",\n // \"opencodeModel\": \"claude-haiku-4-5-20251001\",\n // \"piProvider\": \"openai-codex\",\n // \"piModel\": \"gpt-5.6-luna\",\n\n // ============================================\n // Auto-Capture Settings\n // ============================================\n \n // Auto-capture runs in the background without blocking your main session.\n // Note: Ollama may not support tool calling. Use OpenAI, Anthropic, or Groq for best results.\n \n \"autoCaptureEnabled\": true,\n \n // Provider type: \"openai-chat\" | \"openai-responses\" | \"anthropic\" | \"minimax\" | \"orcarouter\" | \"google-gemini\"\n // Note: \"openai-chat\" is a generic OpenAI API-compatible mode.\n // Any service that follows the OpenAI Chat Completions API can use it via custom \"memoryApiUrl\".\n \"memoryProvider\": \"openai-chat\",\n \n // External API (step 2 above, and the fallback when a host model fails).\n // Uncomment all 3 lines and replace memoryApiKey before use:\n // \"memoryModel\": \"gpt-4o-mini\",\n // \"memoryApiUrl\": \"https://api.openai.com/v1\",\n // \"memoryApiKey\": \"sk-...\",\n\n // API Key Formats:\n // Direct value: \"sk-...\"\n // From file: \"file://~/.config/litellm-key.txt\"\n // From env variable: \"env://LITELLM_API_KEY\"\n \n // Examples for different providers:\n // Any OpenAI-compatible endpoint can use the \"openai-chat\" provider pattern below.\n // Common examples: DeepSeek, Qwen (via Alibaba Cloud ModelStudio),\n // Zhipu GLM (BigModel platform), and Kimi (Moonshot AI platform).\n\n // OpenAI Chat Completion (default, backward compatible):\n // \"memoryProvider\": \"openai-chat\"\n // \"memoryModel\": \"gpt-4o-mini\"\n // \"memoryApiUrl\": \"https://api.openai.com/v1\"\n // \"memoryApiKey\": \"sk-...\"\n\n // DeepSeek (OpenAI-compatible example):\n // \"memoryProvider\": \"openai-chat\"\n // \"memoryModel\": \"deepseek-chat\"\n // \"memoryApiUrl\": \"https://api.deepseek.com/v1\"\n // \"memoryApiKey\": \"sk-...\"\n \n // OpenAI Responses API (recommended, with session support):\n // \"memoryProvider\": \"openai-responses\"\n // \"memoryModel\": \"gpt-4o\"\n // \"memoryApiUrl\": \"https://api.openai.com/v1\"\n // \"memoryApiKey\": \"sk-...\"\n \n // Anthropic (with session support):\n // \"memoryProvider\": \"anthropic\"\n // \"memoryModel\": \"claude-3-5-haiku-20241022\"\n // \"memoryApiUrl\": \"https://api.anthropic.com/v1\"\n // \"memoryApiKey\": \"sk-ant-...\"\n\n // MiniMax (Anthropic Messages-compatible endpoint, with session support):\n // \"memoryProvider\": \"minimax\"\n // \"memoryModel\": \"MiniMax-M3\"\n // \"memoryApiUrl\": \"https://api.minimax.io\" // global endpoint\n // \"memoryApiKey\": \"<MiniMax API key>\"\n // // China endpoint: \"memoryApiUrl\": \"https://api.minimaxi.com\"\n // // Optional adaptive thinking for MiniMax-M3:\n // \"memoryExtraParams\": { \"thinking\": { \"type\": \"adaptive\" } }\n\n // OrcaRouter (OpenAI-compatible gateway, namespaced model IDs, with session support):\n // \"memoryProvider\": \"orcarouter\"\n // \"memoryApiKey\": \"<OrcaRouter API key>\"\n // // memoryApiUrl and memoryModel are optional \u2014 they default to\n // // https://api.orcarouter.ai/v1 and \"orcarouter/auto\" (a routing alias).\n // // OrcaRouter rejects bare model names, so if you set memoryModel, use a\n // // namespaced ID such as \"openai/gpt-5.5\" or \"deepseek/deepseek-v4-flash\".\n // \"memoryModel\": \"openai/gpt-5.5\"\n\n // Groq (OpenAI-compatible, use openai-chat provider):\n // \"memoryProvider\": \"openai-chat\"\n // \"memoryModel\": \"llama-3.3-70b-versatile\"\n // \"memoryApiUrl\": \"https://api.groq.com/openai/v1\"\n // \"memoryApiKey\": \"gsk_...\"\n \n // Maximum iterations for multi-turn AI analysis (for openai-responses, anthropic, and minimax)\n \"autoCaptureMaxIterations\": 5,\n \n // Timeout per iteration in milliseconds (30 seconds default)\n \"autoCaptureIterationTimeout\": 30000,\n\n // Tries for one turn's capture, on Pi and OpenCode, 2 and 4 seconds apart. After the\n // last one fails, a turn the model could not reach goes to the capture retry queue.\n \"autoCaptureMaxRetries\": 3,\n\n // Maximum UTF-8 bytes for the auto-capture markdown context sent to the summary model.\n // Prevents HTTP 400 context overflows on models with ~131K token windows (e.g. Groq Llama).\n // Rough guide: tokens \u2248 bytes / 4 for mixed code/prose.\n \"autoCaptureMaxContextBytes\": 131072,\n \n // Days to keep AI session history before cleanup\n \"aiSessionRetentionDays\": 7,\n\n // Capture diagnostics: every capture attempt always writes one metadata line\n // (model, stop reason, sizes, outcome) to ~/.omms/omms.log, with no\n // conversation text. Set captureTrace to true to also write each attempt's\n // prompt and raw reply to ~/.omms/traces/ for debugging. Traces can contain\n // conversation content: <private> text and common API key formats are\n // redacted, files are readable only by you, and they are deleted after\n // captureTraceRetentionDays. Only this global file can turn tracing on.\n // \"captureTrace\": false,\n // \"captureTraceRetentionDays\": 7,\n // \"captureAttemptRetentionDays\": 30,\n\n // Skill learning: record each full turn (prompt, replies, tool calls with\n // their outcome, and the skills used) in ~/.omms/data/skills.db, so OMMS can\n // rank your skills and draft better versions. Off by default. A project config\n // can turn it off but never on. No model call is made to record a turn.\n // \"skillLearning\": false,\n // Remove <private> text and common API key formats before a turn is stored.\n // Global config only. Turning this off stores text as written.\n // \"skillLearningRedact\": true,\n // Folders OMMS reads skills from. Absolute or starting with ~/. Global config\n // only. Unset: ~/.agents/skills and the Claude Code folder's skills folder.\n // \"skillFolders\": [\"~/.agents/skills\"],\n\n // Visible recall: the OpenCode tui entrypoint draws a row in the session for\n // each memory recall. On by default. A project config can turn it off but\n // never on.\n // \"visibleRecall\": true,\n\n // Capture retry queue: when a live capture fails because the model cannot be\n // reached (network error, timeout, HTTP 408, 429 or 5xx), OMMS keeps a copy of\n // the turn in ~/.omms/data and tries it again later. The copy has <private>\n // text and common API key formats removed. Turns are deleted when the retry\n // ends or after captureRetryRetentionHours (0 to 720). 0 turns the queue off.\n // Only this global file can set it.\n // \"captureRetryRetentionHours\": 72,\n\n // Temperature for AI API requests (set to false to omit parameter for models that don't support it)\n // Some reasoning models (like o1, o3, gpt-5) don't support temperature parameter\n // Set to false and add \"memoryTemperature\": false in config when using such models\n \"memoryTemperature\": 0.3,\n\n // Extra parameters to include in API request body\n // Useful for local inference servers (e.g. llama-server with --jinja) that support\n // additional parameters like disabling thinking/reasoning mode\n // Example for Qwen3 models: { \"enable_thinking\": false }\n // \"memoryExtraParams\": {},\n\n // Language for auto-capture summaries (default: \"auto\" for auto-detection)\n // Options: \"auto\", \"en\", \"id\", \"zh\", \"ja\", \"es\", \"fr\", \"de\", \"ru\", \"pt\", \"ar\", \"ko\"\n // \"autoCaptureLanguage\": \"auto\",\n\n // ============================================\n // Toast Notifications\n // ============================================\n\n // Show toast when memory is auto-captured\n \"showAutoCaptureToasts\": true,\n\n // Show toast when user profile is updated\n \"showUserProfileToasts\": true,\n\n // Show toast for error messages\n \"showErrorToasts\": true,\n\n // ============================================\n // User Profile System\n // ============================================\n\n // Analyze user prompts every N prompts to build/update your user profile\n // When N uncaptured prompts accumulate, AI will analyze them to identify:\n // - User preferences (code style, communication style, tool preferences)\n // - User patterns (recurring topics, problem domains, technical interests)\n // - User workflows (development habits, sequences, learning style)\n // - Skill level (overall and per-domain assessment)\n \"userProfileAnalysisInterval\": 10,\n\n // Days before inactive items (all types) are eligible for removal\n \"userProfileStaleDays\": 2,\n\n // Days before an inactive workflow is eligible for removal. A workflow seen\n // userProfileMinEvidenceForRetention times or more is kept.\n \"userProfileWorkflowStaleDays\": 30,\n\n // Number of preferences shown in UI\n \"userProfileDisplayPreferences\": 20,\n \n // Number of patterns shown in UI\n \"userProfileDisplayPatterns\": 15,\n \n // Number of workflows shown in UI\n \"userProfileDisplayWorkflows\": 10,\n \n // Number of preferences injected into LLM conversation context\n // Keep this small \u2014 the strongest signals are enough; more dilute LLM attention\n \"userProfileInjectPreferences\": 5,\n \n // Number of patterns injected into LLM conversation context\n \"userProfileInjectPatterns\": 5,\n \n // Number of workflows injected into LLM conversation context\n \"userProfileInjectWorkflows\": 3,\n \n // Days before preference confidence starts to decay (if not reinforced)\n // Preferences that aren't seen again will gradually lose confidence and be removed\n \"userProfileConfidenceDecayDays\": 30,\n \n // Number of profile versions to keep in changelog (for rollback/debugging)\n // Older versions are automatically cleaned up\n \"userProfileChangelogRetentionCount\": 5,\n\n // Minimum evidence count for a preference/pattern to survive confidence decay\n // Items confirmed fewer times are more likely to be pruned when confidence decays\n \"userProfileMinEvidenceForRetention\": 3,\n\n // Merge duplicate or vague profile items every N analysed prompts (about 1 model call per 100 items)\n \"userProfileAutoCleanupEnabled\": true,\n \"userProfileAutoCleanupInterval\": 500,\n\n // Enable LLM validation of existing preferences against recent behavior.\n // When enabled, each analysis round checks if top-5 preferences still match recent prompts.\n // Experimental \u2014 disabled by default.\n \"userProfileValidationEnabled\": false,\n\n // ============================================\n // Search Settings\n // ============================================\n \n // Minimum similarity score (0-1) for memory search results. Leave unset to\n // follow the default for your embedding model: 0.5 for qwen3-embedding:0.6b\n // (the only model measured), 0.6 for every other embedder.\n // \"similarityThreshold\": 0.5,\n\n // Maximum number of memories to return in search results.\n // Manual searches can ask for fewer; prompt retrieval uses this ceiling.\n \"maxMemories\": 10,\n\n // ============================================\n // Memory Context Controls\n // ============================================\n\n // Recent memories added at fresh session start (OpenCode V1 and Claude Code).\n // Pi and OpenCode V2 search the store with each prompt instead.\n \"chatMessage\": {\n \"enabled\": true,\n // Recent memories injected at session start.\n \"maxMemories\": 3,\n \"excludeCurrentSession\": true,\n // When to inject: \"first\" message of a session or \"always\".\n // \"injectOn\": \"first\",\n },\n\n // OpenCode profile-learning input limit, in UTF-8 bytes. Smaller values can\n // omit prompts from that input. Does not limit Pi or Claude Code profile input.\n \"userProfileMaxContextBytes\": 32768,\n\n // Shared budget for automatic memory context (profile text, memories, and\n // formatting) across all hosts, in approximate tokens: ceil(UTF-8 bytes / 4).\n // Covers prompt retrieval, recent-memory injection, and session-memory\n // restoration. Not an exact provider token limit or a spending limit.\n \"retrievalMaxTokens\": 2000,\n\n // ============================================\n // Advanced Settings\n // ============================================\n \n // Inject user profile into AI context (preferences, patterns, workflows)\n \"injectProfile\": true\n}\n";
@@ -254,6 +254,11 @@ export const CONFIG_TEMPLATE = `{
254
254
  // only. Unset: ~/.agents/skills and the Claude Code folder's skills folder.
255
255
  // "skillFolders": ["~/.agents/skills"],
256
256
 
257
+ // Visible recall: the OpenCode tui entrypoint draws a row in the session for
258
+ // each memory recall. On by default. A project config can turn it off but
259
+ // never on.
260
+ // "visibleRecall": true,
261
+
257
262
  // Capture retry queue: when a live capture fails because the model cannot be
258
263
  // reached (network error, timeout, HTTP 408, 429 or 5xx), OMMS keeps a copy of
259
264
  // the turn in ~/.omms/data and tries it again later. The copy has <private>
package/dist/config.d.ts CHANGED
@@ -188,6 +188,7 @@ declare function buildConfig(fileConfig: OmmsConfig): {
188
188
  maxAgeDays: number | undefined;
189
189
  injectOn: "first" | "always";
190
190
  };
191
+ visibleRecall: boolean;
191
192
  skillLearning: boolean;
192
193
  skillLearningRedact: boolean;
193
194
  skillFolders: string[] | undefined;
@@ -298,6 +299,7 @@ export declare let CONFIG: {
298
299
  maxAgeDays: number | undefined;
299
300
  injectOn: "first" | "always";
300
301
  };
302
+ visibleRecall: boolean;
301
303
  skillLearning: boolean;
302
304
  skillLearningRedact: boolean;
303
305
  skillFolders: string[] | undefined;
package/dist/config.js CHANGED
@@ -10,6 +10,7 @@ import { getAutoCaptureProviderStatus } from "./services/ai/live-model-choice.js
10
10
  import { parseBackfillModel } from "./importer/backfill-model.js";
11
11
  import { parseIgnoredDirectories, parseImportPathMaps } from "./importer/import-path-maps.js";
12
12
  import { normaliseSkillConfig, projectSkillOverride, } from "./services/skill-learning/skill-config.js";
13
+ import * as visibleRecall from "./services/visible-recall-config.js";
13
14
  import { checkedMemoryLimit, MEMORY_LIMITS } from "./utils/memory-limits.js";
14
15
  import { defaultSimilarityThreshold } from "./utils/threshold-default.js";
15
16
  import { RERANKER_TIMEOUT_DEFAULT_MS } from "./services/request-timeouts.js";
@@ -371,6 +372,7 @@ function buildConfig(fileConfig) {
371
372
  captureAttemptRetentionDays: normalizeAutoCleanupRetentionDays(fileConfig.captureAttemptRetentionDays ?? DEFAULTS.captureAttemptRetentionDays),
372
373
  captureRetryRetentionHours: normalizeCaptureRetryRetentionHours(fileConfig.captureRetryRetentionHours),
373
374
  ...normaliseSkillConfig(fileConfig),
375
+ ...visibleRecall.visibleRecallFromFile(fileConfig),
374
376
  autoBackfill: fileConfig.autoBackfill ?? DEFAULTS.autoBackfill,
375
377
  opencodeBackfillModel: fileConfig.opencodeBackfillModel ?? DEFAULTS.opencodeBackfillModel,
376
378
  piBackfillModel: fileConfig.piBackfillModel ?? DEFAULTS.piBackfillModel,
@@ -543,6 +545,7 @@ export function initConfig(directory, options = {}) {
543
545
  delete projectOverrides.skillLearningRedact;
544
546
  delete projectOverrides.skillFolders;
545
547
  Object.assign(projectOverrides, skillRule.override);
548
+ visibleRecall.applyProjectVisibleRecall(projectConfig, projectOverrides, directory, log);
546
549
  delete projectOverrides.autoBackfill;
547
550
  delete projectOverrides.opencodeBackfillModel;
548
551
  delete projectOverrides.piBackfillModel;
@@ -0,0 +1,28 @@
1
+ /** One memory a recall injected, reduced to what a fold row shows. */
2
+ export type RecallItem = {
3
+ relevance: number;
4
+ id?: string;
5
+ headline: string;
6
+ };
7
+ /** One recall as OMMS made it: a prompt search, or the recent memories a session opens with. */
8
+ export type RecallSummary = {
9
+ mode: "search" | "recent";
10
+ query: string | null;
11
+ items: RecallItem[];
12
+ /** Per-session counter the v2 reporter sets when it stores the summary; the TUI keys rows by it. */
13
+ seq?: number;
14
+ };
15
+ /** Query on one line, cut to `max` characters. */
16
+ export declare function queryLine(query: string, max?: number): string;
17
+ /** One line that names a memory: the first line under `## Request`, else the first line. */
18
+ export declare function headline(body: string): string;
19
+ /**
20
+ * Summarise a formatted retrieval section for a host to show. Returns null when the section holds
21
+ * no memory (a profile-only section included), so the host draws nothing. A `recent` recall has
22
+ * no query, whatever the caller passes.
23
+ */
24
+ export declare function buildRecallSummary(section: string, mode: "search" | "recent", query: string | null): RecallSummary | null;
25
+ /** `memory [mode=search, query="...", limit=4]`: the call's name and arguments, as a tool row shows them. */
26
+ export declare function callTitle(summary: RecallSummary): string;
27
+ /** Body of an unfolded row, one string per line, without indentation (the host indents). */
28
+ export declare function unfoldLines(summary: RecallSummary): string[];