AI/Tasks/OrchestratorUpgrades/Implementation_Overview.txt

IMPLEMENTATION PROMPT SET - ORCHESTRATOR UPGRADES
 
Purpose:
- These prompts convert the design-phase specs into implementation tasks that produce production code and tests.
- Run phases in order. Each phase assumes prior phases are complete.
 
Execution model:
- For each phase, modify production code and tests in the orchestrator execution boundary.
- Keep edits bounded and deterministic.
- Preserve safety invariants: never weaken authorization, confirmation, sandboxing, refusal rules, or execution safety.
 
Primary target surfaces:
- src/TechToolbox.Agent/Orchestrator/*
- src/TechToolbox.Agent/Execution/*
- src/TechToolbox.Agent/Tools/* (only direct execution, validation, and routing seams)
- src/TechToolbox.Agent/Tests/*Orchestrator* and related focused test files
 
Global contracts:
- State model precedence: architecture policy > execution semantics > explicit user intent > heuristic recovery details.
- Security pipeline order: resolve -> validate -> authorize -> execute -> normalize.
- Shared contracts remain stable across phases: run-state semantics, decision schema, tool authorization ordering, cancellation and deadline semantics, retry and repair budgets, path and file-operation safety, telemetry redaction, and retention behavior.
- Logs, telemetry, and diagnostics must be redacted and resource-bounded.
- Mandatory cross-phase requirements:
  - Version every shared contract for state, decisions, tool results, telemetry, and memory records, with migration or fail-closed rejection behavior for unknown versions.
  - Publish an ownership matrix assigning run-state, decision validation, repair, authorization, path checks, retry classification, execution, finalization, telemetry redaction, and memory precedence to single owners or components.
  - Define precedence rules and conflict outcomes for user intent vs. memory preference vs. policy blocks vs. retry or deadline exhaustion.
  - Use explicit numeric resource ceilings for total run duration, iteration limits, tool counts, model calls, repair attempts, loop history, telemetry retention, and output-size limits.
  - Add end-to-end acceptance scenarios covering safe normal execution, blocked mutation, cancellation, retryable and deterministic failures, no-progress loops, low-confidence location selection, prompt injection, and concurrent orchestrator use.
  - Add rollback/compatibility guidance for any contract migration or compatibility wrapper introduced during rollout.
 
Per-phase output format:
1) Summary
2) Files changed
3) Code changes
4) Tests added/updated
5) Validation results
6) Known risks
 
Validation baseline per phase:
- dotnet build src/TechToolbox.Agent/TechToolbox.Agent.csproj -c Release
- dotnet test src/TechToolbox.Agent/Tests/TechToolbox.Agent.Tests.csproj -c Release --filter "Orchestrator|Execution|Tool|Safety|Retry|Loop|Policy|Telemetry|Weather|Authorization"
 
Stop conditions:
- Stop if a requested change would violate safety invariants.
- Stop after three focused repair cycles for phase-related failures and report exact failing assertions.