Commit e4ce8d3
Polish cache-hit telemetry + spec reconcile & archive (#52)
* docs(specs): reconcile regen-pipeline — mark satisfied-by-different-means
Audit found regen-pipeline was marked "complete" with all 24 tasks
checked, but none of its named symbols ever shipped in either repo
(attune-author: _regen, regen_template(corpus_root=...),
_resolve_corpus_root, atomic_write, _patch_summaries_json;
attune-gui: /api/config, /api/templates/refresh-all,
/api/browse/directory, CorpusSetup, App.jsx). A bogus "Shipped" note
had conflated it with the unrelated hash-mismatch regenerate CLI.
The 3 user stories are all satisfied by a more evolved architecture:
- regen: POST /api/living-docs/docs/{id}/regenerate (Jobs +
generate_feature_templates)
- corpus config: multi-corpus registry + workspace config
- bulk: make regen-all
No genuine product gaps remain. This commit corrects the spec docs:
- requirements.md: status -> reconciled, with user-story->reality map
- design.md: marked obsolete (assumes React/JSX + single corpus_root)
- tasks.md: flags the false done-marks and corrects the Shipped note
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* docs(specs): mark regen-staleness-hash-mismatch DONE (shipped in #48/0.14.2)
Status said "Implementation TBD" but the fix shipped in PR #48
(commit 1b1c7c5), released in 0.14.2: apply_polish_results now
re-injects deterministic frontmatter via _replace_polished_frontmatter,
with regression test tests/unit/test_polished_frontmatter_reinjection.py
and a CHANGELOG entry. Status corrected to reflect shipped reality.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* feat(polish): prompt-cache hit-rate telemetry (spec polish-cache-hit-metrics)
Each polish run now tracks Anthropic prompt-cache token usage and logs
a one-line summary at the end of `attune-author regenerate`:
Polish cache hit: 87% (1241 read / 1421 total tokens, 6 call(s))
A WARNING is appended when the run's hit rate < 50% (with >=1 cacheable
token), surfacing silent cache regressions (prompt edits, model alias
drift). Hit rate = read / (read + creation) cacheable input tokens.
Implementation:
- doc_gen/_anthropic.call_anthropic gains an optional
on_cache_usage(creation, read, model) callback; _log_cache_usage now
returns (creation, read). Backward compatible — doc-gen passes nothing.
- polish.py: PolishCacheStats dataclass, in-process accumulator
(_polish_cache_telemetry / reset_polish_cache_telemetry, mirroring
generator._faithfulness_telemetry), polish_cache_stats(), and
format_polish_cache_summary(). _call_llm wires the callback.
- maintenance.py: reset at run start, log summary at run end alongside
the faithfulness summary.
Deviation from the written spec: attune-author has no telemetry JSONL,
so the metric follows the existing in-process faithfulness-counter
pattern instead of a new JSONL subsystem; the threshold warning is
current-run, not cross-run. Acceptance criteria in decisions.md all met.
Tests: 16 new in tests/unit/test_polish_cache_metrics.py (callback
firing incl. zero case, hit-rate math, accumulator, summary, warning).
Docs: README "Cache hit rate" subsection; CHANGELOG [Unreleased].
Spec docs updated to DONE with the deviation noted.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* chore(help): regenerate polish/staleness templates after cache-metrics change
Auto-regenerated by the pre-commit help-freshness hook following the
polish prompt-cache telemetry work (d4af5a3).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* chore(specs): archive completed/superseded specs
Move terminal specs into docs/specs/archive/ so they stop inflating the
active count: polish-fact-check (v0.14.0), polish-cache-hit-metrics
(done), regen-staleness-hash-mismatch (#48/0.14.2), regen-pipeline
(superseded). skill-export-evangelism kept active (open).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* Revert "chore(help): regenerate polish/staleness templates after cache-metrics change"
This reverts commit b9edfc4.
* test(batch): make batch-state fixture date relative to now
The _state() helper hardcoded submitted_at=2026-05-08, which silently
expired past the 29-day retention window on 2026-06-06 and broke the
status/cancel tests (they read batch state without an injected now=).
Default to now-1day so the fixture stays inside the window.
Fixes the 3 date-bomb failures in test_maintenance_batch.py
(TestStatus/TestCancel).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent 01db78a commit e4ce8d3
18 files changed
Lines changed: 531 additions & 67 deletions
File tree
- docs/specs
- archive
- polish-cache-hit-metrics
- polish-fact-check
- regen-pipeline
- regen-staleness-hash-mismatch
- polish-cache-hit-metrics
- src/attune_author
- doc_gen
- tests
- unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
13 | 33 | | |
14 | 34 | | |
15 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
260 | 287 | | |
261 | 288 | | |
262 | 289 | | |
| |||
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
4 | 10 | | |
5 | 11 | | |
6 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 20 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
3 | 22 | | |
4 | 23 | | |
5 | | - | |
| 24 | + | |
6 | 25 | | |
7 | 26 | | |
8 | 27 | | |
| |||
Lines changed: 23 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
8 | 30 | | |
9 | 31 | | |
10 | | - | |
| 32 | + | |
11 | 33 | | |
12 | 34 | | |
13 | 35 | | |
| |||
0 commit comments