Skip to content

feat(core): Task tool — sub-agent invocation#98

Merged
oratis merged 1 commit into
mainfrom
feat/core-task-subagent
May 30, 2026
Merged

feat(core): Task tool — sub-agent invocation#98
oratis merged 1 commit into
mainfrom
feat/core-task-subagent

Conversation

@oratis

@oratis oratis commented May 30, 2026

Copy link
Copy Markdown
Owner

The agent could load sub-agents (.deepcode/agents/*.md) but had no tool to run one — the biggest §0.1 parity gap. Adds the Task tool + a runSubAgent runner threaded into ToolContext by runAgent.

  • Task({prompt, subagent_type?, description?}) runs a named (or generic) sub-agent in a fresh context, returns only its final text.
  • Sub-agent gets a filtered tool registry (frontmatter tools whitelist minus a denylist of Task/Enter·ExitPlanMode/AskUserQuestion), its own model/maxTurns, no session, clean context.
  • Recursion capped (depth 1): a sub-agent gets no runSubAgent and no Task → can't spawn more; fails gracefully.
  • Runner built inline (no ToolRegistry import) + lazy-loads the sub-agent loader → zero node:fs into the renderer bundle.

+10 tests (unit error paths, agent-loop integration runs a sub-agent + feeds output back, depth guard). Full suite green: core 510, desktop 26, cli 59, lsp 8.

🤖 Generated with Claude Code

The agent could load sub-agents (.deepcode/agents/*.md) but had no tool to RUN
one — the biggest §0.1 parity gap. Add the Task tool + a runSubAgent runner
threaded into ToolContext by runAgent (which has provider/model/tools in scope):

- Task({prompt, subagent_type?, description?}) runs a named sub-agent (or a
  generic one) in a fresh context and returns only its final text.
- The sub-agent gets a filtered tool registry (its frontmatter `tools` whitelist
  minus a denylist of Task/Enter·ExitPlanMode/AskUserQuestion), its own
  model/maxTurns from frontmatter, no session, and clean (no) system reminders.
- Recursion is capped (MAX_SUBAGENT_DEPTH=1): a sub-agent gets no runSubAgent and
  no Task tool, so it can't spawn further sub-agents — Task fails gracefully.
- The runner is built inline (no ToolRegistry import) + lazy-loads the sub-agent
  loader, so agent.ts still drags zero node:fs into the renderer bundle.

+10 tests (Task unit incl. error paths; agent-loop integration runs a sub-agent
and feeds its output back; depth-guard). core 510 pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@oratis oratis merged commit c83d668 into main May 30, 2026
3 checks passed
@oratis oratis deleted the feat/core-task-subagent branch May 30, 2026 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant