--- name: change-boot description: Use when past-change rationale matters (refactoring unfamiliar code, revert or hotfix analysis, issue-linked commit archaeology, session authors git changes with human-authored messages) — injects the published ChDR index (docs/adlc/memory/chdr.md, legacy .adlc/memory/chdr.md fallback) as session context; pairs history mining (/change-init) with routine capture (direct-write drafts clarified via /change-clarify); invoked from team-boot's Class Boots catalog. --- # change-boot ## Overview One of the five **class boots** surfaced by `team-boot`'s Class Boots catalog. `team-boot` injects the always-relevant team context (constitution, CDR index, skills registry) at session start; this skill loads the **change history layer** on demand — the published ChDR index mined from git history — and pairs it with decision capture so change rationale is recovered (`/change-init`) rather than living only in commit messages. Reading past rationale and recording new rationale are one loop: published ChDRs explain why the code looks the way it does; rationale discovered during the work flows back into the same record system. ## When to Use Invoke at the START of a matching task — before planning the todo list and before implementation — so the ChDR context informs planning. Never defer to session end. Invoke when: - Refactoring or modifying unfamiliar code — check whether a ChDR explains the current shape before changing it. - Analyzing reverts, hotfixes, or fix chains ("why was this reverted?"). - The session authors git changes with human-authored messages (commit/merge/ revert/rebase/cherry-pick/tag with an authored message, authored PR title/body, CHANGELOG edit) — evaluate at session end whether the rationale is non-obvious enough for a ChDR; routine ops with generated or empty messages are not ChDRs (proportionality gate). - The session produces change rationale: a revert/hotfix explanation, or a commit that links to an issue tracker (the `/change-init` mining signal). ## Core Process ### Step 1: Locate the ChDR Index From the current working directory (do NOT walk up parent directories): - Primary: `docs/adlc/memory/chdr.md` (generated by `/change-publish`; rows start with `| ChDR`) - Fallback: `.adlc/memory/chdr.md` (legacy layout, pre-ADR-401) If the index is missing but `docs/adlc/memory/chdr/ChDR-*.md` or legacy `.adlc/memory/chdr/ChDR-*.md` files exist, synthesize a lean table from each file (ID from filename; Title/Status from frontmatter or first heading). If nothing exists, report `0 ChDRs` — never fabricate rows. When no local memory index exists in the current working directory and the directory sits inside a workspace (detected via a `.gitmodules` marker in an ancestor), read the workspace root's `docs/adlc/memory/` index instead (ADR-401 dual-read order applies: `docs/adlc/memory` first, legacy `.adlc/memory` fallback). ### Step 1b: Read the ChDR Drafts Index Check `.adlc/drafts/chdr/` for `ChDR-*.md` files with `status: proposed` or `status: discovered` in frontmatter. These are draft ChDRs pending clarification — frontmatter `proposed`/`discovered` maps to ledger Status `captured`, and both feed the `Unclarified` count. Collect ID / Title / Type / Status / Date from each file. If the directory is empty or absent, report `0 pending drafts`. ## Absent Context If `team-boot` injected no team context this session (no Team Context & Decisions section in the first user message — unconfigured project or hook failure): say so in one line, emit the section heading with a `0 ChDRs matched (no team context injected — run /team-setup)` source line, and continue the task on the directly-read ChDR index. Never treat a missing injection as an empty record set. Recovery: run `/team-diagnose`. ### Step 2: Inject ChDR Context (Output Contract) Emit before the task answer: ```markdown ## ChDR Context | ID | Title | Status | Date | |--|--|--|--| | ChDR-001 | Why payments retries are capped at 3 | stable | 2026-08-16 | _Searched N ChDRs, K matched._ ## Drafts Pending Review | ID | Title | Type | Status | Date | |----|-------|------|--------|------| | (from .adlc/drafts/chdr/) | _Unclarified: N ChDR drafts — run /change-clarify to review._ ``` - Render ID / Title / Status / Date from the index (the full index also carries Issue, Commit, Note — read the individual `ChDR-*.md` when a task matches a row). - `N` = total index rows; `K` = rows relevant to the current task. **K MUST equal the table rows shown.** 0 rows matched → emit the section heading + the `_Searched N ChDRs, K matched._` line only — no table. A 0-row table header collapses into unrendered single-line markdown; never emit one. Emit the section as markdown blocks — heading, table rows, and counts line each on their own lines. ### Step 3: Capture Change Rationale | Trigger | Action | |---------|--------| | Revert or hotfix performed/analyzed with rationale | ChDR → direct write to `.adlc/drafts/chdr/` | | Commit authored that links to an issue tracker | ChDR → direct write to `.adlc/drafts/chdr/` post-merge | | Git command authored in-session with a human-authored message, authored PR title/body, or CHANGELOG edit | evaluate at session end: non-obvious rationale → ChDR direct write to `.adlc/drafts/chdr/`; routine ops skipped (proportionality gate) | | Fix chain discovered in history | ChDR → direct write to `.adlc/drafts/chdr/` | | ChDR-class decision already in the ledger | verify capture happened; if not, re-surface | Add/refresh rows in **Team Context & Decisions** (ID | Name | Type | Rel | Status | Clarify) for every ChDR-class decision detected this session — including ones from before this boot was invoked. Mirror each decision as a task-list todo (draft → `/change-clarify` at session end); after code-modifying tasks, add a trailing todo to sweep Team Context & Decisions until _Unrecorded: 0 pending · Unclarified: 0 drafts_ (a draft leaves Unclarified only via its clarify skill or an explicit user handoff to a named clarify or execute skill). At session end, deliver the clarify prompt naming each captured ChDR draft in `.adlc/drafts/chdr/` (ID + skill), covering post-merge issue-linked commits too; if the user defers clarify, mark those rows handed off. ## Failure Handling - Missing index + missing records → emit the section heading + `_Searched 0 ChDRs, 0 matched._` only — no table — and continue the user's task; never block. - Unparseable index rows → skip malformed rows, note the skip count. ## Red Flags - Fabricating ChDR rows or inflating K beyond the table shown. - Injecting the index but ignoring capture — the pairing is the point. - Walking up parent directories to find `.adlc/`. - Mining rationale without SHA/URL provenance — `/change-clarify` will reject Decision claims that lack it. ## Verification - [ ] ChDR Context table emitted with `_Searched N ChDRs, K matched._` (K = table rows). - [ ] Detected ChDR-class decisions added as Team Context & Decisions rows.