8 Commits

Author SHA1 Message Date
zernie 9413061d9b feat!: split the public exports by COST — vigiles/test (free) vs vigiles/eval (spends money) (#149)
* refactor(exports)!: split the testing surface on COST, and name the cost

The exports map split the testing API by TEST TIER — `vigiles/testing`,
`vigiles/unit`, `vigiles/integration`, `vigiles/e2e`. That taxonomy already had
a home: the vitest projects, keyed on test-file NAMES. The exports map was a
second, competing implementation of it, and zero of 19 comparable packages
publish `./unit` / `./integration` / `./e2e` subpaths.

It splits on COST now, on two axes at once — the PATH and the NAME.

  "."             -> ./dist/test.js          (was ./dist/core/spec.js)
  "./spec"        -> ./dist/core/spec.js     unchanged
  "./eval"        -> ./dist/eval-surface.js  NEW
  ./linting ./hook ./claude-code ./codex ./adapter ./experimental
  ./vitest ./jest                            unchanged

DELETED: ./testing, ./unit, ./integration, ./e2e.  14 subpaths -> 11.

No `./test` subpath: the bare package name IS the testing surface. Two names for
one door is the duplication being removed (`.` + `./spec` used to be exactly
that). The cost: CLI-verb symmetry is now one-sided — `vigiles/eval` rhymes with
`vigiles eval`, the free half answers to the plain package name. Accepted;
`@playwright/test` publishes no subpath naming a test type at all.

THE NAME AXIS. Every runtime export on `./eval` is prefixed `paid_`:
paid_runEval, paid_measure, paid_measureArms, paid_measureTriggerRate,
paid_judge, paid_judged, paid_claudeEvalDriver. The path warns ONCE at the top
of a file; the name warns EVERY time, at the call site. Reading
`await judged(trace, "did it refuse?")` on line 140, the import is long out of
view. Not a new idiom here — `vigiles/experimental` already pairs a quarantined
path with an `experimental_` prefix; this applies the device to a second axis.

TYPES ARE NOT PREFIXED, deliberately: the prefix warns about CALLING something,
and a type is never called. `paid_EvalReport` would be noise — and since the 29
report types are re-exported from BOTH barrels, prefixing them would put `paid_`
names on the FREE surface.

⚠️ THE PREFIX OVERSTATES SLIGHTLY, AND THIS IS RECORDED, NOT HIDDEN.
`paid_judged(rubric, { judge: myFn })` calls your function and spends nothing;
the `measure*` family takes an injectable `evalDriver`. Only the DEFAULT path
bills (`paid_judge` is the one where `paid_` is exact — no injection seam).
`metered_` would be precise but reads a beat slower, and a warning not absorbed
at a glance is not a warning. Clarity won; the imprecision is written into the
module docstring, each symbol's JSDoc, and docs/testing-api.md.

ALSO FIXED: a PRE-EXISTING violation of the older convention. `makeDockerRuntime`
sat unprefixed among six `experimental_` siblings on `./experimental`. One
missing prefix is worse than none: the six that comply teach the reader that an
unprefixed name is safe. Renamed at source to `experimental_makeDockerRuntime`.

BOTH CONVENTIONS NOW HAVE A GATE, because that violation is exactly what prose
buys you. `scripts/check-export-prefixes.mjs` reads the built `.d.ts` with the
TypeScript compiler (so it can tell a value from a type instead of grepping) and
FAILS with exit 1 — it is a gate, not a nudge. Wired as `npm run exports:check`
and a CI step beside `docs:check`.

ITS TEST HAS BOTH HALVES, and mutation says so. `scripts/check-export-prefixes.test.ts`
(12 cases, colocated) fires on planted violations AND is silent on the legitimate
surface next door. Four mutations, each failing on its OWN assertion:

  drop alias resolution        -> 2 fail  (the vacuous-pass: `./eval` is built
                                  entirely from `export { x as paid_x }`, and an
                                  alias reports Alias, not Value — a check that
                                  skipped resolution would read every export as a
                                  type and pass on a fully unprefixed barrel)
  exit(1) -> exit(0)           -> 1 fail  (gate degrades to nudge)
  delete the ./experimental
    entry from SURFACES        -> 1 fail  (see below)
  never push a violation       -> 4 fail

🔴 THE THIRD MUTATION PASSED GREEN AT FIRST — a hole in the TEST, not the check.
An entire axis could stop being policed with nothing turning red: the axis test
passes its own surface list, the "real barrels" test is satisfied by a SHORTER
list, and the CLI test still exits 1 on its `./eval` defect. Fixed by asserting
SURFACES covers exactly the quarantined subpaths. The CLI test was vacuous the
same way (its fixture lacked `./experimental`, so it exited 1 either way) and now
runs a clean twin that must exit 0.

NOTHING WAS LOST, AND IT IS MEASURED. Union of the four old barrels: 190 symbols.
New: 183 on the root + 36 on ./eval, overlapping in 29 report types re-exported
from both on purpose. 183 + 36 - 29 = 190; set difference empty in BOTH
directions (comparing `paid_x` to `x` by identity). `vigiles/testing` was NOT a
superset of `vigiles/unit`: 11 symbols (all of guardrail-check.ts, plus
decideHook / parseHookOutput) existed only on `unit` and are on the root now.

TWO HONEST COSTS, in the docstrings rather than hidden:
1. The type coupling crosses the boundary and cannot be removed. ~27 helpers
   (assertImproves, compareArms, diffReports, cost/latency/tokens,
   formatEvalReport, …) read an eval RESULT and spend nothing, so they are free
   and unprefixed — but their argument types are defined on the paid side. Hence
   the 29 duplicated types, so nobody imports `./eval` for a type alone.
2. Free is not fast. The old "real CLI, no API key" tier collapses into the root,
   so the import no longer signals that `runHarnessTest` spawns a real claude
   under bubblewrap for ~40s. Duration lives in the runner config now.

`.` moving off `core/spec` means every doc example importing a spec builder from
bare "vigiles" now says "vigiles/spec" (11 blocks). `docs:check` is what caught
those.

Entry points are enumerated in four places independently of package.json; all
updated: scripts/api-extractor.mjs (1:1 with exports now — `vigiles.api.md` is
the test surface, `vigiles-spec.api.md` is new), typedoc.json, eslint.config.mjs
(AGNOSTIC_SURFACE + the no-barrel-imports list; both rules verified by mutation
to still fire on the new filenames), vitest.config.mjs comment.

Gates, by name and in order: npx vitest run (2939 passed, 25 skipped, 174 files)
· npm run lint (0 errors, 206 warnings — unchanged baseline) · npx prettier
--check . · npm run api:check (11 entries, no drift) · npm run build · plus
npm run docs:check (91 blocks, 0 findings) and npm run exports:check. Also
`node dist/cli.js lint` exits 0 with every compiled-markdown hash valid.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uvk2Zx66BAuxuLGLFL2umd

* ci: закрыть класс «сгенерированный файл протух, а CI зелёный»

Шаг «Check generated types compile» перегенерирует файл и компилирует результат.
Свежесгенерированный компилируется всегда — поэтому закоммиченная копия в проверке
НЕ УЧАСТВУЕТ. Замер 16.08: отслеживаемый `.vigiles/generated.d.ts` отставал на
314 строк / ~147 записей, и CI всё это время была зелёной.

Название шага честное — он проверяет, что типы КОМПИЛИРУЮТСЯ, а не что они
актуальны. Именно поэтому дыра пережила ревью: шаг делает ровно то, что обещает.

Предсказание записано за восемь дней до: в .gitignore репозитория zernie/mine
08.08 этим обосновано, почему тот репозиторий свою копию не отслеживает — «drift
in a generated file is invisible unless something regenerates it with --check.
Upstream vigiles tracks its own copy and it IS stale on main for exactly that
reason». Через восемь дней стало хуже. Запись предсказания не помогла; помогает
строка в CI.

Проверено обеими половинами: на актуальном файле проходит, на подложенном
дрейфе (одна строка в конец) падает.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uvk2Zx66BAuxuLGLFL2umd

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-08-16 22:46:26 +05:00
zernie 8f214f2738 feat: mark Codex trigger-rate experimental (Codex-only) + redesign landing hero (#79)
Codex has no skill-selection event, so codexSkillFired infers firing from a
SKILL.md read (cache → false negative, exploratory read → false positive) — so
the trigger-rate is surfaced as EXPERIMENTAL (Codex-only; Claude Code stays
supported): an experimental caveat on the driver → report, a stderr warning, a
loud formatter line. Deterministic vigiles audit stays full Codex parity.
Documented in docs/harness-testing-codex.md + research/harness-capabilities.md.

Also ships the landing hero redesign (site/, deploys to vigiles.sh, not in the
npm package): the merged audit widget (deeplink + npx fallback), sticky CTA,
the audit report on the fold, shared lib/deeplink.ts.
2026-07-20 23:20:24 +05:00
zernie 15c0607a5b feat!: eval lock (CI staleness gate) + full Codex parity for hooks & inject (#53)
* feat!: eval lock (CI staleness gate) + per-adapter harness versionKey

Real-model evals run on your subscription, so they only run locally — never
in CI. The eval LOCK closes the resulting gap: a committed integrity stamp
that lets CI verify the committed numbers still match the current inputs
WITHOUT a model call (distinct from the gitignored, local-speed eval cache).

- `vigiles eval --update` (local): records each NAMED eval's report to a
  committed `.vigiles/eval-locks/<name>.lock.json` + prints the per-number delta.
- `vigiles eval --check` (CI): recompute the input hash, fail "stale" on a
  mismatch — binary-free, deterministic. Green no-op until the first lock is
  committed (smooth adoption).
- The clean split: the lock stores only the model's observed behavior; the
  script's own assertions re-run live against the replayed report, so a
  threshold-only edit is a valid replay while an input change is stale.
- Honest scope: the harness version is provenance, NOT a hash input (CI's
  pinned claude ≠ a dev's local claude would false-trip), and there is no
  nightly run — model/harness drift is a local `--update` concern.

Also extracts the harness version reduction to a per-adapter port method
(`HarnessRuntime.versionKey`): Claude Code keys major.minor (~quarterly),
Codex opts out with "" (its minor is patch-cadence, ~weekly). This fixes the
local cache churning weekly for Codex and is where the cadence decision belongs.

Whole-package coherence: the GHA gains `command: eval-check`, `vigiles init`
scaffolds the eval-check CI job, and this repo dogfoods it. Wired at both eval
seams (runEvalWith + measureTriggerRateWith), 100%-covered, docs updated
(internal research + public guides).

BREAKING CHANGE: `HarnessRuntime` (exported on `vigiles/adapter`) gains a
required `versionKey(raw: string): string` method. Third-party adapters must
add it; return "" to opt out of version partitioning. First-party adapters
(claude-code, codex) are updated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WVmD8n7P62fuJ91aQh9yY9

* feat: eval-lock agent awareness (skill + nudge hook) + cohesive-delivery rule

Close the loop on the eval lock so the AGENT knows it exists and maintains it —
without the invasive option of editing the user's CLAUDE.md.

- test-harness skill documents the lock lifecycle (--update/--check, commit the
  lock, re-run after editing a skill).
- A PostToolUse nudge hook (hooks/eval-lock-nudge.sh → hook-runtime
  eval-lock-nudge): after editing a SKILL.md / *.eval.* with committed locks
  present, inject a NON-BLOCKING reminder to re-run `vigiles eval --update`.
  Self-gated (silent until a lock is committed), never blocks (the gate is CI's
  `eval --check`). Wired into the vigiles plugin; runHook + unit + .sh tests.
- NO init edit to the user's CLAUDE.md — verified that's not how plugins deliver
  context (no plugin-level instructions file exists; the channel is a hook/skill).

Docs + dedup:
- research/agent-context-delivery.md captures the VERIFIED CC/Codex
  context-delivery mechanics ONCE (SessionStart additionalContext is the plugin
  channel; CLAUDE.md is the user's file; skill descriptions always-in-context;
  Codex AGENTS.md + hooks but inject deferred) so we stop re-researching it.
- Per-adapter guides (harness-testing-claude-code/-codex.md) explain how the
  reminder reaches the agent per harness (CC injects; Codex inject is a documented
  follow-on), with the agnostic guide linking DOWN to them (no duplication).

Cohesive-view rule:
- New CLAUDE.md `cohesive-feature-delivery` rule — a definition-of-done CHECKLIST
  (CLI × GHA × init × agent-awareness × both adapters × per-adapter deduped docs ×
  tests) so a feature's INTEGRATION across surfaces is checked as one thing,
  generalizing cohesive-cli-surface + harness-parity + great-agent-flow.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WVmD8n7P62fuJ91aQh9yY9

* test: CLI e2e for the eval-lock invalidation flow (update → check → stale)

Closes the gap flagged in review: the joined CLI flow wasn't tested as one
thing. A real *.eval.cjs fixture (model-free — drives runEvalWith from dist with
a fake runner) run through the built CLI proves the whole loop: `eval --update`
writes a committed lock, `eval --check` with the same inputs replays green (no
model), and an input change makes `eval --check` go red ("stale"). Binary-free,
no subscription — exactly how it runs in CI.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WVmD8n7P62fuJ91aQh9yY9

* docs: scannable eval-lock docs + prose-clarity & easy-adoption rules

Make the eval-lock docs readable at a glance and frame upkeep as agent-driven,
not a manual chore.

Docs (scannable rewrite — ASCII flow diagram, comparison tables, ✅/❌/⚠️
signposts, short sentences, no walls of text):
- docs/harness-testing.md — the lock how-to now leads with "you mostly won't
  touch this by hand; the test-harness skill records it + a hook reminds you,"
  then a diagram + tables.
- docs/harness-testing-claude-code.md / -codex.md — the per-harness nudge
  delivery as tables; the Codex inject caveat is one clear ⚠️ row.
- docs/eval-architecture.md — the "what's stale vs a free replay" split as
  ✅/❌ bullets.
- skills/test-harness/SKILL.md — Step 5 now tells the agent to run
  `eval --update` + commit the lock as part of its job (so it IS done for you).
- README — the Quick-start reassurance leads with "Adoption is smooth: one
  command, then your agent does the rest," names skills AND hooks, no chores.

Two new CLAUDE.md rules:
- prose-clarity — public prose must be clear + scannable (lead with the point,
  one idea per sentence, define/drop jargon, tables/bullets/ASCII/Mermaid over
  walls, emoji as signposts, one bold per point). Prefer ASCII/Mermaid; never
  commit generated raster images into docs.
- lead-with-easy-adoption — docs (README first screen especially) must make it
  clear up front that adoption is low-friction because skills + hooks do the
  work; frame every feature's upkeep as agent/skill/hook-driven, not homework.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WVmD8n7P62fuJ91aQh9yY9

* docs: prose-clarity sweep across 13 user-facing guides

Apply the new prose-clarity rule to the prose-heavy public guides: lead with the
point, one idea per sentence, tables/bullets/ASCII over walls of text, ✅/❌/⚠️/ℹ️
signposts, one bold phrase per point, jargon glossed or dropped. Net −578 lines —
shorter and far more scannable, with meaning unchanged.

Swept: for-plugin-authors, what-vigiles-catches, measuring-skills, skills,
harnesses, comparison, faq, sandboxing, safety, agent-setup, agent-workflows,
verifying-instruction-files, compiled-hooks. The onboarding pair leads with the
low-friction "one command, the agent does the rest" framing.

Reference docs (cli, testing-api, spec-format, …) and the per-rule docs were
deliberately left alone — they're already table-shaped, and churning them is
high-risk / low-value.

Verified: no heading text changed (anchors intact), no `research/` links added to
public docs, the validation-rules matrix is complete (28 rule links → 28), safety
claims retained, command refs resolve (self-command-refs), no orphan docs, fmt
clean. Produced by parallel rewrite agents under strict preserve-anchors/links/
code constraints, then verified + spot-read.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WVmD8n7P62fuJ91aQh9yY9

* feat!: encode hook inject support into HookProtocol.injectableEvents

Codex inject was documented as "deferred" but the official Codex hooks
docs confirm `additionalContext` is honored on SessionStart /
UserPromptSubmit / PreToolUse / PostToolUse / SubagentStart — the same
shape as Claude Code. The gap existed because inject support was a prose
deferral, not a tested contract: nothing in the adapter conformance kit
asserted a shellHooks harness could actually deliver an inject hook.

Encode it as a required port field so the gap can't recur silently:

- HookProtocol gains `injectableEvents: readonly string[]` — the events
  that honor `additionalContext` injection, per-adapter.
- claudeCodeHookProtocol: [SessionStart, UserPromptSubmit, PostToolUse];
  codexHookProtocol: + [PreToolUse, SubagentStart].
- Conformance rejects a shellHooks adapter with an empty list; the
  adapter-contract suite asserts every shellHooks adapter declares the
  events vigiles' shipped hooks use (PostToolUse, SessionStart) — the
  test that would have caught the original miss.
- `compile` warns on an inject hook only when its event isn't injectable
  on the target harness (react output stays CC-confirmed-only).
- Correct every "Codex inject deferred" reference across docs, research,
  and CLAUDE.md; document injectableEvents in the adapter API + authoring
  guides.

BREAKING CHANGE: HookProtocol (exported on vigiles/adapter) gains a
required `injectableEvents` field — a third-party adapter must declare it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* docs: refresh HANDOFF for the eval-lock branch + inject-port encoding

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* feat: fan out hook install + the CI workflow to every declared harness

A repo can enable BOTH harnesses (`harness: ["claude-code","codex"]`),
and instruction files already mirror to both — but `compile` installed a
hook into only ONE harness (`installHooks` ignored `config.harness` and
auto-detected a single adapter), and the scaffolded CI workflow hardcoded
the Claude Code binary. So an inject/gate hook that works on both could
land in `.claude/settings.json` while silently missing from
`.codex/config.toml` — the "works on CC, absent on Codex" failure the
harness-parity rule exists to prevent.

- `resolveHarnessAdapters` (adapter-registry.ts) returns the FULL declared
  set: `--harness=` flag → that one; else config `harness` list → all of
  them; else auto-detect → the detected one (de-duped by name).
- `installHooks` loops over it, merging the SAME compiled hook into every
  enabled harness's native config (JSON / TOML), with per-harness warnings.
- The `init` CI workflow is harness-aware: the deterministic harness job
  installs `@anthropic-ai/claude-code` and/or `@openai/codex` per declared
  harness (`harnessTestBinaries`).

Skills compile byte-identical across harnesses and subagents are CC-only
by design, so hooks + the CI binary were the real fan-out gaps.

Tests: resolveHarnessAdapters units (fan-out / flag-singular / detect /
alias-dedup), a both-harness hook-install e2e (the same hook in both
configs), and harness-aware workflow e2es (codex-only, both). Documented
as §4 in research/multi-harness-compile.md + the compiled-hooks guide.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* feat: wire vigiles's nudge hooks into .codex/config.toml during init

Closes the last Codex-parity gap in agent-awareness: Claude Code gets the
eval-lock + refs nudge hooks from the global marketplace plugin, but Codex
has no global plugin store, so it got skills only — the proactive nudges
never reached a Codex user (the "works on CC, silently absent on Codex"
failure).

Codex config is repo-committed (the idiomatic place), so `init` now wires
the two PostToolUse nudges into `.codex/config.toml`:

- `codexPluginHooks` (pure) declares them as DIRECT `npx vigiles
  hook-runtime …` commands — no plugin root, no vendored bash script. The
  runtime entrypoints read the event JSON on stdin and emit the
  `additionalContext` shape Codex honors on PostToolUse (confirmed +
  encoded in HookProtocol.injectableEvents).
- `applyCodexPluginHooks` (pure, unit-tested) merges them idempotently:
  re-runs replace in place, and the user's own Codex hooks + every other
  config key are preserved. `wireCodexHooks` in cli.ts does only the IO.
- Safety: only an INTENTIONAL exit 2 blocks an edit (the refs nudge under
  `unmarked-refs: error`); an npx-resolution failure exits non-2, so a
  missing dep never blocks.

Loud, documented deferral (no-silent-skips): the SessionStart lint summary
(plain stdout, unconfirmed on Codex) and the compile-on-edit / pre-edit
guards (filename-gated bash, no harness-neutral entrypoint yet) stay manual
on Codex.

Also: the remaining pre-release Codex item — running the eval tier against
the real `codex` binary once — is added to the launch-readiness P0 list in
the roadmap.

Tests: codexPluginHooks shape + applyCodexPluginHooks (fresh / idempotent /
preserves user config); the planPluginInstall codex notes/vendors updated.
Verified end-to-end that `init --harness=codex` writes the config and a
pre-existing `.codex/config.toml` (model + a user hook) is preserved.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* test: update codex install e2e for the new vendors:true (repo hooks)

The codex install plan now writes nudge hooks into .codex/config.toml, so
`vendors` flipped to true. Updated the unit assertion last commit but missed
this e2e (run by both the `e2e` and `test` CI jobs). The skills-are-global
checks below are unchanged and still stand.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix: cover the non-Actions lock message branch + address Codex review

The `test` job's coverage gate failed: `emitLockMessage`'s console.warn/
console.log branches (the non-GITHUB_ACTIONS path) are unreachable in CI,
where GITHUB_ACTIONS is globally set. Added a wiring test that DELETES the
var to exercise both branches regardless of environment.

Also addresses two Codex review findings on the eval-lock work:

- P1 (soundness): `evalArmsInputs` omitted `spec.stubs` from the hash, though
  tool stubs are written onto PATH and are model-facing input — so a changed
  canned CLI output after `--update` left the same `inputsHash` and `--check`
  replayed stale results. Now folds a canonical (name-sorted) view of the
  stubs into the hash; a new wiring test proves a stub change → stale.

- P2 (collision): two eval names normalizing to the same slug (`foo/bar` vs
  `foo bar` → `foo-bar.lock.json`) could let `--check` replay the WRONG eval's
  report. `readLock` now rejects a lock whose stored `name` differs from the
  requested one, degrading a collision to a safe miss (→ stale/re-run), never
  wrong data. Unit-tested.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix: two more eval-lock soundness gaps from Codex review

- An unnamed eval in `--check` mode called `produce()` (ran the model),
  breaking the no-model-in-CI contract: in CI there's no subscription, so it
  would hit the model or fail for missing auth. Now `check` mode throws a
  clear, actionable error for an unnamed eval (never reaching the model);
  `off`/`update` keep producing (the eval just isn't gated locally).

- `spec.ephemeralEnv` toggles the trial's run environment (scrubbed env +
  throwaway HOME vs the inherited process env) — a model-facing input that
  was omitted from the lock hash, so a report recorded under one mode could
  be replayed under the other with the same inputsHash. Now folded into the
  hashed inputs.

Both proven by new wiring tests (unnamed-check throws without calling the
runner; an ephemeralEnv toggle → stale). Coverage holds at 100% lines/
statements/functions (verified with GITHUB_ACTIONS=true).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix: fold the harness identity into the trigger-rate lock hash

Codex review (P2): a trigger-rate eval recorded with one harness driver and
later switched via `measureTriggerRate(spec, { evalDriver: codexEvalDriver })`
hashed identically (prompts/model/plugin unchanged), so `--check` could
replay a Claude-recorded report for a Codex run — defeating the gate for the
Codex eval path this PR adds.

`EvalDriver` gains an optional `harness` identity (defaults to "claude-code",
so existing single-harness locks are unaffected); `claudeEvalDriver` and
`codexEvalDriver` declare theirs, and `measureTriggerRate`/`...With` thread it
into the hashed trigger inputs. A new wiring test proves a harness switch →
stale. API surface regenerated (additive `harness?` on EvalDriver).

This closes the input-hash bug class on the trigger-rate seam (the runEval
seam's stubs + ephemeralEnv were fixed in the prior two commits).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* docs: refresh HANDOFF — PR #53 merge loop + the 5 review fixes

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix: three more Codex-review findings (matchers + plugin-root path hash)

- Codex nudge hooks used Claude tool names (`Edit|Write`) in their matcher,
  but Codex's edit tool is `apply_patch` — so the eval-lock + refs nudges
  wired into `.codex/config.toml` would never fire. Matcher → `^apply_patch$`.

- The compiled-hook FAN-OUT to Codex regex-wraps the raw matcher without
  translating tool names, so a CC-authored `tools("Edit","Write")` gate emits
  `^(Edit|Write)$` into Codex config and silently never fires though compile
  reports success. vigiles has no cross-dialect tool-name map yet, so install
  now WARNS LOUDLY when a tool-matched hook is fanned to a non-CC harness
  (no silent non-firing success); a real mapping is the follow-up.

- For eval arms using `plugin`, `resolveHarness` expands `${PLUGIN_ROOT}` to
  the checkout's ABSOLUTE path before the settings are hashed, so a lock
  recorded at `/home/dev/...` was falsely STALE when `--check` recomputed it
  at `/home/runner/...` in CI. `stripPluginRoot` normalizes the prefix back
  to a token → location-independent hash. New wiring test: the same plugin at
  two different abs paths replays (not stale).

Coverage holds at 100% lines/statements/functions (verified GITHUB_ACTIONS=true).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix: guard stripPluginRoot against a hookless plugin's undefined settings

A plugin that ships only instructions/skills (no hooks) resolves to
settings:undefined; JSON.stringify(undefined) is undefined, so the prior
.split() threw before the eval could run. Guard the non-string case (pass it
through). Regression I introduced in the plugin-root normalization last commit;
new test covers a hookless-plugin arm (update + check, no throw).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* test: add a lock-hash COMPLETENESS guard for both seams

The Codex review kept finding the same class of bug: a model-facing input
omitted from the lock hash, so `--check` replays stale results (stubs,
ephemeralEnv, driver-harness, plugin-root all slipped through). Our tests
proved the MECHANISM (record→replay, task-change→stale) but never asserted
the input set was COMPLETE.

This adds a structural guard: for each input that steers the run, mutate
ONLY it and assert the lock inputsHash CHANGES — one parametrized test per
seam (runEval's evalArmsInputs + trigger-rate's triggerInputs). A new input
added to EvalSpec/TriggerRateSpec without hashing it now fails a row HERE in
CI, instead of a reviewer finding it later. Covers task/model/tools/fixture/
arm.files/arm.settings/arm.model/interceptTools/stubs/ephemeralEnv and
prompts/irrelevantPrompts/model/harness.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-01 01:55:49 +05:00
zernie ff542b7c4b refactor!: vigiles audit — Lighthouse-style harness report (rename scan→audit)
Rename the read-only scan verb to `vigiles audit` — a local, zero-config Lighthouse-style report scoring a harness across four deterministic rings (Truthfulness/Triggering/Structure/Tested) with each finding's fix inline + a shareable HTML report and a versioned AuditReport JSON.

audit is a local report, not a CI step (CI uses `vigiles lint`). The executing checks (live MCP resolution + trigger-rate + the adoption preview) run only behind one interactive consent; there is no execution flag. The safety battery is not an audit ring — it lives in the vigiles/testing API.

Adds the adoption-gateway preview ("what would vigiles catch in your repo?"): the model drafts a spec from the instruction file, the cross-reference engine verifies every drafted ref deterministically.

BREAKING CHANGE: the `scan` verb is renamed to `audit` (no alias); the `--check-hooks`/`--verify-mcp`/`--trigger`/`--fix-plan`/`--explain`/`--deep`/`--measure`/`--fast`/`--no-measure` flags are removed.
2026-06-28 02:34:50 +05:00
zernie d8c639f8da refactor(cli)!: consolidate the verb surface (13→8) + docs/README overhaul (#46)
* docs: sharpen README lint/guard copy

- Replace internal "7 catalogs" jargon with "7 linters (ESLint, Ruff,
  Clippy, and four more)"; Cedar stays in the subdoc
- Drop the plugin-audit paragraph from the Lint section (secondary use
  case, still reachable from More)
- Rewrite the Guard intro to lead with the concrete "fail open" failure
  and name what vigiles emits (exit code, JSON, AST-backed matcher)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* docs: surface the $0/subscription cost story in the first paragraph

The "no metered tokens, runs on your Claude subscription" wedge was
buried in the last line of the Eval section. Pull a crisp version into
the opening paragraph (above the fold); the Eval section keeps the
detailed promptfoo/DeepEval contrast as proof.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* docs: surface agent-writes-the-harness flow, reorder More, drop internal links

- Quick start now leads with "then your agent writes the harness for
  you": the three model-invocable skills (test-harness/strengthen/
  edit-spec) and the plain-English ask each one answers
- Reorder More so CLI sits above the leaderboard (whose link points into
  the CLI docs); trim the now-redundant Skills bullet to a pointer
- Stop linking internal research/ docs from the README (the moat link and
  the Research index) per public-vs-internal-docs

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* feat(compile): auto-refresh an existing harness.gen.ts

compile now keeps a whole-harness registry in sync as a side effect, so
the user never hand-runs generate-harness. Gated on the file already
existing (compile maintains a registry you opted into, never imposes
one) and cheap (parses specs, no linter spawn — unlike generate-types/
generate-schema, which spawn every linter and stay on the config-change
guard). A duplicate agent name fails the compile.

Docs: note the auto-refresh in the compile section and mark the
generate-* artifacts as dev-toolchain output rarely run by hand.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* docs(src): add nested CLAUDE.md with a high-bar-for-new-commands rule

Directory-scoped guidance loaded when working in src/: adding a new CLI
verb or hook-runtime subcommand must clear a high bar (genuinely new
mental action, no overlap with an existing command, siblings collapse to
one verb + subcommand, runtime entrypoints stay hidden). Complements the
root cohesive-cli-surface rule, placed next to the code that defines the
command surface (cli.ts, cli-commands.ts). Spec-managed (require-spec +
integrity); dogfoods vigiles compile.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* docs: drop the "(generated)" annotation from the API reference link

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix(build): stop src/CLAUDE.md.spec.ts shadowing the root spec + add docs rule

The nested src/CLAUDE.md.spec.ts (added last commit) compiles under
rootDir:src to dist/CLAUDE.md.spec.js — the exact path loadSpec resolves
the root CLAUDE.md.spec.ts to, so recompiling the root spec loaded the
src spec and clobbered CLAUDE.md. Exclude src/*.md.spec.ts from tsc so
both load via the tsx fallback (as the root always has).

Also adds the no-internal-links-in-public-docs guidance rule (public
docs never link research/*.md; keep the fact in research, don't link it),
reconciles the old "link to research" line in public-vs-internal-docs,
and files the deterministic lint-rule version as a P1 roadmap item.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* docs: separate public/internal indexes + surface eval safety

- docs/README.md no longer links into internal research/ (public docs
  don't point at the private record)
- research/README.md is explicitly labelled the internal record
- README Eval section gains a "Safe to repeat" note (sandbox + ephemeral
  dir + egress + interceptTools, past-the-sandbox case flagged) linking
  docs/safety.md

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* docs: stop public docs linking internal research/ + add safety FAQ

Strip every research/*.md link from docs/*.md (the no-internal-links-in-
public-docs rule) — ~60 links across 16 guides plus the docs/ index;
prose kept readable, no orphaned research doc (all still cited from
CLAUDE.md keyFiles / research/README.md, orphan-docs green).

Add a FAQ to docs/safety.md answering the side-effects-beyond-the-sandbox
question honestly: network via egress allowlist, a real DB/redis/browser
via a disposable container you stand up (turnkey provisioning is a
committed next step), irreversible externals via interceptTools, and the
no-Docker deterministic/record-replay tiers.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* refactor(cli)!: consolidate verbs — measure/explain→scan flags, refs→lint, generate-*→generate <kind>

De-sprawl the human verb surface from 13 to 8 (the high-bar-for-new-commands
rule, dogfooded). All breaking:

- `measure <dir>` → `scan <dir> --trigger` (the model-gated behavioral
  column folded into scan; trigger-rate + collision matrix unchanged)
- `explain <dir> [name]` → `scan <dir> --explain [name]` (the deterministic
  WHY, a sibling of --fix-plan on the same ScanReport)
- `refs <file>` → folded into `lint` (the unmarked-refs check is already a
  lint rule; the PostToolUse hook keeps its shared collectRefIssues entry)
- `generate-types|schema|harness` → `generate <kind>` (one verb + subcommand;
  the three dev-toolchain generators grouped, not N hyphenated siblings)

scan reuses handleMeasure/handleExplain directly behind --trigger/--explain.
Docs, help text, the regen guard, tests, and the self-command-refs dogfood
all updated together (cohesive-cli-surface); 1588 tests green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* docs: split the GitHub Action reference out of cli.md into its own doc

cli.md was 718 lines (kitchen sink). Extract the ~108-line GitHub Action
section into docs/github-action.md (quick start, inputs, output channels,
versioning) and leave a short pointer; retitle the cli.md intro. Update
the README More bullet (CLI · GitHub Action) and the docs index. cli.md
→ 619 lines. orphan-docs + self-command-refs green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* feat(lint): add prefer-compiled-hooks rule — one nudge toward compiled hooks

A single repo-level recommendation (one finding regardless of hook count):
when a plugin ships hand-written hook commands that aren't compiled
vigiles/hook artifacts, nudge toward compiling them — the message links
docs/compiled-hooks.md and points at guardrail-check for verifying the
ones you have.

A discovery nudge, not a defect: the hand-written shell lane stays
first-class, so it fires ONCE (never per-hook), defaults to warn (info-
level ℹ; informational, doesn't fail CI), and is opt-out. Detector
(manualHookCount: a command that isn't a hook-runtime invocation) lives
in scan.ts and is shared by scan + lint (one-detector-no-drift). Doc +
matrix rows added (rules-docs-in-sync). Honest caveat in the doc: it's
form-based, so it stays a recommendation.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* docs(research): record the eval-startups critique mapped onto positioning

New research/eval-startups-positioning.md captures Thomas Liao's "why eval
startups fail" critique and its implications: vigiles dodges the trap
(harness-eval not model-eval, tooling not services, eval already a feature),
but it's a yellow flag on the public ecosystem-benchmark as a MOAT
(Goodhart-gameable → keep it a thin acquisition flywheel) and it
independently validates the attestation/safety direction (capability-diff,
guardrail proof) as the only defensible eval-shaped niche.

Linked from research/README.md, measurement-authority.md (whose benchmark
thesis it challenges), and strategic-synthesis-2026-06.md (whose Tier-2
conformance/attestation play it validates). Internal-only per
no-internal-links-in-public-docs; orphan-docs green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* docs: purge internal positioning from public docs (jargon, name-drops, benchmark)

Public docs (README + docs/) now state user-facing value, not vigiles's
internal strategic vocabulary:

- strip "moat" from 14 places → user-facing wording (engine / cost
  advantage / differentiator / cross-reference)
- remove all bare research/*.md name-drops from docs/ (the backtick form
  the link-strip + deterministic check miss); scope-descriptions reworded
  to "configured directories" rather than naming research/
- README: drop the "ranks the hyped ecosystem: what works vs hype"
  benchmark banner from the Eval row + kicker (depth stays in
  measuring-skills.md) — per eval-startups, the benchmark is a flywheel,
  not a headline
- docs/cli.md: "moat #2 (research/…)" → "the capability-diff check"

Codified in CLAUDE.md: public-vs-internal-docs now has a strategic-
vocabulary clause (moat/measurement-authority/flywheel stay internal;
public docs name the benefit), so this doesn't regress. orphan-docs +
self-command-refs green; the public↔private split stays docs/ vs research/.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* docs(readme): apply multi-persona review fixes

From a multi-persona README review (power user / staff eng / plugin author
/ non-TS user / eng manager):

- non-TS users: a visible "No TypeScript needed — lint + inline comments
  work on any CLAUDE.md" line (was invisible; contradicted progressive adoption)
- plugin authors: surface "vigiles scan ranks a marketplace, no key" above
  the fold (was buried in More)
- eng-manager cost: hero now says deterministic layers run free in CI;
  merged kicker+affordability nails "real-model on a dev's own subscription,
  never a CI token"
- staff-eng skepticism: the 2/7→7/7 claim now reads "measured, not asserted";
  the typed-pipeline claim is concretized to the real pipe()/needs() mechanism
- fixed a broken blockquote and trimmed the safe-to-repeat para to hold length

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* docs(readme): capture the README design direction as an editor-facing comment

A top-of-file comment block records the framing the README must hold: lead
with benefits, present compiled specs as the easy/auto-enforced next step
(skills write them, hooks compile them; JS→TS evolution, not a wall), keep
all four instruments first-class incl. Eval, stay scannable + under the
length cap, and no internal vocabulary/research links. Guides future edits.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* docs(readme): benefits-forward rewrite + specs-are-easy framing

Per the README direction: lead with what the user GETS, and present the
typed spec as the frictionless auto-enforced next step, not a TS wall.

- hero: stronger, concrete failure modes (stale ref / guard fails open /
  skill never fires), keeps Agent=Model frame, cost above the fold;
  dropped the redundant centered pitch (merge)
- table cells condensed to punchy benefit one-liners
- "You don't hand-write specs — your agent does. TypeScript for your
  harness: opt-in, gradual, auto-compiled, never a chore" (skills write
  them; JS→TS evolution)
- de-dupe cost (drop "not metered tokens" from the Test cell)
- "Not for you if …" honest-scope line
- docs/verifying-instruction-files.md: back the claim — "you rarely
  hand-write one; edit-spec/strengthen write it, a hook recompiles on save"

Eval stays a first-class instrument. fmt + self-command-refs + orphan-docs green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* docs(readme): don't lead callouts with "typed spec" — benefit first

Casual readers shouldn't be greeted by "a typed spec is a program" /
"TypeScript for your harness" in the prominent callouts. Reframe both to
lead with the outcome and demote the spec to a soft, opt-in aside:

- specs-are-easy block: "You don't hand-write any of this — your agent
  does … you never touch it by hand" (drop the TypeScript-for-your-harness
  headline)
- Lint blockquote: "Bad states stop compiling … turn it up only when you
  want it" (drop "Markdown is prose; a typed spec is a program")
- the edit-spec bullet says "edits the source", not "the typed spec"

"No TypeScript?" reassurance and the optional .spec.ts mention stay.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* chore: refresh HANDOFF for the CLI-consolidation + docs/README overhaul session

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* chore: prettier-format HANDOFF

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix(ci): update the stale generate-types ref the verb rename missed

The CI "Check generated types compile" step ran `node dist/cli.js
generate-types` — renamed to `generate types` in the verb consolidation,
so the job failed with "Unknown command". self-command-refs didn't catch
it because it didn't scan .github/; add .github/ to its scan scope so a
stale `cli.js <cmd>` ref in a workflow fails the dogfood from now on.

Also saves the prefer-compiled-hooks-vs-require-hook-spec decision to
research/hook-modes-and-testing.md (the nudge, not a requirement; the
write-hook authoring skill is the real authoring lever, unbuilt).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix(lint): eslint-ignore src/*.md.spec.ts (excluded from tsconfig)

The dist-collision fix excluded src/*.md.spec.ts from tsconfig, so
eslint's type-aware project service can't resolve src/CLAUDE.md.spec.ts
and errors "not found by the project service". It's a tsx-loaded build
input (like the root CLAUDE.md.spec.ts, which isn't linted either), so
ignore it in eslint to match. Latent since the exclude landed; surfaced
now that the earlier generate-types step no longer fails first.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-25 01:20:05 +07:00
zernie 1e798a2a4b feat: deterministic scan/lint rule suite for agent plugins (the cross-referencing moat) + scanner hardening (#40)
* fix: anchor scan surface regexes so a '-agents' skill dir isn't a phantom agent

Pointing `vigiles scan` at popular OSS plugins (obra/superpowers,
wshobson/agents marketplace) surfaced a real misclassification bug: the
skill/agent/command path matchers were unanchored, so any directory whose
NAME merely ends in the keyword was misread. superpowers ships
`skills/dispatching-parallel-agents/SKILL.md`, and the `agents/[^/]+\.md$`
matcher hit the `-agents/SKILL.md` substring — reporting a phantom agent
named "SKILL" with no tool contract. That both corrupts the scan report
and unfairly deducts from the leaderboard score (no-contract penalty).

Anchor `skills/`, `agents/`, and `commands/` on a real path boundary
(start-of-path or `/`). Add regression coverage for `-agents`/`-commands`
skill directories.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat: scan traverses marketplaces and counts dangling refs as structural issues

Two gaps surfaced while pointing `vigiles scan` at popular OSS plugins:

1. Marketplace traversal. `wshobson/agents` ships 80+ plugins under a single
   `.claude-plugin/marketplace.json`; scanning the repo root found nothing.
   `expandMarketplace` resolves each member's relative `source` (skipping
   external git sources and missing dirs), and `vigiles scan <root>` now
   expands a marketplace and ranks every member through the leaderboard.

2. Dangling intra-plugin references are now a first-class structural finding,
   not a buried free-text warning. `ScanReport.danglingRefs` exposes the
   broken-path / partial-vendor refs (obra/superpowers ships three); the
   report prints them under a "Broken references" ✗ section, the verdict
   counts them, and the leaderboard deducts -8 each. Previously superpowers
   reported "✓ no structural issues found" despite three missing files.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix: kill scan false positives that running against real plugins exposed

Validating the marketplace scan against wshobson/agents (80+ plugins) and
obra/superpowers showed the two heuristic findings were almost all FALSE
POSITIVES — the exact doc-mention trap the leaderboard avoids. Promoting
noisy signals to scored "bugs" would discredit the whole pitch, so tighten
both detectors to fire only on real defects:

- Dangling refs: scan only EXECUTABLE source files (hook/helper scripts,
  incl. extensionless ones like superpowers' hooks/session-start), never
  prose. Every hit across the corpus came from markdown — example task text,
  a literal "wc -w skills/path/SKILL.md" template, "❌ Bad" samples, React
  `hooks/*.ts` code comments — none real. The true positive (a script that
  cats a missing plugin file) is preserved.
- Skill descriptions: parse YAML block scalars (`description: >` / `>-`).
  The regex captured only the `>` indicator, mislabeling four richly-
  described wshobson skills as "can't trigger".

Net: the marketplace now reports 0 broken-ref and 0 missing-description
false positives; remaining deductions are real (no tool contract, untested).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs: log first behavioral findings — superpowers brainstorming under-triggers

Ran the model-gated column (measureTriggerRate, real claude on the subscription)
against the full obra/superpowers plugin to find bugs the deterministic scan
structurally cannot see.

Headline: the `brainstorming` skill — structurally green (good description, no
scan finding) — fires on only ~20–30% of its own open-ended use-case prompts
(recall 3/10 then 2/10 across two runs; precision a perfect 100% on mechanical
edits). A diagnostic showed it isn't losing to a competitor: on 8/10 prompts no
skill fired at all. The "You MUST use this before any creative work" imperative
reads strong but fires weak — exactly the class of bug only a real model reveals.

Records method, the over-trigger hypothesis the data refuted, an actionable fix
for the author, the egress column we couldn't run here (no bwrap/slirp4netns),
and honest n=10/1-trial caveats. Linked from distribution-strategy (E1) and
divergent-bets (#9) so it isn't an orphan.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs: empty-context validity + competitor landscape + auto-context idea

Capture the methodology analysis from probing brainstorming:

- Is empty context valid? Confirmed each trigger run is a cold single prompt
  (no fixture/history; TriggerRateSpec has no such field). It's the field
  STANDARD (AWS sample-agent-skill-eval does single relevant/irrelevant queries),
  faithful for opening-move skills (brainstorming qualifies — finding stands),
  biased-low for state-dependent ones (a shared blind spot, not vigiles-specific).
- Landscape table: AWS (query, same), promptfoo (user-injected vars/hooks),
  DeepEval (ConversationalTestCase), Inspect/SWE-bench (seeded sandbox for
  stateful tasks). Nobody auto-reconstructs a skill's trigger state.
- New idea — auto-apply known context: (1) add fixture/prior-turn to
  TriggerRateSpec (parity with measure()/runEval), (2) auto-select a curated
  preset context from the skill's declared trigger phrases so it's measured in
  the state it claims to fire on. Preset selection on explicit cues, not prose
  synthesis. Logged in roadmap.md (Next, P3-MED).

The empty-vs-seeded sensitivity probe is noted as deferred (40 serial runs
overran the budget here; re-run with concurrency).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs: roadmap — per-model trigger-rate + context-rot curve (MED)

(a) Report trigger-rate per model — already a capability (model-as-arm), make it
a standard column. (b) Study how recall rots as the skill roster grows and
whether a stronger model rots slower — the concrete form of divergent-bets #11
(measure model × harness). Opt-in matrix, not a default gate; cheap first probe
is brainstorming recall at 2 roster sizes × 2 models. Measure, don't claim.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat: trigger-rate gets fixture (context) + concurrency for plugin testing at scale

Two enablers for behavioral testing of OSS plugins, both surfaced by this
session's probing limits:

- `TriggerRateSpec.fixture` — seed files into each run's cwd so a skill is
  measured in the repo STATE it claims to trigger on. The default empty cwd is
  faithful for opening-move skills but under-measures state-dependent ones; this
  closes that gap (parity with measure()/runEval, which already had fixture).
- `TriggerRateSpec.concurrency` — run the prompts × trials grid through the
  existing runPool instead of fully serial. Default 1 (rate-limit polite); raise
  it to cut wall-clock on a large prompt set or roster sweep. The serial runner
  is what made the earlier sensitivity probe overrun.

Refactors runTriggerSet to flatten the grid into jobs + aggregate per-prompt
(order preserved); extracts runTriggerTrial (also drops the function under the
complexity ceiling). Unit tests with a fake runner prove fixture lands in the
cwd before the agent runs, and that concurrency>1 actually parallelizes while
aggregation stays correct. Docs + roadmap updated (step 1 of auto-context: done).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat: scan --trigger behavioral column + record empty-vs-seeded sensitivity

(a) scan --trigger — the model-gated behavioral column that stacks on the
structural scan (not a separate command). For each model-invocable skill in a
plugin it measures recall (+ precision) via measureTriggerRate and prints it as
a "Behavioral (trigger-rate)" section. Author-supplied prompts (a JSON map of
skill → { prompts, irrelevant }), never model-generated. Degrades honestly to
"unavailable" with no claude/auth; a thin prompt set is surfaced per-skill, not
a crash. Flags: --prompts= --concurrency= --model= --min-prompts=. New
src/scan-behavioral.ts (probePluginTriggers[With] + formatBehavioralReport),
keeps scanPlugin pure/sync; spawnAgent exported from eval.ts so the real runner
is shared. Unit tests with a fake runner; verified live against superpowers
(brainstorming recall 20%, rest unmeasured).

(b) Sensitivity recorded — empty 0.00 vs seeded 0.20 (10 runs each, via the new
fixture + concurrency). Inconclusive at n=10: empty itself spans 0.0/0.2/0.3
across three samples, so the +20pt delta is within the noise floor. The real
lesson — n=10 can't resolve a 20pt effect — is documented.

Docs: scan --trigger + marketplace + the -8 dangling-ref weight in cli.md;
cross-link from harness-testing.md; sensitivity result in
plugin-behavioral-findings.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs: behavioral findings 2 & 3 — superpowers recall sweep + haretrail scan

Finding 2 — superpowers recall sweep (vigiles scan --trigger across 6
opening-move skills, 10 prompts each): concrete imperative-task skills fire
reliably (test-driven-development 100%, writing-skills 100%) while exploratory /
orchestration skills barely fire (writing-plans 40%, brainstorming 10%,
systematic-debugging 10%, dispatching-parallel-agents 0%). State-dependent
skills left unmeasured on purpose (cold prompt = artifact). The 0-10% vs 100%
gap on structurally-green skills is the finding.

Finding 3 — fleytman/haretrail (Codex/AGENTS.md, 8 skills): structurally clean
(no agents/hooks/broken refs). Description-level risks worth a trigger probe:
Russian descriptions (cross-language trigger risk on English prompts), a literal
{data-repo} placeholder, and overlapping domains (debrief/lessons/postmortem,
task/research) = precision risk; good practice in the explicit trigger-phrase
lists + postmortem's negative cue.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat: scan flags non-Latin skill descriptions as a cross-language trigger risk

Operationalizes the haretrail catch as a deterministic, no-model check: each
skill description's dominant script is detected via Unicode \p{Script=…} (no
dependency), and a description ≥20% non-Latin (Cyrillic/CJK/Arabic/…) is flagged
"cross-language trigger risk" — the selector is English-centric, so it may
under-fire on English prompts. A RISK flag, not a structural defect (a
language-matched audience is fine), reported separately from the verdict and
pointing at the model-gated `scan --trigger` to measure the real gap.

ScanSkill.descriptionScript carries the detected script; formatScanReport notes
it per-skill + a summary line. Latin/English descriptions (and mostly-English
with a stray accented word like "résumé") are not flagged. Verified on the real
fleytman/haretrail (all 8 Cyrillic skills tripped) and superpowers (0 flagged).
Also extracts skillLine() (clears a pre-existing nested-ternary warning).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs: rule — one shared detector for lint+scan; behavioral column is the exception

Records the convention this session arrived at: a deterministic structural check
has ONE home (a single pure detector reused by both `lint` and `scan`, never
reimplemented in each, so they can't drift) — untested-surface, dangling-ref,
and non-Latin-description detection already work this way. The model-gated
behavioral column (scan --trigger / trigger-rate, observed egress) is the
deliberate exception: it's LLM-based (auth, tokens, non-deterministic), so it
lives only in scan/eval and is NEVER a lint rule. Cheap deterministic detection
can be a lint rule; expensive model-gated confirmation cannot.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* refactor: description-script check is expected-relative (default Latin) + Script union

Per review: Latin isn't special, it's a configurable DEFAULT. unexpectedScript(text,
expected="Latin") now flags the dominant script only when it DIFFERS from the
expected one — so a Cyrillic-targeted pack sets expected="Cyrillic", its Russian
descriptions pass, and an English one is flagged instead. Adds a `Script` string
union (ts-essentials: literal union over bare string) used by the detector, the
SCRIPTS table, and ScanSkill.descriptionScript. unexpectedScript is exported as the
single shared detector the future lint rule will reuse (one-detector-no-drift).
Reworded scan output + the CLAUDE.md rule from "non-Latin" to "unexpected script".

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat: eval-tier trace-parser seam (increment 1 of native Codex eval) + docs

Native Codex eval (measureTriggerRate/runEval for Codex) needs three things; this
lands the env-independent foundation and documents the rest.

- Increment 1 (shipped): makeContext's Claude stream-json parsing is extracted as
  parseClaudeRun and injected as a ModelOutputParser (default = Claude, zero
  behavior change). measureTriggerRateWith takes one as a 3rd arg, threaded via
  TriggerRunConfig.parse. A unit test drives a non-Claude line protocol + a custom
  parser end-to-end and detects firing — the exact slot a Codex
  `codex exec --json` parser plugs into.
- Spike recorded (no live binary here): the Codex driver's parseCodexRun returns
  toolCalls:[] by design, so the eval tier can't yet detect a Codex tool/skill
  call; and whether a Codex skill activation is even a discrete `codex exec --json`
  event is the open question only the binary can settle.

Docs (internal + public): research/codex-prototype-findings.md gets the spike +
increment plan + env-validation checklist; CLAUDE.md (eval.ts entry) notes the
parser seam; docs/harness-testing-codex.md and docs/harnesses.md mark Codex
runEval/trigger-rate as in-progress (not over-promised) with the three remaining
steps.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat: scaffold Codex eval runner + tolerant trace parser (increment 2)

src/adapters/codex/eval.ts (exported on vigiles/codex):

- parseCodexEvalRun(out): ParsedModelRun — a TOLERANT, multi-shape parser of
  `codex exec --json` JSONL. No codex binary in the build env, so the line schema
  is unverified: it probes BOTH plausible Codex event models (older
  {msg:{type,…}} stream, newer {type:"item.*", item:{…}} thread/item stream) and
  degrades to empty / output=trimmed-stdout on anything unrecognised. Each
  extractor (assistantText / toolCall / usage) is isolated so finishing against
  captured JSONL is a field-name edit. Returns the Claude-shaped ParsedModelRun so
  it slots straight into the increment-1 ModelOutputParser seam.
- codexEvalRunner — spawns real `codex exec --json` (v8-ignored; flags +
  skill-install wiring best-guess pending the binary).

Unit-tested over synthetic fixtures for both shapes + junk tolerance + the output
contract (src/adapters/codex/eval.test.ts). Deliberately NOT wired into the public
measureTriggerRate({adapter}) dispatch (increment 3) — gated until the schema and
the skill-selection question are confirmed against the live binary, so an
unvalidated parser can't silently report recall 0. Findings doc + checklist
updated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs: how to authenticate Codex for the eval tier (device-auth for headless)

The deterministic tier is keyless; only the eval tier (real model) needs Codex
auth. Documents the three flows in order of fit: `codex login --device-auth`
(URL + one-time code, the only one that works in a remote/sandbox box — no
localhost callback to forward), plain `codex login` (browser, local dev only),
and `printenv OPENAI_API_KEY | codex login --with-api-key`. Notes the network-
egress requirement, the `npm i -g @openai/codex` install (validated 0.141.0), and
the version-sensitivity of the `codex exec --json` schema. Ticks the install/auth
box on the env-validation checklist.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat: confirm Codex eval schema against the live binary + the skill-firing finding

Authed real codex (ChatGPT) and captured real `codex exec --json` turns, turning
increment 2 from a tolerant guess into a confirmed, live-validated parser.

Findings (now documented internal + public):
- Schema CONFIRMED (codex-cli 0.139.0): a thread/item JSONL stream — assistant =
  item.completed/agent_message→text; tool = command_execution→command (+
  aggregated_output/exit_code); usage on turn.completed (incl. cached_input_tokens
  → cacheReadTokens). Count item.completed ONLY (item.started repeats the id).
- THE skill question ANSWERED: Codex has NO discrete skill-selection event (no
  Skill tool). A trigger surfaces as the model READING skills/<name>/SKILL.md via
  a command_execution — so codexSkillFired() detects that read (best-effort; pair
  with a judged check). Validated live: a marker skill fired and was detected
  end-to-end through codexEvalRunner → parseCodexEvalRun → codexSkillFired.
- Version regression: pin codex 0.139.0 (0.141.0 broke the keyless mock recipe).
- Spawn gotcha: stdin must be /dev/null or codex blocks on stdin.

parseCodexEvalRun rewritten to the confirmed schema; fixtures replaced with REAL
captures; codexSkillFired added. Docs updated: harness-testing-codex.md (schema +
skill-firing sections), harnesses.md footnote, CLAUDE.md (eval.ts clause + new
Key Files entries), codex-prototype-findings.md (2026-06-19 live-capture update +
checklist ticked). Remaining: increment 3 — {adapter} dispatch into
measureTriggerRate/runEval.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs: trim public Codex eval docs to high-level (full findings stay internal)

The previous commit over-shared internal detail into the public docs (the full
codex exec --json JSONL schema, item.started/completed dedup, the version
regression specifics, the stdin gotcha). Those belong in
research/codex-prototype-findings.md (where they remain). Public docs
(harness-testing-codex.md, harnesses.md) now keep only the user-relevant level:
runEval-for-Codex is in progress, Codex has no skill-selected event (firing
detected via the SKILL.md read), pin 0.139.0 — and link out for the schema.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs: rule — match doc detail to audience (internal full record vs public link-out)

Adds the public-vs-internal-docs guidance rule: research/*.md + CLAUDE.md hold the
full record (schemas, parse mechanics, version regressions, spike notes,
checklists); public docs (docs/, README) state only what a user needs to act +
link out for the rest. Don't paste schemas/internal mechanics/version quirks into
a user-facing guide unless a user needs them to use the feature. Codifies the
trim just made to the Codex eval docs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs: haretrail native-Codex behavioral probe — cross-language risk refuted

First native-Codex behavioral eval (codexEvalRunner → parseCodexEvalRun →
codexSkillFired) on the real fleytman/haretrail skills, RU vs EN prompts:
research 3/3 RU & 3/3 EN, summary 3/3 & 3/3, debrief 3/3 & 2/3. The Russian
descriptions fire reliably on English prompts too — the deterministic
"non-Latin description → cross-language risk" flag is a correct RISK flag that
the model-gated measurement CLEARS here, so no "switch to English" fix is
warranted. The single debrief/en miss confirms codexSkillFired discriminates.
Logged in research (internal) per the audience-detail rule.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix: codexRunError — an errored/rate-limited Codex turn isn't a "skill didn't fire"

Dogfooding the haretrail precision probe hit a Codex usage limit, and every run
came back all-miss: parseCodexEvalRun left the errored turn an empty trace, so
codexSkillFired read it as a clean recall-0 miss — a rate-limit silently
corrupting trigger-rate with false negatives. codexRunError(out) now detects the
`error` / `turn.failed` event (incl. usage limits) so a caller skips/retries
instead of scoring it (the Codex analog of the Claude path's isRateLimited
backoff). Increment 3's dispatch must consult it. Test uses the real usage-limit
capture. Precision/overlap question remains unmeasured (retry after quota resets).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat: native-Codex trigger-rate dispatch via { evalDriver } (increment 3)

Wire the eval-tier harness dispatch so measureTriggerRate (and the
scan --trigger behavioral column) can route through a non-Claude harness,
with Codex as the first second-harness driver.

- eval.ts: EvalDriver { runner, parse, runError? } bundles a harness's
  AgentRunner + ModelOutputParser + an optional errored-run detector;
  claudeEvalDriver (default) + measureTriggerRate({ evalDriver }) select
  one. A trial whose runError fires is excluded from the denominator
  (an errored/rate-limited turn isn't a clean miss) and counted as
  report.errored.
- adapters/codex/eval.ts: codexEvalDriver (codexEvalAgentRunner +
  parseCodexEvalRun + codexRunError) + installCodexSkills (the Codex
  analog of --plugin-dir: copies skills into <cwd>/.codex/skills).
- scan-behavioral.ts: a HarnessProbe (buildProbe(dir, harness)) selects
  the driver + per-harness "fired" predicate (skillResolved/stubbed for
  Claude, codexSkillFired for Codex), so scan --trigger --harness=codex
  routes through the Codex driver.
- cli.ts: scan --trigger passes the detected harness through.

Built + fake-tested (injected driver, no binary); a live native eval
run remains, gated on Codex quota. Docs + spec updated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs: live-validate the native-Codex trigger dispatch (numbers still quota-blocked)

Re-ran the haretrail debrief/lessons/postmortem precision probe through the
shipped public path (`vigiles scan --trigger --harness=codex`) now that the
`{ evalDriver }` dispatch is wired. The Codex usage limit is still capped, so
the recall/precision NUMBERS remain unmeasured — but the run live-validated
increment 3's plumbing against the real binary:

- the CLI dispatched through the Codex EvalDriver and spawned real
  `codex exec --json`;
- `codexRunError` correctly EXCLUDED every errored trial (report showed
  `recall 0% (0 runs)` = n=0, not scored as misses) — the errored-run
  exclusion proven against reality, not just fakes;
- the diversity gate fired live (rejected a too-similar irrelevant pair).

So the only remaining gap is non-errored trials for actual numbers — a quota
wall, not a code gap. Saves the eval-ready cluster prompt set at
research/fixtures/haretrail-cluster.json for the retry.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix: command-only / MCP-only plugins are a real surface, not score 0

scoreReport treated any plugin with no skills/agents/hooks as "no loadable
plugin surface" (score 0/F) — but a command-only plugin (commands/*.md with a
valid plugin.json) or an MCP-only plugin (.mcp.json) is legitimate. Anthropic
itself ships command-only plugins (code-review, commit-commands) in its
marketplace, and the leaderboard graded both 0/F.

Count commands + MCP toward the loadable-surface check so they score on their
real structural health (a clean command-only plugin → 100/A); a truly empty
directory still scores 0. Found by scanning anthropics/claude-code.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* test: close the two dogfood untested-surface gaps + fix a migrate-to-spec drift

vigiles lint flagged two untested surfaces in our OWN plugin. Closing them
also surfaced a real skill bug:

- hooks/refs-nudge.sh: the sibling refs-hook.test.ts drives the CLI directly,
  so the SHELL WRAPPER (its not-a-node-project guard + exit-2-only propagation)
  was untested. Add a runHook unit test that drives the real script, pointing
  npx at a local node_modules/.bin/vigiles shim so it resolves offline.
- skills/migrate-to-spec: a user-invoked prose skill (model-driven, nothing
  deterministic to test), but it SHOWS agents an exact
  `import { … } from "vigiles/spec"` template. The template imported `check`
  and `every`, which vigiles/spec does NOT export — following the skill
  produced specs that fail to compile. Fixed the template and added a dogfood
  test asserting every taught import is a real vigiles/spec export (catches
  skill ⇄ API drift; names the surface so it counts as covered).

`vigiles lint` now reports all 9 surfaces tested.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs: surface `scan` (audit any plugin) in README + Codex/command-only in cli.md

- README: add a high-signal "Audit any plugin" bullet — the zero-setup,
  no-key scan/leaderboard is the strongest adoption hook and wasn't mentioned
  at all. Kept to one bullet per readme-brevity (links to the cli.md depth).
- cli.md: note that command-only / MCP-only plugins score as real surfaces
  (not 0), and that `scan --trigger --harness=codex` routes the trigger probe
  through the native Codex driver.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat: scan reports the instruction file on any cc/codex repo + lint-vs-scan docs

scan was plugin-oriented — on a plain repo (just a CLAUDE.md/AGENTS.md, no
skills/agents/hooks) it printed an empty inventory and didn't even mention the
instruction file, so it looked broken on the most common repo shape.

- scan: report the detected instruction file (CLAUDE.md/AGENTS.md) with
  spec-managed vs hand-written, so it's useful on ANY cc/codex repo. This is a
  read-only informational fact, NOT the require-spec gate (that stays lint's).
- docs/cli.md: add a "Lint vs scan — gate vs report" section with the full
  capability + target matrices (the answer to "do we need both / does it work
  on normal & Codex repos"). lint = config-driven gate (refs, 7 catalogs,
  exit codes); scan = zero-config read-only report (any plugin, leaderboard,
  + the paid --trigger column). They share one detector for the few common
  structural checks; everything else is intentionally asymmetric.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* test: e2e scan over the cc/codex/mixed/marketplace repo matrix

Drive the real built CLI (node dist/cli.js scan) across every repo shape, in
the free unit tier (deterministic, model-free, offline — like vendor.test.ts).

Two fixture sources by design:
- DOGFOOD pinned OSS plugins (examples/harness/vendor/*) for the Claude Code
  surface — real shapes (oh-my-claudecode multi-surface + MCP; the
  wshobson-accessibility inherits-all agent).
- ARTIFICIAL tmp fixtures for shapes we have no vendored example of: a Codex
  repo (AGENTS.md + TOML [mcp_servers] + skill), a mixed CLAUDE.md+AGENTS.md
  repo (detection-ambiguity warning + --harness override), a CC
  instruction-only repo (the new instruction-file line), and a marketplace
  (leaderboard expansion).

Covers the CLI scan WIRING the library-level scan.test.ts can't reach:
harness auto-detection, the ambiguity warning, --harness=, the leaderboard
branch, --json, and the read-only exit-0 contract.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix: scan honest on curated marketplaces + dedupe name-aliased plugin dirs

Two real bugs surfaced by sweeping ~13 popular plugin marketplaces (~650
plugins) + a variant mix of cc/codex/both repos:

1. A CURATED marketplace — every member an external git/url plugin, nothing
   vendored in-tree (obra/superpowers-marketplace, anthropics/claude-plugins-
   community with 2200 entries) — scanned as "nothing was loaded / no
   structural issues found", indistinguishable from a broken empty repo. Now
   inspectMarketplace classifies members on-disk vs external and scan reports
   `Marketplace "X": N plugin(s), all external (…not on disk)` honestly.

2. A marketplace that maps many NAMES onto the same dir (TheBushidoCollective/
   han: 338 names → 159 dirs) made the leaderboard double-scan and rank the
   same plugin repeatedly ("(338 scanned)" with duplicate rows). expandMarket-
   place now dedupes by resolved path → "(159 scanned)", no dup rows.

inspectMarketplace is the new source of truth (MarketplaceInfo: name/onDisk/
external/total); expandMarketplace delegates to it. The sweep also confirmed
robustness: no crash across all marketplaces, and correct harness detection +
instruction-file reporting across claude-only / codex-only / both-files repos
(openai/codex, sst/opencode, wshobson, obra, …).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix: eliminate scanner false positives found by sweeping real plugins

Sweeping ~13 marketplaces + a variant mix of cc/codex/both repos surfaced that
the scanner's "bugs" were mostly FALSE POSITIVES — a scanner that cries wolf on
working plugins can't drive adoption. Fixed four classes (all verified against
the real plugin that exposed them):

1. Multi-line QUOTED description (`description:\n  "…"`, trailofbits/react-pdf)
   was mislabeled "no description / can't trigger". readField now gathers an
   indented quoted scalar, not just block scalars.
2. Relative hook path (`./hooks/x.sh`, ananddtyagi/cc-marketplace) was reported
   MISSING because existsSync was cwd-relative. resolveScript now resolves a
   relative hook against the PLUGIN ROOT.
3. Existence-guarded hook (`[ ! -f x ] || x`, gmickel/flow-next) — an optional
   run-if-present — was flagged MISSING. Now treated as a conditional one-liner.
4. A project/runtime path in a script (`$CLAUDE_PROJECT_DIR/.claude/hooks/…`,
   flow-next) matched mid-path as a plugin ref. danglingRefs/isPluginRooted now
   only flags PLUGIN-rooted paths (bare or ${PLUGIN_ROOT}/…), skipping literal
   nested dirs and project/home vars; a genuine plugin-rooted miss still flags.

After hardening, the sweep's honest tally over 444 unique plugins: ONE real bug
(ananddtyagi/cc-marketplace's claude-dev-infrastructure ships crisis-debugging-
advisor + meta-skill-router with NO frontmatter → can't be model-triggered),
and the popular plugins are otherwise structurally clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs: record the structural sweep + public-disclosures / FPs-fixed list

New research/plugin-structural-findings.md (sibling of plugin-behavioral-
findings.md) logs the deterministic scan sweep of ~13 marketplaces / 444 unique
plugins:

- Public disclosures: the one genuine external-plugin bug found —
  ananddtyagi/cc-marketplace's claude-dev-infrastructure ships two skills with
  no YAML frontmatter (can't be model-triggered). Status: found, not yet
  reported upstream + disclosure etiquette note.
- Scanner false positives found by the sweep and fixed (the dogfood value):
  command-only 0/F, curated-marketplace "empty", han dedup, multi-line quoted
  description, relative ./hooks resolution, existence-guarded hook, project-
  rooted dangling ref — each with the plugin that exposed it + the fix commit.

Linked from plugin-behavioral-findings.md and distribution-strategy.md (E1) so
it's discoverable and not an orphan doc.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat: tool-contract validation — the cross-referencing moat in scan + lint

The deterministic scanner described tool contracts but never VERIFIED them. Add
the "valid is not true" moat to a subagent's `tools:` rail, as ONE shared
detector (src/core/tool-contract.ts) reused by three callers (one-detector-no-
drift): compileAgent (strict), scan (read-only), and a new agent-tool-contract
lint rule (severity-gated).

Calibrated HIGH-PRECISION after sweeping real plugins (the cry-wolf lesson):
- flags only never-available tools (curated denylist) + close typos (edit
  distance ≤2, with did-you-mean) — the two confident cases.
- a bare unrecognized tool is NOT flagged: a 280★ plugin uses
  TaskCreate/TaskGet/… consistently (plugin/MCP-provided), and our catalog
  can't know every tool — flagging those would be a false-positive flood.

Two real bugs this surfaced and fixed along the way:
- parseAgentTools didn't handle the inline ARRAY form (`tools: [Read, "Bash"]`)
  → it returned `[Read` / `Bash]`, which BOTH broke the PreToolUse rail (it
  would block Read) and tripped the check. Fixed at the source.
- builtinAgentTools was incomplete (missing LS/MultiEdit/BashOutput/KillBash) —
  a latent false "unknown tool" error in compileAgent itself. Catalog fixed.

Sweep result after calibration: 5 real never-available dead-contract entries
across 444 plugins (wshobson team-lead `Agent`, developer-kit/ananddtyagi
`AskUserQuestion`/`ExitPlanMode`), no flood. Leaderboard penalizes a dead tool
like a broken ref. New rule defaults to warn (no-op on repos without agents/);
doc + README + spec updated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat: hook-event validation (#2) — typo'd hook events in scan + lint

Cross-reference each hook's event name against the harness event catalog: a hook
registered under a name the platform doesn't define silently never fires. Shared
detector (src/core/hook-events.ts) → scan + the hook-events lint rule.

Caught/fixed two things before it could ship:
- dialect.hookEvents was WRONG and unused (PreSession/PostSession don't exist;
  SessionStart/SessionEnd/Stop/SubagentStop/UserPromptSubmit/PreCompact were
  missing). Corrected against the events real plugins register.
- Validating ALL unknown events flooded FPs: TheBushidoCollective/han ships a
  custom hook runtime (TeammateIdle, WorktreeRemove, …) — the event set is NOT
  closed. And ananddtyagi/sugar ships hooks as an ARRAY of {event:"tool-use"}
  objects (a non-CC format → Object.keys gave indices). So: high-precision
  (close typos only, via confidentHookEventIssues) + object-keyed shape only.

After calibration: 0 on 444 swept plugins (FP-safe), catches PreToolUSe→
PreToolUse at authoring. Default warn (no-op on this repo); doc + README + spec.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat: frontmatter-schema validation (#3) — missing name/description in scan + lint

A SKILL.md needs a `name` to load (CC keys a skill on its frontmatter name); a
subagent needs `name` + `description` to register. A missing field is a
structurally broken surface that silently never works. Computed in scanPlugin
(frontmatterIssuesFor) and consumed by scan + the frontmatter-schema lint rule.

Verified real on the sweep: 12 issues across 444 plugins, mostly ananddtyagi/
cc-marketplace — the headline bug (crisis-debugging-advisor / meta-skill-router
ship with no frontmatter) is now caught precisely as "missing name", plus
subagents (changelog-generator, …) that are pure prose with no frontmatter →
never register. Confirmed by hand (changelog-generator.md opens with prose, no
--- block). FP-safe (name is required; skill description stays on the skill line
to avoid double-counting). Default warn; doc + README + spec + tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat: MCP-config validation (#4) — unstartable MCP servers in scan + lint

A declared MCP server must say how to reach it: a `command` (stdio) or a `url`
(http/sse). An entry with neither can't start, and its tools silently go missing.
Shared detector (src/core/mcp-config.ts) → scan + the mcp-config lint rule.

FP-safe by construction: command-or-url is an unambiguous requirement, not a
catalog that could be incomplete. Reads .mcp.json + manifest mcpServers (JSON CC
shape); Codex TOML [mcp_servers] is a documented gap. Found 0 on the 444 swept
plugins (they all configure command/url correctly) — survivor bias, as expected;
the value is catching a malformed server at authoring time. Default warn; doc +
README + spec + detector/scan tests.

This completes the deterministic cross-referencing moat across the four agent
surfaces: tool contracts (#1), hook events (#2), frontmatter schema (#3), and
MCP config (#4) — each a shared detector reused by scan + lint (+ compileAgent
for tools), all calibrated high-precision against the real-plugin sweep.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix: tool-contract treats `tools: *` as a wildcard (inherits all), not unknown

A subagent declaring `tools: "*"` (all tools) was flagged `unknown "*" — did you
mean "LS"?` (editDistance("*","LS")=2). A wildcard isn't a tool to validate.
Skip "*" like the empty contract. Found on ananddtyagi/cc-marketplace's
problem-solver-specialist. One more cry-wolf case closed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix: frontmatter-schema is subagents-only — skills need no frontmatter (correction)

Verified against the Claude Code docs (prompted by skepticism that "those skills
never fire"): a SKILL.md requires NO frontmatter — `name` falls back to the
directory name, `description` to the first body paragraph — so a frontmatter-less
skill STILL loads and can fire. My earlier claim that ananddtyagi's
crisis-debugging-advisor / meta-skill-router "never trigger" was WRONG.

A subagent, by contrast, REQUIRES `name` + `description` with no fallback, or it
won't register — confirmed by docs/en/sub-agents. So:

- frontmatterIssuesFor now checks AGENTS ONLY (skill checks were false positives).
- Corrected the disclosures doc: the real ananddtyagi bug is ~9 prose-only
  SUBAGENTS that never register (changelog-generator, content-creator, …), NOT
  the skills. Added a loud correction note.
- Updated the rule doc (skills explicitly not checked + why), cli.md row, spec.

Re-tally after correction: 9 agent-frontmatter bugs in ananddtyagi (real,
docs-confirmed), the 2 skills + han's name-less skill correctly drop off. The
"verify before you claim" discipline catching my own overclaim.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs: empirically confirm the ananddtyagi agent finding (real claude CLI)

Cloned ananddtyagi/cc-marketplace and drove the real claude CLI to verify the
prose-only subagents really are inert (not just doc-inferred): listing subagents
omits the prose-only one, dispatching it returns NO_SUCH_AGENT, while a control
agent with frontmatter runs. Mirror test confirms a no-frontmatter SKILL still
loads (dir-name fallback). Both the agent bug and the earlier skill correction
now have ground-truth backing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* research: save superpowers trigger-probe fixture + session state before probe

Persists (compaction-safe): the recall-probe prompt set
(research/fixtures/superpowers-trigger-probe.json, 3 skills x 10 prompts) and a
durable session-state note in plugin-behavioral-findings.md — the 4-rule moat
shipped this session + the probe plan (results to be filled in after the run).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* research: superpowers trigger probe results — systematic-debugging fires 10%

Ran the recall probe on the SHIPPED scan --trigger path (claude 2.1.183, 10
prompts/skill on the subscription). Control test-driven-development fires 100%
(validates the measurement); systematic-debugging fires only 10% and
brainstorming 50%. A structurally-green skill silently never triggering on its
own use case — the behavioral bug the deterministic column structurally can't
see. Reconfirms the method-vs-situation trigger pattern on the shipped path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat: skill-frontmatter rule — recommend explicit skill name+description (warn)

Skills require NO frontmatter (name←dir, description←first paragraph), so a
missing one isn't a load failure — but relying on fallbacks is fragile (the
first paragraph is often a heading → a weak, accidental trigger surface). Add a
best-practice NUDGE: scanPlugin.skillMetaIssues (a soft ℹ note, never counted as
a structural defect or scored) + the `skill-frontmatter` lint rule.

This is the correct form of the earlier "two rules" idea, split by severity/
intent: `frontmatter-schema` = subagents (REQUIRED → won't register, correctness)
vs `skill-frontmatter` = skills (RECOMMENDED → reliable trigger surface, quality).
Default warn (the skill works without it); set "error" to enforce on your own
skills. vigiles's own skills pass. Doc + README + spec + tests.

Note (follow-up): the pre-existing scan `hasDescription` "can't trigger" line is
the same overclaim class — a skill with no frontmatter description still triggers
via the first-paragraph fallback. Left as-is for now (pre-existing, load-bearing
on the leaderboard); worth softening separately.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* refactor: rename frontmatter-schema rule → agent-frontmatter (symmetric pair)

With two frontmatter rules now, `frontmatter-schema` (agents) vs
`skill-frontmatter` (skills) was lopsided — one generic, one specific. Rename to
`agent-frontmatter` so the pair is parallel and self-describing: agent-frontmatter
(required → won't register) + skill-frontmatter (recommended → trigger surface).
Unreleased on this branch, so no back-compat cost. Config key + doc (git mv to
docs/rules/agent-frontmatter.md) + cli.md table + spec + research refs all
updated; internal symbol names left as-is (not user-facing).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix: soften skill 'can't trigger' overclaim — honor the first-paragraph fallback

The trigger-surface check flagged any skill without a FRONTMATTER description as
'can't trigger' — but Claude Code falls back to the first body paragraph, so a
skill with prose still triggers. Now hasDescription = frontmatter description OR
first body paragraph (firstBodyParagraph); only a skill with NEITHER is flagged.
The last instance of the frontmatter overclaim class. The explicit-metadata
best-practice stays the separate skill-frontmatter rule. (nodesc — name only,
body just a heading — is still correctly flagged.)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* research: ranked next-deterministic-rule ideas, grounded in the OSS sweep

New research/deterministic-rule-ideas.md — the curated backlog of next moat
surfaces, each the same 'valid is not true' cross-reference on a new surface,
high-precision by design (the session's recurring FP lesson). Tier 1:
mcp-tool-resolves (an mcp__server__tool whose server isn't declared),
hook-matcher (typo'd tool in a hook matcher), frontmatter-valid (malformed YAML).
Tier 2: duplicate-names, hook-shape, and the showpiece description-overlap — a
DETERMINISTIC precision-collision proxy reusing the NCD engine (catches a
--trigger-class bug with no model), grounded in haretrail's debrief/lessons/
postmortem overlap. Linked from roadmap Now.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat: add mcp-tool-resolves rule (the MCP half of the tool moat)

Cross-reference an `mcp__server__tool` in a subagent's contract against the
plugin's declared `mcpServers` — a server the plugin doesn't declare can't
resolve. Completes the tool moat: agent-tool-contract verifies built-in tools
but passes any mcp__* token unchecked; this verifies the MCP half.

One pure detector (src/core/mcp-tool.ts: verifyMcpToolServers) reused by scan +
the mcp-tool-resolves lint rule (one-detector-no-drift). Calibrated
high-precision via three guards, each grounded in a real plugin from the
mid-2026 sweep:
- GATE on a declared set — no .mcp.json → reaches global/project servers, flag
  nothing (ananddtyagi's mcp__ide__* shape).
- ALLOWLIST harness built-ins via a new optional dialect.knownMcpServers
  (Claude Code's `ide`); optional/additive, non-breaking for adapters.
- SKIP the plugin-namespaced mcp__plugin_<plugin>_<server>__ form (han's
  playwright-mcp — ambiguous join, the plugin's own server).

Validated FP-free across the whole sweep (0 hits) and fires correctly on a
synthetic undeclared-server plugin. Wired into scan (per-agent mcpToolIssues),
lint (warn default), and the leaderboard score. Doc + detector tests + scan
tests + CLAUDE.md/cli.md + regenerated API reports.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs: competitor rule matrix + verified OSS bug PR drafts

Save the 3-agent competitor landscape sweep (eval tools, plugin/skill
validators, MCP/security scanners) as research/competitor-rule-matrix.md: the
rule-by-rule matrix vs agnix / claudelint / cclint / Anthropic's own
`claude plugin validate`, the positioning finding (structural rules are
converging to table stakes; the moat is semantic cross-reference + harness
testing), and the ranked poach backlog.

Add research/oss-pr-drafts.md with ready-to-file PR/issue text for two
hand-verified third-party bugs the sweep found: subagents listing
AskUserQuestion/ExitPlanMode (silently dropped — Anthropic #12890/#18721) and
ananddtyagi's prose-only/blank-description subagents (won't register). Record
the verified non-bugs (test fixtures, codex source tree) so they aren't
re-chased. Cross-linked from plugin-structural-findings.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat: add hook-script-exists lint rule

Promote scan's missing-hook detection to a lint rule: a hook command
referencing a script file that doesn't exist on disk (with
${CLAUDE_PLUGIN_ROOT} resolved) silently never runs. Reuses scanPlugin's hooks
status (one-detector-no-drift) — FP-safe by construction (skips unresolved
$VARs, existence-guarded one-liners, inline commands).

Matches Anthropic's own `claude plugin validate`, making vigiles a superset on
the hook surface (poach #1 from the competitor matrix). Wired into lint (warn
default) + exit code; doc + types/validate + cli.md table + CLAUDE.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat: add disallowed-tools-contract lint rule (deny-side tool moat)

Cross-reference a subagent's `disallowedTools:` block-list against the catalog —
the mirror of agent-tool-contract. A close typo there blocks NOTHING (you meant
to deny `Bash`, wrote `Bsh`), so the tool stays available silently — worse than
no deny-list. New detector disallowedToolIssues in tool-contract.ts, calibrated
high-precision: only a close typo of a real built-in flags; a real tool is
legitimately blocked, a never-available tool is harmless to list, a bare unknown
is likely a plugin tool (no cry-wolf). A check no other validator does (poach
from SkillCheck).

Generalizes parseAgentTools → parseAgentToolList(md, key) for the disallowedTools
parse. Wired into scan (per-agent disallowedToolIssues) + lint (warn) + exit code
+ leaderboard; doc + detector/scan tests + types/validate + cli.md + CLAUDE.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat: agent-frontmatter also flags invalid model/color values

Extend the agent-frontmatter rule from "missing required field" to also catch an
invalid VALUE: a model: that's a close typo of an alias (inherit/sonnet/opus/
haiku) silently falls back; a color: typo is ignored. High-precision —
close-typo only (≤2 edits), a full/dated model id (claude-sonnet-4-5) is an
explicit form left alone, a far-off unknown is suppressed (no cry-wolf). Matches
Anthropic's own `claude plugin validate` + cclint (poach #3).

New frontmatterValueIssuesFor detector + frontmatterValueIssues on ScanReport,
folded into the same agent-frontmatter lint rule + scan Frontmatter section +
leaderboard; scan test; agent-frontmatter doc + cli.md + CLAUDE.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat: add description-overlap lint rule (deterministic precision proxy)

The showpiece: two model-invocable skills with near-identical descriptions can't
be told apart by the selector, so the wrong one fires (a precision collision).
findDescriptionOverlaps (core/description-overlap.ts) reuses proofs.ts ncd to
catch a --trigger-class behavioral bug with NO model — bridging the deterministic
and behavioral columns, a check no other plugin linter has.

Calibrated against the sweep: across 4678 within-plugin description pairs the
most-similar legitimately-distinct pair (create-issue/create-pr) sits at NCD
0.25, nothing below it — so the cutoff 0.2 fires only on basically-identical
text (FP-free on the whole sweep). User-invoked skills excluded (picked by
command, can't collide).

Wired into scan (descriptionOverlaps, reported as a precision risk) + lint (warn)
+ exit code; detector + scan tests; doc + types/validate + cli.md + CLAUDE.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs: mark second-wave rules shipped in the backlog

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(scan): section headers count entities, not output lines

The "Agents (N)" / "Hooks (N)" headers used the rendered line count, so an
agent's indented issue lines (and the inline-hooks summary line) inflated the
number — "Agents (4)" for one agent with three findings. section() now takes an
explicit count; Agents passes agents.length, Hooks passes hooks + inline.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* refactor: one lenient frontmatter reader (real YAML + regex salvage)

Replace the two divergent hand-parsers (scan's readField, agent-runtime's regex)
with a single shared reader, core/frontmatter-read.ts: try js-yaml (block
scalars, quoted multi-line, flow arrays parse correctly for free), fall back to
a regex salvage on malformed input and record malformed:true. readFrontmatter
never throws — it audits arbitrary third-party files — and frontmatterScalar /
frontmatterList preserve the exact semantics the PreToolUse rail depends on
(absent → null = inherits all, present-empty → [] = no tools). Anchored at file
start (+ optional BOM + optional leading vigiles integrity comment) so a body
--- hr is never read as frontmatter.

Behavior-preserving (agent-runtime/scan/vendor/dogfood suites green); js-yaml was
already a dependency. core/frontmatter.ts (the Level-1 vigiles: block) is a
different concern, untouched. Sets up frontmatter-valid (the malformed flag).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat: add frontmatter-valid rule (malformed-YAML frontmatter)

The payoff of the lenient-reader refactor: readFrontmatter's `malformed` flag
becomes a rule — a skill/agent `---` block that exists but isn't valid YAML, so
fields may not parse as intended.

Calibrated and shipped CONSERVATIVELY per the verify-before-claiming discipline:
a real YAML parser is stricter than some loaders, so a one-line description: with
a `: ` colon / <example> block is flagged though it may still load. The sweep
showed 7% of blocks flagged, concentrated in 2 repos (ananddtyagi, MadAppGang),
0 in the other 11 — a real authoring smell, but NOT empirically confirmed to
fail loading. So: default WARN (not error), scan surfaces it as an informational
ℹ note (not a structural defect, no leaderboard penalty), doc states the caveat
and says verify before setting error. The unambiguous cases (unclosed bracket,
tab, duplicate key) are real regardless.

Same detector as scan (malformedFrontmatter); detector reuses the shared reader.
Wired into lint + scan note; doc + scan test + types/validate + cli.md + CLAUDE.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* test: dogfood the scan rules against real vendored plugins (FP-guard + bug fixture)

Lock the deterministic rules against reality, offline + model-free, alongside the
existing loader dogfood. src/scan-vendor.test.ts asserts golden scan verdicts:

- FP-GUARD: oh-my-claudecode / wshobson-accessibility / superpowers must stay
  CLEAN — every high-precision rule field zero (the regression that catches a
  rule going noisy; the don't-cry-wolf bet).
- TRUE-POSITIVE: a minimal MIT slice vendored BECAUSE it reproduces a real bug —
  madappgang-frontend@6097ad4 tester.md (a single agent file) — must keep firing
  agent-tool-contract (AskUserQuestion never-available) AND frontmatter-valid
  (the one-line description: is invalid YAML).

Only the structural file is vendored (not the repo), only from a permissive
(MIT) upstream — ananddtyagi has no LICENSE, so its files are NOT committed (its
bug stays in research/oss-pr-drafts.md). Provenance + licensing in
examples/harness/vendor/SOURCES.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs: make the OSS bug drafts filing-ready (recipe + worked diffs)

Add a per-repo filing recipe (branch / mechanical edit / conventional commit /
gh pr create) plus worked before→after diffs for both verified bugs — the
comma-form and array-form AskUserQuestion removal, and the missing-frontmatter
prepend. States plainly these can't be filed from a vigiles-scoped session.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs: add PR #40 handoff (resume-here state + next-session prompt)

Single consolidated handoff for the branch: what shipped (the deterministic rule
suite, scanner hardening, the lenient-reader refactor, the vendor dogfood, the
research + OSS PR drafts), the disciplines that must carry forward
(verify-before-claim, high-precision, calibrate-against-the-sweep,
one-detector-no-drift, check-license-before-vendoring), the ranked open
follow-ups (file the OSS PRs, README positioning, the remaining backlog rules),
and a paste-ready next-session prompt. Linked from deterministic-rule-ideas.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat: add mcp-hook-target-resolves rule (the moat on the hook surface)

Cross-reference a `type: "mcp_tool"` HOOK action against the plugin's declared
MCP servers (verified real: CC hooks support command/http/mcp_tool/prompt/agent,
and mcp_tool requires server+tool). Flags two silent-no-op cases: an incomplete
action missing server/tool (unambiguous, always — like mcp-config), and a server
the plugin doesn't declare (gated on a declared mcpServers set + built-ins like
`ide` allowlisted, mirroring mcp-tool-resolves).

New detector core/mcp-hook.ts (verifyMcpHookTargets), wired into scan
(mcpHookIssues) + lint (warn) + exit code + leaderboard; detector/scan tests;
doc + types/validate + cli.md + CLAUDE.md. FP-free across the sweep (0 mcp_tool
hooks in the wild — advanced feature; value is authoring-time + moat completion).
The regex matcher surface is left to a future hook-matcher rule.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs(readme): lead with the cross-reference moat; surface plugin audit

Per research/competitor-rule-matrix.md: the structural lints (hook-events,
agent-frontmatter, mcp-config) are now table stakes — Anthropic's own
`claude plugin validate` ships them — so don't headline them. Elevate what's
actually the moat: cross-referencing a declared reference against LIVE tooling.

Extend the Lint section to the plugin surface — `vigiles scan` checks a plugin's
contracts (subagent tools, mcp__server__tool, mcp_tool hooks, hook events, script
paths) actually exist AND resolve, "a superset of Anthropic's `claude plugin
validate`" (valid YAML ≠ a tool that's real). Retarget the old "Audit any plugin"
More bullet to the leaderboard + --trigger so it doesn't duplicate. Stays within
the readme-brevity budget (150 lines).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-20 01:13:32 +07:00
zernie 2393b155c6 fix: repair broken main — 100% coverage gate + CLAUDE.md integrity/format conflict (#38)
* fix: repair broken main — 100% coverage gate + CLAUDE.md integrity/format conflict

PR #37 left main red on two CI jobs:

- test job: the eval.ts ephemeral-env + interceptTools compose path
  (the `if (overlay) Object.assign(env, overlay)` line) was unexercised,
  dropping statement coverage to 99.79% and failing the 100% gate. Add a
  unit test that drives both features together and asserts the intercept
  overlay survives the env scrub.

- check job: `vigiles compile` emits markdown like `skills/*` but prettier
  re-escapes it to `skills/\*`, desyncing CLAUDE.md's integrity hash. The
  compiled CLAUDE.md is a vigiles-owned exact-format artifact (hash-gated),
  so add it to .prettierignore alongside the other tool-generated files and
  recompile so the committed bytes match the spec. The spec stays formatted.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore: update session state timestamps

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs: tighten README — drop "pillar", footnote the Latin, sharpen the sell

- Move the "Quis custodiet ipsos custodes?" epigram to a footnote on the name;
  open with a real one-line pitch instead.
- Drop the "pillar" jargon everywhere; lead with the two verbs (Lint / Test).
- Lint hook now leads with a renamed file + script (the relatable case), not a
  disabled eslint rule.
- Rename the Test heading "does your harness fire?" → "do its job?" and lay out
  the full scope as bullets (block / trigger w/ recall+precision / behaviour via
  evals / safety) — firing is only one of them; evals are now explicit.
- State plainly that tests are deterministic (no model, no API key) and evals
  run on your Claude subscription, never metered API tokens, with links.
- Cut ~45 lines of wall-of-text (Test section more than halved).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs: make README a scannable front door + add promptfoo eval comparison

Rewrite the readme-brevity rule (in CLAUDE.md.spec.ts → recompiled) to demand a
WOW-on-first-screen, phone-scannable front door: short (~140 line target), no
walls of text, great formatting, links out for detail, and a required promptfoo
comparison in the evals section.

Fix the README to match: add a compact 3-column cost table contrasting
promptfoo/DeepEval (metered API SDK, per-token) against vigiles ($0 extra, runs
on your Claude subscription, most tiers need no model at all).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs: move Quick start above the fold (hook → what → get-it-now → why)

Place the slim Quick start right after the what-it-does table, before the Lint
and Test deep dives, so a skimmer can try `npx vigiles init` in seconds; the
deep-dive sections now read as the "why it's worth keeping". Encode the rule in
readme-brevity (CLAUDE.md.spec.ts → recompiled): install path above the fold,
verbose setup kept in a <details> so the top stays lean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs: add docs-quality rule + align lint/test guides with the new README

- New `docs-quality` guidance rule (CLAUDE.md.spec.ts → recompiled): the docs/
  reference docs are the HOW the README defers to — NOT held to README brevity
  (depth is their job), but to a doc-appropriate polish bar: open with a one-line
  "what this is" + an up-link to the README, stay scannable (headings, Contents,
  tables, runnable code), cross-link siblings + "See also", and stay consistent
  with the front door (terminology, the promptfoo cost contrast, no stale paths).
- Polish the two linked guides accordingly: the testing guide gains the same
  "README has the pitch; this is the full guide" up-link + a sibling link to the
  lint guide; the lint guide drops the "Pillar 1" opening (consistent with the
  README dropping "pillar") and gains the sibling link to the testing guide.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore: add npm repository/homepage/bugs/keywords/license metadata

The package is live on npm (vigiles@5.0.0) but package.json lacked discovery
metadata: no repository (so npmjs.com had no link back to GitHub), no homepage,
bugs, keywords, or license, and a stale description (the old "compile .spec.ts"
framing). Add them and update the description to the current "lint & test the
harness" positioning so npm search and the npm↔GitHub link are correct.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs: scrub "pillar" from the docs and CLAUDE.md spec (use "layer")

Following the README, drop the "pillar" jargon from the user-facing docs and the
CLAUDE.md positioning/rules — "layer" throughout (the linting layer / the testing
layer), matching the front-door voice. Recompiled CLAUDE.md; anchors and
cross-links updated consistently. research/ left as-is (internal design vocab).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore: regenerate generated.d.ts (sync npm scripts + project files)

Regenerated after the package.json metadata change; also picks up pre-existing
drift (api:report/api:check/docs:api scripts, vendor-coverage.test.ts) the
committed file was missing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore: remove the deprecated demos (examples/demo + plugin-test-demo)

The two demos were deprecated and no longer the surfaced front door. Delete them
and every reference: the demo/demo:plugin npm scripts, the doc callout in the
harness-testing guide, the examples/harness README block (now points at
npx vigiles test/eval), and the .gitignore/.prettierignore lines. Regenerated
generated.d.ts (scripts + project files). The roadmap item is updated to "build
the ONE polished front-door demo" (the deletion is done; the polished demo + GIF
remains as the real next step).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs(roadmap): record Sogen evaluated-and-rejected as a sandbox backend

Note in the rejected/parked section so it isn't relitigated: Sogen is a
syscall-level Windows/Linux binary emulator for malware/DRM research (host
isolation "might not be perfect") — wrong workload/guarantee/gap for confining
Node+shell. The transferable idea (snapshot + deterministic replay) we already
do at the filesystem/trace layer.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-18 19:48:24 +07:00
zernie 71b6c4c3d3 fix: finish audit→lint rename — repair CI build, shipped hook, and docs (#34)
* fix: finish audit→lint rename — repair CI build, shipped hook, and docs

The `audit` command was renamed to `lint` in 2c64c62, but the rename never
reached CI, the SessionStart hook, the CLI help, or the docs — so the `check`
job ran `vigiles audit` ("Unknown command", exit 1) and the build badge went red.

- ci.yml: run `vigiles lint` (+ the action dogfood `command: lint`)
- hooks/session-start.sh: `vigiles lint --summary`
- examples/demo/run.sh: `vigiles lint` (npm run demo was broken too)
- src/cli.ts + action.yml: help text / input description say `lint`
- docs/harnesses.md: de-stale the "second harness lands" framing (Codex
  already shipped), trim two over-explained sections, align Pillar 1/2 → Lint/Test
- docs/harness-testing.md: trim the demo callout, audit→lint
- README.md: paste-prompt as a copyable code block; fold init details into <details>

* docs: research core-plus-adapters API design (grounds the pillar-2 relayout)

Five-angle survey (AI SDK, unplugin, Drizzle, Knex, Testing Library, ESLint,
OpenTelemetry, dependency-cruiser, semver/exports) of how comparable tools lay out
a harness-agnostic core + per-target adapters, written to ground the pillar-2 API
relayout. Verdict: keep one package with subpath exports; move the agnostic runners
out of src/adapters/claude-code to the composition root (non-breaking — exports
hide file paths); select by import in the library, string only in the CLI (never
resolve a string to a module on a library path); add an eslint boundary rule so an
agnostic barrel can't import a specific adapter; parameterize the conformance kit
over ADAPTERS; mind the default-param tree-shaking trap.

Linked from research/code-adapter-architecture.md + research/README.md.

* refactor: route agnostic pillar-2 barrels through composition-root modules

Step 1 of the pillar-2 relayout (research/adapter-api-design.md). The harness-
agnostic public entries (vigiles/testing, /unit, /integration, /e2e) no longer
`export *` from src/adapters/claude-code/* — they route through composition-root
modules (src/{harness-test,run-hook,eval,mock-model}.ts), and a new
eslint-plugin-boundaries `agnostic-surface` element forbids them from importing
any adapter (proven to flag the old pattern). exports map repointed accordingly.

Next step relocates the runner *logic* to these composition-root modules so the
100% coverage gate (which already lists them at src/ root) actually covers it.

* refactor: relocate harness-testing library to the composition root

Step 2 of the pillar-2 relayout (research/adapter-api-design.md). Physically move
the deterministic harness-testing modules out of src/adapters/claude-code/ to the
composition root src/: harness-test, run-hook, eval, eval-cache, eval-baseline,
stats, mock-model, mock-entry, sandbox, egress(+entry/proxy), judge (+ tests). The
adapter keeps the ports + bundle + harness glue (dialect, layout, runtime,
hook-protocol, model-mock, adapter, agent-*, skill-*, plugin-loader, run-scripts).

This makes the 100% coverage gate — whose include list already named these at
src/ root — actually cover them: gated statements go 268 → 902 (the gate was
near-empty because egress/sandbox/judge were listed at root but lived in the
adapter, so the v8 include glob matched nothing). Coverage gaps the now-live gate
exposed in egress.ts were closed with real tests, not v8-ignores.

Pure relocation + import-path fixes + coverage-include (added stats, eval-cache);
no logic or public-export changes. Build, lint (boundaries clean), 863 tests, and
the 100% gate all green.

* docs: split harness-testing into agnostic core + per-harness guides; sync spec

Step 3+4 of the pillar-2 relayout.

Docs: docs/harness-testing.md is rewritten as the harness-AGNOSTIC core (retitled
"Testing your harness"): leads with select-by-import + { adapter } (default Claude
Code), the Trace/predicates/assertions model, runHook/runHarnessTest/runEval shown
agnostically, significance + regression gating, and a promoted runner-integration
section (vitest/jest is the runner-agnostic seam, and it's tested in CI). The
Claude-Code-specific walkthrough (oh-my-claudecode, ${CLAUDE_PLUGIN_ROOT}, the
Anthropic mock, sandbox/egress) moves to docs/harness-testing-claude-code.md, and
docs/harness-testing-codex.md covers the Codex path (runHarnessTest with
codexAdapter against real codex exec; subagents a deliberate non-goal, runEval a
documented follow-on). Both linked from the index + harnesses.md (orphan-docs ✓).

Spec: CLAUDE.md.spec.ts Key Files repointed to the relocated module paths
(src/adapters/claude-code/{harness-test,run-hook,eval,...} → src/...), the
architecture section updated to describe the composition-root harness-testing
library + the new agnostic-surface boundary rule, and entries added for the two
new docs + research/adapter-api-design.md. CLAUDE.md recompiled (hash valid).

* docs: fix stale `vigiles audit` references → `vigiles lint`

The audit→lint command rename left 16 user-facing docs/examples telling users to
run a command that no longer exists. Sweep them: docs/comparison, inline-mode,
markdown-mode, spec-format, skills, verifying-instruction-files, testing-matrix,
README, docs/rules/* and examples/{demo,frontmatter-CLAUDE}. `vigiles lint`
(integrity + orphan-docs + refs) stays green; no command now points at the
removed `audit`.

* fix: repoint test/example imports to the relocated runner dist paths

The step-2 relocation rewired src/ imports but missed consumers outside src/:
test/types/smoke.{vitest,jest}.ts and examples/harness/*.mjs (+ dogfood, bench,
plugin-test-demo) still imported dist/adapters/claude-code/{harness-test,eval,
run-hook,sandbox}.js, which moved to dist/*.js. The CI test:types step (TS2307)
and the harness job (ERR_MODULE_NOT_FOUND) caught it — local `npm test` doesn't
run those tiers. Repointed every dist/adapters/claude-code/<moved>.js → dist/<moved>.js.

* fix: repoint vigiles/judge export + regenerate path-union types

Two more relocation leftovers: the package.json "./judge" export still pointed at
./dist/adapters/claude-code/judge.js (judge.ts moved to src/, so the public
vigiles/judge subpath was broken), and .vigiles/generated.d.ts still listed the
old src/adapters/claude-code/<moved> paths. Repointed ./judge → ./dist/judge.js
and regenerated the type union (generate-types --check now passes).

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-15 19:34:08 +05:00