# Mantis

> Google's toolkit of security skills and a reference harness that let AI coding agents find, reproduce and patch vulnerabilities in a codebase

- Category: Agents & Automation / Security Agents
- Language: Python
- Licence: Apache-2.0
- Repository: https://github.com/google/mantis
- Canonical page: https://ai-tldr.dev/tools/mantis/

## In short

Mantis is an open-source toolkit from Google for running security reviews with AI coding agents. It sits in the Security Agents category of the Agents & Automation tools and is open-source, written in Python and licensed Apache-2.0. To get started: install the skills into your coding agent.

## Overview

Mantis is an open-source toolkit from Google for running security reviews with AI coding agents. It has three parts: a `skills/` directory of skills an agent loads on demand, covering threat modelling, research, review, patching and reporting; a `reference/` harness built on Google's Agent Development Kit (ADK) that runs those skills as a pipeline; and an `action/` GitHub Action that runs the harness over a pull request. The README describes the skills as the method and the harness as a working starting point meant to be adapted. It is written in Python and licensed Apache-2.0.

The pipeline reads a repository's version-control history for past vulnerabilities, builds a structural index and security summaries of the code, writes a threat model, and turns it into research hypotheses for individual agents (or simply scans every file). Findings are then deduplicated, reviewed and critiqued for production viability to cut hallucinations, reproduced anywhere from a static guess to a unit test or a mock server inside a sandbox, combined into exploit chains, patched in an adversarial loop that checks the fix, and given a severity from a calibration rubric so humans see the most critical risks first. A reflection step stores what each round learned, and the `mantis-advise` skill uses that knowledge base during later development.

The README is explicit about limits. Mantis generates and executes code autonomously and should only run in isolated, restricted environments; all findings must be verified by a security expert before they are reported, and unverified AI reports must not be mass-filed to open-source maintainers. The pull-request GitHub Action is marked untested end to end and should not gate merges. Mantis is not an officially supported Google product and is intended for demonstration rather than production use.

## What it does

- Nineteen `mantis-*` skills for the whole review loop, from history mining, structural indexing and threat modelling through research, dedupe, critique, reproduction, chaining, patching, calibration and reporting
- An ADK reference harness with `configure.py` auto-detection, a `run.sh` launcher, plain-language `--focus` hints, path exclusions, parallel campaigns and token budget caps
- Research graph synthesis: pass an `--objective` and the harness designs a custom agent-graph topology for that audit goal
- Sandbox options for reproducers, from static-only to microsandbox, gVisor (`runsc`) containers without network access, or Google Compute Engine VMs
- An MCP server that gives any MCP-capable coding agent a deterministic `mantis_check_change` verdict on each diff and a background `mantis_scan_change` audit
- A per-repository knowledge database that can be exported into the repo and imported on the next run, so later scans and the advise skill build on earlier findings

## Getting started

Mantis can be used two ways: install the skills into a coding agent and run the stages yourself, or run the ADK reference harness as an automated pipeline. The README says to use it only in an isolated environment and recommends Docker plus gVisor for running AI-generated reproducer code.

1. Install the skills into your coding agent

   The agent README says Mantis works with Gemini CLI, Antigravity CLI, Google ADK and other coding agent frameworks, and installs the skills with the skills CLI.

```bash
npx skills add google/mantis
```

2. Or install the reference harness

   Install python3-venv, then run the install script in `reference/`. Authenticate Application Default Credentials if you use Vertex AI.

```bash
cd reference && ./install.sh
gcloud auth application-default login   # only for Vertex AI
```

3. Configure and check the setup

   The configure script detects available models and sandboxes (`--interactive` starts a wizard instead), then runs a fast preflight and a live reachability probe.

```bash
python3 scripts/configure.py --auto
python3 scripts/configure.py --test --probe
```

4. Launch a review campaign

   Point `run.sh` at a file or directory. Optional flags steer the planner, leave vendored code out, or cap the token spend.

```bash
./run.sh path/to/code
./run.sh path/to/code --focus "look for IDOR"
./run.sh path/to/code --exclude vendor,testdata
./run.sh path/to/code --max-tokens 2M
```

5. Run the stages by hand inside an agent

   With the skills installed, each stage is a slash command run in order, from the knowledge base and threat model through research, review, reproduction and the final report at `workspace/report/review_packet-latest.md`.

```text
/mantis-architecture
/mantis-threat-model
/mantis-plan
/mantis-researcher
/mantis-dedupe
/mantis-review
/mantis-critic
/mantis-reproduce
/mantis-report
```

## When to use it

- Give a coding agent a structured, multi-stage security review of a codebase you own, with reproducers and candidate patches for a security engineer to verify
- Keep a security check running beside everyday AI-assisted coding by wiring the Mantis MCP server into Gemini CLI, Claude Code or Cursor
- Use the skills and ADK harness as a template for an in-house review pipeline adapted to your own stack, coding standards and risk tolerance
