{
  "markdown": "# account-guard\n\nA Claude Code plugin that warns or blocks prompts when the active Claude account doesn't match the expected account for the current directory.\n\nUseful for teams or individuals who switch between work and personal Claude accounts and want a guardrail against accidentally using the wrong one.\n\n## Installation\n\n```\n/plugin marketplace add fseitun/claude-account-guard\n/plugin install account-guard@fseitun\n```\n\n## Configuration\n\n**`on_mismatch`** — set at install time when prompted, or via `/plugin config`. Options: `warn` (default) or `block`. You can also set `onMismatch` directly in `~/.claude/account-guard.json` (camelCase) if you prefer manual config.\n\n**Folder policy** is configured in `~/.claude/account-guard.json`:\n\n```json\n{\n  \"expectedByFolder\": {\n    \"~/work/acme\":    { \"allowedEmails\": [\"you@acme.com\"] },\n    \"~/personal\":     { \"allowedEmails\": [\"you@gmail.com\"] }\n  }\n}\n```\n\n**`expectedByFolder`** — map of directory prefixes to allowed email lists. The longest matching prefix wins. Paths support `~`.\n\n**`allowedEmails`** (optional, top-level) — a global allowed list that applies everywhere regardless of directory.\n\n## Commands\n\n**`/account-status [path]`** — shows the active Claude account and evaluates the policy for the given path (or current directory).\n\n## How it works\n\nOn every `UserPromptSubmit`, the hook:\n1. Gets the current working directory from the hook payload\n2. Finds the longest-prefix match in `expectedByFolder`\n3. Runs `claude auth status` to get the active email\n4. Warns or blocks if the email isn't in the matched rule's allowed list\n\nIf no config is present, or no rule matches the current directory, the hook is silent.\n\n## Development\n\n```bash\n# Run tests\npython3 -m unittest discover tests/ -v\n\n# Test the hook manually\necho '{\"cwd\": \"/your/path\", \"session_id\": \"test\", \"hook_event_name\": \"UserPromptSubmit\", \"user_prompt\": \"hello\"}' \\\n  | CLAUDE_PLUGIN_ROOT=$(pwd) python3 hooks/account_guard_hook.py\necho \"exit: $?\"\n```\n",
  "bytes": 1993,
  "sha": "012cabf0487574d51e756c9ed8858b54dec7843ffc21536bc89e4ec8b1cacabf",
  "repo_slug": "fseitun/claude-account-guard",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/plg_fseitun_claude_account_guard_claude_acco_ed83ad2e/readme"
}