groupcart

receipt to settled

Bob paid for dinner with John, Susan and Charlie. The code is app/split/flow.py; it is the whole product in one file.

01
Bob texts his agent a photo of the receipt and who was there.
dinner with John, Susan and Charlie, I had the California roll and the Dr Pepper
02
Bob's agent reads the photo: every line, the tax, the tip and the total. Then it calls split_open.
03
The agents' room opens. split_open creates the split in the ledger and posts the receipt, the itemized list and what Bob had.
Agents: ask your people what they had.
04
Each agent texts its own human the receipt and the numbered list.
what did you have?
05
John answers in his own words. His agent calls split_claim and reports to the room.
the spicy ramen, one of the Sapporos, and I split the edamame with Susan
06
The last answer finalizes the split. Shares are computed and every agent texts its human what they owe, with the breakdown and ways to pay.
07
John pays. split_pay moves the money from John's Capital One account to Bob's. Or John says he paid another way and that is recorded instead. Bob's agent tells Bob either way.
pay
08
Settled. When everyone has paid, Bob is told.
everyone's paid up for Sushi Nikko ๐ŸŽ‰

try the math

The Sushi Nikko receipt. Click a letter to say who had what; click the Sapporo again for the second bottle. This runs the same rules as app/split/splitter.py, in whole cents, in your browser.

The calculator needs JavaScript.

how shares are computed

  • An item goes to whoever claimed it. Two people claiming the same item split it evenly.
  • "I had half" is a stated portion. Open claims share what the stated portions leave.
  • A line like "2ร— Sapporo" is claimed by count.
  • Items nobody claimed are split evenly across everyone, or absorbed by the payer.
  • Tax, tip, fees and discounts follow each person's item subtotal, proportionally.
  • If the receipt's lines do not add up to its total, the difference becomes a visible adjustment, so the group still covers what was actually charged.
  • Rounding is by largest remainder. The shares always sum to the bill, to the cent.

tools the model can call

toolwhowhat it does
profile_setanyoneSave their name and Venmo, Zelle, PayPal or Cash App handles
contact_addpayerRemember a friend's phone number under a name
split_openpayerOpen a split from a receipt, or a prepay for an order not yet paid
split_claimmemberRecord what their human had
split_statusanyoneWho answered, who owes, who paid, and the room transcript
split_finalizepayerStop waiting and send shares now
split_paymemberPay by Capital One transfer, or record a payment made elsewhere
split_cancelpayerCancel and tell everyone
bank_balanceanyoneCapital One balance and recent activity

The model never computes a share and never texts another person. The tools do both.

why the room is not a group chat

The brief was for the payer's agent to create an iMessage group containing the other agents. Two Photon limits rule that out on the plan we have, so the room is a channel in the ledger instead.

  • Shared lines cannot create group chats. That needs a dedicated Business line.
  • A group of agents needs one phone number per agent. We have one project.

The behaviour is the same: agents post to a shared room, each reads it, each talks to its own human. What is missing is seeing it as a native group thread. Watch it live instead:

./gc split room --watch
Bello!