Skip to content

Policies

A policy turns a person’s punches into paid time. It says how days, weeks and pay periods are counted. It also says which pay rules apply. Read this page to learn what a policy can decide and how it is put together for different groups of people. You also learn how shared rules reach every tenant that follows them.

A policy has two parts:

  • Settings: how days, weeks and pay periods are counted, how many decimal places hours have, and which pay category work goes in.
  • Rules: rounding, overtime, premiums, lateness, accruals and so on. Each rule has its own settings, such as “overtime over 40 hours a week” or “round to the nearest quarter hour”.

Nothing is assumed. With no rules, nothing is rounded and nothing is overtime. Fifty hours in a week are fifty hours of work until a policy says what overtime is.

A policy is built in layers. Each layer says only what it changes. Its eligibility rule says whom it applies to. Layers apply from the most general to the most specific. So a site can change one threshold and keep everything else from the company. Policy layers shows how they combine.

Eligibility ruleApplies to
(none)Everyone in the tenant.
employer = acme-caThe people of one employer.
jurisdiction = us-caPeople working at a location in California.
under unions:local-42People in union local 42 or a shop under it.
attributes.pay_group in (seasonal, part_time)People whose employment says so.
person = 4471One person.
  • Layers apply day by day. Someone who moves to a California location on Wednesday has California’s rules from Wednesday. This holds even in the middle of a pay period. How days, weeks and pay periods are counted follows the layers in force on the pay period’s first day.
  • Layers have dates. A layer applies from a date, and optionally until one. A new version never changes the old one. A new union contract is a new version from its first day, and the weeks before keep the old one.
  • Layers can lock things. A layer can lock a setting or rule so that no later layer can change it. A jurisdiction layer can add the daily overtime the law requires and lock it. Then a client’s layer can’t switch it off by accident. A change that a lock forbids isn’t applied. It is listed so you can see it was refused.
  • Everything says where it came from. Every setting and rule in a person’s policy records which layer gave it.

For example, the company pays overtime over 40 hours a week. The California layer adds overtime over 8 hours a day and locks it. A client’s layer tries to turn the daily rule off. That change is refused and listed. Ten hours on a Monday are still eight of regular time and two of overtime.

A layer can make these changes to the rules:

ChangeWhat it does
AddAdds a rule before or after a named rule, or at the end.
Change settingsChanges some of a rule’s settings and keeps the rest, such as the weekly threshold from 40 hours to 38. A setting can also be cleared.
ReplaceSwaps a rule for a different one.
Turn off, turn onTurns a rule off, or back on.

A change that can’t apply is refused and listed. One example is a change to a rule that doesn’t exist. Another is a change to a rule that’s locked. A change is never guessed at.

A policy package is a policy written once and used as a whole. It holds its layers, any rules of its own, and the scenarios that prove it. Every recipe in the policy cookbook is one.

A package is either a tenant’s own or shared. A shared package is published once for the whole install by whoever runs it. Examples are a state’s rules, kept up to date as the law changes, and the pay rules every location of a franchise follows.

A tenant adopts a package, shared or its own, in one of two ways:

  • Follow a major version: every version of it published later reaches the tenant.
  • Pin a version: the tenant keeps that version, whatever is published after it.
Shared package published for the install Tenant's own package published for one tenant adopt: follow or pin Tenant's policy franchise@2 package layers, locked company everyone us-ca jurisdiction = us-ca plant-7 under sites:plant-7 each person, each day Effective policy for that day
Adopted packages' layers come first in the tenant's policy. What they lock, no layer of the tenant's can change. The layers whose eligibility rules pick a person on a day make up their policy for that day.

What you can rely on:

  • Checked before anyone gets it. Publishing a package runs its scenarios on the server. A version whose scenarios fail is kept as a failed revision, with what failed. It never reaches any tenant.
  • Versions never change. A published version stays as it is. A fix is a new version.
  • Effective dates. A version says the workday it is in force from. A law change taking effect on 1 May can be published in April and applies from 1 May. Earlier days keep the version they had. A closed pay period that it reaches takes it as a late change.
  • Locks hold. What an adopted package locks, no layer of the tenant’s can change. Adding a layer that would is refused. Adopting a package that would lock something the tenant’s layers change is refused too.
  • What it needs is set up. A package says which accrual categories and measures of the tenant’s setup its steps read by name. Examples are a balance of hours and the wages a supplement is paid in. Adopting the package is refused until the tenant has set them up. The refusal lists everything that is missing. Taking one away while a package needs it is refused too.
  • Tenants are told. Each tenant whose followed version changes is sent package.updated. A tenant that pinned a version is not.

Adopting, pinning or dropping a package works the tenant’s people out again from that moment. You can’t drop a package that one of the tenant’s layers uses. The cookbook’s franchise pay rules and working week by law are shared packages. How a package is laid out and tested is in writing policy steps.

TaskAPIhourctl
Publish (--shared: for the install)POST /api/attendance/packages/shared, POST .../tenants/{t}/packageshourctl attend pkg publish <folder> [--shared] [--effective 2026-11-02]
List, readGET /api/attendance/packages/shared[/{name}], GET .../tenants/{t}/packages[/{name}]hourctl attend pkg list [--shared], pkg show <name>
Adopt (follow, or pin)PUT .../tenants/{t}/packages/adopted/{name} with {"version": "2"} or {"version": "2.3.1"}hourctl -t acme attend pkg adopt franchise@2, pkg pin [email protected]
List adoptionsGET .../tenants/{t}/packages/adoptedhourctl -t acme attend pkg adopted
DropDELETE .../tenants/{t}/packages/adopted/{name}hourctl -t acme attend pkg drop franchise

Only install tokens can use the shared routes. A package name is unique across shared packages and every tenant’s own. A tenant’s written-out document carries its own packages and its adoptions. A shared package it adopts must be published on the install where the document is loaded.

SettingWhat it setsUnless set
week_startsThe day weeks start on, and optionally a time. For example, "friday 12:00" for a 9/80 schedule’s workweek.Monday
day_startsThe time a workday starts. With 04:00, anything before 04:00 belongs to the day before.midnight
decimalsThe decimal places of hours.2
shifts.earlyHow early someone can start and still count as on their shift, such as 30 minutes.not early at all
pay_periodsHow pay periods run: weekly, every so many days, on days of the month, or your own calendar (pay periods).weekly
close.after_daysClose each pay period automatically this many days after it ends, at the start of that workday in the person’s time zone. 0 closes it as it ends (period close).closed only by hand
close.late_changesWhat happens to a change to a closed pay period: adjust the open period, or refuse (period close).adjust
accruals.sinceThe date time-off balances count from (accruals).no balances
accruals.leave_year_startsThe month and day a leave year starts on, such as "07-01"."01-01"
sidesWhether time is worked out only for pay, or for billing customers too (pay and bill).pay only
categories.workThe pay category work goes in.work
categories.lunch, categories.breakThe pay category for lunches or breaks, if they’re paid.unpaid

Some settings have a group name: shifts, close, accruals and categories. You can write them in two ways. One is a dotted name, such as accruals.since. The other is a table under the group’s name, such as { "accruals": { "since": "2026-01-01" } }. The two mean the same. This holds in a layer sent to the API, a package’s package.toml, a tenant’s document and a scenario. A table that is a setting’s value (pay_periods) stays that setting’s value.

Some things are refused:

  • Giving a setting both ways in one layer.
  • A setting that is not in this table.
  • A lock of a setting that is not in this table.

The error names the setting. It also names the setting closest to it (decimal: decimals).

A person’s time zone isn’t part of the policy. It belongs to the person, or to their work location. Their days, weeks and shift times are counted in it.

Each rule has a name in the policy, the rule it uses, and its settings. Most policies use only the standard steps with their settings. Of the cookbook’s recipes, only two exporters need rules of their own. They write a payroll system’s own file layout. The policy cookbook has ready-made, tested policies for common rules. Use them as they are or start from them.

Rules run in a fixed order of stages:

  1. Punches are cleaned up.
  2. Work is matched to shifts and assignments.
  3. Overnight work is given its day.
  4. Times are adjusted (rounding).
  5. Time is sorted into categories (overtime, premiums).
  6. Time off is earned.
  7. Exceptions are flagged (lateness, missed rest).

Within a stage, rules run in the policy’s order.

For example, a policy has overtime over 8 hours a day, then overtime over 40 hours a week counting only regular time. Someone works five nine-hour days and four hours on Saturday. Each weekday’s ninth hour is daily overtime. The weekly rule doesn’t count those hours again. So Saturday’s hours are the ones that go over 40.

Weeks and pay periods don’t have to line up. When a week starts in the previous pay period, a weekly rule counts that week’s earlier days too. But it only moves time in the current period.

Wherever pay rules differ by place, contract or company, the policy decides. Each of these has a ready-made rule in the standard steps and a tested recipe in the cookbook:

DecisionFor example
Which punches countIgnore a badge swiped twice. Give a direction to punches from a clock with no in and out keys. Close a shift whose clock-out was forgotten.
Which shift work belongs toHow early or late still counts as the shift.
Which assignment work goes toThe person’s primary assignment, when several fit.
Which day an overnight shift belongs toWhole to the day it starts or ends, or split at midnight.
RoundingTo the quarter hour, the tenth, or snapped to the schedule.
Which rate appliesThe higher of two that match equally well.
Overtime, premiums, deductionsDaily, weekly or 24-hour overtime, in tiers. The seventh consecutive day. Time past the schedule. Night, weekend and holiday premiums. Meal deductions and meal premiums. Split shifts. Reporting and call-back minimums.
MoneyShift differentials and allowances, piece rates, productivity bonuses, earnings at each rate, tip credits.
Where a holiday is observedA Saturday holiday on the Friday before, or not at all.
Whether leave can be approvedNot more than the balance, not in a blackout week, long leave to a director.
Time offEarned per hours worked or by years of service, granted yearly, capped, forfeited past a carryover limit.
ExceptionsLate, left early, too little rest, no-shows, missed breaks, long days, attendance points.
Late changesSmall corrections to a closed period adjusted. Large or late ones refused for review.
ApprovalsWhat blocks approval, and who approves each stage.

No policy changes how time becomes decimal hours. Each line’s fraction is carried to the next, so the totals match the time worked. A policy chooses only how many decimal places to show.

Every change a rule makes is noted on the timecard line it changed. The note says which rule, which layers it came from, and what it did. For example: “weekly (company, plant 7): moved 7 hours from work to overtime: over 38 hours in the week”. So “why is this overtime?” always has an answer, down to which layer set the threshold.

A rule that fails stops that person’s timecard from being worked out. So does a policy that’s set up wrongly, such as a rule that doesn’t exist or a setting in the wrong form. The rule is named, and no answer is produced. The person shows as waiting, with the error, until it’s fixed.

You add layers through the attendance API (hourctl -t acme attend layer add @layer.json). You publish and adopt packages as shown above. Each layer’s eligibility rule is checked against each person’s employment, organization and location on each day.

  • Working out a layer with no start day. A revision in force from no day is the newest one in force on every day. That includes the day of the earliest kept ledger. So working it out marks everyone the layer’s rules can pick, from the first day they have.
  • Ledgers and replaced revisions. A ledger is a function of the facts and the policy in force. No kept ledger shows a revision that a newer one has replaced on its days.
  • A newer version that needs more setup. A new version of a package a tenant follows can need more than the tenant has set up. It is published all the same, and that tenant stays on the version it has. The adopted package’s status says held at 1.0.0: version 1.1.0 needs accrual category rtt. The publish answer lists the tenants held (held). The tenant is sent package.held. When the tenant sets up what is missing, it moves on to the version at once, with no further publication. It is then sent package.updated.
  • Suspended tenants. A suspended tenant sends no events, package.updated included. The event stays kept. It is delivered once the tenant is resumed.