Overview
The Compliance Engine is a rule evaluation system that lets you define conditions, evaluate candidate and employee data against those conditions, and trigger actions based on the results. It’s the decision-making brain behind automated hiring, onboarding, and workforce compliance.How Rules Work
A Rule is a condition tree that evaluates totrue or false. Rules are composed of Rule Nodes — atomic conditions connected with AND/OR logic.
Rule Nodes
Each Rule Node contains:| Field | Description |
|---|---|
| Field Path | The data field to evaluate (using Object Graph) |
| Operator | The comparison operator |
| Value | The expected value |
| Logic | AND / OR connection to sibling nodes |
Operators
| Operator | Description | Example |
|---|---|---|
| equals | Exact match | status == "ACTIVE" |
| not_equals | Not equal | status != "REJECTED" |
| greater_than | Numeric comparison | age > 18 |
| less_than | Numeric comparison | experience < 5 |
| contains | String contains | email contains "@gmail" |
| not_contains | String does not contain | name not_contains "test" |
| in | Value in list | state in ["CA", "NY", "TX"] |
| not_in | Value not in list | country not_in ["restricted"] |
| is_empty | Field is empty | phone is_empty |
| is_not_empty | Field has value | resume is_not_empty |
| regex | Regular expression | ssn regex "^\d{3}-\d{2}-\d{4}$" |
Object Graph Integration
Rules reference data using the Object Graph (OG) path system:Rule Instances
A Rule Instance is a rule configured for a specific context. The same rule definition can be reused across multiple contexts with different parameters. Contexts where rules are used:- Hiring Flow stages — Gate stage transitions
- Automations — Conditional action execution
- Form compliance — Validate form submissions
- Document requirements — Verify document data
Rule Instance Values
Rule Instance Values provide context-specific parameters:Rule Executions
Every rule evaluation is recorded as a Rule Execution:| Field | Description |
|---|---|
| Rule Instance | Which rule was evaluated |
| Result | Pass or fail |
| Input Data | The data that was evaluated |
| Timestamp | When the evaluation occurred |
| Trigger | What triggered the evaluation |
AI-Powered Rules
Firstwork supports AI-powered rule evaluation where complex conditions can be assessed by LLM:- Natural language conditions (“Is this document a valid government-issued ID?”)
- Document content analysis
- Sentiment analysis on text responses
- Complex multi-factor assessments
Using Rules in Automations
Rules serve as the conditional logic in Automations: When an automation fires:- The trigger event occurs
- The rule is evaluated against current data
- If the rule passes, the associated actions execute
- If the rule fails, alternative actions can execute (or nothing happens)
Best Practices
Keep rules simple and composable
Keep rules simple and composable
Create small, focused rules that check one thing. Combine them using AND/OR logic for complex conditions. This makes rules easier to debug and reuse.
Use meaningful names
Use meaningful names
Name rules descriptively: “US Work Authorization Check” is better than “Rule 1”. This helps when reviewing rule executions and debugging compliance issues.
Test rules before deploying
Test rules before deploying
Use the rule evaluation preview to test rules against sample data before applying them to active hiring flows.
Monitor rule execution results
Monitor rule execution results
Regularly review rule execution logs to identify:
- Rules that always pass or fail (may need adjustment)
- Unexpected evaluation results
- Performance bottlenecks in complex rule trees