feat(cli): heal pre-date-slug ADR guidance in existing repos; author the minting contract in the managed surface - #68
Merged
Conversation
…the minting contract in the managed surface The dated-identifier scheme (adr-date-slug-identifiers) reached new repos through the seed, but never the repos already carrying the old seeded guidance: their docs/adr/README.md still told agents to "take the next free number", and sync deliberately never rewrites a seeded file. That stale instruction was live-fire — colliding ADR numbers on real branches. - Author the authoritative ADR-minting contract in the managed .launchrail/CLAUDE.generated.md; the seeded registry and template keep a project-owned summary that defers to it, so it can never silently drift. - Add migration 2026-09-heal-adr-minting-guidance: a one-time, exact-match heal of the pre-date-slug "Maintaining this registry" section and the 0000-template, leaving any copy a project has edited or ejected untouched. This is the sanctioned surface for a structural change to a seeded file — the propagation sync cannot do. - Sharpen doctor's duplicate-id warning to name the colliding files and prescribe a dated rename; existing numbered duplicates are never auto-renamed (never-renumber stands). ADR: managed-not-seeded-guidance (amends adr-date-slug-identifiers). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DDgcDibdyXw6VhXX4kmP3C
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.
Why
adr-date-slug-identifiers(shipped in 1.17.0) moved new ADRs toYYYY-MM-DD-slugnames — but only for new repos and the ongoing index. A consuming repo reported the gap: its seededdocs/adr/README.mdstill said "take the next free number", agents followed it, and0053collided acrossmasterand two open PRs.That's not a sync bug — it's by design, and it exposed a root cause:
syncdeliberately never rewrites seeded files (the safety rail from ADR-0006/0031). The date-slug ADR even rejected "regenerate from sync" for exactly this reason.launchrail adr indexonly rewrites the table between the markers — never the "Maintaining this registry" prose where the numbering instruction lived.doctoris read-only.So the forward fix had no propagation path into existing repos, and the one instruction that most needs to stay correct — how an agent mints a record — was authored only in project-owned files the toolchain had promised never to touch.
What
The fix leans on the two write surfaces this repo already has —
sync(continuous, managed files only) and migrations (one-time, structural, may touch seeded/project-owned with dry-run + checksum awareness + lockfile recording):.launchrail/CLAUDE.generated.md(whichsynckeeps current). The seeded registry and0000-template.mdkeep a project-owned summary that defers to it, so it can never silently drift again.2026-09-heal-adr-minting-guidance: rewrites the pre-date-slug "Maintaining this registry" section and the# ADR-NNNN:template only when the text is byte-for-byte what Launchrail seeded (both were byte-stable from ADR-0031 until the dated scheme). A section a project has edited or ejected is theirs — reported, never overwritten. It surgically replaces only that section, preserving the project's live picture and index table.doctor: the duplicate-id warning now names the colliding files and prescribes the safe resolution (rename the newer collider to a dated slug — dated ids can't collide). Existing numbered duplicates are never auto-renamed — never-renumber stands; that edit stays a reviewed action in the consuming repo.New ADR managed-not-seeded-guidance records the decision and amends
adr-date-slug-identifiers.Evidence
pnpm buildclean;pnpm test256 passing (+11 new: heal helper states,adrDuplicates, migration heal/skip-modified/skip-ejected/idempotency, doctor file-naming).inita repo → plant the exact 0031-era stale registry + template → mark the migration pending → run realsync. It heals both files; the file-surface pass still logskeep docs/adr/README.md (exists — seeded files are never overwritten), proving the migration is the only thing that touched the seeded file. Secondsyncis a no-op (idempotent);adr indexthen completes the table;doctorreports migrations all applied.launchrail adr indexregenerated in the same commit; the date-slug ADR's row shows the derivedamended by [managed-not-seeded-guidance]backlink (no edit to that record).Consuming-repo note
This heals the toolchain's side. The reporting repo's existing duplicate
0053records still need a reviewed rename (give the newer colliders datedYYYY-MM-DD-slug.mdnames, fix references, runlaunchrail adr index) — the migration removes the stale instruction so it stops recurring.🤖 Generated with Claude Code
https://claude.ai/code/session_01DDgcDibdyXw6VhXX4kmP3C
Generated by Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.