Compare commits
49
Commits
No files matched your search
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "holocron",
|
||||
"description": "AI development skills for Claude Code and GitHub Copilot CLI — factory, design, implement, review, and cross-cutting workflows.",
|
||||
"version": "0.4.7",
|
||||
"description": "AI development skills for Claude Code, and for GitHub Copilot through apm — factory, design, implement, review, and cross-cutting workflows.",
|
||||
"version": "0.5.0",
|
||||
"owner": {
|
||||
"name": "Defame1297",
|
||||
"email": "[email protected]",
|
||||
@@ -10,7 +10,7 @@
|
||||
"plugins": [
|
||||
{
|
||||
"name": "kyberforge",
|
||||
"description": "Skills and agents for creating, maintaining, and managing a Claude Code / Copilot CLI plugin marketplace.",
|
||||
"description": "Skills and agents for creating, maintaining, and managing an apm plugin marketplace for Claude Code and GitHub Copilot.",
|
||||
"version": "2.0.0",
|
||||
"category": "Developer Tools",
|
||||
"source": "./plugins/kyberforge"
|
||||
@@ -18,35 +18,35 @@
|
||||
{
|
||||
"name": "bin",
|
||||
"description": "Skills for everyday AI-assisted development work that is not tied to a single tool, forge or language, and has not yet been split into a focused plugin.",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8",
|
||||
"category": "Utilities",
|
||||
"source": "./plugins/bin"
|
||||
},
|
||||
{
|
||||
"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.7",
|
||||
"version": "1.3.8",
|
||||
"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.8",
|
||||
"version": "1.3.9",
|
||||
"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.2",
|
||||
"version": "1.1.3",
|
||||
"category": "Productivity",
|
||||
"source": "./plugins/core"
|
||||
},
|
||||
{
|
||||
"name": "lint",
|
||||
"description": "Skills and agents for configuring and running linters.",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8",
|
||||
"category": "Developer Tools",
|
||||
"source": "./plugins/lint"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"SessionStart": [
|
||||
{
|
||||
"matcher": "startup",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "\"${CLAUDE_PROJECT_DIR}/.claude/hooks/kyberforge/.apm/hooks/check-apm-current.sh\"",
|
||||
"timeout": 380
|
||||
}
|
||||
],
|
||||
"_apm_source": "Defame1297/holocron/plugins/kyberforge"
|
||||
}
|
||||
]
|
||||
}
|
||||
+4
-4
@@ -40,11 +40,11 @@ apm_modules/
|
||||
/.mcp.json
|
||||
|
||||
# APM hook deployment output — `apm install` copies each package's referenced
|
||||
# hook scripts here and tracks its own settings.json entries in the sidecar.
|
||||
# Regenerated on every install; the authoring source is
|
||||
# plugins/<name>/.apm/hooks/ (ADR-0019).
|
||||
# hook scripts here. Regenerated on every install; the authoring source is
|
||||
# plugins/<name>/.apm/hooks/ (ADR-0019). The .claude/apm-hooks.json ownership
|
||||
# sidecar is committed, not ignored: without it a fresh clone's install cannot
|
||||
# claim the committed settings.json entry and duplicates it (ADR-0019).
|
||||
.claude/hooks/
|
||||
.claude/apm-hooks.json
|
||||
|
||||
# `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.
|
||||
|
||||
+86
-51
@@ -44,8 +44,9 @@ repos:
|
||||
# alternations went with them: `check-useless-excludes` fails on a
|
||||
# pattern that matches no file.
|
||||
#
|
||||
# `.claude/settings.json` is the second and last alternation, and it is
|
||||
# the only one here for a reason other than "generated manifest":
|
||||
# `.claude/settings.json` and its `.claude/apm-hooks.json` ownership
|
||||
# sidecar are the last two alternations, and they are the only ones
|
||||
# here for a reason other than "generated manifest":
|
||||
# apm OWNS that file (ADR-0018, ADR-0019), and
|
||||
# `apm audit --ci` replays the install into a scratch tree and diffs
|
||||
# the result byte-for-byte. `pretty-format-json` sorts object keys
|
||||
@@ -56,8 +57,11 @@ repos:
|
||||
# as permanent drift on a file with no git diff -- exactly what
|
||||
# happened when the SessionStart hook first landed in 2e395a4.
|
||||
# Re-running `apm install` fixes the file; leaving it in scope here
|
||||
# would re-break it on the very commit that carries the fix.
|
||||
exclude: '^(\.claude-plugin/marketplace\.json|\.claude/settings\.json)$'
|
||||
# would re-break it on the very commit that carries the fix. The
|
||||
# sidecar is committed so a fresh clone's install can claim the
|
||||
# settings entry instead of duplicating it (ADR-0019, 2026-09-16
|
||||
# correction), and it is apm output under the same byte-for-byte replay.
|
||||
exclude: '^(\.claude-plugin/marketplace\.json|\.claude/(settings|apm-hooks)\.json)$'
|
||||
- id: check-yaml
|
||||
stages: ['pre-commit']
|
||||
- id: trailing-whitespace
|
||||
@@ -93,48 +97,67 @@ repos:
|
||||
|
||||
- id: apm-audit-ci
|
||||
name: apm audit --ci
|
||||
description: Run apm's producer-side CI gate over the root manifest AND each of the six plugin packages. Verifies exactly two things per manifest -- apm.yml parses as a valid APM manifest (manifest-parse), and, if it declares dependencies, apm.lock.yaml exists and is consistent (lockfile-exists). It does NOT enforce an org policy and does NOT scan for hidden Unicode; 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 of the six plugin packages. 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. It does NOT enforce an org policy; see the comment below for why. Reference:plugins/kyberforge/.apm/skills/apm-workflow/references/audit.md
|
||||
entry: bash -c 'for d in . plugins/*/; do (cd "$d" && apm audit --ci) || { echo "apm audit --ci failed in $d" >&2; exit 1; }; done'
|
||||
language: system
|
||||
stages: [pre-push]
|
||||
pass_filenames: false
|
||||
always_run: true
|
||||
# The description above deliberately claims less than this hook's old one
|
||||
# did ("lockfile/policy/hidden-content integrity"), because two of those
|
||||
# three were never happening:
|
||||
# What this hook actually runs, read off apm 0.28.0'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".
|
||||
#
|
||||
# * POLICY. `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 Gitea, so discovery resolves
|
||||
# nothing and the run prints `No org policy found at unknown;
|
||||
# enforcement skipped`. apm's own message suggests
|
||||
# `policy.fetch_failure_default=block` in apm.yml "to fail closed" --
|
||||
# that was tried on a scratch copy and REJECTED: it does not make the
|
||||
# check meaningful, it makes it permanently red. `apm audit --ci` then
|
||||
# exits 1 with `No org policy found at unknown
|
||||
# (policy.fetch_failure_default=block)` on every push, because there is
|
||||
# no org policy to find and no supported way for this remote to 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.
|
||||
# * HIDDEN CONTENT. The hidden-Unicode scan is plain `apm audit`, not
|
||||
# `apm audit --ci` (the two are different modes, and --ci refuses to
|
||||
# combine with --file/--strip/--dry-run/PACKAGE). Plain `apm audit`
|
||||
# here reports `No apm.lock.yaml found -- nothing to scan` and exits 0,
|
||||
# so adding it would buy a second vacuous check, not coverage.
|
||||
# * ROOT MANIFEST -- 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. 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
|
||||
# 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
|
||||
# only the root install has a lockfile, a deployment ledger and
|
||||
# deployed files to check. Running the six plugin packages is what
|
||||
# makes lockfile-exists reachable for them at all -- the root-only
|
||||
# invocation audits the root manifest and nothing else.
|
||||
# * HIDDEN CONTENT IS COVERED. content-integrity is that scan; it
|
||||
# reports `No critical hidden Unicode or hash drift detected`. An
|
||||
# earlier revision of this comment said the hook does NOT scan for
|
||||
# hidden Unicode and that adding the scan would buy a second vacuous
|
||||
# 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.
|
||||
# * 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
|
||||
# Gitea, so discovery resolves nothing and the run prints `No org
|
||||
# policy found at unknown; enforcement skipped`. apm's own message
|
||||
# suggests `policy.fetch_failure_default=block` in apm.yml "to fail
|
||||
# closed" -- that was tried on a scratch copy and REJECTED: it does
|
||||
# not make the check meaningful, it makes it permanently red. `apm
|
||||
# audit --ci` then exits 1 with `No org policy found at unknown
|
||||
# (policy.fetch_failure_default=block)` on every push, because there
|
||||
# is no org policy to find and no supported way for this remote to
|
||||
# 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.
|
||||
#
|
||||
# What IS left is worth keeping, and is now run against seven manifests
|
||||
# instead of one. lockfile-exists is conditional -- it is vacuous while
|
||||
# every apm.yml declares `dependencies: {apm: [], mcp: []}`, and it arms
|
||||
# itself the moment one does not (verified: adding a git dependency to
|
||||
# plugins/lint/apm.yml fails with `apm.yml declares dependencies but
|
||||
# apm.lock.yaml is absent`). manifest-parse is unconditional and fires on
|
||||
# any malformed manifest (verified: a dependency entry missing its
|
||||
# git/path/registry field fails with `Cannot parse apm.yml`). Running the
|
||||
# six plugin packages is what makes either reachable for them at all --
|
||||
# the root-only invocation audits the marketplace manifest and nothing
|
||||
# else. Costs ~0.5s per package, needs no network (checked under
|
||||
# `unshare -rn`) -- consistent with every other pre-push hook: none of
|
||||
# them need the network (see README.md's "Offline?" section).
|
||||
# Costs ~0.5s per package. Needs no network ONCE `apm install` has
|
||||
# populated apm_modules/ -- 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
|
||||
# "Offline?" section.
|
||||
|
||||
- id: check-apm-agents-valid
|
||||
name: Validate real APM agent files
|
||||
@@ -163,11 +186,14 @@ repos:
|
||||
pass_filenames: false
|
||||
always_run: true
|
||||
|
||||
# check-vale-style-sync was removed by ADR-0025. Only 6 of its 17
|
||||
# assertions diffed skill-audit's Vale copy against agent-audit's; the
|
||||
# merge into factory-audit leaves one copy, so those are moot. The other
|
||||
# check-vale-style-sync was removed by ADR-0025. Of its 17 assertion
|
||||
# sites only 2 actually diffed skill-audit's Vale copy against
|
||||
# agent-audit's, and 4 more existed solely so the script could locate the
|
||||
# two copies -- a real REPO_ROOT, non-stale .apm/ paths, both copies
|
||||
# present (ADR-0025:285-287). The merge into factory-audit leaves one
|
||||
# copy, so all 6 are moot. The other
|
||||
# 11 moved into tests/test-vale-wrap.sh (case 0, cases 28-31, its
|
||||
# Vale-absent skip, and case 33 for cross-manifest files: agreement),
|
||||
# Vale-absent skip, and case 32 for the one-plugin narrowing guard),
|
||||
# which run-tests runs here at
|
||||
# pre-push, so do not re-add the hook to restore coverage. Do not
|
||||
# confuse its removal with check-scope-walkup-sync below, which survives:
|
||||
@@ -183,14 +209,21 @@ repos:
|
||||
pass_filenames: false
|
||||
always_run: true
|
||||
|
||||
- id: check-release-needed
|
||||
name: Check a release tag covers .pre-commit-hooks.yaml's paths
|
||||
description: On push to main only, fail if files exposed via .pre-commit-hooks.yaml changed since the last tag
|
||||
entry: bash scripts/check-release-needed.sh
|
||||
- id: check-skill-version-bump
|
||||
name: Check changed skills bump metadata.version
|
||||
description: On every push, fail if a skill directory changed (tests/ excluded) since the merge-base with main without its SKILL.md metadata.version rising above both that merge-base's and main's tip's (ADR-0022)
|
||||
entry: bash scripts/check-skill-version-bump.sh
|
||||
language: system
|
||||
stages: [pre-push]
|
||||
pass_filenames: false
|
||||
always_run: true
|
||||
# "Changed" is measured from the merge-base with origin/main (falling
|
||||
# back to main), not the remote branch tip: readers install from main.
|
||||
# The version must also beat main's tip, so two branches making the same
|
||||
# bump cannot both land. Fails closed when no main ref resolves, when
|
||||
# there is no merge-base, or when only local main resolves and already
|
||||
# contains the pushed commit. Merges through Gitea's merge button run no
|
||||
# local hook, so they bypass this. See docs/spec/gates.md.
|
||||
|
||||
- id: validate-marketplace
|
||||
name: Validate marketplace manifest
|
||||
@@ -204,7 +237,7 @@ repos:
|
||||
- id: skill-size-check
|
||||
stages: ['pre-commit']
|
||||
name: SKILL.md size and context-budget ceilings
|
||||
description: Enforce agentskills.io's 500-line/2,770-whole-file-word spec ceilings AND ADR-0020's context budget -- description 250 chars SUGGESTION / 400 FAIL, body-only 600 words SUGGESTION / 900 FAIL, and every boundary-clause routing target resolving to a real skill or agent under plugins/*/.apm/
|
||||
description: Enforce agentskills.io's 500-line/2,770-whole-file-word spec ceilings AND ADR-0020's context budget -- description 250 chars SUGGESTION / 400 FAIL, body-only 600 words SUGGESTION / 900 FAIL, and every boundary-clause routing target resolving to a real skill or agent under plugins/*/.apm/ -- plus the required frontmatter fields folded in from the former skill-frontmatter hook, namely name, a non-empty description, and a metadata.version matching three-part semver (1.0.0)
|
||||
entry: scripts/skill-size-check.sh
|
||||
language: script
|
||||
files: '^plugins/[^/]+/\.apm/skills/[^/]+/SKILL\.md$'
|
||||
@@ -226,9 +259,11 @@ repos:
|
||||
entry: scripts/check-rtk-prefix.sh
|
||||
language: script
|
||||
files: '^plugins/[^/]+/\.apm/(skills/.*\.md|agents/.*\.agent\.md)$'
|
||||
# README.md is excluded on purpose, not by oversight. A skill-directory
|
||||
# README is consumer-facing prose that no agent ever loads, and the
|
||||
# `git clone` lines in the six tests/README.md files are setup
|
||||
# README.md is excluded on purpose, not by oversight. The 12 README.md
|
||||
# files still in scope sit in a skill's scripts/, tests/ and assets/
|
||||
# subdirectories -- consumer-facing prose that no agent ever loads (the
|
||||
# skill-directory READMEs this was first written for are deleted) -- and
|
||||
# the `git clone` lines in the six tests/README.md files are setup
|
||||
# instructions for a third party who has no rtk installed. Prefixing
|
||||
# those would be actively wrong -- see ADR-0023's consumer section.
|
||||
exclude: '(^|/)README\.md$'
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
# PUBLISHED CONTRACT. External repos consume these IDs with `rev: <tag>`, so an
|
||||
# ID or a `files:` regex here may not change without breaking them on upgrade.
|
||||
# ADR-0025 merged skill-audit and agent-audit into factory-audit and re-pointed
|
||||
# both `entry:` paths at its single vale-wrap.sh; both IDs and both regexes are
|
||||
# unchanged, deliberately. Collapsing them into one was considered and rejected:
|
||||
# it breaks every consumer pinning kyberforge-vale-audit-agent, and it re-creates
|
||||
# ADR-0014's measured failure where one hook against one config silently scanned
|
||||
# 0 files of the other type. Two IDs are what keep both file scopes addressable.
|
||||
- id: kyberforge-vale-audit-skill
|
||||
name: Kyberforge Vale prose audit (SKILL.md)
|
||||
description: Deterministic prose-pattern prefilter for kyberforge's factory-audit skill flow, via its own bundled Vale config/styles
|
||||
entry: plugins/kyberforge/.apm/skills/factory-audit/scripts/vale-wrap.sh
|
||||
language: script
|
||||
files: '(^|/)SKILL\.md$'
|
||||
|
||||
- id: kyberforge-vale-audit-agent
|
||||
name: Kyberforge Vale prose audit (agent files)
|
||||
description: Deterministic prose-pattern prefilter for kyberforge's factory-audit agent flow, via its own bundled Vale config/styles
|
||||
entry: plugins/kyberforge/.apm/skills/factory-audit/scripts/vale-wrap.sh
|
||||
language: script
|
||||
files: '(^|/)agents/[^/]+\.md$|\.agent\.md$'
|
||||
|
||||
- id: kyberforge-skill-size-check
|
||||
name: SKILL.md size and context-budget ceilings
|
||||
description: Enforce agentskills.io's 500-line/2,770-whole-file-word spec ceilings plus ADR-0020's context budget (description 250 chars SUGGESTION / 400 FAIL, body-only 600 words SUGGESTION / 900 FAIL, resolvable boundary-clause routing targets)
|
||||
entry: scripts/skill-size-check.sh
|
||||
language: script
|
||||
files: '(^|/)SKILL\.md$'
|
||||
# verbose so the SUGGESTION tier reaches a human -- pre-commit prints
|
||||
# nothing for a passing hook, and a SUGGESTION deliberately does not fail.
|
||||
verbose: true
|
||||
@@ -28,9 +28,9 @@ 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). Commit or discard it deliberately.
|
||||
- **A `.apm/` edit is not live in this session until it is pushed.** The six dependencies resolve from the holocron remote, unpinned against the default branch. `apm install` deploys from the lock; `apm update` is what re-resolves refs.
|
||||
- **No pre-push hook needs the network.** Root `apm.yml`'s marketplace has no remote package entries, so every hook resolves locally.
|
||||
- **`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`.** The six 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").
|
||||
- **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.
|
||||
|
||||
## Key documents
|
||||
@@ -45,7 +45,7 @@ Read these on demand:
|
||||
- `docs/spec/gates.md` — what each pre-commit and pre-push hook enforces and why; read when a gate fails or before changing hook config
|
||||
- `docs/spec/architecture.md` — directory structure, install pipeline, provider model
|
||||
- `docs/adr/` — architectural decisions; read before answering design questions or proposing structural changes
|
||||
- `docs/ai-constitution.md` — full governance evidence base; read when a governance decision needs justification
|
||||
- `core/ai-constitution.md` — full governance evidence base; read when a governance decision needs justification
|
||||
- `docs/research/ai-coding-factory/ai-coding-factory-principles.md` — factory design rationale; read when implementing, auditing, or reviewing skills or factory structure
|
||||
- `docs/notes/factory-integration-decisions.md` — decisions from the factory integration grill; read when making skill authoring or factory design decisions
|
||||
- Governance rules are always in effect — `core/instructions/governance.md` (agent rules); `docs/research/governance_principles/CONTROLS.md`
|
||||
+6
-6
@@ -30,10 +30,10 @@ _Avoid_: router body, thin body
|
||||
|
||||
**Hand-invoked skill**:
|
||||
A skill reached only by typing its slash command, declared `disable-model-invocation: true`. The host
|
||||
withholds it from the model-visible listing entirely, so it pays no preload tax and its description
|
||||
becomes human-facing text. The flag also hard-blocks the Skill tool, so **no other skill can route to
|
||||
a hand-invoked skill** — a `` Call `x` `` step in another skill's body stops working the moment `x`
|
||||
takes the flag. Check inbound routes before declaring one. Exemplar: `zoom-out`.
|
||||
withholds it from the model-visible listing entirely, so it costs nothing in always-on context and
|
||||
its description becomes human-facing text. The flag also hard-blocks the Skill tool, so **no other
|
||||
skill can route to a hand-invoked skill** — a `` Call `x` `` step in another skill's body stops
|
||||
working the moment `x` takes the flag. Check inbound routes before declaring one. Exemplar: `zoom-out`.
|
||||
_Avoid_: manual skill, disabled skill
|
||||
|
||||
**Delegation discipline**:
|
||||
@@ -155,9 +155,9 @@ _Avoid_: namespace, category
|
||||
> **Dev:** "This one only fires when someone types the slash command. Does its description still need
|
||||
> trigger words?"
|
||||
> **Maintainer:** "No — that's a **hand-invoked skill**. The host withholds it from the model-visible
|
||||
> listing, so it pays no **preload tax** at all and the description is human-facing text."
|
||||
> listing, so it costs nothing in always-on context and the description is human-facing text."
|
||||
> **Dev:** "Then the body can be as long as it needs to be?"
|
||||
> **Maintainer:** "Different budget. The **skill context contract** gates the body whether or not the
|
||||
> **Maintainer:** "Different budget. ADR-0020's authoring rules gate the body whether or not the
|
||||
> skill is model-invoked — the description competes with every other skill's description, the body
|
||||
> competes with the caller's live conversation. Four mutually exclusive flows means a **dispatch
|
||||
> body**: table in `SKILL.md`, one `references/` file per flow."
|
||||
|
||||
+6
-6
@@ -40,9 +40,9 @@ A research sub-agent reported "Process goes in SKILL.md, context in reference fi
|
||||
|
||||
`claude plugin validate --strict` was left out of the standard plugin audit sweep and only discovered when the user flagged the gap. It catches warnings (missing `version` fields, stray non-agent `.md` files) that will fail CI once strict mode is enforced. Fix: run it on every plugin path and marketplace manifest as a named audit step.
|
||||
|
||||
## 2026-06-21 — Source and deployed gitleaks configs can silently diverge
|
||||
## 2026-06-21 — Source and deployed gitleaks configs can silently diverge (historical)
|
||||
|
||||
`scripts/gitleaks.toml` (source) and `.gitleaks.toml` (deployed, hook-read) drifted after someone edited the deployed copy directly; rerunning `setup-gitleaks.sh` would have overwritten it, silently deleting the allowlist. Fix: treat the source as sole truth, never hand-edit the deployed copy, and update both together in the same commit.
|
||||
Superseded — `5b8b6f5` removed `scripts/gitleaks.toml` and `setup-gitleaks.sh`, so `.gitleaks.toml` is now the only copy and there is nothing to diverge from. Kept for the general pattern, which applies to any source/deployed pair: `scripts/gitleaks.toml` (source) and `.gitleaks.toml` (deployed, hook-read) drifted after someone edited the deployed copy directly; rerunning `setup-gitleaks.sh` would have overwritten it, silently deleting the allowlist. Fix: treat the source as sole truth, never hand-edit the deployed copy, and update both together in the same commit.
|
||||
|
||||
## 2026-06-21 — `shellcheck` without `-x` blocks pre-commit on scripts using `source` (historical)
|
||||
|
||||
@@ -56,9 +56,9 @@ Skills sharing a resource (e.g. `validate.sh`) via a `shared/` directory and rel
|
||||
|
||||
`skill-audit`'s (now `factory-audit`'s skill flow, per ADR-0025: `references/skill-description-quality.md` and `references/skill-body-discipline.md`) description and body-discipline rubrics were derived from `skill-write`'s own conventions — circular, so drift in one silently propagated to the other. Fix: extract condensed reference files directly from the upstream spec (agentskills.io) into the audit skill, so the rubric is independent of in-repo convention drift.
|
||||
|
||||
## 2026-06-22 — Test files in scripts/ are dev tooling; document them in README as non-spec
|
||||
## 2026-06-22 — Test files in scripts/ are dev tooling; document them in README as non-spec (historical)
|
||||
|
||||
The agentskills.io spec defines `scripts/` for bundled executables, not test infrastructure — bats files placed there are invisible to spec-following auditors and cause README drift. Fix: place test files directly in `scripts/` (no subdirectory), and add a README row noting each as "dev tooling, not shipped."
|
||||
Superseded — the fix below is now itself a FAIL. `factory-audit`'s `references/skill-file-structure.md:14` permits `tests/` as one of the four allowed directories, `:21-22` fails a test file found in `scripts/`, and `:58-60` requires a `tests/README.md` when `tests/` exists. Skill-root READMEs are gone too, so there is no table left to add a row to. What survives is the reason: test infrastructure is dev tooling, not shipped content, and has to be declared where an auditor reads — which is now `tests/README.md`. Kept for reference: the agentskills.io spec defines `scripts/` for bundled executables, not test infrastructure — bats files placed there are invisible to spec-following auditors and cause README drift. Fix: place test files directly in `scripts/` (no subdirectory), and add a README row noting each as "dev tooling, not shipped."
|
||||
|
||||
## 2026-06-27 — Clean-context audit catches what biased forks miss
|
||||
|
||||
@@ -130,9 +130,9 @@ Widening a description-opener rule to also catch mid-sentence text looked like a
|
||||
|
||||
`apm audit --ci` failed on `.claude/settings.json` with an empty `git diff` — `pretty-format-json --autofix` silently re-sorts JSON keys, and this generated file was missing from its exclude list, so every commit re-sorted apm's insertion-ordered output before apm compared against it. Separately, a defect introduced 3 hours earlier on the same branch was first mis-described as "pre-existing," an unverified claim about history. Fix: add tool-owned paths to every autofixing hook's exclude the moment ownership is declared, and verify "pre-existing" claims with `git log -S` or `git branch --contains` before writing them down.
|
||||
|
||||
## 2026-08-16 — A rule reversed inside a retrofit leaves no trace unless someone writes it down
|
||||
## 2026-08-16 — A rule reversed inside a retrofit leaves no trace unless someone writes it down (historical)
|
||||
|
||||
A retrofit replaced "keep reference chains one level deep" with "two hops, never three" — the opposite rule, needed because the new dispatch pattern requires `SKILL.md` → `improve.md` → `retrofit.md`. The ADR never mentioned chain depth, so the reversal was carried entirely by the diff with no sign a contradicting rule ever existed. Fix: when a change inverts a standing rule, record the inversion where the rule's rationale lives, or it reads as forgotten rather than overturned.
|
||||
The chain named below no longer exists — `plugins/kyberforge/.apm/skills/skill-author/references/retrofit.md` was deleted, so the dispatch ends at `improve.md`. The reversed rule itself survives, in `skill-author/references/create.md:150`. Kept for reference: a retrofit replaced "keep reference chains one level deep" with "two hops, never three" — the opposite rule, needed because the new dispatch pattern requires `SKILL.md` → `improve.md` → `retrofit.md`. The ADR never mentioned chain depth, so the reversal was carried entirely by the diff with no sign a contradicting rule ever existed. Fix: when a change inverts a standing rule, record the inversion where the rule's rationale lives, or it reads as forgotten rather than overturned.
|
||||
|
||||
## 2026-09-15 — A rare flake in a pipefail suite is a race until proven otherwise
|
||||
|
||||
|
||||
@@ -12,12 +12,12 @@ Content ships as six installable plugins, each an apm (Agent Package Manager) pa
|
||||
| `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 |
|
||||
| `scripts/` | Install, sync, and check scripts used by the git hooks |
|
||||
| `scripts/` | Install and check scripts used by the git hooks |
|
||||
| `tests/` | `run-tests.sh`, `run-bats.sh`, the `test-*.sh` suites, and the bats submodules |
|
||||
|
||||
The six plugins:
|
||||
|
||||
- **kyberforge** — skills and agents for creating, maintaining, and managing a Claude Code / Copilot CLI plugin marketplace
|
||||
- **kyberforge** — skills and agents for creating, maintaining, and managing an apm plugin marketplace for Claude Code (and GitHub Copilot through apm)
|
||||
- **git** — conventional commits, branches, history, submodules, worktrees, remotes, pre-commit hook authoring and running (`pc-author` / `pc-run`), and an interactive router (`git-workflow`)
|
||||
- **gitea** — issues, pull requests, labels, milestones, releases, branches, files, and an interactive router (`gitea-workflow`)
|
||||
- **core** — authoring and auditing a repo's `AGENTS.md` and the provider adapter files that defer to it
|
||||
@@ -31,8 +31,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), which reads folded YAML frontmatter | `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` / `test-vale-hooks-consumer.sh` suites 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/ |
|
||||
| `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 |
|
||||
| `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 |
|
||||
|
||||
Two notes worth reading before you skip one:
|
||||
@@ -58,7 +58,7 @@ pre-commit install -t pre-commit -t commit-msg -t pre-push
|
||||
|
||||
## Keeping the install current
|
||||
|
||||
The six 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; commit or discard it deliberately. Mechanism and rationale: `docs/adr/0019-session-start-hook-keeps-the-apm-install-current.md`.
|
||||
The six 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`.
|
||||
|
||||
Note the difference between the two commands:
|
||||
|
||||
@@ -84,14 +84,9 @@ Run the pre-push gate locally in one command:
|
||||
pre-commit run --hook-stage pre-push --all-files
|
||||
```
|
||||
|
||||
One caveat: `check-release-needed` is a silent no-op under this invocation. It exits 0 unless
|
||||
`PRE_COMMIT_REMOTE_BRANCH` is `refs/heads/main`, and pre-commit exports that only from the real
|
||||
pre-push git hook during an actual `git push` — so the hook reports `Passed` having checked nothing.
|
||||
Every other pre-push hook does run.
|
||||
|
||||
See [`docs/spec/gates.md`](docs/spec/gates.md) for what each hook enforces and why.
|
||||
|
||||
**Offline?** No pre-push hook needs the network: 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. All pre-push hooks pass offline.
|
||||
**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.
|
||||
|
||||
## Editing plugin content
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name: holocron
|
||||
version: 0.4.7
|
||||
description: AI development skills for Claude Code and GitHub Copilot CLI — factory, design, implement, review, and cross-cutting workflows.
|
||||
version: 0.5.0
|
||||
description: AI development skills for Claude Code, and for GitHub Copilot through apm — factory, design, implement, review, and cross-cutting workflows.
|
||||
license: MIT
|
||||
|
||||
# Consumer side: this repo installs its own published plugins from the holocron
|
||||
@@ -36,10 +36,17 @@ dependencies:
|
||||
# executables deploy" until an `executables:` block exists.
|
||||
#
|
||||
# kyberforge ships the SessionStart hook that keeps this install level with the
|
||||
# remote (ADR-0019). The key is version-pinned by apm's own design, so a
|
||||
# kyberforge version bump makes this entry stop matching and the hook stops
|
||||
# deploying until the version here is bumped too. If skills silently go stale
|
||||
# after a kyberforge release, check this first.
|
||||
# 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.
|
||||
executables:
|
||||
allow:
|
||||
kyberforge#2.0.0:
|
||||
@@ -51,8 +58,8 @@ marketplace:
|
||||
# compiled marketplace.json when set explicitly here (an override) — the
|
||||
# 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 GitHub Copilot CLI — factory, design, implement, review, and cross-cutting workflows.
|
||||
version: 0.4.7
|
||||
description: AI development skills for Claude Code, and for GitHub Copilot through apm — factory, design, implement, review, and cross-cutting workflows.
|
||||
version: 0.5.0
|
||||
owner:
|
||||
name: Defame1297
|
||||
email: [email protected]
|
||||
@@ -75,37 +82,25 @@ marketplace:
|
||||
|
||||
packages:
|
||||
- name: kyberforge
|
||||
description: Skills and agents for creating, maintaining, and managing a Claude Code / Copilot CLI plugin marketplace.
|
||||
source: ./plugins/kyberforge
|
||||
version: 2.0.0
|
||||
category: Developer Tools
|
||||
|
||||
- name: bin
|
||||
description: Skills for everyday AI-assisted development work that is not tied to a single tool, forge or language, and has not yet been split into a focused plugin.
|
||||
source: ./plugins/bin
|
||||
version: 1.1.7
|
||||
category: Utilities
|
||||
|
||||
- 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.
|
||||
source: ./plugins/git
|
||||
version: 1.3.7
|
||||
category: Version Control
|
||||
|
||||
- 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.
|
||||
source: ./plugins/gitea
|
||||
version: 1.3.8
|
||||
category: Version Control
|
||||
|
||||
- name: core
|
||||
description: Skills for authoring and auditing a repo's AGENTS.md and the provider adapter files that defer to it.
|
||||
source: ./plugins/core
|
||||
version: 1.1.2
|
||||
category: Productivity
|
||||
|
||||
- name: lint
|
||||
description: Skills and agents for configuring and running linters.
|
||||
source: ./plugins/lint
|
||||
version: 1.1.7
|
||||
category: Developer Tools
|
||||
File renamed without changes.
@@ -1,7 +1,7 @@
|
||||
# Agent Instructions
|
||||
|
||||
Applies to: all AI agents and assistants in this context, at all times.
|
||||
Full governance context: `docs/ai-constitution.md` — read it when making decisions not covered here.
|
||||
Full governance context: `~/.claude/core/ai-constitution.md` — read it when making decisions not covered here.
|
||||
This file is the operative subset: what you, as an agent, can act on in the moment.
|
||||
|
||||
---
|
||||
@@ -70,13 +70,13 @@ When asked to perform a well-defined, repeatable task — file processing, deplo
|
||||
|
||||
## What This File Does Not Govern
|
||||
|
||||
Human process decisions are outside agent scope: oversight checkpoints, human approval gates, post-mortems, regulatory notifications, IP licence scanning, and sustainability measurement. These are defined in `docs/ai-constitution.md` and executed by humans following `docs/wiki/HUMANS.md`.
|
||||
Human process decisions are outside agent scope: oversight checkpoints, human approval gates, post-mortems, regulatory notifications, IP licence scanning, and sustainability measurement. These are defined in `~/.claude/core/ai-constitution.md` and executed by humans following the holocron repo's `docs/wiki/HUMANS.md`.
|
||||
|
||||
The deterministic enforcement layer — pre-commit hooks, CI gates, scanner configuration, audit logging infrastructure, and AI agent permission scoping — is specified in `docs/research/governance_principles/CONTROLS.md` and implemented by humans. Agent instructions alone cannot enforce what deterministic tooling must enforce.
|
||||
The deterministic enforcement layer — pre-commit hooks, CI gates, scanner configuration, audit logging infrastructure, and AI agent permission scoping — is specified in the holocron repo's `docs/research/governance_principles/CONTROLS.md` and implemented by humans. Agent instructions alone cannot enforce what deterministic tooling must enforce.
|
||||
|
||||
---
|
||||
|
||||
*Derived from AI Constitution v1.1 — May 2026. Update this file when the constitution is updated.*
|
||||
*Compatible with: governance.md, CLAUDE.md, .github/copilot-instructions.md, .cursor/rules/*.mdc*
|
||||
*One source of truth. Do not copy-paste into tool-specific files — reference this file from thin adapters.*
|
||||
*Counterparts: `docs/wiki/HUMANS.md` (human practitioner rules) | `docs/research/governance_principles/CONTROLS.md` (deterministic enforcement)*
|
||||
*Counterparts, in the holocron repo: `docs/wiki/HUMANS.md` (human practitioner rules) | `docs/research/governance_principles/CONTROLS.md` (deterministic enforcement)*
|
||||
+1
-1
@@ -60,4 +60,4 @@ Runtime orchestration: push config updates to machines, see running agents, mana
|
||||
|
||||
### Phase 3 — Native Apps
|
||||
|
||||
Mobile (React Native) and desktop (Tauri) wrappers over the Phase 1/2 web app. Deferred until the web app is mature.
|
||||
Mobile and desktop wrappers over the Phase 1/2 web app. Deferred until the web app is mature; the wrapper technology is that product's own choice, on the same terms as the rest of its stack.
|
||||
@@ -26,7 +26,11 @@ stay out of this Vale-based harness because this repo already has dedicated tool
|
||||
`skill-frontmatter` (required frontmatter fields), `validate-marketplace`
|
||||
(`claude plugin validate --strict`, schema), and `gitleaks`/`detect-private-key` (secrets).
|
||||
(ADR-0024 removed the companion `validate-plugins` gate along with the per-plugin manifests it
|
||||
checked; the argument here is unaffected.)
|
||||
checked, and the `skill-frontmatter` hook has since been removed as well — its required-field
|
||||
checks were folded into `skill-size-check`, and the enforcer is now
|
||||
`scripts/skill-size-check.sh:324-335` under the `skill-size-check` hook at
|
||||
`.pre-commit-config.yaml:237`. The argument here is unaffected either way: a dedicated
|
||||
non-Vale tool still owns required frontmatter fields.)
|
||||
Duplicating those concerns as Vale rules would fight tools that already own them better.
|
||||
|
||||
**Governance docs are excluded as a rule source.** `docs/research/governance_principles/CONTROLS.md`
|
||||
|
||||
@@ -27,6 +27,16 @@ them by name — and the argument-free `entry:` contract is untouched. Read the
|
||||
sync-check paragraph, and the `tests/test-vale-wrap.sh` Consequences bullet below as the state this
|
||||
ADR established, not as current layout.
|
||||
|
||||
**Amended (2026-09-16): the `.pre-commit-hooks.yaml` export and its release tags are retired.**
|
||||
The runtime half of this ADR — Vale config, styles and wrapper bundled inside the skill (now
|
||||
`factory-audit`), self-located from `${BASH_SOURCE[0]}` — stands. The external git-hook/CI half does
|
||||
not: the manifest, `check-release-needed` and the tag-cutting consequence are gone. See
|
||||
[the amendment at the end of this file](#amendment-2026-09-16-the-external-hook-contract-is-retired)
|
||||
before reading any paragraph above or below that names `.pre-commit-hooks.yaml`, a `rev:` tag,
|
||||
`check-release-needed`, case 33, or the two exported hook IDs as current. That includes the
|
||||
ADR-0025 amendment directly above: case 33 is deleted (its one-plugin narrowing guard is now a
|
||||
property of case 32), and no external consumer pins the exported hook IDs any more.
|
||||
|
||||
`skill-audit`/`agent-audit`'s Step 1 called
|
||||
`"$(git rev-parse --show-toplevel)/scripts/vale-wrap.sh" --config "$(git rev-parse --show-toplevel)/.vale.ini"`
|
||||
— which resolves to whichever repo the skill happens to be running in. Inside `ai-development`
|
||||
@@ -219,3 +229,72 @@ only when the original span is already two or more lines, so the pad count stays
|
||||
`tests/test-vale-wrap.sh` case 20 asserts an apostrophe-bearing token actually fires on a flattened
|
||||
description in all three apostrophe-carrying branches, and case 20b pins the pad arithmetic against
|
||||
a body line's true line number.
|
||||
|
||||
## Amendment (2026-09-16): the external hook contract is retired
|
||||
|
||||
Root `.pre-commit-hooks.yaml`, `scripts/check-release-needed.sh`,
|
||||
`tests/test-check-release-needed.sh` and `tests/test-vale-hooks-consumer.sh` are deleted, and the
|
||||
`check-release-needed` pre-push hook is removed from `.pre-commit-config.yaml`. The three exported
|
||||
hook IDs — `kyberforge-vale-audit-skill`, `kyberforge-vale-audit-agent` and
|
||||
`kyberforge-skill-size-check` — no longer exist, and no new `vX.Y.Z` tag is cut when hook files
|
||||
change. (Simplification audit finding 36.)
|
||||
|
||||
Three reasons, any one of which would have been enough to ask the question:
|
||||
|
||||
- **No consumer was found.** The Gitea instance holds two repos. The other one pins seven hook
|
||||
repos, and none of them is this one. None of the 13 commits that touched the mechanism came from a
|
||||
consumer report; all were found by this repo's own tests. Clones outside the instance cannot be
|
||||
counted, but ADR-0024 accepted the same standard when it deleted the mirror.
|
||||
- **The mechanism was already failing at its one job.** `scripts/skill-size-check.sh` changed on
|
||||
`main` after `v2.0.1`, and no tag was cut, so a consumer pinning `rev: v2.0.1` already ran a
|
||||
stale hook. The gate could not have caught it. It acted only when pre-commit reported a push to
|
||||
`refs/heads/main`, and PRs here merge through Gitea's server-side merge button, which runs no
|
||||
local hook. The script's own header said that closing the gap needed a server-side CI job the
|
||||
repo does not have.
|
||||
- **The README already contradicted it.** Its "For external consumers" section says apm is the only
|
||||
supported install path and never mentions `.pre-commit-hooks.yaml` or `rev:` pinning.
|
||||
|
||||
**What is unaffected.** This repo's `repo: local` hooks — `skill-size-check`,
|
||||
`vale-audit-prefilter-skill` and `vale-audit-prefilter-agent` — were always wired separately from
|
||||
the export, so no internal lint coverage is lost. The two prefilter hook IDs stay separate for the
|
||||
file-scope reason in "One hook per file-scope" above, not for an external contract.
|
||||
`tests/test-vale-wrap.sh` case 33, the cross-manifest `files:` drift check that ADR-0025 ported,
|
||||
went with the manifest it compared against. Its one guard that did not need a second manifest, a
|
||||
local regex narrowed to a single plugin, is now a third property of case 32. The `v1.0.0`, `v2.0.0`
|
||||
and `v2.0.1` tags are left in place. They are inert: nothing reads them, and apm's `per_package`
|
||||
versioning never consults `tagPattern`.
|
||||
|
||||
**What is preserved for a return.** The `entry[0]`-only constraint in the Consequences above, and
|
||||
its incident records at `LESSONS.md:101` and `:105`, stay as written. That constraint says a
|
||||
published entry is a bare script path, with every bundled file located from `${BASH_SOURCE[0]}`,
|
||||
and it took three review rounds to find. Both hook scripts still meet it: `vale-wrap.sh` takes no
|
||||
`--config`, and `skill-size-check.sh` keeps its embedded resolver copy. If a consumer appears,
|
||||
restore the manifest under that constraint, and restore `test-vale-hooks-consumer.sh` with it: it
|
||||
was the only test that exercised the entry-resolution path that once shipped broken. Restore a
|
||||
release gate only once a server-side job can run it on merge.
|
||||
|
||||
**Correction (2026-09-16, later the same day).** The paragraph above is wrong about
|
||||
`skill-size-check.sh`. `ef27c97` removed its embedded resolver copy: the hook now sources
|
||||
`plugins/kyberforge/.apm/skills/factory-audit/scripts/lib-boundary-resolver.sh` by path and fails
|
||||
closed without it (ADR-0020's 2026-09-16 amendment; `docs/spec/gates.md`, "Duplicated constants").
|
||||
|
||||
**Amended (2026-09-20): that is not a consumer-facing defect.** The correction above went on to say
|
||||
that a consumer's checkout has no such file, so restoring the manifest would ship a hook that fails
|
||||
for every consumer. Reproduced and found false. pre-commit's `script` language clones the **whole**
|
||||
hook repo into its store and prefixes `entry[0]` with the clone directory: `clientlib.py` maps
|
||||
`script` to `unsupported_script`, whose `run_hook` does `cmd = (prefix.path(cmd[0]), *cmd[1:])` over
|
||||
`Prefix(store.clone(...))`, and `store.clone` checks out the full tree — shallow in depth, not in
|
||||
content. `skill-size-check.sh` locates the library from `${BASH_SOURCE[0]}`
|
||||
(`scripts/skill-size-check.sh:481-483`), which points into that same clone, so
|
||||
`../plugins/kyberforge/.apm/skills/factory-audit/scripts/lib-boundary-resolver.sh` resolves beside
|
||||
it. Verified end to end against pre-commit 4.6.1 with a probe hook of the same shape — bare script
|
||||
entry, sibling file reached by climbing out of `scripts/` — and the file was found and sourced. Both
|
||||
hook scripts therefore still meet the `entry[0]`-only constraint: `vale-wrap.sh` takes no `--config`,
|
||||
and `skill-size-check.sh` passes no argv of its own. A return needs no re-embedding; restore
|
||||
`test-vale-hooks-consumer.sh` with the manifest, extended to cover the sourced library, so the claim
|
||||
stays checked rather than reasoned about.
|
||||
|
||||
**Superseded statements elsewhere.** ADR-0022's notes that the version-bump gate "is not exported
|
||||
through `.pre-commit-hooks.yaml`" and that it shares its gaps with `check-release-needed`, and
|
||||
ADR-0025's point 5 ("Both exported Vale hook IDs survive unchanged") and its case-33 port, describe
|
||||
the state before this amendment.
|
||||
@@ -5,6 +5,12 @@ their authoring source; `.claude-plugin/marketplace.json` and every plugin's `pl
|
||||
`apm pack`-compiled output. **Supersedes ADR-0001** ("Skills are distributed via plugins... each
|
||||
plugin contains its own `skills/` directory") — in effect.
|
||||
|
||||
**Correction (2026-09-20): the present tense above has expired for `plugin.json`.** ADR-0024 made
|
||||
apm the only supported install path and deleted per-plugin `plugin.json` with the native install
|
||||
support that needed it. No plugin carries one at `HEAD` — `git ls-files | grep -c 'plugin\.json'`
|
||||
returns 0 — so `.claude-plugin/marketplace.json` is the only `apm pack`-compiled output left. Read
|
||||
the Status line as the state at execution, 2026-08-12.
|
||||
|
||||
This repo replaces its hand-maintained Claude Code plugin/marketplace authoring model
|
||||
(`.claude-plugin/marketplace.json` + per-plugin `plugin.json`) with Microsoft APM (`apm.yml` +
|
||||
`.apm/`) as the authoring source of truth — an outright replacement of the authoring layer, not an
|
||||
@@ -93,6 +99,13 @@ correction) sorted what they document into three buckets:
|
||||
because of hand-authored dual manifests (ADR-0006's version-parity/patch-bump rule, the
|
||||
CC-vs-Copilot field-placement split, dual-file mirroring) are obsolete under `apm.yml`'s
|
||||
single-manifest model and were deliberately dropped.
|
||||
> **Correction (2026-09-19):** "ADR-0006's version-parity/patch-bump rule" misattributes the
|
||||
> patch-bump half. ADR-0006 states a version-*parity* rule and nothing about patch bumps — the
|
||||
> string `patch` does not appear in it (`git show origin/main:docs/adr/0006-plugin-version-parity.md`).
|
||||
> Only the parity half was ADR-0006's, and only that half was dropped. A patch-bump rule does
|
||||
> exist and is live: `plugins/kyberforge/.apm/skills/apm-workflow/references/configure.md` —
|
||||
> bump a package's own `apm.yml` `version:` whenever anything reaching its compiled output
|
||||
> changes. ADR-0024 §4 repeated this misattribution and is corrected there too.
|
||||
- **Holocron policy choice — resolved in #90.** `marketplace-author`'s catalog-version convention
|
||||
(minor bump for package add/remove, patch bump for field-only updates) isn't an APM mechanic —
|
||||
`apm` doesn't enforce it, and has no native version-bump automation at all — so rather than
|
||||
@@ -173,7 +186,11 @@ correction) sorted what they document into three buckets:
|
||||
`git ls-remote`, which is why two pre-push hooks needed the network (see `AGENTS.md`).
|
||||
**Superseded 2026-09-13:** the `mattpocock-skills` entry has been removed from root `apm.yml`
|
||||
entirely, along with the `codex` marketplace output profile. No pre-push hook needs the network
|
||||
any longer.
|
||||
any longer — **once `apm install` has populated `apm_modules/`**. The guarantee is a property of a
|
||||
populated install, 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 holocron remote (`README.md:89`; `docs/spec/gates.md`, "Pushing without a
|
||||
network").
|
||||
- **Caveat on "Status: executed" above:** issue #90's own execution comment flagged, before merge,
|
||||
that Claude Code's ability to actually load content out of `.apm/` was unverified — that caveat
|
||||
turned out to be a real defect, not a formality: the native installer has zero awareness of
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# Plugin-scope agent-author omits `tools:` and all Claude-only fields from `.apm/agents/*.agent.md`
|
||||
|
||||
**Amended by ADR-0025 (2026-09-15).** `agent-audit` was removed and its flow merged with
|
||||
`skill-audit`'s into `factory-audit`, which dispatches to a skill flow and an agent flow at Step 0.
|
||||
Read `agent-audit` below as `factory-audit`'s agent flow, and `validate.sh` as that flow's
|
||||
validator. The decision is unchanged — plugin-scope `.apm/agents/*.agent.md` still carries only the
|
||||
allowlisted fields, and the allowlist is still read as data from a reference file, now
|
||||
`factory-audit/references/agent-field-inventory.md`. The present-tense skill names below are
|
||||
updated accordingly.
|
||||
|
||||
This ADR is a narrower, downstream consequence discovered while designing issue #89's
|
||||
implementation under ADR-0015's broader direction (Microsoft APM replaces hand-authored
|
||||
plugin/marketplace authoring). It does not restate ADR-0015's rationale — see that ADR for
|
||||
@@ -47,8 +55,8 @@ Absent `tools:` means inherit-all-tools on both harnesses — the one value that
|
||||
on either target, unlike a present, harness-specific value that is guaranteed wrong on at least
|
||||
one of them.
|
||||
|
||||
`agent-audit`, at plugin scope, is intended to flag — as a **SUGGESTION**, not a FAIL, since
|
||||
this is an upstream schema limitation rather than an authoring mistake — any agent whose
|
||||
`factory-audit`'s agent flow, at plugin scope, is intended to flag — as a **SUGGESTION**, not a
|
||||
FAIL, since this is an upstream schema limitation rather than an authoring mistake — any agent whose
|
||||
description or body implies a need for tool restriction or a Claude-only behavior the
|
||||
frontmatter can no longer express. This would give visibility into the gap without pretending
|
||||
the schema can do something it can't. **Not yet implemented**: `check_apm_agent_file()` in
|
||||
@@ -71,7 +79,7 @@ write Claude's space-separated `tools:` string. Rejected because it ships a valu
|
||||
silently wrong (or possibly a hard error) on Copilot, and which harness "wins" would be an
|
||||
arbitrary, undocumented asymmetry.
|
||||
|
||||
**Same as above, but `agent-audit` flags the cross-harness breakage as a tracked finding
|
||||
**Same as above, but `factory-audit` flags the cross-harness breakage as a tracked finding
|
||||
(rejected).** Rejected for the same core reason — it still ships a wrong value to a real
|
||||
harness. Tracking the breakage doesn't prevent it, and the chosen decision already gets
|
||||
equivalent visibility (a SUGGESTION finding) without ever shipping the wrong value in the first
|
||||
@@ -141,7 +149,7 @@ admitted as the portable-by-construction half of what was lost. It restores a re
|
||||
confirmed write fence against the tool-call path, not a complete write sandbox. The consequence
|
||||
below is narrowed accordingly.
|
||||
|
||||
Enforcement follows the decision: `agent-audit`'s plugin-scope validator reads its allowlist as
|
||||
Enforcement follows the decision: `factory-audit`'s plugin-scope validator reads its allowlist as
|
||||
data from the `apm-agent-allowlist` section of
|
||||
`plugins/kyberforge/.apm/skills/agent-audit/references/field-inventory.md` (now
|
||||
`factory-audit/references/agent-field-inventory.md`, see ADR-0025), and that line now reads
|
||||
@@ -161,9 +169,9 @@ whether a field is safe under verbatim copy in a single vendor-neutral file.
|
||||
Plugin scope is now "directory containing `apm.yml` → single vendor-neutral file lands in
|
||||
`<root>/.apm/agents/`." Project and user scope, and the rest of ADR-0005, are unaffected.
|
||||
- **ADR-0008 is partially superseded** — its counterpart-derivation/pair-validation mechanism
|
||||
no longer applies at plugin scope; `agent-audit` takes the single file directly there. Project
|
||||
no longer applies at plugin scope; `factory-audit` takes the single file directly there. Project
|
||||
and user scope, where a real pair still exists, are unaffected.
|
||||
- **ADR-0009 is not superseded.** The mechanism it established — `agent-audit` reading field
|
||||
- **ADR-0009 is not superseded.** The mechanism it established — `factory-audit` reading field
|
||||
lists from `references/field-inventory.md` (now
|
||||
`factory-audit/references/agent-field-inventory.md`, see ADR-0025) rather than hardcoding them,
|
||||
with a `source_keys`
|
||||
|
||||
@@ -19,7 +19,7 @@ for the parent decision. It resolves the one question ADR-0015's own execution f
|
||||
did not block on: whether Claude Code's installer can actually load content out of `.apm/`. It
|
||||
could not.
|
||||
|
||||
**Status: executed (2026-08-13, issue #90).** `scripts/sync-plugin-content.sh` has been run
|
||||
**Status: superseded by ADR-0024** (originally executed 2026-08-13, issue #90; the text below is the record of that execution). `scripts/sync-plugin-content.sh` has been run
|
||||
against all 6 plugins; flat `agents/`, `skills/`, `commands/` (etc., wherever `.apm/` populates
|
||||
them), and a merged hooks file now exist at each plugin root as tracked, generated files. The
|
||||
merged hooks file lands at `hooks/hooks.json`, not at the plugin root itself — see the second
|
||||
|
||||
@@ -75,12 +75,23 @@ to end, reintroduced through the mechanism meant to secure it.
|
||||
Matching is an exact dictionary lookup on the composed `name#version` string
|
||||
(`apm_cli/security/executables.py`, `is_package_approved`), so there is no wildcard or
|
||||
version-less key that would sidestep this — the key has to be edited on every bump, and the
|
||||
question is only what catches a missed edit. 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, parsing `version:` out of
|
||||
`plugins/kyberforge/apm.yml` and asserting root `apm.yml` carries the matching
|
||||
`kyberforge#<version>` key. The comment stays as the human-facing pointer; the hook is what
|
||||
question is only what catches a missed edit.
|
||||
|
||||
> **Correction (2026-09-19):** the mechanism above is wrong for apm 0.28.0, verified in source.
|
||||
> `is_package_approved` is an exact lookup, but `install/exec_gate.py` calls it across a candidate
|
||||
> list that includes the version-blind name, `materialize_exec_map` stores each approved key under
|
||||
> its version-blind name too, and `_map_grants` matches exact key, version-blind name, or any stored
|
||||
> key sharing that name. So approving `kyberforge#2.0.0` keeps covering `kyberforge#2.1.0`: a bump
|
||||
> does not silently stop the hook deploying. Whether apm behaved this way when this ADR was written
|
||||
> was not established. **The decision stands** — `scripts/check-executables-allow-sync.sh` is now
|
||||
> 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.
|
||||
|
||||
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,
|
||||
parsing `version:` out of `plugins/kyberforge/apm.yml` and asserting root `apm.yml` carries the
|
||||
matching `kyberforge#<version>` key. The comment stays as the human-facing pointer; the hook is what
|
||||
actually holds. It parses with PyYAML where importable and falls back to a two-shape scan
|
||||
otherwise, so a missing pip package cannot become the thing that blocks every push.
|
||||
|
||||
@@ -124,6 +135,10 @@ was below the 360 s the script can legitimately take. A test asserts the invaria
|
||||
literal — it parses every `timeout N` out of the script, sums them, and requires the `hooks.json`
|
||||
value to be larger — so changing either side without the other fails the suite.
|
||||
|
||||
> **Amendment (2026-09-16) — the refresh is slower than first measured, still inside the budget.**
|
||||
> Re-measured: ~24–26 s for the same six-behind refresh, warm, on a LAN remote — well inside the
|
||||
> 380 s above.
|
||||
|
||||
**Reading a human-readable CLI for a control decision cost a silent failure, again.** `apm outdated`
|
||||
has no `--json` or other machine-readable flag (confirmed against 0.28.0), so the hook must match
|
||||
its prose. The first attempt matched `outdated dependencies found` — plural only. apm emits
|
||||
@@ -141,10 +156,51 @@ via `url.<path>.insteadOf`, so the twelve-hooks-pass-under-`unshare -rn` propert
|
||||
the real `apm outdated`, and replays its genuine output through the real hook. Reverting the grep
|
||||
to plural-only fails it.
|
||||
|
||||
> **Correction (2026-09-20):** neither half of "the twelve-hooks-pass-under-`unshare -rn` property"
|
||||
> is accurate. The count was never twelve: `main` declares 14 pre-push hooks and `HEAD` declares 8 —
|
||||
> 10 counting the two `repo: meta` hooks, which set no `stages` and so run at every stage. And the
|
||||
> property is conditional, not absolute: no pre-push hook needs the network **once `apm install` has
|
||||
> populated `apm_modules/`**, but on a fresh clone `apm-audit-ci`'s `deployed-files-present` fails
|
||||
> outright and its `drift` and `config-consistency` install-replays clone from the holocron remote
|
||||
> (`README.md:89`; `docs/spec/gates.md`, "Pushing without a network"). What the probe itself
|
||||
> establishes is unchanged and is the point of the sentence: staging the outdated dependency against
|
||||
> a local git remote via `url.<path>.insteadOf` adds no network call of its own.
|
||||
|
||||
**The hook cannot install itself.** Dependencies resolve from the remote, so the hook does not
|
||||
deploy until this change is merged and `apm update` has run once against the new default branch.
|
||||
Until then the repo has the mechanism in source and not in effect.
|
||||
|
||||
> **Amendment (2026-09-16) — on a feature branch, the refresh installs `main`, not the branch.**
|
||||
> Recorded after it happened. The dependencies resolve against the remote default branch, so a
|
||||
> session opened on a branch that changes `plugins/` loads `main`'s content, refreshed or not — a
|
||||
> branch's own `.apm/` edits are live only once they are on the remote's `main`. Content the
|
||||
> branch *removes* comes back in the deployed install: on `docs/simplification-audit` a refresh
|
||||
> redeployed `main`'s `skill-audit` and `agent-audit` over the branch's merged `factory-audit`, and
|
||||
> re-materialised `main`'s `plugins/bin/.mcp.json` into `apm_modules/`, so the gitignored root
|
||||
> `.mcp.json` regained the `obsidian` server the branch deleted — invisible to `git status`.
|
||||
> Skipping the refresh off the default branch was considered and rejected: it would not make the
|
||||
> branch live, only freeze the session on an older `main` — the silent staleness this ADR exists to
|
||||
> prevent. The redeployed content goes away once the branch merges. For the server, the next
|
||||
> `apm update` or `apm install` that resolves a tree no longer declaring it removes it from
|
||||
> `.mcp.json`: both commands call `MCPIntegrator.remove_stale` for every server listed under the
|
||||
> lock's `mcp_servers` that no dependency declares any more (`apm_cli/install/mcp/integration.py`).
|
||||
>
|
||||
> The rewritten `apm.lock.yaml` is a separate matter. It records `main`'s current tip, but the
|
||||
> branch's committed lock records a `main` commit too, just an older one, so committing the
|
||||
> rewrite would not swap the branch for `main`. On a feature branch, discard it anyway
|
||||
> (`git checkout -- apm.lock.yaml`, then `apm install`), for two reasons. First, it keeps lock
|
||||
> churn that has nothing to do with the branch out of the branch's diff. Second, it keeps the
|
||||
> deployed tree consistent with the committed lock that the `apm-pack-check-clean` pre-push hook
|
||||
> reads. In this repo `apm pack` builds a bundle from the lock before its `--check-clean` gate
|
||||
> runs, and it stops with a build error ("deployed files are missing on disk -- run 'apm
|
||||
> install'") when a file the lock lists is absent (`apm_cli/bundle/packer.py`, `pack_bundle`).
|
||||
> A refresh leaves the tree in that state whenever the newer `main` dropped a file the older lock
|
||||
> still lists. Under `--dry-run` it checks only that each file exists, not its content hash. The
|
||||
> cost of discarding is real: the session then runs the older `main` that the lock records, which
|
||||
> is the staleness the rejected skip would have caused. That cost is accepted on a feature branch,
|
||||
> and it does not last. At the next session start the hook finds the restored lock behind `main`
|
||||
> and refreshes again.
|
||||
|
||||
**`.claude/settings.json` stops being `{"hooks": {}}`.** apm merges the hook into it and tracks
|
||||
ownership in a `.claude/apm-hooks.json` sidecar, with the script copied to
|
||||
`.claude/hooks/<pkg>/`. The sidecar and the script directory are gitignored install output; the
|
||||
@@ -152,6 +208,16 @@ settings file remains committed, now with apm-generated content in it. ADR-0018'
|
||||
committed content is exactly `{"hooks": {}}` is superseded on that point only — the rule it was
|
||||
protecting, that nothing repo-authored goes in that file, is unchanged.
|
||||
|
||||
> **Correction (2026-09-16) — the sidecar is committed, not ignored.** apm keeps no ownership marker
|
||||
> inside `settings.json`; it recognises its own entries by matching them against
|
||||
> `.claude/apm-hooks.json`, then replaces them. With the sidecar gitignored, a fresh clone holds the
|
||||
> committed `SessionStart` entry but no sidecar, so `apm install` treats the entry as user-owned,
|
||||
> keeps it, and adds its own identical copy. `apm audit --ci` then reports `settings.json` drift and
|
||||
> the `apm-audit-ci` pre-push hook fails. Reproduced on `main` (`a712f2c`) and on this branch with
|
||||
> apm 0.28.0; committing the sidecar makes the install idempotent and the audit pass. The sidecar
|
||||
> 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.
|
||||
|
||||
**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,
|
||||
|
||||
@@ -21,12 +21,23 @@ SHARED BOUNDARY RESOLVER` markers, and one plugin copy — extracted out of the
|
||||
both. `validate-provenance.sh` is not a third reader: it sources `lib-contributing-files.sh` and one
|
||||
of `lib-provenance-skill.sh`/`lib-provenance-agent.sh`, and never touches the resolver at all. The
|
||||
Enforcement table's "constants mirrored in `skill-audit/scripts/validate.sh` and
|
||||
`agent-audit/scripts/validate.sh`" is one path now, `factory-audit/scripts/validate.sh`, which
|
||||
auto-detects the artifact type; the skills/agents columns are unaffected, since the merged validator
|
||||
applies the body tiers on the skill path only. The two copies must still stay byte-identical — a
|
||||
`agent-audit/scripts/validate.sh`" now means `factory-audit/scripts/lib-checks-skill.sh:313-316`
|
||||
(all four constants) and `lib-checks-agent.sh:164-165` (the two description ones). It does **not**
|
||||
mean `factory-audit/scripts/validate.sh`, which holds none of them: `validate.sh` auto-detects the
|
||||
artifact type and sources the matching check suite (`validate.sh:231-233`, `:244-246`). The
|
||||
skills/agents columns are unaffected — only the skill suite carries the body tiers. The two copies
|
||||
must still stay byte-identical — a
|
||||
plugin script cannot source the root one, which is why a second copy exists at all. Read every
|
||||
"three" below as the count at the time of writing.
|
||||
|
||||
**Amended again (2026-09-16): one copy.** `scripts/skill-size-check.sh` no longer embeds the
|
||||
resolver. It sources `factory-audit/scripts/lib-boundary-resolver.sh` by path and fails closed if the
|
||||
library is missing or defines no resolver. The embedded copy had been kept only because the hook was
|
||||
also exported through `.pre-commit-hooks.yaml`, whose consumers could not reach a file inside the
|
||||
plugin; `4de5b6b` retired that export (ADR-0014), so the hook runs only inside this repo. The
|
||||
"byte-identical" sentence above is superseded: there is nothing left to keep identical, and
|
||||
`tests/test-adr0020-contract.sh` assertion 1 now pins the single copy instead of hashing a pair.
|
||||
|
||||
## Context
|
||||
|
||||
Every `file:line` citation in this ADR is against the base commit the decision was taken on,
|
||||
@@ -108,6 +119,12 @@ clause**, and a **boundary clause**. Capability enumeration, output-format detai
|
||||
("composes X rather than duplicating Y"), and implementation detail move to the body or to
|
||||
`README.md`.
|
||||
|
||||
**Correction (2026-09-20): not `README.md`.** The canonical destination for description overflow is
|
||||
"the body or a `references/` file" (`plugins/kyberforge/.apm/skills/skill-author/references/contract.md:35`).
|
||||
A skill-root `README.md` is no longer somewhere overflow can go: all 39 of them were deleted, and
|
||||
`factory-audit/references/skill-file-structure.md:23` now FAILs a non-spec file at the skill root,
|
||||
which a `README.md` is. Read every "or to `README.md`" below as "or to a `references/` file".
|
||||
|
||||
- **250 characters SUGGESTION, 400 FAIL.** The agentskills.io 1,024-character limit remains as an
|
||||
unchanged spec backstop. The SUGGESTION tier is what moves the average; the FAIL tier only stops
|
||||
outliers.
|
||||
@@ -276,8 +293,8 @@ which tier each rule is in, because the failure this ADR is most exposed to is a
|
||||
|
||||
| Check | Applies to | Tier | Home |
|
||||
|---|---|---|---|
|
||||
| description characters (250 SUGGESTION † / 400 FAIL) | skills, agents | deterministic | `scripts/skill-size-check.sh`; constants mirrored in `skill-audit/scripts/validate.sh` and `agent-audit/scripts/validate.sh` |
|
||||
| body-only words (600 SUGGESTION / 900 FAIL) | skills | deterministic | `skill-size-check.sh`, `skill-audit/scripts/validate.sh` (now `factory-audit/scripts/validate.sh`, see ADR-0025) |
|
||||
| description characters (250 SUGGESTION † / 400 FAIL) | skills, agents | deterministic | `scripts/skill-size-check.sh`; constants mirrored in `skill-audit/scripts/validate.sh` and `agent-audit/scripts/validate.sh` (now `factory-audit/scripts/lib-checks-skill.sh:313-314` and `lib-checks-agent.sh:164-165`, see the ADR-0025 amendment — **not** `factory-audit/scripts/validate.sh`, which holds no constants) |
|
||||
| body-only words (600 SUGGESTION / 900 FAIL) | skills | deterministic | `skill-size-check.sh`, `skill-audit/scripts/validate.sh` (now `factory-audit/scripts/lib-checks-skill.sh:315-316`, see the ADR-0025 amendment) |
|
||||
| description present and non-empty (ERROR) | skills, agents | deterministic | same |
|
||||
| boundary target resolves to a real skill or agent — **three** verdicts, not two (ERROR when written in route notation — `/name`, or any arrow form; or when a *terminal* bare name's own sentence names another target that resolves. SUGGESTION otherwise. INFO, "DID NOT RUN", exit 0, when no skill universe could be determined for the path at all — no authoring root above it, no apm package root, no declared apm dependencies, no deployed `.claude/` or `.agents/` tree: the targets are named and left unchecked) | skills, agents | deterministic | same |
|
||||
| boundary clause absent — `absent` (SUGGESTION) † | skills, agents | deterministic | same |
|
||||
@@ -489,7 +506,12 @@ flow all remain. Cache isolation makes them structurally unavoidable
|
||||
(`skill-audit/SKILL.md:95` forbids cross-skill references; `LESSONS.md:107` records why), so the
|
||||
options are a sync gate or continued drift. This is an input to issue #101, which carries both halves
|
||||
of the kyberforge duplication problem — the deferred audit-pair merge and this — not a solved
|
||||
problem.
|
||||
problem. *Amended 2026-09-16: decided — continued drift, no sync gate. The measured overlap (about
|
||||
150–180 lines, 36 of them shared Description prose; see the rejected alternative below and ADR-0025
|
||||
point 7) does not justify a text-sync gate, so the author-pair duplication stays unguarded by
|
||||
decision. With the audit pair merged by ADR-0025, both halves of #101 are settled. The
|
||||
`skill-audit/SKILL.md:95` citation above is historical; the cross-skill reference rule now lives in
|
||||
`factory-audit`'s `references/skill-file-structure.md`, which allows only the possessive form.*
|
||||
|
||||
**Provenance frontmatter is explicitly out of scope.** `LESSONS.md:63` asserts that non-routing
|
||||
frontmatter (`source_keys`, `category`, `version`) is loaded at agent startup, which would make the
|
||||
@@ -535,6 +557,10 @@ Upstream citations below are relative to
|
||||
Largest cut available. Rejected because it reopens ADR-0005, ADR-0008 and ADR-0016 together, and a
|
||||
merged author skill would carry both the skill-directory scaffold and the dual-provider agent
|
||||
scaffold behind one dispatch.
|
||||
**Measured (2026-09-16):** the pair shares about 150–180 distinct non-blank lines — 36 in
|
||||
`contract.md` (of 205 / 126), 13 in `SKILL.md`, 14 in `improve.md`, 48 in the two scaffold
|
||||
scripts — against the 2,934 that the audit-pair merge removed. The rejection holds; simplification
|
||||
audit finding 15 is refuted on this basis.
|
||||
- **Demoting Gotchas** to the end of the body or into `references/gotchas.md`, removing its
|
||||
position-based exemption from the dispatch rule. Maximum saving on the largest body construct
|
||||
(6,830 words, 21% of all body text). Rejected because a gotcha read after the mistake is worthless.
|
||||
@@ -18,6 +18,9 @@ file, `.claude-plugin/marketplace.json`. Read the "four generated files" in Cont
|
||||
generated files" in Consequences as historical counts, true when written. The blast radius shrank;
|
||||
the staleness hazard that motivated this ADR did not.
|
||||
|
||||
**Amended 2026-09-16:** the root `marketplace.packages[]` copy of each description was removed; the
|
||||
package `apm.yml` is now the single source. See the amendment before Consequences.
|
||||
|
||||
## Context
|
||||
|
||||
A plugin's published description is one string authored twice — in `plugins/<name>/apm.yml` and in
|
||||
@@ -82,7 +85,15 @@ unnamed in `git`'s corrected description, though `65bac15`'s own commit message
|
||||
`gitea`'s. Across the three plugins, 23 of 27 skills are named at the third attempt.
|
||||
|
||||
**Nothing checks any of this.** `scripts/check-manifests.sh` does not contain the string
|
||||
`description`. The three ADR-0020 validators (`scripts/skill-size-check.sh` and skill-audit's and
|
||||
`description`.
|
||||
|
||||
**Correction (2026-09-19): that script no longer exists.** `e647f14` deleted
|
||||
`scripts/check-manifests.sh` (282 lines), `tests/test-check-manifests.sh` (771 lines) and the
|
||||
`check-manifests` pre-commit hook entry with them. The conclusion is unchanged and now holds a
|
||||
fortiori: the gate that did not read `description:` is gone, so nothing in its place reads it
|
||||
either.
|
||||
|
||||
The three ADR-0020 validators (`scripts/skill-size-check.sh` and skill-audit's and
|
||||
agent-audit's `validate.sh` — two since ADR-0025 merged the audit pair into `factory-audit`, whose
|
||||
single auto-detecting `validate.sh` carries both) gate on SKILL.md and agent frontmatter; they do open `apm.yml`, but only
|
||||
to read `dependencies.apm` when resolving the boundary-target universe — none of them reads the
|
||||
@@ -92,17 +103,20 @@ output against `apm.yml`, so their entire job is to propagate whatever the descr
|
||||
those four files byte-for-byte and confirm they match. The `wiki` claim passed every one of the fourteen pre-push hooks, every day it
|
||||
was published.
|
||||
|
||||
**Correction (2026-09-14): that gate list is down to one, and it was never two.**
|
||||
**Correction (2026-09-14): that gate list is down to two.**
|
||||
`scripts/sync-plugin-content.sh --check --all` does not exist — `718c79a` deleted the script and its
|
||||
`check-plugin-content-sync` hook with the flat mirror (ADR-0024). Of the two names left,
|
||||
`apm audit --ci` was never a drift gate at all: against this repo it checks only that each `apm.yml`
|
||||
parses and that a manifest declaring dependencies has a consistent `apm.lock.yaml`, and it reads no
|
||||
`description`. So the sole surviving gate that compares compiled output against `apm.yml` is
|
||||
`check-plugin-content-sync` hook with the flat mirror (ADR-0024). The other two survive.
|
||||
`apm audit --ci` at the repo root (apm 0.28.0) 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` and
|
||||
`drift` — and it *is* a drift gate: `drift` and `config-consistency` replay the install and diff the
|
||||
result against the working tree, and `content-integrity` scans for hidden Unicode and hash drift.
|
||||
(In a sub-package such as `plugins/lint` it runs one check, `lockfile-exists`.) The second is
|
||||
`apm pack --check-versions --check-clean --dry-run`, run by the `apm-pack-check-clean` pre-push hook
|
||||
— and with the per-plugin manifests gone it propagates a description into exactly one file,
|
||||
`.claude-plugin/marketplace.json`, not four. This narrows the mechanism and changes nothing about
|
||||
the finding: propagation is still not verification, and nothing anywhere reads the `description`
|
||||
key for sense.
|
||||
the finding: both gates compare bytes, neither reads the `description` key for sense, so propagation
|
||||
is still not verification.
|
||||
|
||||
**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
|
||||
@@ -203,6 +217,32 @@ sit inside ADR-0020's tiers; the tier would have been silent through all three f
|
||||
string, not a link — and the README's own plugin list carries the same enumeration with the same
|
||||
staleness, so this relocates the defect rather than fixing it.
|
||||
|
||||
## Amendment (2026-09-16): the root copy is removed — the package `apm.yml` is the single source
|
||||
|
||||
The Decision's rule that "the two copies … stay identical" is retired by removing the second copy.
|
||||
The six `description:` lines under root `apm.yml`'s `marketplace.packages[]` are deleted, the same way
|
||||
`2def060` deleted the six `version:` lines beside them. `plugins/<name>/apm.yml`'s `description:` is
|
||||
now the only place a package's published description is authored.
|
||||
|
||||
The rule's own justification — "the root entry is what reaches the compiled marketplace" — was true
|
||||
only while the root entry set the field. apm's Claude marketplace mapper resolves a local-path entry's
|
||||
`description` curator-first: the entry's value wins when present, and when it is absent the value is
|
||||
read from the package's own `apm.yml` (`apm_cli/marketplace/output_mappers.py`, the `is_local` branch
|
||||
calling `_apply_field_with_precedence` with `source_label="package apm.yml"`). The root copy was
|
||||
therefore an override, not a mirror. Nothing enforced the identity rule, and on drift apm silently
|
||||
published the root value. Removing the copy removes the drift rather than leaving it unchecked.
|
||||
|
||||
All six root copies were byte-identical to their package's `apm.yml` when they were removed. After
|
||||
the removal, `apm pack` regenerated `.claude-plugin/marketplace.json` with every `description` unchanged,
|
||||
and `apm pack --check-versions --check-clean --dry-run` passes. The consequence for the "unbounded
|
||||
obligation" in Context is that a description edit is now one edit, not two. The package version bump
|
||||
and the catalog patch bump it earns are unchanged
|
||||
(`plugins/kyberforge/.apm/skills/apm-workflow/references/configure.md`).
|
||||
|
||||
This applies to local-path (`source: ./…`) entries only. A remote entry has no local package
|
||||
`apm.yml` to fall back to. Its `description:`, when set, is still the published text, and when it
|
||||
is absent apm uses whatever its best-effort remote metadata fetch returns.
|
||||
|
||||
## Consequences
|
||||
|
||||
**Three descriptions are rewritten and the compiled output regenerated.** Eight generated files
|
||||
|
||||
@@ -54,6 +54,13 @@ per-plugin choice.
|
||||
`name:` or `description:`; a missing `metadata.version` is now the same class of failure, not a
|
||||
style nit an audit might or might not catch.
|
||||
|
||||
> **Correction (2026-09-20): that hook no longer exists.** `skill-frontmatter` was removed and its
|
||||
> required-field checks folded into `skill-size-check`. The enforcer is now
|
||||
> `scripts/skill-size-check.sh:324-335`, declared under the `skill-size-check` hook at
|
||||
> `.pre-commit-config.yaml:237`. It checks presence and three-part-semver shape, on the same
|
||||
> `SKILL.md` glob and at the same pre-commit stage, so the decision is unaffected — only the name
|
||||
> of the hook that holds it. The same substitution applies to the Consequences section below.
|
||||
|
||||
## Considered options
|
||||
|
||||
**Leave it per-plugin, document the split.** This was the initial framing of #127 and is coherent —
|
||||
@@ -67,6 +74,123 @@ it's asked, not one that varies by plugin domain.
|
||||
create/improve pass owes a bump, so the 12 skills carrying it are not tracking dead weight — removing
|
||||
it discards real revision signal for no gain.
|
||||
|
||||
## Amendment (2026-09-16): the bump is enforced at push, not only required to exist
|
||||
|
||||
Making the field mandatory did not make it move. The only thing that bumped it was `skill-author`
|
||||
Step 4, so every hand edit and every trim pass skipped the bump: on `docs/simplification-audit`, 17
|
||||
of the 40 skill directories that changed against `main` carried the same `metadata.version` as
|
||||
`main`, and `gitea` alone sat at six different values. Both validators —
|
||||
`scripts/skill-size-check.sh` (the pre-commit hook) and `factory-audit`'s
|
||||
`scripts/lib-checks-skill.sh` — checked presence and semver shape, never movement, so the field could not answer the question this ADR gives it — "did this
|
||||
change since I last read it". (Simplification audit finding 33.)
|
||||
|
||||
`scripts/check-skill-version-bump.sh` now runs as a pre-push hook on every push, whatever the
|
||||
target branch. It takes its baseline from the merge-base of the pushed commit with `origin/main`
|
||||
(local `main` if `origin/main` does not resolve). For each skill directory under
|
||||
`plugins/*/.apm/skills/` that differs between the pushed commit and that merge-base, ignoring
|
||||
`tests/`, the pushed `metadata.version` must be strictly greater than the version the skill had at
|
||||
the merge-base — not the version on `main`'s current tip. (The amendment below reverses that last
|
||||
choice: the pushed version must now also exceed `main`'s tip.)
|
||||
|
||||
The baseline is the merge-base, not the previous commit. Readers only ever see `main` — installs
|
||||
resolve against the default branch (ADR-0018) — so one bump per branch is what the field owes
|
||||
them. A per-commit check would bump a skill once per commit and inflate the number past meaning.
|
||||
The rule is "greater", not "exactly one patch higher", so a second `skill-author` pass on the same
|
||||
branch that bumps again still passes. `tests/` is excluded because no agent loads it; a
|
||||
fixture-only change does not change the skill. Skills absent from either side are exempt: new,
|
||||
renamed and merged skills start fresh under the rules above, and deleted skills have nothing to
|
||||
check. Every plugin is covered, `bin` included, and the gate is repo-local — it is not exported
|
||||
through `.pre-commit-hooks.yaml`.
|
||||
|
||||
The gate fails closed rather than passing when it has no trustworthy baseline: when neither
|
||||
`origin/main` nor `main` resolves, when the pushed commit shares no merge-base with it, and when
|
||||
only local `main` resolves and the pushed commit is that merge-base, since a local `main` the
|
||||
pushed commit already contains is no independent record of what shipped. It also fails closed when
|
||||
the pushed ref does not resolve to a commit, and when a `SKILL.md` the tree names cannot be read by
|
||||
`git show` or parsed by `python3` — a read failure is reported as such, never as a missing version.
|
||||
It reads versions with `python3` and PyYAML and fails with a clear message if either is missing.
|
||||
|
||||
Three alternatives were rejected. Declaring the field advisory is the cheapest, but concedes the
|
||||
field cannot do its job. Dropping the field was rejected by this ADR already, and costs more now.
|
||||
Checking at commit time against `HEAD` was rejected for the inflation described above.
|
||||
|
||||
The 17 unbumped skills took a patch bump in the commit that added the gate. A typo fix in a skill
|
||||
now costs a version bump; that is the rule working, not noise.
|
||||
|
||||
**Amended by ADR-0014 (2026-09-16).** `check-release-needed` is retired, so the comparison below
|
||||
records the state when this ADR was written, not a hook that still runs. See
|
||||
[ADR-0014's amendment](0014-vale-prefilter-ships-from-the-plugin.md#amendment-2026-09-16-the-external-hook-contract-is-retired).
|
||||
|
||||
The gate differs from `check-release-needed` in when it runs: that hook acts only when pre-commit
|
||||
reports a push to `main`, so a manual `pre-commit run --hook-stage pre-push` skips it, while this
|
||||
gate runs there too and checks `HEAD`. The two hooks share both known gaps. A merge made with
|
||||
Gitea's merge button runs no local hooks, so it is not checked. And pre-commit's pre-push
|
||||
integration checks only one ref of a multi-ref push (`git push origin a b`, `git push --all`).
|
||||
In pre-commit 4.6.1, `_pre_push_ns` in `hook_impl.py` skips delete lines and returns on the first
|
||||
remaining ref whose remote sha is non-zero and present locally; a ref whose remote sha is zero or
|
||||
unknown locally is returned only if it has commits that no remote-tracking ref of that remote has.
|
||||
Every later ref is pushed unchecked. When the returned ref's unpushed history reaches a root
|
||||
commit, pre-commit sets no `PRE_COMMIT_TO_REF` at all, so the gate checks `HEAD`, which is the
|
||||
pushed ref only if it is checked out.
|
||||
|
||||
## Amendment (2026-09-16): the pushed version must also exceed `main`'s tip
|
||||
|
||||
This reverses the choice above that the baseline is the merge-base "not the version on `main`'s
|
||||
current tip". A changed skill's pushed `metadata.version` must now be strictly greater than **both**
|
||||
its version at the merge-base and its version at the tip of `origin/main` (local `main` under the
|
||||
same fallback, with the same fail-closed rules).
|
||||
|
||||
The merge-base alone lets two branches ship two different changes under one version. Branches A and
|
||||
B both start from a skill at `1.0.0`, change it differently, and bump it to `1.0.1`. A merges. B's
|
||||
merge-base is still the `1.0.0` commit, so B passes, and the two `1.0.1` bumps are the same line
|
||||
change, so git merges B without a conflict. `main` then carries two different `1.0.1` contents, and
|
||||
the field again fails to answer "did this change since I last read it". Checking against the tip as
|
||||
well makes B fail until it bumps past `1.0.1`.
|
||||
|
||||
- **A skill absent at the tip** (deleted on `main` since the branch started) is held to the
|
||||
merge-base rule alone. **A skill absent at both** is new and stays exempt.
|
||||
- **When `main` has not moved since the merge-base**, the two baselines are the same commit and the
|
||||
skill is checked once.
|
||||
- **The failure names the baseline it missed**: `(not above merge-base)` or
|
||||
`(not above origin/main tip)`, one line per baseline missed.
|
||||
|
||||
The cost is that a branch behind `main` may have to bump again after another branch lands a bump
|
||||
on the same skill. That is the case the rule exists for, and rebasing onto or merging `main` first
|
||||
shows the version to beat. The rule reads `origin/main` as last fetched, so a tip that moved since
|
||||
the last fetch is not seen until the next one.
|
||||
|
||||
## Amendment (2026-09-20): two exemptions and a third failure form the rules above never stated
|
||||
|
||||
The carve-outs enumerated above read as a closed list, and the baseline above reads as a single
|
||||
merge-base. `scripts/check-skill-version-bump.sh` as shipped has two further exemptions and emits a
|
||||
third failure form. **The gate is right and is not changing; this ADR was behind it.** Its own header
|
||||
comments (`:9-93`) have described all three correctly since it shipped.
|
||||
|
||||
- **The baseline is `git merge-base --all`, not one merge-base.** A criss-cross history — `main`
|
||||
merges a branch while that branch merges a commit of `main` — has two merge bases, and which one
|
||||
`git merge-base` prints is an implementation detail. The script takes every base (`:154-157`) and
|
||||
**intersects** the changed-skill sets across them (`:203-217`): a skill matching any one base is
|
||||
already shipped by that base and is exempt, and a skill that does reach the comparison must exceed
|
||||
the version at every base it exists at (`:367-376`). Picking one base made the verdict a coin
|
||||
flip — an already-merged bump failed the push it should have passed.
|
||||
- **A skill whose directory tree object equals the tip's skips the tip comparison.**
|
||||
`same_subtree()` (`:288-297`, applied at `:334-337`) compares tree object ids rather than diffing:
|
||||
the same tree is the same content, whatever route the history took to it. A branch cut before a
|
||||
fix landed on `main` and then cherry-picking that fix has one merge-base, predating the fix, so the
|
||||
skill counts as changed against it and reaches the tip comparison carrying exactly the tip's
|
||||
version — same content, same version. The merge-base intersection catches that only when some base
|
||||
carries the content, which the criss-cross shape gives and a linear one does not. Without the skip
|
||||
the only escapes are a spurious bump, leaving `main` carrying two versions of identical content,
|
||||
or a rebase the push does not otherwise need.
|
||||
- **A third failure form.** The amendment above lists `(not above merge-base)` and
|
||||
`(not above origin/main tip)`. When there is more than one base, the merge-base line is
|
||||
sha-suffixed — `(not above merge-base <sha>)` (`:372`, against the unsuffixed `:374`) — because
|
||||
"which merge-base" is the one question a reader cannot answer from the branch alone.
|
||||
|
||||
`8cfd54f` recorded that "ADR-0022 is not amended: the documented behaviour does not change". That
|
||||
was wrong for the tree-identical case: the `same_subtree` skip makes a push **pass** that this ADR as
|
||||
written requires to **fail**, which is documented behaviour changing, not an implementation detail.
|
||||
|
||||
## Consequences
|
||||
|
||||
27 SKILL.md files gain `metadata.version: "1.0.0"`, and a 28th — `bin/write-docs` — reaches the same
|
||||
|
||||
@@ -13,6 +13,14 @@ ADR-0015. The root `marketplace:` block in `apm.yml` and the compiled
|
||||
`.claude-plugin/marketplace.json` it produces are **kept** — see "Also delete the marketplace
|
||||
catalogue" under considered options.
|
||||
|
||||
**Amended by ADR-0025 (2026-09-15).** The decision stands unchanged — apm is the only supported
|
||||
install path, and `.apm/` still ships the per-skill `tests/` directories this ADR accepted as
|
||||
dev-fixture leakage. What moved is **consequence 2's skill count**. `skill-audit` and `agent-audit`
|
||||
merged into `factory-audit`, collapsing two `.bats`-carrying skill directories into one, so the same
|
||||
10 `.bats` files now deploy across **5** skills, not the six counted here on 2026-09-14. The figure
|
||||
below is corrected in place; "all six `apm.yml` files" in the same paragraph counts plugins, not
|
||||
skills, and is unaffected.
|
||||
|
||||
## Context
|
||||
|
||||
ADR-0018 moved this repo's own consumption of its own plugins onto `apm install`. From that point
|
||||
@@ -35,8 +43,8 @@ What that audience costs is measurable:
|
||||
|
||||
Roughly 22,000 lines of tracked content and tooling, and about 92 seconds on every push (83 + 4.5 +
|
||||
4.9; the two hook timings are the 2026-09-10 baseline measurements recorded in
|
||||
`SIMPLIFICATION-AUDIT.md`, not re-measured here). The test alone is close to 30% of `run-tests`'
|
||||
wall time — the single largest item in it.
|
||||
`docs/notes/simplification-audit-2026-09.md`, not re-measured here). The test alone is close to 30%
|
||||
of `run-tests`' wall time — the single largest item in it.
|
||||
|
||||
**The native path's automated gate does not gate anything.** ADR-0017 cites
|
||||
`claude plugin validate --strict` passing on all six plugins as one of two verifications. That
|
||||
@@ -167,7 +175,7 @@ README note is the only available mitigation, and a note is not a gate.
|
||||
|
||||
**2. Consumers now receive dev-fixture files.** apm installs from `.apm/`, and `.apm/` contains the
|
||||
per-skill `tests/` directories the mirror explicitly stripped (ADR-0017's depth-scoped
|
||||
`<category>/<name>/tests` exclusion). 10 `.bats` files across 6 skills therefore now deploy into
|
||||
`<category>/<name>/tests` exclusion). 10 `.bats` files across 5 skills therefore now deploy into
|
||||
every consumer's skill directories. Suppressing them would mean switching all six `apm.yml` files
|
||||
from `includes: auto` to explicit include lists — and an explicit list that is wrong silently drops
|
||||
content, which is the same failure class ADR-0017 was written to fix. Trading a cosmetic problem for
|
||||
@@ -179,14 +187,15 @@ now discoverable in the install output and would otherwise be found and double-r
|
||||
they do not belong to — exactly the `apm_modules/` problem ADR-0018 recorded, arriving by a second
|
||||
route. Any future script that walks this repo's tree needs both exclusions.
|
||||
|
||||
**4. No version bumps.** There is no standing rule that would require one. The patch-bump-on-content-
|
||||
change convention this repo once followed was ADR-0006's, and ADR-0015 explicitly retired it as a
|
||||
dual-manifest artifact: "Conventions that existed only because of hand-authored dual manifests
|
||||
(ADR-0006's version-parity/patch-bump rule …) are obsolete under `apm.yml`'s single-manifest model
|
||||
and were deliberately dropped." ADR-0015 also records that apm "has no native version-bump
|
||||
automation at all", so nothing mechanical demands one either. What remains is the substantive test,
|
||||
and it is satisfied independently: nothing under `.apm/` is touched here, only compiled artifacts are
|
||||
removed, so the content every apm consumer receives is byte-identical before and after. This also
|
||||
**4. No version bumps.** There *is* a standing rule, and it is not triggered here.
|
||||
`plugins/kyberforge/.apm/skills/apm-workflow/references/configure.md` states it: **bump a package's
|
||||
own `apm.yml` `version:` whenever anything that reaches its compiled output changes** — either its
|
||||
`.apm/` content (a new or removed skill/agent/hook, or a substantive edit to one) or its own
|
||||
manifest metadata (`description`, `keywords`, `author`, `license`, `homepage`, `repository`, all
|
||||
compiled verbatim into `plugin.json`). This change touches neither: nothing under `.apm/` is edited,
|
||||
no manifest metadata changes, and only compiled artifacts are removed, so the content every apm
|
||||
consumer receives is byte-identical before and after. apm also "has no native version-bump
|
||||
automation at all" (ADR-0015), so nothing mechanical demands one either. This also
|
||||
avoids triggering the `executables.allow`
|
||||
`kyberforge#<version>` pin cascade ADR-0019 describes, which would otherwise turn a cleanup into a
|
||||
multi-file coordinated edit for no functional gain.
|
||||
|
||||
@@ -5,6 +5,18 @@ exact pair, scoped itself to them, and then deferred the work as issue #101. The
|
||||
here. `skill-author` and `agent-author` stay separate — ADR-0020 excluded the author pair
|
||||
deliberately, and nothing in this change touches that exclusion.
|
||||
|
||||
**Amended by ADR-0014 (2026-09-16).** The published `.pre-commit-hooks.yaml` is retired. Point 5
|
||||
below (both exported hook IDs survive) and the case 33 port no longer describe the repo. Case 33 is
|
||||
deleted, and its one-plugin narrowing guard is now a property of case 32. See
|
||||
[ADR-0014's amendment](0014-vale-prefilter-ships-from-the-plugin.md#amendment-2026-09-16-the-external-hook-contract-is-retired).
|
||||
|
||||
**Amended (2026-09-16): the root hook sources the resolver.** Point 6 below records sourcing the
|
||||
resolver into `scripts/skill-size-check.sh` as refuted, because the hook was consumed through
|
||||
`.pre-commit-hooks.yaml`. That manifest is retired (above), so the reason no longer holds: the hook now
|
||||
sources `lib-boundary-resolver.sh`, the repo holds one resolver copy, and the contract test's
|
||||
assertion 1 pins that copy rather than hashing two. Assertion 1a's "exactly those two files" is now
|
||||
exactly one. Point 6 is left as the record of the decision at the time.
|
||||
|
||||
## Context
|
||||
|
||||
Every figure below was measured against the worktree on 2026-09-15. Re-derive rather than quote; the
|
||||
@@ -34,9 +46,16 @@ On top of that, `scripts/check-vale-style-sync.sh` (413 lines) and
|
||||
gate was a copy diff**; it was not, and saying so would overstate the case for deleting it. The
|
||||
script has **17 assertion sites**: 13 `err` calls and 4 hard-fail exits. Its closing
|
||||
`exit 1` only reports the `err` count, so it is not an assertion. Count them with
|
||||
`git show 61b0b9c^:scripts/check-vale-style-sync.sh`. An earlier revision of this ADR said 18. No
|
||||
`git show 620f20b^:scripts/check-vale-style-sync.sh`. An earlier revision of this ADR said 18. No
|
||||
reproducible counting rule gives 18, and it is corrected here.
|
||||
|
||||
> **Repointed (2026-09-19):** this ADR originally cited `61b0b9c^`. `61b0b9c` is a pre-squash commit
|
||||
> that no published branch reaches, so the `git show` failed for anyone but its author. `620f20b` is
|
||||
> the reachable squash of the same work on `docs/simplification-audit`, and `61b0b9c^` and `620f20b^`
|
||||
> have identical trees (`git diff 61b0b9c^ 620f20b^` is empty), so every figure taken at the old
|
||||
> parent reproduces at the new one. Note that `620f20b` is not reachable from `origin/main` either —
|
||||
> fetch the PR branch (`git fetch origin docs/simplification-audit`) before running the command.
|
||||
|
||||
| Class | Old line | What it asserted | Now |
|
||||
|---|---|---|---|
|
||||
| **Moot (6)** | 19 | `REPO_ROOT` is a directory | nothing to guard; no script |
|
||||
@@ -205,17 +224,23 @@ it stops pinning that two `validate-provenance.sh` copies of the Contributing-fi
|
||||
byte-identical, and starts pinning that `lib-contributing-files.sh` is a single sourced copy that has
|
||||
not been re-inlined into either mode library. The claim it protects is the same one — the parser has
|
||||
exactly one authority — stated against the new structure. The drift history behind it is smaller than
|
||||
an earlier revision of this ADR implied. `484357a` (2026-08-30) added the bullet-form parser to both
|
||||
copies with two different spellings of the loop: a temporary `rest` in skill-audit and an inline
|
||||
slice in agent-audit. The two were behaviourally identical. `598a7c3` (2026-09-01) unified the
|
||||
spellings and added the `SHARED CONTRIBUTING-FILES PARSER` markers that 1b hashed. From then until
|
||||
an earlier revision of this ADR implied. `598a7c3` (2026-09-01, the squash of PR #129) is where the
|
||||
bullet-form parser landed on a published branch, in both copies, already carrying the
|
||||
`SHARED CONTRIBUTING-FILES PARSER` markers that 1b hashed. The drift it is named for happened inside
|
||||
that PR's own history: `484357a` (2026-08-30, pre-squash, not on any published branch) added the
|
||||
parser with two different spellings of the loop — a temporary `rest` in skill-audit and an inline
|
||||
slice in agent-audit — which were behaviourally identical, and a later commit on the same branch
|
||||
unified the spellings before the squash. From then until
|
||||
the merge's parent the two marker blocks were byte-identical (`md5 0857272d…` both). So the parser
|
||||
never *parsed* differently. What the gate never covered was the prose around the block, and a
|
||||
docstring there asserted identity the loop did not have. One sourced library removes the question.
|
||||
|
||||
**7. Two things this change does not do.** `skill-author` and `agent-author` are **not** merged
|
||||
here. That remains an open finding and it is unmeasured; ADR-0020 excluded the pair on the grounds
|
||||
here. ADR-0020 excluded the pair on the grounds
|
||||
that they emit genuinely different artifacts, and nothing measured in this session revisits that.
|
||||
*(Updated 2026-09-16.)* It was an open, unmeasured finding when this was written; it has since been
|
||||
measured at about 150–180 shared lines and refuted, and ADR-0020's rejected alternative records the
|
||||
figures.
|
||||
And **no audit criterion changes.** Every check, tier, threshold, regex and branch is carried across
|
||||
as-is. The Python payloads reassembled from the new libraries differ from the pre-merge heredocs only
|
||||
in comments. The one exception is three lines naming `references/agent-field-inventory.md`, a
|
||||
@@ -373,7 +398,8 @@ so the correction is not re-derived from scratch later.**
|
||||
description content rather than accumulating it: the `Not a skill directory -> skill-audit` clause
|
||||
loses its referent, and the `"is this ready to ship"` trigger was duplicated verbatim across both.
|
||||
The two descriptions it replaces measure **239** (skill-audit) and **250** (agent-audit) at
|
||||
`61b0b9c^`. The description this skill ships measures **241**, inside the 250 SUGGESTION target.
|
||||
`620f20b^` (see the repointing note above). The description this skill ships measures **241**,
|
||||
inside the 250 SUGGESTION target.
|
||||
It carries one arrow per boundary target (`Not applying skill fixes -> skill-author. Not applying
|
||||
agent fixes -> agent-author.`), because ADR-0020 resolves only the first target after an arrow, so
|
||||
a one-arrow form would leave `agent-author` checked by nothing. The real blocker was the body: 1,532
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# Simplification audit
|
||||
|
||||
> **Frozen (2026-09-20) — a dated record, not a live document.** Status: complete; every finding is closed at its own note except **22**, deferred with `bin` (§7's status notes carry the closing summary). Every figure below is as measured at the commit it names, and none of them are maintained against HEAD; the document is frozen at `1ec3e8a`. Where a note dates itself "at HEAD", that means the branch tip on **that note's own date**, not the current tip — those figures were not re-derived for the freeze, and several are stale by construction because later commits moved what they measure. Do not re-measure it and do not reopen it for new work — file a Gitea issue instead.
|
||||
|
||||
Date: 2026-09-10. Read-only analysis; nothing has been changed. Purpose: a hand-off for deciding what to remove, merge, and shrink. Findings are ranked by payoff within each area; effort is S/M/L. Claims were independently re-verified against the repo by a clean reviewer; corrections have been applied.
|
||||
|
||||
Assumptions agreed before analysis: anything is on the table, Claude Code and Copilot CLI both stay supported, findings are ranked with effort.
|
||||
@@ -21,27 +23,33 @@ Counting convention: line counts are hand-edited `.apm/` source unless marked "i
|
||||
>
|
||||
> > **Re-measured (2026-09-14, at `a6434e0`):** the right-hand column originally read 31,473 / 6,050 / 3,471 / 2,360 / 923 / 2,083 = 46,360 and was labelled "Today" against "the current working tree". It did not reconcile to its own commit's tree — at `061bb3d`, where it was written, the six plugins measured 31,435 / 6,048 / 3,474 / 2,358 / 926 / 2,087 = 46,328 — and "the current working tree" is a basis that goes stale silently. Re-counted at `a6434e0` and the column now names its SHA. The baseline column is confirmed exact against `9eb8bc7`. Commits after `061bb3d` (`c96ca9c`, which deleted the six plugin-root `.mcp.json` files) account for most of the remaining drift.
|
||||
|
||||
> **Re-derived (2026-09-16, at HEAD on `docs/simplification-audit`):** the 2026-09-15 notes recording finding 14's merge (`467bbd7`, ADR-0025) and the pipefail fix (`4059cb4`) were written without correcting the headlines they annotate, so this pass re-counted every figure those two commits could have moved and corrected each in place above and below. Everything re-measured here came from a command run at HEAD — `git ls-files`, `wc -l`, `grep -c`, and `bash tests/run-tests.sh --strict` — never from an earlier note. What moved: finding 2 (two surviving sync gates → one), the `.pre-commit-config.yaml` hook counts (27/9 → 26/8), the skill census (39 → 38 and everything derived from it), finding 11's validator and `sources.md` figures, finding 16's whole numeric basis, and the stale `skill-audit/`, `agent-audit/` and `formatting-and-scripts.md` paths in findings 18, 19 and 33. §1's three rows re-measured at HEAD: **469** tracked files (465 regular plus the 4 submodule gitlinks) / **74,594** lines; `plugins/` **46,106** (62%); the 38 `SKILL.md` bodies **2,409** (5.2% of plugin lines); enforcement **20 `tests/test-*.sh` totalling 10,189 lines**, the two runners **502** (`run-tests.sh` 283 + `run-bats.sh` 219), and `scripts/` **2,901**; kyberforge's validator scripts and their bats tests **5,861 + 6,015** (the merge deduplicated scripts and left the test corpus larger, not smaller — `git ls-files 'plugins/kyberforge/.apm/skills/*/scripts/*.sh'` and `.../tests/*.bats`). `run-tests.sh --strict` reports **20 passed, 0 skipped, 0 failed**. Re-checked and unchanged, so left alone: `docs/research/` inside plugins (19,030) and repo-level `docs/research/` + `docs/notes/` (4,488). Not re-measured, and still carrying their last stated basis: the preload-tax and commit-share rows, §2's timings, and the per-plugin table in the note above.
|
||||
> **Re-derived (2026-09-16, at HEAD on `docs/simplification-audit`):** the 2026-09-15 notes recording finding 14's merge (~~`467bbd7`~~ → `620f20b`, ADR-0025) and the pipefail fix (~~`4059cb4`~~ → `ffcbed6`) were written without correcting the headlines they annotate, so this pass re-counted every figure those two commits could have moved and corrected each in place above and below. Everything re-measured here came from a command run at HEAD — `git ls-files`, `wc -l`, `grep -c`, and `bash tests/run-tests.sh --strict` — never from an earlier note. What moved: finding 2 (two surviving sync gates → one), the `.pre-commit-config.yaml` hook counts (27/9 → 26/8 → 27/9 → 26/8, the chain spelled out in §3's table note below; **26** `- id:` entries and **8** `stages: [pre-push]` at HEAD, `grep -c -- "- id:"` and `grep -c "stages: \[pre-push\]"`), the skill census (39 → 38 and everything derived from it), finding 11's validator and `sources.md` figures, finding 16's whole numeric basis, and the stale `skill-audit/`, `agent-audit/` and `formatting-and-scripts.md` paths in findings 18, 19 and 33. §1's three rows re-measured: ~~**469**~~ → **471** tracked files (~~465~~ → 467 regular plus the 4 submodule gitlinks) / ~~**74,594**~~ → **75,441** lines (pinned to `c07ca07`; see the note below); `plugins/` ~~**46,106** (62%)~~ → **46,127** (61%); the 38 `SKILL.md` bodies **2,409** (5.2% of plugin lines); enforcement ~~**20 `tests/test-*.sh` totalling 10,189 lines**~~ → ~~**21 `tests/test-*.sh` totalling 10,608 lines**~~ → **19 totalling 10,088** at `baa2f5d`, the two runners ~~**502** (`run-tests.sh` 283 + `run-bats.sh` 219)~~ → **514** (`run-tests.sh` 289 + `run-bats.sh` 225), and `scripts/` ~~**2,901**~~ → ~~**3,139**~~ → **1,926** (**corrected 2026-09-20**: the struck runner and `scripts/` figures are `c07ca07`'s, not `baa2f5d`'s, so this one clause carried two bases and contradicted §1's own row for the same commit; the replacements are `baa2f5d`'s and agree with that row); kyberforge's validator scripts and their bats tests ~~**5,861**~~ → **5,876** + **6,015** (the merge deduplicated scripts and left the test corpus larger, not smaller — `git ls-files 'plugins/kyberforge/.apm/skills/*/scripts/*.sh'` and `.../tests/*.bats`). `run-tests.sh --strict` reports ~~**20 passed, 0 skipped, 0 failed**~~ → ~~**21 passed, 0 skipped, 0 failed**~~ → **19 passed, 0 skipped, 0 failed** at `baa2f5d` (`4de5b6b` deleted two suites).
|
||||
>
|
||||
> > **Re-measured (2026-09-16, at `c07ca07`):** commit `8451169` added `check-skill-version-bump` — a pre-push hook, `scripts/check-skill-version-bump.sh` (238 lines) and `tests/test-skill-version-bump.sh` (410) — after the figures above were taken, so each was one short. `.pre-commit-config.yaml` now has **27** `- id:` entries and **9** `stages: [pre-push]` (`grep -c -- "- id:"`; `grep -c "stages: \[pre-push\]"`), all nine repo-authored. The struck figures are replaced from these commands. They were run against the working tree, and every figure reproduces exactly from the committed tree at `c07ca07`: `git ls-files | wc -l`; `cat` over every non-gitlink tracked path `| wc -l`; `git ls-files plugins | xargs cat | wc -l`; `git ls-files scripts | xargs wc -l` (no untracked files under `scripts/`); `ls tests/test-*.sh | wc -l` and `cat tests/test-*.sh | wc -l`; `bash tests/run-tests.sh --strict`. The earlier 469 / 74,594 / 46,106 did not reproduce exactly at `8451169^` either (469 / 74,638 / 46,121), so they were taken at an earlier commit than this note's "at HEAD" says. Re-checked and unchanged, so left alone: `docs/research/` inside plugins (19,030) and repo-level `docs/research/` + `docs/notes/` (4,488). Not re-measured, and still carrying their last stated basis: the preload-tax and commit-share rows, §2's timings, and the per-plugin table in the note above.
|
||||
>
|
||||
> > **Pinned (2026-09-16, review round):** the tracked-lines total is a moving figure, and this file moves it: `b426460` changed only this audit and took the committed total from 75,441 to 75,461. So the figure stays pinned to a commit instead of being chased. At `c07ca07` the committed tree has **471** paths (`git ls-tree -r`), **75,441** lines (every blob, `git cat-file -p … | wc -l`), and **46,127** lines under `plugins/` (61%). The 38 `SKILL.md` bodies there total **2,409** lines. At `c07ca07` the working-tree method above gives the same numbers, because nothing else was uncommitted. The `scripts/`, `tests/` and runner figures in the note above also reproduce at `c07ca07`, and at `b426460` too, since that commit changed no other file.
|
||||
|
||||
> **Reviewed (2026-09-14):** commits `718c79a` and `d2480b8` were put through a five-agent review. Result: **zero skill, agent or hook regressions** — 39 skills before and after, all gates passing, and both hook removals (`validate-plugins`, `check-plugin-content-sync`) genuinely moot rather than merely unenforced. One real functional regression was found — MCP propagation to consumers, broken by the same commit's manifest deletion; see finding 37 — along with the numeric and bookkeeping drift in this document's own 2026-09-14 notes, corrected in place above and below.
|
||||
|
||||
> **Reviewed again (2026-09-16):** the grill commits (`8451169` through `b426460`) went through a second review round. Its dispositions are in §11.
|
||||
|
||||
## 1. The shape of the problem
|
||||
|
||||
| Measure | Value |
|
||||
| ---------------------------------------------------------------------------| -----------------------------------------------------------------------------------------|
|
||||
| Tracked files / lines | ~~820 / 102,000~~ → ~~475 / 73,073~~ → 469 / 74,594 |
|
||||
| Lines in `plugins/` | ~~70,600 (69% of repo)~~ → ~~46,301 (63% of repo)~~ → 46,106 (62% of repo) |
|
||||
| Of which the ~~39~~ → 38 `SKILL.md` files a model actually loads | ~~about 2,600 lines (under 4% of plugin lines)~~ → ~~2,509 lines (5.4% of plugin lines)~~ → 2,409 lines (5.2% of plugin lines) |
|
||||
| Tracked files / lines | ~~820 / 102,000~~ → ~~475 / 73,073~~ → ~~469 / 74,594~~ → ~~471 / 75,441 (at `c07ca07`)~~ → 468 / 74,025 (at `baa2f5d`) |
|
||||
| Lines in `plugins/` | ~~70,600 (69% of repo)~~ → ~~46,301 (63% of repo)~~ → ~~46,106 (62% of repo)~~ → ~~46,127 (61% of repo)~~ → 46,232 (62% of repo, at `baa2f5d`) |
|
||||
| Of which the ~~39~~ → 38 `SKILL.md` files a model actually loads | ~~about 2,600 lines (under 4% of plugin lines)~~ → ~~2,509 lines (5.4% of plugin lines)~~ → 2,409 lines (5.2% of plugin lines; unchanged at `baa2f5d`) |
|
||||
| Generated flat mirror files (byte copies of `.apm/`) | ~~263 files, ~22,000 lines~~ → 0 (deleted 2026-09-14, see below) |
|
||||
| `docs/research/` vendored inside plugins | ~19,000 lines, nothing executable reads it |
|
||||
| Repo-level `docs/research/` + `docs/notes/` | 4,500 lines, 47% of all prose words, 6 of 11 research files linked only from each other |
|
||||
| Enforcement: hook entries in `.pre-commit-config.yaml` / pre-push hooks | 33 / 14 |
|
||||
| Enforcement: `tests/*.sh` + runners + `scripts/` | ~~12,400 + 475 + 4,500 lines~~ → ~~9,123 + 490 + 3,308 lines~~ → 10,189 + 502 + 2,901 |
|
||||
| Validator scripts inside kyberforge (+ their bats tests) | ~~6,800 + 5,300 lines~~ → 5,861 + 6,015 |
|
||||
| Preload tax (39 skill names + descriptions) | 10,987 chars, ~2,750 tokens per session |
|
||||
| Repo-level `docs/research/` + `docs/notes/` | 4,500 lines, 47% of all prose words, 6 of 11 research files linked only from each other (invalidated by this document's own move into `docs/notes/`, which adds 665 lines to the row it measures) |
|
||||
| Enforcement: hook entries in `.pre-commit-config.yaml` / pre-push hooks | ~~33 / 14~~ → 26 / 8 (at `baa2f5d`; see the note below) |
|
||||
| Enforcement: `tests/*.sh` + runners + `scripts/` | ~~12,400 + 475 + 4,500 lines~~ → ~~9,123 + 490 + 3,308 lines~~ → ~~10,189 + 502 + 2,901~~ → ~~10,608 + 502 + 3,139~~ → ~~10,000 + 502 + 1,924 (at `4b17703`)~~ → 10,088 + 514 + 1,926 (at `baa2f5d`) |
|
||||
| Validator scripts inside kyberforge (+ their bats tests) | ~~6,800 + 5,300 lines~~ → ~~5,861 + 6,015~~ → ~~5,876 + 6,015~~ → 5,885 + 6,071 (at `baa2f5d`) |
|
||||
| Preload tax (~~39~~ → 38 skill names + descriptions) | 10,987 chars, ~2,750 tokens per session (measured at 39 skills on 2026-09-10; never re-measured after ADR-0025's merge took the count to 38) |
|
||||
| Commits since 2026-05-10 / share touching hook, test, gate, vale, or sync | 447 / ~25% |
|
||||
|
||||
> **Corrected then done (2026-09-14):** the mirror row's figure was wrong. The true mirror was **213 files / 20,061 lines**, not 263 / ~22,000 — the original count swept in files that were never mirror output. All 213 were deleted in commit `718c79a` on `docs/simplification-audit` (245 files changed, 298 insertions, 22,602 deletions across the whole change), so the row is now zero. The enforcement row is stale on **both** halves — it was correct at the 2026-09-10 baseline (`9eb8bc7`: 33 `- id:` entries, 14 repo-authored pre-push hooks), but `.pre-commit-config.yaml` today has ~~**27 entries and 9 `stages: [pre-push]`**~~ → **26 entries and 8 `stages: [pre-push]`** (re-measured 2026-09-16 at HEAD; `467bbd7` removed `check-vale-style-sync` with finding 14's merge). Like for like that is 14 → ~~9~~ → 8 repo-authored pre-push hooks. The stage *reports* ~~11~~ → 10, because the 2 pre-commit `meta` hooks also run there — a different counting basis; see the corrected §3 target, which states it the same way.
|
||||
> **Corrected then done (2026-09-14):** the mirror row's figure was wrong. The true mirror was **213 files / 20,061 lines**, not 263 / ~22,000 — the original count swept in files that were never mirror output. All 213 were deleted in commit `718c79a` on `docs/simplification-audit` (245 files changed, 298 insertions, 22,602 deletions across the whole change), so the row is now zero. The enforcement row is stale on **both** halves — it was correct at the 2026-09-10 baseline (`9eb8bc7`: 33 `- id:` entries, 14 repo-authored pre-push hooks), but `.pre-commit-config.yaml` today has ~~**27 entries and 9 `stages: [pre-push]`**~~ → ~~**26 entries and 8 `stages: [pre-push]`**~~ → ~~**27 entries and 9 `stages: [pre-push]`**~~ → **26 entries and 8 `stages: [pre-push]`** (~~`467bbd7`~~ → `620f20b` removed `check-vale-style-sync` with finding 14's merge; `8451169` then added `check-skill-version-bump`; `4de5b6b` then removed `check-release-needed`; re-measured 2026-09-16 at `4b17703` with `grep -c -- "- id:"` and `grep -c "stages: \[pre-push\]"` on `.pre-commit-config.yaml`). Like for like that is 14 → ~~9~~ → ~~8~~ → ~~9~~ → 8 repo-authored pre-push hooks. The stage *reports* ~~11~~ → ~~10~~ → ~~11~~ → 10, because the 2 pre-commit `meta` hooks also run there — a different counting basis; see the corrected §3 target, which states it the same way.
|
||||
|
||||
> **Re-measured (2026-09-14, at `a6434e0`):** this table is a **dated snapshot corrected in place**, not a live figure — every arrow above reads "baseline (2026-09-10, `9eb8bc7`) → value at the stated commit". Three further rows were still carrying baseline values after `d2480b8`/`061bb3d` corrected their neighbours, and are now corrected at `a6434e0`:
|
||||
>
|
||||
@@ -98,18 +106,19 @@ This is the area you named as hardest to understand and slowest. Root cause: mos
|
||||
> **Grilled and closed (2026-09-14):** `apm-audit-ci` — already resolved before this audit was written: `.pre-commit-config.yaml`'s own comment block (added in commit `a155af6`, months before this audit) already rebuts the "overclaimed description" complaint and gives a dated, verified justification for what the hook still checks. Keep, no action. `apm-marketplace-check` — its stated purpose ("the only hook that checks remote package references rather than local-source paths") is void: finding 35 (commit `568ca74`) already removed the only remote package entry, so every `marketplace.packages[]` entry is now a local `./plugins/<name>` path and the hook is pure overlap with `apm-pack-check-clean`. Removed the hook entry, and corrected the now-stale "does NOT join apm-marketplace-check ... on the offline SKIP= list" comment on `apm-audit-ci` (there is no offline skip list any more — every pre-push hook already passes offline per `README.md`). Updated `README.md` (tool table, "Offline?" section) and `docs/spec/gates.md` (hook table, hook counts 13→11 self-authored / 15→13 total, the "Three of these shell out to apm" paragraph, and the "Pushing without a network" section) accordingly. Verified: `apm audit --ci` still passes per-plugin, and the pre-push hook count now matches `.pre-commit-config.yaml`.
|
||||
> **Corrected and closed (2026-09-14, at `a6434e0`):** two things above went stale within hours of being written, and the finding was never given a marker.
|
||||
>
|
||||
> - **"Keep the two `claude plugin validate` hooks"** is void. `718c79a` (ADR-0024) deleted `validate-plugins` — the ADR's own reasoning is that `claude plugin validate` reads manifests only and could never detect the empty-content defect it was credited with guarding, and with the per-plugin manifests gone it has nothing left to read. Only **`validate-marketplace`** survives, over the one manifest this repo still ships (`.claude-plugin/marketplace.json`). Of the six hooks this finding named, three now exist: `validate-marketplace`, `apm-pack-check-clean`, `apm-audit-ci`. Verified against `.pre-commit-config.yaml`: ~~27 `- id:` entries, 9 with `stages: [pre-push]`~~ → **26 `- id:` entries, 8 with `stages: [pre-push]`** (re-measured 2026-09-16 at HEAD), no `validate-plugins` entry.
|
||||
> - **The gates.md figures above ("13→11 self-authored / 15→13 total") were correct for `0dffff3` and are no longer current.** `718c79a` removed two more pre-push hooks after that commit, and `docs/spec/gates.md:24` read **11 reported / 9 self-authored** when this note was written; finding 14's merge has since removed `check-vale-style-sync`, and it now reads **10 reported / 8 self-authored**. Read the count from that file, not from this note.
|
||||
> - **"Keep the two `claude plugin validate` hooks"** is void. `718c79a` (ADR-0024) deleted `validate-plugins` — the ADR's own reasoning is that `claude plugin validate` reads manifests only and could never detect the empty-content defect it was credited with guarding, and with the per-plugin manifests gone it has nothing left to read. Only **`validate-marketplace`** survives, over the one manifest this repo still ships (`.claude-plugin/marketplace.json`). Of the six hooks this finding named, three now exist: `validate-marketplace`, `apm-pack-check-clean`, `apm-audit-ci`. Verified against `.pre-commit-config.yaml`: ~~27 `- id:` entries, 9 with `stages: [pre-push]`~~ → ~~**26 `- id:` entries, 8 with `stages: [pre-push]`**~~ → ~~**27 `- id:` entries, 9 with `stages: [pre-push]`**~~ → **26 `- id:` entries, 8 with `stages: [pre-push]`** (re-measured 2026-09-16 at `4b17703`; `8451169` added `check-skill-version-bump`, then `4de5b6b` removed `check-release-needed`), no `validate-plugins` entry.
|
||||
> - **The gates.md figures above ("13→11 self-authored / 15→13 total") were correct for `0dffff3` and are no longer current.** `718c79a` removed two more pre-push hooks after that commit, and `docs/spec/gates.md:24` read **11 reported / 9 self-authored** when this note was written; finding 14's merge has since removed `check-vale-style-sync`, and it ~~now reads **10 reported / 8 self-authored**~~ → read **10 reported / 8 self-authored** until `8451169` added `check-skill-version-bump`; at `b426460` `gates.md:24-28` read **11 reported / 9 self-authored** again, and since `4de5b6b` removed `check-release-needed` it reads **10 reported / 8 self-authored** (checked at `4b17703`). Read the count from that file, not from this note.
|
||||
>
|
||||
> Marked `[x]`: all three of this finding's decisions are resolved — `check-manifests` deleted (`e647f14`), `apm-audit-ci` kept on the grill above, `apm-marketplace-check` removed (`0dffff3`).
|
||||
|
||||
2. **~~Four~~ ~~two~~ → one surviving "keep two copies in sync" gate: ~~1,100 script lines + 1,600 test lines~~ ~~778 script lines + 1,079 test lines~~ → 381 script lines + 297 test lines.** Each one is a symptom of duplication that could be removed instead of guarded:
|
||||
> **Re-measured (2026-09-16, at HEAD):** `467bbd7` deleted `check-vale-style-sync` with finding 14's merge, so the "two" above is now **one** — `check-scope-walkup-sync`, at **381** script lines (`wc -l scripts/check-scope-walkup-sync.sh`) and **297** test lines (`wc -l tests/test-check-scope-walkup-sync.sh`). Both grew since `a6434e0`, where they measured 365 + 282. Reading `check-executables-allow-sync` into the group as the note below does makes it two gates, **603 + 540** (222 + 243 for that one, unchanged).
|
||||
2. [x] **~~Four~~ ~~two~~ → one surviving "keep two copies in sync" gate: ~~1,100 script lines + 1,600 test lines~~ ~~778 script lines + 1,079 test lines~~ → 381 script lines + 297 test lines.** Each one is a symptom of duplication that could be removed instead of guarded:
|
||||
> **Re-measured (2026-09-16, at HEAD):** ~~`467bbd7`~~ → `620f20b` deleted `check-vale-style-sync` with finding 14's merge, so the "two" above is now **one** — `check-scope-walkup-sync`, at **381** script lines (`wc -l scripts/check-scope-walkup-sync.sh`) and **297** test lines (`wc -l tests/test-check-scope-walkup-sync.sh`). Both grew since `a6434e0`, where they measured 365 + 282. Reading `check-executables-allow-sync` into the group as the note below does makes it two gates, **603 + 540** (222 + 243 for that one, unchanged).
|
||||
> **Re-measured (2026-09-14, at `a6434e0`):** two of the four are gone — `check-marketplace-mirror-sync` deleted in `0dffff3` (2c below) and, though it was never in this finding's own count, `check-plugin-content-sync` in `718c79a`. The two that survive are `check-vale-style-sync` (413 script + 797 test) and `check-scope-walkup-sync` (365 + 282); `check-executables-allow-sync` also survives, shrunk to 222 + 243 (2d below), and counts as the third if that gate is read as part of this group rather than as its own item. Two-gate total 778 + 1,079; three-gate total 1,000 + 1,322. The per-bullet script and test figures below are all still exact at this commit except `check-executables-allow-sync`'s "474 lines", which 2d already corrects.
|
||||
- [x] ~~`check-vale-style-sync`: 413 lines + 798 test lines guarding a byte-identical 526-line `vale-wrap.sh` and style directory copied between skill-audit and agent-audit. About 350 of its lines run Vale glob probes against the hook file patterns. Disappears if the two audit skills merge (finding 14); the probes belong in `test-vale-wrap.sh`.~~ **Done (2026-09-15, `467bbd7`)** — hook, script and test all deleted; see the settled note below for the corrected probe arithmetic.
|
||||
- [x] ~~`check-vale-style-sync`: 413 lines + 798 test lines guarding a byte-identical 526-line `vale-wrap.sh` and style directory copied between skill-audit and agent-audit. About 350 of its lines run Vale glob probes against the hook file patterns. Disappears if the two audit skills merge (finding 14); the probes belong in `test-vale-wrap.sh`.~~ **Done (2026-09-15, ~~`467bbd7`~~ → `620f20b`)** — hook, script and test all deleted; see the settled note below for the corrected probe arithmetic.
|
||||
- `check-scope-walkup-sync`: ~~365~~ → **381** lines (plus **297** test lines; re-measured 2026-09-16 at HEAD) cross-checking four independent ports of the same package-root walk-up. Disappears if the ports share one script ~~or the skills merge~~ — the second half is refuted below, and the first is unreachable.
|
||||
> **Grilled, held (2026-09-14):** both of the above are gated on findings 14/15 (merging skill-audit+agent-audit and skill-author+agent-author), deliberately held for a separate session rather than decided here. Correction for that session: the audit's §8 grouping is wrong — these merges don't need ADR-0012 revisited (that ADR governs the unrelated `core` plugin's three `agentsmd-*` skills). The actual constraint is ADR-0014 (no-cross-skill file sharing on plugin cache-install), and merging sidesteps it rather than requiring it be reversed. The open question for that session is a design one — a shared skill's `description` carrying both skill- and agent-audit trigger phrases — not an ADR supersession. ADR-0012 revisit is needed only for finding 24.
|
||||
> **Settled (2026-09-15) — split verdict, and the first bullet held in full.** Finding 14 landed as `factory-audit` (ADR-0025). **`check-vale-style-sync` is deleted**, hook, script and test, exactly as the first bullet predicted — and its probes **were** rehomed into `test-vale-wrap.sh`, as cases 28-30 (case 31 carries the override allowlist), so both halves of that bullet are closed. `docs/spec/gates.md` records the rehoming, not an open gap. *(Updated later on 2026-09-15.)* The one assertion this note used to call still uncovered — cross-manifest *agreement* between `.pre-commit-hooks.yaml`'s and `.pre-commit-config.yaml`'s `files:` regexes — is now ported as case 33, which pairs the hooks by `id:`. Case 32 covers the separate zero-match question. It was a real gap while it lasted: narrowing the local skill hook to `^plugins/kyberforge/` left 6 of 38 skills prefiltered and the suite green. `bash tests/test-vale-wrap.sh` now reports ~~`61 passed, 0 failed`~~ → `63 passed, 0 failed` (it was 56 before cases 0 and 33 and the Part B mutation self-tests; 61 on 2026-09-15, and 63 once case 34 — the static `.vale.ini` style-load check — landed on 2026-09-16. Without vale on PATH it reports 19 and exits 77, up from 17). The bullet's "about 350 of its lines run Vale glob probes" overstates the probe half: at `a5962ba` the script is **413 lines**, of which the `.vale.ini` coverage section is **332** (`67..398`) and the machinery that actually invokes vale against a probe path is **204** (`195..398`). The balance of that section is `StylesPath`, `BasedOnStyles` and per-rule-override greps — text assertions, not probes. (Its test file is **797** lines, as the note above says, not the 798 the bullet carries.) **`check-scope-walkup-sync` stays**, and the second bullet's "or the skills merge" is wrong: two of its four walk-up ports are in the *author* skills (`new-agent.sh`, `new-skill.sh`), which this merge does not touch, and the audit-side pair is Python against the author-side pair's Bash, so the gate can never degrade into a text diff. Full reasoning in §10's 2026-09-15 note. Finding 15 would not remove it either.
|
||||
> **Settled (2026-09-15) — split verdict, and the first bullet held in full.** Finding 14 landed as `factory-audit` (ADR-0025). **`check-vale-style-sync` is deleted**, hook, script and test, exactly as the first bullet predicted — and its probes **were** rehomed into `test-vale-wrap.sh`, as cases 28-30 (case 31 carries the override allowlist), so both halves of that bullet are closed. `docs/spec/gates.md` records the rehoming, not an open gap. *(Updated later on 2026-09-15.)* The one assertion this note used to call still uncovered — cross-manifest *agreement* between `.pre-commit-hooks.yaml`'s and `.pre-commit-config.yaml`'s `files:` regexes — ~~is now ported as case 33, which pairs the hooks by `id:`~~ → was ported as case 33, and case 33 was deleted with `.pre-commit-hooks.yaml` in `4de5b6b` (finding 36), so there is no second manifest left to agree with. Case 32 covers the separate zero-match question. It was a real gap while it lasted: narrowing the local skill hook to `^plugins/kyberforge/` left 6 of 38 skills prefiltered and the suite green. `bash tests/test-vale-wrap.sh` reports ~~`61 passed, 0 failed`~~ → ~~`63 passed, 0 failed`~~ → **`65 passed, 0 failed` (pinned at `1614bce`)** (it was 56 before cases 0 and 33 and the Part B mutation self-tests; 61 on 2026-09-15, and 63 once case 34 — the static `.vale.ini` style-load check — landed on 2026-09-16. Without vale on PATH it reports ~~19~~ → **14** and exits 77, ~~up from 17~~). The bullet's "about 350 of its lines run Vale glob probes" overstates the probe half: at `a5962ba` the script is **413 lines**, of which the `.vale.ini` coverage section is **332** (`67..398`) and the machinery that actually invokes vale against a probe path is **204** (`195..398`). The balance of that section is `StylesPath`, `BasedOnStyles` and per-rule-override greps — text assertions, not probes. (Its test file is **797** lines, as the note above says, not the 798 the bullet carries.) **`check-scope-walkup-sync` stays**, and the second bullet's "or the skills merge" is wrong: two of its four walk-up ports are in the *author* skills (`new-agent.sh`, `new-skill.sh`), which this merge does not touch, and the audit-side pair is Python against the author-side pair's Bash, so the gate can never degrade into a text diff. Full reasoning in §10's 2026-09-15 note. Finding 15 would not remove it either.
|
||||
> > **Re-measured and pinned (2026-09-20, at `1614bce`).** The two `test-vale-wrap.sh` counts in the note above were written as current readings rather than pinned to a commit, and both went stale when `ea119d8` added cases to that suite after this note. Measured here, not copied forward: `bash tests/test-vale-wrap.sh` → `Results: 65 passed, 0 failed`, exit 0; `env PATH=/usr/bin:/bin bash tests/test-vale-wrap.sh` → `Results: 14 passed, 0 failed`, exit 77. The struck 63 and 19 were correct for the commits they were taken at; no attempt is made here to attribute the 19 → 14 move, only to record the reading at `1614bce`. Take the counts from a run against a named commit, never from this note — that is the same reason §1 carries its "Pinned (2026-09-16, review round)" note.
|
||||
- [x] ~~`check-marketplace-mirror-sync`: guards `.github/plugin/marketplace.json`. The script header calls it Copilot's legacy convention path and says Copilot also accepts the Claude path; the vendored Copilot docs list it as primary. Verify against current Copilot CLI before deleting hook, script, test, and mirror file.~~
|
||||
> **Grilled and done (2026-09-14):** verified against GitHub's current Copilot CLI plugin docs (not the vendored copy, which risked drift). Copilot CLI's marketplace discovery checks paths in order — `marketplace.json`, `.plugin/marketplace.json`, `.github/plugin/marketplace.json`, `.claude-plugin/marketplace.json` — falling through to whichever exists first. `.claude-plugin/marketplace.json` (apm's own `claude` output) already satisfies that chain's last step, so the dedicated `.github/plugin/marketplace.json` mirror bought Copilot users its *preferred* discovery path rather than a required one. Decided against reopening ADR-0018 (native install for both Claude Code and Copilot CLI stays supported) to justify this — the deletion holds either way, since Copilot's own fallback covers it. Deleted `.github/plugin/marketplace.json`, `scripts/sync-marketplace-mirror.sh` (81 lines), `tests/test-sync-marketplace-mirror.sh` (304 lines), and the `check-marketplace-mirror-sync` pre-push hook; removed the dangling references to the deleted script in `scripts/sync-plugin-content.sh` and `tests/test-sync-plugin-content.sh` (both had comments citing its reasoning by name), and updated `docs/spec/architecture.md`'s description of the marketplace-manifest compile step. `tests/test-sync-plugin-content.sh` (92 cases) still passes in full.
|
||||
>
|
||||
@@ -117,35 +126,46 @@ This is the area you named as hardest to understand and slowest. Root cause: mos
|
||||
- [x] ~~`check-executables-allow-sync`: 474 lines to assert one string equals kyberforge's version. A six-line grep, or drop it (the failure mode is visible and recoverable).~~
|
||||
> **Corrected then partially done (2026-09-13):** see commit `1b01e25` on `docs/simplification-audit`. Independent re-verification found "drop it" unsafe — ADR-0019's own Consequences section calls this failure mode *silent* and says a silent-staleness failure here is worse than the duplication the other gates catch, directly contradicting the finding's "visible and recoverable" claim. The hook stays. Shrunk `scripts/check-executables-allow-sync.sh` 231 → 222 lines by deduplicating two comment blocks that re-derived ADR-0019's own reasoning inline, replacing them with a pointer at the ADR. The dual-reader design (PyYAML plus a hand-rolled fallback, so a missing PyYAML can't silently skip the check) was found to be load-bearing, not redundant, and left intact; test file unchanged (behavior unaffected). All 23 test cases and the live pre-push hook run still pass.
|
||||
Effort S each, M for the walk-up.
|
||||
> **Closed (2026-09-16).** Every bullet is settled: `check-vale-style-sync` went with finding 14, `check-marketplace-mirror-sync` with 2c, and `check-executables-allow-sync` was kept and shrunk (2d). `check-scope-walkup-sync` **stays**: finding 14 left its four ports at four (see §10), and finding 15 was refuted, so the author-side pair will not merge either. The "held" note above is resolved by those two outcomes.
|
||||
|
||||
3. **Tests of the test harness: 1,090 lines testing 475 lines.** `test-run-tests.sh` and `test-run-bats.sh` defend "green either way" holes that exist only because the runners hand-roll TAP parsing and set-equality checks. Replace both runners with about 40 lines (`bats -r plugins` plus a parallel `find | xargs` over `test-*.sh`) and delete the meta-tests. `lib/batch-run.sh` stays; ~~`sync-plugin-content.sh` sources it~~ both runners source it. Effort M.
|
||||
3. [x] **Tests of the test harness: 1,090 lines testing 475 lines.** `test-run-tests.sh` and `test-run-bats.sh` defend "green either way" holes that exist only because the runners hand-roll TAP parsing and set-equality checks. Replace both runners with about 40 lines (`bats -r plugins` plus a parallel `find | xargs` over `test-*.sh`) and delete the meta-tests. `lib/batch-run.sh` stays; ~~`sync-plugin-content.sh` sources it~~ both runners source it. Effort M.
|
||||
> **Not proceeding (2026-09-13):** premise doesn't hold. A full read of both runners and both meta-tests found the "TAP-parsing/set-equality" logic is regression coverage for specific past incidents — a `BATS_FILE_FLOOR` hardcode once let deleted test files vanish silently ("155 tests, 0 failures" with 11 tests missing); a missing/broken `run-bats.sh` used to make the whole bats suite disappear with a green summary; a formatter change once reported "0 tests, 0 failures" as a pass. Replacing the runners as specified would delete exactly the guards against that failure class. No changes made. Re-scoping this would mean deciding, guard by guard, which are still worth keeping — a design decision, not a mechanical cleanup.
|
||||
> **Rationale corrected, decision unchanged (2026-09-14, at `a6434e0`):** the stated reason `lib/batch-run.sh` survives was void — `sync-plugin-content.sh` was deleted in `718c79a`. The conclusion is unaffected: `batch-run.sh` (90 lines) is sourced by `tests/run-tests.sh:185` and `tests/run-bats.sh:138`, and copied into fixture trees by `tests/test-run-tests.sh:51` and `tests/test-run-bats.sh:49`. Since the finding is **not proceeding**, both runners stay and keep sourcing it, so nothing is orphaned. Note the knock-on if this is ever re-scoped: with the sync script gone, "replace both runners" would leave `batch-run.sh` with no caller at all, which the original wording assumed it could not. Headline figures re-measured: the meta-tests are **1,090 lines** (675 + 415, as stated) against **490** runner lines, not 475 — the runners grew from 273 + 202 at the `9eb8bc7` baseline. (Both runners and `batch-run.sh` were under concurrent edit when this was measured; figures are as of `a6434e0`.)
|
||||
|
||||
4. [x] ~~**`skill-frontmatter` is a 62-line bash script inlined in YAML** with its own 366-line test. `skill-size-check.sh` already parses the same frontmatter with PyYAML. Fold it in (about 15 Python lines), delete the inline hook, its test, and the 79 lines in `gates.md` arguing for the split. Effort S.~~
|
||||
> **Done (2026-09-12):** see commit `c8a7c9e` on `docs/simplification-audit`. Added a ~20-line required-frontmatter check (`name`, `description`, `metadata.version` as three-part semver) to `scripts/skill-size-check.sh`, reusing the YAML mapping `description_value()` already parses. Removed the inline `skill-frontmatter` hook (~80 lines) from `.pre-commit-config.yaml` and deleted `tests/test-skill-frontmatter.sh` (366 lines). Removed the 79-line "the other hook on that scope" discussion from `docs/spec/gates.md` and its now-dangling cross-reference, replacing both with a one-line note of the fold; updated the pre-push hook counts there. Updated fixture builders in `tests/test-skill-size-check.sh`, `tests/test-adr0020-body-checks.sh`, `tests/test-adr0020-targets.sh`, `tests/test-adr0020-differential.sh`, and `tests/test-vale-hooks-consumer.sh` to carry valid `metadata.version` so the new check doesn't spuriously fail existing fixtures.
|
||||
|
||||
5. **`skill-size-check.sh` has six test files totalling 3,589 lines for one 1,497-line script**, split by ADR section rather than behaviour. `test-adr0020-differential.sh` is 452 lines for 12 assertions. Merge to two files. Effort M.
|
||||
5. [x] **`skill-size-check.sh` has six test files totalling 3,589 lines for one 1,497-line script**, split by ADR section rather than behaviour. `test-adr0020-differential.sh` is 452 lines for 12 assertions. Merge to two files. Effort M.
|
||||
> **Not proceeding (2026-09-14):** premise doesn't hold, in the same way finding 3's did not. The six suites are **not** split by ADR section — they are split by failure class, and five of the six headers name the incident they guard. (The exception is `tests/test-skill-size-check.sh`, whose header names no incident: it describes the two gate families the script must not conflate and flags the constant-agreement block as the load-bearing part.) `test-adr0020-contract.sh` defends *structural* claims that "each one fails silently": that the resolver block copied verbatim into three scripts has not drifted, that both interpreter preflights still exist, that `verbose: true` is still set on the hook (the entire delivery mechanism for the SUGGESTION tier). It records that the `validate-provenance.sh` pair "had already drifted" once. `test-adr0020-differential.sh` compares *verdicts* between `skill-size-check.sh` and `validate.sh` on real files, and its header states that constant-agreement is "necessary but demonstrably not sufficient — a previous review found the two scripts disagreeing on real files while every constant matched perfectly", with two ceilings excluded "until a real divergence shipped behind the exclusion". The suites also do not cover the same scripts: `contract` reaches `validate-provenance.sh` (`tests/test-adr0020-contract.sh:115-116` byte-compares both copies of it). Merging by subject would delete exactly the guards against silent drift between hand-duplicated validators. Re-measured at HEAD: **3,619 lines** across six suites against a **1,517-line** script, not 3,589/1,497. That ratio is the cost of the duplication, not an independent defect — it is deleted by **finding 16**, which removes the thing being differentially compared. **#5 is downstream of #16 and should be reconsidered only after it.** The one salvageable part is a performance change, not a coverage change: `test-adr0020-differential.sh` spends 29 s of every push re-running two validators over the live corpus, and could be sped up with no coverage loss. That is a different finding than the one written here.
|
||||
>
|
||||
> **Salvage closed (2026-09-16, grill): not proceeding.** Timed one suite at a time on this 4-core machine, `test-adr0020-differential.sh` takes **34.3 s** of **213 s** total suite time, behind bats (70.7 s) and ahead of `test-vale-wrap.sh` (29.4 s). Its cost is about 90 validator runs, one after another, at 0.1–0.15 s each. Even deleting it outright would take at most 34 s off a pre-push measured at 3.5–5 min, and inside `run-tests` a parallel rewrite would compete for the same four cores, so a standalone speed-up is too small to be worth another change to a regression suite. Pre-push `run-tests` wall time is a separate question; the human decided (2026-09-16) not to track it.
|
||||
|
||||
6. [x] ~~**Prose-grep tests.** `test-governance-layer.sh` and `test-instructions-and-docs.sh` (583 lines) grep markdown for phrases, including a one-shot "issue 0015 refactor incomplete" assertion made permanent and an assertion that `docs/notes/` exists. Delete both.~~ `check-apm-agents-valid.sh` (~~161 + 264 test lines~~ → **167 + 282**, re-measured 2026-09-16 at HEAD) is a loop plus fail-closed guards around `validate.sh`; it folds into the merged audit skill's own tests (finding 14). Effort S.
|
||||
> **Done (2026-09-12):** see commit `5f9f2b3` on `docs/simplification-audit`. Deleted `tests/test-governance-layer.sh` (270 lines) and `tests/test-instructions-and-docs.sh` (313 lines); no other file referenced either. `check-apm-agents-valid.sh` was left untouched — its fate is tied to the separate, out-of-scope skill-merge finding 14.
|
||||
> **Closed (2026-09-16): `check-apm-agents-valid` stays as a repo-level hook; the fold is not proceeding.** Finding 14 landed and left it in place, updated to call `factory-audit`'s `validate.sh`. It cannot fold into the skill's own tests: it validates *this repo's* `plugins/*/.apm/agents/*.agent.md` files, which exist only here, while a skill's `tests/` ship to every consumer (§9) and must run on fixtures. Its reason to exist — the validator had never run against the artifacts it governs — is unchanged. 167 script + 282 test lines, re-measured at HEAD.
|
||||
|
||||
7. [x] ~~**`check-plugin-content-sync.sh` is 813 lines wrapping `apm pack`, with a 1,291-line test.** The mirror itself must stay (Claude Code marketplace installs need flat directories), and the script does real work a bare `git diff` would lose: it strips `tests/` from the mirror, regenerates both `plugin.json` files with `mcpServers` reinjected, and packs into a scratch copy so `--check` never mutates. Even so, 2,100 lines for that is disproportionate; target a third. Effort M.~~
|
||||
> **Superseded then done (2026-09-14):** see commit `718c79a` on `docs/simplification-audit`. The recommendation ("target a third") is void, not met — the §8 question it depended on was settled the other way. Answering "apm-only" (ADR-0024) removed the mirror's reason to exist, and with the mirror gone the script guarded nothing, so the whole thing was deleted rather than shrunk: `scripts/sync-plugin-content.sh` (813 lines), `tests/test-sync-plugin-content.sh` (1,289 lines — the finding said 1,291), the `check-plugin-content-sync` pre-push hook, and `scripts/lib/marketplace-plugins.sh` (86 lines, whose only consumer was the sync script, and which finding 1 had explicitly kept alive for it). `validate-plugins` went with them, and the twelve per-plugin `plugin.json` manifests the script regenerated. The finding's own premise — "the mirror itself must stay" — is what turned out to be wrong.
|
||||
|
||||
8. **`docs/spec/gates.md` (1,048 lines) is roughly 15% "what is enforced" and 85% post-mortems** of defects already fixed and pinned by tests. The 60-line hook table is the useful part. Target 200 lines. The same applies to the 106 comment lines in `.pre-commit-config.yaml` and to `scripts/`, where 8 of 15 files are 40 to 60% comments. Effort M.
|
||||
8. [x] **`docs/spec/gates.md` (1,048 lines) is roughly 15% "what is enforced" and 85% post-mortems** of defects already fixed and pinned by tests. The 60-line hook table is the useful part. Target 200 lines. The same applies to the 106 comment lines in `.pre-commit-config.yaml` and to `scripts/`, where 8 of 15 files are 40 to 60% comments. Effort M.
|
||||
> **Partially done (2026-09-13):** see commit `a35f5e8` on `docs/simplification-audit`. The 85%-post-mortem characterization was stale — the file had already shrunk to 966 lines by other findings, and most of what remained is load-bearing "why this design" rationale cited by ADRs and tests, not dead incident narration. Cut only the two genuinely stale passages: a reproduction paragraph carrying explicitly outdated numbers, and a retrofit-process narrative superseded by current state — a 36-line cut, 966 → 930 as measured at commit `a35f5e8`. Those two figures describe that commit only, not the file: `718c79a` and later findings have edited `gates.md` again, so read its current length from the file rather than quoting a number here. `.pre-commit-config.yaml`'s comments were left untouched; on inspection they're compact constraint notes, not filler. Target of 200 lines not reached and not recommended — would require deleting content the file itself flags as load-bearing.
|
||||
>
|
||||
> **Closed (2026-09-16, grill): done to the extent recommended.** The `gates.md` cut in `a35f5e8` stands; the 200-line target stays rejected (the file is ~~1,113 lines at HEAD~~ → ~~**1,164** lines at HEAD (`b426460`)~~ → **1,137** lines at `baa2f5d`, `wc -l docs/spec/gates.md`, grown by later findings' sections, and read on demand only). The tests target below is struck: ~~findings 3, 5 and 16 each found dense suites to be named-incident regression coverage~~ → findings 3 and 5 each found dense test suites to be named-incident regression coverage, and finding 16 found the same of dense validator code, whose comments are an incident log. Any future cut to a test suite is its own finding and starts by reading that suite's header.
|
||||
|
||||
**Proposed target.** ~~Pre-push 14 hooks to 6: `run-tests`, `validate-plugins`, `validate-marketplace`, `apm-pack-check-clean`, `check-plugin-content-sync`, `check-release-needed`.~~
|
||||
|
||||
> **Corrected (2026-09-14):** two of the six named targets no longer exist — `validate-plugins` and `check-plugin-content-sync` were deleted in commit `718c79a` (finding 7, ADR-0024). Actual state today: **9 repo-authored pre-push hooks** — `run-tests`, `check-executables-allow-sync`, `apm-audit-ci`, `check-apm-agents-valid`, `apm-pack-check-clean`, `check-vale-style-sync`, `check-scope-walkup-sync`, `check-release-needed`, `validate-marketplace` — plus the 2 pre-commit `meta` hooks that also run at this stage, so 11 are reported at pre-push. `validate-marketplace` was kept: the root `marketplace:` block in `apm.yml` and the root `.claude-plugin/marketplace.json` stay, because apm's own marketplace consumers read that same catalogue and `<name>@holocron` short names depend on it. (That manifest is the only tracked file under `.claude-plugin/` — `git ls-files .claude-plugin` returns it alone. The sibling `.claude-plugin/plugin.json` is a local `apm pack` byproduct, has never been tracked on any branch, and is ignored at `.gitignore:59`; it was not "kept", because it was never there.)
|
||||
|
||||
> **Superseded count (2026-09-15):** finding 14 deleted `check-vale-style-sync` with the merge into `factory-audit` (ADR-0025), so pre-push is now **8 repo-authored hooks** (10 reported). The dated note above is the state on 2026-09-14; see finding 14's note for the correction.
|
||||
> **Superseded count (2026-09-15):** finding 14 deleted `check-vale-style-sync` with the merge into `factory-audit` (ADR-0025), so pre-push ~~is now~~ → was **8 repo-authored hooks** (10 reported). The dated note above is the state on 2026-09-14; see finding 14's note for the correction.
|
||||
>
|
||||
> > **Superseded count (2026-09-16, at HEAD `b426460`):** `8451169` added `check-skill-version-bump` (finding 33), so pre-push is **9 repo-authored hooks** (11 reported) — the eight above plus that one. Measured with `grep -c "stages: \[pre-push\]" .pre-commit-config.yaml`.
|
||||
>
|
||||
> > **Superseded count (2026-09-16, at `4de5b6b`):** `4de5b6b` removed `check-release-needed` (finding 36), so pre-push is **8 repo-authored hooks** (10 reported) — the nine above minus that one. Measured the same way.
|
||||
|
||||
Pre-commit stays roughly as is minus `skill-frontmatter`, and minus `check-ast` once finding 9 removes the only `.py` files. ~~Tests 26 files to about 10 (12,400 to about 5,000 lines).~~ Keep bats and its three submodules; the 351 bats tests ship inside plugins and are the right tool there. Do not port the bash suites to bats; delete them instead.
|
||||
Pre-commit stays roughly as is minus `skill-frontmatter`, and minus `check-ast` once finding 9 removes the only `.py` files. ~~Tests 26 files to about 10 (12,400 to about 5,000 lines).~~ Keep bats and its three submodules; the 351 bats tests ship inside plugins and are the right tool there. ~~Do not port the bash suites to bats; delete them instead.~~ **Struck (2026-09-16, grill):** see finding 8's closing note — the suites are regression coverage (findings 3 and 5; finding 16 found the same of the validators they test).
|
||||
|
||||
> **Re-measured (2026-09-14, at `a6434e0`):** the tests target was stated against the 2026-09-10 baseline and both its numbers are stale. `tests/` now holds **20 `test-*.sh` suites totalling 9,123 lines** (plus the two runners, 490). Six suites have gone since the baseline: `test-check-manifests.sh` (`e647f14`), `test-skill-frontmatter.sh` (`c8a7c9e`), `test-governance-layer.sh` and `test-instructions-and-docs.sh` (`5f9f2b3`), `test-sync-marketplace-mirror.sh` (`0dffff3`), `test-sync-plugin-content.sh` (`718c79a`). Restated on the same basis the target is **20 files to about 10, 9,123 to about 5,000 lines** — the file half of the target is now the closer half, and finding 9's `check-ast` clause is moot anyway, since finding 9 is not proceeding.
|
||||
> **Re-measured (2026-09-14, at `a6434e0`):** the tests target was stated against the 2026-09-10 baseline and both its numbers are stale. `tests/` now holds **20 `test-*.sh` suites totalling 9,123 lines** (plus the two runners, 490). Six suites have gone since the baseline: `test-check-manifests.sh` (`e647f14`), `test-skill-frontmatter.sh` (`c8a7c9e`), `test-governance-layer.sh` and `test-instructions-and-docs.sh` (`5f9f2b3`), `test-sync-marketplace-mirror.sh` (`0dffff3`), `test-sync-plugin-content.sh` (`718c79a`). ~~Restated on the same basis the target is **20 files to about 10, 9,123 to about 5,000 lines**~~ — **struck (2026-09-16):** the target itself is withdrawn (see the struck sentence above); for the record, `tests/` holds **19** suites totalling **10,000** lines at `4b17703`, after `4de5b6b` deleted `test-check-release-needed.sh` and `test-vale-hooks-consumer.sh`. Finding 9's `check-ast` clause is moot anyway, since finding 9 is not proceeding.
|
||||
> > **Corrected (2026-09-20, at `1614bce`) — the deletion tally is nine, not ~~six~~ → ~~eight~~.** The six named above plus the two the 2026-09-16 strike adds come to eight, and a ninth was never folded into the running tally: **`test-check-vale-style-sync.sh`**, removed by `620f20b` with the `factory-audit` merge (finding 14) — the same commit finding 2's bullet already credits for deleting that gate's hook and script. The full `main...HEAD` set is nine: `test-check-manifests.sh` (`e647f14`), `test-check-release-needed.sh` (`4de5b6b`), `test-check-vale-style-sync.sh` (`620f20b`), `test-governance-layer.sh` and `test-instructions-and-docs.sh` (`5f9f2b3`), `test-skill-frontmatter.sh` (`c8a7c9e`), `test-sync-marketplace-mirror.sh` (`0dffff3`), `test-sync-plugin-content.sh` (`718c79a`), `test-vale-hooks-consumer.sh` (`4de5b6b`). Method: `git diff --name-status main...HEAD -- tests/ | grep '^D'`. The pinned "19 suites at `4b17703`" is unaffected — `620f20b` precedes that commit, so the file count already reflected the deletion even though the tally did not. At `1614bce` `tests/` holds **19** `test-*.sh` suites totalling ~~**10,897**~~ → **10,588** lines. (**Corrected 2026-09-20:** the suite count was right and the line total was not — 10,897 is the value at `384756b`, the commit that added the hook-wiring tests, and at `1ec3e8a`; at `1614bce` the nineteen suites total 10,588.)
|
||||
|
||||
## 4. Plugins
|
||||
|
||||
@@ -153,25 +173,27 @@ The shared pattern: per-skill `README.md` files no model reads, a `docs/research
|
||||
|
||||
### 4.1 Cross-plugin (apply everywhere)
|
||||
|
||||
9. **Delete `docs/research/` from every plugin (~19,000 lines).** kyberforge's alone is 14,143 lines, 32% of the plugin, and about 8,900 of those are vendored third-party content (Anthropic `skill-creator` including a 1,325-line `viewer.html` and ten `.py` files, obra/superpowers, mattpocock). The rest is copied tool documentation. The gitea references explicitly say the research doc "has a known history of drifting from the deployed server". Every `apm.yml` uses `includes: auto`; whether the directory ships to consumers needs one check. Keep upstream URLs in one line per plugin README; git history keeps the rest. Check obra/superpowers licence if anything is retained. Goes together with finding 11: 32 `sources.md` files carry "Research doc" paths into these directories. Effort S.
|
||||
9. [x] **Delete `docs/research/` from every plugin (~19,000 lines).** kyberforge's alone is 14,143 lines, 32% of the plugin, and about 8,900 of those are vendored third-party content (Anthropic `skill-creator` including a 1,325-line `viewer.html` and ten `.py` files, obra/superpowers, mattpocock). The rest is copied tool documentation. The gitea references explicitly say the research doc "has a known history of drifting from the deployed server". Every `apm.yml` uses `includes: auto`; whether the directory ships to consumers needs one check. Keep upstream URLs in one line per plugin README; git history keeps the rest. Check obra/superpowers licence if anything is retained. Goes together with finding 11: 32 `sources.md` files carry "Research doc" paths into these directories. Effort S.
|
||||
> **Decision (2026-09-12):** Keep. `docs/research/` is retained on purpose — it's read by agents doing work sourced from those docs. Not proceeding.
|
||||
|
||||
10. [x] ~~**Delete per-skill `README.md` and `references/README.md` (48 files, 1,574 lines).** They restate the SKILL.md in narrative form. The pre-commit config itself notes a skill README "is consumer-facing prose that no agent ever loads". Keep one plugin-level README with one line per skill. Requires dropping the README criterion in `skill-audit/references/file-structure.md` and the README step in `new-skill.sh`. Effort S.~~
|
||||
> **Done (2026-09-12):** see commit `edcc57c` on `docs/simplification-audit`. Deleted the 48 per-skill/reference READMEs plus 2 scaffold templates; dropped the README criterion from `skill-audit`'s `file-structure.md` and `finding-criteria.md` and the README-generation step from `new-skill.sh`; updated `new-skill.bats` to match. Plugin-root READMEs were kept, not part of this finding.
|
||||
|
||||
11. **Drop the provenance chain: `sources.md`, `source_keys` frontmatter, `validate-provenance.sh`.** 32 plugin and skill `sources.md` files (about 1,300 lines) plus 9 research indexes, 216 source files with `source_keys`, ~~two copies of the validator (1,198 and 632 lines)~~ → **one validator, 2,171 lines across four files**, with ten checks, and ~~125 bats tests~~ → **138 bats tests** exist to track which upstream informed which file. Git blame and a URL in the README do the same job. This is more code than the content it tracks. Effort M (touches ~~skill-audit, both validator copies~~ → **`factory-audit`, its one provenance validator**, two repo tests, and every skill's frontmatter).
|
||||
> **Re-measured (2026-09-16, at HEAD):** ADR-0025 merged the two copies, so the "two copies" arithmetic throughout this finding and its note below no longer resolves. The provenance validator is now `factory-audit/scripts/` `validate-provenance.sh` (320) + `lib-provenance-skill.sh` (1,145) + `lib-provenance-agent.sh` (572) + `lib-contributing-files.sh` (134) = **2,171** lines (`wc -l` on the four), against **3,209** bats lines (`validate-provenance-skill.bats` 2,062 + `validate-provenance-agent.bats` 1,147) carrying **138** cases (`grep -c '^@test'`). Note this is *more* than the 1,198 + 632 = 1,830 the finding counted, not less: the merge deduplicated the resolver and the Contributing-files parser, not the per-mode provenance checks, and the shared entry script added the exit-tier and library guards described in `docs/spec/gates.md`. The `sources.md` census also moved: **45 files / 1,756 lines** — 27 skill `references/sources.md` (1,207), 13 research indexes (435), 4 plugin-root (100), 1 scaffold template (14). The note below's 46 / 1,752 swept in `docs/adr/0013-vale-harness-scope-and-rule-sources.md`, which matches `sources\.md$` and is not one. Imbalance at HEAD: **5,380 validator+bats lines against 1,756 of metadata, 3.1:1** — worse than the 2.6:1 below, on the same direction of argument.
|
||||
11. [x] **Drop the provenance chain: `sources.md`, `source_keys` frontmatter, `validate-provenance.sh`.** 32 plugin and skill `sources.md` files (about 1,300 lines) plus 9 research indexes, 216 source files with `source_keys`, ~~two copies of the validator (1,198 and 632 lines)~~ → **one validator, ~~2,171~~ → 2,186 lines across four files**, with ten checks, and ~~125 bats tests~~ → **138 bats tests** exist to track which upstream informed which file. Git blame and a URL in the README do the same job. This is more code than the content it tracks. Effort M (touches ~~skill-audit, both validator copies~~ → **`factory-audit`, its one provenance validator**, two repo tests, and every skill's frontmatter).
|
||||
> **Re-measured (2026-09-16, at HEAD):** ADR-0025 merged the two copies, so the "two copies" arithmetic throughout this finding and its note below no longer resolves. The provenance validator is now `factory-audit/scripts/` `validate-provenance.sh` (~~320~~ → **324**) + `lib-provenance-skill.sh` (~~1,145~~ → **1,152**) + `lib-provenance-agent.sh` (~~572~~ → **576**) + `lib-contributing-files.sh` (134) = ~~**2,171**~~ → **2,186** lines (`wc -l` on the four; **corrected 2026-09-20** — the four struck figures never reproduced at any commit, and `wc -l` gives 324 / 1,152 / 576 / 134 at `620f20b`, the commit that created the files, and at every commit since, `1ec3e8a` included), against **3,209** bats lines (`validate-provenance-skill.bats` 2,062 + `validate-provenance-agent.bats` 1,147) carrying **138** cases (`grep -c '^@test'`). Note this is *more* than the 1,198 + 632 = 1,830 the finding counted, not less: the merge deduplicated the resolver and the Contributing-files parser, not the per-mode provenance checks, and the shared entry script added the exit-tier and library guards described in `docs/spec/gates.md`. The `sources.md` census also moved: **45 files / 1,756 lines** — 27 skill `references/sources.md` (1,207), 13 research indexes (435), 4 plugin-root (100), 1 scaffold template (14). The note below's 46 / 1,752 swept in `docs/adr/0013-vale-harness-scope-and-rule-sources.md`, which matches `sources\.md$` and is not one. Imbalance at HEAD: ~~**5,380**~~ → **5,395 validator+bats lines against 1,756 of metadata, 3.1:1** (2,186 + 3,209; the ratio is unchanged at 3.07) — worse than the 2.6:1 below, on the same direction of argument.
|
||||
> **Verified (2026-09-14, at HEAD `062ca47`):** direction defensible, two scope figures wrong, and **blocked on a decision the finding never poses**. The `sources.md` census below is exact, and so are the finding's own validator and bats figures (1,198 / 632 lines, 125 bats tests); the scope errors are narrower than an earlier revision of this note claimed.
|
||||
>
|
||||
> Corrected figures: **46 `sources.md` files / 1,752 lines** in three distinct classes — 29 skill `references/sources.md` (1,217 lines), 13 research indexes (435), 4 plugin-root files (100, ADR-0010). The finding does **not** double-count: it states two disjoint classes additively ("32 plugin and skill `sources.md` files (about 1,300 lines) **plus** 9 research indexes"), and that plugin-and-skill subtotal is really **33 files / 1,317 lines**, matching its "about 1,300" exactly — had the 32 swept in the research indexes the figure would have been ~1,750. Its real errors there are an off-by-one (32 should be 33) and an omission: it missed the 4 vendored example indexes under `kyberforge/docs/research/examples/skill-write/`, so 9 should be 13. Carriers of `source_keys` in YAML frontmatter: **196** — 168 at column 0 and 28 nested two spaces under `metadata:` — so the finding's 216 is closer to the truth than it looks. (219 files merely *mention* the string. A naive `^[[:space:]]*source_keys:` grep returns 200, but 4 of those are heredoc or fixture text rather than frontmatter: both `validate-provenance.bats` copies, `scripts/check-scope-walkup-sync.sh`, and a fenced example in `plugins/bin/.apm/skills/research/references/file-format.md`.) Checks: **16 across the two copies** (skill-audit 0–9, agent-audit 0–5), not ten. Validator line counts (1,198 / 632) and 125 bats tests are exact.
|
||||
>
|
||||
> **"Touches every skill's frontmatter" is roughly right.** ~~**28 of the 39 real skills carry `source_keys` in frontmatter**~~ → **27 of the 38** (re-measured 2026-09-16 at HEAD; the audit-pair merge took one carrier skill with it), nested under `metadata:` — see `plugins/git/.apm/skills/git-commits/SKILL.md:10-17`, where `metadata:` → `source_keys:` carries four slugs. (~~44~~ → **43** tracked files match `*SKILL.md`; subtract `skill-author/assets/templates/SKILL.md` and the 4 vendored under `kyberforge/docs/research/examples/skill-write/`, leaving ~~39~~ → **38** real skills.) The 11 without it are exactly the `plugins/bin/` skills. Check 2 in the skill-side validator (SKILL.md `source_keys` → slug in `sources.md`) is correspondingly **live**, not dead code: `parse_source_keys()` at `plugins/kyberforge/.apm/skills/factory-audit/scripts/lib-provenance-skill.sh:277-305` handles both spellings explicitly — the metadata-nested branch at `:292`, the top-level branch at `:295`, and a docstring that says "handles metadata.source_keys and top-level" — check 2 at `:712` runs against all ~~28~~ → **27** carrier skills, every one of which has a `references/sources.md`, and bats pins it at `plugins/kyberforge/.apm/skills/factory-audit/tests/validate-provenance-skill.bats:222` ("FAIL: source_keys slug in SKILL.md not present as H2 in sources.md") and ~~`:1337`~~ → `:1338` (a BOM must not silently disable check 2). (Paths and line numbers re-derived at HEAD: ADR-0025's merge moved this code out of `skill-audit/scripts/validate-provenance.sh` into the shared skill-side library, so the figures this note carried at `062ca47` — `:242-270`, `:257`, `:260`, `:766`, `:1313` — no longer resolve.) The imbalance the finding names is real and **worse** than claimed: ~~4,641 validator+bats lines against 1,752 of metadata, a 2.6:1 ratio~~ → **5,380 against 1,756, a 3.1:1 ratio** (re-measured 2026-09-16 at HEAD; see the note under the headline).
|
||||
> **"Touches every skill's frontmatter" is roughly right.** ~~**28 of the 39 real skills carry `source_keys` in frontmatter**~~ → **27 of the 38** (re-measured 2026-09-16 at HEAD; the audit-pair merge took one carrier skill with it), nested under `metadata:` — see `plugins/git/.apm/skills/git-commits/SKILL.md:10-17`, where `metadata:` → `source_keys:` carries four slugs. (~~44~~ → **43** tracked files match `*SKILL.md`; subtract `skill-author/assets/templates/SKILL.md` and the 4 vendored under `kyberforge/docs/research/examples/skill-write/`, leaving ~~39~~ → **38** real skills.) The 11 without it are exactly the `plugins/bin/` skills. Check 2 in the skill-side validator (SKILL.md `source_keys` → slug in `sources.md`) is correspondingly **live**, not dead code: `parse_source_keys()` at `plugins/kyberforge/.apm/skills/factory-audit/scripts/lib-provenance-skill.sh:`~~`277-305`~~ → `:284-312` handles both spellings explicitly — the metadata-nested branch at ~~`:292`~~ → `:299`, the top-level branch at ~~`:295`~~ → `:302`, and a docstring that says "handles metadata.source_keys and top-level" — check 2 at ~~`:712`~~ → `:719` runs against all ~~28~~ → **27** carrier skills, every one of which has a `references/sources.md`, and bats pins it at `plugins/kyberforge/.apm/skills/factory-audit/tests/validate-provenance-skill.bats:222` ("FAIL: source_keys slug in SKILL.md not present as H2 in sources.md") and ~~`:1337`~~ → `:1338` (a BOM must not silently disable check 2). (Paths and line numbers re-derived at HEAD: ADR-0025's merge moved this code out of `skill-audit/scripts/validate-provenance.sh` into the shared skill-side library, so the figures this note carried at `062ca47` — `:242-270`, `:257`, `:260`, `:766`, `:1313` — no longer resolve.) **Corrected (2026-09-20):** the four "re-derived at HEAD" citations into `lib-provenance-skill.sh` were themselves uniformly 7 lines low and never resolved at any commit; they are repointed above. The two `validate-provenance-skill.bats` citations (`:222`, `:1338`) do resolve and are left alone. The imbalance the finding names is real and **worse** than claimed: ~~4,641 validator+bats lines against 1,752 of metadata, a 2.6:1 ratio~~ → ~~**5,380**~~ → **5,395 against 1,756, a 3.1:1 ratio** (re-measured 2026-09-16 at HEAD; see the note under the headline).
|
||||
>
|
||||
> **Omitted entirely: the chain has a producer.** `plugins/bin/.apm/skills/research/` *specifies* the `sources.md` + `source_keys:` output format, and `plugins/bin/evals/research/research/eval.yaml` carries three criteria asserting it. **This is the blocking decision: does `research` keep emitting `sources.md`?** If yes, the chain is not dropped — only unenforced, and the finding collapses to "delete the validators." If no, the research skill's output contract and its evals need redesigning.
|
||||
>
|
||||
> Also breaks: `check-scope-walkup-sync` loses one of four walk-up ports (the hook exists because three scripts drifted); `tests/test-adr0020-contract.sh` loses its parser byte-identity assertion; `tests/test-check-scope-walkup-sync.sh` must re-base its fixture; ADR-0010 is superseded outright and ADR-0009/0016 need amending (`field-inventory.md`'s allowlist data line carries `source_keys`). `LESSONS.md:73` records this validator as the **only** thing that catches a skill authored outside `skill-author` — a failure that "recurred twice in one session" — so "git blame + a README URL do the same job" is false for the one thing the chain demonstrably catches. Side effect: 55 reference files have frontmatter containing *only* `source_keys:`, leaving empty `---\n---` blocks to delete.
|
||||
>
|
||||
> **Effort L, not M** (about ~~6,393~~ → **7,136** lines deleted across 242 files: the ~~4,641~~ → **5,380** validator and bats lines plus the ~~1,752~~ → **1,756** of `sources.md` measured above, across 196 `source_keys` carriers and ~~46~~ → **45** `sources.md` files. An earlier revision of this note said ~4,600 lines across ~230 files, which was internally inconsistent — 4,600 is validator-plus-bats only and silently drops the `sources.md` this same note measures, and ~230 inherited a carrier count of 172 that missed every `metadata:`-nested file.) Smaller alternative worth considering: scope the drop to the skill half only (~~1,217 lines, 1,198-line validator, 82 tests~~ → **1,207 lines of skill `sources.md`, the 1,145-line `lib-provenance-skill.sh`, 87 tests**, re-measured 2026-09-16 at HEAD) and leave the ADR-0010 plugin-root half alone — no ADR supersession needed.
|
||||
> **Effort L, not M** (about ~~6,393~~ → ~~**7,136**~~ → **7,151** lines deleted across ~~242~~ → **241** files: the ~~4,641~~ → ~~**5,380**~~ → **5,395** validator and bats lines plus the ~~1,752~~ → **1,756** of `sources.md` measured above, across 196 `source_keys` carriers and ~~46~~ → **45** `sources.md` files — 196 + 45 = 241, and the struck 242 was consistent only with the struck 46. An earlier revision of this note said ~4,600 lines across ~230 files, which was internally inconsistent — 4,600 is validator-plus-bats only and silently drops the `sources.md` this same note measures, and ~230 inherited a carrier count of 172 that missed every `metadata:`-nested file.) Smaller alternative worth considering: scope the drop to the skill half only (~~1,217 lines, 1,198-line validator, 82 tests~~ → **1,207 lines of skill `sources.md`, the ~~1,145~~ → 1,152-line `lib-provenance-skill.sh`, 87 tests**, re-measured 2026-09-16 at HEAD) and leave the ADR-0010 plugin-root half alone — no ADR supersession needed.
|
||||
>
|
||||
> **Decision (2026-09-16):** Not proceeding — the human declined this finding. The provenance chain (`sources.md`, `source_keys:`, `validate-provenance.sh`) stays, and `research` keeps producing it. This also answers §8's provenance question.
|
||||
|
||||
12. [x] ~~**Strip ADR and changelog narration from model-facing files.** `ADR-0020` is cited in 3 of 7 kyberforge SKILL.md files and 16 references; ADR-0023 is cited inline 21 times in the git plugin. Examples: "was the old house rule and ADR-0020 deleted it", "were removed per ADR-0015 once issue #90 landed", "this file previously recorded `list_issues` as having neither a `type` nor a `milestones` parameter". `skill-author/references/retrofit.md` (197 lines) is a one-time migration guide; it is loaded from `improve.md` and listed in `sources.md`, so remove those in the same change. These belong in git history or the ADR, not in context. Effort S.~~
|
||||
> **Done (2026-09-12):** see commit `edcc57c` on `docs/simplification-audit`. Historical narration stripped from kyberforge (ADR-0020) and git (ADR-0023) skill content; `retrofit.md` deleted along with its load-step and `sources.md` entries. Caught in review: some `ADR-0023` tags were not narration but the `check-rtk-prefix` hook's required opt-out marker for intentionally-bare git commands — those 12 were restored, not left stripped.
|
||||
@@ -184,19 +206,31 @@ The shared pattern: per-skill `README.md` files no model reads, a `docs/research
|
||||
14. [x] ~~**Merge `skill-audit` + `agent-audit` into one `audit` skill (removes about 3,300 lines and two pre-push hooks).** `vale-wrap.sh` is byte-identical in both; five Vale rules byte-identical (agent-audit carries one extra, so it is the superset); `validate.sh` shares a 1,061-line boundary-target resolver block that diffs as zero lines; SKILL.md steps 1, 3, 4 and the gotchas are the same text. Each copy is hard-wired to one mode, so the merged script needs a path switch. The duplication exists because a plugin-cache install copies only each skill's own files (the rule ADR-0014 follows), so a script cannot be shared across skills; merging the skills is the only way to remove the copy. Effort M.~~
|
||||
> **Done (2026-09-15), with three of its claims corrected.** Merged into **`factory-audit`**, not `audit` — the name states the domain (the artifact factory's own output) rather than the verb. See `docs/adr/0025-skill-audit-and-agent-audit-merge-into-factory-audit.md`. The repo goes from 39 skills to 38. Entry scripts are `scripts/validate.sh`, `scripts/validate-provenance.sh` and `scripts/vale-wrap.sh`. Only the first two auto-detect the artifact type they were handed and dispatch to a per-type library. `vale-wrap.sh` does not and never did: it is byte-identical to both pre-merge copies (`diff` clean against each at `a5962ba`) and names neither `SKILL.md` nor `.agent.md` anywhere in its 526 lines. Its scoping comes from outside it — the `.vale.ini` glob sections and the `files:` regexes of the two hooks that call it.
|
||||
>
|
||||
> - **Yield: 2,934 lines and ONE pre-push hook, not ~3,300 and two.** The hook is `check-vale-style-sync`, deleted with its script (413 lines) and `tests/test-check-vale-style-sync.sh` (797). **They did *not* exist only to diff the two now-merged Vale copies** — an earlier revision of this bullet said so and it was wrong, as this document's own ":104" measurement already implied. The script has **17** assertion sites (13 `err` calls and 4 hard-fail exits; ADR-0025 maps each one). Only **6** are genuinely moot: two diffed the copies and four guarded the script's ability to locate them. **10** were rehomed into `tests/test-vale-wrap.sh`: case 0 (config loads), cases 28–30 (glob probes, style loading, Copilot scoping), case 31 (override allowlist) and the suite-level exit 77. **1**, the cross-manifest `files:` drift check, is ported as case 33, pairing hooks by `id:` since both now share one `entry:`. *(Corrected later on 2026-09-15.)* An earlier revision of this bullet said 18 / 6 / 11 / 1. It called the cross-manifest check knowingly dropped and "seven of them stronger". None of that survives a recount. Two text greps became behavioural Vale probes, not seven, and case 32 alone never covered the narrowing that case 33 now catches. `check-scope-walkup-sync` **survives**; see the §10 correction below for why. Pre-push goes 9 repo-authored hooks to 8 (11 reported to 10). The rest of the saving is the second embedded resolver (1,061), the second `vale-wrap.sh` (526), the second `assets/vale/styles/Kyberforge/` copy (44), and the Contributing-files parser embedded in both `validate-provenance.sh` copies (93). **413 + 797 + 1,061 + 526 + 44 + 93 = 2,934**, which is the headline. An earlier revision of this bullet listed 413 + 797 + 526 + 48 + 1,061 = 2,845: it dropped the 93-line parser outright, and its **48** for the Vale copy is the five byte-identical style rules (13 + 7 + 7 + 7 + 10 = **44**) plus skill-audit's 4-line `.vale.ini`. ADR-0025 counts **44** on purpose — the two `.vale.ini` files were deliberately *not* identical (agent-audit's carried the extra `[**/*.agent.md]` section and the `KyberforgeCopilot` style), so that file is a deleted file rather than a removed duplicate, and folding it in would make the headline 2,938. All six figures measured at `a5962ba`.
|
||||
> - **Yield: 2,934 lines and ONE pre-push hook, not ~3,300 and two.** The hook is `check-vale-style-sync`, deleted with its script (413 lines) and `tests/test-check-vale-style-sync.sh` (797). **They did *not* exist only to diff the two now-merged Vale copies** — an earlier revision of this bullet said so and it was wrong, as this document's own ":104" measurement already implied. The script has **17** assertion sites (13 `err` calls and 4 hard-fail exits; ADR-0025 maps each one). Only **6** are genuinely moot: two diffed the copies and four guarded the script's ability to locate them. **10** were rehomed into `tests/test-vale-wrap.sh`: case 0 (config loads), cases 28–30 (glob probes, style loading, Copilot scoping), case 31 (override allowlist) and the suite-level exit 77. **1**, the cross-manifest `files:` drift check, ~~is ported as case 33, pairing hooks by `id:` since both now share one `entry:`~~ → was ported as case 33 and later deleted with its second manifest in `4de5b6b` (finding 36). *(Corrected later on 2026-09-15.)* An earlier revision of this bullet said 18 / 6 / 11 / 1. It called the cross-manifest check knowingly dropped and "seven of them stronger". None of that survives a recount. Two text greps became behavioural Vale probes, not seven, and case 32 alone never covered the narrowing that case 33 now catches. `check-scope-walkup-sync` **survives**; see the §10 correction below for why. Pre-push goes 9 repo-authored hooks to 8 (11 reported to 10). The rest of the saving is the second embedded resolver (1,061), the second `vale-wrap.sh` (526), the second `assets/vale/styles/Kyberforge/` copy (44), and the Contributing-files parser embedded in both `validate-provenance.sh` copies (93). **413 + 797 + 1,061 + 526 + 44 + 93 = 2,934**, which is the headline. An earlier revision of this bullet listed 413 + 797 + 526 + 48 + 1,061 = 2,845: it dropped the 93-line parser outright, and its **48** for the Vale copy is the five byte-identical style rules (13 + 7 + 7 + 7 + 10 = **44**) plus skill-audit's 4-line `.vale.ini`. ADR-0025 counts **44** on purpose — the two `.vale.ini` files were deliberately *not* identical (agent-audit's carried the extra `[**/*.agent.md]` section and the `KyberforgeCopilot` style), so that file is a deleted file rather than a removed duplicate, and folding it in would make the headline 2,938. All six figures measured at `a5962ba`.
|
||||
> - **"Each copy is hard-wired to one mode" was false**, and it is the claim that made this look like a bigger win than it is. The two `validate.sh` files are not one script parameterised per mode: outside the shared 1,061-line resolver they hold **1,293 lines between them** (616 skill-side, 677 agent-side) and share **91** of those. That 91 is ADR-0025's figure and it is exactly reproducible: strip the marked resolver block from each copy at `a5962ba` (`115..1175` skill-side, `189..1249` agent-side, 1,061 lines each), then take the size of the intersection of the two *distinct raw line sets* — 510 distinct lines skill-side, 530 agent-side, 91 in common. An earlier revision of this bullet said "about 115", which matches no counting rule that has been reproduced: dropping blank lines gives 90 and dropping comments as well gives 64. The merged validator dispatches on artifact type over two largely independent bodies of checks; it does not collapse them.
|
||||
> - **The §8 blocker was a non-issue.** The design question held open there — whether one `description` could carry both skills' trigger sets without breaching the ADR-0020 ceiling — was answered against the **400-character FAIL**, which the merged description clears. Read the number from the shipped file, not from a draft. *(Corrected later on 2026-09-15.)* The shipped description is **241 characters**, inside the 250-character SUGGESTION target, and `bash scripts/skill-size-check.sh plugins/kyberforge/.apm/skills/factory-audit/SKILL.md` prints nothing for it. A first cut shipped at **319** and accepted the SUGGESTION as the cost of carrying both artifact types' trigger phrases. That reasoning was wrong. The quoted phrases (`audit this skill`, `review my SKILL.md`, `audit this agent`, `review my agent file`) restated the "skill directory or agent definition audited" trigger in a second register, which ADR-0020 makes a FAIL. Removing them, and keeping both boundary arrows, gives 241. An earlier "241" in this document and ADR-0025's "240" came from a hypothetical single-arrow draft that was never reproduced. That today's figure is also 241 is a coincidence, not a confirmation of it. The real ceiling was the other one: a single body covering both artifact types ran past the **900-word body FAIL**. Solved the way ADR-0020 prescribes — a dispatch body that routes to per-type references, with the 16 per-type reference files namespaced `skill-*` and `agent-*` (plus the shared `sources.md`).
|
||||
>
|
||||
> **Finding 18 was deliberately kept out of scope.** Its re-scoped remainder is prose trimming inside these same files and would have made the merge diff unreviewable; it stays open against `factory-audit`'s files.
|
||||
>
|
||||
> > **Since closed (2026-09-16, grill):** finding 18 is no longer open — it closed as not proceeding; see its own closing note.
|
||||
|
||||
15. **Merge `skill-author` + `agent-author` likewise.** `contract.md` shares most of its Description section; `new-skill.sh` and `new-agent.sh` implement the same package-root walk-up with different mode names; step 1 dispatch tables and step 3 gates are near-identical. Keep the agent scope logic (plugin vs project/user) as its own reference. Effort M.
|
||||
15. [x] ~~**Merge `skill-author` + `agent-author` likewise.** `contract.md` shares most of its Description section; `new-skill.sh` and `new-agent.sh` implement the same package-root walk-up with different mode names; step 1 dispatch tables and step 3 gates are near-identical. Keep the agent scope logic (plugin vs project/user) as its own reference. Effort M.~~
|
||||
> **Refuted (2026-09-16, at HEAD `14248e0`). The overlap is about 150–180 lines, not "most" of anything, and ADR-0020's exclusion of the pair holds on measurement.** Measured as distinct non-blank lines common to both skills, raw and then with `skill`/`agent` normalised to one token: `SKILL.md` 13–14 of 45 / 46; `references/contract.md` 36–37 of 205 / 126; `references/improve.md` 14–15 of 65 / 64; `references/create.md` 9–10 of 138 / 68; every other reference ≤12. The scripts share **48** lines (`new-skill.sh` 189, `new-agent.sh` 303, counts include blanks), mostly the package-root walk-up and its `apm.yml` `type:` matcher; the two bats suites share **15** (209 / 349). Reproduce with `comm -12 <(grep -v '^\s*$' A | sort -u) <(grep -v '^\s*$' B | sort -u) | wc -l`, run from `plugins/kyberforge/.apm/skills/` against each `skill-author/X` and `agent-author/X` pair.
|
||||
>
|
||||
> - **"`contract.md` shares most of its Description section" overstates it.** The shared span is the three-part shape, the banned-content list, the length gate and the boundary-target resolution rules — 36 lines against files of 205 and 126.
|
||||
> - **"Step 1 dispatch tables and step 3 gates are near-identical" is true only of those two steps.** Step 2 differs completely (invocation axis vs. scope resolution), Step 3's body gate is a word budget in one and a delegation check in the other, and Step 4 bumps `metadata.version` in one and the package `apm.yml` `version` in the other.
|
||||
> - **This is the opposite shape to finding 14.** There the copies were byte-identical — a 1,061-line resolver, a 526-line `vale-wrap.sh`, identical style rules — and merging removed 2,934 lines. Here the skills emit different artifacts (a skill directory vs. a one-file or two-file agent, ADR-0005 / ADR-0016), so a merge would put two unrelated scaffolds, two scripts and two test suites behind one dispatch step to save about 150 lines and one router entry.
|
||||
> - **It would not retire `check-scope-walkup-sync`.** Merging takes the gate's four walk-up ports to three; the gate stays (see §10).
|
||||
>
|
||||
> Not proceeding. ADR-0020's rejected alternative and ADR-0025 point 7 now carry this measurement. The remaining overlap is unguarded; ADR-0020 names a text-sync gate as the only option for this pair, and 36 lines of shared Description prose do not justify one.
|
||||
|
||||
16. **Cut the validators by an order of magnitude.** `validate.sh` is 1,677 lines of bash with embedded Python, ported twice; `skill-size-check.sh` is 1,497. Target about 200 lines total: frontmatter present, size ceilings, boundary targets resolve. The 526-line `vale-wrap.sh` exists to work around folded `>` scalars in descriptions; writing descriptions as `|` literal blocks removes the folding problem, but the wrapper is also the exported hook entry in `.pre-commit-hooks.yaml` and carries the NOT RUN guard the audits depend on, so it shrinks rather than disappears. This is where the real complexity lives and is the item most worth discussing. Effort L.
|
||||
16. [x] **Cut the validators by an order of magnitude.** `validate.sh` is 1,677 lines of bash with embedded Python, ported twice; `skill-size-check.sh` is 1,497. Target about 200 lines total: frontmatter present, size ceilings, boundary targets resolve. The 526-line `vale-wrap.sh` exists to work around folded `>` scalars in descriptions; writing descriptions as `|` literal blocks removes the folding problem, but the wrapper is also the exported hook entry in `.pre-commit-hooks.yaml` and carries the NOT RUN guard the audits depend on, so it shrinks rather than disappears. This is where the real complexity lives and is the item most worth discussing. Effort L.
|
||||
> **Refuted (2026-09-14, at HEAD `062ca47`). Finding 16 has no independent content — its only safe saving belongs to finding 14.**
|
||||
>
|
||||
> **Re-measured (2026-09-16, at HEAD) — the basis of every figure below changed when ADR-0025 landed; the refutation is unaffected.** There are no longer three validators or two `vale-wrap.sh` copies. The headline's "ported twice" is void, and its `1,677` and `526` no longer name anything. At HEAD: `scripts/skill-size-check.sh` is **1,522** (the note below's 1,517 was correct at `a6434e0`); `factory-audit`'s validator is **2,663** lines across four files (`validate.sh` 255 + `lib-checks-skill.sh` 621 + `lib-checks-agent.sh` 683 + `lib-boundary-resolver.sh` 1,104); `vale-wrap.sh` is **535**, one copy. Validator total **4,185**, of which the resolver is **2,165** (the 1,061-line block still embedded in `skill-size-check.sh`, plus `lib-boundary-resolver.sh`'s 1,104 — the same 1,061 block wrapped in 43 lines of library preamble, which is why the byte-identity test compares the block and not the files). So the resolver is now **52%** of validator lines, not 65%, and **2,020** lines remain once it is excised, not 1,749. Tests: the six repo suites over `skill-size-check.sh` are **3,907** (was 3,619) and the two in-skill validator bats files **2,248** (`validate-skill.bats` 1,029 + `validate-agent.bats` 1,219), for **6,155**, not 5,506. The 200-line target is off by the same order of magnitude it was. (All figures `wc -l`; the resolver block by `awk '/BEGIN ADR-0020 SHARED BOUNDARY RESOLVER/,/END .../'`.)
|
||||
>
|
||||
> > **Superseded by `ef27c97` (re-measured 2026-09-19, at HEAD).** The paragraph above is a dated snapshot and its two load-bearing claims no longer hold. `scripts/skill-size-check.sh` is **509** lines, not ~~1,522~~ → **1,524** — it shrank by ~~1,013~~ → **1,015** — and the resolver is **no longer embedded in it**: `ef27c97` excised the 1,061-line block and the hook now sources `factory-audit`'s `lib-boundary-resolver.sh` by path (`RESOLVER_LIB` at `:483`, `. "$RESOLVER_LIB"` at `:492`), failing closed if the library is missing or defines no resolver. The single remaining `BEGIN ADR-0020 SHARED BOUNDARY RESOLVER` string in the hook is that fail-closed guard, not a copy. `factory-audit`'s four validator files now total **2,671** (`validate.sh` 255 + `lib-checks-skill.sh` 627 + `lib-checks-agent.sh` 685 + `lib-boundary-resolver.sh` 1,104) and `vale-wrap.sh` is **536**. So there is **one** resolver copy repo-wide, not two, and the "resolver is 52% of validator lines" arithmetic above is void along with its inputs. Only the refutation of finding 16 survives all of this unchanged. (**Corrected 2026-09-20:** this note originally read "not 1,522 — it shrank by 1,013", which contradicted the "−1,015" the closing note below states for the same commit. 1,522 was a stale pre-`ef27c97` reading: `git show ef27c97^:scripts/skill-size-check.sh | wc -l` is **1,524** and `ef27c97` is **509**, so the delta is **−1,015** in both places.)
|
||||
>
|
||||
> The three validators are **not three implementations**. They contain **one block, 1,061 lines, byte-identical in all three**, delimited by `# ===== BEGIN/END ADR-0020 SHARED BOUNDARY RESOLVER =====` and hashed by `tests/test-adr0020-contract.sh`. So 3,183 of 4,932 validator lines (65%) are that block × 3, and **what is left once the resolver is excised is 1,749 lines across all three** — 1,580 non-blank, 992 with comments and blanks both stripped. The duplication is forced by the self-containment constraint, which is why *merging* is the lever and *shrinking* is not.
|
||||
>
|
||||
> Corrected figures: `skill-size-check.sh` is **1,517**. The finding's 1,497 was correct when written — `git show 9eb8bc7:scripts/skill-size-check.sh` is 1,497 lines, and `9eb8bc7` (2026-09-10) is this audit's own first commit. It went stale two days *after*, at `c8a7c9e` (2026-09-12), the commit that folded `skill-frontmatter` in — which is why the finding's "frontmatter present" target is now work already done, not why its number was wrong. agent-audit's `validate.sh` is **1,738**, a superset, not a 1,677-line port. `vale-wrap.sh` 526 × 2 is exact.
|
||||
@@ -208,10 +242,13 @@ The shared pattern: per-skill `README.md` files no model reads, a `docs/research
|
||||
> **The `vale-wrap` half is wrong on its conclusion.** `|` literal blocks do fix the folding case — the script says so and deliberately no-ops on them — but the wrapper handles **four** affected scalar forms (folded `>`, bare plain, double- and single-quoted continuation lines), and **277 of its 526 lines are argv handling unrelated to folding** (cwd-relative absolutization, the `is_builtin_output` guard, scratch-tree mirroring, path relativization), each with its own incident record. Decisively, `.pre-commit-hooks.yaml` exports these hooks to external consumer repos whose scalar style this repo cannot dictate. Converting the 40 in-repo descriptions to `|` is a fine independent change; **it does not shrink the wrapper.**
|
||||
>
|
||||
> Where the savings actually are: **merge skill-audit + agent-audit (finding 14) → ~~−1,587 lines~~ → landed 2026-09-15 at −2,934 lines, zero coverage loss.** A second option — sourcing the resolver into `scripts/skill-size-check.sh` rather than embedding it (−1,061) — is technically possible but couples the root hook to plugin layout and dismantles the byte-identity contract test's design; needs a decision, not an assumption.
|
||||
>
|
||||
> **Decided and done (2026-09-16, grill; `ef27c97`).** The coupling objection went away with finding 36: `4de5b6b` retired `.pre-commit-hooks.yaml`, so `skill-size-check.sh` runs only inside this repo, where the plugin path always exists. The hook now sources `factory-audit/scripts/lib-boundary-resolver.sh` and fails closed without it. `scripts/skill-size-check.sh` went from **1,524** to **509** lines (`wc -l`, −1,015), and the change is −957 lines net across 9 files. The hook's stdout, stderr and exit code are identical before and after over every corpus `SKILL.md` and the 26 differential-suite fixtures. The contract test's byte-identity hash became single-copy assertions (27 → 29 passes), and ADR-0020 and ADR-0025 carry dated amendments.
|
||||
|
||||
17. **Fold `forge` and `apm-install`.** `forge` is a four-row routing table plus 207 lines of references explaining fork vs inline; it should be 25 lines with no references. `apm-install` (53 lines + 17-line sources) becomes a sixth dispatch row in `apm-workflow`. Effort S.
|
||||
17. [x] **Fold `forge` and `apm-install`.** `forge` is a four-row routing table plus 207 lines of references explaining fork vs inline; it should be 25 lines with no references. `apm-install` (53 lines + 17-line sources) becomes a sixth dispatch row in `apm-workflow`. Effort S.
|
||||
> **Decision (2026-09-16):** Not proceeding — the human declined this finding. `forge` and `apm-install` stay as separate skills.
|
||||
|
||||
18. **Delete prose the model already knows.** "Valid characters: lowercase letters, numbers, hyphens"; what pipx does and PEP 668; "code blocks carry a language tag"; "data to stdout, diagnostics to stderr". Ironically `body-discipline.md` instructs auditors not to include "concepts the agent already knows". Effort S.
|
||||
18. [x] **Delete prose the model already knows.** "Valid characters: lowercase letters, numbers, hyphens"; what pipx does and PEP 668; "code blocks carry a language tag"; "data to stdout, diagnostics to stderr". Ironically `body-discipline.md` instructs auditors not to include "concepts the agent already knows". Effort S.
|
||||
> **Re-scoped and folded into finding 22 (2026-09-14).** All four named examples were located, and they are four different classes of thing — only one is what the finding describes:
|
||||
>
|
||||
> | Example | Location | What it actually is |
|
||||
@@ -224,18 +261,20 @@ The shared pattern: per-skill `README.md` files no model reads, a `docs/research
|
||||
> Three exemptions agreed, which is what re-scopes the finding:
|
||||
>
|
||||
> - **Audit criteria are exempt.** ~~`body-discipline.md:14`~~ → `factory-audit/references/skill-body-discipline.md:14` frames the rule as "Would the agent get this wrong without this instruction?" — an auditor *would*, because the criterion is what it reports against. Cutting criteria is a redesign of what ~~`skill-audit`~~ → `factory-audit` checks, which belongs with finding 14.
|
||||
> > **Repointed (2026-09-16, at HEAD):** ADR-0025's merge both moved the directory and renamed the file (`references/formatting-and-scripts.md` → `references/skill-formatting-and-scripts.md`), so the two citations above were doubly stale. Line 19 and line 39 still land on the two criteria named, and `skill-body-discipline.md:14` still carries the core test — verified with `sed -n`. Per finding 14's note, finding 18 **stays open against `factory-audit`'s files**, so these are repointed, not struck.
|
||||
> > **Repointed (2026-09-16, at HEAD):** ADR-0025's merge both moved the directory and renamed the file (`references/formatting-and-scripts.md` → `references/skill-formatting-and-scripts.md`), so the two citations above were doubly stale. Line 19 and line 39 still land on the two criteria named, and `skill-body-discipline.md:14` still carries the core test — verified with `sed -n`. Per finding 14's note, finding 18 **stays open against `factory-audit`'s files**, so these are repointed, not struck. *(Since closed, 2026-09-16 grill — see the closing note at the end of this finding. The repointed citations stay as the record.)*
|
||||
> - **`assets/templates/` is exempt.** Scaffold output, not context.
|
||||
> - **Sourced restatement of a spec this repo's own artifacts are built to is exempt.** `skill-author/references/scripts.md` carries `source_keys: agentskills-using-scripts` and deliberately restates the agentskills.io spec — the contract every skill here is written against, so the restatement governs this repo's artifacts and has to be in front of the author. **`source_keys:` alone is not the test**, and cannot be: `conventional-commits-spec.md` and `bisect.md` both carry it too, and finding 20 recommends reducing both to a pointer plus the house delta. The decidable line is what the content governs — a spec this repo's artifacts must satisfy (agentskills.io) is exempt; documentation of an external tool the model already has (Conventional Commits, `git bisect`) is not. Grounding, stated honestly: findings 9 and 26 closed as "Keep — vendored upstream content is intentional", but both closed over the `docs/research/` and `docs/notes/` *directories*, not over skill `references/*.md`; extending them to `scripts.md` is this note's inference, not a recorded decision. (An earlier revision added "finding 11 re-decides this content's status anyway" — withdrawn: finding 11 proposes dropping the provenance *metadata and validators*, not the sourced prose.)
|
||||
>
|
||||
> What remains is unsourced explanatory prose in skill bodies and non-criteria references — roughly **30–60 lines across kyberforge**, where `apm-install/SKILL.md` yields about one clause. Too small to stand alone, and the same class of writing as finding 22 with a larger surface and no sourced-content conflict. **Merged into finding 22 under these exemptions; not a separate work item.** Safety note established while scoping: `validate-provenance.sh` is not a pre-push gate (the only `.pre-commit-config.yaml` reference is `check-scope-walkup-sync`, over the walk-up port) and validates `sources.md` structure, never line-level traceability — so trimming sourced prose trips no gate provided frontmatter and `sources.md` are left intact. **Loose end in the fold, stated so it is not lost:** finding 22's total is computed over five `bin` skills (1,018 lines) and its implementation sizing names two agents, neither touching kyberforge — so these 30–60 lines sit outside the scope finding 22 states. Track them there as a separate line item with its own estimate; they are not covered by "bin: strip generic process theatre" as written.
|
||||
>
|
||||
> **Closed (2026-09-16, grill): not proceeding.** Finding 22 is deferred with `bin`, and the folded kyberforge remainder (30–60 thin lines) is too small to stand alone, as the note above already says. It would also bring no skill under budget — a judgment made at the grill, not a figure the note above states.
|
||||
|
||||
### 4.3 git and gitea (153 + 93 files, 9,889 + 6,047 lines incl. mirror; source 3,288 + 2,286)
|
||||
|
||||
19. **Delete the two router skills and two orchestrate agents (309 lines + 195 reference lines).** No skill invokes them as a step; they appear only in boundary clauses (`AGENTS.md`, `git-worktrees`, `gitea-issues`, `gitea-prs`) and as worked examples in ~~agent-audit references~~ → **`factory-audit`'s `references/agent-body-and-delegation.md` and `references/agent-description-quality.md`** (repointed 2026-09-16 at HEAD; ADR-0025 moved them), all of which must change in the same commit or `skill-size-check` fails on the dangling target. Claude Code already routes on descriptions. The chain today is `git-workflow` step 5 invokes `git-orchestrate`, whose step 5 invokes `git-commits`, which runs `rtk git commit`: three hops. Both agents exceed 900 words; ADR-0020 deliberately sets no agent body gate. Effort S.
|
||||
19. [x] **Delete the two router skills and two orchestrate agents (309 lines + 195 reference lines).** No skill invokes them as a step; they appear only in boundary clauses (`AGENTS.md`, `git-worktrees`, `gitea-issues`, `gitea-prs`) and as worked examples in ~~agent-audit references~~ → **`factory-audit`'s `references/agent-body-and-delegation.md` and `references/agent-description-quality.md`** (repointed 2026-09-16 at HEAD; ADR-0025 moved them), all of which must change in the same commit or `skill-size-check` fails on the dangling target. Claude Code already routes on descriptions. The chain today is `git-workflow` step 5 invokes `git-orchestrate`, whose step 5 invokes `git-commits`, which runs `rtk git commit`: three hops. Both agents exceed 900 words; ADR-0020 deliberately sets no agent body gate. Effort S.
|
||||
> **Not proceeding (2026-09-13):** premise doesn't hold. There are no separate "router skills" — only two `.agent.md` files. `git-orchestrate` is not a dangling boundary-clause reference; it's `git-workflow` step 5's actual execution backend (documented both directions), so deleting it breaks `git-workflow`'s only execution path rather than tidying an orphan. `gitea-orchestrate` is intentional per ADR-0011 (agent-facing counterpart for agent callers) even though `gitea-workflow` doesn't call it. A third, undocumented instance of the same pattern (`apm-orchestrate`) exists and isn't addressed by this finding. The four boundary-clause locations named above don't actually reference either agent. No changes made. This needs the "short discussion" §7 bucket 2 implies, not a mechanical delete.
|
||||
|
||||
20. **Collapse git 7 skills to 1; gitea 7 to 2.** Git references are man-page restatement: `git-log-format.md` (242 lines listing `%H`, `%ar`), `conventional-commits-spec.md` (170 lines), `worktrees.md` (178), `merging.md` explaining fast-forward. Roughly 60% of the plugin is generic. The genuinely house-specific content fits in about 150 lines: the `rtk` rule and ADR-0023 exceptions, main/master refusal, `--no-verify`, the `-i --autosquash` 2.39.5 trap, `--force-with-lease --force-if-includes`, bisect exit codes, submodule push ordering, the detached-HEAD worktree trap. Gitea is more legitimately specific (MCP schema quirks: `tree_sha`, `withLines`, silent drops on PR create, `per_page` 20 vs 30, 404 means 403) and splits naturally into `gitea-tracker` (issues, PRs, labels, milestones) and `gitea-repo` (branches, files, releases). Risk: one description must carry all trigger phrases; keep a dispatch table at the top of the body. Keep `pc-author` and `pc-run` (finding 38). Effort M.
|
||||
20. [x] **Collapse git 7 skills to 1; gitea 7 to 2.** Git references are man-page restatement: `git-log-format.md` (242 lines listing `%H`, `%ar`), `conventional-commits-spec.md` (170 lines), `worktrees.md` (178), `merging.md` explaining fast-forward. Roughly 60% of the plugin is generic. The genuinely house-specific content fits in about 150 lines: the `rtk` rule and ADR-0023 exceptions, main/master refusal, `--no-verify`, the `-i --autosquash` 2.39.5 trap, `--force-with-lease --force-if-includes`, bisect exit codes, submodule push ordering, the detached-HEAD worktree trap. Gitea is more legitimately specific (MCP schema quirks: `tree_sha`, `withLines`, silent drops on PR create, `per_page` 20 vs 30, 404 means 403) and splits naturally into `gitea-tracker` (issues, PRs, labels, milestones) and `gitea-repo` (branches, files, releases). Risk: one description must carry all trigger phrases; keep a dispatch table at the top of the body. Keep `pc-author` and `pc-run` (finding 38). Effort M.
|
||||
> **Refuted as specified (2026-09-14, at HEAD `062ca47`). The routing concern is not a risk to mitigate — it is a blocking gate failure.**
|
||||
>
|
||||
> What holds: skill counts (git 7 `git-*` + `pc-*`, gitea 7); the four named git reference files at their stated sizes (`git-log-format.md` 242, `conventional-commits-spec.md` 170, `worktrees.md` 178; `merging.md` is 31, among the smallest). "Roughly 60% generic" holds at the top of its range — two independent methods give **54–60%**. Gitea being "more legitimately specific" holds and is **understated**: gitea is ~**72% house-specific**, the inverse of git, with ~50 MCP quirks beyond the five named (no `method:"close"` on `issue_write`; `draft:true` is literally a `"WIP:"` title prefix; **no update tool for releases exists at all**; `replace_labels` clears unlisted labels; org-label methods take `org` not `owner`). Note commit `6cfc357` (finding 13) touched none of the four named files, so its trim does not deflate this evidence.
|
||||
@@ -251,6 +290,8 @@ The shared pattern: per-skill `README.md` files no model reads, a `docs/research
|
||||
> Blast radius if ever revisited: **68 backticked references to git skill names, 99 to gitea names** under `plugins/`. Only the ones in a `SKILL.md` are boundary targets `skill-size-check` resolves and FAILs on if dangling — its `files:` regex is `^plugins/[^/]+/\.apm/skills/[^/]+/SKILL\.md$`, so it opens nothing else — and that is **35 of the 68 git mentions and 26 of the 99 gitea ones**. The remaining 33 and 73 live in `references/*.md`, the two orchestrate agents (10 and 23 on their own), the plugin READMEs, kyberforge's audit and author references, and two `validate.sh` copies — none of which this gate opens: they still have to be rewritten by hand, but they fail no hook. Plus `AGENTS.md:16,18`, `README.md:21-22`, `CONTEXT.md:168` (uses `gitea-prs` as the naming exemplar), `architecture.md:34` (uses `git-branches` vs `gitea-branches` as the canonical boundary example), and ADRs 0011, 0020, 0021, 0022, 0023. Two false alarms not worth chasing: `tests/test-check-rtk-prefix.sh:97` reads from a pinned historical SHA, and `scripts/check-rtk-prefix.sh`'s mention is in a comment.
|
||||
>
|
||||
> **Salvageable independently, ~230 lines:** `conventional-commits-spec.md` (~98% generic) and `bisect.md` (~97%) are the only two files where the generic-restatement thesis fully holds — reduce each to a pointer plus the house delta. Also worth a finding-13-style trim-in-place: the issue-vs-PR disambiguation duplicated across 4 gitea files. Neither needs a merge.
|
||||
>
|
||||
> **Closed (2026-09-16, grill): not proceeding, salvage included.** Both files are loaded on demand only (`git-commits/SKILL.md:46`, `git-history/SKILL.md:33`), and exactly when the agent needs the precise rules; replacing them with a URL pointer trades a local, deterministic answer for a network fetch mid-commit. `bisect.md` is not ~97% generic — every command carries the `rtk` prefix (ADR-0023). `conventional-commits-spec.md` carries the commitlint 11-type set the repo's `conventional-pre-commit` hook enforces. The gitea issue-vs-PR duplication is forced by the no-cross-skill-sharing rule (§9). The saving would be repo lines, not context tokens, at the price of a version bump per file.
|
||||
|
||||
21. [x] ~~**Delete `config.example.json` / `.claude/plugins/git/config.json`.** Read by two steps, written by nothing. Default to GitHub Flow with the existing `develop` / `release/*` inference. Effort S.~~
|
||||
> **Done (2026-09-12):** see commit `f5e4d0d`. Deleted `plugins/git/config.example.json` (the runtime `.claude/plugins/git/config.json` was never a tracked file). Removed the config-read step from `git-orchestrate`'s Process and from `git-branches`' Step 1, leaving the existing default-inference logic (GitHub Flow, with Gitflow inferred from a `develop`/`release/*` branch) as the sole path; updated `git-workflow`'s description of the orchestrator's behaviour to match. Dropped the now-dangling `applied_config` field from `git-orchestrate`'s output shape and the `config.example.json` example from `docs/spec/architecture.md`.
|
||||
@@ -271,30 +312,36 @@ The shared pattern: per-skill `README.md` files no model reads, a `docs/research
|
||||
> **Coupling — the important caution.** This corpus has already been through two trim passes, and the last one broke two of these five targets the same way. PR #129 (`598a7c3`) records: *"`prototype` and `vale-config` deleted rules outright that survived nowhere."* This finding proposes redoing that operation on `prototype` and `diagnose`. **Recommend dropping `prototype` and `grill-with-docs` from scope entirely** — both pass every gate and both have prior-regression history. Also: deleting a `references/*.md` named in a body is a hard ERROR (`skill-size-check.sh:1265`), so `tdd`'s reference deletions and its SKILL.md relinks must land in one commit; `improve-codebase-architecture/SKILL.md:77,79` hard-name `grill-with-docs`'s `context-format.md` and `adr-format.md` by path, so neither can be renamed; and shrinking `write-docs` falsifies live comments at `skill-size-check.sh:64,596`, `tests/test-adr0020-targets.sh:592` and `architecture.md:82`. Unlike finding 23's `caveman`/`zoom-out`, **none of these five is cited as a convention exemplar** anywhere.
|
||||
>
|
||||
> Sizing if implemented: two parallelizable agents over disjoint files — A on `write-docs` (self-contained, no references), B on `tdd` (reference deletion + same-commit relink, ERROR-gated, cannot be split). `diagnose` is ~15 lines, too small for its own agent.
|
||||
>
|
||||
> **Deferred (2026-09-16, grill).** The human is excluding `bin` from this audit: its skills are "binned for a reason" and will be fixed or relocated as a separate piece of work. Nothing in this finding is executed here; the itemised ~165-line estimate above is the starting point for that work. `bin` is still covered by the version-bump gate (finding 33) until then.
|
||||
|
||||
23. **bin: merge `grill-me` into `grill-with-docs`.** `grill-me` is 16 lines and a subset of the docs flow; `grill-with-docs` creates `CONTEXT.md` when missing, so the merged skill needs a no-write opt-out. `caveman` (50 lines) and `zoom-out` (9) are hand-invoked prompts rather than workflow skills; they are also the repo's `disable-model-invocation` exemplars in `CONTEXT.md`, `contract.md`, ADR-0020, ADR-0021, and `gates.md`, and `install.sh` has no path for `~/.claude/commands/`, so moving them means picking a new exemplar. `improve-codebase-architecture` defines its glossary twice (inline and in `language.md`; the README documents the split as intentional). Effort S.
|
||||
23. [x] **bin: merge `grill-me` into `grill-with-docs`.** `grill-me` is 16 lines and a subset of the docs flow; `grill-with-docs` creates `CONTEXT.md` when missing, so the merged skill needs a no-write opt-out. `caveman` (50 lines) and `zoom-out` (9) are hand-invoked prompts rather than workflow skills; they are also the repo's `disable-model-invocation` exemplars in `CONTEXT.md`, `contract.md`, ADR-0020, ADR-0021, and `gates.md`, and `install.sh` has no path for `~/.claude/commands/`, so moving them means picking a new exemplar. `improve-codebase-architecture` defines its glossary twice (inline and in `language.md`; the README documents the split as intentional). Effort S.
|
||||
> **Decision (2026-09-16):** Not proceeding — the human declined this finding. `grill-me` and `grill-with-docs` stay separate.
|
||||
|
||||
24. **core: `provider-adapter-author` is a 1,200-line wrapper around one instruction** ("replace duplicated lines with `@AGENTS.md`, keep provider-specific lines"): a 496-line validator with a 519-line bats suite for a check that is a grep. `agentsmd-author` already calls `agentsmd-audit` as mandatory closeout, and both route to `provider-adapter-author` in boundary clauses that must change with it. Target: one `agentsmd` skill with an audit mode, adapter conversion as a step, validator about 40 lines. Needs an ADR-0012 revisit. Effort L.
|
||||
24. [x] **core: `provider-adapter-author` is a 1,200-line wrapper around one instruction** ("replace duplicated lines with `@AGENTS.md`, keep provider-specific lines"): a 496-line validator with a 519-line bats suite for a check that is a grep. `agentsmd-author` already calls `agentsmd-audit` as mandatory closeout, and both route to `provider-adapter-author` in boundary clauses that must change with it. Target: one `agentsmd` skill with an audit mode, adapter conversion as a step, validator about 40 lines. Needs an ADR-0012 revisit. Effort L.
|
||||
> **Refuted (2026-09-14, at HEAD `062ca47`). Not deferred — the target fails the repo's own gate before any judgment call is reached, so the ADR-0012 §8 question is moot for this finding.**
|
||||
>
|
||||
> **The merge is arithmetically impossible as specified.** Body word counts: `agentsmd-author` 485 + `agentsmd-audit` 361 + `provider-adapter-author` 514 = **1,360 words against `BODY_MAX_WORDS=900`** (ADR-0020 hard FAIL). Descriptions: 251 + 275 + 280 = **806 chars into a field capped at 400**. Relocating the overflow into `references/` is PR #129's named anti-goal, and issue #117 records that `references/` is where neither the size gate nor Vale looks.
|
||||
>
|
||||
> **Both factual anchors describe a validator that no longer exists.** `scripts/validate-adapter.sh` was **141 lines at birth** (`6fd6876`) and in that form *was* approximately a grep — which is why it shipped two recorded defects: `a8cd5e8` (a UTF-8 BOM hid the import line, so a `CLAUDE.md` whose first line was `@AGENTS.md` failed with "no reference to AGENTS.md" and was told to add the line already in front of it) and issue **#115** (`c59e4bf`: the `--no-import-syntax` flag was a proven no-op — "both branches reduce to the same expression"). 141 → 496 is the fix for those. **"Validator about 40 lines" targets below the version whose defects are on the record.** Line counts otherwise exact: validator 496, bats 519 — but "1,200-line wrapper" is 1,164, of which the *wrapper* is 52; **1,015 are validator + tests** (1,071 with the two READMEs, 28 each), and the remaining 41 are `references/`.
|
||||
> **Both factual anchors describe a validator that no longer exists.** `scripts/validate-adapter.sh` was **141 lines at birth** (`6fd6876`) and in that form *was* approximately a grep — which is why it shipped two recorded defects: `a8cd5e8` (reachable from no branch: its change reached `main` squashed into `598a7c3`, #129; a UTF-8 BOM hid the import line, so a `CLAUDE.md` whose first line was `@AGENTS.md` failed with "no reference to AGENTS.md" and was told to add the line already in front of it) and issue **#115** (`c59e4bf`, which is only on `rescued/parse-bullet-contributing-files`; its change reached `main` in the same `598a7c3` squash: the `--no-import-syntax` flag was a proven no-op — "both branches reduce to the same expression"). 141 → 496 is the fix for those. **"Validator about 40 lines" targets below the version whose defects are on the record.** Line counts otherwise exact: validator 496, bats 519 — but "1,200-line wrapper" is 1,164, of which the *wrapper* is 52; **1,015 are validator + tests** (1,071 with the two READMEs, 28 each), and the remaining 41 are `references/`.
|
||||
>
|
||||
> Coverage given up by a 40-line validator: **~67% of the 42-test suite**. **20** tests sit under explicit `Q1`–`Q5` headers — Q1 inert fenced/indented/HTML-comment regions (5), Q2 valid-UTF-8-but-not-UTF-8 encodings (4), Q3 exists-but-unreadable (1), Q4 path resolution (4), Q5 pointer-vs-mention (6); 8 more are hardening, so 28 of 42. Every one was proven non-vacuous by deliberate mutation under PR #129. Representative guards: a ```-fenced `@AGENTS.md` "exited 0"; `@NOTAGENTS.md` counted as an import for want of a path-segment boundary; `"AGENTS.md" in ln` passed *"Do NOT read AGENTS.md; it is obsolete."*; BOM-less UTF-16LE decodes as valid UTF-8 and produced a false diagnosis; exit 2/3 split from 1 "because the skill's closeout tells the agent to fix every non-zero exit by editing the provider file, which for a mistyped flag edits the wrong file forever".
|
||||
>
|
||||
> **The self-containment constraint does not support this finding the way it supports 14/15** — there is no cross-skill duplication here to merge away. `agentsmd-audit`'s three scripts share essentially nothing with `validate-adapter.sh` (no `read_text`, no BOM handling, no NUL check; they exit 1 on usage errors). Merging would *expose* that they are unhardened — costing lines, not saving them.
|
||||
>
|
||||
> Two further blockers if it were ever revisited: the merge dissolves `agentsmd-author`'s standing prohibition *"Never write to a provider file yourself, in any circumstance"* (SKILL.md:21), a hazard `c59e4bf` closed after the validator's own size-FAIL remediation text "actively invited the prohibited edit"; and `skill-size-check.sh:121` + `tests/test-skill-size-check.sh:729` both cite `a8cd5e8`'s exit-2 split as precedent for their own, so deleting it orphans two live cross-references.
|
||||
>
|
||||
> > **Corrected (2026-09-20, at `1614bce`) — neither cross-reference points at `a8cd5e8` any more, and one line number was wrong when written.** `e4ed343` ("docs(gates): cite the reachable squash commit for the exit-2 split") repointed both at `598a7c3`, which `main` reaches. The citations now sit at `scripts/skill-size-check.sh:121` and `tests/test-skill-size-check.sh:737` — `:737`, not the `:729` above. `grep -rn a8cd5e8 scripts/ tests/` returns nothing. The blocker itself is unaffected: the exit-2 precedent still exists, under a hash a branch reaches. Same correction as §12's follow-up, closed there on the same date.
|
||||
|
||||
25. **lint: delete the `lint-runner` agent.** Its body is "call `vale-run`, reformat output", which `--output=JSON` already gives; it exists for backends that do not exist. It is the example boundary clause in three `agent-author` templates and ADR-0016, so those need a new example. About 40% of `vale-config` is install tables and settings lists the model can fetch from vale.sh. Keep the house-verified matrices (`E100`/`E201`, `Packages` below glob, frontmatter, ignore paths). `lint/docs/research/docs/vale/` overlaps the skill's own references by about two thirds. Effort S.
|
||||
25. [x] **lint: delete the `lint-runner` agent.** Its body is "call `vale-run`, reformat output", which `--output=JSON` already gives; it exists for backends that do not exist. It is the example boundary clause in three `agent-author` templates and ADR-0016, so those need a new example. About 40% of `vale-config` is install tables and settings lists the model can fetch from vale.sh. Keep the house-verified matrices (`E100`/`E201`, `Packages` below glob, frontmatter, ignore paths). `lint/docs/research/docs/vale/` overlaps the skill's own references by about two thirds. Effort S.
|
||||
> **Decision (2026-09-16):** Not proceeding — the human declined this finding. The `lint-runner` agent stays.
|
||||
|
||||
## 5. Prose and docs (9,600 lines, 109,000 words outside plugins)
|
||||
|
||||
26. **Move or delete `docs/research/` and `docs/notes/` (4,500 lines, 47% of prose words).** Six of eleven research files are linked only from each other; they are self-described session audit trails, agendas, and a "temporary build reference". `docs/notes/factory-research-gaps-conflicts.md` says "Status: Superseded"; `factory-integration-decisions.md` says "Complete" and its decisions already live in ADRs, yet `AGENTS.md` tells every session to read it. `archive/team-self-organisation-sprint-brief.md` (3,400 words) is unrelated to this repo. Archive or delete; drop the three `AGENTS.md` pointers. Moving `CONTROLS.md` to `docs/spec/` means updating its literal path in nine or more files including the deployed `governance.md`. Effort S.
|
||||
26. [x] **Move or delete `docs/research/` and `docs/notes/` (4,500 lines, 47% of prose words).** Six of eleven research files are linked only from each other; they are self-described session audit trails, agendas, and a "temporary build reference". `docs/notes/factory-research-gaps-conflicts.md` says "Status: Superseded"; `factory-integration-decisions.md` says "Complete" and its decisions already live in ADRs, yet `AGENTS.md` tells every session to read it. `archive/team-self-organisation-sprint-brief.md` (3,400 words) is unrelated to this repo. Archive or delete; drop the three `AGENTS.md` pointers. Moving `CONTROLS.md` to `docs/spec/` means updating its literal path in nine or more files including the deployed `governance.md`. Effort S.
|
||||
> **Decision (2026-09-12):** Keep. Same reasoning as finding 9 — these docs are intentional context for sourced work. Not proceeding.
|
||||
|
||||
27. **Four governance documents say one thing.** `core/instructions/governance.md` (949 words, always-on), `docs/ai-constitution.md` (2,906), `docs/wiki/HUMANS.md` (1,413), `CONTROLS.md` (1,224), with near-identical preambles and, in three of the four, a "what this file does not govern" block pointing at the others. The constitution repeats one of its own principle lead sentences. Keep `governance.md` as the operative file, trimmed to about 50 lines (drop the classification table that repeats the bullets above it, the footer, the non-governance block). Dedupe the constitution by about 20%. Effort M.
|
||||
27. [x] **Four governance documents say one thing.** `core/instructions/governance.md` (949 words, always-on), `docs/ai-constitution.md` (2,906), `docs/wiki/HUMANS.md` (1,413), `CONTROLS.md` (1,224), with near-identical preambles and, in three of the four, a "what this file does not govern" block pointing at the others. The constitution repeats one of its own principle lead sentences. Keep `governance.md` as the operative file, trimmed to about 50 lines (drop the classification table that repeats the bullets above it, the footer, the non-governance block). Dedupe the constitution by about 20%. Effort M.
|
||||
> **Refuted as framed (2026-09-14, at HEAD `062ca47`). All four word counts are exact — the first finding in this audit whose figures survive checking — and everything built on them fails.**
|
||||
>
|
||||
> **"Four documents say one thing" misreads audience separation as duplication.** They are one principle set projected onto four execution surfaces, and each projection is load-bearing: `governance.md` is imperative *to the model* and injected into every session; `HUMANS.md` is imperative *to a person* on a wiki; `CONTROLS.md` is a declarative spec *for CI tooling*; the constitution is the justification layer with citations. Take "secrets never enter AI context": the constitution states it with evidence, `governance.md` tells the model never to emit one, `HUMANS.md` tells the person never to paste one, `CONTROLS.md` specifies the pre-commit hook that catches both when the first two fail. `CONTROLS.md:8` names this explicitly — *"Agent instructions and human practitioner rules are probabilistic… A control that runs automatically in CI enforces a principle more reliably than any instruction in any file."* The three "what this file does not govern" blocks are the seams that keep the four from bleeding together, each pointing at a different file for a different reason. Real overlap is ~15%.
|
||||
@@ -309,9 +356,13 @@ The shared pattern: per-skill `README.md` files no model reads, a `docs/research
|
||||
>
|
||||
> **Honest ceiling: 168 words / 17.7%** of the file's 949 — the cross-reference scaffolding only: preamble **43** (lines 3–5), non-governance block **77** (71–76), footer **48** (79–82), landing at ~67 lines with no rule loss. (An earlier revision said 47 for the preamble, which is only reachable by counting lines 1–7 — that sweeps in the `#` glyph and a `---` rule as words.) Plus 133 words from the constitution. Not 50 lines, not 20%.
|
||||
>
|
||||
> **Two defects the finding missed, both worth fixing independently of it.** (1) **A live bug: `docs/HUMANS.md` does not exist** — the file is `docs/wiki/HUMANS.md`. The wrong path appears **five times across three files**, including the **deployed** `core/instructions/governance.md:82`, which is self-inconsistent (line 73 correct, line 82 broken); the other four are `CONTROLS.md:5,101,106` and `ai-constitution.md:238`. (An earlier revision said "four times" while enumerating all five.) **Fixed (2026-09-15):** all five corrected to `docs/wiki/HUMANS.md`; the deployed copy under `~/.claude/` is now stale until `scripts/install.sh` re-runs. (2) The deployed always-on file carries **repo-relative pointers that dangle in every project but this one** — an agent told to "read it when making decisions not covered here" cannot. That is the substantive question this finding should have asked. The footer is additionally self-referential: `governance.md:80` lists the file as compatible with itself.
|
||||
> **Two defects the finding missed, both worth fixing independently of it.** (1) **A live bug: `docs/HUMANS.md` does not exist** — the file is `docs/wiki/HUMANS.md`. The wrong path appears **five times across three files**, including the **deployed** `core/instructions/governance.md:82`, which is self-inconsistent (line 73 correct, line 82 broken); the other four are `CONTROLS.md:5,101,106` and `ai-constitution.md:238`. (An earlier revision said "four times" while enumerating all five.) **Fixed (2026-09-15):** all five corrected to `docs/wiki/HUMANS.md`; the deployed copy under `~/.claude/` ~~is now stale until `scripts/install.sh` re-runs~~ → was redeployed on 2026-09-16 (see §10). (2) The deployed always-on file carries **repo-relative pointers that dangle in every project but this one** — an agent told to "read it when making decisions not covered here" cannot. That is the substantive question this finding should have asked. The footer is additionally self-referential: `governance.md:80` lists the file as compatible with itself.
|
||||
>
|
||||
> **Decided and done (2026-09-16, grill).** The constitution moved from `docs/ai-constitution.md` to `core/ai-constitution.md`, so the existing `core` deploy step ships it to `~/.claude/core/ai-constitution.md`, and `governance.md`'s "read it when making decisions not covered here" pointer now names that deployed path. The three informational pointers (`HUMANS.md`, `CONTROLS.md`, and the footer) now say they live in the holocron repo rather than reading as local paths. Path-qualified citations were updated in `AGENTS.md`, `docs/spec/architecture.md`, `docs/notes/skill-implementation-workflow.md`, `CONTROLS.md` and the wiki's `HUMANS.md`; the vendored `write-skill` example under `plugins/kyberforge/docs/research/examples/` and this audit's historical notes were left as records. The wiki commit ~~is local until its push is approved, and the `docs/wiki` gitlink is bumped only after that~~ → is pushed (`ca1b35f` on the wiki's `main`), and the gitlink bump landed in `2ae7d4e`.
|
||||
>
|
||||
> **Decision (2026-09-16):** The finding as written is not proceeding: the human declined its cuts, including the 168-word cross-reference trim, so no governance document was deduplicated or shortened. The two defects above are fixed separately. The `docs/HUMANS.md` path was corrected on 2026-09-15 (see §10), and the dangling always-on pointer was fixed by the constitution move in the note above (`adaa978`). That move changed `governance.md`'s pointers, not its rules.
|
||||
|
||||
28. **ADRs: 2,740 lines, 72% in eight ADRs over 150 lines.** ADR-0020 is 513 lines with a 71-line measurement log as Context; ADR-0017 has 173 lines of amendments against 45 of decision. ADR-0001 is superseded and ADR-0006 moot, both keeping full text below the banner. ADR-0002 is three lines. Truncate superseded ones to the banner, fold amendments into the decision, cap Context at 20 lines, add a 25-line `docs/adr/README.md` index with status. The rules already live in `gates.md`; the ADRs need only decision and consequences. Effort M.
|
||||
28. [x] **ADRs: 2,740 lines, 72% in eight ADRs over 150 lines.** ADR-0020 is 513 lines with a 71-line measurement log as Context; ADR-0017 has 173 lines of amendments against 45 of decision. ADR-0001 is superseded and ADR-0006 moot, both keeping full text below the banner. ADR-0002 is three lines. Truncate superseded ones to the banner, fold amendments into the decision, cap Context at 20 lines, add a 25-line `docs/adr/README.md` index with status. The rules already live in `gates.md`; the ADRs need only decision and consequences. Effort M.
|
||||
> **Moved backwards (measured 2026-09-14 over `afa7187^`..`a6434e0`):** today's ADR-0024 work did the opposite of this finding on every axis, and that is recorded here so it is a known trade rather than a surprise. `docs/adr/` went from **23 files / 2,748 lines** to **24 / 3,084** — one new ADR (0024, 259 lines) plus amendment and banner text across **eleven existing ADRs** (0001, 0006, 0011, 0013, 0014, 0015, 0017, 0018, 0019, 0020, 0021 — 87 lines added, 10 removed, net **+77**), for a total of net **+336 lines (+12%)**. The two ADRs this finding names for truncation both grew *below* their banners instead: **ADR-0001 26 → 27** lines and **ADR-0006 22 → 27**, each gaining a fresh "as of ADR-0024" paragraph rather than losing the historical body beneath it. ADR-0017 gained a supersession banner while keeping its four amendments in full — the exact shape this finding proposes to fold.
|
||||
>
|
||||
> Not a defect in that work: a supersession has to be recorded somewhere, and an unread stale ADR is worse than a long one. But it does mean the finding's estimate is now conservative and its "truncate superseded ones to the banner" step has more to remove than when it was written — ADR-0001, ADR-0006 and ADR-0017 are all superseded-with-full-body today. **State the basis when re-measuring:** this is a two-SHA measurement, not a standing count, and further ADR amendments were being written by other sessions while it was taken. Re-derive with `git ls-tree -r --name-only <sha> docs/adr` before acting on it.
|
||||
@@ -322,7 +373,9 @@ The shared pattern: per-skill `README.md` files no model reads, a `docs/research
|
||||
>
|
||||
> Today those same figures read: **ten** ADRs exceed 150 lines, not eight; top-eight share is 68.3%, the over-150 cohort 79.2%. ADR-0020 is **514** lines. Its Context is **72** lines counting the `## Context` heading and **71** without — a counting convention, not drift: the section is byte-identical at `a3e721e` and at HEAD (`## Context` at :11 through `## Decision` at :83), so the finding's 71 and this note's 72 are the same span counted two ways. ADR-0017's "173 amendment lines against 45 of decision" and ADR-0002's three lines are exact.
|
||||
>
|
||||
> **"The rules already live in `gates.md`" is backwards.** `docs/spec/gates.md:349-352` explicitly *declines* to restate ADR-0020's numbers: *"they live in ADR-0020's Consequences section… Quoting them here would just create a second copy to go stale."* gates.md is a consumer of the ADR, not its replacement. **The index proposal also contradicts a recorded decision** — `docs/spec/architecture.md:90`: *"There is no index file — the directory holds numbered ADRs whose filenames state their decision, so `ls docs/adr/` is the index."*
|
||||
> **"The rules already live in `gates.md`" is backwards.** ~~`docs/spec/gates.md:349-352`~~ → ~~`docs/spec/gates.md:397-400`~~ → `docs/spec/gates.md:399-401` explicitly *declines* to restate ADR-0020's numbers: *"they live in ADR-0020's Consequences section… Quoting them here would just create a second copy to go stale."* gates.md is a consumer of the ADR, not its replacement. **The index proposal also contradicts a recorded decision** — `docs/spec/architecture.md:90`: *"There is no index file — the directory holds numbered ADRs whose filenames state their decision, so `ls docs/adr/` is the index."*
|
||||
>
|
||||
> > **Repointed (2026-09-16, at HEAD `b426460`):** the quoted `gates.md` passage moved from `:349-352` to `:397-400` as later sections were added above it; verified with `grep -n "Quoting them here" docs/spec/gates.md` and `sed -n 397,400p`. At `4b17703` it is `:399-401` (the "Quoting them here" line is `:400`). `architecture.md:90` still resolves.
|
||||
>
|
||||
> **No superseded body can be truncated — every one is quoted by content, not merely cited by number.** ADR-0001's body text is quoted verbatim at `docs/adr/0015:5,36`, and `factory-integration-decisions.md:133` lists "Pull-based distribution (ADR-0001)" as settled, a concept living only in its consequences bullets. ADR-0006's version-parity invariant is stated only at `0006:23` and is relied on by `0014:116` and `0024:183-185` — and its banner (17 lines) is already longer than its body (7). ADR-0017's own banner says its diagnosis "is still accurate about how Claude Code's installer works", and ADR-0024 cites its body in eight places. ADR-0002 is only partially superseded and is cited as a design source by a shipped skill.
|
||||
>
|
||||
@@ -333,6 +386,8 @@ The shared pattern: per-skill `README.md` files no model reads, a `docs/research
|
||||
> **Honest ceiling ~235 lines (7.5%)**, and the one real win is not in the finding: **delete ADR-0017's four amendments (−173) now that ADR-0024 consequence 7 has restated them in full**, re-pointing eight citations. Plus ADR-0001/0006 compressed to banner-plus-one-line (−20) and ADR-0020's anecdotes (−42). No README index. Restate the headline as **79% in ten ADRs**.
|
||||
>
|
||||
> **The framing question this finding never notices:** it proposes reversing a convention the repo *just* re-affirmed — every banner added by the ADR-0024 work ends with some form of "kept below as the historical record". Is a superseded ADR's body a record or dead weight? Nothing here is mechanical; every proposed cut touches text another file quotes.
|
||||
>
|
||||
> **Closed (2026-09-16, grill): not proceeding.** Decision: a superseded or accepted ADR's text is the historical record (the Nygard convention, and what every ADR-0024 banner already says), so no body is truncated, no amendment is deleted, and ADR-0020's Context is left intact. That removes every remaining cut — ADR-0017's amendments are part of its record, and ADR-0024 consequence 7 (`0024:213-252`, ~40 lines) summarises them rather than restating them in full as the note above says. Corrected headline for anyone quoting it: ~~**79% of `docs/adr/` lines sit in ten ADRs over 150 lines** (measured 2026-09-14)~~ → ~~**80% of `docs/adr/` lines (2,983 of 3,709, across 25 files) sit in eleven ADRs over 150 lines** (at HEAD `b426460`)~~ → **85% of `docs/adr/` lines (3,295 of 3,896, across 25 files) sit in twelve ADRs over 150 lines** (at `baa2f5d`, 2026-09-16, from `wc -l docs/adr/*.md`; ADR-0025 joined the cohort and the ADR-0019 and ADR-0022 amendments grew the directory). The 79%-in-ten figure was the 2026-09-14 state; the 2,740 figure is the `a3e721e` state only.
|
||||
|
||||
29. [x] ~~**The same facts are stated in full three or four times.** "Edit `.apm/`, never the mirror": README (2 paragraphs), AGENTS.md (2 paragraphs), architecture.md (2 paragraphs plus the lost-README anecdote), ADR-0017. The apm.lock / SessionStart story: README (11 lines), AGENTS.md, ADR-0018, ADR-0019, gates.md. The offline `SKIP=` command and the three-stage install each appear three times. Rule: README has the how-to, AGENTS.md has one-line rules with links, architecture.md has mechanics. Effort S.~~
|
||||
> **Corrected then partially done (2026-09-14):** independent re-verification found the "edit `.apm/`, never the mirror" and apm.lock/SessionStart clusters confirmed but the third overstated — no file documents an offline `SKIP=` command (the one `SKIP=`-adjacent mention in `gates.md` explicitly says a *different* opt-out "is not `SKIP=`"), and "three-stage install" appears twice, not three times, with no restatement worth trimming. Trimmed the two confirmed clusters: README's "Editing plugin content" and AGENTS.md's "Edit `.apm/`, never the flat mirror" sections cut to the how-to/one-line-plus-link split the finding itself proposed, full mechanics (the `rm -rf` behavior and the `plugins/kyberforge/hooks/README.md` anecdote) staying solely in `docs/spec/architecture.md`. README's "Keeping the install current" and AGENTS.md's apm.lock bullet trimmed to drop the restated `apm outdated`/`apm update --yes` timing narrative, pointing to ADR-0019 as the canonical mechanism instead. No test greps the trimmed wording (checked).
|
||||
@@ -342,6 +397,7 @@ The shared pattern: per-skill `README.md` files no model reads, a `docs/research
|
||||
|
||||
31. [x] ~~**`CONTEXT.md`: 28 terms, most used only by gates.md, scripts, or tests rather than by skills;** two (Preload tax, Skill context contract) are never used outside `CONTEXT.md` and ADR-0020. The preload-tax entry quotes two dated numbers then says not to quote them. The example dialogue and flagged-ambiguities sections are grill residue. Cut to about 20 one-line terms. Effort S.~~
|
||||
> **Corrected then done (2026-09-13):** see commits `124ce6e` and follow-up on `docs/simplification-audit`. Independent re-verification found "most used only by gates.md/scripts/tests" overstated: 13 of 28 terms are actually referenced from model-facing `references/*.md` files skills load in normal use (Routing target, Hand-invoked skill, Dispatch body, Near-miss, Thin adapter, Provenance chain, Output profile, apm package, Plugin marketplace, HITL, Skill composition, Delegation discipline, holocron) and were kept untouched. Only the 9 terms confirmed as true orphans were removed after a fresh independent grep: Content mirror, apm-consumed install, Vale audit prefilter, Vacuous green, Management Application, Sycophancy, HOTL, Preload tax, Skill context contract — 28 → 19 terms.
|
||||
> > **Corrected (2026-09-19) — "true orphans" is wrong for two of the nine.** **HOTL** and **Sycophancy** are both still used in `core/ai-constitution.md` (HOTL spelled out at `:111-112`, sycophancy at `:72-87`), and HOTL also in `docs/research/governance_principles/ai-governance-research.md:340-344`. The removals themselves were still right, for a different reason than the one given: the constitution **defines both terms itself, at the point of use**, so a second definition in `CONTEXT.md` was duplication rather than the only authority. Only the orphan justification is corrected here; the other seven and the 28 → 19 count are unaffected.
|
||||
> **Re-counted (2026-09-14, at `a6434e0`): 18 terms, not 19.** The "28 → 19" above is an accurate record of this finding's own commit (`124ce6e`) and is left standing. `718c79a` then removed a twentieth-to-nineteenth entry this finding never touched: the standalone **Plugin** term, folded into **apm package** when ADR-0024 made "plugin" and "apm package" the same thing. Counted as bolded term entries between `## Language` and `## Relationships` in `CONTEXT.md`: 19 at `124ce6e`, 18 at `718c79a` and unchanged at `a6434e0`. The finding's own target ("about 20 one-line terms") is met either way. The preload-tax self-contradiction (quotes 23,427/10,478-char figures then says not to quote either) was confirmed verbatim and resolved by the entry's own deletion. The "example dialogue" and "flagged ambiguities" sections were found to be mandated by `grill-with-docs/references/context-format.md`'s template spec, not grill residue — left untouched, except one dangling bolded cross-reference to the now-deleted "Preload tax" term in a Flagged-ambiguities line, which was unbolded/de-referenced in place (the ambiguity resolution itself still holds without a defined glossary entry to point at).
|
||||
|
||||
32. [x] ~~**Structure is described three ways** (README layout table, architecture.md plugin table, AGENTS.md structure bullets), and `VISION.md` carries a 35-line stack spec for a product that lives in another repo. One layout table in README; architecture.md keeps mechanics only; VISION drops the stack detail. Effort S.~~
|
||||
@@ -356,26 +412,28 @@ The shared pattern: per-skill `README.md` files no model reads, a `docs/research
|
||||
|
||||
Not covered by the area audits above; found on a final sweep of the root config and install pipeline. The install pipeline itself (`scripts/install.sh` 55 lines, `deploy-manifest.sh` 24, statusline 109) is fine and needs nothing.
|
||||
|
||||
33. **Every plugin version lives in four places (five for kyberforge), plus one per skill.** `plugins/<name>/apm.yml`, two generated `plugin.json` files, the root `apm.yml` packages list, the `executables.allow` key (`kyberforge#1.6.2`), and a `metadata.version` in all ~~39~~ → **38** SKILL.md files (ADR-0022) that nothing consumes and that drifts freely (gitea skills sit at five different values). Repo tags (`v2.0.1`) follow a third scheme that the declared `tagPattern: v{version}` can never match under `per_package` versioning. ADR-0006, ADR-0022, `check-executables-allow-sync`, `skill-frontmatter`, and `apm pack --check-versions` all exist to police this. Proposal: one version per plugin in its `apm.yml`; drop `metadata.version` and ADR-0022; let `apm pack` derive the rest. Effort M.
|
||||
> **Partially advanced (2026-09-14):** see commit `718c79a` on `docs/simplification-audit`. Two of the four locations per plugin are gone: the twelve generated `plugin.json` manifests (`plugins/*/.claude-plugin/` and `plugins/*/.github/plugin/`) were deleted with the mirror. ADR-0006 needed no action — it was already moot and governed only those two now-deleted manifests, so no version bumps were required by the change. **Not closed.** Still outstanding: `plugins/<name>/apm.yml`, the root `apm.yml` packages list, the `executables.allow` pin, and `metadata.version` in all ~~39~~ → **38** SKILL.md files (still unconsumed, still drifting), plus ADR-0022 and the `v{version}` `tagPattern` mismatch.
|
||||
33. [x] **Every plugin version lives in four places (five for kyberforge), plus one per skill.** `plugins/<name>/apm.yml`, two generated `plugin.json` files, the root `apm.yml` packages list, the `executables.allow` key (`kyberforge#1.6.2`), and a `metadata.version` in all ~~39~~ → **38** SKILL.md files (ADR-0022) that nothing consumes and that drifts freely (gitea skills sit at five different values). Repo tags (`v2.0.1`) follow a third scheme that the declared `tagPattern: v{version}` can never match under `per_package` versioning. ADR-0006, ADR-0022, `check-executables-allow-sync`, `skill-frontmatter`, and `apm pack --check-versions` all exist to police this. Proposal: one version per plugin in its `apm.yml`; drop `metadata.version` and ADR-0022; let `apm pack` derive the rest. Effort M.
|
||||
> **Partially advanced (2026-09-14):** see commit `718c79a` on `docs/simplification-audit`. Two of the four locations per plugin are gone: the twelve generated `plugin.json` manifests (`plugins/*/.claude-plugin/` and `plugins/*/.github/plugin/`) were deleted with the mirror. ADR-0006 needed no action — it was already moot and governed only those two now-deleted manifests, so no version bumps were required by the change. **Not closed.** Still outstanding: `plugins/<name>/apm.yml`, the root `apm.yml` packages list, the `executables.allow` pin, and `metadata.version` in all ~~39~~ → **38** SKILL.md files (still unconsumed, still drifting), plus ADR-0022 and the `v{version}` `tagPattern` mismatch. *(Since closed, 2026-09-16 grill — see the decision note at the end of this finding.)*
|
||||
> **Verified (2026-09-14, at HEAD `062ca47`): headline wrong, central claim inverted — and it contains the one zero-risk, empirically-verified win in this audit.**
|
||||
>
|
||||
> **Do this regardless of anything else: delete the six root `apm.yml` `packages[].version` lines.** Tested in an isolated scratch copy (repo untouched): setting `plugins/lint/apm.yml` to `9.9.9` while root says `1.1.7` **passes `apm pack --check-versions --check-clean` with exit 0**, reports `[matches]`, and emits `1.1.7` — the curator entry wins (`output_mappers.py:163-171`). Deleting the root `version:` line entirely leaves `marketplace.json` **byte-unchanged** (`builder._fetch_local_metadata` reads the plugin's own `apm.yml`). All six are removable with zero output diff. This is unpoliced duplication that silently ships the wrong number on drift. Effort S, no decision needed.
|
||||
>
|
||||
> Corrected headline: **two** hand-maintained per-plugin locations (**three** for kyberforge), not four — the audit's own "already done" note records the `plugin.json` deletion but never fixed the headline. Gitea skills drift across **six** values (`0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.1.6, 1.0.1`), not five — still six at HEAD on 2026-09-16, re-derived by parsing `metadata.version` out of each `plugins/gitea/.apm/skills/*/SKILL.md`. ~~39 `SKILL.md` files ✓~~ → **38** carry it, and all 38 do (re-measured 2026-09-16; ADR-0025's merge took one). The `0.4.6` duplication between root `version:` and `marketplace.version:` is **forced by apm, not a repo choice** — deleting `marketplace.version` makes `--check-clean` go dirty.
|
||||
> Corrected headline: ~~**two** hand-maintained per-plugin locations (**three** for kyberforge)~~ → **one** hand-maintained per-plugin version location, `plugins/<name>/apm.yml` (**two** for kyberforge, adding the `executables.allow` key), not four. `2def060` deleted the root `packages[].version` lines (corrected 2026-09-16, review round). The root `packages[].description:` duplicates dropped in the same round are a separate duplication, not a version location, so they do not change this count — the audit's own "already done" note records the `plugin.json` deletion but never fixed the headline. Gitea skills drift across **six** values (`0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.1.6, 1.0.1`), not five — ~~still six at HEAD on 2026-09-16~~ → **five** again at HEAD (`b426460`) on 2026-09-16 (`0.1.2, 0.1.4, 0.1.5, 0.1.6, 1.0.1`), because `8451169` bumped `gitea-branches` 0.1.3 → 0.1.4 under the new version-bump gate and it was the only skill at 0.1.3; re-derived by parsing `metadata.version` out of each `plugins/gitea/.apm/skills/*/SKILL.md` with PyYAML. ~~39 `SKILL.md` files ✓~~ → **38** carry it, and all 38 do (re-measured 2026-09-16; ADR-0025's merge took one). The `0.4.6` duplication between root `version:` and `marketplace.version:` is **forced by apm, not a repo choice** — deleting `marketplace.version` makes `--check-clean` go dirty.
|
||||
>
|
||||
> **"Nothing consumes `metadata.version`" is false twice over.** Machine enforcers: ~~`scripts/skill-size-check.sh:1365-1374`~~ → `scripts/skill-size-check.sh:1370-1379` and ~~`skill-audit/scripts/validate.sh:1292-1332`~~ → `plugins/kyberforge/.apm/skills/factory-audit/scripts/lib-checks-skill.sh:235-277`, both FAIL tier, the latter citing ADR-0022 by name, with four dedicated bats cases and ~10 fixture generators baking the field in.
|
||||
> Instruction-level consumers: `skill-author/SKILL.md:60` (bump minor on create, patch on improve), `create.md:89,101`, `improve.md:82`, and `forge/SKILL.md:54` + `references/version-bump.md`. apm parses it for Chatmode/Instruction/Context primitives but not for Skills, and never emits it. Precise statement: the value is written, shape-validated, and never read *downstream* — it is an agent-visible revision counter, and the drift table shows the counter is not being maintained.
|
||||
> **"Nothing consumes `metadata.version`" is false twice over.** Machine enforcers: ~~`scripts/skill-size-check.sh:1365-1374`~~ → ~~`scripts/skill-size-check.sh:1370-1379`~~ → `scripts/skill-size-check.sh:323-335` and ~~`skill-audit/scripts/validate.sh:1292-1332`~~ → `plugins/kyberforge/.apm/skills/factory-audit/scripts/lib-checks-skill.sh:235-283`, both FAIL tier, the latter citing ADR-0022 by name, with four dedicated bats cases and ~10 fixture generators baking the field in.
|
||||
> Instruction-level consumers: `skill-author/SKILL.md:60` (bump minor on create, patch on improve), `create.md:89,101`, ~~`improve.md:82`~~ → `improve.md:105`, and `forge/SKILL.md:54` + `references/version-bump.md`. apm parses it for Chatmode/Instruction/Context primitives but not for Skills, and never emits it. Precise statement: the value is written, shape-validated, and never read *downstream* — it is an agent-visible revision counter, and the drift table shows the counter is not being maintained.
|
||||
>
|
||||
> > **Repointed (2026-09-16, at HEAD):** `skill-audit/scripts/validate.sh` no longer exists — ADR-0025's merge moved the ADR-0022 check into `factory-audit`'s skill-side check library, where it is the `SEMVER_RE` block (comment header at `:235`, `fail()` calls at `:261` and `:275`). `skill-size-check.sh` grew by 5 lines above the block since `062ca47`, hence the shifted range there. All five instruction-level citations still resolve at HEAD, verified with `sed -n`.
|
||||
> > **Repointed (2026-09-16, at HEAD; re-verified and corrected 2026-09-19):** `skill-audit/scripts/validate.sh` no longer exists — ADR-0025's merge moved the ADR-0022 check into `factory-audit`'s skill-side check library, where it is the `SEMVER_RE` block: comment header at `:235`, `SEMVER_RE` itself at `:254`, `fail()` calls at ~~`:261` and `:275`~~ → `:265` and `:280`, the block running `:235-283` (the next section header, `# SKILL.md size ceilings`, is at `:285`). That library is **627** lines, not 621. In `skill-size-check.sh` the check is at `:323-335`; the earlier note said the file "grew by 5 lines above the block", which is the wrong direction by two orders of magnitude — `ef27c97` excised the embedded resolver and the file **shrank** from 1,522 to **509** lines, which is why the range moved from the 1,300s to the 320s. ~~All five instruction-level citations still resolve at HEAD, verified with `sed -n`.~~ → **Corrected (2026-09-20): four of the five resolve, not five.** `improve.md:82` stopped carrying the `metadata.version` content at `baa2f5d`, three days before the 2026-09-19 verification claim was written, so that claim was false when made; the content is at ~~`improve.md:82`~~ → `improve.md:105` ("A skill carrying no `metadata.version` is seeded at `"1.0.0"`, not bumped"). The other four — `skill-author/SKILL.md:60`, `create.md:89`, `create.md:101`, `forge/SKILL.md:54` — do resolve at `1ec3e8a`.
|
||||
>
|
||||
> **ADR-0022 already considered and rejected dropping the field**, on the grounds that `skill-author` depends on it to decide whether a pass owes a bump — a rationale still live today. Superseding costs: rewrite skill-author's bump rule, delete `forge`'s version-bump route premise, strip two scripts, delete four bats cases, fix ~10 fixture generators, edit the scaffold template, update `gates.md:97` — and re-open the "is this field present here?" question issue #127 closed, just from the other side. **Recommendation: keep it and fix the actual defect, which is that nobody bumps it.** Either enforce the bump in the skill-author workflow or declare the values advisory in the ADR.
|
||||
> **ADR-0022 already considered and rejected dropping the field**, on the grounds that `skill-author` depends on it to decide whether a pass owes a bump — a rationale still live today. Superseding costs: rewrite skill-author's bump rule, delete `forge`'s version-bump route premise, strip two scripts, delete four bats cases, fix ~10 fixture generators, edit the scaffold template, update ~~`gates.md:97`~~ → ~~`gates.md:145`~~ → `gates.md:146` — and re-open the "is this field present here?" question issue #127 closed, just from the other side. *(Repointed 2026-09-16, at HEAD `b426460`: the `metadata.version` frontmatter sentence formerly at `gates.md:97` was at `:143-146`, the field itself on `:145`, and is at `:143-147` / `:146` at `4b17703`; verified with `grep -n "metadata.version" docs/spec/gates.md`.)* **Recommendation: keep it and fix the actual defect, which is that nobody bumps it.** Either enforce the bump in the skill-author workflow or declare the values advisory in the ADR.
|
||||
>
|
||||
> **The `tagPattern` claim is refuted — inert, not broken.** Under `versioning.strategy: per_package`, apm never reads it: `version_check.py:262` gates on `strategy == "tag_pattern"`, and `builder.py:641,781` are reachable only for *remote* source entries, while all six packages here are local paths. The `v1.0.0`/`v2.0.0`/`v2.0.1` tags are not "a third scheme" — they are the `.pre-commit-hooks.yaml` external-consumer contract tags from finding 36, a different axis entirely. Latent risk only: if `dependencies.apm` ever gains `ref:` pins, tagPattern goes live against per-package tags that do not exist.
|
||||
>
|
||||
> Also: **`executables.allow` should be kept** — it is version-keyed by apm's design and `check-executables-allow-sync` guards a real silent failure (ADR-0019). And ADR-0006's ADR-0024 amendment asserting *"`apm.yml`'s `version:` is the only version field a plugin has"* is inaccurate while root `packages[].version` exists — fixed by the deletion above.
|
||||
>
|
||||
> **Decided and done (2026-09-16, grill): enforce the bump.** Advisory status and dropping the field were both rejected. The six root `apm.yml` `packages[].version` lines are deleted (`apm pack --check-versions --check-clean` still passes, output unchanged), which also makes ADR-0006's "the only version field a plugin has" true. `scripts/check-skill-version-bump.sh` now runs at pre-push: any skill directory that changed against its merge-base with `main`, `tests/` excluded, must carry a strictly higher `metadata.version` than ~~`main`~~ → the same skill had at that merge-base (not `main`'s current tip; see ~~`gates.md:90` and `:111-112`, and the hook comment at `.pre-commit-config.yaml:203-206`~~ → `gates.md:86` and `:100-113`, and the hook comment at `.pre-commit-config.yaml:194-197`, repointed at `4b17703` after `4de5b6b` shifted both files. *Amended in the 2026-09-16 review round: the gate now also compares against the `origin/main` tip; see §11.*); new, renamed and deleted skills are exempt; every plugin is covered, `bin` included. Recorded as a dated section in ADR-0022, not a new ADR. The 17 skills changed on this branch without a bump took a patch bump in the same commit. The `executables.allow` pin and the inert `tagPattern` are left as the note above recommends.
|
||||
|
||||
34. **The SessionStart hook auto-updates the install on every startup.** `check-apm-current.sh` runs `apm outdated` (network, 60 s timeout) and then `apm update --yes` (300 s timeout) at every session start, rewriting `apm.lock.yaml`. That is why the lock file is dirty at the start of this session and why `AGENTS.md` has to explain "commit or discard it deliberately". It is a 60-line script with a 368-line test, an ADR (0019), the `executables.allow` pin, and a sync hook behind it. For a repo that is its own source, the update belongs in `install.sh` or a manual `apm update`, not in session startup. Effort S to remove; the design question is whether auto-update at startup is wanted at all.
|
||||
34. [x] **The SessionStart hook auto-updates the install on every startup.** `check-apm-current.sh` runs `apm outdated` (network, 60 s timeout) and then `apm update --yes` (300 s timeout) at every session start, rewriting `apm.lock.yaml`. That is why the lock file is dirty at the start of this session and why `AGENTS.md` has to explain "commit or discard it deliberately". It is a 60-line script with a 368-line test, an ADR (0019), the `executables.allow` pin, and a sync hook behind it. For a repo that is its own source, the update belongs in `install.sh` or a manual `apm update`, not in session startup. Effort S to remove; the design question is whether auto-update at startup is wanted at all.
|
||||
> **Refuted (2026-09-14, at HEAD `062ca47`). The evidence is inverted: the finding cites as proof of over-eagerness a session in which the mechanism did not fire, and the observed state is the exact silent failure ADR-0019 exists to prevent.**
|
||||
>
|
||||
> **The update is conditional, not unconditional.** `check-apm-current.sh:42-43` captures `apm outdated` and `exit 0`s unless the output matches `outdated dependenc(y|ies) found`. The staleness test is a real SHA comparison (`apm_cli/commands/outdated.py`, git-branch branch) of the lockfile's `resolved_commit` against the remote tip. On a current install the cost is one **~0.8 s** check and **no lock rewrite** — confirmed by timed probe. `hooks.json` also declares `"matcher": "startup"` only, so `--resume`/`--continue`/post-compact sessions never fire it (ADR-0019 sub-decision 3).
|
||||
@@ -389,6 +447,8 @@ Not covered by the area audits above; found on a final sweep of the root config
|
||||
> **Recommendation: keep the hook.** Cost is 0.8 s on a current install; offline it fails fast (0.81 s, status `unknown`, grep misses, exit 0 — the 60 s timeout is a bound, not a latency). The benefit guards a failure that is silent by construction and that the repo is exhibiting right now.
|
||||
>
|
||||
> **Two things worth fixing, neither of which is removal.** (1) ADR-0019's ~10.4 s refresh figure is now **~18 s** measured warm on a LAN remote — it is quoted in the `timeout: 380` invariant reasoning and understates by 75%. (2) **An undocumented branch hazard, and the strongest argument the finding could have made:** the hook resolves against the remote *default* branch, so on a feature branch that changes `plugins/`, an auto-refresh reinstalls `main`'s version over it. Reproduced — running `apm update` today re-installs `main`'s `plugins/bin/.mcp.json` and writes back the obsidian MCP server that commit `c96ca9c` removed on this branch. That deserves a line in ADR-0019's Consequences; the proportionate fix if it bites is ~3 lines skipping the refresh when `HEAD` is not the default branch.
|
||||
>
|
||||
> **Decided and done (2026-09-16, grill): document, do not skip.** Both follow-ups landed in ADR-0019. The refresh figure is re-measured at ~24–26 s (two runs, six packages behind), not the ~18 s above — still inside the 360 s the `timeout: 380` invariant covers. The branch hazard is a new Consequences paragraph, written after it fired in this very session: the startup refresh redeployed `main`'s `skill-audit`/`agent-audit` and the `obsidian` server over this branch. Skipping the refresh off the default branch was rejected — it would freeze the session on an older `main` without making the branch live.
|
||||
|
||||
35. [x] ~~**Outputs and packages for consumers that do not exist.** The `codex` output profile generates `.agents/plugins/marketplace.json` (95 lines) although Codex is not a supported consumer. The `mattpocock-skills` remote package entry is the only reason `apm-marketplace-check` needs the network, and its pin is advanced by hand (ADR-0015). The `.github/plugin/marketplace.json` mirror is a legacy path (finding 2). Removing all three leaves one generated marketplace manifest (the per-plugin `plugin.json` pairs remain) and no network-dependent hook. Effort S.~~
|
||||
> **Done (2026-09-13):** see commit `568ca74` on `docs/simplification-audit`. Removed the `codex` output profile from root `apm.yml` and its compiled `.agents/plugins/marketplace.json` (95 lines), and the `mattpocock-skills` remote package entry — the only remote marketplace entry, so `apm-marketplace-check` and `apm-pack-check-clean` no longer need network access at all. Updated `README.md`, `AGENTS.md`, `docs/spec/gates.md`, and `docs/spec/architecture.md` accordingly; added one-line superseded/updated notes to ADR-0015 and ADR-0021. Left `.github/plugin/marketplace.json` untouched — that's the Copilot legacy-path question in finding 2/§8, out of scope here; only re-ran the sync script to keep it consistent. `apm.lock.yaml` unaffected (`marketplace.packages[]` isn't part of the lockfile). Verified via `apm install`, `apm pack --marketplace=claude --check-versions`, and all four affected pre-push hooks.
|
||||
@@ -397,7 +457,7 @@ Not covered by the area audits above; found on a final sweep of the root config
|
||||
> - **"The per-plugin `plugin.json` pairs remain"** is void. All twelve were deleted in `718c79a` (ADR-0024); `git ls-files '*plugin.json'` returns nothing. The only tracked manifest left anywhere is the root `.claude-plugin/marketplace.json`. (The root `.claude-plugin/plugin.json` beside it is untracked local `apm pack` output, ignored at `.gitignore:59`.)
|
||||
> - **"Left `.github/plugin/marketplace.json` untouched … out of scope here"** is void the same day: `0dffff3` deleted it under finding 2c, along with `scripts/sync-marketplace-mirror.sh` and its test. The "only re-ran the sync script to keep it consistent" step above refers to `sync-plugin-content.sh`, itself deleted in `718c79a`.
|
||||
|
||||
36. **The release-tag mechanism guards an external contract with no known consumer.** `.pre-commit-hooks.yaml` exports three hooks for other repos to pin by `rev: <tag>`. `check-release-needed` (242 lines + 442 test), `test-vale-hooks-consumer` (270 lines), ADR-0014, and three tags exist to serve that. If no other repo pins these hooks today, the whole mechanism can be deferred until one does. Effort S.
|
||||
36. [x] ~~**The release-tag mechanism guards an external contract with no known consumer.** `.pre-commit-hooks.yaml` exports three hooks for other repos to pin by `rev: <tag>`. `check-release-needed` (242 lines + 442 test), `test-vale-hooks-consumer` (270 lines), ADR-0014, and three tags exist to serve that. If no other repo pins these hooks today, the whole mechanism can be deferred until one does. Effort S.~~
|
||||
> **Verified (2026-09-14, at HEAD `062ca47`): premise holds — the only premise in this audit to survive verification, though not the finding whole: `test-vale-hooks-consumer.sh` is 272 lines, not 270. Not yet decided; deferred by the human on 2026-09-14.**
|
||||
>
|
||||
> Exact: three exported hooks (`kyberforge-vale-audit-skill`, `kyberforge-vale-audit-agent`, `kyberforge-skill-size-check`), `check-release-needed.sh` 242, its test 442, three tags (`v1.0.0`, `v2.0.0`, `v2.0.1`). `test-vale-hooks-consumer.sh` is **272** lines, not 270.
|
||||
@@ -408,11 +468,17 @@ Not covered by the area audits above; found on a final sweep of the root config
|
||||
>
|
||||
> **The mechanism is already failing at its one job.** `scripts/skill-size-check.sh` changed on `origin/main` in `598a7c3` after `v2.0.1`, with no tag cut since — a consumer pinning `rev: v2.0.1` gets a stale hook today. The gate cannot fire: it is wholly gated on `PRE_COMMIT_REMOTE_BRANCH == refs/heads/main`, and PRs merge through Gitea's server-side button, which sets nothing. The script's own header documents this as needing "a server-side CI job, which this repo does not have yet".
|
||||
>
|
||||
> **The premise that it serves only the external contract holds** — all three exported hooks are *separately* wired internally via `repo: local` (`.pre-commit-config.yaml:216,249,258`), so deleting the export costs **zero** internal lint coverage.
|
||||
> **The premise that it serves only the external contract holds** — all three exported hooks are *separately* wired internally via `repo: local` (~~`.pre-commit-config.yaml:216,249,258`~~ → ~~`.pre-commit-config.yaml:221,254,269`~~ → `.pre-commit-config.yaml:212,245,260`, the three `entry:` lines), so deleting the export costs **zero** internal lint coverage.
|
||||
>
|
||||
> **Correction to the finding: ADR-0014 gets amended, not retired.** Its primary decision — moving Vale config/styles/wrapper into `skill-audit/assets/vale/` and `agent-audit/assets/vale/`, self-locating from `${BASH_SOURCE[0]}` so the prefilter works at *runtime* in any repo installing kyberforge — is independent of the release-tag mechanism and stands on its own. Only the `.pre-commit-hooks.yaml` half and the tag consequence retire.
|
||||
>
|
||||
> Removal is ~1,000 lines and mechanical: `.pre-commit-hooks.yaml`, `check-release-needed.sh`, both tests, the hook block at `.pre-commit-config.yaml:194-201`, the `gates.md:83` row and its "External consumers" section. Tags are inert and can stay. **The one real loss:** `test-vale-hooks-consumer.sh` is the sole test exercising the entry-resolution path that once shipped broken — it goes only *with* the manifest, never while it stays. Reversal cost is bounded provided ADR-0014 and `LESSONS.md:101,105` are kept: they preserve the `entry[0]`-only constraint that took three review rounds to find.
|
||||
> Removal is ~1,000 lines and mechanical: `.pre-commit-hooks.yaml`, `check-release-needed.sh`, both tests, the hook block at ~~`.pre-commit-config.yaml:194-201`~~ → `.pre-commit-config.yaml:186-193`, the ~~`gates.md:83`~~ → `gates.md:96` row and its "External consumers" section (`gates.md:789`). Tags are inert and can stay. **The one real loss:** `test-vale-hooks-consumer.sh` is the sole test exercising the entry-resolution path that once shipped broken — it goes only *with* the manifest, never while it stays. Reversal cost is bounded provided ADR-0014 and `LESSONS.md:101,105` are kept: they preserve the `entry[0]`-only constraint that took three review rounds to find.
|
||||
>
|
||||
> > **Repointed (2026-09-16, at HEAD `b426460`):** the line citations in this note were taken at `062ca47` and have shifted. The `check-release-needed` block is now `.pre-commit-config.yaml:186-193` (`grep -n "id: check-release-needed"`); the three internal `repo: local` wirings' `entry:` lines are `:221` (`skill-size-check`), `:254` and `:269` (the two `vale-audit-prefilter-*` hooks, both now on `factory-audit`'s one `vale-wrap.sh`); the `check-release-needed` table row is `gates.md:96` and the "External consumers" section heading is `gates.md:789`. Verified with `grep -n` and `sed -n`. Line counts in this note were not re-measured.
|
||||
>
|
||||
> > **Repointed again (2026-09-16, at `4b17703`):** `4de5b6b` removed the `check-release-needed` block, so the three `entry:` lines are now `:212`, `:245` and `:260`. The `check-release-needed` table row and the "External consumers" section no longer exist in `gates.md`; the same commit deleted them, so the `:96` and `:789` citations above are historical.
|
||||
>
|
||||
> **Decided and done (2026-09-16):** see commit `4de5b6b` on `docs/simplification-audit`. The human took the deferred decision: remove the mechanism. Deleted `.pre-commit-hooks.yaml` (31 lines), `scripts/check-release-needed.sh` (242), `tests/test-check-release-needed.sh` (449 at HEAD, not the 442 above) and `tests/test-vale-hooks-consumer.sh` (276 at HEAD, not 272), plus the `check-release-needed` hook block, for **1,443 lines removed and 234 added** across 20 files. ADR-0014 is **amended, not retired**, as the note above says: its runtime bundling decision stands, and the amendment records why the export went and keeps the `entry[0]`-only constraint (`LESSONS.md:101,105`) in case it returns. ADR-0025 gets a pointer to that amendment. Tags are left in place. **One cost the finding did not count:** `tests/test-vale-wrap.sh` case 33, the cross-manifest `files:` drift check, and case 28's hook-scope half both read the published manifest and went with it. Case 33's one guard that did not need a second manifest, a local regex narrowed to one plugin, is now a third property of case 32, with its own mutation test, so that coverage is kept. `gates.md` now counts 8 authored pre-push hooks (10 reported), no longer 9 (11).
|
||||
|
||||
37. [x] ~~**Two `.mcp.json` files declare an Obsidian vault server over `docs/`** (root and `plugins/bin/`; the other five plugin `.mcp.json` files are empty stubs), while `AGENTS.md` forbids using an external memory system for this repo. If the Obsidian tools are unused, drop both and the `reinject_mcp_servers` explanation in the bin README; the bin `plugin.json` pair regenerates. Effort S.~~
|
||||
> **Not proceeding (2026-09-13):** premise doesn't hold. The server exposes the repo's own git-tracked `docs/` folder — not an external/off-repo store — so it isn't the "external memory system" AGENTS.md's rule targets. It was deliberately added and versioned (3 commits), is documented as current intended behavior in both READMEs, and ADR-0018 uses it as its only concrete worked example of apm's MCP-dependency propagation mechanism actually working. No skill invokes the Obsidian tools as a workflow step, but that alone doesn't make the config dead. No changes made; recommend a human confirm whether the vault tooling is still wanted before removing it.
|
||||
@@ -426,10 +492,18 @@ Not covered by the area audits above; found on a final sweep of the root config
|
||||
## 7. Suggested order
|
||||
|
||||
1. Quick wins, all S, no design decisions needed: findings 9, 10, 26, 30, 31, 29, 12, 13, 1, 6, 4, 35, 37, 38, and the mirror-sync and executables-allow halves of 2. Removes roughly 25,000 to 30,000 lines and 6 hooks.
|
||||
2. Structural changes that need a short discussion: ~~14~~, 15, ~~19~~, 20, 23, 25, 17, ~~3~~, 5, ~~7~~, 33, ~~34~~, 36.
|
||||
3. The real complexity: ~~16 (validators)~~, 11 (provenance), ~~24 (core)~~, 8 and 28 (gates.md and ADRs).
|
||||
2. Structural changes that need a short discussion: ~~14~~, ~~15~~, ~~19~~, ~~20~~, ~~23~~, ~~25~~, ~~17~~, ~~3~~, ~~5~~, ~~7~~, ~~33~~, ~~34~~, ~~36~~.
|
||||
3. The real complexity: ~~16 (validators)~~, ~~11 (provenance)~~, ~~24 (core)~~, ~~8 and 28 (gates.md and ADRs)~~.
|
||||
|
||||
> **Re-derived (2026-09-16, at HEAD):** this ordering was written before the findings were worked, and seven of its entries are now closed. Struck above: **14** landed (`467bbd7`, ADR-0025); **7** was superseded then done (`718c79a`); **3** and **19** are not proceeding on refuted premises; **34**, **16** and **24** are refuted outright. **5** is left standing but is downstream of 16 by its own note, so it cannot be taken in this bucket's order. Read each finding's own marker, not this list — it is a plan of record, not a status board. Bucket 1 is left as written: every entry in it is marked `[x]` or carries a decision note at its own finding.
|
||||
> **Status (2026-09-16, after the grill on 33, 28, 22/18, 20, 8, 34):** open findings were **15** (merge `skill-author` + `agent-author`) and **36** (release-tag mechanism, decision deferred by the human). **22** is deferred with the rest of `bin`. Every other finding is done, closed, or refuted at its own note.
|
||||
>
|
||||
> **Updated (2026-09-16, later):** **36** is decided and done (`4de5b6b`), so **15** is the only open finding. **22** stays deferred with `bin`.
|
||||
>
|
||||
> **Updated (2026-09-16, after the finding 15 grill):** **15** is refuted on measurement (see its note), so no finding is open. **22** stays deferred with `bin`.
|
||||
>
|
||||
> **Complete (2026-09-16).** The follow-up read after 15 closed turned up four loose ends, all now settled: finding 6's `check-apm-agents-valid` fold (not proceeding, see its note); finding 27's dangling always-on pointer (constitution moved to `core/` and deployed, `adaa978`); finding 5's differential-suite speed-up (not proceeding, see its note); and finding 16's resolver-sourcing option (done, `ef27c97`). Nothing in this audit is open. **22** is out of scope with `bin` and, by the human's decision, is not tracked anywhere.
|
||||
|
||||
> **Re-derived (2026-09-16, at HEAD):** this ordering was written before the findings were worked, and ~~seven of its entries are now closed~~ → ~~all but two~~ → ~~all but one~~ → all of its bucket-2 and bucket-3 entries are now closed (corrected later on 2026-09-16, after the grill, and again once **36** closed and once **15** was refuted). Struck above: **14** landed (~~`467bbd7`~~ → `620f20b`, ADR-0025); **7** was superseded then done (`718c79a`); **3**, **5** and **19** are not proceeding on refuted premises; ~~**34**,~~ **16** and **24** are refuted outright; **34** was refuted as a removal and then decided and done as documentation of the branch hazard in ADR-0019 (`afcf477`), with the hook kept; **33** was decided and done (enforce the bump, `8451169`); **8**, **20** and **28** closed at the grill; **17**, **23** and **25** were declined by the human; **11** was declined by the human; **36** was done (`4de5b6b`). ~~**5** is left standing but is downstream of 16 by its own note, so it cannot be taken in this bucket's order.~~ **5** is closed with 16: its own note says it is downstream of 16, and 16 is refuted. ~~Still open, per the Status note above: **15** alone, now that **36** is done (`4de5b6b`);~~ **15** was refuted on measurement after its own grill, so none is still open; **22** is deferred with `bin`. Read each finding's own marker, not this list — it is a plan of record, not a status board. Bucket 1 is left as written: every entry in it is marked `[x]` or carries a decision note at its own finding. *(Updated 2026-09-16:)* `[x]` now marks every closed finding, whatever the outcome — done, refuted, declined or not proceeding; read the note for which. The only finding without one is **22**, deferred with `bin`.
|
||||
|
||||
Findings 9, 10, 11, and 12 are coupled through the provenance validator and the audit criteria; land them together or the audit gates start reporting the removals.
|
||||
|
||||
@@ -445,17 +519,27 @@ Findings 9, 10, 11, and 12 are coupled through the provenance validator and the
|
||||
> **The mechanism is host-independent, which is why this bullet had to change.** ADR-0024 consequence 1 and §9's first residual both state it for Claude Code: a native registration succeeds and installs six plugins containing zero skills, silently. Nothing in that chain is Claude-specific. The catalogue is a list of plugin *roots*; discovery of content inside a root is a convention-scan of flat `skills/`/`agents/`/`hooks/` directories, and that is the layout `718c79a` deleted. Whichever of the four paths a host resolves the catalogue through, it lands on the same empty roots. Copilot was in fact always the weaker case — ADR-0017's own `hooks` amendment records that the mirror only ever partially served it.
|
||||
>
|
||||
> **The delete still holds**, for a stronger reason than the one given: the file was a preferred discovery path to content that no longer exists. What changed is the accepted cost — this is no longer "preference lost", it is the same accepted silent-empty-install residual §9 records, now known to apply to Copilot as well.
|
||||
- **Provenance chain.** Is "which upstream informed this file" a requirement you still want, or was it a governance experiment? Finding 11 hinges on this.
|
||||
- [x] ~~**Provenance chain.** Is "which upstream informed this file" a requirement you still want, or was it a governance experiment? Finding 11 hinges on this.~~
|
||||
> **Sharpened (2026-09-14):** still open, but ask it of the **producer** first. `plugins/bin/.apm/skills/research/` specifies the `sources.md` + `source_keys:` format and three evals in `plugins/bin/evals/research/research/eval.yaml` assert it. If `research` keeps emitting the chain, finding 11 collapses to "delete the validators" and the metadata stays. See finding 11's verification note.
|
||||
- **ADR-0012 (three core skills) and the one-script-per-skill install constraint.** ~~The merges in 14, 15, and 24 need the first revisited and are the only way around the second.~~ **Corrected (2026-09-14):** this grouping was wrong, and finding 2b's note has said so since `0dffff3` while this bullet said the opposite. ADR-0012 governs only the `core` plugin's three `agentsmd-*` skills (`agentsmd-author`, `agentsmd-audit`, `provider-adapter-author`) — read it: it names those three and nothing else. **Only finding 24 touches them, so only finding 24 needs ADR-0012 revisited.** Findings 14 and 15 merge kyberforge's `skill-audit`/`agent-audit` and `skill-author`/`agent-author`, which ADR-0012 does not govern; what constrains them is the self-containment rule, and merging is the way *around* it rather than a reason to reverse anything. That rule survives ADR-0024 — see §9's negative result and ADR-0024 consequence 6, which also correct its source: it is the agentskills.io spec for APM package mode, not a property of Claude Code's plugin cache-install as finding 2b's note assumed. The open question for 14/15 is a design one — one `description` carrying both skills' trigger phrases — not an ADR supersession. Are you open to superseding ADR-0012, for finding 24?
|
||||
> **Closed on the 14/15 half (2026-09-16, at HEAD):** finding 14 landed as `factory-audit` on 2026-09-15 (`467bbd7`, ADR-0025), and the design question this bullet holds open was answered by doing it — the merged description ships at 241 characters, inside the 250 SUGGESTION target, and the binding ceiling turned out to be the 900-word **body**, solved with a dispatch body over `skill-*`/`agent-*` reference files. See finding 14's own note. What remains open here is finding 15 (`skill-author` + `agent-author`) and the ADR-0012 question below, which the next note already answers.
|
||||
>
|
||||
> **Answered (2026-09-16):** keep it. The human declined finding 11; the chain and its validators stay, and `research` keeps producing it.
|
||||
- [x] ~~**ADR-0012 (three core skills) and the one-script-per-skill install constraint.**~~ ~~The merges in 14, 15, and 24 need the first revisited and are the only way around the second.~~ **Corrected (2026-09-14):** this grouping was wrong, and finding 2b's note has said so since `0dffff3` while this bullet said the opposite. ADR-0012 governs only the `core` plugin's three `agentsmd-*` skills (`agentsmd-author`, `agentsmd-audit`, `provider-adapter-author`) — read it: it names those three and nothing else. **Only finding 24 touches them, so only finding 24 needs ADR-0012 revisited.** Findings 14 and 15 merge kyberforge's `skill-audit`/`agent-audit` and `skill-author`/`agent-author`, which ADR-0012 does not govern; what constrains them is the self-containment rule, and merging is the way *around* it rather than a reason to reverse anything. That rule survives ADR-0024 — see §9's negative result and ADR-0024 consequence 6, which also correct its source: it is the agentskills.io spec for APM package mode, not a property of Claude Code's plugin cache-install as finding 2b's note assumed. The open question for 14/15 is a design one — one `description` carrying both skills' trigger phrases — not an ADR supersession. ~~Are you open to superseding ADR-0012, for finding 24?~~
|
||||
> **Closed on the 14/15 half (2026-09-16, at HEAD):** finding 14 landed as `factory-audit` on 2026-09-15 (~~`467bbd7`~~ → `620f20b`, ADR-0025), and the design question this bullet holds open was answered by doing it — the merged description ships at 241 characters, inside the 250 SUGGESTION target, and the binding ceiling turned out to be the 900-word **body**, solved with a dispatch body over `skill-*`/`agent-*` reference files. See finding 14's own note. What remains open here is finding 15 (`skill-author` + `agent-author`) and the ADR-0012 question below, which the next note already answers.
|
||||
> **Moot (2026-09-14):** finding 24 is refuted on arithmetic before this question is reached — the three `core` bodies total 1,360 words against `BODY_MAX_WORDS=900`, and their descriptions 806 chars against a 400 cap. Nothing needs superseding because the merge it would unblock cannot be committed. Question closed unless finding 24 is rewritten.
|
||||
- **Granularity of git/gitea skills.** One `git` skill vs seven trades routing precision for size. Is one broad description acceptable?
|
||||
>
|
||||
> **Closed (2026-09-16):** both halves are settled — finding 14 landed and finding 24 is refuted. The only finding left under this bullet is 15, which needs no ADR-0012 revisit (see above); its remaining question is the design one this bullet already names.
|
||||
> **Closed (2026-09-16, later):** finding 15 is refuted on measurement — about 150–180 shared lines, and ADR-0020's exclusion holds. See its note in §4.2. Nothing remains open under this bullet.
|
||||
- [x] ~~**Granularity of git/gitea skills.** One `git` skill vs seven trades routing precision for size. Is one broad description acceptable?~~
|
||||
> **Answered by measurement (2026-09-14): no, and it is not a preference question.** A merged git description measures **1,950 chars against a 400-char FAIL ceiling (4.9×)** and a 3,381-word body against 900 (3.8×). Both proposed gitea halves also FAIL at 2.5×, and the gitea split additionally puts a hard boundary through the edit-a-file-then-open-a-PR workflow. (An earlier revision also called the gitea split "blocked by ADR-0011, which already rejected a *smaller* bundling" — withdrawn; ADR-0011's objection is to a boundary being crossed, not to bundle size. See finding 20's verification note.)
|
||||
- **Auto-update at session start.** Do you want the install refreshed from the remote every time a session opens (finding 34), or is a manual `apm update` acceptable?
|
||||
>
|
||||
> **Answered (2026-09-16):** keep the seven-and-seven granularity. Finding 20 closed at the grill as not proceeding, salvage included; see its closing note.
|
||||
- [x] ~~**Auto-update at session start.** Do you want the install refreshed from the remote every time a session opens (finding 34), or is a manual `apm update` acceptable?~~
|
||||
> **Recommendation on evidence (2026-09-14): keep it; finding 34 refuted.** The premise that it runs on every startup is false (the update is conditional on a real SHA check), the lock was not dirty, the hook did not fire this session, and the install is currently **9 commits behind `main` with nothing reporting it** — the failure the hook exists to prevent. `install.sh`, the proposed alternative host, has no apm step. Still formally the human's call, but the factual basis for removing it does not survive. See finding 34.
|
||||
- **External hook consumers.** Does any other repo pin this repo's `.pre-commit-hooks.yaml` by tag today? If not, finding 36 defers the release mechanism entirely.
|
||||
>
|
||||
> **Decided (2026-09-16, grill):** keep the hook and document the feature-branch hazard; skipping the refresh off the default branch was rejected. Landed in ADR-0019 (`afcf477`). See finding 34's closing note.
|
||||
- [x] ~~**External hook consumers.** Does any other repo pin this repo's `.pre-commit-hooks.yaml` by tag today? If not, finding 36 defers the release mechanism entirely.~~
|
||||
> **Evidence gathered, decision deferred (2026-09-14).** No consumer found: the Gitea instance holds two repos, and the other pins seven hook repos, none of them this one. No consumer-driven commit in the 13 touching the mechanism. Off-instance clones undeterminable — but ADR-0024 accepted exactly this standard when it deleted the mirror. The mechanism is additionally **already broken** (a consumer pinning `rev: v2.0.1` gets a stale `skill-size-check.sh`, and the guard cannot fire through Gitea's merge button). The human deferred the decision on 2026-09-14; the finding is ready to execute when it is taken. See finding 36.
|
||||
> **Answered (2026-09-16):** no consumer, and the human took the decision: the mechanism is removed (`4de5b6b`), and ADR-0014 is amended to record why. See finding 36.
|
||||
- [x] ~~**Obsidian MCP.** Are the Obsidian tools over `docs/` used by anyone? If not, finding 37 is a pure delete.~~
|
||||
> **Answered (2026-09-14):** not used — remove entirely. All seven `.mcp.json` files are deleted and the repo-root path is gitignored; see finding 37, which also records the functional regression this uncovered (since `718c79a` deleted the per-plugin manifests, apm no longer propagated the server to consumers at all).
|
||||
|
||||
@@ -466,9 +550,9 @@ Recorded here so they are not rediscovered as defects. All follow from commit `7
|
||||
**Two accepted residuals.**
|
||||
|
||||
- **Native install still half-works, and cannot be prevented.** apm reuses Claude's catalogue format by design, so a Claude Code user can still register holocron natively and will install six plugins containing zero skills. Accepted, not overlooked: no schema change closes this, because the format that makes it possible is the format apm's own consumers need.
|
||||
- **Consumers now receive test fixtures.** apm installs from `.apm/`, which carries the `tests/` directories the mirror used to strip, so a consumer installing from this branch receives **10 `.bats` files across 6 skills**, plus those skills' 6 `tests/README.md` files — 16 files. (Repo-wide, 17 tracked paths contain `/tests/`: the 10 `.bats` and 7 `README.md`, one of which is a template asset under `skill-author/assets/templates/tests/` and is not a test fixture.) This is what consumers *receive*, not what this checkout shows: `.claude/skills/` here currently holds zero `.bats` files, because that deployed tree is stale and predates this branch. The mechanism was confirmed empirically on a ref-pinned consumer clone — the 16 files are absent at the parent commit and present at HEAD. Suppressing them means switching all six `apm.yml` files from `includes: auto` to explicit lists, where a wrong list silently drops content — worse failure mode than the noise. Deferred deliberately.
|
||||
- **Consumers now receive test fixtures.** apm installs from `.apm/`, which carries the `tests/` directories the mirror used to strip, so a consumer installing from this branch receives **10 `.bats` files across 5 skills**, plus those skills' 5 `tests/README.md` files — ~~16~~ → **15** files. (Repo-wide, ~~17~~ → **16** tracked paths contain `/tests/`: the 10 `.bats` and 6 `README.md`, one of which is a template asset under `skill-author/assets/templates/tests/` and is not a test fixture. Re-counted 2026-09-19 at HEAD with `git ls-files | grep '/tests/'`; the earlier figures predate ADR-0025's merge, which collapsed `skill-audit` and `agent-audit` into one skill and took the skill count from 6 to 5.) This is what consumers *receive*, not what this checkout shows: `.claude/skills/` here currently holds zero `.bats` files, because that deployed tree is stale and predates this branch. The mechanism was confirmed empirically on a ref-pinned consumer clone — the files are absent at the parent commit and present at HEAD. Suppressing them means switching all six `apm.yml` files from `includes: auto` to explicit lists, where a wrong list silently drops content — worse failure mode than the noise. Deferred deliberately.
|
||||
|
||||
**Negative result — do not re-litigate.** Deleting native install does *not* relax the self-containment constraint. `plugins/kyberforge/.apm/skills/skill-author/references/deployment-modes.md`, sourced from the agentskills.io spec, states it independently for APM package mode: the spec defines no cross-skill sharing. So findings 14 and 15 still require *merging* skills; sharing one file between two skills remains impossible, and §8's "one-script-per-skill install constraint" bullet is unchanged by this decision.
|
||||
**Negative result — do not re-litigate.** Deleting native install does *not* relax the self-containment constraint. `plugins/kyberforge/.apm/skills/skill-author/references/deployment-modes.md`, sourced from the agentskills.io spec, states it independently for APM package mode: the spec defines no cross-skill sharing. So ~~findings 14 and 15 still require~~ → finding 14 required *merging* skills (done, ADR-0025), and finding 15 would have too (refuted on measurement, 2026-09-16); sharing one file between two skills remains impossible, and §8's "one-script-per-skill install constraint" bullet is unchanged by this decision.
|
||||
|
||||
**Accepted gap — symlinks under `.apm/`.** ADR-0017's `check_apm_symlinks()` was the only thing reporting that symlinks under `.apm/` do not survive to a consumer. It is gone, and no replacement guard is being added — the human decided to accept the gap.
|
||||
|
||||
@@ -501,6 +585,8 @@ That base rate made "effort S, no decisions needed" an unreliable signal, and §
|
||||
| 24 | Refuted — arithmetically impossible (1,360w vs a 900 cap) | 0 |
|
||||
| 34 | Refuted — evidence inverted | 0 |
|
||||
|
||||
> **Dispositions since the wave (2026-09-16):** this table records the verdicts at `062ca47` and is left as written. Of the ten, none is still open: **36** was decided and done later the same day (`4de5b6b`), and before that it was the only open one. **33** and **34** are decided and done — the bump is enforced (`8451169`) and the feature-branch hazard is documented in ADR-0019 (`afcf477`), with the hook kept. **20** and **28** closed at the grill as not proceeding; **11** and **27** were declined by the human; **22** is deferred with `bin`. See each finding's own closing note.
|
||||
|
||||
**One premise of ten survived — finding 36's — but not the finding whole: its supporting figure was wrong (`test-vale-hooks-consumer.sh` is 272 lines, not 270). The other nine premises failed.**
|
||||
|
||||
**The headline figure was wrong in at most eight of the ten, not all ten.** Two exceptions, stated so the claim is not overstated:
|
||||
@@ -516,7 +602,7 @@ The recurring failure mode is worth naming, because it has now produced six wron
|
||||
|
||||
> **Executed, and one knock-on claim corrected (2026-09-15).** Finding 14 landed as `factory-audit` (ADR-0025); yield **2,934 lines and one pre-push hook**, and the §8 blocker turned out to be a non-issue. The body was the binding ceiling, not the description, which ships at 241 characters, under the 250 target, once a duplicated trigger register was removed. See finding 14's own note for the corrections.
|
||||
>
|
||||
> **The merge does not unblock `check-scope-walkup-sync`, and nothing in this audit should be read as saying it does.** §3's finding 2 bullet says that gate "disappears if the ports share one script or the skills merge"; the second half of that is wrong, and the first is unreachable. The gate cross-checks **four** independent `$HOME`/`.git`/`apm.yml` walk-up ports, and only two of them are in the audit pair (`validate.sh`'s `detect_scope`, `validate-provenance.sh`'s `find_plugin_root`). The other two — `new-agent.sh`'s and `new-skill.sh`'s `find_package_root` — live in the **author** skills, which finding 15 has not merged and which could not be merged into the audit skill in any case. Four ports go to four ports.
|
||||
> **The merge does not unblock `check-scope-walkup-sync`, and nothing in this audit should be read as saying it does.** §3's finding 2 bullet says that gate "disappears if the ports share one script or the skills merge"; the second half of that is wrong, and the first is unreachable. The gate cross-checks **four** independent `$HOME`/`.git`/`apm.yml` walk-up ports, and only two of them are in the audit pair (`validate.sh`'s `detect_scope`, `validate-provenance.sh`'s `find_plugin_root`). The other two — `new-agent.sh`'s and `new-skill.sh`'s `find_package_root` — live in the **author** skills, which ~~finding 15 has not merged~~ → stay separate now that finding 15 is refuted (2026-09-16), and which could not be merged into the audit skill in any case. Four ports go to four ports.
|
||||
>
|
||||
> It cannot degrade into a text diff either, which is the shape that would let it be deleted rather than merely shrunk: the two audit-side ports are **Python** (`def detect_scope`, `def find_plugin_root`, inside heredocs) and the two author-side ports are **Bash** functions. Byte-comparing them is not an option at any point on this path, so the behavioural fixture cross-check is the only available form of the gate. It survives finding 15 too.
|
||||
>
|
||||
@@ -524,5 +610,56 @@ The recurring failure mode is worth naming, because it has now produced six wron
|
||||
|
||||
### Two defects to fix independently of any finding
|
||||
|
||||
- **~~A live bug in always-on context.~~ Fixed (2026-09-15).** The deployed `core/instructions/governance.md` cited `docs/HUMANS.md`, which does not exist — the file is `docs/wiki/HUMANS.md`. Five occurrences across three files (`governance.md:82`, which was self-inconsistent against its own correct line 73; `CONTROLS.md:5,101,106`; `ai-constitution.md:238`), in a file `@`-imported into every session in every project. All five now point at `docs/wiki/HUMANS.md`. Note the deployed copy under `~/.claude/` no longer matches the repo until `scripts/install.sh` re-runs.
|
||||
- **This checkout's install is stale and there is a branch hazard.** At the time of the wave `apm outdated` reported 6 outdated dependencies, 9 commits behind `main`, with a clean tree and nothing reporting it. **Do not run `apm update` on this branch** — it resolves against `main` and restores the obsidian MCP server that commit `c96ca9c` removed here. Reproduced. The mechanism is worse than "reinstalls `plugins/bin/.mcp.json`": apm never writes into `plugins/`, it re-materialises the file under `apm_modules/` and regenerates the repo-root `/.mcp.json` — which `c96ca9c` gitignored, so the restoration would not appear in `git status` at all. This belongs in ADR-0019's Consequences; see finding 34.
|
||||
- **~~A live bug in always-on context.~~ Fixed (2026-09-15).** The deployed `core/instructions/governance.md` cited `docs/HUMANS.md`, which does not exist — the file is `docs/wiki/HUMANS.md`. Five occurrences across three files (`governance.md:82`, which was self-inconsistent against its own correct line 73; `CONTROLS.md:5,101,106`; `ai-constitution.md:238`), in a file `@`-imported into every session in every project. All five now point at `docs/wiki/HUMANS.md`. ~~Note the deployed copy under `~/.claude/` no longer matches the repo until `scripts/install.sh` re-runs.~~ **Deployed (2026-09-16):** the fixed file was copied to `~/.claude/core/instructions/governance.md` and `diff -rq core ~/.claude/core` is clean. `install.sh` itself was deliberately not run: it overwrites `~/.claude/settings.json` wholesale, and the deployed copy carried machine-local keys (`model`, `extraKnownMarketplaces`, `autoMemoryEnabled`, notification flags) that the repo's `providers/claude-code/settings.json` does not.
|
||||
- **This checkout's install is stale and there is a branch hazard.** At the time of the wave `apm outdated` reported 6 outdated dependencies, 9 commits behind `main`, with a clean tree and nothing reporting it. ~~**Do not run `apm update` on this branch**~~ — it resolves against `main` and restores the obsidian MCP server that commit `c96ca9c` removed here. Reproduced. The mechanism is worse than "reinstalls `plugins/bin/.mcp.json`": apm never writes into `plugins/`, it re-materialises the file under `apm_modules/` and regenerates the repo-root `/.mcp.json` — which `c96ca9c` gitignored, so the restoration would not appear in `git status` at all. This belongs in ADR-0019's Consequences; see finding 34.
|
||||
> **Landed (2026-09-16):** commit `afcf477` amended ADR-0019's Consequences with the feature-branch hazard, and the discard guidance for a feature branch is now also in `AGENTS.md` and `README.md` (`dd0b923`). The reason those two files and ADR-0019 gave for discarding the lock was wrong, and the review round below corrected it. See finding 34's closing note.
|
||||
> **Superseded (2026-09-19) — the "do not run `apm update`" instruction above no longer stands.** It was never enforceable and is now contradicted three ways. kyberforge's `SessionStart` hook runs `apm update --yes` on **every** branch, so the command runs on this branch at every session start whether or not anyone types it. ADR-0019's 2026-09-16 amendment considered skipping the refresh off the default branch and **explicitly rejected it**: it would not make the branch live, only freeze the session on an older `main` — the silent staleness the ADR exists to prevent. And `AGENTS.md`'s session rules and `README.md`'s install section now carry the branch-aware guidance that replaces the prohibition: on a feature branch, discard the rewritten lock (`git checkout -- apm.lock.yaml`, then `apm install`), which keeps unrelated lock churn out of the branch diff and keeps `apm pack --check-clean` consistent with the committed lock. **Current guidance: let the refresh run, then discard the lock on a feature branch.** The observation the instruction was built on is untouched and still worth reading — the obsidian server does come back, apm re-materialises it under `apm_modules/` and regenerates the gitignored root `.mcp.json`, and `git status` shows none of it. The redeployed content goes away once the branch merges, and the next `apm update`/`apm install` that resolves a tree no longer declaring the server removes it via `MCPIntegrator.remove_stale`.
|
||||
|
||||
## 11. Review round on the grill commits (2026-09-16)
|
||||
|
||||
A review of this branch's grill commits (`8451169` through `b426460`) raised the findings below. Each was decided in this round and fixed on this branch. Several agents made the fixes in parallel. This note records the decisions. It does not re-verify the details of fixes it did not make itself: for those, read the named file or ADR.
|
||||
|
||||
- **Version-bump gate baseline.** The gate now also compares against the `origin/main` tip, as well as the merge-base. ADR-0022 is amended to match. This supersedes the merge-base-only wording in finding 33's closing note.
|
||||
- **Version-bump gate parsing.** Frontmatter that starts with a BOM, and version components with leading zeros, are now parsed correctly.
|
||||
- **Version-bump gate tests.** The gaps the review found in `tests/test-skill-version-bump.sh` are closed.
|
||||
- **Plugin patch bumps.** Five plugins took a patch bump: `bin`, `git`, `gitea`, `core` and `lint`. kyberforge was already at `2.0.0` on this branch and needed no further bump.
|
||||
- **Root `apm.yml` descriptions.** The `packages[].description:` duplicates are dropped, following the `version:` lines `2def060` already removed. ADR-0021 is amended. This is not a version location, so finding 33's corrected count (one per plugin, two for kyberforge) is unaffected.
|
||||
- **Remote-entry `version:` guidance.** The `apm-workflow` references now give the right guidance on a remote marketplace entry's `version:`.
|
||||
- **Lock-file discard reasoning.** `README.md`, `AGENTS.md` and ADR-0019's 2026-09-16 amendment used to say to discard the refreshed lock on a feature branch "because it records `main`'s commit, not the branch's". That was wrong: the branch's committed lock records a `main` commit too, just an older one. In this checkout it is `b7bec71`, which `git branch -r --contains` finds on `origin/main`. All three now give the real reasons. Discarding keeps unrelated lock churn out of the branch diff, and it keeps the deployed tree consistent with the lock that `apm pack --check-clean` reads. They also state the cost: the session runs the older `main` until the next session start refreshes again. The SessionStart notice in `check-apm-current.sh` now gives branch-specific advice, and `tests/test-apm-current-hook.sh` pins it. ADR-0019 had two claims that were checked against apm's source. `apm pack` "refuses to run": precisely, it raises a build error before the `--check-clean` gate is reached, and only when a file the lock lists is missing on disk (`bundle/packer.py`, `pack_bundle`). apm "removes a server on its next update": this holds, and it holds for `apm install` as well (`install/mcp/integration.py`, `MCPIntegrator.remove_stale`). The amendment now says both precisely.
|
||||
- **ADR-0022 amendment.** The amendment's placement and the validator names it cites are fixed.
|
||||
|
||||
## 12. Final review round on the whole branch (2026-09-16)
|
||||
|
||||
Seven parallel reviewers went over the whole branch against `main`, each covering one area: the gate scripts, a full test and hook run, references to removed files, kyberforge, the other five plugins, the docs and ADRs, and this document. The full suite and every hook passed at `55221d0`. Nothing still pointed at a removed file, and no finding marked done was missing. The fixes below landed after that review.
|
||||
|
||||
**Fixed:**
|
||||
|
||||
- **Duplicated `SessionStart` entry on a fresh install** (`3a9d257`). apm recognises its own `settings.json` entries only through the `.claude/apm-hooks.json` sidecar. With the sidecar gitignored, a fresh clone's `apm install` added a second copy of the entry and `apm audit --ci` reported drift. This was reproduced on `main` too. The sidecar is now committed and excluded from `pretty-format-json`, and ADR-0019 carries a correction.
|
||||
- **Version-bump gate frontmatter shape** (`614a0d5`). `read_version` now accepts the leading whitespace that `skill-size-check` already accepts, and case 39 pins it. The hook entry now describes the main-tip check.
|
||||
- **README advice in the size checks** (`8ce5392`). `skill-size-check` and factory-audit's validator no longer tell authors to move detail to a README, since skills no longer have one.
|
||||
- **Test runners inside a Claude worktree** (`7380bed`). The runners' worktree exclusion is now relative to the search root, so they also work when the repo itself is a Claude worktree.
|
||||
- **Catalog version and Copilot wording** (`2574391`). The catalog is bumped `0.4.7` → `0.5.0`: removing an entry is a minor change under apm-workflow's marketplace policy. The Copilot wording now says Copilot is reached through apm.
|
||||
- **Stale doc claims** (`1f3d4f9`):
|
||||
- ADR-0014 carries a correction: `skill-size-check` sources the resolver since `ef27c97`.
|
||||
- ADR-0017's status line now matches its supersession.
|
||||
- `architecture.md` and `gates.md` carry the current duplication counts.
|
||||
- "Vacuous green" is defined where `gates.md` uses it.
|
||||
- The gitleaks lesson is marked historical.
|
||||
- **Bare-`git` rule in `git-commits`** (`0323c29`). The general rule is restored.
|
||||
- **Retrofit cut order in `skill-author`** (`baa2f5d`). The ordered cuts are restored inline, and the stale hook name and plugin-mode wording are fixed.
|
||||
- **Stale hashes and figures in this document** (this commit). Hashes left by the branch rewrite are corrected in place. `a8cd5e8` and `c59e4bf` are annotated as unreachable, with their content in `598a7c3`. The case 33 lines are struck. The §1 table, the `gates.md` length and the ADR share are re-measured at `baa2f5d`. The document moves to `docs/notes/`.
|
||||
|
||||
**Declined:**
|
||||
|
||||
- **Removing the remaining `(ADR-0023)` tags.** They are the opt-out markers `check-rtk-prefix` requires on deliberately bare git commands, so removing them would fail that hook.
|
||||
- **Fixing the constitution path in `plugins/kyberforge/docs/research/examples/skill-write/`.** That directory is a frozen research snapshot of a retired skill.
|
||||
- **Restoring factory-audit's dropped trigger phrases.** Removing them was deliberate under ADR-0020's duplicate-wording rule.
|
||||
- **Checking every ref in a multi-ref push.** The version-bump gate checks only one ref per push. That is pre-commit's behaviour and is documented; closing the gap needs a server-side CI check, not a hook change.
|
||||
|
||||
**Open follow-ups:**
|
||||
|
||||
- **~~Gitea #101.~~ Closed — the instruction was already a no-op when written (2026-09-20).** ~~Close it through this branch's PR with `Closes #101`.~~ A comment is posted. Read back from the Gitea API on 2026-09-20, #101 is `"state": "closed"` with `"closed_at": "2026-09-16T16:03:35Z"` — closed on 2026-09-16, this §12 note's own date, so there is nothing left for a `Closes #101` trailer to do. No PR change needed. The comment on the issue stands.
|
||||
- **Gitea #66.** It needs re-scoping, because its `.mcp.json` target is gone. A comment is posted.
|
||||
- **The dropped `LESSONS.md` entry.** The entry saying that "read at session start" is only a hope was removed, and no issue tracks it.
|
||||
- **The ADR-0020 constants.** They could move into the shared library that `skill-size-check` now sources, which would remove the last duplicated copy.
|
||||
- **~~The `a8cd5e8` citations.~~ Closed (2026-09-20, by `e4ed343`).** ~~`scripts/skill-size-check.sh` and `tests/test-skill-size-check.sh` still cite `a8cd5e8`, which no branch reaches. `598a7c3` is the reachable equivalent.~~ `e4ed343` ("docs(gates): cite the reachable squash commit for the exit-2 split", 2026-09-16 15:39 UTC) landed after this follow-up was written and repointed both at `598a7c3`: `scripts/skill-size-check.sh:121` and `tests/test-skill-size-check.sh:737`. Verified at `1614bce` — `grep -rn a8cd5e8 scripts/ tests/` returns nothing. §4.4's finding 24 note carried the same stale citation (with `:729`, a wrong line number) and is corrected in place there.
|
||||
@@ -58,7 +58,7 @@ Return: extracted content per source, commit SHAs, licence notes, security flags
|
||||
|
||||
Spawn an agent to cross-check the extracted upstream content against:
|
||||
- `core/instructions/governance.md` — hard prohibitions, data classification, HITL requirements
|
||||
- `docs/ai-constitution.md` — scope discipline, deterministic execution preference, licence obligations, output volume constraint, transparency requirements
|
||||
- `core/ai-constitution.md` — scope discipline, deterministic execution preference, licence obligations, output volume constraint, transparency requirements
|
||||
|
||||
The agent flags conflicts and tensions as numbered items for the synthesis grill. It does **not** resolve them — that is the grill's job.
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Deterministic Controls
|
||||
|
||||
Applies to: any environment, repository, or pipeline where AI tools are used.
|
||||
Full governance context: `docs/ai-constitution.md` — principles these controls enforce.
|
||||
Full governance context: `core/ai-constitution.md` — principles these controls enforce.
|
||||
Human practitioner rules: `docs/wiki/HUMANS.md` | Agent instructions: `core/instructions/governance.md`
|
||||
This file specifies the enforcement layer: controls that run mechanically, regardless of human or agent intention.
|
||||
|
||||
@@ -103,4 +103,4 @@ Human judgment decisions — which AI model to use, whether a specific output is
|
||||
---
|
||||
|
||||
*Derived from AI Constitution v1.1 — May 2026.*
|
||||
*Counterpart to: `docs/wiki/HUMANS.md` | `core/instructions/governance.md` | Full context: `docs/ai-constitution.md`*
|
||||
*Counterpart to: `docs/wiki/HUMANS.md` | `core/instructions/governance.md` | Full context: `core/ai-constitution.md`*
|
||||
@@ -27,7 +27,7 @@ Skills are **not** deployed by `install.sh`. They are distributed as plugins and
|
||||
|
||||
Skills, agents, MCP servers, and hooks are distributed as self-contained plugin units under `plugins/`, installed independently via `apm install`, here and in any consuming repo (ADR-0018). Each unit is an **apm package**: `plugins/<name>/apm.yml` plus a hand-authored `plugins/<name>/.apm/{skills,agents,hooks,commands,instructions,extensions}/` tree (ADR-0015). There is no per-plugin `plugin.json` at all — apm reads `apm.yml`, and the repo's one generated manifest, `.claude-plugin/marketplace.json`, is compiled from that source.
|
||||
|
||||
Self-contained is a hard constraint, not a description: a file reference inside `.apm/skills/<name>/` may not reach outside that skill's own directory, and there is no cross-skill sharing mechanism to reach for instead. That is why the Vale styles are duplicated across two skills rather than shared (ADR-0014), and why ADR-0020's constants are copied into three validators rather than sourced from one. The constraint used to be explained by Claude Code's plugin cache-install copying a plugin to a cache; that is no longer the reason and never was the only one. It is stated independently for APM package mode by the agentskills.io spec (`plugins/kyberforge/.apm/skills/skill-author/references/deployment-modes.md`), which is why ADR-0024 consequence 6 pins it as a negative result: ending native install did not relax it, and it is not to be re-litigated on the assumption that it did.
|
||||
Self-contained is a hard constraint, not a description: a file reference inside `.apm/skills/<name>/` may not reach outside that skill's own directory, and there is no cross-skill sharing mechanism to reach for instead. That is why the Vale styles ship inside the one skill that uses them, `factory-audit/assets/vale/` (ADR-0014, ADR-0025), and why ADR-0020's constants are copied rather than sourced from one place: `scripts/skill-size-check.sh` carries them, and so do `factory-audit`'s mode libraries — `scripts/lib-checks-skill.sh:313-316` all four, `scripts/lib-checks-agent.sh:164-165` the two description ones. The plugin's `validate.sh` carries none of them; it sources the library its mode selects. The constraint used to be explained by Claude Code's plugin cache-install copying a plugin to a cache; that is no longer the reason and never was the only one. It is stated independently for APM package mode by the agentskills.io spec (`plugins/kyberforge/.apm/skills/skill-author/references/deployment-modes.md`), which is why ADR-0024 consequence 6 pins it as a negative result: ending native install did not relax it, and it is not to be re-litigated on the assumption that it did.
|
||||
|
||||
Which apm package a new skill belongs in follows from what each one is scoped to. The boundary that matters most in practice is `core` vs `kyberforge`: `core` is the home for cross-cutting, repo-agnostic utility skills that a consumer would want against *their* repo, while `kyberforge` is meta-tooling for the holocron marketplace itself. A skill that authors a target repo's `AGENTS.md` is `core`; a skill that audits a `SKILL.md` against this marketplace's contract is `kyberforge`.
|
||||
|
||||
@@ -61,7 +61,7 @@ Plugin-root documentation belongs in `docs/`. That convention is older than the
|
||||
Those on-demand files are plain markdown — no frontmatter, no schema. The agent decides when to read each one from task context and the content index label alone. Frontmatter is deferred until there is evidence that agents are loading the wrong files in practice; it is a deliberate deferral, not an oversight to close.
|
||||
|
||||
The governance layer has two phases:
|
||||
- **Phase 1** (complete): instruction and documentation layer — `governance.md` loaded via `@import`; `docs/ai-constitution.md` and `docs/wiki/HUMANS.md` as human-facing reference; `CONTEXT.md` extended with governance domain language.
|
||||
- **Phase 1** (complete): instruction and documentation layer — `governance.md` loaded via `@import`; `core/ai-constitution.md` and `docs/wiki/HUMANS.md` as human-facing reference; `CONTEXT.md` glossing the one governance term used unglossed elsewhere (HITL); the rest of the governance vocabulary is defined in `core/ai-constitution.md`.
|
||||
- **Phase 2** (planned): deterministic enforcement layer — pre-commit hooks, CI gates, secret scanning, licence scanning. Specified in `docs/research/governance_principles/CONTROLS.md`.
|
||||
|
||||
## AGENTS.md pattern
|
||||
@@ -75,7 +75,7 @@ Both `CLAUDE.md` files are thin adapters: they import from their respective `AGE
|
||||
|
||||
This repo also has a `CLAUDE.md` at its root — the Claude Code entry point for working in this repo. It imports `AGENTS.md` and nothing else; there is no `@CONTEXT.md` import. It is not import-only either: below the import sits a fenced `<!-- rtk-instructions v2 -->` … `<!-- /rtk-instructions -->` block carrying the RTK command-prefix convention, which is tool-specific content with no `AGENTS.md` source. This is distinct from `providers/claude-code/CLAUDE.md`, which is the global config deployed to `~/.claude/`.
|
||||
|
||||
`CONTEXT.md` is therefore **not** always-loaded. `AGENTS.md` instructs agents to read it at session start, which is a behavioural instruction, not an `@import` guarantee — `LESSONS.md`'s 2026-05-17 entry proposed adding the import and it was never applied. Treat that entry as open work rather than a record of a landed change.
|
||||
`CONTEXT.md` is therefore **not** always-loaded. `AGENTS.md` instructs agents to read it at session start, which is a behavioural instruction, not an `@import` guarantee.
|
||||
|
||||
## Reference conventions
|
||||
|
||||
@@ -87,4 +87,4 @@ The stated convention is that files referencing other files declare those refere
|
||||
|
||||
## Architectural decisions
|
||||
|
||||
Key hard-to-reverse decisions are recorded as ADRs in `docs/adr/`. There is no index file — the directory holds numbered ADRs whose filenames state their decision, so `ls docs/adr/` is the index. Read a superseding ADR before the one it supersedes: ADR-0015 (apm as the authoring source of truth) supersedes ADR-0001 and moots ADR-0006, ADR-0017 corrects ADR-0015's host-discovery gap, and ADR-0019 supersedes one claim in ADR-0018 (that `.claude/settings.json`'s committed content is exactly `{"hooks": {}}`) while keeping the rule behind it. Entry points for the structure described on this page: ADR-0002 (two-tier CLAUDE.md), ADR-0003 (AGENTS.md as the provider-agnostic entry point), ADR-0015 and ADR-0017 (the two compilers behind the plugin roots).
|
||||
Key hard-to-reverse decisions are recorded as ADRs in `docs/adr/`. There is no index file — the directory holds numbered ADRs whose filenames state their decision, so `ls docs/adr/` is the index. Read a superseding ADR before the one it supersedes: ADR-0015 (apm as the authoring source of truth) supersedes ADR-0001 and moots ADR-0006, ADR-0024 supersedes ADR-0017 (which had corrected ADR-0015's host-discovery gap with a compiled flat content mirror, now deleted), and ADR-0019 supersedes one claim in ADR-0018 (that `.claude/settings.json`'s committed content is exactly `{"hooks": {}}`) while keeping the rule behind it. Entry points for the structure described on this page: ADR-0002 (two-tier CLAUDE.md), ADR-0003 (AGENTS.md as the provider-agnostic entry point), ADR-0015 (`apm pack`, the one compiler behind the plugin roots) and ADR-0024 (apm as the only install path).
|
||||
+238
-142
@@ -14,7 +14,7 @@ of the oddities documented here are load-bearing and have already been re-litiga
|
||||
| Command | Scope |
|
||||
|---|---|
|
||||
| `pre-commit run --all-files` | the commit-stage hooks |
|
||||
| `pre-commit run --hook-stage pre-push --all-files` | the push gate, one command — with one caveat below |
|
||||
| `pre-commit run --hook-stage pre-push --all-files` | the push gate, one command |
|
||||
| `pre-commit run skill-size-check --all-files` | just the ADR-0020 size/context gates |
|
||||
|
||||
Install hooks via `pc-run`, wiring **all three stages**. This repo's `.pre-commit-config.yaml` has no
|
||||
@@ -25,16 +25,20 @@ The pre-push command reports **10** hooks, not 8. The extra two are pre-commit's
|
||||
`check-hooks-apply` and `check-useless-excludes`: they declare no `stages:`, so they run at every
|
||||
stage including this one. Both are declared in this repo's `.pre-commit-config.yaml` like everything
|
||||
else — what separates them is `repo: meta` (pre-commit's own built-ins) from `repo: local`. Eight
|
||||
is the count of hooks this repo authors itself.
|
||||
is the count of hooks this repo authors itself, and `--hook-stage pre-push --all-files` is a full
|
||||
rehearsal of all eight. A PR merged through Gitea's merge button runs none of them: no local push
|
||||
happens at all.
|
||||
|
||||
**The caveat: one of those 8 is a silent no-op under that invocation.**
|
||||
`check-release-needed` exits 0 immediately unless `PRE_COMMIT_REMOTE_BRANCH` equals
|
||||
`refs/heads/main`, and pre-commit exports that variable only from the real pre-push git hook during
|
||||
an actual `git push`. Running the stage by hand — or from a CI runner — therefore reports it
|
||||
`Passed` having checked nothing. That is by design for feature branches — pushing WIP must not be
|
||||
blocked on cutting a premature tag — but it means `--hook-stage pre-push --all-files` is a full
|
||||
rehearsal of 7 hooks and a skip of the eighth. The script's own header records the same gap for
|
||||
a PR merged through Gitea's merge button, where no local push happens at all.
|
||||
A real push has a gap of its own. When one `git push` carries several refs
|
||||
(`git push origin a b`, `git push --all`), pre-commit runs the pre-push stage once, for one ref.
|
||||
In pre-commit 4.6.1, `_pre_push_ns` in `hook_impl.py` skips delete lines and returns on the first
|
||||
remaining ref whose remote sha is non-zero and present locally; a ref whose remote sha is zero or
|
||||
unknown locally is returned only if it has commits that no remote-tracking ref of that remote has.
|
||||
The one hook that reads the pushed ref, `check-skill-version-bump`, therefore checks only that
|
||||
ref, and the others are pushed unchecked.
|
||||
When that ref's unpushed history reaches a root commit, pre-commit runs with all files and sets no
|
||||
`PRE_COMMIT_TO_REF`, so `check-skill-version-bump` checks `HEAD`, which is the pushed ref only if it
|
||||
is checked out. Push one ref at a time when the gate matters.
|
||||
|
||||
## The pre-push gate
|
||||
|
||||
@@ -53,8 +57,9 @@ Eight hooks, grouped below by what they guard rather than by the order `.pre-com
|
||||
| `check-scope-walkup-sync` | `validate.sh`, `validate-provenance.sh`, `new-agent.sh` and `new-skill.sh`'s four independent `$HOME`/`.git`/`apm.yml` walk-up ports still agree behaviorally |
|
||||
| `check-executables-allow-sync` | root `apm.yml`'s `executables.allow` key names kyberforge's actual version (see [apm gates](#apm-gates)) |
|
||||
|
||||
`check-executables-allow-sync` is the odd one in this group: it guards a *silent failure* rather than
|
||||
drift in generated text.
|
||||
`check-executables-allow-sync` is the odd one in this group: the drift it guards is in a
|
||||
hand-written key rather than in generated text, and it is a record-keeping gate — the grant itself is
|
||||
version-blind, so a stale key deploys fine (see [apm gates](#apm-gates)).
|
||||
|
||||
**Artifact validators**
|
||||
|
||||
@@ -75,23 +80,85 @@ drift in generated text.
|
||||
|---|---|
|
||||
| `validate-marketplace` | `claude plugin validate --strict` on the root marketplace manifest |
|
||||
|
||||
**Release**
|
||||
**Skill versioning** (every push, any branch)
|
||||
|
||||
| Hook | Guards |
|
||||
|---|---|
|
||||
| `check-release-needed` | on a real `git push` to `main` only — fails if files exposed via `.pre-commit-hooks.yaml` changed since the last tag. A no-op everywhere else, including under `pre-commit run --hook-stage pre-push` (see [the caveat above](#running-the-gates)) |
|
||||
| `check-skill-version-bump` | fails if a skill directory changed since the pushed commit's merge-base with `main` without its `metadata.version` rising above both the merge-base's and `main`'s tip's (see [below](#check-skill-version-bump)) |
|
||||
|
||||
Two of these shell out to `apm`: `apm-audit-ci` and `apm-pack-check-clean`. The second is a bare
|
||||
`apm …` entry and the first is a `bash -c` loop calling `apm` once per package, so without the CLI
|
||||
the push dies with an unhelpful "command not found". Install with `apm-install`, or
|
||||
`curl -sSL https://aka.ms/apm-unix | sh`; verify with `apm --version`.
|
||||
|
||||
### `check-skill-version-bump`
|
||||
|
||||
ADR-0022 makes `metadata.version` mandatory and says a skill change carries a bump;
|
||||
`skill-size-check` only checks the field's presence and shape, so this hook holds the bump itself.
|
||||
|
||||
- **It runs on every push and under a manual `pre-commit run --hook-stage pre-push`.** It does not
|
||||
read `PRE_COMMIT_REMOTE_BRANCH`, so the manual rehearsal really checks it. The pushed commit is `PRE_COMMIT_TO_REF`, or `HEAD` when that is unset.
|
||||
- **"Changed" is measured from the merge-bases of the pushed commit with `origin/main`** (local
|
||||
`main` if `origin/main` does not resolve), resolved with **`git merge-base --all`** — all of
|
||||
them, not the single one git would otherwise pick. Readers install from `main`, so "changed"
|
||||
means changed against the `main` the branch started from. The remote branch tip is not the
|
||||
baseline: a second push would excuse an unbumped change the first push already carried.
|
||||
- **With more than one base, the changed-skill sets are intersected.** A criss-cross history —
|
||||
`main` merges a branch while that branch merges a `main` commit — has two merge-bases, and which
|
||||
one a bare `git merge-base` prints is an implementation detail, so picking one made the verdict a
|
||||
coin flip: a skill already identical to `main` was reported `(not above merge-base)` whenever the
|
||||
losing base was chosen. A skill therefore counts as changed only when it differs from **every**
|
||||
base; differing from none of them, or from only some, means a base already carries the pushed
|
||||
content. A skill that does count as changed must then beat the version at every base it exists
|
||||
at. Both directions are conservative: the intersection cannot exempt a skill that changed since
|
||||
all of `main`'s reachable history, and requiring every base keeps the ratchet.
|
||||
- **A changed skill's version must beat two baselines**: its version at each merge-base *and* its
|
||||
version at the tip of the same `main` ref (ADR-0022's second 2026-09-16 amendment). The tip
|
||||
check stops two branches that make the same bump (`1.0.0` → `1.0.1`) with different content from
|
||||
both landing, since the identical version lines merge without a conflict. A skill absent at the
|
||||
tip is held to the merge-bases alone, and so is one whose directory at the pushed commit is the
|
||||
**same tree object** as at the tip — compared as object ids, because a tree id *is* the content
|
||||
whatever route the history took to it. That skill ships exactly what `main` ships, so there is
|
||||
nothing for a bump to announce. The intersection does not already cover it: it exempts only when
|
||||
some base carries the content, which a criss-cross history gives and a cherry-pick of a fix
|
||||
`main` already has does not. When `main` has not moved, the tip is itself a base and the skill is
|
||||
checked once. Each failure line names the baseline it missed: `(not above merge-base)`,
|
||||
`(not above merge-base <sha>)` when there is more than one base to tell apart, or
|
||||
`(not above origin/main tip)`. The tip is `origin/main` as last fetched.
|
||||
- **It fails closed when it has no trustworthy baseline:** neither `origin/main` nor `main`
|
||||
resolves; there is no merge-base (shallow clone, unrelated history); or only local `main`
|
||||
resolves and the pushed commit *is* the merge-base, so local `main` already contains the pushed
|
||||
commit and says nothing independent about what shipped.
|
||||
- **A changed skill must end strictly above each baseline version**, compared numerically
|
||||
(`1.0.10` > `1.0.9`). Any bump size passes. A missing or non-`MAJOR.MINOR.PATCH` version at the
|
||||
pushed ref fails, and so does a skill directory left without its `SKILL.md`. Each part is ASCII
|
||||
digits, at most nine of them, with no leading zero (`1.0.08` is malformed) — the same shape
|
||||
`skill-size-check` enforces, so a Unicode digit, an overflowing part or an octal-looking part
|
||||
cannot pass as a bump. A leading UTF-8 BOM is ignored. A baseline with no valid version accepts
|
||||
any valid version. Skills absent at both baselines (new, renamed, merged) or at the pushed ref
|
||||
(deleted, or replaced by a symlink) are exempt. A file moved between skills counts as a change
|
||||
to both: renames are diffed as delete plus add. A mode-only change counts too.
|
||||
- **It also fails closed on read errors:** a pushed ref that does not resolve to a commit
|
||||
(including a tag on a tree), or a `SKILL.md` that the tree names but `git show` or `python3`
|
||||
cannot read, stops the push with a read-failure message rather than being reported as a missing
|
||||
version or treated as an absent skill. Presence is read from the tree, so a blob missing from a
|
||||
corrupt or partial clone cannot make a skill look new. Frontmatter that reads but does not parse
|
||||
counts as an invalid version.
|
||||
- **`<skill>/tests/` is excluded**: no agent loads it, so a test-only change ships nothing.
|
||||
- **It needs `python3` and PyYAML** to read the frontmatter, and fails with a clear message if
|
||||
either is missing, for the reasons in
|
||||
[`python3` and PyYAML are hard requirements](#python3-and-pyyaml-are-hard-requirements).
|
||||
- **Known gaps:** a PR merged through Gitea's merge button
|
||||
runs no local hook; and a multi-ref push checks only the one ref pre-commit selects, and a push
|
||||
reaching a root commit gets no `PRE_COMMIT_TO_REF`, so `HEAD` is checked (see
|
||||
[Running the gates](#running-the-gates)).
|
||||
- **An all-zeros `PRE_COMMIT_TO_REF` (a branch delete) exits 0.** The branch is defensive:
|
||||
pre-commit 4.6.1 skips delete lines before it sets the variable.
|
||||
|
||||
## Skill and agent context gates (ADR-0020)
|
||||
|
||||
The `skill-size-check` pre-commit hook, scoped to `^plugins/[^/]+/\.apm/skills/[^/]+/SKILL\.md$`,
|
||||
runs `scripts/skill-size-check.sh`. It is also shipped to external repos as
|
||||
`kyberforge-skill-size-check` (see
|
||||
[External consumers](#external-consumers-the-root-pre-commit-hooksyaml)). Besides the ADR-0020
|
||||
runs `scripts/skill-size-check.sh`. Besides the ADR-0020
|
||||
gates below, it also asserts required frontmatter is present: `name`, a non-empty `description`, and
|
||||
a `metadata.version` matching three-part semver (`1.0.0`) — folded in from a formerly standalone
|
||||
`skill-frontmatter` hook that parsed the same fields with a shell script.
|
||||
@@ -353,29 +420,46 @@ findings.
|
||||
|
||||
### Duplicated constants
|
||||
|
||||
`factory-audit`'s `validate.sh` holds a second copy of the four ADR-0020 constants
|
||||
(`DESC_SUGGEST_CHARS` / `DESC_MAX_CHARS` / `BODY_SUGGEST_WORDS` / `BODY_MAX_WORDS`) — the two
|
||||
description constants apply to both artifact types it handles, the two body constants only to
|
||||
skills. They are copied rather than imported because a cache-installed plugin's scripts cannot read
|
||||
files outside their own plugin directory. `tests/test-skill-size-check.sh` asserts the copies agree,
|
||||
`factory-audit` holds a second copy of the four ADR-0020 constants
|
||||
(`DESC_SUGGEST_CHARS` / `DESC_MAX_CHARS` / `BODY_SUGGEST_WORDS` / `BODY_MAX_WORDS`). They are not in
|
||||
its `validate.sh`, which carries none of them: they live in the mode libraries it sources —
|
||||
`scripts/lib-checks-skill.sh:313-316` carries all four, and `scripts/lib-checks-agent.sh:164-165`
|
||||
carries the two description constants only. That split is the contract stated directly: the two
|
||||
description constants apply to both artifact types `factory-audit` handles, the two body constants
|
||||
only to skills. They are copied rather than imported because a skill's files may not reach outside that skill's own
|
||||
directory (the self-contained constraint in `docs/spec/architecture.md`, "Plugin model"), and
|
||||
`scripts/skill-size-check.sh` does not ship with the plugin. `tests/test-skill-size-check.sh` asserts the copies agree,
|
||||
so drift fails CI rather than silently letting an audit bless a skill the commit hook then rejects.
|
||||
|
||||
**The shared boundary resolver is now two copies, not three** (ADR-0025). `scripts/skill-size-check.sh`
|
||||
still carries it embedded between `BEGIN`/`END ADR-0020 SHARED BOUNDARY RESOLVER` markers; the two
|
||||
plugin copies that used to sit inside `skill-audit`'s and `agent-audit`'s `validate.sh` collapsed
|
||||
into the single `factory-audit/scripts/lib-boundary-resolver.sh`, sourced by that skill's scripts.
|
||||
The two remaining copies must still stay byte-identical — a plugin script cannot source the root
|
||||
one, which is the constraint that forces a copy to exist at all.
|
||||
**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`.
|
||||
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.
|
||||
`4de5b6b` retired that export (ADR-0014), so the hook now sources the library by path and fails closed
|
||||
if the library is missing or defines no resolver.
|
||||
|
||||
`tests/test-adr0020-contract.sh` pins that arrangement, and one of its assertions was green on a
|
||||
`tests/test-adr0020-contract.sh` pins that arrangement: the library carries the only marker pair,
|
||||
the hook carries none, the hook fails closed without the library, and a sentinel planted in a copied
|
||||
library proves the hook executes the library's text, and a later block pins every repo-authored
|
||||
pre-commit hook's `entry` and `stages`. One of its assertions was green on a
|
||||
defect it named. "`validate.sh` sources the resolver in **both mode branches**" was implemented as a
|
||||
file-wide `grep -Ec … -ge 2`, which cannot see a branch at all: delete the `agent)` arm's source line
|
||||
and duplicate the `skill)` arm's, and the file-wide count is still 2 and the assertion still passes,
|
||||
with the agent path running no resolver or some other one. It is now a **per-arm structural check** —
|
||||
each arm of `validate.sh`'s `case "$MODE" in` block must carry exactly one `source` line inside its
|
||||
own body, and the file must carry exactly those two — with a mutation self-test that performs that
|
||||
exact count-preserving edit on a copy and requires the check to fail on it. The suite went 25 → 28
|
||||
cases.
|
||||
exact count-preserving edit on a copy and requires the check to fail on it. The suite's case count
|
||||
runs **28 → 27 → 29 → 44**, and is **44** at HEAD: 28 at `620f20b` (the ADR-0025 merge), 27 after
|
||||
`4de5b6b` retired the `.pre-commit-hooks.yaml` export, 29 after `ef27c97` replaced the two-copy
|
||||
hash and its line-count floor with the six one-copy assertions above, and 44 after `384756b` added
|
||||
the hook-wiring block. An earlier revision of this section stopped the chain at 29 and called that
|
||||
the figure at HEAD; it was written before `384756b`. There are two 2026-09-16
|
||||
changes here, not one, which is what an earlier revision of this section conflated. Each figure is
|
||||
`bash tests/test-adr0020-contract.sh` run at that commit — in a worktree for the historical ones —
|
||||
reading its `Results:` line.
|
||||
An earlier revision also opened the chain at 25; that predates the branch squash, no reachable
|
||||
commit reproduces it, and it is dropped as unverifiable rather than carried.
|
||||
|
||||
### `python3` and PyYAML are hard requirements
|
||||
|
||||
@@ -384,7 +468,7 @@ Both, and neither is a best-effort accelerator.
|
||||
`python3` because the script measures the **folded** `description` value. Most descriptions here are
|
||||
`>`-block scalars, so a regex over the raw lines measures indentation and newlines instead of the
|
||||
value. Missing it fails the hook with an install pointer rather than skipping the ADR-0020 checks,
|
||||
which would be a vacuous green. In practice it is already present — pre-commit is itself a Python
|
||||
which would be a vacuous green — a gate that reports success without having checked anything. In practice it is already present — pre-commit is itself a Python
|
||||
application.
|
||||
|
||||
**PyYAML** because the hand-rolled fallback frontmatter reader has been **removed deliberately**. It
|
||||
@@ -398,6 +482,8 @@ which is the exact vacuous-green failure the `python3` check exists to avoid. `p
|
||||
**Neither requirement generalises to every hook in this repo.** `check-rtk-prefix` needs `python3`
|
||||
but **not** PyYAML: it reads the markdown body and never touches frontmatter, so it has no scalar to
|
||||
fold.
|
||||
`check-skill-version-bump` needs both, for the same reason as `skill-size-check`: it parses
|
||||
`metadata.version` out of frontmatter.
|
||||
|
||||
## Agent files take the description gates, not the body gate
|
||||
|
||||
@@ -413,8 +499,10 @@ against synthetic `mktemp` fixtures — it had never run against the agent files
|
||||
how ADR-0016 could be amended to bless a `disallowedTools` frontmatter field while `validate.sh`'s
|
||||
allowlist still rejected it: spec and enforcer disagreed and every gate stayed green.
|
||||
|
||||
Agents take the ADR-0020 **description** gates (`factory-audit`'s `validate.sh` holds its own copy of
|
||||
those two constants) and, deliberately, **no body word gate**. A skill body is loaded into the
|
||||
Agents take the ADR-0020 **description** gates and, deliberately, **no body word gate**. The two
|
||||
description constants `factory-audit` applies to an agent live in `scripts/lib-checks-agent.sh:164-165`;
|
||||
an earlier revision of this line put them in its `validate.sh`, which carries none of them (see
|
||||
[Duplicated constants](#duplicated-constants)). A skill body is loaded into the
|
||||
caller's context and competes with the live conversation; an agent body becomes the system prompt of
|
||||
a *fresh* context. The rationale for the 900-word FAIL does not transfer. A bats test pins that
|
||||
absence for the agent path of `factory-audit`'s validator — adding a body gate there contradicts the
|
||||
@@ -569,8 +657,10 @@ boundary, and a stricter form would only move the same trust to a different stri
|
||||
- **Prose bullets.** Most of `branch-operations.md`, `merging.md` and `rewrite-history.md` instruct
|
||||
in list items, not fences. Those are clause-1 sites the gate cannot see, because it cannot
|
||||
distinguish them from clause-2 mentions in the same list.
|
||||
- **`README.md`, excluded by pattern.** A skill-directory README is consumer-facing prose no agent
|
||||
loads, and the `git clone https://github.com/bats-core/…` lines in the six `tests/README.md`
|
||||
- **`README.md`, excluded by pattern.** The skill-directory READMEs the exclusion was first written
|
||||
for are deleted; what it still covers is the 12 `README.md` files inside a skill's `scripts/`,
|
||||
`tests/` and `assets/` subdirectories — consumer-facing prose no agent loads — and the
|
||||
`git clone https://github.com/bats-core/…` lines in the six `tests/README.md`
|
||||
files are setup instructions for a third party who has no `rtk`. Prefixing those would be actively
|
||||
wrong, not merely noisy — see ADR-0023's consumer section.
|
||||
- **Quoting.** The line splitter breaks on `;`, `|`, `&&`, `||`, `$(` and backticks without tracking
|
||||
@@ -654,27 +744,20 @@ rule at a blocking bare `YES`/`error`. It is not redundant with the probes above
|
||||
(`DescriptionOpener`, `PaddingPhrase`, `SentenceOpenerThereIs`, `CompositionNote`) can each be
|
||||
overridden out of `error` underneath a passing probe. That gap is closed.
|
||||
|
||||
Two cases cover the hook manifests.
|
||||
**Case 32** covers the prefilter hooks' own scope in `.pre-commit-config.yaml`, with three
|
||||
properties. Each vale hook's `files:` regex must still match at least one tracked file; every path it
|
||||
matches must be in that hook's own artifact class; and it must match **every** tracked file of that
|
||||
class under `plugins/*/.apm/`. A hook narrowed to zero files never runs, and pre-commit reports no
|
||||
error. A hook narrowed to one plugin still matches files of the right class, which is why the third
|
||||
property exists: narrowing `vale-audit-prefilter-skill` from `^plugins/[^/]+/...` to
|
||||
`^plugins/kyberforge/...` once left 6 of 38 skills prefiltered and the whole suite green. Part B
|
||||
narrows both regexes to zero files and Part C narrows both to one plugin, each in a copy of the
|
||||
config, and requires Part A to fail by hook name.
|
||||
|
||||
**Case 33** is the original's cross-manifest `files:` drift check, ported. It extracts each vale
|
||||
hook's `files:` regex from `.pre-commit-hooks.yaml` and from `.pre-commit-config.yaml`
|
||||
*independently*, compares them per hook and never as a union, and asserts that each shared probe path
|
||||
is in scope of both or neither. The original selected each hook's record by matching `entry:`
|
||||
against the owning skill's `vale-wrap.sh` path. After the merge both hook IDs share one `entry:`, so
|
||||
the port pairs them by `id:` from an explicit table: `kyberforge-vale-audit-skill` ↔
|
||||
`vale-audit-prefilter-skill`, and `kyberforge-vale-audit-agent` ↔ `vale-audit-prefilter-agent`. A
|
||||
missing hook id or a class with no shared probe fails by name. Part B requires three mutations to
|
||||
fail: the skill hook narrowed to one plugin, the agent hook narrowed the same way, and a renamed
|
||||
local hook id.
|
||||
|
||||
This was briefly a real hole. Narrowing `vale-audit-prefilter-skill` from `^plugins/[^/]+/...` to
|
||||
`^plugins/kyberforge/...` left 6 of 38 skills prefiltered, and the whole suite green, before case 33
|
||||
existed.
|
||||
|
||||
**Case 32** covers the separate zero-match question on the local manifest alone. Each
|
||||
`.pre-commit-config.yaml` vale hook's `files:` regex must still match at least one tracked file, and
|
||||
every path it matches must be in that hook's own artifact class. A hook narrowed to zero files never
|
||||
runs, and pre-commit reports no error.
|
||||
Case 32 used to have a partner, case 33, which compared each hook's `files:` regex against the
|
||||
published `.pre-commit-hooks.yaml`. It went with that manifest (ADR-0014's 2026-09-16 amendment),
|
||||
and its one guard that did not need a second manifest, the one-plugin narrowing, is case 32's third
|
||||
property.
|
||||
|
||||
**Case 34** asks, statically and with no Vale binary, whether the shipped `.vale.ini` could load a
|
||||
style at all. Four assertions: every `[glob]` section declares a **non-empty** `BasedOnStyles`; every
|
||||
@@ -683,8 +766,8 @@ absolute**; and at least one `[glob]` section exists, so the check cannot pass v
|
||||
with nothing in it. A section whose `BasedOnStyles` is empty is the silent case — Vale lints every
|
||||
file that glob matches with no rule loaded, prints `0 errors` and exits 0. The absolute-path clause
|
||||
is the one that is not obvious: an absolute `StylesPath` passes on the machine that wrote it and
|
||||
hard-fails for every external consumer of `.pre-commit-hooks.yaml`, which is the only reason those
|
||||
styles ship at all. Part B is a mutation self-test against the same function Part A calls — it empties
|
||||
hard-fails for every repo that installs `factory-audit`, which is the only reason those styles ship
|
||||
with the skill at all. Part B is a mutation self-test against the same function Part A calls — it empties
|
||||
each section's `BasedOnStyles` in a copy of the assets, and absolutizes `StylesPath` in another
|
||||
pointed at that copy's own real `styles/` directory, and requires each to fail by name.
|
||||
|
||||
@@ -735,27 +818,6 @@ from the hook definitions. Under this model they are no-ops; adding one is not a
|
||||
The `verbose: true` escape hatch that makes `skill-size-check`'s SUGGESTION tier audible has no
|
||||
analogue here — Vale has no tier to make audible.
|
||||
|
||||
### External consumers: the root `.pre-commit-hooks.yaml`
|
||||
|
||||
The root `.pre-commit-hooks.yaml` exposes two Vale hook IDs (`kyberforge-vale-audit-skill`,
|
||||
`kyberforge-vale-audit-agent`) plus `kyberforge-skill-size-check`, so any external repo can enforce
|
||||
the same rules with `repo: <this-repo-url>, rev: <tag>` in its own `.pre-commit-config.yaml`.
|
||||
pre-commit clones the pinned rev into its own cache, independent of whether Claude Code or the
|
||||
`kyberforge` plugin is installed at all; the same mechanism covers CI via `pre-commit run
|
||||
--all-files`. `skill-size-check` has no external asset dependency, so it needed no relocation under
|
||||
ADR-0014 — only exposure.
|
||||
|
||||
**The two IDs survive the merge even though they now point at the same wrapper.** Both
|
||||
`kyberforge-vale-audit-skill` and `kyberforge-vale-audit-agent` keep their IDs and their `files:`
|
||||
regexes, because an external repo pins them by name in its own `.pre-commit-config.yaml` and
|
||||
collapsing them to one would break every such consumer silently. What changed is only the `entry:`
|
||||
target: both now name `factory-audit/scripts/vale-wrap.sh`.
|
||||
|
||||
This repo's own `vale-audit-prefilter-skill` / `-agent` hooks consume the **identical**
|
||||
plugin-bundled copy via `repo: local`. Deliberately not a second root copy, and deliberately **not a
|
||||
pinned self-reference** — a pinned self-reference would lint working-tree edits against the last
|
||||
tagged release rather than against the change being made.
|
||||
|
||||
### Pre-commit
|
||||
|
||||
Two prefilter hooks, with `.apm/`-scoped `files:` patterns:
|
||||
@@ -775,9 +837,10 @@ authors. Without the binary the hooks fail with a bare "command not found" and n
|
||||
reason was mechanical: with a config per skill, a single hook could point at only one copy and would
|
||||
silently 0-file-skip the other file shape (see
|
||||
[A 0-file Vale run is NOT RUN](#a-0-file-vale-run-is-not-run)). One `.vale.ini` carrying all three
|
||||
sections removes that constraint. The split stays anyway because the two IDs are an exported
|
||||
contract external consumers pin by name, and because the `files:` regexes still have to differ —
|
||||
each hook hands Vale only the file shape it is scoped to.
|
||||
sections removes that constraint. The split stays anyway because the `files:` regexes still have to
|
||||
differ — each hook hands Vale only the file shape it is scoped to. Both hooks name the same
|
||||
plugin-bundled `factory-audit/scripts/vale-wrap.sh` through `repo: local`; there is no second root
|
||||
copy.
|
||||
|
||||
### The `.vale.ini` globs do no scoping
|
||||
|
||||
@@ -786,15 +849,12 @@ The `.vale.ini`'s section globs are **path-agnostic** — `[**/SKILL.md]`, `[**/
|
||||
location: Vale's `*` crosses `/`. A `SKILL.md` outside `plugins/` (a project-scope
|
||||
`.claude/skills/foo/SKILL.md`, say) still matches `[**/SKILL.md]` and gets linted normally.
|
||||
|
||||
All scoping therefore comes from the pre-commit hook's own `files:` regex and from `factory-audit`
|
||||
passing one explicit file per invocation. The two manifests scope **differently on purpose**:
|
||||
All scoping therefore comes from the pre-commit hooks' own `files:` regexes, which pin this repo's
|
||||
layout (see [Pre-commit](#pre-commit)), and from `factory-audit` passing one explicit file per
|
||||
invocation — in this repo or in any repo that installs it, whatever that repo's layout.
|
||||
|
||||
| Manifest | `-skill` | `-agent` |
|
||||
|---|---|---|
|
||||
| `.pre-commit-config.yaml` (pins this repo's layout) | `^plugins/[^/]+/\.apm/skills/[^/]+/SKILL\.md$` | `^plugins/[^/]+/\.apm/agents/[^/]+\.agent\.md$` |
|
||||
| `.pre-commit-hooks.yaml` (layout-agnostic for consumers) | `(^\|/)SKILL\.md$` | `(^\|/)agents/[^/]+\.md$\|\.agent\.md$` |
|
||||
|
||||
Narrowing a `.vale.ini` glob to a `plugins/`-shaped path to "tighten" it breaks the consumer case.
|
||||
Narrowing a `.vale.ini` glob to a `plugins/`-shaped path to "tighten" it breaks the consumer case:
|
||||
`factory-audit` run against a project-scope `.claude/skills/` tree would lint nothing.
|
||||
`check-vale-style-sync`'s probe set was built to catch exactly that; it moved to
|
||||
`tests/test-vale-wrap.sh` with the hook's deletion, and two of the six probes exist specifically to
|
||||
pin this location independence — see [One copy, one config](#one-copy-one-config).
|
||||
@@ -827,10 +887,6 @@ config declines to match, which is the [0-file NOT RUN](#a-0-file-vale-run-is-no
|
||||
green run that measured nothing. **Issue #117** records the style-scope half; the hook half has to
|
||||
land in the same change or the fix is cosmetic.
|
||||
|
||||
The consumer manifest is a third axis and does not rescue this either: `.pre-commit-hooks.yaml`'s
|
||||
`(^|/)SKILL\.md$` is layout-agnostic but still filename-shaped, so an external repo running
|
||||
`kyberforge-vale-audit-skill` has the same gap.
|
||||
|
||||
### `vale-wrap.sh`, never bare `vale`
|
||||
|
||||
`factory-audit`'s Step 1 and both pre-commit hooks call
|
||||
@@ -855,29 +911,30 @@ wrapper a bad description in any of the three broken forms sailed straight throu
|
||||
### The `--config` argv defect
|
||||
|
||||
Handed **no `--config` at all**, the wrapper falls back to its own sibling `assets/vale/.vale.ini`,
|
||||
located from `${BASH_SOURCE[0]}` rather than from the cwd. That is why both manifests' `entry:` is
|
||||
now the bare script path with **no argument after it**.
|
||||
located from `${BASH_SOURCE[0]}` rather than from the cwd. That is why both hooks' `entry:` is
|
||||
the bare script path with **no argument after it**.
|
||||
|
||||
pre-commit prefixes only `entry[0]` with the hook-repo clone path (`cmd = (prefix.path(cmd[0]),
|
||||
*cmd[1:])`), so every later argument resolves against the **consuming** repo's root. A `--config` in
|
||||
`.pre-commit-hooks.yaml` therefore pointed at a path no consumer has and hard-failed every external
|
||||
run with `E100 [--config] Runtime error`.
|
||||
the since-retired `.pre-commit-hooks.yaml` therefore pointed at a path no consumer has and
|
||||
hard-failed every external run with `E100 [--config] Runtime error`.
|
||||
|
||||
`.pre-commit-config.yaml` drops the argument too, deliberately keeping the two entries identical.
|
||||
`.pre-commit-config.yaml` drops the argument too, deliberately matching that entry.
|
||||
The local `repo: local` hook resolved its `--config` correctly only because the consuming repo *was*
|
||||
this repo — and that divergence is why three review rounds exercised a path no external consumer
|
||||
takes and missed the defect. **Do not reintroduce a `--config` to either manifest to make the local
|
||||
run "explicit".**
|
||||
takes and missed the defect. **Do not reintroduce a `--config` to either hook to make the local run
|
||||
"explicit"**, and keep a restored published manifest to `entry[0]` alone (ADR-0014).
|
||||
|
||||
An explicit `--config` from any other caller still wins, in all three argv forms (`--config X`,
|
||||
`--config=/abs`, `--config=rel`), and a relative one resolves against the caller's cwd — matching
|
||||
bare `vale`, not the repo root.
|
||||
|
||||
Both audit skills' Step 1 passes no `--config` either. Step 1 resolves the script relative to the
|
||||
`factory-audit`'s Step 1 passes no `--config` either. Step 1 resolves the script relative to the
|
||||
skill's own directory so the call works from an installed plugin cache; a relative `--config`
|
||||
alongside it would resolve against the cwd instead, yielding `E100 Runtime error … does not exist`
|
||||
and exit 2 — which both skills' fallback misreads as "vale unavailable" and silently downgrades to
|
||||
full LLM judgment.
|
||||
and exit 2 — which the skill's fallback misreads as "vale unavailable" and silently downgrades to
|
||||
full LLM judgment. An earlier revision wrote this paragraph in the plural, for the `skill-audit` /
|
||||
`agent-audit` pair ADR-0025 merged; there is one Step 1 now.
|
||||
|
||||
`tests/test-vale-wrap.sh` regression-tests this against `factory-audit`'s copy — the only one left.
|
||||
Its fixtures are all `SKILL.md`-shaped, and that copy's `.vale.ini` carries the matching glob section
|
||||
@@ -903,13 +960,13 @@ clean.
|
||||
`CHECK_VALE_STYLE_SYNC_ALLOW_MISSING_VALE=1` opt-out downgraded them audibly rather than skipping the
|
||||
hook — is deleted with the second Vale copy (ADR-0025). The six glob probes survive it inside
|
||||
`test-vale-wrap.sh`, so `run-tests --strict` is now the gate that runs them. That is also what keeps
|
||||
`vale` a pre-push requirement: `test-vale-hooks-consumer.sh` exits 77 without the binary, and so does
|
||||
`test-vale-wrap.sh` once its static cases pass, and a skip fails the push.
|
||||
`vale` a pre-push requirement: `test-vale-wrap.sh` exits 77 without the binary once its static cases
|
||||
pass, and a skip fails the push.
|
||||
|
||||
`test-vale-wrap.sh` without Vale skips only its Vale-dependent cases, not the whole suite. The cases
|
||||
that are plain greps and awk over the config and the two hook manifests still run: case 0, 16, 26,
|
||||
27, the static halves of 28, 31 Parts A and B, 32, 33 and 34. A static failure exits 1, because a
|
||||
real defect is not a setup error. Only an all-static-pass run exits 77.
|
||||
that are plain greps and awk over the Vale config and `.pre-commit-config.yaml` still run: case 0, 16, 26,
|
||||
27, the static half of 28, 31 Parts A and B, 32, 34 and the static half of 35. A static failure
|
||||
exits 1, because a real defect is not a setup error. Only an all-static-pass run exits 77.
|
||||
|
||||
### Mentioning banned phrasing without tripping the rule
|
||||
|
||||
@@ -935,10 +992,11 @@ run. The pre-push hook invokes the same script as `--strict` (`RUN_TESTS_STRICT=
|
||||
where a skip **does** fail the push: at pre-push a skip means one of the documented dependencies is
|
||||
absent on this machine, so the gate would otherwise report success having run fewer suites than it
|
||||
appears to. Without `--strict` the gate once went green having verified 15 of 17 suites on a
|
||||
vale-less PATH, with the skip list swallowed. Without vale, two suites skip —
|
||||
`test-vale-hooks-consumer.sh` and `test-vale-wrap.sh` — and the strict failure names each one and
|
||||
what to install. (It was three until `test-check-vale-style-sync.sh` was deleted with its hook; see
|
||||
[One copy, one config](#one-copy-one-config).)
|
||||
vale-less PATH, with the skip list swallowed. Without vale, one suite skips — `test-vale-wrap.sh` —
|
||||
and the strict failure names it and what to install. (It was three until
|
||||
`test-check-vale-style-sync.sh` was deleted with its hook — see
|
||||
[One copy, one config](#one-copy-one-config) — and `test-vale-hooks-consumer.sh` with the published
|
||||
hook manifest.)
|
||||
|
||||
**Output assertions use a here-string, never a pipe.** Write `grep -q PATTERN <<< "$OUT"`, not
|
||||
`echo "$OUT" | grep -q PATTERN`. Under `set -o pipefail` the pipe form fails depending on timing:
|
||||
@@ -978,9 +1036,10 @@ near-miss negatives it must leave alone, and the suite from 5 cases to **7**.
|
||||
an `echo` or `printf` feeding any of them is the same race. Those are guarded by **convention** —
|
||||
absorb the writer's status with `|| true`, or take the verdict from a here-string — and deliberately
|
||||
not by this test: most legitimate uses of them in this tree are already absorbed, and the scanner
|
||||
cannot see absorption from the pipeline text alone, so flagging them would be noise. Two live
|
||||
`grep … | head -1` sites (`tests/test-vale-wrap.sh:620` and `:1046`) were fixed by hand with that
|
||||
idiom. Pipes from a non-builtin writer (`run_wrap … | grep -q`) are out of scope for the same reason:
|
||||
cannot see absorption from the pipeline text alone, so flagging them would be noise. The three live
|
||||
`grep … | head -1` sites in `tests/test-vale-wrap.sh` — in `unguarded_expansions()`, in case 20B's
|
||||
`--output line` line-number read, and in case 28's per-file `RESULTS28` lookup — carry that idiom by
|
||||
hand. Pipes from a non-builtin writer (`run_wrap … | grep -q`) are out of scope for the same reason:
|
||||
in practice they either absorb the writer's exit status with `|| true` or write only once, at exit.
|
||||
|
||||
**Known limitation: heredoc bodies are scanned as code.** A `cat <<'EOF'` body containing a
|
||||
@@ -1006,14 +1065,29 @@ because the root-only invocation audits the marketplace manifest and **nothing e
|
||||
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.
|
||||
|
||||
It verifies **exactly two things** per manifest and claims no more:
|
||||
**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:
|
||||
|
||||
- **manifest-parse** — each `apm.yml` parses as a valid APM manifest. Unconditional; verified to fire
|
||||
on a dependency entry missing its `git`/`path`/`registry` field (`Cannot parse apm.yml`).
|
||||
- **lockfile-exists** — any package declaring dependencies has a consistent `apm.lock.yaml`.
|
||||
Conditional, and vacuous while every plugin `apm.yml` declares `dependencies: {apm: [], mcp: []}`;
|
||||
it arms itself the moment one does not (verified by adding a git dependency to
|
||||
`plugins/lint/apm.yml`).
|
||||
On the **root** manifest, **10 checks**: `lockfile-exists`, `ref-consistency`,
|
||||
`deployment-ledger-owners`, `deployed-files-present`, `no-orphaned-packages`,
|
||||
`skill-subset-consistency`, `config-consistency`, `content-integrity`, `includes-consent`, `drift`.
|
||||
|
||||
On each **plugin** manifest, **1 check**: `lockfile-exists`. 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 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.
|
||||
|
||||
**`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.
|
||||
|
||||
**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.
|
||||
|
||||
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:
|
||||
@@ -1028,21 +1102,32 @@ not make the check meaningful, it makes it permanently red — `apm audit --ci`
|
||||
`No org policy found at unknown (policy.fetch_failure_default=block)` on every push, forever. A gate
|
||||
that can never go green is not a gate. Revisit only if this repo gains a policy source apm can reach.
|
||||
|
||||
It also does not scan for hidden Unicode: that scan is plain `apm audit`, a different mode (`--ci`
|
||||
refuses to combine with `--file`/`--strip`/`--dry-run`/`PACKAGE`), and plain `apm audit` here reports
|
||||
`No apm.lock.yaml found -- nothing to scan` and exits 0. Adding it would buy a second vacuous check.
|
||||
**It does scan for hidden Unicode.** An earlier revision of this section said the opposite. The
|
||||
`content-integrity` check in the root table *is* that scan — it reports `No critical hidden Unicode
|
||||
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.
|
||||
|
||||
### `check-executables-allow-sync`
|
||||
|
||||
apm gates a package's `hooks/` and `bin/` on an **exact `<package>#<version>` dictionary lookup** in
|
||||
root `apm.yml`'s `executables.allow` (`apm_cli/security/executables.py`, `is_package_approved`).
|
||||
There is no wildcard and no version-less form.
|
||||
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
|
||||
the version-blind name alongside `<package>#<version>`, and `materialize_exec_map` stores every
|
||||
approved key **under its version-blind name as well**. `_map_grants` matches the same three ways.
|
||||
|
||||
So bumping `plugins/kyberforge/apm.yml`'s `version:` without bumping the key **errors nowhere**: the
|
||||
entry simply stops matching, the gate blocks the hook, kyberforge's `SessionStart` hook stops
|
||||
deploying, and the apm install goes quietly stale — the exact failure ADR-0019 exists to end,
|
||||
reintroduced through the mechanism meant to secure it. ADR-0019 records this as a live failure mode;
|
||||
the release that shipped the hook hit it immediately.
|
||||
**Correction (2026-09-19):** verified against apm 0.28.0, a kyberforge version bump therefore does
|
||||
*not* stop the entry matching — approving `owner/repo#2.0.0` also covers `owner/repo#2.1.0` through
|
||||
the version-blind alias. The earlier claim here ("no wildcard and no version-less form", so the
|
||||
entry silently stops matching and the `SessionStart` hook stops deploying) described apm's behaviour
|
||||
wrongly, and ADR-0019 carries the same correction.
|
||||
|
||||
The gate is still required, for a repo-level reason rather than an apm-level one:
|
||||
`scripts/check-executables-allow-sync.sh` asserts the key matches `plugins/kyberforge/apm.yml`'s
|
||||
`version:`, so a bump without a key edit fails *this repo's* pre-push, and the key stays an accurate
|
||||
record of what was approved.
|
||||
|
||||
`scripts/check-executables-allow-sync.sh` parses `version:` out of `plugins/kyberforge/apm.yml` and
|
||||
asserts root `apm.yml` carries the matching `kyberforge#<version>` key. A comment in the
|
||||
@@ -1068,9 +1153,12 @@ does not deploy and the replay does not compare; shared enforcement belongs in
|
||||
|
||||
### Why it is excluded from `pretty-format-json`
|
||||
|
||||
It is the **second and last alternation** in that hook's `exclude:` pattern, and the only one there
|
||||
for a reason other than "generated manifest". Mind which number you are quoting: **two alternations,
|
||||
expanding to two real files** — `.claude-plugin/marketplace.json`, plus this one.
|
||||
It is in the **second and last alternation** in that hook's `exclude:` pattern, and that alternation
|
||||
is the only one there for a reason other than "generated manifest". Mind which number you are
|
||||
quoting: the pattern is `^(\.claude-plugin/marketplace\.json|\.claude/(settings|apm-hooks)\.json)$`
|
||||
— **two top-level alternations, expanding to three real tracked files**:
|
||||
`.claude-plugin/marketplace.json`, this one, and its committed `.claude/apm-hooks.json` sidecar,
|
||||
which is apm output under the same byte-for-byte replay and is excluded for the same reason.
|
||||
|
||||
`pretty-format-json --autofix` sorts object keys unless `--no-sort-keys` is passed, while apm's hook
|
||||
integrator emits insertion order (`matcher` before `hooks`, `type` before `command`). Leaving the
|
||||
@@ -1084,11 +1172,18 @@ fix.
|
||||
|
||||
## Pushing without a network
|
||||
|
||||
No pre-push hook needs the 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`.
|
||||
No pre-push hook needs the network **once `apm install` has populated `apm_modules/`**. 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`.
|
||||
|
||||
`apm-audit-ci` calls `apm` too but was always local: its org-policy discovery resolves nothing on
|
||||
this remote before any network call.
|
||||
`apm-audit-ci` calls `apm` too, and its org-policy discovery resolves nothing on this remote before
|
||||
any network call. But it is local only against a populated install: `drift` and `config-consistency`
|
||||
replay the install to diff scratch against the working tree, and that replay is cache-only —
|
||||
`[>] 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.
|
||||
|
||||
---
|
||||
|
||||
@@ -1107,7 +1202,8 @@ this remote before any network call.
|
||||
styles
|
||||
- `docs/adr/0025-skill-audit-and-agent-audit-merge-into-factory-audit.md` — the audit-pair merge that
|
||||
collapsed the two Vale copies to one, removed the `check-vale-style-sync` hook, and took the shared
|
||||
boundary resolver from three copies to two. It amends ADR-0014 and ADR-0020 on those points
|
||||
boundary resolver from three copies to two (one since `ef27c97`). It amends ADR-0014 and ADR-0020
|
||||
on those points
|
||||
- `docs/spec/architecture.md` — directory structure, install pipeline, what is generated and what is
|
||||
hand-authored
|
||||
- `.pre-commit-config.yaml` — the hooks themselves, with inline rationale comments
|
||||
+1
-1
Submodule docs/wiki updated: 5c29e79aa3...ca1b35f0b2.
@@ -5,7 +5,7 @@ description: >
|
||||
Ultra-compressed output mode that drops articles, filler and pleasantries while
|
||||
keeping technical substance exact, cutting token usage by roughly 75%.
|
||||
metadata:
|
||||
version: "1.0.0"
|
||||
version: "1.0.1"
|
||||
---
|
||||
|
||||
Respond terse like smart caveman. All technical substance stay. Only fluff die.
|
||||
|
||||
@@ -6,7 +6,7 @@ description: >
|
||||
decision tree. Not a plan to challenge against `CONTEXT.md` and ADRs ->
|
||||
`grill-with-docs`.
|
||||
metadata:
|
||||
version: "1.0.0"
|
||||
version: "1.0.1"
|
||||
---
|
||||
|
||||
Interview me relentlessly about every aspect of this plan until we reach a shared understanding. Walk down each branch of the design tree, resolving dependencies between decisions one-by-one. For each question, provide your recommended answer.
|
||||
|
||||
@@ -5,7 +5,7 @@ description: >
|
||||
the interview challenges terms against `CONTEXT.md` and writes decisions into
|
||||
it and into ADRs as they land. Not a plain interview -> `grill-me`.
|
||||
metadata:
|
||||
version: "1.0.0"
|
||||
version: "1.0.1"
|
||||
---
|
||||
|
||||
<what-to-do>
|
||||
|
||||
@@ -6,7 +6,7 @@ description: >
|
||||
variations. Not production code -> `tdd`. Not talking a design through ->
|
||||
`grill-me`.
|
||||
metadata:
|
||||
version: "1.0.0"
|
||||
version: "1.0.1"
|
||||
---
|
||||
|
||||
# Prototype
|
||||
|
||||
@@ -6,7 +6,7 @@ description: >-
|
||||
documentation written from existing code or specs -> `write-docs`. Not a bug
|
||||
or incident -> `diagnose`.
|
||||
metadata:
|
||||
version: "1.0.0"
|
||||
version: "1.0.1"
|
||||
category: research
|
||||
allowed-tools:
|
||||
- Grep
|
||||
|
||||
@@ -9,7 +9,7 @@ description: >
|
||||
updated: 2026-05-17
|
||||
when: invoked by explicit trigger ("write docs for X", "document this module", "create docs for this feature") or implicit request to produce technical documentation from code or spec
|
||||
metadata:
|
||||
version: "1.0.0"
|
||||
version: "1.0.1"
|
||||
category: implement
|
||||
source:
|
||||
- repo: anthropics/skills
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
name: bin
|
||||
version: 1.1.7
|
||||
version: 1.1.8
|
||||
description: Skills for everyday AI-assisted development work that is not tied to a single tool, forge or language, and has not yet been split into a focused plugin.
|
||||
author:
|
||||
name: Defame1297
|
||||
|
||||
@@ -14,7 +14,7 @@ metadata:
|
||||
- context7-websites-agents-md
|
||||
- context7-agentsmd-agents-md
|
||||
- governance-secrets-hard-prohibition
|
||||
version: "0.1.2"
|
||||
version: "0.1.3"
|
||||
---
|
||||
|
||||
## Gotchas
|
||||
|
||||
@@ -12,7 +12,7 @@ metadata:
|
||||
- agents-md-official
|
||||
- context7-websites-agents-md
|
||||
- context7-agentsmd-agents-md
|
||||
version: "0.1.2"
|
||||
version: "0.1.3"
|
||||
---
|
||||
|
||||
## Gotchas
|
||||
|
||||
@@ -11,7 +11,7 @@ metadata:
|
||||
category: docs
|
||||
source_keys:
|
||||
- adr-0002-0003-two-tier-claude-md
|
||||
version: "0.1.1"
|
||||
version: "0.1.2"
|
||||
---
|
||||
|
||||
## Gotchas
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: core
|
||||
version: 1.1.2
|
||||
version: 1.1.3
|
||||
description: Skills for authoring and auditing a repo's AGENTS.md and the provider adapter files that defer to it.
|
||||
author:
|
||||
name: Defame1297
|
||||
|
||||
@@ -55,7 +55,7 @@ When invoked, you:
|
||||
- remotes: add-remote, remove-remote, rename-remote, set-remote-url, push, pull, fetch
|
||||
- submodules: add-submodule, init-submodule, update-submodule, sync-submodule, remove-submodule, submodule-status
|
||||
- **parameters:** object, operation-specific arguments (branch name, commit message, etc.)
|
||||
- **context:** object (optional), workflow state to carry forward (current_branch, branch_intent, user_config_overrides)
|
||||
- **context:** object (optional), workflow state to carry forward (current_branch, branch_intent, user_config_overrides). All three are supplied by the caller for this request only — `user_config_overrides` is caller-supplied session state, not a read of any plugin config file; no such file exists and step 4 below is explicit that domain skills infer their conventions rather than reading shared config.
|
||||
- **confirm:** boolean (optional), explicit confirmation for destructive operations (required if not set for force-push, branch deletion, rebase with history loss, force-checkout)
|
||||
|
||||
## Process
|
||||
|
||||
@@ -9,7 +9,7 @@ description: >
|
||||
Not a Gitea remote's branches -> `gitea-branches`.
|
||||
|
||||
metadata:
|
||||
version: "1.0.4"
|
||||
version: "1.0.5"
|
||||
category: git
|
||||
source_keys:
|
||||
- context7-git-htmldocs
|
||||
|
||||
@@ -8,8 +8,8 @@ source_keys:
|
||||
One command per action. Where two forms exist, the first is the default and the second the escape
|
||||
hatch.
|
||||
|
||||
- **create** — `rtk git switch -c <branch> <base>`. Base comes from the config's `base_branch`
|
||||
(`main` under GitHub Flow, usually `develop` under Gitflow).
|
||||
- **create** — `rtk git switch -c <branch> <base>`. Base is `main` under GitHub Flow, or `develop`
|
||||
when Gitflow is inferred from the repo — see `references/branch-patterns.md`.
|
||||
- **switch** — `rtk git switch <branch>` moves to an existing local branch; it aborts rather than
|
||||
clobbering conflicting local changes. `rtk git switch -` returns to the previous branch.
|
||||
- **delete (local)** — `rtk git branch -d <branch>` refuses when the branch holds unmerged commits,
|
||||
|
||||
@@ -9,8 +9,7 @@ source_keys:
|
||||
|
||||
Which pattern is in play decides the base branch, the branch name prefix, and whether merges are
|
||||
allowed to fast-forward. Default to GitHub Flow — simpler, and what CI/CD-oriented repos expect.
|
||||
Fall back to Gitflow only when the config says so or the repo already carries `develop` or
|
||||
`release/*` branches.
|
||||
Fall back to Gitflow only when the repo already carries `develop` or `release/*` branches.
|
||||
|
||||
## GitHub Flow
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ Request:
|
||||
{
|
||||
"action": "create|switch|delete|rename|track|list|get-intent",
|
||||
"branch": "<branch-name>",
|
||||
"base": "<base branch, optional, defaults to config>",
|
||||
"base": "<base branch, optional, defaults to the inferred base branch>",
|
||||
"intent": "<human-readable intent, optional>",
|
||||
"confirm": "<true for destructive ops, omit for read ops>"
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ description: >
|
||||
Not branch lifecycle -> `git-branches`.
|
||||
|
||||
metadata:
|
||||
version: "0.1.6"
|
||||
version: "0.1.7"
|
||||
category: git
|
||||
source_keys:
|
||||
- conventional-commits-spec
|
||||
@@ -21,7 +21,7 @@ allowed-tools: Bash
|
||||
|
||||
## Gotchas
|
||||
|
||||
- **Run git as `rtk git <subcommand>`, never bare `git`** — org convention, in `&&` chains too, except where a skill's Gotchas name a specific bare-git case (interactive rebase here).
|
||||
- **Run git as `rtk git <subcommand>`, never bare `git`** — org convention, in `&&` chains too. Run it bare only when rtk would break it: output a script parses, or a command that opens an interactive editor (`rebase -i` in `references/rewrite-history.md`). Say why inline.
|
||||
- **Refuse to force-push `main`/`master`.** A rewrite diverges the branch and the reflex is to force it back — safe only where nobody else has based work on it.
|
||||
- **`reset --hard` is a confirmation gate, not a default.** It overwrites the working tree, and uncommitted edits it discards were never in git, so no reflog recovers them. Name what will be lost and offer a stash first.
|
||||
- **Never add `--no-verify`** — using it when a hook fails bypasses the QA gate the pipeline depends on. Only on the user's explicit demand, with a warning.
|
||||
|
||||
@@ -9,7 +9,7 @@ source_keys:
|
||||
|
||||
1. **Gather context** — what changed and why, from the staged diff, the PR description, or the issue. Confirm the staged diff is one logical, independently reviewable and reversible change that leaves the repository buildable and testable. If it bundles unrelated work, suggest splitting it before going further.
|
||||
2. **Determine the type** — read it off the change itself: a new user-visible feature is `feat`, a bug fix is `fix`. For the full 11-type set and each type's SemVer impact, read `references/conventional-commits-spec.md`.
|
||||
3. **Determine the scope** — use the scope from plugin config where one is set, otherwise 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.
|
||||
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`.
|
||||
|
||||
@@ -9,7 +9,7 @@ description: >
|
||||
Not the superproject's own remotes -> `git-remotes`.
|
||||
|
||||
metadata:
|
||||
version: "1.0.0"
|
||||
version: "1.0.1"
|
||||
category: git
|
||||
source_keys:
|
||||
- git-scm-submodule-docs
|
||||
|
||||
@@ -6,7 +6,7 @@ description: >
|
||||
shellcheck"). Not running, installing, or updating hooks -> `pc-run`.
|
||||
allowed-tools: Bash Read Write Edit
|
||||
metadata:
|
||||
version: "1.0.0"
|
||||
version: "1.0.1"
|
||||
category: devtools
|
||||
source_keys:
|
||||
- context7-pre-commit-com
|
||||
|
||||
@@ -8,7 +8,7 @@ description: >
|
||||
compatibility: Requires pre-commit installed and available on PATH.
|
||||
|
||||
metadata:
|
||||
version: "1.0.1"
|
||||
version: "1.0.2"
|
||||
category: devtools
|
||||
source_keys:
|
||||
- context7-pre-commit-com
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
name: git
|
||||
version: 1.3.7
|
||||
version: 1.3.8
|
||||
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: Defame1297
|
||||
|
||||
@@ -12,7 +12,7 @@ compatibility: Requires Gitea MCP server configured with a token with write:repo
|
||||
|
||||
metadata:
|
||||
category: integration
|
||||
version: "0.1.3"
|
||||
version: "0.1.4"
|
||||
source_keys:
|
||||
- gitea-mcp-repo
|
||||
- gitea-mcp-slim-go
|
||||
|
||||
@@ -19,7 +19,7 @@ metadata:
|
||||
- gitea-mcp-slim-go
|
||||
- context7-websites-gitea
|
||||
- context7-gitea-tea-cli
|
||||
version: "0.1.4"
|
||||
version: "0.1.5"
|
||||
|
||||
allowed-tools: Bash mcp__gitea__list_pull_requests mcp__gitea__pull_request_read mcp__gitea__pull_request_write mcp__gitea__pull_request_review_write
|
||||
---
|
||||
@@ -27,6 +27,7 @@ allowed-tools: Bash mcp__gitea__list_pull_requests mcp__gitea__pull_request_read
|
||||
## Gotchas
|
||||
|
||||
- **Issues and PRs share one number space.** `#42` may be an issue rather than a PR. When unsure, call `pull_request_read method: "get"` and read a 404 as "that number is an issue" — hand it to `gitea-issues`.
|
||||
- **404 may also mean 403.** Gitea masks permission errors as not-found, so a 404 is only evidence of an issue-not-PR once `write:repository` scope is confirmed — check the token scope before reporting a PR missing or handing the number to `gitea-issues`.
|
||||
- **`pull_request_write method: "create"` discards most optional parameters in silence.** `milestone`, `assignee`, `assignees`, `reviewers` and `team_reviewers` are accepted, dropped, and left out of the response, so a drop is indistinguishable from never passing them. `labels` *does* apply on `"create"`, so labels landing is no evidence the milestone did.
|
||||
|
||||
## Step 1 — Resolve owner and repo
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: gitea
|
||||
version: 1.3.8
|
||||
version: 1.3.9
|
||||
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: Defame1297
|
||||
|
||||
@@ -51,8 +51,34 @@ emit() {
|
||||
printf '{"hookSpecificOutput":{"hookEventName":"SessionStart","reloadSkills":%s,"additionalContext":"%s"}}\n' "$1" "$2"
|
||||
}
|
||||
|
||||
# What to do with the rewritten lock depends on the branch (ADR-0019): on the
|
||||
# default branch it is a real update to commit or discard; on a feature branch it
|
||||
# is churn unrelated to the branch and should be discarded. The branch name only
|
||||
# selects between fixed strings and is never interpolated. Outside a git checkout,
|
||||
# or on a detached HEAD, the neutral advice stands.
|
||||
#
|
||||
# So does an UNSET origin/HEAD, which is the common state: git only writes it on
|
||||
# clone, and `git remote add` never does. The fallback here used to be `main`,
|
||||
# which is a guess, and it is wrong in exactly the repos that would notice — a
|
||||
# checkout whose default branch is `master` was told "this is a feature branch,
|
||||
# so discard it" while standing on its default branch, i.e. told to throw away a
|
||||
# real lock update. There is no cheap way to learn the remote's default without
|
||||
# the network, so nothing is asserted: the advice stays neutral and the reader
|
||||
# decides.
|
||||
lock_advice="commit it or discard it deliberately."
|
||||
current_branch="$(git symbolic-ref --short -q HEAD 2> /dev/null || true)"
|
||||
default_branch="$(git symbolic-ref --short -q refs/remotes/origin/HEAD 2> /dev/null || true)"
|
||||
default_branch="${default_branch#origin/}"
|
||||
if [[ -n "$current_branch" && -n "$default_branch" ]]; then
|
||||
if [[ "$current_branch" == "$default_branch" ]]; then
|
||||
lock_advice="this is the default branch, so commit it or discard it deliberately."
|
||||
else
|
||||
lock_advice="this is a feature branch, so discard it: git checkout -- apm.lock.yaml && apm install"
|
||||
fi
|
||||
fi
|
||||
|
||||
if timeout 300 apm update --yes > /dev/null 2>&1; then
|
||||
emit true "apm install was ${stale_count} package(s) behind the remote default branch and has been refreshed automatically; skills and agents were redeployed and re-scanned. apm.lock.yaml has been rewritten and is now a modified file in the working tree - commit it or discard it deliberately."
|
||||
emit true "apm install was ${stale_count} package(s) behind the remote default branch and has been refreshed automatically; skills and agents were redeployed and re-scanned. apm.lock.yaml has been rewritten and is now a modified file in the working tree - ${lock_advice}"
|
||||
else
|
||||
emit false "apm install is ${stale_count} package(s) behind the remote default branch and the automatic refresh failed. Deployed skills and agents may be stale. Run: apm update --yes"
|
||||
fi
|
||||
|
||||
@@ -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.2"
|
||||
version: "1.0.3"
|
||||
category: factory
|
||||
source_keys:
|
||||
- context7-websites-code-claude
|
||||
|
||||
@@ -29,7 +29,8 @@ A description carries exactly three things:
|
||||
3. **Boundary clause** — form: `Not <thing> -> <name>.` Add one only where a near-miss agent or
|
||||
skill could steal delegations.
|
||||
|
||||
Banned from a description; move it to the body or to `README.md`:
|
||||
Banned from a description; move it to the body — an agent is a single file with no `references/`
|
||||
directory to move it to:
|
||||
|
||||
- Capability enumeration or feature lists
|
||||
- Per-scope emission mechanics — which files the author skill writes at which scope changes no
|
||||
|
||||
@@ -6,7 +6,7 @@ description: >
|
||||
authoring, publishing, auditing, or dependency installation for an apm
|
||||
package -> `apm-workflow`.
|
||||
metadata:
|
||||
version: "1.0.0"
|
||||
version: "1.0.1"
|
||||
category: apm
|
||||
source_keys:
|
||||
- context7-microsoft-apm
|
||||
|
||||
@@ -5,7 +5,7 @@ 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.0"
|
||||
version: "1.0.1"
|
||||
category: apm
|
||||
source_keys:
|
||||
- context7-microsoft-apm
|
||||
|
||||
@@ -53,12 +53,19 @@ output changes.** Two triggers, not one:
|
||||
The version belongs to the package, not to the repo: editing `plugins/foo/.apm/` never bumps
|
||||
`plugins/bar/apm.yml`.
|
||||
|
||||
Under a `per_package` strategy the same number is also carried in the catalog's
|
||||
`marketplace.packages[]` entry, so both copies move together in the same commit. The catalog's own
|
||||
version follows a separate rule — see `references/marketplace.md`. `apm pack --check-versions`
|
||||
fails the push when a package's version disagrees with the configured strategy, so a bump applied
|
||||
in only one of the two places is caught, but a bump skipped in both is not: nothing infers intent
|
||||
from a content diff.
|
||||
Under a `per_package` strategy this `version:` is the single source for a local-path
|
||||
(`source: ./…`) catalog entry: when that `marketplace.packages[]` entry omits `version:`,
|
||||
`apm pack` reads it from the package's `apm.yml`. Do not restate it there. On a local entry a
|
||||
`version:` is an override, not a copy — it silently wins in the compiled `marketplace.json`, and
|
||||
`apm pack --check-versions` still reports `[matches]` when it disagrees with the package's own
|
||||
number, so drift between the two is never caught. Set one only when an override is the intent.
|
||||
`description:` behaves the same way: a local entry that omits it publishes the package `apm.yml`'s
|
||||
`description`, and one that sets it silently overrides it. A remote entry is different. There,
|
||||
`version:` is the semver range that selects which git tag to resolve, and a remote entry must carry
|
||||
`version:` or `ref:`. Its `description:`, when set, is the published text.
|
||||
|
||||
A skipped bump is not caught either: nothing infers intent from a content diff. The catalog's own
|
||||
version follows a separate rule — see `references/marketplace.md`.
|
||||
|
||||
## Dependency reference forms
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ marketplace:
|
||||
- name: plugin-a
|
||||
description: ...
|
||||
source: ./packages/plugin-a
|
||||
version: 1.0.0
|
||||
```
|
||||
|
||||
This local-path `source:` form IS valid — `apm marketplace check` and `apm pack` both accept it — even though the `package add` CLI subcommand cannot create it for you. Use `apm marketplace package add` only for packages hosted at a remote git ref; for local packages, edit the YAML directly.
|
||||
@@ -63,12 +62,20 @@ The local-filesystem and `file://` forms need no hosted registry or network acce
|
||||
marketplace:
|
||||
versioning: { strategy: per_package }
|
||||
packages:
|
||||
- { name: plugin-a, source: ./packages/plugin-a, version: 2.0.0 }
|
||||
- { name: plugin-b, source: ./packages/plugin-b, version: 0.1.0 }
|
||||
- { name: plugin-a, source: ./packages/plugin-a }
|
||||
- { name: plugin-b, source: ./packages/plugin-b }
|
||||
```
|
||||
|
||||
Without this block, the default versioning strategy ties every listed package to the marketplace/root version.
|
||||
|
||||
With it, each local-path (`source: ./…`) entry's version comes from its package's own
|
||||
`apm.yml`, and so does its `description`. A local entry may also set `version:` or `description:`,
|
||||
but either one is an override: it silently wins in the compiled `marketplace.json`, and
|
||||
`apm pack --check-versions` does not flag a version mismatch. Omit both unless an override is
|
||||
intended — see `references/configure.md`. A remote entry is different: its `version:` is the semver
|
||||
range that selects the git tag to resolve (matched through the entry's `tag_pattern`, else
|
||||
`build.tagPattern`), not an override, and the entry must set `version:` or `ref:`.
|
||||
|
||||
## Bumping the catalog's own version (repo policy)
|
||||
|
||||
The section above is apm's *mechanic* — how per-package versions are declared and how
|
||||
@@ -79,11 +86,13 @@ earned it:
|
||||
|
||||
- **Minor** when a `marketplace.packages[]` entry is added or removed. The catalog's contents
|
||||
changed — a consumer resolving it now gets a different set of installable packages.
|
||||
- **Patch** when only `marketplace:`-block fields change and the set of packages is unchanged: the
|
||||
catalog description, owner, `build:`/`outputs:` config, or an existing entry's `version:`,
|
||||
description, or category. The catalog describes the same packages; only its metadata moved. An
|
||||
entry's `version:` is the most frequent of these by far — under `per_package` it moves here every
|
||||
time any package bumps (see `references/configure.md`), and that alone earns the catalog patch.
|
||||
- **Patch** when the set of packages is unchanged but what the catalog publishes moved: a
|
||||
`marketplace:`-block field (the catalog description, owner, `build:`/`outputs:` config, or an
|
||||
existing entry's description or category), or any listed package's own `apm.yml` `version:`. The
|
||||
most frequent trigger by far is the package bump. When entries omit `version:` (the recommended
|
||||
local form), the compiled `marketplace.json` still publishes each package's version, so a package
|
||||
bump alone changes the catalog and alone earns the patch — made in the same commit (see
|
||||
`references/configure.md`).
|
||||
|
||||
Keep the root `apm.yml`'s top-level `version:` in step with `marketplace.version`. They are separate
|
||||
keys — the top-level one is not inherited into the compiled `marketplace.json`, but `apm audit`
|
||||
|
||||
@@ -7,7 +7,7 @@ description: >
|
||||
fixes -> agent-author.
|
||||
allowed-tools: Bash Read
|
||||
metadata:
|
||||
version: "1.0.1"
|
||||
version: "1.0.3"
|
||||
category: factory
|
||||
source_keys:
|
||||
- agentskills-home
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
extends: existence
|
||||
message: "Composition or architecture note in a description: '%s' — a description carries a trigger, one capability clause and a boundary clause only; move this to README.md"
|
||||
message: "Composition or architecture note in a description: '%s' — a description carries a trigger, one capability clause and a boundary clause only; move this to the body or a references/ file"
|
||||
level: error
|
||||
scope: text.frontmatter.description
|
||||
ignorecase: true
|
||||
|
||||
+2
-1
@@ -44,7 +44,8 @@ A plugin-scope agent is a single `.apm/agents/<name>.agent.md` file with no sibl
|
||||
directory. It cannot progressively disclose to itself — it can only delegate to skills. So a
|
||||
procedure spelled out in an agent body that a skill the agent invokes already owns is not a
|
||||
shortcut: it is a second copy of that procedure, and the second copy drifts. This is the
|
||||
characteristic agent defect, the way a stale README row is the characteristic skill defect.
|
||||
characteristic agent defect, the way a `SKILL.md` naming a `references/` file that is not there is
|
||||
the characteristic skill defect.
|
||||
|
||||
**An agent body that restates a procedure owned by a skill it can invoke is a FAIL.** The Fix is
|
||||
always the same shape: invoke `<skill>` instead.
|
||||
|
||||
+2
-1
@@ -55,7 +55,8 @@ A model-invoked description carries exactly three things:
|
||||
3. **Boundary clause.** Compressed form: `Not <thing> -> <skill-name>.` The target must resolve to
|
||||
a real skill directory or agent file in the authoring source.
|
||||
|
||||
Everything else belongs in the body or in the plugin's `README.md`.
|
||||
Everything else belongs in the body or in a `references/` file. Not a `README.md`: `plugins/gitea/`
|
||||
and `plugins/lint/` both ship agents this file governs and neither has one.
|
||||
|
||||
## Indirect triggers — conditional, never blanket
|
||||
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ A model-invoked description carries exactly three things:
|
||||
instead") is only a SUGGESTION unless a second target in the same sentence resolves. Take the
|
||||
script's tier as given and report it once, under Structure.
|
||||
|
||||
Everything else belongs in the body or in `README.md`.
|
||||
Everything else belongs in the body or in a `references/` file.
|
||||
|
||||
## Indirect triggers — conditional, never blanket
|
||||
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# lib-boundary-resolver.sh — SOURCED, never executed.
|
||||
#
|
||||
# The ADR-0020 shared boundary resolver, as ONE copy for this skill. Both of
|
||||
# validate.sh's modes compose it into the Python program they run, so the
|
||||
# skill-mode and agent-mode check suites resolve boundary targets through the
|
||||
# same code rather than through two copies that can drift apart.
|
||||
# The ADR-0020 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
|
||||
# copies that can drift apart.
|
||||
#
|
||||
# The resolver is Python, and bash cannot source Python, so the block is held
|
||||
# in a shell variable filled from a QUOTED here-doc: nothing inside it is
|
||||
# expanded, substituted or rewritten, and the text between the two markers
|
||||
# below is therefore byte-identical to the copy in scripts/skill-size-check.sh
|
||||
# that tests/test-adr0020-contract.sh hashes. The markers stay on lines of
|
||||
# their own, at column 0, exactly once each, so `sed -n '/^BEGIN$/,/^END$/p'`
|
||||
# extracts the same span here as it does from the scripts the test already
|
||||
# reads. Edit one copy, then paste it over the others.
|
||||
# expanded, substituted or rewritten, and every consumer runs exactly the text
|
||||
# between the two markers below. The markers stay on lines of their own, at
|
||||
# column 0, exactly once each: tests/test-adr0020-contract.sh extracts the span
|
||||
# with `sed -n '/^BEGIN$/,/^END$/p'`, and asserts no other file carries them.
|
||||
#
|
||||
# The here-doc is consumed by the `read` BUILTIN rather than by `$(cat <<...)`.
|
||||
# This file is sourced by validate.sh before the mode-specific python3/PyYAML
|
||||
@@ -26,7 +25,7 @@
|
||||
# exactly ONE newline, never a run: blank lines at the end of a chunk are part
|
||||
# of the program text the entry script reassembles, and stripping every
|
||||
# trailing newline deleted them. The here-doc itself is unchanged: still
|
||||
# QUOTED, still byte-identical between its markers.
|
||||
# QUOTED, still verbatim between its markers.
|
||||
#
|
||||
# Self-containment (agentskills.io, skill-author/references/deployment-modes.md)
|
||||
# binds BETWEEN skills, not within one: a cache-installed plugin copies each
|
||||
@@ -34,21 +33,22 @@
|
||||
# travels with the skill and is always readable. That is why this is sourced
|
||||
# here and duplicated across skill boundaries elsewhere.
|
||||
#
|
||||
# Consumed by: validate.sh (both modes), via $KYBERFORGE_RESOLVER_PY.
|
||||
# Consumed by: validate.sh (both modes) and scripts/skill-size-check.sh, via
|
||||
# $KYBERFORGE_RESOLVER_PY. The root hook reaches into this plugin by path, which
|
||||
# is safe only because it runs solely inside this repo — 4de5b6b retired the
|
||||
# published hook manifest that once made it run elsewhere (ADR-0014).
|
||||
# shellcheck shell=bash
|
||||
# shellcheck disable=SC2034
|
||||
|
||||
IFS='' read -r -d '' KYBERFORGE_RESOLVER_PY <<'KYBERFORGE_ADR0020_RESOLVER_PY' || true
|
||||
# ===== BEGIN ADR-0020 SHARED BOUNDARY RESOLVER =====
|
||||
# ONE resolver, embedded VERBATIM in two scripts (ADR-0025 retired the third):
|
||||
# scripts/skill-size-check.sh
|
||||
# plugins/kyberforge/.apm/skills/factory-audit/scripts/lib-boundary-resolver.sh
|
||||
# The block between these markers must stay byte-identical in both. It is copied
|
||||
# rather than imported because a cache-installed plugin's scripts cannot read
|
||||
# files outside their own plugin directory, and this 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 (the same constraint that duplicates the
|
||||
# ADR-0020 constants). Edit one copy, then paste it over the other.
|
||||
# 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)
|
||||
# ADR-0025 retired the copies in the two pre-merge audit skills, and the
|
||||
# 2026-09-16 change retired the copy embedded in the root hook, which had been
|
||||
# kept only while that hook was also exported through a published hook manifest
|
||||
# (retired by 4de5b6b; ADR-0014). Edit it here; there is nothing to paste over.
|
||||
#
|
||||
# Requires: glob, os, re, yaml (imported by the host script; PyYAML is a hard
|
||||
# dependency, preflighted in bash before the interpreter starts).
|
||||
@@ -732,8 +732,41 @@ def boundary_targets(description):
|
||||
return sorted({name for name, _, _ in _extract(description)})
|
||||
|
||||
|
||||
def _arrow_targets(description):
|
||||
"""Names extracted from ARROW notation specifically.
|
||||
def _clause_end(description, pos):
|
||||
"""Where CLAUSE_BODY stops scanning forward from `pos`.
|
||||
|
||||
The same two stops the class itself encodes: a `;`, or a `.` that is not
|
||||
followed by a non-space character (a sentence end rather than a dot inside
|
||||
`AGENTS.md`).
|
||||
"""
|
||||
for index in range(pos, len(description)):
|
||||
char = description[index]
|
||||
if char == ';':
|
||||
return index
|
||||
if char == '.' and not description[index + 1:index + 2].strip():
|
||||
return index
|
||||
return len(description)
|
||||
|
||||
|
||||
def _arrow_clause_spans(description):
|
||||
"""(start, end) for EACH ADR-0020 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
|
||||
clause is what keeps two clauses joined by a comma inside one sentence
|
||||
apart — a sentence-scoped span would merge them and let the second clause's
|
||||
target vouch for the first.
|
||||
"""
|
||||
starts = [match.start() for match in BOUNDARY_ARROW.finditer(description)]
|
||||
spans = []
|
||||
for index, start in enumerate(starts):
|
||||
limit = starts[index + 1] if index + 1 < len(starts) else len(description)
|
||||
spans.append((start, min(limit, _clause_end(description, start))))
|
||||
return spans
|
||||
|
||||
|
||||
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
|
||||
@@ -741,15 +774,11 @@ def _arrow_targets(description):
|
||||
that deserves its own message, and telling it apart needs the arrow targets
|
||||
alone rather than every target in the description.
|
||||
"""
|
||||
out = []
|
||||
for sentence in SENTENCE_SPLIT.split(description):
|
||||
for match in ARROW_MARKED.finditer(sentence):
|
||||
name, _, _ = _first(match)
|
||||
if name:
|
||||
out.append(name)
|
||||
for match in ARROW_BOUNDARY.finditer(sentence):
|
||||
out.append(match.group(1))
|
||||
return out
|
||||
for match in ARROW_MARKED.finditer(clause):
|
||||
name, _, _ = _first(match)
|
||||
if name:
|
||||
return True
|
||||
return bool(ARROW_BOUNDARY.search(clause))
|
||||
|
||||
|
||||
def boundary_clause_status(description):
|
||||
@@ -761,16 +790,28 @@ def boundary_clause_status(description):
|
||||
three of them reworded a correct clause to satisfy a regex instead.
|
||||
|
||||
'unparsed' is the narrow, certain case: an ADR-0020 arrow clause was
|
||||
detected and NO target came out of it. The arrow form always names one, so
|
||||
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
|
||||
`` `forge` `` or `/forge`) is the live example, since single-word names are
|
||||
deliberately not matchable bare.
|
||||
|
||||
The test is PER CLAUSE, and that is the whole point of the span walk. Both
|
||||
operands used to take the whole description, so ONE arrow clause that
|
||||
parsed suppressed the diagnostic for every other clause beside it: a
|
||||
backticked hyphenated target wrapped across a line break inside a `>`
|
||||
folded scalar — `` `git-`` / ``commits` `` — went unchecked with no ERROR
|
||||
and no SUGGESTION, while the same wrap written bare was reported correctly.
|
||||
26 of this corpus's 38 skill descriptions carry more than one arrow clause,
|
||||
so the suppression covered most of it. This is the issue #100 regression
|
||||
class, and a whole-description test cannot see it by construction.
|
||||
|
||||
A PROSE clause yielding no target is NOT reported: "Do not use for anything
|
||||
else" is a complete and legitimate boundary clause that names nowhere to go.
|
||||
"""
|
||||
if BOUNDARY_ARROW.search(description) and not _arrow_targets(description):
|
||||
spans = _arrow_clause_spans(description)
|
||||
if spans and not all(_arrow_clause_parses(description[start:end])
|
||||
for start, end in spans):
|
||||
return 'unparsed'
|
||||
if has_boundary_clause(description):
|
||||
return 'present'
|
||||
|
||||
@@ -69,9 +69,9 @@ import yaml
|
||||
# resolver block below pins the reads; this pins the writes.
|
||||
#
|
||||
# Deliberately OUTSIDE the ADR-0020 shared boundary resolver block: the two
|
||||
# validate.sh copies print findings, skill-size-check.sh has its own top-level
|
||||
# equivalent, and tests/test-adr0020-contract.sh hashes that block for
|
||||
# byte-identity across all three.
|
||||
# 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.
|
||||
for _stream in (sys.stdout, sys.stderr):
|
||||
try:
|
||||
_stream.reconfigure(encoding='utf-8')
|
||||
@@ -145,9 +145,11 @@ COPILOT_BODY_LIMIT = 30000
|
||||
# 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.
|
||||
# The repo-root hook's copy cannot be shared with this skill — a cache-installed
|
||||
# plugin's scripts cannot read files outside their own plugin directory, and the
|
||||
# hook cannot reach inside the plugin. The two copies INSIDE this skill could be
|
||||
# The repo-root hook's copy cannot be sourced FROM this skill — a cache-installed
|
||||
# plugin's scripts cannot read files outside their own plugin directory. (The
|
||||
# hook could now read these from the plugin, as it already sources
|
||||
# lib-boundary-resolver.sh, but they sit in its Python preamble; hoisting them
|
||||
# is a separate change.) The two copies INSIDE this skill could be
|
||||
# shared (ADR-0025: two files in one skill may source a third), and are not only
|
||||
# because each mode library is a verbatim lift of the pre-merge suite whose
|
||||
# constants sit in its Python preamble; hoisting them is a separate change.
|
||||
|
||||
@@ -68,9 +68,9 @@ import yaml
|
||||
# resolver block below pins the reads; this pins the writes.
|
||||
#
|
||||
# Deliberately OUTSIDE the ADR-0020 shared boundary resolver block: the two
|
||||
# validate.sh copies print findings, skill-size-check.sh has its own top-level
|
||||
# equivalent, and tests/test-adr0020-contract.sh hashes that block for
|
||||
# byte-identity across all three.
|
||||
# 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.
|
||||
for _stream in (sys.stdout, sys.stderr):
|
||||
try:
|
||||
_stream.reconfigure(encoding='utf-8')
|
||||
@@ -235,7 +235,9 @@ else:
|
||||
# --- ADR-0022: metadata.version is mandatory -------------------------------
|
||||
# FAIL, not SUGGESTION, and the tier is set by the gate rather than by taste.
|
||||
# `.pre-commit-config.yaml`'s `skill-size-check` hook REJECTS a SKILL.md with
|
||||
# no `metadata.version`, and rejects a value that is not three-part semver.
|
||||
# no `metadata.version`, and rejects a value that is not three-part semver:
|
||||
# ASCII digits only, no leading zero (semver 2.0.0 item 2), at most nine digits
|
||||
# per part (bash arithmetic in check-skill-version-bump.sh), whole-value match.
|
||||
# skill-author's Step 4 says to run this audit and "resolve every FAIL", so any
|
||||
# tier below FAIL lets that step report done on a skill the commit gate then
|
||||
# refuses — the same audit-disagrees-with-the-gate failure the MAX_LINES note
|
||||
@@ -246,8 +248,10 @@ else:
|
||||
# The rule is DUPLICATED from that hook for the same cache-isolation reason as
|
||||
# every other constant here — an installed plugin's scripts cannot read the
|
||||
# repo-root config. Keep the two in step: this check must accept exactly what
|
||||
# the hook accepts.
|
||||
SEMVER_RE = re.compile(r'^\d+\.\d+\.\d+$')
|
||||
# the hook accepts. Used with fullmatch(), never match() with ^...$ anchors:
|
||||
# `$` also matches before a trailing newline, and `\d` also matches non-ASCII
|
||||
# Unicode digits — both of which the hook rejects.
|
||||
SEMVER_RE = re.compile(r'(0|[1-9][0-9]{0,8})\.(0|[1-9][0-9]{0,8})\.(0|[1-9][0-9]{0,8})')
|
||||
|
||||
try:
|
||||
fm_data = yaml.safe_load(fm)
|
||||
@@ -268,13 +272,15 @@ else:
|
||||
# spelling is exactly the two-part value the hook rejects — coercing and
|
||||
# then matching keeps this check and the hook agreeing on that case.
|
||||
version_text = version_value if isinstance(version_value, str) else str(version_value)
|
||||
version_text = version_text.strip()
|
||||
if SEMVER_RE.match(version_text):
|
||||
# Same normalisation as the hook: surrounding whitespace, then quotes.
|
||||
version_text = version_text.strip().strip('\'"')
|
||||
if SEMVER_RE.fullmatch(version_text):
|
||||
ok(f"metadata.version present: '{version_text}' (ADR-0022)")
|
||||
else:
|
||||
fail(f"metadata.version '{version_text}' is not three-part semver — the "
|
||||
f"skill-size-check pre-commit hook rejects it. Use MAJOR.MINOR.PATCH, "
|
||||
f"e.g. \"1.0.0\"")
|
||||
f"skill-size-check pre-commit hook rejects it. Use MAJOR.MINOR.PATCH "
|
||||
f"with ASCII digits, no leading zeros and at most nine digits per "
|
||||
f"part, e.g. \"1.0.0\"")
|
||||
|
||||
# SKILL.md size ceilings (agentskills.io skill-authoring.md: 500 lines,
|
||||
# ~5,000 tokens). Both constants are DUPLICATED from the repo-root pre-commit
|
||||
@@ -333,7 +339,7 @@ if desc:
|
||||
f"ADR-0020 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 README.md")
|
||||
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 "
|
||||
|
||||
@@ -29,15 +29,16 @@ set -euo pipefail
|
||||
#
|
||||
# Divergence 1: with no `--config` at all, this script's own sibling
|
||||
# `assets/vale/.vale.ini` is used instead of vale's upward search. pre-commit
|
||||
# prefixes only `entry[0]` with the hook-repo clone path, so a `--config` in
|
||||
# `.pre-commit-hooks.yaml` would resolve against the *consuming* repo and
|
||||
# hard-fail (E100) for every external consumer. The manifest therefore passes the
|
||||
# script alone, and an explicit `--config` from any other caller still wins.
|
||||
# prefixes only `entry[0]` with the hook-repo clone path, so a `--config` in a
|
||||
# published `.pre-commit-hooks.yaml` would resolve against the *consuming* repo
|
||||
# and hard-fail (E100) for every external consumer. That manifest is retired
|
||||
# (ADR-0014, 2026-09-16 amendment), but the script still needs no `--config` so it
|
||||
# can return; an explicit `--config` from any other caller still wins.
|
||||
#
|
||||
# Divergence 2: a path-shaped argument that does not exist is a hard error
|
||||
# (exit 2). Bare vale drops it, falls back to reading stdin, and prints
|
||||
# `0 errors ... in stdin` with exit 0 — a typo'd target is then indistinguishable
|
||||
# from a clean run. Both audit skills treat a `0 files` report as NOT RUN rather
|
||||
# from a clean run. factory-audit treats a `0 files` report as NOT RUN rather
|
||||
# than clean, and `in stdin` does not match that guard, so the silent form would
|
||||
# read as "prefilter clean" and skip the LLM fallback. Erroring is the only way
|
||||
# to keep that guard honest. Linting prose piped on stdin is therefore
|
||||
|
||||
@@ -1989,7 +1989,7 @@ EOF
|
||||
# NEW with the merge and additive: pre-merge, handing the SKILL.md itself to
|
||||
# skill-audit's validate-provenance.sh hit the "not a directory" precondition
|
||||
# and died. It matters because pre-commit `files:` hooks match FILES — the
|
||||
# exported kyberforge-vale-audit-skill hook's regex is (^|/)SKILL\.md$ — so
|
||||
# vale-audit-prefilter-skill hook's regex ends in /SKILL\.md$ — so
|
||||
# every hook-driven invocation hands over a SKILL.md path, never its
|
||||
# directory. The entry point rewrites the token to the directory in place.
|
||||
local skill="$TMPDIR/my-skill"
|
||||
|
||||
@@ -377,7 +377,7 @@ SH
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# ADR-0022 — metadata.version is mandatory. FAIL tier, matching the
|
||||
# skill-frontmatter pre-commit hook: an audit that graded this lower would
|
||||
# skill-size-check pre-commit hook: an audit that graded this lower would
|
||||
# report ready-to-ship on a file the commit gate rejects.
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@@ -437,6 +437,62 @@ PY
|
||||
assert_output --partial "metadata.version present: '0.1.3'"
|
||||
}
|
||||
|
||||
@test "ADR-0022: a leading zero in the patch part FAILs (1.0.08)" {
|
||||
local skill="$TMPDIR/my-skill"
|
||||
make_valid_skill "$skill"
|
||||
python3 - "$skill/SKILL.md" <<'PY'
|
||||
import sys
|
||||
p = sys.argv[1]
|
||||
s = open(p).read().replace(' version: "1.0.0"\n', ' version: "1.0.08"\n')
|
||||
open(p, 'w').write(s)
|
||||
PY
|
||||
run bash "$SCRIPT" "$skill"
|
||||
assert_failure
|
||||
assert_output --partial "three-part semver"
|
||||
}
|
||||
|
||||
@test "ADR-0022: a leading zero in the major part FAILs (01.0.1)" {
|
||||
local skill="$TMPDIR/my-skill"
|
||||
make_valid_skill "$skill"
|
||||
python3 - "$skill/SKILL.md" <<'PY'
|
||||
import sys
|
||||
p = sys.argv[1]
|
||||
s = open(p).read().replace(' version: "1.0.0"\n', ' version: "01.0.1"\n')
|
||||
open(p, 'w').write(s)
|
||||
PY
|
||||
run bash "$SCRIPT" "$skill"
|
||||
assert_failure
|
||||
assert_output --partial "three-part semver"
|
||||
}
|
||||
|
||||
@test "ADR-0022: a multi-digit part with no leading zero passes (1.0.10)" {
|
||||
local skill="$TMPDIR/my-skill"
|
||||
make_valid_skill "$skill"
|
||||
python3 - "$skill/SKILL.md" <<'PY'
|
||||
import sys
|
||||
p = sys.argv[1]
|
||||
s = open(p).read().replace(' version: "1.0.0"\n', ' version: "1.0.10"\n')
|
||||
open(p, 'w').write(s)
|
||||
PY
|
||||
run bash "$SCRIPT" "$skill"
|
||||
assert_success
|
||||
assert_output --partial "metadata.version present: '1.0.10'"
|
||||
}
|
||||
|
||||
@test "ADR-0022: a zero major part passes (0.1.0)" {
|
||||
local skill="$TMPDIR/my-skill"
|
||||
make_valid_skill "$skill"
|
||||
python3 - "$skill/SKILL.md" <<'PY'
|
||||
import sys
|
||||
p = sys.argv[1]
|
||||
s = open(p).read().replace(' version: "1.0.0"\n', ' version: "0.1.0"\n')
|
||||
open(p, 'w').write(s)
|
||||
PY
|
||||
run bash "$SCRIPT" "$skill"
|
||||
assert_success
|
||||
assert_output --partial "metadata.version present: '0.1.0'"
|
||||
}
|
||||
|
||||
@test "fails when name contains consecutive hyphens" {
|
||||
local skill="$TMPDIR/my--skill"
|
||||
make_valid_skill "$skill"
|
||||
@@ -889,6 +945,48 @@ make_hand_invoked_skill() {
|
||||
assert_output --partial "no target could be read"
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# ADR-0020 — 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,
|
||||
# so ONE arrow clause that parsed suppressed the diagnostic for every other
|
||||
# clause beside it.
|
||||
#
|
||||
# The shape that hides there is a backticked hyphenated target wrapped across
|
||||
# the line break of a `>` folded scalar: the fold turns `` `fixture-sibling- ``
|
||||
# / `` skill` `` into `fixture-sibling- skill`, which no extractor can read.
|
||||
# Written BARE the same wrap is reported correctly, so the two spellings
|
||||
# disagreed. 26 of this repo's 38 skill descriptions carry more than one arrow
|
||||
# clause, which is how wide the suppression was. This is the #100 regression
|
||||
# class: no ERROR, no SUGGESTION, exit 0.
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@test "ADR-0020: 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
|
||||
# scalar and the wrap INSIDE the backticks are the fixture. The second
|
||||
# clause parses and resolves against the fixture sibling, and that is what
|
||||
# used to silence the first.
|
||||
cat > "$skill/SKILL.md" <<'EOF'
|
||||
---
|
||||
name: my-skill
|
||||
description: >
|
||||
Use when doing the thing. Not the other thing -> `fixture-sibling-
|
||||
skill`. Not a third thing -> `fixture-sibling-skill`.
|
||||
metadata:
|
||||
version: "1.0.0"
|
||||
---
|
||||
|
||||
word word word word word word word word word word
|
||||
EOF
|
||||
run bash "$SCRIPT" "$skill"
|
||||
assert_success
|
||||
assert_output --partial "no target could be read"
|
||||
refute_output --partial "has no boundary clause"
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Encoding, write side: sys.stdout/stderr.reconfigure(encoding='utf-8')
|
||||
#
|
||||
@@ -960,8 +1058,8 @@ EOF
|
||||
# NEW with the merge and additive rather than ported: pre-merge, handing the
|
||||
# SKILL.md itself to skill-audit's validate.sh hit the directory precondition
|
||||
# and gave a useless exit 1. It matters because pre-commit `files:` hooks
|
||||
# match FILES — the exported kyberforge-vale-audit-skill hook's regex is
|
||||
# (^|/)SKILL\.md$ — so every hook-driven invocation hands over a SKILL.md
|
||||
# match FILES — the vale-audit-prefilter-skill hook's regex ends in
|
||||
# /SKILL\.md$ — so every hook-driven invocation hands over a SKILL.md
|
||||
# path, never the directory above it. The entry point resolves the file to
|
||||
# its directory before dispatching.
|
||||
local skill="$TMPDIR/my-skill"
|
||||
|
||||
@@ -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.2"
|
||||
version: "1.0.4"
|
||||
category: factory
|
||||
source_keys:
|
||||
- agentskills-home
|
||||
|
||||
@@ -7,9 +7,9 @@ source_keys:
|
||||
|
||||
# The description and body contract
|
||||
|
||||
House contract. Every rule here is enforced by `/factory-audit` —
|
||||
`scripts/validate.sh` for the counts and the boundary targets, the bundled Vale styles for the
|
||||
prose patterns, and its reference files for the judgment calls.
|
||||
House contract. Every rule here is enforced by `/factory-audit` — the counts and the boundary
|
||||
targets by `factory-audit`'s `scripts/validate.sh`, the prose patterns by the Vale styles it
|
||||
bundles, the judgment calls by its reference files.
|
||||
|
||||
## Why the budget exists
|
||||
|
||||
@@ -28,10 +28,11 @@ A description carries exactly three things:
|
||||
Focus on user intent, not the skill's internal mechanics.
|
||||
2. **At most one capability clause** — what it does, one clause, no enumeration. Be specific
|
||||
("parses and validates OpenAPI specs", not "helps with APIs").
|
||||
3. **Boundary clause** — form: `Not <thing> -> <skill-name>.` Add one only where a near-miss skill
|
||||
could steal activations.
|
||||
3. **Boundary clause** — form: `Not <thing> -> <skill-name>.` Write one per genuine near-miss
|
||||
skill that could steal activations: at least one, not exactly one — `git-remotes` carries
|
||||
four. What is banned is a clause invented for a skill that was never going to compete.
|
||||
|
||||
Banned from a description; move it to the body or to `README.md`:
|
||||
Banned from a description; move it to the body or to a `references/` file:
|
||||
|
||||
- Capability enumeration or feature lists
|
||||
- Output-format detail ("Produces a compact findings report with Why and Fix per finding")
|
||||
|
||||
@@ -5,15 +5,15 @@ source_keys:
|
||||
|
||||
# Deployment Modes
|
||||
|
||||
Skills deploy standalone, or as part of a package — either a legacy plugin-mode cache install or an APM (`apm.yml`-governed `.apm/` tree, compiled via `apm compile`). All resolve relative paths from the skill root — the SKILL.md body works the same in any of them. Differences only arise when referencing files *outside* the skill directory.
|
||||
Skills deploy standalone, or as part of an APM package (an `apm.yml`-governed `.apm/` tree, compiled via `apm compile`). Some consumers also receive a package through a host's plugin install, which copies it into a cache. All modes resolve relative paths from the skill root — the SKILL.md body works the same in any of them. Differences only arise when referencing files *outside* the skill directory.
|
||||
|
||||
## Cache isolation (plugin mode)
|
||||
## Cache isolation (host plugin install)
|
||||
|
||||
When a plugin is installed, its directory is copied to a cache. Only the plugin's own files are copied. **Any path that leaves the skill directory breaks post-install:**
|
||||
When a host installs a plugin, it copies the plugin directory to a cache. Only the plugin's own files are copied. **Any path that leaves the skill directory breaks post-install:**
|
||||
|
||||
```
|
||||
../other-skill/validate.sh # breaks
|
||||
plugins/kyberforge/skills/other-skill/ # breaks
|
||||
plugins/<plugin>/.apm/skills/other/ # breaks
|
||||
../../shared/utils.sh # breaks
|
||||
```
|
||||
|
||||
@@ -40,7 +40,7 @@ These variables are injected when the plugin is loaded from an install cache. Th
|
||||
| `${CLAUDE_PLUGIN_ROOT}` | Absolute path to the plugin's install directory. Changes on update. |
|
||||
| `${CLAUDE_PLUGIN_DATA}` | Persistent directory that survives updates. Use for `node_modules`, generated state, caches. |
|
||||
|
||||
Use `${CLAUDE_PLUGIN_ROOT}` only in hook commands and `.mcp.json` configs — not in SKILL.md body text, since standalone deployments won't have it.
|
||||
Use `${CLAUDE_PLUGIN_ROOT}` only in hook commands — not in SKILL.md body text, since standalone deployments won't have it.
|
||||
|
||||
## Standalone mode
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ Then proceed — edits are reversible via git, no approval checkpoint needed.
|
||||
## Step 4 — Apply changes
|
||||
|
||||
Edit any file in the skill directory that the signals point to: SKILL.md, `scripts/`,
|
||||
`references/`, `assets/`, `tests/`, README.md.
|
||||
`references/`, `assets/`, `tests/`.
|
||||
|
||||
**Generalize, do not patch.** Find the underlying gap, not the specific example that failed. A fix
|
||||
scoped only to the test cases you have seen will overfit and perform worse on new inputs.
|
||||
@@ -76,6 +76,29 @@ into compliance first — the gates are hot and carry no baseline file, so a one
|
||||
non-compliant skill cannot be committed until the description and body meet
|
||||
`references/contract.md`. Treat that retrofit as part of the same change, not a follow-up.
|
||||
|
||||
Retrofit against the number that actually failed: the audit reports description characters and
|
||||
body-only words separately. Audit the skill in its real package directory, never a scratch copy,
|
||||
where boundary resolution reports `DID NOT RUN` and exits 0 without checking anything. Cut in this
|
||||
order, stopping once the gate clears; the order puts the cuts that lose the least behaviour first:
|
||||
|
||||
1. Gotchas that paraphrase a step below them — delete the Gotcha, keep the step.
|
||||
2. Spec restatements — text repeating a published spec, a tool's `--help`, or a limit the
|
||||
validator already enforces.
|
||||
3. Capability enumeration — keep one capability clause in the description; drop the rest.
|
||||
4. Per-flow prose — move each flow into its own `references/` file behind a dispatch table.
|
||||
|
||||
Still over after all four means the skill does two jobs: split it rather than compressing prose.
|
||||
|
||||
**Re-cite what moved.** After content moves between files, update `references/sources.md`'s
|
||||
`Contributing files` for every slug whose content moved, and drop any file the edit deleted.
|
||||
`factory-audit`'s `scripts/validate-provenance.sh` exits 0 on exactly that drift, so a stale
|
||||
provenance claim ships unless you fix it here.
|
||||
|
||||
**Re-check every relocated gate's reachability.** A Gotcha or gate moved out of the body into one
|
||||
flow's `references/` file is invisible to every other branch, and the word counts improve either
|
||||
way. For each one you move, list the flows that need it: it belongs in one flow's file only when
|
||||
exactly one flow reaches it, otherwise in the body's common-gates section.
|
||||
|
||||
If a signal points to a script or reference file, edit that file directly rather than adding a
|
||||
workaround in SKILL.md.
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ EOF
|
||||
}
|
||||
|
||||
@test "scaffold emits a live metadata.version seeded at 0.1.0 (ADR-0022)" {
|
||||
# The scaffold must clear .pre-commit-config.yaml's `skill-frontmatter` hook
|
||||
# The scaffold must clear .pre-commit-config.yaml's `skill-size-check` hook
|
||||
# on its first commit: a commented-out metadata block ships a skill with no
|
||||
# version and is blocked. Assert the field is live, not a comment.
|
||||
bash "$SCRIPT" my-tool "$DEST"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name: kyberforge
|
||||
version: 2.0.0
|
||||
description: Skills and agents for creating, maintaining, and managing a Claude Code / Copilot CLI plugin marketplace.
|
||||
description: Skills and agents for creating, maintaining, and managing an apm plugin marketplace for Claude Code and GitHub Copilot.
|
||||
author:
|
||||
name: Defame1297
|
||||
email: [email protected]
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
|
||||
Use this for CLI tools, helper scripts, or MCP server entry points bundled with the plugin.
|
||||
|
||||
Reference files in this directory from `.mcp.json` or hooks using `${CLAUDE_PLUGIN_ROOT}/bin/<file>`.
|
||||
Reference files in this directory from a hook command in `.apm/hooks/hooks.json` using
|
||||
`${CLAUDE_PLUGIN_ROOT}/bin/<file>`.
|
||||
The `${CLAUDE_PLUGIN_ROOT}` variable resolves to the plugin's install cache path at runtime —
|
||||
do not use relative paths from the repo root, as they will break after install.
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ description: >
|
||||
|
||||
metadata:
|
||||
category: lint
|
||||
version: "0.1.2"
|
||||
version: "0.1.3"
|
||||
source_keys:
|
||||
- context7-websites-vale-sh
|
||||
- house-vale-3-15-2-repro
|
||||
|
||||
@@ -6,7 +6,7 @@ description: >
|
||||
as in "lint the docs", "check prose style", or "why is CI failing on the docs
|
||||
check". Not setting up Vale config or styles -> `vale-config`.
|
||||
metadata:
|
||||
version: "0.1.3"
|
||||
version: "0.1.4"
|
||||
category: lint
|
||||
source_keys:
|
||||
- context7-websites-vale-sh
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: lint
|
||||
version: 1.1.7
|
||||
version: 1.1.8
|
||||
description: Skills and agents for configuring and running linters.
|
||||
author:
|
||||
name: Defame1297
|
||||
|
||||
@@ -2,11 +2,15 @@
|
||||
set -euo pipefail
|
||||
|
||||
# Fails the push when root apm.yml's executables.allow key stops naming
|
||||
# kyberforge's actual version. apm matches that key by exact dict lookup
|
||||
# (apm_cli/security/executables.py) — a version bump that misses the key
|
||||
# update deploys nothing, with no error anywhere. See ADR-0019, "The allow
|
||||
# key is version-pinned, and that is a live failure mode", for the full
|
||||
# argument; nothing else in the pre-push gate compares these two files.
|
||||
# kyberforge's actual version. The grant itself is version-blind — apm matches
|
||||
# the version-less name alongside '<package>#<version>' (exec_gate.py builds
|
||||
# the candidate list, _map_grants matches it) — so a stale key keeps granting
|
||||
# kyberforge's hooks/ and bin/ and deployment does not break. What this gate
|
||||
# buys is repo-level, not apm-level: a version bump without the matching key
|
||||
# edit fails this repo's own pre-push, so the key stays an accurate record of
|
||||
# what was approved. See ADR-0019's 2026-09-19 correction and docs/spec/gates.md,
|
||||
# "check-executables-allow-sync"; nothing else in the pre-push gate compares
|
||||
# these two files.
|
||||
#
|
||||
# Run from repo root or pass REPO_ROOT as arg.
|
||||
|
||||
@@ -213,10 +217,10 @@ if [[ -n "$STALE_KEYS" ]]; then
|
||||
echo " Found instead:" >&2
|
||||
printf '%s\n' "$STALE_KEYS" | sed 's/^/ /' >&2
|
||||
fi
|
||||
echo " Why: apm matches this key by exact dict lookup — there is no wildcard and no version-less" >&2
|
||||
echo " form — so a key naming any other version silently stops granting kyberforge's hooks/" >&2
|
||||
echo " and bin/. The SessionStart hook then stops deploying and the apm install goes stale" >&2
|
||||
echo " with no error anywhere (ADR-0019, 'The allow key is version-pinned')." >&2
|
||||
echo " Why: nothing is broken right now — apm's grant is version-blind, so a key naming another" >&2
|
||||
echo " version still grants kyberforge's hooks/ and bin/. This gate is a repo-level record" >&2
|
||||
echo " check: a version bump without the matching key edit fails here, which is what keeps" >&2
|
||||
echo " the key an accurate record of what was approved (ADR-0019, 2026-09-19 correction)." >&2
|
||||
echo " Fix: bump the key in root apm.yml to '$EXPECTED_KEY:' — the version bump in" >&2
|
||||
echo " plugins/kyberforge/apm.yml is not complete without it." >&2
|
||||
exit 1
|
||||
@@ -1,242 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Hard-fails only when pushing to main: if any file covered by .pre-commit-hooks.yaml
|
||||
# (the external git-hook/CI contract, see ADR-0014) changed since the last tag,
|
||||
# a release must be cut before landing on main, or external consumers pinning
|
||||
# `rev: <tag>` silently miss the change. Pre-commit sets PRE_COMMIT_REMOTE_BRANCH
|
||||
# for pre-push hooks; on every other branch (feature work mid-review) this is a
|
||||
# silent no-op — pushing WIP commits there must not be blocked on cutting a
|
||||
# premature tag (see ADR-0014's repo: local vs pinned self-reference decision).
|
||||
#
|
||||
# Known gap: this only fires on a local `git push` through pre-commit's pre-push
|
||||
# hook. A PR merged via Gitea's merge button (server-side, no local push) or a
|
||||
# CI runner invoking `pre-commit run --hook-stage pre-push` directly does not set
|
||||
# PRE_COMMIT_REMOTE_BRANCH and will not trigger this check — closing that
|
||||
# requires a server-side CI job, which this repo does not have yet.
|
||||
|
||||
TARGET_BRANCH="refs/heads/main"
|
||||
|
||||
if [[ "${PRE_COMMIT_REMOTE_BRANCH:-}" != "$TARGET_BRANCH" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# What is actually being pushed, which is only HEAD for the common
|
||||
# `git push <remote> <current-branch>` case. pre-commit's pre-push hook-impl
|
||||
# exports the local sha of each pushed ref as PRE_COMMIT_TO_REF; a
|
||||
# `git push <remote> topic:main` from a different checkout would otherwise be
|
||||
# gated on the wrong tip — a false negative when HEAD is behind the pushed ref
|
||||
# (unreleased changes sail through), a false positive when it is ahead.
|
||||
# PRE_COMMIT_FROM_REF, the *remote's* current tip, is deliberately not used
|
||||
# anywhere here: the baseline is the last release tag, not what the remote
|
||||
# already has. Diffing from the remote tip would let an untagged
|
||||
# release-relevant commit already on main excuse the next push from cutting a
|
||||
# tag, which is precisely the drift this gate exists to catch.
|
||||
PUSHED_REF="${PRE_COMMIT_TO_REF:-HEAD}"
|
||||
|
||||
# pre-commit passes an all-zeros sha (40 hex zeros under sha1, 64 under sha256)
|
||||
# as the "to" ref when the push deletes a branch. Nothing is being shipped, and
|
||||
# every rev-taking command below would fail on an unresolvable sha, so bail out
|
||||
# rather than turning a branch deletion into a confusing "could not diff".
|
||||
if [[ "$PUSHED_REF" =~ ^0+$ ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
REPO_ROOT="$(git rev-parse --show-toplevel)"
|
||||
cd "$REPO_ROOT"
|
||||
|
||||
HOOKS_MANIFEST=".pre-commit-hooks.yaml"
|
||||
|
||||
if [[ ! -f "$HOOKS_MANIFEST" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Only vX.Y.Z release tags count as a baseline — an incidental checkpoint or
|
||||
# experiment tag reachable from the pushed ref must not shift the diff baseline.
|
||||
# The tag is resolved from $PUSHED_REF, not HEAD, for the same reason the diff
|
||||
# is: a tag reachable only from HEAD is not part of the history being pushed.
|
||||
# --match is a shell glob, not a regex: its trailing `*`s match any suffix, so
|
||||
# without --exclude a pre-release/checkpoint tag like v1.2.3-checkpoint or
|
||||
# v1.2.3-rc1 also satisfies 'v[0-9]*.[0-9]*.[0-9]*' and could be picked over the
|
||||
# true last release tag. --exclude is glob syntax too, so '*-*' is what actually
|
||||
# rules out any tag carrying a hyphenated suffix, leaving only bare vMAJOR.MINOR.PATCH.
|
||||
LAST_TAG="$(git describe --tags --abbrev=0 --match 'v[0-9]*.[0-9]*.[0-9]*' --exclude '*-*' "$PUSHED_REF" 2>/dev/null || true)"
|
||||
|
||||
if [[ -z "$LAST_TAG" ]]; then
|
||||
echo "FAIL: no release tag exists yet, but .pre-commit-hooks.yaml already exposes hooks to external consumers." >&2
|
||||
echo " Fix: cut the first release tag (e.g. v1.0.0) before this lands on main." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Derive release-relevant paths from .pre-commit-hooks.yaml's own entry: lines
|
||||
# instead of hand-maintaining a parallel list — the manifest is the single
|
||||
# source of truth for what external consumers actually pull at a pinned rev,
|
||||
# so a hook added/removed/renamed there can't silently drift out of sync here.
|
||||
# Everything is derived from tokens[0], the hook's script: pre-commit prefixes
|
||||
# only entry[0] with the hook-repo clone path, so any later token that looks
|
||||
# like a path resolves against the *consuming* repo and can never name a file
|
||||
# this repo ships. A hook's bundled data therefore has to be self-located
|
||||
# relative to the script — vale-wrap.sh reads its own
|
||||
# <script-dir>/../assets/vale/.vale.ini plus the sibling styles/ tree — which
|
||||
# makes <script-dir>/../assets release-relevant alongside the script itself.
|
||||
# The ../ is normalised by stripping a path component rather than with
|
||||
# `realpath -m`, which is a GNU-only extension. Two guards keep the derivation
|
||||
# from inventing paths: a bundle root of "." is skipped, because a script in a
|
||||
# top-level directory (scripts/skill-size-check.sh) would derive the repo's own
|
||||
# shared assets/, which no hook owns and whose churn must not demand a release;
|
||||
# and the assets/ directory is added only where it is known to exist, since a
|
||||
# hook that bundles nothing must not contribute a pathspec matching nothing.
|
||||
RELEASE_PATHS=("$HOOKS_MANIFEST")
|
||||
|
||||
add_release_path() {
|
||||
local candidate="$1" existing
|
||||
for existing in "${RELEASE_PATHS[@]}"; do
|
||||
[[ "$existing" == "$candidate" ]] && return 0
|
||||
done
|
||||
RELEASE_PATHS+=("$candidate")
|
||||
}
|
||||
|
||||
# Emits one "<hook id><TAB><entry value>" line per hook so a rejected entry can
|
||||
# name the hook a human has to go fix. The id sits on its own line above its
|
||||
# entry: in YAML, so it is carried forward and then cleared; a hook that somehow
|
||||
# has no id still reports something printable rather than an empty name. Kept in
|
||||
# bash rather than awk: matching `[[:space:]]` inside a bracket expression is
|
||||
# reliable in bash's own globs but not in the BWK awk macOS ships. `read -r` with
|
||||
# a single variable is the trimmer — it strips leading and trailing whitespace
|
||||
# while preserving anything in between, so a multi-token entry survives intact
|
||||
# for the error message to quote back.
|
||||
manifest_entries() {
|
||||
local line id="" value
|
||||
while IFS= read -r line; do
|
||||
# Drop the indentation and the optional list dash, so that `- id: x` and
|
||||
# ` entry: y` both reduce to the same bare "key: value" shape.
|
||||
line="${line#"${line%%[![:space:]]*}"}"
|
||||
if [[ "$line" == -* ]]; then
|
||||
line="${line#-}"
|
||||
line="${line#"${line%%[![:space:]]*}"}"
|
||||
fi
|
||||
case "$line" in
|
||||
id:*)
|
||||
read -r id <<< "${line#id:}"
|
||||
;;
|
||||
entry:*)
|
||||
read -r value <<< "${line#entry:}"
|
||||
printf '%s\t%s\n' "${id:-(unnamed hook)}" "$value"
|
||||
id=""
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
# A hook's script is legitimate if it exists in the working tree *or* at
|
||||
# $LAST_TAG — the same union the pathspec itself spans. Checking per-scope
|
||||
# instead would reject exactly the case this gate exists to flag: a script
|
||||
# deleted since the tag while its entry survives (see the no -e filtering note
|
||||
# further down) is a real deletion to report, not a malformed manifest.
|
||||
entry_path_exists() {
|
||||
local candidate="$1"
|
||||
[[ -e "$candidate" ]] && return 0
|
||||
git cat-file -e "$LAST_TAG:$candidate" 2>/dev/null && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
# $1 selects where the "does this hook bundle an assets/ tree?" guard looks:
|
||||
# "worktree" probes the filesystem, anything else is a rev whose tree is probed
|
||||
# with git plumbing. Reading entry lines from stdin keeps one derivation for
|
||||
# both the tagged manifest and the current one.
|
||||
collect_release_paths() {
|
||||
local scope="$1" line hook_id entry bundle_root where
|
||||
local -a tokens
|
||||
if [[ "$scope" == "worktree" ]]; then
|
||||
where="the working tree's $HOOKS_MANIFEST"
|
||||
else
|
||||
where="$HOOKS_MANIFEST at $scope"
|
||||
fi
|
||||
while IFS= read -r line; do
|
||||
hook_id="${line%%$'\t'*}"
|
||||
entry="${line#*$'\t'}"
|
||||
read -ra tokens <<< "$entry"
|
||||
[[ ${#tokens[@]} -eq 0 ]] && continue
|
||||
# ADR-0014 binds every entry to a bare script path and nothing else, because
|
||||
# pre-commit rewrites only entry[0] into the hook-repo clone. That is a
|
||||
# constraint nothing else enforces, and the sibling .pre-commit-config.yaml
|
||||
# already ships the multi-token `bash <script>` shape one copy-paste away —
|
||||
# so an entry like `bash scripts/foo.sh` would add "bash" as a pathspec that
|
||||
# matches nothing and derive a bundle root of ".", dropping that hook's
|
||||
# entire surface out of the gate silently. Both malformed shapes below fail
|
||||
# loudly instead: silent degradation here is the same class of defect as the
|
||||
# --config token already recorded in LESSONS.md.
|
||||
if [[ ${#tokens[@]} -gt 1 ]]; then
|
||||
echo "FAIL: hook '$hook_id' in $where has a multi-token entry: $entry" >&2
|
||||
echo " Why: pre-commit rewrites only entry[0] into the hook-repo clone, so every later" >&2
|
||||
echo " token resolves against the *consuming* repo and can never name a file this" >&2
|
||||
echo " repo ships — and this gate would derive its release paths from '${tokens[0]}'." >&2
|
||||
echo " Fix: make the entry a bare script path and have the script self-locate anything" >&2
|
||||
echo " else from \${BASH_SOURCE[0]} (see ADR-0014, 'Consequences')." >&2
|
||||
exit 1
|
||||
fi
|
||||
if ! entry_path_exists "${tokens[0]}"; then
|
||||
echo "FAIL: hook '$hook_id' in $where names a path that exists neither in the working tree nor at $LAST_TAG: ${tokens[0]}" >&2
|
||||
echo " Why: this gate derives its release-relevant pathspec from that path, so a name" >&2
|
||||
echo " that resolves to no file silently drops the hook's whole surface from the diff." >&2
|
||||
echo " Fix: point the entry at a script path this repo actually ships (see ADR-0014," >&2
|
||||
echo " 'Consequences'); a bare command name is not a valid entry here." >&2
|
||||
exit 1
|
||||
fi
|
||||
add_release_path "${tokens[0]}"
|
||||
bundle_root="$(dirname "$(dirname "${tokens[0]}")")"
|
||||
[[ "$bundle_root" == "." ]] && continue
|
||||
if [[ "$scope" == "worktree" ]]; then
|
||||
[[ -d "$bundle_root/assets" ]] && add_release_path "$bundle_root/assets"
|
||||
else
|
||||
git cat-file -e "$scope:$bundle_root/assets" 2>/dev/null && add_release_path "$bundle_root/assets"
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
# The worktree alone is not enough: a path is release-relevant if it was part of
|
||||
# the contract at $LAST_TAG *or* is part of it now, so both trees have to be
|
||||
# derived and unioned. Deriving only from the worktree meant that deleting a
|
||||
# hook's entire assets/ tree made the `-d` guard drop the path from the pathspec
|
||||
# altogether, and the deletion — which breaks every consumer at the next rev —
|
||||
# diffed clean. The two manifests can genuinely disagree (an entry added,
|
||||
# removed, or renamed since the tag), and the union is the conservative side of
|
||||
# that disagreement: a path the tag exposed and HEAD no longer does is a removal
|
||||
# consumers must be told about, and a path only HEAD exposes is new contract
|
||||
# surface they cannot reach without a new tag. The union never over-fires on its
|
||||
# own, either — any manifest edit that makes the two disagree already changes
|
||||
# $HOOKS_MANIFEST, which is itself a release-relevant path.
|
||||
collect_release_paths worktree < <(manifest_entries < "$HOOKS_MANIFEST")
|
||||
|
||||
# A missing manifest at the tag is legitimate (the manifest was added since) but
|
||||
# is indistinguishable from an unreadable tagged tree by its exit status alone,
|
||||
# so the tag's root tree is verified separately. An absent tree object — a
|
||||
# shallow clone, a truncated fetch — fails closed exactly like a `git diff`
|
||||
# failure does, rather than silently degrading to worktree-only derivation.
|
||||
if MANIFEST_AT_TAG="$(git cat-file -p "$LAST_TAG:$HOOKS_MANIFEST" 2>/dev/null)"; then
|
||||
collect_release_paths "$LAST_TAG" < <(printf '%s\n' "$MANIFEST_AT_TAG" | manifest_entries)
|
||||
elif ! git cat-file -e "$LAST_TAG^{tree}" 2>/dev/null; then
|
||||
echo "FAIL: could not read the tree at $LAST_TAG to determine which paths that release exposed." >&2
|
||||
echo " Fix: ensure full tag history is available (e.g. git fetch --unshallow) and retry." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# No -e/existence filtering on the pathspec: a path deleted since $LAST_TAG is
|
||||
# exactly the case that must be caught (external consumers pinning the old tag
|
||||
# would hit a missing file), and `git diff` reports deletions fine without it
|
||||
# existing at the pushed ref. A git failure (e.g. a shallow clone missing
|
||||
# $LAST_TAG's history) must fail closed, not be swallowed into an empty,
|
||||
# falsely-clean diff.
|
||||
if ! CHANGED="$(git diff --name-only "$LAST_TAG".."$PUSHED_REF" -- "${RELEASE_PATHS[@]}")"; then
|
||||
echo "FAIL: could not diff $LAST_TAG..$PUSHED_REF to check for release-relevant changes (see git error above)." >&2
|
||||
echo " Fix: ensure full tag history is available (e.g. git fetch --unshallow) and retry." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -n "$CHANGED" ]]; then
|
||||
echo "FAIL: files covered by .pre-commit-hooks.yaml changed since $LAST_TAG:" >&2
|
||||
echo "$CHANGED" | sed 's/^/ /' >&2
|
||||
echo " Fix: cut a new release tag — external consumers pinning rev: $LAST_TAG would miss this change." >&2
|
||||
exit 1
|
||||
fi
|
||||
Executable
+387
@@ -0,0 +1,387 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Fails a push when a skill changed without its SKILL.md `metadata.version`
|
||||
# being bumped. ADR-0022 makes the field mandatory and the bump the rule; this
|
||||
# is the gate that holds the rule, since skill-size-check only checks presence
|
||||
# and shape.
|
||||
#
|
||||
# Baseline: `git merge-base --all <main> <pushed commit>`, where <main> is
|
||||
# origin/main when it resolves and the local `main` branch otherwise. Readers
|
||||
# install skills from main, so "changed" means changed relative to what main
|
||||
# ships, not relative to the remote branch's current tip. Diffing from
|
||||
# PRE_COMMIT_FROM_REF would let the second push of a feature branch excuse a
|
||||
# change the first push already carried unbumped. The check runs on every push
|
||||
# whatever the target branch — nothing here reads PRE_COMMIT_REMOTE_BRANCH — so
|
||||
# it also runs under a manual `pre-commit run --hook-stage pre-push` (against
|
||||
# HEAD, since no PRE_COMMIT_TO_REF is set). A missing bump is cheapest to fix on
|
||||
# the branch, before review.
|
||||
#
|
||||
# `--all`, not the single base git would otherwise pick for it. A criss-cross
|
||||
# history — main merges a branch while that branch merges a main commit — has
|
||||
# TWO merge bases, and which one `git merge-base` prints is an implementation
|
||||
# detail. Picking one made the verdict a coin flip: a skill byte-identical to
|
||||
# main's tip was still reported "not above merge-base" whenever the losing base
|
||||
# happened to be chosen, so an already-merged bump failed the push it should
|
||||
# have passed. So a skill counts as CHANGED only when it differs from EVERY
|
||||
# base — differing from none of them, or from only some, means one base already
|
||||
# carries the pushed content — and a changed skill's version must exceed the
|
||||
# version at every base it exists at. Both directions are conservative: the
|
||||
# intersection cannot exempt a skill that genuinely changed since all of main's
|
||||
# reachable history, and requiring every base keeps the ratchet.
|
||||
#
|
||||
# Second baseline: the tip of that same <main> ref. A changed skill's pushed
|
||||
# version must exceed its version there too (ADR-0022, second 2026-09-16
|
||||
# amendment). Two branches bumping 1.0.0 -> 1.0.1 with different content merge
|
||||
# without a conflict, so the merge-base alone would let main ship both under
|
||||
# one version. When <main> has not moved since the merge-base, the two
|
||||
# baselines are one commit and the skill is checked once. The tip is read as
|
||||
# last fetched. A skill whose directory at the pushed commit is the SAME TREE
|
||||
# OBJECT as at the tip skips the tip comparison: it ships exactly what main
|
||||
# ships, so there is nothing to announce. The merge-base intersection catches
|
||||
# that only when some base carries the content — true of the criss-cross shape
|
||||
# above, false of a branch that cherry-picks a fix main already has.
|
||||
#
|
||||
# Pushing main itself: with origin/main as the baseline, a push of main diffs
|
||||
# the new commits against what the remote already has, so it is covered. A
|
||||
# pushed commit that is already an ancestor of origin/main (merge-base equals
|
||||
# the pushed commit) changes nothing relative to main and passes. With only the
|
||||
# local `main` fallback, pushing main makes the merge-base the pushed commit
|
||||
# itself — the diff is empty by construction, not because nothing changed — so
|
||||
# that combination FAILS closed rather than passing unchecked.
|
||||
#
|
||||
# Scope: every skill directory plugins/<plugin>/.apm/skills/<skill>/, bin
|
||||
# included. Anything under <skill>/tests/ is ignored — no agent ever loads it,
|
||||
# so a test-only change ships nothing to a reader. A skill counts as changed
|
||||
# when any other file under its directory differs between baseline and pushed
|
||||
# commit. Paths are read NUL-delimited (`git diff -z`), so core.quotePath never
|
||||
# hides a non-ASCII path. Renames are diffed as delete + add (--no-renames), so:
|
||||
# - a skill absent at both baselines (new, renamed-to, merged-into) is
|
||||
# exempt; it has no prior version to exceed. Absent at the tip only
|
||||
# (deleted on main since): the merge-base rule alone applies.
|
||||
# - a file moved from one skill to another changes both.
|
||||
# - a skill directory absent at the pushed commit (deleted, renamed-from) is
|
||||
# exempt; there is nothing left to version. A directory replaced by a
|
||||
# symlink is no longer a tree, so it counts as deleted (apm drops symlinks
|
||||
# under .apm/, ADR-0017). A directory that survives without its SKILL.md
|
||||
# is NOT exempt: it fails as "SKILL.md missing".
|
||||
# Presence is read from the tree (rev-parse <commit>:<path>), not from the
|
||||
# blob, so a blob missing from a corrupt or partial clone is a read failure,
|
||||
# never a skill that looks new.
|
||||
# A changed skill must carry a three-part semver `metadata.version` at the
|
||||
# pushed commit that is numerically greater than each baseline's. The shape
|
||||
# rule matches skill-size-check.sh (str()-coerce, strip whitespace and quotes,
|
||||
# so `1.0` and `1.0.0-rc1` are rejected): each part is ASCII digits (Python's
|
||||
# `\d` also matches e.g. U+FF11), at most 9 of them so it fits bash
|
||||
# arithmetic, with no leading zero so bash never reads it as octal. A leading
|
||||
# UTF-8 BOM is ignored. A baseline with no valid version (a skill predating
|
||||
# ADR-0022) accepts any valid version. Versions are read from git objects,
|
||||
# never the working tree.
|
||||
#
|
||||
# Fails closed: if neither origin/main nor main resolves, if no merge-base
|
||||
# exists (shallow clone, unrelated history), if the pushed ref does not resolve
|
||||
# to a commit (an unknown sha, a tag on a tree), if python3 or PyYAML is
|
||||
# unavailable, or if a SKILL.md the tree names cannot be read. Passing in any
|
||||
# of those would make that environment the one place the rule is silently off.
|
||||
#
|
||||
# Known gaps:
|
||||
# - Only one pushed ref is gated. pre-commit (4.6.1, hook_impl.py
|
||||
# `_pre_push_ns`) consumes the pre-push stdin itself and walks the ref
|
||||
# lines in order: it skips deletes, returns on a ref whose remote sha is
|
||||
# non-zero and exists locally, and otherwise returns on the ref only if it
|
||||
# has commits no remote-tracking ref of that remote has. Every other ref in
|
||||
# the same `git push` (e.g. `git push origin a b`, `--all`, `--tags`) is
|
||||
# never seen. When the selected ref's unpushed history reaches a root
|
||||
# commit, pre-commit runs with all_files and sets no PRE_COMMIT_TO_REF at
|
||||
# all, so this script checks HEAD — the pushed ref only if checked out. The
|
||||
# script cannot recover either case: the ref list is gone by the time it
|
||||
# runs. Push refs one at a time to be sure each is checked.
|
||||
# - A PR merged via Gitea's merge button runs no local hook at all.
|
||||
# Closing it requires a server-side CI job, which this repo does not have
|
||||
# yet.
|
||||
|
||||
# Byte-wise regex matching and messages: path bytes are matched against
|
||||
# SKILL_PATH_RE below and must not depend on the caller's locale.
|
||||
export LC_ALL=C
|
||||
|
||||
# PRE_COMMIT_TO_REF is the local object actually being pushed, which is only
|
||||
# HEAD for the common case. For a tag push it is the tag object, so it is
|
||||
# peeled to a commit below before use.
|
||||
PUSHED_REF="${PRE_COMMIT_TO_REF:-HEAD}"
|
||||
|
||||
# All-zeros sha: the push deletes a branch, so nothing ships. Defensive only:
|
||||
# pre-commit 4.6.1's `_pre_push_ns` already skips delete lines and never passes
|
||||
# one here. Kept so a different caller cannot turn a delete into a rev-parse
|
||||
# failure.
|
||||
if [[ "$PUSHED_REF" =~ ^0+$ ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
REPO_ROOT="$(git rev-parse --show-toplevel)"
|
||||
cd "$REPO_ROOT"
|
||||
|
||||
if ! command -v python3 > /dev/null 2>&1; then
|
||||
echo "FAIL: python3 is required to read SKILL.md metadata.version but was not found on PATH." >&2
|
||||
echo " Fix: install python3 (pre-commit itself is a Python application, so it is almost certainly already present)." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! python3 -c 'import yaml' > /dev/null 2>&1; then
|
||||
echo "FAIL: PyYAML is required to read SKILL.md metadata.version but is not importable by python3." >&2
|
||||
echo " Fix: python3 -m pip install PyYAML (or your distro's python3-yaml package)." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! PUSHED_COMMIT="$(git rev-parse --verify -q "$PUSHED_REF^{commit}")"; then
|
||||
echo "FAIL: pushed ref $PUSHED_REF does not resolve to a commit." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
MAIN_REF=""
|
||||
for candidate in origin/main main; do
|
||||
if git rev-parse --verify -q "$candidate^{commit}" > /dev/null; then
|
||||
MAIN_REF="$candidate"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ -z "$MAIN_REF" ]]; then
|
||||
echo "FAIL: neither origin/main nor main resolves, so there is no baseline to compare skill versions against." >&2
|
||||
echo " Fix: git fetch origin main (or create a local main) and retry." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
BASES=()
|
||||
while IFS= read -r base; do
|
||||
[[ -n "$base" ]] && BASES+=("$base")
|
||||
done < <(git merge-base --all "$MAIN_REF" "$PUSHED_COMMIT" 2>/dev/null || true)
|
||||
|
||||
if [[ ${#BASES[@]} -eq 0 ]]; then
|
||||
echo "FAIL: no merge-base between $MAIN_REF and $PUSHED_REF, so there is no baseline to compare skill versions against." >&2
|
||||
echo " Fix: ensure full history is available (e.g. git fetch --unshallow) and retry." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# A pushed commit that is an ancestor of <main> is itself the only merge-base,
|
||||
# so this fires on exactly the case it always did.
|
||||
if [[ "$MAIN_REF" == "main" ]]; then
|
||||
for base in ${BASES[@]+"${BASES[@]}"}; do
|
||||
if [[ "$base" == "$PUSHED_COMMIT" ]]; then
|
||||
echo "FAIL: origin/main does not resolve and $PUSHED_REF is already contained in local main, so local main cannot serve as an independent baseline — the diff would be empty by construction." >&2
|
||||
echo " Fix: git fetch origin main and retry." >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
CHANGED_FILE="$(mktemp)"
|
||||
trap 'rm -f "$CHANGED_FILE"' EXIT
|
||||
|
||||
SKILL_PATH_RE='^(plugins/[^/]+/\.apm/skills/[^/]+)/(.+)$'
|
||||
|
||||
# skill_dirs_at <base>: sets SKILL_DIRS_ONE to the skill directories differing
|
||||
# between <base> and the pushed commit.
|
||||
skill_dirs_at() {
|
||||
local path dir existing seen
|
||||
SKILL_DIRS_ONE=()
|
||||
if ! git diff -z --no-renames --name-only "$1" "$PUSHED_COMMIT" -- plugins > "$CHANGED_FILE"; then
|
||||
echo "FAIL: could not diff $1..$PUSHED_REF (see git error above)." >&2
|
||||
exit 1
|
||||
fi
|
||||
while IFS= read -r -d '' path; do
|
||||
[[ "$path" =~ $SKILL_PATH_RE ]] || continue
|
||||
[[ "${BASH_REMATCH[2]}" == tests/* ]] && continue
|
||||
dir="${BASH_REMATCH[1]}"
|
||||
seen=false
|
||||
for existing in ${SKILL_DIRS_ONE[@]+"${SKILL_DIRS_ONE[@]}"}; do
|
||||
[[ "$existing" == "$dir" ]] && { seen=true; break; }
|
||||
done
|
||||
$seen || SKILL_DIRS_ONE+=("$dir")
|
||||
done < "$CHANGED_FILE"
|
||||
}
|
||||
|
||||
# Intersected across every base: a skill matching any ONE base is already
|
||||
# shipped by that base and has nothing left to bump.
|
||||
skill_dirs_at "${BASES[0]}"
|
||||
SKILL_DIRS=(${SKILL_DIRS_ONE[@]+"${SKILL_DIRS_ONE[@]}"})
|
||||
for ((i = 1; i < ${#BASES[@]}; i++)); do
|
||||
[[ ${#SKILL_DIRS[@]} -eq 0 ]] && break
|
||||
skill_dirs_at "${BASES[i]}"
|
||||
KEPT=()
|
||||
for dir in ${SKILL_DIRS[@]+"${SKILL_DIRS[@]}"}; do
|
||||
for existing in ${SKILL_DIRS_ONE[@]+"${SKILL_DIRS_ONE[@]}"}; do
|
||||
[[ "$existing" == "$dir" ]] && { KEPT+=("$dir"); break; }
|
||||
done
|
||||
done
|
||||
SKILL_DIRS=(${KEPT[@]+"${KEPT[@]}"})
|
||||
done
|
||||
|
||||
[[ ${#SKILL_DIRS[@]} -eq 0 ]] && exit 0
|
||||
|
||||
# Reads SKILL.md bytes on stdin and prints exactly one line: `OK <version>`
|
||||
# when metadata.version is a valid three-part semver, `INVALID` when it is
|
||||
# missing or malformed (including unparseable frontmatter). Any other outcome —
|
||||
# python3 crashing, PyYAML failing to import — is a non-zero exit with no OK /
|
||||
# INVALID line, which the caller reports as a read failure, never as a missing
|
||||
# version. Bytes are decoded explicitly so the caller's locale cannot turn a
|
||||
# non-ASCII SKILL.md into a crash; `[ \t\r]*` before each `\n` absorbs CRLF.
|
||||
# Whitespace before the opening `---` is accepted, matching FRONTMATTER_RE in
|
||||
# factory-audit's lib-boundary-resolver.sh, which skill-size-check applies.
|
||||
read_version() {
|
||||
python3 -c '
|
||||
import re, sys, yaml
|
||||
text = sys.stdin.buffer.read().decode("utf-8-sig", errors="replace")
|
||||
m = re.match(r"[ \t\r\n]*---[ \t\r]*\n(.*?)\n---[ \t\r]*(\n|\Z)", text, re.S)
|
||||
data = None
|
||||
if m:
|
||||
try:
|
||||
data = yaml.safe_load(m.group(1))
|
||||
except yaml.YAMLError:
|
||||
data = None
|
||||
meta = data.get("metadata") if isinstance(data, dict) else None
|
||||
ver = meta.get("version") if isinstance(meta, dict) else None
|
||||
ver = None if ver is None else str(ver).strip().strip("\x27\"")
|
||||
if ver is not None and re.fullmatch(r"(0|[1-9][0-9]{0,8})\.(0|[1-9][0-9]{0,8})\.(0|[1-9][0-9]{0,8})", ver):
|
||||
print("OK " + ver)
|
||||
else:
|
||||
print("INVALID")
|
||||
'
|
||||
}
|
||||
|
||||
# version_at <commit> <path>: sets VERSION to the valid version or "" when
|
||||
# invalid. Exits the script on a read failure.
|
||||
version_at() {
|
||||
local out
|
||||
if ! out="$(git show "$1:$2" | read_version)" || [[ "$out" != OK\ * && "$out" != INVALID ]]; then
|
||||
echo "FAIL: could not read metadata.version from $1:$2 (see error above)." >&2
|
||||
exit 1
|
||||
fi
|
||||
VERSION=""
|
||||
[[ "$out" == OK\ * ]] && VERSION="${out#OK }"
|
||||
return 0
|
||||
}
|
||||
|
||||
# Exit 0 when $1 > $2, both MAJOR.MINOR.PATCH with parts of at most 9 ASCII
|
||||
# digits and no leading zero (so bash never reads a part as octal), compared
|
||||
# numerically so 1.0.10 > 1.0.9.
|
||||
semver_gt() {
|
||||
local -a a b
|
||||
local i
|
||||
IFS=. read -ra a <<< "$1"
|
||||
IFS=. read -ra b <<< "$2"
|
||||
for i in 0 1 2; do
|
||||
if (( a[i] > b[i] )); then return 0; fi
|
||||
if (( a[i] < b[i] )); then return 1; fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
MAIN_TIP="$(git rev-parse --verify -q "$MAIN_REF^{commit}")"
|
||||
|
||||
# in_tree <commit> <path>: the tree names <path>. Unlike `git cat-file -e`, it
|
||||
# does not need the blob itself, so a blob a corrupt or partial clone lacks is a
|
||||
# read failure in version_at, not a skill that silently looks absent.
|
||||
in_tree() {
|
||||
git rev-parse --verify -q "$1:$2" > /dev/null
|
||||
}
|
||||
|
||||
# same_subtree <commit-a> <commit-b> <path>: both name <path> with the same
|
||||
# object, so the two commits ship byte-identical content there. Compared as
|
||||
# object ids rather than by diffing: a tree id is the content, whatever route
|
||||
# the history took to it. A path missing on either side is not a match.
|
||||
same_subtree() {
|
||||
local a b
|
||||
a="$(git rev-parse --verify -q "$1:$3")" || return 1
|
||||
b="$(git rev-parse --verify -q "$2:$3")" || return 1
|
||||
[[ "$a" == "$b" ]]
|
||||
}
|
||||
|
||||
OFFENDERS=()
|
||||
for dir in ${SKILL_DIRS[@]+"${SKILL_DIRS[@]}"}; do
|
||||
# Bases the skill exists at, in merge-base order, with the version read at
|
||||
# each. Index-matched arrays rather than one map: bash 3.2 has no `declare -A`.
|
||||
base_at=()
|
||||
base_vers=()
|
||||
first_base_ver=""
|
||||
for base in ${BASES[@]+"${BASES[@]}"}; do
|
||||
in_tree "$base" "$dir/SKILL.md" || continue
|
||||
version_at "$base" "$dir/SKILL.md"
|
||||
base_at+=("$base")
|
||||
base_vers+=("$VERSION")
|
||||
[[ -n "$first_base_ver" ]] || first_base_ver="$VERSION"
|
||||
done
|
||||
|
||||
# When main has not moved since a merge-base, the tip IS that baseline and the
|
||||
# skill is checked once.
|
||||
at_tip=false
|
||||
tip_is_base=false
|
||||
for base in ${BASES[@]+"${BASES[@]}"}; do
|
||||
if [[ "$MAIN_TIP" == "$base" ]]; then
|
||||
tip_is_base=true
|
||||
break
|
||||
fi
|
||||
done
|
||||
# A skill byte-identical to the tip's copy of it is already what main ships,
|
||||
# so there is nothing left for a bump to announce. The merge-base rule alone
|
||||
# would already have exempted it, but only when a base carries that same
|
||||
# content — which a criss-cross history gives and a linear one does not. A
|
||||
# branch cut before a fix landed on main and then cherry-picking that fix has
|
||||
# one merge-base, predating the fix, so the skill counts as changed against
|
||||
# it and reaches the tip comparison carrying exactly the tip's version. Same
|
||||
# content, same version, and the only escapes would be a spurious bump —
|
||||
# leaving main carrying two versions of identical content — or a rebase the
|
||||
# push does not otherwise need.
|
||||
if [[ "$tip_is_base" == false ]] && in_tree "$MAIN_TIP" "$dir/SKILL.md" \
|
||||
&& ! same_subtree "$MAIN_TIP" "$PUSHED_COMMIT" "$dir"; then
|
||||
at_tip=true
|
||||
fi
|
||||
# Absent at every baseline: new, renamed-to, or merged-into. Exempt.
|
||||
[[ ${#base_at[@]} -gt 0 ]] || $at_tip || continue
|
||||
# Directory absent at pushed commit: deleted or renamed-from. Exempt.
|
||||
[[ "$(git cat-file -t "$PUSHED_COMMIT:$dir" 2>/dev/null)" == "tree" ]] || continue
|
||||
|
||||
tip_ver=""
|
||||
if $at_tip; then version_at "$MAIN_TIP" "$dir/SKILL.md"; tip_ver="$VERSION"; fi
|
||||
|
||||
# The baseline the two messages below name. A skill added on main after the
|
||||
# branch was cut is absent at every merge-base, so no base names a version
|
||||
# while the tip does — and the tip's is the version the push is actually held
|
||||
# to. Reporting "none" there sends the author to the natural 1.0.0 and costs
|
||||
# them a second blocked push on the same mistake.
|
||||
report_ver="${first_base_ver:-$tip_ver}"
|
||||
|
||||
if ! in_tree "$PUSHED_COMMIT" "$dir/SKILL.md"; then
|
||||
OFFENDERS+=("$dir: SKILL.md missing at $PUSHED_REF (baseline: ${report_ver:-none})")
|
||||
continue
|
||||
fi
|
||||
version_at "$PUSHED_COMMIT" "$dir/SKILL.md"
|
||||
cur_ver="$VERSION"
|
||||
|
||||
if [[ -z "$cur_ver" ]]; then
|
||||
OFFENDERS+=("$dir: metadata.version missing or not MAJOR.MINOR.PATCH at $PUSHED_REF (baseline: ${report_ver:-none})")
|
||||
continue
|
||||
fi
|
||||
# Named by sha only when there is more than one base to tell apart; a
|
||||
# criss-cross history is the only case where "which merge-base" is a question
|
||||
# the reader cannot answer from the branch alone.
|
||||
for ((i = 0; i < ${#base_at[@]}; i++)); do
|
||||
base_ver="${base_vers[i]}"
|
||||
[[ -n "$base_ver" ]] || continue
|
||||
semver_gt "$cur_ver" "$base_ver" && continue
|
||||
if [[ ${#BASES[@]} -gt 1 ]]; then
|
||||
OFFENDERS+=("$dir: $base_ver -> $cur_ver (not above merge-base ${base_at[i]})")
|
||||
else
|
||||
OFFENDERS+=("$dir: $base_ver -> $cur_ver (not above merge-base)")
|
||||
fi
|
||||
done
|
||||
if [[ -n "$tip_ver" ]] && ! semver_gt "$cur_ver" "$tip_ver"; then
|
||||
OFFENDERS+=("$dir: $tip_ver -> $cur_ver (not above $MAIN_REF tip)")
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ ${#OFFENDERS[@]} -gt 0 ]]; then
|
||||
echo "FAIL: skills changed since merge-base with $MAIN_REF without a metadata.version above both that merge-base and the $MAIN_REF tip (ADR-0022):" >&2
|
||||
printf ' %s\n' ${OFFENDERS[@]+"${OFFENDERS[@]}"} >&2
|
||||
echo " Fix: raise metadata.version in each SKILL.md above the baseline named — bump PATCH at minimum." >&2
|
||||
exit 1
|
||||
fi
|
||||
@@ -20,5 +20,3 @@ DEPLOY_EXECUTABLES=(
|
||||
DEPLOY_DIRS=(
|
||||
"core:.claude/core"
|
||||
)
|
||||
|
||||
# Provider skill adapters are declared in providers/*/provider-manifest.sh, not here.
|
||||
+67
-1080
File diff suppressed because it is too large.
Load diff
+39
-10
@@ -45,11 +45,17 @@ fi
|
||||
# land at .claude/skills/<name>/tests/ and be discovered and run a second time,
|
||||
# which is ADR-0024 consequence 2 arriving here. Keeping the exclusion now is
|
||||
# what stops that landing as a mystery double-run on the merge that enables it.
|
||||
#
|
||||
# The walk runs from inside REPO_ROOT so the exclusions match paths RELATIVE to
|
||||
# it, the same universe the `git ls-files` grep below sees. Matched against
|
||||
# absolute paths, `*/.claude/worktrees/*` excluded every file whenever the
|
||||
# checkout itself was a Claude worktree (<repo>/.claude/worktrees/<name>/), and
|
||||
# the run failed with "N of N tracked .bats file(s) were not discovered".
|
||||
TEST_FILES=()
|
||||
while IFS= read -r f; do
|
||||
TEST_FILES+=("$f")
|
||||
TEST_FILES+=("$REPO_ROOT/${f#./}")
|
||||
done < <(
|
||||
find "$REPO_ROOT" -name "*.bats" \
|
||||
cd "$REPO_ROOT" && find . -name "*.bats" \
|
||||
-not -path "*/tests/bats/*" \
|
||||
-not -path "*/test_helper/*" \
|
||||
-not -path "*/.claude/worktrees/*" \
|
||||
@@ -174,6 +180,15 @@ for f in ${TEST_FILES[@]+"${TEST_FILES[@]}"}; do
|
||||
# file bats really did run, so it has to be distinguishable from a file that
|
||||
# produced nothing whatsoever.
|
||||
file_plan="$(grep -c '^1\.\.[0-9]' "$SCRATCH_ROOT/$i.log" || true)"
|
||||
# The planned count itself, extracted only when the file emitted exactly one
|
||||
# plan line. Zero plans is the broken-harness case the aggregate guard below
|
||||
# names, and two or more means the log is not one file's TAP stream at all --
|
||||
# in neither case does "the planned count" mean anything, so the per-file
|
||||
# comparison is skipped and the previous behaviour stands.
|
||||
file_planned=""
|
||||
if [[ "$file_plan" -eq 1 ]]; then
|
||||
file_planned="$(sed -n 's/^1\.\.\([0-9][0-9]*\).*$/\1/p' "$SCRATCH_ROOT/$i.log")"
|
||||
fi
|
||||
# String-compared below, not `-ne`. `-ne` is arithmetic and bash evaluates an
|
||||
# empty string as 0 there -- `[[ "" -ne 0 ]]` is false -- so an *empty* status
|
||||
# file read as a clean exit. The `|| echo 1` fallback only covers a *missing*
|
||||
@@ -183,14 +198,28 @@ for f in ${TEST_FILES[@]+"${TEST_FILES[@]}"}; do
|
||||
TOTAL_OK=$((TOTAL_OK + file_ok))
|
||||
TOTAL_NOT_OK=$((TOTAL_NOT_OK + file_not_ok))
|
||||
TOTAL_PLANS=$((TOTAL_PLANS + file_plan))
|
||||
# Two independent failure signals, deliberately OR-ed: a file can report `not
|
||||
# ok` lines while its process still exits 0 (a bats formatter or wrapper that
|
||||
# swallows the status), and a file can exit non-zero having emitted no `not
|
||||
# ok` at all (a crash, a timeout, an unbound variable in setup_file). Real
|
||||
# bats normally emits both at once, so each signal masks the other and
|
||||
# dropping either half is invisible without tests that produce one without
|
||||
# the other -- tests/test-run-bats.sh has those.
|
||||
if [[ "$file_not_ok" -gt 0 || "$status" != "0" ]]; then
|
||||
# Three independent failure signals, deliberately OR-ed: a file can report
|
||||
# `not ok` lines while its process still exits 0 (a bats formatter or wrapper
|
||||
# that swallows the status), a file can exit non-zero having emitted no `not
|
||||
# ok` at all (a crash, a timeout, an unbound variable in setup_file), and a
|
||||
# file can emit FEWER results than its own plan line promised. Real bats
|
||||
# normally emits all three consistently, so each signal masks the others and
|
||||
# dropping any one of them is invisible without tests that produce one without
|
||||
# the rest -- tests/test-run-bats.sh has those.
|
||||
#
|
||||
# The plan is the third signal and it is now enforced, not merely counted. It
|
||||
# is the one that survives precisely the wrapper-swallows-the-status case
|
||||
# named above: a process printing `1..10`, three `ok` lines and exit 0 used to
|
||||
# be counted as "3 tests, 0 failures" and go green with seven tests silently
|
||||
# gone, because the plan was computed for the aggregate zero-count guard below
|
||||
# and then discarded. Mismatch either way is a failure -- more results than
|
||||
# planned is as broken a TAP stream as fewer.
|
||||
file_short=false
|
||||
if [[ -n "$file_planned" && $((file_ok + file_not_ok)) -ne "$file_planned" ]]; then
|
||||
file_short=true
|
||||
echo "Error: $rel planned $file_planned test(s) but emitted $((file_ok + file_not_ok)) result line(s) — the run was truncated, or its exit status was swallowed" >&2
|
||||
fi
|
||||
if [[ "$file_not_ok" -gt 0 || "$status" != "0" || "$file_short" == true ]]; then
|
||||
FAIL=1
|
||||
fi
|
||||
done
|
||||
|
||||
+69
-2
@@ -151,11 +151,17 @@ run_bats
|
||||
# such file exists today -- the skill suites are all .bats, where run-bats.sh
|
||||
# already hit this -- so the exclusion is symmetry with its sibling, kept here
|
||||
# so the first shell suite added under a skill does not reintroduce it.
|
||||
#
|
||||
# The walk runs from inside SEARCH_ROOT so the exclusions match paths RELATIVE to
|
||||
# it. Matched against absolute paths, `*/.claude/worktrees/*` excluded every
|
||||
# suite whenever the checkout itself was a Claude worktree
|
||||
# (<repo>/.claude/worktrees/<name>/); relative, it still skips worktrees nested
|
||||
# below the root. The `./` prefix is swapped back for SEARCH_ROOT afterwards.
|
||||
SCRIPTS=()
|
||||
while IFS= read -r script; do
|
||||
SCRIPTS+=("$script")
|
||||
SCRIPTS+=("$SEARCH_ROOT/${script#./}")
|
||||
done < <(
|
||||
find "$SEARCH_ROOT" -name "test-*.sh" \
|
||||
cd "$SEARCH_ROOT" && find . -name "test-*.sh" \
|
||||
-not -path "*/.git/*" \
|
||||
-not -path "*/.claude/worktrees/*" \
|
||||
-not -path "*/apm_modules/*" \
|
||||
@@ -163,6 +169,67 @@ done < <(
|
||||
| sort
|
||||
)
|
||||
|
||||
# Discovering NOTHING is never a clean run, and it used to be the quietest
|
||||
# possible pass: the loops below iterate zero times, nothing is printed between
|
||||
# the bats block and the summary, and `Summary: 0 passed, 0 failed` exits 0 --
|
||||
# under --strict too, because strictness only ever turned SKIPS into failures
|
||||
# and there were no suites to skip. A wrong TEST_DIR, a mistyped `find` pattern,
|
||||
# an exclusion that grew to swallow tests/, and a gutted checkout all land here.
|
||||
# tests/run-bats.sh has carried this guard for its own .bats discovery; this is
|
||||
# the same guard one file over, and the run-tests pre-push hook is the caller
|
||||
# that needs it.
|
||||
#
|
||||
# Two checks, in the same order and for the same reasons as run-bats.sh's.
|
||||
# First, the derived one: every test-*.sh in the git index must have been
|
||||
# discovered. The direction matters -- a discovered file need NOT be tracked
|
||||
# (work in progress is ordinary), and a file removed with `git rm` leaves the
|
||||
# index, so a deliberate removal passes while an accidental disappearance
|
||||
# fails. It only runs when SEARCH_ROOT is itself the git worktree root, which
|
||||
# is what keeps it off the mktemp fixture trees in tests/test-run-tests.sh --
|
||||
# those hold one or two test-*.sh files by design and git resolves no worktree
|
||||
# for them. The same exclusions are reapplied to the index listing so both
|
||||
# sides cover the same universe.
|
||||
EXPECTED_SCRIPTS=()
|
||||
GIT_TOPLEVEL="$(git -C "$SEARCH_ROOT" rev-parse --show-toplevel 2> /dev/null || true)"
|
||||
if [[ -n "$GIT_TOPLEVEL" && "$GIT_TOPLEVEL" == "$SEARCH_ROOT" ]]; then
|
||||
while IFS= read -r f; do
|
||||
[[ -n "$f" ]] && EXPECTED_SCRIPTS+=("$SEARCH_ROOT/$f")
|
||||
done < <(
|
||||
git -C "$SEARCH_ROOT" ls-files -- 'test-*.sh' '*/test-*.sh' \
|
||||
| grep -Ev '(^|/)\.claude/worktrees/|(^|/)apm_modules/|(^|/)\.claude/skills/' \
|
||||
| sort || true
|
||||
)
|
||||
fi
|
||||
|
||||
if [[ ${#EXPECTED_SCRIPTS[@]} -gt 0 ]]; then
|
||||
MISSING_SCRIPTS=()
|
||||
for expected in ${EXPECTED_SCRIPTS[@]+"${EXPECTED_SCRIPTS[@]}"}; do
|
||||
found=false
|
||||
for actual in ${SCRIPTS[@]+"${SCRIPTS[@]}"}; do
|
||||
if [[ "$actual" == "$expected" ]]; then
|
||||
found=true
|
||||
break
|
||||
fi
|
||||
done
|
||||
[[ "$found" == true ]] || MISSING_SCRIPTS+=("${expected#"$SEARCH_ROOT"/}")
|
||||
done
|
||||
if [[ ${#MISSING_SCRIPTS[@]} -gt 0 ]]; then
|
||||
echo "Error: ${#MISSING_SCRIPTS[@]} of ${#EXPECTED_SCRIPTS[@]} tracked test-*.sh file(s) were not discovered under $SEARCH_ROOT — they were deleted without being removed from the index, or the search path/exclusions above no longer reach them:" >&2
|
||||
for m in ${MISSING_SCRIPTS[@]+"${MISSING_SCRIPTS[@]}"}; do
|
||||
echo " $m" >&2
|
||||
done
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Second, unconditional and separate: a tree with nothing tracked (a tarball
|
||||
# export, a fresh scaffold) still must not run on an empty set and call it
|
||||
# green.
|
||||
if [[ ${#SCRIPTS[@]} -eq 0 ]]; then
|
||||
echo "Error: found 0 test-*.sh file(s) under $SEARCH_ROOT — the search path is wrong or the suite has been gutted" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Each test-*.sh is independent (fixtures live under its own mktemp dir, none
|
||||
# write back into the live repo tree -- verified before adding this), so they
|
||||
# run concurrently in fixed-size batches instead of one at a time. Dispatch and
|
||||
|
||||
+325
-110
@@ -3,22 +3,20 @@
|
||||
# itself. None of them was pinned anywhere before this file, and each one fails
|
||||
# silently — which is the whole reason they need a test rather than a comment:
|
||||
#
|
||||
# 1. "ONE resolver, embedded VERBATIM in two scripts." The block between the
|
||||
# BEGIN/END markers is copied, not imported, because a cache-installed
|
||||
# plugin's scripts cannot read files outside their own plugin directory.
|
||||
# ADR-0025 merged skill-audit and agent-audit, which dropped the count from
|
||||
# three copies to two: factory-audit now holds ONE copy in a sourced
|
||||
# lib-boundary-resolver.sh, and scripts/skill-size-check.sh keeps its
|
||||
# embedded copy because it is a repo-root hook consumed through
|
||||
# .pre-commit-hooks.yaml, where entry[0] is the only token pre-commit
|
||||
# rewrites — it cannot reach a file inside the plugin at a path any consumer
|
||||
# has. Nothing but this file asserts the two copies are still identical, and
|
||||
# a one-line edit to a single copy is invisible: every constant-agreement
|
||||
# assertion in tests/test-skill-size-check.sh still passes, because the
|
||||
# CONSTANTS are not what drifted.
|
||||
# 1a. The resolver's two copies are the ONLY two, and validate.sh sources
|
||||
# factory-audit's in both mode branches — the same authority checks 1b
|
||||
# makes for the parser, which byte-identity alone cannot make.
|
||||
# 1. "ONE resolver, and both of its consumers run it." The ADR-0020 boundary
|
||||
# resolver has exactly one copy, factory-audit's sourced
|
||||
# lib-boundary-resolver.sh. scripts/skill-size-check.sh used to embed a
|
||||
# second, byte-identical copy, because it was also exported through a
|
||||
# published hook manifest whose consumers could not reach a file inside the
|
||||
# plugin; 4de5b6b retired that export (ADR-0014), so the hook now sources
|
||||
# the library too. What must not fail silently: the hook growing its own
|
||||
# copy back, the library being gutted, or the hook no longer running the
|
||||
# library's text at all. So this asserts the library is real content, the
|
||||
# hook carries no marker pair, the hook fails closed without the library,
|
||||
# and — by a sentinel planted in a copied library — that the text the hook
|
||||
# executes IS the library's.
|
||||
# 1a. The library is the ONLY authority, and validate.sh sources it in both
|
||||
# mode branches — the same authority checks 1b makes for the parser.
|
||||
# 1b. The same claim, one directory over, for the Contributing-files parser.
|
||||
# That one was worse: it was embedded in both validate-provenance.sh copies,
|
||||
# the agent-audit copy's docstring ASSERTED it was kept behaviourally
|
||||
@@ -43,14 +41,20 @@
|
||||
# passing hook, and a SUGGESTION deliberately does not fail, so dropping
|
||||
# one word from the config silences the tier ADR-0020 depends on while
|
||||
# every test and every hook still reports green.
|
||||
# 4. The WIRING of every repo-authored hook — its id, its `entry:` and its
|
||||
# `stages:`. Same failure shape as 3, one level up: the tests drive these
|
||||
# scripts by path, so nothing noticed whether .pre-commit-config.yaml
|
||||
# still invoked them. On a scratch copy, deleting eight local hook blocks
|
||||
# at once — `run-tests` among them — left every suite green. Upstream
|
||||
# hooks and every `rev:` are deliberately out of scope.
|
||||
set -euo pipefail
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
HOOK="$REPO_ROOT/scripts/skill-size-check.sh"
|
||||
FACTORY_AUDIT="$REPO_ROOT/plugins/kyberforge/.apm/skills/factory-audit"
|
||||
# ADR-0025: one auto-detecting entry point, and one sourced copy of the resolver
|
||||
# behind it. The entry point is what the preflight assertions run; the library is
|
||||
# what the byte-identity assertion hashes.
|
||||
# behind it, which the root hook sources as well. The entry point is what the
|
||||
# preflight assertions run; the library is what assertion 1 inspects.
|
||||
FACTORY_VALIDATE="$FACTORY_AUDIT/scripts/validate.sh"
|
||||
FACTORY_RESOLVER="$FACTORY_AUDIT/scripts/lib-boundary-resolver.sh"
|
||||
PASS=0
|
||||
@@ -66,70 +70,111 @@ BEGIN_MARKER='# ===== BEGIN ADR-0020 SHARED BOUNDARY RESOLVER ====='
|
||||
END_MARKER='# ===== END ADR-0020 SHARED BOUNDARY RESOLVER ====='
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# 1. The shared resolver block is byte-identical in both scripts
|
||||
# 1. The resolver has one copy, and the root hook runs it
|
||||
# ---------------------------------------------------------------------------
|
||||
# Two copies, not three, since ADR-0025 merged skill-audit and agent-audit:
|
||||
# scripts/skill-size-check.sh (embedded — sourcing the plugin's copy was
|
||||
# considered and refuted, see the header) and factory-audit's single sourced
|
||||
# lib-boundary-resolver.sh. The claim is unchanged and so is the check: the
|
||||
# span between the markers must be byte-identical wherever it appears.
|
||||
# One copy since the 2026-09-16 change: factory-audit's lib-boundary-resolver.sh.
|
||||
# scripts/skill-size-check.sh sources it rather than embedding a second copy, so
|
||||
# there is no pair left to hash. What replaces the hash is the set of ways a
|
||||
# single sourced copy can still fail quietly.
|
||||
echo ""
|
||||
echo "--- the ADR-0020 shared resolver block is byte-identical in both scripts ---"
|
||||
echo "--- the ADR-0020 resolver has one copy, and skill-size-check.sh runs it ---"
|
||||
|
||||
# Marker discipline first. An unbalanced or duplicated marker pair makes the
|
||||
# extraction below silently measure the wrong span — a sed range that never
|
||||
# closes swallows the rest of the file, and one that opens twice concatenates
|
||||
# two spans. Both would still compare "equal" if both were mangled the
|
||||
# same way, so the shape is asserted before the contents.
|
||||
MARKERS_OK=true
|
||||
for f in "$HOOK" "$FACTORY_RESOLVER"; do
|
||||
if [[ ! -f "$f" ]]; then
|
||||
fail "script not found: $f"
|
||||
MARKERS_OK=false
|
||||
continue
|
||||
fi
|
||||
b="$(grep -cFx "$BEGIN_MARKER" "$f" || true)"
|
||||
e="$(grep -cFx "$END_MARKER" "$f" || true)"
|
||||
if [[ "$b" == "1" && "$e" == "1" ]]; then
|
||||
pass "${f#"$REPO_ROOT/"} carries exactly one BEGIN and one END marker"
|
||||
else
|
||||
fail "${f#"$REPO_ROOT/"} has $b BEGIN and $e END markers, expected 1 and 1"
|
||||
MARKERS_OK=false
|
||||
fi
|
||||
done
|
||||
|
||||
if ! $MARKERS_OK; then
|
||||
fail "skipping the byte-identity comparison — the marker pairs are not well-formed, so any extraction would measure the wrong span"
|
||||
# (i) The library carries exactly one well-formed marker pair around real
|
||||
# content. An unbalanced pair makes every extraction measure the wrong span, and
|
||||
# an emptied-out block would still "load" while enforcing nothing. The resolver
|
||||
# is ~1,060 lines; 100 is a floor low enough never to need maintenance and high
|
||||
# enough that a gutted block cannot sneak past.
|
||||
if [[ ! -f "$FACTORY_RESOLVER" ]]; then
|
||||
fail "resolver library not found: ${FACTORY_RESOLVER#"$REPO_ROOT/"}"
|
||||
else
|
||||
HASHES=()
|
||||
LINECOUNTS=()
|
||||
for f in "$HOOK" "$FACTORY_RESOLVER"; do
|
||||
out="$TMPDIR_T/block-$(echo "$f" | md5sum | cut -c1-8).txt"
|
||||
sed -n "/^${BEGIN_MARKER}\$/,/^${END_MARKER}\$/p" "$f" > "$out"
|
||||
HASHES+=("$(md5sum < "$out" | cut -d' ' -f1)")
|
||||
LINECOUNTS+=("$(wc -l < "$out" | tr -d ' ')")
|
||||
done
|
||||
if [[ "${HASHES[0]}" == "${HASHES[1]}" ]]; then
|
||||
pass "both copies hash to ${HASHES[0]} (${LINECOUNTS[0]} lines) — agreement by construction, not by coincidence"
|
||||
b="$(grep -cFx "$BEGIN_MARKER" "$FACTORY_RESOLVER" || true)"
|
||||
e="$(grep -cFx "$END_MARKER" "$FACTORY_RESOLVER" || true)"
|
||||
if [[ "$b" == "1" && "$e" == "1" ]]; then
|
||||
pass "${FACTORY_RESOLVER#"$REPO_ROOT/"} carries exactly one BEGIN and one END marker"
|
||||
span="$(sed -n "/^${BEGIN_MARKER}\$/,/^${END_MARKER}\$/p" "$FACTORY_RESOLVER" | wc -l | tr -d ' ')"
|
||||
if [[ "$span" -gt 100 ]]; then
|
||||
pass "the resolver span is $span lines — real content, not an empty block"
|
||||
else
|
||||
fail "the resolver span is only $span lines — a gutted block would load and resolve nothing"
|
||||
fi
|
||||
else
|
||||
fail "the shared resolver has DRIFTED: skill-size-check=${HASHES[0]} (${LINECOUNTS[0]} lines), factory-audit/scripts/lib-boundary-resolver.sh=${HASHES[1]} (${LINECOUNTS[1]} lines). Edit one copy, then paste it over the other."
|
||||
fail "${FACTORY_RESOLVER#"$REPO_ROOT/"} has $b BEGIN and $e END markers, expected 1 and 1"
|
||||
fi
|
||||
# A block that has been emptied out would hash equal in both and pass the
|
||||
# comparison above while enforcing nothing. The resolver is ~1,060 lines; 100
|
||||
# is a floor low enough never to need maintenance and high enough that a
|
||||
# gutted block cannot sneak past.
|
||||
if [[ "${LINECOUNTS[0]}" -gt 100 ]]; then
|
||||
pass "the extracted block is ${LINECOUNTS[0]} lines — the comparison is over real content, not an empty span"
|
||||
fi
|
||||
|
||||
# (ii) The hook carries no copy of its own. A column-0 marker line in the hook
|
||||
# is the shape the old embedded copy had, and the shape a paste-back would have.
|
||||
if [[ ! -f "$HOOK" ]]; then
|
||||
fail "hook not found: ${HOOK#"$REPO_ROOT/"}"
|
||||
else
|
||||
hb="$(grep -cFx "$BEGIN_MARKER" "$HOOK" || true)"
|
||||
he="$(grep -cFx "$END_MARKER" "$HOOK" || true)"
|
||||
if [[ "$hb" == "0" && "$he" == "0" ]]; then
|
||||
pass "${HOOK#"$REPO_ROOT/"} carries no resolver marker lines — it has not grown its own copy back"
|
||||
else
|
||||
fail "the extracted shared block is only ${LINECOUNTS[0]} lines — two identical empty spans would compare equal and assert nothing"
|
||||
fail "${HOOK#"$REPO_ROOT/"} carries $hb BEGIN and $he END marker lines — a second copy of the resolver is back in the hook"
|
||||
fi
|
||||
fi
|
||||
|
||||
# (iii) and (iv) run the hook from a scratch tree that mirrors the two paths it
|
||||
# depends on, so the real library is never touched. The scratch hook is a copy
|
||||
# of the real one; its library is either absent, gutted, or the real library
|
||||
# with a sentinel planted inside the resolver block.
|
||||
SSC_TREE="$TMPDIR_T/ssc-tree"
|
||||
SSC_LIB_DIR="$SSC_TREE/plugins/kyberforge/.apm/skills/factory-audit/scripts"
|
||||
mkdir -p "$SSC_TREE/scripts" "$SSC_LIB_DIR" "$TMPDIR_T/ssc-skill/probe-skill"
|
||||
cp "$HOOK" "$SSC_TREE/scripts/skill-size-check.sh"
|
||||
printf -- '---\nname: probe-skill\ndescription: Use when probing the resolver wiring.\nmetadata:\n version: "0.1.0"\n---\n\n## Step 1\n\nDo the thing.\n' \
|
||||
> "$TMPDIR_T/ssc-skill/probe-skill/SKILL.md"
|
||||
PROBE="$TMPDIR_T/ssc-skill/probe-skill/SKILL.md"
|
||||
|
||||
run_scratch_hook() {
|
||||
local rc=0
|
||||
SSC_OUT="$(bash "$SSC_TREE/scripts/skill-size-check.sh" "$PROBE" 2>&1)" || rc=$?
|
||||
SSC_RC=$rc
|
||||
}
|
||||
|
||||
# (iii) Fail closed: no library, then a library that defines nothing.
|
||||
rm -f "$SSC_LIB_DIR/lib-boundary-resolver.sh"
|
||||
run_scratch_hook
|
||||
if [[ "$SSC_RC" -ne 0 && "$SSC_OUT" == *"boundary resolver library was not found"* ]]; then
|
||||
pass "with the library missing, the hook exits $SSC_RC and names the missing library — not a vacuous pass"
|
||||
else
|
||||
fail "with the library missing, the hook exited $SSC_RC without naming it: $SSC_OUT"
|
||||
fi
|
||||
printf '# gutted\n' > "$SSC_LIB_DIR/lib-boundary-resolver.sh"
|
||||
run_scratch_hook
|
||||
if [[ "$SSC_RC" -ne 0 && "$SSC_OUT" == *"did not define the ADR-0020 boundary resolver"* ]]; then
|
||||
pass "with a library that defines no resolver, the hook exits $SSC_RC and says so"
|
||||
else
|
||||
fail "with a gutted library, the hook exited $SSC_RC without saying so: $SSC_OUT"
|
||||
fi
|
||||
|
||||
# (iv) The text the hook executes IS the library's. A sentinel print planted
|
||||
# just after the BEGIN marker of a copied library must appear in the hook's
|
||||
# output. Without this, a hook that sourced the library but ran some other
|
||||
# program would pass (i)-(iii).
|
||||
SENTINEL="ADR0020-RESOLVER-SENTINEL-$$"
|
||||
if [[ -f "$FACTORY_RESOLVER" ]]; then
|
||||
awk -v m="$BEGIN_MARKER" -v s="$SENTINEL" '{ print } $0 == m { print "print(\"" s "\")" }' \
|
||||
"$FACTORY_RESOLVER" > "$SSC_LIB_DIR/lib-boundary-resolver.sh"
|
||||
if [[ "$(grep -cF "$SENTINEL" "$SSC_LIB_DIR/lib-boundary-resolver.sh" || true)" -ne 1 ]]; then
|
||||
fail "fixture check: the sentinel was not planted exactly once in the copied library — the case below would prove nothing"
|
||||
else
|
||||
run_scratch_hook
|
||||
if [[ "$SSC_RC" -eq 0 && "$SSC_OUT" == *"$SENTINEL"* ]]; then
|
||||
pass "a sentinel planted in the library's resolver block runs inside the hook — the hook executes the library's text"
|
||||
else
|
||||
fail "the hook did not run the library's resolver text (rc=$SSC_RC, sentinel absent from output): $SSC_OUT"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# 1a. The resolver copies are the ONLY two, and validate.sh sources its one
|
||||
# 1a. The resolver library is the ONLY authority, and validate.sh sources it
|
||||
# ---------------------------------------------------------------------------
|
||||
# Byte-identity between two named files says nothing about a THIRD copy, and
|
||||
# nothing about whether factory-audit's copy is the one that runs. Assertion 1b
|
||||
# Assertion 1 says nothing about a copy somewhere else in the tree, and nothing
|
||||
# about whether validate.sh runs the library. Assertion 1b
|
||||
# pins both of those for the Contributing-files parser; the resolver is the same
|
||||
# defect class and gets the same two checks:
|
||||
#
|
||||
@@ -137,16 +182,14 @@ fi
|
||||
# branches — asserted inside each arm of `case "$MODE" in`, not by counting
|
||||
# source lines file-wide, because a count cannot see a branch. A library
|
||||
# that is identical, unique and never sourced is a copy that has quietly
|
||||
# been replaced by an inline one — and the byte-identity check above would
|
||||
# stay green over it.
|
||||
# been replaced by an inline one — and assertion 1 would stay green over it.
|
||||
# b. Nothing has re-inlined it. The BEGIN marker and a def unique to the
|
||||
# resolver (`_authoring_root`) appear in exactly the two authorities —
|
||||
# scripts/skill-size-check.sh and lib-boundary-resolver.sh — and nowhere
|
||||
# else under the tree. A mode library that grows a "just this once" copy
|
||||
# would otherwise escape assertion 1 entirely, because 1 hashes only the
|
||||
# two files it names.
|
||||
# resolver (`_authoring_root`) appear in exactly one file,
|
||||
# lib-boundary-resolver.sh, and nowhere else under the tree. A mode library
|
||||
# or a root script that grows a "just this once" copy would otherwise
|
||||
# escape assertion 1 entirely, because 1 inspects only the files it names.
|
||||
echo ""
|
||||
echo "--- the ADR-0020 resolver has exactly two authorities, and validate.sh sources factory-audit's ---"
|
||||
echo "--- the ADR-0020 resolver has exactly one authority, and validate.sh sources it ---"
|
||||
|
||||
# Deployed and vendored trees are generated copies, not authorities: .claude/ is
|
||||
# apm install output, apm_modules/ is resolved dependencies, build/ is release
|
||||
@@ -303,18 +346,18 @@ PY
|
||||
fi
|
||||
fi
|
||||
|
||||
# (b) Exactly the two authorities, for both spellings of a copy.
|
||||
EXPECTED_RESOLVERS="$(printf '%s\n' "$HOOK" "$FACTORY_RESOLVER" | sort)"
|
||||
# (b) Exactly the one authority, for both spellings of a copy.
|
||||
EXPECTED_RESOLVERS="$FACTORY_RESOLVER"
|
||||
check_resolver_authorities() {
|
||||
local label="$1" needle="$2"
|
||||
local found
|
||||
found="$(tree_scan "$needle")"
|
||||
if [[ "$found" == "$EXPECTED_RESOLVERS" ]]; then
|
||||
pass "$label appears in exactly the two resolver authorities and nowhere else"
|
||||
pass "$label appears in exactly the one resolver authority and nowhere else"
|
||||
elif [[ -z "$found" ]]; then
|
||||
fail "$label was found in NO file at all — the scan is looking for the wrong text"
|
||||
else
|
||||
fail "$label appears in an unexpected set of files, so the resolver has been re-inlined or lost: $(echo "$found" | tr '\n' ' ')— expected exactly ${HOOK#"$REPO_ROOT/"} and ${FACTORY_RESOLVER#"$REPO_ROOT/"}"
|
||||
fail "$label appears in an unexpected set of files, so the resolver has been re-inlined or lost: $(echo "$found" | tr '\n' ' ')— expected exactly ${FACTORY_RESOLVER#"$REPO_ROOT/"}"
|
||||
fi
|
||||
}
|
||||
check_resolver_authorities "the resolver's BEGIN marker" "$BEGIN_MARKER"
|
||||
@@ -325,7 +368,7 @@ check_resolver_authorities "a 'def _authoring_root' definition" "def _authoring_
|
||||
# ---------------------------------------------------------------------------
|
||||
# Same defect class, one directory over. parse_contributing_files() used to be
|
||||
# embedded in both validate-provenance.sh copies for the same reason the resolver
|
||||
# is embedded twice, and until this assertion existed the agent-audit copy's
|
||||
# was once embedded in several scripts, and until this assertion existed the agent-audit copy's
|
||||
# docstring merely CLAIMED it was "kept behaviourally identical to skill-audit's
|
||||
# copy" — an invariant nothing checked, and the two did drift into different
|
||||
# spellings of the bullet loop at 484357a. That drift happened to be
|
||||
@@ -590,14 +633,14 @@ for probe in "scripts/skill-size-check.sh|$HOOK|$SUBJECT_SKILL_DIR/SKILL.md" \
|
||||
done
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# 3. verbose: true on the skill-size-check hook, in BOTH manifests
|
||||
# 3. verbose: true on the skill-size-check hook
|
||||
# ---------------------------------------------------------------------------
|
||||
# .pre-commit-config.yaml governs this repo; .pre-commit-hooks.yaml is what a
|
||||
# CONSUMER repo gets when it points at this one. Dropping the flag from either
|
||||
# silences the SUGGESTION tier for that audience alone, which is the hardest
|
||||
# version of the defect to notice.
|
||||
# pre-commit prints nothing for a passing hook, so dropping the flag silences
|
||||
# the SUGGESTION tier without failing anything. The published
|
||||
# .pre-commit-hooks.yaml that once carried a second copy of this hook was
|
||||
# retired (ADR-0014, 2026-09-16 amendment); if it returns, assert it here too.
|
||||
echo ""
|
||||
echo "--- the skill-size-check hook declares verbose: true in both manifests ---"
|
||||
echo "--- the skill-size-check hook declares verbose: true ---"
|
||||
VERBOSE_REPORT="$(python3 - "$REPO_ROOT" <<'PY'
|
||||
import os
|
||||
import sys
|
||||
@@ -632,27 +675,6 @@ else:
|
||||
emit('FAIL', '.pre-commit-config.yaml: skill-size-check has verbose=%r — '
|
||||
'pre-commit prints nothing for a passing hook, so every '
|
||||
'ADR-0020 SUGGESTION is swallowed' % (found.get('verbose'),))
|
||||
|
||||
# Consumer manifest: a flat list of hooks.
|
||||
path = os.path.join(root, '.pre-commit-hooks.yaml')
|
||||
try:
|
||||
with open(path, encoding='utf-8') as fh:
|
||||
hooks = yaml.safe_load(fh) or []
|
||||
except Exception as exc:
|
||||
emit('FAIL', '.pre-commit-hooks.yaml did not parse: %s' % exc)
|
||||
hooks = []
|
||||
found = None
|
||||
for hook in hooks:
|
||||
if isinstance(hook, dict) and hook.get('id') == 'kyberforge-skill-size-check':
|
||||
found = hook
|
||||
if found is None:
|
||||
emit('FAIL', '.pre-commit-hooks.yaml declares no hook with id kyberforge-skill-size-check')
|
||||
elif found.get('verbose') is True:
|
||||
emit('PASS', '.pre-commit-hooks.yaml: kyberforge-skill-size-check is verbose: true')
|
||||
else:
|
||||
emit('FAIL', '.pre-commit-hooks.yaml: kyberforge-skill-size-check has verbose=%r — '
|
||||
'a consumer repo would never see the SUGGESTION tier'
|
||||
% (found.get('verbose'),))
|
||||
PY
|
||||
)"
|
||||
while IFS=$'\t' read -r status msg; do
|
||||
@@ -664,6 +686,199 @@ while IFS=$'\t' read -r status msg; do
|
||||
fi
|
||||
done <<< "$VERBOSE_REPORT"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# 4. Every repo-authored hook is still WIRED, at the stage it claims
|
||||
# ---------------------------------------------------------------------------
|
||||
# Same failure mode as assertion 3, one level up. Every gate this repo owns is
|
||||
# driven in tests by PATH -- tests/test-skill-version-bump.sh runs
|
||||
# scripts/check-skill-version-bump.sh directly -- so the script staying correct
|
||||
# and the hook still existing are independent facts, and only the first one was
|
||||
# pinned. Deleting the `run-tests` block from .pre-commit-config.yaml (a routine
|
||||
# merge-conflict casualty) stops the entire suite from running at pre-push
|
||||
# forever, and `bash tests/run-tests.sh --strict` still prints all green: the
|
||||
# suite cannot notice that nothing invokes it. Verified on a scratch copy --
|
||||
# eight repo-authored hook blocks were deleted at once and every suite stayed
|
||||
# green.
|
||||
#
|
||||
# So: id + entry + stages, for the repo-authored hooks only. "Repo-authored"
|
||||
# is derived from the config (every hook under a `repo: local` entry), not
|
||||
# hardcoded, and the derived set is then compared against the expected list
|
||||
# below -- a new local hook that nobody pinned is itself a failure.
|
||||
#
|
||||
# Deliberately NOT pinned: the stock upstream hooks (gitleaks, check-yaml,
|
||||
# pretty-format-json, shellcheck, conventional-pre-commit, the `repo: meta`
|
||||
# pair) and every `rev:`. Those are somebody else's contract; a rev bump must
|
||||
# not churn this test.
|
||||
echo ""
|
||||
echo "--- every repo-authored hook is wired, with the entry and stages it claims ---"
|
||||
WIRING_REPORT="$(python3 - "$REPO_ROOT" <<'PY'
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
import yaml
|
||||
|
||||
root = sys.argv[1]
|
||||
|
||||
|
||||
def emit(status, msg):
|
||||
print("%s\t%s" % (status, msg))
|
||||
|
||||
|
||||
# The expected wiring of every hook this repo authors: id -> (entry, stages).
|
||||
# ADDING OR REMOVING A REPO-AUTHORED HOOK DELIBERATELY REQUIRES EDITING THIS
|
||||
# LIST. That is the point -- the list is the second party to the agreement, so a
|
||||
# hook cannot leave .pre-commit-config.yaml without someone saying so here.
|
||||
# Upstream hooks are absent on purpose and must stay absent.
|
||||
EXPECTED = {
|
||||
# pre-push
|
||||
'run-tests': (
|
||||
'bash tests/run-tests.sh --strict', ['pre-push']),
|
||||
'check-executables-allow-sync': (
|
||||
'bash scripts/check-executables-allow-sync.sh', ['pre-push']),
|
||||
'apm-audit-ci': (
|
||||
'bash -c \'for d in . plugins/*/; do (cd "$d" && apm audit --ci) || '
|
||||
'{ echo "apm audit --ci failed in $d" >&2; exit 1; }; done\'',
|
||||
['pre-push']),
|
||||
'check-apm-agents-valid': (
|
||||
'bash scripts/check-apm-agents-valid.sh', ['pre-push']),
|
||||
'apm-pack-check-clean': (
|
||||
'apm pack --check-versions --check-clean --dry-run', ['pre-push']),
|
||||
'check-scope-walkup-sync': (
|
||||
'bash scripts/check-scope-walkup-sync.sh', ['pre-push']),
|
||||
'check-skill-version-bump': (
|
||||
'bash scripts/check-skill-version-bump.sh', ['pre-push']),
|
||||
'validate-marketplace': (
|
||||
'claude plugin validate --strict .claude-plugin/marketplace.json',
|
||||
['pre-push']),
|
||||
# pre-commit
|
||||
'skill-size-check': (
|
||||
'scripts/skill-size-check.sh', ['pre-commit']),
|
||||
'check-rtk-prefix': (
|
||||
'scripts/check-rtk-prefix.sh', ['pre-commit']),
|
||||
'vale-audit-prefilter-skill': (
|
||||
'plugins/kyberforge/.apm/skills/factory-audit/scripts/vale-wrap.sh',
|
||||
['pre-commit']),
|
||||
'vale-audit-prefilter-agent': (
|
||||
'plugins/kyberforge/.apm/skills/factory-audit/scripts/vale-wrap.sh',
|
||||
['pre-commit']),
|
||||
}
|
||||
|
||||
path = os.path.join(root, '.pre-commit-config.yaml')
|
||||
try:
|
||||
with open(path, encoding='utf-8') as fh:
|
||||
cfg = yaml.safe_load(fh) or {}
|
||||
except Exception as exc:
|
||||
emit('FAIL', '.pre-commit-config.yaml did not parse: %s' % exc)
|
||||
sys.exit(0)
|
||||
|
||||
local = {}
|
||||
duplicates = []
|
||||
for repo in cfg.get('repos') or []:
|
||||
if repo.get('repo') != 'local':
|
||||
continue
|
||||
for hook in (repo.get('hooks') or []):
|
||||
hid = hook.get('id')
|
||||
if hid in local:
|
||||
duplicates.append(hid)
|
||||
local[hid] = hook
|
||||
|
||||
# Non-vacuity, first. Every assertion below iterates the derived set, so an
|
||||
# empty one would report nothing and the section would pass having checked
|
||||
# nothing at all -- the same shape of silent hole this whole file exists to
|
||||
# close.
|
||||
if not EXPECTED:
|
||||
emit('FAIL', 'the expected repo-authored hook list is empty — '
|
||||
'every wiring assertion below is vacuous')
|
||||
sys.exit(0)
|
||||
if not local:
|
||||
emit('FAIL', '.pre-commit-config.yaml declares no `repo: local` hooks at '
|
||||
'all — every gate this repo authors has been unwired, or the '
|
||||
'config moved and this assertion is now measuring nothing')
|
||||
sys.exit(0)
|
||||
emit('PASS', '.pre-commit-config.yaml declares %d repo-authored (`repo: local`) '
|
||||
'hooks — the wiring assertions below are not vacuous' % len(local))
|
||||
|
||||
if duplicates:
|
||||
emit('FAIL', '.pre-commit-config.yaml declares duplicate local hook ids '
|
||||
'(%s) — pre-commit runs one of them and the other is dead '
|
||||
'config' % ', '.join(sorted(set(duplicates))))
|
||||
|
||||
# The set, before the per-hook detail: a deleted block shows up here as a
|
||||
# missing id even if nothing else in the file changed.
|
||||
missing = sorted(set(EXPECTED) - set(local))
|
||||
extra = sorted(set(local) - set(EXPECTED))
|
||||
if missing or extra:
|
||||
parts = []
|
||||
if missing:
|
||||
parts.append('NOT WIRED in .pre-commit-config.yaml: %s' % ', '.join(missing))
|
||||
if extra:
|
||||
parts.append('wired but not pinned in this test: %s' % ', '.join(extra))
|
||||
emit('FAIL', 'the repo-authored hook set has drifted — %s. A hook that '
|
||||
'leaves the config stops running at push time while every '
|
||||
'test stays green; a hook that arrives unpinned can leave '
|
||||
'again unnoticed. Fix the config, or update EXPECTED in '
|
||||
'tests/test-adr0020-contract.sh deliberately.' % '; '.join(parts))
|
||||
else:
|
||||
emit('PASS', '.pre-commit-config.yaml wires exactly the %d expected '
|
||||
'repo-authored hooks, no more and no fewer' % len(EXPECTED))
|
||||
|
||||
# Per hook: the entry that runs and the stage it runs at. Both are single
|
||||
# tokens whose loss is invisible -- an entry repointed at a path that no longer
|
||||
# exists makes pre-commit fail loudly, but an entry repointed at a DIFFERENT
|
||||
# real script does not, and a hook moved off pre-push simply never fires.
|
||||
entry_paths = []
|
||||
for hid in sorted(EXPECTED):
|
||||
hook = local.get(hid)
|
||||
if hook is None:
|
||||
continue # already reported as missing above
|
||||
exp_entry, exp_stages = EXPECTED[hid]
|
||||
got_entry = hook.get('entry')
|
||||
got_stages = hook.get('stages')
|
||||
problems = []
|
||||
if got_entry != exp_entry:
|
||||
problems.append('entry is %r, expected %r' % (got_entry, exp_entry))
|
||||
if list(got_stages or []) != exp_stages:
|
||||
problems.append('stages is %r, expected %r — a hook at the wrong stage '
|
||||
'(or at none) never fires' % (got_stages, exp_stages))
|
||||
if problems:
|
||||
emit('FAIL', 'hook %s: %s' % (hid, '; '.join(problems)))
|
||||
else:
|
||||
emit('PASS', 'hook %s runs `%s` at %s'
|
||||
% (hid, exp_entry, ','.join(exp_stages)))
|
||||
# Collect the in-repo script/manifest paths the pinned entry names, so the
|
||||
# pin cannot agree with a config that points at nothing.
|
||||
for token in re.split(r'\s+', exp_entry):
|
||||
token = token.strip('\'"')
|
||||
if re.fullmatch(r'[A-Za-z0-9_.\-/]+\.(sh|json)', token):
|
||||
entry_paths.append((hid, token))
|
||||
|
||||
# Every pinned entry path exists on disk. Without this, EXPECTED and the config
|
||||
# could agree perfectly on a script that was deleted.
|
||||
if not entry_paths:
|
||||
emit('FAIL', 'no pinned entry named an in-repo script or manifest — the '
|
||||
'existence check below iterated zero times and proved nothing')
|
||||
else:
|
||||
broken = ['%s -> %s' % (hid, token)
|
||||
for hid, token in entry_paths
|
||||
if not os.path.exists(os.path.join(root, token))]
|
||||
if broken:
|
||||
emit('FAIL', 'pinned hook entries point at files that do not exist: %s'
|
||||
% ', '.join(broken))
|
||||
else:
|
||||
emit('PASS', 'all %d in-repo files named by a pinned hook entry exist '
|
||||
'on disk' % len(entry_paths))
|
||||
PY
|
||||
)"
|
||||
while IFS=$'\t' read -r status msg; do
|
||||
[[ -n "$status" ]] || continue
|
||||
if [[ "$status" == PASS ]]; then
|
||||
pass "$msg"
|
||||
else
|
||||
fail "$msg"
|
||||
fi
|
||||
done <<< "$WIRING_REPORT"
|
||||
|
||||
echo ""
|
||||
echo "Results: $PASS passed, $FAIL failed"
|
||||
[[ $FAIL -eq 0 ]]
|
||||
@@ -5,7 +5,7 @@
|
||||
# and agent-audit behind one auto-detecting entry point; every fixture here is a
|
||||
# skill directory, so every invocation below runs the skill flow. The agent flow
|
||||
# has no counterpart hook to differ from — there is no agent-file size gate in
|
||||
# .pre-commit-hooks.yaml — so it is out of this suite's scope, not dropped from it.
|
||||
# .pre-commit-config.yaml — so it is out of this suite's scope, not dropped from it.
|
||||
#
|
||||
# Why this exists as a separate suite. tests/test-skill-size-check.sh already
|
||||
# asserts the two agree on their CONSTANTS, and that assertion is necessary but
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
# Regression test for the two ways an ADR-0020 gate can be made to check NOTHING
|
||||
# while still exiting 0. Both were live defects, both were silent, and both sit
|
||||
# in the shared resolver block that all three scripts embed verbatim — so every
|
||||
# case below runs against all three.
|
||||
# in the shared resolver block that all three entry points run — one sourced
|
||||
# copy since 2026-09-16 — so every case below runs against all three.
|
||||
#
|
||||
# 1. THE FRONTMATTER BLOCKER. The frontmatter matcher used to be `^---\n`. A
|
||||
# UTF-8 BOM, a leading blank line, a trailing space after either marker, or
|
||||
@@ -441,6 +441,231 @@ else
|
||||
fail "validate.sh agent mode exited $SILENT_RC with output '${SILENT_OUT:-<empty>}' — the original defect was exit 0 and total silence on a blocking pre-push gate"
|
||||
fi
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# 3. The REQUIRED-FIELD checks, folded in from the deleted `skill-frontmatter`
|
||||
# ---------------------------------------------------------------------------
|
||||
# Commit c8a7c9e retired the standalone `skill-frontmatter` hook and moved its
|
||||
# two presence checks — `name` non-empty, `metadata.version` present and
|
||||
# three-part semver — into skill-size-check.sh, beside the ADR-0020 gates. The
|
||||
# hook's own suite went with it, and only the leading-zero shape was left
|
||||
# covered (tests/test-skill-size-check.sh). Measured: mutating the
|
||||
# missing-version ERROR to a no-op left every suite in the repo green. These
|
||||
# cases are that behaviour pinned back down, on the same fixtures the deleted
|
||||
# suite used.
|
||||
#
|
||||
# Probed against the HOOK alone, deliberately. validate.sh's skill mode has its
|
||||
# own metadata.version check with its own wording, and its agent mode has none
|
||||
# at all — ADR-0022 binds skills, not agents — so probe_all's "all three must
|
||||
# agree" contract does not hold for this family and asserting it would be
|
||||
# asserting something the ADRs contradict.
|
||||
#
|
||||
# The four grep defects the deleted suite named are kept as cases because the
|
||||
# YAML-parsed implementation must not regress into any of them: a `metadata:`
|
||||
# block quoted in the BODY, a `version:` under a following `source:` list, a
|
||||
# deeper-indented `version:`, and the mirror image — a `version:` far down a
|
||||
# long metadata block, which the old `-A10` grep reported MISSING.
|
||||
|
||||
# write_required <name> <frontmatter> [body] — a SKILL.md whose only interesting
|
||||
# property is its frontmatter. The description and body sit well inside every
|
||||
# ADR-0020 ceiling, so a finding here is the required-field check and nothing
|
||||
# else; a fixture that also tripped a ceiling would satisfy "exits non-zero" for
|
||||
# the wrong reason.
|
||||
write_required() {
|
||||
local name="$1" frontmatter="$2" body="${3:-Body text.}"
|
||||
local dir="$TMPDIR_T/required/$name"
|
||||
mkdir -p "$dir"
|
||||
{
|
||||
printf -- '---\n'
|
||||
printf '%s\n' "$frontmatter"
|
||||
printf -- '---\n\n'
|
||||
printf '%s\n' "$body"
|
||||
} > "$dir/SKILL.md"
|
||||
printf '%s' "$dir/SKILL.md"
|
||||
}
|
||||
|
||||
# write_required_raw <name> <whole-file> — for the shapes that must NOT have a
|
||||
# closing marker written for them.
|
||||
write_required_raw() {
|
||||
local name="$1"
|
||||
local dir="$TMPDIR_T/required/$name"
|
||||
mkdir -p "$dir"
|
||||
printf '%s' "$2" > "$dir/SKILL.md"
|
||||
printf '%s' "$dir/SKILL.md"
|
||||
}
|
||||
|
||||
REQ_DESC='Use when probing the required-field checks. Do not use for anything else.'
|
||||
|
||||
# require_finding <label> <file> <needle> — non-zero exit AND the named message.
|
||||
# The needle is the message, not the exit code: the mutation this case exists to
|
||||
# catch turns the ERROR into a no-op, and a file that also failed some other gate
|
||||
# would still exit non-zero with the check gone.
|
||||
require_finding() {
|
||||
local label="$1" file="$2" needle="$3" out status=0
|
||||
set +e
|
||||
out="$(bash "$HOOK" "$file" 2>&1)"
|
||||
status=$?
|
||||
set -e
|
||||
if [[ $status -eq 0 ]]; then
|
||||
fail "$label — the hook exited 0: ${out:-<no output>}"
|
||||
elif [[ "$out" != *"$needle"* ]]; then
|
||||
fail "$label — the hook failed but never said '$needle': $out"
|
||||
else
|
||||
pass "$label"
|
||||
fi
|
||||
}
|
||||
|
||||
# require_clean <label> <file> — exits 0 with no finding at all.
|
||||
require_clean() {
|
||||
local label="$1" file="$2" out status=0
|
||||
set +e
|
||||
out="$(bash "$HOOK" "$file" 2>&1)"
|
||||
status=$?
|
||||
set -e
|
||||
if [[ $status -eq 0 ]]; then
|
||||
pass "$label"
|
||||
else
|
||||
fail "$label — expected exit 0, got $status: ${out:-<no output>}"
|
||||
fi
|
||||
}
|
||||
|
||||
echo ""
|
||||
echo "--- control: a SKILL.md carrying both required fields passes ---"
|
||||
# Without this, every case below could be passing because the fixture generator
|
||||
# is broken rather than because the checks fire.
|
||||
require_clean "a well-formed name + metadata.version passes" \
|
||||
"$(write_required valid "name: valid
|
||||
description: $REQ_DESC
|
||||
metadata:
|
||||
version: \"1.0.0\"")"
|
||||
|
||||
echo ""
|
||||
echo "--- metadata.version missing, in each of the shapes that used to satisfy the old grep ---"
|
||||
require_finding "no metadata block at all is reported missing" \
|
||||
"$(write_required no-metadata "name: no-metadata
|
||||
description: $REQ_DESC")" \
|
||||
"metadata.version field is missing"
|
||||
require_finding "a metadata block with other keys but no version is reported missing" \
|
||||
"$(write_required metadata-no-version "name: metadata-no-version
|
||||
description: $REQ_DESC
|
||||
metadata:
|
||||
author: someone")" \
|
||||
"metadata.version field is missing"
|
||||
# `version:` with no value parses to None, which is absent, not malformed —
|
||||
# reporting it as a bad VALUE would send the author looking for a typo in a
|
||||
# value that is not there.
|
||||
require_finding "a valueless 'version:' is reported missing, not malformed" \
|
||||
"$(write_required empty-version "name: empty-version
|
||||
description: $REQ_DESC
|
||||
metadata:
|
||||
version:")" \
|
||||
"metadata.version field is missing"
|
||||
# skill-author's own docs quote a metadata block verbatim; under the old
|
||||
# whole-file grep that quotation satisfied the check for the file quoting it.
|
||||
require_finding "a metadata block quoted in the BODY does not satisfy the check" \
|
||||
"$(write_required fenced-metadata "name: fenced-metadata
|
||||
description: $REQ_DESC" '# Fenced
|
||||
|
||||
Skills declare their version like this:
|
||||
|
||||
```yaml
|
||||
metadata:
|
||||
version: "1.0.0"
|
||||
```')" \
|
||||
"metadata.version field is missing"
|
||||
# `-A10` ran ten lines past `metadata:` regardless of where the block ended, and
|
||||
# write-docs and research both carry a `source:` list immediately after it.
|
||||
require_finding "a version: belonging to a following source[] does not satisfy the check" \
|
||||
"$(write_required source-list "name: source-list
|
||||
description: $REQ_DESC
|
||||
metadata:
|
||||
author: someone
|
||||
source:
|
||||
- name: upstream
|
||||
version: \"2.3.4\"")" \
|
||||
"metadata.version field is missing"
|
||||
# `grep -q \" version:\"` was an unanchored substring match, so any indentation
|
||||
# of two spaces or more matched.
|
||||
require_finding "a four-space-indented version: one level deeper does not satisfy the check" \
|
||||
"$(write_required deep-indent "name: deep-indent
|
||||
description: $REQ_DESC
|
||||
metadata:
|
||||
provenance:
|
||||
version: \"1.0.0\"")" \
|
||||
"metadata.version field is missing"
|
||||
# The mirror image, and the reason this one asserts a PASS: the old grep's
|
||||
# ten-line window reported a real version missing once the block grew past it.
|
||||
require_clean "a version: thirteen lines into the metadata block is found" \
|
||||
"$(write_required long-metadata "name: long-metadata
|
||||
description: $REQ_DESC
|
||||
metadata:
|
||||
a: 1
|
||||
b: 2
|
||||
c: 3
|
||||
d: 4
|
||||
e: 5
|
||||
f: 6
|
||||
g: 7
|
||||
h: 8
|
||||
i: 9
|
||||
j: 10
|
||||
k: 11
|
||||
version: \"1.0.0\"")"
|
||||
|
||||
echo ""
|
||||
echo "--- present is not well formed: a non-semver metadata.version is its own finding ---"
|
||||
# plugins/bin/.apm/skills/write-docs/SKILL.md carried `version: "1.0"` through a
|
||||
# whole PR under a presence-only check: present, well-nested, and not a version.
|
||||
# The value is quoted back so the author does not have to guess which key.
|
||||
require_finding "'1.0' is rejected as malformed and the message quotes it" \
|
||||
"$(write_required two-part "name: two-part
|
||||
description: $REQ_DESC
|
||||
metadata:
|
||||
version: \"1.0\"")" \
|
||||
"metadata.version is malformed ('1.0')"
|
||||
require_finding "'latest' is rejected as malformed and the message quotes it" \
|
||||
"$(write_required word-version "name: word-version
|
||||
description: $REQ_DESC
|
||||
metadata:
|
||||
version: latest")" \
|
||||
"metadata.version is malformed ('latest')"
|
||||
|
||||
echo ""
|
||||
echo "--- the name field is required and must not be empty ---"
|
||||
require_finding "an absent name is reported" \
|
||||
"$(write_required no-name "description: $REQ_DESC
|
||||
metadata:
|
||||
version: \"1.0.0\"")" \
|
||||
"name field is missing or empty"
|
||||
require_finding "an empty name is reported" \
|
||||
"$(write_required empty-name "name: \"\"
|
||||
description: $REQ_DESC
|
||||
metadata:
|
||||
version: \"1.0.0\"")" \
|
||||
"name field is missing or empty"
|
||||
|
||||
echo ""
|
||||
echo "--- a file whose frontmatter block cannot be read reports THAT, not a missing field ---"
|
||||
# The required-field checks run downstream of the frontmatter match, so a file
|
||||
# with no readable block must land on the parse error rather than being reported
|
||||
# as a skill that merely forgot its version — and must never report green.
|
||||
require_finding "an unterminated frontmatter block is a parse error" \
|
||||
"$(write_required_raw unterminated "---
|
||||
name: unterminated
|
||||
description: $REQ_DESC
|
||||
metadata:
|
||||
version: \"1.0.0\"
|
||||
|
||||
Body text.
|
||||
")" \
|
||||
"no parseable YAML frontmatter block"
|
||||
require_finding "an empty '---/---' block is a parse error" \
|
||||
"$(write_required_raw empty-block "---
|
||||
---
|
||||
|
||||
Body text.
|
||||
")" \
|
||||
"no parseable YAML frontmatter block"
|
||||
|
||||
echo ""
|
||||
echo "Results: $PASS passed, $FAIL failed"
|
||||
[[ $FAIL -eq 0 ]]
|
||||
@@ -442,6 +442,24 @@ fi
|
||||
# terminal and therefore danglable. The issue #99 retrofit cut that composition
|
||||
# sentence and the dangling target went with it, so the set is down to one.
|
||||
#
|
||||
# Correction (2026-09-20): the historical text carried NO backticks. `7801589^`
|
||||
# has gitea-issues' description as "Composes gitea-labels-\n milestones for all
|
||||
# label inference/resolution and milestone lookup", bare, so the token was read
|
||||
# by the route-verb path — `Composes` is a ROUTE_VERB and the name matched
|
||||
# NAME_HYPH — and not by the backtick sweep. Everything the paragraph above says
|
||||
# about the fold and the trailing hyphen holds; only the spelling is wrong.
|
||||
#
|
||||
# The spelling is the load-bearing part, because the two are not equally
|
||||
# visible. Backticked, that same wrap reaches every extractor as
|
||||
# `` `gitea-labels- milestones` ``, which none of them can read: the opening
|
||||
# backtick blocks the bare NAME_HYPH alternative and the space inside blocks the
|
||||
# backticked one. Bare, it was extracted and reported all along, which is the
|
||||
# only reason this dangling target was ever measured. In an ARROW clause the
|
||||
# backticked wrap was silent until the 2026-09-20 fix to
|
||||
# boundary_clause_status() in the shared resolver made the unparsed diagnostic
|
||||
# per clause: before it, one sibling clause that parsed suppressed the finding
|
||||
# for the whole description.
|
||||
#
|
||||
# `neuledge-context` was the last one. The issue #99 wave-3 retrofit deleted that
|
||||
# boundary clause outright — commit `6146120` had already deleted the skill it
|
||||
# named, and nothing has owned MCP-server installation since — so the corpus
|
||||
|
||||
@@ -21,6 +21,11 @@ command -v python3 > /dev/null 2>&1 || { echo "python3 required"; exit 77; }
|
||||
FAKE_BIN="$(mktemp -d)"
|
||||
WORK="$(mktemp -d)"
|
||||
trap 'rm -rf "$FAKE_BIN" "$WORK"' EXIT
|
||||
# The hook asks git which branch it is on. Stop git's discovery at the temp
|
||||
# root so a $TMPDIR that happens to sit inside a checkout cannot leak a branch
|
||||
# into the fixtures that are meant to be outside one.
|
||||
export GIT_CEILING_DIRECTORIES
|
||||
GIT_CEILING_DIRECTORIES="$(dirname "$WORK")"
|
||||
|
||||
# Mock `apm`. $1 chooses what `apm outdated` reports; $2 the exit code of
|
||||
# `apm update`. Sentinel files record whether update was actually invoked and
|
||||
@@ -124,6 +129,92 @@ else
|
||||
fail "emits valid JSON"
|
||||
fi
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
echo ""
|
||||
echo "--- lock advice follows the branch ---"
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# ADR-0019: on the default branch the rewritten lock is a real update to commit or
|
||||
# discard; on a feature branch it is unrelated churn to discard. Outside a git
|
||||
# checkout (the fixture above) the neutral advice stands.
|
||||
advice_of() { json_field additionalContext <<< "$1"; }
|
||||
grep -q "commit it or discard it deliberately" <<< "$(advice_of "$out")" \
|
||||
&& pass "gives neutral lock advice outside a git checkout" \
|
||||
|| fail "outside a git checkout the advice should stay neutral"
|
||||
|
||||
if command -v git > /dev/null 2>&1; then
|
||||
REPO="$WORK/repo"
|
||||
mkdir -p "$REPO"
|
||||
git -C "$REPO" init -q -b main
|
||||
git -C "$REPO" -c user.email=[email protected] -c user.name=probe \
|
||||
commit -q --allow-empty -m init
|
||||
touch "$REPO/apm.lock.yaml"
|
||||
|
||||
# origin/HEAD is unset here — git writes it on clone and `git remote add` does
|
||||
# not — so the hook cannot know what the default branch is and must not guess.
|
||||
# It used to assume `main`, which is why the `master` case further down was a
|
||||
# live defect.
|
||||
out="$(run_hook_in "$REPO" "$REPO")"
|
||||
advice="$(advice_of "$out")"
|
||||
grep -q "commit it or discard it deliberately" <<< "$advice" \
|
||||
&& pass "with origin/HEAD unset, keeps the neutral lock advice" \
|
||||
|| fail "with origin/HEAD unset the advice should stay neutral: $advice"
|
||||
# Needles are the two DECISION phrases, not the bare words: the fixed prefix
|
||||
# of every notice already says "behind the remote default branch".
|
||||
grep -qE "this is (the default|a feature) branch, so" <<< "$advice" \
|
||||
&& fail "with origin/HEAD unset the hook must not claim to know which branch this is: $advice" \
|
||||
|| pass "with origin/HEAD unset, claims nothing about which branch this is"
|
||||
|
||||
git -C "$REPO" update-ref refs/remotes/origin/main HEAD
|
||||
git -C "$REPO" symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main
|
||||
out="$(run_hook_in "$REPO" "$REPO")"
|
||||
grep -q "default branch, so commit it or discard it deliberately" <<< "$(advice_of "$out")" \
|
||||
&& pass "on main, says to commit or discard the lock deliberately" \
|
||||
|| fail "on main the advice should be commit-or-discard: $(advice_of "$out")"
|
||||
|
||||
git -C "$REPO" checkout -q -b feature/x
|
||||
out="$(run_hook_in "$REPO" "$REPO")"
|
||||
advice="$(advice_of "$out")"
|
||||
grep -qF "feature branch, so discard it: git checkout -- apm.lock.yaml && apm install" <<< "$advice" \
|
||||
&& pass "on a feature branch, says to discard the lock and reinstall" \
|
||||
|| fail "on a feature branch the advice should be discard-and-install: $advice"
|
||||
grep -q "commit it" <<< "$advice" \
|
||||
&& fail "on a feature branch the advice must not suggest committing the lock" \
|
||||
|| pass "on a feature branch, does not suggest committing the lock"
|
||||
echo "$out" | python3 -m json.tool > /dev/null 2>&1 \
|
||||
&& pass "feature-branch notice is valid JSON" || fail "feature-branch notice broke the JSON"
|
||||
|
||||
# A remote whose default branch is not `main` is honoured via origin/HEAD.
|
||||
git -C "$REPO" update-ref refs/remotes/origin/feature/x HEAD
|
||||
git -C "$REPO" symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/feature/x
|
||||
out="$(run_hook_in "$REPO" "$REPO")"
|
||||
grep -q "default branch, so commit it" <<< "$(advice_of "$out")" \
|
||||
&& pass "reads the default branch from origin/HEAD when it is set" \
|
||||
|| fail "should treat origin/HEAD's branch as the default: $(advice_of "$out")"
|
||||
|
||||
# The regression the `${default_branch:-main}` fallback caused: a repo whose
|
||||
# default branch is `master`, with origin/HEAD unset (no clone wrote it), was
|
||||
# standing on its DEFAULT branch and was told to discard the lock as feature
|
||||
# churn. Assuming `main` is the only way to reach that verdict, so the case is
|
||||
# pinned on the branch name that makes the assumption wrong.
|
||||
MASTER_REPO="$WORK/master-repo"
|
||||
mkdir -p "$MASTER_REPO"
|
||||
git -C "$MASTER_REPO" init -q -b master
|
||||
git -C "$MASTER_REPO" -c user.email=[email protected] -c user.name=probe \
|
||||
commit -q --allow-empty -m init
|
||||
touch "$MASTER_REPO/apm.lock.yaml"
|
||||
out="$(run_hook_in "$MASTER_REPO" "$MASTER_REPO")"
|
||||
advice="$(advice_of "$out")"
|
||||
grep -qF "feature branch, so discard it" <<< "$advice" \
|
||||
&& fail "on master with origin/HEAD unset the hook assumed main and told the reader to discard a real lock update: $advice" \
|
||||
|| pass "on master with origin/HEAD unset, does not misread the default branch as a feature branch"
|
||||
grep -q "commit it or discard it deliberately" <<< "$advice" \
|
||||
&& pass "on master with origin/HEAD unset, falls back to the neutral lock advice" \
|
||||
|| fail "on master with origin/HEAD unset the advice should be neutral: $advice"
|
||||
else
|
||||
echo " (git not on PATH — branch-specific advice cases not run)"
|
||||
fi
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
echo ""
|
||||
echo "--- stale, refresh fails ---"
|
||||
|
||||
@@ -1,449 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
SCRIPT="$REPO_ROOT/scripts/check-release-needed.sh"
|
||||
PASS=0
|
||||
FAIL=0
|
||||
|
||||
pass() { echo " PASS: $1"; PASS=$((PASS + 1)); }
|
||||
fail() { echo " FAIL: $1"; FAIL=$((FAIL + 1)); }
|
||||
|
||||
# Output assertions are `grep -q PATTERN <<< "$OUT"`, never `echo "$OUT" | grep -q`.
|
||||
# Under pipefail the pipe form is scheduling-dependent: bash's echo writes a
|
||||
# multi-line value one line at a time, `grep -q` exits on its first match, and a
|
||||
# later line then hits a closed pipe. echo dies of SIGPIPE, pipefail reports the
|
||||
# pipeline as failed, and a correct output reads as a missing match. The
|
||||
# here-string has no writer process to race.
|
||||
|
||||
# Both entry shapes the real .pre-commit-hooks.yaml ships: a bare script with no
|
||||
# bundled data, and a bare script whose sibling assets/ tree it self-locates at
|
||||
# runtime. Neither carries arguments — pre-commit only rewrites entry[0] to the
|
||||
# hook-repo clone path, so an argument path would resolve against the consuming
|
||||
# repo. RELEASE_PATHS is derived from the manifest rather than hand-maintained,
|
||||
# so it has to cope with both.
|
||||
HOOK_DIR="plugins/demo/skills/demo-audit"
|
||||
|
||||
write_manifest() {
|
||||
local dir="$1"
|
||||
cat > "$dir/.pre-commit-hooks.yaml" <<EOF
|
||||
- id: fake-size-check
|
||||
entry: scripts/skill-size-check.sh
|
||||
language: script
|
||||
- id: fake-vale-check
|
||||
entry: $HOOK_DIR/scripts/vale-wrap.sh
|
||||
language: script
|
||||
EOF
|
||||
}
|
||||
|
||||
# Helper: writes the files both manifest entries expose — the two hook scripts
|
||||
# plus the bundled Vale config and style rule the second one self-locates.
|
||||
write_release_paths() {
|
||||
local dir="$1"
|
||||
mkdir -p "$dir/scripts" "$dir/$HOOK_DIR/scripts" "$dir/$HOOK_DIR/assets/vale/styles/Kyberforge"
|
||||
echo "v1" > "$dir/scripts/skill-size-check.sh"
|
||||
echo "v1" > "$dir/$HOOK_DIR/scripts/vale-wrap.sh"
|
||||
echo "cfg" > "$dir/$HOOK_DIR/assets/vale/.vale.ini"
|
||||
echo "rule: v1" > "$dir/$HOOK_DIR/assets/vale/styles/Kyberforge/DemoRule.yml"
|
||||
}
|
||||
|
||||
# Helper: a fixture repo with a manifest and every release-relevant path it
|
||||
# exposes, committed and tagged v1.0.0.
|
||||
make_tagged_fixture() {
|
||||
local dir
|
||||
dir="$(mktemp -d)"
|
||||
(cd "$dir" && git init -q && git config user.email [email protected] && git config user.name t)
|
||||
write_manifest "$dir"
|
||||
write_release_paths "$dir"
|
||||
(cd "$dir" && git add -A && git commit -q -m "initial" && git tag v1.0.0)
|
||||
echo "$dir"
|
||||
}
|
||||
|
||||
# Helper: a fixture whose manifest carries one malformed entry: at the tag *and*
|
||||
# at HEAD, plus a post-tag change to the file that entry was meant to cover.
|
||||
# Committing the bad entry before the tag is what makes the assertion sharp — an
|
||||
# edited manifest is itself release-relevant, so the gate would fail for the
|
||||
# wrong reason and hide a parser that degrades silently.
|
||||
make_malformed_fixture() {
|
||||
local entry="$1" dir
|
||||
dir="$(mktemp -d)"
|
||||
(cd "$dir" && git init -q && git config user.email [email protected] && git config user.name t)
|
||||
write_release_paths "$dir"
|
||||
cat > "$dir/.pre-commit-hooks.yaml" <<EOF
|
||||
- id: fake-size-check
|
||||
entry: $entry
|
||||
language: script
|
||||
EOF
|
||||
(cd "$dir" && git add -A && git commit -q -m "initial" && git tag v1.0.0)
|
||||
echo "v2" > "$dir/scripts/skill-size-check.sh"
|
||||
(cd "$dir" && git add -A && git commit -q -m "change the file the malformed entry should cover")
|
||||
echo "$dir"
|
||||
}
|
||||
|
||||
# $3 is optional: pre-commit's PRE_COMMIT_TO_REF, the local sha being pushed.
|
||||
# Left off entirely, the variable stays unset and the script falls back to HEAD,
|
||||
# exactly as a plain `git push <remote> <current-branch>` behaves.
|
||||
# The fixture repo is the subject under test, so every PRE_COMMIT_* input must
|
||||
# come from this function and nowhere else. Any such variable already in the
|
||||
# environment belongs to the *caller's* repo: run under the pre-push hook this
|
||||
# suite guards, PRE_COMMIT_TO_REF holds a sha of the real repo, which does not
|
||||
# exist in the fixture, and the script resolves against the wrong rev. Clearing
|
||||
# them is what makes a standalone run and a pre-push run the same test — this
|
||||
# suite passed everywhere except under the hook it exists to protect.
|
||||
run_check() {
|
||||
local dir="$1" branch="$2"
|
||||
if [[ $# -ge 3 ]]; then
|
||||
(cd "$dir" && unset PRE_COMMIT_FROM_REF \
|
||||
&& PRE_COMMIT_REMOTE_BRANCH="$branch" PRE_COMMIT_TO_REF="$3" bash "$SCRIPT" 2>&1)
|
||||
else
|
||||
(cd "$dir" && unset PRE_COMMIT_FROM_REF PRE_COMMIT_TO_REF \
|
||||
&& PRE_COMMIT_REMOTE_BRANCH="$branch" bash "$SCRIPT" 2>&1)
|
||||
fi
|
||||
}
|
||||
|
||||
CLEANUP_DIRS=()
|
||||
trap 'rm -rf ${CLEANUP_DIRS[@]+"${CLEANUP_DIRS[@]}"}' EXIT
|
||||
track() { CLEANUP_DIRS+=("$1"); }
|
||||
|
||||
# --- 1. Not targeting main: silent no-op regardless of state ---
|
||||
echo ""
|
||||
echo "--- exits 0 when not pushing to main, even with no tags ---"
|
||||
FIXTURE1="$(mktemp -d)"; track "$FIXTURE1"
|
||||
(cd "$FIXTURE1" && git init -q)
|
||||
if run_check "$FIXTURE1" "refs/heads/feature-branch" > /dev/null; then
|
||||
pass "exits 0 when target branch isn't main"
|
||||
else
|
||||
fail "exited non-zero on a non-main target branch"
|
||||
fi
|
||||
|
||||
# --- 2. Targeting main, no tag exists at all: hard fail ---
|
||||
echo ""
|
||||
echo "--- exits 1 when targeting main and no tag exists ---"
|
||||
FIXTURE2="$(mktemp -d)"; track "$FIXTURE2"
|
||||
(cd "$FIXTURE2" && git init -q && git config user.email [email protected] && git config user.name t)
|
||||
write_manifest "$FIXTURE2"
|
||||
write_release_paths "$FIXTURE2"
|
||||
(cd "$FIXTURE2" && git add -A && git commit -q -m "initial")
|
||||
if run_check "$FIXTURE2" "refs/heads/main" > /dev/null; then
|
||||
fail "exited 0 when targeting main with no tag — expected exit 1"
|
||||
else
|
||||
pass "exits non-zero when targeting main and no tag exists yet"
|
||||
fi
|
||||
|
||||
# --- 3. Targeting main, tag exists, no release-relevant changes since: passes ---
|
||||
echo ""
|
||||
echo "--- exits 0 when targeting main and nothing release-relevant changed since the tag ---"
|
||||
FIXTURE3="$(make_tagged_fixture)"; track "$FIXTURE3"
|
||||
echo "unrelated" > "$FIXTURE3/README.md"
|
||||
(cd "$FIXTURE3" && git add -A && git commit -q -m "unrelated change")
|
||||
if run_check "$FIXTURE3" "refs/heads/main" > /dev/null; then
|
||||
pass "exits 0 when only unrelated files changed since the tag"
|
||||
else
|
||||
fail "exited non-zero despite no release-relevant changes since the tag"
|
||||
fi
|
||||
|
||||
# --- 4. Targeting main, tag exists, a release-relevant file changed since: hard fail ---
|
||||
echo ""
|
||||
echo "--- exits 1 when a release-relevant file changed since the tag ---"
|
||||
FIXTURE4="$(make_tagged_fixture)"; track "$FIXTURE4"
|
||||
echo "v2" > "$FIXTURE4/scripts/skill-size-check.sh"
|
||||
(cd "$FIXTURE4" && git add -A && git commit -q -m "update release-relevant script")
|
||||
OUT4=$(run_check "$FIXTURE4" "refs/heads/main" || true)
|
||||
if grep -q "skill-size-check.sh" <<< "$OUT4"; then
|
||||
pass "exits non-zero and names the changed file when a release-relevant path changed since the tag"
|
||||
else
|
||||
fail "did not flag the release-relevant file that changed since the tag"
|
||||
fi
|
||||
|
||||
# --- 5. Not targeting main even with release-relevant changes and a tag: still a no-op ---
|
||||
echo ""
|
||||
echo "--- exits 0 on a feature branch even with release-relevant changes since the tag ---"
|
||||
FIXTURE5="$(make_tagged_fixture)"; track "$FIXTURE5"
|
||||
echo "v2" > "$FIXTURE5/scripts/skill-size-check.sh"
|
||||
(cd "$FIXTURE5" && git add -A && git commit -q -m "update release-relevant script")
|
||||
if run_check "$FIXTURE5" "refs/heads/some-feature" > /dev/null; then
|
||||
pass "exits 0 on a feature branch regardless of un-tagged release-relevant changes"
|
||||
else
|
||||
fail "hard-failed on a feature branch — should only ever fail when targeting main"
|
||||
fi
|
||||
|
||||
# --- 6. A release-relevant path deleted since the tag is still flagged ---
|
||||
echo ""
|
||||
echo "--- exits 1 when a release-relevant path was deleted since the tag, not just modified ---"
|
||||
FIXTURE6="$(make_tagged_fixture)"; track "$FIXTURE6"
|
||||
rm -f "$FIXTURE6/$HOOK_DIR/assets/vale/.vale.ini"
|
||||
(cd "$FIXTURE6" && git add -A && git commit -q -m "delete the bundled vale config")
|
||||
OUT6=$(run_check "$FIXTURE6" "refs/heads/main" || true)
|
||||
if grep -q "assets/vale/.vale.ini" <<< "$OUT6"; then
|
||||
pass "flags a deleted release-relevant path instead of silently dropping it from the diff"
|
||||
else
|
||||
fail "did not flag deletion of a release-relevant path since the tag"
|
||||
fi
|
||||
|
||||
# --- 7. A git diff failure hard-fails instead of reading as a clean pass ---
|
||||
echo ""
|
||||
echo "--- exits 1 (not a silent pass) when the underlying git diff errors out ---"
|
||||
FIXTURE7="$(make_tagged_fixture)"; track "$FIXTURE7"
|
||||
TAG_TREE="$(cd "$FIXTURE7" && git rev-parse 'v1.0.0^{tree}')"
|
||||
echo "v2" > "$FIXTURE7/scripts/skill-size-check.sh"
|
||||
(cd "$FIXTURE7" && git add -A && git commit -q -m "advance past the tag")
|
||||
rm -f "$FIXTURE7/.git/objects/${TAG_TREE:0:2}/${TAG_TREE:2}"
|
||||
if run_check "$FIXTURE7" "refs/heads/main" > /dev/null; then
|
||||
fail "silently exited 0 when the underlying git diff failed"
|
||||
else
|
||||
pass "hard-fails instead of silently passing when git diff can't be computed"
|
||||
fi
|
||||
|
||||
# --- 8. A non-version tag reachable from HEAD does not become the diff baseline ---
|
||||
echo ""
|
||||
echo "--- ignores a non-vX.Y.Z tag and still flags a change since the real release tag ---"
|
||||
FIXTURE8="$(make_tagged_fixture)"; track "$FIXTURE8"
|
||||
echo "checkpoint" > "$FIXTURE8/scripts/skill-size-check.sh"
|
||||
(cd "$FIXTURE8" && git add -A && git commit -q -m "checkpoint work" && git tag checkpoint-1)
|
||||
echo "v2" > "$FIXTURE8/scripts/skill-size-check.sh"
|
||||
(cd "$FIXTURE8" && git add -A && git commit -q -m "real release-relevant change")
|
||||
OUT8=$(run_check "$FIXTURE8" "refs/heads/main" || true)
|
||||
if grep -q "skill-size-check.sh" <<< "$OUT8"; then
|
||||
pass "still flags the release-relevant change since v1.0.0, ignoring the non-version checkpoint tag"
|
||||
else
|
||||
fail "an incidental non-version tag shifted the baseline and hid a real release-relevant change"
|
||||
fi
|
||||
|
||||
# --- 9. A file outside every manifest entry does not trigger a fail ---
|
||||
echo ""
|
||||
echo "--- exits 0 when a changed file sits near, but isn't referenced by, a manifest entry ---"
|
||||
FIXTURE9="$(make_tagged_fixture)"; track "$FIXTURE9"
|
||||
echo "irrelevant" > "$FIXTURE9/scripts/unrelated-helper.sh"
|
||||
(cd "$FIXTURE9" && git add -A && git commit -q -m "add an unrelated script alongside the exposed one")
|
||||
if run_check "$FIXTURE9" "refs/heads/main" > /dev/null; then
|
||||
pass "exits 0 for a file that lives alongside, but isn't referenced by, any manifest entry"
|
||||
else
|
||||
fail "flagged a file that no .pre-commit-hooks.yaml entry actually exposes"
|
||||
fi
|
||||
|
||||
# --- 10. A change confined to a hook's bundled styles/ tree is release-relevant ---
|
||||
# The manifest entry names only the wrapper script; the Vale rules it enforces
|
||||
# live in the sibling assets/ tree it self-locates at runtime. If that tree is
|
||||
# not covered, editing a rule and landing it on main demands no new tag, and a
|
||||
# consumer pinned to the old rev keeps the stale rules forever.
|
||||
echo ""
|
||||
echo "--- exits 1 when only a bundled Vale style rule changed since the tag ---"
|
||||
FIXTURE10="$(make_tagged_fixture)"; track "$FIXTURE10"
|
||||
echo "rule: v2" > "$FIXTURE10/$HOOK_DIR/assets/vale/styles/Kyberforge/DemoRule.yml"
|
||||
(cd "$FIXTURE10" && git add -A && git commit -q -m "tighten a vale rule")
|
||||
OUT10=$(run_check "$FIXTURE10" "refs/heads/main" || true)
|
||||
if grep -q "assets/vale/styles/Kyberforge/DemoRule.yml" <<< "$OUT10"; then
|
||||
pass "flags a change confined to a hook's bundled assets/vale/styles/ tree"
|
||||
else
|
||||
fail "a bundled Vale style rule changed since the tag without demanding a release"
|
||||
fi
|
||||
|
||||
# --- 11. The assets/ derivation must not invent a path for a bundle-less hook ---
|
||||
# scripts/skill-size-check.sh has no sibling assets/ tree, so its derived
|
||||
# candidate normalises to a bare top-level assets/ — a directory this repo does
|
||||
# not ship. Adding it unconditionally would make any unrelated repo-root
|
||||
# assets/ file falsely demand a release.
|
||||
echo ""
|
||||
echo "--- exits 0 when a top-level assets/ file changed but no hook bundles one ---"
|
||||
FIXTURE11="$(make_tagged_fixture)"; track "$FIXTURE11"
|
||||
mkdir -p "$FIXTURE11/assets"
|
||||
echo "unrelated" > "$FIXTURE11/assets/logo.txt"
|
||||
(cd "$FIXTURE11" && git add -A && git commit -q -m "add an unrelated top-level assets file")
|
||||
if run_check "$FIXTURE11" "refs/heads/main" > /dev/null; then
|
||||
pass "exits 0 for a top-level assets/ file that no manifest entry bundles"
|
||||
else
|
||||
fail "invented a bogus assets/ path for a hook script with no bundled tree"
|
||||
fi
|
||||
|
||||
# --- 12. Deleting a hook's entire bundled assets/ tree is release-relevant ---
|
||||
# The worktree-only derivation guarded the assets/ path on the directory still
|
||||
# existing, so wiping the whole tree removed the path from the pathspec instead
|
||||
# of diffing it: the single most consumer-breaking change possible diffed clean.
|
||||
# The path list therefore has to be unioned with what $LAST_TAG exposed.
|
||||
echo ""
|
||||
echo "--- exits 1 when a hook's entire bundled assets/ tree was deleted since the tag ---"
|
||||
FIXTURE12="$(make_tagged_fixture)"; track "$FIXTURE12"
|
||||
rm -rf "${FIXTURE12:?}/$HOOK_DIR/assets"
|
||||
(cd "$FIXTURE12" && git add -A && git commit -q -m "delete the whole bundled assets tree")
|
||||
OUT12=$(run_check "$FIXTURE12" "refs/heads/main" || true)
|
||||
if grep -q "assets/vale/.vale.ini" <<< "$OUT12"; then
|
||||
pass "flags a wholesale deletion of a hook's bundled assets/ tree"
|
||||
else
|
||||
fail "a hook's entire bundled assets/ tree vanished since the tag without demanding a release"
|
||||
fi
|
||||
|
||||
# --- 13. A hook script deleted while its manifest entry survives is flagged ---
|
||||
# Characterisation test, not a bug fix: tokens[0] is added to the pathspec
|
||||
# unconditionally (no existence guard), so this case was already covered. It is
|
||||
# pinned here so the tagged-tree union can't accidentally introduce an existence
|
||||
# guard on tokens[0] and reopen the hole its assets/ sibling had.
|
||||
echo ""
|
||||
echo "--- exits 1 when a hook script was deleted but its manifest entry remains ---"
|
||||
FIXTURE13="$(make_tagged_fixture)"; track "$FIXTURE13"
|
||||
rm -f "$FIXTURE13/$HOOK_DIR/scripts/vale-wrap.sh"
|
||||
(cd "$FIXTURE13" && git add -A && git commit -q -m "delete a hook script, keep its manifest entry")
|
||||
OUT13=$(run_check "$FIXTURE13" "refs/heads/main" || true)
|
||||
if grep -q "vale-wrap.sh" <<< "$OUT13"; then
|
||||
pass "flags a hook script deleted out from under a surviving manifest entry"
|
||||
else
|
||||
fail "a manifest entry's script vanished since the tag without demanding a release"
|
||||
fi
|
||||
|
||||
# --- 14. Retiring a whole hook names what the tag exposed, not just the manifest ---
|
||||
# Removing the entry and everything it shipped changes $HOOKS_MANIFEST, so the
|
||||
# gate fires either way — but a derivation that only reads the current manifest
|
||||
# can no longer name the retired script or its assets, and the failure message
|
||||
# understates the breakage to consumers pinned at the old rev. The tagged
|
||||
# manifest is what makes those paths reportable.
|
||||
echo ""
|
||||
echo "--- names the retired hook's own paths when an entry and its files are removed together ---"
|
||||
FIXTURE14="$(make_tagged_fixture)"; track "$FIXTURE14"
|
||||
cat > "$FIXTURE14/.pre-commit-hooks.yaml" <<'EOF'
|
||||
- id: fake-size-check
|
||||
entry: scripts/skill-size-check.sh
|
||||
language: script
|
||||
EOF
|
||||
rm -rf "${FIXTURE14:?}/$HOOK_DIR"
|
||||
(cd "$FIXTURE14" && git add -A && git commit -q -m "retire the vale hook entirely")
|
||||
OUT14=$(run_check "$FIXTURE14" "refs/heads/main" || true)
|
||||
if grep -q "vale-wrap.sh" <<< "$OUT14" && grep -q "assets/vale/.vale.ini" <<< "$OUT14"; then
|
||||
pass "names the retired hook's script and bundled assets, not just the manifest edit"
|
||||
else
|
||||
fail "reported only the manifest change and hid which shipped paths the retirement removed"
|
||||
fi
|
||||
|
||||
# --- 15. A multi-token entry: is rejected loudly, not silently mis-parsed ---
|
||||
# ADR-0014 binds entries to a bare script path, but nothing enforced it, and the
|
||||
# sibling .pre-commit-config.yaml already ships `entry: bash <script>`. Under the
|
||||
# old parser tokens[0] became "bash": a pathspec matching nothing (which git diff
|
||||
# accepts in silence) and a bundle root of "." (skipped), so the hook's whole
|
||||
# surface dropped out of the gate and the post-tag change below diffed clean.
|
||||
echo ""
|
||||
echo "--- exits 1 naming the hook when an entry: carries more than one token ---"
|
||||
# The entry is quoted back verbatim, not just its first token: that is what makes
|
||||
# the diagnostic point at the argument the author has to remove, and what
|
||||
# distinguishes this from the unresolvable-path rejection test 16 covers.
|
||||
FIXTURE15="$(make_malformed_fixture "bash scripts/skill-size-check.sh")"; track "$FIXTURE15"
|
||||
OUT15=$(run_check "$FIXTURE15" "refs/heads/main" || true)
|
||||
if run_check "$FIXTURE15" "refs/heads/main" > /dev/null; then
|
||||
fail "silently exited 0 on a multi-token entry, dropping that hook's paths from the gate"
|
||||
elif grep -q "fake-size-check" <<< "$OUT15" \
|
||||
&& grep -q "bash scripts/skill-size-check.sh" <<< "$OUT15" \
|
||||
&& grep -q "ADR-0014" <<< "$OUT15"; then
|
||||
pass "rejects a multi-token entry, quoting it back and naming the hook and ADR-0014"
|
||||
else
|
||||
fail "rejected the multi-token entry without naming the hook, the entry, and ADR-0014"
|
||||
fi
|
||||
|
||||
# --- 16. An entry naming no file this repo ships is rejected loudly ---
|
||||
# The token-count guard alone still lets a single bare command name (`entry:
|
||||
# vale`, valid for language: system) through as a pathspec matching nothing.
|
||||
# Existence is checked against the union of the worktree and $LAST_TAG, so this
|
||||
# cannot misfire on the deletion cases tests 12-14 pin.
|
||||
echo ""
|
||||
echo "--- exits 1 naming the hook when an entry: names no file in the worktree or at the tag ---"
|
||||
FIXTURE16="$(make_malformed_fixture "vale")"; track "$FIXTURE16"
|
||||
OUT16=$(run_check "$FIXTURE16" "refs/heads/main" || true)
|
||||
if run_check "$FIXTURE16" "refs/heads/main" > /dev/null; then
|
||||
fail "silently exited 0 on an entry that names no shipped file"
|
||||
elif grep -q "fake-size-check" <<< "$OUT16" && grep -q "ADR-0014" <<< "$OUT16"; then
|
||||
pass "rejects an entry that resolves to no file, naming the hook and the ADR-0014 constraint"
|
||||
else
|
||||
fail "rejected the unresolvable entry without naming the hook and the ADR-0014 constraint"
|
||||
fi
|
||||
|
||||
# --- 17. The pushed ref, not HEAD, is what gets gated ---
|
||||
# pre-commit exports the local sha of each pushed ref as PRE_COMMIT_TO_REF.
|
||||
# `git push <remote> pushed-tip:main` from a checkout sitting on an older commit
|
||||
# is the false-negative direction: HEAD is still at the tag and diffs clean while
|
||||
# the branch actually landing on main carries an untagged, release-relevant
|
||||
# change. HEAD is reset back to the tag so the two genuinely differ.
|
||||
echo ""
|
||||
echo "--- exits 1 on a release-relevant change reachable only from PRE_COMMIT_TO_REF ---"
|
||||
FIXTURE17="$(make_tagged_fixture)"; track "$FIXTURE17"
|
||||
echo "v2" > "$FIXTURE17/scripts/skill-size-check.sh"
|
||||
(cd "$FIXTURE17" && git add -A && git commit -q -m "release-relevant change" \
|
||||
&& git branch pushed-tip && git reset -q --hard v1.0.0)
|
||||
OUT17=$(run_check "$FIXTURE17" "refs/heads/main" "pushed-tip" || true)
|
||||
if grep -q "skill-size-check.sh" <<< "$OUT17"; then
|
||||
pass "gates the pushed ref's tip, not HEAD, when HEAD is behind it"
|
||||
else
|
||||
fail "diffed HEAD instead of PRE_COMMIT_TO_REF and missed a release-relevant change"
|
||||
fi
|
||||
|
||||
# --- 18. Neither the diff tip nor the tag baseline may come from a newer HEAD ---
|
||||
# The false-positive direction: HEAD has moved past a v2.0.0 that the pushed ref
|
||||
# never saw. Reading either end of the diff off HEAD fails a push that is clean
|
||||
# since its own baseline — diffing v2.0.0..HEAD flags HEAD's untagged commit, and
|
||||
# resolving the tag from HEAD while diffing pushed-tip flags v2.0.0's change.
|
||||
echo ""
|
||||
echo "--- exits 0 when the pushed ref is clean since its own tag but HEAD has moved on ---"
|
||||
FIXTURE18="$(make_tagged_fixture)"; track "$FIXTURE18"
|
||||
(cd "$FIXTURE18" && git branch pushed-tip)
|
||||
echo "v2" > "$FIXTURE18/scripts/skill-size-check.sh"
|
||||
(cd "$FIXTURE18" && git add -A && git commit -q -m "released change" && git tag v2.0.0)
|
||||
echo "v3" > "$FIXTURE18/scripts/skill-size-check.sh"
|
||||
(cd "$FIXTURE18" && git add -A && git commit -q -m "unreleased change on HEAD's line")
|
||||
if run_check "$FIXTURE18" "refs/heads/main" "pushed-tip" > /dev/null; then
|
||||
pass "exits 0 for a pushed ref clean since the tag reachable from it, ignoring HEAD's line"
|
||||
else
|
||||
fail "gated HEAD's tag or tip and falsely demanded a release for a clean pushed ref"
|
||||
fi
|
||||
|
||||
# --- 19. A branch deletion is a no-op, not a confusing git failure ---
|
||||
# pre-commit sets PRE_COMMIT_TO_REF to an all-zeros sha when the push deletes a
|
||||
# branch. Nothing is being shipped, and the sha resolves to nothing, so without
|
||||
# an explicit guard the gate reports "could not diff" on an unrelated operation.
|
||||
echo ""
|
||||
echo "--- exits 0 when PRE_COMMIT_TO_REF is the all-zeros branch-deletion sha ---"
|
||||
FIXTURE19="$(make_tagged_fixture)"; track "$FIXTURE19"
|
||||
echo "v2" > "$FIXTURE19/scripts/skill-size-check.sh"
|
||||
(cd "$FIXTURE19" && git add -A && git commit -q -m "release-relevant change")
|
||||
if run_check "$FIXTURE19" "refs/heads/main" "0000000000000000000000000000000000000000" > /dev/null; then
|
||||
pass "treats an all-zeros PRE_COMMIT_TO_REF as a branch deletion and exits 0"
|
||||
else
|
||||
fail "turned a branch deletion into a failure instead of a no-op"
|
||||
fi
|
||||
|
||||
# --- 20. The repo's own .pre-commit-hooks.yaml satisfies the entry constraints ---
|
||||
# The parser guards above are only safe to ship if the manifest actually in tree
|
||||
# passes them. It is replayed into a fixture (with the paths its entries name
|
||||
# created) rather than run against the real repo, which has no release tag yet.
|
||||
echo ""
|
||||
echo "--- accepts the real .pre-commit-hooks.yaml this repo ships ---"
|
||||
FIXTURE20="$(mktemp -d)"; track "$FIXTURE20"
|
||||
(cd "$FIXTURE20" && git init -q && git config user.email [email protected] && git config user.name t)
|
||||
cp "$REPO_ROOT/.pre-commit-hooks.yaml" "$FIXTURE20/.pre-commit-hooks.yaml"
|
||||
while IFS= read -r real_entry; do
|
||||
mkdir -p "$FIXTURE20/$(dirname "$real_entry")"
|
||||
echo "v1" > "$FIXTURE20/$real_entry"
|
||||
done < <(sed -n 's/^[[:space:]]*entry:[[:space:]]*//p' "$REPO_ROOT/.pre-commit-hooks.yaml")
|
||||
(cd "$FIXTURE20" && git add -A && git commit -q -m "initial" && git tag v1.0.0)
|
||||
OUT20=$(run_check "$FIXTURE20" "refs/heads/main" || true)
|
||||
if [[ -z "$OUT20" ]]; then
|
||||
pass "parses every entry in the repo's real .pre-commit-hooks.yaml without complaint"
|
||||
else
|
||||
fail "the repo's own .pre-commit-hooks.yaml no longer satisfies the entry constraints: $OUT20"
|
||||
fi
|
||||
|
||||
# --- 21. A vX.Y.Z-suffixed checkpoint tag must not satisfy the release gate ---
|
||||
# git describe --match uses shell-glob semantics, not regex: the trailing `*` in
|
||||
# 'v[0-9]*.[0-9]*.[0-9]*' matches any suffix, so a pre-release/checkpoint tag like
|
||||
# v1.0.1-checkpoint also satisfies the glob and can be picked as LAST_TAG instead
|
||||
# of the true last release tag — hiding a real release-relevant change that landed
|
||||
# before the checkpoint tag from the diff.
|
||||
echo ""
|
||||
echo "--- ignores a vX.Y.Z-checkpoint tag and still flags the change since the real release tag ---"
|
||||
FIXTURE21="$(make_tagged_fixture)"; track "$FIXTURE21"
|
||||
echo "v2" > "$FIXTURE21/scripts/skill-size-check.sh"
|
||||
(cd "$FIXTURE21" && git add -A && git commit -q -m "real release-relevant change" && git tag v1.0.1-checkpoint)
|
||||
OUT21=$(run_check "$FIXTURE21" "refs/heads/main" || true)
|
||||
if grep -q "skill-size-check.sh" <<< "$OUT21"; then
|
||||
pass "still flags the release-relevant change since v1.0.0, ignoring the vX.Y.Z-checkpoint tag"
|
||||
else
|
||||
fail "a vX.Y.Z-checkpoint tag satisfied the glob and hid a real release-relevant change"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Results: $PASS passed, $FAIL failed"
|
||||
[[ $FAIL -eq 0 ]]
|
||||
@@ -204,7 +204,14 @@ while IFS= read -r rel; do
|
||||
[[ -f "$REPO_ROOT/$rel" ]] && FILES+=("$REPO_ROOT/$rel")
|
||||
done < <(git -C "$REPO_ROOT" ls-files -- '*.sh' '*.bats' '*.bash')
|
||||
|
||||
if [[ "${#FILES[@]}" -lt 20 ]]; then
|
||||
# Floored at 50 against a real 57 (58 tracked `*.sh`/`*.bats`/`*.bash` files, less
|
||||
# this one, which excludes itself above). Same discipline as the per-glob floors in
|
||||
# tests/test-vale-wrap.sh: a guard against a broken `git ls-files` invocation or a
|
||||
# moved search root resolving to a fraction of the tree, not a headcount to keep in
|
||||
# step. Seven files of slack is one deliberate multi-file deletion -- a plugin's
|
||||
# whole tests/ directory is three or four .bats files -- and nowhere near enough to
|
||||
# absorb a discovery that degraded to a single directory.
|
||||
if [[ "${#FILES[@]}" -lt 50 ]]; then
|
||||
fail "only ${#FILES[@]} tracked shell files found — the scan is looking in the wrong place"
|
||||
else
|
||||
LIVE_HITS="$(scan ${FILES[@]+"${FILES[@]}"})"
|
||||
|
||||
+68
-2
@@ -43,8 +43,8 @@ trap cleanup EXIT
|
||||
# invokes it as `$(make_fake_repo)`, and an append made in here would land in the
|
||||
# command substitution's subshell and be lost. Registration is the caller's job.
|
||||
make_fake_repo() {
|
||||
local dir
|
||||
dir="$(mktemp -d)"
|
||||
local dir="${1:-}"
|
||||
[[ -n "$dir" ]] || dir="$(mktemp -d)"
|
||||
mkdir -p "$dir/tests" "$dir/scripts/lib"
|
||||
cp "$REPO_ROOT/scripts/lib/batch-run.sh" "$dir/scripts/lib/batch-run.sh"
|
||||
cp "$RUN_BATS" "$dir/tests/run-bats.sh"
|
||||
@@ -410,6 +410,72 @@ else
|
||||
fail "the run failed but not with the zero-files message: $FAKE_OUT"
|
||||
fi
|
||||
|
||||
# --- 10. A repo root that itself sits under .claude/worktrees/ still runs. The
|
||||
# worktree exclusion used to match the absolute path, so a Claude worktree --
|
||||
# which lives at <repo>/.claude/worktrees/<name>/ -- excluded every file of its
|
||||
# own and failed with "N of N tracked .bats file(s) were not discovered". The
|
||||
# exclusion is now relative to the root, so a worktree nested BELOW the root is
|
||||
# still skipped.
|
||||
echo ""
|
||||
echo "--- a root under .claude/worktrees/ discovers its own files and still skips nested worktrees ---"
|
||||
WT_PARENT="$(mktemp -d)"
|
||||
FIXTURES+=("$WT_PARENT")
|
||||
DIR10="$WT_PARENT/repo/.claude/worktrees/agent-x"
|
||||
make_fake_repo "$DIR10" >/dev/null
|
||||
git -C "$DIR10" init -q
|
||||
seed_bats_files "$DIR10"
|
||||
mkdir -p "$DIR10/.claude/worktrees/nested/tests"
|
||||
printf '@test "n" { false; }\n' > "$DIR10/.claude/worktrees/nested/tests/n.bats"
|
||||
install_stub_bats "$DIR10" <<'EOF'
|
||||
#!/usr/bin/env bash
|
||||
echo "1..1"
|
||||
echo "ok 1 first"
|
||||
exit 0
|
||||
EOF
|
||||
git -C "$DIR10" add tests/a.bats tests/b.bats
|
||||
run_fake "$DIR10"
|
||||
if [[ $FAKE_RC -ne 0 ]]; then
|
||||
fail "a root under .claude/worktrees/ failed — its own files were excluded: $FAKE_OUT"
|
||||
elif ! grep -q "^=== tests/a.bats ===$" <<< "$FAKE_OUT"; then
|
||||
fail "a root under .claude/worktrees/ did not run its own tests/a.bats: $FAKE_OUT"
|
||||
elif grep -q "nested/tests/n.bats" <<< "$FAKE_OUT"; then
|
||||
fail "a worktree nested below the root was discovered and run: $FAKE_OUT"
|
||||
else
|
||||
pass "a root under .claude/worktrees/ runs its own files and skips nested worktrees"
|
||||
fi
|
||||
|
||||
# --- 11. A file that emits fewer results than its own plan promised fails the
|
||||
# run. This is the third aggregation signal, and the only one left standing in
|
||||
# exactly the case run-bats.sh's own comment puts in its threat model: a bats
|
||||
# formatter or wrapper that swallows the exit status. A process printing `1..10`,
|
||||
# three `ok` lines and exiting 0 emits no `not ok` and no non-zero status, so both
|
||||
# other halves stay silent -- the plan was already being computed for the
|
||||
# aggregate zero-count guard and was then thrown away, so the run was counted as
|
||||
# "6 tests, 0 failures" and went green with fourteen tests silently gone.
|
||||
echo ""
|
||||
echo "--- a file emitting fewer results than its plan fails the run ---"
|
||||
DIR11="$(make_fake_repo)"
|
||||
FIXTURES+=("$DIR11")
|
||||
seed_bats_files "$DIR11"
|
||||
install_stub_bats "$DIR11" <<'EOF'
|
||||
#!/usr/bin/env bash
|
||||
echo "1..10"
|
||||
echo "ok 1 first"
|
||||
echo "ok 2 second"
|
||||
echo "ok 3 third"
|
||||
exit 0
|
||||
EOF
|
||||
run_fake "$DIR11"
|
||||
if [[ $FAKE_RC -eq 0 ]]; then
|
||||
fail "a file delivering 3 of its 10 planned tests exited 0 — a truncated run reported as a pass"
|
||||
elif ! grep -q "planned 10 test(s) but emitted 3 result line(s)" <<< "$FAKE_OUT"; then
|
||||
fail "the run failed but not with the plan-shortfall message: $FAKE_OUT"
|
||||
elif grep -q "^6 tests, 0 failures$" <<< "$FAKE_OUT"; then
|
||||
pass "a plan promising more tests than were delivered fails the run and names the shortfall"
|
||||
else
|
||||
fail "the plan-shortfall run failed with the wrong count: $FAKE_OUT"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Results: $PASS passed, $FAIL failed"
|
||||
[[ $FAIL -eq 0 ]]
|
||||
+103
-2
@@ -45,8 +45,8 @@ trap cleanup EXIT
|
||||
# substitution's subshell and be lost. Registration is the caller's job. Same
|
||||
# convention as tests/test-run-bats.sh.
|
||||
make_fake_repo() {
|
||||
local dir
|
||||
dir="$(mktemp -d)"
|
||||
local dir="${1:-}"
|
||||
[[ -n "$dir" ]] || dir="$(mktemp -d)"
|
||||
mkdir -p "$dir/tests" "$dir/scripts/lib" "$dir/cases"
|
||||
cp "$REPO_ROOT/scripts/lib/batch-run.sh" "$dir/scripts/lib/batch-run.sh"
|
||||
cp "$RUN_TESTS" "$dir/tests/run-tests.sh"
|
||||
@@ -670,6 +670,107 @@ else
|
||||
pass "--strict and RUN_TESTS_STRICT=1 both dispatch children with RUN_TESTS_STRICT absent"
|
||||
fi
|
||||
|
||||
# --- A search root that itself sits under .claude/worktrees/ still runs. The
|
||||
# worktree exclusion used to match the absolute path, so every suite in a Claude
|
||||
# worktree (<repo>/.claude/worktrees/<name>/) was filtered out. It is now
|
||||
# relative to the search root, so a worktree nested BELOW the root is still
|
||||
# skipped.
|
||||
echo ""
|
||||
echo "--- a root under .claude/worktrees/ discovers its own suites and still skips nested worktrees ---"
|
||||
WT_PARENT="$(mktemp -d)"
|
||||
FIXTURES+=("$WT_PARENT")
|
||||
WT_DIR="$WT_PARENT/repo/.claude/worktrees/agent-x"
|
||||
make_fake_repo "$WT_DIR" >/dev/null
|
||||
install_healthy_bats_runner "$WT_DIR"
|
||||
add_case "$WT_DIR" test-own.sh <<'EOF'
|
||||
#!/usr/bin/env bash
|
||||
echo "own suite ran"
|
||||
EOF
|
||||
mkdir -p "$WT_DIR/cases/.claude/worktrees/nested"
|
||||
cat > "$WT_DIR/cases/.claude/worktrees/nested/test-nested.sh" <<'EOF'
|
||||
#!/usr/bin/env bash
|
||||
echo "nested suite ran"
|
||||
exit 1
|
||||
EOF
|
||||
run_fake "$WT_DIR"
|
||||
if [[ $FAKE_RC -ne 0 ]]; then
|
||||
fail "a root under .claude/worktrees/ failed: $FAKE_OUT"
|
||||
elif ! grep -q "own suite ran" <<< "$FAKE_OUT"; then
|
||||
fail "a root under .claude/worktrees/ did not run its own suite: $FAKE_OUT"
|
||||
elif grep -q "nested suite ran" <<< "$FAKE_OUT"; then
|
||||
fail "a worktree nested below the root was discovered and run: $FAKE_OUT"
|
||||
else
|
||||
pass "a root under .claude/worktrees/ runs its own suites and skips nested worktrees"
|
||||
fi
|
||||
|
||||
# --- 13. Discovering ZERO test-*.sh files is a hard error, not a green run ---
|
||||
# The quietest vacuous pass in the dispatcher, and the one --strict did not
|
||||
# reach: strictness only ever turned SKIPS into failures, so with no suites to
|
||||
# skip there was nothing for it to act on. The loops iterated zero times, the
|
||||
# run printed `Summary: 0 passed, 0 skipped, 0 failed` and exited 0 -- from the
|
||||
# run-tests pre-push hook, which prints nothing for a passing hook, that is
|
||||
# indistinguishable from every suite passing. A wrong TEST_DIR, a mistyped find
|
||||
# pattern, an exclusion that grew to swallow tests/, and a gutted checkout all
|
||||
# land here. tests/run-bats.sh has guarded its own discovery this way since it
|
||||
# hit the same hole; this is the sibling.
|
||||
#
|
||||
# The bats runner is the healthy stub, so the only thing wrong with the fixture
|
||||
# is that it has no case scripts -- a failure here cannot be the bats leg.
|
||||
echo ""
|
||||
echo "--- discovering zero test-*.sh files fails the run and names the search root ---"
|
||||
DIR13="$(make_fake_repo)"
|
||||
FIXTURES+=("$DIR13")
|
||||
install_healthy_bats_runner "$DIR13"
|
||||
run_fake "$DIR13"
|
||||
if [[ $FAKE_RC -eq 0 ]]; then
|
||||
fail "an empty search root exited 0 — a run that verified nothing reports the same as a run that verified everything: $FAKE_OUT"
|
||||
elif ! grep -q "found 0 test-\*\.sh file(s)" <<< "$FAKE_OUT"; then
|
||||
fail "an empty search root failed without saying that nothing was discovered: $FAKE_OUT"
|
||||
elif ! grep -qF "$DIR13/cases" <<< "$FAKE_OUT"; then
|
||||
fail "the zero-discovery error did not name the root it searched, which is the one fact needed to fix it: $FAKE_OUT"
|
||||
elif grep -q "^=== Summary:" <<< "$FAKE_OUT"; then
|
||||
fail "an empty search root still printed a summary line, so a reader scanning for the verdict sees a green one: $FAKE_OUT"
|
||||
else
|
||||
pass "zero discovered test-*.sh files fails the run, names the search root, and prints no summary"
|
||||
fi
|
||||
|
||||
# And under --strict too. Asserted separately because the ONLY lever --strict
|
||||
# had was the skip list, so "it fails now" and "it fails under the gate's own
|
||||
# invocation" were genuinely different questions here.
|
||||
echo ""
|
||||
echo "--- ... and under --strict, which previously had no lever on this at all ---"
|
||||
DIR13B="$(make_fake_repo)"
|
||||
FIXTURES+=("$DIR13B")
|
||||
install_healthy_bats_runner "$DIR13B"
|
||||
run_fake "$DIR13B" --strict
|
||||
if [[ $FAKE_RC -eq 0 ]]; then
|
||||
fail "an empty search root exited 0 under --strict, the invocation the run-tests pre-push hook uses: $FAKE_OUT"
|
||||
elif grep -q "found 0 test-\*\.sh file(s)" <<< "$FAKE_OUT"; then
|
||||
pass "--strict also fails a run that discovered nothing"
|
||||
else
|
||||
fail "--strict failed an empty search root for some other reason: $FAKE_OUT"
|
||||
fi
|
||||
|
||||
# The control: one discovered case is enough to get past the guard, so the two
|
||||
# cases above fail on the count and not on something else the fixture lacks.
|
||||
echo ""
|
||||
echo "--- ... while a single discovered case still passes ---"
|
||||
DIR13C="$(make_fake_repo)"
|
||||
FIXTURES+=("$DIR13C")
|
||||
install_healthy_bats_runner "$DIR13C"
|
||||
add_case "$DIR13C" test-one.sh <<'EOF'
|
||||
#!/usr/bin/env bash
|
||||
echo "one case ran"
|
||||
EOF
|
||||
run_fake "$DIR13C"
|
||||
if [[ $FAKE_RC -ne 0 ]]; then
|
||||
fail "a fixture with exactly one case failed: $FAKE_OUT"
|
||||
elif grep -q "found 0 test-\*\.sh file(s)" <<< "$FAKE_OUT"; then
|
||||
fail "the zero-discovery guard fired on a root that has one case script: $FAKE_OUT"
|
||||
else
|
||||
pass "one discovered case script is enough to get past the zero-discovery guard"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Results: $PASS passed, $FAIL failed"
|
||||
[[ $FAIL -eq 0 ]]
|
||||
@@ -734,12 +734,12 @@ expect_gate "a fixture with no authoring root reports DID NOT RUN and exits 0" \
|
||||
# The script used to print nothing and exit 0 when handed no paths, which made
|
||||
# a mis-scoped `files:` pattern indistinguishable from a corpus with no
|
||||
# findings — the whole ADR-0020 gate family silently disabled while every hook
|
||||
# reported green. Exit 2 (not 1) is the same split a8cd5e8 made in
|
||||
# reported green. Exit 2 (not 1) is the same split 598a7c3 made in
|
||||
# provider-adapter-author's validate-adapter.sh and the one vale-wrap.sh already
|
||||
# used: {0,1} are verdicts, 2 is "you invoked this wrong".
|
||||
#
|
||||
# SAFE FOR THE HOOK. Both manifests declare pass_filenames: true and neither
|
||||
# sets always_run, and pre-commit skips a filename-passing hook outright when
|
||||
# SAFE FOR THE HOOK. The skill-size-check hook declares pass_filenames: true
|
||||
# and does not set always_run, and pre-commit skips a filename-passing hook outright when
|
||||
# its `files:` pattern matches nothing, so pre-commit never invokes this script
|
||||
# with an empty argument list. That claim is asserted below rather than left in
|
||||
# prose, so a config edit that turns it false fails here.
|
||||
@@ -773,7 +773,7 @@ if [[ $CLEAN_RC -eq 0 && $FINDING_RC -eq 1 && $USAGE_RC -eq 2 ]]; then
|
||||
else
|
||||
fail "exit codes collide — clean=$CLEAN_RC findings=$FINDING_RC usage=$USAGE_RC"
|
||||
fi
|
||||
# The hook contract the usage exit depends on. If either manifest ever stops
|
||||
# The hook contract the usage exit depends on. If the hook ever stops
|
||||
# passing filenames, or starts always_run, pre-commit could invoke the script
|
||||
# with no paths and exit 2 would break the hook rather than diagnose a caller.
|
||||
HOOK_CONTRACT="$(python3 - "$REPO_ROOT" <<'PYHOOK'
|
||||
@@ -805,19 +805,11 @@ for repo in cfg.get('repos') or []:
|
||||
found = hook
|
||||
check('.pre-commit-config.yaml skill-size-check', found)
|
||||
|
||||
with open(os.path.join(root, '.pre-commit-hooks.yaml'), encoding='utf-8') as fh:
|
||||
hooks = yaml.safe_load(fh) or []
|
||||
found = None
|
||||
for hook in hooks:
|
||||
if isinstance(hook, dict) and hook.get('id') == 'kyberforge-skill-size-check':
|
||||
found = hook
|
||||
check('.pre-commit-hooks.yaml kyberforge-skill-size-check', found)
|
||||
|
||||
print('; '.join(problems))
|
||||
PYHOOK
|
||||
)"
|
||||
if [[ -z "$HOOK_CONTRACT" ]]; then
|
||||
pass "both manifests pass filenames and neither is always_run, so pre-commit never invokes the script with no paths"
|
||||
pass "the hook passes filenames and is not always_run, so pre-commit never invokes the script with no paths"
|
||||
else
|
||||
fail "the usage exit would break the hook: $HOOK_CONTRACT"
|
||||
fi
|
||||
@@ -899,6 +891,45 @@ else
|
||||
pass "the SUGGESTION survives LC_ALL=C, streams pinned to UTF-8"
|
||||
fi
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# metadata.version shape: no leading zeros, matching check-skill-version-bump
|
||||
# ---------------------------------------------------------------------------
|
||||
echo ""
|
||||
echo "--- metadata.version with a leading zero is malformed ---"
|
||||
for version_case in "1.0.08:malformed" "01.0.1:malformed" "1.0.10:valid" "0.1.0:valid"; do
|
||||
version="${version_case%%:*}"
|
||||
expected="${version_case##*:}"
|
||||
VERSION_SKILL="$TMPDIR/version-$version"
|
||||
mkdir -p "$VERSION_SKILL"
|
||||
cat > "$VERSION_SKILL/SKILL.md" <<VERSIONEOF
|
||||
---
|
||||
name: version-skill
|
||||
description: A valid skill description that is well within the limit.
|
||||
metadata:
|
||||
version: "$version"
|
||||
---
|
||||
|
||||
## Step 1
|
||||
|
||||
Do the thing.
|
||||
VERSIONEOF
|
||||
set +e
|
||||
VERSION_OUT="$("$SCRIPT" "$VERSION_SKILL/SKILL.md" 2>&1)"
|
||||
VERSION_STATUS=$?
|
||||
set -e
|
||||
if [[ "$expected" == malformed ]]; then
|
||||
if [[ $VERSION_STATUS -ne 0 && "$VERSION_OUT" == *"metadata.version is malformed ('$version')"* ]]; then
|
||||
pass "'$version' is rejected as malformed"
|
||||
else
|
||||
fail "'$version' was not rejected as malformed (exit $VERSION_STATUS): ${VERSION_OUT:-<empty>}"
|
||||
fi
|
||||
elif [[ "$VERSION_OUT" == *"metadata.version is malformed"* ]]; then
|
||||
fail "'$version' was wrongly rejected as malformed: $VERSION_OUT"
|
||||
else
|
||||
pass "'$version' is accepted"
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "Results: $PASS passed, $FAIL failed"
|
||||
[[ $FAIL -eq 0 ]]
|
||||
Loaded 100 of 103 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user