Compare commits

..
Author SHA1 Message Date
Defame1297andClaude Opus 5.5 75ec543b4b test(plugins): guard the consumer-neutral test's array expansion
test-vale-wrap's bash 3.2 scan flags a bare "${arr[@]}" expansion under
set -u. Use the guarded form the repo's other scripts use.

Refs: #177

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-06 22:18:55 +00:00
Defame1297andClaude Opus 5.5 05dffc3e45 docs(plugins): fix rtk-bare placement wording and a resolver typo
The git README said the marker goes on its own line; the gate requires
it on the same line as the bare command.

Refs: #177

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-06 21:33:34 +00:00
Defame1297andClaude Opus 5.5 0b8e5451b6 chore(release): bump git, gitea, delivery, core and kyberforge patches
Patch bumps for the consumer-neutral content changes on this branch:
git 1.4.1, gitea 1.3.11, delivery 0.8.2, core 1.1.5, kyberforge 2.3.2.
The root executables.allow keys follow, the catalog moves to 0.9.4, and
the marketplace is updated to match what apm pack generates.

Refs: #177

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-06 18:32:09 +00:00
Defame1297andClaude Opus 5.5 08fcc8be56 test(plugins): assert git and gitea content is consumer-neutral
Add an acceptance test for #177. It fails, printing file:line, when the
git or gitea .apm/ content carries a Co-authored-by trailer example, an
ADR citation or docs/adr path, or the Mortis/Holocron slug, or when any
of git, gitea, delivery, core and kyberforge cite ADR-0023 or ADR-0020.
run-tests picks it up as a tracked tests/test-*.sh suite.

Refs: #177

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-06 18:32:04 +00:00
Defame1297andClaude Opus 5.5 5b1bdd51fa fix(plugins): state the ADR-0020 rule instead of citing it in core and kyberforge
Plugin content is deployed into other repos, where this repo's ADR numbers
mean nothing. Replace every ADR-0020 citation in core and kyberforge
deployed content with the rule it stands for (the context budget, the
compressed boundary form, the shared boundary resolver), in comments,
user-visible validator messages and bats test names. Rename the resolver's
heredoc delimiter and BEGIN/END markers neutrally, and update their
repo-internal readers (skill-size-check.sh, test-adr0020-contract.sh,
gates.md). No behaviour change. Patch-bump the four touched skills.

Refs: #177

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-06 18:29:24 +00:00
Defame1297andClaude Opus 5.5 7dc741d1a7 fix(plugins): make git and gitea skill content repo-neutral
Consumer repos install these skills, so they must not carry this
repo's attribution policy, slug, ADR paths, or issue references.

git-commits trailer examples now show only neutral trailers, and
commit-template.md defers AI-attribution and co-author trailers to the
consumer repo's AGENTS.md, CONTRIBUTING, or session instructions. The
gitea sources notes state the live-verification rule plainly instead
of citing an ADR, and labels.md drops the repo slug.

Refs: #177

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-06 18:18:04 +00:00
Defame1297andClaude Opus 5.5 f3075ae01e fix(plugins): mark bare commands with rtk-bare: instead of citing ADR-0023
Every deliberately bare git command in git and delivery skill content
now carries `rtk-bare: <reason>` on its own line, and the delivery-verify
prose explains the bare command without an ADR citation. The git
README names the new marker. Bumps metadata.version of
delivery-test-first, delivery-verify, git-remotes, git-history and
git-worktrees.

Refs: #177

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-06 18:16:28 +00:00
Defame1297andClaude Opus 5.5 435ea59e93 refactor(gates): rename the rtk-prefix opt-out marker to rtk-bare:
check-rtk-prefix now exempts a deliberately bare git command only when
the line carries `rtk-bare: <reason>`. The old literal `ADR-0023` is no
longer accepted: plugin content is consumed by other repos and must not
cite this repo's ADRs. The test pins the new marker and adds a case
showing the old string no longer exempts a line. gates.md and an
ADR-0023 addendum record the rename.

Refs: #177

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-06 18:16:08 +00:00
Defame1297 b5bb0314d1 Merge pull request 'fix(claude-code): turn off built-in plugin skills that disableBundledSkills misses' (#288) from fix/286-builtin-plugin-skills into main
Reviewed-on: #288
2026-12-06 17:36:31 +00:00
Defame1297andClaude Opus 5.5 d32143b44b docs(adr): scope ADR-0035's one-switch claim and record the install check
Refs #286

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-06 17:06:05 +00:00
Defame1297andClaude Opus 5.5 96300834ef docs(adr): amend ADR-0035 for built-in plugin skills on 2.1.337
Refs #286

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-06 17:04:41 +00:00
Defame1297andClaude Opus 5.5 90394464e0 test(install): cover the built-in plugin settings and their merge
Refs #286

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-06 17:04:36 +00:00
Defame1297andClaude Opus 5.5 c164211480 fix(claude-code): turn off built-in plugin skills the bundled switch misses
Refs #286

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-06 17:04:31 +00:00
Defame1297 00c93ba03d Merge pull request 'fix(rtk): follow up the #284 review notes' (#287) from fix/rtk-review-polish into main
Reviewed-on: #287
2026-12-06 16:47:28 +00:00
Defame1297andClaude Opus 5.5 b66f1b838f fix(gates): carry info/exclude into the waiver's scratch re-run
The unlanded-plugin waiver re-runs `apm audit --ci` in a fresh
`git init` copy, which lacked the repo's info/exclude that
deployed-files-present consults through `git check-ignore`. Copy it from
`git rev-parse --git-path info/exclude` (the shared one in a linked
worktree) when it exists, and correct the claim that origin is the only
git state apm reads.

Leave .claude/worktrees out of the tar copy: those checkouts can carry
full .venvs, are ignored via info/exclude, and hold no lock-recorded
deployed path, so no root check could see them.

Add tests that turn red without the deletions-only diff guard (a
manifest with no trailing newline) or without the post-reduce
dep_identity guard (an rtk item split by a blank line surviving a
deletions-only reduction), plus coverage for the exclude copy and the
worktrees exclusion. Note in gates.md that a stale local origin/main
keeps the waiver alive after landing, which fails safe behind the
15-check re-run, and that `git fetch` ends it.

Refs: #179

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-06 16:15:44 +00:00
Defame1297andClaude Opus 5.5 7ee2066407 docs(rtk): name the commands that raise the duplicate-hook error
Verified against apm 0.39.3 (integration/hook_ownership.py and its
callers): `apm audit`, with or without --ci, reports "ambiguous duplicate
APM-owned hook entry" as a drift finding unless --no-drift is set, and
`apm export-patch` runs the same check. `apm install --frozen` reaches it
too but reports only that a managed hook entry was edited or removed.

README-only: it reaches no compiled output, so no plugin version bump
(apm-workflow references/configure.md).

Refs: #179

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-06 16:15:36 +00:00
Defame1297andClaude Opus 5.5 98e8c27cdf test(rtk): cover an already-prefixed command and a missing timeout
Add a real-rtk case: a `rtk git status` payload yields no output and
exit 0, backing the README's claim that running both the plugin hook and
rtk's global hook is harmless. It skips with the other real-rtk cases
when rtk is absent.

Fail with a clear message when timeout(1) is missing instead of aborting
silently under set -e.

Refs: #179

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-06 16:15:28 +00:00
Defame1297 96307b2a5e Merge pull request 'chore(apm): deploy rtk 0.1.0 and its Bash routing hook' (#285) from chore/apm-deploy-rtk-0.1.0 into main
Reviewed-on: #285
2026-12-06 16:04:20 +00:00
Defame1297andClaude Opus 5.5 d16be22b2d chore(apm): deploy rtk 0.1.0 and its Bash routing hook
Refresh the lock and the deployed hook files after #284 merged, as the
session-start apm update rewrites them on main (ADR-0019). With rtk now
on origin/main, apm-audit-ci no longer needs the unlanded-plugin waiver
for it.

Refs: #179

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-06 15:55:33 +00:00
Defame1297 0b04fa1e66 Merge pull request 'feat(rtk): add an rtk plugin that routes Bash calls through rtk' (#284) from feat/179-rtk-plugin into main
Reviewed-on: #284
2026-12-06 15:30:58 +00:00
Defame1297andClaude Opus 5.5 27f08af9b3 docs(adr): amend ADR-0026 for the unlanded-plugin root waiver
ADR-0026 said the root manifest is never waived. Since the rtk routing
hook landed it has one narrow waiver: ref-consistency for a plugin not
yet on origin/main. The amendment records the waiver's conditions, the
re-run of the full 15-check root set on a scratch copy with those
plugins' entries removed, and that the waiver lapses once the follow-up
lock PR lands.

Refs: #179

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-06 10:07:57 +00:00
Defame1297andClaude Opus 5.5 e14fca123d fix(gates): re-run the full root audit after the unlanded-plugin waiver
Why: on apm 0.39.3 a failing ref-consistency stops the root run after
three checks, so while the unlanded-plugin waiver applied, the other twelve
root checks (content-integrity, hook-approval-pins, local-bundle-hooks,
exec-status-current, deployed-files-present, ...) never ran.

Implementation notes: once the waiver's conditions hold, the hook copies
the working tree (minus .git and .venv) into a mktemp dir. There it drops
only the waived plugins' dependencies.apm items, checks the diff is
deletions only, and runs git init with the same origin. It then runs
apm audit --ci in the copy, and passes only on exit 0 with
"All 15 check(s) passed". A copy was chosen over a trap-guarded in-place
swap of apm.yml: it never writes the working tree, so the tree stays
byte-identical even after SIGKILL. The plugin name must now start
alphanumeric and contain no "..".

Impact: tests cover a failing, short, or non-zero re-run; a one-of-three
failure on another row; a duplicated details header; and dotted names.
Each guard was mutation-checked. On this branch the re-run reports all 15
checks passing.

Refs: #179

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-06 10:07:49 +00:00
Defame1297andClaude Opus 5.5 aaa73dddd3 feat(gates): waive ref-consistency for a plugin not yet on origin/main
A first-landing hook- or bin-shipping plugin could not be pushed.
check-executables-allow-sync requires its git+path entry in root apm.yml,
but root dependencies resolve from the remote's main (ADR-0019), so the
lock cannot record the plugin until it lands and root `apm audit --ci`
fails ref-consistency with `<identity>/plugins/<name>: not found in
lockfile`. No state of the branch satisfied both gates.

scripts/apm-audit-ci.sh now waives the root audit only when the sole
failure is ref-consistency (`1 of 3 check(s) failed`, as apm 0.39.3
prints it), every detail line is that form for the identity root
apm.yml's own git+path entry yields, plugins/<name>/apm.yml exists in
the working tree, and the plugin is absent from the local origin/main.
No fetch; a missing origin/main or unrecognised output fails closed. The
waiver lapses for a plugin once it is on origin/main, when the follow-up
lock PR must record it.

Refs: #179

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-06 09:35:52 +00:00
Defame1297andClaude Opus 5.5 cc1d396d47 fix(rtk): never block a Bash call when rtk itself fails
The hook ran `exec rtk hook claude`, so rtk's exit code became the hook's.
Claude Code treats a PreToolUse exit 2 as "block this tool call", and rtk
(clap) exits 2 on a usage error, e.g. an older rtk without `hook claude`.
On such a machine every Bash call would have been blocked.

The hook now captures rtk's stdout and always exits 0. On any non-zero rtk
exit it prints nothing, so the call proceeds unchanged. On success it prints
rtk's output only when non-empty, with no stray blank line. stdin still
reaches rtk.

Tests cover a stub rtk exiting 2 with stderr, exiting 1, and exiting 0 with
no output, and note that the real-rtk pass-through case depends on rtk
0.42.4's built-in rules.

Refs: #179

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-06 07:55:22 +00:00
Defame1297andClaude Opus 5.5 fe7184f4f3 docs(adr): amend ADR-0032 for the rtk routing hook
Records that the hook may return permissionDecision: allow, accepted because hooks are guardrails, and that git's push guard still sees rtk git push.

Refs: #179

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-05 22:18:33 +00:00
Defame1297andClaude Opus 5.5 91481a5ae7 chore(apm): install the rtk plugin and list it in the marketplace
Adds the git+path dependency, the hooks grant for plugins/rtk#0.1.0 and the marketplace package entry, and regenerates marketplace.json with apm pack.

Refs: #179

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-05 22:18:25 +00:00
Defame1297andClaude Opus 5.5 c5f09a22d0 test(rtk): cover the rtk routing hook
Stub rtk, rtk absent, the .claude/hooks/ guard, the real rtk when installed, and the hooks.json wiring.

Refs: #179

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-05 22:18:14 +00:00
Defame1297andClaude Opus 5.5 de9de7c226 feat(rtk): add rtk plugin that routes Bash calls through rtk
A Claude Code PreToolUse hook on Bash execs `rtk hook claude` when rtk is on PATH and passes its answer through unchanged; without rtk it exits 0 silently. It acts only from .claude/hooks/, like git's push guard.

Refs: #179

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-05 22:18:03 +00:00
Defame1297 a77079e67e Merge pull request 'chore(apm): deploy git 1.4.0 and its push-to-main hook' (#283) from chore/apm-install-git-1.4.0 into main
Reviewed-on: #283
Reviewed-by: Defame1297 <[email protected]>
2026-12-05 21:14:03 +00:00
Defame1297andClaude Opus 5.5 49e8ebdc7d chore(apm): deploy git 1.4.0 and its push-to-main hook
Refresh the lock and the deployed hook files after #282 merged, as the
session-start apm update rewrites them on main (ADR-0019).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-05 20:41:51 +00:00
Defame1297 78cfbe2f32 Merge pull request 'feat(git): refuse git push to main with a Claude Code hook' (#282) from feat/178-refuse-push-to-main into main
Reviewed-on: #282
2026-12-05 20:33:15 +00:00
Defame1297andClaude Opus 5.5 1ccf246598 fix(git): treat rebase onto a named branch as a branch change
`git rebase <upstream> <branch>` checks out <branch>, so a later bare push was refused as if main
were still checked out. Pushes through xargs get refspecs the hook cannot see, so only an explicit
main is refused there.

Refs: #178

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-04 22:54:50 +00:00
Defame1297andClaude Opus 5.5 a988275347 fix(git): follow earlier branch changes in the push-to-main hook
Review found pushes refused after `gh pr checkout` or `git branch -m`, and pushes to main allowed
after `git switch main` or `cd <repo>`. The hook now follows literal branch and directory changes
and treats any other as unknown. Heredoc stripping is linear and handles several per line.

Refs: #178

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-04 22:19:49 +00:00
Defame1297andClaude Opus 5.5 038da3014e docs(adr): note the git push-to-main hook in ADR-0032
Refs: #178

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-04 21:18:12 +00:00
Defame1297andClaude Opus 5.5 77642183c2 feat(git): refuse git push to main with a PreToolUse hook
An agent on main can push straight to it when the server does not protect the branch. The git
plugin now ships a Claude Code hook that refuses such a push before it runs. It fails open, does
nothing on other runtimes, and has an opt-out read only from the hook's own environment.

Closes: #178

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-04 21:18:09 +00:00
Defame1297 55da336298 Merge pull request 'feat(install): merge user settings and turn off bundled Claude Code skills' (#281) from feat/280-merge-user-settings into main
Reviewed-on: #281
Reviewed-by: Defame1297 <[email protected]>
2026-12-04 20:14:54 +00:00
Defame1297andClaude Opus 5.5 f0aac594c3 fix(install): reject NaN and Infinity in existing settings
Python's JSON parser accepts them, so an invalid settings file was rewritten
instead of being refused and left untouched.

Refs: #280
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-04 19:50:55 +00:00
Defame1297andClaude Opus 5.5 aa8319a1db feat(install): merge user settings and turn off bundled skills
Copying the repo's settings.json over ~/.claude/settings.json would delete
most of the operator's settings, so the installer now merges it. The merge
and the new settings land together, so no overwriting installer ever
deploys them.

The merge runs before any other file is deployed, so an invalid settings
file stops the install with nothing changed. It writes a complete temporary
file and renames it, so a failure cannot truncate the user's settings.

Impact: removing a setting from the repo no longer removes it from a
machine that already has it.

ADR: 0035
Refs: #280
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-04 19:48:53 +00:00
Defame1297 0f2d9ede68 Merge pull request 'docs(adr): bundled Claude Code skills are turned off at user level' (#279) from docs/plan-266-bundled-skills-off into main
Reviewed-on: #279
2026-12-03 19:19:10 +00:00
Defame1297andClaude Sonnet 5.5 bb678ff441 docs(adr): bundled Claude Code skills are turned off at user level
Records the decision for #266: one switch in providers/claude-code/settings.json,
not distributed to consumer repos, with install.sh merging into existing settings.

Refs #266

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-03 18:44:36 +00:00
Defame1297 0965c007ba Merge pull request 'chore(apm): lock delivery 0.8.1 and kyberforge 2.3.1' (#278) from chore/refresh-apm-lock into main
Reviewed-on: #278
2026-12-03 16:54:44 +00:00
Defame1297andClaude Opus 5.5 012ccce2a9 chore(apm): lock delivery 0.8.1 and kyberforge 2.3.1
Move the first-party dependencies to Holocron main 5db1eb1, so this repo
deploys the plugin content released with the apm 0.39.3 upgrade.

Refs: #268
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-03 08:21:59 +00:00
Defame1297 5db1eb1435 Merge pull request 'feat(kyberforge): plugin skills and docs refreshed for apm 0.39.3 (#273)' (#277) from feat/273-plugin-docs-apm-0-39 into main
Reviewed-on: #277
2026-12-03 08:10:39 +00:00
Defame1297 474e10597f Merge branch 'main' into feat/273-plugin-docs-apm-0-39 2026-12-03 08:10:27 +00:00
Defame1297 87fd9d53d9 Merge pull request 'docs: pinned apm setup, offline guarantee and 0.28.0 claims re-verified on 0.39.3 (#272)' (#276) from feat/272-repo-docs-apm-0-39 into main
Reviewed-on: #276
2026-12-03 08:10:06 +00:00
Defame1297 a932ecdd06 Merge branch 'main' into feat/272-repo-docs-apm-0-39 2026-12-03 08:09:28 +00:00
Defame1297 38ca0a9433 Merge pull request 'feat: cut this repo over to apm-cli 0.39.3 pinned with uv (#271)' (#275) from feat/271-uv-pinned-apm-cutover into main
Reviewed-on: #275
Reviewed-by: Defame1297 <[email protected]>
2026-12-03 08:09:12 +00:00
Defame1297andClaude Opus 5.5 e6d680a4c5 fix(kyberforge): apply the #273 review to the apm 0.39.3 refresh
- apm-workflow and apm-orchestrate always pass --project to uv run,
  because uv run outside the project silently runs the PATH apm. The
  agent now checks that the reported version equals the pin, or is
  0.39.2 or later where nothing pins it, not only that it exits 0.
- A pin is a quoted apm-cli or apm_cli requirement plus a uv.lock,
  matching the SessionStart hook, in apm-install, uv-pin.md and
  apm-workflow.
- uv-pin.md spells the hook's exact invocation and its environment
  check, and says scripts always pass --project.
- instructions-author and its research note: a Claude rule leaves
  .claude/rules/ only when compile actually wrote it into AGENTS.md;
  install-then-compile dedups it.
- prompt-author: Kiro strips every key with a warning, not silently.
- Record the 0.39.3 executables findings in approvals-and-executables.md
  and the output-profile and type-routing facts in cli-reference.md, and
  cite those digests.
- forge's routing table notes that Kiro gets the body only.

Refs: #273

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-02 12:35:19 +00:00
Defame1297andClaude Opus 5.5 db34dfa728 docs: apply the #272 review notes on the apm 0.39 docs
- Name kyberforge's SessionStart hook as a lock writer that can write
  the bad lock in a 0.28-populated checkout, with the recovery steps
  (README, AGENTS.md, gates.md).
- AGENTS.md: put the pinned-invocation rule above the lock-churn rule,
  make the bare-apm remark conditional on what PATH holds, and replace
  the two 0.28 migration notes with one pointer to gates.md
  "apm-audit-ci".
- Use one wording for the offline guarantee: a synced .venv/ and a
  populated apm_modules/.
- Say the #204 leak was not re-tested on 0.39.3, and narrow the claim to
  git_subprocess_env (gates.md, LESSONS.md, git-env test header).
- State the apm-audit-ci timing as 70-90 s, drop a duplicate README
  sentence, give the 0.39.3 shorthand error, reflow gates.md to about
  100 columns, and move the ADR-0033 note into amendment blockquote form.

Refs #272

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-02 12:25:51 +00:00
Defame1297andClaude Opus 5.5 c68b67301a chore(release): bump kyberforge to 2.3.1 and delivery to 0.8.1
Patch bumps for the apm 0.39.3 refresh of their skills and docs. The
root executables.allow keys follow at full identity, the catalog moves to
0.9.2, and the marketplace is re-packed. Refresh the root apm.yml grant
comment's quote of the gate-disabled message to the 0.39.3 wording; the
rest of that comment was re-checked on 0.39.3 and holds.

Refs: #273

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-02 11:59:17 +00:00
Defame1297andClaude Opus 5.5 aaada85e26 docs(plugins): describe full-identity hook grants on apm 0.39
The kyberforge and delivery hook docs still described apm 0.28.0: a bare
kyberforge#<version> or delivery key matching, and "parked pending
approval" printed for a granted package. On 0.39.3 a bare key parks the
hook and deploys nothing with exit 0, the full
<host>/<owner>/<repo>/<path> identity is required, and the #<version>
suffix is still ignored when matching. Re-run the copilot and codex hook
placement on 0.39.3: with codex in targets, apm now creates .codex/
itself.

Refs: #273

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-02 11:59:17 +00:00
Defame1297andClaude Opus 5.5 0fb106b731 fix(kyberforge): run the repo-pinned apm from apm-workflow
apm-workflow spelled every command as bare apm, which in a repo that pins
apm with uv runs whatever is on PATH, possibly an apm that refuses the
repo's lockfile. Add a step that checks for the pin and runs
uv run --frozen apm there, and the PATH apm otherwise. apm-orchestrate's
version check now probes the same apm.

Bring the references level with apm 0.39.3: the Copilot marketplace
output profile, get_effective_type() still ignoring the declared type,
plain apm audit's exit codes, the uv form of the CI example, and audit
--ci needing an apm at least as new as the lock's writer. Bump
metadata.version to 1.0.4.

Refs: #273

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-02 11:59:17 +00:00
Defame1297andClaude Opus 5.5 b81af32425 feat(kyberforge): document the per-repo uv pin of apm in apm-install
Add a dispatch on where apm comes from: a repo that pins apm with uv, a
repo that wants the pin, or a global install. The new uv-pin reference
covers the pyproject.toml dev group, the committed uv.lock, running as
uv run --frozen apm, the one-time online sync, upgrading the pin, and why
uvx and uv tool are not used. It closes with a worked example of one
pinned and one unpinned repo.

Raise the pip floor to Python 3.11, which apm requires since 0.36.0, add
the package-manager installs, and note the 0.39.2 minimum for v4 locks.
Bump metadata.version to 1.0.2.

Refs: #273

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-02 11:59:17 +00:00
Defame1297andClaude Opus 5.5 5f9c805522 fix(kyberforge): bring prompt-author level with apm 0.39.3
apm 0.39 keeps Claude Code command keys such as disable-model-invocation
on the claude target and still drops them on cursor, opencode, windsurf
and grok-build. It withholds hooks, names dropped keys only under
--verbose, deploys a body-only prompt to Kiro, fails install on a
hand-edited deployed command, and writes nothing when a prompt carries a
critical hidden character.

Update the Gotchas, the frontmatter contract, the compatibility line, the
template and every reference. Re-cite forge's prompt-routing table on the
0.39.3 run. Bump prompt-author to 0.1.1 and forge to 1.0.6.

Refs: #273

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-02 11:59:17 +00:00
Defame1297andClaude Opus 5.5 598f88b536 fix(kyberforge): bring instructions-author level with apm 0.39.3
The skill still described apm 0.28.0. On 0.39.3 an unquoted applyTo fails
install and deploys nothing, the Claude compile writes AGENTS.md behind a
CLAUDE.md that only imports it, dedup is per instruction, unscoped rules
retire from .claude/rules/ once AGENTS.md carries them, and install skips
a hand-authored rule rather than overwriting it.

Update the Gotchas, the compatibility line and the target-mapping, schema,
verify, improve and create references, the template comment, the tests
README and the bats header. Bump metadata.version to 0.1.1.

Refs: #273

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-02 11:59:17 +00:00
Defame1297andClaude Opus 5.5 bb84e4ac13 docs(kyberforge): record the apm 0.39.3 re-run of the primitive experiments
Re-run the 0.28.0 instruction, prompt and executable-grant experiments on
the repo-pinned apm 0.39.3 in throwaway packages, and record what changed
in instructions-gotchas.md and prompt-gotchas.md. Register the run as the
apm-cli-0-39-3-experiments source so the skills refreshed under #273 can
cite it.

Refs: #273

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-02 11:59:17 +00:00
Defame1297andClaude Opus 5.5 66443e7458 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
2026-12-02 11:50:38 +00:00
Defame1297andClaude Opus 5.5 b80c26e064 docs(adr): add dated apm 0.39.3 notes to the 0.28.0 claims
ADRs 0017, 0019, 0021, 0026, 0029 and 0033 get 2026-12-02 forward notes
recording each 0.28.0 claim's result on apm 0.39.3: held, changed, or
not re-run. ADR-0019 gains a note that the executables.allow key is now
the full package identity (#271), not the bare kyberforge#<version>
form it describes. ADR-0034 consequence 4 records the re-check as done.

Refs #272

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-02 11:49:22 +00:00
Defame1297andClaude Opus 5.5 386ab7ec5d docs(gates): re-verify the apm gate facts on apm 0.39.3
The apm-audit-ci section now records 15 root checks and 2 plugin checks,
a run of about 70 s through uv run, manifest-parse as a named row, the
new plain-audit wording, and the waiver re-verified in a scratch copy of
plugins/mattpocock. The setup note and "Pushing without a network" give
the two one-time online steps, the pinned invocation, and the
first-0.39-install refusal on a 0.28-deployed checkout.

Refs #272

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-02 11:49:22 +00:00
Defame1297andClaude Opus 5.5 01fe1fb767 docs: run apm only through the uv-pinned invocation
README, the AGENTS.md session rules, architecture.md and the .gitignore
comments now give the pinned `uv run --frozen apm` form for every apm
command in this repo and the two one-time online setup steps. A new
session rule says a bare `apm` reaches the global 0.28.0, which this repo
does not use. README and AGENTS.md add the setup note for a checkout
deployed by apm 0.28: move .claude/skills, agents and commands aside
before the first 0.39 install, or apm refuses with "no trustworthy local
deployment baseline".

Refs #272

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-02 11:49:22 +00:00
Defame1297andClaude Opus 5.5 7e63f22bf8 docs: re-verify the apm 0.28.0 claims in hook and test comments
Checked against apm 0.39.3 live and in its source. The apm-audit-ci
description and comments now give 15 root checks and 2 plugin checks,
about 70 s through uv run, manifest-parse as a named row, and the new
"nothing to scan" wording. The run-bats copytree note, the #204 git-env
test header and its LESSONS entry say what holds on 0.39.3.

Refs #272

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-02 11:49:22 +00:00
Defame1297andClaude Opus 5.5 c2ba7f01bf fix(apm): regenerate apm.lock.yaml from a fresh apm 0.39.3 install
The lock committed in e87bd67 was written by `apm update` over an
apm_modules/ that apm 0.28.0 had populated. The 22 pinned third-party
dependencies (fluxcd gitops skills and mattpocock skills) were reused
from that cache, so the lock lacked their carried_licenses and LICENSE
deployment records. A fresh install writes them, which left the
committed lock out of step with every new checkout and failed
apm-pack-check-clean there on a content-hash mismatch.

Regenerated with `uv run --frozen apm install` after moving apm_modules/
aside: +331/-1, only carried_licenses for those 22 dependencies, their 22
LICENSE deployment records, and generated_at. A second fresh install into
another empty apm_modules/ left the lock byte-identical. Still the
sanctioned lock rewrite (ADR-0034); no tracked .claude/ file changed.

Refs: #271

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-02 11:27:04 +00:00
Defame1297andClaude Opus 5.5 126831e96f fix(scripts): expand APM_CMD bash-3.2-safely in apm-pack-check-clean
The helper now seeds APM_CMD empty, and a bare "${APM_CMD[@]}" on an
array that can be empty fails under `set -u` on bash 3.2. The bash-4
construct scan in tests/test-vale-wrap.sh caught it at pre-push. Use the
guarded expansion that run_apm already uses.

Refs: #271

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-02 10:29:51 +00:00
Defame1297andClaude Opus 5.5 b0977d4073 feat(scripts): fail the push on a parked executable in apm.lock.yaml
apm records each dependency's executables decision as `exec_status:` in
the lock. A gated_* value means the trust gate parked that package's
hooks, bin or MCP servers. Root `apm audit --ci` still passes in that
state, so a wrong key would leave the SessionStart hook or the delivery
guard uninstalled with every gate green (spike #269, section 7.3).

check-executables-allow-sync now scans the lock's dependencies and fails
on any gated_* entry, naming its identity and status, with a Why/Fix
block that starts from `apm approve --list`. It runs even when no plugin
here ships executables. The test covers deployed, two gated_* values
under both readers, the no-plugin case, and that neither the next
dependency nor the deployments: section is misreported. gates.md and the
hook description note it.

Refs: #271

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-02 10:12:06 +00:00
Defame1297andClaude Opus 5.5 045e43f0f8 fix(scripts): describe allow-sync keys as <identity>#<version>
A comment and the name-mismatch message still described the bare
<name>#<version> key. Both now say <identity>#<version>, and that the
directory name is what finds the identity, through the root dependency
entry's `path: plugins/<dir>`.

Refs: #271

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-02 10:11:41 +00:00
Defame1297andClaude Opus 5.5 5089856c0d fix(scripts): anchor the apm version check to its CLI banner
Match `CLI version X.Y.Z`, the banner apm prints, instead of any
`version X.Y.Z`, so other version-like text on stdout is not taken for
apm's version. Fail clearly when APM holds only whitespace, instead of
running an empty command.

The seam B test now pins both properties. The fake uv also writes a
banner-shaped `uv CLI version 0.0.1` to stderr, so a parser reading the
merged stream fails it (23 failures with the round-1 bug restored). A
stub that prints `version 0.40.0` before a 0.28.0 banner must still fail.
The git-env test's stub prints the real banner.

Refs: #271

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-02 10:11:28 +00:00
Defame1297andClaude Opus 5.5 0696ce31e7 test(kyberforge): keep the real-apm probe off the network
The probe moves HOME to an empty dir, which also moved uv's cache and its
managed Pythons, leaving uv cold. Pin UV_CACHE_DIR and
UV_PYTHON_INSTALL_DIR to the real ones resolved beforehand, and set
UV_OFFLINE so the probe runs the synced pin and never fetches. Verified
under `unshare -rn`.

Refs: #271

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-02 09:47:45 +00:00
Defame1297andClaude Opus 5.5 dca0b5823b fix(scripts): refuse a dependency URL with a port in the allow-sync gate
How apm 0.39 writes a port into a package identity is unverified, so a
key derived from a git: URL with a port could be wrong while looking
right. The gate now fails clearly on one, naming `apm approve --list` as
the way to read the real identity. The script and gates.md record that
only an https URL on a lowercase host was checked against apm.

The test drops its GNU-only `sed -i` for a python3 rewrite, and covers
ssh:// and https URLs with a port under both readers.

Refs: #271

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-02 09:47:38 +00:00
Defame1297andClaude Opus 5.5 615d3dd881 fix(scripts): parse the apm version from stdout and its banner only
require_apm_version merged stderr into the --version output and took the
first X.Y.Z. When `uv run --frozen` syncs first, uv prints
`Using CPython 3.14.6` on stderr, so the check parsed 3.14.6 and passed
whatever apm reported. It now reads stdout only, matches apm's
`version X.Y.Z` banner, and shows the captured stderr only on failure.

The fake uv in the seam B test now writes that line to stderr, so the
regression stays pinned. Resolve the repo root with CDPATH cleared.

Refs: #271

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-02 09:47:30 +00:00
Defame1297andClaude Opus 5.5 a48f0fdf5b docs: document the uv-pinned apm setup and full-identity allow keys
README: uv replaces the global apm as a prerequisite, setup starts with
`uv sync --frozen`, and the offline note names both one-time steps.
gates.md: the apm hooks run through scripts/lib/apm.sh with plain
--frozen (and why the gates, unlike the SessionStart hook, keep the
sync), and check-executables-allow-sync expects the full package
identity apm 0.39 matches on.

Refs: #271

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-02 08:47:53 +00:00
Defame1297andClaude Opus 5.5 e87bd67c1f chore(apm): regenerate apm.lock.yaml with the pinned apm 0.39.3
Written by `uv run --frozen apm update --yes` on apm 0.39.3: lockfile
version 4, apm_version 0.39.3, and every dependency resolved to main at
feef6d8, which records kyberforge 2.3.0 from #270. This is the one
sanctioned exception to discarding lock churn on a feature branch
(ADR-0034, ADR-0019).

With the full-identity approvals both hooks stay deployed (exec_status
deployed). .claude/settings.json and .claude/apm-hooks.json keep the
PreToolUse guard and SessionStart entries; their only change is
kyberforge 2.3.0's hook timeout, 380 to 400. No apm-owned file was edited
by hand.

Refs: #271

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-02 08:47:43 +00:00
Defame1297andClaude Opus 5.5 5842be70cc test(kyberforge): run the instructions-author bats suite on the pinned apm
need_apm now runs apm through scripts/lib/apm.sh, so the suite exercises
the repo-pinned 0.39.3 and never a PATH apm. In this repo a missing uv or
an apm below 0.39.2 fails rather than skips, so run-tests.sh --strict
cannot pass without running these tests. Outside the repo it still falls
back to PATH apm and skips without one.

Three assertions pinned 0.28.0 behaviour and are updated to 0.39.3's:
compile --target claude writes a CLAUDE.md that imports AGENTS.md, an
unquoted applyTo fails install closed and deploys nothing, and compile
warns when applyTo matches no file. The skill's own text still describes
the 0.28.0 behaviour; that is left for a skill update.

Refs: #271

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-02 08:47:35 +00:00
Defame1297andClaude Opus 5.5 7291b46271 feat(scripts): run the apm gates through the uv-pinned apm
Add scripts/lib/apm.sh, the one place the repo spells its apm command:
`uv run --project <repo root> --frozen apm`. --project comes from the
helper's own location, so it names the repo root even when apm runs inside
plugins/<name>/. Sourcing it keeps the git-env scrub (#204), and
require_apm_version fails with a clear message, naming `uv sync --frozen`,
when the resolved apm is below 0.39.2, unreadable, or uv is missing. APM
overrides the command, as ADR-0034 provides.

apm-audit-ci.sh and apm-pack-check-clean.sh use it. The audit script's
matching logic is unchanged; only its verified-against note now records
0.39.3.

tests/test-apm-gate-invocation.sh is seam B: a fake uv and a stub apm
first on a PATH without the real ones. It proves the command shape,
--project from a plugin directory, the scrub, and the version floor.
test-apm-hooks-git-env.sh reaches its stub through a fake uv, and the
real-apm probe in test-apm-current-hook.sh now runs the pinned apm.

Refs: #271

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-02 08:47:12 +00:00
Defame1297andClaude Opus 5.5 d15688ee99 build: pin apm-cli 0.39.3 per repo with uv
Add a root pyproject.toml with no build system, uv package mode off,
Python 3.11 or later, and a dev dependency group pinning apm-cli==0.39.3,
as ADR-0034 decides. Commit the uv.lock that hashes apm-cli and its
transitive dependencies, and ignore uv's .venv/.

Refs: #271

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-02 08:47:06 +00:00
Defame1297andClaude Opus 5.5 e1a99a7291 fix(apm): key executables.allow on the full 0.39 package identity
apm 0.39.3 matches executable grants on the package identity
<host>/<owner>/<repo>/<path>. The bare kyberforge#<version> and
delivery#<version> keys that 0.28.0 matched no longer match, so the first
0.39 install parks both hooks and rewrites .claude/settings.json without
them, while root apm audit --ci stays green (spike #269, on #268).

Rename both keys to git.rkdr.net/Mortis/Holocron/plugins/<name>#<version>
with type-level grants, as `apm approve --list` names them on 0.39.3. Keep
the version suffix convention; apm strips it before matching. Do not use
`apm approve`, which would content-pin, strip the block's comments and
park the hook on every script edit.

check-executables-allow-sync now derives each expected key from root
apm.yml's git + path dependency entry for the plugin, fails a bare key with
a message saying why, and fails a shipping plugin with no such entry. Both
readers carry the change, and the test covers URL and path spellings.

Refs: #271

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-02 08:46:38 +00:00
134 changed files with 7024 additions and 663 deletions

No files matched your search

+13 -6
View File
@@ -1,7 +1,7 @@
{
"name": "holocron",
"description": "AI development skills for Claude Code, and for GitHub Copilot through apm — factory, design, implement, review, and cross-cutting workflows.",
"version": "0.9.1",
"version": "0.9.4",
"owner": {
"name": "Mortis",
"url": "https://git.rkdr.net/Mortis/"
@@ -10,7 +10,7 @@
{
"name": "kyberforge",
"description": "Skills and agents for creating, maintaining, and managing an apm plugin marketplace for Claude Code and GitHub Copilot.",
"version": "2.3.0",
"version": "2.3.2",
"category": "Developer Tools",
"source": "./plugins/kyberforge"
},
@@ -24,21 +24,21 @@
{
"name": "git",
"description": "Skills and agents for working with a local Git clone over the git wire protocol, and for authoring and running the pre-commit hooks that guard it.",
"version": "1.3.9",
"version": "1.4.1",
"category": "Version Control",
"source": "./plugins/git"
},
{
"name": "gitea",
"description": "Skills and agents for working with a Gitea forge through its HTTP API — the forge's own objects, as distinct from the local git clone.",
"version": "1.3.10",
"version": "1.3.11",
"category": "Version Control",
"source": "./plugins/gitea"
},
{
"name": "core",
"description": "Skills for authoring and auditing a repo's AGENTS.md and the provider adapter files that defer to it.",
"version": "1.1.4",
"version": "1.1.5",
"category": "Productivity",
"source": "./plugins/core"
},
@@ -59,7 +59,7 @@
{
"name": "delivery",
"description": "Agents and skills for taking a change from spec to a verified merge through tracker-gated stages.",
"version": "0.8.0",
"version": "0.8.2",
"category": "Developer Tools",
"source": "./plugins/delivery"
},
@@ -90,6 +90,13 @@
"version": "0.5.0",
"category": "Productivity",
"source": "./plugins/plan"
},
{
"name": "rtk",
"description": "A Claude Code hook that routes Bash tool calls through rtk, the token-saving command wrapper, when rtk is installed.",
"version": "0.1.0",
"category": "Developer Tools",
"source": "./plugins/rtk"
}
]
}
+23 -1
View File
@@ -11,6 +11,28 @@
}
],
"_apm_source": "Mortis/Holocron/plugins/delivery"
},
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "\"${CLAUDE_PROJECT_DIR}/.claude/hooks/git/.apm/hooks/refuse-push-to-main.py\"",
"timeout": 10
}
],
"_apm_source": "Mortis/Holocron/plugins/git"
},
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "\"${CLAUDE_PROJECT_DIR}/.claude/hooks/rtk/.apm/hooks/route-through-rtk.sh\"",
"timeout": 10
}
],
"_apm_source": "Mortis/Holocron/plugins/rtk"
}
],
"SessionStart": [
@@ -20,7 +42,7 @@
{
"type": "command",
"command": "\"${CLAUDE_PROJECT_DIR}/.claude/hooks/kyberforge/.apm/hooks/check-apm-current.sh\"",
"timeout": 380
"timeout": 400
}
],
"_apm_source": "Mortis/Holocron/plugins/kyberforge"
+21 -1
View File
@@ -11,6 +11,26 @@
"timeout": 10
}
]
},
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "\"${CLAUDE_PROJECT_DIR}/.claude/hooks/git/.apm/hooks/refuse-push-to-main.py\"",
"timeout": 10
}
]
},
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "\"${CLAUDE_PROJECT_DIR}/.claude/hooks/rtk/.apm/hooks/route-through-rtk.sh\"",
"timeout": 10
}
]
}
],
"SessionStart": [
@@ -20,7 +40,7 @@
{
"type": "command",
"command": "\"${CLAUDE_PROJECT_DIR}/.claude/hooks/kyberforge/.apm/hooks/check-apm-current.sh\"",
"timeout": 380
"timeout": 400
}
]
}
+7 -3
View File
@@ -48,16 +48,16 @@ apm_modules/
.claude/hooks/
# `apm pack` bundle output. The pre-push gate runs pack with --dry-run, so this
# only appears after a bare `apm pack` during a release; it is not repo content.
# only appears after a non-dry-run `apm pack` during a release; it is not repo content.
build/
# `apm pack`'s manifest for the *root* package. Emitted beside the marketplace
# manifest by a bare `apm pack`, and never tracked on any branch — the repo's
# manifest by `apm pack` run with no flags, and never tracked on any branch — the repo's
# own paths hide it, since the apm-pack-check-clean pre-push hook, the only
# thing that runs pack here, passes --dry-run. It is NOT write-only output:
# pack reads an existing copy back in preference to apm.yml and only rewrites
# it with --force, so a stale copy leaks an old version and config into every
# bundle. Pack releases with `apm pack --force`, or delete this file first. Scoped
# bundle. Pack releases with `uv run --frozen apm pack --force`, or delete this file first. Scoped
# to the file, not the directory: the sibling .claude-plugin/marketplace.json is
# compiled output that IS committed and must stay tracked.
/.claude-plugin/plugin.json
@@ -66,3 +66,7 @@ build/
# apm copies the whole hooks directory, so a stray cache would deploy with it.
__pycache__/
*.pyc
# uv's project environment for the repo-pinned apm (ADR-0034). Created by
# `uv sync --frozen` from the committed uv.lock; machine-local, never content.
.venv/
+33 -23
View File
@@ -71,7 +71,7 @@ repos:
- id: check-executables-allow-sync
name: Check executables allow keys sync
description: Verify root apm.yml's executables.allow carries a "<name>#<version>" key matching the apm.yml version of every plugin that ships executables (plugins/<name>/.apm/hooks/ or bin/), reporting every out-of-sync package in one run. apm's grant is version-blind, so a stale key still deploys; this is a record-keeping gate that fails a version bump made without the matching key edit, keeping each key an accurate record of what was approved (see ADR-0019's 2026-09-19 correction and docs/spec/gates.md)
description: Verify root apm.yml's executables.allow carries a "<host>/<owner>/<repo>/plugins/<name>#<version>" key -- the full package identity apm 0.39 matches on, derived from root apm.yml's git+path dependency entry for the plugin, plus the plugin's apm.yml version -- for every plugin that ships executables (plugins/<name>/.apm/hooks/ or bin/), reporting every out-of-sync package in one run. A bare "<name>#<version>" key fails, because apm 0.39 parks the hooks under it while root `apm audit --ci` stays green (spike #269). The version half is version-blind to apm, so a stale version still deploys; that half is a record-keeping gate that fails a version bump made without the matching key edit (see ADR-0019's 2026-09-19 correction and docs/spec/gates.md). It also fails when apm.lock.yaml records any gated_* exec_status, a parked executable that root `apm audit --ci` lets through
entry: bash scripts/check-executables-allow-sync.sh
language: system
stages: [pre-push]
@@ -80,41 +80,48 @@ repos:
- id: apm-audit-ci
name: apm audit --ci
description: Run apm's producer-side CI gate over the root manifest AND each plugin package, via scripts/apm-audit-ci.sh. On the root manifest it runs ten checks -- lockfile-exists, ref-consistency, deployment-ledger-owners, deployed-files-present, no-orphaned-packages, skill-subset-consistency, config-consistency, content-integrity, includes-consent, drift -- so it is both a hidden-Unicode scan and a drift gate that replays the install and diffs it. In a plugin package it runs one, lockfile-exists, which the script waives when that package declares dependencies, because a package is not an install root (ADR-0026). The waiver never applies to the root and never covers a second failing check. It does NOT enforce an org policy; see the comment below for why. Reference:plugins/kyberforge/.apm/skills/apm-workflow/references/audit.md
description: Run apm's producer-side CI gate over the root manifest AND each plugin package, via scripts/apm-audit-ci.sh. On the root manifest apm 0.39.3 runs fifteen checks -- lockfile-exists, ref-consistency, deployment-ledger-owners, deployed-files-present, no-orphaned-packages, lockfile-targets-current, skill-subset-consistency, config-consistency, native-mcp-ownership, content-integrity, local-bundle-hooks, hook-approval-pins, exec-status-current, includes-consent, drift -- so it is both a hidden-Unicode scan and a drift gate that replays the install and diffs it. In a plugin package it runs two, lockfile-exists and a content-integrity row that scans no package source; the script waives lockfile-exists when that package declares dependencies, because a package is not an install root (ADR-0026). The waiver never applies to the root and never covers a second failing check. It does NOT enforce an org policy; see the comment below for why. Reference:plugins/kyberforge/.apm/skills/apm-workflow/references/audit.md
entry: scripts/apm-audit-ci.sh
language: system
stages: [pre-push]
pass_filenames: false
always_run: true
# What this hook actually runs, read off apm 0.28.0's own compliance
# What this hook actually runs, read off apm 0.39.3's own compliance
# table by invoking `apm audit --ci` at the repo root and in
# plugins/lint/. Long form in docs/spec/gates.md, "apm-audit-ci".
# plugins/lint/ (holocron#272; first done on 0.28.0, which ran ten
# root checks and one plugin check). Long form in docs/spec/gates.md,
# "apm-audit-ci".
#
# * ROOT MANIFEST -- ten checks: lockfile-exists, ref-consistency,
# * ROOT MANIFEST -- fifteen checks: lockfile-exists, ref-consistency,
# deployment-ledger-owners, deployed-files-present,
# no-orphaned-packages, skill-subset-consistency, config-consistency,
# content-integrity, includes-consent, drift. It is a drift gate: it
# no-orphaned-packages, lockfile-targets-current,
# skill-subset-consistency, config-consistency, native-mcp-ownership,
# content-integrity, local-bundle-hooks, hook-approval-pins,
# exec-status-current, includes-consent, drift. It is a drift gate: it
# replays the install cache-only and diffs the scratch result against
# the working tree. Root lockfile-exists is not vacuous -- the root
# declares dependencies, so it reports `Lockfile present`.
# * PLUGIN MANIFESTS -- one check: lockfile-exists. Conditional, and
# * PLUGIN MANIFESTS -- two checks: lockfile-exists, and a
# content-integrity row that scans no package source (it passed with
# a planted bidi override). lockfile-exists is conditional, and
# vacuous while every plugin apm.yml declares
# `dependencies: {apm: [], mcp: []}`: it reports `No dependencies
# declared -- lockfile not required` and arms itself the moment one
# does not (verified by adding a git dependency to
# plugins/lint/apm.yml). Everything else above is root-only, because
# plugins/lint/apm.yml). Everything else in the root list is
# root-only, because
# only the root install has a lockfile, a deployment ledger and
# deployed files to check. Running every plugin package is what
# makes lockfile-exists reachable for them at all -- the root-only
# invocation audits the root manifest and nothing else.
# THAT ARMING NOW HAPPENS: plugins/mattpocock declares real dependencies,
# and there is no green state for it -- without a package lockfile
# lockfile-exists fails, and with one it passes and arms the other
# nine, where drift then demands the dependency's skills be deployed
# lockfile-exists fails, and with one it passes and arms the rest of
# the root set, where drift then demands the dependency's skills be deployed
# INSIDE the package. A package is not an install root, so
# scripts/apm-audit-ci.sh waives that single check for a package and
# nothing else (ADR-0026). Dropping --ci for packages would have been
# smaller and is wrong: verified on apm 0.28.0, plain `apm audit`
# smaller and is wrong: verified on apm 0.28.0 and 0.39.3, plain `apm audit`
# exits 0 on a dependency entry missing its git/path/registry field
# while --ci exits 1 naming it, and malformed-dependency detection is
# the whole reason packages are audited.
@@ -125,13 +132,14 @@ repos:
# check. Both claims were wrong. What is true is that the STANDALONE
# mode differs: plain `apm audit` (--ci refuses to combine with
# --file/--strip/--dry-run/PACKAGE) run in a plugin directory reports
# `No apm.lock.yaml found -- nothing to scan` and exits 0, because
# only the root has a lockfile.
# * MANIFEST-PARSE IS NOT A CHECK in apm 0.28.0's table, and an earlier
# revision of this comment named it as one. Parsing is still
# enforced -- a dependency entry missing its git/path/registry field
# fails with `Cannot parse apm.yml` -- but it fails the invocation
# before the table is built, so it never appears as a row.
# `No recognized deployed primitives found -- nothing to scan` on
# 0.39.3 (`No apm.lock.yaml found -- nothing to scan` on 0.28.0) and
# exits 0, because only the root has a lockfile.
# * MANIFEST-PARSE IS A ROW ON 0.39.3, not on 0.28.0. A dependency entry
# missing its git/path/registry field now yields a one-row table with
# a failing manifest-parse row (`Cannot parse apm.yml: ...`); 0.28.0
# failed the invocation before building the table. A parsable
# manifest gets no such row.
# * POLICY IS NOT ENFORCED. `apm audit --ci` discovers an org policy
# from the git remote, and apm's discovery only understands
# github.com and Azure DevOps. This repo's remote is a self-hosted
@@ -146,8 +154,10 @@ repos:
# serve one. A gate that can never go green is not a gate. Revisit if
# this repo ever gains a policy source apm can actually reach.
#
# Costs ~0.5s per package. Needs no network ONCE `apm install` has
# populated apm_modules/ -- the root marketplace has no remote package
# Takes 70-90 s for the root plus every plugin through `uv run` on
# apm 0.39.3 (about 0.5 s per package on 0.28.0). Needs no network ONCE
# `uv sync --frozen` and `uv run --frozen apm install` have each run
# once -- the root marketplace has no remote package
# entries, so the install replay is cache-only. On a FRESH CLONE there
# is no cache: deployed-files-present fails outright, and drift and
# config-consistency clone from the holocron remote. See README.md's
@@ -263,8 +273,8 @@ repos:
- id: check-rtk-prefix
stages: ['pre-commit']
name: ADR-0023 rtk prefix on executable git commands
description: Enforce ADR-0023 clause 1 -- an executable, instructed git command in a shell code fence or a dispatch-table Run cell is written `rtk git`. Clauses 2 and 3 are not machine-decidable; a deliberately bare command opts out with the literal string ADR-0023 on its own line
name: rtk prefix on executable git commands (ADR-0023)
description: Enforce ADR-0023 clause 1 -- an executable, instructed git command in a shell code fence or a dispatch-table Run cell is written `rtk git`. Clauses 2 and 3 are not machine-decidable; a deliberately bare command opts out with the rtk-bare marker and its reason on the same line
entry: scripts/check-rtk-prefix.sh
language: script
files: '^plugins/[^/]+/\.apm/(skills/.*\.md|agents/.*\.agent\.md)$'
+4 -3
View File
@@ -28,9 +28,10 @@ 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 `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.
- **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). `apm install` deploys from the lock; `apm update` is what re-resolves refs.
- **No pre-push hook needs the network — once `apm install` has run.** Root `apm.yml`'s marketplace has no remote package entries, so every hook resolves locally. The guarantee is a property of 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. Run `apm install` once on a new checkout and the offline guarantee holds from then on (`docs/spec/gates.md`, "Pushing without a network").
- **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 whatever is on `PATH`, possibly an older apm that refuses the v4 `apm.lock.yaml`.
- **`apm.lock.yaml` turning up modified is expected, not a bug.** kyberforge's `SessionStart` hook keeps the install current on launch: it runs `uv run --frozen apm update --yes` 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. A checkout that apm 0.28 deployed or populated needs one-time migration steps, and its first session-start rewrite of the lock can be wrong: see `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.
- **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. (`docs/spec/gates.md`, "Pushing without a network").
- **A plugin `version:` bump that has merged to `main` gets its release tag.** Run `git fetch origin --tags`, then `scripts/tag-plugin-releases.sh`; exit 1 means a tag is missing, and `--apply` creates it locally and prints the push command. The script reads local tags only, so OK means present locally, not published: confirm with `git ls-remote --tags origin '<plugin>-v*'` before calling it done. A tag push is an irreversible publish, not a free Propose-tier push (ADR-0032): show the maintainer the exact tags and that command, and only on their explicit yes in this conversation run exactly it yourself (named tags, never `--tags` or other refs). Agents cut release tags only with the script, which never moves or deletes one; exit 2 means stop and report it to the maintainer, never hand-fix, move or delete a tag (ADR-0033).
- **This repo and Gitea are the only source of truth.** All project state, decisions, and working conventions live here. Do not use an external memory system for this project — cached state diverges from the repo and you get a split brain. Before answering any design or architecture question, check `docs/adr/` for an existing decision.
+5 -1
View File
@@ -154,4 +154,8 @@ Under the `run-tests` pre-push hook, git exported `GIT_DIR` to the hook, so a ba
## 2026-11-26 — A hook's GIT_DIR leaks through any tool that runs git
#204: pushing from a linked worktree left the shared `.git/config` with `core.bare=true` and the worktree on a detached HEAD at the lock-pinned commit. git exports an absolute `GIT_DIR` to hooks run from a linked worktree. `apm-audit-ci` ran `apm audit --ci`, and its drift replay (apm 0.28.0) runs `git init` and `git checkout` in a temp dir with an env copied from `os.environ`. The inherited `GIT_DIR` won, so both operations hit this repo instead of the temp dir. The 2026-11-13 fix did not cover this: it scrubbed the env only inside `tests/run-tests.sh`, and the apm hooks never pass through that file. Fix: `scripts/lib/clean-git-env.sh` unsets the repo-locating vars, and both `scripts/apm-audit-ci.sh` and the new `scripts/apm-pack-check-clean.sh` source it before calling apm. `tests/test-apm-hooks-git-env.sh` reproduces the leak with a stub `apm`. Rule: any hook that shells out to a tool that runs git must scrub `GIT_*` first. Scrubbing one entry point does not protect the others.
#204: pushing from a linked worktree left the shared `.git/config` with `core.bare=true` and the worktree on a detached HEAD at the lock-pinned commit. git exports an absolute `GIT_DIR` to hooks run from a linked worktree. `apm-audit-ci` ran `apm audit --ci`, and its drift replay (apm 0.28.0) runs `git init` and `git checkout` in a temp dir with an env copied from `os.environ`. The inherited `GIT_DIR` won, so both operations hit this repo instead of the temp dir. The 2026-11-13 fix did not cover this: it scrubbed the env only inside `tests/run-tests.sh`, and the apm hooks never pass through that file. Fix: `scripts/lib/clean-git-env.sh` unsets the repo-locating vars, and both `scripts/apm-audit-ci.sh` and the new `scripts/apm-pack-check-clean.sh` source it before calling apm. `tests/test-apm-hooks-git-env.sh` reproduces the leak with a stub `apm`. Rule: any hook that shells out to a tool that runs git must scrub `GIT_*` first. Scrubbing one entry point does not protect the others. *2026-12-02 (#272):* apm 0.39.3's `apm_cli/utils/git_env.py` provides `git_subprocess_env`, which strips `GIT_DIR` and the other repo-locating vars. The leak was not re-tested on 0.39.3, and the scrub stays, because the rule is about the hook, not about one tool version.
## 2026-12-06 — Two correct gates can make a first landing unpushable
#179: `check-executables-allow-sync` requires a new hook-shipping plugin's git+path entry in root `apm.yml`, while root deps resolve from the remote's `main` (ADR-0019), so `apm-audit-ci`'s `ref-consistency` fails until the plugin lands — no state of the branch passes both. Fix: a narrow, self-expiring waiver in `scripts/apm-audit-ci.sh` keyed on the plugin being absent from local `origin/main`. Rule: when adding a gate that reads the remote's `main`, check what a first landing of the thing it guards looks like.
+25 -13
View File
@@ -8,7 +8,7 @@ Content ships as installable plugins, each an apm (Agent Package Manager) packag
| Path | What it holds |
| --- | --- |
| `plugins/` | The apm packages — `bin`, `core`, `git`, `gitea`, `kyberforge`, `lint`, `mattpocock`, `delivery`, `ansible`, `gitops`, `k8s`, `plan` — each carrying skills, and where relevant agents, hooks, and bundled assets |
| `plugins/` | The apm packages — `bin`, `core`, `git`, `gitea`, `kyberforge`, `lint`, `mattpocock`, `delivery`, `ansible`, `gitops`, `k8s`, `plan`, `rtk` — each carrying skills, and where relevant agents, hooks, and bundled assets |
| `providers/claude-code/` | Claude Code adapter, deployed to `~/.claude/` via `scripts/install.sh` |
| `core/` | Provider-agnostic always-on content — `core/AGENTS.md` and `core/instructions/` |
| `docs/` | Specs (`docs/spec/`), architectural decisions (`docs/adr/`), governance, research, and notes |
@@ -36,8 +36,8 @@ Install all of these before setting up. Each one is a hard dependency of a git h
| Tool | Why | Install |
| --- | --- | --- |
| `apm` CLI | Two pre-push hooks shell out to it (`apm-audit-ci` and `apm-pack-check-clean`) | The `apm-install` skill, or `curl -sSL https://aka.ms/apm-unix \| sh`. Verify with `apm --version` |
| `python3` + PyYAML | Required by `scripts/skill-size-check.sh` (the `skill-size-check` pre-commit hook) and `scripts/check-skill-version-bump.sh` (the `check-skill-version-bump` pre-push hook), which both parse YAML frontmatter | `python3` is usually present — pre-commit is itself a Python application. `pip install pyyaml` if the hook reports PyYAML missing |
| `uv` | Runs this repo's pinned apm. The root `pyproject.toml` pins `apm-cli==0.39.3` and `uv.lock` locks it (ADR-0034); the `apm-audit-ci` and `apm-pack-check-clean` pre-push hooks run it as `uv run --frozen apm` through `scripts/lib/apm.sh`, and fail below apm 0.39.2 | https://docs.astral.sh/uv/getting-started/installation/. A global `apm` is not needed and not used: a bare `apm` here may be an older one that refuses the v4 `apm.lock.yaml` |
| `python3` + PyYAML | Required by `scripts/skill-size-check.sh` (the `skill-size-check` pre-commit hook) and `scripts/check-skill-version-bump.sh` (the `check-skill-version-bump` pre-push hook), which both parse YAML frontmatter. `scripts/install.sh` needs `python3` (not PyYAML) to merge the Claude Code settings | `python3` is usually present — pre-commit is itself a Python application. `pip install pyyaml` if the hook reports PyYAML missing |
| `vale` | Required by the `vale-audit-prefilter-skill` / `-agent` pre-commit hooks, and by the `test-vale-wrap.sh` suite that `run-tests --strict` runs at pre-push | `brew install vale` (macOS), `snap install vale` (Linux), `choco install vale` (Windows), or https://vale.sh/docs/vale-cli/installation/ |
| `claude` CLI | Required by the `validate-marketplace` pre-push hook | Claude Code |
@@ -51,25 +51,36 @@ Two notes worth reading before you skip one:
Run these in order, from the repo root.
```bash
# 1. Deploy this repo's own skills and agents
apm install
# 1. Install the pinned apm into .venv/ (gitignored)
uv sync --frozen
# 2. Install the git hooks — all three stages
# 2. Deploy this repo's own skills and agents
uv run --frozen apm install
# 3. Install the git hooks — all three stages
pre-commit install -t pre-commit -t commit-msg -t pre-push
```
**`apm install`** deploys the plugins root `apm.yml` lists into `.claude/skills/` and `.claude/agents/`. Both are gitignored install output, *not* authoring source — `plugins/<name>/.apm/` remains the only place to edit. It needs the network and materializes `apm_modules/` (which stays gitignored).
**`uv sync --frozen`** installs the apm that `uv.lock` pins into `.venv/`.
**`uv run --frozen apm install`** deploys the plugins root `apm.yml` lists into `.claude/skills/` and `.claude/agents/`. Both are gitignored install output, *not* authoring source — `plugins/<name>/.apm/` remains the only place to edit. Steps 1 and 2 each need the network once per checkout; the first apm 0.39 install also records commit-reachability verdicts. The install materializes `apm_modules/` (which stays gitignored).
**Run apm only through `uv run --frozen apm`.** A bare `apm` reaches whatever is on `PATH`, possibly an older apm that refuses the v4 `apm.lock.yaml`. The global pipx apm 0.28.0 some machines carry is not used in this repo.
**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. kyberforge's `SessionStart` hook is such a writer: it runs `uv run --frozen apm update --yes` at session start, so it can write the bad lock before you read this. To recover, discard it with `git checkout -- apm.lock.yaml`, move `apm_modules/` aside, then run `uv run --frozen apm install`. 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
The first-party dependencies in root `apm.yml` are unpinned against the default branch, so deployed skills go stale whenever anyone merges. kyberforge's `SessionStart` hook keeps the install current automatically on launch, rewriting `apm.lock.yaml` in the process — an unexplained modification to it after opening a session is expected, not a bug. On `main`, commit or discard it deliberately. On a feature branch, discard it (`git checkout -- apm.lock.yaml`, then `apm install`). The committed lock records a `main` commit too, just an older one. Discarding keeps lock churn unrelated to the branch out of its diff, and keeps the deployed tree consistent with the committed lock that `apm pack --check-clean` reads. The trade-off: the session then runs the older `main` the lock records, which is accepted on a feature branch. The discard also lasts only until the next session start, when the hook finds the lock behind `main` and refreshes again. Mechanism and rationale: `docs/adr/0019-session-start-hook-keeps-the-apm-install-current.md`.
The first-party dependencies in root `apm.yml` are unpinned against the default branch, so deployed skills go stale whenever anyone merges. kyberforge's `SessionStart` hook keeps the install current automatically on launch, rewriting `apm.lock.yaml` in the process — an unexplained modification to it after opening a session is expected, not a bug. On `main`, commit or discard it deliberately. On a feature branch, discard it (`git checkout -- apm.lock.yaml`, then `uv run --frozen apm install`). The committed lock records a `main` commit too, just an older one. Discarding keeps lock churn unrelated to the branch out of its diff, and keeps the deployed tree consistent with the committed lock that `apm pack --check-clean` reads. The trade-off: the session then runs the older `main` the lock records, which is accepted on a feature branch. The discard also lasts only until the next session start, when the hook finds the lock behind `main` and refreshes again. Mechanism and rationale: `docs/adr/0019-session-start-hook-keeps-the-apm-install-current.md`.
Note the difference between the two commands:
- `apm install` deploys from `apm.lock.yaml`. It does **not** pick up remote changes.
- `apm update` re-resolves refs. This is the command that pulls in a merged `.apm/` edit.
- `uv run --frozen apm install` deploys from `apm.lock.yaml`. It does **not** pick up remote changes.
- `uv run --frozen apm update` re-resolves refs. This is the command that pulls in a merged `.apm/` edit.
## Running tests
@@ -92,7 +103,7 @@ pre-commit run --hook-stage pre-push --all-files
See [`docs/spec/gates.md`](docs/spec/gates.md) for what each hook enforces and why.
**Offline?** No pre-push hook needs the network **once `apm install` has populated `apm_modules/`**. Root `apm.yml`'s marketplace has no remote package entries (the last one, `mattpocock-skills`, was removed), so `apm-pack-check-clean` resolves everything from local sources, and `apm-audit-ci`'s install-replay is cache-only against a populated install. On a **fresh clone** there is no cache: `apm-audit-ci`'s `deployed-files-present` fails outright, and its `drift` and `config-consistency` checks clone from the holocron remote. The offline guarantee is a property of a populated `apm_modules/`, not of the hook set — run `apm install` once on a new checkout and it holds from then on.
**Offline?** No pre-push hook needs the network **once `uv sync --frozen` and `uv run --frozen apm install` have each run once, online** (ADR-0034). Root `apm.yml`'s marketplace has no remote package entries (the last one, `mattpocock-skills`, was removed), so `apm-pack-check-clean` resolves everything from local sources, and `apm-audit-ci`'s install-replay is cache-only against a populated install. On a **fresh clone** there is no cache: `apm-audit-ci`'s `deployed-files-present` fails outright, and its `drift` and `config-consistency` checks clone from the holocron remote. The offline guarantee is a property of a synced `.venv/` and a populated `apm_modules/`, not of the hook set — run `uv sync --frozen` and `uv run --frozen apm install` once on a new checkout and it holds from then on.
## Editing plugin content
@@ -127,7 +138,7 @@ dependencies:
ref: git-v1.3.9
```
Then run `apm install`. Without `ref:`, the entry tracks the default branch. To list a plugin's
Then run `apm install` in your own repo. Without `ref:`, the entry tracks the default branch. To list a plugin's
releases, run `git ls-remote --tags https://git.rkdr.net/Mortis/Holocron.git '<plugin>-v*'`;
`apm outdated` also reports newer `<plugin>-v<x.y.z>` tags.
@@ -135,7 +146,8 @@ releases, run `git ls-remote --tags https://git.rkdr.net/Mortis/Holocron.git '<p
The shorthand `git.rkdr.net/Mortis/Holocron/plugins/<name>#<plugin>-v<x.y.z>` does not work on this
host. apm reads `plugins/<name>` as part of the repository path, so a real install tries to clone
`.../Holocron/plugins/<name>.git` and fails with "Not found". `apm install --dry-run` does not catch
`.../Holocron/plugins/<name>.git` and fails because no such repository exists (on apm 0.39.3:
"Repository Mortis/Holocron/plugins/<name> not found on git.rkdr.net"). `apm install --dry-run` does not catch
this. Use the object form.
### Automated updates
+1218 -118
View File
File diff suppressed because it is too large. Load diff
+38 -18
View File
@@ -1,5 +1,5 @@
name: holocron
version: 0.9.1
version: 0.9.4
description: AI development skills for Claude Code, and for GitHub Copilot through apm — factory, design, implement, review, and cross-cutting workflows.
license: MIT
@@ -51,33 +51,49 @@ dependencies:
# Ticket and idea planning, up to an agent-ready spec and breakdown.
- git: https://git.rkdr.net/Mortis/Holocron.git
path: plugins/plan
# Routes Bash tool calls through rtk when it is installed (#179).
- git: https://git.rkdr.net/Mortis/Holocron.git
path: plugins/rtk
mcp: []
# Turns apm's executable-trust gate ON. Without this block the gate is disabled
# and every hook, bin and MCP primitive a dependency ships deploys silently —
# verified: `apm approve --list` reports "Executable-trust gate disabled -- all
# executables deploy" until an `executables:` block exists.
# verified on 0.39.3: `apm approve --list` reports "Executable-trust gate
# disabled -- executables need no approval" until an `executables:` block
# exists.
#
# Keys are the FULL package identity apm 0.39 matches on,
# <host>/<owner>/<repo>/<path>#<version>, as `apm approve --list` prints it.
# The bare `kyberforge#<version>` form 0.28 accepted no longer matches: under
# 0.39.3 it parks both hooks, writes `.claude/settings.json` back to `{}`, and
# root `apm audit --ci` still passes (spike #269, on #268). The `#<version>`
# suffix is stripped before matching, so the grant is version-blind and a
# plugin bump alone does not park the hook; the suffix is a repo convention
# that `scripts/check-executables-allow-sync.sh`, a pre-push hook, holds level
# with each plugin's apm.yml `version:`.
#
# The grants are type-level (`hooks: true`), not content-pinned. Every install
# warns that they are not pinned to content; that is accepted, because a
# content pin parks the hook on every edit to its scripts until someone re-runs
# `apm approve`. Do not run `apm approve` here: it rewrites this block, adds
# content pins and strips these comments.
#
# kyberforge ships the SessionStart hook that keeps this install level with the
# remote (ADR-0019). The `#2.0.0` suffix below is cosmetic as far as apm is
# concerned: grants are version-BLIND in apm 0.28.0. `_map_grants`
# (apm_cli/security/executables.py) matches the exact key, the version-blind
# name, or any stored key sharing that name, and `materialize_exec_map` also
# stores the version-blind name — so approving `kyberforge` covers
# `kyberforge#2.0.0` and vice-versa, and a kyberforge version bump does NOT
# make this entry stop matching or stop the hook deploying. Do not delete the
# suffix anyway: `scripts/check-executables-allow-sync.sh` is a repo-authored
# pre-push hook that asserts this key carries the version in
# plugins/kyberforge/apm.yml, so a bump here is a repo convention to keep, not
# an apm mechanic.
# remote (ADR-0019).
executables:
allow:
kyberforge#2.3.0:
git.rkdr.net/Mortis/Holocron/plugins/kyberforge#2.3.2:
hooks: true
bin: true
# delivery ships the guard hook (ADR-0032 enforcement layer 2). Same
# version-in-key convention as above, kept by the same sync check.
delivery#0.8.0:
# full-identity, version-in-key convention as above, kept by the same check.
git.rkdr.net/Mortis/Holocron/plugins/delivery#0.8.2:
hooks: true
# git ships the hook that refuses a push to main.
git.rkdr.net/Mortis/Holocron/plugins/git#1.4.1:
hooks: true
# rtk ships the hook that routes Bash tool calls through rtk.
git.rkdr.net/Mortis/Holocron/plugins/rtk#0.1.0:
hooks: true
marketplace:
@@ -86,7 +102,7 @@ marketplace:
# top-level apm.yml description:/version: above are NOT inherited into the
# compiled output despite being used elsewhere (e.g. by `apm audit`).
description: AI development skills for Claude Code, and for GitHub Copilot through apm — factory, design, implement, review, and cross-cutting workflows.
version: 0.9.1
version: 0.9.4
owner:
name: Mortis
url: https://git.rkdr.net/Mortis/
@@ -157,3 +173,7 @@ marketplace:
- name: plan
source: ./plugins/plan
category: Productivity
- name: rtk
source: ./plugins/rtk
category: Developer Tools
@@ -10,6 +10,12 @@ accurate about how Claude Code's installer works; what changed is that nothing c
they governed; the symlink amendment's underlying gap is not — see ADR-0024's consequences. This
ADR's content is kept below as the historical record; it is no longer the current model.
*Amended 2026-12-02 (holocron#272): the apm 0.28.0 mechanism under Considered options holds on apm
0.39.3, checked in source. `build_plugin_manifest` still strips `("agents", "skills", "commands",
"instructions")`, and `synthesize_plugin_json_from_apm_yml` still emits only identity fields. One
addition: for the `codex` ecosystem only, 0.39.3 adds `skills` and `mcpServers` pointers after the
strip.*
---
This ADR is a follow-on correction to ADR-0015 (Microsoft APM replaces hand-authored
@@ -12,6 +12,11 @@ repo-pinned `uv run --frozen` apm, else `PATH` apm, else exit 0) instead of a ba
The "0.28.0" claims below (the correction near line 80, the `apm outdated` prose at about line 143,
and the sidecar reproduction at about line 217) are pending re-verification on 0.39.3 under #265.*
*Amended 2026-12-02 (holocron#272): those claims are re-checked on apm 0.39.3, and the results sit
beside each claim. The version-blind matching holds, but the key's name half is now the full
package identity (#271). The `apm outdated` prose holds. The sidecar reproduction was not re-run.
In this repo every apm command named below runs as `uv run --frozen apm ...` (ADR-0034).*
## Context
The pre-existing answer was `scripts/git-hooks/post-push`, which pulled the marketplace clone and
@@ -92,6 +97,18 @@ question is only what catches a missed edit.
> justified by this repo's own requirement that the key track `plugins/kyberforge/apm.yml`'s
> `version:`, not by an apm-level failure mode. `docs/spec/gates.md` carries the same correction.
> **Amendment (2026-12-02, holocron#272) — the key is now the full package identity.** The
> version-blind matching in the correction above holds on apm 0.39.3: `is_package_approved`,
> `materialize_exec_map` and `_map_grants` keep the same roles in its source. The bare
> `kyberforge#<version>` key described above no longer matches on 0.39. apm 0.39 matches a grant on
> the package identity `apm approve --list` prints, so the key is
> `git.rkdr.net/Mortis/Holocron/plugins/kyberforge#<version>` (#271). A bare key leaves the hook
> parked: the first 0.39 install drops it from `.claude/settings.json`, and root `apm audit --ci`
> still passes (spike #269). `scripts/check-executables-allow-sync.sh` therefore derives each
> expected key from root `apm.yml`'s `git:` + `path:` entry for the plugin, fails a bare key, and
> fails any `gated_*` `exec_status` in `apm.lock.yaml`. The `#<version>` half is still a repo-level
> record. `docs/spec/gates.md`, "check-executables-allow-sync", has the details.
A comment in the `executables:` block is not enough: this repo gates generated-content drift,
marketplace mirror drift and vale style drift deterministically, and a silent-staleness failure is
strictly worse than any of them. So `scripts/check-executables-allow-sync.sh` runs at pre-push,
@@ -158,6 +175,10 @@ silently and no refresh ran. With six packages merging independently, one-behind
case rather than an edge, which means the mechanism failed most often in exactly the situation it
exists for. The match is now `outdated dependenc(y|ies) found`.
> **Amendment (2026-12-02, holocron#272) — holds on apm 0.39.3.** `apm outdated --help` still lists
> no `--json` or other machine-readable flag, and `apm_cli/commands/outdated.py` still picks
> `dependency` or `dependencies` by count.
The deeper lesson is the one `post-push` already taught and this repeated: every assertion about the
hook mocked `apm`, so the suite was green while the hook could not detect the common case. Mocks
verify the code against its author's belief about the interface, never the interface. The suite now
@@ -228,6 +249,12 @@ protecting, that nothing repo-authored goes in that file, is unchanged.
> is apm output like the settings entry it describes, so it is committed for the same reason and
> changes only when the owning package is renamed or moved. `.claude/hooks/` stays ignored.
> **Amendment (2026-12-02, holocron#272) — not re-run on apm 0.39.3.** The sidecar is still
> committed, and with it root `apm audit --ci` passes all 15 checks on 0.39.3. The 0.28.0 failure
> without the sidecar was not reproduced. apm 0.38 and later refuse to replace managed files that
> lack deployment evidence, so the failure without it may now look different. That was not
> established.
**Native consumers are protected by a guard, not by the gate.** A host installing holocron through
`claude plugin install` auto-discovers `hooks/hooks.json` and does not consult apm's trust gate at
all. The script therefore exits silently when there is no `apm.lock.yaml` in the working directory,
@@ -118,6 +118,12 @@ result against the working tree, and `content-integrity` scans for hidden Unicod
the finding: both gates compare bytes, neither reads the `description` key for sense, so propagation
is still not verification.
*Amended 2026-12-02 (holocron#272): on apm 0.39.3, root `apm audit --ci` runs fifteen checks, not
ten. It adds `lockfile-targets-current`, `native-mcp-ownership`, `local-bundle-hooks`,
`hook-approval-pins` and `exec-status-current`. A plugin package runs two, with `content-integrity`
added to `lockfile-exists`. None of the new checks reads the `description` key for sense, so the
finding stands. The current list is in `docs/spec/gates.md`, "apm-audit-ci".*
**And the obligation is unbounded.** Under enumeration, adding one skill to `bin`, `git` or `gitea`
means editing two copies of a prose string on top of the version bumps and regeneration any skill
addition already owes under this repo's release policy
@@ -166,3 +166,12 @@ that was false about the `gitea-*` skills and a citation to a file that does not
A `check-rtk-prefix` pre-commit hook and `tests/test-check-rtk-prefix.sh` land with it; the test runs
the gate against the pre-sweep corpus on `main` and asserts it fails there, because a gate that only
passes on the fixed tree proves nothing about the drift it was written for.
## Addendum (2026-12-06): the opt-out marker is `rtk-bare:`
The clause-3 opt-out marker that `check-rtk-prefix` accepts is now `rtk-bare:`, written on the same
line as the bare command and followed by its reason (`# rtk-bare: the output is parsed`). It replaces
the literal string `ADR-0023`, which the gate no longer accepts. The cause is issue #177: plugin
content is consumed by other repos, and a marker that cites this repo's ADR leaks a reference those
consumers cannot follow. The decision itself is unchanged — the three clauses, the per-line scope and
the inline-reason requirement all stand; only the marker string moved.
@@ -2,6 +2,31 @@
**Status:** Accepted (2026-09-20)
*Amended 2026-12-06 ([rtk routing hook](https://git.rkdr.net/Mortis/Holocron/issues/179)): "the root
manifest is never waived" below now holds for `lockfile-exists` only. The root has one narrow
waiver: `ref-consistency` for a plugin not yet on `origin/main`. Root `apm.yml`'s first-party
dependencies resolve from the remote's `main` (ADR-0019), so the lock cannot record a plugin before it
lands. `check-executables-allow-sync` meanwhile requires a hook- or bin-shipping plugin's git+path
entry before it can be pushed, so without the waiver such a plugin could never land. The waiver applies
only when all of these hold: the output reads `1 of 3 check(s) failed` and its one failing row is
`ref-consistency`; the details block appears exactly once and every line in it is `<identity>/plugins/<name>: not found
in lockfile`, for root `apm.yml`'s own entry and a name that starts alphanumeric and holds no `..`;
`plugins/<name>/apm.yml` is in the working tree and absent from the local `origin/main`, which must
resolve. On apm 0.39.3 a failing `ref-consistency` stops the root run after three checks, so the hook then
re-runs `apm audit --ci` on a scratch copy of the tree with those plugins' `dependencies.apm` entries
removed, and the push passes only if that run reports `All 15 check(s) passed`. The working tree is
never written. The waiver lapses for each plugin once it is on `origin/main`, when the follow-up PR that
records it in the lock is required.*
*Amended 2026-12-02 (holocron#272): re-verified on apm 0.39.3 in a scratch copy of
`plugins/mattpocock`. Without a package lock, the same line and `1 of 1 check(s) failed` appear, so
the waiver is unchanged. With one from `apm lock`, the rest of the root set arms (fourteen more
checks, not nine), and `drift` fails on 74 unintegrated files under `.agents/skills/`. Two details
below changed. A plugin package whose `lockfile-exists` passes now runs two checks, with
`content-integrity` added. Plain `apm audit` now prints `No recognized deployed primitives found --
nothing to scan`. The malformed-entry case still separates `--ci` (exit 1, now a failing
`manifest-parse` row) from plain `apm audit` (exit 0), so the rejection of dropping `--ci` stands.*
`plugins/onedev` is the first plugin package in this repo to declare a real dependency. It pins
`code.onedev.io/onedev/tod#v4.3.4` so that a consumer installing `onedev` from the holocron
marketplace picks up OneDev's eight TOD skills transitively — a `marketplace.packages` entry takes a
@@ -27,6 +27,9 @@ are packages and already resolve through the `path:` branch. The name is a conve
it assumes apm deploys the skill under the subpath's last segment, which it does today (verified on
apm 0.28.0 for `wayfinder`), and a rename upstream is caught by the pin, not by this gate.
*Amended 2026-12-02 (holocron#272): holds on apm 0.39.3. A `uv run --frozen apm install` deploys
`mattpocock/skills/skills/engineering/wayfinder#v1.3.2` to `.claude/skills/wayfinder/`.*
**Rejected: rewording the four clauses out of route notation.** Cheap, but it turns real routing
checks into SUGGESTIONs for exactly the skills most likely to be renamed upstream.
@@ -127,6 +127,14 @@ passed. Failed tasks are shown in the PR comment for the approver to judge. Deci
cluster or state and print no secret: anything not on the list is denied, so an unlisted mutating
subcommand fails safe. Codex cannot ask, so odd jobs are
denied there; an unrecognised runtime is treated the same way.
- *Amended 2026-12-05 ([rtk routing hook](https://git.rkdr.net/Mortis/Holocron/issues/179)): the
opt-in `rtk` plugin ships a Claude Code hook that rewrites Bash commands through `rtk hook claude`
and may return `permissionDecision: allow`, skipping the permission prompt. Accepted, because hooks
are guardrails, not the boundary; `git`'s push guard still sees `rtk git push`, as `rtk` is one of
its wrappers.*
- *Amended 2026-12-04 ([git push-to-main hook](https://git.rkdr.net/Mortis/Holocron/issues/178)): `git`
ships its own guardrail hook beside `delivery`'s, refusing a `git push` to `main` on Claude Code
only. It fails open and has an opt-out; branch protection stays the real control.*
- *Amended 2026-11-25 ([Pre-merge Ansible dry run without exposing production credentials](https://git.rkdr.net/Mortis/Holocron/issues/200)):
the reopened Ansible `--check --diff` now runs in CI from the base branch's copy with production
credentials — automatic on human-authored PRs, gated on bot PRs by an allowlisted human's
@@ -6,6 +6,15 @@
check in Context and the apm behaviour in consequence 3) are pending re-verification on 0.39.3 under
#265, once apm is pinned per repo (ADR-0034). The Decision is unchanged.*
> **Amendment (2026-12-02, holocron#272) — the 0.28.0 claims re-checked on apm 0.39.3.**
> - The tag pattern holds in source: `apm_cli/marketplace/tag_pattern.py` still lists
> `{name}-v{version}`. The synthetic-repo `apm outdated` run was not repeated.
> - Consequence 3's shorthand failure holds. A scratch install of
> `git.rkdr.net/Mortis/Holocron/plugins/lint#<tag>` fails with `Repository
> Mortis/Holocron/plugins/lint not found on git.rkdr.net`. The tag in that run did not exist, but
> the failure comes at repository resolution, before any ref is read.
> - The `rstrip(".git")` bug is fixed in 0.39.3, which uses `removesuffix(".git")`.
## Context
Issue #223. Consumers that pin a holocron package need a git tag per package version. Two consumers
@@ -92,6 +92,8 @@ different name.
apm and the version check.
4. **Re-verification is pending.** ADR-0019 and ADR-0033 state facts verified against apm 0.28.0.
They are re-checked on 0.39.3 under #265, and each carries a note saying so.
*Amended 2026-12-02 (holocron#272): done. ADRs 0017, 0019, 0021, 0026, 0029 and 0033 carry
dated notes with the 0.39.3 result for each claim.*
Related: ADR-0019, ADR-0024, ADR-0033; #245, #265; Defame1297/ansible-homelab-mono#1078;
Mortis/Kamino#499.
@@ -0,0 +1,83 @@
# Bundled Claude Code skills are turned off at user level
**Status: accepted (2026-12-03), amended 2026-12-06 (#286).**
## Context
Issue #266. Claude Code ships bundled skills and syncs skills from the claude.ai account, and the
operator wants only this repo's plugin skills. Claude Code 2.1.334 has no allowlist: a skill missing
from `skillOverrides` is on, and `Skill(x)` allow rules do not restrict other skills. The operator
wanted a setting that also covers bundled skills added later. A custom `/ship` is also not loaded
where the built-in one is available.
On Claude Code 2.1.337 the switch does not cover built-in plugins (`cc-plugin-*@builtin`). Their
skills `design`, `doctor` and `plugin-authoring` still load, and so do their tools (#286).
## Decision
**Bundled skills are turned off with one switch; built-in plugin skills need a per-name list.** The
settings live at user level in `providers/claude-code/settings.json`, which `scripts/install.sh` deploys to
`~/.claude/settings.json`:
- `disableBundledSkills: true`
- `syncClaudeAiSkills: false`
- `env.CLAUDE_CODE_DISABLE_SHIP: "1"`, the documented fix for the custom `/ship`.
- `skillOverrides.init: "off"`
- `skillOverrides` `design`, `doctor` and `plugin-authoring`: `"off"`, for the built-in plugin skills.
- `enabledPlugins`: `cc-plugin-easel@builtin` and `cc-plugin-plugin-authoring@builtin` set to `false`.
`cc-plugin-privacy`, `-agents-md`, `-telemetry` and `-verbs` stay on: they add no skills and their
behaviour has not been checked.
- `syncClaudeAiPlugins: false`, the plugin counterpart of `syncClaudeAiSkills`.
**A per-name `skillOverrides` blocklist is accepted for built-in plugin skills only**, because the
single switch does not reach them. Bundled skills stay under the switch. `enabledPlugins` lives in
this user-level file, so ADR-0018's ban on it in the project `.claude/settings.json` does not apply.
Holocron does not distribute these settings to consumer repos. User-level settings already apply to
every repo on the machine, and another machine needs its own `install.sh` run.
**`install.sh` must merge into an existing `~/.claude/settings.json` before these settings are
deployed.** It used to copy the file over, which would have dropped 11 of the operator's 13 top-level
keys. Done since: `scripts/merge-json.py` merges the file, and `tests/test-install.sh` covers it.
## Considered options
**A `skillOverrides` blocklist (rejected as the general mechanism).** It needs a new entry for each unwanted skill that ships.
It is now used for built-in plugin skills (#286), but is still rejected as the general mechanism.
**`skillOverrides` in the committed `.claude/settings.json`, as #266 proposed (rejected).** apm owns
that file and `apm audit --ci` fails on hand-added keys (AGENTS.md, ADR-0018, ADR-0019). apm 0.39.3
cannot write the key either.
**A PreToolUse hook on the Skill tool (rejected).** It can refuse a call but cannot hide a skill or
resolve a name collision.
**Turning off only the three unwanted synced skills in the claude.ai account (rejected).** The
operator chose to turn off all syncing.
## Consequences
1. `simplify`, `loop`, `update-config` and `claude-api` are lost and cannot be re-enabled one by one
(tested).
2. All synced `anthropic-skills:*` are lost, including `pdf`, `docx`, `xlsx` and
`satisfactory-helper`. Claude Code moves the synced copies to `.trash`.
3. New built-in commands, as opposed to bundled skills, are not covered.
4. Each new built-in plugin skill needs its own `skillOverrides` entry.
5. The `cc-plugin-easel` chart tool and the `cc-plugin-plugin-authoring` `scan_secrets` MCP server are
lost.
## Evidence
- **Tested** in headless mode on Claude Code 2.1.334: the effect of `disableBundledSkills` on bundled
skills, and `skillOverrides.init: "off"`.
- **Documented, not tested:** that the custom `/ship` loads in an interactive session with
`CLAUDE_CODE_DISABLE_SHIP=1`.
- **From the docs only:** the `syncClaudeAiSkills` behaviour.
- **Tested** in headless mode on Claude Code 2.1.337, from the `init` event of
`claude -p … --output-format stream-json --verbose`: `skillOverrides` for `design`, `doctor` and
`plugin-authoring`, and `enabledPlugins` for the two plugins. Confirmed after `scripts/install.sh`:
the `init` event lists none of the three skills and only the four plugins kept on.
- **From the setting's description in the binary only:** the `syncClaudeAiPlugins` behaviour.
- Sources: code.claude.com/docs/en/settings-reference, `/skills` and `/ship-command-troubleshooting`.
Related: ADR-0018, ADR-0019; #266, #286.
+4 -3
View File
@@ -13,13 +13,14 @@ project repo (local overrides)
## Content deployment model
`scripts/install.sh` is a **deployer**, not a composer. It sources `scripts/deploy-manifest.sh` and deploys three categories:
`scripts/install.sh` is a **deployer**, not a composer, with one exception: user settings are merged, not copied. It sources `scripts/deploy-manifest.sh` and deploys four categories:
- **Files** (`DEPLOY_FILES`): `providers/claude-code/CLAUDE.md` → `~/.claude/CLAUDE.md`; `providers/claude-code/settings.json` → `~/.claude/settings.json`; `core/AGENTS.md` → `~/.agents/AGENTS.md`
- **Files** (`DEPLOY_FILES`): `providers/claude-code/CLAUDE.md` → `~/.claude/CLAUDE.md`; `core/AGENTS.md` → `~/.agents/AGENTS.md`
- **Merged JSON** (`DEPLOY_JSON_MERGES`): `providers/claude-code/settings.json` → `~/.claude/settings.json`. Settings only the user has are kept, including inside nested objects; where both set a value, the repo's wins, and arrays are replaced whole. Removing a setting from the repo does not remove it from a user's file. An existing file that is not a valid JSON object stops the install and is left untouched (ADR-0035)
- **Executables** (`DEPLOY_EXECUTABLES`): `providers/claude-code/statusline-command.sh` → `~/.claude/statusline-command.sh` (with `+x`)
- **Directories** (`DEPLOY_DIRS`): `core/` → `~/.claude/core/` (destination fully replaced on each deploy)
Skills are **not** deployed by `install.sh`. They are distributed as plugins and installed separately — in this repo by `apm install` against the `dependencies.apm` entries in the root `apm.yml`, which lands them in `.claude/skills/` and `.claude/agents/` (ADR-0018). A consuming repo installs them the same way — apm is the only supported install path.
Skills are **not** deployed by `install.sh`. They are distributed as plugins and installed separately — in this repo by `uv run --frozen apm install` (the repo-pinned apm, ADR-0034) against the `dependencies.apm` entries in the root `apm.yml`, which lands them in `.claude/skills/` and `.claude/agents/` (ADR-0018). A consuming repo installs them the same way — apm is the only supported install path.
`~/.claude/CLAUDE.md` is a thin adapter, not a content source. It imports `~/.agents/AGENTS.md` (always-on rules) and `governance.md` (always-on governance) and carries nothing else — the content index of on-demand instruction files sits in `core/AGENTS.md`, deployed to `~/.agents/AGENTS.md` and imported by it. All always-on content lives in `AGENTS.md` files so other providers can import the same source without duplication.
+194 -61
View File
@@ -72,7 +72,7 @@ version-blind, so a stale key deploys fine (see [apm gates](#apm-gates)).
| Hook | Guards |
|---|---|
| `apm-audit-ci` | `scripts/apm-audit-ci.sh` — `apm audit --ci` once per manifest, root plus each plugin package under `plugins/`, waiving only a package's `lockfile-exists` (see [below](#apm-audit-ci)) |
| `apm-audit-ci` | `scripts/apm-audit-ci.sh` — `apm audit --ci` once per manifest, root plus each plugin package under `plugins/`, waiving only a package's `lockfile-exists` and the root's `ref-consistency` for a plugin not yet on `origin/main` (see [below](#apm-audit-ci)) |
| `apm-pack-check-clean` | `scripts/apm-pack-check-clean.sh` — `apm pack --check-versions --check-clean --dry-run` with a scrubbed git env (see [`apm-audit-ci`](#apm-audit-ci)) — the compiled marketplace still matches what `apm.yml` + `.apm/` would generate, and per-package versions agree with the `per_package` strategy |
**Host validators** (needs the `claude` CLI on PATH)
@@ -498,7 +498,7 @@ directory (the self-contained constraint in `docs/spec/architecture.md`, "Plugin
so drift fails CI rather than silently letting an audit bless a skill the commit hook then rejects.
**The shared boundary resolver is one copy** (ADR-0025, then 2026-09-16). It lives between the
`BEGIN`/`END ADR-0020 SHARED BOUNDARY RESOLVER` markers in `factory-audit/scripts/lib-boundary-resolver.sh`.
`BEGIN`/`END SHARED BOUNDARY RESOLVER` markers in `factory-audit/scripts/lib-boundary-resolver.sh`.
ADR-0025 collapsed the two copies inside `skill-audit`'s and `agent-audit`'s `validate.sh` into that
file. `scripts/skill-size-check.sh` kept an embedded, byte-identical third copy while it was also
exported through `.pre-commit-hooks.yaml`, whose consumers could not reach a file inside the plugin.
@@ -734,16 +734,18 @@ checking only a leading span flags neither, and still catches the ordinary
### The clause-3 opt-out
A command that is deliberately bare — because rtk rewrites the output the skill parses, or because
the command is interactive — is exempted by putting the literal string `ADR-0023` **on the same
line**: in a shell comment for a code line, in the cell text for a table row.
the command is interactive — is exempted by putting the marker `rtk-bare:` and its reason **on the
same line**: in a shell comment for a code line, in the cell text for a table row. The marker was
`ADR-0023` until issue #177; it is neutral because plugin content is consumed by other repos and must
not cite this repo's ADRs. The old string no longer exempts a line.
Per line, never per block. A fenced procedure routinely mixes `rtk git` steps with one deliberately
bare command (`git-remotes/references/push.md` does exactly that), and a block-level marker would
silently disarm every checked line around the marked one. The cost is a repeated `# bare per
ADR-0023` in the three blocks of `git-log-format.md` where every line is deliberately bare; that
silently disarm every checked line around the marked one. The cost is a repeated `# rtk-bare:` in
the three blocks of `git-log-format.md` where every line is deliberately bare; that
repetition is the price of the marked line being the only line the marker speaks for.
The marker is a plain substring match, so a line that mentions `ADR-0023` for an unrelated reason is
The marker is a plain substring match, so a line that mentions `rtk-bare:` for an unrelated reason is
also exempt. Accepted deliberately: the marker records an author's opt-out, it is not a security
boundary, and a stricter form would only move the same trust to a different string.
@@ -1162,74 +1164,165 @@ plugin packages under `plugins/` — because the root-only invocation audits the
**nothing else**, and `apm-pack-check-clean` does not parse plugin `dependencies:` blocks either.
Verified: a malformed dependency entry passes
`apm pack --check-versions --check-clean --dry-run` and fails `apm audit --ci` in that package's
directory. Costs ~0.5s per package.
directory. The whole hook, the root plus every plugin package, takes 70-90 s through `uv run` on
apm 0.39.3, about 20 s of it the root audit. On apm 0.28.0 it cost about 0.5 s per package.
**apm runs with git's repo-locating env scrubbed.** Both apm hooks source
`scripts/lib/clean-git-env.sh` before calling `apm`, which unsets `GIT_DIR`, `GIT_WORK_TREE`,
**Both apm hooks run the repo-pinned apm.** They source `scripts/lib/apm.sh`, the one place the
invocation is spelled: `uv run --project <repo root> --frozen apm` (ADR-0034). `--project` comes
from the helper's own location, so it names the repo root even when apm runs inside
`plugins/<name>/`. Each hook first checks the resolved apm's version and fails, naming
`uv sync --frozen` as the fix, below 0.39.2. The gates keep plain `--frozen`, without the
SessionStart hook's `--no-sync --offline`: once `uv sync --frozen` has run, the sync it implies is a
no-op that needs no network, and after a pull that moves the pin it brings `.venv/` to the new pin
instead of letting a gate certify the tree with a stale apm. `tests/test-apm-gate-invocation.sh`
pins the command, the `--project` root, the scrub and the version floor with a fake `uv`.
**apm runs with git's repo-locating env scrubbed.** Sourcing `scripts/lib/apm.sh` also sources
`scripts/lib/clean-git-env.sh` before anything calls `apm`, which unsets `GIT_DIR`, `GIT_WORK_TREE`,
`GIT_INDEX_FILE`, `GIT_OBJECT_DIRECTORY`, `GIT_COMMON_DIR`, `GIT_PREFIX` and
`GIT_IMPLICIT_WORK_TREE`. It deliberately keeps the config-passing vars (`GIT_CONFIG_PARAMETERS`,
`GIT_CONFIG_COUNT`), because they carry `git -c` overrides apm's remote clones may need. The reason: `git push` from a **linked worktree** exports an
absolute `GIT_DIR=<main>/.git/worktrees/<name>` to its hooks, and from the main checkout it exports
none. `drift`'s install replay (apm 0.28.0) runs `git init` and `git checkout` in a temp dir with an
env copied from `os.environ`, so the inherited `GIT_DIR` wins. The `init` wrote `core.bare=true` into
the shared `.git/config`, and the `checkout` moved the worktree's HEAD to the lock-pinned commit
(issue #204). Pre-commit runs hooks from the worktree root, so once the vars are gone plain
discovery finds the right repo. `tests/test-apm-hooks-git-env.sh` pins this for both hooks.
`GIT_CONFIG_COUNT`), because they carry `git -c` overrides apm's remote clones may need. The reason:
`git push` from a **linked worktree** exports an absolute `GIT_DIR=<main>/.git/worktrees/<name>` to
its hooks, and from the main checkout it exports none. `drift`'s install replay (apm 0.28.0) runs
`git init` and `git checkout` in a temp dir with an env copied from `os.environ`, so the inherited
`GIT_DIR` wins. The `init` wrote `core.bare=true` into the shared `.git/config`, and the `checkout`
moved the worktree's HEAD to the lock-pinned commit (issue #204). Pre-commit runs hooks from the
worktree root, so once the vars are gone plain discovery finds the right repo. *2026-12-02
(holocron#272):* apm 0.39.3's `apm_cli/utils/git_env.py` provides `git_subprocess_env`, which strips
`GIT_DIR` and the other repo-locating vars. The leak was not re-tested on 0.39.3, and the scrub
stays as defence in depth. `tests/test-apm-hooks-git-env.sh` pins this for both hooks.
**What it actually runs is asymmetric**, and the two manifest classes are not comparable. Verified by
running `apm audit --ci` (apm 0.28.0) at the repo root and in `plugins/lint/`, reading the check
names straight off its own compliance table:
running `apm audit --ci` (apm 0.39.3, holocron#272; first done on 0.28.0) at the repo root and in
`plugins/lint/`, reading the check names straight off its own compliance table:
On the **root** manifest, **10 checks**: `lockfile-exists`, `ref-consistency`,
On the **root** manifest, **15 checks**: `lockfile-exists`, `ref-consistency`,
`deployment-ledger-owners`, `deployed-files-present`, `no-orphaned-packages`,
`skill-subset-consistency`, `config-consistency`, `content-integrity`, `includes-consent`, `drift`.
`lockfile-targets-current`, `skill-subset-consistency`, `config-consistency`,
`native-mcp-ownership`, `content-integrity`, `local-bundle-hooks`, `hook-approval-pins`,
`exec-status-current`, `includes-consent`, `drift`. apm 0.28.0 ran ten of these; the five it lacked
are `lockfile-targets-current`, `native-mcp-ownership`, `local-bundle-hooks`, `hook-approval-pins`
and `exec-status-current`.
On each **plugin** manifest, **1 check**: `lockfile-exists`. Conditional, and vacuous while every
plugin `apm.yml` declared `dependencies: {apm: [], mcp: []}` — it reports `No dependencies declared
-- lockfile not required`. An earlier revision of this section said it would arm the moment one did
not. **It has armed.** `plugins/onedev` was the first plugin package to declare a real dependency — it
pinned `code.onedev.io/onedev/tod#v4.3.4` — and was removed on 2026-11-11; `plugins/mattpocock`
carries the same shape (pinned third-party skills, no primitives of its own) and the check fires on
it for real. Everything else in the list above is root-only, because it is the
root install that has a lockfile, a deployment ledger and deployed files to check.
On each **plugin** manifest, **2 checks**: `lockfile-exists` and `content-integrity` (0.28.0 ran
only `lockfile-exists`). The plugin-level `content-integrity` row scans no package source: on 0.39.3
it still passed with a bidi override planted in a scratch copy of `plugins/lint`. When
`lockfile-exists` fails, the table holds that one row alone. `lockfile-exists` is conditional, and
vacuous while every plugin `apm.yml` declared `dependencies: {apm: [], mcp: []}` — it reports `No
dependencies declared -- lockfile not required`. An earlier revision of this section said it would
arm the moment one did not. **It has armed.** `plugins/onedev` was the first plugin package to
declare a real dependency — it pinned `code.onedev.io/onedev/tod#v4.3.4` — and was removed on
2026-11-11; `plugins/mattpocock` carries the same shape (pinned third-party skills, no primitives of
its own) and the check fires on it for real. Everything else in the root list is root-only, because
it is the root install that has a lockfile, a deployment ledger and deployed files to check.
**A plugin package that declares dependencies has no green state, so the hook waives exactly one
failure.** Verified against apm 0.28.0 in `plugins/onedev/` (since removed; the behaviour is the same for any package that declares dependencies):
failure.** Verified against apm 0.28.0 in `plugins/onedev/` (since removed; the behaviour is the
same for any package that declares dependencies), and again on apm 0.39.3 in a scratch copy of
`plugins/mattpocock` (holocron#272):
- **Without a package `apm.lock.yaml`**, `lockfile-exists` fails — `apm.yml declares dependencies but
apm.lock.yaml is absent` — reported as `1 of 1 check(s) failed`.
apm.lock.yaml is absent` — reported as `1 of 1 check(s) failed`. Unchanged on 0.39.3.
- **With one**, generated by `apm lock` in the package directory, `lockfile-exists` passes and
thereby arms the other nine checks; `drift` then fails reporting **8 unintegrated files** at
`.agents/skills/<name>/SKILL.md`, i.e. demanding the dependency's skills be *deployed inside the
package*. `apm lock` also leaves an `apm_modules/` tree inside the package.
thereby arms the rest of the root check set; `drift` then fails reporting unintegrated files at
`.agents/skills/<name>/...`, i.e. demanding the dependency's skills be *deployed inside the
package*. On 0.28.0 that was nine more checks and 8 files from onedev; on 0.39.3 it is fourteen
more checks and 74 files from mattpocock. `apm lock` also leaves an `apm_modules/` tree inside the
package.
The cause is that apm treats any directory holding both `apm.yml` and `apm.lock.yaml` as an **install
root**, and a plugin package is not one. `scripts/apm-audit-ci.sh` therefore waives `lockfile-exists`
and nothing else, and only for a non-root manifest: it asserts the string `1 of 1 check(s) failed`,
so any second failing check changes the count and the run fails normally, and output it does not
recognise fails closed. The root manifest is never waived. Recorded as ADR-0026.
recognise fails closed. The root manifest is never waived for `lockfile-exists`. Recorded as ADR-0026.
**Dropping `--ci` for package directories was considered and rejected.** It is the smaller change and
it is wrong. Verified on apm 0.28.0 against a scratch package whose dependency entry carried no
`git`/`path`/`registry` field: `apm audit --ci` exits 1 naming the field, while plain `apm audit`
prints `No apm.lock.yaml found -- nothing to scan` and exits 0. Malformed-dependency detection is the
reason this section gives for auditing packages at all, and a package *with* dependencies is the only
kind that can carry a malformed dependency entry — so dropping `--ci` would discard the check
precisely where it earns its keep.
**The root has one waiver of its own: `ref-consistency` for a plugin not yet on `origin/main`.**
Root `apm.yml`'s first-party dependencies resolve from the remote's `main` (ADR-0019), so the lock
cannot record a plugin before it lands, while `check-executables-allow-sync` refuses a push of a
hook- or bin-shipping plugin whose git+path entry is missing from root `apm.yml`. Without a waiver a
first-landing executable-shipping plugin is unpushable: root `ref-consistency` fails with
`<identity>/plugins/<name>: not found in lockfile`. On apm 0.39.3 a failing `ref-consistency` cuts
the root run to three checks (holocron#179), so the hook waives it only when the output reads `1 of
3 check(s) failed`, the one failing row is `ref-consistency`, and every line of its details block is
that `not found in lockfile` form for an identity equal to root `apm.yml`'s own git+path entry for
`plugins/<name>` (derived by `check-executables-allow-sync`'s rule). Each `plugins/<name>/apm.yml`
must also exist in the working tree and be absent from the **local** `origin/main`, which must
resolve; nothing is fetched. A plugin name must start with a letter or digit and may not contain
`..`. Any other output fails closed. The waiver lapses for a plugin by itself: once it is on
`origin/main`, the follow-up PR that records it in the lock is required. Because the hook reads
only the local `origin/main` ref, a stale or unfetched one keeps the waiver alive after the plugin
has landed. That fails safe: the waiver still requires the full 15-check re-run below to pass, so
it waives only the `not found in lockfile` rows. `git fetch` refreshes the ref and ends the waiver.
**The waiver re-runs the full root check set before it passes.** The cut-short run never reaches the
other twelve root checks (`content-integrity`, `hook-approval-pins`, `local-bundle-hooks`,
`exec-status-current`, `deployed-files-present` and the rest), so the three-check result alone
would let a defect in any of them through. Once the conditions above hold, the hook copies the working
tree (minus `.git`, `.venv` and `.claude/worktrees`) into a `mktemp -d` directory with `tar`. In the
copy it drops only the `dependencies:` > `apm:` items whose `path:` names a waived plugin, checks
that the reduced `apm.yml` differs from the original by those deletions alone and that no entry for
a waived plugin survived, and runs `git init`. It gives that repo the git state apm reads: the
same `origin` URL, for org-policy discovery, and a copy of the real repo's `info/exclude` (from
`git rev-parse --git-path info/exclude`, so a linked worktree's shared one), which
`deployed-files-present` consults through `git check-ignore`. It then runs `apm audit --ci` there. The push passes only
if that run exits 0 and prints `All 15 check(s) passed`. On this branch (holocron#179, apm 0.39.3) it
does, and the hook prints `root re-run without the unlanded plugins: All 15 check(s) passed`. A copy
was chosen over swapping `apm.yml` in place under a `trap`: the copy never writes the working tree, so
the tree stays byte-identical even after `SIGKILL`, and a concurrent apm never sees a reduced
manifest. `.git` is not copied because in a linked worktree it points into the shared gitdir. `.venv`
is not copied because apm runs from the real one via `uv run --project`. `.claude/worktrees` is not
copied because each worktree there is a full checkout that can carry its own `.venv`. Leaving it out
hides nothing: it is ignored through `info/exclude`, and the root checks look only at lock-recorded
deployed paths, none of which is under it. The scratch directory is
removed on exit, including on `INT`, `TERM` and `HUP`. The script header records the full reasoning.
`tests/test-apm-audit-ci-waiver.sh` covers the waiver, the re-run, and each of its guards.
**Dropping `--ci` for package directories was considered and rejected.** It is the smaller change
and it is wrong. Verified on apm 0.28.0, and again on 0.39.3 (holocron#272), against a scratch
package whose dependency entry carried no `git`/`path`/`registry` field: `apm audit --ci` exits 1
naming the field, while plain `apm audit` exits 0. Plain `apm audit` printed `No apm.lock.yaml found
-- nothing to scan` on 0.28.0 and prints `No recognized deployed primitives found -- nothing to
scan` on 0.39.3. Malformed-dependency detection is the reason this section gives for auditing
packages at all, and a package *with* dependencies is the only kind that can carry a malformed
dependency entry — so dropping `--ci` would discard the check precisely where it earns its keep.
**Known weak point: the waiver matches on apm's stdout.** An apm upgrade that rewords either line
turns the waiver off. That fails the push rather than hiding a defect; re-verify against the new
output and update the patterns rather than widening them.
**`manifest-parse` is not a named check** in apm 0.28.0's output, and an earlier revision of this
section listed it as one. Parsing is still enforced — a dependency entry missing its
`git`/`path`/`registry` field fails with `Cannot parse apm.yml` — but it fails the invocation before
the table is built rather than appearing as a row in it.
**`manifest-parse` is a named check on apm 0.39.3, and was not one on 0.28.0.** On 0.28.0 a
dependency entry missing its `git`/`path`/`registry` field failed the invocation with `Cannot parse
apm.yml` before the table was built. On 0.39.3 the same entry produces a one-row table, a failing
`manifest-parse` row reading `Cannot parse apm.yml: Invalid APM dependency ...`, and `1 of 1
check(s) failed` (holocron#272). The waiver does not cover it: that row lacks the `declares
dependencies but apm.lock.yaml is absent` line the waiver also requires. A parsable manifest gets no
`manifest-parse` row, which is why it is missing from both lists above.
**The hook needs a completed `apm install`.** `deployed-files-present` checks the install output on
disk, so on a fresh clone it fails with `303 deployed file(s) missing` and takes the push with it.
That is not a defect in the gate; it is the gate correctly reporting that nothing has been installed
yet. Run `apm install` before the first push from a new checkout.
disk, so on a fresh clone it fails with `<N> deployed file(s) missing` (303 on 0.28.0; the count
follows the lock) and takes the push with it. That is not a defect in the gate; it is the gate
correctly reporting that nothing has been installed yet. Before the first push from a new checkout,
run `uv sync --frozen` and then `uv run --frozen apm install`, each once and online. Without the
first, the hooks' plain `uv run --frozen` performs that sync itself, which needs the network. An
older checkout whose `.claude/skills`, `.claude/agents` and `.claude/commands` were deployed by apm
0.28 moves those three directories aside before that first 0.39 install. Otherwise apm refuses to
replace the files 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. kyberforge's
`SessionStart` hook is such a writer: it runs `uv run --frozen apm update --yes` at session start,
so in a checkout apm 0.28 populated it can write the bad lock before anyone reads this. To recover,
discard it with `git checkout -- apm.lock.yaml`, move `apm_modules/` aside, then run
`uv run --frozen apm install`.
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:
@@ -1249,13 +1342,46 @@ that can never go green is not a gate. Revisit only if this repo gains a policy
or hash drift detected` — so the root invocation already covers it and nothing needs adding. What
remains true is that the *standalone* mode is different: plain `apm audit` (`--ci` refuses to combine
with `--file`/`--strip`/`--dry-run`/`PACKAGE`) run in a plugin directory reports
`No apm.lock.yaml found -- nothing to scan` and exits 0, because only the root has a lockfile.
Plugin manifests get `lockfile-exists` and nothing else; they are not Unicode-scanned. That holds
because no package carries an `apm.lock.yaml` — one would arm the other nine checks, `content-integrity`
among them, which is the state ADR-0026 rules out rather than a second scan worth having.
`No recognized deployed primitives found -- nothing to scan` on 0.39.3 (`No apm.lock.yaml found --
nothing to scan` on 0.28.0) and exits 0, because only the root has a lockfile and deployed files.
Plugin manifests are not Unicode-scanned. 0.39.3 does add a `content-integrity` row in a plugin
directory, but it scans no package source (see above). That holds because no package carries an
`apm.lock.yaml`. One would arm the rest of the root check set, a scanning `content-integrity` among
them, which is the state ADR-0026 rules out rather than a second scan worth having.
### `check-executables-allow-sync`
**Keys are full package identities (apm 0.39, #271).** apm 0.39.3 matches a grant on the package
identity `<host>/<owner>/<repo>/<path>`, as `apm approve --list` prints it, e.g.
`git.rkdr.net/Mortis/Holocron/plugins/kyberforge`. The bare `kyberforge#<version>` key that 0.28.0
matched no longer matches: the first 0.39 install parks the hooks, rewrites `.claude/settings.json`
without them, and root `apm audit --ci` still passes (spike #269, on #268). So the gate now derives
each expected key from root `apm.yml`'s own `git:` + `path:` dependency entry for the plugin (URL
without scheme, user or `.git`, then the path), appends `#<version>`, and fails a bare key with a
message saying why. A shipping plugin with no such entry fails, since no key can be derived, and so
does one whose `git:` URL names a port, because how apm writes a port into the identity is
unverified. Only an https URL on a lowercase host was checked against `apm approve --list`; the
scp-like and `ssh://` forms follow the same rule unchecked, and the host's case is kept as written. The
`#<version>` suffix is still stripped before apm matches, so the grant stays version-blind and the
version half stays a repo-level record. The grants are type-level (`hooks: true`), not
content-pinned: `apm approve` would pin content, strip the block's comments, and park the hook on
every script edit until someone approves again.
**It also fails on a parked executable in `apm.lock.yaml`** (spike #269, section 7.3). apm records
each dependency's executables decision as `exec_status:` in the lock, `deployed` or a `gated_*`
value such as `gated_pending_approval`. Root `apm audit --ci` passes with executables parked,
because `exec-status-current` only checks that the lock agrees with the gate. So the gate scans the
lock's `dependencies:` and fails on any `gated_*` entry, naming its identity and status, with
`apm approve --list` as the first step of the fix. It runs even when no plugin here ships
executables, since a third-party dependency can be parked too. A missing lock is left to
`apm-audit-ci`'s `lockfile-exists`. It is a line scan of the shape apm writes, not a YAML parse.
The rest of this section describes the 0.28.0 matching that the version-blind behaviour comes from.
*2026-12-02 (holocron#272):* the functions it names are still in apm 0.39.3's source with the same
roles. `materialize_exec_map` still stores each key under its version-blind name, and `_map_grants`
documents ordinary grants as version-blind. What changed is the name half of the key, which is now
the full identity described above.
apm gates a package's `hooks/` and `bin/` on root `apm.yml`'s `executables.allow`
(`apm_cli/security/executables.py`). `is_package_approved` is itself an exact dictionary lookup, but
it is never called with a single key: `install/exec_gate.py` builds a candidate list that includes
@@ -1274,12 +1400,13 @@ every key stays an accurate record of what was approved.
It covers every plugin that ships executables, not one named package. The script scans
`plugins/*/` and treats a plugin as shipping executables when `plugins/<name>/.apm/hooks/` or
`plugins/<name>/bin/` exists — kyberforge ships both, delivery ships a guard hook. For each one it
`plugins/<name>/bin/` exists — kyberforge ships both, delivery ships a guard hook,
git ships a hook that refuses a push to `main`. For each one it
reads `name:` and `version:` from `plugins/<name>/apm.yml` and asserts root `apm.yml` carries the
`<name>#<version>` key under `executables.allow`. Keys use the package name, so a `name:` that
differs from the directory name fails rather than being guessed at. Every failing package is
reported in one run, each with its own Why/Fix block; a stale `<name>#<other-version>` key is quoted
back as "found instead". It also fails on a shipping plugin with no `apm.yml`, a missing `version:`,
`<identity>#<version>` key under `executables.allow`. The `name:` must equal the directory name, so
one that differs fails rather than being guessed at. Every failing package is
reported in one run, each with its own Why/Fix block; a stale `<identity>#<other-version>` key, or a
bare `<name>#...` key, is quoted back as "found instead". It also fails on a shipping plugin with no `apm.yml`, a missing `version:`,
a missing root `apm.yml`, or no `executables.allow` mapping. A repo with no executable-shipping
plugin at all is the one no-op, and a plugin with neither directory needs no key.
@@ -1327,7 +1454,11 @@ drift after the fact, not by a derived gate.
## Pushing without a network
No pre-push hook needs the network **once `apm install` has populated `apm_modules/`**. Every entry
No pre-push hook needs the network **once two one-time online steps have run in this checkout**:
`uv sync --frozen`, which installs the apm that `uv.lock` pins into `.venv/`, then
`uv run --frozen apm install`, which populates `apm_modules/` and the deployed tree. Every apm
call in the hooks goes through the pinned invocation in `scripts/lib/apm.sh` (ADR-0034); after the
first sync, its implied `uv` sync is a no-op that needs no network. Every entry
in root `apm.yml`'s `marketplace.packages[]` resolves from a local `./plugins/<name>` path, so
`apm-pack-check-clean` never calls `git ls-remote`.
@@ -1337,8 +1468,10 @@ replay the install to diff scratch against the working tree, and that replay is
`[>] Replaying install (cache-only)` — which is exactly why it costs no network here. On a **fresh
clone** there is no cache to replay from, so the replay clones from the holocron remote and those two
checks fail offline, with `deployed-files-present` already failing for the same reason (see
`apm-audit-ci` above). The offline guarantee is a property of a populated `apm_modules/`, not of the
hook set: run `apm install` once on a new checkout and it holds from then on.
`apm-audit-ci` above). The offline guarantee is a property of a synced `.venv/` and a populated
`apm_modules/`, not of the hook set: run `uv sync --frozen` and `uv run --frozen apm install` once
on a new checkout and it holds from then on. Run apm only in that pinned form here: a bare `apm`
reaches whatever is on `PATH`, possibly an older apm that refuses the v4 `apm.lock.yaml`.
## Plugin release tags are not a gate
@@ -11,7 +11,7 @@ metadata:
category: docs
source_keys:
- adr-0002-0003-two-tier-claude-md
version: "0.1.3"
version: "0.1.4"
---
## Gotchas
@@ -202,7 +202,7 @@ def read_text(path):
byte is the complete signal and is checked first: no plausible markdown
adapter contains one, and every UTF-16/32 encoding of ASCII is full of
them. A file this gate cannot read gets an encoding diagnostic and exit 2,
the same policy the ADR-0020 validators' read_text() uses.
the same policy factory-audit's validators' read_text() uses.
A file that exists but cannot be read at all is neither a pass nor a FAIL —
nothing was graded — so it exits 3 rather than 1. Exit 1 sends the skill's
+1 -1
View File
@@ -1,5 +1,5 @@
name: core
version: 1.1.4
version: 1.1.5
description: Skills for authoring and auditing a repo's AGENTS.md and the provider adapter files that defer to it.
author:
name: Mortis
@@ -9,7 +9,7 @@ compatibility: Requires git with push access to the work branch, and a consuming
allowed-tools: Read Write Edit Bash
metadata:
category: delivery
version: "0.2.0"
version: "0.2.1"
---
## Gotchas
@@ -58,7 +58,7 @@ Read only the matched flow's reference — each is self-contained.
Stage only files under the test paths, then check the staged set before committing:
```bash
git diff --cached --name-only # bare: the path list is parsed (ADR-0023)
git diff --cached --name-only # rtk-bare: the path list is parsed
```
Any path outside the test paths → unstage it. Commit exactly once per run, with a Conventional
@@ -9,7 +9,7 @@ compatibility: Requires git, a Gitea forge with Actions reached through the Gite
allowed-tools: Read Bash mcp__gitea__pull_request_read mcp__gitea__list_pull_requests mcp__gitea__commit_read mcp__gitea__actions_run_read mcp__gitea__get_file_contents
metadata:
category: delivery
version: "0.1.0"
version: "0.1.1"
---
## Gotchas
@@ -13,10 +13,10 @@ in Step 1, before any waiting, and again where `references/apply-wait.md` and
the merge commit whose message reverts it, oldest first:
```bash
git log --reverse --format=%H -F --grep='Reverts merge commit <merge commit>' --grep='This reverts commit <merge commit>' <merge commit>..origin/<base> # ADR-0023: parsed
git log --reverse --format=%H -F --grep='Reverts merge commit <merge commit>' --grep='This reverts commit <merge commit>' <merge commit>..origin/<base> # rtk-bare: the output is parsed
```
Bare `git`, per ADR-0023: rtk filters `git log` and this output is parsed. Full 40-character
Bare `git`, not `rtk git`: rtk filters `git log` and this output is parsed. Full 40-character
SHA in both patterns. Not `--first-parent`: a revert PR merged with a merge commit puts the
revert on the second parent. The first SHA listed is the **revert commit**.
@@ -36,10 +36,10 @@ Otherwise tied when both hold:
ancestor carrying a status with the same name:
```bash
git log --first-parent --format=%H -n 50 <merge commit>^1 # ADR-0023: parsed
git log --first-parent --format=%H -n 50 <merge commit>^1 # rtk-bare: the output is parsed
```
Bare `git`, per ADR-0023: rtk filters `git log` and this output is parsed. Read each SHA's
Bare `git`, not `rtk git`: rtk filters `git log` and this output is parsed. Read each SHA's
statuses with `mcp__gitea__commit_read` `get_status`, newest first. A `skipped` status ran
nothing, so pass over it, but only when every row of its workflow (the status name's prefix
before ` / `) on that commit is `success` or `skipped`; otherwise a failure there may have
@@ -32,10 +32,10 @@ For each such workflow, run `references/already-reverted.md` again (a revert →
the default branch's first-parent commits after the merge commit, oldest first:
```bash
git log --first-parent --reverse --format=%H <merge commit>..origin/<default branch> # ADR-0023: parsed
git log --first-parent --reverse --format=%H <merge commit>..origin/<default branch> # rtk-bare: the output is parsed
```
Bare `git`, per ADR-0023: rtk filters `git log` and this output is parsed. That check's fetch
Bare `git`, not `rtk git`: rtk filters `git log` and this output is parsed. That check's fetch
found no revert, so none of these is at or after one. Read each SHA's statuses with
`mcp__gitea__commit_read` `get_status`:
+1 -1
View File
@@ -1,5 +1,5 @@
name: delivery
version: 0.8.0
version: 0.8.2
description: Agents and skills for taking a change from spec to a verified merge through tracker-gated stages.
author:
name: Mortis
+10 -6
View File
@@ -152,7 +152,7 @@ The script tells runtimes apart by where apm deployed it:
|---|---|---|
| `.claude/hooks/` | Claude Code | Output is `hookSpecificOutput.permissionDecision`. `onFailure: block` makes a crash or timeout block the call (Claude Code ≥ 2.1.295). Verified live on 2.1.326. |
| `.github/hooks/scripts/` | Copilot CLI | Output is top-level `permissionDecision` plus a reason. A non-zero exit denies, but a **timeout lets the call through**. The TUI auto-approves `ask` (ADR-0032 accepted risk). apm writes the entry in Claude's nested shape with `command`/`timeout`, and Copilot's docs accept both keys but don't document the nested group, so it is **unverified** until a Copilot account exists. |
| `.codex/hooks/` | Codex | `ask` is unsupported, so the guard denies with exit 2 and the reason on stderr. apm deploys only if `.codex/` already exists, and Codex skips project hooks until a human trusts them. Codex resolves the relative command from the session cwd, so a session started in a subdirectory may not find the script. |
| `.codex/hooks/` | Codex | `ask` is unsupported, so the guard denies with exit 2 and the reason on stderr. apm deploys it when the consuming project targets `codex`; with `codex` in `targets:`, apm 0.39.3 creates `.codex/` itself. Codex skips project hooks until a human trusts them. Codex resolves the relative command from the session cwd, so a session started in a subdirectory may not find the script. |
| anywhere else | unknown | Treated like Codex: odd jobs are denied, with exit 2. The payload's shape (`toolName` or `tool_name`) picks only how the payload is read, never the runtime. |
## What a consuming repo needs
@@ -160,18 +160,22 @@ The script tells runtimes apart by where apm deployed it:
- `python3` on PATH. The script uses the standard library only. Without python3 the hook cannot
start, which blocks every tool call on Claude Code and Copilot. That's deliberate.
- An `executables.allow` grant for the package in the repo's `apm.yml`, when that repo turns on apm's
executable-trust gate:
executable-trust gate. On apm 0.39 the key is the package's full identity, as
`apm approve --list` prints it:
```yaml
executables:
allow:
delivery:
git.rkdr.net/Mortis/Holocron/plugins/delivery:
hooks: true
```
apm 0.28.0 prints "parked pending approval" even when the grant matches (holocron#208). Check that
the hook actually deployed by looking for `guard.py` under `.claude/hooks/delivery/` and the
`PreToolUse` entry in `.claude/settings.json`. Don't rely on the install exit code.
A bare `delivery` key, which apm 0.28.0 matched, no longer does: under 0.39.3 the hook is parked
("parked pending approval"), nothing deploys, and install still exits 0. A `#<version>` suffix on
the key is ignored when matching. Check that the hook actually deployed by looking for `guard.py`
under `.claude/hooks/delivery/` and the `PreToolUse` entry in `.claude/settings.json`. Don't rely
on the install exit code. apm 0.28.0 also printed "parked pending approval" when the grant matched
(holocron#208); 0.39.3 does not.
- Host hardening is documented, not shipped (ADR-0032 layer 3). Examples are Claude permission
deny rules, sandbox `denyRead` on the vault password file, and managed settings with
`allowManagedHooksOnly` so the guard cannot be switched off.
+16
View File
@@ -0,0 +1,16 @@
{
"hooks": {
"PreToolUse": [
{
"hooks": [
{
"command": "${CLAUDE_PLUGIN_ROOT}/.apm/hooks/refuse-push-to-main.py",
"timeout": 10,
"type": "command"
}
],
"matcher": "Bash"
}
]
}
}
+265
View File
@@ -0,0 +1,265 @@
#!/usr/bin/env python3
"""PreToolUse hook: refuse a `git push` that can update `main`.
A guardrail against accidents, not a security boundary: whatever it cannot read
in the command line goes through. Limits and opt-out: the git plugin's README.
"""
import fnmatch
import json
import os
import re
import shlex
import subprocess
import sys
MAIN_NAMES = ("main", "heads/main", "refs/heads/main")
HEREDOC = re.compile(
r"""(?<!<)<<(-?)[ \t]*(?:'([^']+)'|"([^"]+)"|\\?([^\s;&|()<>'"`\\]+))"""
)
WORD = r"""(?:[^ \t\r\n;&|()`<>'"\\]|\\.|'[^']*'|"(?:[^"\\]|\\.)*")+"""
TOKEN = re.compile(
rf"""(?P<skip>[ \t\r]+|\#[^\n]*|(?:\d*|&)[<>]+[&|]?[ \t]*(?:{WORD})?)
|(?P<separator>[;&|()`\n]+)
|(?P<word>{WORD})""",
re.S | re.X,
)
ASSIGNMENT = re.compile(r"\w+=")
SHELL_KEYWORDS = {"!", "{", "if", "then", "elif", "else", "while", "until", "do"}
WRAPPERS = {
"rtk",
"proxy",
"command",
"env",
"exec",
"nohup",
"sudo",
"time",
"timeout",
"xargs",
}
WRAPPER_ARGUMENT = re.compile(r"-|\d+[smhd]?$")
SHORT_PUSH_OPTIONS = {"h": "--help", "n": "--dry-run"}
GIT_OPTIONS_WITH_VALUE = {"-c", "--git-dir", "--work-tree", "--namespace", "--config-env"}
REBASE_OPTIONS_WITH_VALUE = {
"--onto",
"-s",
"--strategy",
"-X",
"--strategy-option",
"-x",
"--exec",
}
PUSH_OPTIONS_WITH_VALUE = {
"--repo",
"--push-option",
"--receive-pack",
"--exec",
"--recurse-submodules",
}
def strip_heredocs(command):
lines = command.split("\n")
# A `<<` that nothing closes is text or arithmetic, not a heredoc.
closing_lines = {line.lstrip("\t") for line in lines}
kept, pending = [], []
for line in lines:
if pending:
dash, delimiter = pending[0]
if (line.lstrip("\t") if dash else line) == delimiter:
pending.pop(0)
continue
kept.append(line)
for dash, *quotings in HEREDOC.findall(line):
delimiter = "".join(quotings)
if delimiter in closing_lines:
pending.append((dash, delimiter))
return "\n".join(kept)
def simple_commands(command):
"""Split a command line into word lists; None when it does not parse.
A subshell's parentheses come out as the commands ["("] and [")"].
"""
command = re.sub(r"(?<!\\)\\\n", "", strip_heredocs(command))
commands, position = [[]], 0
while position < len(command):
token = TOKEN.match(command, position)
if not token:
return None
if token["separator"]:
commands += [[c] for c in token["separator"] if c in "()"]
commands.append([])
elif token["word"]:
commands[-1].append("".join(shlex.split(token["word"])))
position = token.end()
return commands
def strip_prefixes(words):
wrapped = False
for index, word in enumerate(words):
if word in WRAPPERS:
wrapped = True
elif not (
word in SHELL_KEYWORDS
or ASSIGNMENT.match(word)
or (wrapped and WRAPPER_ARGUMENT.match(word))
):
return words[index:]
return []
def split_git_command(arguments, directory):
"""(directory it runs in, subcommand, the subcommand's arguments)."""
rest = iter(arguments)
for word in rest:
if word == "-C":
directory = resolve(directory, next(rest, ""))
elif word in GIT_OPTIONS_WITH_VALUE:
next(rest, None)
elif not word.startswith("-"):
return directory, word, list(rest)
return directory, "", []
def resolve(directory, target):
# Not normalised: a target such as `$X/..` must stay a path that does not
# exist, so that the branch lookup fails and the push is allowed.
return os.path.join(directory, os.path.expanduser(target))
def changes_branch(subcommand, arguments):
if subcommand == "branch":
return not {"-m", "-M", "--move"}.isdisjoint(arguments)
if subcommand == "rebase": # `git rebase <upstream> <branch>` checks out <branch>
rest, names = iter(arguments), []
for argument in rest:
if argument in REBASE_OPTIONS_WITH_VALUE:
next(rest, None)
elif not argument.startswith("-"):
names.append(argument)
return len(names) > 1
return subcommand == "switch" or (subcommand == "checkout" and "--" not in arguments)
def parse_push(arguments):
"""(long-form option names, refspecs) of a git push."""
options, positional = set(), []
rest = iter(arguments)
for argument in rest:
if argument == "--":
positional.extend(rest)
elif argument.startswith("--"):
options.add(argument.split("=")[0])
if argument in PUSH_OPTIONS_WITH_VALUE:
next(rest, None)
elif argument.startswith("-"):
flags, push_option, value = argument[1:].partition("o")
options.update(SHORT_PUSH_OPTIONS.get(f, f) for f in flags)
if push_option and not value:
next(rest, None)
else:
positional.append(argument)
return options, positional[1:]
def updates_main(arguments, on_main):
"""Whether a push can update main. `on_main` is called only when it matters."""
options, refspecs = parse_push(arguments)
if options & {"--dry-run", "--help"}:
return False
if options & {"--all", "--branches", "--mirror"}:
return True
if not refspecs:
return "--tags" not in options and on_main()
rest = iter(refspecs)
for refspec in rest:
if refspec == "tag":
next(rest, None)
continue
source, colon, destination = refspec.removeprefix("+").partition(":")
if colon and not source and not destination:
return True
target = destination if colon else source
if any(fnmatch.fnmatchcase(name, target) for name in MAIN_NAMES):
return True
if not colon and source in ("HEAD", "@") and on_main():
return True
return False
def current_branch_is_main(directory):
head = subprocess.run(
["git", "-C", directory, "symbolic-ref", "--quiet", "HEAD"], capture_output=True, text=True
)
return head.stdout.strip() == "refs/heads/main"
def pushes_to_main(command, directory):
if "git" not in command or "push" not in command:
return False
outer_directories = []
branch_change = None # (directory, whether it went to main) of the latest one
for all_words in simple_commands(command) or []:
words = strip_prefixes(all_words)
if not words:
continue
name, arguments = os.path.basename(words[0]), words[1:]
if name == "(":
outer_directories.append(directory)
elif name == ")" and outer_directories:
directory = outer_directories.pop()
elif name in ("cd", "pushd", "popd"):
directory = resolve(directory, words[-1])
elif name in ("gh", "tea") and "checkout" in arguments:
branch_change = (directory, False)
elif name == "git":
repo, subcommand, arguments = split_git_command(arguments, directory)
# xargs adds refspecs, and another git dir has its own branch.
unknown = "xargs" in all_words or any(
w.startswith(("GIT_DIR=", "--git-dir")) for w in all_words
)
def on_main():
if unknown:
return False
if branch_change:
return branch_change == (repo, True)
return current_branch_is_main(repo)
if changes_branch(subcommand, arguments):
names = [a for a in arguments if not a.startswith("-")]
branch_change = (repo, subcommand != "branch" and names == ["main"])
elif subcommand == "push" and updates_main(arguments, on_main):
return True
return False
def main():
# apm deploys this file to Copilot and Codex too, where it must do nothing.
if "/.claude/hooks/" not in os.path.abspath(__file__).replace("\\", "/"):
return 0
if os.environ.get("GIT_ALLOW_PUSH_TO_MAIN") == "1":
return 0
payload = json.load(sys.stdin)
if payload["tool_name"] != "Bash":
return 0
if pushes_to_main(payload["tool_input"]["command"], payload["cwd"]):
print(
"Refused: this git push can update main. "
"Push a feature branch by name and open a pull request instead.",
file=sys.stderr,
)
return 2
return 0
if __name__ == "__main__":
sys.exit(main())
+2 -2
View File
@@ -8,7 +8,7 @@ description: >
Not branch lifecycle -> `git-branches`.
metadata:
version: "0.1.8"
version: "0.1.9"
category: git
source_keys:
- conventional-commits-spec
@@ -65,7 +65,7 @@ For an agent caller, return:
"scope": "api",
"description": "add user authentication",
"body": "optional body text, or null",
"footers": ["Fixes: #123", "Refs: #456", "Co-authored-by: Bob <bob@example.com>"]
"footers": ["Fixes: #123", "Refs: #456", "Signed-off-by: Bob <bob@example.com>"]
}
}
```
@@ -59,8 +59,10 @@ Refs:
ADR:
RFC:
Design:
Co-authored-by:
Reviewed-by:
Signed-off-by:
BREAKING CHANGE:
```
Add an AI-attribution or co-author trailer only when the repo's AGENTS.md or CONTRIBUTING, or the
session instructions, ask for one, and use exactly the form they give.
@@ -90,7 +90,7 @@ Rules:
<token> #<value> # for issue references
```
- Tokens use hyphens for word separation: `Reviewed-by`, `Co-authored-by`, `Refs`.
- Tokens use hyphens for word separation: `Reviewed-by`, `Signed-off-by`, `Refs`.
- Exception: `BREAKING CHANGE` (space allowed, uppercase).
- Multiple footers allowed, one per line.
- Blank line required before the footer block.
@@ -99,7 +99,7 @@ Valid footer examples:
```text
Reviewed-by: Z
Refs: #123
Co-authored-by: Alice <alice@example.com>
Signed-off-by: Alice <alice@example.com>
BREAKING CHANGE: the `--format` flag now requires a value
```
@@ -12,6 +12,6 @@ source_keys:
3. **Determine the scope** — infer it from the files changed (`api`, `db`, `cli`, `config`). Scope is optional, but it identifies which part of the system moved and is worth setting.
4. **Write the description** — imperative mood, no trailing period: "add user authentication", "fix race condition in cache". Neither source spec sets a target below the 100-character header maximum, but convention favours roughly 50 characters so `git log --oneline` stays readable.
5. **Add a body when the change is non-trivial** — blank line first, wrapped at 100 characters. Explain *why*, not what: the diff already shows what changed, and the message's job is the context the diff cannot carry — motivation, root cause, tradeoffs. Follow the Why / Implementation Notes / Impact structure in `references/commit-template.md`.
6. **Add footers where they apply** — `Fixes: #123`, `Refs: #123`, `ADR: 0012`, `Co-authored-by: Name <email>`, `BREAKING CHANGE: description`. For the full trailer list, read `references/commit-template.md`.
6. **Add footers where they apply** — `Fixes: #123`, `Refs: #123`, `ADR: 0012`, `Signed-off-by: Name <email>`, `BREAKING CHANGE: description`. For the full trailer list, read `references/commit-template.md`.
7. **Signal a breaking change with `!` before the colon** — `feat!: drop Node 6` is visible in `git log --oneline`, where the `BREAKING CHANGE:` footer alone is machine-readable but hidden. Use both when the break needs describing.
8. **Validate, confirm, execute** — check header length, type, lowercase subject and trailing period against commitlint, show the message, and commit only once the caller has approved. Never add `--no-verify`.
+1 -1
View File
@@ -8,7 +8,7 @@ description: >
`git-commits`. Not a Gitea server's history -> `gitea-branches`.
metadata:
version: "1.0.3"
version: "1.0.4"
category: git
source_keys:
- git-scm-bisect-docs
@@ -166,10 +166,10 @@ line at roughly 72 characters with an ellipsis, on the one query whose whole poi
is showing line content.
```bash
git log -L 10,20:file.txt # bare (ADR-0023)
git log -L /start_pattern/,/end_pattern/:file.txt # bare (ADR-0023)
git log -L :myfunction:src/app.c # bare (ADR-0023)
git log -L /init/,+15:config.py # bare (ADR-0023); 15 lines after first /init/ match
git log -L 10,20:file.txt # rtk-bare: rtk truncates diff lines
git log -L /start_pattern/,/end_pattern/:file.txt # rtk-bare: rtk truncates diff lines
git log -L :myfunction:src/app.c # rtk-bare: rtk truncates diff lines
git log -L /init/,+15:config.py # rtk-bare: rtk truncates diff lines; 15 lines after first /init/ match
```
Range formats:
@@ -213,8 +213,8 @@ Bare `git`, not `rtk git`: rtk appends a blank line and a `Changes:` trailer, so
the output is no longer one record per line.
```bash
git diff --name-only # bare (ADR-0023); only filenames, one per line
git diff --name-status # bare (ADR-0023); status letter + filename per line
git diff --name-only # rtk-bare: rtk adds a trailer; only filenames, one per line
git diff --name-status # rtk-bare: rtk adds a trailer; status letter + filename per line
```
`--name-status` uses the same status letters as `--diff-filter`.
@@ -225,10 +225,10 @@ Bare `git`, not `rtk git`: rtk replaces the word-diff with its own diffstat
renderer and emits none of the `[-removed-] {+added+}` markers.
```bash
git diff --word-diff # bare (ADR-0023); inline word-level diff, [-removed-] {+added+} markers
git diff --word-diff=color # bare (ADR-0023); color only, no markers
git diff --word-diff=porcelain # bare (ADR-0023); machine-readable: +/- prefixed lines, ~ for newlines
git diff --word-diff-regex=<re> # bare (ADR-0023); define what counts as a "word"
git diff --word-diff # rtk-bare: rtk drops the word-diff; inline word-level diff, [-removed-] {+added+} markers
git diff --word-diff=color # rtk-bare: rtk drops the word-diff; color only, no markers
git diff --word-diff=porcelain # rtk-bare: rtk drops the word-diff; machine-readable: +/- prefixed lines, ~ for newlines
git diff --word-diff-regex=<re> # rtk-bare: rtk drops the word-diff; define what counts as a "word"
```
### Whitespace Flags
+1 -1
View File
@@ -10,7 +10,7 @@ description: >
Not submodule pointers -> `git-submodules`.
metadata:
version: "1.0.4"
version: "1.0.5"
category: git
source_keys:
- git-scm-remote-docs
@@ -50,13 +50,13 @@ Two mitigations:
# poisoned by an unrelated fetch.
# The inner `git config` is bare: its stdout becomes a remote URL, so any
# output rewriting would poison the remote silently.
rtk git remote add origin-push $(git config remote.origin.url) # inner bare (ADR-0023)
rtk git remote add origin-push $(git config remote.origin.url) # rtk-bare: inner command; rewritten output would corrupt the URL
rtk git push --force-with-lease origin-push
# Option 2 — explicit SHA via a local tag, unaffected by tracking-branch state
rtk git fetch
rtk git tag base master
git rebase -i master # bare, not `rtk` (ADR-0023): interactive sequence editor
git rebase -i master # rtk-bare: interactive sequence editor
rtk git push --force-with-lease=master:base master:master
```
@@ -8,7 +8,7 @@ description: >
Not interactive multi-step git guidance -> `git-workflow`.
metadata:
version: "1.0.3"
version: "1.0.4"
category: git
source_keys:
- git-scm-worktree-docs
@@ -32,7 +32,7 @@ metadata:
| Create a local branch tracking a remote one | `rtk git worktree add --track -b <branch> <path> <remote>/<branch>` — always correct. `git worktree add <path> <branch>` expands to exactly this, but **only** under the conditions in `references/worktrees.md` |
| Throwaway experiment, no branch | `rtk git worktree add -d <path>` — detached HEAD |
| **Never** `git worktree add <path> <remote>/<branch>` | That ref resolves, so the shortcut never fires and you get **a detached HEAD, no branch, no upstream**. Commits there go unreachable once HEAD moves, and `git push` needs an explicit refspec. Use the tracking row above |
| List | `git worktree list -v` to read, or `git worktree list --porcelain -z` to parse — both bare (ADR-0023): rtk re-renders the output and drops the porcelain flags |
| List | `git worktree list -v` to read, or `git worktree list --porcelain -z` to parse — rtk-bare: rtk re-renders the output and drops the porcelain flags |
| Lock or unlock | `rtk git worktree lock [--reason <str>] <path>` / `rtk git worktree unlock <path>` |
| Move | `rtk git worktree move <from> <to>` |
| Remove | `rtk git worktree remove <path>` |
+58 -1
View File
@@ -25,7 +25,7 @@ The entry above is unpinned and tracks the remote's default branch. To pin a rel
## Conventions
Skills here run local git commands through the org's `rtk` wrapper. **When a command is prefixed, when it stays bare, and why some executable commands must stay bare are all decided by ADR-0023** (`docs/adr/0023-rtk-prefix-marks-executable-commands-only.md`), which is repo-wide and not specific to this plugin. `check-rtk-prefix` enforces the part of it that is machine-decidable.
Skills here run local git commands through the org's `rtk` wrapper. **When a command is prefixed, when it stays bare, and why some executable commands must stay bare are all decided by ADR-0023** (`docs/adr/0023-rtk-prefix-marks-executable-commands-only.md`), which is repo-wide and not specific to this plugin. `check-rtk-prefix` enforces the part of it that is machine-decidable. A command that must stay bare carries `rtk-bare: <reason>` on the same line as the command (in a trailing comment or the same table cell), which is the gate's opt-out marker.
Installing this plugin without `rtk`? Every prefixed command is a plain `git` invocation with a word in front of it — drop the `rtk ` and it is correct.
@@ -35,9 +35,66 @@ Installing this plugin without `rtk`? Every prefixed command is a plain `git` in
|---|---|---|
| Skills | `.apm/skills/` | `git-commits`, `git-branches`, `git-history`, `git-remotes`, `git-submodules`, `git-workflow`, `git-worktrees`, `pc-author`, `pc-run` |
| Agents | `.apm/agents/` | `git-orchestrate` |
| Hooks | `.apm/hooks/` | `refuse-push-to-main.py`, see [Push-to-main hook](#push-to-main-hook) |
`.apm/` is the authoring source and the only thing apm deploys (ADR-0024).
## Push-to-main hook
On Claude Code, a `PreToolUse` hook refuses a Bash `git push` that can update `main`:
- an explicit destination: `main`, `HEAD:main`, `<branch>:main`, `refs/heads/main`, or deleting `main`
- a bare `git push`, `HEAD` or `@` while `main` is checked out
- a bulk push: `--all`, `--mirror`, `:`, or a wildcard refspec that covers `main`
- any of these with `--force` or `--force-with-lease`
Pushes to other branches, tag pushes and `--dry-run` go through. apm also deploys the files to Copilot and Codex, where the hook does nothing.
### Limits
The hook is a guardrail against accidents. Server-side branch protection is the real control. If the hook itself fails, the push goes through. It does not see:
- git aliases, shell variables such as `$BRANCH`, scripts, `bash -c`, command substitution inside double quotes, or pushes made through an MCP server
- git config that redirects a push (`push.default=upstream`, `remote.<name>.push`)
- a push behind a wrapper option that takes a separate value, such as `sudo -u <user>` or `env -u <name>`
- a command line the hook cannot parse, for example `$'...'` with an escaped quote
- a bare `git push`, `HEAD` or `@` in a command that makes the branch unknown:
- an earlier `git switch` or `git checkout` to anything but a literal `main`, `git branch -m`, `git rebase <upstream> <branch>`, `gh pr checkout` or `tea pr checkout`
- an earlier `cd` to a path that is not literal
- `--git-dir`, `GIT_DIR=` or `xargs` on the push itself
### Opt-out
To allow pushes to `main`, set the variable under `env` in `.claude/settings.json`, or in `.claude/settings.local.json` for yourself only:
```json
{
"env": {
"GIT_ALLOW_PUSH_TO_MAIN": "1"
}
}
```
Claude Code puts `env` values into its own environment, which hooks inherit. Setting the variable inside the command (`GIT_ALLOW_PUSH_TO_MAIN=1 git push`) has no effect. After you remove the setting, restart Claude Code for the hook to refuse again.
### Approval
The hook is an executable primitive, so whether it deploys depends on the `executables:` block in the consuming project's `apm.yml`:
- **No `executables:` block:** hooks deploy without approval.
- **With an `executables:` block:** the hook is parked until it is granted. Grant it in one of two ways, then run `apm install` and commit the `executables` entry:
- `apm approve` writes the entry and pins it to the hook's content, so a later change to the script needs approval again.
- A hand-written entry under the full package identity is not pinned:
```yaml
executables:
allow:
git.rkdr.net/Mortis/Holocron/plugins/git:
hooks: true
```
The first `apm approve` in a project creates the block and so turns the gate on. The next install then parks every other package's unapproved executables.
## Author
Defame1297
+1 -1
View File
@@ -1,5 +1,5 @@
name: git
version: 1.3.9
version: 1.4.1
description: Skills and agents for working with a local Git clone over the git wire protocol, and for authoring and running the pre-commit hooks that guard it.
author:
name: Mortis
@@ -12,7 +12,7 @@ compatibility: Requires Gitea MCP server configured with a token with write:repo
metadata:
category: integration
version: "0.1.4"
version: "0.1.5"
source_keys:
- gitea-mcp-repo
- gitea-mcp-slim-go
@@ -1,10 +1,10 @@
# Sources
**Note on call signatures:** per `docs/adr/0011-gitea-skill-deep-modules.md`, the tool parameter
signatures in `references/branches.md` and `references/commits.md` were re-verified live via
`ToolSearch` against the deployed `gitea-mcp` server — **last verified against v1.7.0**, as reported
by `get_gitea_mcp_server_version` — rather than copied verbatim from `api-reference.md` below. This resolves issue #6 comment #849's root-cause finding
that a prior skill was authored from API docs that had drifted from the actual MCP tool schema.
**Note on call signatures:** the tool parameter signatures in `references/branches.md` and
`references/commits.md` were re-verified live via `ToolSearch` against the deployed `gitea-mcp`
server — **last verified against v1.7.0**, as reported by `get_gitea_mcp_server_version` — rather
than copied verbatim from `api-reference.md` below, because API docs can drift from the actual MCP
tool schema, and a skill authored from them once shipped a wrong parameter.
The research docs cited here informed gotchas, response shapes, and workflow context, not the
parameter lists themselves.
@@ -14,7 +14,7 @@ compatibility: Requires Gitea MCP server configured with write:issue and write:r
metadata:
category: integration
version: "0.1.5"
version: "0.1.6"
source_keys:
- gitea-mcp-repo
- gitea-mcp-slim-go
@@ -8,7 +8,7 @@ source_keys:
# Create-flow enrichments
Closes out the four enrichments deferred from issue #6 comment #848. Run in this order before the
Four enrichments to the create flow. Run them in this order before the
`issue_write method: "create"` call in SKILL.md's create dispatch: **labels → milestone →
assignee → dependency link**. Each step is independent and skippable on its own — a missing
milestone fit doesn't block label inference, and so on — but this is the order that lets later
@@ -1,10 +1,9 @@
# Sources
**Note on call signatures:** per `docs/adr/0011-gitea-skill-deep-modules.md`, the tool parameter
signatures in `references/issues.md` and `references/search.md` are re-verified live via
`ToolSearch` against the deployed `gitea-mcp` server — they are not copied verbatim from
`api-reference.md`. This resolves issue #6 comment #849's root-cause finding that a prior skill was
authored from API docs that had drifted from the actual MCP tool schema. That re-verification is
**Note on call signatures:** the tool parameter signatures in `references/issues.md` and
`references/search.md` are re-verified live via `ToolSearch` against the deployed `gitea-mcp`
server — they are not copied verbatim from `api-reference.md`, because API docs can drift from the
actual MCP tool schema, and a skill authored from them once shipped a wrong parameter. That re-verification is
ongoing, not one-off: an earlier live check recorded `list_issues` as lacking the `type` and
`milestones` parameters `api-reference.md` documents, and both are present on the deployed
gitea-mcp **v1.7.0**, which is the version these signatures are current as of.
@@ -16,7 +16,7 @@ metadata:
- gitea-mcp-slim-go
- context7-websites-gitea
- context7-gitea-tea-cli
version: "0.1.7"
version: "0.1.8"
allowed-tools: Bash mcp__gitea__label_read mcp__gitea__label_write mcp__gitea__milestone_read mcp__gitea__milestone_write
---
@@ -61,7 +61,7 @@ per repo label. That does not contradict `label_write`'s schema, which annotates
server-side; where it is `false` labels in that scope stack legitimately. Read the field — never
infer exclusivity from the `/` in a name, and never carry another repo's map over.
On the instance this skill was authored against (`Mortis/Holocron`) the split ran: every
On the repo this skill was authored against the split ran: every
`Priority/*`, `Reviewed/*` and `Status/*` label `exclusive: true`, every `Kind/*` label and
`Compat/Breaking` `exclusive: false`. That is one repo's configuration at one point in time, recorded
as a worked example of what the field looks like in practice — it is not a property of the taxonomy
+1 -1
View File
@@ -1,5 +1,5 @@
name: gitea
version: 1.3.10
version: 1.3.11
description: Skills and agents for working with a Gitea forge through its HTTP API — the forge's own objects, as distinct from the local git clone.
author:
name: Mortis
@@ -13,7 +13,7 @@ You are the orchestrator for apm package/marketplace operations. Your one job is
You resolve the package root once per dispatched operation (the directory containing that package's `apm.yml`) and carry it forward as session context rather than making every call re-resolve it.
**Scope:** this orchestrator routes `apm-workflow`'s five concerns only — configure/scaffold, marketplace, install, compile/pack/publish, audit. It does not route `apm-install` (binary install, agent-runtime setup) — that's a one-time machine bootstrap, not a per-package, fan-out-able operation, and has no orchestrator counterpart. Confirm `apm --version` succeeds before dispatching any operation; if it fails, tell the caller to run `apm-install` first rather than attempting recovery here.
**Scope:** this orchestrator routes `apm-workflow`'s five concerns only — configure/scaffold, marketplace, install, compile/pack/publish, audit. It does not route `apm-install` (binary install, agent-runtime setup) — that's a one-time machine bootstrap, not a per-package, fan-out-able operation, and has no orchestrator counterpart. Confirm the repo's apm reports a usable version before dispatching any operation: `uv run --project <repo root> --frozen apm --version` in a repo that pins apm with uv, `apm --version` otherwise (`apm-workflow` Step 2 says how to tell). Always pass `--project`: `uv run` outside the project silently falls back to the `PATH` apm. Exit 0 is not enough. The version must equal the repo's pin, or be 0.39.2 or later where nothing pins it, because an older apm refuses a v4 lockfile. If the check fails, tell the caller to run `apm-install` first rather than attempting recovery here.
## Hard rules
@@ -43,7 +43,7 @@ These are non-negotiable regardless of `confirm` or any skill-local override:
1. Validate the request structure and check if `operation` is known
2. Check the request against the Hard rules above (publish confirmation, marketplace-add direction, `type:` delegation, audit-vs-audit-ci, registries precondition) — refuse outright on violation, independent of `confirm`
3. If `operation` is `publish`: require `confirm: true`, dispatch `--dry-run -v` first regardless, surface that output, else fail with structured "requires explicit confirmation" error
4. Verify `apm --version` succeeds; if not, fail with a diagnostic pointing to `apm-install`
4. Verify the repo's apm version (pinned: `uv run --project <repo root> --frozen apm --version`, which must equal the pin; otherwise `apm --version`, which must be 0.39.2 or later); if not, fail with a diagnostic pointing to `apm-install`
5. Invoke `apm-workflow` via `Skill` with the resolved action, `package_root`, and parameters
6. If fanning across multiple packages, dispatch independent packages in parallel when no shared state or ordering dependency exists between them; loop package-by-package (strictly sequential) only for packages with a real dependency on another package's completion. Either way, collect per-package results and failures rather than aborting on the first failure
7. Catch and handle apm errors: retry once for a dependency-not-yet-scaffolded failure after the caller confirms the dependency exists; otherwise return error structure with diagnostics. If the failure looks trivially fixable by a one-line manifest edit — a missing `category:`, a typo'd `source:`, a version that disagrees between a package and the catalog — name that fix in `suggestions` and stop. Do not apply it yourself and do not self-dispatch an `edit-config` to apply it
@@ -6,7 +6,7 @@ description: >
Not read-only review -> `factory-audit`. Not skills -> `skill-author`.
allowed-tools: Bash Read Write Edit
metadata:
version: "1.0.4"
version: "1.0.5"
category: factory
source_keys:
- context7-websites-code-claude
@@ -3,7 +3,7 @@
## templates/
Annotated agent definition templates copied by `scripts/new-agent.sh` when scaffolding a new agent.
All three scaffold the `description` in the three-part ADR-0020 shape — a `Use when` trigger clause, at most one capability clause, and a boundary clause — rather than the deleted action-verb opener, and each carries a delegate-don't-restate note in the body.
All three scaffold the `description` in the three-part context-budget shape — a `Use when` trigger clause, at most one capability clause, and a boundary clause — rather than the deleted action-verb opener, and each carries a delegate-don't-restate note in the body.
- **`claude-code.md`** — Claude Code agent definition template (project/user scope). Includes all supported frontmatter fields (required and optional) with inline guidance comments and `FILL IN:` placeholders.
- **`copilot.agent.md.template`** — Copilot CLI agent definition template (CLI format, project/user scope). Excludes cloud/IDE-only fields (`target`, `user-invocable`, `disable-model-invocation`, `mcp-servers`) and Claude Code-only fields. Uses Copilot tool aliases (`execute`, `read`, `edit`, `search`, `agent`, `web`).
@@ -32,7 +32,7 @@ description: FILL IN: Use when <trigger>. <One capability clause.> Not <thing> -
session whether or not this agent is ever used. Three parts, nothing else:
a trigger clause opening "Use when", at most one capability clause, and a
boundary clause naming a real sibling skill or agent.
250 characters is the target, 400 the hard ceiling (ADR-0020).
250 characters is the target, 400 the hard ceiling (context budget).
Do not open with an action verb ("Reviews...", "Analyzes...") — that rule was
deleted.
Never write "Use proactively" here. It steers the Claude Code runtime and does
@@ -12,7 +12,7 @@ description: FILL IN: Use when <trigger>. <One capability clause.> Not <thing> -
session whether or not this agent is ever used. Three parts, nothing else:
a trigger clause opening "Use when", at most one capability clause, and a
boundary clause naming a real sibling skill or agent.
250 characters is the target, 400 the hard ceiling (ADR-0020).
250 characters is the target, 400 the hard ceiling (context budget).
Do not open with an action verb ("Reviews...", "Analyzes...") — that rule was
deleted.
"Use proactively" is valid HERE and only here: it steers the Claude Code runtime
@@ -17,7 +17,7 @@ description: FILL IN: Use when <trigger>. <One capability clause.> Not <thing> -
every session whether or not this agent is ever used. Three parts, nothing else:
a trigger clause opening "Use when", at most one capability clause, and a
boundary clause naming a real sibling skill or agent.
250 characters is the target, 400 the hard ceiling (ADR-0020).
250 characters is the target, 400 the hard ceiling (context budget).
Do not open with an action verb ("Reviews...", "Analyzes...") — that rule was deleted.
Never write "Use proactively" here. It steers the Claude Code runtime and does nothing
in Copilot, and factory-audit's KyberforgeCopilot.ProactivePhrase grades it a hard FAIL.
@@ -285,7 +285,7 @@ else
if [[ "$SCOPE" == "plugin" ]]; then
echo " 1. Fill in $APM_FILE — replace every FILL IN: placeholder. Optional fields are" >&2
echo " scaffolded there as commented blocks; uncomment the ones that apply." >&2
echo " Description: 250 chars target / 400 ceiling (ADR-0020). The body has no" >&2
echo " Description: 250 chars target / 400 ceiling (context budget). The body has no" >&2
echo " word gate — delegate to a skill instead of restating what it does." >&2
echo " 2. Populate $SOURCES_DIR/sources.md with research sources, or delete it" >&2
echo " 3. Validate: $VALIDATE_HINT $APM_FILE" >&2
@@ -294,7 +294,7 @@ else
else
echo " 1. Fill in $CC_FILE — replace every FILL IN: placeholder. Optional fields are" >&2
echo " scaffolded there as commented blocks; uncomment the ones that apply." >&2
echo " Description: 250 chars target / 400 ceiling (ADR-0020). The body has no" >&2
echo " Description: 250 chars target / 400 ceiling (context budget). The body has no" >&2
echo " word gate — delegate to a skill instead of restating what it does." >&2
echo " 2. Fill in $CP_FILE — same, and heed its closing comment: the Claude Code-only" >&2
echo " fields it names must not cross over from the file above." >&2
@@ -6,20 +6,33 @@ description: >
authoring, publishing, auditing, or dependency installation for an apm
package -> `apm-workflow`.
metadata:
version: "1.0.1"
version: "1.0.2"
category: apm
source_keys:
- context7-microsoft-apm
- apm-v0-39-3-docs
- apm-cli-0-39-3-uv-experiments
---
## Gotchas
- apm never executes an agent itself — it only installs and manages the runtimes that do. Installing apm alone leaves the user with a package manager and no working agent CLI, so Step 2 is required whenever the user actually wants one; skip it only when they explicitly want the package manager alone.
- apm never executes an agent itself — it only installs and manages the runtimes that do. Installing apm alone leaves the user with a package manager and no working agent CLI, so Step 3 is required whenever the user actually wants one; skip it only when they explicitly want the package manager alone.
- `apm runtime setup copilot` needs Node.js v22+ and npm v10+ already on `PATH`; apm will not install them for you.
- In a repo that pins apm with uv, the `PATH` apm is not the repo's apm and may refuse its lockfile. Never upgrade the global apm to fix one repo: other repos may depend on its version.
## Step 1 — Install the apm CLI
## Step 1 — Choose where apm comes from
If `apm --version` already answers and the user is not pinning or upgrading, skip to Step 2.
| Condition | Method | Where |
|---|---|---|
| The repo pins apm: `pyproject.toml` has a quoted `apm-cli` or `apm_cli` requirement, beside a `uv.lock` | Per-repo pin. Use or upgrade it, never the global apm | `references/uv-pin.md` |
| The user wants apm fixed per repo, and uv is available | Per-repo pin. Set it up | `references/uv-pin.md` |
| Anything else: a machine-wide apm, a CI image, no uv | Global install | Step 2 |
Unsure which row applies: read the worked example closing `references/uv-pin.md`.
## Step 2 — Install the global apm CLI
If `apm --version` already answers and the user is not pinning or upgrading, skip to Step 3.
Default:
@@ -29,16 +42,17 @@ curl -sSL https://aka.ms/apm-unix | sh
Escape hatches — combine as needed:
- **Pin a version** — append `@vX.Y.Z` to the piped script's arguments: `curl -sSL https://aka.ms/apm-unix | sh -s -- @v1.2.3`.
- **Pin a version** — append `@vX.Y.Z` to the piped script's arguments: `curl -sSL https://aka.ms/apm-unix | sh -s -- @v1.2.3`. Pick 0.39.2 or later for a repo whose `apm.lock.yaml` an apm 0.39.2 or later wrote; older versions refuse it.
- **Custom install directory** — set `APM_INSTALL_DIR` on the piped script's command: `curl -sSL https://aka.ms/apm-unix | APM_INSTALL_DIR=$HOME/.local/bin sh`.
- **Air-gapped mirror / GitHub Enterprise** — an air-gapped host cannot reach `aka.ms` at all, so get `install.sh` onto the box and run it from disk instead of piping. Point it at the mirror with `APM_RELEASE_BASE_URL` and pin `VERSION`: `APM_RELEASE_BASE_URL=https://mirror.corp/apm VERSION=v1.2.3 sh install.sh`; add `APM_RELEASE_METADATA_URL` instead if you leave `VERSION` unset. `GITHUB_URL` is the GitHub Enterprise host, not a release mirror. All four are ordinary environment variables that also work through the pipe — running from disk is a network constraint, not a script one.
- **pip** — `pip install apm-cli` requires Python 3.10+. Not on an externally-managed (PEP 668) Python such as Debian or Ubuntu, where it hard-fails with `error: externally-managed-environment`; use pipx below. The quick-install script has no Python prerequisite, so prefer it unless the environment is pip-first.
- **Air-gapped mirror / GitHub Enterprise** — an air-gapped host cannot reach `aka.ms` at all, so get `install.sh` onto the box and run it from disk instead of piping. Point it at the mirror with `APM_RELEASE_BASE_URL` and pin `VERSION`: `APM_RELEASE_BASE_URL=https://mirror.corp/apm VERSION=v1.2.3 sh install.sh`; add `APM_RELEASE_METADATA_URL` instead if you leave `VERSION` unset. `GITHUB_URL` is the GitHub Enterprise host, not a release mirror.
- **pip** — `pip install apm-cli` requires Python 3.11+ (since apm 0.36.0), and so does every other Python-based install. Not on an externally-managed (PEP 668) Python such as Debian or Ubuntu, where it hard-fails with `error: externally-managed-environment`; use pipx below. The quick-install script has no Python prerequisite, so prefer it unless the environment is pip-first.
- **pipx** — `pipx install apm-cli` on those PEP 668 environments. Same PyPI package, but pipx builds an isolated venv and exposes `apm` on `PATH`.
- **Package managers** — `brew install apm`, `winget install --id Microsoft.APM --exact --source winget` or `scoop install apm`. The apm docs give no way to pin a version through them.
- **Manual** — download the platform archive from the GitHub releases page, extract, and place the binary on `PATH`.
Verify with `apm --version`.
## Step 2 — Install or manage an agent runtime
## Step 3 — Install or manage an agent runtime
Default:
@@ -46,7 +60,7 @@ Default:
apm runtime setup copilot
```
Other targets: `apm runtime setup codex`, `apm runtime setup gemini`, `apm runtime setup llm`.
Other targets: `apm runtime setup codex`, `apm runtime setup gemini`, `apm runtime setup llm`. In a repo that pins apm, spell each of these as `uv run --project <repo root> --frozen apm runtime …`.
- `apm runtime list` — show installed runtimes.
- `apm runtime status` — show which runtime `apm run` will pick by default.
@@ -15,3 +15,27 @@
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md
- **Contributing files:** (none)
- **Status:** `referenced`
## apm-v0-39-3-docs
- **URL:** https://github.com/microsoft/apm/tree/v0.39.3/docs/src/content/docs
- **Description:** The apm docs source at tag v0.39.3: the installation page (install methods, the Python 3.11 floor, version pinning, the package-manager installs) and the lockfile compatibility pages (which apm reads which lock, the minimum-version advice, `apm audit --ci` refusing unknown lock fields).
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md (digest: plugins/kyberforge/docs/research/docs/microsoft-apm/installation.md)
- **Contributing files:** SKILL.md, references/uv-pin.md
- **Status:** `extracted`
## apm-cli-0-39-3-uv-experiments
- **URL:** https://pypi.org/project/apm-cli/0.39.3/
- **Description:** Throwaway uv 0.11.24 projects pinning apm-cli 0.39.3: the `[tool.uv] package = false` form, `uv run --frozen --offline` with a warm and a cold cache, and `uvx --offline` against a cache warmed by `uv add`. Grounds the per-repo pin, its offline behaviour and the rejection of uvx and `uv tool`.
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md (digest: plugins/kyberforge/docs/research/docs/microsoft-apm/installation.md)
- **Contributing files:** SKILL.md, references/uv-pin.md
- **Status:** `extracted`
## pypi-apm-cli
- **URL:** https://pypi.org/pypi/apm-cli/json
- **Description:** PyPI metadata for apm-cli: `requires_python >=3.11` and the runtime dependencies the uv lock pins.
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md (digest: plugins/kyberforge/docs/research/docs/microsoft-apm/installation.md)
- **Contributing files:** references/uv-pin.md
- **Status:** `extracted`
@@ -0,0 +1,99 @@
---
source_keys:
- apm-cli-0-39-3-uv-experiments
- apm-v0-39-3-docs
- pypi-apm-cli
---
# Pinning apm per repo with uv
Reached from `SKILL.md` Step 1. apm has no `apm.yml` field for a minimum apm version, and upstream
advises pinning apm outside the manifest. A uv pin gives every checkout of the repo the same apm
and the same transitive dependencies, whatever is installed globally. apm's docs do not describe
this method. It was tested with uv 0.11.24 and apm-cli 0.39.3.
## Set up the pin
1. Add this `pyproject.toml` at the repo root:
```toml
[project]
name = "<repo>-tooling"
version = "0.0.0"
requires-python = ">=3.11"
dependencies = []
[tool.uv]
package = false
[dependency-groups]
dev = ["apm-cli==0.39.3"]
```
- There is no `[build-system]`, and `package = false` keeps uv from ever building the project,
so uv installs only the `dev` group. `uv sync` installs that group by default.
- `>=3.11` is apm-cli's own floor.
- Pin with `==`. Choose 0.39.2 or later. Older versions refuse a lockfile that 0.39.2 or later
rewrote.
- If the repo already has a `pyproject.toml` for a real Python project, add `apm-cli==<version>`
to a dependency group there. Do not add `package = false` to a project that builds.
2. Run `uv lock`. Commit `pyproject.toml` and `uv.lock`, and gitignore `.venv/`. The lock hashes
apm-cli and every transitive dependency.
3. On each checkout, run `uv sync --frozen` once. The first sync on a machine needs the network,
because a cold uv cache cannot download wheels offline.
4. Run `uv run --project . --frozen apm install` from the repo root. The first install with apm 0.39 or later also needs the
network once, to record commit verdicts.
5. Check the version with `uv run --project . --frozen apm --version`.
## Run it
- Spell every apm command in the repo as `uv run --project <repo root> --frozen apm <args>`. `--frozen` runs from
`uv.lock` as committed and never re-resolves it. It still syncs the environment to the lock
first. After the one-time sync that costs nothing, and when a pull moves the pin it brings the
environment up to the new version.
- Scripts always pass `--project <repo root>`. Without it, `uv run` from a directory outside the repo finds no project and silently runs the `PATH` apm. The same happens under a nested `pyproject.toml`.
- Offline, `uv run --project <repo root> --frozen --offline apm …` works once the uv cache is warm, even with no
`.venv`. With a cold cache it fails.
- A hook with a short timeout must never sync. kyberforge's SessionStart hook runs
`uv run --project <root> --frozen --no-sync --offline apm`, after checking that
`${UV_PROJECT_ENVIRONMENT:-<root>/.venv}` exists, because even `--no-sync` creates an empty one.
## Upgrade the pin
Change the `==` version, then run `uv lock` and `uv sync --frozen`, and commit both files. Then
follow apm's own upgrade notes for the versions crossed. Every machine and CI job that runs
`apm install` or `apm audit --ci` on the repo's lockfile needs an apm at least as new as the one
that last wrote it. `apm audit --ci` fails on lockfile fields it does not know.
## Why not uvx or `uv tool`
- **`uvx apm-cli@<version>`** pins only apm-cli. Its transitive dependencies float between runs and
nothing is locked. A cache warmed by `uv add` also did not satisfy `uvx --offline`.
- **`uv tool install apm-cli`** is machine-global, the same drift as a global pipx install under
another name.
uv installs the apm tool and nothing else. Packages, skills and agents still come from
`apm install`.
## Worked example: one pinned repo, one unpinned
**Repo A pins apm.** The user asks to install the repo's apm dependencies. The root
`pyproject.toml` has `dev = ["apm-cli==0.39.3"]`, and `uv.lock` sits beside it.
1. Detect the pin: a quoted `apm-cli` or `apm_cli` requirement in `pyproject.toml`, and a `uv.lock` beside it:
`grep -Eq "[\"']apm[-_]cli" pyproject.toml && test -f uv.lock`.
2. Run `uv sync --frozen`, the first time on this checkout.
3. Run `uv run --project . --frozen apm --version`. It prints 0.39.3.
4. Run `uv run --project . --frozen apm install`.
Wrong moves: a bare `apm install`, because the `PATH` apm may be 0.28.0, which refuses the v4 lock.
`pipx upgrade apm-cli`, because that changes every repo on the machine. `uvx apm-cli@0.39.3
install`, because its dependencies are unlocked.
**Repo B does not pin apm.** It has no `pyproject.toml` naming `apm-cli`, or no `uv.lock`.
1. Run `apm --version`. If nothing answers, install apm globally (`SKILL.md` Step 2).
2. If apm is older than the repo's lock needs (0.39.2 or later for a lock 0.39.2 or later wrote),
upgrade the global apm, or propose a per-repo pin. Do not add the pin unasked: it is a repo
change the user should approve.
3. Run `apm install`.
@@ -5,16 +5,18 @@ description: >
the dependencies it declares, or an apm marketplace — even when the user does
not say "apm". Not the apm binary or an agent runtime -> `apm-install`.
metadata:
version: "1.0.3"
version: "1.0.4"
category: apm
source_keys:
- context7-microsoft-apm
- apm-cli-0-39-3-uv-experiments
---
## Gotchas
- MCP server secrets in `apm.yml` (headers, env vars) must use `${VAR}` indirection, never literal values, so they resolve at install or runtime and are never committed.
- `apm experimental enable registries` must run before a `registries:` block or `registry.*` config takes effect anywhere — configure, install or publish. Without it, declaring one silently does nothing: no error, no warning.
- `uv run` outside the uv project silently runs the `PATH` apm instead: from outside the repo it reported 0.28.0 where the repo pinned 0.39.3. Hence `--project` in Step 2.
- `apm.yml`'s `type:` selects which primitives are processed and is never checked against what `.apm/` holds, so `apm install` and `apm compile` can exit 0 having shipped none of the ones you expected. Set it to cover every primitive the package ships, and confirm the deployed output, not the exit code. Mechanics: `references/configure.md`.
## Step 1 — Dispatch
@@ -29,6 +31,15 @@ metadata:
Read the reference file matching the resolved flow — it carries that flow's own traps, and names a sibling file wherever one flow genuinely depends on another's detail.
## Step 2 — Execute
## Step 2 — Choose the apm command
Follow the matched reference file's instructions. Report back which `apm` command(s) were run (or drafted, if the user asked for a plan rather than execution) and their outcome.
The references spell every command as bare `apm`. Before running one, check whether the repo pins apm: a `pyproject.toml` at the repo root carrying a quoted `apm-cli` or `apm_cli` requirement, with a `uv.lock` beside it.
- **Pinned:** run each command as `uv run --project <repo root> --frozen apm <args>`. Run `uv sync --frozen` once per checkout first; the first sync needs the network. A bare `apm` there runs whatever is on `PATH`, which may be older than the repo's pin and refuse its lockfile.
- **Not pinned:** use the `apm` on `PATH`. If it is missing, or refuses the repo's lockfile as too new, hand off to `apm-install`.
Installing apm, or adding or moving the pin, belongs to `apm-install`.
## Step 3 — Execute
Follow the matched reference file's instructions. Report back which `apm` command(s) were run (or drafted, if the user asked for a plan rather than execution), spelled as invoked, and their outcome.
@@ -4,6 +4,9 @@ source_keys:
- context7-microsoft-apm
- context7-websites-code-claude
- claude-code-plugins-docs
- apm-v0-39-3-source
- apm-v0-39-3-docs
- apm-cli-0-39-3-uv-experiments
---
## `apm audit`
@@ -14,7 +17,7 @@ apm audit --ci # CI gate: lockfile consistency + drift replay + pol
apm audit --file <path> # standalone: scan an arbitrary file
```
Exit code `0` on success, `1` on any violation — composes as a normal CI gate step. It does not replace general lint/test/security-scan CI steps, it sits alongside them.
`apm audit --ci` exits `0` when every check passes and `1` when any fails, so it composes as a normal CI gate step. Plain `apm audit` exits `0` when clean, `1` on a critical finding and `2` on warnings only. It does not replace general lint/test/security-scan CI steps, it sits alongside them.
## Policy checks
@@ -46,6 +49,10 @@ jobs:
`-f sarif --output <file>` emits SARIF for GitHub Code Scanning's inline PR annotations.
In a repo that pins apm with uv, replace the `pip install` step with `uv sync --frozen` and run each apm step as `uv run --project . --frozen apm …` from the checkout root, so CI runs the repo's own apm.
The apm that runs `apm audit --ci` must be at least as new as the newest apm that wrote `apm.lock.yaml`: it fails on lockfile fields it does not know, where plain `apm audit` only warns.
## Frozen installs
`apm install --frozen` fails instead of silently re-resolving if the lockfile is out of date — the CI equivalent of `npm ci` vs `npm install`. Use in any CI job that must not be allowed to drift the lockfile.
@@ -2,6 +2,7 @@
topic: compile
source_keys:
- context7-microsoft-apm
- apm-cli-0-39-3-experiments
---
## Compile
@@ -12,7 +13,7 @@ apm compile --clean # zero-write sanity check; use for skill/agent-o
apm compile --clean --dry-run # pure preview, no writes
```
Compiles `.apm/instructions/` + `.apm/agents/*.agent.md` primitives into consumer-side context files (AGENTS.md/CLAUDE.md CONTEXT files) for the deployment target, per the `compilation:` block in `apm.yml`. This is the consumer/deployment side — it is NOT the producer of `plugin.json`/`marketplace.json`; that's `apm pack`'s job (below). Run `apm compile` after any change to `.apm/instructions/`/`.apm/agents/` content or to `compilation:`/`targets:` in `apm.yml`. To author an instructions file, use `instructions-author` — it covers which fields each target drops. `apm compile` never reads `.apm/prompts/`; to author a prompt file, use `prompt-author` — verification there is a throwaway `apm install`.
Compiles `.apm/instructions/` + `.apm/agents/*.agent.md` primitives into consumer-side context files (AGENTS.md/CLAUDE.md CONTEXT files) for the deployment target, per the `compilation:` block in `apm.yml`. For the `claude` target, apm 0.38 and later write the instructions into `AGENTS.md` and a `CLAUDE.md` that only imports it (`@AGENTS.md`). This is the consumer/deployment side — it is NOT the producer of `plugin.json`/`marketplace.json`; that's `apm pack`'s job (below). Run `apm compile` after any change to `.apm/instructions/`/`.apm/agents/` content or to `compilation:`/`targets:` in `apm.yml`. To author an instructions file, use `instructions-author` — it covers which fields each target drops. `apm compile` never reads `.apm/prompts/`; to author a prompt file, use `prompt-author` — verification there is a throwaway `apm install`.
## Pack
@@ -63,5 +64,5 @@ Executes a named script defined under `scripts:` in `apm.yml`, with `--param` su
## Gotchas
- Plain `apm compile` HARD-FAILS with exit 1 and `No instruction files found in .apm/ directory` on any package that has skills/agents but no `.apm/instructions/` content — the common case for a skill-only or skill+agent package. Use `apm compile --clean` as the zero-write sanity-check substitute: it sets `allow_empty=True` internally and exits 0 cleanly with zero writes; add `--dry-run` for a pure preview. `compile` ≠ `pack` — see above.
- Plain `apm compile` HARD-FAILS with exit 1 and `No instruction files found in .apm/ directory` (re-run on apm 0.39.3) on any package that has skills/agents but no `.apm/instructions/` content — the common case for a skill-only or skill+agent package. Use `apm compile --clean` as the zero-write sanity-check substitute: it sets `allow_empty=True` internally and exits 0 cleanly with zero writes; add `--dry-run` for a pure preview. `compile` ≠ `pack` — see above.
- `claude plugin validate --strict` auto-scans every `.md` file directly under a compiled plugin's `agents/` directory and treats it as an agent definition requiring frontmatter, independent of any manifest declaration (an empirically observed Claude Code platform behavior, not an `apm` mechanic). A non-agent `.md` file (notes, provenance record, README) that ends up under `.apm/agents/` in the source tree will still fail validation once compiled to the `claude` target. Keep such files outside `.apm/agents/` (e.g. at the package root), regardless of what `apm.yml` declares.
@@ -2,6 +2,7 @@
topic: configure
source_keys:
- context7-microsoft-apm
- apm-v0-39-3-source
---
## Scaffolding a new package
@@ -90,6 +91,6 @@ apm config set registry.corp-main.default true
## Gotchas
- `apm.yml`'s `type:` field validates nothing about `.apm/`. It selects processing: `instructions` compiles to AGENTS.md only, `skill` installs a native skill only, `prompts` emits commands only, `hybrid` does both (see `apm_cli/models/validation.py`, `PackageContentType`). apm checks only that the value parses to one of those four strings; no check anywhere compares it against the primitives actually on disk, and no mismatch diagnostic exists. A package declaring `type: instructions` while shipping `.apm/skills/` therefore raises no error — the mismatch resolves silently, either by omitting that primitive from the install/compile output or, in apm 0.28.0 where `get_effective_type()` routes off the on-disk layout and never reads the declared field, by ignoring the declared value outright. Both directions are silent: `apm install` and `apm compile` can exit 0 having shipped none of the primitives you expected. Set `type:` to cover every primitive the package ships, and confirm the deployed output rather than the exit code.
- `apm.yml`'s `type:` field validates nothing about `.apm/`. It selects processing: `instructions` compiles to AGENTS.md only, `skill` installs a native skill only, `prompts` emits commands only, `hybrid` does both (see `apm_cli/models/validation.py`, `PackageContentType`). apm checks only that the value parses to one of those four strings; no check anywhere compares it against the primitives actually on disk, and no mismatch diagnostic exists. A package declaring `type: instructions` while shipping `.apm/skills/` therefore raises no error — the mismatch resolves silently, either by omitting that primitive from the install/compile output or, in apm 0.28.0 and still in 0.39.3, where `get_effective_type()` routes off the detected package layout and never reads the declared field, by ignoring the declared value outright. Both directions are silent: `apm install` and `apm compile` can exit 0 having shipped none of the primitives you expected. Set `type:` to cover every primitive the package ships, and confirm the deployed output rather than the exit code.
- `apm experimental enable registries` must run before any `registry.*` config takes effect. Declaring a `registries:` block or running `apm config set registry.*` without it silently does nothing — no error, no warning.
- `apm plugin init <name>` run with a positional name argument, from inside a directory already named `<name>`, creates a wrongly-nested `<name>/<name>/` subdirectory — it treats the positional arg as "create a new project directory named X," not "confirm the current directory is X." Fix: omit the positional argument entirely when already cd'd into the target package directory — run `apm plugin init --yes --target claude,copilot` instead.
@@ -5,6 +5,7 @@ source_keys:
- context7-websites-code-claude
- claude-code-plugins-docs
- apm-github-repo
- apm-v0-39-3-source
---
## Building a marketplace from a producer repo
@@ -114,6 +115,6 @@ hook.
## Gotchas
- `apm marketplace add` and `apm marketplace package add` point in opposite directions and are easy to conflate: `add` registers someone else's catalog for you to *consume*; `package add` registers a package by remote reference (`owner/repo`, host URL, or full URL) into a marketplace you are *building*. `package add` does not accept a local path — register a local package by hand-editing `marketplace.packages[]`, as above.
- Only `claude` and `codex` marketplace output profiles exist in apm 0.28.0 — confirmed via source (`apm_cli/marketplace/output_profiles.py`: `MARKETPLACE_OUTPUTS = {claude: ..., codex: ...}`, nothing else). There is no native Copilot marketplace output; `apm pack` will not generate one. A repo needing a Copilot-consumable marketplace manifest must maintain it separately by other means.
- The marketplace output profiles depend on the apm version. apm 0.39.3 has three, `claude` (`.claude-plugin/marketplace.json`), `codex` (`.agents/plugins/marketplace.json`) and `copilot` (`.github/plugin/marketplace.json`), confirmed in `apm_cli/marketplace/output_profiles.py`. apm 0.28.0 had only `claude` and `codex`, so an older apm cannot emit a Copilot marketplace manifest. Add the output under `marketplace.outputs` only once every apm that packs the repo has it.
- A package/plugin `name` compiling to the `claude` target must avoid Claude Code's reserved name prefixes/values — `anthropic-*`, `claude-*`, `agent-skills`, `official-claude-plugins` — otherwise the compiled `.claude-plugin/marketplace.json` is rejected by Claude Code's validator. This is a Claude Code platform constraint, independent of how the manifest gets authored.
- Removing a package from `marketplace.packages[]` in `apm.yml` and re-packing changes the public/consumed catalog. Confirm with the user in conversation before removing the entry and running `apm pack` — this is a normal `apm.yml` edit (not a distinct apm-orchestrate operation with its own gate), so the confirmation is conversational, the same as any other consequential manifest edit.
@@ -11,7 +11,7 @@
## apm-github-repo
- **URL:** https://github.com/microsoft/apm
- **Description:** APM's own Python source (`src/apm_cli/`), read directly for schema and compile-mapping ground truth where Context7's doc snippets were thin. Backs the marketplace output-profile claim (`apm_cli/marketplace/output_profiles.py` — only `claude` and `codex` profiles exist, so there is no native Copilot marketplace output) and the `apm pack --check-clean`/`--check-versions` semantics.
- **Description:** APM's own Python source (`src/apm_cli/`), read directly for schema and compile-mapping ground truth where Context7's doc snippets were thin. Backs the `apm pack --check-clean`/`--check-versions` semantics, and the 0.28.0 marketplace output profiles (`claude` and `codex` only).
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md
- **Contributing files:** references/marketplace.md
- **Status:** `extracted`
@@ -39,3 +39,35 @@
- **Research doc:** plugins/kyberforge/docs/research/docs/claude-code-plugins/sources.md
- **Contributing files:** (none)
- **Status:** `referenced`
## apm-v0-39-3-source
- **URL:** https://github.com/microsoft/apm/tree/v0.39.3/src/apm_cli
- **Description:** apm source at tag v0.39.3, read from the pinned install: the three marketplace output profiles in `marketplace/output_profiles.py`, `get_effective_type()` in `integration/skill_package_routing.py` still routing off the detected package layout, and the `apm audit` exit codes.
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md (digest: plugins/kyberforge/docs/research/docs/microsoft-apm/cli-reference.md)
- **Contributing files:** references/marketplace.md, references/configure.md, references/audit.md
- **Status:** `extracted`
## apm-v0-39-3-docs
- **URL:** https://github.com/microsoft/apm/tree/v0.39.3/docs/src/content/docs
- **Description:** apm docs at tag v0.39.3: `apm audit --ci` refusing lockfile fields it does not know, so the auditing apm must be at least as new as the lock's writer.
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md (digest: plugins/kyberforge/docs/research/docs/microsoft-apm/lockfile-and-compatibility.md)
- **Contributing files:** references/audit.md
- **Status:** `extracted`
## apm-cli-0-39-3-uv-experiments
- **URL:** https://pypi.org/project/apm-cli/0.39.3/
- **Description:** Throwaway uv projects pinning apm-cli 0.39.3. Grounds the pinned invocation `uv run --project <repo root> --frozen apm` in `SKILL.md` Step 2 and in the CI note, and the need for one online `uv sync --frozen` per machine.
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md (digest: plugins/kyberforge/docs/research/docs/microsoft-apm/installation.md)
- **Contributing files:** SKILL.md, references/audit.md
- **Status:** `extracted`
## apm-cli-0-39-3-experiments
- **URL:** https://pypi.org/project/apm-cli/0.39.3/
- **Description:** The repo-pinned apm-cli 0.39.3 run in throwaway packages outside the repo (holocron#273): the Claude compile writing a `CLAUDE.md` that imports `AGENTS.md`, and a skills-only package's plain compile still exiting 1 while `--clean` exits 0.
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md (digest: plugins/kyberforge/docs/research/docs/microsoft-apm/instructions-gotchas.md)
- **Contributing files:** references/compile.md
- **Status:** `extracted`
@@ -7,7 +7,7 @@ description: >
fixes -> agent-author.
allowed-tools: Bash Read
metadata:
version: "1.0.7"
version: "1.0.8"
category: factory
source_keys:
- agentskills-home
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# lib-boundary-resolver.sh — SOURCED, never executed.
#
# The ADR-0020 shared boundary resolver — the ONE copy in the repo. Both of
# The shared boundary resolver — the ONE copy in the repo. Both of
# validate.sh's modes compose it into the Python program they run, and so does
# the repo-root hook scripts/skill-size-check.sh, so the audit and the commit
# hook resolve boundary targets through the same code rather than through
@@ -40,8 +40,8 @@
# shellcheck shell=bash
# shellcheck disable=SC2034
IFS='' read -r -d '' KYBERFORGE_RESOLVER_PY <<'KYBERFORGE_ADR0020_RESOLVER_PY' || true
# ===== BEGIN ADR-0020 SHARED BOUNDARY RESOLVER =====
IFS='' read -r -d '' KYBERFORGE_RESOLVER_PY <<'KYBERFORGE_RESOLVER_PY_END' || true
# ===== BEGIN SHARED BOUNDARY RESOLVER =====
# ONE resolver, and this is its only copy. Sourced from this file by:
# plugins/kyberforge/.apm/skills/factory-audit/scripts/validate.sh (both modes)
# scripts/skill-size-check.sh (the repo-root commit hook)
@@ -357,7 +357,7 @@ def known_targets(start_dir):
# already added, so a one-plugin monorepo shows a delta of zero and would
# wrongly reach for the deployed trees — including the user's global
# ~/.claude/skills, making the verdict depend on what happens to be
# installed (ADR-0020 lines 118-127).
# installed.
root, root_has_plugins = _authoring_root(start)
if root:
_collect_authoring_root(root, names)
@@ -373,7 +373,7 @@ def known_targets(start_dir):
# carrying "do not"/"instead"/"rather than"/"not for"). Without the second
# condition, pc-run's "run pre-commit hooks" reads as a route to a
# non-existent `pre-commit` skill.
# * A BARE arrow target counts only in ADR-0020's compressed boundary form,
# * A BARE arrow target counts only in the compressed boundary form,
# `Not <thing> -> <skill-name>`. The example that motivated it is gone:
# diagnose's process chain "fix -> regression-test", which without the
# gate read as a route to a non-existent `regression-test` skill, was cut
@@ -456,7 +456,7 @@ def known_targets(start_dir):
# that had no escape hatch.
#
# EXPLICIT ROUTE NOTATION is exempt from corroboration and always blocks:
# ADR-0020's compressed arrow (`Not <thing> -> <name>`) and Claude Code's
# the compressed arrow (`Not <thing> -> <name>`) and Claude Code's
# invocation form (`/<name>`). Neither is ever how English cites a tool — nobody
# writes `-> pre-commit` or `/pre-commit` to mean the hook — so there is no
# ambiguity to resolve, and an author who wants a route checked unconditionally
@@ -486,7 +486,7 @@ def known_targets(start_dir):
#
# THE TWO SWEEPS ARE GATED DIFFERENTLY, and the asymmetry is the whole point.
# `/name` is Claude Code's invocation syntax and nothing else — no English
# sentence contains one by accident — so the ADR-0020 amendment and
# sentence contains one by accident — so the boundary-target contract and
# docs/spec/gates.md both promise it blocks UNCONDITIONALLY, for any name. So
# NOTATION_SLASH is swept over every sentence, boundary marker or not. Gating it
# on BOUNDARY_MARKER made that promise false for the last sentence of
@@ -590,7 +590,7 @@ ARROW_BOUNDARY = re.compile(
r"\bnot\b%s*?(?:->|→)\s*(%s)\b" % (CLAUSE_BODY, NAME_HYPH), re.I)
BACKTICK = re.compile(r"`(%s)`" % NAME_HYPH, re.I)
# A boundary clause takes two shapes and BOTH count: the prose markers, and
# ADR-0020's compressed arrow form `Not <thing> -> <name>`.
# the compressed arrow form `Not <thing> -> <name>`.
BOUNDARY_MARKER = re.compile(r"\b(?:do\s+not|instead|rather\s+than|not\s+for)\b", re.I)
BOUNDARY_ARROW = re.compile(r"\bnot\b%s*?(?:->|→)" % CLAUSE_BODY, re.I)
# Sentence boundaries decide the CORROBORATION scope above, so getting one wrong
@@ -672,7 +672,7 @@ def _notation(text, start, arrow):
"""True if the name is written in route NOTATION rather than in prose.
Two forms qualify: `/name` (Claude Code's invocation syntax, detected from
the character before the name) and `-> name` (ADR-0020's compressed boundary
the character before the name) and `-> name` (the compressed boundary
form, passed in by the caller that matched the arrow). A backticked name
does NOT qualify — a code span is how a tool, a file and a skill are all
cited, so it carries no intent the follower test hasn't already read.
@@ -690,7 +690,7 @@ def _add(out, text, name, start, end, strict=None, arrow=False):
_terminal() and a follower outside FOLLOWER_OK set may_dangle=False. The
target then reached unresolved_targets() unblockable — and, before the
companion fix there, unreported as well. `... use /no-such-skill
afterwards.` exited 0 in total silence, on the one form ADR-0020 offers an
afterwards.` exited 0 in total silence, on the one form the contract offers an
author who wants a route checked unconditionally.
"""
if not name:
@@ -788,7 +788,7 @@ def _clause_end(description, pos):
def _arrow_clause_spans(description):
"""(start, end) for EACH ADR-0020 arrow clause, one span per clause.
"""(start, end) for EACH compressed arrow clause, one span per clause.
A clause runs from its `Not` to whichever comes first: the start of the
NEXT arrow clause, or the end of the clause body. Bounding on the next
@@ -808,7 +808,7 @@ def _arrow_clause_parses(clause):
"""True when either arrow extractor reads a target out of ONE clause.
Kept apart from boundary_targets() because the arrow form is the one shape
that ALWAYS names a target: ADR-0020's `Not <thing> -> <name>`. A clause
that ALWAYS names a target: the compressed `Not <thing> -> <name>`. A clause
written that way from which nothing could be extracted is a parse failure
that deserves its own message, and telling it apart needs the arrow targets
alone rather than every target in the description.
@@ -828,7 +828,7 @@ def boundary_clause_status(description):
the second sends the author hunting for a problem that is not there, and
three of them reworded a correct clause to satisfy a regex instead.
'unparsed' is the narrow, certain case: an ADR-0020 arrow clause was
'unparsed' is the narrow, certain case: a compressed arrow clause was
detected and NO target came out of IT. The arrow form always names one, so
zero targets means the name is written in a shape the extractor cannot see
— a single-word bare target (`Not X -> forge`, which has to be written
@@ -865,7 +865,7 @@ def multi_target_arrow_clauses(description):
never to arrows, so `Not X -> a or b` resolved `a`, left `b` neither
resolved nor reported, and then printed "1 of 1 boundary target(s) resolve"
on a clause naming two — a gate under-reporting its own coverage, which is
the one failure mode ADR-0020 says a gate must not have.
the one failure mode a gate must never have.
The clause is REJECTED rather than the arrow scan extended. Extending it
would widen the resolver's deliberately conservative false-positive tuning
@@ -1037,7 +1037,7 @@ def unresolved_body_targets(body, known):
# --- Frontmatter ----------------------------------------------------------
# Tolerant on the way in, HARD-FAILING on the way out. A UTF-8 BOM, a leading
# blank line, trailing whitespace after either `---`, or CRLF line endings all
# defeated the old `^---\n(.*?)\n---`, and the miss was SILENT: every ADR-0020
# defeated the old `^---\n(.*?)\n---`, and the miss was SILENT: every context-budget
# check was skipped and the file reported green (measured: a 550-character
# description with a 1,000-word body exited 0 behind a BOM). A file that cannot
# be measured must never report green, so every caller of these two ERRORs on a
@@ -1076,7 +1076,7 @@ def description_value(fm_text):
description is present. A line regex cannot: `description:` with no value
followed by `model: sonnet` lets `\\s*` cross the newline and captures the
NEXT key, which reads as a non-empty description, skips the "missing or
empty" failure, and then early-returns out of every ADR-0020 gate on the
empty" failure, and then early-returns out of every context-budget gate on the
genuinely empty folded value. That combination exited 0 with zero output on
a BLOCKING pre-push gate.
"""
@@ -1111,7 +1111,7 @@ def hand_invoked(fm_text):
`disable-model-invocation: true` removes a skill from the model-visible
listing entirely — it is not preloaded, and the Skill tool refuses to call
it — so its description is never matched against user intent. ADR-0020 and
it — so its description is never matched against user intent. The context budget and
skill-author's contract give such a skill ONE plain human-facing sentence:
no trigger list, no boundary clause. No validator knew the field existed
(issue #108), so the boundary-clause SUGGESTION fired on exactly the shape
@@ -1276,6 +1276,6 @@ def missing_reference_pointers(body, skill_dir):
if not os.path.isfile(os.path.join(skill_dir, 'references', match.group(1))):
missing.add('references/' + match.group(1))
return sorted(missing)
# ===== END ADR-0020 SHARED BOUNDARY RESOLVER =====
KYBERFORGE_ADR0020_RESOLVER_PY
# ===== END SHARED BOUNDARY RESOLVER =====
KYBERFORGE_RESOLVER_PY_END
KYBERFORGE_RESOLVER_PY="${KYBERFORGE_RESOLVER_PY%$'\n'}"
@@ -2,7 +2,7 @@
# lib-checks-agent.sh — SOURCED, never executed.
#
# agent-audit's structural check suite: everything in its validate.sh that is
# NOT the ADR-0020 shared boundary resolver, lifted verbatim and split at the
# NOT the shared boundary resolver, lifted verbatim and split at the
# resolver's markers. validate.sh reassembles
#
# $KYBERFORGE_AGENT_PREAMBLE_PY
@@ -17,8 +17,8 @@
#
# The dimension vocabulary and the tiers here are agent-audit's and are
# deliberately NOT reconciled with lib-checks-skill.sh's. Agents take the
# ADR-0020 description gates and no body word gate at all; adding one would
# contradict the ADR.
# context-budget description gates and no body word gate at all; adding one would
# be wrong (see the body-gate note below).
#
# Consumed by: validate.sh, agent mode.
# shellcheck shell=bash
@@ -36,7 +36,7 @@ kyberforge_agent_preflight() {
# dependency sends the reader to install the wrong thing.
if ! command -v python3 > /dev/null 2>&1; then
echo "Error: python3 is required but was not found on PATH." >&2
echo " Why: skipping the ADR-0020 description and boundary-target gates would be a vacuous pass." >&2
echo " Why: skipping the description and boundary-target gates would be a vacuous pass." >&2
echo " Fix: install python3 (pre-commit itself is a Python application, so it is almost certainly already present)." >&2
# Exit 2, the never-ran tier: no check ran, so this is not a findings result.
# lib-provenance-*.sh has always exited 2 here; this matches it.
@@ -45,7 +45,7 @@ kyberforge_agent_preflight() {
if ! python3 -c 'import yaml' > /dev/null 2>&1; then
echo "Error: PyYAML is required but is not importable by python3." >&2
echo " Why: skipping the ADR-0020 description and boundary-target gates would be a vacuous pass." >&2
echo " Why: skipping the description and boundary-target gates would be a vacuous pass." >&2
echo " Fix: python3 -m pip install PyYAML (or your distro's python3-yaml package)." >&2
# Exit 2, the never-ran tier: a missing hard dependency is not a findings result.
exit 2
@@ -62,13 +62,13 @@ import yaml
# Output is UTF-8 for the same reason input is: under LC_ALL=C the streams
# default to ASCII, and this script's own message text carries em dashes (the
# ADR-0020 boundary SUGGESTION is one). Pinning only the reads moved the crash
# boundary-clause SUGGESTION is one). Pinning only the reads moved the crash
# from the read to the write — a UnicodeEncodeError raised while PRINTING, after
# every check has already run, which loses the whole report and (here) flips a
# clean exit 0 into a traceback and an exit 1. read_text() in the shared
# resolver block below pins the reads; this pins the writes.
#
# Deliberately OUTSIDE the ADR-0020 shared boundary resolver block: the two
# Deliberately OUTSIDE the shared boundary resolver block: the two
# validate.sh modes print findings, skill-size-check.sh has its own top-level
# equivalent, and the block is one sourced copy all three share, so each
# consumer's own startup stays in its own preamble.
@@ -141,7 +141,7 @@ SUBAGENT_UNAVAILABLE_TOOLS = {
# Copilot body length limit (chars) — content beyond this is silently truncated
COPILOT_BODY_LIMIT = 30000
# ADR-0020 description budget. An agent's name + description is preloaded into
# Context-budget description limit. An agent's name + description is preloaded into
# every session exactly like a skill's, so agents take the SAME description
# gates. These two constants are DUPLICATED in three places:
# scripts/skill-size-check.sh, lib-checks-skill.sh beside this file, and here.
@@ -157,7 +157,7 @@ COPILOT_BODY_LIMIT = 30000
# rather than silently diverging.
#
# Agents deliberately take NO body word gate, and adding one here would
# contradict ADR-0020: a skill body is loaded into the caller's context and
# be wrong: a skill body is loaded into the caller's context and
# competes with the live conversation, while an agent body becomes the system
# prompt of a fresh context. The rationale for the 900-word skill ceiling does
# not transfer. Agent body length falls out of the delegation rule instead.
@@ -170,7 +170,7 @@ suggestions = []
def fail(msg):
# stderr, matching scripts/skill-size-check.sh's ERROR routing. All three
# scripts in the ADR-0020 family now agree: findings that fail the run go to
# scripts that run the context-budget gates now agree: findings that fail the run go to
# stderr, everything advisory (SUGGESTION / INFO) goes to stdout. Both repo
# callers (check-apm-agents-valid.sh, check-scope-walkup-sync.sh) capture
# `2>&1`, so nothing a human reads moves.
@@ -208,7 +208,7 @@ def extract_field(fm, field):
`\\s*` after the colon crosses the newline, so `description:` with no value
followed by `model: sonnet` captured `model: sonnet` as the description.
That made the value look present, skipped the "missing or empty" failure,
and then every ADR-0020 gate early-returned on the genuinely empty folded
and then every context-budget gate early-returned on the genuinely empty folded
value — a valueless description exited 0 with zero output on a BLOCKING
pre-push gate. This function is now used only for fields with no folding
semantics (name, tools); description goes through description_value(), the
@@ -234,14 +234,14 @@ def agent_description(fm, local_fname):
# `exc` carries the whole clause — invalid YAML, a non-mapping block, or
# a description of the wrong type. Do not prefix a diagnosis here; the
# last one named a syntax error for two failures that have none.
fail(f"{exc} — the ADR-0020 description and boundary-target gates could "
fail(f"{exc} — the description and boundary-target gates could "
f"not run — {local_fname}")
return None
def check_description_budget(value, local_fname, by_hand=False):
"""ADR-0020 description gates — identical for every scope.
"""context-budget description gates — identical for every scope.
`by_hand` is ADR-0020's hand-invocation carve-out (issue #108): an agent
`by_hand` is the hand-invocation carve-out (issue #108): an agent
carrying `disable-model-invocation: true` is absent from the model-visible
listing, so the 250-character SUGGESTION — a routing-quality budget — has
no listing to apply to. The 400-character ceiling is unaffected.
@@ -251,18 +251,18 @@ def check_description_budget(value, local_fname, by_hand=False):
dlen = len(value)
if dlen > DESC_MAX_CHARS:
fail(f"description is {dlen} chars — exceeds the {DESC_MAX_CHARS}-character "
f"ADR-0020 ceiling. It is preloaded into every session whether or not the "
f"context-budget ceiling. It is preloaded into every session whether or not the "
f"agent is invoked. Keep a trigger clause, at most one capability clause, "
f"and a boundary clause; move capability enumeration, output-format detail, "
f"composition notes and implementation detail to the body — {local_fname}")
elif dlen > DESC_SUGGEST_CHARS and not by_hand:
suggest(f"description is {dlen} chars — over the {DESC_SUGGEST_CHARS}-character "
f"ADR-0020 target (hard fail at {DESC_MAX_CHARS}). The SUGGESTION tier is "
f"context-budget target (hard fail at {DESC_MAX_CHARS}). The SUGGESTION tier is "
f"what moves the corpus average; the FAIL tier only stops outliers "
f"— {local_fname}")
def check_boundary(value, fpath, local_fname, by_hand=False):
"""ADR-0020 boundary clause + resolvable boundary targets.
"""Boundary clause + resolvable boundary targets.
agent-author's SKILL.md states that an agent's boundary targets must
resolve, but until this ran no script checked it — the contract was
@@ -287,7 +287,7 @@ def check_boundary(value, fpath, local_fname, by_hand=False):
status = boundary_clause_status(value) if not by_hand else 'present'
if status == 'absent':
suggest(f"description has no boundary clause — add the prose form (\"Do not use "
f"for X — use `y` instead\") or ADR-0020's compressed form (\"Not X -> y\") "
f"for X — use `y` instead\") or the compressed form (\"Not X -> y\") "
f"so the router knows where NOT to send this agent — {local_fname}")
elif status == 'unparsed':
suggest(f"description has an arrow boundary clause (\"Not X -> y\") from which no "
@@ -527,7 +527,7 @@ def check_apm_agent_file(fpath, allowlist, stem):
# Presence is decided on the FOLDED value, never on a line regex. Deciding
# it on extract_field's raw capture is what let `description:` with no value
# pass this gate in total silence: the capture picked up the next key, so
# "missing or empty" never fired, and every ADR-0020 check below then
# "missing or empty" never fired, and every context-budget check below then
# early-returned on the empty folded value. Exit 0, zero output, no gate run.
folded = agent_description(fm, local_fname)
if folded is None:
@@ -624,7 +624,7 @@ def check_file(fpath, file_provider):
# Presence is decided on the FOLDED value, never on a line regex. Deciding
# it on extract_field's raw capture is what let `description:` with no value
# pass this gate in total silence: the capture picked up the next key, so
# "missing or empty" never fired, and every ADR-0020 check below then
# "missing or empty" never fired, and every context-budget check below then
# early-returned on the empty folded value. Exit 0, zero output, no gate run.
folded = agent_description(fm, local_fname)
if folded is None:
@@ -2,7 +2,7 @@
# lib-checks-skill.sh — SOURCED, never executed.
#
# skill-audit's structural check suite: everything in its validate.sh that is
# NOT the ADR-0020 shared boundary resolver, lifted verbatim and split at the
# NOT the shared boundary resolver, lifted verbatim and split at the
# resolver's markers. validate.sh reassembles
#
# $KYBERFORGE_SKILL_PREAMBLE_PY
@@ -17,7 +17,7 @@
# INFO tiers here are skill-audit's and are deliberately NOT reconciled with
# lib-checks-agent.sh's. The two suites disagree on purpose: a skill body is
# loaded into the caller's context, an agent body becomes the system prompt of
# a fresh one, so ADR-0020 gives skills a body word budget and agents none.
# a fresh one, so the context budget gives skills a body word budget and agents none.
#
# Consumed by: validate.sh, skill mode.
# shellcheck shell=bash
@@ -35,7 +35,7 @@ kyberforge_skill_preflight() {
# dependency sends the reader to install the wrong thing.
if ! command -v python3 > /dev/null 2>&1; then
echo "Error: python3 is required but was not found on PATH." >&2
echo " Why: skipping the ADR-0020 description, body and boundary-target gates would be a vacuous pass." >&2
echo " Why: skipping the description, body and boundary-target gates would be a vacuous pass." >&2
echo " Fix: install python3 (pre-commit itself is a Python application, so it is almost certainly already present)." >&2
# Exit 2, the never-ran tier: no check ran, so this is not a findings result.
# lib-provenance-*.sh has always exited 2 here; this matches it.
@@ -44,7 +44,7 @@ kyberforge_skill_preflight() {
if ! python3 -c 'import yaml' > /dev/null 2>&1; then
echo "Error: PyYAML is required but is not importable by python3." >&2
echo " Why: skipping the ADR-0020 description, body and boundary-target gates would be a vacuous pass." >&2
echo " Why: skipping the description, body and boundary-target gates would be a vacuous pass." >&2
echo " Fix: python3 -m pip install PyYAML (or your distro's python3-yaml package)." >&2
# Exit 2, the never-ran tier: a missing hard dependency is not a findings result.
exit 2
@@ -61,13 +61,13 @@ import yaml
# Output is UTF-8 for the same reason input is: under LC_ALL=C the streams
# default to ASCII, and this script's own message text carries em dashes (the
# ADR-0020 boundary SUGGESTION is one). Pinning only the reads moved the crash
# boundary-clause SUGGESTION is one). Pinning only the reads moved the crash
# from the read to the write — a UnicodeEncodeError raised while PRINTING, after
# every check has already run, which loses the whole report and (here) flips a
# clean exit 0 into a traceback and an exit 1. read_text() in the shared
# resolver block below pins the reads; this pins the writes.
#
# Deliberately OUTSIDE the ADR-0020 shared boundary resolver block: the two
# Deliberately OUTSIDE the shared boundary resolver block: the two
# validate.sh modes print findings, skill-size-check.sh has its own top-level
# equivalent, and the block is one sourced copy all three share, so each
# consumer's own startup stays in its own preamble.
@@ -92,7 +92,7 @@ def ok(msg):
def fail(msg):
# stderr, matching scripts/skill-size-check.sh's ERROR routing. All three
# scripts in the ADR-0020 family now agree: findings that fail the run go to
# scripts that run the context-budget gates now agree: findings that fail the run go to
# stderr, everything advisory (PASS / SUGGESTION / INFO) goes to stdout.
# Both repo callers capture `2>&1`, so nothing a human reads moves.
global failed
@@ -102,7 +102,7 @@ def fail(msg):
def suggest(msg):
# SUGGESTIONs are printed after every check and NEVER touch the exit code.
# factory-audit's SKILL.md Step 4 report counts them into its
# `PASS (N suggestions)` result line, which is what makes the ADR-0020 SUGGESTION tier visible
# `PASS (N suggestions)` result line, which is what makes the context-budget SUGGESTION tier visible
# rather than another silently-ignored warning (ADR-0013).
suggestions.append(msg)
@@ -167,7 +167,7 @@ except FrontmatterError as exc:
dir_name = os.path.basename(skill_dir)
# ADR-0020's hand-invocation carve-out (issue #108). `disable-model-invocation:
# the hand-invocation carve-out (issue #108). `disable-model-invocation:
# true` takes the skill out of the model-visible listing entirely, so the
# trigger/capability/boundary rules and the 250-character routing target do not
# apply to it — the audit's own references/skill-description-quality.md Step 0 says
@@ -211,8 +211,8 @@ if desc:
else:
fail("description field is missing or empty")
# description length — agentskills.io spec backstop. UNCHANGED by ADR-0020:
# 1024 is the specification's hard limit, and the ADR-0020 budget gate below
# description length — agentskills.io spec backstop. UNCHANGED by the context budget:
# 1024 is the specification's hard limit, and the context-budget gate below
# sits underneath it rather than replacing it.
if desc:
dlen = len(desc)
@@ -295,12 +295,12 @@ MAX_LINES = 500
# for the full measurement.
MAX_WORDS = 2770
# ADR-0020 context-budget gates. DUPLICATED from scripts/skill-size-check.sh
# Context-budget gates. DUPLICATED from scripts/skill-size-check.sh
# for exactly the same cache-isolation reason as MAX_LINES/MAX_WORDS above, and
# carrying the same warning — tests/test-skill-size-check.sh asserts the copies
# agree, so drift fails CI instead of shipping an audit that disagrees with the
# commit hook. lib-checks-agent.sh, beside this file, holds a third copy of the
# two description constants; per ADR-0020 agents take the description gates and
# two description constants; agents take the description gates and
# deliberately take NO body word gate, because an agent body becomes the system
# prompt of a fresh context rather than competing with a live conversation.
#
@@ -331,33 +331,33 @@ else:
body = content[body_start:]
# --- ADR-0020: description budget -----------------------------------------
# --- context budget: description budget ------------------------------------
if desc:
dlen = len(desc)
if dlen > DESC_MAX_CHARS:
fail(f"description is {dlen} chars — exceeds the {DESC_MAX_CHARS}-character "
f"ADR-0020 ceiling. It is preloaded into every session whether or not the "
f"context-budget ceiling. It is preloaded into every session whether or not the "
f"skill is invoked. Keep a trigger clause, at most one capability clause, "
f"and a boundary clause; move capability enumeration, output-format detail, "
f"composition notes and implementation detail to the body or a references/ file")
elif dlen > DESC_SUGGEST_CHARS and not by_hand:
suggest(f"description is {dlen} chars — over the {DESC_SUGGEST_CHARS}-character "
f"ADR-0020 target (hard fail at {DESC_MAX_CHARS}). The SUGGESTION tier is "
f"context-budget target (hard fail at {DESC_MAX_CHARS}). The SUGGESTION tier is "
f"what moves the corpus average; the FAIL tier only stops outliers")
elif by_hand:
ok(f"description length {dlen} chars (hand-invoked: the {DESC_SUGGEST_CHARS}-character "
f"routing target does not apply, the {DESC_MAX_CHARS}-character ceiling still does)")
else:
ok(f"description length {dlen} chars (ADR-0020 target: {DESC_SUGGEST_CHARS})")
ok(f"description length {dlen} chars (context-budget target: {DESC_SUGGEST_CHARS})")
# --- ADR-0020: body budget -------------------------------------------------
# --- context budget: body budget -------------------------------------------
# Counts the BODY ONLY — everything after the closing --- of the frontmatter.
# This is a different measurement from MAX_WORDS above, which counts the whole
# file including frontmatter as a spec-conformance backstop. Both are reported.
body_word_count = len(body.split())
if body_word_count > BODY_MAX_WORDS:
fail(f"SKILL.md body is {body_word_count} words — exceeds the {BODY_MAX_WORDS}-word "
f"ADR-0020 ceiling (body only; separate from the {MAX_WORDS}-word whole-file "
f"context-budget ceiling (body only; separate from the {MAX_WORDS}-word whole-file "
f"limit above). Move lookup tables, spec restatements, output schemas, templates "
f"and rationale prose to references/ behind an explicit "
f"\"If X, read `references/file.md`\" trigger. At two or more mutually exclusive "
@@ -365,9 +365,9 @@ if body_word_count > BODY_MAX_WORDS:
f"common to every branch, each flow gets its own self-contained references/ file")
elif body_word_count > BODY_SUGGEST_WORDS:
suggest(f"SKILL.md body is {body_word_count} words — over the {BODY_SUGGEST_WORDS}-word "
f"ADR-0020 target (hard fail at {BODY_MAX_WORDS})")
f"context-budget target (hard fail at {BODY_MAX_WORDS})")
else:
ok(f"SKILL.md body word count {body_word_count} (ADR-0020 target: {BODY_SUGGEST_WORDS})")
ok(f"SKILL.md body word count {body_word_count} (context-budget target: {BODY_SUGGEST_WORDS})")
# --- Reference pointers must exist -----------------------------------------
# FAIL, not SUGGESTION: a dispatch table naming a references/ file that is not
@@ -396,7 +396,7 @@ if gotchas is not None:
f"{round(100.0 * GOTCHA_MAX_BODY_FRACTION)}% guideline. Move the durable "
f"parts to references/ and keep the section for live traps")
# --- ADR-0020: boundary clause present -------------------------------------
# --- boundary clause present -----------------------------------------------
# SUGGESTION, not FAIL: detecting the absence is deterministic, but whether
# this particular skill warrants a boundary clause is judgment. Both accepted
# shapes count — the prose markers and the compressed `Not <thing> -> <name>`.
@@ -417,7 +417,7 @@ elif desc:
ok("description has a boundary clause")
elif status == 'absent':
suggest("description has no boundary clause — add the prose form (\"Do not use "
"for X — use `y` instead\") or ADR-0020's compressed form (\"Not X -> y\") "
"for X — use `y` instead\") or the compressed form (\"Not X -> y\") "
"so the router knows where NOT to send this skill")
else:
suggest("description has an arrow boundary clause (\"Not X -> y\") from which no "
@@ -436,7 +436,7 @@ elif desc:
f"nothing. Split it into one arrow per target: \"Not X -> {first}. "
f"Not Y -> {second}.\"")
# --- ADR-0020: resolvable boundary targets ---------------------------------
# --- resolvable boundary targets -------------------------------------------
# The resolution universe comes from the SKILL's own location: the authoring
# root above it (every sibling plugin in the monorepo), its own apm package, and
# the packages that package declares in apm.yml dependencies.apm. It is never
@@ -5,7 +5,7 @@ set -euo pipefail
# target is a skill directory or an agent definition file and runs the matching
# check suite; the two suites live in lib-checks-skill.sh and lib-checks-agent.sh
# and are unchanged from the skill-audit / agent-audit scripts they came from.
# The ADR-0020 boundary resolver both of them need is sourced once, from
# The shared boundary resolver both of them need is sourced once, from
# lib-boundary-resolver.sh, instead of being embedded twice.
#
# Detection never guesses. A target that matches neither shape is a hard exit 2
@@ -36,7 +36,7 @@ EOF
}
# Helper: a description of EXACTLY <n> characters that carries a boundary
# clause and names no routing target. ADR-0020's missing-boundary-clause
# clause and names no routing target. The missing-boundary-clause
# SUGGESTION fires on any description without one, so a fixture that omits it
# is never "otherwise clean" and a test refuting SUGGESTION would be asserting
# the boundary check's absence instead of the thing it names. The clause is
@@ -54,7 +54,7 @@ PY
}
# Helper: same shape as make_apm_agent, but the description is supplied
# verbatim — used by the ADR-0020 description-budget tests.
# verbatim — used by the description-budget tests.
make_apm_agent_with_desc() {
local root="$1" name="$2" desc="$3"
mkdir -p "$root/.apm/agents"
@@ -670,14 +670,14 @@ EOF
}
# ---------------------------------------------------------------------------
# ADR-0020 — description budget (250 SUGGESTION / 400 FAIL)
# Context budget — description (250 SUGGESTION / 400 FAIL)
#
# Agents take the SAME description gates as skills: name + description is
# preloaded into every session identically. Agents take NO body word gate — see
# the final test in this block, which pins that asymmetry.
# ---------------------------------------------------------------------------
@test "ADR-0020: agent description of exactly 250 chars raises no suggestion" {
@test "context budget: agent description of exactly 250 chars raises no suggestion" {
local root="$TMPDIR/pkg"
make_apm_agent_with_desc "$root" "my-agent" "$(desc_of_length 250)"
run bash "$SCRIPT" "$root/.apm/agents/my-agent.agent.md"
@@ -685,7 +685,7 @@ EOF
refute_output --partial "SUGGESTION"
}
@test "ADR-0020: agent description of 251 chars raises a SUGGESTION and still exits 0" {
@test "context budget: agent description of 251 chars raises a SUGGESTION and still exits 0" {
local root="$TMPDIR/pkg"
make_apm_agent_with_desc "$root" "my-agent" "$(desc_of_length 251)"
run bash "$SCRIPT" "$root/.apm/agents/my-agent.agent.md"
@@ -694,7 +694,7 @@ EOF
assert_output --partial "description is 251 chars"
}
@test "ADR-0020: agent description of exactly 400 chars is a SUGGESTION, not a FAIL" {
@test "context budget: agent description of exactly 400 chars is a SUGGESTION, not a FAIL" {
local root="$TMPDIR/pkg"
make_apm_agent_with_desc "$root" "my-agent" "$(desc_of_length 400)"
run bash "$SCRIPT" "$root/.apm/agents/my-agent.agent.md"
@@ -702,16 +702,16 @@ EOF
assert_output --partial "SUGGESTION"
}
@test "ADR-0020: agent description of 401 chars FAILs and exits non-zero" {
@test "context budget: agent description of 401 chars FAILs and exits non-zero" {
local root="$TMPDIR/pkg"
make_apm_agent_with_desc "$root" "my-agent" "$(desc_of_length 401)"
run bash "$SCRIPT" "$root/.apm/agents/my-agent.agent.md"
assert_failure
assert_output --partial "description is 401 chars"
assert_output --partial "400-character ADR-0020 ceiling"
assert_output --partial "400-character context-budget ceiling"
}
@test "ADR-0020: agent description length is measured after YAML folding is resolved" {
@test "context budget: agent description length is measured after YAML folding is resolved" {
local root="$TMPDIR/pkg"
mkdir -p "$root/.apm/agents"
cat > "$root/apm.yml" <<EOF
@@ -735,7 +735,7 @@ EOF
assert_output --partial "description is 450 chars"
}
@test "ADR-0020: the description gate applies at project scope too" {
@test "context budget: the description gate applies at project scope too" {
local root="$TMPDIR/project"
local desc
desc="$(python3 -c "print('x' * 401)")"
@@ -758,10 +758,10 @@ You are a test agent. When invoked, do the thing.
EOF
run bash "$SCRIPT" "$root/.claude/agents/my-agent.md"
assert_failure
assert_output --partial "400-character ADR-0020 ceiling"
assert_output --partial "400-character context-budget ceiling"
}
@test "ADR-0020: agents take NO body word gate — a body far over the 900-word skill ceiling passes" {
@test "context budget: agents take NO body word gate — a body far over the 900-word skill ceiling passes" {
local root="$TMPDIR/pkg"
mkdir -p "$root/.apm/agents"
cat > "$root/apm.yml" <<EOF
@@ -771,9 +771,9 @@ type: skill
EOF
# Deliberate asymmetry, not an oversight: a skill body is loaded into the
# caller's context and competes with the live conversation, while an agent
# body becomes the system prompt of a fresh context. ADR-0020 gates the
# body becomes the system prompt of a fresh context. The context budget gates the
# former at 900 words and explicitly declines to gate the latter. If a body
# word gate is ever added here, it contradicts the ADR.
# word gate is ever added here, it contradicts that rule.
#
# The description carries a boundary clause so the ONLY thing this test can
# go red on is a body finding. Without one, the missing-boundary-clause
@@ -1026,7 +1026,7 @@ EOF
#
# read_text() in the shared resolver block pins the READS to UTF-8. That moved
# the LC_ALL=C crash to the WRITE: this script's own message text carries em
# dashes (the ADR-0020 boundary SUGGESTION is one), so the streams' ASCII
# dashes (the boundary-clause SUGGESTION is one), so the streams' ASCII
# default raised UnicodeEncodeError while PRINTING — after every check had
# already run. Here it also flipped a clean exit 0 into a traceback and exit 1.
# ---------------------------------------------------------------------------
@@ -1061,8 +1061,8 @@ EOF
# exported Vale hook matches with `(^|/)agents/[^/]+\.md$`)
#
# A misclassification here is silent and total — the skill rubric would run
# against an agent file, so ADR-0022's metadata.version and ADR-0020's 900-word
# body ceiling would both be applied to an artifact that ADR-0020 explicitly
# against an agent file, so ADR-0022's metadata.version and the 900-word
# body ceiling would both be applied to an artifact that the context budget explicitly
# exempts from the latter (see the 1,500-word body test above, which AGENTS.md
# cites as the pin for that asymmetry).
# ---------------------------------------------------------------------------
@@ -10,7 +10,7 @@ setup() {
# Helper: create a minimal valid skill directory.
#
# The description carries a boundary clause deliberately. ADR-0020's
# The description carries a boundary clause deliberately. The
# missing-boundary-clause SUGGESTION fires on any description without one, so
# a fixture that omits it is never "otherwise clean" — every test asserting
# SUGGESTION-freedom would be asserting the boundary check's absence instead
@@ -55,7 +55,7 @@ PY
# Helper: create a skill directory with an exact description length and an
# exact body word count. <desc> is used verbatim; <body_words> "word"
# tokens follow the frontmatter. Used by the ADR-0020 boundary tests.
# tokens follow the frontmatter. Used by the boundary tests.
make_sized_skill() {
local dir="$1" desc="$2" body_words="$3"
local name
@@ -136,7 +136,7 @@ teardown() {
assert_success
}
@test "the 1024-char agentskills.io spec backstop is unchanged and separate from the ADR-0020 ceiling" {
@test "the 1024-char agentskills.io spec backstop is unchanged and separate from the context-budget ceiling" {
local skill="$TMPDIR/my-skill"
local name
name="$(basename "$skill")"
@@ -155,10 +155,10 @@ Do the thing.
EOF
run bash "$SCRIPT" "$skill"
# Two independent gates on one value: the spec limit still PASSES at
# exactly 1024 (its own boundary is unmoved), while ADR-0020's 400-char
# exactly 1024 (its own boundary is unmoved), while the 400-char
# ceiling FAILs. The run fails on the second, not the first.
assert_output --partial "description length 1024 chars (agentskills.io spec limit: 1024)"
assert_output --partial "400-character ADR-0020 ceiling"
assert_output --partial "400-character context-budget ceiling"
assert_failure
}
@@ -521,14 +521,14 @@ PY
}
# ---------------------------------------------------------------------------
# ADR-0020 — description budget (250 SUGGESTION / 400 FAIL)
# Context budget — description (250 SUGGESTION / 400 FAIL)
#
# These sit UNDER the agentskills.io 1024-character spec backstop above, which
# is unchanged. Both ceilings are inclusive: exactly at the number passes that
# tier, one past it trips.
# ---------------------------------------------------------------------------
@test "ADR-0020: description of exactly 250 chars raises no suggestion" {
@test "context budget: description of exactly 250 chars raises no suggestion" {
local skill="$TMPDIR/my-skill"
make_sized_skill "$skill" "$(desc_of_length 250)" 10
run bash "$SCRIPT" "$skill"
@@ -536,7 +536,7 @@ PY
refute_output --partial "SUGGESTION"
}
@test "ADR-0020: description of 251 chars raises a SUGGESTION and still exits 0" {
@test "context budget: description of 251 chars raises a SUGGESTION and still exits 0" {
local skill="$TMPDIR/my-skill"
make_sized_skill "$skill" "$(desc_of_length 251)" 10
run bash "$SCRIPT" "$skill"
@@ -546,7 +546,7 @@ PY
assert_output --partial "All checks passed (1 suggestion(s))."
}
@test "ADR-0020: description of exactly 400 chars is a SUGGESTION, not a FAIL" {
@test "context budget: description of exactly 400 chars is a SUGGESTION, not a FAIL" {
local skill="$TMPDIR/my-skill"
make_sized_skill "$skill" "$(desc_of_length 400)" 10
run bash "$SCRIPT" "$skill"
@@ -554,16 +554,16 @@ PY
assert_output --partial "SUGGESTION"
}
@test "ADR-0020: description of 401 chars FAILs and exits non-zero" {
@test "context budget: description of 401 chars FAILs and exits non-zero" {
local skill="$TMPDIR/my-skill"
make_sized_skill "$skill" "$(desc_of_length 401)" 10
run bash "$SCRIPT" "$skill"
assert_failure
assert_output --partial "description is 401 chars"
assert_output --partial "400-character ADR-0020 ceiling"
assert_output --partial "400-character context-budget ceiling"
}
@test "ADR-0020: description length is measured after YAML folding is resolved" {
@test "context budget: description length is measured after YAML folding is resolved" {
local skill="$TMPDIR/my-skill"
mkdir -p "$skill"
# A >-folded block scalar: 11 lines of 40 chars folded with 10 joining
@@ -582,17 +582,17 @@ PY
run bash "$SCRIPT" "$skill"
assert_failure
assert_output --partial "description is 450 chars"
assert_output --partial "400-character ADR-0020 ceiling"
assert_output --partial "400-character context-budget ceiling"
}
# ---------------------------------------------------------------------------
# ADR-0020 — body budget (600 SUGGESTION / 900 FAIL), body ONLY
# Context budget — body (600 SUGGESTION / 900 FAIL), body ONLY
#
# Distinct from the 2,770-word whole-file spec ceiling above, which counts
# frontmatter too and is unchanged. Do not unify them.
# ---------------------------------------------------------------------------
@test "ADR-0020: body of exactly 600 words raises no suggestion" {
@test "context budget: body of exactly 600 words raises no suggestion" {
local skill="$TMPDIR/my-skill"
make_sized_skill "$skill" "A short valid description. Do not use for anything else." 600
run bash "$SCRIPT" "$skill"
@@ -600,7 +600,7 @@ PY
refute_output --partial "SUGGESTION"
}
@test "ADR-0020: body of 601 words raises a SUGGESTION and still exits 0" {
@test "context budget: body of 601 words raises a SUGGESTION and still exits 0" {
local skill="$TMPDIR/my-skill"
make_sized_skill "$skill" "A short valid description. Do not use for anything else." 601
run bash "$SCRIPT" "$skill"
@@ -609,7 +609,7 @@ PY
assert_output --partial "All checks passed (1 suggestion(s))."
}
@test "ADR-0020: body of exactly 900 words is a SUGGESTION, not a FAIL" {
@test "context budget: body of exactly 900 words is a SUGGESTION, not a FAIL" {
local skill="$TMPDIR/my-skill"
make_sized_skill "$skill" "A short valid description. Do not use for anything else." 900
run bash "$SCRIPT" "$skill"
@@ -617,16 +617,16 @@ PY
assert_output --partial "body is 900 words"
}
@test "ADR-0020: body of 901 words FAILs and exits non-zero" {
@test "context budget: body of 901 words FAILs and exits non-zero" {
local skill="$TMPDIR/my-skill"
make_sized_skill "$skill" "A short valid description. Do not use for anything else." 901
run bash "$SCRIPT" "$skill"
assert_failure
assert_output --partial "body is 901 words"
assert_output --partial "900-word ADR-0020 ceiling"
assert_output --partial "900-word context-budget ceiling"
}
@test "ADR-0020: the body gate counts the body only — frontmatter words do not count toward it" {
@test "context budget: the body gate counts the body only — frontmatter words do not count toward it" {
local skill="$TMPDIR/my-skill"
# 895 body words plus a description long enough that the WHOLE FILE is well
# over 900 words. The body gate must stay silent; the 2,770-word whole-file
@@ -634,11 +634,11 @@ PY
make_sized_skill "$skill" "$(python3 -c "print(' '.join(['w'] * 100))")" 895
run bash "$SCRIPT" "$skill"
assert_success
refute_output --partial "900-word ADR-0020 ceiling"
refute_output --partial "900-word context-budget ceiling"
}
# ---------------------------------------------------------------------------
# ADR-0020 — resolvable boundary targets
# resolvable boundary targets
#
# Resolved against the AUTHORING SOURCE (plugins/*/.apm/skills/ and
# plugins/*/.apm/agents/), never .claude/skills/, so the check works offline and
@@ -646,7 +646,7 @@ PY
# than leaning on this repo's live skills.
# ---------------------------------------------------------------------------
@test "ADR-0020: a boundary target naming an existing sibling skill resolves" {
@test "boundary: a boundary target naming an existing sibling skill resolves" {
local skill
skill="$(make_fixture_tree "$TMPDIR/tree" "my-skill")"
make_sized_skill "$skill" "Use when doing the thing. Do not use for the other thing — use fixture-sibling-skill instead." 10
@@ -655,7 +655,7 @@ PY
assert_output --partial "boundary target(s) resolve"
}
@test "ADR-0020: a boundary target naming a non-existent skill FAILs when its sentence names one that resolves" {
@test "boundary: a boundary target naming a non-existent skill FAILs when its sentence names one that resolves" {
local skill
skill="$(make_fixture_tree "$TMPDIR/tree" "my-skill")"
# `fixture-sibling-skill` is the corroborator: a prose-form target only earns
@@ -667,7 +667,7 @@ PY
assert_output --partial "routes to 'fixture-missing-skill'"
}
@test "ADR-0020: a LONE boundary target naming a non-existent skill is a SUGGESTION, not a FAIL" {
@test "boundary: a LONE boundary target naming a non-existent skill is a SUGGESTION, not a FAIL" {
local skill
skill="$(make_fixture_tree "$TMPDIR/tree" "my-skill")"
# Same grammar as the case above and as "run \`pre-commit\` instead" — a
@@ -682,7 +682,7 @@ PY
refute_output --partial "FAIL description routes to"
}
@test "ADR-0020: a boundary target naming an AGENT file resolves (agents are valid routing targets)" {
@test "boundary: a boundary target naming an AGENT file resolves (agents are valid routing targets)" {
local skill
skill="$(make_fixture_tree "$TMPDIR/tree" "my-skill")"
make_sized_skill "$skill" "Use when doing the thing. Do not use when the caller is an agent — invoke fixture-sibling-agent instead." 10
@@ -691,7 +691,7 @@ PY
assert_output --partial "boundary target(s) resolve"
}
@test "ADR-0020: a /slash-command boundary target that does not resolve FAILs" {
@test "boundary: a /slash-command boundary target that does not resolve FAILs" {
local skill
skill="$(make_fixture_tree "$TMPDIR/tree" "my-skill")"
make_sized_skill "$skill" "Use when doing the thing. Do not use when improvements are wanted — use /fixture-missing-improve instead." 10
@@ -700,7 +700,7 @@ PY
assert_output --partial "routes to 'fixture-missing-improve'"
}
@test "ADR-0020: a backticked name that does not resolve FAILs when its sentence names one that resolves" {
@test "boundary: a backticked name that does not resolve FAILs when its sentence names one that resolves" {
local skill
skill="$(make_fixture_tree "$TMPDIR/tree" "my-skill")"
make_sized_skill "$skill" "Use when doing the thing. Composes \`fixture-sibling-skill\` and \`fixture-missing-helper\` for the shared part." 10
@@ -709,7 +709,7 @@ PY
assert_output --partial "routes to 'fixture-missing-helper'"
}
@test "ADR-0020: a /slash-command target is route NOTATION and FAILs on its own, uncorroborated" {
@test "boundary: a /slash-command target is route NOTATION and FAILs on its own, uncorroborated" {
local skill
skill="$(make_fixture_tree "$TMPDIR/tree" "my-skill")"
# The escape hatch from the SUGGESTION tier: `/name` and `-> name` are never
@@ -721,7 +721,7 @@ PY
assert_output --partial "routes to 'fixture-missing-notation'"
}
@test "ADR-0020: a bare hyphenated word outside a boundary sentence is not read as a routing target" {
@test "boundary: a bare hyphenated word outside a boundary sentence is not read as a routing target" {
local skill
skill="$(make_fixture_tree "$TMPDIR/tree" "my-skill")"
# "run pre-commit hooks" is pc-run's real phrasing. A naive extractor reads
@@ -732,10 +732,10 @@ PY
refute_output --partial "pre-commit"
}
@test "ADR-0020: an arrow chain outside a boundary clause is not read as a routing target" {
@test "boundary: an arrow chain outside a boundary clause is not read as a routing target" {
local skill
skill="$(make_fixture_tree "$TMPDIR/tree" "my-skill")"
# diagnose's real process chain. Only ADR-0020's `Not <thing> -> <skill>`
# diagnose's real process chain. Only the compressed `Not <thing> -> <skill>`
# form makes a bare arrow target a route.
make_sized_skill "$skill" "Reproduce → minimise → instrument → fix → regression-test. Use when a bug is reported." 10
run bash "$SCRIPT" "$skill"
@@ -743,7 +743,7 @@ PY
refute_output --partial "regression-test"
}
@test "ADR-0020: MCP tool names and capitalised tool names are not read as routing targets" {
@test "boundary: MCP tool names and capitalised tool names are not read as routing targets" {
local skill
skill="$(make_fixture_tree "$TMPDIR/tree" "my-skill")"
make_sized_skill "$skill" "Use when writing issues. Do not use for local files (use Read/Write/Edit) — that write goes through \`issue_write\`/\`pull_request_write\` instead." 10
@@ -752,7 +752,7 @@ PY
refute_output --partial "routes to"
}
@test "ADR-0020: ADR's compressed boundary form (Not <thing> -> <skill>) is checked" {
@test "boundary: the compressed boundary form (Not <thing> -> <skill>) is checked" {
local skill
skill="$(make_fixture_tree "$TMPDIR/tree" "my-skill")"
make_sized_skill "$skill" "Use when doing the thing. Not the other thing → fixture-missing-target." 10
@@ -761,7 +761,7 @@ PY
assert_output --partial "routes to 'fixture-missing-target'"
}
@test "ADR-0020: the boundary check declines rather than false-FAILs when no authoring source is found" {
@test "boundary: the boundary check declines rather than false-FAILs when no authoring source is found" {
# Deliberately NOT built with make_fixture_tree: this skill sits in a bare
# temp directory with no plugins/*/.apm/ above it and no .git, so the resolver
# legitimately has no universe. That is a real path (a skill being drafted
@@ -779,7 +779,7 @@ PY
}
# ---------------------------------------------------------------------------
# ADR-0020 — the hand-invocation carve-out (issue #108)
# the hand-invocation carve-out (issue #108)
#
# A skill carrying `disable-model-invocation: true` is absent from the
# model-visible listing entirely: not preloaded, and the Skill tool refuses to
@@ -815,7 +815,7 @@ make_hand_invoked_skill() {
} > "$dir/SKILL.md"
}
@test "ADR-0020: a hand-invoked skill is not asked for a boundary clause" {
@test "hand-invoked: a hand-invoked skill is not asked for a boundary clause" {
local skill="$TMPDIR/my-skill"
make_hand_invoked_skill "$skill" \
"Tell the agent to zoom out and give broader context or a higher level perspective." 10
@@ -825,7 +825,7 @@ make_hand_invoked_skill() {
assert_output --partial "hand-invoked"
}
@test "ADR-0020: the SAME description without the flag IS asked for a boundary clause" {
@test "hand-invoked: the SAME description without the flag IS asked for a boundary clause" {
# The control. Without it the case above is satisfied by an audit that
# stopped checking boundary clauses altogether.
local skill="$TMPDIR/my-skill"
@@ -836,7 +836,7 @@ make_hand_invoked_skill() {
assert_output --partial "has no boundary clause"
}
@test "ADR-0020: a hand-invoked skill is exempt from the 250-character description target" {
@test "hand-invoked: a hand-invoked skill is exempt from the 250-character description target" {
local skill="$TMPDIR/my-skill"
make_hand_invoked_skill "$skill" \
"$(python3 -c "print('Tell the agent to zoom out. ' + 'x' * 273)")" 10
@@ -845,7 +845,7 @@ make_hand_invoked_skill() {
refute_output --partial "over the 250-character"
}
@test "ADR-0020: a hand-invoked description over 400 chars still FAILS" {
@test "hand-invoked: a hand-invoked description over 400 chars still FAILS" {
# The half the carve-out does NOT lift. 400 is an outlier stop, not a
# routing-quality target: a hand-invoked description is still the one line
# the user reads when choosing from the `/` menu.
@@ -857,7 +857,7 @@ make_hand_invoked_skill() {
assert_output --partial "400-character"
}
@test "ADR-0020: a hand-invoked body over 900 words still FAILS" {
@test "hand-invoked: a hand-invoked body over 900 words still FAILS" {
# The body is loaded on invocation exactly like any other body and competes
# with the caller's live conversation the same way, so no body tier moves.
local skill="$TMPDIR/my-skill"
@@ -868,7 +868,7 @@ make_hand_invoked_skill() {
}
# ---------------------------------------------------------------------------
# ADR-0020 — one arrow, one target (issue #107)
# one arrow, one target (issue #107)
#
# Only the FIRST target after an arrow was resolved: the conjunction
# continuation is wired to the prose route verbs and never to arrows. So this
@@ -878,7 +878,7 @@ make_hand_invoked_skill() {
# extractor widened.
# ---------------------------------------------------------------------------
@test "ADR-0020: an arrow clause naming two targets is reported, not silently half-checked" {
@test "boundary: an arrow clause naming two targets is reported, not silently half-checked" {
local skill
skill="$(make_fixture_tree "$TMPDIR/tree" "my-skill")"
# A bare `Not ... ->` sentence carries no BOUNDARY_MARKER, so the backtick
@@ -890,7 +890,7 @@ make_hand_invoked_skill() {
assert_output --partial "names more than one target"
}
@test "ADR-0020: one arrow per target — the convention the suggestion asks for — is silent" {
@test "boundary: one arrow per target — the convention the suggestion asks for — is silent" {
local skill
skill="$(make_fixture_tree "$TMPDIR/tree" "my-skill")"
make_sized_skill "$skill" "Use when doing the thing. Not the other thing -> \`fixture-sibling-skill\`." 10
@@ -900,7 +900,7 @@ make_hand_invoked_skill() {
}
# ---------------------------------------------------------------------------
# ADR-0020 — a dotted filename in a boundary clause (issue #110)
# a dotted filename in a boundary clause (issue #110)
#
# `[^.;]` could not cross the `.` in `AGENTS.md`, so a clause naming a dotted
# file between "Not" and the arrow was invisible. With a backticked target that
@@ -909,7 +909,7 @@ make_hand_invoked_skill() {
# extracted, so the dangling check silently did not run on it.
# ---------------------------------------------------------------------------
@test "ADR-0020: a boundary clause naming a dotted filename is not reported as missing" {
@test "boundary: a boundary clause naming a dotted filename is not reported as missing" {
local skill
skill="$(make_fixture_tree "$TMPDIR/tree" "my-skill")"
make_sized_skill "$skill" "Use when doing the thing. Not AGENTS.md -> \`fixture-sibling-skill\`." 10
@@ -919,7 +919,7 @@ make_hand_invoked_skill() {
assert_output --partial "description has a boundary clause"
}
@test "ADR-0020: a BARE target after a dotted filename is extracted and checked" {
@test "boundary: a BARE target after a dotted filename is extracted and checked" {
local skill
skill="$(make_fixture_tree "$TMPDIR/tree" "my-skill")"
# The silent half of #110: this clause produced no target at all, so it was
@@ -931,7 +931,7 @@ make_hand_invoked_skill() {
assert_output --partial "routes to 'fixture-missing-dotted'"
}
@test "ADR-0020: an arrow clause yielding no target is reported as unparsed, not as missing" {
@test "boundary: an arrow clause yielding no target is reported as unparsed, not as missing" {
local skill
skill="$(make_fixture_tree "$TMPDIR/tree" "my-skill")"
# A single-word target is deliberately not matchable bare, because
@@ -946,7 +946,7 @@ make_hand_invoked_skill() {
}
# ---------------------------------------------------------------------------
# ADR-0020 — the unparsed diagnostic is PER CLAUSE, not per description
# the unparsed diagnostic is PER CLAUSE, not per description
#
# boundary_clause_status() used to test `BOUNDARY_ARROW.search(description) and
# not _arrow_targets(description)`. Both operands took the WHOLE description,
@@ -962,7 +962,7 @@ make_hand_invoked_skill() {
# class: no ERROR, no SUGGESTION, exit 0.
# ---------------------------------------------------------------------------
@test "ADR-0020: an unparsed arrow clause is reported even when a sibling clause parses" {
@test "boundary: an unparsed arrow clause is reported even when a sibling clause parses" {
local skill
skill="$(make_fixture_tree "$TMPDIR/tree" "my-skill")"
# Written by hand rather than through make_sized_skill: the `>` folded
@@ -992,7 +992,7 @@ EOF
#
# read_text() in the shared resolver block pins the READS to UTF-8. That moved
# the LC_ALL=C crash to the WRITE: this script's own message text carries em
# dashes (the ADR-0020 boundary SUGGESTION is one), so the streams' ASCII
# dashes (the boundary-clause SUGGESTION is one), so the streams' ASCII
# default raised UnicodeEncodeError while PRINTING — after every check had
# already run, losing the whole report at the last step.
# ---------------------------------------------------------------------------
@@ -6,7 +6,7 @@ description: >
skill -> `skill-author`. Not a named agent -> `agent-author`. Not a named
plugin -> `apm-workflow`.
metadata:
version: "1.0.5"
version: "1.0.6"
category: factory
source_keys:
- claude-code-subagents-docs
@@ -4,7 +4,7 @@ source_keys:
- context7-websites-code-claude
- claude-code-memory-docs
- apm-docs-author-prompts
- apm-cli-0-28-0-prompt-experiments
- apm-cli-0-39-3-experiments
- claude-code-slash-commands
---
@@ -37,7 +37,7 @@ place only where its single-file, multi-target shape is the point.
| The content is | Route |
|---|---|
| A single-file command that should also reach Copilot, Cursor, Gemini or OpenCode | Prompt file (`prompt-author`) |
| A single-file command that should also reach Copilot, Cursor, Gemini or OpenCode (Kiro gets the body only) | Prompt file (`prompt-author`) |
| A command that needs `references/` or `scripts/`, or that other skills or the model must be able to call | Skill (`skill-author`), declared hand-invoked |
| A Claude-only command with no such need | Skill (`skill-author`), because the vendor steers new commands there |
@@ -32,11 +32,11 @@
- **Contributing files:** references/author-routes.md
- **Status:** `extracted`
## apm-cli-0-28-0-prompt-experiments
## apm-cli-0-39-3-experiments
- **URL:** https://pypi.org/project/apm-cli/0.28.0/
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md (digest: plugins/kyberforge/docs/research/docs/microsoft-apm/prompt-target-mapping.md)
- **Description:** The installed apm-cli 0.28.0 exercised in throwaway packages. Grounds the same table: which targets receive a prompt file.
- **URL:** https://pypi.org/project/apm-cli/0.39.3/
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md (digest: plugins/kyberforge/docs/research/docs/microsoft-apm/prompt-gotchas.md)
- **Description:** The repo-pinned apm-cli 0.39.3 run in throwaway packages (holocron#273), re-running the 0.28.0 prompt experiments. Grounds the same table: Copilot, Cursor, Gemini and OpenCode each receive a prompt file as a command. Kiro now receives the body only, and Codex and Antigravity still receive nothing.
- **Contributing files:** references/author-routes.md
- **Status:** `extracted`
@@ -5,21 +5,23 @@ description: >
(`.apm/instructions/*.instructions.md`). Not read-only review ->
`factory-audit`. Not skills -> `skill-author`. Not agents -> `agent-author`.
Not AGENTS.md -> `agentsmd-author`.
compatibility: Requires the apm CLI; behaviour verified against apm 0.28.0.
compatibility: Requires the apm CLI, 0.39.2 or later; behaviour verified against apm 0.39.3.
allowed-tools: Bash Read Write Edit
metadata:
version: "0.1.0"
version: "0.1.1"
category: factory
source_keys:
- apm-docs-site
- apm-cli-0-28-0-experiments
- apm-cli-0-39-3-experiments
- apm-v0-39-3-source
- claude-code-memory-docs
---
## Gotchas
- Claude Code drops `description`; only Copilot, grok-build and Cursor keep it. Write a body that explains itself.
- Quote every `applyTo`. An unquoted `**/*.py` fails to parse, compile skips the file, and `apm install` still deploys it with no `paths:`, so it loads in every session. Install prints the parse warning once and exits 0.
- Quote every `applyTo`. An unquoted `**/*.py` is a YAML alias error: `apm install` exits 1 and deploys nothing, while `apm compile` drops the file and still exits 0.
- On Claude a rule leaves `.claude/rules/` only once a compile has actually written it into `AGENTS.md`, which `CLAUDE.md` imports. Install-then-compile dedups it, so it stays. Where a rule loads from is in `references/target-mapping.md`.
## Step 1 — Dispatch
@@ -40,7 +42,7 @@ Gates on every file, whichever flow wrote it:
- **One topic per file.** Two topics are two files.
- **Scope.** Omit `applyTo` only for a rule that must load in every session, and tell the user it then costs context at every launch.
- **Source.** Flat in `.apm/instructions/`, named `<stem>.instructions.md`. Anything nested or misnamed is ignored or never installed.
- **Stem.** It becomes the deployed filename, and install overwrites a hand-authored rule of the same name on most targets without a prompt. Check for a collision before choosing it.
- **Stem.** It becomes the deployed filename. Install skips a hand-authored file at that path and deploys nothing there, and `--force` overwrites it. Check for a collision before choosing it.
- **Body.** Concrete, checkable bullets, paths in backticks, nothing assuming another file is loaded, under 200 lines. If unsure the content is a rule rather than a procedure or something to enforce, read `references/content.md`.
If a field, glob or location is in question, read `references/schema.md`. If the question is which target keeps which field, or what compile does, read `references/target-mapping.md`.
@@ -2,8 +2,8 @@
# Delete these comments once filled in; Copilot receives this file verbatim.
description: "FILL IN: one line on what this rule covers. Only Copilot, grok-build and Cursor keep it."
applyTo: "FILL IN: quoted glob, e.g. **/*.py"
# applyTo is always quoted: an unquoted ** is a YAML alias error and the rule
# deploys unscoped. Several globs: "**/*.css,**/*.scss". Delete the line only
# applyTo is always quoted: an unquoted ** is a YAML alias error and apm
# install fails. Several globs: "**/*.css,**/*.scss". Delete the line only
# for a rule that must load in every session.
---
# FILL IN: one topic per file
@@ -1,7 +1,7 @@
---
source_keys:
- apm-docs-site
- apm-cli-0-28-0-experiments
- apm-cli-0-39-3-experiments
---
# Creating a new instructions file
@@ -18,7 +18,7 @@ Confirm, and ask the user for anything missing:
## Step 1 — Check the stem
Install overwrites a hand-authored file at `.claude/rules/<stem>.md`, `.cursor/rules/<stem>.mdc`, `.windsurf/rules/<stem>.md`, `.kiro/steering/<stem>.md` and `.agents/rules/<stem>.md` without a prompt. List those paths in the consuming project and choose another stem on any hit.
Install skips a hand-authored file at a deployed path, such as `.claude/rules/<stem>.md` or `.github/instructions/<stem>.instructions.md`, so the new rule never deploys there; `--force` would overwrite the hand-authored one. For each target in `targets:`, list its path from `references/target-mapping.md` in the consuming project and choose another stem on any hit.
## Step 2 — Scaffold
@@ -1,7 +1,7 @@
---
source_keys:
- apm-docs-site
- apm-cli-0-28-0-experiments
- apm-cli-0-39-3-experiments
---
# Improving an existing instructions file
@@ -16,13 +16,16 @@ Read the file whole. Signals are grill output, audit findings, inline feedback,
| Symptom | Cause | Fix |
|---|---|---|
| A scoped rule loads in every Claude session | `applyTo` is unquoted or malformed, so install deployed no `paths:` | Quote it, then confirm with `references/verify.md` |
| Compile warns "Failed to parse" | Broken frontmatter YAML | Repair the YAML; do not delete the field |
| The rule is in `CLAUDE.md` but not `.claude/rules/` | The file is nested under `.apm/instructions/` | Move it up to the flat directory |
| Install exits 1 with "Rejected frontmatter", or compile warns "Failed to parse" | Broken frontmatter YAML, most often an unquoted `applyTo` | Repair or quote it; do not delete the field |
| A rule meant to be scoped loads in every Claude session | `applyTo` is missing, or apm 0.28.0 installed it unquoted with no `paths:` | Add or quote it, then confirm with `references/verify.md` |
| The rule is in `AGENTS.md` but not `.claude/rules/`, and it is scoped to file types | The file is nested under `.apm/instructions/` | Move it up to the flat directory |
| An unscoped rule left `.claude/rules/` | apm moved it into `AGENTS.md`, which `CLAUDE.md` imports | Expected; confirm `CLAUDE.md` holds `@AGENTS.md` |
| Compile warns "applyTo ... matched no files" | The glob matches nothing in this project | Fix the glob, or confirm the files do not exist yet |
| The rule appears nowhere | The name lacks `.instructions.md` | Rename it |
| Claude ignores guidance written in `description` | Claude Code drops `description` | Move the substance into the body |
| A hand-written rule vanished after install | The stem collided with a deployed name | Restore it from version control and rename the source stem |
| The same rule reaches the agent twice | Cursor, Windsurf, Kiro and Grok get both a native file and an `AGENTS.md` copy | State it to the user; it is apm behaviour, not a defect in the file |
| The rule did not deploy and install printed "files skipped -- local files exist" | The stem collides with a hand-written file at the deployed path | Rename the source stem. `--force` would overwrite the hand-written file |
| A hand-written rule vanished after install | `--force`, or apm 0.28.0, overwrote it | Restore it from version control and rename the source stem |
| The same rule reaches the agent twice | When compile also writes `AGENTS.md` for a target with no dedup, Cursor, Windsurf, Kiro and Grok get both a native file and an `AGENTS.md` copy | State it to the user; it is apm behaviour, not a defect in the file |
Cases not in the table: read `references/target-mapping.md`.
@@ -2,20 +2,20 @@
source_keys:
- apm-docs-site
- apm-github-repo
- apm-cli-0-28-0-experiments
- apm-cli-0-39-3-experiments
- claude-code-memory-docs
---
# The instructions source file
Verified against apm 0.28.0. Reached from `SKILL.md` Step 2 when a frontmatter field, a glob or the file's location is in question.
Verified against apm 0.39.3. Reached from `SKILL.md` Step 2 when a frontmatter field, a glob or the file's location is in question.
## Location and name
`.apm/instructions/<name>.instructions.md`, flat. The double extension is the discovery key and the stem is the primitive's name; there is no `name` field.
- A plain `.md` in that directory is ignored by both `apm compile` and `apm install`.
- A file in a subdirectory is folded into compiled root files by compile but never deployed by install, so it reaches `CLAUDE.md` and `AGENTS.md` and no native rules directory.
- A file in a subdirectory is folded into compiled root files by compile but never deployed by install, so it reaches `AGENTS.md` and no native rules directory.
- The stem becomes the deployed filename: `<stem>.md`, `<stem>.mdc`, or `<stem>.instructions.md`, by target.
## Frontmatter
@@ -32,7 +32,7 @@ Only `description` and `applyTo` carry meaning. `author` and `version` are parse
- A YAML sequence is joined into the same comma form.
- Brace alternation is never split: `"**/*.{css,scss},**/*.py"` is two patterns.
- A literal comma in a pattern is `\,`; a literal backslash is `\\`.
- Always quote the value. An unquoted `**/*.py` is a YAML alias error; see `SKILL.md` Gotchas for what apm then does.
- Always quote the value. An unquoted `**/*.py` is a YAML alias error, and install then fails; see `SKILL.md` Gotchas.
## Body
@@ -43,8 +43,8 @@ Plain markdown. Official guidance: bullets over prose, one topic per file (`pyth
`Instruction.validate()` yields three findings, all demoted to warnings: missing `description`, missing `applyTo` ("will apply globally") and empty content. A broken relative link in the body is a fourth, also non-fatal.
- A real `apm compile` prints them. `apm compile --validate` prints none of them and exits 0 even for a file with all three problems; it exits 1 only when the package has no instructions at all.
- `apm install` prints none.
- `apm install` prints none, and deploys such a file.
- `apm audit --ci` checks lockfile, deployed-file presence, content hash and hidden Unicode, not instruction content.
- A file whose frontmatter does not parse is skipped by compile ("Failed to parse") but still deployed by install.
- A file whose frontmatter does not parse is skipped by compile ("Failed to parse", exit 0) and fails install: `apm install` exits 1 with "Rejected frontmatter in <file>" and commits nothing.
No standalone instructions validator exists, so enforcement is this skill's checks and `references/verify.md`.
@@ -2,6 +2,8 @@
source_keys:
- apm-docs-site
- apm-github-repo
- apm-cli-0-39-3-experiments
- apm-v0-39-3-source
- apm-cli-0-28-0-experiments
- claude-code-memory-docs
- github-copilot-custom-instructions-docs
@@ -26,12 +28,28 @@ source_keys:
- **Contributing files:** references/schema.md
- **Status:** `extracted`
## apm-cli-0-39-3-experiments
- **URL:** https://pypi.org/project/apm-cli/0.39.3/
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md (digest: plugins/kyberforge/docs/research/docs/microsoft-apm/instructions-gotchas.md)
- **Description:** The repo-pinned apm-cli 0.39.3 run in throwaway packages (holocron#273): unquoted and broken frontmatter failing install, the Claude compile writing a `CLAUDE.md` that imports `AGENTS.md`, per-instruction dedup, an unscoped rule's retirement from `.claude/rules/`, hand-authored collisions skipped, stale cleanup, per-target transforms, validation severity and discovery asymmetry. The bats suite in `tests/` re-runs four of these on every push.
- **Contributing files:** SKILL.md, references/schema.md, references/target-mapping.md, references/verify.md, references/create.md, references/improve.md
- **Status:** `extracted`
## apm-v0-39-3-source
- **URL:** https://github.com/microsoft/apm/tree/v0.39.3/src/apm_cli
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md (digest: plugins/kyberforge/docs/research/docs/microsoft-apm/instructions-target-mapping.md)
- **Description:** apm source at tag v0.39.3: which Claude instruction scopes route to `AGENTS.md`, and the blockers that keep every instruction in `.claude/rules/` (a hand-authored `CLAUDE.md` without the import, a hand-authored `AGENTS.md` without managed-section markers, a symlinked `AGENTS.md`).
- **Contributing files:** SKILL.md, references/target-mapping.md
- **Status:** `extracted`
## apm-cli-0-28-0-experiments
- **URL:** https://pypi.org/project/apm-cli/0.28.0/
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md (digest: plugins/kyberforge/docs/research/docs/microsoft-apm/instructions-gotchas.md)
- **Description:** The installed apm-cli 0.28.0 package plus throwaway install, compile and audit experiments confirming validation severity, unquoted-glob handling, discovery asymmetry, dedup and overwrite behaviour.
- **Contributing files:** SKILL.md, references/schema.md, references/target-mapping.md, references/verify.md, references/create.md, references/improve.md
- **Description:** The installed apm-cli 0.28.0 package plus throwaway install, compile and audit experiments. Superseded by `apm-cli-0-39-3-experiments` wherever the two were both run; still the only source for the user-scope deploy rule and the 0.28.0 behaviours the skill names as history.
- **Contributing files:** references/target-mapping.md
- **Status:** `extracted`
## claude-code-memory-docs
@@ -1,5 +1,7 @@
---
source_keys:
- apm-cli-0-39-3-experiments
- apm-v0-39-3-source
- apm-cli-0-28-0-experiments
- apm-docs-site
- claude-code-memory-docs
@@ -9,11 +11,11 @@ source_keys:
# What each target receives
Verified against apm 0.28.0 and throwaway installs. Reached from `SKILL.md` Step 2 when the question is which target keeps which field. Source-file syntax is in `references/schema.md`.
Verified against apm 0.39.3 in throwaway installs, except where a line says otherwise. Reached from `SKILL.md` Step 2 when the question is which target keeps which field. Source-file syntax is in `references/schema.md`.
## Two output paths
`apm install` writes one native file per instruction into each target's rules directory. `apm compile` writes root context files that concatenate instruction bodies, grouped by `applyTo`. Treat install as the primary path for Claude Code and Copilot, and compile as the path for targets with no native instructions directory.
`apm install` writes one native file per instruction into each target's rules directory. `apm compile` writes root context files that concatenate instruction bodies, grouped by `applyTo`. Treat install as the primary path for Copilot and the other rule-directory targets, and compile as the path for targets with no native instructions directory. Claude uses both; see below.
## Install: deployed path and transform
@@ -21,14 +23,23 @@ Verified against apm 0.28.0 and throwaway installs. Reached from `SKILL.md` Step
|---|---|---|
| copilot | `.github/instructions/<n>.instructions.md` | Verbatim copy |
| claude | `.claude/rules/<n>.md` | `applyTo` becomes a `paths:` list; `description` dropped; no frontmatter at all without `applyTo` |
| cursor | `.cursor/rules/<n>.mdc` | `applyTo` becomes `globs`; `description` kept; no `alwaysApply` written |
| cursor | `.cursor/rules/<n>.mdc` | `applyTo` becomes `globs`, one comma-separated string even for several patterns; `description` kept; no `alwaysApply` written |
| windsurf | `.windsurf/rules/<n>.md` | `trigger: glob` plus `globs`, or `trigger: always_on`; `description` dropped |
| kiro | `.kiro/steering/<n>.md` | `inclusion: fileMatch` plus `fileMatchPattern`, or `inclusion: always`; `description` dropped |
| antigravity | `.agents/rules/<n>.md` | `trigger: glob` plus `globs`, or no frontmatter; `description` dropped |
| antigravity | `.agents/rules/<n>.md` | `trigger: glob` plus `globs`, or `trigger: always_on`; `description` dropped |
| grok-build | `.grok/rules/<n>.instructions.md` | Verbatim copy |
| codex, gemini, opencode and the rest | none | Reach instructions only through compile |
Cursor, Windsurf and Antigravity do not deploy at user scope; Kiro and the rest do.
At user scope Cursor, Windsurf and Antigravity do not deploy, and Kiro and the rest do. That is from the 0.28.0 source and was not re-run.
## Claude: `.claude/rules/` or `AGENTS.md`
apm 0.38 and later split Claude's instructions between the two.
- Install deploys each instruction to `.claude/rules/`, unless a compiled `AGENTS.md` already carries it.
- Compile writes the bodies into `AGENTS.md` and a `CLAUDE.md` that holds only `@AGENTS.md`, leaving out any instruction already in `.claude/rules/`.
- A rule moves out of `.claude/rules/` only when compile actually wrote it into `AGENTS.md`: compile ran before install, `--force-instructions` was passed, or the compile also served a target with no dedup. The next install then deletes the `.claude/rules/` copy ("Retired ... AGENTS.md now carries it"). Install-then-compile dedups every deployed rule, so they all stay in `.claude/rules/`, and compile-then-install never deploys the unscoped rule there. The source also routes a rule scoped to `**`, `**/*` or exactly one literal `dir/**` this way. File-type globs such as `**/*.py`, wildcard directories and lists stay in `.claude/rules/`.
- From the source, not run: these keep every instruction in `.claude/rules/`, with a warning: a hand-authored root `CLAUDE.md` without an `@AGENTS.md` import; a hand-authored root `AGENTS.md` without `compilation.agents_md.mode: managed_section` and one pair of `<!-- apm:start -->`/`<!-- apm:end -->` markers; a symlinked `AGENTS.md`. Compile never overwrites a hand-authored root file. User scope never routes to `AGENTS.md`.
## Field survival
@@ -42,22 +53,23 @@ For Claude Code the body's first line or heading is the only descriptive text th
## Ownership and overwrite
- Claude, Cursor, Windsurf, Kiro and Antigravity treat each deployed file as apm-owned: install replaces a hand-authored file at the same path without a prompt. Copilot and grok-build skip an unmanaged file ("local files exist, not managed by APM") until `apm install --force`.
- Removing or renaming a source makes the next install delete the file it deployed for Claude, Copilot, Cursor, Windsurf and Kiro. Antigravity and grok-build leave the old file behind in 0.28.0, so delete it by hand.
- Every rule target skips a hand-authored file at a deployed path: install prints "files skipped -- local files exist, not managed by APM", deploys nothing there and exits 0. `apm install --force` overwrites the hand-authored file. apm 0.28.0 overwrote it silently on Claude, Cursor, Windsurf, Kiro and Antigravity.
- Removing or renaming a source makes the next install delete the file it deployed, on every rule target.
## Compile
- `--target claude` writes `CLAUDE.md`; Gemini writes `GEMINI.md` and `AGENTS.md`; every other target writes `AGENTS.md`.
- Compile skips instructions already deployed natively, for Claude, Copilot and Antigravity only, and the skip is all-or-nothing: if any instruction has a same-stem file in `.claude/rules/`, compile omits every instruction from `CLAUDE.md`, including a new one never deployed. With rules populated, `--target claude` exits 0, prints "produced no output files" and writes nothing. `--force-instructions` (alias `--no-dedup`) overrides.
- Cursor, Windsurf, Kiro and Grok have no dedup: compile writes `AGENTS.md` that repeats rules the tool already loads natively. Codex, Gemini and OpenCode get no native file, so the compiled root file is their only copy.
- A package with no instruction primitives (skills only) makes plain `apm compile` exit 1 with "No instruction files found"; `apm compile --clean` exits 0.
- `--target claude` writes `AGENTS.md` plus a `CLAUDE.md` that imports it. Gemini writes `GEMINI.md`, which also imports `AGENTS.md`. Every other target writes `AGENTS.md`.
- For a Claude-only compile, an instruction already deployed to `.claude/rules/` is left out of `AGENTS.md`, one instruction at a time. A nested or newly added one is still compiled. When every instruction is deployed, compile exits 0 and writes no `CLAUDE.md`. `--force-instructions` (alias `--no-dedup`) includes them all.
- A compile that also serves a target with no dedup, such as codex, writes every instruction into `AGENTS.md`. Cursor, Windsurf, Kiro and Grok then get each rule twice: natively and through `AGENTS.md`.
- Compile warns "applyTo for '<n>' matched no files" when a pattern matches nothing in the project, and places that instruction at the root.
- A package with skills but no instruction primitives makes plain `apm compile` exit 1 with "No instruction files found"; `apm compile --clean` exits 0.
## Native format facts
- Claude Code reads `.claude/rules/**/*.md` recursively. `paths` is the only field it reads, as a list or a comma-separated string; other fields are ignored. A rule without `paths` loads at every launch. Frontmatter that fails to parse is ignored and the rule loads without `paths`.
- Claude Code reads `.claude/rules/**/*.md` recursively. `paths` is the only field it reads, as a list or a comma-separated string; other fields are ignored. A rule without `paths` loads at every launch. Frontmatter that fails to parse is ignored and the rule loads without `paths`. Claude Code reads `AGENTS.md` only while no `CLAUDE.md` exists or `CLAUDE.md` imports it.
- Copilot path-specific files need `applyTo` as a quoted comma-joined string; `excludeAgent` is the only other documented key. Repository-wide instructions are the separate `.github/copilot-instructions.md`.
- Cursor ignores a plain `.md` in `.cursor/rules`. A rule with only a `description` is "Apply Intelligently", not always-on.
## Unverified
Cursor's handling of a YAML-list `globs`, Copilot's handling of unknown frontmatter keys, and runtime behaviour on Windsurf, Kiro and Antigravity. Say so rather than asserting any of them.
Copilot's handling of unknown frontmatter keys, and runtime behaviour on Windsurf, Kiro and Antigravity. Say so rather than asserting any of them.
@@ -1,11 +1,11 @@
---
source_keys:
- apm-cli-0-28-0-experiments
- apm-cli-0-39-3-experiments
---
# Verifying a file in a throwaway package
Reached from `SKILL.md` Step 3. Run step 2 outside the repo: `apm install` writes `apm_modules/`, `apm.lock.yaml` and a rules directory, and install overwrites hand-authored rule files without warning.
Reached from `SKILL.md` Step 3. Run step 2 outside the repo: `apm install` writes `apm_modules/`, `apm.lock.yaml` and a rules directory. In a repo that pins apm with uv, spell each `apm` below as `uv run --project <repo root> --frozen apm`, so the check runs the repo's apm and not the one on `PATH`.
1. From the package root, a real compile. `--validate` hides the missing-`description`, missing-`applyTo` and empty-body warnings and exits 0 whenever the package has an instruction, so it verifies nothing:
@@ -25,8 +25,8 @@ Reached from `SKILL.md` Step 3. Run step 2 outside the repo: `apm install` write
(cd "$d" && apm install && cat .claude/rules/<name>.md)
```
3. The deployed file must open with `paths:` listing the intended globs. No frontmatter block at all means `applyTo` was missing or did not parse: the rule would load in every session.
3. Install must exit 0. Exit 1 with "Rejected frontmatter" means the YAML did not parse, usually an unquoted `applyTo`. The deployed file must open with `paths:` listing the intended globs. No frontmatter block at all means `applyTo` was missing: the rule loads in every session.
4. Once rules sit in `.claude/rules/`, `apm compile --target claude` writes no `CLAUDE.md` and still exits 0, so an exit-code check proves nothing. To inspect the compiled root file, pass `--force-instructions`.
4. Once every rule sits in `.claude/rules/`, `apm compile --target claude` writes no `CLAUDE.md` and still exits 0, so an exit-code check proves nothing. To inspect the compiled `AGENTS.md`, pass `--force-instructions`. The `CLAUDE.md` it writes holds only `@AGENTS.md`.
Delete the directory afterwards. Report only what was observed; Cursor's list-form `globs` and the Windsurf, Kiro and Antigravity runtimes stay unverified.
Delete the directory afterwards. Report only what was observed; the Windsurf, Kiro and Antigravity runtimes stay unverified.
@@ -1,12 +1,12 @@
# tests/
- **`new-instructions.bats`** — covers `scripts/new-instructions.sh` (name validation, package walk-up, no-package refusal, no-op on an existing file, template placeholders) and the apm behaviour the skill's gotchas rest on, run against throwaway packages: a filled scaffold compiles into `CLAUDE.md` and installs into `.claude/rules/` with `description` dropped, compile writes nothing once rules are installed, an unquoted `applyTo` installs unscoped, and `--validate` hides the warnings a real compile prints.
- **`new-instructions.bats`** — covers `scripts/new-instructions.sh` (name validation, package walk-up, no-package refusal, no-op on an existing file, template placeholders) and the apm behaviour the skill's gotchas rest on, run against throwaway packages: a filled scaffold compiles into `AGENTS.md` behind a `CLAUDE.md` that imports it, and installs into `.claude/rules/` with `description` dropped; compile writes nothing once rules are installed; an unquoted `applyTo` fails install and deploys nothing; and `--validate` hides the warnings a real compile prints.
## Dependencies
The test file loads `bats-support` and `bats-assert` from the repo root's `tests/test_helper/`, and runs on the repo's bats submodule at `tests/bats/`. The first `bash tests/run-bats.sh` initialises the submodules.
The apm tests need the `apm` CLI on `PATH` and skip when it is absent. They assert apm 0.28.0 behaviour, so a failure after an apm upgrade is a finding about the skill's gotchas, not a flaky test.
In this repo the apm tests run the repo-pinned apm (`uv run --frozen apm`, through `scripts/lib/apm.sh`) and fail when it is unavailable; run `uv sync --frozen` first. Outside this repo they use the `apm` on `PATH` and skip when it is absent. They assert apm 0.39.3 behaviour, so a failure after an apm upgrade is a finding about the skill's gotchas, not a flaky test.
From the repo root:
@@ -28,7 +28,21 @@ fill() {
"$1"
}
# In this repo apm is the one pinned in pyproject.toml/uv.lock, run through
# scripts/lib/apm.sh as `uv run --project <repo root> --frozen apm` (ADR-0034),
# so these tests exercise 0.39.3 and never whatever apm is on PATH. The pin is
# a declared dependency here, so a missing uv or an apm below the helper's
# minimum FAILS rather than skips: a skip would let `run-tests.sh --strict` go
# green without running these tests. Outside this repo (no helper) the PATH
# apm is used, and its absence still skips.
need_apm() {
if [[ -f "$REPO_ROOT/scripts/lib/apm.sh" ]]; then
# shellcheck source=/dev/null
source "$REPO_ROOT/scripts/lib/apm.sh"
require_apm_version || fail "the repo-pinned apm is unavailable; run 'uv sync --frozen' at $REPO_ROOT"
apm() { run_apm "$@"; }
return 0
fi
command -v apm >/dev/null 2>&1 || skip "apm CLI not installed"
}
@@ -173,10 +187,14 @@ need_apm() {
}
# ---------------------------------------------------------------------------
# apm behaviour the skill's gotchas rest on (verified against apm 0.28.0)
# apm behaviour the skill's gotchas rest on. Verified against apm 0.28.0, then
# re-pinned to the repo's 0.39.3 (#271), where three behaviours changed: compile
# --target claude writes a CLAUDE.md that imports AGENTS.md, an unquoted applyTo
# fails install closed, and compile warns when applyTo matches no file. The
# skill's text was brought level with 0.39.3 under #273.
# ---------------------------------------------------------------------------
@test "filled scaffold compiles for the Claude target into CLAUDE.md without the description" {
@test "filled scaffold compiles for the Claude target: CLAUDE.md imports AGENTS.md, which drops the description" {
need_apm
make_package
bash "$SCRIPT" my-rule "$ROOT"
@@ -185,9 +203,11 @@ need_apm() {
run apm compile --target claude
assert_success
assert [ -f "$ROOT/CLAUDE.md" ]
run grep -F 'Use type hints.' "$ROOT/CLAUDE.md"
run grep -Fx '@AGENTS.md' "$ROOT/CLAUDE.md"
assert_success
run grep -F 'Python style rules' "$ROOT/CLAUDE.md"
run grep -F 'Use type hints.' "$ROOT/AGENTS.md"
assert_success
run grep -F 'Python style rules' "$ROOT/AGENTS.md"
assert_failure
}
@@ -221,17 +241,16 @@ need_apm() {
assert [ ! -f "$ROOT/CLAUDE.md" ]
}
@test "an unquoted applyTo still installs, as a rule with no paths:" {
@test "an unquoted applyTo fails install closed and deploys no rule" {
need_apm
make_package
mkdir -p "$ROOT/.apm/instructions"
printf -- '---\ndescription: x\napplyTo: **/*.py\n---\n# T\n\n- a\n' > "$ROOT/.apm/instructions/bad.instructions.md"
cd "$ROOT"
run apm install
assert_success
assert [ -f "$ROOT/.claude/rules/bad.md" ]
run grep -F 'paths:' "$ROOT/.claude/rules/bad.md"
assert_failure
assert_output --partial "Rejected frontmatter in bad.instructions.md"
assert [ ! -f "$ROOT/.claude/rules/bad.md" ]
}
@test "compile --validate exits 0 and hides the warnings a real compile prints" {
@@ -259,5 +278,8 @@ need_apm() {
assert_success
assert_output --partial "dry-run"
refute_output --partial "Failed to parse"
refute_output --partial "Warning"
# 0.39 warns when applyTo matches no file, which an empty package always
# does; any other warning is a parse or validation finding.
run grep -F "Warning" <<< "$(grep -vF "matched no files" <<< "$output")"
assert_failure
}
@@ -5,23 +5,24 @@ description: >
(`.apm/prompts/*.prompt.md`). Not read-only review -> `factory-audit`.
Not skills -> `skill-author`. Not agents -> `agent-author`. Not
instructions -> `instructions-author`.
compatibility: Requires the apm CLI; behaviour verified against apm 0.28.0.
compatibility: Requires the apm CLI, 0.39.2 or later; behaviour verified against apm 0.39.3.
allowed-tools: Bash Read Write Edit
metadata:
version: "0.1.0"
version: "0.1.1"
category: factory
source_keys:
- apm-docs-author-prompts
- apm-docs-llms-full
- apm-docs-producer-ramp
- apm-github-repo
- apm-cli-0-28-0-prompt-experiments
- apm-cli-0-39-3-experiments
- apm-v0-39-3-source
---
## Gotchas
- `apm compile` never reads prompt files, and `--validate` ignores them even when malformed. A prompt file is verified only by a throwaway `apm install`.
- Unsupported frontmatter keys are dropped, loudly on the Claude family and silently on Gemini, which keeps only `description`. Codex, Kiro and Antigravity deploy nothing and print nothing.
- Unsupported frontmatter keys are dropped quietly: the Claude family names them only under `apm install --verbose`, and Gemini keeps only `description` and says nothing. Kiro strips every key, with a warning naming them. Codex and Antigravity deploy nothing and print nothing.
- `input:` descriptions are discarded: only the names survive, as `arguments:`. Duplicate names are not caught.
## Step 1 — Dispatch
@@ -42,7 +43,7 @@ Gates on every file, whichever flow wrote it:
- **Source.** A single file named `<stem>.prompt.md` in `.apm/prompts/`, flat. Anything nested, uppercase or named plain `.md` is silently ignored.
- **Stem.** Kebab-case. It becomes the deployed command name, and apm skips a hand-written file of the same name unless `--force` is passed. Check for a collision before choosing it.
- **Frontmatter.** `description`, plus `input`, `allowed-tools`, `model` or `argument-hint` only when needed. No other keys: they are dropped, and `source_keys` would warn on every install.
- **Frontmatter.** `description`, plus `input`, `allowed-tools`, `model` or `argument-hint` only when needed. A Claude Code command key such as `disable-model-invocation` survives on the `claude` target only, from apm 0.39.0, and is dropped on every other target; add one only when the command needs it on Claude. Never `hooks`: apm withholds it. No other keys, `source_keys` included: they are dropped.
- **Arguments.** Declare `input:` names and use `${input:name}` in the body, or use a literal `$ARGUMENTS`, never both.
- **Body.** Written as an instruction to the model, self-contained, and clear about what it produces. If unsure the content is a prompt file rather than a skill, a rule or something to enforce, read `references/content.md`.
@@ -11,6 +11,8 @@ input:
# allowed-tools: Bash(git status:*) Read
# model: FILL IN
# argument-hint: "<target>" # synthesised from input: when omitted
# Claude only (apm 0.39+), dropped on every other target:
# disable-model-invocation: true
---
FILL IN: an instruction to the model, written so it works with nothing else loaded.
@@ -1,7 +1,7 @@
---
source_keys:
- apm-docs-author-prompts
- apm-cli-0-28-0-prompt-experiments
- apm-cli-0-39-3-experiments
---
# Creating a new prompt file
@@ -1,7 +1,7 @@
---
source_keys:
- apm-docs-author-prompts
- apm-cli-0-28-0-prompt-experiments
- apm-cli-0-39-3-experiments
---
# Improving an existing prompt file
@@ -18,15 +18,20 @@ Read the file whole. Apply the signals that triggered this flow (`SKILL.md` Step
|---|---|---|
| The command does not exist after install | The file is nested, uppercase (`.PROMPT.md`) or a bare `.md`, so discovery ignored it | Move it flat into `.apm/prompts/` and name it `<stem>.prompt.md` |
| The command is missing and install warned "malformed or over-budget YAML frontmatter" | Broken frontmatter, so Claude and Gemini skipped the file | Repair the YAML |
| Install warned "frontmatter keys not supported … dropped" | The file carries keys the Claude family does not keep | Remove them, or accept that only Copilot keeps them |
| `apm install --verbose` reported "frontmatter keys not supported … dropped" | The file carries keys that target does not keep | Remove them, or accept that only Copilot keeps them |
| `disable-model-invocation` or another Claude Code command key is missing from `.claude/commands/` | The apm that installed it is older than 0.39, which dropped those keys | Install with apm 0.39.2 or later |
| A Claude Code command key is missing from the Cursor or OpenCode command | Only the `claude` target keeps those keys | State it to the user; it is apm behaviour |
| Install warned "frontmatter hooks withheld" | The file sets `hooks`, which apm does not deploy on commands | Remove it, or move the hook into a hook package |
| An argument is missing from `arguments:` | The name failed `[A-Za-z][A-Za-z0-9_-]{0,63}` and install warned `input: rejected` | Rename it |
| An argument appears twice | Duplicate names are not caught | Remove the duplicate |
| `arguments:` lists `name` and `description` | An `input:` item had `name:` and `description:` keys, and each key became an argument | Use plain names, or one `{name: description}` pair per item |
| The body shows `$ARGUMENTS` or `$0` next to named arguments | `input:` and a literal placeholder were both written | Use one style |
| The Gemini command ignores `model` or `allowed-tools` | Gemini keeps only `description` and the body, silently | State it to the user; it is apm behaviour |
| Nothing deployed for Codex, Kiro or Antigravity | Those targets have no prompt surface | State it to the user |
| Nothing deployed for Codex or Antigravity | Those targets have no prompt surface | State it to the user |
| The Kiro prompt has no frontmatter | Kiro's prompt surface keeps the body only | State it to the user |
| Install exited 1 with "Kept … modified since APM deployed it" | A deployed command was edited by hand | Move it aside, or export the edit with `apm export-patch`, then reinstall |
| A hand-written command was not replaced | apm skips unmanaged files | Rename the stem, or use `apm install --force` knowingly |
| Install failed with exit 1 and a security error | Tag characters or a bidi override in the file; the Claude-family command is withheld even with `--force`, while the Copilot copy and Gemini TOML may still be written | Remove the hidden characters |
| Install failed with exit 1 and a security error | Tag characters or a bidi override in the file. Nothing is written; with `--force` the Copilot copy and Gemini TOML are, but the Claude-family command is still withheld | Remove the hidden characters |
Cases not in the table: read `references/target-mapping.md`.
@@ -2,12 +2,14 @@
source_keys:
- apm-docs-author-prompts
- apm-github-repo
- apm-v0-39-3-source
- apm-cli-0-39-3-experiments
- apm-cli-0-28-0-prompt-experiments
---
# The prompt source file
Verified against apm 0.28.0. Reached from `SKILL.md` Step 2 when a field, a placeholder or the file's location is in question.
Verified against apm 0.39.3, except the root-file and odd-name rules under "Location and name", last run on 0.28.0. Reached from `SKILL.md` Step 2 when a field, a placeholder or the file's location is in question.
## Location and name
@@ -31,9 +33,16 @@ No closed schema; apm passes or drops keys per target.
| `model` | Model override |
| `argument-hint` (alias `argumentHint`) | Hint text; synthesised as `<a> <b>` from `input` when omitted |
### Claude Code command keys
From apm 0.39.0 the `claude` target keeps Claude Code's own command keys: `when_to_use`, `disable-model-invocation`, `user-invocable`, `disallowed-tools`, `effort`, `context`, `agent`, `background` and `shell`. Every other target that gets a command file (cursor, opencode, windsurf, grok-build) drops them, and Gemini and Kiro drop them with the rest. apm 0.28.0 dropped them on Claude too, so a command relying on one needs apm 0.39.2 or later wherever it is installed.
- An authored `arguments:` is kept on Claude only when the file has no `input:` key at all.
- `hooks` is withheld: the command deploys without it, and install warns `frontmatter hooks withheld`.
Input names must match `[A-Za-z][A-Za-z0-9_-]{0,63}`. An invalid name is dropped with a warning and the install still succeeds; duplicates are neither removed nor warned about.
The Copilot App workflow keys `interval`, `schedule_hour` and `schedule_day` mark a prompt file as a scheduled workflow that the command integrator skips. Do not use them in a plain prompt file. The VS Code keys `agent`, `tools` and `name` survive on Copilot only.
The Copilot App workflow keys `interval`, `schedule_hour` and `schedule_day` mark a prompt file as a scheduled workflow that the command integrator skips. Do not use them in a plain prompt file. The VS Code keys `tools` and `name` survive on Copilot only. `agent` also survives on Claude, as a Claude Code command key with its own meaning there.
## Body placeholders
@@ -4,6 +4,8 @@ source_keys:
- apm-docs-llms-full
- apm-docs-producer-ramp
- apm-github-repo
- apm-v0-39-3-source
- apm-cli-0-39-3-experiments
- apm-cli-0-28-0-prompt-experiments
---
@@ -41,10 +43,26 @@ source_keys:
- **Contributing files:** SKILL.md, references/schema.md
- **Status:** `extracted`
## apm-v0-39-3-source
- **URL:** https://github.com/microsoft/apm/tree/v0.39.3/src/apm_cli
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md (digest: plugins/kyberforge/docs/research/docs/microsoft-apm/prompt-primitive-schema.md)
- **Description:** apm source at tag v0.39.3: the Claude-native command keys kept only on the `claude` target (`_CLAUDE_NATIVE_COMMAND_KEYS`), the `arguments` rule, and `hooks` being withheld.
- **Contributing files:** SKILL.md, references/schema.md, references/target-mapping.md
- **Status:** `extracted`
## apm-cli-0-39-3-experiments
- **URL:** https://pypi.org/project/apm-cli/0.39.3/
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md (digest: plugins/kyberforge/docs/research/docs/microsoft-apm/prompt-gotchas.md)
- **Description:** The repo-pinned apm-cli 0.39.3 run in throwaway packages (holocron#273): Claude-native keys on claude versus cursor and opencode, the `--verbose` dropped-keys line, `hooks` withheld, per-target output including Kiro, malformed YAML, input names, collisions, hand-edited deployed files, hidden-character scanning, and compile ignoring prompts.
- **Contributing files:** SKILL.md, references/create.md, references/improve.md, references/schema.md, references/target-mapping.md, references/verify.md
- **Status:** `extracted`
## apm-cli-0-28-0-prompt-experiments
- **URL:** https://pypi.org/project/apm-cli/0.28.0/
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md (digest: plugins/kyberforge/docs/research/docs/microsoft-apm/prompt-gotchas.md)
- **Description:** The installed apm-cli 0.28.0 exercised in throwaway packages: discovery, manifest type, compile on prompts-only packages, per-target output and warnings, input-name and YAML edge cases, collisions, cleanup, hidden-Unicode scanning and packing.
- **Contributing files:** SKILL.md, references/create.md, references/improve.md, references/schema.md, references/target-mapping.md, references/verify.md
- **Description:** The installed apm-cli 0.28.0 exercised in throwaway packages. Superseded by `apm-cli-0-39-3-experiments` wherever both were run; still the only source for root-level discovery, odd filenames, user-scope paths, packing, and BOM, NBSP and bidi scanning.
- **Contributing files:** references/schema.md, references/target-mapping.md
- **Status:** `extracted`
@@ -2,12 +2,14 @@
source_keys:
- apm-docs-author-prompts
- apm-docs-llms-full
- apm-cli-0-39-3-experiments
- apm-v0-39-3-source
- apm-cli-0-28-0-prompt-experiments
---
# What each target receives
Verified against apm 0.28.0 in throwaway installs; runtime behaviour in the receiving tools was not tested. Reached from `SKILL.md` Step 2. Source syntax is in `references/schema.md`.
Verified against apm 0.39.3 in throwaway installs, except the user-scope paths and packing, last run on 0.28.0. Runtime behaviour in the receiving tools was not tested. Reached from `SKILL.md` Step 2. Source syntax is in `references/schema.md`.
## Install is the only path
@@ -20,7 +22,8 @@ Verified against apm 0.28.0 in throwaway installs; runtime behaviour in the rece
| cursor, opencode, grok-build | `.cursor/commands/`, `.opencode/commands/`, `.grok/commands/` `<n>.md` | Same transform as claude |
| windsurf | `.windsurf/workflows/<n>.md` | Same transform |
| gemini | `.gemini/commands/<n>.toml` | `description` and `prompt` only, silently |
| codex, kiro, antigravity, agent-skills | none | Exit 0, no warning |
| kiro | `.kiro/prompts/<n>.md` | Body only; every frontmatter key stripped, with a warning naming them |
| codex, antigravity, agent-skills | none | Exit 0, no warning |
At user scope (`apm install -g`) claude, gemini and cursor deploy to their home commands directories and Copilot to `~/.copilot/prompts/`. The experimental targets (hermes, openclaw, copilot-cowork, grok-cloud, copilot-app) need a flag and are untested.
@@ -33,9 +36,11 @@ At user scope (`apm install -g`) claude, gemini and cursor deploy to their home
| `allowed-tools` | kept (ignored by Copilot) | kept | dropped silently |
| `model` | kept | kept | dropped silently |
| `argument-hint` | kept | kept or synthesised | dropped silently |
| any other key | kept | dropped, with a warning naming the keys | dropped silently |
| Claude Code command keys (`disable-model-invocation` and the rest, `references/schema.md`) | kept | kept on `claude` only; dropped on cursor, opencode, windsurf and grok-build | dropped silently |
| `hooks` | kept | withheld on `claude`, with a warning; dropped elsewhere | dropped silently |
| any other key | kept | dropped; named only under `apm install --verbose` | dropped silently |
The Claude command file holds only `allowed-tools`, `argument-hint`, `arguments`, `description` and `model`, sorted, with no trailing newline.
The Claude command file holds the shared keys (`allowed-tools`, `argument-hint`, `arguments`, `description`, `model`) plus any Claude Code command keys, sorted. Cursor's and the other Claude-family files hold the shared keys only.
## Body placeholders by target
@@ -49,13 +54,14 @@ Claude Code natively supports `$ARGUMENTS`, zero-based `$N` and named `$name` fr
## Ownership and cleanup
- A hand-written file at a deployed path is skipped ("not managed by APM", exit 0); `--force` overwrites. Editing a deployed file and reinstalling silently overwrites it.
- Removing a prompt file from the package and reinstalling deletes the deployed files. A hand-edited one is kept with a "delete manually" message.
- Zero-width characters, BOM and NBSP warn and the file deploys to every target. Tag characters and bidi overrides are critical: install exits 1 and the Claude-family command is withheld, but the Copilot byte copy and Gemini TOML may still be written. `--force` makes the exit code 0 and changes nothing else.
- A hand-written file at a deployed path is skipped ("not managed by APM", exit 0); `--force` overwrites.
- A deployed file edited by hand blocks the next install that would change it: install exits 1 with "Kept ... it was modified since APM deployed it" and commits nothing. Move the file aside, or export the edit with `apm export-patch`.
- Removing a prompt file from the package and reinstalling deletes the deployed files. A hand-edited one is kept, with a warning.
- A zero-width space warns and the file deploys to every target. A tag character is critical: install exits 1 and writes nothing on any target. `--force` exits 0 and writes the Copilot copy and Gemini TOML, but still withholds the Claude-family command. BOM, NBSP and bidi overrides were last tested on 0.28.0, as warning, warning and critical.
## Packing
`apm pack --format plugin` copies `.apm/prompts/x.prompt.md` to `commands/x.md` unchanged and skips root-level prompts. Installing that bundle copies files verbatim, so `input:` survives untransformed and Copilot receives `.github/commands/`.
Last run on 0.28.0. `apm pack --format plugin` copies `.apm/prompts/x.prompt.md` to `commands/x.md` unchanged and skips root-level prompts. Installing that bundle copies files verbatim, so `input:` survives untransformed and Copilot receives `.github/commands/`.
## Unverified
@@ -1,11 +1,11 @@
---
source_keys:
- apm-cli-0-28-0-prompt-experiments
- apm-cli-0-39-3-experiments
---
# Verifying a file in a throwaway package
Reached from `SKILL.md` Step 3. `apm compile` and `apm compile --validate` never read prompts, so they verify nothing. Install is the only check. Run it outside the repo: `apm install` writes `apm_modules/`, `apm.lock.yaml` and a commands directory.
Reached from `SKILL.md` Step 3. `apm compile` and `apm compile --validate` never read prompts, so they verify nothing. Install is the only check. Run it outside the repo: `apm install` writes `apm_modules/`, `apm.lock.yaml` and a commands directory. In a repo that pins apm with uv, spell each `apm` below as `uv run --project <repo root> --frozen apm`, so the check runs the repo's apm and not the one on `PATH`.
1. Deploy the prompt where nothing else can be overwritten:
@@ -14,12 +14,12 @@ Reached from `SKILL.md` Step 3. `apm compile` and `apm compile --validate` never
printf 'name: scratch\nversion: 0.1.0\ntype: prompts\ntargets:\n - claude\n' > "$d/apm.yml"
mkdir -p "$d/.apm/prompts" "$d/.claude"
cp <package-root>/.apm/prompts/<name>.prompt.md "$d/.apm/prompts/"
(cd "$d" && apm install && cat .claude/commands/<name>.md)
(cd "$d" && apm install --verbose && cat .claude/commands/<name>.md)
```
2. Read every warning install prints. A line starting "frontmatter keys not supported … dropped" lists keys that did not survive; "input: rejected" names an invalid argument; "Skipped command … malformed" means the file did not parse and no command exists.
2. Read every warning and info line install prints. `--verbose` is what makes apm name dropped keys: a line "frontmatter keys not supported … dropped" lists keys that did not survive, and "frontmatter hooks withheld" means `hooks` was removed; "input: rejected" names an invalid argument; "Skipped command … malformed" means the file did not parse and no command exists.
3. The deployed file must contain `description` and, if `input:` was written, an `arguments:` list matching it. Body placeholders should read `$name`, not `${input:name}`. A missing file means the install skipped it.
3. The deployed file must contain `description`, every Claude Code command key the source set, such as `disable-model-invocation`, and, if `input:` was written, an `arguments:` list matching it. A missing command key means the apm that ran is older than 0.39. Body placeholders should read `$name`, not `${input:name}`. A missing file means the install skipped it.
4. For another target, add it to `targets:` and `cat` its deployed path from `references/target-mapping.md`. Gemini prints no warning for what it drops, so read its `.toml`.
@@ -6,7 +6,7 @@ description: >
Not read-only review -> `factory-audit`. Not agent files -> `agent-author`.
allowed-tools: Bash Read Write Edit
metadata:
version: "1.0.7"
version: "1.0.8"
category: factory
source_keys:
- agentskills-home
@@ -55,6 +55,6 @@ Gates `/factory-audit` enforces in both flows:
## Step 4 — Validate and close
Run `/factory-audit` on the resolved skill directory; resolve every FAIL before reporting done. It checks name-to-directory match, placeholders, both size budgets, boundary-target resolution and script hygiene — do not hand-check those. Hand-check the one thing it misses: an empty body reports `PASS SKILL.md body word count 0 (ADR-0020 target: 600)`, so confirm at least one non-empty section exists.
Run `/factory-audit` on the resolved skill directory; resolve every FAIL before reporting done. It checks name-to-directory match, placeholders, both size budgets, boundary-target resolution and script hygiene — do not hand-check those. Hand-check the one thing it misses: an empty body reports `PASS SKILL.md body word count 0 (context-budget target: 600)`, so confirm at least one non-empty section exists.
Bump `metadata.version`: the **minor** version on create (new skills start at `0.1.0`) and the **patch** version on improve.
+1 -1
View File
@@ -1,5 +1,5 @@
name: kyberforge
version: 2.3.0
version: 2.3.2
description: Skills and agents for creating, maintaining, and managing an apm plugin marketplace for Claude Code and GitHub Copilot.
author:
name: Mortis
+17 -10
View File
@@ -70,15 +70,21 @@ tracked in a `.claude/apm-hooks.json` sidecar, so an uninstall removes them with
hand-authored hooks. Both `.claude/hooks/` and the sidecar are gitignored install output.
Note that apm's **executable-trust gate is off** unless the consuming project's `apm.yml` has an
`executables:` block — without one, package hooks deploy with no prompt. The grant is
**version-blind**: apm also matches an allow key such as `kyberforge#<version>` by its bare package
name, so a version bump on one side does not stop the hook deploying (verified against apm 0.28.0;
the correction is recorded in ADR-0019 and `docs/spec/gates.md`). This repo still keeps each key at
`<name>#<version>` as a record of which version was reviewed, and `check-executables-allow-sync` is
the pre-push gate that holds every plugin shipping `.apm/hooks/` or `bin/` to that.
`executables:` block — without one, package hooks deploy with no prompt. An allow key must be the
package's **full identity**, `<host>/<owner>/<repo>/<path>`, as `apm approve --list` prints it, for
example `git.rkdr.net/Mortis/Holocron/plugins/kyberforge`. apm 0.39 no longer matches the bare
`kyberforge#<version>` form that 0.28.0 accepted: under 0.39.3 that key parks the hook ("parked
pending approval"), deploys nothing and exits 0 (spike #269, re-run under #273). The grant is still
**version-blind**: apm strips a `#<version>` suffix before matching, so a key at one version admits
any other, and a version bump on one side does not stop the hook deploying. This repo keeps each key
at `<identity>#<version>` as a record of which version was reviewed, and
`check-executables-allow-sync` is the pre-push gate that holds every plugin shipping `.apm/hooks/` or
`bin/` to that.
apm 0.28.0 prints "parked pending approval" for a granted package even when it deploys the hook
(holocron#208). Check for the deployed script and settings entry, not the warning.
A matching type-level grant (`hooks: true`) deploys the hook, and every install then warns that the
approval is "not pinned to content". apm 0.28.0 printed "parked pending approval" even for a granted
package (holocron#208); 0.39.3 prints it only when the hook really was not deployed. Either way, check
for the deployed script and settings entry, not the exit code.
## The SessionStart hook
@@ -149,14 +155,15 @@ hook.
An earlier version of this section said Copilot loads no hooks from an apm package, because nothing
pointed Copilot at a hooks file and apm wrote only a Claude-shaped definition. That no longer holds:
apm 0.28.0 shapes and deploys hooks per target itself, with no `plugin.json` pointer involved.
apm shapes and deploys hooks per target itself, with no `plugin.json` pointer involved. The table
below was observed on 0.28.0 and re-run on 0.39.3 (holocron#273).
Sources: `docs/research/infra-packages/enforcement-hooks.md` on the `research/enforcement-hooks`
branch, and the [delivery guard hook](https://git.rkdr.net/Mortis/Holocron/issues/190) work.
| Target | Where apm writes the hook | Status |
|---|---|---|
| `copilot` | One file per hook, `.github/hooks/<pkg>-<name>.json`, with the script under `.github/hooks/scripts/<pkg>/.apm/hooks/`. Event names are renamed to camelCase and `version: 1` is added. | **Unverified.** Entries keep Claude's nested matcher group with `command`/`timeout`. Copilot's docs accept `command`/`timeout` as aliases for `bash`/`powershell`, but don't document the nested group, so whether Copilot CLI runs the hook is untested until a Copilot account exists. |
| `codex` | Merged into `.codex/hooks.json`, with the script under `.codex/hooks/<pkg>/.apm/hooks/`. Claude's event names and shape are kept. | apm skips the target unless `.codex/` already exists, and Codex runs project hooks only after a human trusts them. |
| `codex` | Merged into `.codex/hooks.json`, with the script under `.codex/hooks/<pkg>/.apm/hooks/` and ownership in `.codex/apm-hooks.json`. Claude's event names and shape are kept. | With `codex` in `targets:`, apm 0.39.3 creates `.codex/` and deploys; whether it skips an auto-detected codex target with no `.codex/` was not re-run. Codex runs project hooks only after a human trusts them. |
Only enabled targets get a hook: this repo's root `apm.yml` targets `claude` alone, so nothing lands
in `.github/hooks/` or `.codex/` here. VS Code's Copilot reads both `.github/hooks/` and
Loaded 100 of 134 files, more files were not shown because too many files have changed in this diff. Show more