feat(retro): add the retro phase and the lessons store - #7
Merged
Conversation
The pipeline had no place for what an iteration *cost*. spec.yml records what was built and the wiki records what it means, but the knowledge that actually gets lost between features — the bug rediscovered, the assumption wrong twice, the fix redone — had nowhere to live, so every cycle paid for it again. Adds `retro` as the final default phase, after `audit`. The knowledge-curator reconstructs the cycle from evidence already in the repo (state.yml history, fix-on-fix commits, audit and reviewer findings) and writes one lesson per file under the new paths.lessons. The store is deliberately NOT part of the wiki: the wiki is derived from the spec and its one non-negotiable rule is that every claim traces to a REQ, which a lesson about a recurring bug never can. What makes it bind rather than rot into a diary: - plan/tdd/it run `kivax lessons relevant --phase <p>` before producing anything (no path filtering by default — at plan time nobody knows yet which files the feature will touch) - plan.md gains a `## Lessons applied` section, in the template - `kivax lessons check` computes the applicable lessons and exits 1 when one isn't answered for; the trace-auditor runs it at the audit gate. A lesson can be dismissed, but only in writing. Lesson ids are allocated by `kivax lessons new`, never by hand — a shared id would make every reference in every plan ambiguous, and nothing downstream would notice. Co-Authored-By: Claude <noreply@anthropic.com>
develop landed a breaking change while this branch was open (constitution → principles, plus the researcher agent and resumable task lists), so this is a real adaptation, not a textual reconciliation: - every reference the retro work added to CONSTITUTION.md / paths.constitution / CONSTITUTION-VIOLATION now uses the principles naming - `retro` joins the renamed default pipeline; PASSTHROUGH carries both `task` and `lessons` - knowledge-curator gains the task-list block every long-running specialist now has, and joins that roster in kivax-tasks and the README — the retro phase can be interrupted mid-write like any other - the audit's step order absorbs both new checks: lessons first (mechanical), then principles (judgment) - skill counts corrected to 6 reference + 14 phase-driver Verified on the merged tree: 465 tests pass, ruff clean, and a fresh `kivax init` produces a pipeline ending in retro with `kivax doctor` OK and both `kivax lessons` and `kivax task` working. Co-Authored-By: Claude <noreply@anthropic.com>
null-result
force-pushed
the
feature/retro-phase-lessons-store
branch
from
July 31, 2026 16:00
45be48d to
6d8dc96
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
Adds
retroas the final phase of the default pipeline (… → it → audit → retro → done) and a new project artifact it owns: the lessons store underpaths.lessons(defaultspecs/lessons/), oneLSN-NNNN-<slug>.mdper lesson.New:
kivax_lessons.py(CLI:list/show/new/relevant/check/lint), theknowledge-curatoragent, thekivax-retrophase skill, thekivax-lessons-schemareference skill, and a lesson template. Wired intoDEFAULT_PIPELINE,kivax init,kivax doctor, and the CLI passthrough; the plan/tdd/it/audit/evolve/status skills and their canonical agents were updated to read and enforce it.Why
spec.ymlrecords what was built. The wiki records what it means. Neither records what the iteration cost — the bug rediscovered, the assumption wrong twice, the fix redone — so every cycle paid for it again.Why not the wiki. The wiki is derived from the spec, and its one non-negotiable rule is that every claim on a page traces to a REQ. A lesson about a recurring bug has no REQ behind it by construction, so folding it in would have meant relaxing that rule and weakening
kivax wiki lint. Separate artifact, separate owner, separate lifecycle (reinforced on recurrence, retired when it stops being true — never reingested on a hash change).How it binds
A knowledge store nobody reads is a diary. Three mechanisms, in order of teeth:
kivax-plan,kivax-tdd, andkivax-itrunkivax lessons relevant --phase <p>before producing anything. Deliberately generous: no path filtering unless asked, because at plan time nobody knows yet which files the feature will touch, and a lesson withheld for that reason is a lesson about to be relearned.plan.mdgains a## Lessons appliedsection (shipped in the template): one line per applicable lesson, saying how the plan honors it ornot applicable: <reason>.kivax lessons checkcomputes the applicable set (project-wide lessons, plus path-scoped ones whose globs match the branch diff or a path named inplan.md) and exits 1 when one isn't answered for. The trace-auditor runs it as part of the audit. A lesson can be dismissed; it cannot be dismissed silently.Notes for the reviewer
plan+tdd;kivax lessons checkinkivax-auditis the addition that turns documentation into enforcement. It's the piece most worth a second opinion.kivax lessons new), never from the agent writing the lesson — same rule as feature numbers. Two lessons sharing an id would make every## Lessons appliedreference ambiguous and nothing downstream would notice. Ids are never reused after deletion.seen_in) instead of duplicating, retire (status: retired+superseded_by/retired_reason) instead of deleting, and zero lessons is a valid cycle — every applicable lesson is read by every future planner, so a worthless entry buys inattention to the good ones.GAP:routed tokivax-evolve. Stated explicitly in the skill, the agent, and the orchestrator's principles so the store can't become a back door around spec-first.config.ymledit (pipeline,paths.lessons,gates.retro) —kivax upgradecopies the new skill/agent in but never rewrites config. Migration snippet is in the README.kivax lessonsfalls back to<paths.features>/lessonsso nothing breaks mid-migration, andkivax doctorflags the missing key whenretrois in the pipeline.kivax lessons checkacts on the active feature (unlikevalidate/trace, which span every feature); the sample CI step notes that.Verified end to end on a scratch project: a lesson scoped to
src/booking/**was correctly ignored bycheckuntil the plan's REQ→modules table named a matching path, then failed the gate.Checklist
pytest testspasses — 429 tests (67 new)kivax_lessons.pyat 98%ruff check . bin/kivaxpassestests/unit/test_kivax_lessons.pycovers applicability, acknowledgment parsing, the gate's pass/fail paths, id allocation, and every lint ruleshare/updated alongside the CLI🤖 Generated with Claude Code