Docs menu

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_id NOT NULL
  • role - CHECK IN (‘user’,‘assistant’)
  • content NOT NULL
  • proposed_report jsonb NULL - a report INFI proposes (“propose, don’t act”)
  • proposed_action jsonb NULL - a real write action INFI proposes; the confirm-action endpoint reads this row back rather than trusting the frontend to round-trip tool arguments
  • created_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 PK
  • enabled boolean DEFAULT false
  • updated_at