Source-backed memory for persistent AI agents
0.2 Alpha · Quick start · Architecture · API cost · Benchmarks · Amadeus · 中文
A desktop companion needs to remember across sessions, use the right evidence when asked, and respect a later correction or withdrawal. Eidema is the embedded Python memory runtime developed for Amadeus. It keeps the durable memory state in SQLite and lets the host choose its own models and decide when memory belongs in a reply.
- A memory lifecycle. Save, inspect, correct and forget scoped notes. Independent saves can outlive the chat they came from. Source-dependent notes remain usable only while their required sources and grants are valid.
- Recall with evidence. Find saved notes or permitted original messages using SQLite FTS5 and an optional semantic embedder. Deliver a bounded set of current source versions with speaker and time metadata where the host has it.
- Versioned use. Register the exact memory, source and prior-output versions consumed by a reply. A host can revalidate these dependencies before delivery and when building later history.
- Background formation and comparison. Feed committed source changes to bounded, restartable tasks. A host-supplied model proposes candidates and cites evidence. The host sets the schedule, usage budget, provider and adoption policy.
Use Python 3.10+ and SQLite 3.42+ with FTS5. Install the wheel from the 0.2 Alpha GitHub release. The core depends on NumPy. This example runs locally with lexical search and needs no model or API credentials.
python -m pip install "https://github.com/Code-Amadeus/Eidema/releases/download/v0.2.0-alpha.1/eidema-0.2.0a1-py3-none-any.whl"Save a note and find it after reopening the same database.
from pathlib import Path
from tempfile import TemporaryDirectory
from time import time_ns
from eidema import AccessScope, MemoryScope, MemoryStore
access = AccessScope("user-1", "companion")
scope = MemoryScope("character", "user-1", "companion")
with TemporaryDirectory() as directory:
database = Path(directory) / "memory.sqlite3"
with MemoryStore(database) as store:
store.remember(
access, scope,
operation_id="save-spare-key", item_id="note-1",
text="My spare key is in the blue cabinet.",
now_ms=time_ns() // 1_000_000,
)
with MemoryStore(database) as store:
result = store.recall(
access, "spare key", purpose="lookup",
now_ms=time_ns() // 1_000_000,
)
print(result.candidates[0].text)Use one active store owner per database. For a real application, construct
scopes from the host's authenticated user, character and optional project. Use
MemoryStore(path, embedder=...) to add semantic search and inspect retrieval
coverage before relying on it. See the note lifecycle API and
original-source retrieval API.
Eidema 0.2.0a3 uses SQLite schema 20. Start with the note lifecycle, scope, retrieval and evidence APIs. Formation, comparison and their scheduler are experimental APIs in the 0.x series. The design, experiment, progress and review directories contain dated research snapshots. See SDK tests for the supported test matrix.
The SDK assembles explicit notes and permitted originals through
LookupEngine. Applications supply their canonical
source adapter, model prompts and execution policy. Install eidema[onnx] to
use the offline CPU embedder with local files. The base package only requires
NumPy. ONNX setup.
| Component | Responsibility |
|---|---|
| Host application | Owns canonical conversations, identity, source grants, persona, clocks, and permission to deliver evidence to a model. |
| Eidema | Stores scoped notes and versioned dependencies, maintains rebuildable projections, and validates permitted evidence reads. |
| Model adapters | Supply embeddings or propose memories through separate background requests. The conversation model uses the evidence the host delivers. |
This is the memory-focused Alpha. Persona definitions stay in the host. Automatic memory use in ordinary Amadeus chat and learned persona changes remain research work. See the architecture and source map and the persistent Host example for integration.
Amadeus uses separately downloaded Jina ONNX Q4 weights under CC-BY-NC-4.0. Eidema's Apache-2.0 wheel can use lexical search or a Host-supplied embedder.
SQLite storage and local retrieval make zero API calls. The Amadeus Alpha candidate uses DeepSeek Flash Low for opt-in background formation. An earlier 32-request synthetic run covering formation and comparison reported a 70.5% input cache hit rate. At the recorded off-peak prices, that usage works out to about CN¥0.63 total, or CN¥0.02 per background request. Cost breakdown.
These measurements cover the Amadeus explicit-recall research integration
with local Jina ONNX Q4 retrieval and OpenAI GPT-6.1 Terra (none) for remote
evidence selection and answer generation.
The host sends up to eight evidence groups and permits one supplemental lookup
when it obtains new authorized evidence.
| Evaluation | Earlier configuration | Research candidate |
|---|---|---|
| LongMemEval-S, same 79-question development regression | 48/79 (60.8%) | 64/79 (81.0%) |
| LongMemEval-S, independent holdout main set | 26/38 (68.4%) | 29/38 (76.3%) |
| Amadeus synthetic development dialogue | — | 18/24 (75.0%) prior live score, preserved by replay |
For the 79-question run, each initial pack had a 1,024 research-token limit. Local lookup was 65 / 84 ms p50 / p95. The explicit remote selection stage was 1.95 / 2.87 s. All 185 API requests used 1,215,688 input / 10,212 output tokens in total. In the paired holdout, the three additional grounded answers came with 34% more input tokens across the 45 cases. These stage timings describe explicit recall.
The public runs use selected LongMemEval-S subsets and a project grounding rubric. Quality depends on the host, evidence budget and answer model. The published Eidema wheel separately passed 974 SDK tests. See the benchmark report for the paired quality, cost and latency measurements.
Apache-2.0 for the SDK. Embedding and generation models have their own licenses and are configured separately.