Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions draft/maintenance/mind/lifecycle_record_auto_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# lifecycle record auto-index

Difficulty: trivial
Autonomy: safe
Priority: medium

## Request (verbatim)

Make PyAutoMind `scripts/lifecycle.py` `cmd_record` automatically regenerate and
`git add` `complete/index.md` when `--apply` is passed, so the index can never
drift stale after a ship.

## Root cause

`record --apply` writes the completion record and stages it, but leaves
`complete/index.md` stale. The separate `index --apply` step is documented in the
ship skills (`ship_library`/`ship_workspace`) but gets forgotten. The **Lifecycle
Drift** workflow (`.github/workflows/lifecycle_drift.yml`) runs `index --check` on
every direct push to `main` that touches `complete/**`; a forgotten regen fails
the run and emails the maintainer on every ship.

## Fix

In `cmd_record`, under the `--apply` branch (after the record is written and the
prompt folded), regenerate the index via the existing `_render_index` /
`_existing_curated` helpers, write `complete/index.md`, and `git add` it — the
same effect as `index --apply`, folded into `record` so the two steps can't drift
apart. Behaviour-preserving except `record --apply` now also freshens the index.

@PyAutoMind
11 changes: 11 additions & 0 deletions scripts/lifecycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,17 @@ def cmd_record(args) -> int:
capture_output=True, text=True)
if r.returncode != 0:
prompt.unlink(missing_ok=True)

# Freshen complete/index.md in the same step so a shipped record never
# leaves it stale — the Lifecycle Drift guard runs `index --check` on every
# push to main touching complete/**, and the separate `index --apply` step
# was easy to forget (failing runs + maintainer emails). Same effect as
# cmd_index --apply, folded in so the two can't drift apart.
INDEX_MD.write_text(_render_index(_existing_curated()))
subprocess.run(["git", "-C", str(ROOT), "add", str(INDEX_MD)],
capture_output=True, text=True)
print(f"index: refreshed {INDEX_MD.relative_to(ROOT)} "
f"({len(_all_records())} records)")
return 0


Expand Down
Loading