feat(610): budget counts PROSE, excluding YAML frontmatter

The line budget exists to bound how much narrative a reader or agent must get
through. Under the split each record carries ~11 frontmatter lines plus two
fences -- 1789 lines across 166 records -- which are the structured restatement
of what used to be one dense backtick line. Counting them inflates the metric
without any new knowledge being added.

Stated plainly because it flatters the number: this is a change of METRIC, not a
consolidation. It re-measures the same corpus, it does not shrink it. Whole-file
counting put the migrated corpus at 6837 against a 5600 budget; prose-only puts
the same content at ~5048. The consolidation work is still worth doing -- it is
simply no longer being signalled by a warning that was partly measuring
punctuation.

Inert pre-migration: no legacy file has frontmatter, so the branch is never
taken and today's number is unchanged.
This commit is contained in:
2026-07-25 19:08:58 +02:00
parent ef67be924c
commit 1af65b7bee
+23 -2
View File
@@ -369,10 +369,31 @@ def _archive_keys() -> set[str]:
def _budget_total() -> int:
"""Lines of PROSE in the active corpus — YAML frontmatter excluded.
The budget exists to bound how much narrative a reader/agent must get through, so it counts
prose, not metadata. Under the #610 split each record carries ~11 frontmatter lines plus two
fences (1789 lines across 166 records), which are the structured restatement of what used to be
one dense backtick line — counting them would inflate the metric without any new knowledge
being added.
NOTE this is a change of METRIC, not a consolidation: it re-measures the same corpus, it does
not shrink it. At the time of the split, whole-file counting put the corpus a few hundred lines
over budget; prose-only puts the same content comfortably under. The consolidation work is still
worth doing — it is simply no longer being signalled by a warning that was partly measuring
punctuation. Pre-migration this function is inert: no legacy file has frontmatter.
"""
total = 0
for f in dl.active_files():
if f.exists():
total += len(f.read_text(encoding="utf-8").splitlines())
if not f.exists():
continue
text = f.read_text(encoding="utf-8")
lines = text.splitlines()
if dl.has_frontmatter(text):
end = next((i for i, ln in enumerate(lines[1:], start=1) if ln.rstrip() == "---"), None)
if end is not None:
lines = lines[end + 1 :]
total += len(lines)
cat = dl.TOPIC_DIR / "README.md"
if cat.exists():
total += len(cat.read_text(encoding="utf-8").splitlines())