Evaluate the final Phase 5 gate — completion is allowed only when final gate evidence for every criterion passes: full regression actually ran and passed, documentation is complete, deployment checklist is verified, and traceability links every acceptance criterion to passing tests. Store the actual pass/fail evidence at gate-5-{feature-slug}-{timestamp} in sparc-gates. If evidence is missing, failed, interrupted, or unrun, preserve state and phase, increment gateAttempts, refresh updatedAt to the current ISO timestamp at the exact current-phase key, report blockers and stop. Do not store a complete artifact or complete the state, set completedAt, or train a successful cycle on failure.
After the final gate passes, store completion artifact — call mcp__plugin_ruflo-core_ruflo__memory_store with namespace sparc-phases, key complete-{feature-slug}, value: { status: "complete", traceabilityMatrix: [...], documentationFiles: [...], deploymentChecklist: {...}, regressionResult: "pass" }
Close the workflow — retrieve current-phase-{feature-slug} exactly from sparc-state again and decode it as state. If status === "complete", do not write again or change its timestamps. Otherwise require phase 5 and the successful final gate evidence above; stop on missing/malformed or changed state. Preserve all existing state fields and set now = new Date().toISOString(). Call mcp__plugin_ruflo-core_ruflo__memory_store with namespace sparc-state and exact key current-phase-{feature-slug}, value { ...state, phase: 5, phaseName: "Completion", status: "complete", completedAt: now, updatedAt: now } once. Keep phase 5, never increment to 6. Report completion only after this write succeeds. A completion artifact alone does not close state; this read/write sequence is not an atomic concurrency guarantee.