AI / INFI
Read Conventions first.
ai_chat_messages
One flat, endless history per user (no named threads). History is owned server-side.
id,business_id,user_idNOT NULLrole- CHECK IN (‘user’,‘assistant’)contentNOT NULLproposed_reportjsonb NULL - a report INFI proposes (“propose, don’t act”)proposed_actionjsonb NULL - a real write action INFI proposes; the confirm-action endpoint reads this row back rather than trusting the frontend to round-trip tool argumentscreated_at; index(user_id, created_at)
ai_agent_action_settings
Per-business toggles for which AI-agent actions may run autonomously (daily background job) vs. only on explicit chat request. Missing row = disabled. A generic keyed table, so a new automatable action needs no migration.
business_id,action_key- composite PKenabledboolean DEFAULT falseupdated_at