gendigitalinc/sage
Lightweight Agent Detection & Response (ADR) layer for AI agents — guards commands, files, and web requests. Part of Gen Agent Trust Hub.
Sage – Safety layer for AI coding assistants
What it is – Sage is a lightweight security plug‑in that sits between an AI‑powered coding assistant (Claude Code, Cursor, VS Code, OpenClaw, OpenCode, etc.) and the host system. Whenever the assistant tries to run a tool call – e.g. a shell command, download a URL, write a file, or install a package – Sage intercepts the request, runs a series of threat checks, and only lets the action proceed if it is deemed safe.
Why it matters – Large language model (LLM)‑based coding tools can be tricked into executing malicious commands or fetching harmful payloads (prompt‑injection attacks, supply‑chain compromises, etc.). Sage adds a defensive “firewall” that protects the developer’s machine without requiring changes to the underlying AI model.
Core capabilities
| Feature | What it does |
|---|---|
| URL reputation | Queries a cloud service to flag known malware, phishing or scam links before they are fetched. |
| Local heuristics | Over 300 YAML‑defined patterns detect dangerous shell commands, suspicious URLs, credential leaks, and code obfuscation. |
| Prompt‑injection detection | A two‑stage guard – fast heuristic rules followed by a fine‑tuned machine‑learning model – that spots injected instructions in fetched content. |
| Package supply‑chain checks | Looks up npm / PyPI packages, verifies they exist, evaluates their reputation and age to catch typosquatting or abandoned libraries. |
| Plugin scanning | At the start of each AI‑assistant session, Sage scans any installed plug‑ins for known threats. |
| AMSI integration | On Windows (and WSL) Sage forwards commands to the Antimalware Scan Interface, letting the OS’s real‑time scanner block malware. |
How to get it
- Read the online install guide – https://ai.gendigital.com/sage (keeps the steps up‑to‑date).
- Choose your AI assistant and follow the short command shown in the README:
- Claude Code – add the repo as a plugin and install
sage@sage. - Cursor – install the Gen Sage extension from the Cursor marketplace.
- VS Code – install the Gen Sage extension from the VS Code marketplace.
- OpenClaw –
openclaw plugins install @gendigital/sage-openclaw. - OpenCode – add
@gendigital/sage-opencodeto theopencode.jsonconfig file.
- Claude Code – add the repo as a plugin and install
- After installation, Sage runs automatically, logging decisions to an on‑disk JSONL audit file.
Typical workflow
- The developer writes a prompt to the AI assistant.
- The assistant generates a tool call (e.g.,
git clone https://evil.example.com/repo.git). - Sage intercepts the call and:
- Checks the URL against the cloud reputation service.
- Runs the local YAML heuristics.
- (If needed) feeds the content to the prompt‑injection ML model.
- Looks up any package involved in a supply‑chain check.
- Sends the command through AMSI on Windows.
- If any check flags a threat, Sage blocks the action and records the event; otherwise the command is allowed to execute.
Who should use it
- Developers who rely on LLM‑based code assistants and want to avoid accidental malware execution.
- Security teams looking for a plug‑and‑play safeguard that works across multiple AI IDE extensions.
- Ops / DevOps who automate code generation and need a policy‑enforced gate before any generated script runs.
Extensibility & contribution
- Threat patterns live in
threats/as simple YAML files – contributors can add new rules via a pull request. - The repository includes a Developer Guide describing the architecture, testing harness, and how to train or update the prompt‑injection ML model.
- All code is Apache‑2.0; the rule set has its own Detection Rule License 1.1.
Bottom line – Sage provides a focused, cross‑assistant security layer that catches malicious tool calls generated by AI coding assistants, using a mix of cloud reputation, local heuristics, ML‑based prompt‑injection detection, and OS‑level scanning.
Related
- Project
- Project
- Project
- Project