$npx -y skills add softspark/ai-toolkit --skill mem-searchSearch past coding sessions using natural language. Finds relevant observations, decisions, and context from previous work.
| 1 | # Search Session Memory |
| 2 | |
| 3 | Search the persistent memory database for past coding observations, decisions, and context. |
| 4 | |
| 5 | $ARGUMENTS |
| 6 | |
| 7 | ## How It Works |
| 8 | |
| 9 | This skill queries the SQLite FTS5 full-text search index at `~/.softspark/ai-toolkit/memory.db` to find relevant observations from past sessions. |
| 10 | |
| 11 | ## Instructions |
| 12 | |
| 13 | 1. **Parse the search query** from `$ARGUMENTS`. If empty, prompt the user for a query. |
| 14 | |
| 15 | 2. **Initialize the database** if it does not exist: |
| 16 | ```bash |
| 17 | python3 "$HOME/.softspark/ai-toolkit/hooks/../plugins/memory-pack/scripts/init_db.py" 2>/dev/null || true |
| 18 | ``` |
| 19 | |
| 20 | 3. **Run the FTS5 search** against the observations table: |
| 21 | ```bash |
| 22 | sqlite3 ~/.softspark/ai-toolkit/memory.db " |
| 23 | SELECT o.id, o.session_id, o.tool_name, o.content, o.created_at, |
| 24 | s.project_dir, s.summary |
| 25 | FROM observations_fts fts |
| 26 | JOIN observations o ON o.id = fts.rowid |
| 27 | LEFT JOIN sessions s ON s.session_id = o.session_id |
| 28 | WHERE observations_fts MATCH '<query>' |
| 29 | ORDER BY rank |
| 30 | LIMIT 10; |
| 31 | " |
| 32 | ``` |
| 33 | Replace `<query>` with the user's search terms. Escape single quotes by doubling them. |
| 34 | |
| 35 | 4. **Progressive disclosure** -- present results in two stages: |
| 36 | |
| 37 | **Stage 1: Summary view** (show first) |
| 38 | ```markdown |
| 39 | ## Memory Search: "<query>" |
| 40 | |
| 41 | Found N results across M sessions. |
| 42 | |
| 43 | | # | Session | Project | Tool | Time | Preview | |
| 44 | |---|---------|---------|------|------|---------| |
| 45 | | 1 | abc123 | /path | Edit | 2025-01-15 | First 80 chars... | |
| 46 | ``` |
| 47 | |
| 48 | **Stage 2: Detail view** (on request) |
| 49 | Show the full observation content, session summary, and related observations from the same session. |
| 50 | |
| 51 | 5. **If no results found**, suggest: |
| 52 | - Trying broader search terms |
| 53 | - Checking if memory-pack hooks are installed |
| 54 | - Running `init-db.sh` if the database is missing |
| 55 | |
| 56 | ## Query Tips |
| 57 | |
| 58 | - Use simple keywords: `mem-search database migration` |
| 59 | - FTS5 supports prefix matching: `migrat*` matches "migration", "migrate" |
| 60 | - Boolean operators: `database AND NOT test` |
| 61 | - Column filters: `tool_name:Edit` to search only Edit tool observations |