Files
dotfiles/claude/memory/project-chamber-cruft-restoration.md
T
David F GliddenandClaude Opus 5 c2df868104 [FIX] Repair 39 files' frontmatter — including 3 I damaged an hour earlier
The 2026-06-06 normalization sweep (3f9a89b, 283 files) prepended a stray
permalink-only frontmatter block to 39 memory files, 20 of them session wrap
records. Any real frontmatter parser reads the FIRST block, gets `permalink`
alone, and never sees name/description/type.

The sharp case: `strip_frontmatter` exists specifically to stop thread extraction
from matching inside `description:` — its docstring says so. On those 20 wrap
records it strips the stray block and hands the real frontmatter back AS BODY,
producing exactly the condition it was written to prevent.

Repair merges permalink into the real block and drops the duplicate. Nothing
retyped: frontmatter and body are carried as slices, body md5 asserted unchanged.

TWO DEFECTS OF MY OWN, both found only after claiming success:

1. THREE FILES DAMAGED BY THIS SESSION'S OWN STAMPING COMMIT (ef6fa94). That
   script located frontmatter with a non-greedy `^---\n.*?\n---\n`, which on a
   stray-block file matches the STRAY block — so it appended superseded_by to the
   wrong block and orphaned the real frontmatter into the body. That is the same
   non-greedy-first-block blindness diagnosed in strip_frontmatter one hour
   earlier, reproduced in the tool written to clean up after it.
   And the post-stamp check reported "malformed: none" because it asked "does the
   file start with frontmatter then a banner" — true for all three — while the
   claim was "the stamp preserved the record's metadata". The control's subject
   was adjacent to the claim's, for the sixth time today and the first time in my
   own verification. Repaired, verified against the pre-stamp file from git: no
   key lost, prose preserved.

2. REPAIRING 20 APRIL-MAY WRAP RECORDS MOVED THEIR MTIMES TO TODAY, and
   `sec_pause` picked "newest wrap" by mtime — so the digest promoted an April
   session to `Last wrap` and lost both the pulling thread and the open question.
   Caught by the DEGRADED section, which is the honest-degradation mechanism doing
   its job. `sec_pause` now selects by git add-time, like `wrap_events`. Residual
   stated in the comment: add-time lags the wrap by hours, so `Last wrap` is an
   upper bound — wrong by hours where mtime was wrong by months.

Verified after: 0 two-block patterns, 0 orphaned frontmatter, 16 stamps intact
with name: present, 381 pointers resolve, 0 dead, selftest PASS, drift clean,
digest reports 0 degraded sections and the correct last wrap.

Not defects: context-discipline.md and relational-gap-analysis.md use the
`title:`/`type: note` convention and have no `name:` — flagged by my check, correct
as they stand.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Y6t6qx7cpaCu5xGdD36u4
2026-08-17 19:49:02 +02:00

6.0 KiB
Raw Blame History


Why this exists — the steward's framing 2026-05-13 evening, after seeing the audit:

between cleaning this and the better query tools that mcp will give us, the library and I could perhaps "talk"

This is the work that makes discourse-with-the-library reachable. Substrate quality + multi-tool retrieval = honest dialogue with the corpus. The chamber-Alexandrian-foundation memo (project-chamber-alexandrian-foundation-standard.md) names the standard; this is the restoration that delivers on it.

The actual numbers (2026-05-13 audit of 399 chamber .md files)

Bucket Files % Cruft markers Lines Work
CLEAN (0 markers) 162 41% 0 1,929,017 nothing
near-clean (<50 markers) 49 12% 302 2,028,939 leave as-is
light cleanup (<0.01/line) 33 8% 4,193 903,689 strip_cruft, fast
moderate cleanup (0.01–0.05) 33 8% 18,991 784,607 strip_cruft, ok
heavy cleanup (0.05–0.20) 58 15% 94,456 878,200 strip_cruft, heavy
severe — RECONVERT (≥0.20) 62 16% 488,663 1,313,685 source EPUB + repair_epub_headings + pandoc + strip_cruft

Total work: 186 files (47% of chamber).

Load-bearing voices in the severe RECONVERT bucket

These aren't "any books" — they're chamber load-bearers for the work the steward actually does:

  • Phenomenology / Bachelard cycle: Poétique de la rêverie, Poétique de l'espace (FR), La terre et les rêveries de la volonté, L'air et les songes, Psychanalyse du feu
  • Frankfurt School / Arendt: Human Condition, Eichmann in Jerusalem, Between Past and Future (×2 — duplicate, see below), Totalitarianism
  • Adorno: Minima Moralia (worst offender, 2.19 cruft/line — every line wrapped 2+ times)
  • Heidegger: Being and Time
  • Plato: The Republic
  • Marcus Aurelius: Meditations (new translation)
  • Alexander: A Pattern Language — the Alexandrian-standard text itself
  • Lévi-Strauss: Mythologiques 1–4 (all four volumes severe)
  • Borges: Fictions
  • Visual culture / Berger: Here Is Where We Meet, A Fortunate Man, Understanding a Photograph, Success and Failure of Picasso
  • Massive volume cases: Taruskin Oxford History of Western Music (131k cruft, 305k lines), Davies Europe: A History (31k/84k), Shakespeare Arden Third Series Complete (66k/262k), Swafford Brahms (12k/35k)

Critical finding: dedup missed an Arendt duplicate

The 2026-05-13 morning dedup caught byte-identical filename-matches. It missed byte-identical content under different filenames:

  • traditions/critical_modernity/frankfurt_school/between-past-and-future-hannah-arendt.md
  • traditions/critical_modernity/frankfurt_school/between-past-and-future-penguin-classics.md

Both: 1,166 cruft / 2,110 lines, exactly 0.5526 cruft/line. Identical content under different naming. One needs to go before reconversion to avoid double-mining.

Probable other content-dupes lurking in the bucket — worth a content-hash sweep across the chamber as a discrete pre-step before reconversion begins.

Workflow implications

The current mine (running until ~02:30–04:30 tomorrow) is embedding cruft. All 399 files including the 186 non-clean ones are mining as-is. Drawers will carry pandoc-class markers and HTML scaffolding inline. After cleanup+reconversion, the cleaned files will need re-mining via mempalace's mtime-trigger (touch file → sync prunes old drawers → next mine re-embeds clean).

So cleanup-then-remine is a recurring workflow, not a one-shot. Each restored file means: clean → touch → sync → mine. The audit script we wrote tonight (audit_chamber_queryability.py) becomes the verification surface after restoration.

Sequencing strategy

Phase 1 — CLEANUP bucket (124 files, ~3–5 hours attended work)

  • Cheaper per-file (strip_cruft.py --apply handles it)
  • No source-material requirement (operates on existing MD)
  • Clears 31% of chamber faster than equivalent effort on RECONVERT
  • Backup discipline: _backups/YYYY-MM-DD/ per session

Phase 2 — RECONVERT bucket (62 files, ~15–30 hours attended work)

  • Per-file craft (find source EPUB → repair_epub_headings.py → pandoc -t gfm-raw_html → strip_cruft → verify)
  • Some files have source in ~/Documents/__Chamber Source EPUBs/ (already-repaired) or ~/Documents/___The Library [ePub_AWZ3]/ (need repair); some stranded until source surfaces
  • Priority sequencing: load-bearing for current work first (Bachelard for AldineXXI/phenomenology; Alexander for Pattern Language references; Berger for visual culture)

Phase 3 — final sweep + audit

  • Re-run audit_cruft.py against restored chamber — confirm 0 severe, minimal cleanup remainder
  • Re-mine touched files
  • Run audit_chamber_queryability.py against quiescent palace — verify retrieval surfaces canonical voices for designed probes
  • Per Alexandrian-foundation standard: building what you will not need to rebuild

Honest scope

This is a multi-day substrate restoration project. 15–35 hours of focused work across the two phases, plus verification and re-mining. Per the chamber-Alexandrian-foundation memo: this is per-file craft, not batch processing; the quality bar applies equally to first and last voices admitted. Building what you will not need to rebuild.

The aim is not "throughput" — it's a substrate the steward can trust enough to talk with, not just search through.