Skip to main content

Bayesian memory designed for feedback-driven learning

Project description

aelfrice

Bayesian memory designed for feedback-driven learning. Today: knowledge store with Bayesian priors. Coming in v0.4.0: the feedback loop that teaches the store.

⚠️ Status: under active rebuild — do not depend on this for production. The first installable release is v1.0.0; until then, modules land milestone-by-milestone. The previous codebase (v2.0) is preserved at aelfrice-v0 (archived, read-only).

Why aelfrice

LLM agents repeatedly forget what they learned. Vector-RAG remembers documents but doesn't remember outcomes: which retrievals helped, which hurt, which were corrected. aelfrice is being built as a small, local, SQLite-backed memory that will:

  • Keep each belief's confidence as a Beta-Bernoulli posterior (α/(α+β)), so confidence updates are mathematically grounded, not vibes.
  • Treat every retrieval as a feedback opportunity: apply_feedback(belief_id, used|harmful) will update posteriors, propagate valence through the belief graph, and record the event for audit.
  • Let you lock beliefs you trust as ground truth. Lock floor short-circuits decay. Contradicting feedback against a locked belief accumulates demotion_pressure; cross a threshold and the lock auto-demotes.
  • Stay local. Pure stdlib SQLite. No vector DB, no embeddings, no cloud sync. Local-only is a feature.

The central claim — that a memory which actually applies feedback outperforms one that doesn't — will be testable end-to-end at v1.0.0.

v1.0.0 milestone roadmap

The rebuild is structured as a sequence of small, atomic milestones.

Milestone Status What lands
v0.1.0 shipped models.py + config.py + store.py (SQLite WAL + FTS5 + CRUD + broker-attenuated propagate_valence + demotion_pressure read/write)
v0.2.0 shipped scoring.py (Beta-Bernoulli posterior mean, type-specific decay with lock-floor short-circuit, basic relevance combiner) + tests for Bayesian inertia, decay-required, and lock-floor sharpness
v0.3.0 next retrieval.py — locked beliefs auto-load + FTS5 keyword search with BM25. Token-budgeted output. No HRR, no BFS multi-hop, no entity-index in v1.0.
v0.4.0 planned feedback.py — the central new endpoint (apply_feedback, feedback_history table, demotion-pressure-acted-on) + correction.py
v0.5.0 planned scanner.py — onboarding with filesystem walk, git log, simple AST extractors
v0.6.0 planned cli.py (8 commands) + mcp_server.py (8 MCP tools) + slash_commands/
v0.7.0 planned setup.py — Claude Code wiring (UserPromptSubmit hook for retrieval injection)
v0.8.0 planned docs, CHANGELOG.md, LICENSE (MIT), final pyproject.toml
v0.9.0-rc planned minimal benchmark harness producing a publishable score
v1.0.0 planned tag, push, PyPI publish

After v1.0.0, the v1.x series recovers v2.0 features incrementally with evidence justifying each addition.

What works today (v0.2.0)

  • SQLite-backed Belief and Edge storage with WAL journaling and FTS5 search
  • Beta-Bernoulli confidence math; per-type half-life decay
  • Lock floor (a user-locked belief does not decay)
  • Broker-confidence-attenuated valence propagation through the belief graph
  • 24 tests, including 3 pre-registered property tests (Bayesian inertia, decay necessity, lock-floor sharpness) and 7 type-half-life lockdown tests

What does NOT work yet: retrieval, the feedback endpoint, the CLI, the MCP server, onboarding, install via pip. Wait for v1.0.0 if you want to use this.

design notes

  • Clean by construction, not clean by audit. Filtering is a tripwire, not a gate.
  • apply_feedback is the central endpoint. Not an admin command, not a hook, not an undocumented path. Read+write demotion_pressure is required.
  • No HRR, no LLM, no embeddings in v1.0. Stdlib + SQLite only. Heavier machinery lands in v1.x with evidence justifying inclusion.

Contributing

Closed to outside contribution until v1.0.0 ships. Issues welcome at that point.

License

Will land at v0.8.0 (MIT planned). Until then, all rights reserved by the author.

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-0.6.0.tar.gz (125.2 kB view details)

Uploaded Source

Built Distribution

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

aelfrice-0.6.0-py3-none-any.whl (42.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for aelfrice-0.6.0.tar.gz
Algorithm Hash digest
SHA256 16f1999e5f3056ed36361df00ec7df21c312b3084ad72c8b2887c21d1fbaa2ce
MD5 c6188620799962edc5b2f4eac7aba3bc
BLAKE2b-256 57b05dbc426fdc37199f7a4c13f87eca86598f1267584f2c2d8c17c3ca05fb65

See more details on using hashes here.

Provenance

The following attestation bundles were made for aelfrice-0.6.0.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-0.6.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for aelfrice-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 06edef3cfd8b1f7fd34a83753c44951ac7dca1a2eaa08b4e38a520105becd29e
MD5 e686f5bb799f03c663e3592d378c6f8f
BLAKE2b-256 a32b2032ef21642c58d87707af9a1618d67b92dedf447a0df3f1e7442c1bde9c

See more details on using hashes here.

Provenance

The following attestation bundles were made for aelfrice-0.6.0-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