Loading
Loading
Five minutes from pip install to a working conflict-flagging loop. Every snippet below runs as-is on Python 3.10+.
The recommended shape: construct Memory once at process start, then call .for_user(...) with an authenticated identity. Never pass a value from a request body — the SDK enforces this at the validation layer.
from atlaso import Memory
m = Memory() # resolves <project-root>/.atlaso/ on first call;
# per-user file lives at users/<sha256(user_id)[:16]>/field.db
user = m.for_user("alice") # frozen handle bound to aliceDeposits are plain English. The defaults — polarity="open" and evidence_grade="anecdotal" — let you write without Field 3.0 ceremony.
result = user.add("Alice prefers oat milk in lattes")
print(result.id) # ak_… or a uuid
print(result.deposit.polarity, result.deposit.evidence_grade)
# open anecdotalRecall returns a SearchResults container with bag-level flags plus per-hit annotations.
results = user.recall("milk", limit=5)
print(results.explain()) # bag-level verdict
for r in results:
print(r.is_confident, r.content)Atlaso's defining mechanic: when two deposits with directional polarities collide in the same scope bag, every hit in that bag returns has_disagreement=True and lists its conflict_peers.
from atlaso import Scope
scope = Scope(model="gpt-5", dataset="prod-2026", env="prod") # env= satisfies the gate's
# provenance rule for narrow-negative
user.add(
"Threshold of 0.7 is optimal",
polarity="positive",
evidence_grade="observed",
scope=scope,
)
user.add(
"Threshold of 0.7 over-flags",
polarity="negative",
evidence_grade="observed",
scope=scope,
)
hits = user.recall("threshold", scope=scope)
print(hits.has_disagreement) # True
for h in hits:
print(h.has_disagreement, h.content, "peers:", h.conflict_peers)Deposits are immutable. Calling m.update(...) raises with a pointer to the right method. To change a fact, use contradict() — it atomically marks one or more existing deposits as superseded and writes a new authoritative deposit.
old = user.add("Alice prefers oat milk")
new = user.contradict(
"Alice now prefers soy milk",
contradicts=[old.id],
reason="Apr-23 conversation update",
)
print(new.deposit.id, "supersedes", old.id)By default, retract() drops a soft tombstone — the deposit becomes invisible to recall but stays in the file for audit. For GDPR / PII, pass hard_delete=True.
# Soft retract (default) — auditable
user.retract(new.deposit.id, reason="customer request 2026-05-11")
# Hard delete — irreversible, purges FTS index
user.retract(new.deposit.id, reason="GDPR erasure", hard_delete=True)health() returns the Field Maturity Index — a 0–100 geometric mean of Coverage × Precision × Resolution × Density over a rolling window.
diag = user.health(window_days=30)
print(diag.fmi, diag.coverage, diag.precision, diag.resolution, diag.density)
print(diag.explain())is_confident.atlaso subcommand.Was this page helpful?