BrainAPI
BrainAPI
Retrieve

For the complete BrainAPI documentation index, see llms.txt. A markdown version of any docs page is available by appending .md to its URL. Docs MCP: /docs/mcp.

Cross-source conflicts

Scan, list, resolve, and dismiss contradictory facts that share a subject and predicate

A conflict links two facts that share a subject and predicate, disagree on value, amount, or polarity, and overlap in valid time. Same-source revisions (a superseded copy versus the current copy) are not conflicts.

Statuses are open, resolved, and dismissed. Resolution methods are dismissed, verified_side, manual, and stale.

On-demand scan is always available on a 2.21.0 engine. Ingest-time detection and leftover-pair judging stay off unless you opt in.

Public hosts that have not rolled 2.21.0 return 404 on /retrieve/conflicts because the route is not deployed there. That live 404 is not this contract. See Regional API hosts.

REST

MethodPathEffect
GET/retrieve/conflictsList conflicts. Filter with status, source (source_key), subject, since, until. Page with limit and skip.
GET/retrieve/conflicts/{id}Read one conflict.
GET/retrieve/conflicts/reportformat=json (default) returns summary plus conflicts. format=markdown returns text/markdown only. Invalid format or status is 400.
POST/retrieve/conflicts/scanQueue a scan. Returns 202 {message, task_id} only. Body may set use_llm only. There is no MCP scan tool.
POST/retrieve/conflicts/{id}/resolveResolve. Body: winning_fact_id, notes, method (manual or verified_side).
POST/retrieve/conflicts/{id}/dismissDismiss without choosing a winner. Body: optional notes.
curl --fail-with-body -X POST http://localhost:8000/retrieve/conflicts/scan \
  -H "BrainPAT: $BRAINPAT_TOKEN" \
  -H "X-Brain-ID: $BRAIN_ID" \
  -H "Content-Type: application/json" \
  -d '{"use_llm":false}'

curl --fail-with-body "http://localhost:8000/retrieve/conflicts?status=open" \
  -H "BrainPAT: $BRAINPAT_TOKEN" \
  -H "X-Brain-ID: $BRAIN_ID"

Poll the scan with GET /tasks/{task_id} in the same brain. truncated, scanned_relationships, stale_resolved, and related counts land on the task result, not the 202 body. The REST scan body cannot override the cap.

Resolve methods

MethodScopeBehavior
manualany valid PATRecord a winner and notes. Does not rewrite verification states.
verified_sideverificationVerify the winning fact and reject the other side. Requires winning_fact_id.
dismissedany valid PATClose without a winner (POST .../dismiss).
stalescannerAuto-closed when a later scan proves the contradiction no longer holds.

verified_side snapshots verification properties before writes. If reject fails, it restores the prior verified_by, verified_at, verification_source, and reason with a single history entry tagged rollback, and keeps the conflict open. A pre-read miss or error aborts before any write.

A stale-closed conflict reopens if the same contradiction is found again. Stale auto-resolve requires a concrete reason (side removed or superseded, validity windows no longer overlap, values compatible, or an explicit LLM contradicts=false). LLM-detected conflicts stay open when the LLM is off, the pair budget is exhausted, or that pair got no verdict.

upsert_conflict does not overwrite a concurrent operator resolution.

Scan cap and cursor

CONFLICT_DETECT_MAX_RELATIONSHIPS defaults to 10000. 0 means unlimited. REST scan cannot pass a different cap.

Capped scans page by whole (subject_uuid, normalized predicate) groups, persist a per-brain keyset cursor {after_subject, after_predicate}, and wrap around so later scans continue past the previous window. Hitting the cap stale-closes only groups that scan loaded. A comparison group larger than the cap is still loaded whole so groups are never split.

Ingest-time scan (when enabled) is incremental over touched subjects and can page past the default cap. Full on-demand scans honor the env cap.

MCP

ToolPurpose
list_conflictsList with the same filters as REST. limit is clamped to 1–50.
get_conflictRead one conflict.
resolve_conflictResolve (method manual or verified_side).
dismiss_conflictDismiss.
conflict_reportJSON or markdown report. limit is clamped to 1–200; there is no skip.

There is no MCP tool to start a scan. verified_side on MCP also requires the verification scope.

Defaults

FlagDefault
CONFLICT_DETECT_ON_INGESTfalse
CONFLICT_DETECT_LLMfalse
CONFLICT_DETECT_LLM_MAX_PAIRS20
CONFLICT_DETECT_MAX_RELATIONSHIPS10000 (0 unlimited)

See Known issues for scan, stale-close, and LLM-verdict caveats verified in this release.

Edit on GitHub

Last updated on

On this page