The five core operations: remember, recall, forget, search, and link.

Memory Operations

CortexDB provides five core operations for working with memory. Each operation is designed around how AI systems naturally interact with information.

remember

Store a new episode in CortexDB.

remember stores an episode durably. Once you receive an acknowledgment, the data is safe. Additional processing (entity discovery, indexing) happens asynchronously in the background.

result = client.remember(
    content="We should switch from REST to gRPC for the internal APIs.",
    tenant_id="my-app",
    metadata={"source": "slack", "author": "alice"},
)

print(result.event_id)   # Unique event ID

Key characteristics:

  • Fast writes -- no LLM on the write path
  • Content is preserved losslessly -- never rewritten
  • Idempotent when the same episode ID is provided

Batch Ingest

For high-throughput ingestion, use ingest_episode with structured episodes:

from cortexdb import IngestEpisodeRequest

episode = IngestEpisodeRequest.from_dict({
    "content": "We should switch from REST to gRPC.",
    "type": "decision",
    "source": "slack",
    "actor": "alice",
})
result = client.ingest_episode(episode)

recall

Retrieve relevant memories using natural language.

recall is the primary read operation. It finds the most relevant context matching your query.

results = client.recall(
    query="What API protocol are we using internally?",
    tenant_id="my-app",
)

print(results.context)       # Synthesized context
print(results.confidence)    # Confidence score

forget

Remove memories from recall results.

forget removes information from all read paths. The deletion is auditable and compliant.

result = client.forget(
    query="old migration notes",
    reason="Decision reversed",
    tenant_id="my-app",
)

print(f"Forgotten {result.forgotten_entities} entities, {result.forgotten_edges} edges")

Key characteristics:

  • Immediately excluded from recall and search results
  • Auditable -- every forget operation is tracked
Info

Forget is not reversible through the API. Administrators can recover forgotten memories if needed through administrative tools.

search

Search across memories and episodes with filters.

search provides filtered access to episodes when you need fine-grained control.

# Search with filters
results = client.search(
    query="authentication issues",
    source="slack",
    episode_type="message",
    time_range="7d",
    tenant_id="my-app",
)

# Search for exact terms
results = client.search(
    query="CORTEX-789",
    tenant_id="my-app",
)

link

Manually create relationships between entities.

While CortexDB automatically discovers entity relationships, link lets you explicitly declare connections that represent domain-specific knowledge.

result = client.link(
    source_entity_id="ent_payments_service",
    target_entity_id="ent_cockroachdb",
    relationship="uses",
    fact="Migration completed in PR #456",
    tenant_id="my-app",
)

Use cases for manual linking:

  • Correcting missed connections
  • Adding domain-specific relationships (e.g., "competes_with", "regulates")
  • Creating high-confidence anchors

Operation Comparison

| Operation | Write/Read | LLM Required | Use Case | |---|---|---|---| | remember | Write | No | Store new information | | recall | Read | No | Retrieve relevant context | | forget | Write | No | Remove from results | | search | Read | No | Filtered episode search | | link | Write | No | Manual relationships |

Next Steps