Elephantasm

Subjective Agent Identity & Memory

An AI agent today is brilliant and amnesiac — every conversation starts from zero. Elephantasm is an open-source framework that gives an agent a continuous inner life: it remembers what happened, distils those memories into knowledge, and over time forms a stable identity of its own. Not a vector store bolted on for recall — a living cognitive substrate, built on deterministic, auditable processes you can inspect.

It remembers

Every interaction is captured and distilled — not stored verbatim, but understood and given weight.

It learns

Memories harden into knowledge: the facts, methods, and preferences an agent carries from one task to the next.

It becomes

Accumulated knowledge crystallises into a stable identity — a voice, a perspective, a sense of self that persists.

An auditable cognitive substrate.

Four layers. Four factors. Two methods. Everything in between is automatic, deterministic, and inspectable end-to-end.

Event. Memory. Knowledge. Identity.

Four layers, each a higher level of abstraction and stability. Raw interaction signals are captured as events. Events are synthesised by an LLM into structured memories. Memories are distilled into canonicalised knowledge — facts, concepts, methods, principles, and experiences. Over time, accumulated knowledge crystallises into emergent identity: personality, communication style, and self-awareness.

Beyond Similarity

Retrieval isn't just cosine distance. Every memory is scored across four independent factors: importance, confidence, recency, and decay — combined with semantic similarity into a weighted composite score. A critical memory from last week outranks a tangentially similar one from yesterday. Frequently recalled memories resist decay through spaced repetition, effectively becoming permanent.

Sleep. Dream. Refine.

Autonomous memory curation inspired by sleep-based consolidation. Light Sleep runs fast, deterministic passes — updating decay scores, transitioning memory states, detecting merge candidates via pgVector similarity. Deep Sleep brings in the LLM — evaluating merges through the lens of the agent's identity, reviewing flagged memories, splitting conflated concepts. Every action logged with full before-and-after snapshots. Nothing is truly destroyed.

ingest( ). inject( ).

Two SDK methods cover the entire surface. Record interactions with ingest. Retrieve assembled context with inject. Everything between — accumulation scoring, threshold-gated synthesis, knowledge extraction, autonomous curation, four-layer pack compilation with token budgeting — happens automatically. Python and TypeScript SDKs. Plug into LangChain, CrewAI, or any custom agent.

Specifications

CLASSIFICATION
LTAM Framework
STATUS
Active
FRAMEWORK
FastAPI (async)
LANGUAGE
Python
DATABASE
PostgreSQL
VECTOR ENGINE
pgVector · 1536-dim
EMBEDDINGS
OpenAI text-embedding-3-small
LLM
Anthropic Claude
ORCHESTRATION
LangGraph
SDKs
Python · TypeScript
LICENSE
MIT

Frequently Asked Questions

Is Elephantasm open source?

Yes. Elephantasm is an open-source framework released under the MIT license, with source available at github.com/hejijunhao/elephantasm-core.

What language is Elephantasm written in?

Elephantasm is written in Python on the async FastAPI framework, and stores memory in PostgreSQL using the pgVector extension with 1536-dimension embeddings.

How is Elephantasm different from a vector database?

Elephantasm is a cognitive substrate rather than a vector store: beyond similarity search it scores every memory across importance, confidence, recency, and decay, and organises data across four layers — event, memory, knowledge, and identity.

Does Elephantasm integrate with LangChain or CrewAI?

Yes. Elephantasm ships Python and TypeScript SDKs and plugs into LangChain, CrewAI, or any custom agent through two methods, ingest and inject.

What problem does Elephantasm solve?

Elephantasm gives an AI agent persistent identity and memory so it does not start every conversation from zero; it remembers interactions, distils them into knowledge, and forms a stable identity over time.

Is Elephantasm production-ready?

Elephantasm is listed with Active status and is built on deterministic, auditable processes; every curation action is logged with full before-and-after snapshots, and nothing is truly destroyed.