Validate every memory write against project and writeback rules. Prevent contamination and schema drift.
Required fields:
raw_content — the content attempting to enter project memorycandidate_project_id — the project being written tomemory_type — type of memory: note, finding, task, summary, record, etc.source — where this came from: user message, paper, tool output, etc.timestamp — ISO-8601 timestamp of when the content was createdconfidence — confidence score 0.0–1.0 for project assignmenttext
decision: "accept" | "reject" | "reroute"
destination: string | null # project_id or "inbox" or null
normalized_record: object | null # cleaned record if accepted/rerouted
contamination_risk: "none" | "low" | "medium" | "high"
missing_fields: string[] | null
reason: string
ConditionDecisionMissing project_idreject — never enter formal project memoryMissing memory_typereject — no formal writebackMissing timestampreject — no formal writebackConfidence < 0.6reroute to inboxCross-project ambiguityreroute to inbox or cleanup modeAll fields present + high confidenceaccept
inbox — unverified content waiting for manual reviewcleanup — ambiguous content needing disambiguationWhen decision is accept or reroute, normalize the record:
validated_at timestampguard_version = "1.0"raw_content in normalized_record.rawIf uncertain about any field:
decision = "reroute" with destination = "inbox"missing_fields explicitlyreasonNever force acceptance when validation fails.