# Pi Verifier Agent

Pi package for a two-agent builder/verifier workflow. The builder runs normally
in your terminal while a read-only verifier Pi instance runs in a sibling tmux
window. After each builder turn, the verifier reads the bounded session slice,
checks the builder's claims against repository state, and sends concrete
corrective feedback back to the builder when verification fails.

## Install

```bash
pi install npm:@mporenta/pi-verifier-agent
```

Then launch Pi with the package enabled and pass `--verifiable`:

```bash
pi --verifiable
```

For repo-local development in `pi-dev`:

```bash
pi -e extensions/verifier/verifiable.ts --verifiable
```

The package includes its own verifier persona and prompt templates under
`agents/` and `prompts/`. The default verifier model is
`openai-codex/gpt-5.4-mini`, which uses Pi's ChatGPT/Codex subscription auth
route. Do not change this to `openai/gpt-5.4-mini` unless you intend to use the
API-key OpenAI provider.

Project-local overrides are supported. If the current project has
`.pi/agents/verifier.md`, the package uses that persona instead of
`agents/verifier.md`. Custom persona names use the same pattern:
`--verifier-agent foo` resolves `.pi/agents/foo.md` before packaged
`agents/foo.md`. If the project has
`.pi/verifier/prompts/verify_on_stop.md`, the verifier uses that prompt instead
of the packaged `prompts/verify_on_stop.md`.

## Package Contents

- `verifiable.ts`: builder-side extension that owns the socket server, spawns
  the verifier child, and forwards lifecycle events.
- `verifier.ts`: verifier-side extension loaded into the child Pi process.
- `verifiable-footer.ts`: builder input-bar status renderer.
- `_shared/`: IPC, persona parsing, tmux launch, and socket helpers.
- `agents/verifier.md`: default read-only verifier persona.
- `prompts/verify_on_stop.md`: prompt fired after each builder turn.
- `prompts/builder_error.md`: terse renderer template for builder error events.

## Development

```bash
npm ci
npm run typecheck
npm run pack:dry-run
```
