Three rows of detector/README.md describe values the engine does not
return. The npm package exposes analyzeText as its only entry point, so
a caller branching on these gets code that never matches.
- label: getLabel() returns six scored strings, and the four listed were
truncated forms of them. Clean (score 0) and Moderate AI signals
(36-60) were missing, and the real strings carry an "AI signals" or
"AI patterns" suffix, so `label === "Minimal"` is never true.
- document_classification: the early-exit paths return a fourth value,
UNSCORED, on empty, too-short, and too-long input. Documented with the
rest of that result shape, since score 0 alone cannot distinguish
unscored input from clean text.
- contextMode: VALID_CONTEXT_MODES accepts four modes, not two. Passing
marketing or personal is valid and is reported in stats.contextMode;
only technical currently changes what gets flagged, which the text now
says rather than implying the other two are rejected.
Verified against the engine:
node -e "const D=require('./detector/patterns.js'); for (const s of [0,1,15,16,35,36,60,61,80,81,100]) console.log(s, D.getLabel(s))"
node -e "const D=require('./detector/patterns.js'); console.log(D.analyzeText('').document_classification)"
No behavior change. npm test and self-scan:check pass.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015w3yGvreSY5CLyBG7zgCKK
Adds a preservation validator, a self-scan with PROOF.md, over-correction guardrails, a false-positive intake, and a two-class control corpus with the project's first FPR, TPR, and AUC.
Splits Tier 1 into 1A frequency markers and 1B clarity edits, and fixes two detector defects the measurement found (#67, #69).
Findings and open decisions: #70, #71, #72, #73.
* feat: make repo SSOT for the detection engine
Extract the 43-category detection engine + its dependency-free node test
harness from the (winding-down) private web-app repo into detector/, so this
open-source repo is now the canonical source of truth for both the rules
(SKILL.md) and their executable expression (detector/patterns.js).
- detector/patterns.js: zero-dep, build-step-free, runs in node>=18 + browser
- detector/patterns.test.js: 60 fixtures, no deps (node:assert)
- package.json + CI: `npm test` on push/PR touching detector/
- detector/CATEGORIES.md: anti-drift map of SKILL.md sections <-> detector types
- README: "Run the detector" section
The cert/attestation/x402/token layer stays behind in the private app; the
engine is a pure function with no knowledge of it.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* docs: reclassify smart-punct-signature as a partial skill map
Community PR #15 adds a curly-quotation-marks rule under SKILL.md's
Formatting section, so smart-punct-signature is no longer detector-only.
Move it from section B to a partial mapping in section A, noting that the
detector requires 4-signal co-occurrence while the skill rule treats curly
quotes as a weak corroborating signal — the two agree in spirit but differ
in mechanism.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test: enforce CATEGORIES.md contract; docs: contributor guide + count clarity
- detector/categories.test.js: asserts every detector type is documented in
CATEGORIES.md and no stale type rows remain; wired into `npm test`.
- README + CATEGORIES.md: note that the 42 prose patterns, 43 detector types,
and ~50 SKILL.md sections are different counts on purpose — don't reconcile.
- CONTRIBUTING.md + PR template: encode the regex-vs-judgment decision, the
precision-over-recall bias, npm test, the clean-prose bar, and changelog/
version conventions — the things the first community PR surfaced by hand.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* docs: require contributors to cite sources for empirical claims
Rules that assert how AI or humans write get fact-checked; some turn out
wrong (e.g. the curly-quote premise). Add a "Cite your sources" section to
CONTRIBUTING.md and a checklist item to the PR template.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test: require detector types to appear in a CATEGORIES.md table, not just prose
Tighten the anti-drift check so a type "documented" by a stray backtick
mention in prose no longer satisfies the gate — it has to land in an actual
mapping-table row, matching the test's own summary line.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>