TL;DR: A commercial real estate law firm in Toronto was spending 25 hours monthly on expense categorization. Every expense needed three decisions: type, client billable, and cost center. 18% got miscategorized. $10K CAD in client-billable expenses went unbilled annually. Month-end close took 14 days. We built an agent that reads expense descriptions, infers client allocation from calendar context, and routes uncertain items for review. Categorization time dropped to 4 hours monthly. Miscategorization fell to 4%. The firm captured $14K in previously missed billable expenses in year one.

Two Weeks of Weekends

Mei had worked as the bookkeeper at a Toronto commercial real estate law firm for seven years. Twelve attorneys. Thirty-eight employees. A solid practice with complex financials.

Every month, for fourteen days, she worked weekends.

Not because she was slow. Because month-end close required categorizing hundreds of expenses, and every single one needed three decisions:

What type of expense is this? Office supplies, travel, meals, filing fees, outside services, professional development - dozens of categories.

Should this be billed to a client? Some expenses are clearly firm overhead. Others should get passed through to client matters. Get it wrong and the firm eats costs it should have recovered.

Which partner's cost center? Each partner tracks their own expenses for profit-sharing calculations. Assign to the wrong partner and the numbers are wrong.

Mei knew the firm's systems better than anyone. But with hundreds of expenses monthly, she couldn't remember which client had the closing last Tuesday or which partner had lunch in Mississauga on Thursday.

She made her best guesses. Then spent hours reviewing. Then caught some errors. Missed others.

"I work weekends for two weeks straight every month-end," she told the managing partner. "I can't keep doing this."

The Categorization Problem

Some expenses were simple. Office supplies from Staples: office expense, not billable, admin cost center. Easy.

Others required inference.

A meal at a restaurant near a client's office, on the same day as a client meeting. Probably billable to that client. But which matter? And was the meeting actually that day, or is Mei mis-remembering?

A filing fee at the land registry office. Obviously related to a transaction. But which one? Three deals closed that week.

A courier expense from a vendor they use for everything. Could be internal documents. Could be client deliveries. The description just says "courier service."

The bookkeeper couldn't possibly hold all this context in her head. But without that context, expenses got miscategorized.

For more on how to calculate what categorization errors actually cost, we've written about the hidden math.

The Numbers

The managing partner asked Mei to track the problem for a quarter. The results were worse than expected.

25 hours per month on expense categorization. That's more than three full workdays.

18% miscategorization rate. Nearly one in five expenses got assigned wrong on the first pass and needed correction later—or never got corrected at all.

$10,000 CAD annually in unbilled client expenses. Costs that should have been recovered from clients but got coded as firm overhead. Money left on the table.

14 days from month-end to close. Two weeks of Mei's life, every month.

The firm wasn't unusual. Professional services with complex expense allocation all face this. The question was whether there was a better way.

What We Built

The expense categorization agent has five stages.

Stage 1: Expense Capture

New expense enters the system via Expensify (for reimbursements and credit cards) or directly from vendor invoices. Agent captures: description, vendor name, amount, date, submitter.

Stage 2: Pattern Analysis

Reads the expense description and vendor. Matches to expense categories using patterns trained on the firm's historical data.

"Staples" → office supplies. "Via Rail" → travel. "Land Registry" → filing fees.

But also learned patterns: "Goodmans" (a law firm) → outside legal services. "Bay Adelaide Centre" → probably client meeting, building is a frequent client location.

Stage 3: Client Allocation

This is where context matters.

The agent checks calendar context. Who had meetings that day? Where were they? What matters were active?

A lunch expense on February 14th from a restaurant in Markham. The agent sees that Partner A had a client meeting in Markham that day for the Smith Industries matter. High probability: billable to Smith Industries.

A filing fee on February 16th. Three transactions closed that week. Agent looks at which transactions involved land registry filings, cross-references timing, assigns to the most likely matter.

When the inference is uncertain, it flags for review rather than guessing.

Stage 4: Cost Center Assignment

Determines which partner's cost center based on who submitted the expense and what type it is.

Partner-submitted expenses go to their cost center. Staff expenses get allocated based on who they support or which matter they worked on.

Stage 5: Confidence Routing

Every categorization gets a confidence score.

High confidence: auto-categorizes and flows to QuickBooks. No human touch needed.

Low confidence: queued for Mei's weekly review. She sees the agent's best guess plus the reasoning, then approves or corrects.

The review queue is usually 15-20 items per week. Takes about an hour. That's instead of 25 hours of manual categorization.

The Human Checkpoint

Mei reviews uncertain categorizations weekly. She can override with a reason, and those corrections train the system.

"Actually, Bay Adelaide Centre was for the Morrison file, not Smith"—that correction helps the agent learn.

The agent handles volume. Mei handles exceptions.

What Surprised Us

Calendar integration was essential.

The first version without calendar context had limited accuracy on client allocation. It could categorize expense types well but couldn't infer which client matters applied.

Adding calendar integration—seeing which meetings happened when and where—dramatically improved client allocation accuracy. The agent could connect a restaurant near a client site to the meeting that happened there.

The agent found patterns humans missed.

After a few months, the firm noticed something. Certain vendors appeared almost exclusively on client-billable expenses. A specific courier service used only for closing documents. A parking garage near the courthouse.

Mei had never explicitly categorized these vendors as "probably billable." She just handled them one at a time. The agent spotted the pattern and started using it.

Unbilled expenses exceeded estimates.

They thought they were losing $10K annually to miscategorization. In year one, the agent captured $14K in previously missed billable expenses. The problem was bigger than they knew.

The Numbers

Before:

  • 25 hours/month on expense categorization

  • 18% miscategorization rate

  • $10K CAD/year in unbilled client expenses (estimated)

  • 14-day month-end close

After:

  • 4 hours/month on review

  • 4% miscategorization rate

  • $14K captured in year one

  • 5-day month-end close

The quote that mattered:

"I have my weekends back. And the partners stopped asking why their distributions were late. Worth every penny."

That's what efficiency feels like to the person doing the work. Not just faster. Sustainable.

The Pattern

If your business has complex expense allocation—multiple categories, client billing, cost centers—you probably have categorization problems.

The symptoms:

  • Month-end close takes longer than it should

  • Finance person working overtime regularly

  • Meaningful error rate on expense categorization

  • Revenue leakage from unbilled client expenses

The core issue: Categorization requires context that humans can't hold in their heads. The information exists (calendars, matter lists, vendor history) but isn't connected at the moment of decision.

The invoice processing blueprint shows a similar challenge from the other direction—getting invoices out rather than categorizing expenses in. Same theme: financial operations that require context-aware decision making.

Next Steps

Want to see 25 agent architectures across different industries? Download Unstuck—it includes this one plus blueprints for lead gen, collections, dispatch, proposals, and more.

Think expense categorization might be your bottleneck? Book a Bottleneck Audit. 30 minutes, no pitch. We'll map your current process and identify where time is going.

by SP, CEO - Connect on LinkedIn
for the AdAI Ed. Team

Keep Reading