Agent Privacy Shield
Agent Privacy Shield is a local semantic privacy layer for coding agents. It virtualizes identifying paths and workspace identity into stable aliases such as <PROJECT_ROOT> while preserving the technical structure the agent needs to work correctly.
Supported targets in this repository:
| Agent | Adapter | Current protection level |
|---|
| Claude Code | native function-hook plugin | FULL |
| Gemini CLI | extension using BeforeModel / BeforeTool | FULL |
| Kilo Code | in-process plugin using experimental.chat.* and tool.* hooks | FULL |
| Codex | portable plugin + lifecycle hooks | PARTIAL / conservative |
| Cursor | plugin + beforeSubmitPrompt / preToolUse hooks | PARTIAL / conservative |
| Antigravity | native plugin + lifecycle hooks | PARTIAL |
FULL means the host exposes a documented point where the outgoing model request can be rewritten before it reaches the remote model. PARTIAL is intentionally not presented as equivalent privacy.
Security-sensitive MVP: read SECURITY.md. This project reduces disclosure; it is not a formal security boundary against an administrator who controls your endpoint.
What the model sees
Local:
C:\Users\Anna\Dev\ProjectNightfall\Source\AI\Enemy.cpp
Remote model:
<PROJECT_ROOT>\Source\AI\Enemy.cpp
Automatically inferred aliases include:
<PROJECT_ROOT>
<PROJECT_ROOT_SLUG>
<PROJECT_NAME>
<HOME>
<LOCAL_USER>
<GIT_REMOTE>
<GIT_ORG>
<REPO_NAME>
<HOSTNAME>
<EMAIL_3f2a9c1b07>
<PRIVATE_IP_8d41e0a2c5>
<EXTERNAL_ROOT_b19c77e403>
Names keep their casing on the way back: Server, SERVER and server get <PROJECT_NAME_TITLE>, <PROJECT_NAME_UPPER> and <PROJECT_NAME_LOWER> when the canonical name differs. Dynamic aliases (emails, IPs, external roots) carry a random suffix, so two agents running at once never hand out the same alias for different values.
High-risk credentials are one-way masked as <SECRET_n>. Because the real value is never restored, every adapter refuses a local tool call whose arguments contain a <SECRET_n> placeholder instead of writing the placeholder into a file or command.
Install
Install the plugin with your agent's own plugin command; no clone or setup script is needed. Each agent has its own plugin system, so install once per agent you use. The plugin works in whichever project you open; there is nothing to configure.
claude plugin install agent-privacy-shield --marketplace khasky/agent-privacy-shield
gemini extensions install https://github.com/khasky/agent-privacy-shield --consent
agy plugin install https://github.com/khasky/agent-privacy-shield
codex plugin marketplace add khasky/agent-privacy-shield
codex plugin add agent-privacy-shield@agent-privacy-shield
Kilo Code and Cursor have no install command for a plugin from a Git repository; see Kilo Code and Cursor for their steps.
Things to know before you start:
- Requirements:
node 18 or newer and git on PATH; the workspace is discovered with git. The Gemini CLI, Codex, Cursor and Antigravity hooks are node commands, so without node they do not run and nothing is sanitized. Claude Code runs the hooks itself and needs node only for the alias vault; without it protection stays on with memory-only persistence.
- Restart the agent after installing. Protection starts with the next session; a session that was already open stays unprotected.
- Codex needs one trust step. Codex skips plugin hooks until you approve them: start
codex, run /hooks and trust the agent-privacy-shield hooks. Codex asks again after every update, because trust is tied to the hook definition.
- Local clone: each command also takes the path of a clone in place of the GitHub source, for example
claude plugin install agent-privacy-shield --marketplace D:\src\agent-privacy-shield. Gemini copies the extension at install time, so after pulling changes run gemini extensions update agent-privacy-shield.
- Persistence is Windows-only for now. On macOS and Linux the plugin works, but aliases for emails, IPs and outside paths are not remembered between hook calls; see Shared alias vault.
- Gemini CLI or Antigravity CLI: Google moved unpaid-tier and Google One users from Gemini CLI to Antigravity CLI. Install into whichever of the two you actually run; Antigravity protection is PARTIAL.
Update or remove: