feat(config-audit): cache-prefix stability scanner CPS (v5 N3) [skip-docs]
New CPS scanner walks CLAUDE.md cascade and flags volatile content
between lines 31 and 150 — the cache-prefix window beyond TOK Pattern
A's top-30 territory. Volatile content anywhere in the cached prefix
forces a fresh cache write from that line down on every turn.
Volatile-pattern set extends TOK Pattern A with:
- shell-exec lines (! prefix) — common in CLAUDE.md to inject git/date
- ${VAR} substitutions — vary per-shell, defeat cache reuse
Severity: medium per finding. Skips lines 1-30 to avoid duplicating
Pattern A's range; CPS' value is in the 31-150 zone.
Wired into scan-orchestrator + scoring SCANNER_AREA_MAP. CPS shares
the "Token Efficiency" area with TOK; scoreByArea now deduplicates by
area name and combines counts across scanners contributing to the
same area, so the 9-area scorecard contract holds.
Fixtures volatile-mid-section/{volatile-line-60, volatile-line-200}
verify both positive (line 60) and out-of-window (line 200) cases.
[skip-docs] reason: v5 plan fences off README/CLAUDE.md badge updates
to Session 5; Forgejo pre-commit-docs-gate hook requires this tag.
Tests: 604 → 611 (+7).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
0420b8cc4a
commit
65087e624f
6 changed files with 517 additions and 9 deletions
|
|
@ -24,6 +24,7 @@ import { scan as scanImports } from './import-resolver.mjs';
|
|||
import { scan as scanConflicts } from './conflict-detector.mjs';
|
||||
import { scan as scanGap } from './feature-gap-scanner.mjs';
|
||||
import { scan as scanTokenHotspots } from './token-hotspots.mjs';
|
||||
import { scan as scanCachePrefix } from './cache-prefix-scanner.mjs';
|
||||
|
||||
// Directory names that identify test fixture / example directories
|
||||
const FIXTURE_DIR_NAMES = ['tests', 'examples', '__tests__', 'test-fixtures'];
|
||||
|
|
@ -55,6 +56,7 @@ const SCANNERS = [
|
|||
{ name: 'CNF', fn: scanConflicts, label: 'Conflict Detector' },
|
||||
{ name: 'GAP', fn: scanGap, label: 'Feature Gap Scanner' },
|
||||
{ name: 'TOK', fn: scanTokenHotspots, label: 'Token Hotspots' },
|
||||
{ name: 'CPS', fn: scanCachePrefix, label: 'Cache-Prefix Stability' },
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue