Skip to main content

Overview

This document provides technical reference for the AI prompts and schemas used in the GR-06 AI Compliance Advisor. Understanding these prompts helps interpret AI outputs and customize behavior.

Prompt Templates

Compliance Chat System Prompt

Location: src/cores/gr/ai/prompts.tsCOMPLIANCE_CHAT_PROMPT Purpose: General compliance chat assistant Specializations:
  • CARF (Commission on Accreditation of Rehabilitation Facilities)
  • Joint Commission accreditation
  • State licensing requirements for behavioral health and recovery housing
  • CMS (Centers for Medicare & Medicaid Services) regulations
  • HIPAA privacy and security requirements
  • SAMHSA guidelines for substance use treatment
Guidelines Enforced:
  • Provides clear, actionable guidance
  • References specific regulatory standards when applicable
  • Identifies potential compliance risks
  • Considers organizational context
  • Never provides legal advice
  • Uses anonymized references for cases
  • Flags state/accreditor variations

Requirement Identification Prompt

Location: src/cores/gr/ai/prompts.tsREQUIREMENT_IDENTIFICATION_PROMPT Purpose: Analyze organizational context and identify applicable regulatory requirements Output Structure: For each requirement identified:
  1. Clear title and description
  2. Regulatory body (CARF, Joint Commission, State, CMS, SAMHSA, HIPAA)
  3. Specific reference code (e.g., “CARF 1.A.1”, “42 CFR Part 2”)
  4. Priority (critical, high, medium, low)
  5. Confidence score (0-100)
Focus Areas:
  • Directly applicable requirements
  • Currently in effect or upcoming
  • Commonly cited in audits
  • High-risk for non-compliance
Tool Called: extract_requirements

Gap Analysis Prompt

Location: src/cores/gr/ai/prompts.tsGAP_ANALYSIS_PROMPT Purpose: Analyze requirements and current compliance status to identify gaps Gap Types: Output Structure: For each gap:
  1. Gap type classification
  2. Clear description
  3. Priority (critical, high, medium, low)
  4. Specific recommendation
  5. 2-4 concrete remediation actions
Prioritization Criteria:
  • Likely audit citations
  • Patient/resident safety risks
  • Approaching deadlines
  • Ease of remediation
Tool Called: analyze_gaps

Audit Preparation Prompt

Location: src/cores/gr/ai/prompts.tsAUDIT_PREPARATION_PROMPT Purpose: Assess audit readiness and generate preparation plan Output Structure:
  1. Readiness Score: 0-100
  2. Assessment Narrative: Current state summary
  3. Gap Areas: Areas needing attention
  4. Potential Findings: Likely audit citations
  5. Checklist Items: Prioritized tasks
Checklist Item Status:
  • ready - No action needed
  • needs_attention - Some work required
  • not_ready - Significant work needed
Considerations:
  • Audit type (CARF survey, state inspection, CMS review)
  • Historical findings
  • Current compliance status
  • Documentation completeness
  • Staff interview readiness
Tool Called: prepare_audit

Risk Assessment Prompt

Location: src/cores/gr/ai/prompts.tsRISK_ASSESSMENT_PROMPT Purpose: Assess risks and recommend mitigation strategies Likelihood Scale (1-5): Impact Scale (1-5): Risk Rating Calculation:
  • Score = Likelihood × Impact (1-25)
  • 1-4: Low
  • 5-9: Medium
  • 10-16: High
  • 17-25: Critical
Mitigation Strategies: Output Structure:
  1. Likelihood score (1-5)
  2. Impact score (1-5)
  3. Risk score (calculated)
  4. Risk rating
  5. Mitigation strategy recommendation
  6. 2-5 specific mitigation actions
  7. Reasoning for assessment
Tool Called: assess_risk

Structured Output Schemas

Requirement Suggestion Schema

Location: src/cores/gr/ai/schemas.tsrequirementSuggestionSchema

Gap Analysis Schema

Location: src/cores/gr/ai/schemas.tsgapAnalysisSchema

Audit Preparation Schema

Location: src/cores/gr/ai/schemas.tsauditPrepSchema

Risk Assessment Schema

Location: src/cores/gr/ai/schemas.tsriskAssessmentSchema

Context Building

buildComplianceContext Function

Location: src/cores/gr/ai/prompts.tsbuildComplianceContext() Purpose: Build context string for AI prompts based on organization data Parameters:
Output Format:

Module Context

All GR AI hooks pass module context to Platform AI:
This enables:
  • Module-specific rate limiting
  • Usage tracking per module
  • Feature-level analytics

AI Hooks Reference

useAIComplianceChat

Purpose: Interactive compliance chat Platform Hook: useAIChat System Prompt: COMPLIANCE_CHAT_PROMPT

useAIRequirementIdentification

Purpose: Identify applicable requirements Platform Hook: useAIStructuredOutput System Prompt: REQUIREMENT_IDENTIFICATION_PROMPT Schema: requirementSuggestionSchema

useAIGapAnalysis

Purpose: Analyze compliance gaps Platform Hook: useAIStructuredOutput System Prompt: GAP_ANALYSIS_PROMPT Schema: gapAnalysisSchema

useAIAuditPreparation

Purpose: Audit readiness assessment Platform Hook: useAIStructuredOutput System Prompt: AUDIT_PREPARATION_PROMPT Schema: auditPrepSchema

useAIRiskAssessment

Purpose: Risk assessment Platform Hook: useAIStructuredOutput System Prompt: RISK_ASSESSMENT_PROMPT Schema: riskAssessmentSchema

PHI Protection

All AI prompts enforce PHI protection:
  • System prompts instruct AI to use anonymized references
  • The Platform AI layer includes PHI detection
  • Identifiable information is blocked before reaching AI
Example anonymization:
  • ❌ “John Smith in Room 204”
  • ✅ “Resident R-001”

Error Handling

AI hooks should handle these errors:

Customization Options (Future)

Potential future customization points:
  • Organization-specific prompt additions
  • Custom regulatory body definitions
  • State-specific requirement overrides
  • Custom risk matrix thresholds