---
name: commission-calculator
description: "Compute each agent's earned commission for the period using the splits table, including referral fees passed through, franchise levies deducted, and pre-agreed adjustments. Presents the result as a payable schedule with totals. Built for use inside month-end-close."
---

# Commission calculator

A building-block skill called by `month-end-close`. The feature that justifies this workflow for the office tier.

## What it does

Reads the splits table from the profile (a structured document mapping each agent to their commission rate per fee type), then for every completion that received its fee in the period:

1. Compute the gross commission per the splits table.
2. Pass through any referral fee owed to a referring agent or third party.
3. Deduct the franchise levy if applicable (a percentage of gross).
4. Apply any pre-agreed adjustment (one-off bonus, holiday cover, claw-back).

The output is a payable schedule, one row per agent, with the gross, the deductions, the net, and the deal references that build to each row. A totals row sums every column.

## Solo agent behaviour

For a solo agent with no splits table, the skill produces a single row showing gross fee income net of any referral fees and franchise levies. Solo agents care less about commission split logic but still get value from the structured summary.

## What it does not do

- It does not pay the agents. Payment is `payment-batch-stager`.
- It does not run payroll PAYE or NIC calculations. The schedule is gross-of-tax; the accountant handles tax.
- It does not amend the splits table. The table is edited out-of-band; the workflow reads.

## Connectors

Read: profile (splits table, franchise levy percentage), CRM (deal references), accounting (received fees from `period-reconciler`).
Write: none.

## Profile keys

- `realagent.commission.splits_table_path`
- `realagent.commission.franchise_levy_pct`
- `realagent.commission.adjustments` (list of pre-agreed adjustments per agent per period)
