Skip to main content

Single-file graph memory for local AI, agents, and Python applications

Project description

liel

License: MIT CI

The name comes from the French lier — to connect, to bind.

A portable external brain for local AI agents — one file, structured by relationships.

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 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

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

MIT

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

liel-0.2.12.tar.gz (137.2 kB view details)

Uploaded Source

Built Distributions

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

liel-0.2.12-cp39-abi3-win_amd64.whl (355.0 kB view details)

Uploaded CPython 3.9+Windows x86-64

liel-0.2.12-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (497.8 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

liel-0.2.12-cp39-abi3-macosx_11_0_arm64.whl (449.1 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file liel-0.2.12.tar.gz.

File metadata

  • Download URL: liel-0.2.12.tar.gz
  • Upload date:
  • Size: 137.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for liel-0.2.12.tar.gz
Algorithm Hash digest
SHA256 c75d8cc1ad9bf75915d1ac2450054190869a6a734f136c4506128e3be0a89fb9
MD5 138ec1c941a7ebee870b68e1534dd810
BLAKE2b-256 57bd922eb064f37e6543e8cc5bcb380eacb694cb4f81d570c7d7b582f5d6ddf4

See more details on using hashes here.

Provenance

The following attestation bundles were made for liel-0.2.12.tar.gz:

Publisher: release-pypi.yml on hy-token/liel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file liel-0.2.12-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: liel-0.2.12-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 355.0 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

Hashes for liel-0.2.12-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 f1426ee59c8a41862fa6978ea9778e4ca9f9c1b41235438e46d9fcc2c8355463
MD5 66a98e7eddeebf0d0a645c31c13727f2
BLAKE2b-256 4d5b65ddda5e166f96b43b7a33b7a4ac9ba6e140af45b6b15cd8c340646cdf0e

See more details on using hashes here.

Provenance

The following attestation bundles were made for liel-0.2.12-cp39-abi3-win_amd64.whl:

Publisher: release-pypi.yml on hy-token/liel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file liel-0.2.12-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for liel-0.2.12-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b77d0acbec5567d693fb2fdfae012cdb2efd03c0639e3ea3dcb6f02d8f74b7be
MD5 034c3a239bd0dcb4dc8c1ba6ebc9576d
BLAKE2b-256 6a295149f21e6b537def5ea9b2a4e0de7b487dbae1e67b1280a072b653c517ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for liel-0.2.12-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release-pypi.yml on hy-token/liel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file liel-0.2.12-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: liel-0.2.12-cp39-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 449.1 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

Hashes for liel-0.2.12-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 13099c286693397b6d26cbc88650c217bdabf2f21aa6d78ec6bd35bdfdad87a7
MD5 303e58fbe91d3cd476d411d25cfd7626
BLAKE2b-256 479604f85556f9bda0ad0cc6fcb0b1c98bb45fa8724a15edab155d7aac9514c2

See more details on using hashes here.

Provenance

The following attestation bundles were made for liel-0.2.12-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: release-pypi.yml on hy-token/liel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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