Piece rate by job
The rule
Each unit produced (a box packed, a load moved, a garment sewn) pays a set amount, which depends on the work: packing pays one rate, forklift loads another. Rates change from a date; work is paid at the rate in force on its workday.
Who uses it
Agriculture, garment and food production, warehouses and installers: work where output is counted and paid by the unit, alone or on top of hourly pay.
How the recipe does it
Configuration only: a package (package.toml) of one layer running the
standard piece_rate step. The rates are the tenant’s setup.
[[layer]]id = "pieces"[[layer.step]]id = "pieces"uses = "standard/piece_rate"params = { measure = "boxes", rate = "piece", pay = "pay", category = "piece_pay" }
[[rate]] # one rate per job; the most specific winskind = "piece"matches = { job = "pack" }amount = 30 # minor units: 30 centscurrency = "USD"Counts are labor entries of a count measure (boxes), each with its labor
context. For each count of the day, piece_rate asks for the rate of the
kind rate on that count’s context and workday (ctx:rate), and adds the
count times the rate as money (ctx:add_quantity) in the measure pay.
Of the rates whose values the work has, the one naming the most wins; a
rate naming none is the default; two naming as many is an exception
(rate_ambiguous), and nothing is paid until it is settled. With each
instead of rate, every unit pays the same: a plant paying one rate
replaces the step in a layer of its own with each = 20.
A corrected count replaces the first (replaces), and the money follows.
What your setup needs
Set up before you adopt the recipe; the recipe’s steps read them by name, and adopting it is refused, with a list of what is missing, until they exist.
- A measure called
pay: the amount the recipe adds up (money in a currency, or a count).
The scenarios show each as it was set up for them.
Parameters
| Parameter | Meaning |
|---|---|
measure | The count measure paid for. |
rate | The rate kind to look up, matched on each count’s context. |
each | Instead of rate: one amount per unit, in minor units. |
pay | The money measure the pay is added in. |
category | The category of the pay. |
What the scenarios show
each-job-at-its-rate: packing at 30 cents, forklift at 50, and a job without a rate of its own at the default 25.a-raise-from-a-date: Tuesday at the old rate, Wednesday at the new.one-rate-for-everything:each = 20, and a recount replacing a count.
Legal note
This is a common way companies implement piece-rate pay; check the rules where you operate. Many places require piece-rate earners to make at least the minimum wage for all hours worked, and some require separate pay for rest and other non-productive time.
Get the recipe
The recipe’s package and its scenarios are in the example packages repository: attendance/piece_rate. Test it, or your own copy of it, with hourctl attend test, and publish it with hourctl attend pkg publish.
The policy package
The package’s layers, with the standard steps each one runs and their settings:
name = "piece_rate"version = "1.0.0"description = "Pay for each unit produced, at a rate matched on the work's context (the job, the line, the assignment), changing from a date."
# What the tenant must have set up for the recipe: the steps read these by name.[needs]measures = ["pay"]
# Each box counted is paid at the piece rate for its work: the rate that# names the most of the work's context wins.[[layer]]id = "pieces"[[layer.step]]id = "pieces"uses = "standard/piece_rate"params = { measure = "boxes", rate = "piece", pay = "pay", category = "piece_pay" }Scenarios
Each scenario gives a person’s punches and setup and the timecard they must produce, worked out with this package adopted (the format).
The packing rate goes from 30 to 35 cents a box on Wednesday: Tuesday's boxes are paid at the old rate, Wednesday's at the new, each by the rate in force on its workday
description = "The packing rate goes from 30 to 35 cents a box on Wednesday: Tuesday's boxes are paid at the old rate, Wednesday's at the new, each by the rate in force on its workday"
[policy]zone = "America/Chicago"
[[measure]]id = "boxes"kind = "count"
[[measure]]id = "pay"kind = "money"currency = "USD"
[[rate]]kind = "piece"matches = { job = "pack" }amount = 30currency = "USD"to = "2026-10-06"
[[rate]]kind = "piece"matches = { job = "pack" }amount = 35currency = "USD"from = "2026-10-07"
[[labor]]workday = "2026-10-06"measure = "boxes"quantity = 100category = "pieces"values = { job = "pack" }
[[labor]]workday = "2026-10-07"measure = "boxes"quantity = 100category = "pieces"values = { job = "pack" }
[expect]week = "2026-10-05"quantities = [ "2026-10-06 boxes 100 pieces job=pack", "2026-10-06 pay 30.00 USD piece_pay job=pack", "2026-10-07 boxes 100 pieces job=pack", "2026-10-07 pay 35.00 USD piece_pay job=pack",]Boxes counted per job: packing pays 30 cents a box and forklift loads 50, matched on each count's job; a job with no rate of its own, labeling, is paid by the rate that names nothing, 25 cents
description = "Boxes counted per job: packing pays 30 cents a box and forklift loads 50, matched on each count's job; a job with no rate of its own, labeling, is paid by the rate that names nothing, 25 cents"
[policy]zone = "America/Chicago"
[[measure]]id = "boxes"kind = "count"
[[measure]]id = "pay"kind = "money"currency = "USD"
[[rate]]kind = "piece"matches = { job = "pack" }amount = 30currency = "USD"
[[rate]]kind = "piece"matches = { job = "forklift" }amount = 50currency = "USD"
# The default: a rate that names no value matches any work, and loses to# any rate that names one the work has.[[rate]]kind = "piece"amount = 25currency = "USD"
[[labor]]workday = "2026-10-05"measure = "boxes"quantity = 100category = "pieces"values = { job = "pack" }
[[labor]]workday = "2026-10-05"measure = "boxes"quantity = 12category = "pieces"values = { job = "forklift" }
[[labor]]workday = "2026-10-05"measure = "boxes"quantity = 40category = "pieces"values = { job = "label" }
[expect]week = "2026-10-05"quantities = [ "2026-10-05 boxes 12 pieces job=forklift", "2026-10-05 boxes 40 pieces job=label", "2026-10-05 boxes 100 pieces job=pack", "2026-10-05 pay 6.00 USD piece_pay job=forklift", "2026-10-05 pay 10.00 USD piece_pay job=label", "2026-10-05 pay 30.00 USD piece_pay job=pack",]A plant that pays one rate for every box needs no rate table: each = 20 pays 20 cents a box, whatever the job; a corrected count replaces the first
description = "A plant that pays one rate for every box needs no rate table: each = 20 pays 20 cents a box, whatever the job; a corrected count replaces the first"
[policy]zone = "America/Chicago"
# A plant that pays one rate for every box: 20 cents each.[[layer]]id = "one-rate"[[layer.step]]id = "pieces"change = "replace"uses = "standard/piece_rate"params = { measure = "boxes", each = 20, pay = "pay", category = "piece_pay" }
[[measure]]id = "boxes"kind = "count"
[[measure]]id = "pay"kind = "money"currency = "USD"
[[labor]]id = "l1"workday = "2026-10-05"measure = "boxes"quantity = 90category = "pieces"values = { job = "pack" }
# The supervisor recounts: 95, not 90.[[labor]]id = "l2"workday = "2026-10-05"measure = "boxes"quantity = 95category = "pieces"values = { job = "pack" }replaces = "l1"recorded = "2026-10-06 09:00"
[expect]week = "2026-10-05"quantities = [ "2026-10-05 boxes 95 pieces job=pack", "2026-10-05 pay 19.00 USD piece_pay job=pack",]