Skip to content

feat(skills): skill-audit gains the drift lens, and the standard stops calling the gate advisory - #706

Merged
athvin merged 2 commits into
mainfrom
fix/skill-audit-drift-lens
Nov 6, 2026
Merged

athvin merged 2 commits into
mainfrom
fix/skill-audit-drift-lens

Conversation

@athvin

@athvin athvin commented Nov 6, 2026

Copy link
Copy Markdown
Owner

The two follow-ups flagged at the end of #689, plus a consistency sweep. One commit each.

1. skill-audit gains a drift lens — 9a0a26f9

The first campaign over this collection audited twelve skills and landed a fix on each. Ten of those twelve corrected a claim the tree had outgrown — a deleted client, a renamed CI job, a signature that gained an argument, a cited section number, an absence that had filled in. Reproducible from git log --oneline d72cda56~1..08622516. Since then #694 landed "the AWS skill asserted absences that had stopped being true", independently finding the same subclass.

None of the six lenses asked for that pass. Auditors filed the findings under counts because the remedy matched — derive it — which left the lens doing someone else's job and the dominant failure class unnamed. Worse, protocol.md framed opening a source file as a bounded exception and listed "inventing a finding from a filename" as an anti-pattern, so the skill mildly discouraged the pass that produced most of its value.

What the lens adds:

  • It is the only lens that opens the source, and the only one whose findings no gate can catch — nothing in scripts/skills-check.sh reads a skill's prose against the code it describes. That gap is now stated in the boundary table's own section.
  • A table of the six shapes that rot, each with the probe it wants: an absence, a deleted symbol, a signature, a borrowed identifier, a "not yet" claim, a quoted section number.
  • An absence is called out as the dangerous shape. "The only X", "there is no Y" reads as a convention rather than as inventory, so nobody re-checks it — a skill stating one is telling a session not to look.
  • The highest-value subclass is a "not yet"/"cannot" claim whose blocker has been removed, because it makes a session decline work that is now routine. Both items in this PR are that shape.
  • A probe is mandatory. "Never reports a drift claim it did not probe" is in the never-does list, the verification checklist asks whether the probe ran this session, and the challenger is told to re-run it rather than trust the draft's citation — a skill quoting a line that no longer exists will supply a convincing quote.
  • The counts boundary is explicit, since they overlap on every number: counts asks where the fact lives and fires even when it is correct; drift asks whether it is true today. Both wrong and un-derived is one card, filed under drift, generator named in the Fix.

Two eval scenarios, one each way — 7 must probe and report, 8 must withhold on a deliberate superseded-pattern warning, where the grep that appears to falsify the claim is the evidence the warning is needed.

2. The standard stops describing the gate as advisory — 66982576

agent skills (lint + drift) became a required status check while this was being written — a peer promoted it, so the API change was not mine to make. That left three passages in the standard false in the direction that matters: they tell a reader to distrust a green that is now trustworthy.

The observation the promotion rule demands is now recorded rather than dropped, because it shows the stake. On throwaway PR #699 — a .claude-only diff with a one-line description edit and no regen — the skills job failed while every other required context reported skipped: detect had correctly skipped every compile job, and protection accepts skipped as satisfied. The only job that noticed was, at that moment, the only job that could not block the merge.

Also adds the post-merge-surface row to the generator table — the script had fourteen generators to the table's thirteen rows.

Verification

  • bash scripts/skills-check.sh all → ok (regen + drift + lint + overrides, 23 skills), re-run after rebasing onto 73e9da7c. Per land-pr's table, that is the gate for a .claude/ + docs/ change; no Rust, TypeScript or Terraform is touched, so cargo/next build/terraform validate have nothing to say about this diff.
  • The gate caught a real mistake in this change mid-work: my first draft of the lens linked protocol.md from lenses.md, which the one-level reference rule bans. Fixed to a prose reference.
  • The lens was run end to end against .claude/skills/security, a skill nobody has audited, following the new definition. It produced two verified findings and correctly withheld on two claims that look stale and are not. Details in the PR comments.

Not done, deliberately

ci-and-supply-chain/SKILL.md:284 says the workflow pins (S9) job is "not yet a required check". I probed the protection API — it is still not required, so the claim is accurate and I left it.

🤖 Generated with Claude Code

@athvin

athvin commented Nov 6, 2026

Copy link
Copy Markdown
Owner Author

End-to-end run of the new lens: /skill-audit review .claude/skills/security --lens=drift

Run against a skill nobody has audited, following the lens's method — extract the checkable claims, probe the cheapest first, one command each. Recorded here rather than acted on: fixes are a separate change, and security is outside this PR's topic.

Two findings, both the "not yet"/"wrong location" shape.

HIGH — the named test home for prompt injection does not exist. security/SKILL.md:119 sends a session to frontend/tests/unit/assistant-tools.test.ts as the harness that locks prompt injection / PII→LLM. There is no such file, and nothing under frontend/tests matches *assistant* except three Playwright snapshot PNGs. The nearest real harnesses are frontend/tests/unit/agent-actions.test.ts and ai-resolve.test.ts. This defeats the skill's own stated purpose — "the exact existing test harness that locks each one" — because a session following it creates a new file instead of extending the harness.

MEDIUM — the posterity gate is in a different crate than implied. security/SKILL.md:98-100 attributes the lake.main.<x> and query_strings gates to freeform_sql.rs in a passage about er-server/src. The file is rust/crates/er-schema/tests/freeform_sql.rs. The rule is accurate — it scans ../er-server/src at line 76 — so only the location misleads, but er-server/tests/freeform_sql.rs is where a reader looks first and it is not there.

Correctly withheld, which is the half that matters:

  • security/SKILL.md:113 marks er-server/tests/pg_tenant_isolation.rs as NEW, i.e. not yet existing. It still does not exist — the claim is accurate, and it is flagging an untested invariant rather than drifting.
  • security/SKILL.md:88-92 claims "no env var and no config field" can disable the egress guard — an absence, so the shape most likely to have rotted. Grepping for ER_*EGRESS, disable_egress and allow_egress across rust/ and frontend/ returns nothing. It holds.
  • The role lattice (lib.rs:390-395), the guard(p, org, minimum) signature (lib.rs:704) and the other four named test files all probed clean.

Two findings and two withholdings from one pass is the behaviour the lens is for: the withholdings are what keep a drift run from turning into a list of sentences that merely look old.

One thing the harness cannot verify in-session

SKILL.md edits made in a git worktree cannot be trigger-tested from the session that made them. Claude Code resolves .claude/skills/ from the primary checkout and loads it at startup, so invoking /skill-audit here loaded main's copy — without the drift row. Copying the file into the shared primary checkout to force it would pollute a tree other sessions are working in.

So what is verified is that the instructions are coherent and executable (the run above), that the files parse and satisfy every authoring rule (skills-check green, having first caught a sibling-link violation), and that the generated projections did not move. Confirming the lens triggers on a natural phrasing needs a fresh session after merge — which is what evals.md is for, and scenarios 7 and 8 are written to be posed that way.

bmoore813 and others added 2 commits November 6, 2026 01:35
…indings were

The first campaign over this collection audited twelve skills and landed a fix
on each. Ten of those fixes corrected a claim the tree had outgrown — a deleted
client, a renamed CI job, a signature that gained an argument, a section number,
an absence that had filled in. Reproducible from
`git log --oneline d72cda5~1..0862251`.

None of the six lenses asked for that. Auditors filed the findings under
`counts`, because the remedy matched — derive it — which left the lens doing
someone else's job and the dominant failure class unnamed. Worse, the protocol
framed opening a source file as a bounded *exception*, and listed "inventing a
finding from a filename" as an anti-pattern, so the skill mildly discouraged the
one pass that produced most of its value.

So `drift` is now a lens of its own:

- It is the only lens that opens the source, and the only one whose findings no
  gate can catch — nothing in `scripts/skills-check.sh` reads a skill's prose
  against the code it describes.
- It carries a table of the six shapes that rot, each with the probe it wants.
- An **absence** is called out as the dangerous shape: "the only X", "there is no
  Y". It reads as a convention rather than as inventory, so nobody re-checks it,
  and a skill stating one is telling a session not to look.
- The subclass worth the most is a "not yet"/"cannot" claim whose blocker has
  since been removed, because it makes a session decline work that is routine.
- A probe is mandatory. "Never reports a drift claim it did not probe" is now in
  the never-does list, the verification checklist asks whether the probe actually
  ran this session, and the challenger is told to re-run it rather than trust the
  draft's source citation. A confident false drift finding sends the author to
  correct a sentence that was right, which is worse than silence.

The `counts` boundary is stated explicitly, because the two overlap on every
number: `counts` asks where the fact lives (remedy: derive it) and fires even
when the number is correct; `drift` asks whether it is true today (remedy:
correct it, then consider deriving). Both wrong and un-derived is ONE card, filed
under `drift`, generator named in the Fix.

Two eval scenarios, one each way: 7 must probe a planted "there is no `<table>`"
claim and report it HIGH with a real source citation, and 8 must WITHHOLD on a
deliberate superseded-pattern warning, where the grep that appears to falsify the
claim is the evidence the warning is needed.

The description trades a wordier routing clause for "whether a claim about the
tree has gone stale", so the trigger vocabulary carries it. Both clauses the
inventory generators project were left byte-identical, so the generated tables
do not move.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
`agent skills (lint + drift)` became a required status check on `main` while
this was being written, which made three passages in the standard false in the
direction that matters — they tell a reader to distrust a green that is now
trustworthy:

- the drift check's duplication in the cargo `lint` job was justified by
  "`skills` is not a required status check, so on its own it cannot block a
  merge". The duplication is now belt-and-braces, and the sentence said the
  opposite of the current configuration. Kept the duplication, replaced the
  reason — it costs seconds and removing it buys nothing.
- "**Do not read a `.claude`-only PR's green as proof the generated references
  are current** until it is promoted" — it is promoted, so that green now IS the
  proof. Being ungated it reports on every PR; being required it can refuse one.
- "not yet a required status check. Per docs/frontend-testing.md's rule, promote
  it only after it has been observed failing."

That last rule was honoured, and the observation is now recorded rather than
dropped, because it demonstrates the stake: on throwaway PR #699 — a
`.claude`-only diff with a one-line description edit and no regen — the skills
job FAILED while every other required context reported `skipped`, since `detect`
correctly skipped every compile job and protection accepts `skipped` as
satisfied. The only job that noticed was the only job that could not block.

Also adds the `post-merge-surface` row to the generator table, which a peer's
generator had been left out of. Not a count — the table is the hand-written
index of which generator owns which target, and the script had fourteen
generators to its thirteen rows.

Deliberately NOT changed: `ci-and-supply-chain/SKILL.md` says the
`workflow pins (S9)` job is "not yet a required check". Probed the protection
API — it is still not required, so that one is accurate.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@athvin
athvin force-pushed the fix/skill-audit-drift-lens branch from 0a67d42 to 41566d9 Compare November 6, 2026 06:37
@athvin
athvin merged commit 17f02fe into main Nov 6, 2026
33 checks passed
athvin pushed a commit that referenced this pull request Nov 6, 2026
…e gate could not see it

#706 landed the missing `post-merge-surface` row while this branch was open
carrying the same fix, so rebasing produced two rows for one generator with
different "Derived from" prose. Kept the derivation-shaped wording, because the
set-difference paragraph above the table now cites `post-merge-surface` by name
and only that wording supports the claim.

The rebase merged cleanly and `make skills-check` stayed green through it, which
is the part worth fixing: `generator_table_ids` ran `sort -u` before the set
comparison, so a duplicate row was deduplicated out of existence on its way to
the diff. The gate this branch adds was built to catch a hand-maintained table
disagreeing with the code, and a table that says two different things about one
generator is that same defect — it just arrives by concurrent PR rather than by
omission.

So the ids are now extracted twice: deduplicated for the set comparison, and raw
for a `uniq -d` pass. Observed failing before being trusted, per
docs/frontend-testing.md — reintroducing the duplicate row fails
`skills-check.sh generators` with exit 1 and names the id.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
athvin pushed a commit that referenced this pull request Nov 6, 2026
…t main

The block this branch introduces is derived from every skill's `description`,
so it goes stale whenever any of them changes — and three landed while the
branch was open. #706 lengthened `skill-audit` to 1017 characters, which drops
its headroom from 17 to 7 and moves it to the top of the table, and `land-pr`
shortened, which moves it past `skill-writer`.

Regenerated output only; no prose or threshold changed. Worth noting what the
refreshed numbers say, since the block exists to be read: `skill-audit` now has
7 characters free against a 56-character median routing clause, so it is the
next description that cannot take a tail without being trimmed first.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
athvin added a commit that referenced this pull request Nov 6, 2026
…dropped for want of 31 characters (#713)

* fix(skills): the description budget, and the routing clause an audit dropped for want of 31 characters

`description` is capped at 1,024 characters and is a shared append target:
closing an overlap means appending a clause to a NEIGHBOUR's description, so
unrelated audits all spend the same line. Fifteen of twenty-three descriptions
had arrived within 34 characters of the cap with no single author having spent
it, and six within nine.

The cost was not hypothetical. The `sql-analysis` audit (#697) found that
`entity-framework` and `sql-analysis` both carry the E0xx and oracle triggers
while neither tail hands them over, decided the clause was needed, and then
DROPPED it because `entity-framework` had 31 characters free. That is the one
outcome the standard already forbids — docs/agent-skills.md:113 says to shorten
that description rather than drop the routing, because an unclosed overlap costs
a mis-selected skill at runtime, which is the failure the field exists to
prevent. The clause is now in, and `entity-framework` has more headroom than it
started with.

Thirteen descriptions trimmed on the standard's own rule: cut the **what**
clause, never the trigger vocabulary. Every noun, command, filename and error
string a person would type is preserved; what went is explanation the body
already carries — "and why each is pinned", "rather than by account", "and why
it sits there", "the measurements a speed claim needs". Four skills are left
alone because they are in open pull requests (#699, #702, #705); the generated
table names them rather than leaving it to be rediscovered.

The durable half is that generated table. The standard's remedy had been "read
the headroom before adding a tail" plus a shell one-liner, which is a step an
author can skip — and skipping it is exactly how #697 ended up choosing between
a count and a correct routing graph. The threshold is DERIVED rather than
chosen: the median routing clause in the collection, so "cannot take another
clause" is measured against what a clause actually costs here instead of a
number someone picked.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(skills): the derived threshold was measuring whole descriptions, not clauses

The clause-length regex was unanchored, so `[^;]*\bfor .*see [a-z0-9-]+`
matched from the start of each `;`-delimited segment and swallowed the what
clause with it. Of 77 "routing clauses" it found, fifteen were 698-868
characters — entire description prefixes.

The reported median was right anyway (59 vs 56 now), because a median ignores
outliers. That is luck, not a design, and the whole claim of this block is that
the threshold is DERIVED rather than picked — so an extraction that measures
the wrong thing undermines the one property worth having, even while printing a
plausible number.

Anchored on `for`, split on sentence as well as clause boundaries: 76 clauses,
28 to 162 characters, median 56. The splitting moved to awk because BSD and GNU
sed disagree about `\n` in a replacement, and this generator runs on both.

Found by checking what the extraction actually returned instead of trusting a
believable aggregate.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* chore(skills): regenerate the description-budget block against current main

The block this branch introduces is derived from every skill's `description`,
so it goes stale whenever any of them changes — and three landed while the
branch was open. #706 lengthened `skill-audit` to 1017 characters, which drops
its headroom from 17 to 7 and moves it to the top of the table, and `land-pr`
shortened, which moves it past `skill-writer`.

Regenerated output only; no prose or threshold changed. Worth noting what the
refreshed numbers say, since the block exists to be read: `skill-audit` now has
7 characters free against a 56-character median routing clause, so it is the
next description that cannot take a tail without being trimmed first.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

---------

Co-authored-by: bmoore813 <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
athvin added a commit that referenced this pull request Nov 6, 2026
…e that drifted while we were in there (#703)

* docs(skills): the generator table never learned about post-merge-surface

`run_regen` wires 13 generators; the table in the standard listed 12.
`post-merge-surface` — the `land-pr` reference that set-differences every
workflow's triggers down to the ones no pull request can pre-test — was added
with that skill and never reached the table, and nothing noticed because the
table is hand-maintained prose.

The "three of these are set differences" sentence was wrong for the same reason:
`post-merge-surface` is a fourth. Rephrased without the count, since a count in
prose here is the defect this document spends a section warning about.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* feat(skills): gate the generator table against the generators actually wired

The previous commit fixed one missing row by hand, which leaves the mechanism
that produced it intact: the generator table in docs/agent-skills.md is a
hand-maintained list of something code owns, and this repo's whole answer to
that shape is to derive it.

`skills-check.sh generators` extracts the id set from the `splice` calls in
`run_regen`, extracts it from the table, and set-differences both ways:

- wired but unlisted — what `post-merge-surface` was
- listed but unwired — a row left behind when a generator is retired, which
  reads as documentation of something that no longer runs

The "Derived from" column stays prose deliberately. What a generator derives and
*why* is the part worth reading and the part no script can write; only the id
set is derivable, so only the id set is asserted.

Observed failing before being trusted, in both directions: deleting the
`post-merge-surface` row fails with that id named, and adding a `ghost-generator`
row fails with the opposite message. Also proved the extractor cannot fail open
— an empty wired set is its own error rather than a vacuous pass.

Runs in `lint` and `all`, so it needs no toolchain and reports on a
`.claude`-only PR, same as `overrides`.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(skills): the eval still asserted a glob that matches nothing

`entities/*.yaml` matches zero files — the layout is `entities/<name>/entity.yaml`,
49 of them. The body was rewritten to say `entities/` and the eval beside it was
not, so scenario 1 asked a session to justify `entities-check` with a path that
does not exist.

Scoped deliberately to this file. The same shorthand sits in nine other tracked
places (the design doc, CONTRIBUTING.md, rust.yml, the Makefile, an
`er-entities/Cargo.toml` comment, the eslint config), where it reads as
established shorthand for "the entity YAMLs" rather than a typo — rewriting
those would put a comment-only change through the full Rust and frontend gates
and is not this change's business.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(skills): the table gained a second post-merge-surface row, and the gate could not see it

#706 landed the missing `post-merge-surface` row while this branch was open
carrying the same fix, so rebasing produced two rows for one generator with
different "Derived from" prose. Kept the derivation-shaped wording, because the
set-difference paragraph above the table now cites `post-merge-surface` by name
and only that wording supports the claim.

The rebase merged cleanly and `make skills-check` stayed green through it, which
is the part worth fixing: `generator_table_ids` ran `sort -u` before the set
comparison, so a duplicate row was deduplicated out of existence on its way to
the diff. The gate this branch adds was built to catch a hand-maintained table
disagreeing with the code, and a table that says two different things about one
generator is that same defect — it just arrives by concurrent PR rather than by
omission.

So the ids are now extracted twice: deduplicated for the set comparison, and raw
for a `uniq -d` pass. Observed failing before being trusted, per
docs/frontend-testing.md — reintroducing the duplicate row fails
`skills-check.sh generators` with exit 1 and names the id.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

---------

Co-authored-by: bmoore813 <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants