# Prolog Verification

> prolog, verification, evidence, invariants, worktrees, brave, hooks

- Skill: `lost-rob0t/prolog-verification` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds@latest add lost-rob0t/prolog-verification`
- Raw SKILL.md: https://api.skillmd.com/api/skills/lost-rob0t/prolog-verification/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: lost-rob0t (https://skillmd.com/u/lost-rob0t)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/lost-rob0t/prolog-verification

---


# Prolog verification

## Goal

Verify agent changes against explicit facts and invariants stored under the current worktree's `.prolog/` directory.

## Required state

- `.prolog/facts.kb` contains task/control facts and current repository state.
- `.prolog/runs/run-<HEAD>.pl` contains machine-recorded observations and Brave evidence for that Git HEAD.
- `.prolog/verify.pl` derives completion and owns task-specific PlUnit tests.
- `.prolog/result.json` is overwritten by the gate with the checked repository state and result.

Use the installed `prolog-verify` command when available. Otherwise run this skill's `scripts/prolog-verify.py` with Python 3.

## Workflow

1. Run `prolog-verify init --task <short-task-id>` in the worktree before recording evidence.
2. Add task-specific requirements and derived invariants to the canonical verification files. Never assert `verified(true)` or equivalent self-certifying facts.
3. Run real tests through `prolog-verify observe -- <command> [args...]`. The helper records the command, exit status, output digest, Git HEAD, and worktree digest in `run-<HEAD>.pl`.
4. When external discovery is required, run `prolog-verify brave --query <query>` so the fixed Brave CLI call and its result are recorded in the same run file. Use `record-brave` only when a compatible Brave tool already wrote its successful result to a file. Do not mark local-only work as research.
5. Run `prolog-verify check`. Treat a missing, stale, timed-out, exceptional, or non-zero result as failure.

## Rules

- Facts tied to an old HEAD or worktree digest are historical evidence, not current proof.
- Keep claimed requirements, machine observations, and derived conclusions distinct.
- `.prolog/runs/`, sessions, verifier control files, and result output are runtime state and are excluded from the worktree digest.
- Durable `.prolog/kb/**` project knowledge is not runtime state: changes there must affect the digest and require fresh verification evidence.
- Missing evidence is unknown, not proof of falsehood.
- Use `library(clpfd)` for integer constraints and `table/1` for recursive relations over cyclic graphs when needed.
- Keep verification pure. Filesystem, shell, and network effects belong in the helper, which projects their results into ground Prolog facts.
- Do not weaken or delete an invariant merely to make the gate pass.

For the fact schema and extension rules, read [references/schema.md](references/schema.md).

