Markdown agreement format
Canonical markdown agreement format for auto contracts with bounded subjective resolution.
Canonical markdown agreement format for auto contracts with bounded subjective resolution.
This standard defines a canonical markdown document format for auto contract agreements. An agreement is a human-readable markdown document with structured YAML frontmatter whose hash is anchored onchain through an IAutoContract implementation. The format is generic: it works for escrow, governance, bounties, disputes, insurance, and any other contract type that requires bounded subjective resolution.
Smart contracts excel at objective, deterministic settlement but break down when an outcome depends on a bounded judgment: did the deliverable meet the spec, was the governance proposal enacted faithfully, does the insurance claim qualify?
Encoding full agreement semantics in Solidity is impractical. Natural language is necessary for expressing terms, but natural language is not hashable or machine-routable without structure. This standard resolves the tension:
A conforming agreement is a UTF-8 markdown document with two parts:
---Every agreement begins with YAML frontmatter containing these fields:
standard: auto.contracts/v1 version: 1 chain_id: 421614217 contract_type: escrow parties:
```
standard -- Required. Must equal auto.contracts/v1, identifying this document as conforming to this standard.version -- Required. Must equal 1. Reserved for future revisions.chain_id -- Required. The chain ID of the IAutoContract settlement contract, as a positive integer.contract_type -- Required. A lowercase identifier for the agreement's domain — a single word or hyphenated phrase. This standard doesn't restrict values; common types include escrow, governance, bounty, dispute, insurance, and milestone.parties -- Required. An ordered array of party objects, each containing:
address -- A valid account address on the target chain, as a hex string.role -- A lowercase label for the party's role (e.g., buyer, seller, proposer, voter, claimant, insurer). Roles are defined by the contract_type, not restricted by this standard.resolver -- Required. The address authorized to call resolve on the settlement contract.resolver_policy -- Required. A human-readable label for the resolver's governance model — e.g., centralized_single_resolver, multisig_3_of_5, dao_vote, oracle. For human interpretation only; it doesn't constrain onchain behavior.deadline -- Required. An ISO 8601 timestamp, with a timezone designator, after which the agreement may expire under implementation-specific rules.Agreements may include extra frontmatter for domain-specific data. Common optional fields:
visibility -- Access control for the document — public or private, defaulting to public.
public -- The document at contractURI is accessible to anyone.private -- The document at contractURI is accessible only to the parties and the resolver. The termsHash remains public onchain and can verify the document for anyone who obtains it through other means.currency -- Human-readable asset label (e.g., USDC, ETH).amount -- Settlement amount as a decimal string.quorum -- Required participation threshold for multi-party resolution.appeals -- Number of allowed appeal rounds.Consumers ignore unknown frontmatter fields.
The markdown body contains these sections, in order:
# AgreementStarts with a level-1 heading. The heading should describe the agreement — # Agreement, # Governance Proposal #42, # Bug Bounty: Authentication Bypass.
## TermsFree-form markdown describing what the agreement covers — the obligations, deliverables, conditions, proposals, or claims at stake. It should be specific enough that a resolver can evaluate compliance without external context the document doesn't reference.
## Review QuestionDefines exactly one bounded question the resolver answers, phrased so that each possible answer maps to exactly one outcome in ## Resolution Effects.
A good question is:
## Allowed Evidence.## Terms.## Allowed EvidenceLists the evidence classes the resolver may inspect when answering the review question. Each class should be a short identifier or description.
Recommended evidence class identifiers:
github_prdeployed_urlfigma_linkscreenshotwritten_notesonchain_dataattestationapi_responseImplementations may define additional evidence classes. The resolver must not consider evidence outside the classes listed here.
## Resolution EffectsMaps each possible answer to the review question onto a named outcome. Outcomes are expressed as:
``` answer => outcome ```
Each outcome is a lowercase label that corresponds to a bytes32 value onchain (computed as keccak256(bytes(outcome))). The settlement contract uses this value to execute the appropriate state transition.
There must be at least two outcomes. Common labels:
release, refund (escrow)approve, reject (governance)valid, invalid (bounty, dispute)covered, denied (insurance)The canonical agreement hash (termsHash) passed to IAutoContract.create(..., termsHash) is computed as:
``` termsHash = keccak256(document_bytes) ```
Where document_bytes is the complete UTF-8 encoded markdown document, including the YAML frontmatter delimiters.
Three normalization rules apply:
\n (LF) before hashing.This standard doesn't mandate a transport or publication layer — only that:
termsHash is the value passed to the settlement contract.An IAutoContract settlement instance created from a conforming agreement satisfies:
parties is the creator (the msg.sender of create).parties is the counterparty argument to create.resolver equals the resolver frontmatter field.termsHash equals the canonical agreement hash.When the resolver calls IAutoContract.resolve(contractId, outcome, resolutionHash):
outcome equals keccak256(bytes(label)), where label is the outcome string from ## Resolution Effects (e.g., keccak256(bytes("release"))).resolutionHash is the hash of a resolution document conforming to the resolution standard paired with this agreement's contract_type.For agreements with more than two parties, the mapping to IAutoContract.create is defined by the contract-type-specific extension standard. This base standard defines only the two-party case.
Contract-type-specific standards (e.g., auto.contracts/escrow/v1, auto.contracts/governance/v1) MAY:
contract_type, parties[].role, and outcome labels.Extensions cannot remove or redefine any field or section this standard requires. A document conforming to an extension also conforms to this base standard.
Hash determinism. Identical document bytes always produce an identical termsHash; any difference in bytes produces a different one.
Frontmatter completeness. A conforming agreement carries every required frontmatter field. A document missing any required field is non-conforming, and consumers reject it.
Section completeness. A conforming agreement carries every required markdown section. Additional sections may appear between or after them, but the required ones are always present.
Outcome coverage. Every possible answer to the review question maps to exactly one outcome in ## Resolution Effects — no answer is left unmapped.
Outcome computability. Every outcome label in ## Resolution Effects converts deterministically to bytes32 via keccak256(bytes(label)), and the settlement contract uses that value and no other.
Party-address binding. The addresses in parties match the addresses used in the onchain create call. Any mismatch makes the agreement non-conforming.
Resolver exclusivity. Only the address in the resolver field can call resolve for this agreement, enforced by the settlement contract.
Evidence boundary. The resolver considers only the evidence classes listed in ## Allowed Evidence. A resolution that relies on excluded evidence is non-conforming.
Immutability after hashing. Once the termsHash is onchain, the document bytes never change. Any amendment is a new agreement with a new hash.
Forward compatibility. Consumers ignore unknown frontmatter fields and markdown sections, so extension standards don't break base-standard consumers.
The following is a conforming agreement for a bug bounty:
standard: auto.contracts/v1 version: 1 chain_id: 421614217 contract_type: bounty parties:
Bug bounty for critical authentication bypass in api.example.com.
The sponsor offers a bounty of 10,000 USDC for a verified report demonstrating a critical authentication bypass in the production API at api.example.com.
A qualifying report MUST include:
The hunter MUST submit the report before the deadline. The sponsor MUST NOT patch the reported vulnerability before the resolver renders a decision.
Does the submitted report demonstrate a critical authentication bypass in api.example.com that is reproducible and includes a proposed remediation?
This document is placed in the public domain.