Skip to content

feat: drop the focus doc's tracking tables and the impact log's older rows - #69

Draft
Bhekani Khumalo (bhekanik) wants to merge 4 commits into
mainfrom
feat/m5c-prompt-diet-focusdoc-impact
Draft

feat: drop the focus doc's tracking tables and the impact log's older rows#69
Bhekani Khumalo (bhekanik) wants to merge 4 commits into
mainfrom
feat/m5c-prompt-diet-focusdoc-impact

Conversation

@bhekanik

Copy link
Copy Markdown
Collaborator

What

Two prompt-only trims. Neither file on disk is touched, and the writers and the cleanup still
read both whole.

input before after change
focusDoc 24,172 925 -96%
impact 16,041 5,554 -65%

Measured on fixtures shaped like the real files. The fifteen sections still sum to exactly the
prompt length.

1. Focus doc tables

My Focus.md is the engineer's own document and the coach reads all of it, so it stays whole
apart from one thing: a markdown table with more than twenty data rows is replaced by
_(table of N rows omitted from the coaching prompt)_. On the real vault that document is 55k and
a single 128-row tracking table is 44k of it — the priorities are in the prose and the headings,
and the table is a spreadsheet that happens to live in a markdown file.

Headings, prose, and tables of twenty rows or fewer survive verbatim.

2. Impact log window

The prompt gets impact rows dated within 52 weeks of the week being generated, not of today,
so regenerating an old week sees what that week could have seen. Older rows become one
_(N older entries not shown)_ line after the table.

The coach's job with this file is the gap analysis — how long since the last significant impact,
is the pace healthy — and a year of rows answers it; the older ones have already been promoted
into a brag book. **Last significant impact:** and **Current gap:** are not dated rows and pass
through untouched, along with the heading and the table header.

How both work

Both walk tables the way the memory trim does: fence-aware via markdown-scan.ts, CRLF preserved,
kept rows passed through byte for byte rather than re-rendered. They share one table finder, which
treats a run of pipe lines with no separator as prose so it cannot eat one.

--verbose gains a third line:

Prompt omissions: 1 focus doc table(s), 120 impact row(s) outside the window

Verification

  • bunx tsc --noEmit clean, bun run lint clean, anti-slop-check clean on changed lines.
  • bun run test — 839 passing across 25 files (818 before).
  • Fourteen mutations, all red.

Note on the fixture

The focus doc fixture is 24k against the real 55k. The shape is what matters here — one table
holding most of the bytes — and the trim removes it either way; the real saving will be larger.

… rows

Two product decisions, both prompt-only. Neither file on disk is touched, and the
writers and the cleanup still read them whole.

`My Focus.md` is the engineer's own document and the coach reads all of it, so it
stays whole apart from one thing: a markdown table with more than twenty data
rows is replaced by a line saying how many rows it had. On the real vault that
document is 55k and one 128-row tracking table is 44k of it. The priorities are
in the prose and the headings; the table is a spreadsheet that happens to live in
a markdown file. Headings, prose and small tables survive verbatim.

The impact log now reaches back a year from the week being generated, not from
today, so regenerating an old week sees what that week could have seen. Older
rows become one line counting them. The coach's job with this file is the gap
analysis — how long since the last significant impact, is the pace healthy — and
a year of rows answers that; the older ones have already been promoted into a
brag book. The last-impact and current-gap lines the schema depends on are not
dated rows and pass through untouched.

Both walk tables the way the memory trim does: fence-aware through
`markdown-scan.ts`, CRLF preserved, kept rows passed through byte for byte
rather than re-rendered. The table finder they share treats a run of pipe lines
with no separator as prose, so it cannot eat one.

`--verbose` gains a line counting what each left out, so a thin section is never
a mystery.

On fixtures shaped like the real files: focusDoc 24,172 to 925, impact 16,041 to
5,554.
Both survived mutation. The undated-row test used a value that sorts above any
ISO date, so dropping undated rows happened to keep it; it now uses one that
sorts below. And nothing checked that the window is measured from the week being
generated rather than from today, which matters for regenerating an old week;
the dropped count is now compared against the fixture's own rows.
Only the lower bound was applied, so regenerating an old week showed it
achievements from two years after the fact, and the two status lines walked
through untouched telling a 2024 week what its author's last impact would
eventually be. That is the history rule broken in the one place the coach is
asked to reason about time.

The window is now `[week start - 52 weeks, week end]`. Rows past the upper bound
are removed without comment, because to that week they had not happened; there
is no count for them, since a count would itself leak that something came later.
Rows below the lower bound stay a count, as before.

Both status lines are recomputed from every row dated on or before the week's
end, including rows too old to be listed: an engineer whose last impact is
fourteen months back has a fourteen-month gap, not "none recorded". The gap is
measured from the week's end or from today, whichever is sooner, so the current
week reads exactly as it does now. `gapText` and the status vocabulary are
imported from `vault-updates.ts` rather than reimplemented.

Three more from the same review:

`findTables` recorded only the first separator in a run of pipe lines, so a
small table written directly under a large one was swallowed and its rows went
with it. A table now starts at every header-and-separator pair.

Dates are validated with the round-tripping `isIsoDate` from `vault-updates.ts`.
The local copy checked the shape only, so `2024-13-01` counted as a date, was
dropped as too old, and could have won the latest-impact comparison.

Tables written without their outer pipes, and tables indented up to three
spaces, are both found now. A line is normalized once, then handed to the
writers' own `isTableSeparator` and `scanRow` so this file does not keep a
second copy of their rules. Four spaces still means an indented code block.
Three mutations survived. The four-space guard was covered only through the
impact trim, where stripping it shifts the date column and nothing is dropped
anyway; the focus trim counts rows instead, so it notices. And nothing built a
prompt for a historical week, so neither the upper bound nor the gap basis was
pinned at the builder level.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant