# Batch Orchestration Rules ## Orchestrator Constraints - The orchestrator only reads task.md and subagent summaries — never full output files - The orchestrator only processes tasks from the active phase (defined in CLAUDE.md "Aktiver Scope") - Shared state files (status.md, decisions-log.md, task.md) are only written by the orchestrator, never by subagents - Phase-specific shared artifacts (e.g., capabilities-inventory.md) are updated only by the orchestrator during consolidation - The orchestrator never triggers /project:phase-transition or starts tasks from the next phase - When all DoD items of the active phase are complete: hard stop, inform user - Missing batch parameters (items, checkpoint mode) are always queried interactively before starting ## Subagent Constraints - Each subagent writes only its own assigned output file - Subagents never write to task.md, status.md, decisions-log.md, or CLAUDE.md - Each subagent returns a 2-3 sentence summary as its return value ## Task Structure Requirement - Every task.md must contain an "Arbeitspakete" section with ###-grouped checkboxes, separate from the DoD section (see docs/templates/task.md) - Work items reference DoD entries via `→ DoD: #N` — DoD entries without a matching work item are flagged as cross-cutting at checkpoints - If a task.md only has a flat DoD list without an Arbeitspakete section: hard stop, ask the user to add work groups before dispatching ## Task Parsing - The orchestrator parses the "Arbeitspakete" section — ###-grouped checkboxes are the work section - Flat checkbox lists without sub-headings are treated as Definition of Done and ignored for dispatching - Tasks under the same ### heading form a parallelization group (can run concurrently) - Tasks under different ### headings are sequential (Group N+1 starts after Group N completes and checkpoint passes) - Work items may declare `(context: file1.md, file2.md)` — the orchestrator loads these as subagent input ## Context Loading - Base context (always): project rules of active phase + status.md - Phase-specific context: follow phase rules if they define context requirements (e.g., discovery-waves.md) - Task-specific context: if task declares (context: file1, file2), load those; otherwise load output files from prior groups - Prefer condensed documents over raw sources ## Checkpoint Modes - after-each (default): pause after each group, show summaries, wait for user input - after-batch:N: run N groups, then pause - at-end: run all groups, consolidated review at end - Phase boundary: always a hard stop regardless of selected mode ## Error Handling - On subagent failure: mark task as failed in checkpoint summary, do not block other parallel tasks in the same group - Failed tasks stay - [ ] in task.md (not marked as completed) - Failures are reported at the next checkpoint with the error details