Skip to main content
Glama

Dispatch Contract

dispatch_contract

Send code-review, audit, implementation, or test contracts to another local AI agent over shared SQLite, with file fingerprints and overlap warnings.

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 and emitting active pointer overlap warnings.

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").

  • Mutation Write Modes (ADR-0006 / ADR-0007):

    • write_mode="direct" (default for implementation / test_generation): Worker edits pointer files directly on disk and commits post-mutation SHA-256 hashes at fulfill time.

    • write_mode="proposal": Worker is forbidden from editing disk files and must deliver a unified git diff in proposed_patch; requester reviews and atomically applies it via apply_contract_patch. Recommended when concurrent agents share workspace_root.

  • 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 pass write_mode on read-only tasks (code_review / architecture_audit).

Behavior & Side Effects

  • Mutates local SQLite database (~/.ferrycat/mesh.db) only; makes zero network requests.

  • Active Pointer Overlap Detection (ADR-0007): Checks non-expired SUBMITTED / CLAIMED contracts in the same workspace_root and populates overlapping_contracts + warning if pointer files intersect.

Return Value

Returns { contract_id, status: 'SUBMITTED', created_at, write_mode?, files, patch_sha256?, patch_bytes?, overlapping_contracts?, warning? }.

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

NameRequiredDescriptionDefault
titleYesConcise contract title (1-120 chars) summarizing the goal of the request.
pointersYesArray of 1 to 50 target file pointers hashed with full-file SHA-256 and snapshot boundaries for tamper detection.
git_patchNoOptional 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_typeYesType of contract task. Tiered default execution TTL: 1800s for code_review/architecture_audit, 300s for implementation/test_generation.
write_modeNoMutation delivery mode for "implementation" | "test_generation" contracts (ADR-0007). Defaults to "direct" (worker edits pointer files in place per ADR-0006). Set "proposal" to forbid worker disk edits and require delivering a unified diff via proposed_patch for requester-controlled atomic apply.
exec_ttl_secNoExecution 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_agentYesTarget worker agent identifier expected to claim and execute this contract (e.g., "workbuddy", "antigravity").
queue_ttl_secNoQueue expiration TTL in seconds while status is SUBMITTED (default: 1800s / 30m). Transitions to TIMED_OUT if unclaimed before expiry.
workspace_rootYesAbsolute 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_summaryYesDetailed task instructions, audit focus areas, architectural constraints, and background context for the worker agent (1-20000 chars).
contract_schemaNoOptional Draft-07 JSON Schema that structured_output must validate against. Bounded to 1MB and max 32 depth (FC-302).
requester_agentNoRequester agent identifier. Defaults to AGENT_NAME env var (e.g., "antigravity", "workbuddy").

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.6.0
    • addedInput schema / properties / write_mode
      Added value: +{
      +  "description": "Mutation delivery mode for \"implementation\" | \"test_generation\" contracts (ADR-0007). Defaults to \"direct\" (worker edits pointer files in place per ADR-0006). Set \"proposal\" to forbid worker disk edits and require delivering a unified diff via proposed_patch for requester-controlled atomic apply.",
      +  "enum": [
      +    "direct",
      +    "proposal"
      +  ],
      +  "type": "string"
      +}
  2. Changed1 schema field changedv0.5.0
    • addedInput schema / properties / git_patch
      Added value: +{
      +  "description": "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.",
      +  "minLength": 1,
      +  "type": "string"
      +}
  3. Changed1 schema field changedv0.3.2
    • changedInput schema / properties / contract_schema / description
      Previous value: -"Optional Draft-07 JSON Schema that structured_output must validate against. Enforces bounded retry (max 2 RETRY_NEEDED attempts before terminal VALIDATION_FAILED)."New value: +"Optional Draft-07 JSON Schema that structured_output must validate against. Bounded to 1MB and max 32 depth (FC-302)."
  4. Changed12 schema fields changedv0.3.0
    • changedInput schema / properties / context_summary / description
      Previous value: -"Task instructions, audit focus, and background context"New value: +"Detailed task instructions, audit focus areas, architectural constraints, and background context for the worker agent (1-20000 chars)."
    • changedInput schema / properties / contract_schema / description
      Previous value: -"Optional JSON Schema that the worker structured_output must satisfy"New value: +"Optional Draft-07 JSON Schema that structured_output must validate against. Enforces bounded retry (max 2 RETRY_NEEDED attempts before terminal VALIDATION_FAILED)."
    • changedInput schema / properties / exec_ttl_sec / description
      Previous value: -"Execution expiration TTL in seconds for CLAIMED state (default: 300)"New value: +"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."
    • changedInput schema / properties / pointers / description
      Previous value: -"File pointers to be hashed and verified on the worker side (max 50 files)"New value: +"Array of 1 to 50 target file pointers hashed with full-file SHA-256 and snapshot boundaries for tamper detection."
    • changedInput schema / properties / pointers / items / properties / line_range / description
      Previous value: -"Optional [startLine, endLine] 1-based inclusive range"New value: +"Optional [startLine, endLine] 1-based inclusive line range focus for the task."
    • changedInput schema / properties / pointers / items / properties / path / description
      Previous value: -"File path relative to workspace_root"New value: +"File path relative to workspace_root. Must exist on disk. Sensitive files (.env*, *.pem, *.key, id_rsa*, *credentials*, *secret*, .npmrc, .git/config) and path escapes are strictly rejected."
    • changedInput schema / properties / queue_ttl_sec / description
      Previous value: -"Queue expiration TTL in seconds for SUBMITTED state (default: 1800)"New value: +"Queue expiration TTL in seconds while status is SUBMITTED (default: 1800s / 30m). Transitions to TIMED_OUT if unclaimed before expiry."
    • changedInput schema / properties / requester_agent / description
      Previous value: -"Requester agent identifier (defaults to AGENT_NAME env var, e.g., \"antigravity\")"New value: +"Requester agent identifier. Defaults to AGENT_NAME env var (e.g., \"antigravity\", \"workbuddy\")."
    • changedInput schema / properties / target_agent / description
      Previous value: -"Target worker agent identifier (e.g., \"workbuddy\", \"antigravity\")"New value: +"Target worker agent identifier expected to claim and execute this contract (e.g., \"workbuddy\", \"antigravity\")."
    • changedInput schema / properties / task_type / description
      Previous value: -"Type of contract task"New value: +"Type of contract task. Tiered default execution TTL: 1800s for code_review/architecture_audit, 300s for implementation/test_generation."
    • changedInput schema / properties / title / description
      Previous value: -"Concise contract title"New value: +"Concise contract title (1-120 chars) summarizing the goal of the request."
    • changedInput schema / properties / workspace_root / description
      Previous value: -"Absolute path to the shared local workspace root directory"New value: +"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."
  5. First observedv0.1.0

TDQS

A4.9/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The annotations already establish that this is a non-read-only, non-open-world, non-idempotent, non-destructive operation. The description adds important context beyond annotations: it mutates only the local SQLite database, makes zero network requests, performs active pointer overlap detection across non-expired SUBMITTED/CLAIMED contracts in the same workspace_root, and returns overlap warnings.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is structured with clear Purpose, Usage Guidelines, Behavior & Side Effects, and Return Value sections, making it easy to scan. Despite being long for a complex 12-parameter tool, each section earns its place by adding usage guidance, side-effect disclosure, or return-value context that is not already covered by an output schema.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given a 12-parameter mutation tool with no output schema, the description is complete: it covers purpose, usage and exclusions, write-mode semantics, side effects, overlap detection, and return fields. An agent has enough information to decide whether to call this tool and what behavior to expect.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the schema already documents all 12 parameters in detail. The description still adds decision-level semantics beyond the schema by explaining write_mode behavior for direct versus proposal delivery, when not to pass write_mode on read-only tasks, and the practical rationale for proposal mode when concurrent agents share a workspace.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb and resource: dispatch a contract to another local AI agent host. It further states that it registers a new contract in SUBMITTED status with SHA-256 snapshots, which clearly distinguishes it from poll_next_task, inspect_mesh_state, and apply_contract_patch.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It provides explicit when-to-use guidance for code reviews, audits, implementation, and test generation. It also names when-not-to-use cases and routes the agent to the right siblings, including poll_next_task for claiming/executing and inspect_mesh_state for status/output inspection, and clarifies write_mode selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.