AI Characters that live, remember and forget
Quick Start • Installation • General Idea • Knowledge Graph • Demo Projects • Introduction VideoIntroduction Video • Credits • Documentation ↗
Unlike other memory systems, Character Memory is not created for perfect recall, but to recall like a human, make bonds with users and keep track of the character's lifetime.
Like humans, in CharacterMemory, memories are recalled based on how emotionally impactful an episode was, in which location the character is, how recent is the memory and how often he recalls it.
Character Memory is both a library for developers and a ready-to-integrate tool for third party applications It provides a:
pip install charactermemory # the library
pip install 'charactermemory[server]' # + FastAPI server, WebUI and MCP endpoint
The library talks to any OpenAI-compatible /v1 endpoint for both the chat model and the embeddings server:
export OPENAI_BASE_URL="http://127.0.0.1:9999/v1"
export OPENAI_API_KEY="anything"
export OPENAI_MODEL="my-chat-model"
export OPENAI_EMBEDDINGS_BASE_URL="http://127.0.0.1:9999/v1"
export OPENAI_EMBEDDINGS_MODEL="my-embeddings-model"
A character is just a directory: Information/ lore files, Dialogues/ examples, and an optional config.yaml with persona, prompts and memory toggles.
from character_memory import CharacterAgent, LLMConfig, EmbeddingConfig, MemoryConfig
agent = CharacterAgent(directory="assets/Kurisu", name="Kurisu")
agent.load_from_config(LLMConfig(), EmbeddingConfig(), MemoryConfig())
agent.build() # load or build the memory indexes (idempotent)
chat = agent.create_chat(user="michael", title="phonewave intro")
chat.add_message("user", "Hi, I'm Michael, a nuclear engineer called in by Daru.")
for chunk in agent.generate_answer(chat, stream=True): # persisted + auto-extracted
print(chunk, end="", flush=True)
charactermemory-server # serves /context, /save, /gui and /mcp on :8000
Open http://localhost:8000/gui to create characters, browse and edit their memories and explore the knowledge graph, or point an MCP client (Claude Desktop, Cursor, …) at http://localhost:8000/mcp?character=Kurisu.
The full walkthrough of all four usage modes (full library, context-only, MCP server, HTTP API + WebUI) is in docs/getting_started.md.
Character Memory provides the following built-in memory systems (which can be enabled/disabled):
Knowledge Graph Retrieval provides an aggregation of retrieval-based memories and connects them in order to provide a more advanced retrieval. There are multiple node types:
Depending on the nodes they connect, edges can map the emotions about an event, relationship with other poeple, two events that get recalled together, the importance and how recent an event is.
At the end,
The knowledge graph requires one additional LLM call after every extraction. (And tens of LLM calls to ingest existing memories)
Still in beta, not available to the public yet.
https://github.com/user-attachments/assets/ade9442e-b19a-4a71-a275-756d935a8b47
AI Characters that live, remember and forget
Quick Start • Installation • General Idea • Knowledge Graph • Demo Projects • Introduction VideoIntroduction Video • Credits • Documentation ↗
Unlike other memory systems, Character Memory is not created for perfect recall, but to recall like a human, make bonds with users and keep track of the character's lifetime.
Like humans, in CharacterMemory, memories are recalled based on how emotionally impactful an episode was, in which location the character is, how recent is the memory and how often he recalls it.
Character Memory is both a library for developers and a ready-to-integrate tool for third party applications It provides a:
pip install charactermemory # the library
pip install 'charactermemory[server]' # + FastAPI server, WebUI and MCP endpoint
The library talks to any OpenAI-compatible /v1 endpoint for both the chat model and the embeddings server:
export OPENAI_BASE_URL="http://127.0.0.1:9999/v1"
export OPENAI_API_KEY="anything"
export OPENAI_MODEL="my-chat-model"
export OPENAI_EMBEDDINGS_BASE_URL="http://127.0.0.1:9999/v1"
export OPENAI_EMBEDDINGS_MODEL="my-embeddings-model"
A character is just a directory: Information/ lore files, Dialogues/ examples, and an optional config.yaml with persona, prompts and memory toggles.
from character_memory import CharacterAgent, LLMConfig, EmbeddingConfig, MemoryConfig
agent = CharacterAgent(directory="assets/Kurisu", name="Kurisu")
agent.load_from_config(LLMConfig(), EmbeddingConfig(), MemoryConfig())
agent.build() # load or build the memory indexes (idempotent)
chat = agent.create_chat(user="michael", title="phonewave intro")
chat.add_message("user", "Hi, I'm Michael, a nuclear engineer called in by Daru.")
for chunk in agent.generate_answer(chat, stream=True): # persisted + auto-extracted
print(chunk, end="", flush=True)
charactermemory-server # serves /context, /save, /gui and /mcp on :8000
Open http://localhost:8000/gui to create characters, browse and edit their memories and explore the knowledge graph, or point an MCP client (Claude Desktop, Cursor, …) at http://localhost:8000/mcp?character=Kurisu.
The full walkthrough of all four usage modes (full library, context-only, MCP server, HTTP API + WebUI) is in docs/getting_started.md.
Character Memory provides the following built-in memory systems (which can be enabled/disabled):
Knowledge Graph Retrieval provides an aggregation of retrieval-based memories and connects them in order to provide a more advanced retrieval. There are multiple node types:
Depending on the nodes they connect, edges can map the emotions about an event, relationship with other poeple, two events that get recalled together, the importance and how recent an event is.
At the end,
The knowledge graph requires one additional LLM call after every extraction. (And tens of LLM calls to ingest existing memories)
Still in beta, not available to the public yet.
https://github.com/user-attachments/assets/ade9442e-b19a-4a71-a275-756d935a8b47