Your AI Agent Has Amnesia: Why We Built a Database to Fix It
If you've worked with AI coding agents for more than a weekend, you've hit this wall: the agent writes beautiful code, then forgets why it made certain design decisions the moment the session ends.
The next time you open the project, the agent is starting from zero. It doesn't remember that you rejected the async approach because of the runtime constraints. It doesn't know that the User model was deliberately kept thin because you're migrating auth providers next sprint. It's like working with a brilliant junior developer who has a perfect memory â but only for the last 15 minutes.
Context Window â Memory
The AI industry's answer to this has been: "just make the context window bigger." Gemini has 1M tokens. Claude has 200K. But a bigger context window isn't memory â it's a bigger scratchpad.
Here's what gets lost between sessions:
- Reasoning artifacts: The chain of thought that led to a decision
- Rejected paths: What you tried, why it failed, what to avoid
-
Implicit constraints: "Don't use
unwrap()here because of the FFI boundary" - Multi-modal context: The diagram the agent generated, the screenshot it analyzed, the audio note you recorded
You can't cram all of that into a prompt. And even if you could, the agent doesn't query it â it just sits there, inert, hoping the right context is somewhere in the pile.
Why Existing Databases Don't Solve This
We looked at the existing stack and realized: none of it was built for this problem.
Vector databases (Pinecone, Qdrant, Weaviate)
They're great at semantic search. But they're designed for server-side RAG pipelines, not embedded at the edge. You don't want a network call every time your robot's onboard agent needs to recall "what did I see in the previous room?" Also, they store embeddings â not the rich, structured reasoning artifacts an agent produces.
SQLite / Postgres
Mature, reliable, works everywhere. But they're not AI-native. There's no first-class concept of an embedding, a multimodal blob, or a reasoning trace. You can bolt those on with extensions (pgvector, etc.), but you're still mapping AI concepts onto a relational schema that was designed for a different era.
In-memory KV stores (Redis, etc.)
Fast, but they don't persist. And they definitely don't handle multimodal data (images, audio, sensor streams) as first-class citizens.
What Agent Memory Actually Needs
We spent months talking to teams building embodied AI (robots, drones, edge inference) and identified what agent memory actually requires:
It has to be embedded. If your agent is running on-device (robot, edge server, drone), you can't round-trip to a cloud DB for every memory lookup. It needs to be in-process.
It has to be multimodal. Agents don't just produce text. They generate images, analyze audio, process sensor data. The memory layer needs to store and query across all of it.
It needs to store reasoning, not just results. The most useful thing an agent can remember is not "the answer was X" â it's "I tried X, it failed because of Y, here's what I learned."
It needs to be fast. Memory lookups should be indistinguishable from a local cache. If the agent has to wait 200ms for a memory lookup, the interaction feels broken.
It needs to be queryable by the agent. Not just a dump of chat logs that a human has to read. The agent needs to be able to search its own memory.
Enter moteDB
We built moteDB to meet these requirements. It's the first (that we know of) AI-native embedded multimodal database, written entirely in Rust.
What "AI-Native" Means Here
Most databases store rows, documents, or key-value pairs. moteDB stores AI artifacts:
- Embeddings as first-class data types (not a bolt-on extension)
- Multimodal blobs (images, audio, video frames) with automatic embedding generation
- Reasoning traces â structured records of what the agent tried, what worked, what didn't
- Episodic memory â timestamped sequences of agent actions that can be queried semantically
Why Embedded?
Because the use case that drove this design was embodied AI: robots, drones, edge-deployed agents that need to remember while operating without a stable network connection.
If your warehouse robot is navigating between shelves and needs to remember "the north corridor is blocked by a pallet," that memory lookup has to be local, fast, and resilient to network drops. An embedded DB (like SQLite) gives you that â but SQLite wasn't built to handle multimodal embeddings as first-class data.
Why Rust?
Three reasons:
Memory safety without GC pauses. When your agent is doing real-time inference on an edge device, a 200ms GC pause is unacceptable. Rust gives us memory safety with deterministic performance.
Embedded deployment. Rust compiles to a single binary with no runtime. That matters when your target is a Raspberry Pi on a drone, not a 64-core server in us-east-1.
FFI is trivial. We needed moteDB to be callable from Python, C++, JavaScript, and anything else teams are using. Rust's FFI story is the best in the business.
What Using moteDB Looks Like
Here's the simplest possible example. You're building an agent that navigates a robot through a building:
use motedb::AgentMemory;
let memory = AgentMemory::open("robot_mem.db")?;
// Store a multimodal memory: image + reasoning
memory.store_episode(
"north_corridor_blocked",
Episode {
timestamp: now(),
modality: Modality::ImageWithText,
embedding: embed("The north corridor is blocked by a pallet"),
reasoning: "Tried to navigate north, hit obstacle. Label: static obstruction.",
blob: camera_frame,
}
)?;
// Later: semantic recall
let relevant = memory.recall("how do I get to the loading dock?", top_k=5)?;
for episode in relevant {
println!("Remembered: {}", episode.reasoning);
}
The key design choice: the agent doesn't just store "answers." It stores what it tried, what the outcome was, and why. That's what makes the memory reusable â not just a chat log dump.
Performance Numbers (Early Benchmarks)
We're still tuning, but early benchmarks on a Raspberry Pi 4:
- Embedding storage + retrieval: ~3ms for top-10 similarity search across 10K embeddings
- Multimodal blob storage: ~12MB/s write, ~45MB/s read (compressed)
- Reasoning trace query: ~8ms for structured query across 5K episodes
- Memory footprint: ~18MB resident for a 10K-episode database
For comparison: a network round-trip to Pinecone from an edge device is typically 80-200ms. The math is pretty clear.
The Bigger Picture
The agent memory problem is not going away. If anything, it's about to get worse â because agents are moving from "helpful assistant in the browser" to "autonomous system running on-device."
When that happens, the memory layer stops being a "nice to have" and becomes the difference between an agent that learns and an agent that's just expensive autocomplete.
We're open-source (MIT). cargo add motedb if you want to try it. Feedback â especially from teams building embodied AI â is very welcome.
- moteDB is open-source, MIT-licensed. GitHub: https://github.com/motedb/motedb â stars, issues, and PRs all welcome.*
Top comments (0)