Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
fix(store): preserve FTS tokenizer behavior for path search
AkitaOnRailsdd2b8d0839d7
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 94d00702..9d05b1cd 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).## [Unreleased]+### Added+- Page FTS now indexes normalized page paths, so searches can find pages by+ filename or slug even when the slug does not appear in the title/body ([#62]).+### Fixed- `memory_write_page` calls that specify `project` without `workspace` nowdefault to the active workspace published by hooks, and project-only reads usediff --git a/crates/ai-memory-store/migrations/V17__pages_fts_index_path.sql b/crates/ai-memory-store/migrations/V17__pages_fts_index_path.sqlindex 74a2f98c..06c8e414 100644--- a/crates/ai-memory-store/migrations/V17__pages_fts_index_path.sql+++ b/crates/ai-memory-store/migrations/V17__pages_fts_index_path.sql@@ -33,7 +33,7 @@ CREATE VIRTUAL TABLE pages_fts USING fts5(title, body, path_search,content='pages',content_rowid='rowid',- tokenize="unicode61 tokenchars '/_-'"+ tokenize="unicode61 remove_diacritics 2 tokenchars '/_-'");CREATE TRIGGER pages_fts_ai AFTER INSERT ON pages BEGIN@@ -46,7 +46,7 @@ CREATE TRIGGER pages_fts_ad AFTER DELETE ON pages BEGINVALUES ('delete', old.rowid, old.title, old.body, old.path_search);END;-CREATE TRIGGER pages_fts_au AFTER UPDATE ON pages BEGIN+CREATE TRIGGER pages_fts_au AFTER UPDATE OF title, body, path_search ON pages BEGININSERT INTO pages_fts(pages_fts, rowid, title, body, path_search)VALUES ('delete', old.rowid, old.title, old.body, old.path_search);INSERT INTO pages_fts(rowid, title, body, path_search)diff --git a/crates/ai-memory-store/src/ops.rs b/crates/ai-memory-store/src/ops.rsindex 3e682a8c..4899413d 100644--- a/crates/ai-memory-store/src/ops.rs+++ b/crates/ai-memory-store/src/ops.rs@@ -1765,4 +1765,37 @@ mod tests {.unwrap();assert_eq!(body_hit, 1, "body must remain searchable");}++ #[test]+ fn pages_fts_path_migration_preserves_accent_folding() {+ let (_tmp, mut conn, ws, proj) = fresh_db();+ let mut p = page(ws, proj, "notes/descricao.md", "descrição do projeto");+ p.title = "Descrição".into();+ upsert_page(&mut conn, &p).unwrap();++ let n: i64 = conn+ .query_row(+ "SELECT COUNT(*) FROM pages_fts WHERE pages_fts MATCH 'descricao'",+ [],+ |r| r.get(0),+ )+ .unwrap();+ assert_eq!(n, 1, "page FTS should remain accent-insensitive");+ }++ #[test]+ fn pages_fts_update_trigger_ignores_access_counter_updates() {+ let (_tmp, conn, _ws, _proj) = fresh_db();+ let sql: String = conn+ .query_row(+ "SELECT sql FROM sqlite_master WHERE type = 'trigger' AND name = 'pages_fts_au'",+ [],+ |r| r.get(0),+ )+ .unwrap();+ assert!(+ sql.contains("AFTER UPDATE OF title, body, path_search ON pages"),+ "pages_fts_au must not fire on access_count/last_accessed_at updates: {sql}"+ );+ }}