
Free Pascal · AI · LLM · LoRA · Local AI Memory
FMXExpress has released memagent, an experimental local AI agent that doesn’t just remember what you tell it — it learns new facts into the model itself while you continue chatting.
Most AI memory systems rely on conversation history, summarization, or retrieval-augmented generation (RAG). Memagent combines those techniques with continual learning through LoRA adapters. New facts are immediately available through local retrieval, while a background trainer gradually incorporates them into the model’s weights without requiring a complete model retraining.
The architecture introduces two tiers of learned memory. A fast LoRA incorporates recently learned facts on top of an existing deep LoRA. Periodic “deep sleep” cycles consolidate the accumulated knowledge into a new long-term adapter. Before an adapter is hot-swapped into the running model, an evaluation gate checks whether it can recall the learned facts without retrieval and whether training has degraded the model’s existing capabilities.
Built in Free Pascal, memagent integrates llama.cpp for local inference and training, SQLite FTS5 for keyword search, and ONNX Runtime for embedding-based retrieval and cross-encoder reranking. It also maintains evidence-weighted standing instructions, supports correcting and forgetting facts, and includes a guard against confabulated memories.
The agent runs locally on Windows and Linux, with CPU and GPU configurations supporting models including SmolLM2, Qwen, Gemma, Liquid Foundation Models, GPT-OSS, and Magistral. It can also import conversation history from ChatGPT, Claude, Claude Code, Codex, Gemini CLI, OpenCode, and OpenClaw, turning previous conversations into a personal knowledge base.
An optional robotics integration adds another dimension: memagent can connect to LeRobot policies, including FineART-VLA, allowing completed physical tasks to become memories while standing instructions help govern the agent’s actions.
The result is an interesting exploration of what happens when an AI agent’s memory is no longer just an external database, but something the model can gradually learn and consolidate into its own parameters.
See how to build a local AI agent that remembers immediately, learns continuously, and consolidates its knowledge while it sleeps:
https://github.com/FMXExpress/Short-Long-Memory-LLM