# stage planner ```output { acceptance_checks, implementation_plan, needs_ui, needs_api, revision_count: 0, max_revisions } Preserve repository and user constraints. ``` ```prompt Use the user's runtime prompt as the feature request and infer repository context from the workspace. Initialize revision_count=0 and max_revisions=2 unless the user requests a lower budget; preserve the request and constraints in your output. Inspect the app and turn the request into scoped, testable acceptance criteria. Choose exactly one next route: user_interface for UI or full-stack work, api_only for backend-only work. Record needs_ui and needs_api explicitly. This is a conditional fork, not parallel execution. Return blocked for unresolved requirements. ``` ```edges user_interface -> ui_builder api_only -> api_builder blocked -> #failure error -> #failure ``` ```configs provider=opencode-go model=deepseek-v4.1-flash retries=0 ``` # stage ui_builder ```output { ui_changes, accessibility_checks, changed_files, needs_api, revision_count, max_revisions } Preserve the original plan and any API changes from previous iterations. ``` ```prompt Implement the UI using existing components and conventions. Include responsive, loading, empty, error, and keyboard-accessible states where relevant. Do not invent unrequested features. On revision, increment the shared counter or return exhausted when the budget is reached. If needs_api is true, return backend_needed so API work happens next, sequentially; otherwise return success for verification. ``` ```edges success -> verifier backend_needed -> api_builder exhausted -> #failure error -> #failure ``` ```configs provider=opencode-go model=deepseek-v4.1-flash retries=0 ``` # stage api_builder ```output { api_changes, contract_tests, changed_files, revision_count, max_revisions } Preserve UI artifacts and acceptance criteria. ``` ```prompt Implement the required API and persistence changes with validation, authorization, and error handling appropriate to the existing project. Preserve public contracts unless the plan explicitly changes them. Add focused contract tests. Increment the revision counter for feedback routed directly here by verifier. Do not increment again for a sequential handoff from ui_builder, which already counted that revision. Return exhausted if over budget. Do not deploy, commit, or push. ``` ```edges success -> verifier exhausted -> #failure error -> #failure ``` ```configs provider=opencode-go model=deepseek-v4.1-flash retries=0 ``` # stage verifier ```output { verification_results, feedback?, revision_count, max_revisions } Preserve the plan and branch-selection flags for retries. ``` ```prompt Execute acceptance, unit, integration, and relevant UI checks. Include actual commands and observations. If UI work needs revision, return ui_failed; for a backend-only issue return api_failed. For a full-stack issue involving both, return ui_failed so UI then API are revisited sequentially. Infrastructure failures are error, not evidence that the implementation is wrong. Never claim unrun checks. ``` ```edges success -> reviewer ui_failed -> ui_builder api_failed -> api_builder error -> #failure ``` ```configs provider=opencode-go model=deepseek-v4.1-flash retries=0 ``` # stage reviewer ```output { delivery_summary, review_findings, evidence, limitations } ``` ```prompt Review scope, correctness, security, and accessibility against the request. Return success with a concise delivery summary only when the feature is complete and verified. Return rejected for unresolved review findings. Report limitations honestly; do not merge, publish, or deploy without user authorization. ``` ```edges success -> #success rejected -> #failure error -> #failure ``` ```configs provider=opencode-go model=deepseek-v4.1-flash retries=0 ```