# Crew tasking — Supabase table (one-time setup)

Mission Control (the owner-only admin hub) assigns work to crew agents
through this table. Agents check it at the start of every run.

Run this in the Supabase SQL editor (project `qobjttazhfwkraozzzvy`):

```sql
create table if not exists crew_tasks (
  id uuid primary key default gen_random_uuid(),
  agent text not null,              -- 'Scout','Captain','Pricer','Pricer OP','Critic','Marketer','Manager','all'
  task text not null,
  status text not null default 'open',  -- open | done
  created_by uuid references auth.users(id),
  created_at timestamptz not null default now()
);

alter table crew_tasks enable row level security;

-- Anyone can read open tasks (agents poll with the anon key)
create policy "public read crew tasks" on crew_tasks
  for select using (true);

-- Only owner/admin can assign or close tasks
create policy "owner manage crew tasks" on crew_tasks
  for all using (
    exists (select 1 from profiles where profiles.id = auth.uid()
            and profiles.role in ('owner','admin'))
  );
```

## How it works
1. Jahvon opens **Mission Control** (Owner Operations) and assigns a task to an agent (or "all").
2. The site inserts the row using his signed-in owner session.
3. Each crew cron reads open tasks for its agent at the start of its run, does the work, and reports back in the crew chat + digest.
4. Jahvon marks tasks done from Mission Control.

Until this table exists, assigned tasks are kept in the browser's local
outbox and shown with a reminder to run the SQL above — nothing is lost.
