-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
enhancementNew feature or requestNew feature or requestphase-3Phase 3: Auto-ingestion & searchPhase 3: Auto-ingestion & search
Description
What
Query APIs and CLI commands that leverage the sidecar tables (tool usage, file operations, commands, git operations, errors, costs) for analytics, filtering, and intelligent recall.
Why
The sidecar tables from Phase 1 store rich structured data but there's no way to query them yet. Developers should be able to ask "what files did I edit today?", "show me all failed commands in project X", or "which sessions cost the most tokens".
Tasks
- File activity queries: "what files were touched in session X" / "most-edited files this week"
- Tool usage analytics: tool frequency, success rates, average duration per tool
- Error analysis: error type distribution, most common errors, sessions with highest error rate
- Git activity: commits per session, PR creation timeline, branch activity
- Cost tracking: token usage per session/project/day, cost trends, cache hit rates
- Search filters: extend `smriti search` with `--tool`, `--file`, `--error-type`, `--git-op` flags
- `smriti stats` command overhaul: show sidecar table summaries alongside existing stats
- `smriti activity` command: timeline of file operations + commands for a session
- Recall enrichment: include sidecar data in recall context (e.g., "this session edited 5 files and ran 12 commands")
- JSON output for all analytics queries (`--format json`)
Files
- `src/search/index.ts` — Add sidecar-aware search filters
- `src/search/analytics.ts` — new Analytics query functions
- `src/search/recall.ts` — Enrich recall with sidecar context
- `src/index.ts` — Add `stats`, `activity` CLI commands
- `src/format.ts` — Format analytics output (table, JSON, CSV)
- `test/analytics.test.ts` — new Analytics query tests
Acceptance Criteria
- `smriti search "auth" --tool Bash` returns only sessions where Bash tool was used
- `smriti search "auth" --file "src/auth.ts"` returns sessions that touched that file
- `smriti stats` shows tool usage, error rates, and cost summaries
- `smriti activity ` shows chronological timeline of operations
- `smriti recall "query" --synthesize` includes sidecar context in synthesis
- All analytics queries return results in < 100ms for databases with 10k+ messages
Testing
bun test test/analytics.test.ts # Analytics query tests
smriti stats # Overview with sidecar data
smriti activity <session-id> # Session activity timeline
smriti search "fix bug" --tool Bash --format jsonReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestphase-3Phase 3: Auto-ingestion & searchPhase 3: Auto-ingestion & search