Why The two audit skills carried 1,724 lines of byte-identical duplication: the ADR-0020 boundary resolver (1,061), vale-wrap.sh (526), the Vale style rules (44) and the Contributing-files parser (93). Nothing shared them — they were held in sync by a 413-line pre-push gate and its 797-line test suite. Sync-by-gate had already failed once: at484357athe two parser copies drifted into different spellings of the bullet loop while a docstring asserted they were identical. That drift was behaviour-neutral and was re-unified by hand at598a7c3, so the copies were identical at merge time — but nothing had caught it, and the next drift need not be neutral. Implementation Notes Self-containment binds BETWEEN skills, not within one. The agentskills.io spec forbids reaching across skill directories, which is why two separate skills needed embedded copies; two files inside ONE skill may source a third. That is the whole reason the merge removes duplication rather than relocating it. The union of both bodies measured 1,532 words against BODY_MAX_WORDS=900, and only 211 of those words were shared, so SKILL.md is a dispatch body. Step 0 resolves the flow from the target path before any validation, and its table mirrors validate.sh's detection exactly: a directory holding SKILL.md or a SKILL.md file (skill); a *.agent.md, or a .md directly under an agents/ directory (agent); anything else stops without running a validator. Steps 1-3 live in references/skill-flow.md and references/agent-flow.md, and gotchas that apply to one flow live in that flow's file, since it is loaded on every invocation anyway. If validate.sh reports on the other artifact type, the body restarts at Step 0. Named factory-audit rather than forge-audit because forge is a live skill, and a family prefix that matches a live sibling reads as ownership rather than membership. The description carries one arrow per boundary target, because ADR-0020 resolves only the first target after an arrow. It drops the quoted "audit this skill"-style phrases, which restated "audited" in a second register (ADR-0020's duplicate-register rule). 241 characters, Gotchas 16% of the body: no size SUGGESTIONs. The boundary resolver stays embedded in two files rather than imported: a cache-installed plugin cannot read outside its own directory, and the repo-root hook resolves via .pre-commit-hooks.yaml where entry[0] is the only token pre-commit rewrites, so no single file is reachable by both. tests/test-adr0020-contract.sh hashes both copies for byte-identity, and asserts validate.sh sources the resolver and that no third copy exists. The entry scripts classify the target from its resolved parent directory, so a bare agent filename typed inside agents/ works; resolve SCRIPT_DIR CDPATH-safely; and exit 2 when a lib-*.sh is missing, rather than dying with exit 1, the tier the flows relay as real findings. The provenance run functions stash their findings code in KYBERFORGE_PROV_RC and return 0, so validate-provenance.sh calls them UNTESTED. Testing a function's status (`f || RC=$?`) disables errexit for its entire body, and no subshell or `set -e` inside can re-arm it once the call sits in a condition context (measured, both spellings). Their error paths use `exit`, which is unaffected either way; this keeps errexit armed for anything added later. Case 0's readability guard reads the file instead of asking `[[ -r ]]`. `-r` is access(2), which answers yes for uid 0 even on a mode-000 file, and this repo's dev environment is root -- so the guard could never fire where it exists to fire. A read attempt is also the stricter question, catching EIO. This is the reasoning scripts/check-vale-style-sync.sh carried before this commit deleted it; the hazard did not go with it. All three entry scripts are CDPATH-safe, vale-wrap.sh included: both of its cd sites are cleared, the --config resolution and the directory-mirror walk, where an exported CDPATH would otherwise print a decoy path into the -print0 stream and build the mirror from the decoy's files. The two remaining bare cd calls take absolute paths, which CDPATH is never consulted for. Impact BREAKING: skill-audit and agent-audit no longer exist as invocable skills. kyberforge goes to 2.0.0 (catalog 0.4.7). Check logic is unchanged: differential runs of the old and new validators across every skill and agent produced byte-identical stdout, stderr and exit codes, and the reconstructed Python payloads differ only in comments and the references/field-inventory.md -> agent-field-inventory.md rename. One doctrine governs the tiers: exit 0 is audited and clean, exit 1 is audited with findings OR a target present but unreadable, exit 2 is that nothing was audited at all. Edge paths DID change, deliberately (full table in ADR-0025): - a missing target exits 2 (never ran), not 1, under its own "does not exist" message; detection is by path shape, so a shape-matching path that is simply absent used to reach the validator and come back as a FAIL against a file that never existed; - an unshaped target exits 2 under the generic "matches neither" message, and a directory with no SKILL.md under a third, distinct one -- three exit-2 messages, not one; - a dangling symlink or a symlink loop stays exit 1: it is present but broken, which is a finding about the artifact rather than a usage error; - a SKILL.md file path is audited as its skill directory instead of refused; - a .md agent outside an agents/ directory is refused rather than audited; - a missing script library, a missing python3, a missing PyYAML, and no argument at all each exit 2. validate-provenance.sh already exited 2 for the last two; validate.sh now matches it. .pre-commit-hooks.yaml is a published contract consumed by external repos. Both hook IDs and both files: regexes are unchanged; only entry: and description: moved. scripts/check-vale-style-sync.sh (413), scripts/sync-vale-styles.sh (21), tests/test-check-vale-style-sync.sh (797) and agent-audit/scripts/README.md (47) are deleted. The checker made 17 assertions: 6 compared the two Vale copies and are moot; 10 are rehomed into tests/test-vale-wrap.sh (case 0, cases 28-31, and the suite's Vale-absent skip); and the cross-manifest files: agreement check, which selected hooks by entry: and so could not survive both hooks sharing one, is ported as case 33 pairing hooks by id:. Cases 28, 30 and 33 carry mutation self-tests; narrowing the local skill prefilter to 6 of 38 SKILL.md files now fails the suite. Skills go 39 to 38. Pre-push goes 9 repo-authored hooks to 8. ADR: 0025 BREAKING-CHANGE: the skill-audit and agent-audit skills are removed. Both flows are served by factory-audit, which auto-detects whether it was handed a skill directory or an agent file. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YR2CjVumUbEGWcMikcoXBD
175 lines
12 KiB
Markdown
175 lines
12 KiB
Markdown
# This repo installs its own plugins through apm, not Claude Code's native plugin install
|
|
|
|
ADR-0015 moved plugin **authoring** to apm; ADR-0017 added the flat content mirror that keeps the
|
|
authored `.apm/` tree discoverable by hosts that install natively. Both are about producing the
|
|
marketplace. This ADR is about consuming it: how the plugins get onto the machine this repo is
|
|
worked on.
|
|
|
|
**Correction (2026-09-14): the flat content mirror named above no longer exists.** ADR-0017 is
|
|
superseded by ADR-0024, and commit `718c79a` deleted the mirror
|
|
(`plugins/<name>/{skills,agents,hooks}/`) along with its generator, its test suite and its pre-push
|
|
gate; native `claude plugin install` is no longer a supported path, so there are no longer "hosts
|
|
that install natively" for it to serve. Nothing this ADR decides depends on the mirror — it appears
|
|
here only as the other half of "producing the marketplace", and once more under "Install output is
|
|
gitignored" below, where the two copies of plugin content ADR-0017 governed are now one, `.apm/`
|
|
itself, and committing the deployed skills would make a second rather than a third. Read both
|
|
mentions as historical.
|
|
|
|
**Status: executed (2026-08-14).** All six packages are installed into `/root/ai-development` by
|
|
`apm install`; the six native project-scope installs (`claude plugin uninstall <name>@holocron
|
|
--scope project`) are gone and `.claude/settings.json`'s `enabledPlugins` block is empty.
|
|
|
|
## Context
|
|
|
|
Until now the repo consumed its own output the same way any user would: `claude plugin install
|
|
<name>@holocron`, six plugins enabled per-project in `.claude/settings.json`, the `holocron`
|
|
marketplace registered in `~/.claude/plugins/known_marketplaces.json` with `autoUpdate: true`.
|
|
That worked. It also meant the repo's dogfooding stopped one layer short of the tooling it
|
|
publishes: `kyberforge` ships `apm-workflow` and `apm-install` skills describing an install path
|
|
the repo itself did not take.
|
|
|
|
apm supports both scopes. `apm install --global` deploys to `~/.claude/`; plain `apm install`
|
|
deploys to the project. Global was rejected deliberately — the switch should be provable in one
|
|
repo before it changes how every other project on the machine resolves its skills.
|
|
|
|
## Decision
|
|
|
|
Root `apm.yml` declares all six packages under `dependencies.apm`, each as a `git:`/`path:` object
|
|
against the holocron remote:
|
|
|
|
```yaml
|
|
dependencies:
|
|
apm:
|
|
- git: git@git.dev.rkdr.net:Defame1297/holocron.git
|
|
path: plugins/core
|
|
```
|
|
|
|
`apm install` deploys them to `.claude/skills/<name>/` and `.claude/agents/<name>.md`.
|
|
|
|
Three sub-decisions inside that:
|
|
|
|
- **Object form over the `<name>@holocron` marketplace alias.** The alias is shorter and apm
|
|
resolves it correctly (verified end-to-end against this remote), but it first requires
|
|
`apm marketplace add`, which writes to `~/.apm/marketplaces.json` — user scope, outside the
|
|
repo, and absent on a fresh clone. The object form needs nothing beyond the committed manifest.
|
|
- **Remote source over local path.** apm accepts `path: /root/ai-development/plugins/<name>` as a
|
|
local dependency, which would make the working tree live instantly. Rejected: it erases the
|
|
distinction between editing a skill and shipping one, which is the entire point of having a
|
|
marketplace. The remote form keeps the repo running the same released content every other
|
|
consumer gets.
|
|
- **Unpinned against the default branch.** Parity with the `autoUpdate: true` the native install
|
|
had. apm warns on every install (`6 dependencies unpinned`); accepted knowingly. Pinning is a
|
|
per-entry `ref:` away once the repo tags releases per package — today `git tag` lists one tag
|
|
total, so there is nothing meaningful to pin to.
|
|
|
|
## Consequences
|
|
|
|
**Skills gain an unnamespaced name.** apm deploys plain project skills, so `git:git-commits` also
|
|
answers to `git-commits` and `kyberforge:skill-audit` to `skill-audit` (**skill renamed per ADR-0025,
|
|
2026-09-15:** that skill is now `factory-audit`, so the live example is `kyberforge:factory-audit` to
|
|
`factory-audit`; the rule is unchanged). This is not configurable —
|
|
a project skill has no plugin to prefix. `AGENTS.md` and `CONTEXT.md` are updated to name the bare
|
|
form, which is what apm deploys and the only form a repo consuming holocron through apm gets.
|
|
|
|
**Correction (2026-08-14): the namespaced form did not stop resolving.** *Superseded by the
|
|
2026-08-17 correction below: the machine state this cites is no longer present. Both are kept
|
|
because the pair is the finding — read neither as current.* An earlier revision of
|
|
this consequence said every `<plugin>:<skill>` reference "was stale the moment the switch landed",
|
|
and `AGENTS.md`/`CONTEXT.md` were written to match. That contradicts the "User scope is untouched,
|
|
deliberately" consequence below, and the contradiction resolves against it: `~/.claude.json` still
|
|
enables `core`, `git`, `gitea`, `kyberforge` and `lint` at user scope, so both names are live at
|
|
once and a working `gitea:gitea-prs` is the user-scope copy answering. That doubling is the same
|
|
"present twice under two names" outcome the "Keeping both install paths" alternative was rejected
|
|
for — reached by leaving user scope alone rather than by adopting it, which is why it is a
|
|
consequence to record rather than a decision to revisit. Prefer the bare name regardless: it
|
|
survives those user-scope installs eventually being converted, and the namespaced form still
|
|
resolves for anyone installing holocron natively, so skill bodies written for both audiences
|
|
should name the bare skill.
|
|
|
|
**Correction (2026-08-17): the evidence under the correction above is gone, and the claim goes with
|
|
it — not to its opposite.** Observed on this machine: `~/.claude/plugins/installed_plugins.json` is
|
|
`{"version": 2, "plugins": {}}`; there is no `enabledPlugins` key anywhere in `~/.claude.json`
|
|
(`grep -c enabledPlugins` returns 0); `~/.apm/marketplaces.json` is `{"marketplaces": []}`. The
|
|
`holocron` entry in `~/.claude/plugins/known_marketplaces.json` survives, but a registered
|
|
marketplace is not an installed plugin. So the user-scope installs the 2026-08-14 correction cited
|
|
are not there, and neither is the state the *original* consequence described before it. The claim
|
|
about the namespaced form has now been written twice off two different observations of the same
|
|
machine, and this ADR has already reversed itself once on it. That is the finding: the fact is
|
|
machine state, not a property of this decision, and it changes without any commit. No instruction
|
|
file — `AGENTS.md`, `CONTEXT.md`, or a skill body — should assert either way whether
|
|
`<plugin>:<skill>` resolves. The rule that survives every observation is the one that was always the
|
|
actionable half: write the bare name, because it is the only form `apm install` produces.
|
|
|
|
**apm owns `.claude/settings.json`.** (ADR-0019 supersedes the "exactly `{"hooks": {}}`" claim
|
|
below — once a package ships a hook, apm merges it into that file and the merged entry is apm's own
|
|
output. The rule that nothing repo-authored goes in the file is unchanged.) `apm audit --ci` replays the install into a scratch tree and
|
|
diffs it against the worktree. apm's hook integrator writes that file, so the replay expects
|
|
exactly what apm would have written — `{"hooks": {}}` — and any repo-owned key in it is permanent
|
|
drift that fails the `apm-audit-ci` pre-push hook. Verified both directions: with the pre-existing
|
|
`enabledPlugins` block present, `1 of 10 check(s) failed`; reduced to `{"hooks": {}}`,
|
|
`All 10 check(s) passed`. Nothing was lost in that reduction — `enabledPlugins` was empty after the
|
|
native uninstall and the only `hooks` entry was an empty `PreToolUse: []` — but it does mean the
|
|
file is no longer available for repo-owned settings. Machine-specific settings go in the gitignored
|
|
`.claude/settings.local.json`, which apm does not deploy; shared enforcement belongs in
|
|
`.pre-commit-config.yaml`, where this repo already keeps it.
|
|
|
|
**`apm_modules/` breaks naive tree walks.** apm materializes a full copy of every dependency there
|
|
— including this repo's own plugins, `.bats` files and all. The dependency copies resolve their
|
|
bats helpers relative to their own root, not this repo's, so `tests/run-tests.sh` went from 167
|
|
tests passing to `334 tests, 167 failures` on the first install. Both discovery walks
|
|
(`tests/run-bats.sh`, `tests/run-tests.sh`) now exclude `apm_modules/`, on the find side and on the
|
|
`git ls-files` side that derives the expected set. Any future script that walks the repo tree needs
|
|
the same exclusion.
|
|
|
|
**Install output is gitignored; the lockfile is not.** `.claude/skills/`, `.claude/agents/`, and
|
|
`apm_modules/` are regenerated by `apm install`. Committing the deployed skills would add a third
|
|
mirror of content ADR-0017 already governs two copies of. `apm.lock.yaml` is committed — it is what
|
|
makes the install reproducible, and `apm audit --ci` checks it.
|
|
|
|
**MCP survived the switch; hooks were never at risk.** apm read `plugins/bin/.mcp.json` as a
|
|
self-defined direct-dependency MCP server and configured `obsidian` into the repo's `.mcp.json`
|
|
unprompted. The `gitea` and `context7` servers were never plugin-provided — they live in
|
|
`~/.claude.json` and are untouched. Every plugin's `.apm/hooks/hooks.json` is `{"hooks": {}}`, so
|
|
apm's "contributed no entries to claude settings; skipped" warning on `kyberforge` and `lint` is
|
|
accurate and harmless.
|
|
|
|
**Correction (2026-09-14): the MCP propagation above stopped operating, and the files it read are
|
|
deleted.** It ran on one code path only — `apm_cli/deps/plugin_parser.py` maps a plugin-root
|
|
`.mcp.json` onto `.apm/.mcp.json` for packages apm treats as *marketplace plugins*. Commit
|
|
`718c79a` (ADR-0024) deleted every `plugins/*/.claude-plugin/plugin.json` and
|
|
`plugins/*/.github/plugin/plugin.json`, so each package is now a plain apm package and that path no
|
|
longer runs. The supported declaration was never in use either: `plugins/bin/apm.yml` has
|
|
`dependencies.mcp: []`. That left the six plugin-root `.mcp.json` files dead config — five of them
|
|
empty stubs, only `plugins/bin`'s carrying the `obsidian` server — and all six are now deleted along
|
|
with the server itself, which is not wanted. The repo-root `.mcp.json` was apm's own generated
|
|
output that happened to be tracked; it is deleted and gitignored, on the same reasoning as
|
|
`.claude/skills/`. The rest of this paragraph is unaffected: `gitea` and `context7` were never
|
|
plugin-provided, and the hooks claim never depended on any of this.
|
|
|
|
**A `.apm/` edit now needs a round trip.** The dependency resolves from the remote, so an edit is
|
|
invisible to the running session until it is pushed and the install is refreshed. Under the native
|
|
install with `autoUpdate` the shape was the same; it was more noticeable here at first because the
|
|
refresh is a manual step where marketplace auto-update was not — ADR-0019 automates it at
|
|
`SessionStart`.
|
|
|
|
**Correction (2026-08-14): the refresh command is `apm update`, not `apm install`.** An earlier
|
|
revision of this paragraph named `apm install`, which is wrong: `apm install` deploys from the
|
|
pinned `resolved_commit` in `apm.lock.yaml` and does not re-resolve refs (`apm install --force`
|
|
documents this explicitly — "does NOT refresh refs; use 'apm update' for that"). Running it after a
|
|
merge redeploys the same content and reports success.
|
|
|
|
**User scope is untouched, deliberately.** This decision changed project scope only; whatever is
|
|
natively installed at user scope was left alone, and converting it is a separate decision with a
|
|
blast radius beyond this repo. The specific inventory this paragraph used to name
|
|
(`bin@holocron`, `gitea@holocron`, a stale `hello-world@holocron`) is machine state and is stale —
|
|
see the 2026-08-17 correction above. The decision recorded here is unaffected by what that state is.
|
|
|
|
## Alternatives considered
|
|
|
|
- **`apm install --global`.** Verified working in an isolated `HOME`: user-scope deploys land in
|
|
`~/.claude/skills/` and `~/.claude/agents/`, and it is the only scope where a plugin's `bin/`
|
|
executables deploy (moot here — every `bin/` in this repo is empty but for a README). Deferred,
|
|
not rejected: it changes skill resolution for every project on the machine at once.
|
|
- **Keeping both install paths.** Rejected: the same skill would be present twice under two names,
|
|
and `.claude/settings.json` cannot hold `enabledPlugins` without failing `apm audit --ci`.
|