The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
fix(memory): "X is unknown" is never saved as a memory, nor put in a prompt (CA)
purple1819b1f095fe
diff --git a/src/lib/__tests__/not-knowing-is-not-a-memory.test.ts b/src/lib/__tests__/not-knowing-is-not-a-memory.test.tsnew file mode 100644index 00000000..4169e38f--- /dev/null+++ b/src/lib/__tests__/not-knowing-is-not-a-memory.test.ts@@ -0,0 +1,33 @@+import { describe, it, expect } from 'vitest'+import { onlyStatesAGap } from '../memory-gap'+import { parseExtractionResponse } from '../memory-extraction'++// CA bench AG10 (14.11.2026): the extraction had saved "User's preferred+// language for commit messages is unknown", and the model believed it over+// the real fact "writes commit messages in English".+describe('a memory that only says something is unknown', () => {+ it('is recognised in the shapes the extraction wrote', () => {+ expect(onlyStatesAGap({ content: "User's preferred language for commit messages is unknown", description: 'Unknown' })).toBe(true)+ expect(onlyStatesAGap({ content: 'Die Lieblingsfarbe ist noch unbekannt' })).toBe(true)+ expect(onlyStatesAGap({ content: 'Unknown' })).toBe(true)+ expect(onlyStatesAGap({ content: 'The deadline was not specified.' })).toBe(true)+ })++ it('leaves real facts alone, also ones with the word in them', () => {+ expect(onlyStatesAGap({ content: 'Schreibt Commit-Messages immer auf Englisch.' })).toBe(false)+ expect(onlyStatesAGap({ content: 'Likes the band Unknown Mortal Orchestra' })).toBe(false)+ expect(onlyStatesAGap({ content: 'Works on the project "unknown-tools"', description: 'Project name' })).toBe(false)+ expect(onlyStatesAGap({ content: 'Prefers clear, unknown-free specs' })).toBe(false)+ })++ it('is not saved by the extraction', () => {+ const r = parseExtractionResponse(JSON.stringify({+ shouldSave: true,+ memories: [+ { type: 'user', title: "User's preferred editor", description: 'Helix', content: "User's preferred editor is Helix" },+ { type: 'user', title: 'Commit language', description: 'Unknown', content: "User's preferred language for commit messages is unknown" },+ ],+ }))+ expect(r.memories.map((m) => m.description)).toEqual(['Helix'])+ })+})diff --git a/src/lib/memory-extraction.ts b/src/lib/memory-extraction.tsindex 2285929b..97a489f4 100644--- a/src/lib/memory-extraction.ts+++ b/src/lib/memory-extraction.ts@@ -14,6 +14,7 @@import { extractJsonObject } from './json-scan'import { isRecord, asString, asStringArray } from '../types/json-guards'import type { MemoryType } from '../types/agent-mode'+import { onlyStatesAGap } from './memory-gap'export interface ExtractedMemory {type: MemoryType@@ -241,6 +242,8 @@ export function parseExtractionResponse(response: string): ExtractionResult {const content = asString(raw.content)if (!type || !title || !content) continueconst description = asString(raw.description) || content.substring(0, 120)+ // "X is unknown" is not a fact about the user (memory-gap.ts).+ if (onlyStatesAGap({ content, description })) continuememories.push({type,title: title.substring(0, 60),diff --git a/src/lib/memory-gap.ts b/src/lib/memory-gap.tsnew file mode 100644index 00000000..8596c7cf--- /dev/null+++ b/src/lib/memory-gap.ts@@ -0,0 +1,25 @@+/**+ * A "memory" that only records that something is NOT known (CA, 14.11.2026).+ *+ * The automatic extraction stored "User's preferred language for commit+ * messages is unknown" after a turn that did not mention it. Injected later+ * next to the real fact ("writes commit messages in English"), it won: Kimi+ * answered that it had never been told (CA bench AG10). Not knowing is not a+ * fact about the user. Such entries are not saved, and ones saved before are+ * left out of the prompt.+ *+ * Narrow on purpose: only a statement that something IS unknown / unclear /+ * not given, or a field that says nothing but "unknown". A memory that merely+ * contains the word ("likes Unknown Mortal Orchestra") stays.+ */+const IS_UNKNOWN = /\b(?:is|are|was|were|remains?|stays?)\s+(?:still\s+|currently\s+|not\s+yet\s+)?(?:unknown|unclear|undetermined|not\s+(?:known|specified|mentioned|provided|stated|given|clear))\b/i+const IST_UNBEKANNT = /\b(?:ist|sind|war|bleibt)\s+(?:noch\s+|bisher\s+)?(?:unbekannt|unklar|nicht\s+(?:bekannt|angegeben|genannt|klar))\b/i+const ONLY_UNKNOWN = /^\s*(?:unknown|unclear|not\s+specified|not\s+known|n\/a|none|unbekannt|keine\s+angabe)\s*\.?\s*$/i++export function onlyStatesAGap(m: { content?: string; description?: string }): boolean {+ const content = m.content ?? ''+ const description = m.description ?? ''+ if (ONLY_UNKNOWN.test(content)) return true+ if (IS_UNKNOWN.test(content) || IST_UNBEKANNT.test(content)) return true+ return ONLY_UNKNOWN.test(description) && (IS_UNKNOWN.test(content) || IST_UNBEKANNT.test(content) || content.trim() === '')+}diff --git a/src/stores/memoryStore.ts b/src/stores/memoryStore.tsindex 359cb925..c5e23225 100644--- a/src/stores/memoryStore.ts+++ b/src/stores/memoryStore.ts@@ -8,6 +8,7 @@ import { generateEmbeddings } from '../api/rag'import { singleModelSlot } from '../lib/capabilities'import { saveVector, loadVectors, deleteVector, clearAll as clearAllVectors, type MemoryVectorRecord } from '../lib/memoryEmbedDB'import { scoreMemoriesBlended, isStale, type BlendCandidate } from '../lib/memory-retrieval'+import { onlyStatesAGap } from '../lib/memory-gap'import type { ResolutionDecision } from '../lib/memory-extraction'import { isRecord, prop, asString, asNumber, asStringArray } from '../types/json-guards'import { log } from '../lib/logger'@@ -936,7 +937,9 @@ export const useMemoryStore = create<MemoryState>()(// A phone has only this path, so its words are taken without the// punctuation ("drink?" must find "drink"). The desktop keeps its split.const words = singleModelSlot() ? queryWords(query) : query.toLowerCase().split(/\s+/).filter(w => w.length > 2)- let candidates = get().entries.filter(e => !e.sensitive && !isStale(e) && memoryMatchesScope(e, opts?.scope))+ // An entry that only says something is unknown would outvote the real+ // fact next to it (memory-gap.ts, CA bench AG10).+ let candidates = get().entries.filter(e => !e.sensitive && !isStale(e) && !onlyStatesAGap(e) && memoryMatchesScope(e, opts?.scope))if (opts?.excludeToolResults) {candidates = candidates.filter(e => !isToolResultMemory(e))}@@ -1000,7 +1003,7 @@ export const useMemoryStore = create<MemoryState>()(// stubbed sync method in tests is honoured).if (budget.budgetTokens === 0 || budget.maxMemories === 0) return fallback()- let candidates = get().entries.filter(e => !e.sensitive && !isStale(e) && memoryMatchesScope(e, requestOpts?.scope))+ let candidates = get().entries.filter(e => !e.sensitive && !isStale(e) && !onlyStatesAGap(e) && memoryMatchesScope(e, requestOpts?.scope))if (requestOpts?.excludeToolResults) {candidates = candidates.filter(e => !isToolResultMemory(e))}