Specification

Covenant v1

Version: 1.0.0 — Status: Release

1. Purpose

covenant.yml is a deterministic governance contract for repositories. It defines what human contributors, software agents, and manager actors may do across repository interaction surfaces.

The policy is machine-readable and schema-validated. No enforcement decision depends on natural language interpretation.

Read this page as an implementation guide: sections 2-5 define the contract and evaluation pipeline, sections 6-11 define behavior and interfaces, and sections 12-14 define compliance and shared terminology.

2. Canonical Location

The policy file must be placed at the repository root:

/covenant.yml

No alias locations are part of Covenant v1.

3. Decision Model

Covenant uses three outcomes:

Strictness ordering: deny > warn > allow

In practice, this means any failing requirement can only keep or increase strictness. A decision never becomes less strict later in evaluation.

4. Top-Level Contract

Think of top-level keys as contract modules: each one controls a different stage of evaluation, verification, or enforcement.

KeyPurpose
spec_versionPins behavior to a known spec contract.
defaultsFallback decision behavior when no rule matches.
actorsIdentity mapping for human, agent, and manager actor profiles.
surfacesOptional surface-level configuration and constraints.
rulesPrimary policy logic (actor + action + constraints -> outcome).
requirementsEvidence and provenance requirements applied after rule selection.
attestationCryptographic verification controls and failure handling.
enforcementAction plan templates for allow/warn/deny decisions.
routingBranch reroute behavior for selected denied operations.
policiesPre-rule global gates (for example eligible-label checks).
metadataInformational fields that do not change the decision model.

Unknown top-level keys are invalid.

4.1 Policies

The policies section defines cross-cutting constraints that are evaluated before rule matching.

agent_eligible_labels restricts agents to issues carrying at least one eligible label.

policies:
  agent_eligible_labels:
    labels: [agent-friendly, good-first-bot-issue]
    actions: [issue.solve, issue.comment]
    on_missing: deny

This gate only affects agents. Humans and managers are not subject to it.

5. Deterministic Resolution Algorithm

Input event envelope:

{
  "action": "pull_request.open",
  "actor": { "id": "ci-agent[bot]", "kind": "agent" },
  "repository": { "name": "acme/project", "visibility": "public" },
  "target": { "branch": "main", "thread_mode": "mixed", "labels": ["ai"] },
  "evidence": {
    "model": "gpt-5",
    "provider": "openai",
    "prompt_record": "prompt://123",
    "test_proof": "tests://ci/123"
  },
  "attestation": {}
}
Envelope FieldHow to interpret it
actionCanonical operation being evaluated (for example pull_request.open).
actorWho initiated the event; used for actor-kind resolution and profile matching.
repositoryRepository context used by rules or conditions (name, visibility, and related metadata).
targetAction target context such as branch, labels, and thread mode.
evidenceProvenance fields evaluated by requirement profiles.
attestationSigned proof block, required only where policy demands it.

Resolution steps:

  1. Normalize incoming platform event into canonical action and envelope.
  2. Apply policies gates (for example agent_eligible_labels) before rule matching.
  3. Match candidate rules by actor, action, target, and conditions.
  4. Compute specificity tuple: actor specificity, action specificity, target specificity, condition count.
  5. Select highest tuple.
  6. If tie: apply strictness tie-break (deny > warn > allow).
  7. If no rule matches: use defaults.unmatched.
  8. Apply requirements checks.
  9. Apply attestation checks when required.
  10. Compute final decision as the maximum strictness of rule outcome and requirement/attestation failures.
  11. Compute reason codes and emit enforcement action plan.

Think of the algorithm as a fixed pipeline: normalize -> gate -> match -> escalate -> enforce. Because the order is fixed, identical inputs always produce identical outputs.

6. Interaction Matrix

The matrix below maps each canonical action to expected decision ranges per actor kind. Hover selected headers and action names for field-level guidance.

This is a capability map, not a direct allow-list. The final decision for a given event still depends on your concrete rules, policies gates, and requirement failures.

Interaction Human Agent Manager Typical Controls
issue.openallow/warn/denyallow/warn/denyallowtemplates, labels, attestation
issue.commentallow/warn/denyallow/warn/denyallowthread mode control
issue.labelallow/warn/denyallow/warn/denyallowauto-label policy
issue.solveallow/warn/denyallow/warn/denyallowevidence policy
pull_request.openallow/warn/denyallow/warn/denyallowprovenance and tests
pull_request.updateallow/warn/denyallow/warn/denyallowre-attestation
pull_request.review.submitallow/warn/denyallow/warn/denyallowreviewer policy
pull_request.review.approveallow/warn/denyallow/warn/denyallowhuman-only gates
pull_request.mergeallow/warn/denyallow/warn/denyallowbranch and ruleset checks
conversation.intervene_human_threadallow/warn/denyallow/warn/denyallowhuman thread protection
conversation.intervene_agent_threadallow/warn/denyallow/warn/denyallowagent thread policy
maintenance.cleanupallow/warn/denyallow/warn/denyallowclose PR, delete branch
routing.to_develop_botallow/warn/denyallow/warn/denyallowreroute to develop-bot branch

Thread modes are explicit: human, agent, mixed.

7. Attestation Contract

Attestation version: covenant.attestation.v1

The signed payload binds identity, action, repository context, policy revision, and freshness controls into one verifiable artifact.

FieldExpected meaning
versionContract version of the attestation payload.
actor_idExact actor identity that created the action.
actionCanonical action being attested.
repositoryRepository identifier this attestation applies to.
refGit reference tied to the action context.
policy_sha256Hash binding the signature to a specific policy revision.
timestampCreation time used for freshness checks.
nonceSingle-use token used for replay protection.

Verification key registry: actors.agents[].verification

Minimum controls:

A valid signature is necessary but not sufficient: freshness, nonce reuse, and policy-hash checks must all pass.

8. Enforcement Operations

Enforcement operations are deterministic side effects. They explain, route, or block actions based on the final decision.

OperationTypical use
commentCommunicate why a decision was produced.
labelMark issues/PRs for workflow routing or review queues.
close_pull_requestStop disallowed changes from remaining open.
delete_branchClean up denied or obsolete contribution branches.
reroute_to_branchRetarget blocked PRs to a staging branch.
fail_statusSurface policy failures in CI checks.

Actions are planned deterministically from enforcement.<decision> and optional routing rules.

9. Canonical Actions

Canonical actions are normalized event names used by rules. Platform-specific event payloads should map to one of these before evaluation.

ActionWhen it is used
issue.openCreate a new issue.
issue.commentAdd a comment to an issue.
issue.labelAdd or change issue labels.
issue.solveClose or resolve an issue.
pull_request.openCreate a new pull request.
pull_request.updatePush updates to an existing pull request.
pull_request.review.submitSubmit a review on a pull request.
pull_request.review.approveSet review state to approved.
pull_request.mergeMerge an approved pull request.
conversation.intervene_human_threadComment in a thread labeled as human-focused.
conversation.intervene_agent_threadComment in a thread labeled as agent-focused.
maintenance.cleanupPerform maintenance actions like close/relabel/delete branch.
routing.to_develop_botRetarget denied pull requests to a configured staging branch.

Wildcards supported in rules: * and <surface>.* (e.g., pull_request.*)

Use exact actions when you need strict control, and surface wildcards when you want broader but still explicit policy coverage.

10. Resolution Flow

Incoming platform event
  -> Normalize to canonical action
  -> Apply policies gates
  -> Match candidate rules
  -> Compute specificity tuple
  -> Select rule or defaults.unmatched
  -> Apply provenance requirements
  -> Apply attestation checks
  -> Finalize decision and reason codes
  -> Plan enforcement operations
  -> Emit CI outputs and badges

This condensed flow mirrors the algorithm in section 5 and is useful as a debugging checklist when a decision looks unexpected.

11. Public Interfaces

These interfaces are the stable integration points for local tooling, CI workflows, and policy-aware automation.

CLI

covenant validate [policy-path]
covenant eval --event <json|path> [--policy <path>]
covenant badge --format json|shields [--policy <path>]

GitHub Action

Inputs: policy-path, event-json, mode

Outputs: decision, reason_codes, enforcement_actions

Schema

schema/covenant.schema.json

Integrators should treat CLI output and action outputs as machine contracts, and use the schema for validation before policy evaluation.

12. Conformance

A Covenant v1 implementation is conformant if:

Conformance is about behavior, not language. If two engines disagree on a decision for the same input, at least one is non-conformant.

13. Reason Codes

Conformant engines emit machine-readable reason codes with each decision.

Treat reason codes as your debugging API: they explain exactly which gate, rule, or verification check influenced the final outcome.

Rule Selection

CodeMeaning
rule.selected.<id>Rule with the given ID was selected as the best match.
defaults.unmatchedNo rule matched; defaults.unmatched was applied.

Policies Gate

CodeMeaning
policies.agent_eligible_labels.missingAgent issue action had no eligible label.

Provenance / Evidence

CodeMeaning
requirements.provenance_profile_missingReferenced provenance profile is not defined.
requirements.provenance.missing.<field>Required evidence field is absent or empty.

Attestation

CodeMeaning
attestation.missingNo attestation block was provided.
attestation.invalid_versionAttestation version is not covenant.attestation.v1.
attestation.actor_mismatchattestation.actor_id does not match event.actor.id.
attestation.action_mismatchattestation.action does not match event.action.
attestation.policy_hash_mismatchattestation.policy_sha256 does not match evaluated policy.
attestation.invalid_timestampattestation.timestamp is not parseable.
attestation.expiredAttestation is older than attestation.max_age_seconds.
attestation.invalid_nonceattestation.nonce is missing or invalid.
attestation.replayed_nonceNonce was already seen within nonce_ttl_seconds.
attestation.verification_key_missingNo verification key is registered for the actor profile.
attestation.unsupported_verification_typeVerification type is not supported.
attestation.invalid_signature_encodingPublic key or signature is not valid base64.
attestation.invalid_signatureSignature verification failed.
attestation.signature_verification_errorInternal error occurred during signature verification.

14. Glossary

Use this glossary as the canonical meaning of terms used across policy files, CLI output, and documentation.

TermDefinition
actorEntity performing an action: human, agent, or manager.
agentSoftware system acting autonomously on a repository.
actionCanonical interaction event, e.g. pull_request.open.
attestationSigned payload asserting context for an agent action.
decisionPolicy evaluation outcome: allow, warn, or deny.
evidenceProvenance fields in event.evidence (model, provider, prompt_record, test_proof).
managerTrusted actor kind declared in policy for governance automation.
outcomeRule-declared value (allow, warn, deny) before requirement escalation.
policyFull contents of a covenant.yml file.
profileNamed actor entry under actors.agents[], actors.humans[], or actors.managers[].
provenanceOrigin/context metadata for an agent action.
rulePolicy entry mapping actor + action (+ optional target/conditions) to an outcome.
surfaceNamespace grouping related actions, such as issue or pull_request.
thread modeConversation type: human, agent, or mixed.