{"record":{"id":"c512646167c490c7","repo":"mastra-ai/mastra","slug":"subconscious-curate-requires-a-configured-knowledg","errorCode":null,"errorMessage":"Subconscious curate requires a configured knowledge storage domain.","messagePattern":"Subconscious curate requires a configured knowledge storage domain\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/memory/src/processors/observational-memory/subconscious/curate.ts","lineNumber":76,"sourceCode":"  return { records, hasMore: Boolean(cursor) };\n}\n\nexport function createCuratorHandler(\n  memory: Memory,\n  subconscious: ResolvedSubconsciousConfig,\n  curatorMemory = memory,\n  options?: { omModel?: ObservationalMemoryModel },\n): (context: ReflectionCommittedContext) => Promise<'ran' | 'no-op'> {\n  const config = subconscious.reflection.find(agent => agent.name === CURATION_AGENT);\n  if (!config) return async () => 'no-op';\n\n  return async context => {\n    let store: KnowledgeStorage | undefined;\n    let scope: KnowledgeScope | undefined;\n    try {\n      scope = resolveScope(context);\n      store = await memory.storage.getStore('knowledge');\n      if (!store) throw new Error('Subconscious curate requires a configured knowledge storage domain.');\n\n      const cursor = await store.getCurationCursor({ sourceThreadId: context.parentThreadId, agent: CURATION_AGENT });\n      const worklist = await readWorklist(store, context.parentThreadId, scope, cursor?.lastKnowledgeId);\n      if (!worklist.records.length && !context.observations.trim()) return 'no-op';\n\n      const agent = await createCuratorAgent(\n        memory,\n        curatorMemory,\n        context,\n        scope,\n        config,\n        subconscious,\n        options?.omModel,\n      );\n      const result = await agent.generate(\n        `Parent thread: ${context.parentThreadId}\\nCurrent time: ${new Date().toISOString()}\\nWorklist truncated: ${worklist.hasMore}\\n\\nCommitted pre-reflection observations:\\n${context.observations}\\n\\nNew KnowledgeRecord worklist:\\n${JSON.stringify(worklist.records)}`,\n        {\n          requestContext: context.requestContext,","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/memory/src/processors/observational-memory/subconscious/curate.ts#L58-L94","documentation":"The subconscious curate handler needs a 'knowledge' storage domain registered on the memory instance's storage to persist its worklist and curation cursor. Before doing any curation work it calls memory.storage.getStore('knowledge'); if no such store is configured it throws immediately. This guards against running curation against a storage backend that cannot hold KnowledgeRecords.","triggerScenarios":"Calling the curate processor (via handler/curate) when memory.storage has no store registered under the 'knowledge' domain, e.g. using a default storage adapter that never had a knowledge store added.","commonSituations":"Enabling the subconscious curate phase in observational-memory config without configuring knowledge storage; switching storage adapters and forgetting to register the knowledge store; running against in-memory/legacy storage that lacks the knowledge domain.","solutions":["Register a knowledge store on the memory storage backend (storage.addStore / equivalent for domain 'knowledge') before enabling curate.","Verify with await memory.storage.getStore('knowledge') at startup that the store resolves.","Disable the curate phase in the Subconscious config if knowledge storage is not intended to be used."],"exampleFix":"// before\nnew Memory({ storage }) // no knowledge store\n// after\nconst storage = new LibsqlStore({ url });\nstorage.addStore?.('knowledge', new KnowledgeStorageAdapter());\nnew Memory({ storage });","handlingStrategy":"validation","validationCode":"const store = await memory.storage.getStore('knowledge');\nif (!store) throw new Error('Enable knowledge storage before running subconscious curate.');","typeGuard":"function hasKnowledgeStore(s: unknown): s is KnowledgeStorage {\n  return !!s && typeof (s as KnowledgeStorage).getCurationCursor === 'function';\n}","tryCatchPattern":"try {\n  await curate(context);\n} catch (err) {\n  if (err.message.includes('knowledge storage domain')) {\n    logger.warn('curate skipped: no knowledge storage configured');\n  } else throw err;\n}","preventionTips":["Register the knowledge store at memory/agent bootstrap, not lazily.","Add a startup assertion calling getStore('knowledge').","Only enable the curate phase when knowledge storage is part of the deployment config."],"tags":["storage","configuration","observational-memory"],"backgroundTag":"missing-storage-domain","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}