Skip to main content Switch to mobile version kristal 0.1.6 A multi-faceted memory framework for AI: pluggable memory facets on a shared multi-source substrate, unified consumption, auditable across apps.
pip install kristal==0.1.6 Copy PIP instructions
Kristal — a multi-faceted memory framework for AI: define any memory facet on a shared multi-source data substrate, consume them through one unified context layer, and audit every write and read across apps.
Status: pre-alpha. APIs will change. Prompts are currently tuned for Chinese, so generated memories are written in Chinese; an English prompt pack is planned.
Memory is not one thing. A person's timeline, relationships, preferences and habits each need their own shape, lifecycle and retrieval rules. Kristal treats memory as a crystal: every memory type is a facet, and all facets grow from the same substrate.
Multi-source substrate — raw inputs (chats, transcripts, media, app events) land as immutable items and are normalized into an observation layer that every facet reads from.
Pluggable facets — add a new memory type by implementing one model and registering it; ingestion, orchestration and consumption stay untouched.
Unified consumption — all facets converge into a single context layer that apps and agents query, with consistent permissions.
People & profiles — a shared person directory (social graph) and user profile, fed by the facets that know about them.
Auditable by design — every memory traces back to its evidence, and every read is ticketed and logged.
Cross-app by default — one user, many apps, one memory, governed by explicit authorization.
Items (raw input) ─► Observations / Segments ─► Facets (memory types) ─► Context (consumption) multi-source shared substrate pluggable unified, auditable └─► Persons & Profiles Install
pip install kristal # library, standalone (SQLite + local files), no other services needed pip install "kristal[server]" # + HTTP service (kristal serve) pip install "kristal[mem0]" # + mem0 as a memory type (docs/internals/external-memory.md) pip install "kristal[all]" # + MySQL, Redis, S3, Milvus, Langfuse, Chinese name/calendar support, mem0 Python 3.11 or 3.12.
Quickstart: as a library
Set OPENAI_API_KEY (or point OPENAI_BASE_URL at any OpenAI-compatible endpoint), then:
from kristal import Kristal with Kristal() as k: # data lives in ~/.kristal (SQLite + local files) k.add([ {"role": "user", "content": "We fixed the release plan for Friday afternoon today.", "at": "2026-11-20T09:00:00+08:00"}, {"role": "assistant", "content": "Are the two open bugs fixed by then?"}, {"role": "user", "content": "Yes, by Thursday. I'll write the release notes."}, ], user_id="alice") k.flush() # wait until the day's narrative is readable print(k.memories("alice")["memories"][0]["content"]) # the day's narrative ctx = k.context("alice", "What did Alice decide about the release?") print(k.trace("alice", ctx["sections"][0]["memories"][0]["memory_id"])["items"]) # memory → evidence flush() returns once what you wrote can be read (the day narratives); event stories, month and year rollups and profiles keep running in the background, and flush(full=True) waits for them too. Methods return plain data and raise KristalError with the same error codes as the HTTP API. Use k.app("glasses") to write and read as another app: several apps feed the same user, and each app's data stays under its own visibility and authorization rules.
To use other providers, write a kristal.toml (see examples/config/ for OpenAI, DeepSeek, Gemini, Qwen and Ollama) and pass it: Kristal("kristal.toml").
Quickstart: as a service
pip install "kristal[server]" export OPENAI_API_KEY=... export KRISTAL_ADMIN_TOKEN=$(openssl rand -hex 16) # enables the admin API kristal serve --port 8000 Register an app (the response contains its AK/SK; the SK is shown only once):
curl -s -X POST localhost:8000/admin/v1/apps -H "X-Admin-Token: $KRISTAL_ADMIN_TOKEN" \ -H 'Content-Type: application/json' \ -d '{"app_id": "notes", "name": "Notes", "owner": "me", "account_domain": "home", "trust": "first_party"}' Every request is signed with the app's AK/SK. KristalClient does this for you and has the same methods as the library:
from kristal import KristalClient c = KristalClient("http://localhost:8000", ak="...", sk="...") c.add([{"role": "user", "content": "..."}], user_id="alice") print(c.context("alice", "What did Alice decide?")) Interactive API docs are at http://localhost:8000/docs, and the built-in read-only Memory Workbench for browsing memories, social graphs, profiles and segments across apps and users is at http://localhost:8000/workbench. For local development only, KRISTAL_AUTH_MODE=relaxed skips signature checks.
Inputs and memory types
Inputs. Recordings with transcripts (media/recording.*), transcripts (conversation/transcript.*), instant messaging chats (conversation/chat.*) and assistant sessions (conversation/agent.session) are cleaned, segmented and understood; each kind has its own segmentation rules. Images and files inside messages travel with the segment as attachments. Other kinds are stored and traceable but not yet turned into memories. In the library, pick the kind with k.add(messages, user_id=..., subtype="chat.im").
Memory types. A memory type turns segments into memories. Kristal ships life_timeline (narratives of the user's days, months and years) and social_graph (user-centered interpersonal relationship graph and character memories), and can plug in open-source memory frameworks as memory types; storage and retrieval are theirs, while authorization, tracing, audit and erasure stay Kristal's (docs/internals/external-memory.md). The first adapter is mem0:
# kristal.toml; install with: pip install "kristal[mem0]" [memory_types.mem0] enabled = true # external frameworks are off by default sources = ["conversation/chat.*", "conversation/agent.session"] [memory_types.life_timeline] sources = ["conversation/transcript.*", "media/recording.*", "conversation/chat.*"] Which memory types receive a segment is the intersection of the deployment ([memory_types.
Kristal uses whatever infrastructure you configure and falls back to defaults for the rest:
Standalone (no Redis): one process. A lease in the database makes a second process refuse to start. After a restart, unfinished work is recovered from the database.
Cluster (Redis configured): any number of replicas; requires MySQL and S3. kristal worker runs background processing without serving HTTP.
Settings resolve in this order: constructor arguments → KRISTAL_* environment variables (and .env) → kristal.toml (current directory or KRISTAL_CONFIG) → defaults. See kristal.toml.template and .env.template for all settings and stage-level model routing ([models.*], [stages], [embedding], [rerank]).
Released: Dec 4, 2026
MIT View SPDX License List
Python <3.13, >=3.11
server mysql redis s3 milvus langfuse zh mem0 all dev
memory ai agent llm personal-ai context knowledge
Development Status 2 - Pre-Alpha
Intended Audience Developers
Programming Language Python :: 3
Topic Scientific/Engineering :: Artificial Intelligence
Release files for kristal 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
Built distribution (wheel)
Total release size: 1.5 MB
Release files / kristal-0.1.6.tar.gz
Release files / kristal-0.1.6-py3-none-any.whl
Security for kristal 0.1.6
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.
Release history Release notifications | RSS feed
Dec 4, 2026 2 release files No provenance
Dec 3, 2026 2 release files No provenance
Nov 26, 2026 2 release files No provenance
Nov 25, 2026 2 release files No provenance
"PyPI", "Python Package Index", and the blocks logos are registered trademarks of the Python Software Foundation.
© 2026 Python Software Foundation
Deployed from 4d99e05











