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.ts → COMPLIANCE_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
- 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.ts → REQUIREMENT_IDENTIFICATION_PROMPT
Purpose: Analyze organizational context and identify applicable regulatory requirements
Output Structure:
For each requirement identified:
- Clear title and description
- Regulatory body (CARF, Joint Commission, State, CMS, SAMHSA, HIPAA)
- Specific reference code (e.g., “CARF 1.A.1”, “42 CFR Part 2”)
- Priority (critical, high, medium, low)
- Confidence score (0-100)
- Directly applicable requirements
- Currently in effect or upcoming
- Commonly cited in audits
- High-risk for non-compliance
extract_requirements
Gap Analysis Prompt
Location:src/cores/gr/ai/prompts.ts → GAP_ANALYSIS_PROMPT
Purpose: Analyze requirements and current compliance status to identify gaps
Gap Types:
Output Structure:
For each gap:
- Gap type classification
- Clear description
- Priority (critical, high, medium, low)
- Specific recommendation
- 2-4 concrete remediation actions
- Likely audit citations
- Patient/resident safety risks
- Approaching deadlines
- Ease of remediation
analyze_gaps
Audit Preparation Prompt
Location:src/cores/gr/ai/prompts.ts → AUDIT_PREPARATION_PROMPT
Purpose: Assess audit readiness and generate preparation plan
Output Structure:
- Readiness Score: 0-100
- Assessment Narrative: Current state summary
- Gap Areas: Areas needing attention
- Potential Findings: Likely audit citations
- Checklist Items: Prioritized tasks
ready- No action neededneeds_attention- Some work requirednot_ready- Significant work needed
- Audit type (CARF survey, state inspection, CMS review)
- Historical findings
- Current compliance status
- Documentation completeness
- Staff interview readiness
prepare_audit
Risk Assessment Prompt
Location:src/cores/gr/ai/prompts.ts → RISK_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
Output Structure:
- Likelihood score (1-5)
- Impact score (1-5)
- Risk score (calculated)
- Risk rating
- Mitigation strategy recommendation
- 2-5 specific mitigation actions
- Reasoning for assessment
assess_risk
Structured Output Schemas
Requirement Suggestion Schema
Location:src/cores/gr/ai/schemas.ts → requirementSuggestionSchema
Gap Analysis Schema
Location:src/cores/gr/ai/schemas.ts → gapAnalysisSchema
Audit Preparation Schema
Location:src/cores/gr/ai/schemas.ts → auditPrepSchema
Risk Assessment Schema
Location:src/cores/gr/ai/schemas.ts → riskAssessmentSchema
Context Building
buildComplianceContext Function
Location:src/cores/gr/ai/prompts.ts → buildComplianceContext()
Purpose: Build context string for AI prompts based on organization data
Parameters:
Module Context
All GR AI hooks pass module context to Platform AI:- 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
- ❌ “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