Repository navigation
FTS5 session search and skill curator lifecycle - #77
Merged
Merged
Conversation
Replace the linear substring scan with a dedicated SQLite FTS5 index for session message search. The index lives at ~/.mayros/agents/<agentId>/sessions/search.sqlite and uses an external-content virtual table with triggers for automatic sync. The search now supports multi-word queries with BM25 relevance ranking, role/timestamp/session filters, and snippet generation via the FTS5 snippet() function. Indexing is incremental (lazy sync on each query, skipping unchanged files by mtime+size), so no background watchers are needed. The public searchSessions API is unchanged — it tries FTS5 first and falls back to the original linear scan when node:sqlite is unavailable, so search always works regardless of the runtime.
Replace the linear substring scan with a dedicated SQLite FTS5 index for session message search. The index lives at ~/.mayros/agents/<agentId>/sessions/search.sqlite and uses an external-content virtual table with triggers for automatic sync. The search now supports multi-word queries with BM25 relevance ranking, role/timestamp/session filters, and snippet generation via the FTS5 snippet() function. Indexing is incremental (lazy sync on each query, skipping unchanged files by mtime+size), so no background watchers are needed. The public searchSessions API is unchanged — it tries FTS5 first and falls back to the original linear scan when node:sqlite is unavailable, so search always works regardless of the runtime. Results are sorted by timestamp descending and sessionsSearched counts files scanned, matching the original contract.
Add a skill lifecycle manager that automatically transitions skills through active → stale → archived states based on invocation activity. Activity tracking (activity-store.ts): a JSON sidecar at ~/.mayros/skills/skill-activity.json records lastInvokedAt, invocationCount, and firstInvokedAt per skill. Updated on every skill invocation. Lifecycle metadata: extend MayrosSkillMetadata with state, pinned, created, and updated fields. Parsed from SKILL.md frontmatter. Curator sweep (skill-curator.ts): a self-throttled background sweep (mirroring session-reaper.ts) that transitions active skills to stale after 30 days of inactivity and stale skills to archived after 90 days. Pinned skills are never transitioned. Only agent-created skills (source: mayros-managed) are eligible for archival — user skills can go stale but are never auto-archived. Archived skills are moved to ~/.mayros/skills.archived/.
5 tasks done
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
Two Tier 2 features: fast full-text session search and automatic skill lifecycle management.
FTS5 session search
~/.mayros/agents/<agentId>/sessions/search.sqlite) with BM25 ranking, multi-word query support, role/timestamp/session filters, and snippet generation.searchSessionsAPI is unchanged — tries FTS5 first, falls back to the linear substring scan whennode:sqliteis unavailable.Skill curator lifecycle
~/.mayros/skills/skill-activity.json) records lastInvokedAt, invocationCount, firstInvokedAt per skill.MayrosSkillMetadataextended withstate,pinned,created,updatedfrontmatter fields.~/.mayros/skills.archived/.Test plan
pnpm tsgo— 0 errorspnpm lint— 0 errors, 358 warningspnpm exec vitest run src/infra/ src/agents/skills/— 57 passed, 0 failedFollow-up
The LLM consolidation pass (Commit 3 of the plan) is deferred to a separate session — it requires an isolated agent turn and clustering logic that benefits from focused implementation.