Overview
CareSupport implements mechanical access control that operates at two layers: pre-filter (context scoping) and post-check (outbound message scanning). This ensures that members only see information appropriate to their role, and prevents the AI agent from accidentally leaking sensitive data.Access Levels
Each member in routing.json has anaccess_level that determines what sections of family.md they can see:
Full Access — Sees everything. Can approve care plan changes.Visible sections: All (*)Typical roles: Primary caregiver, care recipient (if coordinating own care)Can approve changes: Yes
Schedule + Medications — Sees operational care details but not financial/insurance information.Visible sections: members, care_recipient, schedule, medications, appointments, availability, active_issuesTypical roles: Family caregiver, professional caregiverCan approve changes: No
Schedule Only — Sees when help is needed, not medical details.Visible sections: members, schedule, availability, active_issuesTypical roles: Community supporter, backup family memberCan approve changes: No
Provider Access — Medical information for professional healthcare providers.Visible sections: care_recipient, medications, appointments, membersTypical roles: Visiting nurse, care manager, professional caregiverCan approve changes: No
Limited Access — Basic information only. No medical or scheduling details.Visible sections: members, care_recipient (basic info)Typical roles: Distant family, emergency contacts, occasional helpersCan approve changes: No
Enforcement Architecture
Layer 1: Pre-Filter (Context Scoping)
Before the AI agent sees any data,role_filter.py strips restricted sections:
- Parse family.md into sections (using
## Headers) - Map section headers to access matrix keys
- Keep only sections allowed for this access level
- Reconstruct markdown with allowed sections only
The agent never sees restricted sections. This is the primary defense against data leakage.
Layer 2: Post-Check (Outbound Scanning)
Before sending a response, scan for leaked medical terms:- Medication patterns (suffixes like
-pril,-sartan,-statin) - Dosage patterns (
10mg,500 mg) - Medical conditions (
diabetes,hypertension,dementia) - Clinical terms (
A1C,blood pressure,insulin)
Access Matrix Reference
Complete mapping of access levels to visible sections:Section Mapping
Markdown section headers map to access matrix keys:| Markdown Header | Access Matrix Key |
|---|---|
## Members | members |
## Care Recipient | care_recipient |
## Schedule | schedule |
## Medications | medications |
## Active Medications | medications |
## Appointments | appointments |
## Availability | availability |
## Active Issues | active_issues |
## Recent Events | recent_events |
## Insurance & Coverage | insurance |
## Care Preferences | care_preferences |
Headers are normalized: case-insensitive, spaces converted to underscores. “Active Medications” → “medications”.
Role-Based Workflows
Primary Caregiver (Full Access)
Access level:full
Can do:
- View all sections of family.md
- Approve medication changes
- Approve member additions
- See insurance and financial information
- Access full medication history
- View all member profiles
Family Caregiver (Schedule + Meds)
Access level:schedule+meds
Can do:
- View schedule and availability
- See medication list and schedules
- Access appointment information
- View active issues and urgent notes
- See care team members
- Insurance information
- Financial details
- Decision history
- Full medication history
Community Supporter (Schedule Only)
Access level:schedule
Can do:
- View schedule (when help is needed)
- See availability gaps
- View active issues (non-medical)
- See care team members
- Medications
- Medical conditions
- Appointments (medical details)
- Insurance information
Professional Provider (Provider Access)
Access level:provider
Can do:
- View care recipient medical information
- See full medication list
- Access appointment history
- View care team members
- Family schedule
- Availability gaps
- Insurance information (unless shared separately)
- Family communication preferences
Setting Access Levels
During Onboarding
Set access level in routing.json when adding a member:Via Agent
The agent uses conservative defaults when adding members:| Role | Default Access Level |
|---|---|
primary_caregiver | full |
family_caregiver | schedule+meds |
professional_caregiver | schedule+meds |
community_supporter | schedule |
care_recipient | full or limited (ask preference) |
Changing Access Levels
-
Update routing.json:
- Changes take effect on next message (routing.json is read per-message)
-
Log the change in family.md Recent Updates:
PHI Audit Trail
Every context load and response is logged with PHI audit details:fork/workspace/logs/{date}/phi_access.log
Includes:
- Who accessed data (phone, role, access_level)
- What sections they saw
- What message triggered the access
- Timestamp (UTC)
- Leakage check results (passed/failed)
PHI audit logs are HIPAA-compliant and support compliance audits. Never delete these logs.
Approval Requirements
Certain actions require approval from a member withcan_approve_changes=True:
Requires approval:
- Adding/changing medications
- Adding new care team members
- Updating care plan
- Changing emergency protocols
- Non-approver requests change: “Can we add aspirin 81mg daily?”
- Agent generates proposal, stores in
pending_approvals.json - Agent notifies approver: “Roman requested adding aspirin 81mg daily. Reply YES to approve.”
- Approver responds: “YES”
- Agent executes change, logs to family.md
Testing Access Control
Verify access filtering with dry-run:Best Practices
- Use
schedule+medsas default for family caregivers - Reserve
fullfor 1-2 primary coordinators only - Use
schedulefor community supporters - Document access level rationale in member profiles
- Review access levels quarterly
- Log all access level changes in family.md
Security Considerations
Phone Number Security
- routing.json contains PHI (phone numbers + relationships)
- Never commit routing.json to version control
- Never share routing.json outside secure channels
- Use separate routing.json per environment (dev/staging/prod)
Chat ID Security
- chat_id is persistent and stable
- Treat chat_id as sensitive (equivalent to session token)
- Never log chat_id in public logs
- Rotate chat_id if device/number changes
Access Level Auditing
Regularly audit access levels:Next Steps
Onboarding New Families
Learn how to set up a new family with proper access controls from the start.
Member Management
Understand how to add members with appropriate roles and access levels.
Phone Routing
Configure routing.json to map members to their access levels.