2026-01-05 · Authensor

HIPAA Technical Safeguards for AI Agents Handling PHI

Regulation Overview

The Health Insurance Portability and Accountability Act (HIPAA) Security Rule (45 CFR Part 164, Subpart C) establishes national standards for protecting electronic protected health information (ePHI). When AI agents read patient files, write clinical summaries, execute data processing scripts, or make network requests involving ePHI, they become system components subject to HIPAA technical safeguard requirements. Covered entities and business associates must implement access controls, audit controls, integrity controls, and transmission security for all systems that touch ePHI.

Relevant Requirements

§164.312(a)(1) — Access Control

Implement technical policies and procedures for electronic information systems that maintain ePHI to allow access only to authorized persons or software programs. This is a required specification.

§164.312(a)(2)(i) — Unique User Identification

Assign a unique name and/or number for identifying and tracking user identity. Each AI agent instance must be individually identifiable in access logs.

§164.312(a)(2)(iv) — Encryption and Decryption

Implement a mechanism to encrypt and decrypt ePHI. Addressable specification, but effectively required for any system handling PHI files.

§164.312(b) — Audit Controls

Implement hardware, software, and/or procedural mechanisms that record and examine activity in information systems that contain or use ePHI. This is a required specification.

§164.312(c)(1) — Integrity

Implement policies and procedures to protect ePHI from improper alteration or destruction. Electronic measures must be established to confirm ePHI has not been improperly altered.

§164.312(c)(2) — Mechanism to Authenticate ePHI

Implement electronic mechanisms to corroborate that ePHI has not been altered or destroyed in an unauthorized manner. Addressable specification.

§164.312(d) — Person or Entity Authentication

Implement procedures to verify that a person or entity seeking access to ePHI is who they claim to be. Applies to AI agent authentication before granting data access.

§164.312(e)(1) — Transmission Security

Implement technical security measures to guard against unauthorized access to ePHI being transmitted over an electronic communications network.

Compliance Gap Without Gating

Deploying AI agents in healthcare environments without action-level controls creates these HIPAA violations:

How SafeClaw Addresses Each Requirement

| HIPAA Section | Requirement | SafeClaw Capability |
|---|---|---|
| §164.312(a)(1) | Access control to ePHI systems | Deny-by-default policy engine blocks all agent actions unless explicitly permitted. file_read and file_write rules restrict access to specific PHI-containing paths. |
| §164.312(a)(2)(i) | Unique user identification | Each agent instance receives a unique API key. All audit entries are tied to the specific agent identity. |
| §164.312(b) | Audit controls | Tamper-proof audit trail records every action request, policy decision, timestamp, and action metadata. SHA-256 hash chain ensures log integrity. |
| §164.312(c)(1) | Integrity controls | file_write rules prevent unauthorized modification of ePHI. Deny-by-default blocks all writes unless explicitly permitted to specific paths. |
| §164.312(c)(2) | ePHI authentication mechanism | Hash-chained audit trail provides cryptographic proof of data access history, enabling integrity verification of ePHI access patterns. |
| §164.312(d) | Person/entity authentication | Agent authentication via API key before any policy evaluation occurs. Invalid keys receive deny responses for all actions. |
| §164.312(e)(1) | Transmission security | network action rules restrict which endpoints an agent can contact. Deny-by-default blocks all network access unless explicitly allowed. |

Evidence Generation

| HIPAA Requirement | Evidence Type | SafeClaw Output |
|---|---|---|
| §164.312(a)(1) | Access control documentation | Policy configuration files showing deny-by-default with path-specific allow rules for ePHI directories |
| §164.312(a)(2)(i) | User identification records | API key assignment records per agent instance |
| §164.312(b) | Audit logs | Complete hash-chained audit trail: action type, path, decision, timestamp, agent identity |
| §164.312(c)(1) | Integrity control documentation | Policy rules blocking file_write to ePHI directories; denied write attempt logs |
| §164.312(c)(2) | Authentication mechanism records | SHA-256 hash chain verification reports |
| §164.312(d) | Authentication logs | Key validation records for each agent session |
| §164.312(e)(1) | Transmission security logs | Network action decision logs showing allowed/denied external communications |

The SafeClaw control plane receives only action metadata — never ePHI, file contents, or patient data. This satisfies the minimum necessary standard under §164.502(b) for the gating tool itself.

Example Policy

A HIPAA-compliant policy for an AI agent processing clinical documents:

{
  "name": "hipaa-clinical-agent",
  "defaultAction": "deny",
  "rules": [
    {
      "action": "file_read",
      "path": "/app/clinical/intake-forms/**",
      "decision": "allow",
      "reason": "§164.312(a)(1) — Read access to assigned intake forms only"
    },
    {
      "action": "file_write",
      "path": "/app/clinical/summaries/**",
      "decision": "allow",
      "reason": "§164.312(c)(1) — Write limited to summary output directory"
    },
    {
      "action": "file_write",
      "path": "/app/clinical/intake-forms/**",
      "decision": "deny",
      "reason": "§164.312(c)(1) — No modification of source ePHI"
    },
    {
      "action": "file_read",
      "path": "/app/clinical/billing/**",
      "decision": "deny",
      "reason": "Minimum necessary — billing data not required for this task"
    },
    {
      "action": "shell_exec",
      "decision": "deny",
      "reason": "§164.312(a)(1) — No shell access in clinical context"
    },
    {
      "action": "network",
      "decision": "deny",
      "reason": "§164.312(e)(1) — No external transmission of ePHI"
    }
  ]
}

Install with npx @authensor/safeclaw. The free tier with 7-day renewable keys (no credit card required) allows compliance testing before production deployment. Use simulation mode to validate policies against real clinical workflows without affecting production ePHI.

Audit Trail Export

For HIPAA compliance reviews and OCR audit responses:

  1. Export the full audit trail from the SafeClaw dashboard at safeclaw.onrender.com
  2. Filter by ePHI-related paths to isolate PHI access records
  3. Verify SHA-256 hash chain — provides §164.312(c)(2) integrity evidence
  4. Generate denied action reports — demonstrates access control enforcement per §164.312(a)(1)
  5. Document policy configurations — serves as §164.312(a)(1) implementation specification
SafeClaw's local execution model means ePHI never leaves the covered entity's infrastructure during policy evaluation. Zero third-party dependencies (verified by 446 tests, TypeScript strict mode) eliminate supply chain risk to ePHI-handling systems. The 100% open-source client under MIT license enables covered entities to audit the enforcement code directly.

Cross-References

Try SafeClaw

Action-level gating for AI agents. Set it up in your browser in 60 seconds.

$ npx @authensor/safeclaw