Proposal: Context Summary for Orchestrator Sub-tasks #954
HadesArchitect
started this conversation in
1. Feature requests
Replies: 2 comments
-
Love this. Hope it gets implemented. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Good idea. I still think the ai models are capable with little contexts but I would like to see the difference made |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Original: https://discord.com/channels/1349288496988160052/1388009729497890888
TL;DR: summarize context that orchestrator has and pass it to subtasks. (like the condensing summary)
Scope Document: Agentic Middleware for Context Handoff
1. Problem Statement
The current agent architecture suffers from context-loss inefficiency. When the Orchestrator creates a sub-task for a specialist agent (e.g., Architect, Builder), the new agent starts with a blank slate. It must re-discover the environment, re-read files, and lacks the nuanced understanding accumulated by its parent. This leads to redundant operations, increased token usage, and potentially sub-optimal performance.
Similarly, when a sub-task completes and returns to the Orchestrator, the full context of its work (new files created, APIs implemented, problems solved) is not automatically and concisely injected back into the Orchestrator's context, forcing it to potentially re-read the sub-task's outputs.
2. Proposed Solution: The "Context Handoff" Middleware
We will implement a middleware layer that acts as a "context summarization agent." This layer will be invoked during two critical phases of the agent lifecycle:
Task Delegation (Orchestrator -> Sub-agent): Before a new sub-task is created, the middleware will summarize the Orchestrator's extensive context, tailoring the summary to be highly relevant to the sub-task's specific prompt. This distilled summary is then injected into the sub-agent's initial context.
Task Completion (Sub-agent -> Orchestrator): Upon completing its work, the sub-agent will use the middleware to generate a "boomerang" summary. This summary will encapsulate the key outcomes, artifacts, and learnings from the sub-task, providing a concise and potent update to the Orchestrator.
This creates an intelligent "context pipeline" that ensures low-token, high-relevance information flows between hierarchical agents.
3. Technical Implementation Details
3.1. New Core Logic:
generateHandoffSummary
The heart of this feature will be a new function, likely residing alongside the existing summarization logic in
/src/core/condense/index.ts
.3.2. Modifying the Orchestration Flow in
Task.ts
The
Task
class will need modification in how it creates new tasks. We'll intercept the creation process to inject our middleware.3.3. The "Boomerang" Context Handoff
For the return journey, we need to ensure the sub-task's summary is properly injected into the parent's context:
4. Impact Analysis
Files to Modify:
/src/core/condense/index.ts
: To add theTASK_HANDOFF_PROMPT
and thegenerateHandoffSummary
function./src/core/task/Task.ts
: To modify the sub-task creation and completion logic to invoke the new middleware.Benefits:
Beta Was this translation helpful? Give feedback.
All reactions