Skip to content

Concepts

This page explains the objects Spongram manipulates and how they relate. The glossary gives short definitions; the pages linked below go into the mechanisms.

Brain

A brain (called an instance in the admin UI and the API) is one user's memory: a row in PostgreSQL and a partition of the knowledge graph. Each brain has a group_id, and every node and edge it owns in Neo4j carries that group_id. Nothing is shared between two brains.

A client proves which brain it speaks for with a brain key, a secret that starts with spt_brain_. The server stores only its SHA-256 hash, so the clear value is shown once, when the brain is created or the key is regenerated. The server derives the group_id from the key on every call; a client never chooses it. See the security model.

Episode, entity, fact

Memory enters as an episode: a short, self-contained piece of text with a name and a source_description. An agent writes one with the add_memory tool.

From each episode, the extraction engine (Graphiti) derives:

  • entities: the things the text talks about (a person, a project, a tool, a decision), stored as nodes with a summary and an embedding;
  • facts: dated relations between two entities, stored as edges. A fact has a validity window. When a later episode contradicts it, the fact is marked invalid instead of being deleted, so history is kept and searches hide it by default.

Extraction is asynchronous. add_memory answers as soon as the episode is safely queued; entities and facts appear a little later. The ingestion page describes the queue and its guarantees.

Project, global, scope

Every episode is tagged in its source_description with project=<slug>, and usually with repo=, branch= and client=. Two values are special:

  • project=global marks what applies everywhere: personal preferences, working rules, cross-cutting decisions;
  • project=desktop-inbox receives untagged memories from non-coding clients when topic scoping is enabled.

A search can pass a scope. With scope.project, the server keeps that project, global, the active persona and untagged memories, and drops other projects. scope.all searches everything. See tagging and scope and project aliases.

Agents read memory with search_nodes (entities) and search_memory_facts (facts). The server oversamples, filters by scope, reranks, hides invalidated facts and truncates to the size the client asked for. Results are cached for a short time. See search.

Background workers

Two workers run inside the spongram service:

  • the Sleeper runs every few minutes and writes summaries of entities whose episodes changed;
  • the Dream runs every few hours and consolidates: it computes a confidence for each fact from the number of distinct projects that support it, and flags probable duplicate entities.

See Sleeper and Dream.

Personas and skills

A persona is a named voice and set of rules that an agent can adopt for a brain, with optional persona skills. One persona at most is active per brain, and only the agent activates it, through a tool. Separately, an agent can record a reusable procedure as a skill and recall it later. See personas and the persona marketplace.

Code map

The code map is a second graph in the same brain: a structural map of a repository extracted from its syntax tree, with no LLM involved. Agents query it with the code_map_* tools. See code map.

Explorers

Each brain can be browsed in a web page: the Cortex (a 3D view of the graph), the Wiki (entities as pages), the code map and the personas library. See Cortex and Wiki.

Clients and bundles

A client is anything that speaks MCP over streamable HTTP. For Claude Code and Claude Desktop, the admin UI generates a ready-to-install bundle that already contains the server URL; Codex is connected by registering the MCP server with a command. The Claude Code plugin adds hooks that recall context at session start and capture memory at compaction and session end. See the client guides.

Inference

Extraction, summaries and embeddings need a language model and an embedding model. Spongram calls one OpenAI-compatible endpoint that you configure, through a single internal proxy. The embedding dimension (1024 by default) is fixed for the life of a brain: changing the embedding model means purging and re-ingesting. See inference providers.