Add long-term memory system with hybrid search#8
Merged
initializ-mk merged 1 commit intomainfrom Feb 26, 2026
Merged
Conversation
Implement persistent cross-session agent memory inspired by OpenClaw's memory architecture. Agents can now accumulate knowledge across tasks via daily observation logs and a curated MEMORY.md file. Key components: - Embedder interface with OpenAI, Gemini, and Ollama providers - File-based memory store with daily logs and evergreen MEMORY.md - Text chunker with paragraph/sentence-aware overlap splitting - FileVectorStore (JSON-backed, pluggable VectorStore interface) - Hybrid search: vector cosine similarity + keyword overlap + temporal decay (7-day half-life, MEMORY.md exempt) - memory_search and memory_get builtin tools for agent self-service - MemoryFlusher hook in compactor to capture observations before discard - Full runner integration with embedder auto-detection and fallback Graceful degradation: no embedder → keyword-only search, no memory dir → skip without crash, corrupted index → rebuild from source files.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Embedderabstraction with OpenAI (text-embedding-3-small), Gemini, and Ollama (nomic-embed-text) implementations, plus factory with auto-detection and Anthropic fallback handlingforge-core/memory/): file-based storage (daily logs + curatedMEMORY.md), text chunker with paragraph/sentence-aware overlap,FileVectorStorewith pluggableVectorStoreinterface, and hybrid search engine combining vector cosine similarity, keyword overlap, and temporal decay (7-day half-life,MEMORY.mdevergreen)memory_searchandmemory_getbuiltin tools enabling agents to query their own long-term memoryMemoryFlusherhook captures tool results and decisions before compaction discards old messages, writing them to the daily observation logmemory.Managerlifecycle, conditional tool registration, and background indexing at startupEnable via
memory.long_term: trueinforge.yamlorFORGE_MEMORY_LONG_TERM=trueenv var.Test plan