Skip to main content

Store & Organize

Full memory lifecycle in one call — store, enrich, link, and cluster.

Overview

Store and organize combines the entire memory lifecycle into a single API call. Instead of storing a memory and then separately enriching, linking, and clustering it, this endpoint handles the full pipeline and returns per-stage feedback.

This is the recommended way to store memories when you want full enrichment without managing multiple API calls.

Pipeline Stages

  1. Store — persist the memory content and metadata
  2. Enrich — extract tags, facts, entities, and embeddings
  3. Link — create relationships to related existing memories
  4. Cluster — assign the memory to relevant clusters

Each stage runs sequentially, and the response includes a status for each stage so you can see exactly what happened.

API Endpoint

Request
POST /v1/memories/store-organize

{
  "content": "Kubernetes pods should have resource limits set",
  "tags": ["kubernetes", "best-practices"],
  "detect_contradictions": true
}

SDK Examples

import { Trix } from '@trixdb/client';

const trix = new Trix({ apiKey: process.env.TRIX_API_KEY });

const result = await trix.memories.storeAndOrganize({
  content: 'Kubernetes pods should have resource limits set',
  tags: ['kubernetes', 'best-practices'],
  detectContradictions: true,
});

console.log(`Memory ID: ${result.memory.id}`);
console.log(`Enrichment: ${result.stages.enrich.status}`);
console.log(`Links created: ${result.stages.link.count}`);
console.log(`Cluster: ${result.stages.cluster.name}`);

if (result.contradictions?.length) {
  console.log('Contradictions found:', result.contradictions);
}

Contradiction Detection

When detect_contradictions is enabled, the pipeline checks whether the new memory contradicts existing memories. Contradictions are returned in the response but do not block storage — you decide how to handle them.

Contradiction detection adds a small amount of latency as it requires searching existing memories for conflicting information.

Per-Stage Feedback

The response includes a stages object with the status of each pipeline stage. Possible statuses are completed, skipped, or failed. If a stage fails, subsequent stages still run.