Coriqo
Developer documentation

byoai-shield: keep secrets and personal data out of AI chat

byoai-shield runs on the device. It checks what is sent to AI chat apps, replaces personal details with placeholders, blocks leaked secrets, and keeps a signed record of what happened, not of what was said.

What it does

Shield sits on the device, in a local capture proxy and a Chrome extension, so text is checked before it leaves. For the product view of Shield, including deployment for a team, see Shield. This page is the developer reference for the open-source package.

  • Secrets are blocked. API keys and tokens, private keys, JWTs, database URLs with passwords and Luhn-valid card numbers stop the send with a 403.
  • Personal data is redacted. Emails, phone numbers, SSNs, IBANs and wallet addresses become numbered placeholders such as [EMAIL_1]. The mapping is not kept.
  • The record holds no message text. Ledger rows hold the app, the verdict, rule ids, message length and an HMAC-SHA256 fingerprint keyed by a per-device secret.

Install

byoai-shield ships inside the open-source byoai-runtime package (Apache 2.0, Python 3.10 or later). Shield alone needs the shield extra, because it signs its record with cryptography.

pip install "byoai-runtime[shield] @ git+https://github.com/coriqo/byoai-runtime"
byoai-shield
byoai-shield --install-login-item   # start at login (macOS, Linux, Windows)

The Shield UI is then at http://127.0.0.1:17831/shield. The install above is from the GitHub source, where Shield is currently maintained. The pre-release on PyPI (pip install --pre byoai-runtime) is an older build and may not include it.

Default behaviour

The default mode is redact, and it acts per tier. When several rules hit, the strictest action wins (block, then warn, then redact, then log).

  • secret: block: stops the send.
  • pii: redact: replaces the value with a placeholder.
  • flag: log: records the hit, changes nothing.
  • observe mode logs everything and changes nothing. Lowering a tier through the settings API requires an explicit "acknowledge": "less_private".

Pattern rules find known shapes of data. They will miss personal data that does not look like one of those shapes, so Shield reduces the risk of leaks and does not remove it.

What it keeps

  • No message text on disk by default. An opt-in keep_text setting stores up to 200 characters with personal details removed.
  • Retention is set by retention_days (7, 30, 90 or 365; default 30). Older ledger rows are deleted. Sealed entries stay, so receipts keep verifying.
  • The browser extension records nothing until the user agrees on its welcome page, and Turn capture off reverses it.

Which apps

The proxy reads Claude (claude.ai, the Claude desktop app and the Anthropic API) and ChatGPT (chatgpt.com and the OpenAI Chat Completions and Responses APIs; off until turned on). Gemini and Copilot do not send JSON the proxy can read. For those the browser extension’s input gate checks what you send and attach, and the proxy only records.

What protects the record

Shield’s files are owner-only and the seal chain is an append-only log, with every entry covered by a signed checkpoint (RFC 6962 Merkle tree, Ed25519 device key). Verification reports a break when an entry no longer matches its hash, when the checkpoint no longer matches the entries, when entries were cut off the end, or when the log changes while Shield runs.

What this cannot do: anything running as your user can still edit or delete the files. That is detected in the cases above, not prevented, and a wipe of everything leaves no trace. Copies held off the machine, by enrolling Shield in Coriqo, are the defence against a local wipe. Shield records that a message was sent. It does not control tools the AI runs on its own servers after the message has left.

Questions about the code?

An engineer who works on it will answer.