# sapper-v2

> A commander agent and a worker swarm that run a pentest together

- Category: Agents & Automation / Security Agents
- Language: Python
- Licence: MIT
- Repository: https://github.com/N1nEmAn/sapper-v2
- Canonical page: https://ai-tldr.dev/tools/sapper-v2/

## In short

sapper-v2 is a multi-agent orchestration harness for penetration testing, not a single agent. It sits in the Security Agents category of the Agents & Automation tools and is open-source, written in Python and licensed MIT. To get started: install the CLI and set a goal.

## Overview

sapper-v2 is a multi-agent orchestration harness for penetration testing, not a single agent. One AI commander reads the board, decides and dispatches; generals, scouts and soldiers attack targets in parallel in their own tmux panes; and a script-only watchdog relaunches a crashed commander, rotates API keys and wraps up at the deadline. It does not bind to one model or CLI — the agent behind each role can be Claude Code, Codex, Code Buddy or any interactive CLI, and each role can run a different model.

The harness rests on three capabilities its author calls Create, Language and History. Create opens new agents by typing the CLI command into a fresh tmux pane; Language lets agents type into each other's input boxes; History is a layered fact-intent graph (title, summary, evidence document) that outlives any single agent session, so a successor reads the graph and carries on. The pentest strategy itself lives in a 426-line commander doctrine, `docker/commander/SKILL.md`, which you can replace to point the same mechanism at another long-horizon task; the author publishes the general-purpose base separately as nvwabase.

The project was built for the 3rd Tencent Cloud Intelligent Attack-Defense Challenge, where its README reports a first place in the online qualifier (80.18/100 over 8 unattended hours) on about 1B tokens. It is offensive-security tooling for authorised testing only — the repository ships a DISCLAIMER.md — and should be scoped like any operator holding the same tools.

## What it does

- Commander / general / scout / soldier roles, each running in its own tmux pane under one dispatching commander
- Model- and CLI-agnostic: swap the agent with `--agent` and the model with `--model` or `SAPPER_MODEL`, per role
- Layered fact-intent graph (title / summary / evidence) as shared memory that survives agent restarts
- Zero-strategy watchdog that relaunches a crashed commander, rotates keys and recycles agents whose context saturates
- Replaceable doctrine file, so the orchestration can be reused beyond pentesting
- Pre-built Docker image with a Kali toolchain, the sapper CLI and an offline knowledge base

## Getting started

The CLI is standard-library Python with no dependencies; the full legion runs in Docker. Model gateways, the key pool and budget are set through environment variables documented in docker/ENV.md. Only run it against systems you are authorised to test.

1. Install the CLI and set a goal

   install.sh symlinks the sapper CLI. setup creates the board for a goal; status shows the board and the ready-to-work frontier.

```bash
git clone https://github.com/N1nEmAn/sapper-v2.git
cd sapper-v2
bash install.sh
sapper setup --goal "assess http://target" --agents
sapper status
```

2. Build the full legion image

   Builds the commander image from source.

```bash
docker build -f docker/Dockerfile.commander -t sapper:latest .
```

3. Or load the pre-built image

   Download sapper-v18-mixed.tar.gz (about 1.2 GB) from the v18-champion GitHub release, then load it.

```bash
docker load < sapper-v18-mixed.tar.gz
```

## When to use it

- Reach for it in timed CTF or attack-defense competitions where many targets must be worked in parallel without a human at the keyboard
- Reach for it when one agent's context keeps saturating on a long engagement and you want findings to persist across agent restarts
- Reach for it to split work between an expensive planning model and a cheap model for mass execution
- Reach for it as a template for other long-horizon multi-agent work, by swapping the commander doctrine
