Ward banner
jstockdi jstockdi

Ward

Development community

Description

Claude Code hook CLI — PII guard, leak detection, event logging

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

Ward

A fast, local CLI that integrates with [Claude Code hooks](https://docs.anthropic.com/en/docs/claude-code/hooks) to block PII, secrets, and credentials from leaking through your AI coding workflow. Ships as a single Rust binary — no runtime dependencies.

What It Does

Ward scans every prompt you send and every tool call Claude makes, blocking sensitive data before it leaves your machine.

Subcommand Hook Events Purpose
ward pii UserPromptSubmit, PreToolUse, PostToolUse Block SSNs, credit cards, emails, phone numbers
ward leaks UserPromptSubmit, PreToolUse, PostToolUse Block API keys, cloud credentials, tokens, passwords, private keys, connection strings
ward log All events Structured event logging to ~/.ward/events.jsonl

On UserPromptSubmit and PreToolUse, a match **blocks** (exit 2) before anything leaves your machine. On PostToolUse the tool has already run, so blocking is impossible — instead ward **redacts**: it rewrites the tool output via the hook's `updatedToolOutput` field, replacing each secret with a `[WARD LEAKS REDACTED: ]` (or `WARD PII`) marker before Claude ever sees it. If a match can't be masked in place, the whole output is withheld.

Detection Coverage

PII Patterns

  • Social Security Numbers (with ISO date false-positive prevention)
  • Credit card numbers (spaces and dashes)
  • Email addresses
  • US phone numbers

Leak Detection — 3 Tiers

**Tier 1: Provider-Specific Keys** (32 patterns, high confidence)

  • AWS (access key, secret key, Bedrock), GCP, Azure
  • Anthropic, OpenAI
  • GitHub (PAT, fine-grained, OAuth, app tokens), GitLab
  • Slack (bot, app, user, webhook, legacy tokens)
  • Stripe, SendGrid, Twilio, Linear, Databricks
  • Heroku, Vercel, Grafana, Sentry, Datadog
  • HashiCorp Vault, NPM, PyPI

**Tier 2: Structural Patterns** (medium confidence)

  • PEM-encoded private keys (RSA, EC, OPENSSH)
  • JWT tokens
  • Connection strings (postgres, mysql, mongodb, redis, amqp,