AegisContext - Keep secrets out of AI's view. Keep the AI at full power

An open-source Claude Code plugin that swaps every API key, password and token for a safe placeholder before the model ever sees it. Zero network calls, zero runtime dependencies.

AegisContext - Keep secrets out of AI's view. Keep the AI at full power
Live Demo

Technologies Used

TypeScriptClaude Code Plugin APIRegex EngineHooksMCPAho-CorasickGitleaks RulesNode.jsOS Keychain (Keychain / Credential Manager / libsecret)GitHub ActionsRemotion

AegisContext is an open-source security plugin for Claude Code that keeps API keys, passwords and tokens out of the AI's view. Every secret is swapped for a smart placeholder before the model sees it, so developers keep the full power of AI-assisted coding with none of the exposure.

Zero network calls. Zero telemetry. Zero runtime dependencies. Everything that runs is in the repository, and anyone can prove it works with the built-in leak test kit.

Key Features

  • Every door guarded: typed and pasted prompts, every file Claude reads (including @ files), command output, MCP tool results, subagent work, project instruction files and compaction summaries
  • Smart placeholders: Claude knows a secret is there, with its type, last four characters and a unique tag, and keeps working without ever seeing the real value
  • 259 detection rules: 219 industry-standard Gitleaks rules plus 40 custom rules for popular services, with label-aware matching for passwords and tokens
  • Register your own secrets: saved in the operating system's password store and caught in every form, including base64, hex, URL-encoded and JSON-escaped
  • Outbound safety check: a last line of defence that blocks a command, web request or connected tool call carrying a known secret before it runs
  • Self-defending: tool calls that try to change its settings, saved secrets or hooks are denied, shutting out prompt injection from a poisoned web page or file
  • Two independent layers: a main lock built as a plugin and a backup lock built from plain settings hooks, so protection never has a single point of failure
  • Simple controls: a full /redact command set to add, learn, allow, remove and diagnose, plus optional detection of emails and phone numbers
  • Team-ready: an organization install that no user plugin can skip, with ready-made settings for macOS, Windows and Linux

How It Works

AegisContext hooks into Claude Code at every point where text can reach the model. Each piece of text is checked once, as it arrives, and stored already cleaned. A single pass finds every keyword at the same time, patterns run only around the hits, and an Aho-Corasick matcher scans for all registered secrets and their encoded forms in one sweep, at roughly the same cost for 10 secrets or 10,000. Anything that looks encoded is decoded up to three layers deep and checked again.

Engineering

Written entirely in TypeScript on Node.js, with no runtime libraries at all: every line that runs is in the repository, and build and test tools are pinned with a lockfile. The test suite runs on Node's built-in test runner, and the tool is built to behave the same on Windows, macOS and Linux. The project is released under the Apache-2.0 licence, with a full engineering record of its specification, decisions and measurements.

Proven, Not Promised

A built-in leak test kit starts a local server that stands in for the model API, points Claude Code at it and plants fake secrets at every door. If the server sees even one, the test fails. No API key and no network needed, so anyone can run it and see the result for themselves.

  • 97.8% catch rate on the public catch set (135 of 138), with every case that has a known shape or label caught
  • 41 of 41 harmless code samples left untouched, so developers are never slowed by false alarms
  • Fast enough to disappear: the backup lock handles an event in a median of 88 ms, and the heaviest benchmark, 2 MB of base64, finishes in under half a second

Use Case

AegisContext is built for every developer who uses an AI coding assistant and wants to move fast without leaking credentials. It suits solo developers working on their own laptop, open-source maintainers, and engineering teams that need one consistent safeguard across every machine. Install it in one command, and your keys, tokens and passwords stay yours while the AI keeps helping.