03 ยท Agentic bots

Ten bots, one mandate

Bots prepare, people decide. Always-on helpers over an event stream and an approval queue โ€” every action logged, every bot with a kill switch.

3 autonomy levels ยท human in the loop๐Ÿ“„ AGENTIC.mdVersion 1.0 ยท 4 October 2026 How always-on bots sit on top of the Orders & Dispatch module. Builds on TRD.md ยง5 and APP_FLOW.md Part C.

1Mandate

Bots prepare, people decide. The bots watch orders, stock and the calendar; they draft, check, remind and flag. They never move stock, commit money, or promise anything to a customer on their own. Every bot action shows on the dashboard as one plain-English line, and every bot has a kill switch.

2The ten bots

#BotWatchesDoesNever does
1Order Intake BotOrders mailbox (dnata / Gate Gourmet PO emails, non-airline emails)Airline POs: fixed template parser per caterer (system-generated POs). Non-airline: extracts customer, PO, dates and lines with AI; matches product codes; creates a draft order with a confidence score per fieldConfirms an order or reserves stock
2Availability BotNew and edited ordersCalculates available-to-promise per line; suggests earliest delivery date for non-airline; pushes airline lines into the Production Planning matrixPromises a date to the customer
3Invoice Prep BotOrders without an invoice numberPicks the right Xero (SkyCrest vs Annie Makes Cakes); prepares invoice lines; V2: creates a draft invoice in XeroApproves, sends or changes an invoice
4Confirmation BotInvoiced orders not yet confirmedDrafts the customer confirmation email from a template (lines, dispatch date, method)Sends without a human, or changes quantities
5Production Bot ("Alex's assistant")Shortfalls on orders, planner "to produce", tartlet NEED TO MAKEBuilds a daily make-list by date and product; sends Alex the missing-items alert for non-airline shortsChanges planner quantities or production priorities
6Allocation BotPacking queue, stock IN eventsProposes allocations earliest-dispatch-first; re-checks short lines when stock arrives; flags orders competing for the same stockAllocates or releases stock without a packer confirming
7Dispatch Scheduler BotOrders dispatching tomorrow14:00 the day before: builds the schedule (Interstate by port โ†’ Roadmaster, Sydney โ†’ driver run, Non-airline โ†’ all customers); drafts Roadmaster booking email and driver run sheet; lists orders not readyBooks transport or marks anything dispatched
8Stock Reconciler BotTransactions, dispatches, XLSM syncsNightly: negative stock, dispatched-but-not-deducted, large manual adjustments, app vs XLSM differences after a syncAdjusts stock
9Hermes Reminder Bot (runs on Hermes Agent)Dashboard "seen" status, staff roster07:00 per-person to-do list; if a person hasn't opened their dashboard by check-in time โ†’ WhatsApp/Telegram โ†’ SMS โ†’ phone call (Twilio) โ†’ manager. Also chases uninvoiced / unconfirmed / unbooked orders. Full spec: DASHBOARD.md ยง4Calls anyone not opted in, calls more than once a day, or contacts outside 06:00โ€“18:00
10Order Pattern BotAirline PO history per kitchenLearns each kitchen's rhythm (SYD every 3โ€“4 days, MEL/BNE weekly, PER ~3 weeks); flags "expected order not received"; 8-week demand forecast per product for the make-list; menu-change and slow-mover alerts. Basis: AIRLINE_ANALYSIS.mdCreates orders or contacts customers

3Autonomy levels

LevelMeaningExamplesDefault for
L1 โ€” Human onlyBot may surface information; a named person actsDispatch (stock out), allocation, invoice approval, customer promises, stock adjustments, cancelling ordersMoney, stock, customer commitments โ€” permanently
L2 โ€” Bot prepares, human approvesBot creates a proposal; nothing happens until someone clicks ApproveDraft order from email, proposed allocation, confirmation email, Roadmaster booking email, make-listMost bot output at launch
L3 โ€” Bot acts and reportsBot acts and logs it; fully reversible; no money/stock effectReminders, digests, shortage flags, reconciliation reports, planner refreshLow-risk communication and checks

Raising an action from L2 to L3 needs an admin setting change and a written confirmation by the business owner. There is no automatic "autonomy creep".

4Eight rules that make the loop real

  1. Named human, not "the system" โ€” every approval records decided_by and time.
  2. Reversible by default โ€” bots only create proposals, flags and messages; undo is always one click.
  3. Escalate, don't guess โ€” low-confidence extraction or ambiguity goes to the human queue; the bot never retries into a wrong answer.
  4. Kill switch per bot and per action type โ€” in Admin โ†’ Agents.
  5. No silent autonomy creep โ€” level changes are logged and need two people.
  6. Stock, money and customer promises stay L1.
  7. Human override wins โ€” if a person rejects a bot proposal, the reason is captured and the bot does not re-propose the same thing.
  8. Loop health is monitored โ€” proposals waiting too long show on the digest like overdue orders.

5Daily schedule

WhenJob
Every 15 min (06:00โ€“20:00)Inbox scan โ†’ draft orders; stock-IN watcher โ†’ re-check short lines
Every 15 min (06:00โ€“11:00)Hermes: dashboard-seen check โ†’ message โ†’ SMS โ†’ call โ†’ manager ladder
06:30Shortage sweep + Pattern Bot forecast โ†’ Alex's make-list for today + next 3 days; expected-order watch
07:00Daily digest via Hermes โ€” per-person to-do list (office, packing, Alex, admin)
14:00Day-before dispatch schedule draft + booking drafts + "not ready" list
16:00Chase: uninvoiced, unconfirmed, unbooked for tomorrow
Tuesday 10:00Interstate reminder โ€” MEL/BNE dispatch peaks on Wednesday: check Roadmaster bookings
20:00Stock reconciliation report
02:00Database backup (copy of stock.db, keep 30 days)
Monday 08:00Weekly summary: orders, dispatches, shortfalls, bot acceptance rate

6Decision rights

DecisionBotHuman
Create orderDrafts from emailOffice confirms
Delivery date (non-airline)SuggestsOffice confirms with customer
InvoicePrepares lines / Xero draftOffice approves in Xero
Confirmation emailDraftsOffice sends
Allocate stockProposesPacking confirms
What to makeBuilds make-listAlex decides
Transport bookingDrafts schedule + emailsOffice books
Dispatch (stock out)Checks readinessPacking / office dispatches
Stock adjustmentFlags differencesAdmin adjusts

7Technical design

7.1 Runtime

7.2 Event stream

7.3 New tables (additive)

CREATE TABLE IF NOT EXISTS events (
  id INTEGER PRIMARY KEY AUTOINCREMENT, type TEXT NOT NULL,
  entity TEXT NOT NULL, entity_id INTEGER, payload TEXT DEFAULT '{}',
  username TEXT DEFAULT '', created_at TEXT DEFAULT (datetime('now','localtime'))
);
CREATE TABLE IF NOT EXISTS agent_settings (
  agent TEXT PRIMARY KEY, enabled INTEGER DEFAULT 0,
  level TEXT DEFAULT 'L2', config TEXT DEFAULT '{}',
  updated_by TEXT DEFAULT '', updated_at TEXT DEFAULT ''
);
CREATE TABLE IF NOT EXISTS agent_proposals (     -- the human approval queue
  id INTEGER PRIMARY KEY AUTOINCREMENT, agent TEXT NOT NULL,
  kind TEXT NOT NULL,                            -- draft_order | allocation | email | booking | make_list
  entity TEXT, entity_id INTEGER, summary TEXT NOT NULL,
  payload TEXT NOT NULL, confidence REAL DEFAULT 1.0,
  status TEXT DEFAULT 'PENDING',                 -- PENDING | APPROVED | REJECTED | EXPIRED
  decided_by TEXT DEFAULT '', decided_at TEXT DEFAULT '', reason TEXT DEFAULT '',
  created_at TEXT DEFAULT (datetime('now','localtime'))
);
CREATE TABLE IF NOT EXISTS agent_runs (
  id INTEGER PRIMARY KEY AUTOINCREMENT, agent TEXT NOT NULL,
  started_at TEXT, finished_at TEXT, status TEXT, cursor_event_id INTEGER DEFAULT 0,
  summary TEXT DEFAULT '', error TEXT DEFAULT ''
);
CREATE TABLE IF NOT EXISTS agent_log (            -- one plain-English line per action
  id INTEGER PRIMARY KEY AUTOINCREMENT, agent TEXT NOT NULL,
  message TEXT NOT NULL, level TEXT DEFAULT 'info',
  entity TEXT, entity_id INTEGER, created_at TEXT DEFAULT (datetime('now','localtime'))
);

7.4 AI usage

7.5 Screens

7.6 Hermes (bot 9)

7.7 Hosting checks still needed