feat: add FTS5 full-text search for memory retrieval#2
Open
sergi-rz wants to merge 1 commit intocodejunkie99:masterfrom
Open
feat: add FTS5 full-text search for memory retrieval#2sergi-rz wants to merge 1 commit intocodejunkie99:masterfrom
sergi-rz wants to merge 1 commit intocodejunkie99:masterfrom
Conversation
Currently the memory system can only surface top-k entries by salience score, but cannot search by topic or keyword. This adds a lightweight SQLite FTS5 search tool that indexes all .md and .jsonl files under .agent/memory/ and returns ranked results with context snippets. - memory_search.py: FTS5 index with auto-rebuild and grep fallback - .gitignore: exclude derived .index/ directory - memory-manager SKILL.md: document the search command Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Problem
The memory system can surface the top-k entries by salience score (
context_budget.py), but there's no way to search by topic or keyword. If an agent needs to recall what it learned about deploys, or a specific past failure, it has no retrieval path — it only sees whatever happens to score highest globally.Solution
A lightweight
memory_search.pythat builds a SQLite FTS5 index over all.mdand.jsonlfiles in.agent/memory/. It:Usage
python3 .agent/memory/memory_search.py "deploy failure" python3 .agent/memory/memory_search.py --status python3 .agent/memory/memory_search.py --rebuildWhat's changed
.agent/memory/memory_search.py— the search tool (~170 lines, zero dependencies beyond stdlib).gitignore— excludes.agent/memory/.index/(derived, auto-rebuilt)memory-manager/SKILL.md— documents the search command so the agent knows it existsNo existing code is modified. This is purely additive.
Context
I'm building Claudia OS, a personal AI assistant on top of Claude Code. I adopted your episodic memory architecture, dream cycle, and salience scoring (credited in my ATTRIBUTION.md). While adapting it, I needed keyword search over memory — the salience-only retrieval wasn't enough when the agent needed to recall something specific. This FTS5 approach solved it cleanly without adding infrastructure.
🤖 Generated with Claude Code