Skip to content

TailorAU/pact

Spec Version License: MIT Stars PRs Welcome

PACT — Protocol for Agent Consensus and Truth

The open protocol for multi-agent consensus — documents, transactions, knowledge, and beyond.

Specification · Getting Started · Examples · Contributing


The Problem

You have 3 AI agents that need to negotiate a contract. Agent A drafts liability clauses. Agent B enforces budget caps. Agent C checks regulatory compliance.

How do they collaborate on the same document without stepping on each other? Now imagine the same problem for payments, knowledge verification, clinical records, or any shared resource.

MCP gives agents tools. A2A gives agents communication. But neither gives agents structured consensus rules, human oversight, and information barriers over a shared resource.

PACT does.

Where PACT Fits

┌─────────────────────────────────────────────────────────┐
│                    AI Agent Ecosystem                    │
├──────────────┬──────────────┬───────────────────────────┤
│     MCP      │     A2A      │          PACT             │
│  Tools/Data  │  Agent Comms │  Consensus Protocol       │
│              │              │                           │
│  "Hands"     │  "Voices"    │  "Shared negotiation      │
│              │              │   table"                  │
└──────────────┴──────────────┴───────────────────────────┘
Protocol Connects agents to... Example
MCP Tools and data "Read this database"
A2A Other agents "Tell Agent B to start"
PACT Shared resources "Object to this proposal — it violates my constraint"

How It Works

PACT is a coordination and consensus protocol. Each agent arrives with its own private context and negotiating parameters. PACT handles how they declare positions, detect conflicts, and reach agreement — not the content itself.

Silence = acceptance. Proposals auto-merge after TTL unless someone objects. Only disagreements require action.

┌─────────────────────────────────────────────────────────────────┐
│                        PACT Workflow                            │
│                                                                 │
│  Agent A                  Document                  Agent B     │
│  ┌──────┐                ┌────────┐                ┌──────┐    │
│  │Legal │──intent───────▶│        │◀──constraint───│Budget│    │
│  │      │  "Add currency │sec:    │  "Cap at $2M"  │      │    │
│  │      │   risk clause" │liability                │      │    │
│  │      │                │        │                │      │    │
│  │      │                │  ✏️    │──notify──────▶ │      │    │
│  │      │                │  edit  │                │      │    │
│  │      │                │        │   No objection │      │    │
│  │      │                │        │◀──(silence)────│      │    │
│  │      │                │        │                │      │    │
│  │      │                │ ✅ Auto│                │      │    │
│  │      │                │ merged │                │      │    │
│  └──────┘                └────────┘                └──────┘    │
│                                                                 │
│  Humans can override ANY decision at ANY time.                  │
└─────────────────────────────────────────────────────────────────┘

The Core Primitives

PACT defines coordination, not content. Agents bring their own context.

Primitive What it does Why it matters
Join Register at the table Identifies who's negotiating
Intent "I want to add X to this section" Catches misalignment before anyone writes
Constraint "X must not exceed $2M" Reveals limits without revealing reasoning
Salience Score 0–10: how much you care Focuses attention on contested sections
Object "This violates my constraint" Blocks auto-merge, forces renegotiation
Escalation "Humans, we need you" Agents know when to stop and ask
Done "I'm satisfied" Signals completion and alignment

Content operations (reading documents, creating proposals, editing sections) are the responsibility of the implementation — not the protocol. See Implementations.

Quick Start

CLI

# Install the standalone PACT CLI
npm install -g @pact-protocol/cli

# Point at any PACT-compliant server
pact config --server https://your-pact-server.com --key YOUR_API_KEY

# Join a document
pact join <documentId> --as "budget-agent" --role reviewer

# Declare what you care about
pact intent <documentId> --section sec:liability --goal "Ensure currency risk is addressed"
pact constrain <documentId> --section sec:budget --boundary "Total must not exceed $2M"
pact salience <documentId> --section sec:budget --score 9

# Watch for proposals from other agents
pact poll <documentId> --since evt_0

# Object only if something violates your constraints (silence = accept)
pact object <proposalId> --doc <documentId> --reason "Exceeds $2M budget cap"

# Escalate to humans when agents can't agree
pact escalate <documentId> --message "Budget and legal agents deadlocked on liability clause"

# Signal completion
pact done <documentId> --status aligned --summary "Budget constraints satisfied"

MCP Server (for AI agent frameworks)

# Run the PACT MCP server (for Cursor, LangChain, CrewAI, AutoGen, etc.)
PACT_BASE_URL=https://your-pact-server.com \
PACT_API_KEY=YOUR_KEY \
npx @pact-protocol/mcp

Cursor / VS Code (MCP config) — add to .cursor/mcp.json or your editor’s MCP settings (adjust URL and use a real key or env reference):

{
  "mcpServers": {
    "pact": {
      "command": "npx",
      "args": ["-y", "@pact-protocol/mcp"],
      "env": {
        "PACT_BASE_URL": "https://your-pact-server.com",
        "PACT_API_KEY": "YOUR_KEY"
      }
    }
  }
}

CLI binary name: The package installs the command pact. The npm ecosystem also has an unrelated contract-testing package named pact; if your machine already has that CLI on PATH, use the pact-agent alias (same binary) instead.

Packages are published from this repo — see RELEASING.md.

REST API

# Join via invite token (no account needed)
curl -X POST https://your-server.com/api/pact/{docId}/join-token \
  -H "Content-Type: application/json" \
  -d '{"agentName": "my-agent", "token": "INVITE_TOKEN"}'

# Declare a constraint
curl -X POST https://your-server.com/api/pact/{docId}/constraints \
  -H "X-Api-Key: SCOPED_KEY" \
  -H "Content-Type: application/json" \
  -d '{"sectionId": "sec:budget", "boundary": "Total must not exceed $2M"}'

# Object to a proposal that violates your constraint
curl -X POST https://your-server.com/api/pact/{docId}/proposals/{id}/object \
  -H "X-Api-Key: SCOPED_KEY" \
  -H "Content-Type: application/json" \
  -d '{"reason": "Exceeds $2M budget cap"}'

# Poll for events (stateless)
curl https://your-server.com/api/pact/{docId}/poll?since=evt_0 \
  -H "X-Api-Key: SCOPED_KEY"

Integration Paths

Path Best for Get started
CLI Shell scripts, CI/CD, prototyping npm i -g @pact-protocol/cli
MCP Tools Cursor, LangChain, CrewAI, AutoGen npx @pact-protocol/mcp
REST API Python/TS agents, custom frameworks Getting Started
SignalR / WebSocket Real-time event-driven agents Specification

Tooling

Package What it handles Install
@pact-protocol/cli Consensus coordination — join, intent, constrain, object, escalate, done npm i -g @pact-protocol/cli
@pact-protocol/mcp Same primitives as MCP tools for AI frameworks npx @pact-protocol/mcp

These packages handle coordination only. Content operations (reading documents, creating proposals) are provided by the implementation you connect to.

Use Cases

Contract Negotiation — Legal, commercial, and compliance agents negotiate terms. Each declares constraints. Proposals auto-merge unless objected to. The document converges through structured silence.

Multi-Agent Code Review — Security, performance, and style agents review a design doc. High-salience sections get the most attention. Disagreements escalate to human architects.

Policy Drafting — Regulatory agents maintain compliance policies across jurisdictions. Information barriers prevent cross-pollination of confidential reasoning.

Knowledge Verification — AI agents propose factual claims, debate evidence, and reach consensus. Verified facts become queryable. See Source.

Design Principles

  1. Humans always win. Any human can override any agent decision, at any time, no exceptions.
  2. Silence is consent. Proposals auto-merge after TTL unless actively objected to.
  3. Agents bring their own context. PACT coordinates — it doesn't read your mind or your data.
  4. Field-level granularity. Operations target addressable fields (sections, transaction fields, claims), not raw offsets.
  5. Event-sourced truth. The operation log is the source of truth. The resource state is a projection.
  6. Transport-agnostic. REST, CLI, MCP, WebSocket — use whatever fits your stack.

Key Features (v1.1)

  • Resource Types — Consensus on any resource: documents, transactions, knowledge claims, clinical records
  • Silence = Acceptance — Proposals auto-merge after TTL unless objected to. Only disagreements need action.
  • Information Barriers — Classification frameworks, agent clearance levels, dissemination controls
  • Graduated Disclosure — 4-level framework controlling what agents can see about each other
  • Structured Negotiation — Multi-round position exchanges facilitated by a mediator
  • Implementation Profiles — Servers advertise supported resource types and conformance level
  • Invite Tokens (BYOK) — Zero-trust agent onboarding; no account required
  • Message Register — Append-only audit log of all inter-agent communication
  • Event-Sourced — The operation log is the source of truth. The resource state is a projection.

Specification

Version Status Docs
v1.1 Stable Specification · Getting Started
v1.0 Previous Specification · Getting Started
v0.3 Legacy Specification · Getting Started

Implementations

PACT defines the consensus protocol. Implementations provide the content layer for their domain.

Implementation Resource Type What it adds Status Maintainer
Tailor document Document collaboration — upload, edit, review, sign Live TailorAU
Source fact Verified knowledge graph — facts, legislation, standards Live TailorAU
Baink transaction Sovereign billing — multi-agent payment authorization Planned TailorAU

Building a PACT implementation? Open a PR to add it here.

Community

License

MIT — Use PACT however you want. Build implementations, fork it, extend it.

PACT is maintained by TailorAU. The specification is open and vendor-neutral — anyone can implement it.

About

PACT — Protocol for Agent Consensus and Truth. The open standard for multi-agent document collaboration. MIT licensed.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors