Skip to main content
Glama

Delimit Agent Impl

_delimit_agent_impl

Manage agent-task lifecycle: dispatch records intent, status tracks progress, handoff transfers to another model, and complete closes the task.

Instructions

Manage the agent-task lifecycle — dispatches to one of four actions.

When to use: as the single MCP-registered agent surface (delimit_agent) when the caller wants to pick the lifecycle action by name in one call rather than choosing a specific delimit_agent_* alias. The lifecycle is dispatch (record intent) -> status (read) -> handoff (transfer to another model) -> complete (close). When NOT to use: from internal code paths — prefer the specific alias (delimit_agent_dispatch, delimit_agent_status, delimit_agent_complete, delimit_agent_handoff) so the action's docstring and arg schema show up at the right call site. Do NOT use action="dispatch" expecting a subagent to run — it RECORDS the dispatch, it does not execute it (see Side effects). The related delimit_agent_link / _policy / _check / _dashboard tools share the prefix but are SEPARATE tools, not actions here — passing their names as action= returns an "Unknown action" error.

Sibling contrast: delimit_agent_dispatch / _status / _complete / _handoff are thin aliases that call straight into this implementation with a fixed action; they exist so each action's docstring lives at the right name. This is the dispatch core for those four. Versus delimit_ledger_add: the ledger holds free-form work items; this surface carries engineering-dispatch schema (assignee, tools_needed, constraints) and a per-task audit trail.

Side effects: action="status" is READ-ONLY (loads the task store, no writes). action="dispatch" / "complete" / "handoff" WRITE to the agent task store and append to its audit log. CRITICAL: action="dispatch" records intent only — it persists a task plus a formatted agent_prompt and does NOT spawn or run a subagent — UNLESS the launch parameter is given with a launchable assignee ("muse", "codex", "copilot", "auto"), in which case the worker IS started through the contained launcher (scripts/launch_contained_worker*.sh, sandbox on, never a sandbox-disabling flag) and the task records the session binding with status "running". Without launch, per the operating model, actual execution is the caller's responsibility via the Agent tool (subagent_type=engineering); this is the planning + audit surface. Dispatch additionally enforces deterministic guards before writing: a kill switch (refuses if ~/.delimit/pause_dispatch exists), a dead- letter circuit breaker (auto-pauses once too many tasks remain un-acknowledged), a ghost-title reject, and a shipped-LED anti- duplicate gate (refuses + auto-closes a task whose LED is already merged to main). assignee="any" is resolved to a concrete model via the task-type router. Every return is wrapped via _with_next_steps. Errors are deterministic ({"error": ...}): an unknown action short- circuits before any backend call.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleNoTask title (action="dispatch" only). Required — the backend rejects empty titles.
actionNoWhich lifecycle operation to perform. One of "dispatch", "status", "complete", "handoff". Default "status". Any other value returns a deterministic {"error": "Unknown action ..."}.status
launchNoOptional tracked-launch spec (action="dispatch" only), as a dict or JSON object string with workspace (git worktree path, required), prompt_file (required), max_steps (default 220), network ("proxy-only"/"restricted"/"enabled", default "proxy-only"). Coerced via _coerce_dict_arg. Assignees "muse", "codex" and "copilot" launch; "auto" rotates in policy order; other runtimes record "launch_unsupported" and total rotation failure records "exhausted".
resultNoSummary of what was done (action="complete" only).
contextNoBackground to seed the executor (action="dispatch") OR notes for the next model (action="handoff"). Unused by status/complete.
task_idNoTask id, e.g. "AGT-A1B2C3D4". Used by status, complete, handoff. Optional for status (empty lists all active tasks); required and validated for complete/handoff.
assigneeNoTarget model "claude"/"codex"/"gemini"/"any"/"auto" (action="dispatch" only). Default "any", resolved to a concrete model by the router. Invalid values are rejected. Explicit-only "muse"/"copilot" name harnesses; "muse", "codex" and "copilot" support the launch parameter, and "auto" rotates muse → copilot → antigravity → codex in policy order (requires launch; total failure is "exhausted").any
priorityNo"P0"/"P1"/"P2" (action="dispatch" only). Default "P1"; invalid values are rejected.P1
to_modelNoTarget model for the transfer (action="handoff" only). Required; validated against the allowed models.
constraintsNoComma-separated constraints, e.g. "no force push" (action="dispatch" only). Coerced to a list.
descriptionNoLonger task description (action="dispatch" only).
tools_neededNoComma-separated MCP tools the work will need (action="dispatch" only). Coerced to a list.
files_changedNoComma-separated modified file paths (action="complete" only). Coerced to a list.
accept_uncertainNoClose an "uncertain" worker task anyway (action="complete" only). Default False; uncertain outcomes require an explicit True. Ignored for other statuses.
review_diff_pathNo
review_diff_textNo
review_transcriptNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv4.19.11
    • changedInput schema / properties / assignee / description
      Previous value: -"Target model \"claude\"/\"codex\"/\"gemini\"/\"any\"\n(action=\"dispatch\" only). Default \"any\", resolved to a\nconcrete model by the router. Invalid values are rejected.\nExplicit-only \"muse\"/\"copilot\" name harnesses; only \"muse\"\nsupports the launch parameter."New value: +"Target model \"claude\"/\"codex\"/\"gemini\"/\"any\"/\"auto\"\n(action=\"dispatch\" only). Default \"any\", resolved to a\nconcrete model by the router. Invalid values are rejected.\nExplicit-only \"muse\"/\"copilot\" name harnesses; \"muse\",\n\"codex\" and \"copilot\" support the launch parameter, and\n\"auto\" rotates muse → copilot → antigravity → codex in\npolicy order (requires launch; total failure is \"exhausted\")."
    • changedInput schema / properties / launch / description
      Previous value: -"Optional tracked-launch spec (action=\"dispatch\" only),\nas a dict or JSON object string with workspace (git worktree\npath, required), prompt_file (required), max_steps (default\n220), network (\"proxy-only\"/\"restricted\"/\"enabled\", default\n\"proxy-only\"). Coerced via _coerce_dict_arg. Only assignee\n\"muse\" launches; other runtimes record \"launch_unsupported\"."New value: +"Optional tracked-launch spec (action=\"dispatch\" only),\nas a dict or JSON object string with workspace (git worktree\npath, required), prompt_file (required), max_steps (default\n220), network (\"proxy-only\"/\"restricted\"/\"enabled\", default\n\"proxy-only\"). Coerced via _coerce_dict_arg. Assignees \"muse\",\n\"codex\" and \"copilot\" launch; \"auto\" rotates in policy order;\nother runtimes record \"launch_unsupported\" and total rotation\nfailure records \"exhausted\"."
  2. Changed6 schema fields changedv4.19.1
    • addedInput schema / properties / accept_uncertain
      Added value: +{
      +  "default": false,
      +  "description": "Close an \"uncertain\" worker task anyway\n(action=\"complete\" only). Default False; uncertain outcomes\nrequire an explicit True. Ignored for other statuses.",
      +  "type": "boolean"
      +}
    • changedInput schema / properties / assignee / description
      Previous value: -"Target model \"claude\"/\"codex\"/\"gemini\"/\"any\"\n(action=\"dispatch\" only). Default \"any\", resolved to a\nconcrete model by the router. Invalid values are rejected."New value: +"Target model \"claude\"/\"codex\"/\"gemini\"/\"any\"\n(action=\"dispatch\" only). Default \"any\", resolved to a\nconcrete model by the router. Invalid values are rejected.\nExplicit-only \"muse\"/\"copilot\" name harnesses; only \"muse\"\nsupports the launch parameter."
    • addedInput schema / properties / launch
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "additionalProperties": true,
      +      "type": "object"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Optional tracked-launch spec (action=\"dispatch\" only),\nas a dict or JSON object string with workspace (git worktree\npath, required), prompt_file (required), max_steps (default\n220), network (\"proxy-only\"/\"restricted\"/\"enabled\", default\n\"proxy-only\"). Coerced via _coerce_dict_arg. Only assignee\n\"muse\" launches; other runtimes record \"launch_unsupported\"."
      +}
    • addedInput schema / properties / review_diff_path
      Added value: +{
      +  "default": "",
      +  "type": "string"
      +}
    • addedInput schema / properties / review_diff_text
      Added value: +{
      +  "default": "",
      +  "type": "string"
      +}
    • addedInput schema / properties / review_transcript
      Added value: +{
      +  "default": "",
      +  "type": "string"
      +}
  3. Changed12 schema fields changedv4.13.1
    • changedInput schema / properties / action / description
      Previous value: -"Which agent operation to perform."New value: +"Which lifecycle operation to perform. One of \"dispatch\",\n\"status\", \"complete\", \"handoff\". Default \"status\". Any other\nvalue returns a deterministic {\"error\": \"Unknown action ...\"}."
    • changedInput schema / properties / assignee / description
      Previous value: -"Target model claude/codex/gemini/any (for action='dispatch')."New value: +"Target model \"claude\"/\"codex\"/\"gemini\"/\"any\"\n(action=\"dispatch\" only). Default \"any\", resolved to a\nconcrete model by the router. Invalid values are rejected."
    • changedInput schema / properties / constraints / description
      Previous value: -"Comma-separated constraints (for action='dispatch')."New value: +"Comma-separated constraints, e.g. \"no force push\"\n(action=\"dispatch\" only). Coerced to a list."
    • changedInput schema / properties / context / description
      Previous value: -"Background info (for dispatch) or handoff context (for handoff)."New value: +"Background to seed the executor (action=\"dispatch\") OR\nnotes for the next model (action=\"handoff\"). Unused by\nstatus/complete."
    • changedInput schema / properties / description / description
      Previous value: -"Task description (for action='dispatch')."New value: +"Longer task description (action=\"dispatch\" only)."
    • changedInput schema / properties / files_changed / description
      Previous value: -"Comma-separated files modified (for action='complete')."New value: +"Comma-separated modified file paths\n(action=\"complete\" only). Coerced to a list."
    • changedInput schema / properties / priority / description
      Previous value: -"P0/P1/P2 (for action='dispatch')."New value: +"\"P0\"/\"P1\"/\"P2\" (action=\"dispatch\" only). Default \"P1\";\ninvalid values are rejected."
    • changedInput schema / properties / result / description
      Previous value: -"Summary of what was done (for action='complete')."New value: +"Summary of what was done (action=\"complete\" only)."
    • changedInput schema / properties / task_id / description
      Previous value: -"Task ID e.g. AGT-A1B2C3D4 (for status/complete/handoff)."New value: +"Task id, e.g. \"AGT-A1B2C3D4\". Used by status, complete,\nhandoff. Optional for status (empty lists all active tasks);\nrequired and validated for complete/handoff."
    • changedInput schema / properties / title / description
      Previous value: -"Task title (for action='dispatch')."New value: +"Task title (action=\"dispatch\" only). Required — the backend\nrejects empty titles."
    • changedInput schema / properties / to_model / description
      Previous value: -"Target model for handoff (for action='handoff')."New value: +"Target model for the transfer (action=\"handoff\" only).\nRequired; validated against the allowed models."
    • changedInput schema / properties / tools_needed / description
      Previous value: -"Comma-separated tools list (for action='dispatch')."New value: +"Comma-separated MCP tools the work will need\n(action=\"dispatch\" only). Coerced to a list."
  4. Addedv4.5.5

TDQS

A4.8/5.0
Behavior5/5

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

Goes far beyond the annotations: it discloses that status is read-only, that dispatch/complete/handoff write to the task store and audit log, that dispatch only records intent unless launch is given, that a worker is started sandboxed when launched, and that deterministic guards (kill switch, dead-letter breaker, ghost-title reject, shipped-LED anti-duplicate) gate writes. Error behavior and return wrapping are also described. No contradiction with readOnlyHint=false.

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

Conciseness4/5

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

The description is long, but the tool is genuinely complex (17 params, 4 actions, launch paths, guards). It is organized into clear labeled sections with the most decision-relevant information front-loaded. Some redundancy exists between the when-to-use and sibling-contrast sections and the side-effects section, but each sentence contributes usable context.

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 the tool's complexity and the presence of an output schema, the description is complete: it covers when to use it, when not to, side effects, launch behavior, safety guards, error semantics, and relationships to sibling aliases. Nothing an agent needs to select or invoke this tool correctly appears to be missing.

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 high (82%), so the schema carries most parameter documentation. The description adds semantic value beyond the schema by explaining how actions combine with parameters (e.g., launch plus assignee, assignee='any' resolution, launch-unsupported outcomes, and lifecycle sequencing). The three review_* params remain undocumented, but the description cannot fully compensate for that gap.

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 names a specific verb and resource: 'Manage the agent-task lifecycle — dispatches to one of four actions.' It then enumerates the four actions (dispatch, status, handoff, complete) and explicitly contrasts this with sibling aliases and unrelated prefix-sharing tools, so an agent can distinguish it from the many sibling tools.

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?

Provides explicit when-to-use guidance ('as the single MCP-registered agent surface... when the caller wants to pick the lifecycle action by name'), explicit when-not-to-use guidance ('prefer the specific alias... from internal code paths'), and a clear warning against misusing dispatch to run a subagent. It also contrasts with delimit_ledger_add and separate prefix-sharing tools.

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

Deploy Server

Other Tools