Skip to main content

Module task_tool

Module task_tool 

Source
Expand description

Task tool — Claude-Code Agent-equivalent for typed sub-agent delegation.

PMAT-CODE-SPAWN-PARITY-001: the Task tool mirrors Claude Code’s Agent tool, which takes subagent_type + description + prompt and returns the child’s final response. This is the 1:1 equivalent for apr code and is default-registered (no capability gate) so the agent can always delegate, matching Claude Code 1:1.

Distinct from SpawnTool:

  • SpawnTool is untyped — caller passes any manifest inline.
  • TaskTool resolves subagent_type via SubagentRegistry to a preset personality (system-prompt + narrow tool allowlist). This matches Claude’s pattern where each agent type has a fixed role.

Toyota Production System:

  • Poka-Yoke: subagent_type must exist in the registry — an unknown type errors out before spawn, so typos can’t launch a misconfigured child.
  • Jidoka: child max_iterations is clamped and recursion is bounded by max_depth.
  • Muda: child shares parent’s driver + memory Arc, so no duplicate model load.

Structs§

SubagentRegistry
Registry of subagent types available to TaskTool.
SubagentSpec
A pre-configured subagent personality resolved by subagent_type.
TaskTool
Task tool — Claude-Code-equivalent Agent/Task sub-agent dispatcher.

Functions§

default_registry
Default registry populated with the 3 canonical subagent types (general-purpose, explore, plan) — identical roster to Claude Code’s built-in agents.
register_task_tool
Register TaskTool + Spawn { max_depth } capability in the given registry, unless the manifest already denies Spawn explicitly.