diff --git a/.claude/memory/decisions.md b/.claude/memory/decisions.md index 2b68e73..15c51ba 100644 --- a/.claude/memory/decisions.md +++ b/.claude/memory/decisions.md @@ -981,6 +981,7 @@ rules: - **Why**: user call 2026-07-14 — registries already capture decisions; a stale plan describes a superseded intermediate state and misleads future readers; accumulation pollutes the repo. Precedent: gsc-crux cleanup (8a1fac0, 2026-07-10) did the same — this makes it law, not habit. - **Alternatives rejected**: never-commit (gitignore docs/superpowers) — breaks mid-run: briefs, reviewers, other-machine checkouts need the files; superpowers brainstorming commits the spec by convention. Keep-forever — the drift + pollution complained about. - **Reference**: project CLAUDE.md; cleanup commit this chore; precedent 8a1fac0. Linked [[BDR-064]], [[LRN-124]]. +- **Amendment (2026-07-22)**: DELETE side now AUTOMATED — `lib/gitflow.sh` `_gitflow_purge_transient` at `gitflow finish` (feature/bugfix, pre-merge, on HEAD) git-rm's `docs/superpowers/{specs,plans}` + scoped commit → develop TIP clean, feature commits stay reachable (`git show :…` archive intact). Best-effort: NEVER aborts finish (nothing-tracked no-op / dirty-path skip / commit-fail index+tree restore). Opt-out `GITFLOW_PURGE_TRANSIENT=0`. Retires the manual chore that slipped (655e364). Universal via `~/.claude/lib`→repo symlink (ship-feature STEP 9 + init-project STEP 11 both finish through it). gitignore STILL rejected — unchanged: breaks superpowers' `git add` of the spec (silently skipped, no travel to SDD worktree). `.claude/tasks/{contracts,plans}` kept versioned (user call — durable, referenced by decisions.md). Tests: gitflow-test.sh T17 a-d. [[LRN-138]]. --- diff --git a/.claude/memory/journal.md b/.claude/memory/journal.md index 889fd6e..78a43c9 100644 --- a/.claude/memory/journal.md +++ b/.claude/memory/journal.md @@ -423,3 +423,7 @@ rules: ## 2026-07-21 - Skill audit (user ask "pourquoi pas investigate dans bugfix ?") → same core doctrine, incompatible wrappers: investigate = monolithic gstack (own memory ~/.gstack, no gitflow/gates, ~1075-line preamble), bugfix = orchestrator (contract, fresh verifier+security gates, registries). Routing inverted in CLAUDE.global.md: bugfix primary, investigate explicit-only → BDR-080. chore/skill-routing-bugfix, UNMERGED. + +## 2026-07-22 +- User: auto-gitignore+delete transient pipeline artifacts in all projects. Investigation reframed the ask — gitignore = WRONG tool (files read from disk during run; would break superpowers SDD `git add` of spec). BDR-065 already rejected gitignore + its DELETE side was doctrine-only (no code, manual chore slipped once — 655e364). User picks (2 recommended): keep committed-during-run + AUTOMATE delete; keep `.claude/tasks/{contracts,plans}` versioned. +- Built `lib/gitflow.sh` `_gitflow_purge_transient` at finish (feature/bugfix, pre-merge, best-effort never-abort, opt-out `GITFLOW_PURGE_TRANSIENT=0`) + `purge-transient` CLI verb. Universal via `~/.claude/lib`→repo symlink. gitflow-test T17 a-d (10 checks, `--full-history` recovery), shellcheck clean, make test exit 0. BDR-065 amendment + [[LRN-138]]. feature/gitflow-auto-purge-transient. diff --git a/.claude/memory/learnings.md b/.claude/memory/learnings.md index 61472ca..2a4d04a 100644 --- a/.claude/memory/learnings.md +++ b/.claude/memory/learnings.md @@ -1349,3 +1349,9 @@ rules: - **fail-safe pin rule**: keep the HIGHEST tier as the frontmatter pin and override DOWN at call sites — a forgotten override then over-tiers (costs money) instead of silently downgrading judgment (costs correctness). - **future application**: before splitting any agent across model tiers, try MODE + `model=` first; create a new agent file only for a genuinely new role. Run-scoped `.audit/-` files + completeness sentinel + fail-closed consumer for any cross-dispatch artifact. - **cousin**: [[LRN-125]] [[LRN-126]] [[BDR-077]]. + +## LRN-138 — gitignore ≠ delete for run-time artifacts read from disk (2026-07-22) +- **pattern**: gitignore is the WRONG tool for an artifact a pipeline READS FROM DISK during a run — it blocks the commit but leaves the file (cleans nothing) AND breaks git-travel flows (superpowers commits the spec via `git add` so it reaches the SDD worktree; a gitignored path is silently skipped w/o `-f`). Right tool = commit-during-run + AUTO-DELETE at the integration boundary (`gitflow finish`, pre-merge, on the working branch → history keeps the archive, develop tip clean). +- **context**: user asked to gitignore transient planning artifacts (`docs/superpowers/{specs,plans}`, `.claude/tasks/{contracts,plans}`) to stop them merging. BDR-065 had already REJECTED gitignore for docs/superpowers on the git-travel ground; the real gap was the DELETE side never being coded (doctrine-only manual chore, slipped once — 655e364). Built `_gitflow_purge_transient`. +- **future application**: "don't merge transient X" → ask: does the run read X from disk? does X travel via git (worktree, foreign checkout)? Yes → auto-purge at finish, not gitignore. Scoped commit `-- ` avoids sweeping a dirty index; `git diff --quiet HEAD -- paths` precheck makes `git rm` all-or-nothing safe; keep the purge best-effort so cleanup NEVER blocks a merge. Prove archive-reachability with `git log --full-history` / `git show :path` — plain `git log -- path` prunes the purged add-commit via history simplification (bit me writing T17). +- **link**: [[BDR-065]]. diff --git a/.claude/tasks/TODO.md b/.claude/tasks/TODO.md index 4ed061e..cc2c8cb 100644 --- a/.claude/tasks/TODO.md +++ b/.claude/tasks/TODO.md @@ -1,5 +1,26 @@ # TODO +## 2026-07-22 — auto-purge transient superpowers artifacts at finish (feature/gitflow-auto-purge-transient) +User: transient planning artifacts (`docs/superpowers/{specs,plans}`) leak into +develop; BDR-065 "post-merge cleanup" is DOCTRINE ONLY (no code) — manual chore, +already missed once (655e364). Decision (user 2026-07-22, 2 recommended picks): +keep committed-during-run (SDD worktree + reviewers read them), AUTOMATE the +delete at `gitflow finish`. NO gitignore (would break superpowers' `git add` of +the spec → no travel to SDD worktree). `.claude/tasks/{contracts,plans}` stay +versioned (durable, referenced by decisions.md e.g. BDR-076). Universal via the +`~/.claude/lib` → repo `lib` symlink: every project's finish gets it. +- [x] lib/gitflow.sh: `_gitflow_purge_transient` (clean-precheck → git rm → + scoped commit `-- paths`; best-effort, NEVER aborts finish; opt-out + `GITFLOW_PURGE_TRANSIENT=0`) wired into finish `feature|bugfix` pre-merge; + `purge-transient` CLI verb. +- [x] lib/gitflow-test.sh T17 a/b/c/d (purge+recover-from-history via + --full-history+`git show`, no-op when absent, opt-out keeps, chore scope). + Also fixed 2 pre-existing SC2034 warnings (T16 gl_out/noleaks_out). +- [x] Gate: shellcheck lib/*.sh CLEAN + `make test` exit 0 (gitflow 106/0, full + suite green). Universal via ~/.claude/lib → repo lib symlink (verified). +- [x] CLAUDE.md §Transient planning artifacts: → "AUTO-PURGED by gitflow finish". +- [ ] Capitalize: BDR-065 amendment (delete side now automated) + LRN — pending user OK. + ## 2026-07-20 — pending merge gates (reconcile) - [x] merge feature/profile-managed-externals → develop (BDR-079 profile symmetry + /doc clean pass: README/USAGE/ARCHITECTURE.md) — 37c79f0