Scenario A: Request Deduplication Request Level
User double-taps send button. System detects the duplicate request and waits for the original to complete instead of processing twice.
Trigger Condition
Second request arrives with matching requestHash (derived from userId + message content + timestamp window) while first request is still processing.
Request Timeline
Original
"Plan my week with the dentist appointment"
Duplicate
"Plan my week with the dentist appointment"
Blocked
Waiting for original request... (hash match detected)
Deduplication Flow
🧠
RequestDeduplicator
Processing request #1
Request #2
Waiting (duplicate)
Request #1
Completes first
Without Deduplication
  • Both requests processed separately
  • Double API/LLM costs
  • User sees duplicate responses
  • Possible data conflicts
With Deduplication
  • Second request waits for first
  • Single processing cost
  • Same response returned to both
  • No race conditions
💡 Hash Generation
Request hash combines: userId + normalized message content + 2-second time window. This catches both accidental double-taps and retry storms without blocking legitimate rapid sequential requests.
50%
Cost Saved
2s
Dedup Window
~8%
Duplicate Rate
Scenario B: Plan Progress Context Attention Anchor
Inject checklist into agent prompts showing completed steps and current position. This "Manus-style" attention anchor reduces drift and improves coherence.
Trigger Condition
Multi-step plan is being executed. Each agent invocation includes the plan progress context in its system prompt.
📋
Plan Progress Context
Injected into agent prompt
  • Fetch calendar events for this week
  • Identify dentist appointment on Tuesday
  • 3 Check for conflicts with existing meetings
  • 4 Suggest optimal times for quarterly report work
  • 5 Generate final week plan summary
Context Injection Flow
🧠
Supervisor
Tracks progress
+ plan context
📅
Calendar Agent
Sees: "Step 3 of 5"
Without Plan Context

Agent receives only the current step instruction. Has no awareness of:

  • What was already done
  • What comes next
  • Overall goal context

Result: Repetitive actions, lost context, drift from plan

With Plan Context

Agent sees the full checklist with current position. Understands:

  • Prior steps are complete
  • Current focus area
  • Upcoming dependencies

Result: Focused execution, no redundant work

// Plan progress injection in HierarchicalPromptBuilder
const planContext = `
## Current Plan Progress
You are executing step ${currentStep} of ${totalSteps}.

${steps.map((s, i) =>
  i < currentStep ? \`[x] \${s.name}\` :
  i === currentStep ? \`[>] \${s.name} (CURRENT)\` :
  \`[ ] \${s.name}\`
).join('\\n')}

Focus on the CURRENT step. Previous steps are complete.
`;

systemPrompt = planContext + originalPrompt;
💡 Manus-Style Attention Anchor
This technique, popularized by Manus AI, keeps the model "on track" by providing a visible checklist in every prompt. It's particularly effective for multi-step plans where context window size would otherwise cause drift.
40%
Less Drift
~200
Tokens Added
0
Redundant Steps
Scenario C: Parallel vs Sequential Execution Mode
Different agents can run in parallel. The same agent must run sequentially. This prevents context collision while maximizing throughput.
Decision Criteria
ExecutionOrchestrator checks: (1) Are tasks independent? (2) Do they use the same agent? (3) Are there data dependencies? Tasks with different agents and no dependencies run in parallel.
Parallel Execution
Different agents can run simultaneously. Calendar and Weather can both process while Task waits for neither.
📅
🌤
📝
~800ms total
Sequential Execution
Same agent must run sequentially to avoid context collision. Two Calendar calls wait for each other.
📅
📅
📅
~2400ms total
Mixed Execution Example
🧠
Supervisor
Orchestrates
📅
Calendar #1
t=0ms
🌤
Weather
t=0ms (parallel)
📅
Calendar #2
t=800ms (waits for #1)
// ExecutionOrchestrator.ts - Execution mode selection
function canRunParallel(taskA: Task, taskB: Task): boolean {
  // Different agents = parallel OK
  if (taskA.agentId !== taskB.agentId) return true;

  // Same agent = must be sequential
  return false;
}

// Also checks: data dependencies, resource locks, priority
💡 Why Sequential for Same Agent?
Agents maintain conversational context. Running the same agent in parallel would cause context collision - each instance would have different conversation state, leading to inconsistent outputs. Sequential execution ensures context coherence.
3x
Faster (Parallel)
100%
Context Safe
Auto
Mode Selection
Scenario D: Conflict Resolution Agent Disagreement
Two agents return different values for the same question. The system uses confidence scores and configurable strategies to pick the winner.
Trigger Condition
Multiple agents provide answers for the same field/question. Answers differ. System must resolve to a single authoritative value.
Conflicting Responses
Question: "Best time for the team meeting?"
Winner
📅
Calendar Agent
"Tuesday 2-3pm - all attendees free"
Confidence: 0.92
📝
Task Agent
"Thursday morning - project deadline buffer"
Confidence: 0.68
Available Resolution Strategies
🏆
highest_confidence
Pick highest score
👥
majority
Most agents agree
last
Most recent wins
🏁
first
First response wins
// ConflictResolution in execution-orchestrator.ts
type ConflictStrategy =
  | 'highest_confidence'  // Default: pick highest score
  | 'majority'            // Most agents agree
  | 'last'                // Most recent response
  | 'first';              // First response wins

function resolveConflict(responses: AgentResponse[]): string {
  const sorted = responses.sort((a, b) =>
    b.confidence - a.confidence
  );
  return sorted[0].value;
}
Resolution Applied
Using highest_confidence strategy

Selected Calendar Agent's response (0.92 confidence) over Task Agent's (0.68).

Final answer: "Tuesday 2-3pm - all attendees free"

💡 Domain Authority
For calendar-related questions, Calendar Agent typically has higher confidence because it has direct access to availability data. The confidence score reflects both data quality and domain expertise.
Scenario E: Synthesis Strategies Response Merging
How the final response is assembled from multiple agent outputs. Different strategies for different types of responses.
Trigger Condition
Multiple agents have contributed outputs that need to be combined into a single coherent response for the user.
Hierarchical Merge Example
Calendar Agent
"Tuesday is free from 2-5pm. Dentist at 10am."
Weather Agent
"Rain expected Wednesday afternoon."
Task Agent
"Quarterly report needs 4 hours of focused time."
Synthesized Response
Here's your week plan: Tuesday you have a dentist appointment at 10am, then you're free from 2-5pm - perfect for focused work on the quarterly report. I'd suggest doing outdoor activities before Wednesday afternoon since rain is expected. Would you like me to block off Tuesday afternoon for the report?
🌳
hierarchical-merge
Combines outputs based on domain priority. Calendar facts first, then context from other agents. Best for planning questions.
priority-weighted
Weight contributions by confidence and domain relevance. Higher confidence agents dominate the response structure.
🤝
consensus-building
Find common ground between agents. Highlight agreements, note disagreements. Best for complex decisions.
📖
sequential-narrative
Tell a story through time. First this, then that. Best for trip planning and multi-day schedules.
// Synthesis strategy selection in supervisor-agent-v3.ts
const strategies: Record<string, SynthesisStrategy> = {
  'hierarchical-merge': mergeByDomainPriority,
  'priority-weighted': weightByConfidence,
  'consensus-building': findCommonGround,
  'sequential-narrative': buildTimeline,
  'auto': detectBestStrategy  // Analyzes request type
};

// 'auto' examines the original request to pick best strategy
if (request.includes('plan') || request.includes('week')) {
  return 'hierarchical-merge';
}
💡 Strategy Selection
The default "auto" strategy examines the user's original request to determine the best synthesis approach. Planning requests use hierarchical-merge, travel uses sequential-narrative, and complex decisions use consensus-building.
5
Strategies
auto
Default Mode
~300ms
Synthesis Time