Skip to content

Policy layers

Nobody writes a person’s policy in one piece. A company sets its rules. A jurisdiction adds what the law requires. A union contract changes a threshold. One person may have an agreement of their own.

Each of those is a layer. A layer says only what it changes. Its eligibility rule says whom it applies to.

On each day, the layers that apply to a person are combined into the effective policy for that day. Every value in the effective policy names the layer that gave it.

layers, lowest order first company rev 2 (everyone) decimals = 2 add step weekly: threshold, over 40h us-ca rev 1: jurisdiction = us-ca add step daily: threshold, over 8h lock step:daily plant-7 rev 4: under sites:plant-7 step weekly: over = 38h step daily: disable (locked above) e1 rev 1: person = E1 decimals = 3 nothing else Effective policy, E1, 2026-10-05 decimals = 3 e1 rev 1 weekly: threshold, over 38h company rev 2, plant-7 rev 4 daily: threshold, over 8h us-ca rev 1, locked refused plant-7 rev 4 changes step daily, which us-ca rev 1 locks the daily threshold still applies: the change is not applied, and is said
Of the layers whose rules pick the person that day, the lowest order applies first. A later layer wins for what it changes, unless an earlier layer locked it. Every value keeps the name of the layer that gave it.
Part
Id1 to 64 letters, digits, - or _: tenant, us-ca, local-42. An adopted package’s layers are named <package>@<version>/<layer>.
RevisionA number. A change to a layer is its next revision. The old one is kept.
OrderWhere the layer applies among the layers, the lowest first (default 0). Layers of the same order apply in the order they were added.
Eligibility ruleapplies_to: whom the layer applies to. It is a selector asked of the person on each day. Without one, the layer applies to everyone.
From, toThe workdays the revision is in force on. Either may be open.
SettingsValues the layer sets. It can also unset a value that an earlier layer set.
StepsChanges to the policy’s steps. You can add a step before or after a named step, replace what a step runs, change its parameters, or turn it off or on.
LocksWhat no later layer may change: setting:<key>, step:<id>, or * for every setting and step the layer gives.

Over the API, a layer is JSON (POST /api/attendance/tenants/{tenant}/layers, hourctl -t acme attend layer add @layer.json):

{ "id": "us-ca", "revision": 1, "order": 10, "applies_to": "jurisdiction = us-ca",
"locks": ["step:daily"],
"steps": [{ "add": { "id": "daily", "uses": "standard/threshold",
"params": { "over": "8h", "to": "overtime", "window": "day" } } }] }

In a policy package or a scenario, the same layer is TOML:

[[layer]]
id = "us-ca"
order = 10
applies_to = "jurisdiction = us-ca"
locks = ["step:daily"]
[[layer.step]]
id = "daily"
uses = "standard/threshold"
params = { over = "8h", to = "overtime", window = "day" }

In TOML, a step change says what it does with change:

  • No change (with uses) adds a step.
  • "params" changes parameters.
  • "replace" changes what the step runs.
  • "disable" and "enable" turn the step off and on.
  • before or after places a step you add.

A layer’s settings are a table: settings = { pay_periods = { every_days = 7, from = "2026-10-05" } }. unset = ["close.after_days"] takes a setting away.

A layer is refused (400) in any of these cases:

  • Its id is not a valid id.
  • Its rule is not a selector. The error names the column.
  • A lock is not a valid lock.
  • It changes one step twice. One change would be lost.
  • It gives a step parameters the step does not take. See the standard steps.

A layer’s rule is asked of the person as they are on each day. The rule can see these things about the person:

KeyThe person’s
personid
employeremployer; none for an unlinked person
workerworker
unlinkedtrue for an unlinked person, else false
locationwork location that day
jurisdictionthat location’s jurisdiction
attributes.<name>employment attribute that day: text as it is, a number or true/false as written (attributes.hours = 40); a list or a table is no value
under <hierarchy>:<org>organization of the hierarchy that day is the one named or under it, as the tree was that day

Here are some examples:

  • A state’s overtime, for everyone working in California: jurisdiction = us-ca.
  • A union’s contract, for everyone in its local or a shop under it: under unions:local-42.
  • employer = acme-ca (an employer’s people).
  • attributes.pay_group in (seasonal, part_time).
  • person = 4471 (one person).
  • jurisdiction = us-ca and not under unions:local-42.

A rule only decides which layers apply to a person. You cannot use it to list people. To list people, filter by under=. See lists of those under an organization.

Rules are dated, like the rest of a layer. On each day, the newest revision of the layer in force that day decides whether the layer applies. It decides by its own rule. Suppose a revision has a different rule from a given day. It changes whom the layer applies to from that day only. Earlier days keep the revision before.

A person’s own values change on these days:

  • the days their employment changes take effect (attributes, organization, location)
  • the days an organization above theirs moves

A layer applies from the day a person comes to fit its rule, or the day its revision is in force from. It applies until the day before they no longer fit. This holds even inside a pay period. Say someone moves to a California location on Wednesday. They have California’s layer from Wednesday.

How a step runs depends on its window:

  • A step whose window is a day runs on exactly the days its layer applies.
  • A step whose window spans days (a week, the pay period, 24 hours) runs on a window when its layer applies on any day of it. It counts and moves only the days the layer applies on. California’s weekly threshold from a Wednesday counts Wednesday to Sunday.
  • A step that runs once on the pay period (attribute, approve) runs when its layer applies on any day of the period.
  • A late step runs on the day of the change it decides.
  • A rate step runs on the workday of each tie it decides.
  • A leave step runs on any day of the request.
  • A holiday step runs on any day the ledger reaches.

Settings work in two ways:

  • Settings that apply to a day follow the layers in force that day. These are the categories each kind of segment starts in (categories.*) and shifts.early.
  • Settings that shape the period itself are those in force on the pay period’s first day. These are pay_periods, week_starts, day_starts, decimals, sides, close.* and accruals.since.

The layers that apply to a person on a day are applied in order. Each layer changes what the ones before it made.

  • A setting a layer gives replaces the one before. A setting it unsets is gone.
  • A step change applies to the step with that id.
    • params sets or unsets single parameters and keeps the rest.
    • replace changes what the step runs and its parameters.
    • disable and enable turn it off and on.
    • add places a new step after or before a named one, or at the end.
  • Once a layer locks a setting or a step, a change to it by any later layer is not applied. It is listed in the effective policy as refused, naming both layers.
  • A change to a step that does not exist is refused. So is an add of a step already there. Both are listed the same way, never guessed at.

For every setting and every parameter, the effective policy keeps the layer that gave it. For every step, it keeps the layer that added it and each layer that changed it. Ledger lines carry these names in their stamps: weekly [company rev 2, plant-7 rev 4].

Give the most general layers the lowest orders. The tenant’s is 0. A state’s or an employer’s is 10. A union’s or a site’s is 20.

An adopted policy package’s layers come first. Lowest order comes first, and packages of the same order go by name. Each version’s layers apply on the days it is in force. Then come the tenant’s own layers.

What a package’s layer locks, no layer of the tenant’s may change. Adding such a layer is refused (409, layer site changes step daily, which [email protected] (its layer overtime) locks).

A new revision of a layer works out again everyone its rules can pick. It starts from the day the revision is in force.

A change to a person works them out again from the day it takes effect. It works them out with the layers that apply to them. The change can be to their employment, their organization or their location.

You never ask for a recalculation by hand.

The engine has no settings or steps of its own. With no layers, there is no rule. That means no rounding, no overtime, no break deductions and nothing late.

What no layer sets is plain counting: days from midnight, weeks from Monday, paid by the week, two decimals. Each of those is a setting that a layer can change.

See policies for every setting and policy packages. See the standard steps for what a layer’s steps can run. See writing policy steps for a package’s own.