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 make sure you have Ollama running locally with:

ollama pull nomic-embed-text
ollama pull llama3.2

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.0.1.tar.gz (14.2 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.0.1-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ashira_memory-0.0.1.tar.gz
  • Upload date:
  • Size: 14.2 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.0.1.tar.gz
Algorithm Hash digest
SHA256 428624c18a992fdb0e7eaeda5665476afd9602c0fc969d3cc45dd3f49eea8ece
MD5 b910a5f15282d6e9048077087f549135
BLAKE2b-256 50d48aaa744091631a8c3b95041097c500b74940b21d11d284936777cd57021d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ashira_memory-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 14.4 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.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0e98376f460faaf65a962580efb16682dceb21f33bd174d7848bdba89c5071df
MD5 3bb0cf02d2fcf3993e50a61a75789fa3
BLAKE2b-256 45f0cf10c4984ece77ccbd64ce86beb491f46a5d208e55f9157b7660b9b53fc8

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