Fixes two related issues causing session indexing to stop after gateway restart:
1. Move needsFullReindex check before reason gate in shouldSyncSessions()
- Previously, reason='session-start' or 'watch' would block reindex
- Now needsFullReindex bypasses reason checks, allowing sessions in full reindex
2. Persist sessionsDirty flag to database metadata
- Add sessionsDirty field to MemoryIndexMeta type
- Save sessionsDirty during sync (runSafeReindex)
- Restore sessionsDirty from meta on manager construction
- Rebuild sessionsDirtyFiles Set by scanning sessions directory on startup
- Compare against indexed files in DB to populate dirty set
Without these fixes, session indexing would silently stop after any restart
because the in-memory sessionsDirtyFiles Set was lost and sessions were
excluded from reindex due to the reason gate.
Resolves issue #1
When searching in FTS-only mode (no embedding provider), extract meaningful
keywords from conversational queries using LLM to improve search results.
Changes:
- New query-expansion module with keyword extraction
- Supports English and Chinese stop word filtering
- Null safety guards for FTS-only mode (provider can be null)
- Lint compliance fixes for string iteration
This helps users find relevant memory entries even with vague queries.