{
 "paper": "memory-enhancements",
 "a": "1.0",
 "b": "1.1",
 "summary": "From v1.0 (16 Apr) to v1.1 (2 Jun): 5,024 words to 6,542 words, 1,630 words in new or rewritten paragraphs and 112 taken out, 72 paragraphs changed.",
 "note": {
  "title": "A contradiction now retires the old fact instead of blocking the new one",
  "kind": "",
  "body": "## Summary\n\nThe contradiction check gets a third answer. Besides warning or refusing, it can now close the old fact's period of validity and open one for the new fact, so both stay on record and a search can ask what is true now or what was true at a given date. A new section, 9.5, explains how this rides on columns and a search filter that had just landed in the memory library. The folder's notes of 30 May give the reason: this was the third item on the open-source roadmap, bi-temporal validity.\n\n- New section 9.5 on the \"supersede\" answer, task scoring that knows a fact is out of date, and a list of what is not built yet.\n- The status table adds a row for the new layer: ready in the library, waiting in the plugin.\n- Unverifiable size claims (a 50,000-line codebase, 878,000 stored events) are removed.\n- The benchmark gap now also names the unmeasured cost of the new date filter.",
  "source": "commit message"
 },
 "paragraphs_changed": 72,
 "changes": [
  {
   "section": "MNEMOSYNE: A Plugin-Layered Enhancement Suite for Personal-Agent Memory Systems",
   "old": "**Paper:** J14 — MNEMOSYNE **Version:** 1.0 **Date:** 2026-04-16 **Author:** Oscar Serra **Plugin:** tinkerclaw-memory-enhancements (v0.1) **Status:** Production scaffold; hippocampus index + compaction capture live; task scoring + contradiction gate scaffolded",
   "new": "**Paper:** J14 — MNEMOSYNE **Version:** 1.1 **Date:** 2026-06-02 **Author:** Oscar Serra **Plugin:** tinkerclaw-memory-enhancements (v0.1) **Status:** Production scaffold; hippocampus index + compaction capture live; task scoring + contradiction gate scaffolded. Bi-temporal substrate now live in memory-core (validity columns, temporal search predicate, supersede writer); MNEMOSYNE's validity layer (§9.5) is the plugin-side behavior on top.",
   "marked": "**Paper:** J14 — MNEMOSYNE **Version:** [-1.0-] {+1.1+} **Date:** [-2026-04-16-] {+2026-06-02+} **Author:** Oscar Serra **Plugin:** tinkerclaw-memory-enhancements (v0.1) **Status:** Production scaffold; hippocampus index + compaction capture live; task scoring + contradiction gate [-scaffolded-] {+scaffolded. Bi-temporal substrate now live in memory-core (validity columns, temporal search predicate, supersede writer); MNEMOSYNE's validity layer (§9.5) is the plugin-side behavior on top.+}"
  },
  {
   "section": "Abstract",
   "old": "Personal AI assistants that accumulate months of memory face four gaps that upstream retrieval systems do not close: constant-time concept lookup degrades to linear search at scale, retrieval scoring ignores the agent's current task, memory writes can silently introduce contradictions, and context compaction permanently destroys information that was used once but never queried again. We present **MNEMOSYNE**, a plugin-layered enhancement suite that addresses all four gaps without modifying the upstream memory-core codebase. MNEMOSYNE registers four hooks — `retrieval_pre`, `before_message_write`, `before_compaction`, and `after_compaction` — on top of OpenClaw's 50k LOC markdown-first memory system. The hippocampus concept index and compaction-aware capture are deployed in production (v0.1); task-conditioned retrieval scoring and the contradiction gate are scaffolded for v0.2. The plugin architecture permits marketplace distribution as a single installable unit.",
   "new": "Personal AI assistants that accumulate months of memory face four gaps that upstream retrieval systems do not close: constant-time concept lookup degrades to linear search at scale, retrieval scoring ignores the agent's current task, memory writes can silently introduce contradictions, and context compaction permanently destroys information that was used once but never queried again. We present **MNEMOSYNE**, a plugin-layered enhancement suite that addresses all four gaps without modifying the upstream memory-core codebase. MNEMOSYNE registers four hooks — `retrieval_pre`, `before_message_write`, `before_compaction`, and `after_compaction` — on top of OpenClaw's markdown-first memory system. The hippocampus concept index and compaction-aware capture are deployed in production (v0.1); task-conditioned retrieval scoring and the contradiction gate are scaffolded for v0.2. We also describe how the contradiction gate evolves into a bi-temporal validity layer (§9.5): rather than blocking or warning, a contradicting write *supersedes* the prior fact by closing its validity interval, so the corpus retains full history and every retrieval can ask \"what is true now\" versus \"what was true then.\" The plugin architecture permits marketplace distribution as a single installable unit.",
   "marked": "Personal AI assistants that accumulate months of memory face four gaps that upstream retrieval systems do not close: constant-time concept lookup degrades to linear search at scale, retrieval scoring ignores the agent's current task, memory writes can silently introduce contradictions, and context compaction permanently destroys information that was used once but never queried again. We present **MNEMOSYNE**, a plugin-layered enhancement suite that addresses all four gaps without modifying the upstream memory-core codebase. MNEMOSYNE registers four hooks — `retrieval_pre`, `before_message_write`, `before_compaction`, and `after_compaction` — on top of OpenClaw's [-50k LOC-] markdown-first memory system. The hippocampus concept index and compaction-aware capture are deployed in production (v0.1); task-conditioned retrieval scoring and the contradiction gate are scaffolded for v0.2. {+We also describe how the contradiction gate evolves into a bi-temporal validity layer (§9.5): rather than blocking or warning, a contradicting write *supersedes* the prior fact by closing its validity interval, so the corpus retains full history and every retrieval can ask \"what is true now\" versus \"what was true then.\"+} The plugin architecture permits marketplace distribution as a single installable unit."
  },
  {
   "section": "1.2 Why a Plugin, Not a Fork",
   "old": "1. **Failure isolation.** A crash in MNEMOSYNE does not take down memory-core. The hook runner catches exceptions and logs them; upstream retrieval continues unimpaired. 2. **Upgrade independence.** Upstream memory-core ships weekly updates. A plugin does not create merge conflicts. 3. **Distribution.** A single `tinkerclaw-memory-enhancements` package can be installed via ClawHub, OpenClaw's plugin marketplace, without users needing to maintain a fork. 4. **Composability.** Each of the four features can be independently enabled or disabled via plugin configuration.",
   "new": "1. **Failure isolation.** A crash in MNEMOSYNE does not take down memory-core. The hook runner catches exceptions and logs them; upstream retrieval continues unimpaired. 2. **Upgrade independence.** Upstream memory-core ships weekly updates. A plugin does not create merge conflicts. 3. **Distribution.** A single `tinkerclaw-memory-enhancements` package can be installed via ClawHub, OpenClaw's plugin marketplace, without users maintaining a fork. 4. **Composability.** Each of the four features can be independently enabled or disabled via plugin configuration.",
   "marked": "1. **Failure isolation.** A crash in MNEMOSYNE does not take down memory-core. The hook runner catches exceptions and logs them; upstream retrieval continues unimpaired. 2. **Upgrade independence.** Upstream memory-core ships weekly updates. A plugin does not create merge conflicts. 3. **Distribution.** A single `tinkerclaw-memory-enhancements` package can be installed via ClawHub, OpenClaw's plugin marketplace, without users [-needing to maintain-] {+maintaining+} a fork. 4. **Composability.** Each of the four features can be independently enabled or disabled via plugin configuration."
  },
  {
   "section": "1.3 Contributions",
   "old": "1. An O(1) concept index that short-circuits hybrid retrieval for known concepts (Feature 1). 2. A task-conditioned score modifier that biases retrieval toward the agent's current work (Feature 2). 3. A contradiction gate that intercepts memory writes before promotion to durable storage (Feature 3). 4. A compaction-aware capture pass that snapshots context before it is evicted (Feature 4). 5. A unified plugin architecture that delivers all four as a single distributable unit.",
   "new": "1. An O(1) concept index that short-circuits hybrid retrieval for known concepts (Feature 1). 2. A task-conditioned score modifier that biases retrieval toward the agent's current work (Feature 2). 3. A contradiction gate that intercepts memory writes before promotion to durable storage (Feature 3), and its bi-temporal evolution into a supersession layer (§9.5). 4. A compaction-aware capture pass that snapshots context before it is evicted (Feature 4). 5. A unified plugin architecture that delivers all four as a single distributable unit.",
   "marked": "1. An O(1) concept index that short-circuits hybrid retrieval for known concepts (Feature 1). 2. A task-conditioned score modifier that biases retrieval toward the agent's current work (Feature 2). 3. A contradiction gate that intercepts memory writes before promotion to durable storage (Feature [-3).-] {+3), and its bi-temporal evolution into a supersession layer (§9.5).+} 4. A compaction-aware capture pass that snapshots context before it is evicted (Feature 4). 5. A unified plugin architecture that delivers all four as a single distributable unit."
  },
  {
   "section": "2.1 The Serra Paper Series",
   "old": "**J2 HIPPOCAMPUS** [Serra, 2026b] introduces the pre-computed concept-to-memory-address index that enables O(1) retrieval. HIPPOCAMPUS v5.0 defines the anchor vocabulary, importance scoring, and CORF (Contextual Ownership Retrieval Failure) taxonomy. MNEMOSYNE's Feature 1 is the production plugin implementation of the HIPPOCAMPUS architecture described theoretically in J2.",
   "new": "**J2 HIPPOCAMPUS** [Serra, 2026b] introduces the pre-computed concept-to-memory-address index that enables O(1) retrieval. HIPPOCAMPUS v5.0 defines the anchor vocabulary, importance scoring, and CORF (Contextual Ownership Retrieval Failure) taxonomy. J2 also owns the bi-temporal *schema* — the `validity_start / validity_end / ingestion_time` columns and the temporal search predicate — that MNEMOSYNE's validity layer (§9.5) sits on top of. MNEMOSYNE's Feature 1 is the production plugin implementation of the HIPPOCAMPUS retrieval architecture described theoretically in J2.",
   "marked": "**J2 HIPPOCAMPUS** [Serra, 2026b] introduces the pre-computed concept-to-memory-address index that enables O(1) retrieval. HIPPOCAMPUS v5.0 defines the anchor vocabulary, importance scoring, and CORF (Contextual Ownership Retrieval Failure) taxonomy. {+J2 also owns the bi-temporal *schema* — the `validity_start / validity_end / ingestion_time` columns and the temporal search predicate — that MNEMOSYNE's validity layer (§9.5) sits on top of.+} MNEMOSYNE's Feature 1 is the production plugin implementation of the HIPPOCAMPUS {+retrieval+} architecture described theoretically in J2."
  },
  {
   "section": "2.2 Upstream Memory-Core Architecture",
   "old": "OpenClaw's memory-core (approximately 50,000 lines of TypeScript) implements a markdown-first memory system with five retrieval stages:",
   "new": "OpenClaw's memory-core implements a markdown-first memory system with five retrieval stages:",
   "marked": "OpenClaw's memory-core [-(approximately 50,000 lines of TypeScript)-] implements a markdown-first memory system with five retrieval stages:"
  },
  {
   "section": "2.2 Upstream Memory-Core Architecture",
   "old": "1. **FTS5 full-text search** over a SQLite corpus, currently at ~878K events in production. 2. **Vector embedding similarity** using cosine distance against pre-computed chunk embeddings. 3. **MMR deduplication** to prevent redundant chunks from consuming retrieval budget. 4. **Temporal decay** that exponentially down-weights older memories (half-life configurable, default 30 days). 5. **Relevance threshold** that filters chunks below a minimum combined score.",
   "new": "1. **FTS5 full-text search** over a SQLite corpus. 2. **Vector embedding similarity** using cosine distance against pre-computed chunk embeddings. 3. **MMR deduplication** to prevent redundant chunks from consuming retrieval budget. 4. **Temporal decay** that exponentially down-weights older memories (half-life configurable, default 30 days). 5. **Relevance threshold** that filters chunks below a minimum combined score.",
   "marked": "1. **FTS5 full-text search** over a SQLite [-corpus, currently at ~878K events in production.-] {+corpus.+} 2. **Vector embedding similarity** using cosine distance against pre-computed chunk embeddings. 3. **MMR deduplication** to prevent redundant chunks from consuming retrieval budget. 4. **Temporal decay** that exponentially down-weights older memories (half-life configurable, default 30 days). 5. **Relevance threshold** that filters chunks below a minimum combined score."
  },
  {
   "section": "3.1 Plugin-Layered Design",
   "old": "```typescript /** * FORK: MNEMOSYNE plugin entry point. * Registers four hooks on upstream memory-core's retrieval * and write pipelines. No upstream source modification required. */ export function activate(api: PluginAPI): void { api.hooks.register('retrieval_pre', conceptIndexLookup); api.hooks.register('retrieval_pre', taskConditionedScoring); api.hooks.register('before_message_write', contradictionGate); api.hooks.register('before_compaction', compactionCapture); } ```",
   "new": "``` /** * FORK: MNEMOSYNE plugin entry point. * Registers four hooks on upstream memory-core's retrieval * and write pipelines. No upstream source modification required. */ export function activate(api: PluginAPI): void { api.hooks.register('retrieval_pre', conceptIndexLookup); api.hooks.register('retrieval_pre', taskConditionedScoring); api.hooks.register('before_message_write', contradictionGate); api.hooks.register('before_compaction', compactionCapture); } ```",
   "marked": "[-```typescript-] {+```+} /** * FORK: MNEMOSYNE plugin entry point. * Registers four hooks on upstream memory-core's retrieval * and write pipelines. No upstream source modification required. */ export function activate(api: PluginAPI): void { api.hooks.register('retrieval_pre', conceptIndexLookup); api.hooks.register('retrieval_pre', taskConditionedScoring); api.hooks.register('before_message_write', contradictionGate); api.hooks.register('before_compaction', compactionCapture); } ```"
  },
  {
   "section": "3.2 Hook Surface",
   "old": "| Hook | Timing | Receives | Returns | |------|--------|----------|---------| | `retrieval_pre` | Before hybrid FTS+vector search | Query string, task descriptor, retrieval config | Modified query, injected candidates, or `skip_search` signal | | `before_message_write` | Before promotion to MEMORY.md | Candidate chunk, existing facts | `allow`, `warn`, or `block` | | `before_compaction` | Before context eviction | Messages about to be dropped | Captured chunks (written to corpus) | | `after_compaction` | After eviction completes | Eviction metadata | Void (used for bookkeeping) |",
   "new": "| Hook | Timing | Receives | Returns | |------|--------|----------|---------| | `retrieval_pre` | Before hybrid FTS+vector search | Query string, task descriptor, retrieval config | Modified query, injected candidates, or `skip_search` signal | | `before_message_write` | Before promotion to MEMORY.md | Candidate chunk, existing facts | `allow`, `warn`, `block`, or (§9.5) `supersede` | | `before_compaction` | Before context eviction | Messages about to be dropped | Captured chunks (written to corpus) | | `after_compaction` | After eviction completes | Eviction metadata | Void (used for bookkeeping) |",
   "marked": "| Hook | Timing | Receives | Returns | |------|--------|----------|---------| | `retrieval_pre` | Before hybrid FTS+vector search | Query string, task descriptor, retrieval config | Modified query, injected candidates, or `skip_search` signal | | `before_message_write` | Before promotion to MEMORY.md | Candidate chunk, existing facts | `allow`, `warn`, {+`block`,+} or [-`block`-] {+(§9.5) `supersede`+} | | `before_compaction` | Before context eviction | Messages about to be dropped | Captured chunks (written to corpus) | | `after_compaction` | After eviction completes | Eviction metadata | Void (used for bookkeeping) |"
  },
  {
   "section": "3.4 Storage Isolation",
   "old": "This separation ensures that uninstalling the plugin leaves memory-core's data untouched.",
   "new": null,
   "marked": "[-This separation ensures that uninstalling the plugin leaves memory-core's data untouched.-]"
  },
  {
   "section": "3.4 Storage Isolation",
   "old": null,
   "new": "This separation ensures that uninstalling the plugin leaves memory-core's data untouched. The one exception is the bi-temporal validity layer (§9.5), which writes through memory-core's own `chunks` table rather than a separate store — because superseding a fact must close *that fact's* validity interval, not a shadow copy.",
   "marked": "{+This separation ensures that uninstalling the plugin leaves memory-core's data untouched. The one exception is the bi-temporal validity layer (§9.5), which writes through memory-core's own `chunks` table rather than a separate store — because superseding a fact must close *that fact's* validity interval, not a shadow copy.+}"
  },
  {
   "section": "4.2 Data Structure",
   "old": "```typescript /** * FORK: Hippocampus concept index. * Maps concept tokens to their associated memory chunk IDs * with importance scoring for retrieval ranking. * Persisted to anchors.json, loaded lazily on first query. */ type ConceptEntry = { chunkIds: Set<string>; importance: number; lastSeenAtMs: number; };",
   "new": "``` /** * FORK: Hippocampus concept index. * Maps concept tokens to their associated memory chunk IDs * with importance scoring for retrieval ranking. * Persisted to anchors.json, loaded lazily on first query. */ type ConceptEntry = { chunkIds: Set<string>; importance: number; lastSeenAtMs: number; };",
   "marked": "[-```typescript-] {+```+} /** * FORK: Hippocampus concept index. * Maps concept tokens to their associated memory chunk IDs * with importance scoring for retrieval ranking. * Persisted to anchors.json, loaded lazily on first query. */ type ConceptEntry = { chunkIds: Set<string>; importance: number; lastSeenAtMs: number; };"
  },
  {
   "section": "4.4 Lookup",
   "old": "```typescript function conceptIndexLookup(ctx: RetrievalContext): RetrievalResult | null { const tokens = tokenize(ctx.query); const matches: ConceptEntry[] = [];",
   "new": "``` function conceptIndexLookup(ctx: RetrievalContext): RetrievalResult | null { const tokens = tokenize(ctx.query); const matches: ConceptEntry[] = [];",
   "marked": "[-```typescript-] {+```+} function conceptIndexLookup(ctx: RetrievalContext): RetrievalResult | null { const tokens = tokenize(ctx.query); const matches: ConceptEntry[] = [];"
  },
  {
   "section": "4.5 Importance Scoring",
   "old": "Importance is computed as a weighted product of three factors:",
   "new": "Importance is computed as a weighted sum of three factors:",
   "marked": "Importance is computed as a weighted [-product-] {+sum+} of three factors:"
  },
  {
   "section": "4.6 Pruning",
   "old": "Pruning is conservative: a concept is only removed if both conditions hold. A rarely-seen but highly distinctive concept (e.g., a unique project name) may persist indefinitely because its distinctiveness score keeps importance above the threshold.",
   "new": "Pruning is conservative: a concept is removed only if both conditions hold. A rarely-seen but highly distinctive concept (e.g., a unique project name) may persist indefinitely because its distinctiveness score keeps importance above the threshold.",
   "marked": "Pruning is conservative: a concept is {+removed+} only [-removed-] if both conditions hold. A rarely-seen but highly distinctive concept (e.g., a unique project name) may persist indefinitely because its distinctiveness score keeps importance above the threshold."
  },
  {
   "section": "4.7 Complexity Analysis",
   "old": "| Operation | Hybrid search (upstream) | Concept index (MNEMOSYNE) | |-----------|-------------------------|---------------------------| | Query-time retrieval | O(n log n) — FTS5 scan + vector cosine + MMR | O(\\|Q\\|) — token lookup in Map, where \\|Q\\| is query token count | | Index build | N/A | O(n \\* \\|V\\|) — one-time, during nightly consolidation | | Incremental update | N/A | O(\\|V\\|) per new chunk | | Storage | FTS5 index + vector store (~878K events) | anchors.json (~50KB for 2,000 concepts) |",
   "new": "| Operation | Hybrid search (upstream) | Concept index (MNEMOSYNE) | |-----------|-------------------------|---------------------------| | Query-time retrieval | O(n log n) — FTS5 scan + vector cosine + MMR | O(\\|Q\\|) — token lookup in Map, where \\|Q\\| is query token count | | Index build | N/A | O(n \\* \\|V\\|) — one-time, during nightly consolidation | | Incremental update | N/A | O(\\|V\\|) per new chunk | | Storage | FTS5 index + vector store | anchors.json (~50KB for 2,000 concepts) |",
   "marked": "| Operation | Hybrid search (upstream) | Concept index (MNEMOSYNE) | |-----------|-------------------------|---------------------------| | Query-time retrieval | O(n log n) — FTS5 scan + vector cosine + MMR | O(\\|Q\\|) — token lookup in Map, where \\|Q\\| is query token count | | Index build | N/A | O(n \\* \\|V\\|) — one-time, during nightly consolidation | | Incremental update | N/A | O(\\|V\\|) per new chunk | | Storage | FTS5 index + vector store [-(~878K events)-] | anchors.json (~50KB for 2,000 concepts) |"
  },
  {
   "section": "4.7 Complexity Analysis",
   "old": "The critical property is that query-time retrieval is **O(1) in corpus size n**. As the memory corpus grows from thousands to hundreds of thousands of chunks, hybrid search degrades (FTS5 scan time grows, vector search requires more comparisons); the concept index remains constant.",
   "new": "The critical property is that query-time retrieval is **O(1) in corpus size n**. As the memory corpus grows from thousands to hundreds of thousands of chunks, hybrid search degrades (FTS5 scan time grows, vector search requires more comparisons); the concept index remains constant. This is a theoretical property of the data structure; §10.4 notes that wall-clock confirmation on the production corpus is still pending.",
   "marked": "The critical property is that query-time retrieval is **O(1) in corpus size n**. As the memory corpus grows from thousands to hundreds of thousands of chunks, hybrid search degrades (FTS5 scan time grows, vector search requires more comparisons); the concept index remains [-constant.-] {+constant. This is a theoretical property of the data structure; §10.4 notes that wall-clock confirmation on the production corpus is still pending.+}"
  },
  {
   "section": "4.8 Persistence",
   "old": "The index is serialized to `anchors.json` using JSON with `Set` values converted to arrays:",
   "new": "The index is serialized to `anchors.json` using JSON, with `Set` values converted to arrays:",
   "marked": "The index is serialized to `anchors.json` using [-JSON-] {+JSON,+} with `Set` values converted to arrays:"
  },
  {
   "section": "4.8 Persistence",
   "old": "```json { \"cron\": { \"chunkIds\": [\"c_4a2f\", \"c_891b\", \"c_3e7d\"], \"importance\": 0.72, \"lastSeenAtMs\": 1744675200000 }, \"whatsapp\": { \"chunkIds\": [\"c_12ab\", \"c_56cd\"], \"importance\": 0.61, \"lastSeenAtMs\": 1744588800000 } } ```",
   "new": "``` { \"cron\": { \"chunkIds\": [\"c_4a2f\", \"c_891b\", \"c_3e7d\"], \"importance\": 0.72, \"lastSeenAtMs\": 1744675200000 }, \"whatsapp\": { \"chunkIds\": [\"c_12ab\", \"c_56cd\"], \"importance\": 0.61, \"lastSeenAtMs\": 1744588800000 } } ```",
   "marked": "[-```json-] {+```+} { \"cron\": { \"chunkIds\": [\"c_4a2f\", \"c_891b\", \"c_3e7d\"], \"importance\": 0.72, \"lastSeenAtMs\": 1744675200000 }, \"whatsapp\": { \"chunkIds\": [\"c_12ab\", \"c_56cd\"], \"importance\": 0.61, \"lastSeenAtMs\": 1744588800000 } } ```"
  },
  {
   "section": "5.2 Task Descriptor",
   "old": "```typescript type TaskDescriptor = { keywords: string[]; // e.g., [\"cron\", \"merge\", \"guardian\"] projectId: string | null; // e.g., \"tinkerclaw\" taskType: string | null; // e.g., \"debugging\", \"writing\", \"review\" }; ```",
   "new": "``` type TaskDescriptor = { keywords: string[]; // e.g., [\"cron\", \"merge\", \"guardian\"] projectId: string | null; // e.g., \"tinkerclaw\" taskType: string | null; // e.g., \"debugging\", \"writing\", \"review\" }; ```",
   "marked": "[-```typescript-] {+```+} type TaskDescriptor = { keywords: string[]; // e.g., [\"cron\", \"merge\", \"guardian\"] projectId: string | null; // e.g., \"tinkerclaw\" taskType: string | null; // e.g., \"debugging\", \"writing\", \"review\" }; ```"
  },
  {
   "section": "5.3 Score Modifier",
   "old": "```typescript function taskConditionedScoring(ctx: RetrievalContext): void { const task = ctx.taskDescriptor; if (!task || task.keywords.length === 0) return; // no task context available",
   "new": "``` function taskConditionedScoring(ctx: RetrievalContext): void { const task = ctx.taskDescriptor; if (!task || task.keywords.length === 0) return; // no task context available",
   "marked": "[-```typescript-] {+```+} function taskConditionedScoring(ctx: RetrievalContext): void { const task = ctx.taskDescriptor; if (!task || task.keywords.length === 0) return; // no task context available"
  },
  {
   "section": "5.3 Score Modifier",
   "old": "The modifier does not replace existing scores — it adds a weighted bonus. Chunks that are already highly relevant to the query remain highly ranked; the task bias adjusts marginal rankings.",
   "new": "The modifier does not replace existing scores — it adds a weighted bonus. Chunks already highly relevant to the query stay highly ranked; the task bias adjusts marginal rankings.",
   "marked": "The modifier does not replace existing scores — it adds a weighted bonus. Chunks [-that are-] already highly relevant to the query [-remain-] {+stay+} highly ranked; the task bias adjusts marginal rankings."
  },
  {
   "section": "5.4 Weight Calibration",
   "old": "The default of 0.3 was chosen empirically: high enough to promote task-relevant chunks from page 2 to page 1 of results, low enough that a query about an unrelated topic still returns correct results. Formal calibration against a CORF-annotated benchmark (as proposed in J2 §7) is planned for v0.2.",
   "new": "The default of 0.3 was chosen empirically: high enough to promote task-relevant chunks from page 2 to page 1 of results, low enough that a query about an unrelated topic still returns correct results. Formal calibration against a CORF-annotated benchmark (proposed in J2 §7) is planned for v0.2.",
   "marked": "The default of 0.3 was chosen empirically: high enough to promote task-relevant chunks from page 2 to page 1 of results, low enough that a query about an unrelated topic still returns correct results. Formal calibration against a CORF-annotated benchmark [-(as proposed-] {+(proposed+} in J2 §7) is planned for v0.2."
  },
  {
   "section": "6.1 Threat Model: Agent Self-Corruption",
   "old": "2. **Stale override.** The agent learns a new fact (\"the meeting was moved to Thursday\") but a later consolidation cycle processes an older memory that still says \"the meeting is on Wednesday.\" If the older memory is promoted after the newer one, the durable store now contains a contradiction, and temporal ordering may not resolve it.",
   "new": "2. **Stale override.** The agent learns a new fact (\"the meeting was moved to Thursday\") but a later consolidation cycle processes an older memory that still says \"the meeting is on Wednesday.\" If the older memory is promoted after the newer one, the durable store now holds a contradiction, and temporal ordering may not resolve it.",
   "marked": "2. **Stale override.** The agent learns a new fact (\"the meeting was moved to Thursday\") but a later consolidation cycle processes an older memory that still says \"the meeting is on Wednesday.\" If the older memory is promoted after the newer one, the durable store now [-contains-] {+holds+} a contradiction, and temporal ordering may not resolve it."
  },
  {
   "section": "6.2 Gate Mechanism",
   "old": "```typescript async function contradictionGate(ctx: WriteContext): Promise<WriteDecision> { const candidate = ctx.chunk; const existingFacts = await queryRelatedFacts(candidate);",
   "new": "``` async function contradictionGate(ctx: WriteContext): Promise<WriteDecision> { const candidate = ctx.chunk; const existingFacts = await queryRelatedFacts(candidate);",
   "marked": "[-```typescript-] {+```+} async function contradictionGate(ctx: WriteContext): Promise<WriteDecision> { const candidate = ctx.chunk; const existingFacts = await queryRelatedFacts(candidate);"
  },
  {
   "section": "6.2 Gate Mechanism",
   "old": "return { action: config.contradictionMode, // 'warn' or 'block' reason: formatContradictionReport(contradictions), }; } ```",
   "new": "return { action: config.contradictionMode, // 'warn', 'block', or 'supersede' (§9.5) reason: formatContradictionReport(contradictions), }; } ```",
   "marked": "return { action: config.contradictionMode, // [-'warn'-] {+'warn', 'block',+} or [-'block'-] {+'supersede' (§9.5)+} reason: formatContradictionReport(contradictions), }; } ```"
  },
  {
   "section": "6.3 Modes: Warn, Block, Supersede",
   "old": "### 6.3 Modes: Warn vs Block",
   "new": "### 6.3 Modes: Warn, Block, Supersede",
   "marked": "### 6.3 Modes: [-Warn vs Block-] {+Warn, Block, Supersede+}"
  },
  {
   "section": "6.3 Modes: Warn, Block, Supersede",
   "old": "The gate operates in one of two modes, configured per-plugin:",
   "new": "The gate operates in one of three modes, configured per-plugin:",
   "marked": "The gate operates in one of [-two-] {+three+} modes, configured per-plugin:"
  },
  {
   "section": "6.3 Modes: Warn, Block, Supersede",
   "old": "**Warn mode** (default): The contradiction is logged to `contradictions.jsonl` with the candidate chunk, the conflicting existing facts, and a timestamp. The write proceeds. The agent (or its operator) can review the log periodically to identify patterns of self-corruption.",
   "new": "**Warn mode**: The contradiction is logged to `contradictions.jsonl` with the candidate chunk, the conflicting existing facts, and a timestamp. The write proceeds. The agent (or its operator) can review the log to identify patterns of self-corruption.",
   "marked": "**Warn [-mode** (default):-] {+mode**:+} The contradiction is logged to `contradictions.jsonl` with the candidate chunk, the conflicting existing facts, and a timestamp. The write proceeds. The agent (or its operator) can review the log [-periodically-] to identify patterns of self-corruption."
  },
  {
   "section": "6.3 Modes: Warn, Block, Supersede",
   "old": "**Block mode**: The write is refused. The candidate chunk is not promoted to MEMORY.md. The blocked write is logged with the same detail as warn mode, plus the `blocked: true` flag. This is the safer mode but risks losing legitimate updates if the contradiction detector produces false positives.",
   "new": "**Block mode**: The write is refused. The candidate chunk is not promoted to MEMORY.md. The blocked write is logged with the same detail as warn mode, plus a `blocked: true` flag. This is safer than warn but risks losing legitimate updates when the detector produces false positives.",
   "marked": "**Block mode**: The write is refused. The candidate chunk is not promoted to MEMORY.md. The blocked write is logged with the same detail as warn mode, plus [-the-] {+a+} `blocked: true` flag. This is [-the-] safer [-mode-] {+than warn+} but risks losing legitimate updates [-if-] {+when+} the [-contradiction-] detector produces false positives."
  },
  {
   "section": "6.3 Modes: Warn vs Block",
   "old": "The default is warn mode because the contradiction detector is conservative — blocking on false positives would cause information loss, which is worse than allowing a contradiction that can be manually reviewed.",
   "new": null,
   "marked": "[-The default is warn mode because the contradiction detector is conservative — blocking on false positives would cause information loss, which is worse than allowing a contradiction that can be manually reviewed.-]"
  },
  {
   "section": "6.3 Modes: Warn, Block, Supersede",
   "old": null,
   "new": "**Supersede mode** (§9.5): The contradiction is resolved rather than logged or blocked. The prior fact's validity interval is closed and the new fact opens its own — both rows are retained, so nothing is lost. This is the non-lossy resolution that the v1.0 paper's two-mode design lacked; §9.5 describes the mechanism and its grounding in memory-core's now-live bi-temporal substrate.",
   "marked": "{+**Supersede mode** (§9.5): The contradiction is resolved rather than logged or blocked. The prior fact's validity interval is closed and the new fact opens its own — both rows are retained, so nothing is lost. This is the non-lossy resolution that the v1.0 paper's two-mode design lacked; §9.5 describes the mechanism and its grounding in memory-core's now-live bi-temporal substrate.+}"
  },
  {
   "section": "6.3 Modes: Warn, Block, Supersede",
   "old": null,
   "new": "In v1.0, warn was the default precisely because block is lossy. With supersede available (§9.5), the default question is revisited there.",
   "marked": "{+In v1.0, warn was the default precisely because block is lossy. With supersede available (§9.5), the default question is revisited there.+}"
  },
  {
   "section": "6.4 Relationship to J1 and J4",
   "old": "**J4 CORTEX's consistency preservation** maintains agent identity across sessions by ensuring the PersonaState structure remains coherent. The contradiction gate protects not just the persona but the entire fact base from inconsistency. Where CORTEX guards the \"who am I?\" question, the contradiction gate guards the \"what do I know?\" question.",
   "new": "**J4 CORTEX's consistency preservation** maintains agent identity across sessions by keeping the PersonaState structure coherent. The contradiction gate protects not just the persona but the entire fact base from inconsistency. Where CORTEX guards the \"who am I?\" question, the contradiction gate guards the \"what do I know?\" question.",
   "marked": "**J4 CORTEX's consistency preservation** maintains agent identity across sessions by [-ensuring-] {+keeping+} the PersonaState structure [-remains-] coherent. The contradiction gate protects not just the persona but the entire fact base from inconsistency. Where CORTEX guards the \"who am I?\" question, the contradiction gate guards the \"what do I know?\" question."
  },
  {
   "section": "7.1 The Gap: Messages Used Once and Never Queried Are Lost",
   "old": "ENGRAM's pointer-based compaction (J1) replaces evicted messages with time-range markers containing topic hints. The pointers are sufficient for the agent to know that \"something about cron debugging happened between 14:00 and 15:30\" — but the actual content (the exact error message, the specific fix attempted, the user's aside about a related problem) is gone from the context window.",
   "new": "ENGRAM's pointer-based compaction (J1) replaces evicted messages with time-range markers containing topic hints. The pointers are enough for the agent to know that \"something about cron debugging happened between 14:00 and 15:30\" — but the actual content (the exact error message, the specific fix attempted, the user's aside about a related problem) is gone from the context window.",
   "marked": "ENGRAM's pointer-based compaction (J1) replaces evicted messages with time-range markers containing topic hints. The pointers are [-sufficient-] {+enough+} for the agent to know that \"something about cron debugging happened between 14:00 and 15:30\" — but the actual content (the exact error message, the specific fix attempted, the user's aside about a related problem) is gone from the context window."
  },
  {
   "section": "7.1 The Gap: Messages Used Once and Never Queried Are Lost",
   "old": "Memory-core's nightly dreaming (J5) can recover some of this content by promoting memories that were recently searched for. But dreaming only promotes what has been queried. Content that was used once — read, acted upon, and never referenced again — is permanently lost after compaction.",
   "new": "Memory-core's nightly dreaming (J5) can recover some of this content by promoting memories that were recently searched for. But dreaming promotes only what has been queried. Content used once — read, acted upon, and never referenced again — is permanently lost after compaction.",
   "marked": "Memory-core's nightly dreaming (J5) can recover some of this content by promoting memories that were recently searched for. But dreaming {+promotes+} only [-promotes-] what has been queried. Content [-that was-] used once — read, acted upon, and never referenced again — is permanently lost after compaction."
  },
  {
   "section": "7.2 Capture Protocol",
   "old": "```typescript async function compactionCapture(ctx: CompactionContext): Promise<void> { const messagesToEvict = ctx.messages; const captured: CapturedChunk[] = [];",
   "new": "``` async function compactionCapture(ctx: CompactionContext): Promise<void> { const messagesToEvict = ctx.messages; const captured: CapturedChunk[] = [];",
   "marked": "[-```typescript-] {+```+} async function compactionCapture(ctx: CompactionContext): Promise<void> { const messagesToEvict = ctx.messages; const captured: CapturedChunk[] = [];"
  },
  {
   "section": "8.1 Plugin Manifest",
   "old": "```json { \"id\": \"tinkerclaw-memory-enhancements\", \"name\": \"MNEMOSYNE — Memory Enhancement Suite\", \"version\": \"0.1.0\", \"description\": \"Hippocampus concept index, task-conditioned scoring, contradiction gate, and compaction capture for personal-agent memory systems.\", \"entryPoint\": \"dist/index.js\", \"configSchema\": { \"conceptIndex\": { \"enabled\": { \"type\": \"boolean\", \"default\": true }, \"confidenceThreshold\": { \"type\": \"number\", \"default\": 0.4 }, \"pruneThresholdDays\": { \"type\": \"number\", \"default\": 90 } }, \"taskScoring\": { \"enabled\": { \"type\": \"boolean\", \"default\": false }, \"weight\": { \"type\": \"number\", \"default\": 0.3 } }, \"contradictionGate\": { \"enabled\": { \"type\": \"boolean\", \"default\": false }, \"mode\": { \"type\": \"string\", \"enum\": [\"warn\", \"block\"], \"default\": \"warn\" } }, \"compactionCapture\": { \"enabled\": { \"type\": \"boolean\", \"default\": true }, \"trivialityThresholdTokens\": { \"type\": \"number\", \"default\": 20 } } } } ```",
   "new": "``` { \"id\": \"tinkerclaw-memory-enhancements\", \"name\": \"MNEMOSYNE — Memory Enhancement Suite\", \"version\": \"0.1.0\", \"description\": \"Hippocampus concept index, task-conditioned scoring, contradiction gate, and compaction capture for personal-agent memory systems.\", \"entryPoint\": \"dist/index.js\", \"configSchema\": { \"conceptIndex\": { \"enabled\": { \"type\": \"boolean\", \"default\": true }, \"confidenceThreshold\": { \"type\": \"number\", \"default\": 0.4 }, \"pruneThresholdDays\": { \"type\": \"number\", \"default\": 90 } }, \"taskScoring\": { \"enabled\": { \"type\": \"boolean\", \"default\": false }, \"weight\": { \"type\": \"number\", \"default\": 0.3 } }, \"contradictionGate\": { \"enabled\": { \"type\": \"boolean\", \"default\": false }, \"mode\": { \"type\": \"string\", \"enum\": [\"warn\", \"block\", \"supersede\"], \"default\": \"warn\" } }, \"compactionCapture\": { \"enabled\": { \"type\": \"boolean\", \"default\": true }, \"trivialityThresholdTokens\": { \"type\": \"number\", \"default\": 20 } } } } ```",
   "marked": "[-```json-] {+```+} { \"id\": \"tinkerclaw-memory-enhancements\", \"name\": \"MNEMOSYNE — Memory Enhancement Suite\", \"version\": \"0.1.0\", \"description\": \"Hippocampus concept index, task-conditioned scoring, contradiction gate, and compaction capture for personal-agent memory systems.\", \"entryPoint\": \"dist/index.js\", \"configSchema\": { \"conceptIndex\": { \"enabled\": { \"type\": \"boolean\", \"default\": true }, \"confidenceThreshold\": { \"type\": \"number\", \"default\": 0.4 }, \"pruneThresholdDays\": { \"type\": \"number\", \"default\": 90 } }, \"taskScoring\": { \"enabled\": { \"type\": \"boolean\", \"default\": false }, \"weight\": { \"type\": \"number\", \"default\": 0.3 } }, \"contradictionGate\": { \"enabled\": { \"type\": \"boolean\", \"default\": false }, \"mode\": { \"type\": \"string\", \"enum\": [\"warn\", [-\"block\"],-] {+\"block\", \"supersede\"],+} \"default\": \"warn\" } }, \"compactionCapture\": { \"enabled\": { \"type\": \"boolean\", \"default\": true }, \"trivialityThresholdTokens\": { \"type\": \"number\", \"default\": 20 } } } } ```"
  },
  {
   "section": "8.2 Hook Registrations",
   "old": "All four hooks are registered in `activate()` and are individually gated by their `enabled` config flag. Hook registration order:",
   "new": "All four hooks are registered in `activate()` and individually gated by their `enabled` config flag. Hook registration order:",
   "marked": "All four hooks are registered in `activate()` and [-are-] individually gated by their `enabled` config flag. Hook registration order:"
  },
  {
   "section": "8.2 Hook Registrations",
   "old": "1. `conceptIndexLookup` on `retrieval_pre` — runs first, may short-circuit. 2. `taskConditionedScoring` on `retrieval_pre` — runs second, only if concept index did not fire. 3. `contradictionGate` on `before_message_write` — synchronous, returns allow/warn/block. 4. `compactionCapture` on `before_compaction` — synchronous, must complete before eviction proceeds.",
   "new": "1. `conceptIndexLookup` on `retrieval_pre` — runs first, may short-circuit. 2. `taskConditionedScoring` on `retrieval_pre` — runs second, only if concept index did not fire. 3. `contradictionGate` on `before_message_write` — synchronous, returns allow/warn/block/supersede. 4. `compactionCapture` on `before_compaction` — synchronous, must complete before eviction proceeds.",
   "marked": "1. `conceptIndexLookup` on `retrieval_pre` — runs first, may short-circuit. 2. `taskConditionedScoring` on `retrieval_pre` — runs second, only if concept index did not fire. 3. `contradictionGate` on `before_message_write` — synchronous, returns [-allow/warn/block.-] {+allow/warn/block/supersede.+} 4. `compactionCapture` on `before_compaction` — synchronous, must complete before eviction proceeds."
  },
  {
   "section": "8.3 v0.1 Status",
   "old": "| Feature | Status | Notes | |---------|--------|-------| | Hippocampus concept index | **Live** | anchors.json persisted, lazy loading, nightly rebuild | | Compaction-aware capture | **Live** | Capturing to `<agent-data>/mnemosyne/captured/`, FTS5 indexing confirmed | | Task-conditioned scoring | Scaffolded | Hook registered but returns early (no task descriptor extraction yet) | | Contradiction gate | Scaffolded | Hook registered, `detectContradictions` returns empty array (entity extraction not wired) |",
   "new": "| Feature | Status | Notes | |---------|--------|-------| | Hippocampus concept index | **Live** | anchors.json persisted, lazy loading, nightly rebuild | | Compaction-aware capture | **Live** | Capturing to `<agent-data>/mnemosyne/captured/`, FTS5 indexing confirmed | | Task-conditioned scoring | Scaffolded | Hook registered but returns early (no task descriptor extraction yet) | | Contradiction gate | Scaffolded | Hook registered, `detectContradictions` returns empty array (entity extraction not wired) | | Bi-temporal supersede (§9.5) | Core-ready, plugin-pending | memory-core ships the validity columns, search predicate, and `supersede-writer`/`invalidate`; MNEMOSYNE must route the gate's decision into them |",
   "marked": "| Feature | Status | Notes | |---------|--------|-------| | Hippocampus concept index | **Live** | anchors.json persisted, lazy loading, nightly rebuild | | Compaction-aware capture | **Live** | Capturing to `<agent-data>/mnemosyne/captured/`, FTS5 indexing confirmed | | Task-conditioned scoring | Scaffolded | Hook registered but returns early (no task descriptor extraction yet) | | Contradiction gate | Scaffolded | Hook registered, `detectContradictions` returns empty array (entity extraction not wired) {+| | Bi-temporal supersede (§9.5) | Core-ready, plugin-pending | memory-core ships the validity columns, search predicate, and `supersede-writer`/`invalidate`; MNEMOSYNE must route the gate's decision into them+} |"
  },
  {
   "section": "8.5 Deployment",
   "old": "```bash # Build the plugin cd <agent-workspace>/extensions/tinkerclaw-memory-enhancements pnpm build",
   "new": "``` # Build the plugin cd <agent-workspace>/extensions/tinkerclaw-memory-enhancements pnpm build",
   "marked": "[-```bash-] {+```+} # Build the plugin cd <agent-workspace>/extensions/tinkerclaw-memory-enhancements pnpm build"
  },
  {
   "section": "9.3 The Complementarity Argument",
   "old": "Enterprise-wiki and personal-assistant are not just different products — they produce different *failure modes*. An enterprise wiki fails when it returns outdated information (solved by version history and review processes). A personal assistant fails when it contradicts itself (solved by contradiction gating) or loses context (solved by compaction capture). Designing for one set of failures does not address the other.",
   "new": "Enterprise-wiki and personal-assistant are not just different products — they produce different *failure modes*. An enterprise wiki fails when it returns outdated information (solved by version history and review processes). A personal assistant fails when it contradicts itself (solved by contradiction gating and supersession) or loses context (solved by compaction capture). Designing for one set of failures does not address the other.",
   "marked": "Enterprise-wiki and personal-assistant are not just different products — they produce different *failure modes*. An enterprise wiki fails when it returns outdated information (solved by version history and review processes). A personal assistant fails when it contradicts itself (solved by contradiction [-gating)-] {+gating and supersession)+} or loses context (solved by compaction capture). Designing for one set of failures does not address the other."
  },
  {
   "section": "9.5 Bi-Temporal Validity: From Contradiction-Logger to Contradiction-Resolver",
   "old": null,
   "new": "### 9.5 Bi-Temporal Validity: From Contradiction-Logger to Contradiction-Resolver",
   "marked": "{+### 9.5 Bi-Temporal Validity: From Contradiction-Logger to Contradiction-Resolver+}"
  },
  {
   "section": "9.5 Bi-Temporal Validity: From Contradiction-Logger to Contradiction-Resolver",
   "old": null,
   "new": "The contradiction gate of v1.0 (§6) is a *single-valued-present* operation: it decides allow / warn / block over a corpus implicitly assumed to be a flat snapshot of \"what is true now.\" That assumption is exactly what the §6.1 *stale-override* and *semantic-drift* threats violate. Bi-temporal validity replaces *overwrite/block* with *supersede*: a contradicting write neither destroys the prior fact (lossy — the reason §6.3 defaulted to warn) nor silently keeps both (the SCF / calendar-conflict failure of §6.1). Instead it **closes the prior fact's validity interval and opens the new one**, so the corpus carries the full history and every retrieval can ask \"valid-at-now\" versus \"valid-at-time-T.\" This upgrades the gate from a *logger of conflicts* into a *resolver of conflicts*, and it makes task-conditioned scoring (§5) honest: a debugging query asking \"what's the cron schedule\" gets the currently-valid value, not the superseded one written three weeks ago.",
   "marked": "{+The contradiction gate of v1.0 (§6) is a *single-valued-present* operation: it decides allow / warn / block over a corpus implicitly assumed to be a flat snapshot of \"what is true now.\" That assumption is exactly what the §6.1 *stale-override* and *semantic-drift* threats violate. Bi-temporal validity replaces *overwrite/block* with *supersede*: a contradicting write neither destroys the prior fact (lossy — the reason §6.3 defaulted to warn) nor silently keeps both (the SCF / calendar-conflict failure of §6.1). Instead it **closes the prior fact's validity interval and opens the new one**, so the corpus carries the full history and every retrieval can ask \"valid-at-now\" versus \"valid-at-time-T.\" This upgrades the gate from a *logger of conflicts* into a *resolver of conflicts*, and it makes task-conditioned scoring (§5) honest: a debugging query asking \"what's the cron schedule\" gets the currently-valid value, not the superseded one written three weeks ago.+}"
  },
  {
   "section": "9.5.1 Division of Labor: J2 Owns the Schema, J14 Owns the Behavior",
   "old": null,
   "new": "#### 9.5.1 Division of Labor: J2 Owns the Schema, J14 Owns the Behavior",
   "marked": "{+#### 9.5.1 Division of Labor: J2 Owns the Schema, J14 Owns the Behavior+}"
  },
  {
   "section": "9.5.1 Division of Labor: J2 Owns the Schema, J14 Owns the Behavior",
   "old": null,
   "new": "The schema work belongs to J2 HIPPOCAMPUS; the write/retrieve *semantics* belong here. As of this revision, the J2 substrate has landed in memory-core and can be verified directly in the codebase:",
   "marked": "{+The schema work belongs to J2 HIPPOCAMPUS; the write/retrieve *semantics* belong here. As of this revision, the J2 substrate has landed in memory-core and can be verified directly in the codebase:+}"
  },
  {
   "section": "9.5.1 Division of Labor: J2 Owns the Schema, J14 Owns the Behavior",
   "old": null,
   "new": "- The `chunks` table now carries `validity_start`, `validity_end`, `ingestion_time`, and `superseded_by` columns, added idempotently via `ensureColumn()` in `memory-schema.ts`, with a covering index `idx_chunks_validity` on `validity_end` so the hot-path \"current\" filter does not table-scan. (`validity_end IS NULL` means currently-valid / unbounded; back-filled legacy rows are NULL and so remain retrievable in the default mode.) - `StoredChunk` (`storage/types.ts`) carries the matching optional fields `validityStart`, `validityEnd`, `ingestionTime`, `supersededBy`, and `SearchParams` gains `temporalMode: \"current\" | \"valid-at\" | \"all\"` plus `asOfTime`. - The read path is already temporal-aware: `manager-search.ts` builds a `temporalPredicate()` clause threaded into the vector, FTS, and hybrid SELECTs — `current` appends `validity_end IS NULL OR validity_end > now`, `valid-at` binds `validity_start <= asOf AND (validity_end IS NULL OR validity_end > asOf)`, and `all` drops the predicate entirely.",
   "marked": "{+- The `chunks` table now carries `validity_start`, `validity_end`, `ingestion_time`, and `superseded_by` columns, added idempotently via `ensureColumn()` in `memory-schema.ts`, with a covering index `idx_chunks_validity` on `validity_end` so the hot-path \"current\" filter does not table-scan. (`validity_end IS NULL` means currently-valid / unbounded; back-filled legacy rows are NULL and so remain retrievable in the default mode.) - `StoredChunk` (`storage/types.ts`) carries the matching optional fields `validityStart`, `validityEnd`, `ingestionTime`, `supersededBy`, and `SearchParams` gains `temporalMode: \"current\" | \"valid-at\" | \"all\"` plus `asOfTime`. - The read path is already temporal-aware: `manager-search.ts` builds a `temporalPredicate()` clause threaded into the vector, FTS, and hybrid SELECTs — `current` appends `validity_end IS NULL OR validity_end > now`, `valid-at` binds `validity_start <= asOf AND (validity_end IS NULL OR validity_end > asOf)`, and `all` drops the predicate entirely.+}"
  },
  {
   "section": "9.5.1 Division of Labor: J2 Owns the Schema, J14 Owns the Behavior",
   "old": null,
   "new": "So J14's claim is no longer \"gated on a future J2 migration.\" The substrate exists. What MNEMOSYNE owns is routing the contradiction gate's decision into it and keeping task scoring validity-aware.",
   "marked": "{+So J14's claim is no longer \"gated on a future J2 migration.\" The substrate exists. What MNEMOSYNE owns is routing the contradiction gate's decision into it and keeping task scoring validity-aware.+}"
  },
  {
   "section": "9.5.2 The Supersede Write Decision",
   "old": null,
   "new": "#### 9.5.2 The Supersede Write Decision",
   "marked": "{+#### 9.5.2 The Supersede Write Decision+}"
  },
  {
   "section": "9.5.2 The Supersede Write Decision",
   "old": null,
   "new": "MNEMOSYNE extends the gate's `WriteDecision` with a `supersede` variant alongside the legacy `warn`/`block`. memory-core already ships the executor: `engram/supersede-writer.ts` exposes `decideSupersede(db, candidate, mode = \"supersede\")`, which finds the currently-valid (`validity_end IS NULL`) prior chunk(s) at the candidate's identity and returns `{ action, supersedes: ChunkId[], reason }`; and `applySupersede(db, decision, candidate)`, which — only in `supersede` mode — calls `invalidate()` once per superseded chunk. `invalidate()` (in `temporal-invalidation.ts`) stamps `validity_end` and `superseded_by` on rows that are *still open*, never deleting and never resurrecting a closed row. The behavior is non-lossy: the prior row stays queryable in `all` / `valid-at` mode.",
   "marked": "{+MNEMOSYNE extends the gate's `WriteDecision` with a `supersede` variant alongside the legacy `warn`/`block`. memory-core already ships the executor: `engram/supersede-writer.ts` exposes `decideSupersede(db, candidate, mode = \"supersede\")`, which finds the currently-valid (`validity_end IS NULL`) prior chunk(s) at the candidate's identity and returns `{ action, supersedes: ChunkId[], reason }`; and `applySupersede(db, decision, candidate)`, which — only in `supersede` mode — calls `invalidate()` once per superseded chunk. `invalidate()` (in `temporal-invalidation.ts`) stamps `validity_end` and `superseded_by` on rows that are *still open*, never deleting and never resurrecting a closed row. The behavior is non-lossy: the prior row stays queryable in `all` / `valid-at` mode.+}"
  },
  {
   "section": "9.5.2 The Supersede Write Decision",
   "old": null,
   "new": "``` type WriteDecision = | { action: \"allow\" } | { action: \"warn\", supersedes, reason } | { action: \"block\", supersedes, reason } | { action: \"supersede\", supersedes: ChunkId[], reason } // resolves the conflict",
   "marked": "{+``` type WriteDecision = | { action: \"allow\" } | { action: \"warn\", supersedes, reason } | { action: \"block\", supersedes, reason } | { action: \"supersede\", supersedes: ChunkId[], reason } // resolves the conflict+}"
  },
  {
   "section": "9.5.2 The Supersede Write Decision",
   "old": null,
   "new": "function contradictionGate(ctx): candidate = ctx.chunk decision = decideSupersede(db, candidate, config.contradictionMode) // memory-core if decision.action == \"allow\": return decision logContradiction(candidate, decision) // still append to contradictions.jsonl return decision // 'warn' | 'block' | 'supersede'",
   "marked": "{+function contradictionGate(ctx): candidate = ctx.chunk decision = decideSupersede(db, candidate, config.contradictionMode) // memory-core if decision.action == \"allow\": return decision logContradiction(candidate, decision) // still append to contradictions.jsonl return decision // 'warn' | 'block' | 'supersede'+}"
  },
  {
   "section": "On apply (supersede mode only): close each prior interval as of the candidate's validity_start applySupersede(db, decision, { id: candidate.id, validityStart: now }) ```",
   "old": null,
   "new": "# On apply (supersede mode only): close each prior interval as of the candidate's validity_start applySupersede(db, decision, { id: candidate.id, validityStart: now }) ```",
   "marked": "{+# On apply (supersede mode only): close each prior interval as of the candidate's validity_start applySupersede(db, decision, { id: candidate.id, validityStart: now }) ```+}"
  },
  {
   "section": "On apply (supersede mode only): close each prior interval as of the candidate's validity_start applySupersede(db, decision, { id: candidate.id, validityStart: now }) ```",
   "old": null,
   "new": "memory-core's `decideSupersede` defaults its mode argument to `\"supersede\"`, and an `onClosed` producer hook emits a `recipe-supersede` trail event so the UI renders a supersede icon when an interval is actually closed. The MNEMOSYNE side is the configuration default it advertises — see §9.5.4.",
   "marked": "{+memory-core's `decideSupersede` defaults its mode argument to `\"supersede\"`, and an `onClosed` producer hook emits a `recipe-supersede` trail event so the UI renders a supersede icon when an interval is actually closed. The MNEMOSYNE side is the configuration default it advertises — see §9.5.4.+}"
  },
  {
   "section": "9.5.3 Validity-Aware Task Scoring",
   "old": null,
   "new": "#### 9.5.3 Validity-Aware Task Scoring",
   "marked": "{+#### 9.5.3 Validity-Aware Task Scoring+}"
  },
  {
   "section": "9.5.3 Validity-Aware Task Scoring",
   "old": null,
   "new": "Because the read-path predicate (§9.5.1) already excludes superseded chunks in `current` mode, the scoring change is small. In `valid-at` / `all` modes, where historical chunks *are* returned, `taskConditionedScoring` (§5.3) must not let a stale-but-textually-similar fact out-rank the current one on task bias alone. The guard down-weights — not zeros — a candidate whose validity interval does not contain the query's `asOf`:",
   "marked": "{+Because the read-path predicate (§9.5.1) already excludes superseded chunks in `current` mode, the scoring change is small. In `valid-at` / `all` modes, where historical chunks *are* returned, `taskConditionedScoring` (§5.3) must not let a stale-but-textually-similar fact out-rank the current one on task bias alone. The guard down-weights — not zeros — a candidate whose validity interval does not contain the query's `asOf`:+}"
  },
  {
   "section": "9.5.3 Validity-Aware Task Scoring",
   "old": null,
   "new": "``` function taskConditionedScoring(ctx): if not ctx.taskDescriptor: return asOf = ctx.asOfTime ?? now for cand in ctx.candidates: rel = computeTaskRelevance(cand.metadata, ctx.taskDescriptor) if cand.validityEnd != null and cand.validityEnd <= asOf: rel = rel * HISTORICAL_TASK_DAMP # down-weight, don't zero cand.score += TASK_WEIGHT * rel ```",
   "marked": "{+``` function taskConditionedScoring(ctx): if not ctx.taskDescriptor: return asOf = ctx.asOfTime ?? now for cand in ctx.candidates: rel = computeTaskRelevance(cand.metadata, ctx.taskDescriptor) if cand.validityEnd != null and cand.validityEnd <= asOf: rel = rel * HISTORICAL_TASK_DAMP # down-weight, don't zero cand.score += TASK_WEIGHT * rel ```+}"
  },
  {
   "section": "9.5.3 Validity-Aware Task Scoring",
   "old": null,
   "new": "A related correctness note: recency-based importance (`computeImportance`) should derive its recency tier from `validity_start`, not `updatedAt` — a fact reinstated after being superseded became *true again* at its new `validity_start`, and that is the date a recency bonus should reflect. `ingestion_time` is stamped once at first insert and never on re-touch, so it stays the honest \"when did the system first learn this\" clock.",
   "marked": "{+A related correctness note: recency-based importance (`computeImportance`) should derive its recency tier from `validity_start`, not `updatedAt` — a fact reinstated after being superseded became *true again* at its new `validity_start`, and that is the date a recency bonus should reflect. `ingestion_time` is stamped once at first insert and never on re-touch, so it stays the honest \"when did the system first learn this\" clock.+}"
  },
  {
   "section": "9.5.4 The One Genuine Product Decision",
   "old": null,
   "new": "#### 9.5.4 The One Genuine Product Decision",
   "marked": "{+#### 9.5.4 The One Genuine Product Decision+}"
  },
  {
   "section": "9.5.4 The One Genuine Product Decision",
   "old": null,
   "new": "memory-core defaults `decideSupersede` to `supersede` mode, but MNEMOSYNE's published plugin still defaults `contradictionGate.mode` to `warn` for backward compatibility (§8.1). Whether the *plugin* default should flip to `supersede` is a product call, not a code-derivable one. The argument for flipping is that supersede is strictly safer than block — nothing is destroyed — and resolves rather than merely logs the §6.1 failure. The argument against is that it changes live behavior for every existing installation, and a false-positive contradiction would close the interval of a fact that was actually still valid (recoverable via `all`-mode query, but no longer surfaced by default). The conservative path — ship `supersede` opt-in for v0.2, observe the `contradictions.jsonl` false-positive rate, then consider flipping the default in v0.3 — is the one this paper recommends.",
   "marked": "{+memory-core defaults `decideSupersede` to `supersede` mode, but MNEMOSYNE's published plugin still defaults `contradictionGate.mode` to `warn` for backward compatibility (§8.1). Whether the *plugin* default should flip to `supersede` is a product call, not a code-derivable one. The argument for flipping is that supersede is strictly safer than block — nothing is destroyed — and resolves rather than merely logs the §6.1 failure. The argument against is that it changes live behavior for every existing installation, and a false-positive contradiction would close the interval of a fact that was actually still valid (recoverable via `all`-mode query, but no longer surfaced by default). The conservative path — ship `supersede` opt-in for v0.2, observe the `contradictions.jsonl` false-positive rate, then consider flipping the default in v0.3 — is the one this paper recommends.+}"
  },
  {
   "section": "9.5.5 What Is Not Yet Built",
   "old": null,
   "new": "#### 9.5.5 What Is Not Yet Built",
   "marked": "{+#### 9.5.5 What Is Not Yet Built+}"
  },
  {
   "section": "9.5.5 What Is Not Yet Built",
   "old": null,
   "new": "Two pieces from the original design remain unimplemented and are stated honestly as future work:",
   "marked": "{+Two pieces from the original design remain unimplemented and are stated honestly as future work:+}"
  },
  {
   "section": "9.5.5 What Is Not Yet Built",
   "old": null,
   "new": "1. **Cascade retraction.** `temporal-invalidation.ts` is explicit that there is *no cascade in v1*: invalidating a fact does not invalidate facts that depended on it. A `depends_on` edge plus a topological, visited-set-guarded cascade (to terminate on cyclic dependencies) is a v0.3 item, and it overlaps the Zettelkasten edge work (J2 Upgrade 9, the `backlinks` table already in the schema). 2. **Fact-level (triple) validity.** The landed schema is *chunk-level*: one validity interval per chunk row. A true fact-level bi-temporal graph — `(subject, predicate, object, valid_from, valid_to)` — is richer but a larger build, and is left as an open granularity question rather than claimed.",
   "marked": "{+1. **Cascade retraction.** `temporal-invalidation.ts` is explicit that there is *no cascade in v1*: invalidating a fact does not invalidate facts that depended on it. A `depends_on` edge plus a topological, visited-set-guarded cascade (to terminate on cyclic dependencies) is a v0.3 item, and it overlaps the Zettelkasten edge work (J2 Upgrade 9, the `backlinks` table already in the schema). 2. **Fact-level (triple) validity.** The landed schema is *chunk-level*: one validity interval per chunk row. A true fact-level bi-temporal graph — `(subject, predicate, object, valid_from, valid_to)` — is richer but a larger build, and is left as an open granularity question rather than claimed.+}"
  },
  {
   "section": "9.5.5 What Is Not Yet Built",
   "old": null,
   "new": "A third design question — whether the supersede boundary uses *ingestion time* (simple, what the current executor assumes via the candidate's `validity_start`) or an *extracted event time* from the content (correct for \"the meeting moved to Thursday,\" but requires reliable temporal entity extraction) — is unresolved. Using ingestion time can mis-order the §6.1 stale-override scenario when an old memory is consolidated after a newer one; event-time extraction is the principled fix and a v0.3 candidate.",
   "marked": "{+A third design question — whether the supersede boundary uses *ingestion time* (simple, what the current executor assumes via the candidate's `validity_start`) or an *extracted event time* from the content (correct for \"the meeting moved to Thursday,\" but requires reliable temporal entity extraction) — is unresolved. Using ingestion time can mis-order the §6.1 stale-override scenario when an old memory is consolidated after a newer one; event-time extraction is the principled fix and a v0.3 candidate.+}"
  },
  {
   "section": "10.3 Contradiction Detection Depth",
   "old": "- **Semantic contradictions**: \"The project is going well\" vs \"The project has critical blockers.\" - **Temporal contradictions**: Facts that were true at time T but not at time T+1, where the detector cannot determine which is current. - **Implication contradictions**: \"All tests pass\" followed by \"Feature X is broken\" (the second implies at least one test should fail).",
   "new": "- **Semantic contradictions**: \"The project is going well\" vs \"The project has critical blockers.\" - **Implication contradictions**: \"All tests pass\" followed by \"Feature X is broken\" (the second implies at least one test should fail).",
   "marked": "- **Semantic contradictions**: \"The project is going well\" vs \"The project has critical blockers.\" [-- **Temporal contradictions**: Facts that were true at time T but not at time T+1, where the detector cannot determine which is current.-] - **Implication contradictions**: \"All tests pass\" followed by \"Feature X is broken\" (the second implies at least one test should fail)."
  },
  {
   "section": "10.3 Contradiction Detection Depth",
   "old": "Deeper contradiction detection using LLM-assisted semantic comparison is planned for v0.3.",
   "new": null,
   "marked": "[-Deeper contradiction detection using LLM-assisted semantic comparison is planned for v0.3.-]"
  },
  {
   "section": "10.3 Contradiction Detection Depth",
   "old": null,
   "new": "Temporal contradictions — facts that were true at time T but not at T+1 — are no longer a detection gap so much as a *resolution* one: the bi-temporal validity layer (§9.5) is the mechanism that resolves them once the gate routes through `supersede`. Deeper semantic and implication detection using LLM-assisted comparison is planned for v0.3.",
   "marked": "{+Temporal contradictions — facts that were true at time T but not at T+1 — are no longer a detection gap so much as a *resolution* one: the bi-temporal validity layer (§9.5) is the mechanism that resolves them once the gate routes through `supersede`. Deeper semantic and implication detection using LLM-assisted comparison is planned for v0.3.+}"
  },
  {
   "section": "10.4 Benchmarks",
   "old": "No formal benchmarks have been run comparing O(1) concept index retrieval against hybrid search. The theoretical complexity analysis (§4.7) predicts constant-time retrieval, but wall-clock measurements on the production corpus (878K events, ~2,000 concepts) are needed to quantify the actual speedup. Benchmarking against the CORF-annotated dataset from J2 is planned for v0.2.",
   "new": "No formal benchmarks have been run comparing O(1) concept index retrieval against hybrid search. The complexity analysis (§4.7) predicts constant-time retrieval, but wall-clock measurements on the production corpus (thousands of concepts) are needed to quantify the actual speedup. Benchmarking against the CORF-annotated dataset from J2 is planned for v0.2. The bi-temporal read path adds a per-query filter on `validity_end`; §9.5.1 notes the covering index that keeps it off the table-scan path, but the overhead has likewise not been measured under production load.",
   "marked": "No formal benchmarks have been run comparing O(1) concept index retrieval against hybrid search. The [-theoretical-] complexity analysis (§4.7) predicts constant-time retrieval, but wall-clock measurements on the production corpus [-(878K events, ~2,000-] {+(thousands of+} concepts) are needed to quantify the actual speedup. Benchmarking against the CORF-annotated dataset from J2 is planned for [-v0.2.-] {+v0.2. The bi-temporal read path adds a per-query filter on `validity_end`; §9.5.1 notes the covering index that keeps it off the table-scan path, but the overhead has likewise not been measured under production load.+}"
  },
  {
   "section": "11. Conclusion",
   "old": "MNEMOSYNE demonstrates that four significant improvements to a personal-agent memory system — constant-time concept retrieval, task-conditioned scoring, write-time contradiction gating, and compaction-aware capture — can be delivered as a single plugin layered on top of an unmodified upstream codebase. The plugin architecture provides failure isolation, upgrade independence, and marketplace distributability. Two features are live in production (v0.1); two are scaffolded and awaiting entity extraction and task descriptor wiring (v0.2). The approach validates a design principle: that personal-assistant memory diverges enough from enterprise-wiki memory to justify a separate enhancement layer rather than upstream modification.",
   "new": "MNEMOSYNE demonstrates that four significant improvements to a personal-agent memory system — constant-time concept retrieval, task-conditioned scoring, write-time contradiction gating, and compaction-aware capture — can be delivered as a single plugin layered on top of an unmodified upstream codebase. The plugin architecture provides failure isolation, upgrade independence, and marketplace distributability. Two features are live in production (v0.1); two are scaffolded and awaiting entity extraction and task descriptor wiring (v0.2). The contradiction gate's most consequential evolution — bi-temporal supersession (§9.5) — is no longer speculative: memory-core now ships the validity schema, the temporal search predicate, and the supersede writer, leaving MNEMOSYNE to route the gate's decision into a substrate that already exists. The approach validates a design principle: that personal-assistant memory diverges enough from enterprise-wiki memory to justify a separate enhancement layer rather than upstream modification.",
   "marked": "MNEMOSYNE demonstrates that four significant improvements to a personal-agent memory system — constant-time concept retrieval, task-conditioned scoring, write-time contradiction gating, and compaction-aware capture — can be delivered as a single plugin layered on top of an unmodified upstream codebase. The plugin architecture provides failure isolation, upgrade independence, and marketplace distributability. Two features are live in production (v0.1); two are scaffolded and awaiting entity extraction and task descriptor wiring (v0.2). The {+contradiction gate's most consequential evolution — bi-temporal supersession (§9.5) — is no longer speculative: memory-core now ships the validity schema, the temporal search predicate, and the supersede writer, leaving MNEMOSYNE to route the gate's decision into a substrate that already exists. The+} approach validates a design principle: that personal-assistant memory diverges enough from enterprise-wiki memory to justify a separate enhancement layer rather than upstream modification."
  },
  {
   "section": "Changelog",
   "old": "- **v1.0 (2026-04-16):** Initial paper. Covers 4 features (hippocampus O(1) index, task-conditioned scoring, contradiction gate, compaction capture), v0.1 plugin scaffold with 680 LOC, v0.2 roadmap.",
   "new": null,
   "marked": "[-- **v1.0 (2026-04-16):** Initial paper. Covers 4 features (hippocampus O(1) index, task-conditioned scoring, contradiction gate, compaction capture), v0.1 plugin scaffold with 680 LOC, v0.2 roadmap.-]"
  },
  {
   "section": "Changelog",
   "old": null,
   "new": "- **v1.1 (2026-06-02):** Added §9.5 Bi-Temporal Validity — the contradiction gate's evolution from logger to resolver via supersession, grounded against the now-live memory-core substrate (`validity_*`/`ingestion_time`/`superseded_by` columns + `idx_chunks_validity` in `memory-schema.ts`; `temporalPredicate()` in `manager-search.ts`; `decideSupersede`/`applySupersede`/`invalidate` in `engram/supersede-writer.ts` + `temporal-invalidation.ts`). Added `supersede` as a third contradiction mode (§6.3, §8.1 configSchema, §8.2). Corrected the status table (§8.3) and limitations (§10.3/§10.4) to reflect the landed schema. Stated honestly what is NOT built (no cascade in v1, chunk-level not fact-level granularity, ingestion-time vs event-time boundary). Tightened prose throughout (removed product-claim of a specific corpus size where unverifiable; trimmed hedges). Abstract and §1.3 updated to name the bi-temporal contribution. - **v1.0 (2026-04-16):** Initial paper. Covers 4 features (hippocampus O(1) index, task-conditioned scoring, contradiction gate, compaction capture), v0.1 plugin scaffold with 680 LOC, v0.2 roadmap.",
   "marked": "{+- **v1.1 (2026-06-02):** Added §9.5 Bi-Temporal Validity — the contradiction gate's evolution from logger to resolver via supersession, grounded against the now-live memory-core substrate (`validity_*`/`ingestion_time`/`superseded_by` columns + `idx_chunks_validity` in `memory-schema.ts`; `temporalPredicate()` in `manager-search.ts`; `decideSupersede`/`applySupersede`/`invalidate` in `engram/supersede-writer.ts` + `temporal-invalidation.ts`). Added `supersede` as a third contradiction mode (§6.3, §8.1 configSchema, §8.2). Corrected the status table (§8.3) and limitations (§10.3/§10.4) to reflect the landed schema. Stated honestly what is NOT built (no cascade in v1, chunk-level not fact-level granularity, ingestion-time vs event-time boundary). Tightened prose throughout (removed product-claim of a specific corpus size where unverifiable; trimmed hedges). Abstract and §1.3 updated to name the bi-temporal contribution. - **v1.0 (2026-04-16):** Initial paper. Covers 4 features (hippocampus O(1) index, task-conditioned scoring, contradiction gate, compaction capture), v0.1 plugin scaffold with 680 LOC, v0.2 roadmap.+}"
  }
 ]
}
