verify_contract
Performs a read-only pre-flight check that audits on-disk pointer files against the baseline SHA-256 snapshot, confirming contract files are clean before fulfillment to prevent TOCTOU strikes.
Instructions
Read-only pre-flight consistency check (ADR-0004): audits on-disk pointer files against the baseline SHA-256 snapshot.
Purpose
Enables agents or automated scripts to verify that on-disk files match the contract's dispatched baseline before calling fulfill_contract, preventing accidental TOCTOU strikes.
Usage Guidelines
When to use: Call before fulfill_contract while holding a CLAIMED contract to confirm file cleanliness, or when investigating why a fulfill call was blocked.
When NOT to use:
Do NOT use to deliver results (use fulfill_contract).
Do NOT use to renew time (use extend_ttl).
ADR-0004 Rule: Pointers are an immutable review baseline. If verify_contract reports dirty files, restore or stash them (e.g., git stash or git checkout -- ) and deliver proposed changes inside structured_output.fixes.
Behavior & Side Effects
Zero side effects: Pure read-only operation. Never updates the database, never alters contract status, and never consumes a TOCTOU strike.
Complete pointer check: Verifies all pointer files on disk and returns every drifted file (reason: SIZE_MISMATCH, CONTENT_CHANGED, or FILE_MISSING).
Return Value
Returns { ok: true, valid: boolean, fulfillable: boolean, contract_id: string, status: ContractStatus, target_agent: string, toctou_strike: number, max_toctou_strikes: number, dirty_files: Array<{ path, reason, detail }>, message: string }. NOTE: valid only means every pointer still matches its dispatched baseline. fulfillable additionally requires the contract to be CLAIMED. A contract that already went terminal (FAILED / POINTER_STALE / COMPLETED) can report valid=true while fulfillable=false, so branch on fulfillable rather than valid before calling fulfill_contract.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agent_id | No | Optional caller agent identifier for audit logging. Does not restrict read-only verification. | |
| claim_token | No | Optional lease token for caller verification (FC-301). | |
| contract_id | Yes | The contract ID whose on-disk pointer files should be verified against the baseline SHA-256 snapshot without mutating contract state. |