The milestone pattern
One milestone: brief the environment, plan the brief into task files under `sprints/`, author and ground the gate, build each task through the included `sprint` pipeline, then review the milestone as a whole. Called by `build` once per milestone brief.
[header] pattern_language_compatibility = "3" entry = "milestone" include = ["sprint.toml", "troubleshoot.toml", "merge.toml"] merge = "merge" on_stop = "write_handover" description = """ One milestone: brief the environment, plan the brief into task files under `sprints/`, author and ground the gate, build each task through the included `sprint` pipeline, then review the milestone as a whole. Called by `build` once per milestone brief. """ [patterns.milestone] [[patterns.milestone.parameters]] name = "plan_source" kind = "path" description = "The milestone brief the environment briefer, the task planner, and the gate author read."
All three are passed whole into sprint; review_prompt also runs milestone_review and
troubleshoot_prompt the troubleshoot pass below. A caller that wants its own names each in full.
[[patterns.milestone.parameters]] name = "execute_prompt" kind = "prompt-id" default = "execute" description = "The task executor's prompt." [[patterns.milestone.parameters]] name = "review_prompt" kind = "prompt-id" default = "review" description = "The task reviewer's prompt." [[patterns.milestone.parameters]] name = "troubleshoot_prompt" kind = "prompt-id" default = "troubleshoot" description = "The troubleshoot pass's prompt." [[patterns.milestone.parameters]] name = "merge_attempt_ceiling" kind = "text" default = "2" description = "The finish-time merge repair ceiling passed to the bundled merge pattern." [[patterns.milestone.parameters]] name = "protected_check" kind = "path" default = ".gantry/no-protected-check" description = "An optional record-path check an enclosing recursive goal run freezes." [[patterns.milestone.parameters]] name = "attempt_ceiling" kind = "text" default = "unbounded" description = "The attempt ceiling passed to each sprint task."
Planning the milestone
A failed environment briefing routes to nothing; later agent preambles omit environment.md.
[[patterns.milestone.steps]] name = "brief_environment" title = "Write Environment Brief" type = "agent" stage = "environment-build" prompt = "write-environment" inputs = ["{{plan_source}}"] protected = ["{{protected_check}}"] on_plan_change = "review_plan_change" [[patterns.milestone.steps]] if = { brief_environment = "failed" } then = "nothing"
An observed plan change routes to nothing because the task briefs are this step's product.
[[patterns.milestone.steps]] name = "plan_sprints" title = "Decompose Milestone Brief Into Task Briefs" type = "agent" stage = "plan" prompt = "write-sprints" inputs = ["{{plan_source}}"] protected = ["{{protected_check}}"] on_plan_change = "nothing" outputs = [ { name = "sprints", path = "sprints/" }, ]
A re-entered milestone keeps an existing bin/gate, including a non-executable one the baseline
must report. Both branches overwrite gate_present because command steps retain stale outputs.
[[patterns.milestone.steps]] name = "probe_gate" title = "Check For Task Gate Command" type = "command" run = 'mkdir -p "$orchestration/state"; if test -e "$orchestration/bin/gate"; then printf yes > "$orchestration/state/gate-present.txt"; else printf no > "$orchestration/state/gate-present.txt"; fi' outputs = [ { name = "gate_present", path = "state/gate-present.txt", values = ["yes", "no"] }, ] [[patterns.milestone.steps]] if = { gate_present = "yes" } else = "author_gate"
A red baseline stops the milestone before any task can build.
[[patterns.milestone.steps]] name = "baseline" title = "Testing" type = "gate" command = "{{gate_script}}" [[patterns.milestone.steps]] if = { baseline = "red" } then = "stop_baseline_red"
The tasks
This inner for re-enumerates sprints/, so a task review can add a task for a later iteration.
[[patterns.milestone.steps]] name = "run_sprints" type = "for" list = { directory = "{{sprints}}" } body = "sprint" [patterns.milestone.steps.parameters] execute_prompt = "{{execute_prompt}}" review_prompt = "{{review_prompt}}" troubleshoot_prompt = "{{troubleshoot_prompt}}" declared_gate_command = "{{gate_script}}" protected_check = "{{protected_check}}" attempt_ceiling = "{{attempt_ceiling}}" [[patterns.milestone.steps]] if = { run_sprints = "failed" } then = "stop_sprints_absent"
The milestone review
The reviewer judges the built milestone and may edit the tree. The for above has ended, so
diff = "iteration-start" resolves to the start of build's iteration: the reviewer reads the
whole milestone rather than the last task's changes.
[[patterns.milestone.steps]] name = "milestone_review" title = "Review Built Milestone" type = "agent" stage = "review" summarize = true prompt = "{{review_prompt}}" diff = "iteration-start" protected = ["PROGRESS.md", ".preamble.sys.md", "bin", "{{protected_check}}"] confine = true on_plan_change = "review_plan_change" outputs = [ { name = "milestone_verdict", path = "state/milestone-verdict.txt", values = ["complete", "blocked"] }, { name = "milestone_note", path = "state/milestone-note.md" }, ] [patterns.milestone.steps.text] REVIEW_SUBJECT = "whole milestone" EXTRA_JUDGMENT = """ Beyond correctness, judge the architecture: responsibilities and interfaces, dependencies, maintainability, and whether the structure will suffice for the later, not-yet-built milestone briefs. """ [[patterns.milestone.steps]] if = "milestone_verdict" then = { complete = "verify_milestone_review_edits", blocked = "stop_milestone_blocked" } else = "stop_milestone_verdict_absent"
An absent bin/gate leaves gate_script unbound, so baseline stops on command resolution.
[[patterns.author_gate.steps]] name = "author_gate" title = "Write Task Gate Command" type = "agent" stage = "gate-build" prompt = "write-milestone-gate" inputs = ["{{plan_source}}"] read_only = true outputs = [ { name = "gate_script", path = "bin/gate" }, ]
The reviewer's own edits
This gate checks the milestone review's edits; one troubleshoot pass can repair a red result.
[[patterns.verify_milestone_review_edits.steps]] name = "milestone_review_gate" title = "Testing" type = "gate" command = "{{gate_script}}" [[patterns.verify_milestone_review_edits.steps]] if = { milestone_review_gate = "red" } then = "route_milestone_review_red_gate" [[patterns.route_milestone_review_red_gate.steps]] name = "milestone_review_gate_recovery" type = "call" pattern = "troubleshoot" [patterns.route_milestone_review_red_gate.steps.parameters] troubleshoot_prompt = "{{troubleshoot_prompt}}" declared_gate_command = "{{gate_script}}" protected_check = "{{protected_check}}" position = """ You are repairing a red gate that a milestone review caused. Every task in this milestone passed this gate before the reviewer edited the tree, so the reviewer's own edits are the sole cause. Fix them forward if the edits carry a genuine finding — a strengthened check, a corrected assertion, a real defect surfaced. If they are cosmetic and you cannot verify a repair, say so and stop rather than half-fixing: this milestone ends either way, and the handover is what the next session reads. """ [[patterns.route_milestone_review_red_gate.steps]] name = "repaired_milestone_review_gate" title = "Testing" type = "gate" command = "{{gate_script}}" [[patterns.route_milestone_review_red_gate.steps]] if = { repaired_milestone_review_gate = "red" } then = "stop_repaired_milestone_review_gate" [[patterns.stop_repaired_milestone_review_gate.steps]] type = "stop" note = "The milestone reviewer's own edits left the gate red and the troubleshoot pass could not verify a fix; the reviewer's note is at state/milestone-note.md and the troubleshoot pass's is at state/troubleshoot-note.md."
The endings
[[patterns.stop_baseline_red.steps]] type = "stop" note = "The milestone's declared gate is red on a clean tree, so either the gate is wrong or the tree was already broken." [[patterns.stop_milestone_blocked.steps]] type = "stop" note = "The milestone reviewer's verdict was blocked; its note is at state/milestone-note.md." [[patterns.stop_milestone_verdict_absent.steps]] type = "stop" note = "The milestone reviewer did not write state/milestone-verdict.txt, so the milestone cannot be accepted." [[patterns.stop_sprints_absent.steps]] type = "stop" note = "The task planner did not write the sprints directory, so the milestone cannot enumerate work."
milestone — one milestone, planned, gated, built, and reviewed
build'sforbodybuild_milestonecalls this once per milestone brief; it is not run on its own.Every step's outputs resolve under this invocation's own state root, so two milestones cannot collide on the path
sprints.