docs: clear a 0.28-populated apm_modules before writing the lock

apm 0.39 reuses the 0.28-era third-party copies in apm_modules/ and
writes a lock without their carried_licenses entries, which a fresh
install contradicts and apm-pack-check-clean then fails on. README
setup, gates.md and the AGENTS.md lock-churn rule now say to move
apm_modules/ aside and reinstall before any 0.39 command that writes
the lock. Consuming the committed lock is unaffected.

Refs #272

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
This commit is contained in:
Defame1297andClaude Opus 5.5 committed 2026-12-02 11:50:38 +00:00
1 parent b80c26e064
commit 66443e7458
3 files changed
+13 -1

No files matched your search

+1 -1
View File
@@ -28,7 +28,7 @@ Fall back to raw shell only when no skill covers it.
## Session rules
- **Do not add repo-owned keys to `.claude/settings.json`.** apm treats it as its own deployed artifact and `apm audit --ci` replays the install and diffs, so anything apm would not have written is permanent drift that fails the `apm-audit-ci` pre-push hook. A hook you want here is authored in `plugins/<name>/.apm/hooks/` and deployed by apm, never hand-written into that file. The `SessionStart` entry already in it is exactly that: kyberforge authors it in `plugins/kyberforge/.apm/hooks/hooks.json` and apm merges it in, so it is apm's own output, it is what the replay expects, and it belongs in the commit — do not strip it (ADR-0019). Machine-specific settings go in the gitignored `.claude/settings.local.json`; shared enforcement goes in `.pre-commit-config.yaml`.
- **`apm.lock.yaml` turning up modified is expected, not a bug.** kyberforge's `SessionStart` hook keeps the install current on launch and rewrites the lock in the process (ADR-0019). On `main`, commit or discard it deliberately. On a feature branch, discard it (`git checkout -- apm.lock.yaml`, then `uv run --frozen apm install`). This keeps unrelated lock churn out of the branch diff and keeps `apm pack --check-clean` consistent with the committed lock. The session then runs the older `main` that the lock records, which is accepted on a branch, and the next session start refreshes again.
- **`apm.lock.yaml` turning up modified is expected, not a bug.** kyberforge's `SessionStart` hook keeps the install current on launch and rewrites the lock in the process (ADR-0019). On `main`, commit or discard it deliberately. On a feature branch, discard it (`git checkout -- apm.lock.yaml`, then `uv run --frozen apm install`). This keeps unrelated lock churn out of the branch diff and keeps `apm pack --check-clean` consistent with the committed lock. The session then runs the older `main` that the lock records, which is accepted on a branch, and the next session start refreshes again. Before writing the lock with apm 0.39 in a checkout whose `apm_modules/` apm 0.28 populated, move `apm_modules/` aside and run `uv run --frozen apm install`, or the lock loses its third-party `carried_licenses` entries (`docs/spec/gates.md`, "apm-audit-ci").
- **A `.apm/` edit is not live until it is on the remote's `main`.** Root `apm.yml`'s first-party dependencies resolve from the holocron remote, unpinned against the default branch, so pushing a feature branch does not deploy it (ADR-0019). `uv run --frozen apm install` deploys from the lock; `uv run --frozen apm update` is what re-resolves refs.
- **Run apm only as `uv run --frozen apm …`.** The root `pyproject.toml` and `uv.lock` pin apm 0.39.3 (ADR-0034). A bare `apm` reaches the machine-global 0.28.0, which this repo does not use and which refuses the v4 `apm.lock.yaml`.
- **No pre-push hook needs the network — once the two one-time online steps have run.** A new checkout runs `uv sync --frozen`, then `uv run --frozen apm install`, each online once. Root `apm.yml`'s marketplace has no remote package entries, so every hook then resolves locally. The guarantee is a property of a synced `.venv/` and a populated `apm_modules/`, not of the hook set: on a fresh clone `apm-audit-ci`'s `deployed-files-present` fails outright, and its `drift` and `config-consistency` install-replays have no cache to replay from and clone from the remote. A checkout whose `.claude/skills`, `.claude/agents` and `.claude/commands` were deployed by 0.28 moves those three directories aside before its first 0.39 install, or apm refuses with "no trustworthy local deployment baseline" (`docs/spec/gates.md`, "Pushing without a network").
+2
View File
@@ -69,6 +69,8 @@ pre-commit install -t pre-commit -t commit-msg -t pre-push
**An existing checkout deployed by apm 0.28 needs one more step before step 2.** Move `.claude/skills`, `.claude/agents` and `.claude/commands` aside (or delete them if they hold no edits), then run `uv run --frozen apm install`. Without that, apm 0.39 refuses to replace the 0.28-deployed files with "no trustworthy local deployment baseline", because 0.28 recorded no deployment evidence for them. apm's own message suggests a bare `apm install`; use the `uv run --frozen` form instead.
**Writing the lock from a checkout whose `apm_modules/` apm 0.28 populated needs a clean cache first.** Before any 0.39 command that writes `apm.lock.yaml` (`uv run --frozen apm update`, or an install that changes the lock), move `apm_modules/` aside and run `uv run --frozen apm install`. Otherwise apm reuses the 0.28-era third-party copies and writes a lock without their `carried_licenses` entries, which a fresh install then contradicts. Consuming the committed lock is unaffected and needs only the two setup steps above.
**Git hooks** must be wired for **all three stages**. This repo's `.pre-commit-config.yaml` has no `default_install_hook_types`, so a plain `pre-commit install` silently skips `commit-msg` (Conventional Commits) and `pre-push` (the full gate) — the `-t` flags above are not optional. The `pc-run` skill handles this and the troubleshooting around it, if you would rather not remember the flags.
## Keeping the install current
+10
View File
@@ -1265,6 +1265,16 @@ three directories aside before that first 0.39 install. Otherwise apm refuses to
with `no trustworthy local deployment baseline`, because 0.28 recorded no deployment evidence for
them. apm's message suggests a bare `apm install`; run the `uv run --frozen` form instead.
**A lock written over a 0.28-populated `apm_modules/` is wrong, and this gate family catches it
late.** Before any 0.39 command that writes `apm.lock.yaml` (`uv run --frozen apm update`, or an
install that changes the lock) in a checkout whose `apm_modules/` apm 0.28 populated, move
`apm_modules/` aside and run `uv run --frozen apm install`. Otherwise apm reuses the 0.28-era
third-party copies and writes a lock without their `carried_licenses` entries. A fresh install then
adds the LICENSE files, the cached content hash no longer matches the lock, and
`apm-pack-check-clean` fails with `does not match the content hash recorded in apm.lock.yaml`
(found under #272, fixed on #271 by regenerating the lock from a fresh install). Only writing the
lock is affected: consuming the committed lock needs only the two setup steps.
It does **not** enforce an org policy. apm discovers one from the git remote and only understands
github.com and Azure DevOps, so against this repo's self-hosted Gitea remote it prints: