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:
parent
b3c572ad46
commit
8376dab83f
15 changed files with 66 additions and 40 deletions
|
|
@ -109,6 +109,6 @@ when structural signal alone isn't enough.
|
|||
|
||||
## See also
|
||||
|
||||
- `knowledge/opus-4.7-patterns.md` — structural patterns the TOK scanner detects (CA-TOK-001..005)
|
||||
- `knowledge/prompt-cache-patterns.md` — structural patterns the TOK scanner detects (CA-TOK-001..005)
|
||||
- `knowledge/configuration-best-practices.md` — CLAUDE.md cache-stability guidance
|
||||
- `/config-audit tokens --with-telemetry-recipe` — surfaces a pointer to this file in JSON output
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
## CLAUDE.md
|
||||
|
||||
1. **Optimise for prompt-cache stability.** Place stable content in the first 30 lines (cache-friendly prefix); volatile content (timestamps, dynamic counts, rolling activity logs) goes below that threshold or moves to an `@import`-ed file outside the cache prefix. On Opus 4.7 the dominant cost lever is cache reuse, not file length.[^200lines]
|
||||
1. **Optimise for prompt-cache stability.** Place stable content in the first 30 lines (cache-friendly prefix); volatile content (timestamps, dynamic counts, rolling activity logs) goes below that threshold or moves to an `@import`-ed file outside the cache prefix. On Opus 4.8 the dominant cost lever is cache reuse, not file length.[^200lines]
|
||||
2. **Use `@import` for specs/docs.** `@path/to/spec.md` inlines the file at session start. Max 5 hops, but keep chains ≤ 2 hops — every `@import` boundary fragments the prompt-cache prefix. Keeps the main file scannable.
|
||||
3. **Use HTML comments for maintainer notes.** `<!-- Updated 2026-01-01: reason -->` is stripped before context injection — zero token cost.
|
||||
4. **Put personal dev notes in `CLAUDE.local.md`**, not `CLAUDE.md`. Add `CLAUDE.local.md` to `.gitignore`. Team members' sandbox URLs should never appear in git.
|
||||
|
|
@ -94,4 +94,4 @@
|
|||
|
||||
---
|
||||
|
||||
[^200lines]: The "keep CLAUDE.md under 200 lines" threshold was a Sonnet-era adherence heuristic — Sonnet's attention quality dropped on longer files, so trimming raw line count was the optimisation lever. Opus 4.7 uses prompt-cache structure as the dominant cost driver: the first 30 lines must stay byte-stable across turns to keep the cache hit, and `@import` boundaries fragment the cached prefix. A 400-line CLAUDE.md with stable structure outperforms a 150-line file whose top contains a daily-rolling activity log. See `knowledge/opus-4.7-patterns.md` for detection IDs (CA-TOK-001..003).
|
||||
[^200lines]: The "keep CLAUDE.md under 200 lines" threshold was a Sonnet-era adherence heuristic — Sonnet's attention quality dropped on longer files, so trimming raw line count was the optimisation lever. Opus 4.8 uses prompt-cache structure as the dominant cost driver: the first 30 lines must stay byte-stable across turns to keep the cache hit, and `@import` boundaries fragment the cached prefix. A 400-line CLAUDE.md with stable structure outperforms a 150-line file whose top contains a daily-rolling activity log. See `knowledge/prompt-cache-patterns.md` for detection IDs (CA-TOK-001..003).
|
||||
|
|
|
|||
|
|
@ -1,14 +1,16 @@
|
|||
# Opus 4.7 Configuration Patterns
|
||||
# Prompt-Cache Configuration Patterns
|
||||
|
||||
> Token-efficiency patterns for Claude Opus 4.7. Detection IDs map to TOK scanner findings.
|
||||
> Sources: research/01-opus-47-features-token-efficiency.md (Topic 1), research/04-prompt-caching-patterns.md (Topic 4). Last verified 2026-04-19.
|
||||
> Token-efficiency patterns for current Claude Code (defaults to Opus 4.8; Fable 5 is the top-capability model). Detection IDs map to TOK scanner findings.
|
||||
> Sources: research/01-opus-47-features-token-efficiency.md (Topic 1), research/04-prompt-caching-patterns.md (Topic 4). Patterns verified 2026-04-19; model-era anchor refreshed 2026-06-18.
|
||||
|
||||
Opus 4.7 raises the cost ceiling per turn while expanding the context window
|
||||
and prompt-cache window. Net effect: cache reuse and tool-schema discipline
|
||||
become the dominant levers for keeping a session affordable. The patterns
|
||||
below are structural — they can be detected statically by reading config files
|
||||
without running a session. Cache hit-rate measurement requires runtime
|
||||
telemetry and is explicitly out of scope.
|
||||
Current Claude Code defaults to Opus 4.8 (Fable 5 is the top-capability model).
|
||||
On these models the cost ceiling per turn is high and both the context window
|
||||
and prompt-cache window are large, so cache reuse and tool-schema discipline
|
||||
are the dominant levers for keeping a session affordable. These patterns are
|
||||
properties of prompt-caching itself, not of any single model — they are
|
||||
structural and detectable statically by reading config files without running a
|
||||
session. Cache hit-rate measurement requires runtime telemetry and is
|
||||
explicitly out of scope.
|
||||
|
||||
| # | Pattern | Detection (ID) | Severity | Fix |
|
||||
|---|---------|----------------|----------|-----|
|
||||
Loading…
Add table
Add a link
Reference in a new issue