Contracts before code.
Tests as law.

A multi-agent software engineering framework where architecture is decided before a single line of implementation is written. Agents implement independently, in parallel, even competitively — with no way to ship code that doesn't honor its contract.

pip install pact-agents

LLMs are unreliable reviewers.
Tests are perfectly reliable judges.

Every multi-agent coding framework has the same problem: how do you know the code is right? Advisory coordination doesn't work. "Looks good to me" doesn't scale.

Pact's answer: make the tests first, make them mechanical, and let agents iterate until they pass. No negotiation. No review boards. Pass or fail.

Code is cheap — agents generate it in minutes. Contracts are expensive — they encode hard-won understanding of what the system actually needs to do. Pact makes that inversion explicit.

"When a module fails in production, the response isn't 'debug the implementation.' It's: add a test that reproduces the failure, flush the implementation, and let an agent rebuild it. The contract got stricter. The next implementation can't have that bug."

Contracts accumulate the scar tissue of every production incident. They become the real engineering artifact.

Nine phases. All mechanical gates.

No human judgment in the loop at verification time. The pipeline either passes or it doesn't.

1-2
Interview
& Shape
3
Decompose
4-6
Contract
Test & Validate
7-8
Implement
& Integrate
9
Diagnose

Built for the age of AI-generated code

When agents write the code, the contracts, tests, and verification become the real product.

🏗️

Contract-First Decomposition

Tasks decompose into 2-7 components. Each gets a typed interface contract and executable tests before any implementation begins.

Parallel Implementation

Independent components implement concurrently. No agent waits on another. Semaphore-limited concurrency keeps costs predictable.

🏁

Competitive Agents

N agents race on the same component. Best implementation wins — scored by test pass rate and execution time. The contract is the judge.

🌍

Python, TypeScript & JavaScript

Generate contracts, stubs, and implementations in Python, TypeScript, or plain JavaScript ES6 modules with JSDoc. Vitest for TS/JS, pytest for Python.

🔌

Multi-Provider

Route different roles to different LLMs. Opus for architecture, Sonnet for tests, GPT-4o for implementation. Anthropic, OpenAI, and Gemini supported.

💰

Budget-Aware

Per-project spend tracking with content-aware token estimation. Set a budget, let agents work. Multi-window caps prevent runaway costs.

📋

Plan-Only Mode

Stop after contracts and tests. Review the architecture. Then target specific components with pact build. Full control over what gets built and when.

🔍

Spec-Compliance Audit

Run pact audit after implementation to verify every requirement in your spec is covered. Get a gap report showing what's covered, partial, or missing.

🚨

Dysmemic Pressure Detection

The pipeline monitors its own coordination health. Detects the $50-planning-zero-output pattern, cascade failures, and budget stalls. Proposes remedies — you decide.

🔧

User-Controlled Remedies

When health degrades, Pact pauses and proposes fixes via FIFO directive. No silent config changes. The system never reduces its own degrees of freedom without asking.

If AI writes the code, who debugs it at 3am?

Agents do. The Sentinel watches production logs, detects errors, and attributes them to the right component via embedded PACT log keys.

It spawns a knowledge-flashed fixer agent loaded with the full contract and test context, adds a reproducer test, rebuilds the module, and verifies all tests pass. The contract ensures no regressions.

You review the contract change in the morning. Not the code.

Error detected in production logs
PACT:a3f2:auth_module // attributed
Fixer agent spawned with contract context
Reproducer test added to contract
Implementation rebuilt from scratch
1,260 tests pass // verified
Contract got stricter. Bug can't recur.

Up and running in 60 seconds

Python 3.12+, two dependencies. pip install pact-agents and go. Generates Python, TypeScript, or JavaScript.

Describe your task in task.md, set your standards in sops.md, and let Pact decompose, contract, and build.

View on GitHub

# Install from PyPI
pip install pact-agents

# Or with all LLM backends
pip install pact-agents[all-backends]

# Create a project
pact init my-project
# Edit my-project/task.md with your task
# Edit my-project/sops.md with your standards

# Run the pipeline
pact run my-project

# Or go step by step
pact run my-project --plan-only
pact components my-project
pact build my-project auth_module

Built on the ideas in Beyond Code

Pact is one of three systems built to test the ideas in Beyond Code: Context, Constraints, and the New Craft of Software. The book covers the coordination, verification, and specification problems that motivated Pact's design.

Read the Book