Is Claude HIPAA Compliant? What Anthropic's BAA Covers, Including Claude Code

Claude can be covered by Anthropic's BAA, and Claude Code only in a narrow setup. Covered still isn't compliant: what the BAA covers, ZDR vs the HIPAA configuration, and where PHI leaks.

Clint JohnsonPublished 9 min read
Is Claude Code HIPAA Compliant? Covered Isn't Compliant.

The short answer for Claude in general: Anthropic signs a Business Associate Agreement for HIPAA-ready setups, so Claude can handle PHI there. The BAA covers Anthropic's side. Your logs, prompts and error reports are still yours to get right. Claude Code is narrower still.

Claude Code isn't HIPAA compliant on its own. No tool is. It can be covered by Anthropic's BAA, but only in a narrow setup.

You need a HIPAA-ready Enterprise plan. Then one of two things has to be true. Either the Primary Owner applies a separate HIPAA configuration to Claude Code, or the account runs with zero data retention. Developers also have to use the terminal or the Code tab of Claude Desktop, signed in with the Enterprise account and talking directly to Anthropic.

Even when all of that holds, "covered" only means the BAA applies. It doesn't make your product compliant.

Every leak I'll walk through below, in MedScrub and eSpiral, happened in my own code: logs, error reporting, a debug endpoint, and a prompt that claimed to be de-identified and wasn't. A BAA on the coding agent wouldn't have stopped any of them. That's why my PHI controls don't live in the agent harness. They live in the app, at the point where data leaves for a model, and in making logs, fixtures and endpoints non-PHI by design.

When is Claude Code covered by Anthropic's BAA?

Anthropic's HIPAA-ready Enterprise plans article is blunt: "Enabling HIPAA alone doesn't bring Claude Code or Cowork under your BAA." The Primary Owner must also apply the HIPAA configuration to Claude Code (local mode). Until then, Claude Code is covered only with ZDR, which is limited to qualified accounts. Anthropic's instruction for everything else is "Don't use PHI with a product that isn't covered."

These are the constraints engineers trip over:

  • Plan. Only Enterprise can enable HIPAA. Team, Pro and Max can't. Only the Primary Owner can accept the click-through BAA, and the decision is one-way.
  • The configuration is permanent. "The Primary Owner can't remove the configuration." It also turns off cloud sessions, Remote Control and Cowork in the cloud.
  • Surface. Local mode means the terminal and the Code tab of Claude Desktop. The VS Code and JetBrains extensions receive the HIPAA configuration, but the BAA does not cover them. If your team works in the IDE panel, PHI work has to move to the terminal or Desktop.
  • Route. Amazon Bedrock, Google Cloud's Agent Platform, Microsoft Foundry, an LLM gateway and a custom base URL are all available but not covered. So is a Console API key without ZDR. A Console key in a ZDR org is covered through ZDR, not through the HIPAA configuration.
  • Old BAAs. An API BAA signed before December 2, 2025 covers API usage only. It doesn't extend to the Enterprise plan.

Some third-party guides, like Specode's, still treat ZDR as the only path. That predates the HIPAA configuration. Read Anthropic's pages, not someone's summary of them.

Claude Code zero data retention (ZDR) vs the HIPAA configuration

In engineering terms, these are two different retention models. You pick one per org.

ZDR means Anthropic doesn't retain your Claude Code traffic. The catch is that Covered Models require 30-day retention, so a ZDR org that requests one gets an error. The Compliance API also doesn't capture Claude Code sessions while ZDR is on.

The HIPAA configuration runs at standard 30-day retention. It can use Covered Models, and the Compliance API can read local-mode sessions for up to 30 days. To get Covered Models under the BAA, Anthropic says to replace ZDR with the HIPAA configuration.

One more trap: "HIPAA readiness and ZDR cannot coexist on a single 1P API organization." Say your production API traffic is HIPAA-ready and you also want ZDR for Claude Code. Then you need separate org IDs, because Claude Code isn't an eligible service on a HIPAA-ready API org.

To enforce the covered route on every machine, Anthropic's HIPAA setup docs give a managed-settings sample:

{
  "forceLoginMethod": "claudeai",
  "forceLoginOrgUUID": "<org-id>",
  "allowedProviders": ["anthropic"],
  "cleanupPeriodDays": 30
}

allowedProviders makes Claude Code refuse to start against a cloud provider or gateway. The forced login refuses sessions that authenticate with ANTHROPIC_API_KEY, ANTHROPIC_AUTH_TOKEN or apiKeyHelper. Know the gaps:

  • forceLoginOrgUUID only checks claude.ai sign-ins.
  • The HIPAA configuration doesn't cap cleanupPeriodDays. Set it here, or developers can raise it.
  • A wrong org UUID makes Claude Code exit at startup for everyone.

Verify each machine with /status. It should list HIPAA on the "Organization configuration" line.

How PHI can leak into Claude Code's context

I have no record of a real HL7 message or patient query result being pasted into a coding agent. The near miss came through a side door.

My L2 support agent is Claude Code running on a loop. Its skill tells it to pull the full latest Sentry event, including stack frames, breadcrumbs, tags and counts. That's the right call for debugging. It also meant a risk that lasted until October 2026. A renderer log line like "Briefing failed for patient <name>", or a #/patients/<id> route, could ride along in the breadcrumbs of the next error report. From there it could land in the agent's context.

Nobody had to paste anything. The agent reads support artifacts, and those artifacts could carry PHI because our logging did.

We fixed it at the source. Breadcrumbs are now dropped entirely (beforeBreadcrumb: () => null), and the briefing log says "patient N of M" instead of a name. The fix was in the logging, not the agent.

The agent sees whatever your logs, errors, fixtures and endpoints see. So the first control is making those places non-PHI by design.

Where to put PHI scanning when you use Claude Code

My Claude Code harness has almost no PHI protection:

  • My hooks update a terminal status line.
  • A vendor security plugin reviews edits for code vulnerabilities. It has no PHI patterns.
  • My permissions.deny list is empty.
  • Pre-commit runs typecheck and lint, not a secret or PHI scan.

The PHI scanning lives where data leaves: in the app, at the point of egress to a model. On MedScrub desktop that's a hard gate:

// apps/desktop/src/main/llm/egress-gate.ts (shape, not full source)
// local providers (Ollama) bypass: PHI stays on-device
if (baa === true) return null; // user attests a BAA; we can't verify it
// otherwise: refuse cloud egress unless deidentified === true,
// then a regex backstop for SSN, email, phone, MRN[:#\s]*\d{4,}, DOB

The backstop was too narrow. It caught SSNs, emails, phones, MRNs and DOBs, but never names or narrative. One fix in this area found a daily-briefing path that sent real patient names and re-identified chart narrative to the configured cloud provider. It did that while asserting deidentified: true, and nothing verified that flag. It shipped in a release before we caught it.

MedHook needed tuning in the opposite direction. Its name detector redacted column labels like "Patient Name". Now it only masks a name that follows a cue. We also changed the UI so it stops promising full redaction. It now reads "IDs masked · don't paste patient details." Over-redaction erodes trust in the scrubber. Overclaiming creates false confidence.

The rest is boring and works:

  • Logs are a non-PHI sink.
  • Test fixtures are obviously synthetic.
  • Demo machines run a filter that hides real patients, because a partner's patients come from eCW and are real PHI.

On-device mode (Ollama) is the only setup where data stays put, which is why the gate lets it through without a scrub. I wrote about when small models are enough if that tradeoff interests you.

What the BAA doesn't cover inside Claude Code

  • MCP and connectors. Local MCP servers, connectors and the built-in GitHub integration are "Not covered." Local MCP servers are on by default unless managed settings turn them off. Pointing an MCP database tool at a table with patient rows is exactly the path the BAA excludes.
  • Skills and plugins on disk. These are available but not covered. Under the HIPAA configuration, Anthropic's security scanning is off, so it says to "Review each skill and plugin before you provide it to members." My L2 support skill is one of these. Its instructions are why full Sentry events enter context.
  • Credentials. The HIPAA configuration strips Anthropic credentials from shell commands, hooks and MCP servers. It does not strip cloud-provider or GitHub credentials. An agent can still git push, and the BAA doesn't cover what lands there.
  • Telemetry. OpenTelemetry export to your own tools is "your organization's responsibility."
  • Local transcripts. Sessions live in ~/.claude/projects/. The retention sweep only runs when someone starts Claude Code, so an idle laptop keeps everything. claude purge --all --yes skips paths like paste-cache/. /logout and removing a seat delete nothing, so Anthropic's offboarding advice is to wipe the device.

Anthropic also calls bypass permissions mode "Covered," then adds that whether to allow it "is your organization's decision." Covered describes the contract. It says nothing about whether the setup is safe.

A BAA on the agent doesn't make your app HIPAA compliant

A BAA tells you who may receive PHI and on what terms. It does nothing about what your code sends, where it logs, or who in your app can see it. Anthropic's own covered-models page says your organization is responsible for making sure its use complies with the law.

Here's what our code did, with no coding agent involved:

  • eSpiral wrote patient names, ICD-10 conditions and primary complaints to CloudWatch. We removed those logs.
  • eSpiral had a debug endpoint, api.debug-fhir.ts, that returned patient names, problem list items and stack traces as JSON. We deleted it.
  • MedScrub shipped a real customer's eCW Group UUIDs as the "e.g." placeholder in the UI, so every install showed one customer's group ID. Not PHI, but the same failure mode: real data in a place other users and agents read. The fixtures are now obviously synthetic UUIDs.
  • The briefing path above sent names to a cloud model under a de-identified flag.

The more common mistake, including in my own repos, runs the other way. People assume that scrubbing means you don't need a BAA. eSpiral had an issue, "Confirm BAA Coverage for LLM Providers." One sub-task was to determine whether our scrubbing satisfied compliance without a direct BAA. The issue was closed as not planned with every box unchecked. MedHook gets this right now: AI features stay off in production until a BAA with Anthropic covers that deployment.

MedScrub's BAA path is an attestation, not a verification. The physician says they have a BAA, and the UI tells them we can't check it. The UI also warns that a Google Workspace or ChatGPT business agreement generally doesn't cover the developer API. The attestation is versioned, so widening what it waives can't silently reuse old consent. If consent mechanics are your next question, I covered them in HIPAA Consent: What Engineers Actually Need to Know.

Claude Code PreToolUse hooks for PHI: the exit code 2 trap

I'd rather admit the gap than describe a hook that doesn't exist. A real PreToolUse PHI hook is the next gap I'm closing.

Check one mistake in your own repo first. eSpiral has a PreToolUse Bash check that matches four destructive strings like rm -rf / and exits with code 1. Under Claude Code's hook contract, only exit code 2 blocks. Exit 1 is a non-blocking error, so the command still runs. If your guard hook exits 1, it has never blocked anything.

Get the BAA right. Then assume it covers none of your code, because it doesn't.