# BigMind Search Optimization — FTS5 Rules

## FTS5 AND-Match Behavior
- Every token in query must appear in the same fact/chunk
- Order doesn't matter, but all words must match
- Case-insensitive

## Good Query Patterns (2-3 Focused Keywords)
| ✅ Good | ❌ Bad | Why Good |
|---------|--------|----------|
| `"TrueNAS Docker"` | `"homelab infrastructure TrueNAS Docker"` | Too many tokens → 0 results |
| `"mcp.json config"` | `"mcp.json clients VS Code IntelliJ config path"` | Rare words like "clients" kill results |
| `"Fedora workstation"` | `"server infrastructure"` | Specific nouns > generic words |
| `"BigMind hypothesis"` | `"memory_add_hypothesis during analysis"` | Focus on tool name + context |

## Reserved Word Protection
- FTS5 keywords (rank, content, category) are auto-quoted
- Always quote multi-word queries: `"multi word query"`

## Search Strategy
1. Start with 2 keywords, add third if needed
2. Use tool names + context: `"memory_search_facts facts"`
3. For people: `"memory_recall_person Patrick"`
4. For sessions: `"memory_list_sessions mcp-adp"`

## When Search Returns 0
- Shorten query to 1-2 tokens
- Use `memory_list_sessions(topics_filter="mcp")` for broad exploration
- Fall back to `memory_get_context()` for recent sessions