dispatch_contract
Registers and dispatches code review or implementation contracts to a target local AI agent over a shared SQLite mesh, with SHA-256 file snapshots for 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.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"target_agent": "<target_agent>",
"task_type": "<task_type>",
"title": "<title>",
"context_summary": "<context_summary>",
"workspace_root": "<workspace_root>",
"pointers": "<pointers>"
},
"name": "dispatch_contract"
}
}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. | |
| git_patch | No | Optional unified git diff patch payload (max 512KB, FC-202) enabling self-contained cross-branch or disjoint workspace reviews without requiring identical on-disk working tree state. | |
| 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"). |