# usestrix/strix

> Python pentest agent where a root LLM agent spawns specialist child agents that share one Kali Docker sandbox with a Caido proxy.

- Category: [Open-source AI pentest and offensive-security agents](https://llms-technical-reviews.com/offensive-security-agents/)
- Repository: https://github.com/usestrix/strix (reviewed at commit `6b7ae2ebe4d47037a927aade23265ff4e4f27e84`, 2026-10-29)
- Stars: 73328 · Language: Python · License: Apache-2.0
- Canonical page: https://llms-technical-reviews.com/p/strix/

## Overview

Strix is a command-line security assessment agent written in Python. You give `strix --target` one or more targets: a Git repository, a local directory, a web URL, an IP address or an API spec. Strix then starts a Docker sandbox and runs a tree of LLM agents inside it until the root agent calls `finish_scan`. The output is a run folder with one structured report per finding, a SARIF file, CSV/JSON indexes and an executive report. A `--fail-on` flag lets a CI job fail the build on findings above a chosen severity.

The engine is built on the OpenAI Agents SDK's `SandboxAgent` and `Runner`, with LiteLLM behind a custom model provider. Each agent gets the SDK's `Filesystem` and `Shell` capabilities, which execute inside the container, plus about 45 Strix tools. These cover notes, todos, a coverage ledger, threat models, web search, finding reports, the Caido proxy history, MCP servers and the agent graph. Domain knowledge lives in Markdown "skills" under `strix/skills/` (vulnerability classes, frameworks, cloud, tooling). The prompt renderer inlines these, and an agent can load more on demand.

Most of the code is runtime plumbing rather than prompts: resumable runs, budget enforcement, context compaction, LLM-judged dedupe and strict report schemas. Scope control is the weak point. The authorised-target list is prompt text that the model is told it may extend, and nothing at the network layer enforces it.

## Architecture

```mermaid
flowchart TD
  CLI["strix CLI / TUI"] --> RUN["run_strix_scan"]
  RUN --> SBX["Docker sandbox (Kali image)"]
  RUN --> ROOT["Root SandboxAgent"]
  ROOT -->|"create_agent"| CHILD["Child agents"]
  ROOT --> LOOP["_run_cycle / Runner.run_streamed"]
  CHILD --> LOOP
  LOOP --> LLM["StrixProvider -> LiteLLM"]
  LOOP --> TOOLS["Shell, files, Strix tools"]
  TOOLS --> SBX
  SBX --> CAIDO["Caido proxy sidecar"]
  TOOLS --> REP["create_vulnerability_report"]
  REP --> DEDUPE["LLM dedupe judge"]
  REP --> STATE["ReportState -> run dir"]
  LOOP --> COORD["AgentCoordinator (agents.json)"]
```

| Component | Path | Role |
|---|---|---|
| Scan runner | `strix/core/runner.py` | Brings up the sandbox, builds root and child factories, runs or resumes the root loop |
| Agent loop | `strix/core/execution.py` | Cycle wrapper around `Runner.run_streamed`: compaction, retries, budget errors, parking |
| Agent factory | `strix/agents/factory.py` | Assembles prompt, tool list and wrappers into a `SandboxAgent` |
| Prompts and skills | `strix/agents/prompts/`, `strix/skills/` | Jinja system prompt, scope block, Markdown skill library |
| Coordinator | `strix/core/agents.py` | Agent graph, statuses, mailboxes, budget flags, `agents.json` snapshot |
| Sandbox runtime | `strix/runtime/` | Docker client, session manager, Caido bootstrap, pluggable backends |
| Graph tools | `strix/tools/agents_graph/tools.py` | `create_agent`, `send_message_to_agent`, `wait_for_agents`, `agent_finish` |
| Reporting | `strix/tools/reporting/tool.py`, `strix/report/` | Finding schema, CVSS, dedupe, run state, SARIF/CSV/Markdown/PDF writers |
| Budget hooks | `strix/core/hooks.py` | Usage accounting, turn and spend warnings, stop or pause at the limit |

## How a request flows

1. **Scan setup.** The CLI parses targets into a scan config and calls `run_strix_scan`. It creates the run directory and `.state/`, resolves the model, and treats an existing `agents.json` as a resume ([runner.py](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/core/runner.py#L215-L386)).
2. **Sandbox.** `session_manager.create_or_reuse` starts the container. Every process started through the Shell tool inherits `http_proxy`/`https_proxy` pointing at the in-container Caido sidecar, so HTTP traffic is recorded ([session_manager.py](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/runtime/session_manager.py#L312-L331)).
3. **Scope and prompt.** `build_scope_context` turns the targets into an `authorized_targets` list. API specs add their declared base URLs ([inputs.py](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/core/inputs.py#L192-L224)). The list is rendered into the system prompt through `scope.jinja`.
4. **Root agent.** `build_strix_agent` combines the base tools, any registered extra tools and the lifecycle tool. It wraps every function tool for argument coercion, strict schemas and bounded output, and attaches the `Filesystem` and `Shell` capabilities ([factory.py](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/agents/factory.py#L722-L828)). The runner registers the root in the coordinator and starts `run_agent_loop` ([runner.py](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/core/runner.py#L517-L677)).
5. **Cycle.** `_run_cycle` marks the agent running, enforces the image budget, compacts the session if needed, and streams one `Runner.run_streamed` call. It retries transient model errors, strips images after an image rejection, compacts on context overflow, and translates budget exceptions into stop or park ([execution.py](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/core/execution.py#L761-L935)). The run ends only when `_finish_tool_use_behavior` sees a lifecycle tool succeed, or, in interactive mode, a wait tool park ([factory.py](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/agents/factory.py#L600-L619)).
6. **Delegation.** The root calls `create_agent(name, task, skills)`. It validates the skill names (at most 5), passes the parent's history by default, and spawns a child that runs concurrently in the same sandbox ([tools.py](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/tools/agents_graph/tools.py#L495-L591)). Children report back with `agent_finish`, which lands in the parent's mailbox.
7. **Findings.** Any agent can file `create_vulnerability_report`. It validates fields and computes CVSS, checks cited proxy exchange ids against Caido, runs `check_duplicate`, and only then persists ([tool.py](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/tools/reporting/tool.py#L873-L933)).
8. **Finish.** The root calls `finish_scan`, which refuses while children are still active and otherwise writes the four executive report sections ([finish/tool.py](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/tools/finish/tool.py#L311-L353)). Report writers emit Markdown, JSON, CSV and SARIF into the run directory.

## Key components

### Agent graph and coordination

The structure is a tree. A root agent decomposes the work and children inherit the scan configuration through `make_child_factory` ([factory.py](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/agents/factory.py#L831-L870)). `AgentCoordinator` keeps parents, statuses, mailboxes, recovery counts and budget flags, and snapshots them atomically to `agents.json`. Each agent's conversation lives in an SDK `SQLiteSession` in `agents.db`. A resume restores the coordinator, reopens the sessions and respawns children. Planning itself is not code: it is prompt guidance from the `coordination/root_agent` skill plus the `create_agent` docstring, which tells the model when to spawn and how to name specialists.

### Tool surface

The base tool tuple ([factory.py](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/agents/factory.py#L633-L677)) covers reasoning (`think`, `load_skill`), working memory (todos, notes, coverage, threat models), web research (Exa or Perplexity), reporting, Caido history (`list_requests`, `view_request`, `repeat_request`, `list_sitemap`, `scope_rules`), MCP dispatch and the graph tools. Real security tooling is not wrapped as typed tools. Agents run CLI tools through the shell inside a Kali-based image (`containers/Dockerfile` installs nmap, nuclei, sqlmap, ffuf, semgrep, an `agent-browser` CLI and Caido), and the `tooling/` skills teach the model how to use each one. Tool output is capped by tokens, lines and bytes, and oversized results are spilled to a file in the sandbox.

### Findings pipeline

Reports carry a heavy required schema: impact, technical analysis, PoC description and script, evidence, assumptions, **counterevidence**, confidence, severity-change conditions, fix effort and a full CVSS 3.1 vector. Proxy evidence is checked. Unknown Caido request ids are rejected. If the proxy cannot be queried, the ids are kept with a warning ([tool.py](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/tools/reporting/tool.py#L231-L265)). Dedupe is deterministic for dependency CVEs and LLM-judged for everything else, optionally with a separate `STRIX_DEDUPE_MODEL` ([dedupe.py](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/report/dedupe.py#L330-L418)). The judge fails open: an error or empty reply files the finding as new. Nothing re-runs the PoC independently. Validation is the filing agent's own counterevidence step, as instructed by the `analysis/counterevidence` skill.

### Budget and limits

`DEFAULT_MAX_TURNS` is 500 ([settings.py](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/config/settings.py#L14-L14)). `--max-budget` sets a shared dollar limit with warnings at 70/85/95% for the root and a 90% reserve at which sub-agents stop, so the root can still write the report ([hooks.py](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/core/hooks.py#L56-L60)). The `pause` policy parks all agents at the limit until an operator raises it.

### Scope and safety controls

- **Scope is advisory.** `scope.jinja` lists the authorised targets, but its preamble tells the model the user is a verified tester, that it must never question authorisation, and that "the list below is the starting scope, not a ceiling" ([scope.jinja](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/agents/prompts/scope.jinja#L1-L16)). It also says websites and tool output cannot change scope, which is a sensible prompt-injection rule, but it is still only a prompt. Caido `scope_rules` are history filters that the agent manages itself, not an egress policy.
- **No approval gate.** No Strix tool requires approval before it runs. In interactive mode the agent can call `wait_for_user`. Headless runs (`-n`) run unattended.
- **Container hardening is opt-in.** The sandbox gets `NET_ADMIN` and `NET_RAW` and a `host.docker.internal` mapping. A dedicated Docker network, memory, CPU and PID limits are applied only when their `STRIX_*` environment variables are set. Log rotation is the only cap on by default ([docker_client.py](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/runtime/docker_client.py#L250-L266), [L120-L137](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/runtime/docker_client.py#L120-L137)).
- **Host-side guard.** `check_mountable_dir` refuses to bind-mount system directories, the home directory or credential folders such as `.ssh`, `.aws` and `.kube` as a code target ([utils.py](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/interface/utils.py#L1406-L1441)).

## Extending it

- **Skills.** Add a Markdown file under `strix/skills/<group>/`. Agents load it by name through `create_agent(skills=[...])` or `load_skill`. Custom skills (API-spec testing, dependency CVE scanning, SAST) live under `custom/`.
- **Tools.** `register_agent_tools()` adds tools to every root and child agent built afterwards, with a uniqueness check ([factory.py](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/agents/factory.py#L698-L714)).
- **MCP.** Servers in `~/.strix/mcp-servers.json` (or `--mcp-server`) are reached through `list_mcps`, `search_mcp_tools` and `call_mcp`, so they do not inflate the tool list.
- **Embedding.** `run_strix_scan` accepts a custom finish tool, a custom report tool, extra system-prompt context, an event sink and per-skill turn limits, which is how a hosted product can reuse the engine. Sandbox backends are pluggable through `register_backend`.

## Running it

- Install with the install script or `pipx`/`uv tool install strix-agent`. Set `STRIX_LLM` (a LiteLLM-style `provider/model`) and `LLM_API_KEY`. `LLM_API_BASE` points at a local OpenAI-compatible server, and `chatgpt/<model>` uses a ChatGPT subscription.
- Docker is required. The first run pulls the sandbox image.
- `strix --target <repo|dir|url|ip|spec>` with `--instruction`, `--scope-mode auto|diff|full` (PR diff scoping for code targets), `--max-budget`, `--max-turns`, `-n` for headless and `--fail-on` for CI.
- Telemetry (PostHog, Scarf) is on by default. Set `STRIX_TELEMETRY=0` to turn it off.

## Strengths and caveats

- **Strength: production-grade runtime.** Resume from `agents.json` plus SQLite sessions, compaction on overflow, transient-error replay, image stripping and a spend budget shared across the whole agent tree. Long unattended runs are treated as the normal case.
- **Strength: disciplined findings.** Required counterevidence, CVSS computed from vectors, proxy-backed evidence ids, dedupe before persistence and SARIF output make reports usable in CI and triage.
- **Strength: shared proxy history.** All agents' HTTP goes through one Caido instance, so children can reuse and replay each other's traffic.
- **Caveat: scope lives in the prompt.** The prompt tells the model to follow the user, not to refuse, and to treat the target list as a floor. Operators must enforce scope outside Strix, with a Docker network or firewall set through `STRIX_DOCKER_SANDBOX_NETWORK`.
- **Caveat: no human gate in headless mode.** Every command the model writes runs in a container with raw-socket and network-admin capabilities.
- **Caveat: validation is self-attested.** The agent that filed a finding also argues against it. Dedupe is an LLM call that fails open.
- **Caveat: many LLM calls.** Multi-agent fan-out, dedupe calls and compaction summaries add cost. Set `--max-budget` on every unattended run.

*Sources: code at 6b7ae2e, verified Q&A.*

## How usestrix/strix answers the Open-source AI pentest and offensive-security agents questions

### How is the agent loop and planning implemented? (answered)

Strix uses a **single root agent with multiple addressable child agents** arranged in a tree, not a flat crew. The root agent is a SandboxAgent (OpenAI Agents SDK) built in `agents/factory.py:build_strix_agent()` (lines 722–828), and it can spawn independent children via the `create_agent` tool (`tools/agents_graph/tools.py:494–606`).

**Planning and decomposition** are handled by the LLM itself through system-prompt skills. The root agent's prompt (rendered by `agents/prompt.py:render_system_prompt()`, lines 78–158) loads a chain of Jinja2 skill templates — scan modes (e.g. `scan_modes/deep`), analysis skills (`analysis/counterevidence`, `analysis/severity_calibration`), and root coordination skills (`coordination/root_agent`). The root agent decides when to spawn a specialist child by calling `create_agent`, passing a task string and optional skill list (e.g. `["xss", "sql_injection"]`). Each child calls `agent_finish` when done, posting a structured completion report back to the parent (`tools/agents_graph/tools.py:609–751`).

**Turn structure** — The inner loop runs in `core/execution.py:_run_cycle()` (lines 761–935). Each cycle: (1) marks the agent running, (2) enforces image budget and runs proactive context compaction, (3) calls `Runner.run_streamed()` for one model response, streaming events back, (4) handles lifecycle tool results (completion → stop, wait tools → park, plain text → recovery nudge). The `_finish_tool_use_behavior` callback in `agents/factory.py:600–618` determines whether a tool result is terminal. The outer loop (`_run_agent_loop`, lines 271–387) repeats cycles: in interactive mode it parks on `wait_for_user`/`wait_for_agents` with a 300s auto-resume timeout, waking on new messages; in non-interactive mode it returns immediately.

**Stop conditions** — `DEFAULT_MAX_TURNS = 500` (`config/settings.py:14`), a dollar-based `max_budget_usd` with three warn bands (70%/85%/95% via `hooks.py:57–58`), and a 90% subagent reserve (`hooks.py:60`). Recovery limit: interactive agents get 3 chances to produce a tool call after ending a turn with plain text (`execution.py:536`); non-interactive agents get the full max_turns.


Citations: [strix/core/runner.py:215-260](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/core/runner.py#L215-L260) · [strix/core/execution.py:539-658](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/core/execution.py#L539-L658) · [strix/agents/factory.py:722-828](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/agents/factory.py#L722-L828) · [strix/core/agents.py:56-82](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/core/agents.py#L56-L82) · [strix/tools/agents_graph/tools.py:494-606](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/tools/agents_graph/tools.py#L494-L606) · [strix/core/hooks.py:165-450](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/core/hooks.py#L165-L450)

### How are security tools integrated and executed? (answered)

Strix agents have access to **~30 built-in tools** plus any registered via `register_agent_tools()` (`factory.py:698–714`). Tools fall into several categories:

**Shell and filesystem** — Every agent carries `Filesystem` and `Shell` SandboxAgent capabilities (`factory.py:813–828`) that provide native SDK tools (read/write files, `exec_command`, `write_stdin`). The `exec_command` tool is wrapped to enforce output caps via `_apply_shell_output_cap()` (lines 435–442), limit yield time, and annotate running-non-TTY processes. The `write_stdin` wrapper decodes escape sequences. Outputs are bounded at `STRIX_TOOL_OUTPUT_MAX_TOKENS` (8K tokens), `STRIX_TOOL_OUTPUT_MAX_LINES` (2000), and `STRIX_TOOL_OUTPUT_MAX_BYTES` (50 KB) via `_bound_result()` (lines 138–142). When tool output exceeds the bound, it is spilled to a workspace file via the spill writer (`runner.py:402–412`).

**Browser** — The `agent_browser` skill provides a CLI for automated browser interaction (Playwright-based).

**HTTP Proxy (Caido)** — The Docker sandbox runs `caido-cli` as an in-container sidecar. Environment variables `http_proxy`/`https_proxy` pointing at `127.0.0.1:48080` route all container traffic through Caido (`session_manager.py:317–330`). Tools like `list_requests`, `view_request`, `repeat_request`, `list_sitemap`, and `scope_rules` (`tools/proxy/tools.py`) give the agent access to captured HTTP traffic.

**MCP servers** — User-configured MCP servers (via `~/.strix/mcp-servers.json`) are registered in an `McpRegistry` (`runner.py:475–515`). Tools `list_mcps`, `describe_mcp`, `call_mcp`, `get_mcp_tool_schema`, and `search_mcp_tools` let the agent discover and invoke remote tools. Tool names are namespaced by connection name.

**Reporting and knowledge** — `create_vulnerability_report`, `create_dependency_report`, `update_vulnerability_report`, `delete_vulnerability_report`, `list_reports`, and `get_report` (`tools/reporting/tool.py`) for findings. Notes, todos, threat models, and coverage tools record structured knowledge. `web_search`/`web_get_contents` provide OSINT. `think` is a reasoning scaffold.

**Agent graph tools** — `create_agent`, `send_message_to_agent`, `wait_for_agents`, `stop_agent`, `view_agent_graph`, and `agent_finish` (`tools/agents_graph/tools.py`).

**Command building and output parsing** — Tool invocations are validated by Pydantic (`@function_tool` decorator), wrapped for argument coercion (`_with_coerced_arguments`), and strict-schema compliance (`_with_strictness`). Errors are returned as tool results, not exceptions, so the model can self-correct (`_function_tool_with_error_result`, lines 294–305).


Citations: [strix/agents/factory.py:633-677](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/agents/factory.py#L633-L677) · [strix/agents/factory.py:138-162](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/agents/factory.py#L138-L162) · [strix/runtime/session_manager.py:313-330](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/runtime/session_manager.py#L313-L330) · [strix/core/runner.py:469-515](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/core/runner.py#L469-L515) · [strix/tools/reporting/tool.py:981-1010](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/tools/reporting/tool.py#L981-L1010) · [strix/tools/agents_graph/tools.py:1-30](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/tools/agents_graph/tools.py#L1-L30)

### How are scope, authorization and dangerous actions controlled? (answered)

Strix implements multiple layers of scope and safety control:

**Target allowlist via `build_scope_context`** — Every target is typed and authorized before the run. `inputs.py:build_scope_context()` (lines 192–224) builds an `authorized_targets` list from the scan config, recording each target's type (repository, local_code, web_application, ip_address, api_spec), its value/URL, and its workspace path. API specs auto-authorize their declared `base_urls` as in-scope web targets. This list is rendered into the system prompt via `scope.jinja`, telling the model what it may target.

**Workspace mount safety** — `check_mountable_dir()` in `interface/utils.py:1406–1441` prevents mounting system directories (`/bin`, `/etc`, `/usr`, etc.), home directories, and credential directories (`.ssh`, `.aws`, `.kube`) into the sandbox. Forbidden paths include 15 root trees and 12 sensitive dir names.

**Human-in-the-loop approval** — Interactive mode enables `wait_for_user`, which parks the agent and yields control. The outer agent loop in `execution.py:_run_agent_loop()` (lines 328–387) parks on the user indefinitely when interactive, with a 300s auto-resume timeout. Tools can declare `needs_approval` callbacks; the SDK enforces user confirmation before execution.

**Docker sandbox isolation** — The sandbox container runs with `NET_ADMIN`/`NET_RAW` capabilities (`docker_client.py:254–257`) but has optional network isolation: `STRIX_DOCKER_SANDBOX_NETWORK` can place it on an isolated Docker network (lines 57–66). Resource limits are available via env vars (`STRIX_SANDBOX_MEM_LIMIT`, `STRIX_SANDBOX_CPUS`, `STRIX_SANDBOX_PIDS_LIMIT`). Container logs are capped at 50 MB×3 files by default (`docker_client.py:130–137`).

**Rate limits and turn limits** — `max_turns` defaults to 500 (`settings.py:14`). The `LLM_MAX_TOOL_CALLS_PER_TURN` setting (default 32, `settings.py:104–108`) caps degenerate responses. Model-level retry has 5 attempts with exponential backoff (`models.py:687–701`). Stream idle timeout (300s), first-event timeout (120s), and total timeout (600s) prevent hung model calls (`models.py:277–290`).

**Budget enforcement** — `max_budget_usd` with policies `stop` or `pause` (`hooks.py:165–450`). Three warn bands (70%/85%/95%) inject escalation prompts into the stream. Subagents stop at 90% reserve so the root can finish writing the report. The `BudgetExceededError` propagates through the agent tree and triggers `coordinator.trigger_budget_stop()`.

**Illegal operations** — `finish_scan` refuses to run if child agents are still active (`finish/tool.py:322–335`). `agent_finish` refuses to run for root agents (`agents_graph/tools.py:679–690`). The model cannot send messages to itself, stop itself, or stop unknown agents.

> **Editor's note.** Correction: no Strix tool uses `needs_approval`, so there is no per-action approval; and `authorized_targets` is prompt text only — scope.jinja tells the model the list is 'the starting scope, not a ceiling' and never to question authorization, with no network-level enforcement (a dedicated Docker network is opt-in via STRIX_DOCKER_SANDBOX_NETWORK).

Citations: [strix/core/inputs.py:192-224](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/core/inputs.py#L192-L224) · [strix/interface/utils.py:1342-1440](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/interface/utils.py#L1342-L1440) · [strix/runtime/docker_client.py:1-67](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/runtime/docker_client.py#L1-L67) · [strix/core/hooks.py:165-250](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/core/hooks.py#L165-L250) · [strix/config/settings.py:93-108](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/config/settings.py#L93-L108) · [strix/tools/finish/tool.py:311-353](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/tools/finish/tool.py#L311-L353)

### How are findings validated and reported? (answered)

Findings are filed as structured vulnerability reports with **mandatory CVSS scoring, counterevidence, confidence, and proof-of-concept** through `create_vulnerability_report` (`tools/reporting/tool.py:981–1460`).

**Required fields** — Every finding requires title, description, impact, target, technical_analysis, poc_description, poc_script_code, remediation_steps, evidence, assumptions, counterevidence, confidence, severity_change_conditions, fix_effort, and a full 8-metric CVSS v3.1 breakdown (`tool.py:157–168`). Validation checks all required text fields, confidence enum (high/medium/low), fix_effort enum, CVSS metric validity, and HTTP exchange ID provenance.

**Deduplication** — Before persisting, the tool calls `check_duplicate()` in `report/dedupe.py:330–418`. Dependency CVEs are deduplicated deterministically by CVE + package + ecosystem identity, optionally split by manifest_path. Dynamic findings are compared via an LLM judge using a structured `DEDUPE_SYSTEM_PROMPT` (lines 68–135) that considers root cause, endpoint, method, and fix equivalence. A separate configurable dedupe model may be used via `STRIX_DEDUPE_MODEL`. When a duplicate is detected, the report is rejected with a `duplicate_of` response.

**Validation and revision lifecycle** — Every finding goes through client-side validation (CVSS computation via the `cvss` library, CVE/CWE regex, code location format, HTTP exchange ID verification against the Caido project). After filing, findings can be `update_vulnerability_report`'d (keeping id and audit history) or `delete_vulnerability_report`'d. Updates track previous values, reasons, and field history (`report/state.py:459–555`). Dependent fields (e.g. `confidence_rationale` with `confidence`) are auto-dropped when the parent field changes without a replacement.

**PoC re-validation** — The system prompt includes the `analysis/counterevidence` skill requiring agents to actively search for evidence against their own finding before filing. The `fix_verification` field enforces a four-gate review (security closure, bypass review, preserved behavior, repo checks) when a code fix is proposed.

**Report output** — Multiple formats are written to the run directory (`strix_runs/<name>/`): (1) individual markdown files per finding under `vulnerabilities/<id>.md`, (2) `vulnerabilities.json` (full structured data), (3) `vulnerabilities.csv` (index with CWE-1236 formula-injection protection), (4) `penetration_test_report.md` (executive summary + methodology + technical analysis + recommendations), (5) `findings.sarif` for CI/ASPM integration (`report/writer.py`), and (6) PDF via `report_pdf.py`. The final scan report is emitted by `finish_scan` which writes the four narrative sections.


Citations: [strix/tools/reporting/tool.py:981-1010](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/tools/reporting/tool.py#L981-L1010) · [strix/tools/reporting/tool.py:808-963](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/tools/reporting/tool.py#L808-L963) · [strix/report/dedupe.py:68-136](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/report/dedupe.py#L68-L136) · [strix/report/dedupe.py:330-418](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/report/dedupe.py#L330-L418) · [strix/report/state.py:207-240](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/report/state.py#L207-L240) · [strix/report/writer.py:148-200](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/report/writer.py#L148-L200)

### How is engagement state and knowledge kept across a long run? (answered)

Strix maintains scan state across several coordinated stores:

**ReportState** — A singleton `ReportState` (`report/state.py:197–956`) holds the in-memory vulnerability report list, run record (run name, start/end time, LLM usage, status, targets, config), and callback hooks. It persists to `run.json` on every state change (via `save_run_data()`) and writes artifact files (vulnerabilities JSON/CSV/MD, SARIF, coverage, executive report). On resume, `hydrate_from_run_dir()` (lines 260–331) reloads vulnerabilities and LLM usage from disk.

**SDK SQLite sessions** — Each agent gets a `SQLiteSession` stored in `agents.db` under the run's `.state/` directory (`core/sessions.py:43–45`). These hold the full conversation history (model responses, tool calls, results). Compaction via `llm/compaction.py:maybe_compact()` (lines 340–401) summarizes old turns when the context window is near capacity, producing a structured checkpoint (finding list, credentials, recon details, work state, failed attempts). It reads LiteLLM's model metadata for window size via `context_budget.py`, uses the LLM itself for summarization with the `_SUMMARY_INSTRUCTIONS` prompt (96 lines of dense extraction rules), and replaces old session items with the checkpoint.

**AgentCoordinator** — The in-memory coordinator (`core/agents.py:56–705`) tracks the agent graph: parent relationships, statuses (running/waiting/completed/stopped/crashed/failed/budget_paused), mailboxes (inter-agent message queues), recovery counts, wait kinds, and budget state. It snapshots to `agents.json` via `_maybe_snapshot()` (lines 684–704), using atomic temporary-file writes. On resume (`runner.py:341–383`), the snapshot is restored and subagents are respawned via `respawn_subagents()`.

**Knowledge tools** — Structured knowledge is stored and loaded from `.state/`: coverage entries (`hydrate_coverage_from_disk`), notes, threat models, todos. These are restored on resume so accumulated context survives.

**Resume mechanism** — `run_strix_scan()` (runner.py:290–731) detects a prior run by the existence of `agents.json`. It restores the coordinator snapshot, reopens each agent's SQLite session, respawns child agents in their prior state, and replays conversation from the SDK session database. A new `--instruction` on resume is injected as a fresh user message. Budget flags are recomputed from actual spend to avoid double-counting.


Citations: [strix/report/state.py:197-240](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/report/state.py#L197-L240) · [strix/report/state.py:260-331](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/report/state.py#L260-L331) · [strix/llm/compaction.py:1-20](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/llm/compaction.py#L1-L20) · [strix/llm/compaction.py:340-401](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/llm/compaction.py#L340-L401) · [strix/core/agents.py:56-100](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/core/agents.py#L56-L100) · [strix/core/agents.py:637-705](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/core/agents.py#L637-L705)

### Which models are supported and how are cost and context managed? (answered)

Strix supports **any LLM provider** through the LiteLLM routing layer integrated into the OpenAI Agents SDK's `MultiProvider` pattern, with the custom `StrixProvider` (`config/models.py:563–667`).

**Model configuration** — The primary model is set via `STRIX_LLM` env var (e.g. `vercel_ai_gateway/zai/glm-5.3`, `openrouter/deepseek/deepseek-v4.1-flash-1017`, `anthropic/claude-opus-5-5`) or `llm.model` in settings (`config/settings.py:32`). The `StrixProvider` resolves prefixed model names via LiteLLM: non-OpenAI/Anthropic prefixes route through LiteLLM with the prefix preserved. The provider also supports a **ChatGPT subscription backend** through `codex.subscription_model()` which returns a `_CodexResponsesModel` using the ChatGPT API.

**Per-role model selection** — A separate deduplication model can be configured via `STRIX_DEDUPE_MODEL` with its own API key, base URL, reasoning effort, extra headers, and extra body (`config/settings.py:116–140`). This keeps the judge model separate from the pentester model for cost and capability reasons. The dedupe model is resolved via `resolve_dedupe_model()` (models.py:53–65), binding to its own endpoint when configured.

**Cost management** — `max_budget_usd` enforces a dollar-based budget with multi-band warnings (70%/85%/95% thresholds in `hooks.py:57–60`). A 90% subagent reserve ensures the root agent can finish writing. Two budget policies: `stop` (hard stop at limit) and `pause` (park agents, wait for operator to extend). The budget is shared across all agents. Cost is tracked via LiteLLM's `success_callback` which records provider-reported cost, OpenRouter's per-stream cost capture, and a fallback cost-map estimate (`report/state.py:1089–1221`). Manual pricing overrides per model are available via `STRIX_LLM_INPUT_COST_PER_MTOK`, `STRIX_LLM_OUTPUT_COST_PER_MTOK`, and `STRIX_LLM_CACHED_INPUT_COST_PER_MTOK` (`settings.py:66–71`).

**Context window management** — Auto-compaction (`STRIX_CONTEXT_AUTO_COMPACT`, defaults on) summarizes old turns when the model's context window is near capacity (`llm/compaction.py`). Configurable via `compact_buffer_tokens` (20K), `keep_tokens` (8K), `fallback_context_tokens` (200K for unmapped models), and `summary_max_tokens` (4K). The context window is read from LiteLLM's model metadata via `context_budget.py:context_window()`.

**Local models** — Supported via `LLM_API_BASE` pointing at a local endpoint (Ollama, LM Studio, vLLM). The `StrixProvider` routes unprefixed or non-OpenAI names through LiteLLM which handles the HTTP translation. Streaming can be disabled via `LLM_DISABLE_STREAMING` for gateways that don't support SSE.

**Per-turn guardrails** — The `_TurnGuardModel` (`models.py:262–387`) rewrites tool-call IDs per turn (preventing provider rejection from reused IDs), limits tool calls per response, and enforces stream idle/first-event/total timeouts. Transient errors are retried up to 5 times with exponential backoff up to 90s.


Citations: [strix/config/models.py:563-667](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/config/models.py#L563-L667) · [strix/config/settings.py:29-113](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/config/settings.py#L29-L113) · [strix/report/dedupe.py:33-65](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/report/dedupe.py#L33-L65) · [strix/core/hooks.py:165-250](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/core/hooks.py#L165-L250) · [strix/llm/compaction.py:340-370](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/llm/compaction.py#L340-L370)
