Inspiration
AI agents often remember a fact after it stops being true. A larger context window does not tell a user which source replaced that fact, why the answer changed, or whether the older evidence was preserved. Librarian treats memory as an evidence lifecycle instead of a bag of text.
What it does
Librarian is a MemoryAgent powered by Qwen Cloud and deployed on Alibaba Cloud ECS.
A user can:
- ingest an original source,
- ingest a correction that explicitly replaces it,
- query the current memory with bounded retrieval, and
- inspect an explanation showing the active claim, superseded claim, source citations, and transition history.
The guided demo uses an isolated namespace for each run. Sources remain immutable while claim state changes explicitly, so the system can answer with the current value without erasing how that value changed.
How we built it
- Qwen Cloud models through the DashScope OpenAI-compatible API
- FastAPI application on Alibaba Cloud ECS
- Caddy HTTPS gateway with Basic Auth and a 64 KB request-body limit
- persistent Markdown, JSON, and JSONL memory outside immutable application releases
- graph-first bounded retrieval
- systemd services and exact-commit GitHub Actions deployment
- candidate-bound health and restart-persistence receipts
Only bounded ingest and query requests cross the Qwen boundary. The explanation view is reconstructed locally from the stored ledger and does not make another model call.
Challenges
The hardest part was making “memory changed” auditable. We had to preserve source bytes, represent supersession rather than overwrite history, keep retrieval bounded, and prove that deployment and restart did not silently alter persistent memory. Our deployment pipeline therefore fails closed when the candidate SHA, live health, or memory digest does not match.
Accomplishments
- a working browser-guided correction demo
- live Qwen Cloud calls with model and token receipts
- source-backed answers with explicit claim IDs
- visible active/superseded memory states
- exact-SHA deployment on Alibaba Cloud ECS
- restart-persistence proof bound to the deployed candidate
What we learned
Useful agent memory needs more than storage. It needs evidence, state transitions, bounded recall, and recovery proof. We also learned to keep the Qwen transmission boundary small and to separate model-assisted ingest/query from deterministic explanation and deployment verification.
What's next
Next we would add user-managed retention policies, encrypted tenant isolation, and broader evaluation across real correction-heavy workflows while preserving the same evidence-first contract.