Skip to main content
The memories table stores persistent AI memory blobs that the chat agent reads before composing a response. Each row holds a single free-text memory string scoped to either a workspace (type = 'workspace') or to a specific workspace member (type = 'user'). The entity is exclusively written by the AI Memory pipeline (MemoryService) via a fire-and-forget Cloud Task dispatcher; no user-facing PATCH route exists. Uniqueness constraints guarantee at most one workspace-scoped memory per workspace and at most one user-scoped memory per membership.
Internal object. Not currently exposed on the public REST API. The operations below describe the intended contract.

API operations

Data model

Attributes

Relationships

System-computed

  • memory_id β€” generated via gen_random_uuid() on INSERT
  • created_at β€” set by MikroORM onCreate hook at INSERT time, never mutated
  • updated_at β€” set by MikroORM onCreate hook at INSERT; refreshed by onUpdate hook on every subsequent write
  • type default β€” defaults to MemoryType.USER (β€˜user’) at the entity level; column DEFAULT β€˜user’ also enforced in Postgres
  • Partial unique indexes β€” memories_workspace_unique: at most one row per workspace_pk WHERE type = β€˜workspace’; memories_membership_unique: at most one row per membership_pk WHERE type = β€˜user’ β€” enforced by MemoryRepository.upsertForWorkspace / upsertForMembership (find-or-create pattern)
  • CHECK constraint memories_type_membership_check β€” ensures type/membership_pk coherence: user rows must have membership_pk NOT NULL; workspace rows must have membership_pk NULL
  • Whole-record upsert β€” MemoryService.upsertMemory() writes the entire memory blob atomically on each LLM extraction cycle; there is no incremental append path

Example

Source: /Users/maximechampoux/platform/apps/api/src/database/entities/Memory.ts Β· domain: intelligence Β· tier: Activity