Skip to content

v2.21.0

Choose a tag to compare

@cursor cursor released this 21 Nov 10:40
0162a65

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 / rejected with 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 verification token scope (not granted by default). method=verified_side conflict resolve uses the same scope. (#125, #126)
  • verified_side snapshots verification properties before writes. On reject failure it restores exact prior state (verified_by, verified_at, verification_source, reason) with a single history entry tagged rollback, 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_conflict does 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 (default 10000; 0 is unlimited). Capped scans page by whole (subject_uuid, normalize_predicate(predicate)) groups, persist a per-brain keyset cursor {after_subject, after_predicate} in Mongo conflict_scan_state / Postgres data_conflict_scan_state, and wrap around so later scans continue past the previous window. Hitting the cap sets truncated and stale-closes only the groups that scan loaded. Neo4j pred_key matches normalize_predicate for relationship types that are not clean_label (hyphens, spaces, dots, non-ASCII), so those groups stay together; cursor pages keep n.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 in validity_unknown_count; include_validity_unknown=true returns 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_versions lists versions. (#106)
  • Confirmed POST /tasks/{task_id}/purge removes 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_done as {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_nodes decodes driver records via Record.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

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. Needs EXPLAIN/PROFILE on a real brain; follow-up is stamp normalization at write time or typed UNION queries.
  • set_fact_verification commits then re-reads; a raising re-read can leave a rejected loser in place while reporting failure without rollback_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 EXISTS stays 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 neo4j database when CREATE DATABASE is unsupported.
  • A missing, null, or non-boolean LLM contradicts field is treated as false and can stale-close as llm_compatible.
  • Compact timed stamps (2024-01-01T090000) collapse to date-only in normalize_date_string, so same-day events that differ only by time can share an identity UUID. Conflict detection uses parse_date_string and 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=open only).
  • LLM batch indexes are not bounded to the current batch; a negative index can overwrite an earlier batch's verdict.
  • Config.conflict_detect_max_relationships uses int(...) with no fallback; a blank or non-numeric env value raises at import. Runtime conflict_detect_max_relationships() already falls back.
  • Compact clocks with a space separator (20240101 090000) compare as dates, not instants. _instant_key also drops microseconds, so fractional-second instants compare equal.
  • Compact as_of values like 2024-01-01T930 can parse as 09:03 instead of being rejected.
  • A comparison group larger than CONFLICT_DETECT_MAX_RELATIONSHIPS is 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_relationships backends 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_relationships fallback loads the whole graph before sorting and applying the cap.