Skip to main content

Relational memory for AI characters and companions. Local-first.

Project description

ashira-memory

The memory layer for AI characters and companions. Models relationships, not just facts. Local-first. OpenAI-optional.

status license python


ashira-memory is built for one specific job: giving an AI character or companion a memory that feels personal. Not "I retrieved chunk 4 from the vector store" — "I remember you mentioned your sister last week, how is she?"

Existing memory libraries (mem0, Letta, Zep) are built for agent / dev-tool use cases. Their primitives are User → Session → Agent. None of them model a relationship between a character and a user as a first-class object.

This one does.

What you get out of the box

import asyncio
from ashira_memory import Memory

async def demo():
    mem = Memory("ashira")  # local Ollama + local SQLite. zero config.

    await mem.remember("alice", "I'm allergic to peanuts")
    await mem.remember("alice", "I love Studio Ghibli — Spirited Away is my favourite")

    hits = await mem.recall("alice", "what food should I avoid?", k=3)
    for h in hits:
        print(h.score, h.entry.text)

    # Relationship is a first-class object — the bit nobody else has
    rel = await mem.relationship("alice")
    print(f"interactions: {rel.interaction_count}, familiarity: {rel.familiarity:.2f}")

    # Track in-jokes, open promises, broken promises, shared themes
    await mem.update_relationship(
        "alice",
        callbacks=["the joke about the rubber duck"],
        open_promises=["I'll remember your birthday"],
    )

asyncio.run(demo())

That's the entire quickstart.

Why this, not mem0?

mem0 ashira-memory
Built for AI agents, dev tools AI characters, companions
Default LLM OpenAI gpt-5-mini Whatever Ollama you've got
Default embedding OpenAI text-embedding-3-small nomic-embed-text (local)
Cross-character isolation Application's problem (see #5121) Impossible by construction
Relationship as object No equivalent mem.relationship(user_id)
Hidden network calls Yes (by default) None
Lines of dependencies Big httpx. That's it.

We are not trying to beat mem0 at being mem0. We're winning a market they left.

Install

pip install ashira-memory          # core + Ollama
pip install ashira-memory[openai]  # add OpenAI provider

Then either:

# local (default)
ollama pull nomic-embed-text
ollama pull llama3.2

or:

# cloud — bring your own API key
import os
from ashira_memory import Memory
from ashira_memory.providers import OpenAIProvider

os.environ["OPENAI_API_KEY"] = "sk-..."
mem = Memory("ashira", provider=OpenAIProvider())

The mental model in 60 seconds

  • Character — the AI persona. You set this once per Memory instance.
  • User — the human. Every method takes user_id. Always.
  • Episode — one stored memory (remember, recall, forget).
  • Relationship — first-class state between (character, user): trust, familiarity, warmth, in-jokes, open promises, broken promises.

Every memory belongs to exactly one (character_id, user_id) pair. The storage layer enforces this. Two characters sharing one database cannot see each other's memories, no matter what your application code does.

API surface

12 methods. The whole library:

# storing
await mem.remember(user_id, text, *, importance=0.5, tags=None, emotional=None)
await mem.remember_turn(user_id, user_msg, character_msg)
await mem.forget(memory_id)

# recalling
await mem.recall(user_id, query, k=5)
await mem.recent(user_id, k=10)

# relationship — the wedge
await mem.relationship(user_id)
await mem.update_relationship(user_id, trust=..., callbacks=..., open_promises=...)

# maintenance
await mem.consolidate(user_id)
await mem.export(user_id)

That's it. If you're reaching for something that's not here, open an issue.

Status

Alpha. The API is stable enough to build against; expect minor breaking changes through 0.1.x. Tests pass on Python 3.10–3.12.

License

Apache-2.0.

Roadmap

  • 0.1 — OpenAI provider, Postgres/pgvector adapter
  • 0.2 — synthesis (cross-memory reflections), dream-style consolidation
  • 0.3RelMemBench public benchmark + scorecards against mem0/Letta/Zep
  • 0.4 — agent skills for Claude Code / Cursor / Codex

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ashira_memory-0.1.0.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ashira_memory-0.1.0-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file ashira_memory-0.1.0.tar.gz.

File metadata

  • Download URL: ashira_memory-0.1.0.tar.gz
  • Upload date:
  • Size: 17.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for ashira_memory-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7595f36d8ebd23cb331e7189c9f72c0bdc443b67e21529e216ad77ea726e3e1e
MD5 5c9b8f6c1822b0e1babba74fe8d421b2
BLAKE2b-256 8ac6a7c66f95c88ce6d22feef4421ac617853c6218e346532561d3c070e4e9c7

See more details on using hashes here.

File details

Details for the file ashira_memory-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ashira_memory-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for ashira_memory-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8643ee6e1b4b11971e9a525707db2d585ec257ddd35576f0cb92688b0106724c
MD5 f3ec41f1b797adbb0894a32b685d7e48
BLAKE2b-256 57e5e73e68697c001174c7a6ebc61ca9d8553e69bea6862aa8ff84d5f6054f38

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page