# Self-Learning Loop — Mandatory Session End Protocol **This rule fires at the end of EVERY task. No exceptions.** Kilocode MUST complete all 6 steps before declaring any task done. --- ## STEP 1 — Verify Build and Tests (Non-negotiable gate) Run build verification: ``` .\verify-build.bat ``` Expected: `✅ All checks passed!` — zero errors, zero warnings. **If it fails: fix before proceeding. Do NOT move to Step 2 with a failing build.** Run tests: ``` dotnet test tests/NT8.Core.Tests/NT8.Core.Tests.csproj --no-build --verbosity minimal ``` Expected: All tests pass, 0 failed. **If any fail: fix before proceeding.** --- ## STEP 2 — Update SPRINT_BOARD.md 1. Find the completed task under `## 🔵 ACTIVE` 2. Move it to `## ✅ COMPLETED THIS SPRINT` and append ` — ✅ [YYYY-MM-DD]` 3. Find the next task at the top of `## ⬜ QUEUE` 4. Move it to `## 🔵 ACTIVE` 5. Save SPRINT_BOARD.md --- ## STEP 3 — Write Learnings to Governance For each of these questions, append to the file if YES: **Did this task reveal an NT8 API surprise or runtime behavior?** → Append to `docs/00-governance/common_failures.md`: ``` ## [YYYY-MM-DD] [TASK-ID] — [one-line symptom] - **Root cause:** [what caused it] - **Fix:** [what fixed it] - **Prevention:** [how to avoid in future] ``` **Did this task cause or reveal a compile error?** → Also append to `docs/00-governance/compile_guardrails.md`: ``` ## [YYYY-MM-DD] [TASK-ID] — [error code/description] - **Pattern to avoid:** [the problematic pattern] - **Correct pattern:** [the working replacement] ``` **Did this task confirm a working implementation pattern?** → Append to `docs/00-governance/patterns_and_antipatterns.md`: ``` ## [YYYY-MM-DD] [TASK-ID] — [pattern name] - **✅ DO:** [correct pattern with code example] - **❌ DON'T:** [incorrect pattern] ``` If no new learnings: skip Step 3 (write nothing, don't create empty entries). --- ## STEP 4 — Stage NEXT_PROMPT.md 1. Read the new ACTIVE task from SPRINT_BOARD.md 2. Find that task's full prompt in KILOCODE_RUNBOOK.md 3. Overwrite `NEXT_PROMPT.md` with exactly this format: ``` # NEXT: [TASK-ID] — [Task Name] # Staged: [YYYY-MM-DD] # Sprint: [N] | Estimated: [X hrs] # ───────────────────────────────────────────────────────────────── [paste the full Kilocode prompt here verbatim from KILOCODE_RUNBOOK.md] ``` --- ## STEP 5 — Update Current Status Edit `docs/00-governance/current_status.md`: - Change `Last Completed Task:` to the task just finished - Change `Active Task:` to the new active task - Change `Next Task:` to the task after that - Update `Last Updated:` date --- ## STEP 6 — Git Commit Everything Stage and commit all changes: ``` git add -A git commit -m "[TASK-ID]: [task name] complete - [file1]: [what changed — one line] - [file2]: [what changed — one line] - SPRINT_BOARD.md: [old active] → [new active] - NEXT_PROMPT.md: staged [new active task] - docs/00-governance/current_status.md: updated Build: clean | Tests: [N] passing | Dual-deployed: [yes/no]" ``` --- ## Why This Matters Every session adds to compound institutional memory. Governance files that update themselves mean zero re-alignment time between sessions. NEXT_PROMPT.md means the next task is always one paste away. Learning files mean the same compile error never appears twice. This is how one developer moves at team speed.