Repository navigation
v2.21.0
2.21.0 — 2026-11-21
Knowledge-graph memory: expert verification, cross-source conflict detection, fail-closed as-of retrieve, validity changelogs, staged-ingest rollback, and Cypher hardening. Defaults are unchanged: raw Cypher is read-only, CONFLICT_DETECT_ON_INGEST and CONFLICT_DETECT_LLM are off, as-of lookups fail closed, and ingest staging is not required for a normal import.
Deferred: #121 (agent-first MCP remember/recall/correct/check), #104 (Celery Redis reconnect), #105 (hosted ChatGPT MCP OAuth).
Verification
- Facts carry
unverified/verified/rejectedwith history. REST:GET/POST /model/facts…. MCP:verify_fact,reject_fact,reset_fact_verification,list_facts_by_verification,get_fact_verification. (#113, #125, #126) - Writes require the
verificationtoken scope (not granted by default).method=verified_sideconflict resolve uses the same scope. (#125, #126) verified_sidesnapshots verification properties before writes. On reject failure it restores exact prior state (verified_by,verified_at,verification_source, reason) with a single history entry taggedrollback, and keeps the conflict open. Pre-read miss or error aborts before any write. (#133, #135)
Conflicts
- Cross-source conflict scan, list, report, resolve, dismiss. REST under
/retrieve/conflicts. MCP:list_conflicts,get_conflict,resolve_conflict,dismiss_conflict,conflict_report. (#114, #126) - Ingest-time scan is incremental (touched subjects), pages past the old 10k cap, and evals scan-then-list with versioned timestamps. (#128, #132)
- Stale auto-resolve requires a concrete reason (side removed/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. A stale-closed conflict reopens if the same contradiction is found again. Compact ISO clock times compare as instants.upsert_conflictdoes not overwrite a concurrent operator resolution. Ingest scans include prior published units in the same run and skip detect when a prior staged output cannot be read. (#138, #139) - Full scans honor
CONFLICT_DETECT_MAX_RELATIONSHIPS(default10000;0is unlimited). Capped scans page by whole(subject_uuid, normalize_predicate(predicate))groups, persist a per-brain keyset cursor{after_subject, after_predicate}in Mongoconflict_scan_state/ Postgresdata_conflict_scan_state, and wrap around so later scans continue past the previous window. Hitting the cap setstruncatedand stale-closes only the groups that scan loaded. Neo4jpred_keymatchesnormalize_predicatefor relationship types that are notclean_label(hyphens, spaces, dots, non-ASCII), so those groups stay together; cursor pages keepn.uuid >= after_subject_uuid. (#138, #139, #140) - Optional ingest/LLM detection stays off:
CONFLICT_DETECT_ON_INGEST=false,CONFLICT_DETECT_LLM=false.
As-of retrieve and changelogs
- Retrieve/search accept
as_of. Undated facts are omitted (fail closed) and counted invalidity_unknown_count;include_validity_unknown=truereturns them separately. (#112, #124, #129) - Changelogs:
GET /retrieve/changelogs,GET /retrieve/changelogs/{id},GET /retrieve/changelogs/types. MCP:list_changelogs,get_changelog. Window filters run in Cypher; Neo4j creates per-type range indexes on validity timestamps. Index setup is cached per database (TTL or after writes that add relationship types; failed types back off and log once). (#129, #136)
History and sources
- History-mode triggers keep original revisions; ranking cost is capped. (#110, #117, #127)
- Retrieve prefers the newest copy of an app source;
list_source_versionslists versions. (#106) - Confirmed
POST /tasks/{task_id}/purgeremoves one import’s owned graph data. (#119)
Staged ingest and rollback
- Settlement failures are bounded; leftover cleanup is retried. Live staged units roll back when publish settlement is exhausted. (#115, #118)
- Graph rollback distinguishes created vs reused items and keys
rollback_doneas{operation_id}:{kind}:{uuid}so a later retouch cannot skip deleting the original create. (#131, #134)
Graph store and Cypher
- Identifier interpolation is allowlisted; raw Cypher stays read-only unless
GRAPH_RAW_WRITE_ENABLED=true. (#108, #120) remove_nodesdecodes driver records viaRecord.get; extra invalid labels no longer drop the node. Multilingual ingest labels, LOAD CSV/APOC rejection, and unsafe purge fallbacks. (#123, #130)
Evals and MCP
- Use-case eval harness vs a hybrid baseline; BrainAPI eval conflict IDs, as-of
include_history, and passage attribution. (#107, #116) - MCP version reads and multilingual history. (#109)
Security
- Raise
mcpto>=1.30.0,<2.0.0and refresh both lockfiles (Trivy HIGH CVE-2026-115563). (#140)
Defaults and flags (unchanged unless you opt in)
| Flag / setting | Default |
|---|---|
| Raw Cypher | read-only |
GRAPH_RAW_WRITE_ENABLED |
false |
CONFLICT_DETECT_ON_INGEST |
false |
CONFLICT_DETECT_LLM |
false |
CONFLICT_DETECT_MAX_RELATIONSHIPS |
10000 (0 = unlimited) |
| As-of missing valid-time start | fail closed (omit; count as unknown) |
include_validity_unknown |
false |
Token scope verification |
not granted by default |
VERIFIED_FACT_RANK_BOOST |
0.15 |
Known issues
- Neo4j validity index count grows as 7 × the number of relationship types.
- Changelog
MATCH (n)-[r]->(m)with OR/regex timestamp filters likely still scans relationships despite the new indexes. NeedsEXPLAIN/PROFILEon a real brain; follow-up is stamp normalization at write time or typedUNIONqueries. set_fact_verificationcommits then re-reads; a raising re-read can leave a rejected loser in place while reporting failure withoutrollback_failed.- Verified-side rollback is an unconditional SET by UUID and can overwrite a concurrent verification that landed after the snapshot.
- If a restore callback raises mid-loop, later facts (including the winner) may not be restored.
- REST/MCP conflict-resolve errors can include pre-read exception text; logs should stay detailed, callers should get a fixed message.
- Cold-start index setup is not serialized per database (
CREATE RANGE INDEX IF NOT EXISTSstays correct; overlapping first callers repeat work). A raw Cypher write during type listing can wait until the next TTL for a new type’s indexes. - Neo4j Community Edition still shares the default
neo4jdatabase whenCREATE DATABASEis unsupported. - A missing, null, or non-boolean LLM
contradictsfield is treated asfalseand can stale-close asllm_compatible. - Compact timed stamps (
2024-01-01T090000) collapse to date-only innormalize_date_string, so same-day events that differ only by time can share an identity UUID. Conflict detection usesparse_date_stringand is not affected. - An in-flight LLM verdict can stale-close a conflict after a later scan has already refreshed it with new fact values (
if_status=openonly). - LLM batch indexes are not bounded to the current batch; a negative index can overwrite an earlier batch's verdict.
Config.conflict_detect_max_relationshipsusesint(...)with no fallback; a blank or non-numeric env value raises at import. Runtimeconflict_detect_max_relationships()already falls back.- Compact clocks with a space separator (
20240101 090000) compare as dates, not instants._instant_keyalso drops microseconds, so fractional-second instants compare equal. - Compact
as_ofvalues like2024-01-01T930can parse as 09:03 instead of being rejected. - A comparison group larger than
CONFLICT_DETECT_MAX_RELATIONSHIPSis still loaded whole so groups are never split. - Truncated stale-close lists all open conflicts, then filters to scanned groups in Python.
- Skip/limit-only
list_validity_relationshipsbackends fall back to their native first page when no cursor is set. Production Neo4j, NetworkX, and search-fallback scans already order by comparison-group key. - Neo4j conflict-scan count queries still run on each page (full-brain total, not the current window).
- Unknown-side lookups during stale-close are unbounded.
- The
search_relationshipsfallback loads the whole graph before sorting and applying the cap.