Pending schema changes — agent F2 (ai / scanner / research)
New file packages/database/src/schema/ai.ts, exported from schema/index.ts. Applied locally with
drizzle-kit push on rareindex_ai; no migration generated (to be folded into the next
pnpm db:generate at integration).
| Table | Purpose |
|---|---|
scanner_sessions |
Scanner submissions (photo/url/text), model guess + confidence, candidates shown, user pick (feedback loop), thumbnails, cost |
research_sessions |
AI Research threads keyed by anonymous cookie (anon_id) or user_id |
research_messages |
Messages with transparent tool-call trace, usage and cost |
ai_quotas |
Per-day counters for anonymous AI features (key = ip hash or user id) |
No changes to existing tables. AI spend is written to the existing costs table (kind='ai').