Objective
Every agent framework has the same failure: memory is append-only trust. A user misspeaks, a scraped page lies, another agent hallucinates — and the falsehood is stored next to the facts, recalled with equal confidence forever. This is memory poisoning, and the usual answer ("review your memories sometimes") doesn't scale.
SynapCores co-locates agent memory (MEMORY_STORE / MEMORY_RECALL) and an
NLI verifier in the same process, so the fix is structural: before a
candidate memory is stored, verify it against what the namespace already
believes. A contradiction is rejected and logged; everything else is
stored. The whole check is one statement over the recall set.
Step 1: Establish what the agent knows
MEMORY_STORE auto-creates the namespace on first write — no schema step.
SELECT MEMORY_STORE('recipe_consistent_mem',
'The customer prefers to be contacted by email, never by phone.') AS m1;
SELECT MEMORY_STORE('recipe_consistent_mem',
'The customer is on the Aurora plan, which includes a 14-day return window.') AS m2;
SELECT MEMORY_STORE('recipe_consistent_mem',
'The customer manages procurement for a mid-size logistics company.') AS m3;
Step 2: Ground truth — what does recall surface for a contact question?
SELECT content, similarity
FROM MEMORY_RECALL('recipe_consistent_mem', 'how should we contact the customer', 3);
Expected: the email-preference memory ranks first. This recall set is exactly the evidence the gate will verify against.
Step 3: The gate — verify a candidate memory against recalled beliefs
A candidate arrives (from a user message, another agent, a scraper): "The customer prefers phone contact." Verify it against the namespace before storing:
SELECT NLI_VERIFY('nli-default',
'The customer prefers phone contact.',
NLI_ANCHORS(content)) AS gate
FROM MEMORY_RECALL('recipe_consistent_mem', 'The customer prefers phone contact.', 5);
Expected: verdict LIE (observed confidence ≈ 0.999), with
violated_anchor = the stored email-preference memory. The recall query uses
the candidate itself as the probe, so the memories most likely to
conflict are exactly the ones retrieved.
Step 4: Route on the verdict — store, or log the conflict
CREATE TABLE IF NOT EXISTS recipe_consistent_mem_conflicts (
id INT PRIMARY KEY,
candidate TEXT,
verdict TEXT,
violated_anchor TEXT,
confidence DOUBLE,
seen_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
The contradicting candidate goes to the conflict log, not to memory:
INSERT INTO recipe_consistent_mem_conflicts (id, candidate, verdict, violated_anchor, confidence)
SELECT 1,
'The customer prefers phone contact.',
JSON_UNQUOTE(JSON_EXTRACT(gate, '$.verdict')),
JSON_UNQUOTE(JSON_EXTRACT(gate, '$.violated_anchor')),
CAST(JSON_EXTRACT(gate, '$.confidence') AS DOUBLE)
FROM (
SELECT NLI_VERIFY('nli-default',
'The customer prefers phone contact.',
NLI_ANCHORS(content)) AS gate
FROM MEMORY_RECALL('recipe_consistent_mem', 'The customer prefers phone contact.', 5)
) checked
WHERE JSON_UNQUOTE(JSON_EXTRACT(gate, '$.verdict')) = 'LIE';
SELECT candidate, verdict, violated_anchor FROM recipe_consistent_mem_conflicts;
Expected: 1 row — the phone-contact candidate, verdict LIE, violated
anchor naming the email-preference memory. A human (or a supervising agent)
now sees that there is a conflict and which belief it collides with —
instead of two contradictory memories being served with equal confidence.