Nirmos
Memory

Store and ingest memories

Submit new evidence under an active policy and inspect admission outcomes.

Create a policy and space once, using memory:create. The policy selects capture types, privacy/retention rules and extraction/indexing models. An empty captureTypes array disables capture. A space attaches an active policy and an application-chosen identity inside the organization.

Submit new evidence

Use memory:ingest and preserve the event's body and identity before submission:

import type { MemoryIngestRequest } from "@nirmos/sdk";
const input: MemoryIngestRequest = {
  memorySpaceId: "space-id", idempotencyKey: "persisted-source-event-id",
  messages: [{ id: "message-1", role: "user", content: "Please send important notifications by email." }],
};
const result = await nirmos.memory.ingest(input, { maxRetries: 0 });
console.log(result.memoryRunId, result.acceptedCount, result.indexing);

Submit 1-32 new messages/events. Use context only to resolve references; context-only facts are not new evidence. Ingestion can accept zero candidates. memory.items.create submits a manual memory through admission and reconciliation; it does not guarantee insertion.

Admission and partial success

A useful memory helps a later interaction with this user or project: preferences, project facts, decisions, constraints, commitments and meaningful events. Generic facts, one-off arithmetic, greetings and assistant advice are not user facts. Extraction uses all languages; cited excerpts must exactly match source evidence. Assistant statements need confirming user evidence. Thresholds do not replace these rules and inflated model scores cannot bypass deterministic admission.

captureTypes, allowInferredMemories, minimumConfidence, minimumFutureUtility, privacy and retention are enforced together. Extraction quality remains model-dependent; evaluate on representative conversations. Temporary states need bounded validity/expiry or a policy TTL. Expiry uses the earliest explicit expiry, validity end or source-relative policy TTL. Temporary durability is capped. Expired, deleted and inactive facts are filtered by default.

Both memory.ingest and memory.items.create return replayed: false when this request processes the operation, and replayed: true for a completed replay. Completed replays retain the original run ID, memory IDs and operation counters (including insertedCount). The counters describe the original operation; they are not new writes by the replaying HTTP request. indexing describes this request, so a completed replay returns zero indexed/failed and performs no model/index work. Changed content under the same idempotency key returns a conflict.

Inspect accepted/rejected and reconciliation counters plus indexing separately. A run may persist accepted facts but leave failed embeddings. Fix the dependency, then invoke bounded memory.reindex({memorySpaceId, memoryIds}); do not ingest a new event just to repair an index.

Use the assistant recipe for minimal setup and the lifecycle example for a complete policy-to-profile flow. Lifecycle owns failure recovery and reindexing.

On this page