How we run Kaizen

How our AI agent prepares invoices, and where a person steps in

Billing a client used to mean rebuilding weeks of work from commits, calendars and email. Now Kai, our internal operations platform, does most of that work. It records what happened each day, proposes the hours and drafts the invoice. A person approves the hours, approves the invoice and sends it, and code checks the numbers at each of those taps.

By Ashish Tonse 7 min read

Person approvals before a client sees an invoice
3
Agent tools that can send an invoice
0
Times an approved hour can be billed
1

Billing a client used to mean rebuilding a whole period at the end of it. Someone went back through commits, calendars, email and chat, weeks after the work, and turned it into hours. It was slow, and the result depended on how well someone could piece together work from weeks before.

Now Kai, our internal operations platform, does most of that as the work happens, in four steps:

  1. Every weekday evening, it records the billable work that happened that day.
  2. Every Friday, it turns the week's records into proposed hours, and a person approves them.
  3. When a contract's billing period closes, it drafts the invoice from the approved hours.
  4. A person approves the invoice, and then a person sends it.
From daily evidence to a sent invoice The agent and code prepare the work: every weekday evening the agent records billing evidence, every Friday it proposes hours from that evidence, and when a contract's billing window closes, code drafts the invoice from the approved hours. A person makes three taps: approving the hours, which records them, approving the invoice, which runs four checks in code and puts the invoice in QuickBooks, and sending it, which has QuickBooks email the invoice to the client. In this flow, hours are recorded only by the Friday tap, and no agent tool pushes or sends an invoice. THE AGENT AND CODE PREPARE A PERSON TAPS WEEKDAY EVENINGS Record evidence Sessions, meetings, PRs FRIDAYS Propose hours Each row cites its records TAP 1 Approve hours Records the time entries WHEN A WINDOW CLOSES Draft the invoice Built by code from hours TAP 2 Approve invoice Checked, then to QuickBooks TAP 3 Send QuickBooks emails the client HOURS ARE RECORDED ONLY BY TAP 1. NO AGENT TOOL PUSHES OR SENDS AN INVOICE.
The agent does the recording, proposing and drafting. A person approves the hours, approves the invoice and sends it.

The rule behind it: let the agent prepare everything, and put a person's tap, plus a check in code, at each step where money moves or a client sees something.

Record the evidence the day it happens

At the end of each workday, the agent that writes our daily recap also records billing evidence. Each record is one signal, tied to a client and a project: an AI coding session, a pull request, a meeting, a message we sent or a ticket that moved.

Three rules keep the records honest:

  • A record is never a time entry. It's a sign that work happened. A coding session's length is only an upper limit, because a session can sit idle. A meeting's scheduled length is exact.
  • Each signal is recorded once. Records are keyed by their source, such as a meeting's calendar ID. Running the same day twice updates the record instead of adding a second one.
  • If the agent can't tell which client a signal belongs to, it drops it. It doesn't guess.

If a run fails or a day is skipped, the next run starts from the last day it recorded, so nothing falls through.

If you're automating billing, capture the evidence while it's fresh, and keep it separate from hours. Evidence says what happened. Hours are a judgment, and a person should make it.

A person approves the hours every Friday

On Friday afternoon, a job gathers each client's new evidence, and the agent proposes time entries: one per person, per day, per project, each listing the records behind it. They appear on a review card. A person can change the hours, rewrite a description or delete a row, then taps Approve.

Approval does three things at once. It records the time entries. It marks the evidence behind them as used. And it marks the records the reviewer chose not to bill as reviewed, so they don't come back next week.

If the time already logged for that period, or anyone's rate, changed after the card was prepared, approval is refused until the card is refreshed. The agent has no step in this flow that records time by itself. The tap is the only way an hour gets onto the books.

A week of evidence becomes proposed hours on a card An illustration with a made-up client, Northwind Research Center. Five evidence records from the week of Sep 14: a coding session on the event calendar filters of up to three hours and pull request 218 on Tuesday, a one-hour scheduled check-in meeting on Wednesday, a reply on the newsletter layout on Thursday, and an internal tooling session on Thursday. The agent proposes three time entries on a review card: 2.5 developer hours on Tuesday from the session and the pull request, 1 project manager hour on Wednesday from the meeting, and half a project manager hour on Thursday from the email. The internal session is not billed but is marked reviewed. The card waits for review with Approve and Edit buttons, and hours are recorded only when a person taps Approve. EVIDENCE, WEEK OF SEP 14 A CARD IN THE APP SESSION Build the event calendar filters TUE SEP 15, UP TO 3 H PR #218 Event calendar filters TUE SEP 15 MEETING Weekly check-in with the center WED SEP 16, 1 H SCHEDULED EMAIL Reply on the newsletter layout THU SEP 17, SENT BY US SESSION Internal tooling cleanup THU SEP 17, UP TO 2 H PROPOSED Time review, week of Sep 14 WAITING FOR REVIEW NORTHWIND RESEARCH CENTER Tue Sep 15 · Developer 2.5 h FROM THE SESSION AND PR #218 Wed Sep 16 · Project manager 1 h FROM THE MEETING Thu Sep 17 · Project manager 0.5 h FROM THE EMAIL NOT BILLED: INTERNAL TOOLING, MARKED REVIEWED Approve Edit HOURS ARE RECORDED ONLY WHEN A PERSON TAPS APPROVE ILLUSTRATION: THE CLIENT, DATES AND HOURS ARE MADE UP
A week of evidence for a made-up client becomes proposed entries on a card. The person edits and approves, and only then are the hours recorded.

Code builds the draft

On the first of each month, a job looks at every active contract. Each contract bills on its own schedule: monthly, quarterly, once a year or by milestone. The job drafts an invoice only when a billing window has closed.

  • A window that is still open, even with hours waiting to be billed, gets a line in the morning briefing. It isn't drafted early.
  • A milestone contract never gets a draft built from hours. A finished milestone with no invoice becomes a note for a person.
  • If a draft for that client is already waiting, the job extends it to the new end date instead of deleting it and starting over.

The lines come from code. Approved hours are grouped into one line per role, such as Developer Hours, with a few bullets taken from the entry descriptions. People's names stay off the invoice. Each time entry is linked to the invoice that bills it, and a new draft only picks up entries with no invoice yet, so the same hour can't be billed twice.

The agent can still adjust a draft. It can add a monthly hosting line, apply a note such as "add the newsletter to the next invoice" or fix a description. It can change dates and amounts only while the invoice is a draft. After that, its tools refuse the change.

Two taps, each checked in code

The draft appears on a card with the client's name and the total. When a person taps Approve, the server checks four things before anything happens:

  • The invoice is still a draft.
  • The client is linked to our accounting system, QuickBooks.
  • The total is more than zero.
  • The lines add up to the total, to within a dollar.

If a check fails, the tap is refused and the card says why. If all four pass, the draft goes to QuickBooks, which gives it an invoice number. Approving doesn't send anything. It opens a second card, Send, that says exactly who will receive the invoice. Tapping Send has QuickBooks email the invoice, with the PDF attached, to the client's billing contacts, and marks it as sent.

Both cards accept a tap only from the account's human owner. The same request made with an agent's credentials is refused. The agent has no tool that pushes an invoice to QuickBooks, sends it or marks it as sent.

A draft invoice needs two taps to reach a client An illustration with a made-up client, amounts and invoice number. A draft invoice for Northwind Research Center, Jul 1 to Sep 30, 2026, has two lines built from approved hours: 24 developer hours at $150.00, which is $3,600.00, and 6 project manager hours at $175.00, which is $1,050.00, for a total of $4,650.00. A person taps Approve. The server then checks that the invoice is still a draft, that the client is linked to QuickBooks, that the total is above zero, and that the lines add up to the total. With all four passing, the draft is pushed to QuickBooks, which assigns invoice number INV-0142, and nothing is sent yet. A second card, Send invoice INV-0142, says QuickBooks will email the invoice with the PDF attached to billing@northwind.example. Only when a person taps Send does it go out and get marked as sent. Both taps accept only the human owner, and an agent's credentials are refused. CARD 1: THE DRAFT AT THE TAP CARD 2: SEND Approve invoice DRAFT NORTHWIND RESEARCH CENTER JUL 1 TO SEP 30, 2026 Developer Hours $3,600.00 24 H AT $150.00 Project Manager Hours $1,050.00 6 H AT $175.00 Total $4,650.00 Approve CHECKED ON THE SERVER Still a draft Client linked to QuickBooks Total above zero Lines add up to the total Pushed to QuickBooks NUMBER ASSIGNED: INV-0142 NOTHING IS SENT YET Send invoice INV-0142 NORTHWIND RESEARCH CENTER QuickBooks emails INV-0142 ($4,650.00) with the PDF attached to billing@northwind.example Send ONLY THIS TAP REACHES THE CLIENT THEN THE INVOICE IS MARKED SENT APPROVE NEVER SENDS. BOTH TAPS ACCEPT ONLY THE HUMAN OWNER, NEVER AN AGENT. ILLUSTRATION: THE CLIENT, AMOUNTS, EMAIL AND INVOICE NUMBER ARE MADE UP
An illustration with made-up names and amounts. Approve runs four checks and gets an invoice number. Only the second tap, Send, reaches the client.

When you build this for your own team, run the checks on the server at the moment of the tap. A card can be out of date by the time someone taps it, and the server reads the invoice as it is now.

Bills we pay work the same way

Contractors send us their invoices by email. A daily job reads the attached spreadsheet or PDF, logs the hours from its lines at the rate we agreed with that contractor, and records a bill linked to those hours. Code then compares the hours times the rate with the total the contractor wrote.

  • If they match to within a dollar, the bill is approved when it arrives and waits for the next pay run.
  • If they don't match, or no hours are linked, the bill gets its own Approve card, and the tap runs the same comparison again.

Money moves only after a person confirms the pay run. Confirming marks the approved bills as paid and drafts a short "payment processed" note to each contractor, each on its own Send card.

A contractor's bill is checked against its hours An illustration with made-up contractors, rates and amounts. Bill 17 from Alex Rivera states $2,400.00. The hours logged from its lines are 32 at the agreed $75.00, which is $2,400.00, so it matches to the dollar and is approved on arrival, waiting for the pay run. Bill 9 from Jordan Lee states $1,950.00, but its 24 hours at $75.00 come to $1,800.00, off by $150.00, so it gets its own Approve card, and the tap runs the same check again. Money moves only at the pay run, where a person confirms, the approved bills are marked paid, and a payment note to each contractor waits on its own Send card. A bill matches when hours times the agreed rate is within a dollar of its total. THE BILL HOURS FROM ITS LINES RESULT MONEY MOVES Bill #17 · Alex Rivera STATED TOTAL $2,400.00 32 h at $75.00 LOGGED: $2,400.00 MATCHES TO THE DOLLAR Approved on arrival WAITS FOR THE PAY RUN Bill #9 · Jordan Lee STATED TOTAL $1,950.00 24 h at $75.00 LOGGED: $1,800.00 OFF BY $150.00 Its own Approve card THE TAP CHECKS AGAIN IF IT PASSES, PAY RUN Pay run A PERSON CONFIRMS APPROVED BILLS MARKED PAID PAYMENT NOTES ON SEND CARDS A BILL MATCHES WHEN HOURS TIMES THE AGREED RATE IS WITHIN A DOLLAR OF ITS TOTAL. ILLUSTRATION: THE CONTRACTORS, RATES AND AMOUNTS ARE MADE UP
An illustration with made-up names and amounts. A bill that matches its logged hours waits for the pay run. One that doesn't gets its own card.

Our finance inbox is sorted like the rest of our email, as described in How we triage email with rules, AI and checks in code. Receipts are archived. A bill we owe, or a client's question about an invoice we sent, becomes a work item, and the client's question gets the higher priority.

Mark where money moves

Write down every step of your billing process, from the first sign of work to the payment. Mark each step where money moves or a client sees something. Those steps need a person's tap and a check in code that runs at the tap. Everything else, such as gathering evidence, proposing hours and building the draft, is work an agent can prepare.

That list is where our AI Workflow Review starts. Everything else our agent does, and the rules it follows, is on How we run Kaizen on AI.

Want the same for your company?

Bring us two or three workflows that take up your team's week. We will tell you which one to automate first.

How we implement AI

Book a 30-minute call