{"record":{"id":"34b2837b6f625aff","repo":"JuliusBrussee/caveman","slug":"cave-memory-consent-unsupported-only-local-only","errorCode":null,"errorMessage":"cave_memory_consent_unsupported: only \"local_only\" consent is supported","messagePattern":"cave_memory_consent_unsupported: only \"local_only\" consent is supported","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/agent/src/primitives.ts","lineNumber":290,"sourceCode":"    throw new Error(\"caveman agent: memory recallBudget must be a non-negative integer\");\n  }\n  try {\n    memoryTTLMilliseconds(options.ttl);\n  } catch {\n    throw new Error(\"caveman agent: memory ttl must use positive m, h, or d duration\");\n  }\n  // Fail closed at CONSTRUCTION, not at tool-call time: the durable\n  // store implements only local, single-tenant memory. A `project`/`external`\n  // provenance or a `project_shared` consent is a shared-backend contract this\n  // package does not provide, so it is refused here rather than burning a model\n  // turn to discover a config the framework already knew was unsupported.\n  const provenance = options.provenance ?? \"local\";\n  if (provenance !== \"local\") {\n    throw new Error(\"cave_memory_provenance_unsupported: only \\\"local\\\" memory is supported\");\n  }\n  const consent = options.consent ?? \"local_only\";\n  if (consent !== \"local_only\") {\n    throw new Error(\"cave_memory_consent_unsupported: only \\\"local_only\\\" consent is supported\");\n  }\n  return Object.freeze({\n    kind: \"memory\",\n    namespace: options.namespace,\n    provenance,\n    ttl: options.ttl,\n    recallBudget: options.recallBudget,\n    consent,\n  });\n}\n\nexport type ContextKind =\n  | \"instruction\"\n  | \"user_intent\"\n  | \"tool_schema\"\n  | \"skill\"\n  | \"memory\"\n  | \"history\"","sourceCodeStart":272,"sourceCodeEnd":308,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/packages/agent/src/primitives.ts#L272-L308","documentation":"Companion to the provenance guard: the memory store is local and single-tenant, so memory() fails closed at construction when consent is 'project_shared'. Only the default 'local_only' is accepted, because a shared-consent contract implies a shared backend this package does not provide.","triggerScenarios":"Calling memory({ consent: 'project_shared' }) on any namespace. Omitting consent is fine — it defaults to 'local_only'.","commonSituations":"Spec-driven config written against the full MemoryDefinition type union before checking runtime support; migrating from a team memory tool that required explicit consent flags.","solutions":["Remove the consent option or set it to 'local_only'","If the intent was to document data sensitivity, record it in your own metadata — the framework has no shared path to consent to","Validate loaded config and delete/deny consent: 'project_shared' before building the agent"],"exampleFix":"// before\nmemory({ namespace: 'notes', ttl: '7d', recallBudget: 10, consent: 'project_shared' });\n\n// after\nmemory({ namespace: 'notes', ttl: '7d', recallBudget: 10, consent: 'local_only' });","handlingStrategy":"validation","validationCode":"const SUPPORTED_CONSENT = new Set(['local_only']);\nfunction checkConsent(c: unknown): 'local_only' | undefined {\n  if (c === undefined) return undefined;\n  if (!SUPPORTED_CONSENT.has(c as string)) throw new Error('only consent \"local_only\" is supported by this build');\n  return 'local_only';\n}","typeGuard":"function isSupportedConsent(value: unknown): value is 'local_only' { return value === 'local_only' || value === undefined; }","tryCatchPattern":"try { memory(opts); } catch (e) { if (e instanceof Error && e.message.startsWith('cave_memory_consent_unsupported')) throw new ConfigError('project_shared consent is not available; use local_only', { cause: e }); throw e; }","preventionTips":["Leave consent at its local_only default","Do not pre-configure consent for a shared backend that does not exist yet","Re-check supported memory options on framework upgrades"],"tags":["memory","consent","unsupported-feature","fail-closed"],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}