# Repository Briefing: capture0x/redwitness
> Source: https://repoforai.com/repo/capture0x/redwitness (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/capture0x/redwitness
- **Category**: Agents & Frameworks (智能体与框架)
- **Primary Language**: Python
- **License**: AGPL-3.0
- **Engineering Health**: A (82/100 · Maintenance 35/35 · Adoption 16/25 · Releases 20/20 · License 11/20)
- **Latest Release**: v1.6.0 (2026-11-30) — https://github.com/capture0x/redwitness/releases
- **Review Snapshot**: 2026-12-03
- **Deployment / Stack Signals**: Docker, Self-Hosted, API
- **Momentum**: 122 ★ total (+0 24h / +121 7d) · 37 forks
- **Topics**: `ai-agents`, `ai-pentesting`, `ai-red-teaming`, `ai-security`, `jailbreak`, `llm`, `llm-hacking`, `llm-security`, `mcp`, `mitre-atlas`, `offensive-security`, `owasp-llm-top-10`
- **When to Use**: Best for: Security and QA teams that need auditable guardrail regression checks, reviewable evidence, and CI release gates for applications they operate. Skip if: You only need a fixed-dataset model score, require a turnkey managed service, or cannot operate the stack and provide an approved judge endpoint without violating data-handling rules.

## Overview
```text
### Architecture & Core Mechanics
RedWitness is a self-hosted application with a Next.js operator UI, a Python FastAPI backend, and PostgreSQL 16 Alpine under Docker Compose. The UI proxies API traffic to FastAPI, which handles authentication, role-based access, and the signed-scope gate. A state-machine orchestrator reads versioned, hashed JSON/YAML test definitions rather than embedding test content in the engine. The Governor enforces request limits, rate and budget controls, and IP pinning.

Target replies are treated as untrusted input. Deterministic checks take precedence; when a rule cannot decide, a separate model judges the reply and must cite text that actually appears in it. Verification requires a configured threshold of repeat observations across fresh conversations. Stored transcripts, replay results, and the library hash let reviewers trace what was evaluated, while the hash-chained audit log records activity. Browser and sandbox runners are optional components, separate from the core UI/API/database path.

### Key Capabilities & Differentiators
RedWitness evaluates application behavior across chatbots, RAG pipelines, and agents, including instruction handling, data isolation, tool permissions, and unsafe output. It supports OpenAI and Anthropic APIs, generic JSON over HTTP or WebSocket, and widget-only chat interfaces through an optional browser runner. Judge configuration is separate and supports Anthropic, OpenAI, and OpenAI-compatible APIs. Findings can be mapped to OWASP LLM Top 10, MITRE ATLAS, and NIST AI RMF; SARIF serves downstream tooling, while PDF and Word reports serve human reviewers.

The evaluation pipeline combines exact-quote checks and replay with severity caps, optional second-model review, and human calibration. On 59 hand-labelled cases, 19 of them deliberately difficult, Claude Sonnet yielded 95% correct decisions and sent the remaining 5% to human review; Claude Haiku yielded 85% correct and sent 15% to review. Neither recorded an incorrect verdict in that sample. Those figures show how often each configuration reached a correct decision without escalation on that set; they do not establish detection accuracy on a new application.

### Trade-offs & Limitations
Compared with a standalone model benchmark, RedWitness adds authorization records, application-level evidence, and reviewable findings. That overhead pays off when a release decision depends on what an application exposed or did, not just a model score. Conversely, replay increases request volume, stronger judges raise inference costs, and browser-backed evaluations can add maintenance when the UI changes. A replay-backed finding demonstrates repeatability under the tested conditions, not coverage of every application path.

Self-hosting gives operators control over the deployment and where local evidence is stored, but it does not guarantee that data stays on-premises: an external judge may receive target reply content. Compared with a managed service, operators retain responsibility for upgrades, secrets, evidence retention, backups, and access control. Treat transcripts as sensitive, and review AGPL-3.0 obligations before distributing the software or offering a modified version to network users.

### Hardware & Deployment Guide
The standard deployment requires Docker with Compose v2 and a free UI port, defaulting to 3000. The installer generates local secrets and builds the stack; the Debian package also leads into Docker-based setup rather than replacing it. The default Compose layout makes the UI reachable from the local machine and does not publish API or database ports to the host. PostgreSQL uses a persistent volume, so plan backups for the database and deployment secrets. External judging requires provider credentials and connectivity; local inference must be reachable from the backend container, whose localhost is not the host machine.

For sizing, start with the UI, API, and PostgreSQL, then account for concurrent runs, retained transcripts, and any optional runners. Size local inference separately; the application stack has no specified VRAM requirement. The v1.6.0 bundled demo uses a mock judge and needs no provider key. v1.5.0 added contextual assistant chat for runs and findings, and v1.4.1 added release checksums and signed build provenance for verifying the packaged artifact.
```

## Key Capabilities
```text
- Request governance: Signed scopes bind targets, test categories, time windows, and request budgets; the Governor checks each request.
- Evidence traceability: Findings retain transcripts, replay results, and the exact test-library hash.
- Verdict pipeline: Deterministic checks take priority, model verdicts require verbatim evidence, and inconclusive cases can go to human review.
- Guardrail comparison: Defense Efficacy compares the same tests with and without a guardrail and reports a 95% interval.
- CI handoff: Scoped, expiring API tokens, SARIF export, and signed completion webhooks support integration; incomplete runs cannot pass the gate.
- Deployment boundary: The default Compose layout exposes the UI on the local machine without publishing FastAPI or PostgreSQL to the host.
```

## Quick Start / Clone
```bash
./scripts/init-env.sh             # writes .env with random secrets and prints the admin password once
docker compose up -d --build --wait
```
