Claude Code Ban Cleanup: 5 Hidden Data Locations & the cc-clean Tool
After a Claude Code account ban, the author details five local locations where telemetry, credentials, and API keys persist on macOS, demonstrates manual cleanup steps with concrete file paths and commands, and releases an open-source Python tool (cc-clean) to audit and safely remove residual data without losing project settings.
After a 3.5-year-old Claude Code account was banned and two backup accounts triggered KYC, the author needed to purge all residual data from their Mac (version 2.1.296) before activating a new account. Using Codex for a read-only audit and cross-referencing a Feishu document on ban mechanisms (
https://bytedance.larkoffice.com/docx/E2JudVzf7oCNfhxyxaQcZIW1n0g) and Anthropic's official docs, they identified five locations where old account data and privacy exposures linger.
Location 1: ~/.claude/telemetry and telemetry switches
The ~/.claude/telemetry directory contained 9 failed-upload event files (~457 KiB, 238 events logged Sept 13–Oct 3). Though named .json, each file holds one JSON object per line (JSONL); parsing as a single JSON fails. Each event includes device_id, account/organization UUIDs, session_id, system environment, memory, CPU, duration, token usage, and tool-call status. Fields process and additional_metadata are Base64-encoded JSON, easily decoded. No prompt originals appear in this failed queue—only a prompt_length: 403 summary—and pattern matching on 7,091 decoded characters found no emails, home paths, or common secrets. Official documentation splits automatic reporting into usage metrics (latency, reliability; no code/paths) and error reports (crash stacks, scrubbed of secrets/paths/emails, enabled only for Pro/Max on direct official API). Disabling is done via environment variables:
export DISABLE_TELEMETRY=1
export DISABLE_ERROR_REPORTING=1The author opted to leave telemetry enabled for stability.
Location 2: ~/.claude.json main config and backups
The main config ~/.claude.json (sibling to ~/.claude directory) and its historical backups held oauthAccount, userID, machineID, and entitlement caches. The Feishu document flagged a top-level deviceId field, but it was absent in this config—version differences may apply. Before any deletion, the author backed up 18,276 regular files and 11 symlinks (~1.85 GiB), verified SHA-256 hashes, spot-checked restores, then locked permissions to directory 0700 and file 0600. Only 20 files were actually removed: 9 telemetry files, 9 old config backups, and 2 auth-state files. The main config was surgically stripped of 12 old-account fields while preserving 87 project settings and 5 MCP configurations.
Location 3: macOS Keychain
Editing JSON files does not clear macOS Keychain login items. The Keychain still held a default Claude Code login entry. A hidden pitfall: the gateway's independent Keychain entry mixed the old Claude OAuth credential ( claudeAiOAuth) with two active MCP caches in the same blob. Deleting the entire entry would break the live MCP logins. The solution was to surgically remove only claudeAiOAuth and retain the two MCP caches.
Location 4: CLAUDE_CONFIG_DIR independent gateway directory
The author isolates the gateway config ccmr via CLAUDE_CONFIG_DIR=~/.claude-gateway, routing model requests through a local router that forwards to upstream provider API keys. A read-only audit revealed old Claude account caches inside this supposedly isolated directory. After confirming that model-forwarding authentication derives entirely from the router's keys, the old account residues were purged while keeping router keys and model config. A live test request returned HTTP 200 with model glm-5.3 and body OK. Server-side data retention follows Anthropic's consumer privacy policy: 5 years if opted in for model improvement, otherwise 30 days; requests sent via the local gateway to third-party upstreams fall under those upstreams' own policies.
Location 5: history.jsonl plaintext API keys in input history
The gateway directory's history.jsonl stores every prompt, timestamp, and project path as plaintext JSON Lines; default periodic cleanup does not touch it. Among 860 lines, two display fields (lines 275 and 749) contained full provider API keys still in use. To avoid wiping history, the author performed in-place desensitization on just those two lines after stopping the gateway, confirming no new writes, and working from a verified backup. The file remains 860 valid JSON lines; the other 858 lines are byte-identical, and key matches drop to zero. If the file or backup might have been read by other processes, the safest remediation is to rotate the keys at the provider's dashboard.
Open-source Skill: cc-clean
To avoid re-scripting the audit/cleanup loop, the author packaged the “read-only audit first, then clean by confirmed checklist” workflow into an open-source Skill named cc-clean (Python 3.10+, zero third-party dependencies, invocable from both Claude Code and Codex). Repository: https://github.com/luwill/cc-clean.
The audit command scans only file metadata (never reading credentials or history content), correlates artifacts by shared-root UUID across project sessions, session-env, file-history, debug, and todos, and emits an offline HTML report (permissions 0600) with search/filter and default sensitive-format masking. On 14 Oct, a Codex read-only re-audit of the default directory surfaced 201 session groups; 16 groups had only project sessions without session-env snapshots—the tool flags the reason and defaults to retain, never auto-deleting due to missing snapshots.
For cleanup or recovery, the tool verifies SHA-256, permissions, symlinks, and sample restores before an Agent executes the confirmed checklist; helper scripts never modify source files autonomously. Installation: clone the repo, place the cc-clean directory into ~/.claude/skills/cc-clean/ (invoke with /cc-clean) or ~/.codex/skills/cc-clean/ (invoke with $cc-clean). A first check can be triggered by telling the Agent:
Use cc-clean to read-only audit ~/.claude and ~/.claude.json. Retain project history, Skills, plugins, and MCP configs. Generate association list and HTML report; do not delete or modify any source data.
The author recommends running cc-clean inside Codex because users performing local data cleanup are typically post-ban and preparing a new account; if not banned, avoid using the skill inside Claude Code.
All content is for reference only; Claude bans are often opaque. The Feishu document also provides a ban-risk matrix worth reviewing.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
