dispatch_contract
Dispatches code review, audit, implementation, or test contracts to another local AI agent, creating SHA-256 file snapshots and a baseline for cross-host verification.
Instructions
Dispatch a task or code review contract to another local AI agent host via the shared SQLite WAL mesh.
Purpose
Registers a new contract in SUBMITTED status with full-file SHA-256 fingerprint snapshots of all target files, establishing an immutable baseline for cross-host verification.
Usage Guidelines
When to use: Use when requesting code reviews, architecture audits, implementation, or test generation from a target agent (e.g., target_agent="workbuddy" or "antigravity").
When NOT to use:
Do NOT use to claim or execute tasks (use poll_next_task).
Do NOT use to check task status or inspect outputs (use inspect_mesh_state).
Do NOT use if the target host does not share the same local filesystem access to workspace_root.
Prerequisites: workspace_root must be a valid directory accessible by both hosts. Pointer files must exist on disk and be saved. Sensitive files (.env, keys, credentials, .git/config) and path escapes are strictly blocked.
Behavior & Side Effects
Mutates database: Synchronously inserts a single row into contracts with status='SUBMITTED' in SQLite WAL (~/.ferrycat/mesh.db).
SHA-256 Snapshot: Computes 64-char hex SHA-256, byte size, and first/last lines for each pointer. Emits a warning if any file was modified within the last 3 seconds (indicating unsaved IDE buffers).
Lifecycle & Expiry: Starts the queue_ttl_sec countdown (default: 1800s / 30m). If the target agent never claims it before queue_ttl_sec elapses, the contract lazily transitions to TIMED_OUT.
Once claimed, execution is governed by exec_ttl_sec (tiered default: 1800s for review/audit, 300s for implementation/test).
Return Value
Returns { contract_id: string, status: 'SUBMITTED', created_at: number, files: Array<{ path, size, mtime_ms, sha256, first_line, last_line, line_range? }>, warning?: string }. Note: requester_agent / target_agent / task_type / title / TTLs are NOT echoed back — read them via inspect_mesh_state if needed.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | Concise contract title (1-120 chars) summarizing the goal of the request. | |
| pointers | Yes | Array of 1 to 50 target file pointers hashed with full-file SHA-256 and snapshot boundaries for tamper detection. | |
| task_type | Yes | Type of contract task. Tiered default execution TTL: 1800s for code_review/architecture_audit, 300s for implementation/test_generation. | |
| exec_ttl_sec | No | Execution TTL in seconds once CLAIMED (default: 1800s for review/audit, 300s for implementation/test). Worker must fulfill, extend, release, or fail within this window. | |
| target_agent | Yes | Target worker agent identifier expected to claim and execute this contract (e.g., "workbuddy", "antigravity"). | |
| queue_ttl_sec | No | Queue expiration TTL in seconds while status is SUBMITTED (default: 1800s / 30m). Transitions to TIMED_OUT if unclaimed before expiry. | |
| workspace_root | Yes | Absolute canonical path to the shared local workspace directory accessible by both hosts (e.g. "F:/git/FerryCat"). Path escapes and sensitive files are blocked. | |
| context_summary | Yes | Detailed task instructions, audit focus areas, architectural constraints, and background context for the worker agent (1-20000 chars). | |
| contract_schema | No | Optional Draft-07 JSON Schema that structured_output must validate against. Bounded to 1MB and max 32 depth (FC-302). | |
| requester_agent | No | Requester agent identifier. Defaults to AGENT_NAME env var (e.g., "antigravity", "workbuddy"). |