Skip to content

Harness Contract

Every production harness declares a BlockContract. The contract is the runtime-facing promise that connects implementation, verification, state, and extension behavior.

The Phase 02a contract requires these fields:

  • known_failure_modes: ways the harness itself can fail.
  • mitigates_failure_modes: registered LLM failure-mode codes the harness is meant to reduce.
  • state_surface: whether the harness persists state, how it can be queried, and how long it is retained.
  • extension_points: the validation gate and mutation surfaces available to T3-added MCP tools, or None for harnesses that opt out.
  • verification_method: the named verifier dispatched by AIBlock.verify().

Example:

@block_contract(
    purpose="Checks a generated answer before it is marked complete.",
    outputs=("decision", "evidence"),
    mitigates_failure_modes=("hallucinated_success",),
    state_surface=StateSurface(persistence="run", queryable_via="ledger", retention="30d"),
    extension_points=ExtensionPoints(
        training_signal_inputs=("contract_warning",),
        validation_gate="unit_tests_only",
        allowed_mutation_surfaces=("mcp:tools",),
    ),
    verification_method="unit_tests_only",
)
class ExampleHarness(AIBlock[dict, dict, None]):
    ...

G6_CONTRACT_ENFORCE controls migration behavior:

  • off: skip runtime contract validation.
  • warn: log contract_warning events without blocking import.
  • raise: convert contract violations into G6_E_CONTRACT_* errors.

Production harnesses listed in policies/production_harnesses.yaml must avoid placeholder values. Non-production harnesses may use mitigates_failure_modes = ("TBD",), StateSurface(persistence="none", queryable_via="none", retention="run"), and extension_points=None until promoted.