Skip to main content

Bayesian memory for LLM agents — local, SQLite-backed, feedback-driven.

Project description

A figure of shimmering cloud rising from a dark sea, weaving threads of light into a constellation of beliefs

aelfrice

Bayesian memory for AI coding agents. Local-only. Auditable.

PyPI Python License CI Staging Gate Downloads

[!NOTE] v1.0 ships the surface — local SQLite store, retrieval, the apply_feedback endpoint, the onboarding scanner, an 11-command CLI, an MCP server, Claude Code wiring, and a reproducible benchmark harness. Retrieval ranking is BM25-only at v1.0 — feedback updates the math but doesn't yet move ranking. The v1.x line wires posterior into ranking and closes known issues.

You had a doc with the conversation. You re-explained your stack last session. You wrote a runbook the agent didn't read. The notes you keep adding don't actually keep your agent from forgetting — they just give you more to maintain.

aelfrice is a small SQLite-backed memory that the agent can't skip. Lock the rules you don't want forgotten. Onboard a project once. Every prompt thereafter gets the relevant slice injected before the agent answers.

No GPU. No network. No telemetry. No cloud.
SQLite at ~/.aelfrice/memory.db. That's the whole runtime.

Every retrieval result is traceable to the beliefs and rules that produced it. Every state of the system is reproducible from its write log. We are not aware of another agent-memory system that combines bit-level reproducibility, named-rule traceability, write-log historical reconstruction, and audit comprehensible to a non-technical reviewer as a single system property. See PHILOSOPHY § Determinism is the property.

60 seconds

$ pip install aelfrice
$ aelf onboard .
$ aelf lock "Never push directly to main; use scripts/publish.sh"
$ aelf setup        # wires the UserPromptSubmit hook into Claude Code

Same operations are available as MCP tools and Claude Code slash commands. Full demo: docs/QUICKSTART.md.

Roadmap

Status
v0.1 – v1.0 shipped core memory, CLI, MCP, hook wiring, synthetic benchmark, PyPI publish
v1.0.1 next launch fix-up — hook→retrieval wiring, onboard noise, aelf --version
v1.1.0 planned project identity (.git/aelfrice/, .aelfrice.toml), edges→threads, status/health split
v1.2.0 planned commit-ingest hook, seed files, triple-extraction port
v1.3 planned retrieval wave — entity index + BFS multi-hop + LLM classification
v2.0 planned feature parity with the earlier research line + full benchmark reproducibility

Per-version detail with deliverables, recovery inventory, and structural-fix rationale: docs/ROADMAP.md. Per-issue tracking: docs/LIMITATIONS.md.

Install

pip install aelfrice                # core (zero runtime deps)
pip install "aelfrice[mcp]"         # add MCP server
pip install "aelfrice[archive]"     # add encrypted DB archive on uninstall
aelf --version                       # confirm install
aelf setup                           # wire hook + statusline into Claude Code
aelf health                          # confirm wiring + store init

aelf setup wires two things into ~/.claude/settings.json:

  1. The UserPromptSubmit hook (aelf-hook) which injects relevant beliefs into every Claude Code prompt.
  2. The statusline notifier (aelf statusline) which shows an orange ⬆ aelfrice X.Y.Z available, run: aelf upgrade banner only when an update is pending. When you're up to date the banner is empty and your statusline looks unchanged.

If you already have a custom statusLine configured, aelf setup composes its snippet onto the end of your command (preserving your bar). If your existing command uses pipes, here-docs, &&, backticks, or backslashes it's left untouched and you get a one-line hint about manual composition.

--no-statusline opts out of the auto-wire if you want hook-only.

docs/INSTALL.md covers Codex wiring, generic MCP hosts, and troubleshooting.

Upgrade

aelf upgrade           # prints the right pip-upgrade line for your env
aelf upgrade --check   # yes/no, no command line printed

aelf upgrade detects venv vs pipx vs system and tells you the exact line. It does not execute pip itself: replacing the running package mid-process is unreliable on Windows and can leave a broken interpreter. You run the line.

When an update is available the output also includes the published wheel SHA-256 plus the PyPI release URL so you can hash-pin the install if you want.

The orange statusline banner appears automatically when an update is pending and disappears once you're up to date — no manual refresh needed.

Opt out of the update notifier at any time with export AELF_NO_UPDATE_CHECK=1.

Uninstall

aelfrice has an explicit teardown command. You must pick exactly one disposition for the brain-graph DB:

aelf uninstall --keep-db       # leave ~/.aelfrice/memory.db alone (safe)
aelf uninstall --archive ~/aelf-backup.aenc   # encrypt then delete
aelf uninstall --purge         # permanently delete (redundant gates fire)
pip uninstall aelfrice         # finally, remove the wheel

Verify removal:

aelf --version 2>&1 | grep -q "aelfrice" || echo "removed"

Details:

  • --keep-db — DB preserved. Default also runs unsetup (removes hook + statusline). Pass --keep-hook to keep those too.
  • --archive PATH — DB encrypted (AES-128-CBC + HMAC via Fernet, scrypt-derived key) to PATH, then original deleted. Password is read interactively (twice, must match) or via --password-stdin. Recover later with python -c "from aelfrice.lifecycle import decrypt_archive; open('out.db','wb').write(decrypt_archive('PATH','pw'))". Requires pip install 'aelfrice[archive]'.
  • --purge — Permanently deletes the DB. Three gates fire before deletion: (1) the flag must be passed explicitly, (2) you must type PURGE verbatim, (3) a final [y/N] confirmation. --yes skips the prompts but does not auto-pass --purge.

docs/INSTALL.md has the full uninstall reference including archive-recovery details.

Docs

QUICKSTART · COMMANDS · MCP · SLASH_COMMANDS · ARCHITECTURE · PHILOSOPHY · PRIVACY · LIMITATIONS · CHANGELOG

CONTRIBUTING · SECURITY · CITATION · 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

aelfrice-1.0.1.tar.gz (1.5 MB view details)

Uploaded Source

Built Distribution

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

aelfrice-1.0.1-py3-none-any.whl (86.7 kB view details)

Uploaded Python 3

File details

Details for the file aelfrice-1.0.1.tar.gz.

File metadata

  • Download URL: aelfrice-1.0.1.tar.gz
  • Upload date:
  • Size: 1.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for aelfrice-1.0.1.tar.gz
Algorithm Hash digest
SHA256 136b65c992b02adfef4f1ed3d0b9780df9ad77f0a4552a8af2b5d7996102c823
MD5 2808ddb03f865bc9f2fb5d651c7173ed
BLAKE2b-256 2927705ba278770eee639c6f70e8780986c801d0a94046a57e0ad8113120f379

See more details on using hashes here.

Provenance

The following attestation bundles were made for aelfrice-1.0.1.tar.gz:

Publisher: publish.yml on robotrocketscience/aelfrice

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

File details

Details for the file aelfrice-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: aelfrice-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 86.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for aelfrice-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 660d635d7c91dc7238f315369177026387f5a45eb2d93b55eedc6a01aa8738d3
MD5 e4f4bfcbe06c962e632404a17b68fb2e
BLAKE2b-256 69098e57c6fdd88eb56927b6dc8ba47220bb72a99f697d5a17861295b4779173

See more details on using hashes here.

Provenance

The following attestation bundles were made for aelfrice-1.0.1-py3-none-any.whl:

Publisher: publish.yml on robotrocketscience/aelfrice

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