fix(tokens): refresh stale "Opus 4.7" framing to model-neutral + Opus 4.8 anchor

Fase 4 token-opt, Item 1 of gap-review NEXT STEP #2. The prompt-cache pattern corpus + TOK scanner were frozen at an "Opus 4.7" framing after CC shipped Opus 4.8 (default, 2.1.154) and Fable 5 (2.1.170). Model-era facts re-verified against the official changelog cache before editing.

The patterns are properties of prompt-caching, not of any model, so mechanic text is now model-neutral with a single "current default: Opus 4.8" anchor — preventing a re-freeze at the next model bump.

- rename knowledge/opus-4.7-patterns.md -> prompt-cache-patterns.md (git mv, history preserved); 6 reference sites updated
- TOK scanner: line-318 finding text (human-facing) made model-neutral; header + cache-prefix-scanner + CLI comments refreshed
- configuration-best-practices.md body + footnote 4.7 -> 4.8
- human-facing docs: commands/{tokens,help,manifest}.md, project CLAUDE.md, README, docs/scanner-internals.md
- gap-matrix row marked DONE; future Items 2/3 retargeted to new filename

Failing-test-first (Iron Law): +2 knowledge staleness guards (era-anchor + no-refreeze) +1 scanner assertion (no stale model anchor in finding text). Suite 853 -> 856 green; zero snapshot drift; self-audit A(97) PASS. CHANGELOG / v5 plan / ratified gap-plan keep historical opus-4.7-patterns refs (correct record of past state).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ter3E2JSi1Khgmuf2kady8
This commit is contained in:
Kjell Tore Guttormsen 2026-06-18 15:27:36 +02:00
commit 8376dab83f
15 changed files with 66 additions and 40 deletions

View file

@ -5,7 +5,7 @@
* cached prefix ( CACHED_PREFIX_LINES). Distinguishes from TOK Pattern A,
* which only inspects the top 30 lines: CPS catches a `!git log` at line 60
* or a `${TIMESTAMP}` at line 100. Volatile content anywhere in the cached
* prefix breaks Opus 4.7 prompt-cache reuse from that line forward.
* prefix breaks prompt-cache reuse from that line forward.
*
* Volatile patterns extend the TOK set with shell-exec `!` prefix and
* `${VAR}` substitutions both common cache-busters in real CLAUDE.md files.

View file

@ -1,7 +1,7 @@
#!/usr/bin/env node
/**
* token-hotspots CLI emit ranked token hotspots and Opus 4.7 pattern findings
* token-hotspots CLI emit ranked token hotspots and prompt-cache pattern findings
* for a target repo path.
*
* Usage:

View file

@ -1,7 +1,7 @@
/**
* TOK Scanner Token Hotspots / Opus 4.7 patterns
* TOK Scanner Token Hotspots / prompt-cache patterns
*
* Detects three structural Opus 4.7-era token-efficiency patterns
* Detects three structural prompt-cache token-efficiency patterns
* (severities recalibrated for tokens/turn impact in v5 F7):
* CA-TOK-001 cache-breaking volatile top in CLAUDE.md (high)
* CA-TOK-002 redundant tool/permission declarations (medium)
@ -15,7 +15,7 @@
* a `hotspots` array (10 entries, possibly fewer for tiny projects) on the
* scanner result.
*
* Pattern catalogue: knowledge/opus-4.7-patterns.md
* Pattern catalogue: knowledge/prompt-cache-patterns.md
* Token heuristic: estimateTokens() in scanners/lib/active-config-reader.mjs
*
* Zero external dependencies.
@ -315,7 +315,7 @@ export async function scan(targetPath, discovery) {
description:
`The first ${VOLATILE_TOP_LINES} lines of ${f.relPath || f.absPath} contain volatile ` +
'tokens (timestamps, session ids, or activity logs). Volatile content above stable ' +
'content defeats Opus 4.7 prompt-cache reuse on every turn.',
'content defeats prompt-cache reuse on every turn.',
file: f.absPath,
evidence: CALIBRATION_NOTE,
recommendation: