akili-specs 2.5.1 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: Archive a completed spec task, sync agent guides and CodeGraph, and keep the TRD current.
2
+ description: Archive a completed spec task, run the Kaizen retrospective, sync agent guides and CodeGraph, and keep the TRD current.
3
3
  ---
4
4
 
5
5
  # Archive AKILI-SPECS Spec
@@ -8,7 +8,7 @@ Archive a completed AKILI-SPECS spec path after implementation, testing, and val
8
8
 
9
9
  Archiving preserves the full decision trail. It keeps active `docs/specs/` easier to scan while retaining proposal, requirements, design, tasks, execution notes, test evidence, and validation evidence for future review.
10
10
 
11
- > **Recommended model tier:** T5 Fast-Cheap. This is a format-following and file-moving job; a deep reasoning model is not required.
11
+ > **Recommended model tier:** T5 Fast-Cheap. This is a format-following and file-moving job; a deep reasoning model is not required. The Kaizen Learn sub-step (Step 4.2) is a judgment task — if convenient, run it on a T3 Auditor model; otherwise keep the whole command on T5 and keep lessons few.
12
12
 
13
13
  ## Usage
14
14
 
@@ -71,6 +71,10 @@ docs/specs/archive/2026-05-16-bugfix--login-redirect/
71
71
  - `execution.md` if present
72
72
  - `test-report.md` if present
73
73
  - `validation-report.md` if present
74
+ 4. Read Kaizen inputs (each only if it exists):
75
+ - `docs/specs/kaizen-log.md`
76
+ - `docs/specs/drift-report.md`
77
+ - `docs/specs/quick/quick-log.md` (only if this spec escalated from `/akili-quick`)
74
78
 
75
79
  ### Step 1: Check Archive Readiness
76
80
 
@@ -119,13 +123,35 @@ Before moving the folder, sync the project constitution with what the spec actua
119
123
  - Follow the inheritance convention from `/akili-constitution` Step 7 — if the project has no `## Module Guides` index yet, add it rather than inventing a parallel structure.
120
124
  3. **CodeGraph Refresh Hook:** Check if `.codegraph/` exists in the repository root. If it does, recommend that the user or environment runs a fresh CodeGraph indexing/update (e.g. running `codegraph index` or equivalent) so the graph reflects the new or reshaped modules.
121
125
 
122
- ### Step 4: Move Folder
126
+ ### Step 4: Kaizen Retrospective
127
+
128
+ Before moving the folder, **load the `kaizen` skill and follow its loop contract**: one bounded continuous-improvement pass over the completed spec — **Measure → Learn → Standardize → Record**. The pass reads only files already loaded in Step 0, produces at most 3 lessons and one log entry, and must never block the archive.
129
+
130
+ #### 4.1 — Measure
131
+
132
+ Extract the improvement signals listed in the skill's Measure table from the spec's own evidence: Reviewer FAIL rework attempts, HALTs and FATAL_FAILs, `## Pivot Record` blocks, PRODUCT_BUG findings, severe judgment-day findings, validation FAIL/WARN counts, `/akili-quick` escalations, and drift attributable to this spec.
133
+
134
+ If every signal is clean, record a one-line **clean run** entry in Step 4.4 and skip 4.2–4.3.
135
+
136
+ #### 4.2 — Learn
137
+
138
+ Distill **0 to 3** lessons following the skill's hard rules: every lesson names a root cause and cites its evidence (file + section); generic lessons are banned; prefer zero lessons over filler; a repeated root cause increments recurrence and raises severity instead of duplicating. Classify each lesson's target as **Product** (this project) or **Methodology** (the root cause is AKILI itself).
139
+
140
+ #### 4.3 — Standardize (HITL)
141
+
142
+ For each lesson, propose exactly one minimal edit (1–3 lines) to the most durable home (constitution guides, `docs/specs/general-setup/` templates, `docs/ux-ui/design.md`, or `.agents/` personas — append-only). Methodology lessons get no local edit; record them for upstreaming to the AKILI methodology repository. Present the skill's approval menu (Apply all / Apply selected / Defer all / Type something); recommend "Apply all" when any High-severity lesson exists, otherwise "Defer all". **Every edit outside the kaizen log requires this approval.**
143
+
144
+ #### 4.4 — Record
145
+
146
+ Create or update `docs/specs/kaizen-log.md` using the skill's Kaizen Log Format: prepend the new entry under `## Entries`, refresh `## Active Lessons` (10 rows max, retire institutionalized lessons).
147
+
148
+ ### Step 5: Move Folder
123
149
 
124
150
  1. Ensure `docs/specs/archive/` exists.
125
151
  2. Move `docs/specs/$ARGUMENTS/` to `docs/specs/archive/YYYY-MM-DD-$SAFE_NAME/`.
126
152
  3. If the target archive folder already exists, do not overwrite it. Add a numeric suffix such as `-2` and report the final path.
127
153
 
128
- ### Step 5: Report To User
154
+ ### Step 6: Report To User
129
155
 
130
156
  Present:
131
157
 
@@ -135,6 +161,7 @@ Present:
135
161
  4. unresolved follow-ups, if any
136
162
  5. whether the active spec directory is now clean
137
163
  6. constitution sync summary: guides created or updated, parent index entries touched, and whether a CodeGraph re-index is recommended
164
+ 7. Kaizen summary: metrics captured, lessons recorded (IDs), standardization actions applied or deferred, and any Methodology lessons suggested for upstreaming to the AKILI repo
138
165
 
139
166
  ## Error Handling
140
167
 
@@ -143,3 +170,5 @@ Present:
143
170
  - If validation has unresolved FAIL findings, recommend fixing or explicitly accepting risk before archive.
144
171
  - If moving the folder fails, leave the original folder in place and report the reason.
145
172
  - Do not delete spec folders as part of archiving; only move them into `docs/specs/archive/`.
173
+ - The Kaizen retrospective must never block the archive. If retrospective inputs are missing or the user declines, append a metrics-only (or clean-run) entry to `docs/specs/kaizen-log.md` and continue to Step 5.
174
+ - Never edit files outside `docs/specs/kaizen-log.md` without explicit user approval in Step 4.3.
@@ -75,6 +75,7 @@ The Leader does not write production code itself unless the rework loop is exhau
75
75
  - `docs/specs/$ARGUMENTS/design.md`
76
76
  - `docs/specs/$ARGUMENTS/tasks.md`
77
77
  3. Read `docs/specs/$ARGUMENTS/execution.md` if it exists.
78
+ - Also read `docs/specs/kaizen-log.md` if it exists — ONLY the `## Active Lessons` table (skip `## Entries`).
78
79
  4. Read the agent personas:
79
80
  - `.agents/leader.md`
80
81
  - `.agents/implementer.md`
@@ -133,6 +134,7 @@ Delegate to the Implementer with:
133
134
  - the project constitution references (`CLAUDE.md`, `AGENTS.md`, `docs/ux-ui/design.md`)
134
135
  - the recommended skill list from the task (e.g. `ui-ux-pro-max`, `react-doctor`, `nestjs-expert`)
135
136
  - any prior Reviewer feedback when this is a rework attempt
137
+ - any Active Lessons from `docs/specs/kaizen-log.md` relevant to the task's domain (pass only the matching rows, never the full log)
136
138
  - the verification command to run before reporting completion
137
139
 
138
140
  The Implementer must keep changes minimal and within task scope, follow the design spec exactly unless the spec is clearly incomplete or contradictory, and run the verification before reporting completion.
@@ -65,6 +65,7 @@ Do not create `requirements.md`, `design.md`, or `tasks.md` in this command unle
65
65
  - `docs/specs/general-setup/`
66
66
  - package-level `CLAUDE.md` files
67
67
  4. Read nearby or related specs under `docs/specs/`.
68
+ - Also read `docs/specs/kaizen-log.md` if it exists — ONLY the `## Active Lessons` table (skip `## Entries`).
68
69
  5. **CodeGraph over full reads:** If `.codegraph/` exists, use `codegraph_search` and `codegraph_context` to inspect relevant code paths instead of reading full source files or using generic `grep`/`glob`. This drastically reduces input tokens.
69
70
 
70
71
  ### Step 1: Classify Request Type & Route
@@ -143,6 +144,8 @@ Create a concise proposal with this structure:
143
144
  13. Success Criteria
144
145
  14. Next Step
145
146
 
147
+ If an Active Lesson from `docs/specs/kaizen-log.md` applies to this change's domain, reflect it in Scope or Risks and cite its ID (e.g. `KZ-003`).
148
+
146
149
  ### Visual Reference
147
150
 
148
151
  Capture whatever visual source backs this change so `/akili-specify` can convert it into requirements, design, and tasks. Use the state that applies:
@@ -78,6 +78,12 @@ If **multiple specs** are active, present a dashboard:
78
78
  Which spec do you want to resume? (or "all" for full briefing)
79
79
  ```
80
80
 
81
+ If `docs/specs/kaizen-log.md` exists, append a Kaizen footer line to either format, reading ONLY the `## Active Lessons` table:
82
+
83
+ ```markdown
84
+ Kaizen: 3 active lessons (latest: KZ-003 — empty-state tokens before list UI)
85
+ ```
86
+
81
87
  ### Step 3: Provide Full Briefing (if requested)
82
88
 
83
89
  If the user selects "all" or if there's only one spec, provide a detailed briefing for each:
@@ -74,6 +74,7 @@ When the spec is a **bug** — the proposal's Document Control says `Type: Bug`,
74
74
  - A generated mockup under `docs/specs/$ARGUMENTS/mockup/`, `.stitch/designs`, or a `.stitch/DESIGN.md` reference → read those artifacts (screens, HTML, design tokens) and use `stitch-design` to interpret them.
75
75
  - Any mockup produced during `/akili-propose` counts as visual design context for the `Design Impact` steps below, exactly like a Figma link.
76
76
  4. Read nearby or dependent specs under `docs/specs/` that overlap with the requested path.
77
+ - Also read `docs/specs/kaizen-log.md` if it exists — ONLY the `## Active Lessons` table (skip `## Entries`).
77
78
  5. Respect the repository's current package layout and naming conventions instead of assuming a fixed stack.
78
79
  6. **CodeGraph over full reads:** If `.codegraph/` exists, use `codegraph_search` and `codegraph_context` to inspect relevant code paths instead of reading full source files or using generic `grep`/`glob`. This drastically reduces input tokens.
79
80
 
@@ -189,7 +190,7 @@ Use additional technical skills as needed:
189
190
 
190
191
  #### Step 2.2 — Write
191
192
 
192
- Generate `design.md` using `docs/specs/general-setup/design.md` as the format source.
193
+ Generate `design.md` using `docs/specs/general-setup/design.md` as the format source. Apply relevant Active Lessons from `docs/specs/kaizen-log.md` and cite the lesson ID next to the design decision it shaped.
193
194
 
194
195
  Minimum content:
195
196
 
@@ -0,0 +1,155 @@
1
+ ---
2
+ name: kaizen
3
+ description: "Trigger: kaizen, retrospective, continuous improvement, mejora continua, /akili-archive Kaizen step. Run the bounded Kaizen retrospective: Measure → Learn → Standardize → Record."
4
+ license: MIT
5
+ metadata:
6
+ author: Juan Carlos Cadavid — jcadavid.com
7
+ version: "1.0"
8
+ inspired-by: "Kaizen Institute glossary (kaizen.com), 'El Método Kaizen' (small-steps approach, Robert Maurer), 'Emprendiendo Kaizen' (INTI, 2019, ISBN 978-950-532-415-6)"
9
+ ---
10
+
11
+ # Kaizen — The AKILI Continuous-Improvement Skill
12
+
13
+ Kaizen (改善, *kai* = change, *zen* = better) is the Japanese philosophy of continuous improvement through small, disciplined, daily steps. This skill turns that philosophy into an executable retrospective for AI-assisted development: every archived spec must leave the project — and the methodology itself — slightly better than it found them.
14
+
15
+ > Other methodologies execute specs. AKILI learns from every spec.
16
+
17
+ ## Activation Contract
18
+
19
+ Load this skill when:
20
+
21
+ - `/akili-archive` reaches its **Kaizen Retrospective** step (the primary, automatic trigger), or
22
+ - the user explicitly requests a kaizen retrospective / continuous-improvement pass over a spec or project.
23
+
24
+ The retrospective is **bounded**: one pass, at most 3 lessons, one log entry. It must never block the archive or any other command that invoked it.
25
+
26
+ ## Philosophy → Engineering Mapping
27
+
28
+ Each Kaizen concept maps to a concrete AKILI mechanism. Use this vocabulary in reports so the improvement culture stays visible.
29
+
30
+ | Concept | Meaning | In AKILI |
31
+ |---|---|---|
32
+ | **Kai + Zen** | Small changes that make things better, every day, forever | Every `/akili-archive` is an improvement opportunity; the loop never "finishes" |
33
+ | **Small steps** (Maurer) | Improvements so small they cannot fail or trigger resistance | Standardization edits are 1–3 lines; never rewrite a document to institutionalize a lesson |
34
+ | **Small questions** (Maurer) | Gentle questions unlock root causes better than big alarming ones | Learn step asks: *"What is the smallest rule that would have prevented this rework?"* |
35
+ | **PDCA** (Deming) | Plan → Do → Check → Act | Plan = the spec; Do = execute/test; Check = validate + **Measure**; Act = **Standardize**. The retrospective closes the cycle the pipeline opened |
36
+ | **MUDA** | Waste: any activity that adds no value | Rework attempts (defects), pivots (planning waste), token waste (oversized context, re-reading), stale docs (drift = inventory waste), quick-escalations (misrouted work). **Measure = hunt MUDA** |
37
+ | **Jidoka** | Stop the line the moment a defect appears | AKILI already practices it: the Tester keeps a test red on `PRODUCT_BUG`; the harness HALTs on `FATAL_FAIL`. Name it in reports — the methodology owns this concept |
38
+ | **Gemba / 3 GEN** | Real place, real thing, real facts — never speculate | Every lesson must cite evidence from the actual artifacts (`execution.md`, `test-report.md`, `validation-report.md`); use **5W1H** to reach root cause |
39
+ | **LUP** (one-point lesson) | One lesson, one page, instantly teachable | The `## Active Lessons` digest row: one lesson, one line, one owner document |
40
+ | **Standardize & repeat** | A fix becomes a standard, then the next improvement begins | Applied lessons live in constitution guides/templates; the digest retires them once institutionalized |
41
+
42
+ ## The Loop Contract
43
+
44
+ Run the four phases in order. Read only artifacts already loaded by the invoking command.
45
+
46
+ ### 1. Measure
47
+
48
+ Extract improvement signals from the spec's own evidence:
49
+
50
+ | Signal | Source |
51
+ |---|---|
52
+ | Reviewer FAIL rework attempts, HALTs, FATAL_FAILs | `execution.md` task entries |
53
+ | Pivots | `execution.md` `## Pivot Record` blocks |
54
+ | PRODUCT_BUG findings | `test-report.md` |
55
+ | Severe judgment-day findings | `design.md` / specify review notes, if recorded |
56
+ | Validation FAIL / WARN counts | `validation-report.md` |
57
+ | Escalations from `/akili-quick` into this spec | `docs/specs/quick/quick-log.md`, if applicable |
58
+ | Drift attributable to this spec | `docs/specs/drift-report.md`, if present |
59
+
60
+ If every signal is clean (zero rework, no pivots, no product bugs, no severe findings), record a one-line **clean run** entry in phase 4 and skip phases 2–3. A clean spec teaches nothing new — say so.
61
+
62
+ ### 2. Learn
63
+
64
+ Distill **0 to 3** lessons. Hard rules:
65
+
66
+ - Every lesson names a **root cause** (apply 5W1H) and cites its evidence — file + section, e.g. `execution.md — Task 4, attempts 1–2 (Violated Rule: design.md#tokens)`. Gemba: real facts only.
67
+ - Generic lessons are banned ("write better tests", "be more careful"). A lesson must change what a future command concretely does.
68
+ - Prefer **zero lessons** over filler.
69
+ - If the same root cause already exists in `## Active Lessons`, do not duplicate it — increment its recurrence note and raise its severity (a repeat is a strong standardization signal).
70
+ - Classify each lesson's **target**:
71
+ - **Product** (default): the root cause lives in this project — its guides, templates, design tokens, or personas.
72
+ - **Methodology**: the root cause is AKILI itself — an ambiguous command step, a template gap, a missing skill. These lessons make the methodology learn from every tool built with it.
73
+
74
+ ### 3. Standardize (HITL)
75
+
76
+ For each lesson, propose **exactly one** minimal edit (1–3 lines) targeting the most durable home:
77
+
78
+ - root `CLAUDE.md` / `AGENTS.md` (or a child module guide) — behavioral rules
79
+ - `docs/specs/general-setup/` templates — spec-authoring rules
80
+ - `docs/ux-ui/design.md` — missing tokens or visual rules
81
+ - `.agents/` personas — harness-role rules (append-only, never rewrite)
82
+ - **Methodology lessons:** no local edit — record the proposal in the log and recommend upstreaming it to the AKILI methodology repository.
83
+
84
+ Assign a severity: **High** = caused a HALT, pivot, or PRODUCT_BUG; **Medium** = caused rework or a severe finding; **Low** = friction only. Then present the menu:
85
+
86
+ 1. **Apply all** (make every proposed edit now)
87
+ 2. **Apply selected** (user picks by lesson ID)
88
+ 3. **Defer all** (record proposals in the log; apply in a later spec)
89
+ 4. **Type something** (adjust a proposal before applying)
90
+
91
+ Recommend option 1 when any High-severity lesson exists, otherwise option 3. Appending to the kaizen log is automatic; **every edit outside the log requires this approval**.
92
+
93
+ ### 4. Record
94
+
95
+ Create or update `docs/specs/kaizen-log.md` (it lives outside spec folders so it survives archiving):
96
+
97
+ 1. If the file does not exist, create it with the header and both sections from the format below.
98
+ 2. Prepend the new entry under `## Entries` (newest first).
99
+ 3. Refresh `## Active Lessons`: add new lessons; keep the table at **10 rows or fewer**; retire lessons whose rule now lives in the constitution or templates (mark `Retired` — the guide carries the rule from now on).
100
+
101
+ ## Kaizen Log Format
102
+
103
+ ```markdown
104
+ # Kaizen Log
105
+
106
+ Continuous-improvement record for this project, updated automatically by
107
+ `/akili-archive` (Kaizen Retrospective, powered by the `kaizen` skill).
108
+ Other AKILI commands read only the `## Active Lessons` table below —
109
+ keep it at 10 rows or fewer.
110
+
111
+ ## Active Lessons
112
+
113
+ | ID | Lesson | Source Spec | Severity | Target | Standardized In | Status |
114
+ |---|---|---|---|---|---|---|
115
+ | KZ-003 | Define empty-state design tokens before any UI task that renders lists | changes/add-remember-me | Medium | Product | docs/specs/general-setup/design.md | Applied |
116
+ | KZ-002 | DTO boundary validations must be written as `AND IT MUST` constraints in requirements, never left implicit | bugfix/login-redirect | High | Product | docs/specs/general-setup/requirements.md | Applied |
117
+
118
+ ## Entries
119
+
120
+ ### 2026-07-20 — changes/add-remember-me
121
+
122
+ **Metrics**
123
+
124
+ | Signal | Value | Source |
125
+ |---|---|---|
126
+ | Tasks executed | 8 | tasks.md |
127
+ | Reviewer FAIL rework attempts | 3 (Task 4 x2, Task 7 x1) | execution.md |
128
+ | HALTs / FATAL_FAILs | 0 | execution.md |
129
+ | Pivots | 1 (Task 5 — storage approach) | execution.md — ## Pivot Record: Task 5 |
130
+ | PRODUCT_BUGs | 1 (resolved) | test-report.md |
131
+ | Judgment-day severe findings | 2 | design.md review notes |
132
+ | Validation FAIL / WARN | 0 / 2 | validation-report.md |
133
+
134
+ **Lessons**
135
+
136
+ - **KZ-003 — Empty-state tokens were missing from the design phase.** (Product, Medium)
137
+ - Root cause: `design.md` specified list components without empty-state tokens, so the
138
+ Implementer improvised styles and the Reviewer failed Task 4 twice on token compliance.
139
+ - Evidence: execution.md — Task 4, attempts 1–2 (Violated Rule: design.md#tokens).
140
+ - Standardization: add an empty-state token check to the Design Impact checklist in
141
+ `docs/specs/general-setup/design.md`. → **Applied 2026-07-20 (user-approved)**
142
+
143
+ ### 2026-07-19 — bugfix/session-refresh — clean run
144
+
145
+ No rework, pivots, product bugs, or severe findings. No lessons recorded.
146
+ ```
147
+
148
+ ## Hard Rules
149
+
150
+ - **Never block the archive** (or any invoking command). Missing inputs or a declined menu → append a metrics-only or clean-run entry and continue.
151
+ - **Never edit files outside `docs/specs/kaizen-log.md` without explicit HITL approval** in phase 3.
152
+ - Digest capped at **10 Active Lessons**; retire institutionalized lessons instead of letting the table grow.
153
+ - At most **3 lessons per retrospective**; prefer zero over filler.
154
+ - Standardization edits are **1–3 lines**; never rewrite whole documents.
155
+ - Consumers (`/akili-propose`, `/akili-specify`, `/akili-execute`, `/akili-resume`) read **only** the `## Active Lessons` digest, never `## Entries`.
package/CHANGELOG.md CHANGED
@@ -10,6 +10,12 @@ The format is inspired by Keep a Changelog and the repository follows semantic v
10
10
 
11
11
  - No unreleased changes yet.
12
12
 
13
+ ## [2.6.0] - 2026-07-20
14
+
15
+ ### Added
16
+ - **The Kaizen Loop in `/akili-archive`:** every archive now runs a bounded continuous-improvement retrospective — **Measure** (rework attempts, pivots, PRODUCT_BUGs, severe judgment-day findings, validation WARN/FAIL, drift) → **Learn** (0–3 root-cause lessons with cited evidence; generic lessons banned) → **Standardize** (minimal 1–3 line edits to constitution guides, general-setup templates, design tokens, or `.agents/` personas — always HITL-approved) → **Record** (append to the new accumulative `docs/specs/kaizen-log.md`, with a capped `## Active Lessons` digest). No new command: Kaizen is a step inside `/akili-archive` and never blocks archiving. Lessons target the **Product** or the **Methodology** itself (flagged for upstreaming to this repo).
17
+ - **New packaged `kaizen` skill** (`.claude/skills/kaizen/SKILL.md`), authored by Juan Carlos Cadavid — jcadavid.com, inspired by the Kaizen Institute glossary, Robert Maurer's small-steps method, and INTI's *Emprendiendo Kaizen* (2019). It encodes the philosophy-to-engineering mapping (PDCA, MUDA, Jidoka, Gemba/3 GEN, 5W1H, LUP), the loop contract, and the kaizen-log format.
18
+ - **Kaizen-aware commands:** `/akili-propose`, `/akili-specify`, and `/akili-execute` read the `## Active Lessons` digest so past mistakes shape new specs and task delegation; `/akili-resume` shows the active-lesson count in its dashboard.
13
19
  ## [2.5.1] - 2026-07-19
14
20
 
15
21
  ### Added
package/README.md CHANGED
@@ -11,9 +11,9 @@
11
11
 
12
12
  # AKILI
13
13
 
14
- ### Supercharge Claude Code, OpenCode, and Google Antigravity with constitution-first spec intelligence
14
+ ### Supercharge Claude Code, OpenCode, and Google Antigravity with constitution-first, self-improving spec intelligence
15
15
 
16
- **Durable product context · traceable requirements · governed releases · 100% local methodology files**
16
+ **Durable product context · traceable requirements · governed releases · a methodology that learns from every spec · 100% local methodology files**
17
17
 
18
18
  <p>
19
19
  <a href="https://www.npmjs.com/package/akili-specs"><img alt="npm version" src="https://img.shields.io/npm/v/akili-specs?style=for-the-badge&label=npm"></a>
@@ -507,7 +507,7 @@ See the full [Command Reference](docs/commands/README.md) for detailed pages per
507
507
  | `/akili-execute <spec-path>` | Implementing approved tasks via the Leader → Implementer → Reviewer harness | Code changes, updated `tasks.md`, `execution.md` with full PASS/FAIL audit trail |
508
508
  | `/akili-test <spec-path>` | Adding or running test evidence | `test-report.md` with requirement-to-test traceability |
509
509
  | `/akili-validate <spec-path>` | Checking implementation against the spec | `validation-report.md` with pass, warning, failure, and remediation items |
510
- | `/akili-archive <spec-path>` | Closing completed work after validation | Archived spec folder under `docs/specs/archive/` with `archive-summary.md`, synced agent guides, CodeGraph re-index reminder |
510
+ | `/akili-archive <spec-path>` | Closing completed work after validation | Archived spec folder under `docs/specs/archive/` with `archive-summary.md`, Kaizen retrospective appended to `docs/specs/kaizen-log.md`, synced agent guides, CodeGraph re-index reminder |
511
511
  | `/akili-audit` | Detecting drift between specs and codebase reality | `docs/specs/drift-report.md` with conformance score and discrepancy matrix |
512
512
  | `/akili-resume` | Resuming work after a session break | Multi-spec dashboard with phase, progress, and next command recommendation |
513
513
  | `/akili-seo <site-domain>` | Auditing deployed SEO and Search Console state | `seo-setup-report.md`, `seo-audit-report.md` |
@@ -539,6 +539,30 @@ Lite mode does not skip rigor. It keeps the documents short, but every requireme
539
539
  | Task | A small executable unit linked to requirements and design sections |
540
540
  | Report | Evidence that the implementation was tested and validated |
541
541
  | Archive | Completed AKILI-SPECS history moved under `docs/specs/archive/` |
542
+ | Kaizen | The continuous-improvement loop that turns each spec's evidence into lessons and standards |
543
+
544
+ ## The Kaizen Loop
545
+
546
+ Other methodologies execute specs. **AKILI learns from every spec.**
547
+
548
+ AKILI embeds the Japanese Kaizen philosophy of continuous improvement (改善 — *kai* change, *zen* better) as an executable step, powered by the packaged `kaizen` skill (authored by [Juan Carlos Cadavid](https://jcadavid.com), inspired by the Kaizen Institute glossary, Robert Maurer's small-steps method, and INTI's *Emprendiendo Kaizen*). Every `/akili-archive` automatically runs a bounded retrospective — no extra command, no extra ceremony:
549
+
550
+ ```text
551
+ ┌─────────┐ ┌─────────┐ ┌──────────────┐ ┌──────────┐
552
+ │ MEASURE │ ─▶ │ LEARN │ ─▶ │ STANDARDIZE │ ─▶ │ REPEAT │
553
+ │ rework, │ │ 0–3 root│ │ constitution │ │ next spec│
554
+ │ pivots, │ │ -cause │ │ templates, │ │ reads the│
555
+ │ bugs │ │ lessons │ │ guides (HITL)│ │ lessons │
556
+ └─────────┘ └─────────┘ └──────────────┘ └──────────┘
557
+ every /akili-archive · logged in docs/specs/kaizen-log.md
558
+ ```
559
+
560
+ - **Measure:** hunt MUDA (waste) in the spec's own evidence — Reviewer rework attempts, pivots, PRODUCT_BUGs, severe judgment-day findings, validation warnings, drift.
561
+ - **Learn:** distill 0–3 lessons with a named root cause and cited evidence (Gemba: real facts, never speculation). Generic lessons are banned.
562
+ - **Standardize:** propose 1–3 line edits to constitution guides, spec templates, design tokens, or agent personas — always human-approved. Small steps, never rewrites.
563
+ - **Record:** append to the accumulative `docs/specs/kaizen-log.md`; a capped `## Active Lessons` digest is then read by `/akili-propose`, `/akili-specify`, and `/akili-execute` so past mistakes shape new work, and shown by `/akili-resume`.
564
+
565
+ The loop improves on two levels: **Product** lessons harden the project you are building, while **Methodology** lessons (root causes in AKILI itself) are flagged for upstreaming — so the methodology learns from every tool built with it. This is the meaning behind the name: *akili* is Swahili for intelligence, and intelligence that does not learn is not intelligence.
542
566
 
543
567
  ## Spec Folder Shape
544
568
 
@@ -729,7 +753,7 @@ Fallback rule:
729
753
  - `/akili-execute` orchestrates a Leader → Implementer → Reviewer rework loop (max 3 retries) to implement tasks from an approved spec path.
730
754
  - `/akili-test` runs a Leader → Tester(s) harness: the Leader partitions testing into suites and delegates each to a Tester subagent (inline for trivial/Lite work; one Tester per independent suite, in parallel, otherwise). It validates requirement-to-test traceability, explicitly checking for negative constraints and strict boundaries.
731
755
  - `/akili-validate` audits implementation conformance against the spec (including rigorous boundary validations) and constitutional baseline.
732
- - `/akili-archive` preserves completed specs under `docs/specs/archive/` after validation, syncs agent guides (child `CLAUDE.md`/`AGENTS.md` + the parent `## Module Guides` index) from the spec's `## Constitution Impact` notes, and recommends a CodeGraph re-index.
756
+ - `/akili-archive` preserves completed specs under `docs/specs/archive/` after validation, runs the Kaizen retrospective (measure → learn → standardize → record) appending to `docs/specs/kaizen-log.md`, syncs agent guides (child `CLAUDE.md`/`AGENTS.md` + the parent `## Module Guides` index) from the spec's `## Constitution Impact` notes, and recommends a CodeGraph re-index.
733
757
  - `/akili-seo` operates outside the main spec lifecycle: it provisions Google Search Console ownership for a domain and produces a standalone SEO audit under `docs/specs/seo/<domain>/`. Run it any time after deployment; rerun after major content or schema changes.
734
758
 
735
759
  ## Multi-Agent Harness Engineering
package/docs/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # AKILI Documentation
2
2
 
3
- AKILI is the documented form of the AKILI-SPECS methodology: a constitution-first, spec-driven workflow for Claude Code and OpenCode.
3
+ AKILI is the documented form of the AKILI-SPECS methodology: a constitution-first, self-improving spec-driven workflow for Claude Code and OpenCode.
4
4
 
5
5
  Use this documentation when you want the human-facing reference. The installable source prompts and skills remain under `.claude/commands/` and `.claude/skills/`.
6
6
 
@@ -26,6 +26,8 @@ Use this documentation when you want the human-facing reference. The installable
26
26
  /akili-archive <spec-path>
27
27
  ```
28
28
 
29
+ Every `/akili-archive` closes with the **Kaizen Loop** — a bounded retrospective (Measure → Learn → Standardize → Record, via the packaged `kaizen` skill) that appends lessons to `docs/specs/kaizen-log.md` so the next spec starts smarter. See [flow.md](flow.md#8-the-kaizen-loop).
30
+
29
31
  Use `/akili-resume` at the start of any session to see a dashboard of all active specs and where each one stands.
30
32
 
31
33
  Use `/akili-audit` independently to detect drift between specs and codebase reality at any time.
@@ -13,7 +13,7 @@ AKILI commands are installed as slash-command prompts for Claude Code and OpenCo
13
13
  | [`/akili-execute <spec-path>`](akili-execute.md) | Implementing approved tasks via the Leader → Implementer → Reviewer harness | Code/docs changes, updated `tasks.md`, `execution.md` with full PASS/FAIL audit trail |
14
14
  | [`/akili-test <spec-path>`](akili-test.md) | Proving behavior with test evidence via the Leader → Tester(s) harness | `test-report.md` |
15
15
  | [`/akili-validate <spec-path>`](akili-validate.md) | Auditing conformance before completion | `validation-report.md` |
16
- | [`/akili-archive <spec-path>`](akili-archive.md) | Closing completed work after validation | Archived spec folder with `archive-summary.md` |
16
+ | [`/akili-archive <spec-path>`](akili-archive.md) | Closing completed work after validation | Archived spec folder with `archive-summary.md` + Kaizen retrospective entry in `docs/specs/kaizen-log.md` |
17
17
  | [`/akili-audit`](akili-audit.md) | Detecting drift between specs and codebase reality | `docs/specs/drift-report.md` with conformance score and discrepancy matrix |
18
18
  | [`/akili-resume`](akili-resume.md) | Resuming work after a session break | Multi-spec dashboard with phase, progress, and next command recommendation |
19
19
  | [`/akili-seo <site-domain>`](akili-seo.md) | Setting up GSC ownership and SEO audit evidence | `seo-setup-report.md`, `seo-audit-report.md` |
@@ -1,6 +1,6 @@
1
1
  # `/akili-archive`
2
2
 
3
- Move a completed spec into historical archive after implementation, testing, and validation.
3
+ Move a completed spec into historical archive after implementation, testing, and validation, running the Kaizen retrospective along the way.
4
4
 
5
5
  ## Usage
6
6
 
@@ -58,8 +58,20 @@ Before moving the folder, the command consumes the `## Constitution Impact` note
58
58
  - updates root-guide statements the change made stale
59
59
  - recommends a CodeGraph re-index when `.codegraph/` exists
60
60
 
61
+ ## Kaizen Retrospective
62
+
63
+ Before moving the folder, the command loads the packaged `kaizen` skill and runs one bounded continuous-improvement pass — **Measure → Learn → Standardize → Record**:
64
+
65
+ - **Measure:** extracts improvement signals from the spec's evidence (Reviewer rework attempts, pivots, PRODUCT_BUGs, severe judgment-day findings, validation WARN/FAIL, quick escalations, drift).
66
+ - **Learn:** distills 0–3 lessons, each with a named root cause and cited evidence; generic lessons are banned. Lessons target the **Product** or the **Methodology** (flagged for upstreaming to the AKILI repo).
67
+ - **Standardize:** proposes 1–3 line edits to constitution guides, `general-setup` templates, design tokens, or `.agents/` personas via an approval menu. Every edit outside the kaizen log requires approval.
68
+ - **Record:** appends the entry to the accumulative `docs/specs/kaizen-log.md` and refreshes its `## Active Lessons` digest (10 rows max), which `/akili-propose`, `/akili-specify`, `/akili-execute`, and `/akili-resume` read.
69
+
70
+ A clean spec records a one-line clean-run entry. The retrospective never blocks the archive.
71
+
61
72
  ## Guardrails
62
73
 
63
74
  - Do not delete completed specs.
64
75
  - Do not overwrite an existing archive folder.
65
76
  - If archive readiness is unclear, ask whether to validate first, proceed with accepted risk, or keep the spec active.
77
+ - The Kaizen retrospective never blocks the archive and never edits files outside `docs/specs/kaizen-log.md` without approval.
@@ -23,6 +23,7 @@ Reads:
23
23
  - `docs/specs/<spec-path>/design.md`
24
24
  - `docs/specs/<spec-path>/tasks.md`
25
25
  - `docs/specs/<spec-path>/execution.md` when present
26
+ - `docs/specs/kaizen-log.md` when present — only the `## Active Lessons` digest; the Leader passes matching rows to the Implementer per task
26
27
  - Constitution docs (`docs/prd.md`, `docs/ux-ui/design.md`, `docs/trd/trd.md`)
27
28
  - `CLAUDE.md` and `AGENTS.md`
28
29
  - `.agents/leader.md`, `.agents/implementer.md`, `.agents/reviewer.md`
@@ -53,6 +53,8 @@ Creates or updates:
53
53
  docs/specs/<spec-path>/proposal.md
54
54
  ```
55
55
 
56
+ If `docs/specs/kaizen-log.md` exists, the command reads its `## Active Lessons` digest and reflects applicable lessons in the proposal's Scope or Risks, citing their IDs (e.g. `KZ-003`).
57
+
56
58
  ## Proposal Sections
57
59
 
58
60
  - Document Control (records `Type: Bug | Change | Trivial`)
@@ -23,7 +23,7 @@ The command performs a four-step scan:
23
23
 
24
24
  1. **Scan Active Specs** — lists all directories under `docs/specs/` (excluding `archive/`)
25
25
  2. **Determine Phase & Progress** — for each spec, identifies current phase (PROPOSE → SPECIFY → EXECUTE → TEST → VALIDATE → ARCHIVE), task progress, last action, and blockers
26
- 3. **Present Dashboard** — shows a visual dashboard with progress bars and status for each active spec
26
+ 3. **Present Dashboard** — shows a visual dashboard with progress bars and status for each active spec; if `docs/specs/kaizen-log.md` exists, appends a Kaizen footer line with the active-lesson count and the latest lesson (read from the `## Active Lessons` digest only)
27
27
  4. **Recommend Next Command** — suggests the next command based on current phase
28
28
 
29
29
  ## Output
@@ -32,6 +32,7 @@ Reads context from:
32
32
  - `docs/ux-ui/design.md`
33
33
  - `docs/trd/trd.md`
34
34
  - related specs under `docs/specs/`
35
+ - `docs/specs/kaizen-log.md` when present — only the `## Active Lessons` digest; relevant lessons are applied and cited by ID in design decisions
35
36
  - root and package-level agent guidance files
36
37
 
37
38
  ## Outputs
package/docs/flow.md CHANGED
@@ -54,7 +54,7 @@ You: /akili-validate changes/add-remember-me
54
54
  AI: Creates validation-report.md with PASS/WARN/FAIL/BLOCKED findings
55
55
 
56
56
  You: /akili-archive changes/add-remember-me
57
- AI: Moves completed work into docs/specs/archive/ and refreshes CodeGraph
57
+ AI: Runs the Kaizen retrospective (appends docs/specs/kaizen-log.md), moves completed work into docs/specs/archive/, and refreshes CodeGraph
58
58
 
59
59
  Independent Auditing:
60
60
  You: /akili-audit
@@ -128,6 +128,7 @@ For Legacy and Active-AKILI-SPECS modes, CodeGraph is preferred when `.codegraph
128
128
  | `docs/specs/<spec-path>/test-report.md` | `/akili-test` | Requirement-to-test matrix and coverage gaps |
129
129
  | `docs/specs/<spec-path>/validation-report.md` | `/akili-validate` | Final conformance audit |
130
130
  | `docs/specs/drift-report.md` | `/akili-audit` | Conformance auditing of documentation vs. codebase reality |
131
+ | `docs/specs/kaizen-log.md` | `/akili-archive` | Accumulated metrics and root-cause lessons; the `## Active Lessons` digest is read by `/akili-propose`, `/akili-specify`, `/akili-execute`, and `/akili-resume` |
131
132
  | `docs/specs/archive/.../archive-summary.md` | `/akili-archive` | Historical closure record |
132
133
 
133
134
  ## Review Gates
@@ -144,7 +145,7 @@ AKILI keeps humans in control at each important transition.
144
145
  | Execution | Each completed task has verification evidence |
145
146
  | Testing | Key requirements have automated or accepted manual evidence |
146
147
  | Validation | No unresolved FAIL findings remain |
147
- | Archive | Warnings and follow-ups are accepted |
148
+ | Archive | Warnings and follow-ups are accepted; Kaizen lessons are recorded and standardizations approved or deferred |
148
149
 
149
150
  ## Documentation Depth
150
151
 
@@ -307,3 +308,22 @@ OpenCode). `/akili-constitution` (Step 7C) scaffolds a `## Model Routing` copy o
307
308
  the project's `AGENTS.md` / `CLAUDE.md`. It is **guidance only** — no `model:` frontmatter, no
308
309
  installer changes — and it enforces **author ≠ auditor** (Reviewer model ≠ Implementer model). See
309
310
  [model-routing.md](model-routing.md) for the tiers, principles, and the default registry.
311
+
312
+ ### 8. The Kaizen Loop
313
+
314
+ AKILI embeds Kaizen — continuous improvement through small, disciplined steps — as an executable
315
+ retrospective inside `/akili-archive`, powered by the packaged `kaizen` skill (authored by
316
+ Juan Carlos Cadavid — jcadavid.com). Every archive runs one bounded pass:
317
+
318
+ * **Measure:** hunt waste (MUDA) in the spec's own evidence — Reviewer rework attempts, pivots,
319
+ PRODUCT_BUGs, severe judgment-day findings, validation WARN/FAIL, drift.
320
+ * **Learn:** distill 0–3 lessons, each with a named root cause and cited evidence. Generic lessons
321
+ are banned; a clean spec records a one-line clean-run entry instead.
322
+ * **Standardize:** propose 1–3 line edits to constitution guides, `general-setup` templates, design
323
+ tokens, or `.agents/` personas. **Every edit outside the kaizen log requires human approval.**
324
+ * **Record:** append to the accumulative `docs/specs/kaizen-log.md`. Its capped `## Active Lessons`
325
+ digest (10 rows max) is the only part other commands read.
326
+
327
+ Lessons target either the **Product** (this project) or the **Methodology** itself — Methodology
328
+ lessons are flagged for upstreaming to the AKILI repository, so the methodology learns from every
329
+ tool built with it. The retrospective never blocks the archive.
@@ -65,7 +65,7 @@ the suites, and a Tester ideally runs on a different model than the Implementer
65
65
  | `/akili-test` → **Tester(s)** | T2 | Test authoring + verification per suite. Prefer a different model than the Implementer (author ≠ tester). |
66
66
  | `/akili-validate` | T3 | Deep conformance audit. |
67
67
  | `/akili-audit` | T4 + T3 | Drift detection over large context, judged critically. |
68
- | `/akili-archive` | T5 | Cheap, fast summarization of closed work. |
68
+ | `/akili-archive` | T5 | Cheap, fast summarization of closed work. (Kaizen Learn sub-step: T3 optional.) |
69
69
  | `/akili-seo` | T3 + T5 | Audit findings (T3) plus setup/formatting steps (T5). |
70
70
 
71
71
  **author ≠ auditor enforcement.** In the registry, T2 (Coder) and T3 (Auditor) must resolve to
@@ -27,6 +27,7 @@ This repository borrows useful documentation and workflow ideas from OpenSpec wh
27
27
  | Existing projects | Brownfield-friendly workflow | Explicit existing-project constitution mode with optional CodeGraph analysis |
28
28
  | Validation | Workflow validation through commands | Dedicated `/akili-test` and `/akili-validate` reports before archive |
29
29
  | SEO | Not a core workflow in OpenSpec | `/akili-seo` handles Google Search Console setup and audits |
30
+ | Continuous improvement | Not a core workflow in OpenSpec | The Kaizen Loop: `/akili-archive` runs a bounded retrospective and later commands read the accumulated `## Active Lessons` digest |
30
31
  | Package target | `@fission-ai/openspec` | `akili-specs` |
31
32
 
32
33
  ## Practical Takeaway
@@ -22,6 +22,7 @@ The installable source files live in `.claude/skills/*/SKILL.md`. These pages ar
22
22
  | [`gsap-scrolltrigger`](gsap-scrolltrigger.md) | Scroll-driven animation, pinning, scrub, parallax | `/akili-specify`, `/akili-execute` |
23
23
  | [`gsap-timeline`](gsap-timeline.md) | Sequenced animations and playback control | `/akili-specify`, `/akili-execute` |
24
24
  | [`gsap-utils`](gsap-utils.md) | GSAP utilities such as clamp, mapRange, random, snap, wrap | `/akili-execute` |
25
+ | [`kaizen`](kaizen.md) | Bounded continuous-improvement retrospective (Measure → Learn → Standardize → Record); authored by Juan Carlos Cadavid — jcadavid.com | `/akili-archive` |
25
26
  | [`nestjs-expert`](nestjs-expert.md) | NestJS modules, DI, guards, interceptors, testing, TypeORM/Mongoose | `/akili-specify`, `/akili-execute`, `/akili-test`, `/akili-validate` |
26
27
  | [`product-manager-toolkit`](product-manager-toolkit.md) | Product discovery, PRDs, prioritization, customer interview analysis | `/akili-constitution`, `/akili-propose`, `/akili-specify` |
27
28
  | [`react-doctor`](react-doctor.md) | React diagnostics after changes | `/akili-test`, `/akili-validate` |
@@ -0,0 +1,30 @@
1
+ # `kaizen`
2
+
3
+ **Author:** Juan Carlos Cadavid — [jcadavid.com](https://jcadavid.com)
4
+
5
+ ## Purpose
6
+
7
+ Turns the Japanese Kaizen philosophy of continuous improvement into an executable, bounded retrospective: **Measure → Learn → Standardize → Record**. Every archived spec leaves the project — and the methodology itself — slightly better than it found them. Inspired by the Kaizen Institute glossary (kaizen.com), Robert Maurer's small-steps method, and INTI's *Emprendiendo Kaizen* (2019).
8
+
9
+ ## Use When
10
+
11
+ - `/akili-archive` reaches its **Kaizen Retrospective** step (the primary, automatic trigger).
12
+ - The user explicitly requests a kaizen retrospective or continuous-improvement pass over a spec or project.
13
+
14
+ ## Core Rules
15
+
16
+ - **Measure** hunts MUDA (waste) in the spec's own evidence: Reviewer rework attempts, pivots, PRODUCT_BUGs, severe judgment-day findings, validation WARN/FAIL, quick escalations, drift.
17
+ - **Learn** distills 0–3 lessons; each names a root cause (5W1H) and cites evidence (Gemba: real facts, never speculation). Generic lessons are banned; prefer zero over filler. Lessons target the **Product** or the **Methodology** (flagged for upstreaming to the AKILI repo).
18
+ - **Standardize** proposes one minimal edit (1–3 lines) per lesson to the most durable home; every edit outside the kaizen log requires human approval via a numbered menu.
19
+ - **Record** appends to the accumulative `docs/specs/kaizen-log.md`; the `## Active Lessons` digest is capped at 10 rows and institutionalized lessons are retired.
20
+ - The retrospective **never blocks the archive** — missing inputs or a declined menu produce a metrics-only or clean-run entry.
21
+
22
+ ## Best Paired Commands
23
+
24
+ - `/akili-archive` — runs the retrospective automatically as its Kaizen Retrospective step.
25
+ - `/akili-propose`, `/akili-specify`, `/akili-execute` — read the `## Active Lessons` digest so past mistakes shape new work.
26
+ - `/akili-resume` — shows the active-lesson count in the dashboard.
27
+
28
+ ## Source
29
+
30
+ - `../../.claude/skills/kaizen/SKILL.md`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akili-specs",
3
- "version": "2.5.1",
3
+ "version": "2.6.0",
4
4
  "description": "Portable AKILI-SPECS methodology commands and skills for AI-assisted development.",
5
5
  "homepage": "https://github.com/JuankCadavid/akili-specs#readme",
6
6
  "repository": {