Now inviting automation leaders: publish your playbook as a skill, under your own name. Publish yours →
Automation Skills
All skills/Agent config audit/Remediation
Reference · Agent config audit

Remediation

Part of Agent config audit. Install the skill and your agent reads this page when it needs the depth.

Remediation

Fixes for what the audit finds, grouped by who applies them. Offer the ones that match the findings; do not paste the whole file at the user.

Opening a repo you did not write

  1. Scan it first, from a session started outside it.
  2. Open it with hooks off: claude --settings '{"disableAllHooks": true}', or a file containing {"disableAllHooks": true} passed as claude --settings <file> (easier in Windows PowerShell, which mangles inline JSON quoting). disableAllHooks in user settings alone does not protect you: project settings take precedence and can set it back to false.
  3. To ignore the project's settings files entirely, claude --setting-sources user.
  4. Inside the session, review /hooks and /mcp before re-enabling anything.
  5. Start agents inside a project folder, never in ~ or ~/Downloads.

Headless runs and CI

claude -p and the Agent SDK do not show the trust dialog, so a repo's committed hooks and MCP servers run without a prompt. Never run them over a repo you did not write without --bare (skips hooks from settings and plugins) or --setting-sources user. In CI, never give an agent that reads issues or pull requests both shell access and publish credentials.

Hooks, tasks and scripts

MCP servers

Permissions

Secrets in config

  1. Rotate first. A secret that was ever committed is still in git history, so untracking the file does not un-leak it.
  2. git rm --cached .claude/settings.local.json, add **/.claude/settings.local.json to .gitignore, commit.
  3. git ls-files | grep settings.local.json should print nothing afterwards.

local-settings-tracked is fixed by steps 2 and 3, but only after step 1: a command approved with "don't ask again" is saved verbatim, so assume every key in the file leaked.

Dependencies

Secrets in conversation history (secret-in-history)

  1. Rotate the key first. The transcript sits on disk in plain text and may already have been copied by a backup, a sync tool or malware.
  2. Then delete the transcript file the scanner named (~/.claude/projects/<folder>/<file> or ~/.codex/sessions/...), or redact the value in it. Never open it in the agent to do this: that puts the secret back into a new session.
  3. Shorten retention: Claude Code's cleanupPeriodDays in ~/.claude/settings.json deletes old transcripts automatically.
  4. Stop pasting keys into prompts. Put them in an env file the agent never reads (the secrets guard hook above enforces that) and have code load them from the environment.

Editor extensions (known-bad-extension)

  1. Uninstall it from the editor, then delete its folder under ~/.vscode/extensions, ~/.cursor/extensions or ~/.windsurf/extensions if it remains.
  2. Rotate every key the editor could reach: model API keys, GitHub tokens, cloud credentials in the workspace.
  3. Install extensions only from the publisher's verified listing, and check the publisher name, not just the display name.

Stolen AI keys (LLMjacking)

Teams

When a hook already ran

If a startup hook or folderOpen task fetched and ran something:

  1. Treat the machine as compromised. Disconnect it from anything sensitive.
  2. Rotate every credential the user could reach (cloud, GitHub, npm, model API keys, SSH keys) from a different, clean machine.
  3. Look for persistence the payload may have left: new entries in ~/.ssh/authorized_keys, scheduled tasks, LaunchAgents, systemd units, shell profile edits, and agent config in other repos on the machine (scan the whole code folder with this skill).
  4. Removing the repo or extension is not enough on its own; follow the incident response process of whoever owns the machine.

Publish your skill

Copy this prompt into Claude Code, Codex or any agent. It walks you through your first skill in about 20 minutes, with you as the author.

Click to copy.