Single-file graph memory for local AI, agents, and Python applications
Project description
liel
Git-compatible memory for AI agents.
One local file you can merge, diff, trace, and inspect.
Docs: https://hy-token.github.io/liel/
pip install liel
liel-demo
Runs fully local. No API keys required (LLM optional).
liel is a single-file graph memory layer for people using local AI agents while coding. One .liel file stores decisions, tasks, sources, files, facts, and the relationships between them, so tools can recall why decisions were made, not just what was said.
The core is a small Rust property graph engine with Python (PyO3) bindings and optional MCP tools. No server, no cloud, no daemon.
Why decisions disappear
Chat turns roll off the context window, but the graph still holds how a choice was reached. liel trace walks a shortest path so that reasoning stays visible—not just the final answer.
The name liel comes from the French lier — to connect, to bind.
Three quick demos (~30 seconds each)
Use the fixed SaaS-style memory generator (two agents diverge on the same bug/decision graph). From a checkout with liel on your PATH and Python 3.9+:
python examples/demo_memory/make_demo_files.py --force
Default output: target/demo-memory/ (base.liel, agent-a.liel, agent-b.liel, identity-rules.json).
-
Parallel merge preview (two agents, one reviewable report) — the story behind “Git-compatible working memory”:
liel merge target/demo-memory/agent-a.liel target/demo-memory/agent-b.liel \ --dry-run --identity-rules target/demo-memory/identity-rules.json \ --edge-strategy idempotent --format json
-
Diff with stable identity (what drifted between branches of memory):
liel diff target/demo-memory/base.liel target/demo-memory/agent-a.liel \ --identity-rules target/demo-memory/identity-rules.json
-
One-file inspect (portable artifact):
liel stats target/demo-memory/base.liel --format json
For VHS tapes and GIF outputs, see demos/README.md (English) or demos/README.ja.md (Japanese catalog). KPI and posting cadence for these stories live in the maintainer Phase 4 Marketing Playbook (Japanese; clone the repo to read it).
Coding memory helpers (experimental)
Optional thin wrappers in python/liel/coding_memory.py for File / Decision / bug-shaped Task nodes — see examples/coding_memory/README.md and the Python guide § Coding memory helpers. Maintainer design (Japanese): docs/internal/design/coding-memory.ja.md.
Why Local-First
- Your code stays on your machine. No API keys, no telemetry, no cloud round-trips.
- Works with any LLM. Local (Ollama, LM Studio) or cloud (Claude, GPT) — only memory stays local.
- Offline-friendly. Memory persists across sessions without network access.
- One file, no lock-in. Copy, commit, archive, and open with any tool that speaks
.liel.
LLM Setup
Use liel as project memory through MCP:
pip install "liel[mcp]"
Configure your LLM client to start the liel MCP server. In Claude Code, edit
.mcp.json in the project root like this:
{
"mcpServers": {
"liel": {
"type": "stdio",
"command": "/absolute/path/to/liel-mcp",
"args": ["--path", "/absolute/path/to/agent-memory.liel"]
}
}
}
Use the installed liel-mcp executable for command, and set --path to the
.liel file the AI should use as durable memory. For other LLM/MCP clients,
use the equivalent MCP server setting with the same command and args.
Do not put mcpServers in .claude/settings.json; that file is for Claude
Code settings such as permissions and environment variables.
For first-time setup, --path is the clearest option. If the file does not
exist yet, liel creates it on first open. Without --path, the server checks
only the startup directory: if no *.liel file exists there, it uses
./memory.liel; if one exists, it uses that file; if multiple files exist, it
prints the candidates and asks you to register the intended file with --path
instead of choosing one silently.
Then add a memory policy to the agent's project instructions. Start with the
AI memory playbook,
or use the
sample CLAUDE.md as a longer Claude
template.
Recommended LLM Memory Pattern
When using liel as project memory:
- Always check existing memory before asking the user to repeat context.
- Save only durable, high-signal information: decisions, preferences, tasks, sources, and important project facts.
- Do not store temporary reasoning, speculative notes, noisy logs, or every tool result.
- Write at meaningful checkpoints, not every turn.
- Use nodes for entities and edges for relationships.
Try It
import liel
with liel.open("agent-memory.liel") as db:
task = db.add_node(
["Task"],
description="Migrate auth from JWT to server-side sessions",
)
question = db.add_node(
["OpenQuestion"],
content="Use Redis or PostgreSQL for the session store?",
)
rejected = db.add_node(
["RejectedOption"],
option="Redis",
reason="Adds another infrastructure dependency",
)
decision = db.add_node(
["Decision"],
content="Use a PostgreSQL session table",
)
source = db.add_node(["Source"], title="Auth migration notes")
db.add_edge(task, "RAISED", question)
db.add_edge(question, "REJECTED", rejected)
db.add_edge(question, "RESOLVED_BY", decision)
db.add_edge(decision, "SUPPORTED_BY", source)
db.commit()
for node in db.neighbors(question, edge_label="RESOLVED_BY"):
print(node["content"])
Compared To Mem0 / Letta / Zep
liel is intentionally lower-level and local-first. It ships as a single .liel file with no server, no API keys, and no required vector index. Relationships are explicit edges you write and traverse, not only facts inferred from chat history.
Mem0, Letta, and Zep may be a better fit when you want a hosted service, a full agent runtime, automatic memory extraction, temporal graph intelligence, dashboards, or production-scale context assembly. liel is the smaller substrate: local coding agents and project-adjacent tools that need durable, inspectable graph memory they can copy, commit, archive, and open from Python or MCP.
The Zen of Liel
- One file, any place.
- No server, no waiting.
- Minimal dependencies, simple environments.
- Start small, stay local.
Documentation
- Why liel - what it solves and what it does not
- Quickstart - demo, Python, and MCP paths
- AI memory playbook - recommended LLM memory pattern
- Sample CLAUDE.md - Claude project-instructions template
- Architecture - system layers and the Mermaid diagram
- Python guide - API, transactions, traversal, coding memory helpers
- MCP guide - Claude and other MCP-capable tools
- Feature list - what is provided at a glance
- Reliability - commit semantics, crash recovery, repair
- Format spec - byte-level
.lielfile format - Product trade-offs - what liel does not do, and why
Status
liel is currently a Beta package. The supported contract is the Python-first API plus the single-writer, single-file reliability model. There is no semantic/vector search in core, and commit() defines crash-safe boundaries. Breaking changes before 1.0 are tracked in the changelog.
Contributing
Pull requests and issues are welcome. A good first step is to run liel-demo and note anything confusing about the output, memory model, or docs.
See CONTRIBUTING.md.
Author
Built by Hayato under hy-token, a personal namespace for small local-first tools and AI infrastructure experiments.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file liel-0.6.3.tar.gz.
File metadata
- Download URL: liel-0.6.3.tar.gz
- Upload date:
- Size: 1.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0fb08428c0a7c59f17d8aff1eb09e24ab58f5e46dfa76dbeae2836fd0891715f
|
|
| MD5 |
2ad643fe48587d63ed02de5d1cc4f8da
|
|
| BLAKE2b-256 |
062e49b2257e441c5809540a5fb09b8bff1a351d0dd0b06cf7485c01f13d3194
|
Provenance
The following attestation bundles were made for liel-0.6.3.tar.gz:
Publisher:
release-pypi.yml on hy-token/liel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
liel-0.6.3.tar.gz -
Subject digest:
0fb08428c0a7c59f17d8aff1eb09e24ab58f5e46dfa76dbeae2836fd0891715f - Sigstore transparency entry: 1438622722
- Sigstore integration time:
-
Permalink:
hy-token/liel@ceb00ca5bcc9141224bd3eddf50f88e26142167d -
Branch / Tag:
refs/tags/v0.6.3 - Owner: https://github.com/hy-token
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@ceb00ca5bcc9141224bd3eddf50f88e26142167d -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file liel-0.6.3-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: liel-0.6.3-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 381.5 kB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef98b00d49ed3f5a4a63f1511d4f0ab14ad524f810fb5ee88d53e3da335f5630
|
|
| MD5 |
42ae614a6343304c7170ca5c4d7a8e5d
|
|
| BLAKE2b-256 |
080502fccae7193de3fdce5391adb0a165ccdf2b469050b7bd417b5c66a5f2b2
|
Provenance
The following attestation bundles were made for liel-0.6.3-cp39-abi3-win_amd64.whl:
Publisher:
release-pypi.yml on hy-token/liel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
liel-0.6.3-cp39-abi3-win_amd64.whl -
Subject digest:
ef98b00d49ed3f5a4a63f1511d4f0ab14ad524f810fb5ee88d53e3da335f5630 - Sigstore transparency entry: 1438622752
- Sigstore integration time:
-
Permalink:
hy-token/liel@ceb00ca5bcc9141224bd3eddf50f88e26142167d -
Branch / Tag:
refs/tags/v0.6.3 - Owner: https://github.com/hy-token
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@ceb00ca5bcc9141224bd3eddf50f88e26142167d -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file liel-0.6.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: liel-0.6.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 524.9 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
361fb5db320d0f79a9a1c96c829d6c9197fad313839cb092db8e15fbb1cdc71d
|
|
| MD5 |
3644379dac5f32347022213b11afc91e
|
|
| BLAKE2b-256 |
e7bd0f7a1e549733c0c2f2a075600964527856d2c2d4e391796f1a4ec78a5f40
|
Provenance
The following attestation bundles were made for liel-0.6.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release-pypi.yml on hy-token/liel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
liel-0.6.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
361fb5db320d0f79a9a1c96c829d6c9197fad313839cb092db8e15fbb1cdc71d - Sigstore transparency entry: 1438622776
- Sigstore integration time:
-
Permalink:
hy-token/liel@ceb00ca5bcc9141224bd3eddf50f88e26142167d -
Branch / Tag:
refs/tags/v0.6.3 - Owner: https://github.com/hy-token
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@ceb00ca5bcc9141224bd3eddf50f88e26142167d -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file liel-0.6.3-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: liel-0.6.3-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 476.0 kB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3b571f1a8ff5c7275aed6f29932a6a13cfcdb1a7cba8ee0fb72a13f6a3cde18
|
|
| MD5 |
17f82ddaee052e3603ac1f48eb880ea0
|
|
| BLAKE2b-256 |
c6a47eba5f17a5cbce8ade1b9b658376c6116cf5e94ee8674fbe86621c4c7559
|
Provenance
The following attestation bundles were made for liel-0.6.3-cp39-abi3-macosx_11_0_arm64.whl:
Publisher:
release-pypi.yml on hy-token/liel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
liel-0.6.3-cp39-abi3-macosx_11_0_arm64.whl -
Subject digest:
e3b571f1a8ff5c7275aed6f29932a6a13cfcdb1a7cba8ee0fb72a13f6a3cde18 - Sigstore transparency entry: 1438622765
- Sigstore integration time:
-
Permalink:
hy-token/liel@ceb00ca5bcc9141224bd3eddf50f88e26142167d -
Branch / Tag:
refs/tags/v0.6.3 - Owner: https://github.com/hy-token
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@ceb00ca5bcc9141224bd3eddf50f88e26142167d -
Trigger Event:
workflow_dispatch
-
Statement type: