docs(ENG-3282): refresh the README after the 0.9.3 model swap

Merged
HI
1mo ago
+52-33

A reviewer checked every README claim against the code. Snippets were type-checked against dist and behavior was checked at runtime. I re-verified the main findings. For example, multi-head mode is off by default (tier2MultiheadBlocked is undefined, and true only with tier2Config.multihead), and no source file reads multihead_presets.

Wrong before

  • Presets (my mistake in #115): the text implied the multi-head presets apply on their own. They don't. The README now documents the tier2Config: { multihead: {...} } opt-in, and tier2Config is added to the options block.
  • defendToolResult: the signature was missing options ({ context, signal }), and the description said it runs only Tier 1 and Tier 2.
  • DefenseResult: it was missing tier2Available, coverageDegraded and tier3.note, and it said tier3 is present only when Tier 3 ran.
  • Anthropic SDK snippet: filter kept the system role in the type, which the SDK's message type rejects.
  • Vercel AI SDK example: anthropic was never imported, and it used an old model ID.
  • Risky fields: the github_* row was missing content (config.ts).
  • riskLevel: it said the level is never reduced. Tier 3 can lower it in cascade and sets it in tier3_only.
  • Override warning: it fires once per process, not once per instance.

Missing before

  • Node 22+ and the fasttext.wasm peer needed for useSfe.
  • The maxTokens default, legacyMaxTokens and fetch.
  • The batch context and { signal }.
  • A note that Tier 2 rarely reports medium with the bundled model (relevant to onError: "block").

Also: the build note is rewritten in plain sentences, and stale code comments are fixed. Those comments cited v5's multihead thresholds and 0.64, and said a single-sentence field "is blocked" when the cleaner actually leaves it untouched.

Not in this PR: the benchmark table and the F1/latency badges still describe an old model. That's waiting on a decision: re-measure them, or replace them with the release-gate numbers.

docs: doesn't release. Checks: 710 tests pass, test:typecheck passes, and lint shows only the pre-existing warning.

🤖 Generated with Claude Code


Summary by cubic

Refreshes the README so its claims match the code after the 0.9.3 model swap, updates stale comments in tier2-classifier.ts and prompt-defense.ts, and pins the recalibrated 0.52 high-risk boundary in tests.

Key corrections:

  • Multi-head mode is off by default; documents the tier2Config.multihead opt-in instead of implying presets apply automatically.
  • defendToolResult now shows its options argument; DefenseResult adds tier2Available, coverageDegraded and tier3.note.
  • Fixes the Anthropic and Vercel AI SDK snippets (role filter, missing import, outdated model ID).
  • Adds the Node 22+ requirement and the fasttext.wasm peer needed for useSfe.
  • Covers maxTokens default, legacyMaxTokens, fetch, batch context/signal, and riskLevel under Tier 3.
  • Corrects the override warning to once per process, adds content to github_*, and notes Tier 2 rarely reports medium with the bundled model.
  • Rewrites the build note, updates classifier comments that cited v5 thresholds, and documents the [CONTENT SANITISED] marker in the sanitisation comment.
  • Adds spec assertions that Tier 2 rates 0.52 as high (the bundled model's boundary) and that blocking still requires blockHighRisk.
  • Replaces the benchmark table and F1 badge with measurements for the 0.9.3 model (F1 0.865 average through the package pipe at the default 0.52 threshold); the prior 0.908 used a different method and is not comparable.