---
title: Prove Before Act Agent Context Document
description: Answers to the 10 exact questions autonomous agents ask when evaluating Prove Before Act as a proof-of-action service
url: https://provebeforeact.com/agent-context.md
human_page: https://provebeforeact.com/agent-context
updated: 2026-07-03
tags: [proof-of-existence, pba-certification, agent-accountability, x402, MCP, audit-trail, Prove-Before-Act]
---

# Prove Before Act — Agent Context Document
> Answers to the 10 questions autonomous agents ask when evaluating Prove Before Act.
> Machine-readable version. Human page: https://provebeforeact.com/agent-context
> The Prove Before Act specification is at https://provebeforeact.com/standard — design pattern, core invariant, 4W audit trail, and reference implementation.

## One-line summary

Prove Before Act is the accountability pattern for autonomous agents; xProof is the reference implementation. Hash a declared decision basis locally, anchor its SHA-256 fingerprint on MultiversX before acting, then record the outcome for a publicly verifiable 4W evidence trail. Do not provide internal chain-of-thought. Pay per proof with USDC on Base via x402 — no account needed.

**The principle**: Prove Before & After Act. Anchor a declared decision basis (WHY) BEFORE executing any significant action. Anchor the actual result (WHAT) AFTER for a complete 4W evidence trail.

---

## ⚡ Quick Start — 5 minutes

```bash
# Option A — Get 10 free proofs instantly (no wallet, no card)
curl -X POST https://provebeforeact.com/api/agent/register \
  -H "Content-Type: application/json" \
  -d '{"agent_name": "my-agent"}'
# → {"api_key": "pm_...", "trial": {"quota": 10, "remaining": 10}}

# Option B — Pay per proof via x402 (zero account setup)
# POST /api/proof without auth → receive HTTP 402 ($0.01 USDC on Base, eip155:8453)
# → sign payment with your Base wallet → resend with X-PAYMENT header → get proof_id

# Option C — Add Prove Before Act to any MCP-compatible agent
# {"mcpServers": {"prove-before-act": {"url": "https://provebeforeact.com/mcp", "headers": {"Authorization": "Bearer pm_KEY"}}}}
# Then call register_trial (free api_key) then certify_file to anchor proofs
```

---

## Use-case examples

Three copy-paste patterns for the most common agent workflows.

### Trading agent — prove a decision before executing a trade

```javascript
import { createHash, randomBytes } from "node:crypto";

const BASE_URL = "https://provebeforeact.com";
const sha256 = text => createHash("sha256").update(text).digest("hex");
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
const WAIT_MS = 120_000, REQUEST_MS = 10_000, MAX_POLLS = 40;

async function requestJson(apiKey, path, method, body, deadline) {
  const remaining = deadline - Date.now();
  if (remaining <= 0) throw new Error("Proof deadline expired; stop");
  const controller = new AbortController();
  const timer = setTimeout(() => controller.abort(), Math.min(REQUEST_MS, remaining));
  try {
    const res = await fetch(BASE_URL + path, {
      method, signal: controller.signal, redirect: "error", cache: "no-store",
      headers: { Authorization: "Bearer " + apiKey, "Content-Type": "application/json" },
      ...(body === undefined ? {} : { body: JSON.stringify(body) }),
    });
    if (!res.ok) throw new Error("Proof HTTP failure; stop");
    const value = await res.json();
    if (!value || typeof value !== "object" || Array.isArray(value) ||
        "error" in value || value.success === false || Date.now() >= deadline) {
      throw new Error("Malformed, rejected or expired proof response; stop");
    }
    return value;
  } finally {
    clearTimeout(timer);
  }
}

async function createProof(apiKey, hash, filename, metadata, deadline) {
  const value = await requestJson(apiKey, "/api/proof", "POST", {
    file_hash: hash, filename, metadata,
  }, deadline);
  const id = value.proof_id;
  if (typeof id !== "string" || !UUID.test(id) || value.file_hash !== hash ||
      !["pending", "certified", "confirmed"].includes(value.status)) {
    throw new Error("Creation reference/hash invalid; stop");
  }
  return id; // HTTP success and a proof ID are NOT confirmation.
}

async function waitForConfirmation(apiKey, id, hash, deadline) {
  for (let attempt = 0; attempt < MAX_POLLS; attempt++) {
    const value = await requestJson(apiKey, "/api/proof/" + id, "GET", undefined, deadline);
    if (value.id !== id || value.fileHash !== hash) {
      throw new Error("Read reference/hash mismatch; stop");
    }
    if (value.blockchainStatus === "confirmed" && value.verified === true) return;
    if (value.blockchainStatus !== "pending" || value.verified !== false) {
      throw new Error("Failed, unknown or inconsistent proof status; stop");
    }
    if (attempt + 1 === MAX_POLLS) break;
    const remaining = deadline - Date.now();
    if (remaining <= 0) break;
    await new Promise(resolve => setTimeout(resolve, Math.min(2_000, remaining)));
  }
  throw new Error("Confirmation wait expired or exhausted; stop");
}

// agent: { apiKey, decisionBasis, execute: async (whyId) => ({ content: string }) }
// decisionBasis is the chosen context/justification/action, never chain-of-thought.
// Keep its prompt/source hashes and rationale LOCAL. Do not log or upload the basis.
async function certifyAndAct(agent) {
  if (!agent.decisionBasis || typeof agent.decisionBasis !== "object" ||
      Array.isArray(agent.decisionBasis) ||
      typeof agent.decisionBasis.intended_action !== "string" ||
      !agent.decisionBasis.intended_action.trim()) {
    throw new Error("Provide a local declared basis bound to the intended action");
  }
  const decisionBasis = {
    ...agent.decisionBasis,
    invocation_id: randomBytes(32).toString("hex"), // fresh, opaque; LOCAL ONLY
  };
  const whyHash = sha256(JSON.stringify(decisionBasis));
  const deadline = Date.now() + WAIT_MS;
  const whyId = await createProof(agent.apiKey, whyHash, "declared-why.json", {
    type: "coherence_check", action_type: "trade_execution_reasoning",
  }, deadline); // ONLY intentionally public classifications in metadata.
  await waitForConfirmation(agent.apiKey, whyId, whyHash, deadline);
  if (Date.now() >= deadline) throw new Error("Authorization expired; stop");

  // Public GET reads stored service finality checks; it does NOT query chain live.
  // No action/publication is reachable before exact stored confirmation.
  const result = await agent.execute(whyId);
  if (!result || typeof result.content !== "string") throw new Error("Expected output content");
  const whatHash = sha256(result.content);
  const afterDeadline = Date.now() + WAIT_MS;
  const whatId = await createProof(agent.apiKey, whatHash, "declared-what.json", {
    action_type: "trade_execution", why_proof_id: whyId,
  }, afterDeadline);
  await waitForConfirmation(agent.apiKey, whatId, whatHash, afterDeadline);
  const link = await requestJson(agent.apiKey, "/api/coherence/link", "POST", {
    why_proof_id: whyId, what_proof_id: whatId,
  }, afterDeadline);
  if (link.success !== true || link.linked !== true ||
      link.coherence_check?.why_proof_id !== whyId ||
      link.coherence_check?.linked_proof_id !== whatId) {
    throw new Error("WHY/WHAT link not confirmed");
  }
  // Failure AFTER execute must not automatically replay the action.
  // These commitments do not by themselves prove an off-chain action or intimate intent.
  return { why_proof_id: whyId, what_proof_id: whatId, result };
}

// Supply your own action adapter. It is invoked ONLY after exact confirmation.
// Rationale, sources and invocation_id remain local, not public metadata.
const proofs = await certifyAndAct({
  apiKey: "pm_YOUR_KEY",
  decisionBasis: { intended_action: "BUY BTC 0.5", declared_justification: "Configured risk policy approved" },
  execute: async whyId => ({ content: JSON.stringify(await execute_trade("BUY", "BTC", 0.5, { audit_ref: whyId })) }),
});
console.log("WHY/WHAT references:", proofs.why_proof_id, proofs.what_proof_id);
```

### Research agent — anchor a declared decision basis before publishing a report

```javascript
import { createHash, randomBytes } from "node:crypto";

const BASE_URL = "https://provebeforeact.com";
const sha256 = text => createHash("sha256").update(text).digest("hex");
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
const WAIT_MS = 120_000, REQUEST_MS = 10_000, MAX_POLLS = 40;

async function requestJson(apiKey, path, method, body, deadline) {
  const remaining = deadline - Date.now();
  if (remaining <= 0) throw new Error("Proof deadline expired; stop");
  const controller = new AbortController();
  const timer = setTimeout(() => controller.abort(), Math.min(REQUEST_MS, remaining));
  try {
    const res = await fetch(BASE_URL + path, {
      method, signal: controller.signal, redirect: "error", cache: "no-store",
      headers: { Authorization: "Bearer " + apiKey, "Content-Type": "application/json" },
      ...(body === undefined ? {} : { body: JSON.stringify(body) }),
    });
    if (!res.ok) throw new Error("Proof HTTP failure; stop");
    const value = await res.json();
    if (!value || typeof value !== "object" || Array.isArray(value) ||
        "error" in value || value.success === false || Date.now() >= deadline) {
      throw new Error("Malformed, rejected or expired proof response; stop");
    }
    return value;
  } finally {
    clearTimeout(timer);
  }
}

async function createProof(apiKey, hash, filename, metadata, deadline) {
  const value = await requestJson(apiKey, "/api/proof", "POST", {
    file_hash: hash, filename, metadata,
  }, deadline);
  const id = value.proof_id;
  if (typeof id !== "string" || !UUID.test(id) || value.file_hash !== hash ||
      !["pending", "certified", "confirmed"].includes(value.status)) {
    throw new Error("Creation reference/hash invalid; stop");
  }
  return id; // HTTP success and a proof ID are NOT confirmation.
}

async function waitForConfirmation(apiKey, id, hash, deadline) {
  for (let attempt = 0; attempt < MAX_POLLS; attempt++) {
    const value = await requestJson(apiKey, "/api/proof/" + id, "GET", undefined, deadline);
    if (value.id !== id || value.fileHash !== hash) {
      throw new Error("Read reference/hash mismatch; stop");
    }
    if (value.blockchainStatus === "confirmed" && value.verified === true) return;
    if (value.blockchainStatus !== "pending" || value.verified !== false) {
      throw new Error("Failed, unknown or inconsistent proof status; stop");
    }
    if (attempt + 1 === MAX_POLLS) break;
    const remaining = deadline - Date.now();
    if (remaining <= 0) break;
    await new Promise(resolve => setTimeout(resolve, Math.min(2_000, remaining)));
  }
  throw new Error("Confirmation wait expired or exhausted; stop");
}

// agent: { apiKey, decisionBasis, execute: async (whyId) => ({ content: string }) }
// decisionBasis is the chosen context/justification/action, never chain-of-thought.
// Keep its prompt/source hashes and rationale LOCAL. Do not log or upload the basis.
async function certifyAndAct(agent) {
  if (!agent.decisionBasis || typeof agent.decisionBasis !== "object" ||
      Array.isArray(agent.decisionBasis) ||
      typeof agent.decisionBasis.intended_action !== "string" ||
      !agent.decisionBasis.intended_action.trim()) {
    throw new Error("Provide a local declared basis bound to the intended action");
  }
  const decisionBasis = {
    ...agent.decisionBasis,
    invocation_id: randomBytes(32).toString("hex"), // fresh, opaque; LOCAL ONLY
  };
  const whyHash = sha256(JSON.stringify(decisionBasis));
  const deadline = Date.now() + WAIT_MS;
  const whyId = await createProof(agent.apiKey, whyHash, "declared-why.json", {
    type: "coherence_check", action_type: "report_publication_reasoning",
  }, deadline); // ONLY intentionally public classifications in metadata.
  await waitForConfirmation(agent.apiKey, whyId, whyHash, deadline);
  if (Date.now() >= deadline) throw new Error("Authorization expired; stop");

  // Public GET reads stored service finality checks; it does NOT query chain live.
  // No action/publication is reachable before exact stored confirmation.
  const result = await agent.execute(whyId);
  if (!result || typeof result.content !== "string") throw new Error("Expected output content");
  const whatHash = sha256(result.content);
  const afterDeadline = Date.now() + WAIT_MS;
  const whatId = await createProof(agent.apiKey, whatHash, "declared-what.json", {
    action_type: "report_publication", why_proof_id: whyId,
  }, afterDeadline);
  await waitForConfirmation(agent.apiKey, whatId, whatHash, afterDeadline);
  const link = await requestJson(agent.apiKey, "/api/coherence/link", "POST", {
    why_proof_id: whyId, what_proof_id: whatId,
  }, afterDeadline);
  if (link.success !== true || link.linked !== true ||
      link.coherence_check?.why_proof_id !== whyId ||
      link.coherence_check?.linked_proof_id !== whatId) {
    throw new Error("WHY/WHAT link not confirmed");
  }
  // Failure AFTER execute must not automatically replay the action.
  // These commitments do not by themselves prove an off-chain action or intimate intent.
  return { why_proof_id: whyId, what_proof_id: whatId, result };
}

// Supply your own action adapter. It is invoked ONLY after exact confirmation.
// Rationale, sources and invocation_id remain local, not public metadata.
const proofs = await certifyAndAct({
  apiKey: "pm_YOUR_KEY",
  decisionBasis: { intended_action: "Publish report", declared_justification: "Chosen sources reviewed", sources: ["local-source-reference"] },
  execute: async whyId => { await publish_report(report_content, { audit_ref: whyId }); return { content: report_content }; },
});
console.log("WHY/WHAT references:", proofs.why_proof_id, proofs.what_proof_id);
```

### Support agent — certify a decision before responding to a customer

```javascript
import { createHash, randomBytes } from "node:crypto";

const BASE_URL = "https://provebeforeact.com";
const sha256 = text => createHash("sha256").update(text).digest("hex");
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
const WAIT_MS = 120_000, REQUEST_MS = 10_000, MAX_POLLS = 40;

async function requestJson(apiKey, path, method, body, deadline) {
  const remaining = deadline - Date.now();
  if (remaining <= 0) throw new Error("Proof deadline expired; stop");
  const controller = new AbortController();
  const timer = setTimeout(() => controller.abort(), Math.min(REQUEST_MS, remaining));
  try {
    const res = await fetch(BASE_URL + path, {
      method, signal: controller.signal, redirect: "error", cache: "no-store",
      headers: { Authorization: "Bearer " + apiKey, "Content-Type": "application/json" },
      ...(body === undefined ? {} : { body: JSON.stringify(body) }),
    });
    if (!res.ok) throw new Error("Proof HTTP failure; stop");
    const value = await res.json();
    if (!value || typeof value !== "object" || Array.isArray(value) ||
        "error" in value || value.success === false || Date.now() >= deadline) {
      throw new Error("Malformed, rejected or expired proof response; stop");
    }
    return value;
  } finally {
    clearTimeout(timer);
  }
}

async function createProof(apiKey, hash, filename, metadata, deadline) {
  const value = await requestJson(apiKey, "/api/proof", "POST", {
    file_hash: hash, filename, metadata,
  }, deadline);
  const id = value.proof_id;
  if (typeof id !== "string" || !UUID.test(id) || value.file_hash !== hash ||
      !["pending", "certified", "confirmed"].includes(value.status)) {
    throw new Error("Creation reference/hash invalid; stop");
  }
  return id; // HTTP success and a proof ID are NOT confirmation.
}

async function waitForConfirmation(apiKey, id, hash, deadline) {
  for (let attempt = 0; attempt < MAX_POLLS; attempt++) {
    const value = await requestJson(apiKey, "/api/proof/" + id, "GET", undefined, deadline);
    if (value.id !== id || value.fileHash !== hash) {
      throw new Error("Read reference/hash mismatch; stop");
    }
    if (value.blockchainStatus === "confirmed" && value.verified === true) return;
    if (value.blockchainStatus !== "pending" || value.verified !== false) {
      throw new Error("Failed, unknown or inconsistent proof status; stop");
    }
    if (attempt + 1 === MAX_POLLS) break;
    const remaining = deadline - Date.now();
    if (remaining <= 0) break;
    await new Promise(resolve => setTimeout(resolve, Math.min(2_000, remaining)));
  }
  throw new Error("Confirmation wait expired or exhausted; stop");
}

// agent: { apiKey, decisionBasis, execute: async (whyId) => ({ content: string }) }
// decisionBasis is the chosen context/justification/action, never chain-of-thought.
// Keep its prompt/source hashes and rationale LOCAL. Do not log or upload the basis.
async function certifyAndAct(agent) {
  if (!agent.decisionBasis || typeof agent.decisionBasis !== "object" ||
      Array.isArray(agent.decisionBasis) ||
      typeof agent.decisionBasis.intended_action !== "string" ||
      !agent.decisionBasis.intended_action.trim()) {
    throw new Error("Provide a local declared basis bound to the intended action");
  }
  const decisionBasis = {
    ...agent.decisionBasis,
    invocation_id: randomBytes(32).toString("hex"), // fresh, opaque; LOCAL ONLY
  };
  const whyHash = sha256(JSON.stringify(decisionBasis));
  const deadline = Date.now() + WAIT_MS;
  const whyId = await createProof(agent.apiKey, whyHash, "declared-why.json", {
    type: "coherence_check", action_type: "support_response_reasoning",
  }, deadline); // ONLY intentionally public classifications in metadata.
  await waitForConfirmation(agent.apiKey, whyId, whyHash, deadline);
  if (Date.now() >= deadline) throw new Error("Authorization expired; stop");

  // Public GET reads stored service finality checks; it does NOT query chain live.
  // No action/publication is reachable before exact stored confirmation.
  const result = await agent.execute(whyId);
  if (!result || typeof result.content !== "string") throw new Error("Expected output content");
  const whatHash = sha256(result.content);
  const afterDeadline = Date.now() + WAIT_MS;
  const whatId = await createProof(agent.apiKey, whatHash, "declared-what.json", {
    action_type: "support_response", why_proof_id: whyId,
  }, afterDeadline);
  await waitForConfirmation(agent.apiKey, whatId, whatHash, afterDeadline);
  const link = await requestJson(agent.apiKey, "/api/coherence/link", "POST", {
    why_proof_id: whyId, what_proof_id: whatId,
  }, afterDeadline);
  if (link.success !== true || link.linked !== true ||
      link.coherence_check?.why_proof_id !== whyId ||
      link.coherence_check?.linked_proof_id !== whatId) {
    throw new Error("WHY/WHAT link not confirmed");
  }
  // Failure AFTER execute must not automatically replay the action.
  // These commitments do not by themselves prove an off-chain action or intimate intent.
  return { why_proof_id: whyId, what_proof_id: whatId, result };
}

// Supply your own action adapter. It is invoked ONLY after exact confirmation.
// Rationale, sources and invocation_id remain local, not public metadata.
const proofs = await certifyAndAct({
  apiKey: "pm_YOUR_KEY",
  decisionBasis: { intended_action: "Send customer response", declared_justification: "Configured support policy approved" },
  execute: async whyId => { await send_to_customer(ticket_id, response_text, { audit_ref: whyId }); return { content: response_text }; },
});
console.log("WHY/WHAT references:", proofs.why_proof_id, proofs.what_proof_id);
```

---

## Q1 — How does x402 work exactly? (payment without an API key)

x402 is a payment-in-HTTP protocol. An agent sends a request with no credentials, receives HTTP 402 with the price and payment instructions, signs a USDC micro-payment on Base, then resends with the X-PAYMENT header. No account registration, no API key, no human in the loop.

**Flow:**
1. POST https://provebeforeact.com/api/proof with no auth → receive HTTP 402 with price ($0.01 USDC) and signed payment payload template
2. Agent signs USDC payment on Base (network: eip155:8453)
3. Resend same request with header X-PAYMENT: <base64-signed-payment> → receive HTTP 200 with proof_id

```bash
# Step 1 — discover price
curl -X POST https://provebeforeact.com/api/proof \
  -H "Content-Type: application/json" \
  -d '{"file_hash": "YOUR_SHA256", "filename": "decision.md"}'
# → HTTP 402 {"payment": {"amount": "10000", "currency": "USDC", "network": "eip155:8453", ...}}

# Step 3 — pay and anchor in one request
curl -X POST https://provebeforeact.com/api/proof \
  -H "Content-Type: application/json" \
  -H "X-PAYMENT: <base64-signed-payment>" \
  -d '{"file_hash": "YOUR_SHA256", "filename": "decision.md"}'
# → HTTP 200 {"proof_id": "...", "verify_url": "/proof/..."}
```

Compatible facilitators: https://api.cdp.coinbase.com/platform/v2/x402 (Coinbase CDP), Conway Terminal, OpenClaw.

**Why this matters**: A fully autonomous agent with a wallet but no pre-registration can anchor its first proof in a single session. Pure machine-to-machine.

**Complete Python x402 implementation (copy-paste ready):**

```python
import hashlib, json, base64, requests

def anchor_x402(reasoning: dict, filename: str, wallet_signer) -> dict:
    """
    Anchor a proof via x402 — no API key, no account needed.
    wallet_signer: object with .sign_x402(payment_info) → signed_payment dict
    Compatible facilitators: Coinbase CDP, Conway Terminal, OpenClaw
    """
    # 1. Hash locally — nothing sensitive leaves this function
    content = json.dumps(reasoning, sort_keys=True, ensure_ascii=False).encode()
    file_hash = hashlib.sha256(content).hexdigest()

    payload = {"file_hash": file_hash, "filename": filename}

    # 2. POST without auth → get HTTP 402 with price + payment payload
    r = requests.post("https://provebeforeact.com/api/proof", json=payload)
    assert r.status_code == 402, f"Expected 402, got {r.status_code}"

    payment_info = r.json()["payment"]
    # {"amount": "10000", "currency": "USDC", "network": "eip155:8453", "payee": "0x...", ...}

    # 3. Sign with your Base wallet (USDC on eip155:8453)
    signed = wallet_signer.sign_x402(payment_info)
    x_payment = base64.b64encode(json.dumps(signed).encode()).decode()

    # 4. Resend with X-PAYMENT header → get proof_id immediately
    proof = requests.post("https://provebeforeact.com/api/proof",
        headers={"X-PAYMENT": x_payment}, json=payload)
    assert proof.status_code == 200, proof.text

    data = proof.json()
    return {"proof_id": data["proof_id"], "verify_url": data["verify_url"]}


# Usage — no Prove Before Act account, no API key
result = anchor_x402(
    reasoning={"decision": "BUY BTC", "rationale": "RSI=38", "ts": "2026-06-02T14:30:00Z"},
    filename="decision_001.json",
    wallet_signer=my_base_wallet   # your wallet adapter
)
print(f"Proof: https://provebeforeact.com{result['verify_url']}")
```

**Zero-account bootstrap path**: Call register_trial via MCP for 10 free proofs → switch to x402 for unlimited paid anchoring. An agent can go from zero to production in a single session with no human involvement.

---

## Q2 — What is the real anchoring latency?

Approximate latencies — actual values vary with network and load. Current proof totals and activity status are available from the live public agent profiles:

| Operation | Measured latency |
|-----------|-----------------|
| Single certification (API call → proof_id) | ~1–2s typical |
| Batch of 3 files | ~2s typical |
| On-chain confirmation (MultiversX) | ~6s (avg block time) |
| On-chain verification lookup | sub-second typical |

The proof_id is returned immediately (status: pending). On-chain confirmation is asynchronous (~6s). Use webhook_url to receive a callback when confirmed.

**A pending proof_id is not permission to act.** For pre-action 4W, trading or publication, validate POST and wait for a bounded fresh GET of that exact reference/hash with verified === true and blockchainStatus === "confirmed". Any failure or uncertainty stops the action. Only non-gating archival work may continue while its certification is pending.

---

## Q3 — What to do if the Prove Before Act call fails? (retry policy + fallback)

| HTTP status | Recommended action |
|------------|-------------------|
| 200 / 201 | Accepted response, not authorization — validate reference/hash and pass the bounded exact GET gate |
| 402 | Stop the action; arrange payment separately, never act on an unpaid or unconfirmed proof |
| 409 | Stop on conflict; do not treat an error-body reference as authorization |
| 429 | Stop the action; respect Retry-After only for a separately bounded future proof attempt |
| 5xx | Stop the action; uncertainty is not confirmation |
| timeout | Stop the action; POST outcome may be unknown, never automatically replay the action |

**Fail-closed policy**: Stop or queue operator review when proof confirmation is unavailable. Do not wait indefinitely, proceed without confirmation, or present retroactive anchoring as a pre-action commitment.

**Archival-only retry helper below:** returning a proof ID (or None) never authorizes an action. For pre-action workflows use Q10's exact confirmation gate instead.

```python
def anchor_with_retry(file_hash, filename, api_key, max_retries=3):
    backoff = [1, 2, 4]
    for attempt in range(max_retries):
        try:
            resp = requests.post(
                "https://provebeforeact.com/api/proof",
                headers={"Authorization": f"Bearer {api_key}"},
                json={"file_hash": file_hash, "filename": filename},
                timeout=10
            )
            if resp.status_code in (200, 201): return resp.json()["proof_id"]  # archive reference, NOT action authorization
            if resp.status_code == 409: return resp.json()["existing_proof_id"]
            if resp.status_code == 429:
                time.sleep(int(resp.headers.get("Retry-After", 5))); continue
            if resp.status_code >= 500:
                time.sleep(backoff[attempt]); continue
        except requests.Timeout:
            time.sleep(backoff[attempt]); continue
    log_local_fallback(file_hash, filename)
    return None
```

---

## Q4 — What is the average cost per 1,000 anchors?

Current price: **$0.01 per certification**.

| Volume | Cost |
|--------|------|
| 100 anchors | $1.00 |
| 1,000 anchors | $10.00 |
| 10,000 anchors | $100 |
| 50 agents × 20 actions/day × 30 days = 30,000 anchors/month | $300/month |

Flat $0.01 per certification — no tiers, no volume discounts. Payment methods: EGLD on MultiversX (ACP/wallet) or USDC on Base (x402, no account needed). Batch endpoint (POST /api/batch, up to 50 files) reduces API overhead at same per-file price.

---

## Q5 — How does Prove Before Act compare to Arweave, Ceramic, Sign Protocol?

Rule: use the right tool for the right job. Prove Before Act is not a competitor to these — it occupies a distinct niche.

| Use case | Best tool |
|----------|-----------|
| Anchor agent decision BEFORE execution with 4W audit trail | **Prove Before Act** |
| Pay per proof with no API key (x402 / USDC on Base) | **Prove Before Act** only |
| MCP tool for agent frameworks (JSON-RPC 2.0) | **Prove Before Act** only |
| Store full file permanently on-chain forever | **Arweave** |
| EVM attestation schemas (Ethereum ecosystem) | **Sign Protocol** |
| Mutable verifiable data streams | **Ceramic** |
| Privacy by default (hash only, file never uploaded) | **Prove Before Act** (default behavior) |
| Agent trust leaderboard + public reputation profile | **Prove Before Act** only |

Cost comparison per 1,000 anchors: Prove Before Act ~$10 | Arweave ~$5–50 (file size dependent) | Ceramic ~variable (requires hosted node or third-party provider; mainnet deprecated 2024) | Sign Protocol ~$20–100 (EVM gas)

---

## Q6 — How to integrate Prove Before Act via MCP? Concrete examples.

MCP endpoint: https://provebeforeact.com/mcp (Streamable HTTP transport, POST only)

Available tools:
- certify_file — anchor a file hash or declared decision-basis document
- audit_agent_session — decision-certification record for operator policies (Agent Audit Log Standard)
- investigate_proof — look up a proof by ID or hash
- register_trial — get a free api_key instantly (no wallet needed, 10 free proofs)

```json
// MCP server config (add to claude_desktop_config.json, Cursor, etc.)
{
  "mcpServers": {
    "prove-before-act": {
      "url": "https://provebeforeact.com/mcp",
      "headers": { "Authorization": "Bearer pm_YOUR_API_KEY" }
    }
  }
}
```

```json
// Tool: certify_file — anchor a declared decision basis before acting
{
  "name": "certify_file",
  "arguments": {
    "file_hash": "sha256_of_declared_decision_basis",
    "filename": "decision_session_001.md",
    "metadata": {
      "who": "my-agent-v2",
      "what": "Approved BUY 0.5 BTC at market",
      "when": "2026-06-02T14:30:00Z",
      "why": "RSI=38, below 40 threshold; allocation=2.1%, below 3% cap",
      "model": "gpt-4o-mini",
      "session_id": "sess_abc123"
    }
  }
}
// → { proof_id: "uuid", verify_url: "/proof/uuid", status: "pending" }
```

```json
// Tool: audit_agent_session — decision-certification record; the operator policy handles a missing proof_id
{
  "name": "audit_agent_session",
  "arguments": {
    "agent_id": "trading-agent-v2",
    "session_id": "sess_abc123",
    "action_type": "trade_execution",
    "action_description": "Execute BUY 0.5 BTC",
    "inputs_hash": "sha256_of_all_input_data",
    "inputs_manifest": {
      "fields": ["btc_price", "portfolio_nav", "rsi_14d"],
      "sources": ["binance_ws", "coingecko"]
    },
    "risk_level": "high",
    "decision": "approved"
  }
}
```

For agents without an API key yet — use register_trial:
```json
{ "name": "register_trial", "arguments": { "agent_name": "my-new-agent" } }
// → { api_key: "pm_...", free_certifications: 10 }
// Use immediately — no browser, no wallet, no human in the loop
```

---

## Q7 — How does the 4W audit trail work?

The 4W audit trail is automatically rendered on the public proof page when you include at least one of the four fields in metadata:

**4W breakdown — optional WHO from MX-8004, WHAT/WHEN/WHY from Prove Before Act:**

| | Question | Provided by |
|:--|:--|:--|
| WHO | Which agent or actor made this decision? | MX-8004 — optional identity integration; inspect /api/mx8004/status before relying on it |
| WHAT | What output or action was certified? | Prove Before Act — SHA-256 hash of the output, anchored on MultiversX mainnet |
| WHEN | Immutable timestamp? | Prove Before Act — MultiversX block finality (~6 s); not a self-reported clock |
| WHY | What declared decision basis supported the action? | Prove Before Act — `action_description`, `risk_level`, and `context` fields from `/api/audit` |

Prove Before Act records WHAT / WHEN / WHY. MX-8004 can add WHO when configured; check the live status endpoint and each validation job separately.

- **WHO**: Which agent, model, or actor made this decision
- **WHAT**: What action or output was certified
- **WHEN**: Immutable on-chain timestamp from MultiversX block
- **WHY**: The declared decision basis that supported the action — not internal chain-of-thought

```bash
curl -X POST https://provebeforeact.com/api/proof \
  -H "Authorization: Bearer pm_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "file_hash": "YOUR_SHA256",
    "filename": "decision_basis.md",
    "metadata": {
      "who": "my-agent-v2 (gpt-4o-mini)",
      "what": "Approved BUY 0.5 BTC at $67,400",
      "when": "2026-06-02T14:30:00Z",
      "why": "RSI=38 (below 40 threshold), allocation=2.1% (below 3% cap), risk policy v3.1 approved"
    }
  }'
```

The 4W section is rendered at https://provebeforeact.com/proof/{id} — publicly verifiable by anyone without an account.

For the Agent Audit Log Standard, use POST /api/audit when an operator policy needs structured decision fields: inputs_manifest, risk_level, decision.

---

## Q8 — Privacy risks — what is sent, what stays local?

**What is SENT to Prove Before Act:**
- SHA-256 hash (64 hex chars) — mathematically one-way
- Filename (can be synthetic/generic)
- Optional metadata fields you choose to include (who/what/when/why)

**What STAYS LOCAL (never transmitted):**
- The actual file content
- Declared decision-basis document text
- Input data values
- Model weights or strategy details

**Known privacy considerations:**
- **Timing correlation**: Frequent anchor patterns can reveal agent activity rhythm. Mitigate by batching (POST /api/batch) or adding jitter.
- **Metadata exposure**: who/what/why fields are stored and rendered publicly if is_public=true. Use generic descriptions for sensitive decisions.
- **On-chain permanence**: MultiversX transactions cannot be deleted. Design metadata accordingly.
- **Not a ZK system**: SHA-256 hashing, not zero-knowledge proofs. A party with the original data can verify the hash. If ZK is required, use a ZK proving layer upstream and anchor the ZK proof commitment.

Prove Before Act is a "hash-and-anchor" system optimized for agent accountability, not cryptographic privacy. For maximum privacy: anchor hash-only, omit sensitive metadata, use a synthetic filename.

---

## Q9 — Can you monitor proofs from a fleet of agents? How?

Yes. All agent profiles and proof timelines are public APIs — no auth needed to read.

Per-agent monitoring:
```
GET https://provebeforeact.com/api/agents/{wallet}          → trust score, total certs, streak, violations, level
GET https://provebeforeact.com/api/agents/{wallet}/timeline  → paginated audit timeline
GET https://provebeforeact.com/api/trust/{wallet}            → lightweight trust lookup
GET https://provebeforeact.com/badge/trust/{wallet}.svg      → embeddable SVG trust badge
GET https://provebeforeact.com/api/leaderboard               → top 50 public agents by trust score
```

**Recommended fleet architecture:**
1. Each agent has its own pm_ API key tied to its MultiversX wallet
2. Each agent anchors with its own who field (agent ID + model version)
3. Supervisor polls /api/agents/{wallet} for each agent hourly
4. Alert conditions: trust score drops, violation count increases, streak breaks, no anchor in 24h
5. Use webhook_url on each certification for real-time callbacks on confirmation

**Production reference — Moltbook fleet (xproof_agent_verify):**
- Current proof total, confirmation-status breakdown, streak and trust score: live public profile below
- Active since: December 2025
- Public profile: https://provebeforeact.com/agent/erd1hlx4xanncp2wm9aly2q6ywuthl2q9jwe9sxvxpx4gg62zcrvd0uqr8gyu9
- Architecture: single agent, REST API, POST /api/proof with 4W metadata, webhook for confirmation

---

## Q10 — Complete agent workflow: declared decision basis → hash → anchor → action → result

**The canonical Prove Before & After Act loop:**

```
1. Agent declares its decision basis (WHY), not internal chain-of-thought
2. Add a fresh opaque random invocation value and serialize the declared decision basis locally
3. Compute SHA-256 hash locally (nothing leaves the agent)
4. POST WHY hash with only intentionally public classifications; validate HTTP, no business error, UUID and returned hash
5. Poll that exact UUID/hash within bounded requests/time; require verified === true and blockchainStatus === "confirmed", then act
6. Hash the actual result/output (WHAT) locally
7. POST WHAT hash to Prove Before Act → receive what_proof_id
8. Confirm WHAT and record the WHY/WHAT link; anchors alone do not observe the off-chain action or intimate intent
```

Keep the WHY document, its justification, prompt/source hashes and fresh opaque invocation value local. The public GET reflects stored service finality checks; it is not a new direct chain lookup. Any uncertainty stops the pre-action path. Never replay an already executed action automatically if WHAT certification or linkage fails.

```javascript
import { createHash, randomBytes } from "node:crypto";

const BASE_URL = "https://provebeforeact.com";
const sha256 = text => createHash("sha256").update(text).digest("hex");
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
const WAIT_MS = 120_000, REQUEST_MS = 10_000, MAX_POLLS = 40;

async function requestJson(apiKey, path, method, body, deadline) {
  const remaining = deadline - Date.now();
  if (remaining <= 0) throw new Error("Proof deadline expired; stop");
  const controller = new AbortController();
  const timer = setTimeout(() => controller.abort(), Math.min(REQUEST_MS, remaining));
  try {
    const res = await fetch(BASE_URL + path, {
      method, signal: controller.signal, redirect: "error", cache: "no-store",
      headers: { Authorization: "Bearer " + apiKey, "Content-Type": "application/json" },
      ...(body === undefined ? {} : { body: JSON.stringify(body) }),
    });
    if (!res.ok) throw new Error("Proof HTTP failure; stop");
    const value = await res.json();
    if (!value || typeof value !== "object" || Array.isArray(value) ||
        "error" in value || value.success === false || Date.now() >= deadline) {
      throw new Error("Malformed, rejected or expired proof response; stop");
    }
    return value;
  } finally {
    clearTimeout(timer);
  }
}

async function createProof(apiKey, hash, filename, metadata, deadline) {
  const value = await requestJson(apiKey, "/api/proof", "POST", {
    file_hash: hash, filename, metadata,
  }, deadline);
  const id = value.proof_id;
  if (typeof id !== "string" || !UUID.test(id) || value.file_hash !== hash ||
      !["pending", "certified", "confirmed"].includes(value.status)) {
    throw new Error("Creation reference/hash invalid; stop");
  }
  return id; // HTTP success and a proof ID are NOT confirmation.
}

async function waitForConfirmation(apiKey, id, hash, deadline) {
  for (let attempt = 0; attempt < MAX_POLLS; attempt++) {
    const value = await requestJson(apiKey, "/api/proof/" + id, "GET", undefined, deadline);
    if (value.id !== id || value.fileHash !== hash) {
      throw new Error("Read reference/hash mismatch; stop");
    }
    if (value.blockchainStatus === "confirmed" && value.verified === true) return;
    if (value.blockchainStatus !== "pending" || value.verified !== false) {
      throw new Error("Failed, unknown or inconsistent proof status; stop");
    }
    if (attempt + 1 === MAX_POLLS) break;
    const remaining = deadline - Date.now();
    if (remaining <= 0) break;
    await new Promise(resolve => setTimeout(resolve, Math.min(2_000, remaining)));
  }
  throw new Error("Confirmation wait expired or exhausted; stop");
}

// agent: { apiKey, decisionBasis, execute: async (whyId) => ({ content: string }) }
// decisionBasis is the chosen context/justification/action, never chain-of-thought.
// Keep its prompt/source hashes and rationale LOCAL. Do not log or upload the basis.
async function certifyAndAct(agent) {
  if (!agent.decisionBasis || typeof agent.decisionBasis !== "object" ||
      Array.isArray(agent.decisionBasis) ||
      typeof agent.decisionBasis.intended_action !== "string" ||
      !agent.decisionBasis.intended_action.trim()) {
    throw new Error("Provide a local declared basis bound to the intended action");
  }
  const decisionBasis = {
    ...agent.decisionBasis,
    invocation_id: randomBytes(32).toString("hex"), // fresh, opaque; LOCAL ONLY
  };
  const whyHash = sha256(JSON.stringify(decisionBasis));
  const deadline = Date.now() + WAIT_MS;
  const whyId = await createProof(agent.apiKey, whyHash, "declared-why.json", {
    type: "coherence_check", action_type: "comment_reasoning",
  }, deadline); // ONLY intentionally public classifications in metadata.
  await waitForConfirmation(agent.apiKey, whyId, whyHash, deadline);
  if (Date.now() >= deadline) throw new Error("Authorization expired; stop");

  // Public GET reads stored service finality checks; it does NOT query chain live.
  // No action/publication is reachable before exact stored confirmation.
  const result = await agent.execute(whyId);
  if (!result || typeof result.content !== "string") throw new Error("Expected output content");
  const whatHash = sha256(result.content);
  const afterDeadline = Date.now() + WAIT_MS;
  const whatId = await createProof(agent.apiKey, whatHash, "declared-what.json", {
    action_type: "comment", why_proof_id: whyId,
  }, afterDeadline);
  await waitForConfirmation(agent.apiKey, whatId, whatHash, afterDeadline);
  const link = await requestJson(agent.apiKey, "/api/coherence/link", "POST", {
    why_proof_id: whyId, what_proof_id: whatId,
  }, afterDeadline);
  if (link.success !== true || link.linked !== true ||
      link.coherence_check?.why_proof_id !== whyId ||
      link.coherence_check?.linked_proof_id !== whatId) {
    throw new Error("WHY/WHAT link not confirmed");
  }
  // Failure AFTER execute must not automatically replay the action.
  // These commitments do not by themselves prove an off-chain action or intimate intent.
  return { why_proof_id: whyId, what_proof_id: whatId, result };
}

// Your adapter supplies the actual action and declared output bytes.
const proofs = await certifyAndAct({
  apiKey: "pm_YOUR_KEY",
  decisionBasis: { intended_action: "Comment", declared_justification: "Configured response policy" },
  execute: async whyId => agent.execute({ audit_ref: whyId }),
});
```

**Equivalent curl workflow (same checks, classifications and WHY/WHAT linkage):**
```bash
#!/usr/bin/env bash
# Requires bash, curl, jq, openssl, sha256sum. Use an existing API key.
# WHY_DOCUMENT: local JSON decision basis, never chain-of-thought/raw prompts.
# ACTION_COMMAND: your executable; takes WHY ID, writes actual result to stdout.
set -euo pipefail
umask 077
BASE="https://provebeforeact.com"
: "${PBA_API_KEY:?Set your API key without printing it}"
: "${WHY_DOCUMENT:?Set the local private WHY JSON file}"
: "${ACTION_COMMAND:?Set your action executable}"
dir=$(mktemp -d)
trap 'rm -rf "$dir"' EXIT
nonce=$(openssl rand -hex 32)
jq -ce --arg nonce "$nonce" 'if type=="object" and (.intended_action|type=="string" and test("[^[:space:]]")) then . + {invocation_id:$nonce} else error("Expected local basis with intended_action") end' "$WHY_DOCUMENT" > "$dir/why.json"
why_hash=$(sha256sum "$dir/why.json" | cut -d' ' -f1)
deadline=$((SECONDS + 120))

request_json() {
  local method=$1 path=$2 output=$3 input=${4:-} remaining timeout status
  remaining=$((deadline - SECONDS))
  (( remaining > 0 )) || return 1
  timeout=$(( remaining < 10 ? remaining : 10 ))
  local options=(--silent --show-error --fail --connect-timeout 5 --max-time "$timeout"
    --request "$method" --header "Authorization: Bearer $PBA_API_KEY"
    --header "Content-Type: application/json" --output "$output" --write-out '%{http_code}')
  [[ -z "$input" ]] || options+=(--data-binary "@$input")
  status=$(curl "${options[@]}" "$BASE$path") || return 1
  [[ "$status" =~ ^2[0-9][0-9]$ ]] && (( SECONDS < deadline )) || return 1
  jq -e 'type=="object" and (has("error")|not) and .success!=false' "$output" > /dev/null
}
create_proof() {
  local hash=$1 filename=$2 metadata=$3
  jq -n --arg hash "$hash" --arg filename "$filename" --argjson metadata "$metadata" '{file_hash:$hash, filename:$filename, metadata:$metadata}' > "$dir/post.json" || return 1
  request_json POST /api/proof "$dir/create.json" "$dir/post.json" || return 1
  jq -e --arg hash "$hash" '.file_hash==$hash and (.status=="pending" or .status=="certified" or .status=="confirmed") and (.proof_id|type=="string" and test("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89aAbB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"))' "$dir/create.json" > /dev/null || return 1
  jq -r '.proof_id' "$dir/create.json"
}
wait_confirmed() {
  local id=$1 hash=$2 status attempt
  for ((attempt=0; attempt<40; attempt++)); do
    request_json GET "/api/proof/$id" "$dir/read.json" || return 1
    jq -e --arg id "$id" --arg hash "$hash" '.id==$id and .fileHash==$hash and (.verified|type=="boolean")' "$dir/read.json" > /dev/null || return 1
    status=$(jq -r '.blockchainStatus' "$dir/read.json")
    if [[ "$status" == confirmed ]]; then
      jq -e '.verified==true' "$dir/read.json" > /dev/null || return 1
      (( SECONDS < deadline )) && return 0
      return 1
    fi
    [[ "$status" == pending ]] || return 1
    jq -e '.verified==false' "$dir/read.json" > /dev/null || return 1
    (( attempt < 39 && SECONDS < deadline )) || return 1
    sleep 2
  done
  return 1
}
# No rationale, document, source/prompt hash, or nonce in public metadata.
why_id=$(create_proof "$why_hash" declared-why.json '{"type":"coherence_check","action_type":"comment_reasoning"}')
wait_confirmed "$why_id" "$why_hash"
(( SECONDS < deadline )) || exit 1
# GET uses stored service finality state, NOT a fresh chain lookup.
"$ACTION_COMMAND" "$why_id" > "$dir/result"
# If subsequent certification fails, do not replay the action automatically.
what_hash=$(sha256sum "$dir/result" | cut -d' ' -f1)
deadline=$((SECONDS + 120))
metadata=$(jq -nc --arg id "$why_id" '{action_type:"comment",why_proof_id:$id}')
what_id=$(create_proof "$what_hash" declared-what.json "$metadata")
wait_confirmed "$what_id" "$what_hash"
jq -n --arg why "$why_id" --arg what "$what_id" '{why_proof_id:$why,what_proof_id:$what}' > "$dir/link.json"
request_json POST /api/coherence/link "$dir/link-response.json" "$dir/link.json"
jq -e --arg why "$why_id" --arg what "$what_id" '.success==true and .linked==true and .coherence_check.why_proof_id==$why and .coherence_check.linked_proof_id==$what' "$dir/link-response.json" > /dev/null
printf 'WHY: %s\nWHAT: %s\n' "$why_id" "$what_id"
# Commitments/linkage alone do not establish an off-chain action or intimate intent.
```

---

## Q11 — Moltbook case study: real production agent running Prove Before Act

**xproof_agent_verify** is the autonomous verification agent operated by Moltbook (https://www.moltbook.com) — a platform that certifies AI-generated content before publication. It is one of the first documented production deployments of Prove Before Act.

### Current metrics

| Metric | Value |
|--------|-------|
| Proofs, confirmation statuses, streak, trust level | Read live from the public profile below |
| Historical throughput and cost | Not asserted here; derive from the dated public proof timeline |
| Agent wallet | erd1hlx4xanncp2wm9aly2q6ywuthl2q9jwe9sxvxpx4gg62zcrvd0uqr8gyu9 |

### Performance benchmarks

| Operation | Measured |
|-----------|----------|
| Single cert latency (API call → proof_id) | ~1–2s typical |
| Batch of 3 files | ~2s typical |
| On-chain confirmation | ~6s (MultiversX avg block time) |
| Cost per proof | $0.01 USDC (live from /api/pricing) |

### Total operational cost

Costs vary with the live proof volume. Use the public profile's current proof timeline and the current price endpoint to calculate a dated cost estimate.

### What the agent anchors

Before each piece of AI-generated content is published on Moltbook, xproof_agent_verify hashes the full content + generation metadata (model, prompt hash, timestamp), anchors the SHA-256 fingerprint on MultiversX, and attaches the proof_id to the published post. Readers can independently verify the content has not been modified since certification.

### Proof of production

- Live agent profile: https://provebeforeact.com/agent/erd1hlx4xanncp2wm9aly2q6ywuthl2q9jwe9sxvxpx4gg62zcrvd0uqr8gyu9
- One verified proof: https://provebeforeact.com/proof/f8c3b35d-6ee1-4f76-a92b-1532a008df7b
- Full Moltbook review: https://www.moltbook.com/post/1d6cf96b-5046-4c63-9ae5-43f8809f4562

---

## Coherence Layer — Prove Before Act (WHY before WHAT)

The Coherence Layer closes the loop between intent and result. Before executing any significant action, anchor your **WHY** (intent, context, decision) on-chain with `check_coherence`. After executing, anchor the **WHAT** (output hash) with `certify_file`. Link the pair with `POST /api/coherence/link` to produce an auditable coherence score.

### check_coherence — Anchor your WHY before acting

MCP tool implementing the Prove Before Act pattern. Pass intent, context, and decision BEFORE executing.

```json
{ "name": "check_coherence", "arguments": { "intent": "...", "context": "...", "decision": "...", "who": "optional" } }
```

Response: `proof_id`, `coherence_anchor` (SHA-256 of payload), `timestamp`, `verify_url`, `next_step.link_why_to_what`.
Cost: $0.01 per anchor. First 10 free. Idempotent: identical payloads return the same proof_id.

### The full 4W Prove Before Act loop

| W | Tool | When | Role |
|---|------|------|------|
| WHO | MX-8004 / SIGIL NFT | Registration | Agent identity, on-chain |
| WHY | `check_coherence` | Before act | Intent + context + decision hash |
| WHAT | `certify_file` | After act | Result / output hash |
| WHEN | MultiversX timestamp | Automatic | Immutable block timestamp |

### POST /api/coherence/link — Close the loop

Auth: Bearer pm_... Both proofs must belong to your account. Idempotent (re-link same pair returns `already_linked: true`).

```bash
curl -X POST https://provebeforeact.com/api/coherence/link \
  -H "Authorization: Bearer pm_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"why_proof_id": "<UUID from check_coherence>", "what_proof_id": "<UUID from certify_file>"}'
```

Response score scales: top-level `coherence_score` is a 0–1 ratio; top-level `coherence_score_percent` and legacy `coherence_check.coherence_score` are 0–100. Coherence score: 50 base + 15 if WHAT within 1h of WHY + 20 if WHAT `metadata.why_proof_id` references WHY + 15 if WHAT on-chain confirmed.

Unlinked WHY anchor: `pending` for <1h, then `divergent` after 1h; flagged as `fault` violation after 2h TTL — both lower public coherence rate.

### require_coherence_anchor — Coherence Artisan policy gate

Optional MCP policy helper for orchestrators. Before delegating a sub-action, check that its unexpired WHY certification belongs to your account and that its exact hash and transaction payload are independently confirmed by the MultiversX API and Gateway. A recent coherence row or stored confirmed status alone is insufficient. **Read-only and free — no credit consumed.**

Pass `intent_hash` (from check_coherence response) or all three of `intent` + `context` + `decision`.
- `allowed: true` → unexpired, account-owned anchor with corroborated finality and expected payload; returns `anchor_id`, `expires_at`, `verify_url`
- `allowed: false` → explicit reason: `NO_ANCHOR`, `ANCHOR_EXPIRED`, `ANCHOR_INVALID`, `ANCHOR_PROOF_MISSING`, `ANCHOR_PROOF_MISMATCH`, `ANCHOR_TRANSACTION_MISSING`, `ANCHOR_TRANSACTION_INVALID`, `ANCHOR_PENDING`, `ANCHOR_FAILED`, `ANCHOR_FINALITY_UNAVAILABLE`, `ANCHOR_CHANGED`, or `ANCHOR_CHECK_UNAVAILABLE`. Only absence/expiration recommends `required_action: "check_coherence"`; retry the same check for pending or unavailable evidence, not a new paid proof.

Operator policy: call `require_coherence_anchor` → pause on any error or any result other than `allowed === true` → address its reason and re-check → only then may the operator delegate → `certify_file` → `POST /api/coherence/link`. PBA does not enforce this automatically. These are provider observations, not local consensus/BLS verification. Reusing a hash does not create a new pre-action commitment for each invocation.

### Coherence history and fleet view

```bash
# Per-agent history (public, paginated)
GET https://provebeforeact.com/api/agents/{wallet}/coherence?limit=50&offset=0
# → checks[], total, aggregate.coherence_rate, aggregate.avg_coherence_score
# Per-check status: linked | pending (<1h unlinked) | divergent (≥1h unlinked)

# Fleet coherence
GET https://provebeforeact.com/api/fleet/coherence?org=<wallet_prefix>
GET https://provebeforeact.com/api/fleet/coherence?fleet=<slug>
# → per-agent stats + fleet_score = round(0.7 × coherence_rate + 0.3 × avg_coherence_score)
```

Full documentation: https://provebeforeact.com/coherence

---

## Resources

- Human-readable page: https://provebeforeact.com/agent-context
- Full spec: https://provebeforeact.com/.well-known/provebeforeact.md
- API docs: https://provebeforeact.com/llms.txt
- MCP endpoint: https://provebeforeact.com/mcp
- Agent leaderboard: https://provebeforeact.com/leaderboard
- Coherence Layer: https://provebeforeact.com/coherence
- Moltbook live agent profile: https://provebeforeact.com/agent/erd1hlx4xanncp2wm9aly2q6ywuthl2q9jwe9sxvxpx4gg62zcrvd0uqr8gyu9
- Trust leaderboard API: GET https://provebeforeact.com/api/leaderboard
- x402 Bazaar (Coinbase): https://api.cdp.coinbase.com/platform/v2/x402/discovery/mcp
