Nirmos
Memory

Memory lifecycle

Handle revisions, derived state, partial indexing, replay, and erasure.

Stored facts can be reinforced, merged, superseded, expired or deleted. Inspect operation counters and indexing outcomes separately; successful persistence does not guarantee a searchable embedding.

Reconciliation and derived state

Repeated facts reinforce; complementary details may merge; newer conflicting truth supersedes with lineage; irrelevant candidates are ignored. Exact matches avoid a reconciliation model call. Used policy revisions are immutable. Create a new version under the same policyKey, activate it, and repoint the space. Duplicate organization-local space keys or policy key/version identities return 409.

Profiles/observations are generated explicitly. Profile source changes, deletion or expiry can make a profile unavailable/stale; regenerate it before relying on it. Item PATCH changes administrative fields, not semantic content. Use manual items.create for corrections with evidence/reconciliation. Inspect evidence, relations, entities and embedding generations through the item methods.

Failure diagnosis and safe replay

APIError includes code, status, retryable, retryAfterMs, requestId, traceId and sanitized details. Configuration failures such as NO_CREDENTIALS and unavailable models need setup; validation errors need a corrected request; quota/rate-limit failures need provider recovery or Retry-After; timeouts and outages are separate categories. No credentials or raw upstream bodies are public. Memory runs expose diagnosticReference and safe diagnostics with stage, run ID, gateway request ID, parent request/trace IDs and provider status/code when available. Use gateway logs for the correlated request; spans are not guaranteed to exist.

SDK transport retries and internal gateway retries are separate. Memory model calls disable gateway retries and extra LLM healing calls; deterministic failures are not blindly retried. SDK transport honors nested HTTP error.retryable: false, including quota errors, before status defaults; a root-level flag is ignored. See automatic retry rules for status/method eligibility and request overrides. Search/context/generation disable SDK transport retries. For ingest/manual insertion, persist both body and event key, and reuse identical input after fixing the cause. Passing the same RequestOptions idempotencyKey enables SDK replay eligibility; this example sets maxRetries: 0 for explicit control. A completed run replays without extraction; index-only partial recovery reuses committed candidates. Other failed stages can require extraction again because privacy settings do not retain full candidate content. Retry does not create another event identity. Changed content under an existing source identity returns a conflict. An event created under another attached policy revision returns MEMORY_EVENT_POLICY_CONFLICT; restore its original revision to resume it. Source occurrence time stays fixed across retries.

Deletion and erasure

items.delete tombstones a fact and invalidates derived state. spaces.delete blocks execution; memory.erase physically cleans a tombstoned space. Cleanup failures retain external vector addresses for safe retry. The example only cleans its disposable resources when MEMORY_CLEANUP=1 is explicitly set.

See generated Memory methods, Memory types, and error handling. The authenticated runtime contract is GET /v1/memory/openapi.json; management schemas come from API OpenAPI.

Model requirements

Extraction, semantic reconciliation and relevance require a chat model capable of producing the requested nested JSON structure. Credential availability is not proof of that capability or upstream quota. Configure extraction and reconciliation models explicitly in the policy. Indexing separately requires an embedding model, a supported dimension count and configured managed/BYO Qdrant infrastructure.

Policy retention/decay configuration does not imply an autonomous background cleanup or decay algorithm. The lifecycle example demonstrates explicit operations on disposable resources.

Correction and historical validity

Canonical keys are matching hints, not proof that two statements conflict. The reconciliation model compares policy-safe evidence and existing facts within a bounded related set. Compatible contexts can coexist, such as email newsletters and urgent messaging notifications.

Invalid comparison decisions return MEMORY_INVALID_DECISION with RECONCILIATION_COMPARISON_INVALID. Malformed candidate data returns MEMORY_MODEL_OUTPUT_INVALID; inspect its diagnostic stage rather than interpreting it as a provider outage. No automatic output-repair call is made.

Supersession commits replacement facts and closes prior validity together. Current retrieval checks canonical records, so stale vector payloads cannot reactivate a superseded fact. Explicit historical validAt retrieval can select an earlier interval. Indexing failure does not undo committed truth; repair the partial index explicitly.

On this page