How-to
Detect contradictions and track knowledge gaps
Use memory_check to find inconsistencies and memory_gap to log questions the memory couldn't answer.
Two intelligence-layer surfaces work together: check finds places where the memory disagrees with itself, and gap records questions it couldn’t answer well. This recipe shows how to use both.
Run a contradiction check
Section titled “Run a contradiction check”quaid check people/alice --db ~/memory.db # one pagequaid check --all --db ~/memory.db # every pagequaid check --type person --db ~/memory.db # all pages of one typecheck reads the assertions table and flags subject-predicate-object triples that disagree. Common patterns:
- Two assertions about the same
(subject, predicate)with overlappingvalid_from/valid_until. - A timeline entry that contradicts a compiled-truth assertion.
- A frontmatter field that disagrees with content in the body.
Output is human-readable by default, JSON with --json. Materialized contradictions live in the contradictions table.
Where assertions come from
Section titled “Where assertions come from”Assertions are populated three ways:
-
Declared in frontmatter:
---title: Alicetype: personassertions:- subject: alicepredicate: employed_byobject: river-aivalid_from: 2024-01-15--- -
Parsed from
## Assertionssections in the body. -
Inferred by ingestion heuristics from common patterns (e.g. “Alice joined RiverAI in 2024”).
Resolve a contradiction
Section titled “Resolve a contradiction”There’s no automated resolver — contradictions are surfaced for human (or agent) review. The typical resolution:
- Wrong assertion? Delete it from the source (frontmatter or body), re-run
put, re-runcheck. - Both true at different times? Add
valid_untilto the older assertion so the intervals don’t overlap. - Both true now, but seem to disagree? Edit the predicate; the contradiction was lexical, not semantic.
Log a knowledge gap
Section titled “Log a knowledge gap”When a query returns weak results — or you anticipate one will — log it:
quaid call memory_gap '{"query":"who covers our European compliance?","context":"weekly briefing"}' --db ~/memory.dbBy default this stores the hash of the query, plus the context, plus a default sensitivity = internal. The raw text is not persisted unless explicitly approved. See the Sensitivity contract.
List unresolved gaps
Section titled “List unresolved gaps”quaid gaps --db ~/memory.db # unresolved (default)quaid gaps --resolved --db ~/memory.db # include resolvedquaid gaps --limit 100 --db ~/memory.dbResolve a gap
Section titled “Resolve a gap”You add a page that answers the question, then either:
- Manually mark it resolved — set
resolved_atandresolved_by_sluginknowledge_gapsdirectly. - Use the
researchskill — the embedded skill has a documented workflow for ingesting new material in response to a gap and marking the gap resolved when novelty passes a threshold.
The skill is the recommended path; it keeps the gap → research → ingest → resolve loop legible.
Common workflow
Section titled “Common workflow”- Daily:
quaid statsshows unresolved gap counts;quaid gaps --limit 5is the work queue. - Weekly:
quaid check --allto catch contradictions you’ve introduced. - Monthly:
quaid validateto catch link integrity issues. See Manage skills for analertsskill that wires this into your day automatically.
How agents use this
Section titled “How agents use this”Agents log gaps when their memory_query results don’t meet a confidence threshold. The hash-only default means the memory accumulates a privacy-safe ledger of “where can’t we answer well?” over time, even when individual queries are sensitive.
When an agent escalates a gap to external research (e.g. via the enrich skill), it must transition the sensitivity tier with explicit approval — see Sensitivity contract.