How We Built a Deterministic Employment-Rules Engine

By Alex V.6 min read

An employee handbook is only as trustworthy as the rules behind it. A generic template might read well, but if it misses your state's sick-leave law or your country's final-pay timing, it quietly leaves you exposed — and most owners never find out until it matters.

For a while, we leaned on AI plus a live web search to work out which rules applied every time someone generated a handbook. It was flexible, but it had a fundamental flaw: the same business could get different answers on different days. So we built something sturdier — a curated employment-rules database that deterministically decides which policies apply to your business, and lets the AI write from real rules instead of guessing at them.

Not legal advice

The rules database is planning guidance, not legal advice. Every rule links to an official government source so you can verify it, and you should still have employment counsel review your handbook before publishing. This post explains why we built it and how it works — see the story behind location-aware planning for the earlier chapter.

The problem we kept seeing

Handbook compliance is genuinely hard because the rules are conditional. Whether a policy applies to you depends on where you operate, how many people you employ, and sometimes what industry you're in. Asking a language model to reason through all of that, live, on every generation, created three recurring problems:

  • Inconsistency — the same California restaurant could get a meal-break policy one day and miss it the next, depending on how the search and the model happened to land
  • Unverifiable claims — when an AI asserts "your state requires X," there's often no citation to check it against
  • Slow and repetitive — re-researching the same well-known state laws on every single handbook is wasteful and adds latency

This is the same class of reliability problem we wrote about in ChatGPT vs employee handbook software: raw generation is fast and confident, but confidence isn't compliance.

Why handbook rules are different

Most content an AI writes is judged on whether it reads well. Employment rules are judged on whether they're correct for a specific business — a much higher bar:

  • They're gated, not universal — "overtime after 8 hours in a day" applies in some states and not others; "harassment training" often kicks in only above a headcount threshold
  • They stack by jurisdiction — a business gets federal rules, plus state rules, plus anything specific to its industry, all at once
  • They change — laws are passed, amended, and repealed, so "true last year" isn't good enough

The key insight

Deciding which rules apply is a structured lookup — it should be deterministic code, not a creative task. Writing the policy prose is a language task. We had been asking the AI to do both; splitting them is what made the whole thing reliable.

Why we built a rules database

Three reasons drove the decision to make a curated database the source of truth:

1. Deterministic selection

Given your country, state, employee count, and industry, the same set of rules comes back every time. No randomness, no "it depends on the day." Two identical businesses get identical coverage.

2. One vetted source of truth

Each rule is researched from an official government source and stored with that citation. The rules are reviewed the way code is — through our own vetting before they ever reach a customer's handbook — rather than re-derived on the fly from whatever a search returned.

3. Content grounded in real rules

The AI still writes the policy — but now it writes from the matched rules instead of inventing them. That keeps the language natural and on-brand while the substance comes from a vetted, cited rule. Web search becomes a supplement for genuine gaps and freshness, not the primary engine.

How it works

When you generate or update a handbook, HandbookHub resolves the rules that apply before the AI writes a word:

  • Country & region — your operating country and states/regions select the jurisdiction layers (federal + each state)
  • Employee count — headcount-gated rules (like training thresholds) switch on only when your team size actually crosses them
  • Industry — industry-specific rules apply when your business matches; general rules apply to everyone
  • Result — the matched rules become handbook sections, and the AI drafts each one from the rule and its source

Because your handbook's outline and state addendums are assembled from these rules, they reflect your real situation — not a one-size-fits-all template. Setting your location, size, and industry during onboarding is what powers the match, so it's worth getting those right.

How we keep it current

A rules database is only useful if it stays fresh, so maintenance runs continuously in the background:

  • Discover new places — research jurisdictions we don't cover yet, and mark the ones with no special rules so we don't keep re-checking them
  • Find new rules — revisit places we already cover to catch newly passed policies
  • Catch changes — re-verify existing rules and flag anything that looks amended or repealed

Nothing goes live unreviewed

Anything the automated research turns up is stored as pending review and is invisible to handbook generation until a human promotes it. The engine never writes your handbook from a rule a person hasn't signed off on. Keeping a handbook accurate over time is a discipline in itself — see our guide on how to maintain an employee handbook.

Before and after

BeforeWith the rules database
AI + live search decides which rules apply each timeDeterministic lookup by country, region, headcount, industry
Same business can get different answers day to dayIdentical businesses get identical, repeatable coverage
Claims often lack a checkable citationEvery rule carries an official government source
AI invents policy substanceAI writes prose from a vetted rule

What we cover today

The database launches with US federal rules and US state rules seeded from our researched US state handbook guides, with Australia and India regions supported and more jurisdictions being added over time. Each state guide — like our California employee handbook page — is the canonical source for that state's rules, so the page you can read and the rules that build your handbook stay in sync.

How it fits the rest of HandbookHub

The rules engine sits underneath the features you already use:

  • AI structure builds your outline and state addendums from the matched rules
  • AI writing drafts each section from the rule and its source, in your voice
  • Inline suggestions let your team refine the language over time

Together, that's the goal: substance from a vetted, cited rules database, and wording from AI you control.

Frequently asked questions

Is the employment-rules database legal advice?

No. It's planning guidance to help your handbook cover the right topics for your location, headcount, and industry. Every rule links to an official government source so you can verify it, and you should still have employment counsel review your handbook before publishing.

Which locations does the rules database cover?

US federal rules plus US states, with Australia and India regions supported and more being added over time. Rules are matched to your country, region, employee count, and industry, so you only see policies that actually apply to your business.

How do you keep the rules current?

Background jobs continuously research new jurisdictions, look for new policies in places we already cover, and flag rules that may have changed or been repealed. Anything the automated research discovers is held for human review and only goes live after a person promotes it — the handbook never generates from unreviewed rules.

Compliance shouldn't come down to how a search happened to go on a given afternoon. We built the employment-rules database so the substance of your handbook rests on vetted, cited rules — and the AI does what it's genuinely good at: turning those rules into clear policy your team can read.

AV

Alex V.

Founder at HandbookHub

Alex has been building software tools for over 10 years. He founded HandbookHub to help companies create, manage, and search employee handbooks without the usual weeks of manual work.

Build a handbook on real employment rules

HandbookHub matches vetted, cited rules to your location, size, and industry

Generate a handbook whose state and country policies come from a curated employment-rules database — deterministic, source-backed, and kept current.