From 81be4717fee620635c45e5630eb334ced40e4ff4 Mon Sep 17 00:00:00 2001 From: Snider Date: Tue, 17 Mar 2026 20:03:52 +0000 Subject: [PATCH] feat: add mandatory closeout sequence to coding template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dispatched agents must now run a 4-pass polish cycle before committing: 1. Self-review (conventions, nil pointers, hardcoded paths) 2. Build + test (fix failures, add tests for critical paths) 3. Simplify (consolidate, deduplicate, reduce complexity) 4. Final check (build clean → commit) This captures the review→fix→simplify→re-review flow that produces polished code. Goal: CodeRabbit finds zero issues on agent output. Co-Authored-By: Virgil --- pkg/agentic/prep.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/pkg/agentic/prep.go b/pkg/agentic/prep.go index 975d9da..74175ff 100644 --- a/pkg/agentic/prep.go +++ b/pkg/agentic/prep.go @@ -355,6 +355,36 @@ Each phase = one commit. This is not optional. If no PLAN.md, complete TODO.md as a single unit of work. +## Closeout Sequence (MANDATORY before final commit) + +After completing your work, you MUST run this polish cycle before committing: + +### Pass 1: Self-Review +Review ALL files you changed. For each file check: +- Error handling: coreerr.E("pkg.Method", "msg", err) — 3 args always +- File I/O: coreio.Local not os.ReadFile/WriteFile +- No hardcoded paths (/Users/*, /home/*) +- No nil pointer risks (check err before using resp.StatusCode) +- No unused imports or variables +- UK English in comments +Fix anything you find. This catches the obvious mistakes. + +### Pass 2: Build + Test +Run the test suite. Fix any failures. If tests don't exist for your new code, add them for critical paths. + +### Pass 3: Simplify +Look at your changes as a whole: +- Any duplicate code that should be consolidated? +- Any function that's too long and should be split? +- Any unnecessary complexity? +- Can any of your changes be expressed more simply? +Simplify without changing behaviour. + +### Pass 4: Final Check +Run build one more time. If clean, commit. If not, fix and repeat. + +Each pass catches things the previous one introduced. Do NOT skip passes. + ## Commit Convention Commit message format: type(scope): description