{
  "id": 4180573,
  "title": "Why I Put Swarm Memory in PostgreSQL Instead of Zep",
  "url": "https://urgent.news/2026/08/29/why-i-put-swarm-memory-in-postgresql-instead-of-zep",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-08-29T11:35:10.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/kingsleyonoh/why-i-put-swarm-memory-in-postgresql-instead-of-zep-e61"
  },
  "original_language": "en",
  "account": "The project allocated roughly 30,000 to 40,000 credits per simulation for memory usage. Daily runs would turn memory retrieval into a recurring external dependency before the gateway had served its first reader. To resolve this issue, the memory layer was moved into PostgreSQL 16 with pgvector. The upstream checkout still utilized its configured graph provider while constructing a graph. However, the boundary was now closer and more defensible: once MiroFish returned graph data and action logs, the gateway owned the persisted copy and every read against it. The gateway had three read patterns: retrieving entities by type, walking a bounded neighborhood, and searching agent episodes by meaning. These patterns were met by adding graph nodes, graph edges, and episodes to the existing PostgreSQL database. pgvector facilitated semantic queries without introducing another network call. The tenant rule was made explicit, with tenantId and simulationId included in the graph tables and unique constraints preventing duplicate records within a simulation. The schema consisted of one store and two kinds of memory: graph entities and agent episodes. Graph entities mirrored named entities from the MiroFish graph, while agent episodes stored actions produced during simulation rounds. The embedding width was set to 384 dimensions, matching the output of the local Xenova/all-MiniLM-L6-v2 model. The embedding extractor was initialized lazily and shared through a single promise to avoid loading the ONNX model for non-semantic search requests and prevent concurrent model loads. The query function, which carries the security contract, performed semantic retrieval using cosine similarity, with tenantId and simulationId as predicates and an optional agent filter.",
  "summary": "A completed simulation left me with a report and an ownership problem. MiroFish had built the graph, generated the agents, and run their interactions, but the useful memory still lived behind somebody else's service boundary. The gateway could display the final answer. It couldn't reliably ask its own questions of the evidence that produced it. That distinction mattered because running a swarm…",
  "key_points": [
    "30,000 to 40,000 credits allocated per simulation for memory usage",
    "Memory layer moved into PostgreSQL 16 with pgvector",
    "Three read patterns: entities by type, neighborhood walks, and episodes by meaning"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}