2.2 KiB
2.2 KiB
Subagents Support Plan (Flynn)
Date: 2026-02-26
Status: phases 1-3 implemented
Scope: add OpenClaw-style multi-turn subagent session support in Flynn without changing channel surface scope (Telegram-first)
Constraints
- Keep channel scope unchanged (Telegram remains default for now).
- Deliver subagent capability through the existing native tool loop.
- Keep gateway protocol additive-only (no new JSON-RPC methods required).
Phase 1 (Implemented in this change)
- Added subagent runtime manager (
src/backends/native/subagents.ts) that can:- spawn child sessions,
- send follow-up turns,
- list active child sessions,
- cancel in-flight child runs,
- delete child sessions.
- Added new tools:
subagent.spawnsubagent.sendsubagent.listsubagent.cancelsubagent.delete
- Wired tools into per-session router orchestration (
src/daemon/routing.ts). - Added config guardrails under
agents.subagents:enabledmax_active_sessions
- Added policy/profile support so
subagent.*is controlled throughgroup:agentsand tool profiles.
Phase 2 (Implemented)
- Added idle TTL eviction plus audit lifecycle events for cleanup visibility.
- Added transcript export/summarization via
subagent.summary. - Added per-subagent tool-profile override (
queue_mode,tool_profileon spawn). - Added parent-child trace IDs and subagent lifecycle/turn audit events.
Phase 3 (Implemented)
- Added queue semantics per child session (
followupFIFO,interruptlatest-wins). - Added explicit resource budgets (max turns, max total tokens, per-turn timeout).
- Added operator/UI affordances:
/subagentscommand (list/summary/cancel/delete),- gateway chat slash suggestion for
/subagents.
Final Acceptance Criteria
- Parent agent can spawn and continue child subagents across multiple turns.
- Child session state is isolated and delete clears history.
- Recursion tooling (
agent.delegate,council.run,subagent.*) is removed from child registries. - Child sessions support queue policy + budget guardrails + transcript inspection.
- Tests cover manager lifecycle, tool behavior, config parsing, routing command wiring, and audit event logging.