Inspiration
What it does
Inspiration
Large language models are excellent within a single conversation, but they struggle across weeks or months of interaction. They repeatedly ask the same questions, forget long-term preferences, retain outdated facts, or waste valuable context on irrelevant memories. Existing memory systems often either remember everything indefinitely or rely on simplistic similarity search that ignores time, importance, and user evolution.
MemoryAgent was built to solve this problem by treating memory as a living system rather than a static database. Instead of storing conversations, it continuously builds, updates, retrieves, consolidates, and forgets information—much closer to how human long-term memory works.
What it does
MemoryAgent is a persistent AI memory architecture that enables agents to learn across conversations while remaining accurate over time.
It can:
- Store semantic knowledge (facts, preferences, relationships, beliefs)
- Store episodic memories (important experiences and events)
- Retrieve only the most relevant memories under limited context windows
- Automatically consolidate short-term memories into long-term representations
- Replace outdated beliefs instead of accumulating contradictions
- Decay insignificant memories over time
- Preserve historically important information through versioning and audit trails
- Continuously optimize retrieval quality using an evaluation-driven tuning system (BACA)
Rather than acting like a chat history search engine, MemoryAgent behaves like a continuously evolving memory system.
How we built it
The project was built as a modular multi-graph architecture using LangGraph, where each pipeline is responsible for a specialized cognitive function.
Core Memory Pipeline
- Unified information extraction using structured LLM outputs
- Parallel semantic and episodic memory ingestion
- Asynchronous memory staging
- Background consolidation workers
- Independent retrieval graph
- Main reasoning graph
Semantic Memory
Semantic memories are represented as structured subject–predicate–object triples.
Instead of blindly inserting duplicates, new facts are compared against existing active beliefs.
When contradictions are detected:
- old beliefs are superseded,
- history is preserved through an audit trail,
- retrieval always favors the newest valid belief.
This prevents the classic "memory drift" problem where agents simultaneously remember conflicting facts.
Episodic Memory
Experiences are stored separately from factual knowledge.
Each episode captures:
- emotional importance
- significance
- temporal information
- contextual embeddings
This allows the system to distinguish between:
- "The user likes bananas."
- "Yesterday the user was building an AI project."
Those are fundamentally different kinds of memories and deserve different retrieval behavior.
Retrieval Engine
Memory retrieval is not based on vector similarity alone.
Each candidate receives a weighted score combining signals such as:
- semantic similarity
- graph relationships
- keyword overlap
- importance
- temporal decay
- episodic relevance
The highest scoring memories are packed into the LLM context window.
This dramatically reduces irrelevant context while improving recall of important information.
Background Cognitive Processes
Instead of slowing user interactions, maintenance tasks execute asynchronously:
- semantic consolidation
- episodic consolidation
- decay sweeps
- tombstoning
- memory staging
The user receives a response immediately while memory continuously improves in the background.
BACA (Behavior-Aware Calibration Algorithm)
One of the most unique parts of the project is our retrieval calibration system.
Rather than manually tuning retrieval weights, BACA performs automatic evaluation using curated benchmark cases.
Each tuning cycle:
- proposes a single parameter adjustment,
- evaluates retrieval accuracy,
- compares against the current baseline,
- commits only improvements,
- rolls back any regression.
This coordinate-wise hill-climbing strategy creates a retrieval system that improves safely over time while remaining fully explainable and auditable.
Efficient Forgetting
Remembering everything is just as harmful as forgetting everything.
MemoryAgent implements an algorithmic decay pipeline where memories lose retrieval priority based on age, importance, and usage.
Low-value memories eventually become tombstoned while significant memories remain active.
This keeps retrieval efficient without allowing the database to grow into unusable noise.
Challenges we ran into
Building persistent memory turned out to be far more difficult than building the conversational agent itself.
Some of the biggest engineering challenges included:
- preventing contradictory beliefs from coexisting
- separating semantic memory from episodic memory
- designing retrieval that balances similarity, importance, and freshness
- implementing safe forgetting without deleting valuable knowledge
- coordinating multiple asynchronous background pipelines
- building an evaluation framework capable of automatically improving retrieval without degrading existing performance
- keeping latency low while multiple independent memory processes execute in parallel
Most of the project complexity lies in the memory architecture rather than the chatbot.
Accomplishments that we're proud of
We're especially proud of building a complete persistent-memory ecosystem rather than a simple vector database.
Highlights include:
- Modular LangGraph architecture
- Persistent semantic and episodic memory systems
- Automatic contradiction resolution
- Background memory consolidation
- Algorithmic forgetting and decay
- Retrieval calibration through BACA
- Audit trails for historical beliefs
- Autonomous retrieval optimization
- Scalable asynchronous memory pipelines
- Retrieval designed specifically for limited LLM context windows
The resulting architecture behaves much more like a long-term cognitive system than traditional conversational memory.
What we learned
This project reinforced that effective AI memory is fundamentally a systems problem.
Good retrieval depends on much more than embeddings.
We learned how to combine structured knowledge graphs, vector search, temporal reasoning, background processing, evaluation datasets, and optimization algorithms into a single coherent architecture.
Perhaps the biggest lesson was that forgetting is not a limitation—it is an essential capability for maintaining accurate long-term intelligence.
What's next for MemoryAgent
Our roadmap extends well beyond this hackathon.
Next steps include:
- automatic generation of evaluation datasets from real user interactions
- reinforcement learning for retrieval weight optimization
- multi-agent shared memory workspaces
- hierarchical long-term memory with semantic clustering
- multimodal memory (images, audio, documents)
- distributed memory synchronization across devices
- adaptive personalization based on long-term behavioral patterns
- memory analytics and visualization dashboards
- production deployment with large-scale concurrent users
Our long-term vision is to build an AI memory layer that enables future agents to genuinely accumulate knowledge, adapt over time, and become increasingly useful through every interaction rather than starting from scratch each session.
How we built it
Challenges we ran into
Accomplishments that we're proud of
What we learned
What's next for research.ai
Built With
- cli
- qwen
Log in or sign up for Devpost to join the conversation.