> ## Documentation Index
> Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
> Use this file to discover all available pages before exploring further.

# AI-Powered State Compliance Checking — Integration Documentation

> Feature ID: GR-06-EN-01 Owner: GR (Governance & Compliance) Status: 📝 Planned Created: 2026-03-31

**Feature ID:** GR-06-EN-01
**Owner:** GR (Governance & Compliance)
**Status:** 📝 Planned
**Created:** 2026-03-31

***

## Overview

GR-06-EN-01 enhances the GR-06 AI Compliance Advisor with jurisdiction-aware compliance checking. It integrates with PF-96 jurisdiction profiles, PF-60/PF-61 RAG/KB infrastructure, and PF-62 AI Skills to provide state-specific compliance guidance.

***

## Platform Integration Layer Dependencies

| Platform Layer                | Integration Type                      | Direction  | Description                                                                                                           |
| ----------------------------- | ------------------------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------- |
| PF-96 (Jurisdiction Profiles) | `useJurisdictionProfile(siteId?)`     | Read       | Resolves org/site jurisdiction profile for AI context injection                                                       |
| PF-60 (RAG Infrastructure)    | Embedding pipeline                    | Read/Write | State regulatory document chunks embedded and retrieved via RAG                                                       |
| PF-61 (Knowledge Base)        | KB article storage                    | Write      | State regulatory documents stored as KB entries in per-state collections                                              |
| PF-62 (AI Skills)             | Skill registry                        | Write      | Registers `state_compliance_advisor`, `state_gap_analyzer`, `state_training_advisor`, `multi_state_comparator` skills |
| PF-27 (Platform AI)           | AI generation                         | Read       | Base AI chat and generation capabilities                                                                              |
| PF-72 (Agent SDK)             | `useAISkillChat` / `ai-skill-execute` | Read       | Skill execution with structured output                                                                                |
| PF-45 (Feature Flags)         | `useFeatureFlag`                      | Read       | `gr_state_compliance_enabled` rollout gate                                                                            |
| PF-10 (Notifications)         | Notification triggers                 | Write      | Critical gap analysis notifications                                                                                   |

## Internal GR Dependencies

| GR Module                     | Integration Type  | Direction | Description                                                    |
| ----------------------------- | ----------------- | --------- | -------------------------------------------------------------- |
| GR-06 (AI Compliance Advisor) | Parent spec       | Extends   | All GR-06 AI hooks enhanced with jurisdiction context          |
| GR-03 (Compliance Tracking)   | Data read         | Read      | Compliance check statuses for gap analysis context             |
| GR-02 (Training & CEU)        | Data read         | Read      | Training completions and CEU records for training gap analysis |
| GR-16 (Accreditation Tracer)  | Feature extension | Extends   | AI question simulator enhanced with jurisdiction context       |

***

## Events Published

### `gr_state_gap_analysis_completed`

* **Publisher:** GR-06-EN-01

* **Subscribers:** PF-91 (compliance dashboard), PF-10 (notifications for critical gaps)

* **Payload Schema:**

  ```typescript theme={null}
  {
    organization_id: string; // UUID
    state_code: string;      // e.g., "AZ"
    domain: 'clinical' | 'billing' | 'compliance' | 'training' | 'comprehensive';
    compliance_score: number; // 0-100
    gap_count: number;
  }
  ```

* **Trigger:** On completion of state-specific gap analysis

* **Status:** 📝 Planned (Phase 4)

***

## Events Consumed

None directly. GR-06-EN-01 reads data from GR-03 and GR-02 via hooks, not via events.

***

## API Contracts

### Frontend Hooks (Internal)

| Hook                                    | Purpose                               | Consumers          |
| --------------------------------------- | ------------------------------------- | ------------------ |
| `useStateComplianceChat(siteId?)`       | Jurisdiction-aware AI compliance chat | GR compliance UI   |
| `useStateGapAnalysis(domain, siteId?)`  | State-specific gap analysis           | GR gap analysis UI |
| `useMultiStateComparison(profileIds[])` | Multi-state requirement comparison    | GR comparison UI   |

***

## Security Considerations

* No PHI in AI prompts, KB documents, or RAG context
* State regulatory documents are public information (no org-scoping on KB tables)
* Org-specific compliance data sanitized via `sanitizeContentForAI`
* All AI interactions audit-logged to `pf_ai_usage_logs` with jurisdiction context
* Federal baseline enforcement: AI cannot recommend weakening federal requirements

***

## References

* **Spec:** `specs/gr/specs/GR-06-EN-01-ai-state-compliance-checking.md`
* **Plan:** `specs/gr/plans/GR-06-EN-01-ai-state-compliance-checking-PLAN.md`
* **Parent:** [GR-06 Integration context](../../architecture/integrations/CROSS_CORE_INTEGRATIONS.md)
* **PF-96 Integration:** `docs/architecture/integrations/PF-96-medicaid-state-compliance-configuration-INTEGRATION.md`
