Predicate
Modular rules, skills, and workflows that keep AI coding assistants anchored to the true goal across long-horizon work.
Predicate is built from two synergistic halves: correction relaxes drift back out in an outer loop once it appears, and prevention keeps the walk focused before drift compounds. Correction without prevention corrects toward the wrong goal; prevention without correction drifts anyway over a long horizon. Together they bound drift.
Two terms used throughout. A walk is a single agent generation run, and the agent performing it is a walker — Predicate treats generation as a trajectory that can drift, not as a mind that thinks. An IBC (Initial Boundary Condition) is the prompt contract that sets a walker on course: the goal, constraints, and acceptance criteria a walk is launched against.
See the Getting Started Guide to integrate Predicate into your project.
What it looks like in practice
The doctrine below is heavy; the daily experience is not. A concrete example: you ask the agent to fix a bug and invoke the core workflow (predicate:core). Instead of editing the implementation directly, the agent first writes a test that captures the bug and runs it to confirm it fails (a baseline failure — proof the test actually exercises the bug). Only then does it write the fix, re-running the test until it passes. When it commits, the commit-msg hook rejects the message if it does not follow Conventional Commits form or references context a stranger could not resolve. None of that is the agent remembering to be careful — each step is a gate that blocks until satisfied. The rest of this document explains why those gates are shaped the way they are.
A fuller, runnable worked example — a real record an agent wrote while cutting a test suite down to size — lives at ledger/examples/walkthrough/.
Repository structure
predicate/
├── rules.md # The master ruleset: the Verification Dual and the Prime Invariants every walker inherits
├── ambient.md # Always-on principles that are not workflows (no entrypoint)
├── conditioning/ # System-prompt generator: invariant-core ++ role persona, gated by injection-rule contract
├── skills/ # Encapsulated agent skills (rules, workflows, tools)
├── ledger/ # Nickel contracts that make campaign artifacts machine-valid
├── gates/ # Standalone evaluator scripts (orphan, self-containment)
├── hooks/ # Git hooks that enforce the three-tier Commit Gate at commit time
├── templates/ # Project templates (IBC.md, ADR.md, etc.)
└── docs/ # Guides, the orchestration protocol, ADRs, and theory
Two directories are runtime-only and gitignored by this repository: .scratch/
holds a campaign's ephemeral working set, and .ledger/ is the durable history
sub-repository (the flight recorder). Neither is tracked here; see
the flight recorder below. These entries are specific to
the predicate checkout; downstream consumers must add both lines to their own
project's .gitignore. The file templates/.gitignore in the checkout contains
them as a copy-ready reference.
Terminology
Predicate packages all agent assets as skills:
| Term | Category | Description |
|---|
| Rule | Constraint | Declarative guardrails (like rust or engineering guidelines). |
| Workflow | Procedure | State-machine SOPs (like core, refine, or campaign). |
| Tool | Capability | Executable scripts (like security-audit). |
Architecture: correction + prevention
Prompt engineering is a fragile way to program. Autoregressive language models do not "think" or "reason"; they execute a stochastic walk across a discrete token state-space. Over long generations, errors compound, and the boundary condition that set the agent on course fades as context accumulates. Without external structure, an agent will eventually drift off course, write unverified code, or introduce regressions.
A drifting walk fails in two distinct ways, so Predicate answers each with its own half:
- Correction detects drift after it appears and relaxes it back out — an outer feedback loop scored by the strongest available evaluator. This is the Verification Dual.
- Prevention keeps the walk in its basin before drift compounds — externalizing the goal, requirements, unknowns, and available tools as a durable, selectively re-surfaced conditioning layer.
The two are not ranked; they are peers that cover different failure modes. Correction relaxes error away from a fixed attractor; prevention keeps that attractor felt as the context grows. The intro to rules.md and the project goal in AGENTS.md state the same architecture; the halves below expand each at the level of a newcomer.
The correction half: the Verification Dual