Persistent memory for AI agents. Set up once. Stays out of your way. Local SQLite, auditable, no GPU, no network.
Project description
aelfrice
Persistent memory for AI agents. Set up once. Stays out of your way.
Local SQLite. Auditable. No GPU, no network.
You correct your agent. "Got it," it says. Next session, same mistake.
aelfrice runs in the background and stops the forgetting. You write a rule once and it gets attached to every prompt thereafter — no cross-references for the agent to skip, no markdown files to maintain, nothing to remember to do.
pip install aelfrice
aelf onboard .
aelf lock "never push directly to main; use scripts/publish.sh"
aelf setup # wire the hook into Claude Code
That's it. Restart Claude Code and your next prompt that mentions "push" already has the rule attached. From here on out aelfrice is invisible — no command to remember to run, no file to keep updated.
What it does
When you submit a prompt in Claude Code, aelfrice's UserPromptSubmit hook fires before the model sees your message. It runs a two-layer search:
L0: locked beliefs -> rules you marked permanent (always returned)
L1: FTS5 keyword -> SQLite full-text search, BM25-ranked
The matching beliefs come back as an <aelfrice-memory> block prepended to your prompt. The agent reads it as part of the prompt — it doesn't have to remember to check a file.
<aelfrice-memory>
[locked] never push directly to main; use scripts/publish.sh
[locked] commits must be SSH-signed with ~/.ssh/id_rrs
the publish script runs gitleaks before tagging
</aelfrice-memory>
push the release
Default budget is 2,000 tokens per prompt. Locked beliefs always go first; the rest is BM25-ranked and truncated to fit.
What it remembers
| You run | It stores |
|---|---|
aelf lock "never commit .env files" |
Permanent rule. Returned on every retrieval. |
aelf onboard . |
Walks the project — git log, README headings, code structure — and ingests structural facts. |
aelf feedback <id> used |
Bayesian feedback. Strengthens the belief's posterior. |
aelf feedback <id> harmful |
Weakens it. After enough independent harmfuls, locks auto-demote. |
Each belief carries a (α, β) Beta-Bernoulli posterior. α / (α+β) is the confidence. Locks short-circuit decay; everything else fades over time so stale beliefs eventually drop out of retrieval.
aelf stats
# beliefs: 142 locked: 8 threads: 67
# feedback: 31 avg_confidence: 0.71
Why files don't solve this
The standard workaround for "agent keeps forgetting" is more files: STATE.md, DECISIONS.md, a CLAUDE.md with cross-references to runbooks. Every cross-reference is a bet that the agent will read the file, find the right section, and follow what it says.
The failure modes are predictable. The agent reads the rule and runs git push anyway. Cross-references break silently after compaction. State files rot the moment you forget to update them. Each new failure mode begets another file.
aelfrice replaces the chain with a mechanism. The hook injects matched beliefs as part of your prompt, before the agent sees it. Nothing voluntary. Nothing the agent can skip.
| Manual approach | What breaks | aelfrice |
|---|---|---|
| Rules in CLAUDE.md | Agent reads them, doesn't follow them | Injected per-prompt, not per-session |
| Cross-references | Agent skips or reads the wrong section | Matched beliefs injected directly |
| Hand-maintained state files | One missed update breaks the chain | State is the SQLite DB; no manual sync |
Determinism
Same store + same query gives the same beliefs. The retrieval path is stdlib + SQLite — no embeddings, no learned re-rankers, no LLM — so every result traces back to a specific belief and the user action that wrote it.
Tradeoff: no fuzzy semantic recall. See PHILOSOPHY.md.
Your data stays yours
- 100% local. SQLite at
<repo>/.git/aelfrice/memory.db. No network calls in the retrieval path. - No telemetry. No accounts, no signup, no phone-home.
- No GPU, no vector DB. Stdlib + SQLite. The optional
[mcp]extra addsfastmcp. That's it. - Per-project isolation. Beliefs from project A cannot leak into project B (they live in different
.git/directories). - Removable.
aelf uninstall --archive backup.aencencrypts the DB to a file, then deletes it. Or--purgefor a full wipe.
docs/PRIVACY.md for verifiable specifics.
Day-to-day surface
After aelf setup you should rarely type aelf again. The day-to-day commands are six:
aelf onboard . # once per project — scan and ingest
aelf lock "never push to main" # add a permanent rule
aelf locked # see what rules are active
aelf search "push to main" # check what the agent will see
aelf status # quick health summary
aelf setup / aelf doctor # initial install + verification
Everything else (deeper diagnostics, archive/uninstall, migration tools, hook entry-points called by Claude Code itself) is callable but not something you reach for in normal use. aelf --help shows the everyday surface; aelf --help --advanced lists the rest. Full reference: COMMANDS.
The same operations are also available as MCP tools and /aelf:* slash commands — same library underneath. See MCP and SLASH_COMMANDS.
Roadmap
| Version | Status | Theme |
|---|---|---|
| v1.0.x | shipped | core memory, CLI, MCP, hook wiring, install routing |
| v1.1.0 | shipped | per-project DBs (.git/aelfrice/), aelf migrate, edges→threads rename, aelf health rewrite |
| v1.2.0 | shipped | auto-capture pipeline (transcript-ingest, commit-ingest, SessionStart), agent_inferred → user_validated promotion, triple extractor, --batch JSONL ingest, CLI consolidation, INEDIBLE per-file opt-out |
| v1.2.x | planned | search-tool PreToolUse hook — memory-first context on Grep/Glob |
| v1.3 | shipped | retrieval wave — entity index (L2.5), BFS multi-hop (L3), LLM-Haiku onboard classifier (opt-in), partial Bayesian-weighted ranking |
| v1.4 | shipped | context rebuilder — PreCompact retrieval-curated continuation (augment mode); manual + threshold trigger; continuation-fidelity scorer (exact-match) |
| v2.0 | planned | feature parity with the original research line + benchmark reproducibility. v2.0's component issues (#148–#154) will land incrementally across v1.5+ minor versions; final v2.0 tag is the reproducibility cut. |
Per-version detail: docs/ROADMAP.md. Open issues: docs/LIMITATIONS.md.
Documentation
- Getting started: Install · Quickstart
- Reference: Commands · MCP · Slash commands · Config
- Background: Architecture · Philosophy · Privacy · Limitations
- Development: Releasing · Changelog · Contributing · Security
Citation
@software{aelfrice2026,
author = {robotrocketscience},
title = {aelfrice: deterministic Bayesian memory for AI coding agents},
year = {2026},
url = {https://github.com/robotrocketscience/aelfrice},
license = {MIT}
}
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 Distribution
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 aelfrice-1.4.0.tar.gz.
File metadata
- Download URL: aelfrice-1.4.0.tar.gz
- Upload date:
- Size: 3.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ababb12691e4fdbb16d9ada3f7da43bdceef2ffd6cba82f5b91e8db69b79118c
|
|
| MD5 |
b4f0e894024d11fcb496d011249169aa
|
|
| BLAKE2b-256 |
2686aa2c16cddbac915d9bc2f026bb0e3d8b37b4d1c30bbd918187e0cff8171e
|
Provenance
The following attestation bundles were made for aelfrice-1.4.0.tar.gz:
Publisher:
publish.yml on robotrocketscience/aelfrice
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aelfrice-1.4.0.tar.gz -
Subject digest:
ababb12691e4fdbb16d9ada3f7da43bdceef2ffd6cba82f5b91e8db69b79118c - Sigstore transparency entry: 1397419589
- Sigstore integration time:
-
Permalink:
robotrocketscience/aelfrice@ccda429e26e92d3d4dd86b9fdd582cd457646151 -
Branch / Tag:
refs/tags/v1.4.0 - Owner: https://github.com/robotrocketscience
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ccda429e26e92d3d4dd86b9fdd582cd457646151 -
Trigger Event:
push
-
Statement type:
File details
Details for the file aelfrice-1.4.0-py3-none-any.whl.
File metadata
- Download URL: aelfrice-1.4.0-py3-none-any.whl
- Upload date:
- Size: 206.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce083d91978eb25c45c5e6a9a918b630f4275d69bb4cf8dc0635479fe8c9ac64
|
|
| MD5 |
04df8c4cf33bad83670270e5915addc9
|
|
| BLAKE2b-256 |
1671edd1d970dfec04a2270bd5c974b80e3f8588fb384e196495e9f7bf69d77c
|
Provenance
The following attestation bundles were made for aelfrice-1.4.0-py3-none-any.whl:
Publisher:
publish.yml on robotrocketscience/aelfrice
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aelfrice-1.4.0-py3-none-any.whl -
Subject digest:
ce083d91978eb25c45c5e6a9a918b630f4275d69bb4cf8dc0635479fe8c9ac64 - Sigstore transparency entry: 1397419597
- Sigstore integration time:
-
Permalink:
robotrocketscience/aelfrice@ccda429e26e92d3d4dd86b9fdd582cd457646151 -
Branch / Tag:
refs/tags/v1.4.0 - Owner: https://github.com/robotrocketscience
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ccda429e26e92d3d4dd86b9fdd582cd457646151 -
Trigger Event:
push
-
Statement type: