# Source audit: agents

Decision: OMP-port-backlog, fail-closed locally. Real subagent execution belongs to OMP `TaskTool`; `miloc-pi` must port or thin-wrap that behavior before enabling an agents/task plugin.

Current local state:

- `extensions/agents/index.ts` registers primary `task`, legacy `runAgent`, and `/agent`.
- `/agent list` can show markdown definitions from bundled `agents/*.md`, `.pi/agents`, and `.agents/agents`.
- `task`, `runAgent`, and `/agent run` return `isError=true` for existing agents instead of returning a synthetic accepted-task result.
- The extension is disabled by default through `package.json#pi.extensions`.

OMP source evidence:

- `/tmp/oh-my-pi-review/packages/coding-agent/src/task/index.ts` defines `TaskTool`, `name = "task"`, dynamic description rendering, sync/async execution selection, validation, progress aggregation, isolation handling, and final summary rendering.
- `/tmp/oh-my-pi-review/packages/coding-agent/src/task/types.ts` defines the active task schema: `agent`, `tasks[].id`, `tasks[].description`, `tasks[].assignment`, optional `context`, `schema`, and `isolated`, plus `TaskToolDetails`, `SingleResult`, and progress payloads.
- `/tmp/oh-my-pi-review/packages/coding-agent/src/task/discovery.ts` and `/tmp/oh-my-pi-review/docs/task-agent-discovery.md` define discovery precedence for project, user, plugin, and bundled agents.
- `/tmp/oh-my-pi-review/packages/coding-agent/src/task/executor.ts` creates child sessions, applies tool restrictions, forwards progress, handles nested task data, and finalizes subprocess output.
- `/tmp/oh-my-pi-review/packages/coding-agent/src/prompts/tools/task.md` documents model-facing task rules: explicit assignments, batch width, caller-owned final verification, no globs, and no project-wide gates inside subagents.
- `/tmp/oh-my-pi-review/docs/tools/task.md` documents artifacts, `agent://` outputs, async details, isolation modes, output caps, and common errors.

Implementation boundary:

- Do not keep the old deterministic summary as execution proof.
- Do not call this extension product-ready until child sessions, progress, artifacts, cancellation, output caps, and isolation behavior are either ported from OMP or intentionally out of scope with a documented API.
- If Miloc-specific agent markdown remains, it must map into OMP-compatible agent definitions rather than becoming a second execution engine.

License note: OMP files are source evidence for the future port. No OMP implementation code was copied in the fail-closed slice.
