oc-mnemoria 0.1.1 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,10 +2,22 @@
2
2
 
3
3
  [![CI](https://github.com/one-bit/oc-mnemoria/actions/workflows/ci.yml/badge.svg)](https://github.com/one-bit/oc-mnemoria/actions/workflows/ci.yml)
4
4
  [![npm](https://img.shields.io/npm/v/oc-mnemoria)](https://www.npmjs.com/package/oc-mnemoria)
5
+ [![Sponsor](https://img.shields.io/badge/Sponsor-GitHub%20Sponsors-181717?logo=githubsponsors)](https://github.com/sponsors/one-bit)
5
6
 
6
7
  Persistent shared memory for [OpenCode](https://opencode.ai) agents, powered
7
8
  by [mnemoria](https://crates.io/crates/mnemoria).
8
9
 
10
+ ## Support this project
11
+
12
+ If this project has been helpful to you, you are welcome to sponsor it.
13
+ Sponsorship helps me spend more time maintaining it, fixing bugs, and
14
+ building new features.
15
+
16
+ No pressure at all - starring the repo, sharing it, or giving feedback also
17
+ means a lot.
18
+
19
+ [Become a sponsor](https://github.com/sponsors/one-bit)
20
+
9
21
  ## What it does
10
22
 
11
23
  Every time you start a new OpenCode session, your AI assistant loses all
@@ -30,44 +42,26 @@ BM25 + semantic search, CRC32 checksum chains, and corruption recovery.
30
42
 
31
43
  ## Installation
32
44
 
33
- ### 1. Install the mnemoria CLI
45
+ Run the install script in your project directory:
34
46
 
35
47
  ```sh
36
- cargo install mnemoria
48
+ curl -fsSL https://raw.githubusercontent.com/one-bit/oc-mnemoria/main/install.sh | sh
37
49
  ```
38
50
 
39
- ### 2. Add the plugin to your project
51
+ The script:
40
52
 
41
- Add `oc-mnemoria/plugin` to the `plugin` array in your `opencode.json`:
53
+ 1. Installs the `mnemoria` CLI (via `cargo install` if needed)
54
+ 2. Configures the compatibility plugin setup (`opencode.json`, `.opencode/package.json`, `.opencode/plugins/oc-mnemoria.js`)
55
+ 3. Installs `/mn-*` slash commands to `.opencode/commands/`
56
+ 4. Installs the oc-mnemoria-judge subagent to `.opencode/agents/`
42
57
 
43
- ```json
44
- {
45
- "$schema": "https://opencode.ai/config.json",
46
- "plugin": ["oc-mnemoria/plugin"]
47
- }
48
- ```
49
-
50
- > **Important:** You must use `"oc-mnemoria/plugin"`, not `"oc-mnemoria"`.
51
- > The bare package name resolves to the main entry point which re-exports
52
- > helpers, constants, and classes alongside the plugin function. OpenCode's
53
- > plugin loader iterates over every export and tries to call each one as a
54
- > plugin initializer, so non-function exports like `DEFAULT_CONFIG` cause a
55
- > `TypeError: fn is not a function` crash. The `/plugin` subpath exports only
56
- > the plugin function and avoids this issue.
57
-
58
- Or use the install script:
58
+ After installation, restart OpenCode and run:
59
59
 
60
60
  ```sh
61
- curl -fsSL https://raw.githubusercontent.com/one-bit/oc-mnemoria/main/install.sh | bash
61
+ /mn-stats
62
62
  ```
63
63
 
64
- ### 3. Install slash commands (optional)
65
-
66
- Copy the `commands/` directory to your OpenCode config:
67
-
68
- ```sh
69
- cp commands/*.md ~/.config/opencode/commands/
70
- ```
64
+ You should see memory store statistics (entry count, file size, timestamps).
71
65
 
72
66
  ## How it works
73
67
 
@@ -135,6 +129,63 @@ giving the current agent immediate cross-agent context.
135
129
  | `ask_memory` | Ask a natural language question |
136
130
  | `memory_stats` | View statistics for the shared store |
137
131
  | `timeline` | Browse memories chronologically (all agents) |
132
+ | `forget` | Mark a memory as obsolete (append-only tombstone) |
133
+ | `compact` | Remove forgotten entries/markers and optionally prune old data |
134
+
135
+ ## oc-mnemoria-judge Subagent
136
+
137
+ The install script includes an `oc-mnemoria-judge` **subagent** (mode: `subagent`) that helps decide what should be remembered. This provides a lightweight way to get a second opinion on whether content is worth storing.
138
+
139
+ **What is a subagent?**
140
+ Subagents are specialized AI assistants that can be invoked manually via `@` mentions or automatically by primary agents via the Task tool. Unlike primary agents (Build, Plan), subagents are designed for specific tasks and run in their own isolated sessions.
141
+
142
+ ### How it works
143
+
144
+ The plugin automatically captures obvious intents using fast heuristics. For uncertain cases, you can invoke the memory judge subagent:
145
+
146
+ ```
147
+ @oc-mnemoria-judge Should I remember: "We decided to use PostgreSQL instead of MongoDB"
148
+ ```
149
+
150
+ The subagent will analyze the content and respond with:
151
+ - A YES/NO decision
152
+ - Brief reasoning
153
+ - Suggested entry type
154
+ - A summary for storage
155
+
156
+ **Note:** The oc-mnemoria-judge is configured as `mode: subagent` in `.opencode/agents/oc-mnemoria-judge.md`, making it available for manual invocation but not appearing as a primary agent in the Tab-switching menu.
157
+
158
+ ### Setting a model
159
+
160
+ The oc-mnemoria-judge subagent does **not** set a model by default — it will
161
+ use whatever model OpenCode assigns. Since this subagent performs a simple
162
+ YES/NO classification, you should override it with a **low-cost model** to
163
+ avoid unnecessary spend.
164
+
165
+ Add an agent model override in your `opencode.json`:
166
+
167
+ ```json
168
+ {
169
+ "$schema": "https://opencode.ai/config.json",
170
+ "agent": {
171
+ "oc-mnemoria-judge": {
172
+ "model": "anthropic/claude-haiku-4-5-20251001"
173
+ }
174
+ }
175
+ }
176
+ ```
177
+
178
+ Any model available in your OpenCode instance can be used. Run `/models` to
179
+ see available options.
180
+
181
+ ### Customizing behavior
182
+
183
+ You can edit the agent's configuration and system prompt in
184
+ `.opencode/agents/oc-mnemoria-judge.md` to change:
185
+ - **Mode**: Keep as `subagent` for manual invocation via `@oc-mnemoria-judge`, or change to `primary` if you want it as a main agent
186
+ - **Tools**: Add tools if you want the subagent to perform actions (currently set to `{}` for safety)
187
+ - **Hidden**: Set to `true` to hide from `@` autocomplete (can still be invoked programmatically)
188
+ - **System prompt**: Change what types of content should be remembered, response format, decision criteria, examples
138
189
 
139
190
  ### Entry types
140
191
 
@@ -147,11 +198,13 @@ Observations are categorized when stored:
147
198
 
148
199
  | Command | Description |
149
200
  |----------------------|--------------------------------------|
150
- | `/memory ask <q>` | Ask about past decisions |
151
- | `/memory search <q>` | Search memories |
152
- | `/memory stats` | Show memory statistics |
153
- | `/memory recent` | Show recent memories |
154
- | `/memory timeline` | Chronological view |
201
+ | `/mn-ask <q>` | Ask about past decisions |
202
+ | `/mn-search <q>` | Search memories |
203
+ | `/mn-stats` | Show memory statistics |
204
+ | `/mn-recent` | Show recent memories |
205
+ | `/mn-timeline` | Chronological view |
206
+ | `/mn-forget ...` | Mark a memory as forgotten/obsolete |
207
+ | `/mn-compact` | Compact store by removing forgotten data |
155
208
 
156
209
  ## Inspecting memories from the command line
157
210
 
@@ -255,6 +308,38 @@ mnemoria --path .opencode verify
255
308
  Checks the CRC32 checksum chain across all entries. Returns a non-zero exit
256
309
  code on corruption, making it suitable for CI or pre-commit hooks.
257
310
 
311
+ ## Memory maintenance workflows
312
+
313
+ Over time, some memories become outdated. oc-mnemoria supports a two-step
314
+ maintenance flow:
315
+
316
+ 1. Mark obsolete entries with `forget` (append-only marker)
317
+ 2. Run `compact` to physically rebuild the store without forgotten entries
318
+
319
+ ### In OpenCode (recommended)
320
+
321
+ Use slash commands:
322
+
323
+ ```sh
324
+ /mn-search flaky test timeout
325
+ /mn-forget id=8d9f... reason="Superseded by retry policy"
326
+ /mn-compact
327
+ ```
328
+
329
+ Optionally prune old entries during compaction:
330
+
331
+ ```sh
332
+ /mn-compact 90
333
+ ```
334
+
335
+ (`90` means `maxAgeDays=90`)
336
+
337
+ ### What each step does
338
+
339
+ - `forget` keeps history intact by writing a tombstone marker
340
+ - `compact` removes forgotten markers/entries and optionally old data
341
+ - This keeps the memory store accurate while preserving auditability between runs
342
+
258
343
  ## Git integration
259
344
 
260
345
  Mnemoria's append-only binary format is designed for version control. You
@@ -0,0 +1,9 @@
1
+ ---
2
+ description: Compact memory store
3
+ agent: build
4
+ ---
5
+ Compact the memory store by removing forgotten markers/entries.
6
+
7
+ Use the compact tool. If I provide a number of days, pass it as `maxAgeDays` to also prune old entries.
8
+
9
+ Report how many entries were kept and removed.
@@ -0,0 +1,13 @@
1
+ ---
2
+ description: Mark a memory as forgotten
3
+ agent: build
4
+ ---
5
+ Forget a memory that is outdated or incorrect.
6
+
7
+ Use the forget tool with either:
8
+ - `id` (recommended), or
9
+ - `summary` (only when unique)
10
+
11
+ Set `reason` to explain why it should be forgotten.
12
+
13
+ Then confirm the forgotten entry id and marker id in your response.
package/dist/index.d.ts CHANGED
@@ -18,6 +18,8 @@ declare const OcMnemoria: Plugin;
18
18
  * Memory entry types matching mnemoria's EntryType enum.
19
19
  */
20
20
  type EntryType = "intent" | "discovery" | "decision" | "problem" | "solution" | "pattern" | "warning" | "success" | "refactor" | "bugfix" | "feature";
21
+ /** All valid entry type values, usable at runtime for validation. */
22
+ declare const ENTRY_TYPES: readonly ["intent", "discovery", "decision", "problem", "solution", "pattern", "warning", "success", "refactor", "bugfix", "feature"];
21
23
  /**
22
24
  * A memory entry as returned by the mnemoria CLI (JSON output).
23
25
  */
@@ -108,6 +110,10 @@ interface UserIntent {
108
110
  goal: string;
109
111
  context: string[];
110
112
  filePaths: string[];
113
+ /** Weighted score from intent category matching */
114
+ score: number;
115
+ /** Whether this intent meets the minimum threshold to be stored */
116
+ shouldStore: boolean;
111
117
  }
112
118
 
113
119
  /**
@@ -121,16 +127,21 @@ interface UserIntent {
121
127
 
122
128
  declare class Mind {
123
129
  private cli;
124
- private currentChainId;
125
- private currentParentId;
130
+ private chainIds;
131
+ private parentIds;
126
132
  private config;
127
133
  private constructor();
134
+ private sessionKey;
135
+ /** Evict the oldest entry when the map exceeds the size cap. */
136
+ private evictIfNeeded;
137
+ /** Touch an entry to move it to the end (most-recently-used). */
138
+ private touchKey;
128
139
  /**
129
140
  * Open (or create) the shared hive-mind store.
130
141
  */
131
142
  static open(config?: Partial<PluginConfig>): Promise<Mind>;
132
- /** The current intent chain ID. */
133
- getCurrentChainId(): string | null;
143
+ /** The current intent chain ID for a given agent. */
144
+ getCurrentChainId(agent?: AgentName): string | null;
134
145
  /** The path to the memory store. */
135
146
  getMemoryPath(): string;
136
147
  /**
@@ -160,8 +171,24 @@ declare class Mind {
160
171
  * Creates a new chain ID that links subsequent observations.
161
172
  */
162
173
  setIntent(message: string, extractedGoal: string, agent: AgentName): Promise<string>;
174
+ /**
175
+ * Mark a memory as forgotten/obsolete.
176
+ *
177
+ * Since the store is append-only, this records a "forgotten" marker
178
+ * entry rather than physically deleting. Markers are ID-based to avoid
179
+ * accidental deletion when multiple entries share the same summary.
180
+ */
181
+ forget(target: {
182
+ id?: string;
183
+ summary?: string;
184
+ }, reason: string, agent: AgentName): Promise<{
185
+ markerId: string;
186
+ forgottenId: string;
187
+ forgottenSummary: string;
188
+ }>;
163
189
  /**
164
190
  * Search the shared memory. Optionally filter by agent.
191
+ * Results are enriched with full content when available.
165
192
  */
166
193
  search(query: string, limit?: number, agent?: AgentName): Promise<SearchResult[]>;
167
194
  /**
@@ -170,6 +197,7 @@ declare class Mind {
170
197
  ask(question: string, agent?: AgentName): Promise<string>;
171
198
  /**
172
199
  * Get a timeline of memories. Optionally filter by agent.
200
+ * Entries are enriched with full content when available.
173
201
  */
174
202
  timeline(options?: Partial<TimelineOptions>, agent?: AgentName): Promise<Observation[]>;
175
203
  /**
@@ -185,10 +213,25 @@ declare class Mind {
185
213
  relevantMemories: SearchResult[];
186
214
  tokenCount: number;
187
215
  }>;
216
+ /**
217
+ * Compact the memory store by removing forgotten/obsolete entries
218
+ * and optionally pruning entries older than a given age.
219
+ *
220
+ * @param maxAgeDays - If provided, remove entries older than this many days
221
+ * @returns Object with counts of kept and removed entries
222
+ */
223
+ compact(maxAgeDays?: number): Promise<{
224
+ kept: number;
225
+ removed: number;
226
+ }>;
227
+ private resolveForgetTarget;
188
228
  }
189
229
  /**
190
230
  * Get or create the shared Mind instance.
191
231
  * All agents share this single instance (and single mnemoria store).
232
+ *
233
+ * The promise itself is cached to prevent a race condition where two
234
+ * concurrent callers both trigger Mind.open() before either resolves.
192
235
  */
193
236
  declare function getMind(config?: Partial<PluginConfig>): Promise<Mind>;
194
237
  /**
@@ -212,12 +255,24 @@ declare function resetMind(): void;
212
255
  */
213
256
  declare class MnemoriaCli {
214
257
  readonly basePath: string;
258
+ private _ready;
259
+ private exportCache;
260
+ private exportInFlight;
215
261
  constructor(basePath: string);
262
+ /**
263
+ * Execute a mnemoria CLI command and return stdout.
264
+ * Stderr is suppressed (mnemoria logs warnings there).
265
+ *
266
+ * Retries up to MAX_RETRIES times on transient failures (lock contention,
267
+ * timeouts) with exponential backoff. Permanent errors (e.g., ENOENT) are
268
+ * not retried.
269
+ */
270
+ private run;
216
271
  /** Check whether the mnemoria binary is available on PATH. */
217
272
  static isAvailable(): Promise<boolean>;
218
273
  /** Path to the actual store directory (basePath/mnemoria/). */
219
274
  get storePath(): string;
220
- /** Whether the store has been initialised. */
275
+ /** Whether the store has been initialised (checks filesystem). */
221
276
  isInitialized(): boolean;
222
277
  /** Initialise a new memory store. Idempotent if already initialised. */
223
278
  init(): Promise<void>;
@@ -265,36 +320,206 @@ declare class MnemoriaCli {
265
320
  * This is the only reliable way to get full entry data with IDs.
266
321
  */
267
322
  exportAll(): Promise<MemoryEntry[]>;
323
+ /**
324
+ * Enrich search results with full content from the store.
325
+ * Falls back gracefully — returns original results if export fails.
326
+ */
327
+ enrichSearchResults(results: SearchResult[]): Promise<SearchResult[]>;
328
+ /**
329
+ * Enrich timeline entries with full content from the store.
330
+ * Falls back gracefully — returns original entries if export fails.
331
+ */
332
+ enrichTimelineEntries(entries: MemoryEntry[]): Promise<MemoryEntry[]>;
333
+ /**
334
+ * Rebuild the store from a filtered list of entries.
335
+ *
336
+ * This is used by the compact operation. The rebuild is performed
337
+ * atomically: entries are written to a temporary store first, then
338
+ * the temp store is swapped in to replace the real one. If anything
339
+ * fails, the original store is left untouched.
340
+ */
341
+ rebuild(entries: MemoryEntry[]): Promise<void>;
268
342
  /**
269
343
  * Verify the checksum chain integrity.
270
344
  */
271
345
  verify(): Promise<boolean>;
346
+ private invalidateExportCache;
347
+ private getAllEntriesCached;
272
348
  }
273
349
 
274
350
  /**
275
351
  * Utility functions for oc-mnemoria.
276
352
  *
277
- * Extraction, classification, and text helpers used by the plugin hooks.
353
+ * Text and intent helpers used by the plugin hooks.
278
354
  */
279
355
 
280
356
  /** Generate a random 16-character hex ID. */
281
357
  declare function generateId(): string;
282
- /** Rough token estimate: ~4 chars per token. */
358
+ /**
359
+ * Improved token estimate.
360
+ *
361
+ * Uses a content-aware heuristic instead of a flat 4 chars/token ratio:
362
+ * - Whitespace-heavy text (code with indentation): ~3.5 chars/token
363
+ * - Dense text (natural language): ~4.5 chars/token
364
+ * - Mixed/default: ~4 chars/token
365
+ *
366
+ * Falls back gracefully — always returns at least 0.
367
+ */
283
368
  declare function estimateTokens(text: string): number;
284
369
  /** Truncate text to fit within a token budget. */
285
370
  declare function truncateToTokens(text: string, maxTokens: number): string;
286
- interface ExtractedInfo {
287
- summary: string;
288
- content: string;
289
- filePaths: string[];
290
- findings: string[];
291
- patterns: string[];
292
- }
293
- /** Extract key information from tool output based on the tool name. */
294
- declare function extractKeyInfo(toolName: string, output: string, args?: Record<string, unknown>): ExtractedInfo;
295
- /** Classify a tool's output into an observation type. */
296
- declare function classifyObservationType(toolName: string, output: string): EntryType;
297
- /** Extract the user's intent from their message. */
371
+ /** Extract the user's intent from their message using weighted scoring. */
298
372
  declare function extractUserIntent(message: string): UserIntent;
299
373
 
300
- export { type AgentName, DEFAULT_CONFIG, type EntryType, type MemoryEntry, type MemoryStats, Mind, MnemoriaCli, type Observation, type ObservationMetadata, OcMnemoria, type PluginConfig, type SearchResult, type TimelineOptions, type UserIntent, classifyObservationType, OcMnemoria as default, estimateTokens, extractKeyInfo, extractUserIntent, generateId, getMind, resetMind, truncateToTokens };
374
+ /**
375
+ * oc-mnemoria — Centralized Constants
376
+ *
377
+ * All tunable configuration values, thresholds, limits, and magic strings
378
+ * live here. Change any value in this file to adjust plugin behavior
379
+ * without hunting through the codebase.
380
+ */
381
+
382
+ /** Default agent name when none is provided by context or session. */
383
+ declare const DEFAULT_AGENT: AgentName;
384
+ /**
385
+ * Maximum number of concurrent sessions to track before evicting the oldest.
386
+ * Prevents unbounded memory growth in long-running processes.
387
+ */
388
+ declare const MAX_TRACKED_SESSIONS = 100;
389
+ /**
390
+ * Maximum number of per-agent chain/parent entries in the Mind singleton.
391
+ * Uses LRU eviction when exceeded.
392
+ */
393
+ declare const MAX_CHAIN_MAP_SIZE = 50;
394
+ /**
395
+ * Minimum weighted score from intent pattern matching before an intent
396
+ * is considered strong enough to persist. Lower = more intents stored.
397
+ */
398
+ declare const INTENT_MIN_SCORE = 2;
399
+ /**
400
+ * Minimum message length (characters) required for intent storage.
401
+ * Messages shorter than this are ignored regardless of score.
402
+ */
403
+ declare const INTENT_MIN_MESSAGE_LENGTH = 20;
404
+ /**
405
+ * Maximum message length (characters) to process for intent extraction.
406
+ * Messages longer than this are skipped to avoid expensive regex work.
407
+ */
408
+ declare const INTENT_MAX_MESSAGE_LENGTH = 5000;
409
+ /**
410
+ * Minimum message length (characters) to even attempt intent extraction.
411
+ * Messages shorter than this are too brief to carry meaningful intent.
412
+ */
413
+ declare const INTENT_MIN_EXTRACT_LENGTH = 10;
414
+ /**
415
+ * Maximum character length for the extracted goal string.
416
+ * Goals are truncated to this length before storage.
417
+ */
418
+ declare const INTENT_GOAL_MAX_LENGTH = 200;
419
+ /**
420
+ * Jaccard similarity threshold (0–1) for intent deduplication.
421
+ * If a new intent's word overlap with the last stored intent exceeds
422
+ * this value, the new intent is considered a duplicate and skipped.
423
+ * Higher = more aggressive dedup (fewer intents stored).
424
+ */
425
+ declare const INTENT_DEDUP_SIMILARITY = 0.7;
426
+ /**
427
+ * Prefix used on summary lines to mark an entry as forgotten.
428
+ * The compact operation uses this to identify entries to remove.
429
+ */
430
+ declare const FORGOTTEN_MARKER_PREFIX = "[FORGOTTEN] ";
431
+ /**
432
+ * Maximum character length for observation summaries stored via `mind.remember()`.
433
+ * Prevents CLI argument overflow on extremely long summaries.
434
+ */
435
+ declare const SUMMARY_MAX_LENGTH = 200;
436
+ /**
437
+ * Maximum character length for the extracted goal in `mind.setIntent()`.
438
+ * This is the summary field, not the full content.
439
+ */
440
+ declare const INTENT_SUMMARY_MAX_LENGTH = 100;
441
+ /**
442
+ * Maximum character length when displaying user goal content
443
+ * in the system prompt's "Past User Goals" section.
444
+ */
445
+ declare const GOAL_DISPLAY_MAX_LENGTH = 150;
446
+ /**
447
+ * Maximum number of recent observations to include in the
448
+ * system prompt's "Recent Context" section.
449
+ */
450
+ declare const CONTEXT_MAX_RECENT_OBSERVATIONS = 10;
451
+ /**
452
+ * Maximum number of relevant memories to include in the
453
+ * system prompt's "Relevant Memories" section.
454
+ */
455
+ declare const CONTEXT_MAX_RELEVANT_MEMORIES = 5;
456
+ /**
457
+ * Maximum number of past user intents to include in the
458
+ * system prompt's "Past User Goals" section.
459
+ */
460
+ declare const CONTEXT_MAX_PAST_INTENTS = 3;
461
+ /** Default result limit for the `search_memory` tool. */
462
+ declare const SEARCH_DEFAULT_LIMIT = 10;
463
+ /** Default result limit for the `timeline` tool. */
464
+ declare const TIMELINE_DEFAULT_LIMIT = 20;
465
+ /** Default reverse order for the `timeline` tool (newest first). */
466
+ declare const TIMELINE_DEFAULT_REVERSE = true;
467
+ /** Name of the mnemoria CLI binary on PATH. */
468
+ declare const MNEMORIA_BIN = "mnemoria";
469
+ /**
470
+ * Maximum number of retries for transient CLI failures
471
+ * (lock contention, timeouts). Permanent errors are never retried.
472
+ */
473
+ declare const CLI_MAX_RETRIES = 2;
474
+ /**
475
+ * Base delay (ms) between CLI retries. Doubled on each attempt
476
+ * (exponential backoff: 100ms, 200ms, 400ms, ...).
477
+ */
478
+ declare const CLI_RETRY_BASE_DELAY_MS = 100;
479
+ /**
480
+ * Default timeout (ms) for a single CLI command execution.
481
+ * Commands that take longer than this are killed.
482
+ */
483
+ declare const CLI_COMMAND_TIMEOUT_MS = 30000;
484
+ /**
485
+ * Maximum stdout/stderr buffer size (bytes) for CLI commands.
486
+ * Prevents memory exhaustion on unexpectedly large output.
487
+ * Default: 10 MB.
488
+ */
489
+ declare const CLI_MAX_BUFFER_BYTES: number;
490
+ /**
491
+ * Timeout (ms) for the `mnemoria --help` availability check.
492
+ * Shorter than the default command timeout since this should be instant.
493
+ */
494
+ declare const CLI_AVAILABILITY_TIMEOUT_MS = 5000;
495
+ /**
496
+ * TTL (ms) for the full-store export cache used by enrichment.
497
+ * Cached exports are reused within this window to avoid redundant
498
+ * subprocess invocations during rapid search/timeline calls.
499
+ */
500
+ declare const EXPORT_CACHE_TTL_MS = 2000;
501
+ /**
502
+ * Whitespace-to-length ratio above which text is considered "code-like"
503
+ * (lots of indentation/newlines). Code-like text uses fewer chars per token.
504
+ */
505
+ declare const TOKEN_CODE_WHITESPACE_RATIO = 0.3;
506
+ /**
507
+ * Whitespace-to-length ratio below which text is considered "dense"
508
+ * (compact prose, no indentation). Dense text uses more chars per token.
509
+ */
510
+ declare const TOKEN_DENSE_WHITESPACE_RATIO = 0.12;
511
+ /** Estimated characters per token for code-like content. */
512
+ declare const TOKEN_CHARS_PER_TOKEN_CODE = 3.5;
513
+ /** Estimated characters per token for dense/compact text. */
514
+ declare const TOKEN_CHARS_PER_TOKEN_DENSE = 4.5;
515
+ /** Estimated characters per token for mixed content. */
516
+ declare const TOKEN_CHARS_PER_TOKEN_MIXED = 4;
517
+ /**
518
+ * Conservative chars-per-token ratio used for truncation.
519
+ * Uses the lowest ratio to avoid over-truncating.
520
+ */
521
+ declare const TOKEN_CHARS_PER_TOKEN_CONSERVATIVE = 3.5;
522
+ /** Number of milliseconds in one day. Used for age-based compaction. */
523
+ declare const MS_PER_DAY: number;
524
+
525
+ export { type AgentName, CLI_AVAILABILITY_TIMEOUT_MS, CLI_COMMAND_TIMEOUT_MS, CLI_MAX_BUFFER_BYTES, CLI_MAX_RETRIES, CLI_RETRY_BASE_DELAY_MS, CONTEXT_MAX_PAST_INTENTS, CONTEXT_MAX_RECENT_OBSERVATIONS, CONTEXT_MAX_RELEVANT_MEMORIES, DEFAULT_AGENT, DEFAULT_CONFIG, ENTRY_TYPES, EXPORT_CACHE_TTL_MS, type EntryType, FORGOTTEN_MARKER_PREFIX, GOAL_DISPLAY_MAX_LENGTH, INTENT_DEDUP_SIMILARITY, INTENT_GOAL_MAX_LENGTH, INTENT_MAX_MESSAGE_LENGTH, INTENT_MIN_EXTRACT_LENGTH, INTENT_MIN_MESSAGE_LENGTH, INTENT_MIN_SCORE, INTENT_SUMMARY_MAX_LENGTH, MAX_CHAIN_MAP_SIZE, MAX_TRACKED_SESSIONS, MNEMORIA_BIN, MS_PER_DAY, type MemoryEntry, type MemoryStats, Mind, MnemoriaCli, type Observation, type ObservationMetadata, OcMnemoria, type PluginConfig, SEARCH_DEFAULT_LIMIT, SUMMARY_MAX_LENGTH, type SearchResult, TIMELINE_DEFAULT_LIMIT, TIMELINE_DEFAULT_REVERSE, TOKEN_CHARS_PER_TOKEN_CODE, TOKEN_CHARS_PER_TOKEN_CONSERVATIVE, TOKEN_CHARS_PER_TOKEN_DENSE, TOKEN_CHARS_PER_TOKEN_MIXED, TOKEN_CODE_WHITESPACE_RATIO, TOKEN_DENSE_WHITESPACE_RATIO, type TimelineOptions, type UserIntent, OcMnemoria as default, estimateTokens, extractUserIntent, generateId, getMind, resetMind, truncateToTokens };