Background
Phase 2 of the agent handoff roadmap is sub-agents: distributing structured context horizontally so each sub-agent receives only what it needs and composes results back without losing constraints.
OpenClaw's plugin SDK already exposes the surface for this (prepareSubagentSpawn, onSubagentEnded on ContextEngine). Today both are no-ops in AbstractContextEngine (packages/contexto/src/engine/base.ts).
Goal
A design plan + working PoC that turns those hooks into real behavior end-to-end against an OpenClaw sub-agent flow.
Design plan should cover
- Context packet shape — what slice of mindmap state travels with the spawn (filtered episodes? branch subset? path ancestors?).
- Scoping — how to constrain a sub-agent to its task without leaking unrelated branches.
- Return composition — how sub-agent outputs (and any new constraints surfaced during its run) get folded back into the parent mindmap on
onSubagentEnded.
- Traceability — how a parent retrieval can later explain "this came from sub-agent X working on Y".
- Backend contract — what (if any) new endpoints the hosted backend needs (e.g.
mindmap.subgraph, mindmap.merge).
PoC scope
- Implement
prepareSubagentSpawn + onSubagentEnded in DefaultContextEngine (sliding-window can come later).
- One concrete OpenClaw demo: parent agent decomposes a task, spawns one sub-agent with a scoped context packet, sub-agent's episode is ingested under a traceable parent link, parent retrieval can surface it.
- Keep changes additive — don't break existing single-agent flows.
Acceptance criteria
Background
Phase 2 of the agent handoff roadmap is sub-agents: distributing structured context horizontally so each sub-agent receives only what it needs and composes results back without losing constraints.
OpenClaw's plugin SDK already exposes the surface for this (
prepareSubagentSpawn,onSubagentEndedonContextEngine). Today both are no-ops inAbstractContextEngine(packages/contexto/src/engine/base.ts).Goal
A design plan + working PoC that turns those hooks into real behavior end-to-end against an OpenClaw sub-agent flow.
Design plan should cover
onSubagentEnded.mindmap.subgraph,mindmap.merge).PoC scope
prepareSubagentSpawn+onSubagentEndedinDefaultContextEngine(sliding-window can come later).Acceptance criteria
docs/explorations/(or similar) and linked from this issue