/guardx:canary — Canary Token Management
Manage canary tokens to detect prompt leakage effectively.
Trigger
User invokes /guardx:canary or asks to inject/check/list canary tokens.
Steps
-
Ask: "Do you want to (a) inject a canary into a system prompt, (b) check if a canary was triggered, or (c) list active canaries?"
-
(a) Inject a canary:
- Ask: "Please provide the system prompt to embed the canary into — paste it directly or give me a file path."
- If a file path is provided, use the
Readtool to load the contents. - Optionally ask for a label to identify this canary (press Enter to skip for default "unlabelled").
- Call the
inject_canaryMCP tool:Tool: inject_canary Arguments: systemPrompt: <the prompt text> label: <optional label> - Show the returned
tokenprominently and the modifiedembeddedPrompt. - Instruct the user: "Deploy the modified prompt shown above. Keep the token
<token>safe — use it later to check for leakage."
-
(b) Check if a canary was triggered:
- Ask: "Please provide the canary token (e.g. GX-a1b2c3d4)."
- Ask: "Do you have a scan ID from history, an inline scan result, or shall I run a fresh scan?"
- If running a fresh scan, invoke
/guardx:scanfirst, then use the result. - Call the
check_canaryMCP tool:Tool: check_canary Arguments: token: <the canary token> id: <scan ID> OR result: <inline scan result> - Report: triggered = LEAKAGE CONFIRMED (the canary token appeared in extracted content), clean = no leakage detected.
-
(c) List active canaries:
- Call
list_canaries. - Display results as a table: Token | Label | Created | Embedding Style.
- Call
Notes
- Canary tokens have the format
GX-[8 hex chars]. - Tokens are stored locally under
.guardx/canaries/. - A triggered canary is definitive evidence of prompt leakage — escalate immediately.