Real-time visual security for prompt engineering. Detects and visualizes hidden "ghost" characters, directional overrides, and malicious Unicode within the VS Code editor.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Real-time visual security for prompt engineering. Detects and visualizes hidden "ghost" characters, directional overrides, and malicious Unicode within the VS Code editor.
✨ Features
X-Ray Vision: Instantly reveals invisible characters (ZWSP, NBSP) and BIDI overrides with distinct decorations.
Real-Time Diagnostics: Highlights threats with squiggly lines (Red for Critical, Yellow for High).
Quick Fixes: One-click remediation for common threats (e.g., "Remove invisible character").
The extension registers several commands accessible via the Command Palette (Cmd+Shift+P / Ctrl+Shift+P):
PromptShield: Scan Workspace
Triggers a highly concurrent, streaming scan of your entire project directory, respecting .gitignore and .promptshieldignore.
Automatically generates a detailed workspace-report.md in your .promptshield directory containing file:// links to all discovered threats.
PromptShield: Show Detailed Report
Opens a quick-pick list of all active threats in the currently focused file for rapid navigation.
PromptShield: Toggle X-Ray
Toggles the inline ghost-text decorators that visually expose invisible characters like [ZWSP].
Code Actions & Quick Fixes
When your cursor is over a highlighted threat, you can use the Quick Fix menu (Cmd+. / Ctrl+.) to access context-aware actions:
Fix this issue / Fix all issues: Immediately and deterministically removes the dangerous characters from the document without breaking surrounding text block shapes.
Fix with AI (Copilot Integrated): For semantic threats (like encoded payloads or complex regex injections), this action bridges directly to GitHub Copilot (or your active Language Model) to intelligently rewrite the malicious prompt segment while preserving the original intent.
Ignore this line: Automatically injects a language-appropriate comment (e.g. // promptshield-ignore next) to suppress the warning.
Remove unused ignore directive: Keeps your codebase clean by offering to delete ignore comments that are no longer masking an active threat.
Configuration
Customize detection rules in .vscode/settings.json or your User Settings: