CHAI — Care & Home Assurative Integrations

Compliance
as Code

AI extracts rules once. Engine enforces forever.
A 7-layer declarative rule engine with graph-backed provenance — designed from the ground up for regulated care environments.

8 agents
42/42 tests passing
14 certs tracked
4 residents
LIVE in production
What CHAI does for your team
Eight AI agents handle the paperwork behind your shifts. Your team writes naturally — CHAI extracts the data, tracks the certifications, flags the incidents, and routes every decision that needs a human directly to the right person. The system knows exactly what it can do on its own.
Shift notes → auto-extracted Cert expiry → 30-day alert Incidents → CIR drafted in seconds Staffing gate → checked before every schedule Ledger → daily CLBC reconciliation
The platform thesis
CHAI is the proof of concept. 70% of the platform carries forward to every new vertical. The compliance structure — KYC, incident reporting, credential tracking, retention — is identical across healthcare, finance, legal, and medical. Each new domain is ~30% net-new code on top of proven infrastructure.
CHAI — BC RCR/CARF [LIVE] FHAI — CIRO/FINTRAC [SCOPED] MHAI — CPSBC/CRNBC [FUTURE] LHAI — LSBC [FUTURE] 70% platform reuse ~27K CIRO advisors (CA)
Designed for examination
Every rule reference is explicit. Every action has a regulation citation. The reconciliation graph retains 7 years of provenance — who decided what, at what confidence, with which human approval. ALERT-tier actions require human sign-off before execution. No autonomous external submissions.
BC RCR s.40, s.44, s.62-65, s.77, s.82-90 CLBC service agreement CARF accreditation standards 7-year audit retention Human signs every CIR Allowlisted outbound only

The 10 Things That Keep You Up at Night

Every group home in BC runs on the same fragile stack: binders, spreadsheets, memory, and whoever happened to be on shift. CHAI replaces that stack with something you set up once.

STAFFING · CRC
"Someone's criminal record check expired weeks ago and they've already worked three shifts."
→ CHAI blocks scheduling before the shift happens. Hard gate, no override, no exceptions.
INCIDENTS · FRASER HEALTH
"Did we file with Fraser Health within 24 hours? I can't find the paper trail."
→ Deadline clock starts the moment the incident is logged. Every notification timestamped.
NUTRITION · KITCHEN
"Our fridge temperature log is blank again. The inspector is coming this week."
→ Daily temperature prompts. Alert fires when the log is missing. Violation logged automatically.
NUTRITION · MEAL REFUSALS
"Mark has been refusing meals. I think it was three times this week but no one is sure."
→ Refusal threshold counter auto-escalates at 3 in 7 days. Administrator notified, ISP flagged.
WEIGHT · RCR s.64
"His weight has been dropping for 6 weeks and no one noticed until the CLBC visit."
→ 5% change over 30 days triggers automatic escalation to nurse + Fraser Health within 48h.
STAFFING · FIRST AID
"Two of our staff have expired First Aid. I only found out when building the shift schedule."
→ 30-day advance warning per cert, per staff member. Shift coverage check runs on every roster.
ISP · CLBC REVIEW
"The CLBC reviewer just pointed out our ISP hasn't been updated in over a year."
→ Field-level ISP completeness check runs daily. Missing or stale fields surface before the review.
INCIDENTS · FAMILY
"The family is asking why they weren't told about the incident last month."
→ Every notification is timestamped and stored. Exact time, who sent it, what was said.
STAFFING · ORIENTATION
"The new hire worked a solo shift before completing orientation. That was on me."
→ Orientation gate blocks unsupervised scheduling. Flagged on every shift until complete.
AUDIT · COMPLIANCE REPORT
"We have an audit in 3 days and I need to compile a compliance report from 6 different binders."
→ One endpoint. All residents, all agents, all gaps — ready any time, not just the week of the audit.
NOT JUST FOR CHAI · BREW^WEB
Not on CHAI yet? The compliance tools still work.
Meal refusal tracking, fridge temperature logs, dietary profile management, weekly menu planning, and the full compliance audit report are available as a standalone web portal — no CHAI deployment required. Group homes use it today as the "guidebook you fill in" for CLBC inspections, then migrate to full CHAI when they're ready.
Try Nutrition Portal → More standalone tools in development

Your Binders Are the Spec.
Hours, Not Weeks.

Cristina Home's 1,051-rule compliance corpus took two weeks of a human reading regulation binders, CLBC contracts, CARF standards, and operational policies — transcribing every obligation by hand. Every facility after the first faces the same bottleneck. The Onboarding Suite eliminates it.

YOU PROVIDE
Policy binders & operational manuals
Completed forms (incident reports, MAR sheets)
Regulatory PDFs (BC RCR, CLBC contract, CARF)
Employee handbooks & vendor invoices
HOURS OF REVIEW
not weeks
CHAI PRODUCES
Draft per-facility rules corpus for review
Enforcement code generated per obligation
Every rule traced to page + line of source
Facility live after operator approval
1,051 RULES · CRISTINA HOME
The proof it works.
Four layers: 424 operational (13 CH-NNN policies), 236 regulatory (BC RCR + CCALA), 246 funder (CLBC), 145 accreditation (CARF). Each rule: enforcement agent, check type, severity, RCR section. All generated from source documents.
PIPEDA & PIPA-BC · ZERO EGRESS
PHI never leaves your building.
All document AI runs on-premises. No OpenAI. No Google Document AI. No cloud LLMs. BC residential-care records are PIPA-BC regulated — local-only processing is not a preference, it is a legal requirement.
OPERATOR REVIEW · NOT ZERO-TOUCH
AI proposes. You decide.
Every extracted obligation is a draft until a qualified human approves it. The extraction is automated. The judgment is yours. This is the only arrangement that is defensible at a CLBC or Fraser Health audit.
PROVENANCE · PAGE + LINE
Every rule has a paper trail.
When a CLBC auditor asks why a staff scheduling decision was made, the answer is traceable through the event substrate: from the automated decision, back to the rule, back to the specific page and line of the policy document that required it.
NOVEL FIELD · coded_check
The extraction that writes its own enforcement code.
Document-management tools store policy text. CHAI generates the enforcement logic. For each extracted obligation, the pipeline produces a coded_check — a Python spec for the deterministic check that implements the obligation. A rule like "weight change ≥5% in 30 days triggers nurse notification within 48h" becomes runnable enforcement code, not stored prose.
boolean · deadline · schedule
threshold · classification · pattern_detection
field_present · staleness · expiry_tracking · gate
10 enforcement check types — every extracted obligation maps to one.
WHAT CHAI IS NOT · AND WHY THAT MATTERS
Next-token prediction
Statistical approximation over general training data Domain knowledge bounded by what was in the training corpus BC RCR + CLBC + CARF intersection: no training data exists Answers are probabilistic; compliance is binary General-purpose — jurisdiction-unaware
Domain knowledge execution
Expert-curated obligations run as deterministic checks Corpus grows with every new domain area — permanently This intersection has never been encoded anywhere else Outcomes are auditable, traceable, and defensible Jurisdiction-specific by construction: BC RCR, PIPA-BC
The ML in CHAI runs at the ingestion layer only — parsing shift notes, extracting entities from documents, classifying form regions. It does not make compliance judgments. Judgments are either already codified (rule exists → execute it deterministically) or newly encountered (rule doesn't exist yet → surface to the operator to codify it). The operator decision becomes a new rule. The corpus compounds. That is the moat.

The 7-Layer Rule Engine

Each layer has a single responsibility. Data flows from ingestion through inference, governance, and control — terminating in a permanent, examiner-ready graph node.

01
Data Ingestion
CASK Data Layer
Authenticated access to all external data sources via a single credential broker. Google Workspace, email threads, Home Assistant sensors, REST webhooks, and brokerage feeds all resolve through one audited access path.
Google Workspace Gmail Sheets Home Assistant REST Webhooks
02
Agent Framework
DomainAgent Base Class
Standardized agent skeleton shared across all regulated verticals. Eight sub-agents inherit from the same base, providing consistent logging, error handling, qdb observation writing, and autonomy tier enforcement. 70% platform reuse across CHAI, FHAI, MHAI, and LHAI.
8 Sub-Agents 70% Reuse QdB Write Audit Trail
03
Inference Engine
Hardy Confidence Gating
Every AI decision is scored before any action is taken. Outputs are classified as PRESTIGE (high confidence, proceed), MATCHED (verified against known patterns), or UNMATCHED (escalate to human). Low-confidence outputs never write to the ledger.
PRESTIGE MATCHED UNMATCHED → QUEUE
04
Governance Pipeline
Stage → Validate → Merge
Proposed changes are staged before any write occurs. The validator checks rule compliance, data completeness, and confidence thresholds. Only validated changesets merge to the ledger — partially validated changes are queued for human review, not silently discarded.
Stage Validate Merge No silent drops
05
Autonomy Control
Tiered Autonomy (YAML)
Every action is classified in a declarative YAML file: AUTO (execute immediately), QUEUE (stage for human review), or ALERT (notify human, human acts). The config is the contract — an auditor can read it and understand the system's authority boundaries.
AUTO — execute QUEUE — human reviews ALERT — human acts
06
Deliberation
Council Deliberation
Complex decisions — those requiring trade-off analysis, compliance review, or multi-stakeholder perspective — are routed to a council of 25+ weighted personas. Each persona argues from a distinct evidence basis. Decisions are documented with dissenting views before any action is taken.
4 Personas Evidence-Based Dissent recorded Compliance review
07
Audit & Provenance
Reconciliation Graph
Every action writes a permanent graph node linked to: the originating rule reference, the confidence score, the agent that acted, the human who approved (if required), and a timestamp. The graph is the audit trail — not a bolted-on log, but the operational data store itself. 7-year retention, examiner-ready.
7-Year Retention Examiner-Ready Rule Reference Confidence Score Human Gate Record

Tiered Autonomy in Practice

Real examples from services/config/autonomy_tiers.yaml. The config file is the contract. An auditor reads it and knows the system's authority boundaries.

AUTO
Execute immediately · logged
Routine, reversible, low-risk reads and writes. The system acts without waiting. Every action still writes to the reconciliation graph.
bookkeeper: classify
care_chronicler: document_shift_note
hr_sentinel: flag_cert_expiry
shift_coordinator: check_ratios
facility_steward: check_fire_safety
care_chronicler: log_weight
QUEUE
Staged · human reviews before merge
Higher-impact writes that need a human eye before committing. The system proposes; the human approves or rejects. Nothing merges without a decision.
bookkeeper: write_ledger
care_chronicler: draft_isp_modification
hr_sentinel: modify_staff_file
shift_coordinator: reassign_coverage
facility_steward: approve_expenditure
bookkeeper: resolve_hypothetical
ALERT
Human acts · system only notifies
Externally-visible or irreversible actions. The system prepares and alerts; a human performs every step. Required by BC RCR s.77 for all CIR submissions.
incident_commander: submit_report ← RCR s.77
incident_commander: notify_family
regulatory: submit_to_authority
shift_coordinator: approve_overtime
chai: send_email
chai: book

8 Domain Agents + 1 Lead Orchestrator

Every agent operates within its autonomy tier boundary. The orchestrator coordinates; the 8 domain sub-agents execute. No agent can exceed its declared tier without a code change and test pass.

CHAI ORCHESTRATOR
chai_agent.py — all sub-agents
AUTO Route to sub-agent
AUTO Aggregate qdb observations
ALERT Escalate to human
Bookkeeper
Finance — CLBC Ledger
AUTO Daily reconciliation
AUTO Backfill unmatched
QUEUE Write ledger entry
QUEUE Resolve hypothetical
Incident Commander
Safety — BC RCR s.77
AUTO Classify severity
AUTO Draft CIR report
ALERT Submit CIR to authority
ALERT Notify family
Shift Coordinator
Operations — RCR s.40
AUTO Check staffing ratios
AUTO Fill routine shift
QUEUE Reassign coverage
ALERT Approve overtime
Care Chronicler
Care Docs — RCR s.62-65
AUTO Document shift note
AUTO Log weight & nutrition
AUTO Flag care pattern
QUEUE Draft ISP modification
Regulatory Agent
Compliance — CLBC / Fraser Health
AUTO Track deadlines
AUTO Draft response
AUTO IPC / CQI checks
ALERT Submit to authority
HR Sentinel
HR — RCR s.37-43 / WorkSafeBC
AUTO Flag cert expiry (14 certs)
AUTO Run payroll check
AUTO Scheduling gate interlock
QUEUE Modify staff file
Facility Steward
Facility — RCR s.82-90
AUTO Create work order
AUTO Fire safety check
AUTO EPP completeness
QUEUE Approve expenditure

Graph-Backed Provenance Guarantee

Every action traces a permanent path from raw input to graph node. Nothing is implicit. The LLM drafts; the graph decides. An examiner can reconstruct any decision, at any point in time, in full.

RAW
Input
Shift note / email / sensor
AI
Extract
LLM parses structure
GATE
Hardy Gate
Confidence scored
TIER
Tier Check
AUTO / QUEUE / ALERT
Human Gate
If QUEUE or ALERT
Graph Node
Written to reconciliation graph
7yr
Retained
Examiner-ready
Rule Reference
Every action links to an explicit regulation citation. No implicit compliance — the rule is in the code.
Confidence Score
Hardy gate classification (PRESTIGE / MATCHED / UNMATCHED) recorded with every graph node. Auditors see why the system acted.
Human Gate Record
QUEUE and ALERT actions record who approved, at what time, and what they saw when they approved.
7-Year Retention
Graph retention matches BC RCR and CLBC requirements. Full reconstruction of any decision, any date.

The inspection company sends their own emailed PDF in their own format. CHAI provides a template they can use — but the mapping protocol runs regardless. Even their native format produces a CLBC-ready record.

External authority
Inspector’s Emailed Report
Their format, their logo, their sign-off. Stored as-is. The authoritative root.
SHA-256: a3f9c1… ← root
schema map
+ extract
CHAI normalized
CHAI-Schema Inspection Record
BC RCR s.22–26 fields populated. Derived from original, not written independently.
SHA-256: c71e… ← derived from a3f9…
format for
regulator
CLBC / regulator output
Facility Compliance Record
Monitoring-ready. Any auditor can walk backwards: CLBC record → normalized → original email.
Full chain on demand
“Looks self-generated?” — The original inspection report is the authoritative root of the hash chain. The CHAI-formatted version is transparently labelled as derived, with the extraction event recorded. If CLBC raises an eyebrow, the response is: here is the inspector’s original document, here is the mapping record, here is the hash that links them. The CHAI version was never independent — it is a translation, not an invention.

Why This Is Not an LLM Wrapper

The LLM is one component in a seven-layer system. It drafts; the graph decides. The distinction matters in every examination.

Dimension LLM Wrapper InfiniTEA OS / CHAI
Decision model Prompt → answer Graph node → confidence → tier gate
Audit trail Chat history (ephemeral) Reconciliation graph (7-year retention)
Human oversight Manual (after the fact) Tiered: AUTO / QUEUE / ALERT per action type
Rule reference Implicit in prompt Explicit in constants.py + autonomy_tiers.yaml
Regulatory posture Hope for the best Designed for examination from day one
Confidence gating None Hardy: PRESTIGE / MATCHED / UNMATCHED
Multi-agent deliberation Single model Council: 25+ personas, evidence-based
Vertical expansion cost Rebuild from scratch ~30% net-new code on proven platform

Compliance Anchors

CHAI encodes the actual regulations, not a summary. Each rule reference is cited in source code, tested, and linked to a specific autonomy tier.

BC RCR
BC Residential Care Regulation
s.37-43 (HR), s.40 (staffing), s.44 (resident rights), s.62-65 (documentation), s.77 (incidents), s.82-90 (facility safety)
CARF
Commission on Accreditation of Rehab Facilities
CQI program, incident management, care plan documentation, staff training records
CLBC
Community Living BC
Service agreement, quarterly/annual reporting, funding contract reconciliation (daily via Bookkeeper)
WSB
WorkSafeBC
HR Sentinel scans for WorkSafeBC compliance flags during payroll and scheduling gate checks
PIPEDA
Personal Information Protection (BC PIPA)
Resident data uses initials only in logs. Full names are PHI — never in shared observations or external logs
OUTBOUND
Outbound Communication Contract
Allowlisted recipients only. No autonomous external comms. Gmail send requires explicit ALERT tier approval

The Vertical Expansion Path

CHAI is the proof point. The platform scales horizontally to any regulated vertical with the same compliance structure: know your subject, document every action, report incidents, track credentials, retain records.

CHAI
Residential Care
BC RCR · CARF · CLBC
LIVE
FHAI
Financial Advisory
CIRO · CSA · FINTRAC
SCOPED
Fundraising
Governed Event & Fundraising
BCLDB · Fraser Health · CRA · Society Bylaws
LIVE
Trades
Construction & Trades
WorkSafeBC · Provincial Licensing Boards
IN SCOPE
MHAI
Medical Clinic
CPSBC · CRNBC
FUTURE
BREWTEA
Business & Regulatory Enterprise Workforce
Every vertical — CHAI, Fundraising, FHAI, Trades — and every O2O handoff between them operates through BREWTEA — the cross-vertical exchange substrate for any regulated business: SMEs, paraprofessionals, associations, sole practitioners. When a trades contractor enters a CHAI facility, when an advisor pulls DTC evidence from a care record, when two operators transact with a governed audit trail — that’s BREWTEA in action.
70% platform reuse
30% net-new per vertical

From Hash Chain to Human Document

The same authoritative event substrate produces bespoke outputs calibrated to each stakeholder's capacity — from PDFs a family signs to flowcharts an inspector audits to hash chains a CTO verifies. No data duplication. No separate systems. One ledger, seven lenses.

Resident & Family
Non-technical
ISP document Care plan summary Binder printout QR code links
Plain-language care plan with QR codes bridging print back to digital provenance. Family signs once; the hash chain seals it.
PDF Print QR
Care Staff & Supervisor
Operational
Shift handoff log Approvals queue Incident report wizard MAR
4-step incident wizard, shift handoff with staffing ratio gate, medication record — all consent-gated before any write persists.
Web app PDF export
Facility Administrator
Managerial
Agent health dashboard Cert expiry alerts Daily summary CQI cycle
Real-time fleet view of all 8 agents. Every action staged for human review before execution. Cert gaps flagged 60 days out.
Dashboard Digest email
Regulator & Inspector
Regulatory
Compliance report Incident log RCR section citations Audit trail
Every finding cites the exact BC RCR section. Timestamps are tamper-evident. Inspection-ready PDF on demand.
PDF Printable RCR-cited
Funder (CLBC)
Financial
Ledger reconciliation Quarterly report Hours delivery Contract compliance
CLBC contract #3144182.7.0 tracked daily. Financial reconciliation against service hours automatically flagged for human review.
PDF Quarterly CLBC format
Investor & Board
Business
Pitch infographic Exec summary TAM analysis BREW provenance proof
Architecture infographic, one-page exec summary, and live provenance proof showing every decision is auditable from research to deployment.
HTML/PDF Presentation
External Provider
Third-party
Inspection report (original) CHAI template (optional) Mapping protocol Provenance chain
Inspection companies, contractors, and health professionals submit in their own format. CHAI normalizes under the CHAI schema via a mapping protocol. Original + normalized + extraction event are all hash-linked. The original is the authoritative root — the CHAI version is transparently derived.
Email / PDF Any format Hash-linked
CTO & Technical
Technical
Code walkthrough Hash chain proof Route surface Rule corpus
Annotated source — classifier, hash chain, 800 rules in YAML, 20 typed HTTP endpoints. Every architectural claim backed by running code.
Annotated source Live endpoints
One authoritative source → eight bespoke representations.
append_event() · SHA-256 hash chain · autonomy tier gate · 800+ YAML rules · consent-gated writes · schema mapping protocol.
The same ledger entry that closes a regulatory window also populates the family’s printed binder and the CLBC quarterly report. Third-party documents are ingested under the same chain — original as root, normalized as derived, both hash-linked. Nothing is duplicated. Nothing is invented. Everything is traceable.

Architecture → Implementation

Every claim on this page is backed by running code. Seven file paths link the architecture to its implementation — open any card to see the actual source.

Deterministic Severity Classifier
incident_report.py · L75, 106, 144, 205
No LLM in the classification path. Keyword + type lookup against CH-004. Binary output, regulatory citations inline.
Fire Safety AUTO Check
facility_steward_agent.py · L364
Autonomous read-only scheduled check. SQLite query → overdue flags → QdB observation. Human resolves.
BC RCR Rule Corpus
bc_rcr_rules.yaml · 471 rules
Statutory authority. Each rule: section ref, check_type, enforcing agent, violation severity.
CARF 2023 Standards
carf_2023_rules.yaml · 329 standards
Accreditation authority. Conformance indicators — what a CARF surveyor looks for on inspection day.
BREW Provenance Reports
brew_report.py · compute_recipe_provenance
Events projected into RECIPE phases. Every decision gets a causation chain from research to deployment.
Event Substrate & Hash Chain
events.py · append_event, _compute_this_hash
SHA-256 per-entity chain. Tamper-evident by construction. Terminal events idempotent.
CHAI HTTP Route Surface
chai.py · L536+ register()
20 typed Flask endpoints. Every agent capability surfaces here. Nothing talks to agents directly.
Open full code walkthrough →