Catalogue / change-init
change-init
MITSignedUse when you want guided mining of git history, structured change-story clustering, or comprehensive rationale recovery before documenting. Class boots only suggest capture — for in-session change rationale they suggest /change-specify; this skill mines history and writes the lightweight ChDR draft.--- name: change-init description: Use when you want guided mining of git history, structured change-story clustering, or comprehensive rationale recovery before documenting. Class boots only suggest capture — for in-session change rationale they suggest /change-specify; this skill mines history and writes the lightweight ChDR draft. disable-model-invocation: true ---
change-init
What this skill does
Mine git history for Change Decision Records (ChDRs) — the *why* behind how the code came to be — and write them as draft records for human review.
A ChDR captures a decision that was *made in the past* and survives only in commits + linked issue trackers:
- Scan a window of
git logfor commit messages that reference an issue tracker (JIRA keys, GitHub/GitLab#NNN, MR!NNN, or issue URLs) - Cluster commits sharing one issue key into a single change story
- Best-effort fetch the issue title/body (GitLab via MCP, GitHub via
gh, else link-only) for requirement-level context - Infer the Decision from the diff summary; record Consequences (reverts, follow-up fix chains — the negative knowledge almost never documented elsewhere)
- Write
ChDR-{slug}.mdto{REPO_ROOT}/.adlc/drafts/chdr/with status Discovered - Regenerate
{REPO_ROOT}/.adlc/drafts/chdr/chdr.mdindex
Key differences from the team-levelup family:
| Skill | Source | Record | Question answered | |---|---|---|---| | /team-init | current code (what IS) | CDR (Context Directive) | what patterns are reusable | | /team-levelup | current session | CDR | what was learned this session | | /change-specify | this session (why it CHANGED now) | ChDR (Change Decision) | why this revert/hotfix/workaround was chosen | | /change-init (this skill) | git history (why it BECAME) | ChDR (Change Decision) | why this code exists / what was tried and reverted |
ChDRs are project-local memory (this repo's evolution), not team-wide context — they fail the team-levelup "team-wide applicability" signal gate. They publish to {REPO_ROOT}/docs/adlc/memory/chdr/ (see /change-publish), and their index is injected at session start by team-boot.
When to use
> Note: Class boots detect in-session change rationale and suggest > /change-specify (which writes the lightweight draft to .adlc/drafts/). > This skill is for interactive deep-dive exploration — guided history > mining, change-story clustering, and rationale recovery before documenting.
- Brownfield onboarding: give an agent project memory without anyone writing docs
- Before refactoring unfamiliar code: surface Chesterton's fences — constraints that exist only in old commits + tickets
- Recovering lost rationale: when ADRs were never written but commits + issues exist
- Post-incident learning: revert/fix chains are first-class output
When NOT to use
- Greenfield / no history: nothing to mine
- Documenting current patterns: use
/team-init(what IS) - Capturing this session's learnings: use
/team-levelup - Capturing this session's change rationale: use
/change-specify - Pending ChDRs already exist: run
/change-clarifyto review them first
Process
User Input
$ARGUMENTS
You MUST consider the user input before proceeding (if not empty).
Examples of User Input:
"--since 6months"— limit the scan window"--tracker gitlab"— force tracker type (auto by default)"--no-fetch"— record issue links only, never fetch issue bodies"--include-unlinked"— also surface signal-rich unlinked commits (reverts, large cross-cutting diffs)"src/payments"— restrict to a path- Empty input: scan last 500 commits across the whole repo, auto-detect tracker
Flags
--since DATE/--until DATE/--max-count N(default 500):git logwindowing--path PATH: restrict to a pathspec--tracker gitlab|github|jira|auto(defaultauto): issue-tracker integration--no-fetch: detect+record issue links only, never fetch bodies--include-unlinked: also cluster signal-rich unlinked commits (reverts, diffs touching ≥3 subsystems)--limit N(default 20): cap number of ChDRs generated--resume: resume from previous interrupted state
Role & Context
You are a Context Archaeologist recovering *why* the code is the way it is. Your job is inference from evidence, not invention:
- Every Decision claim MUST cite the commit SHA(s) and/or issue URL it was inferred from (provenance is non-negotiable — an unprovenanced inferred rationale is context poisoning, worse than no rationale)
- Mark confidence (HIGH/MEDIUM/LOW) on each Decision
- Record what you do NOT know explicitly ("Reason for choice unknown — commit message terse, no linked issue")
- Reverts and follow-up fix chains are the highest-value content: they are negative knowledge ("we tried X, it broke Y") documented almost nowhere else
Outline
- Validate Environment (Phase 1): git repo, resolve paths, id allocation (slug)
- Scan Window (Phase 2):
git logwith windowing - Detect Issue Links (Phase 3): regex over commit messages
- Cluster into Change Stories (Phase 4): group commits by issue key
- Best-Effort Issue Fetch (Phase 5): tracker content (degrade gracefully)
- Detect Revert/Fix Chains (Phase 6): first-class negative knowledge
- Score & Prioritize (Phase 7): subsystems touched, diff size, chains
- Generate ChDRs (Phase 8): write drafts + index
- Output (Phase 9): summary with linkage-rate metric
Execution Steps
Phase 1: Validate Environment
Run the setup script from the skill's base directory:
scripts/bash/setup-change-init.sh
Parse the JSON output for REPO_ROOT, CHDR_DRAFTS_DIR, id_allocation, GIT_AVAILABLE, DEFAULT_BRANCH, TD_CONFIGURED, EXISTING_CHDRS.
If the setup script is unavailable or fails, resolve manually:
REPO_ROOT— walk up from cwd to find.adlc/, orgit rev-parse --show-toplevel, orpwd.CHDR_DRAFTS_DIR—REPO_ROOT/.adlc/drafts/chdrid_allocation— report "slug" to enable title-based ID generation.GIT_AVAILABLE—git rev-parse --is-inside-work-tree(exit 0 = true).TD_CONFIGURED— true ifTEAM_AI_DIRECTIVESresolves (used only to skip duplicate decisions already captured as CDRs).
If `GIT_AVAILABLE` is false:
Not a git repository — change-init has nothing to mine. Run /team-init to scan current code instead.
Exit cleanly (do not create empty drafts).
Phase 2: Scan Window
git log --pretty=format:'%H%x09%an%x09%ad%x09%s%n%b' --date=short \
${SINCE:+--since="$SINCE"} ${UNTIL:+--until="$UNTIL"} --max-count="${MAX_COUNT:-500}" \
${PATHSPEC:+-- "$PATHSPEC"} 2>/dev/nullCapture per commit: SHA, author, date, subject, body, files touched (git show --stat --name-only), and subsystems (top-level dirs of touched files).
Phase 3: Detect Issue Links
Apply a combined regex to each commit message (subject + body):
| Pattern | Tracker | Example | |---|---|---| | \b[A-Z][A-Z0-9]+-\d+\b | JIRA | PROJ-123 | | (?<!\w)#\d+\b | GitHub/GitLab issue | #123 | | \b!\d+\b | GitLab MR / Gerrit | !42 | | https?://\S+/(issues|pull|merge_requests|browse)/\S+ | URL | .../issues/123 |
Tracker type is auto-inferred from git remote get-url origin (gitlab.com / github.com / atlassian.net) and the link shapes found. --tracker overrides.
Commits with no detected link are unlinked; skipped unless --include-unlinked (then only those that are reverts or touch ≥3 subsystems are kept).
Phase 4: Cluster into Change Stories
Group commits by issue key. One issue key → one candidate ChDR. For URL-only links, normalize to the issue number. Merge subject + body text across the cluster as the raw rationale corpus.
Phase 5: Best-Effort Issue Fetch
For each cluster, fetch the issue title + body summary as Context (the requirement that motivated the change). Best-effort, never blocking:
- GitLab: use the configured GitLab MCP tools (
gitlab_get_issueby project+iid). If unavailable, tryglab issue view. - GitHub:
gh issue view <num> --json title,body(ifghis authenticated). - JIRA / unreachable: link-only — record the URL as evidence, Context comes from commit messages alone.
--no-fetch skips this phase entirely. Any fetch failure degrades to commit-message context (do not abort).
Security: issue bodies may contain sensitive detail. Summarize the requirement in 1-3 sentences; do not paste raw issue bodies verbatim into the ChDR. The human gate (/change-clarify) reviews before promotion.
Phase 6: Detect Revert/Fix Chains (first-class)
Across the whole window (independent of issue links):
- Reverts:
git log --grep='^Revert "' --pretty=format:'%H %s'andgit log --grep='revert' -i. For each reverted original commit, record it as negative knowledge. - Fix chains: commits whose subject matches
fix(?!ed)?\borhotfixthat touch the same files as an earlier commit in the window — a follow-up fixing a regression. Record the pair (original, fix) as a consequence.
Reverts and fix chains that have no issue link are still captured when --include-unlinked is set (they are the highest-value unlinked signal). When a revert/fix chain belongs to an issue-linked cluster, attach it to that cluster's ### Consequences.
Phase 7: Score & Prioritize
Score each candidate (0.0–1.0):
- subsystems touched (cross-cutting = higher)
- diff size (larger = higher, capped)
- has revert/fix-chain consequence (boost — negative knowledge)
- has fetched issue context (boost — richer rationale)
- recency (mild boost)
Sort descending; take top --limit (default 20). Skip candidates with score below 0.2 (trivial).
Phase 8: Generate ChDRs
For each selected change story, write {CHDR_DRAFTS_DIR}/ChDR-{slug}.md:
## ChDR-{slug}: [Title — from issue title or commit subject]
### Status: **Discovered**
### Date: [YYYY-MM-DD of most recent commit in cluster]
### Source: Git history via /change-init
### Issue Links: [keys/URLs, or "none detected"]
### Commits: [sha list, abbreviated]
### Target Module: `docs/adlc/memory/chdr/[slug].md`
### Descriptor: One-line "when to consult this" summary for the chdr.md index.
### Context
[Why the change was made — issue title/body summary (1-3 sentences) + commit messages. Cite SHAs inline.]
### Decision
[What was decided/implemented — inferred from diffs. Mark confidence: HIGH/MEDIUM/LOW. Each claim cites its SHA/URL.]
### Consequences
[Reverts, follow-up fix chains, later modifications — negative knowledge. "None observed" if the cluster has no reversals.]
### Evidence
- `{sha}`: {commit subject}
- {file/path}: {what changed}
- {issue-url}: {title} (fetched | link-only)Rules:
- Every
### Decisionclaim cites a SHA or URL (provenance — the context-poisoning circuit breaker). - "Reason unknown" is acceptable and preferred over invention.
- Confidence is mandatory on Decision claims.
Then regenerate {CHDR_DRAFTS_DIR}/chdr.md index by listing all ChDR-*.md files and building a markdown table from their single-line fields:
# Change Decision Records (Drafts) ## ChDR Index | ID | Status | Date | Issues | Commits | Descriptor | |----|--------|------|--------|---------|------------| | why-payments-retries-capped-at-3 | Discovered | 2026-08-16 | PROJ-123 | abc1234 | Why payments retries are capped at 3 | **Stats**: N entries | Last Updated: YYYY-MM-DD
Phase 9: Output Summary
## Change-Init Summary
- Scan window: [since/until or "last N commits"]
- Commits scanned: N
- Issue-linked commits: M (linkage rate: P%)
- Clusters formed: K
- Revert/fix chains detected: C
- ChDRs generated: N (capped at --limit)
- Output: `{REPO_ROOT}/.adlc/drafts/chdr/`Preview shortened. The full SKILL.md is in the pack.
| File | Size | SHA-256 |
|---|---|---|
| SKILL.md | 14.3 kB | 9ba691b8dd2b |
| SKILVAULT_SOURCE.json | 1.6 kB | 5cb5b1ac7db8 |
| THIRD_PARTY_NOTICES.md | 1.1 kB | b316c9568d08 |
| scripts/bash/chdr-lib.sh | 12.3 kB | bd29834b74f9 |
| scripts/bash/setup-change-init.sh | 6.2 kB | bea8439c2ad7 |
| scripts/powershell/chdr-lib.ps1 | 12.7 kB | 96110c7d7f9c |
| scripts/powershell/setup-change-init.ps1 | 4.0 kB | 99a531a62d73 |
Published verbatim from the pinned commit. Nothing is rewritten.
| Version | Pinned commit | Signed | |
|---|---|---|---|
| 0.1.0 Current | 2be08e49f7e1 | 29 Nov 2026 |
Locking a skill to one version needs Pro.