---
name: pi-verify
description: Auto-verify Pi agent output. Two-agent system: builder runs, verifier checks, auto-corrects. USE WHEN verify, review, test, check, auto-fix, quality, confidence.
metadata:
  author: artale
  version: 1.0.0
---

# Pi Verify

**Two-agent verification system for Pi. Builder runs, verifier checks, auto-corrects.**

Inspired by [disler/the-verifier-agent](https://github.com/disler/the-verifier-agent)

## Concept

```
BUILDER ──► code ──► session.jsonl
                            │
                            ▼
                       VERIFIER
                            │
                            ▼ (if failed)
                       feedback loop
                            │
                            ▼
                       BUILDER fixes
```

## How It Works

1. **Builder Pi** runs normally in your terminal
2. **Verifier Pi** watches the session.jsonl
3. After each turn, verifier **checks output**
4. If issues found → **injects fix** via API
5. Loop repeats **max 3 times**
6. If still failing → **escalates to human**

## Why

- Tokens are cheap, your time is not
- Manual review = 50% of your day
- Auto-verify moves that to a second agent
- Defense in depth = safer code

## Confidence Grades

| Grade | Meaning | Action |
|-------|---------|--------|
| PERFECT | All checks pass | Done |
| VERIFIED | Minor suggestions | Info only |
| PARTIAL | Some issues | Feedback loop |
| FAILED | Major problems | Fix + escalate |

## Installation

```bash
npm install @artale/pi-verify
```

## Usage

```bash
# Start builder with verifier
pi run --verify

# Or run verifier separately
pi-verify --watch session.jsonl
```

## Configuration

```json
{
  "maxLoops": 3,
  "confidenceThreshold": "VERIFIED",
  "checks": ["syntax", "tests", "diff"]
}
```