Skip to content
This repository was archived by the owner on Oct 26, 2026. It is now read-only.

M6: the repair layer — eleven plans, and a ledger that closes - #103

Merged
ozerozdas merged 22 commits into
masterfrom
plan/m6-repair-layer
Sep 4, 2026
Merged

ozerozdas merged 22 commits into
masterfrom
plan/m6-repair-layer

Conversation

@ozerozdas

Copy link
Copy Markdown
Contributor

Closes the repair layer — spec 4, eleven plans, and a second ledger that now reads 24 asserted, 0 pending.

The layer's premise is that a learner who nods along is not learning, and that the thing worth teaching is asking for repair under pressure. Everything here follows from two rules: nothing is claimed that was not observed, and no number reaches a surface unless it was measured and carries a unit and a definition.

The eleven plans

Plan What it added
PLAN-027 Six repair moves, filled only by observation — a learner claiming they know one changes nothing
PLAN-028 A response baseline that belongs to the learner, with the model's own latency separated out
PLAN-029 The bluff decision: two signals and no repair move, capped at two rewinds a session
PLAN-030 A rewind that blames the coach and repeats the same sentence slower
PLAN-031 One difficulty axis a session, calibrated, never announced, and "don't push me today" obeyed unconditionally
PLAN-032 A coach that waits out the learner's silence, and praise that has to cite a record
PLAN-033 One remembered detail per opening, never re-asked, and a coach who does not drift out of style
PLAN-034 Rehearsal: the coach plays the other side, then steps out to debrief
PLAN-035 Brought content — the learner's own text, kept local, talked about rather than translated
PLAN-036 Graded listening conditions, and none the engine cannot honestly produce
PLAN-037 The surfaces: the inventory in the learner's own phrasings, the change as a direction in words

What the ledger is for

REPAIR_LEDGER in invariants.check.ts holds spec §12's claims. A row is either assertedIn a named marker in a named check file, or pending with the issue that will build it. The audit fails if a row points at a file that does not carry its marker, so a claim cannot quietly lose its evidence. It opened at 0/24 and closes at 24/0.

The finding that kept recurring

Nine times across these plans, a check was green while the behaviour it named was broken — and the shape was the same every time: the check asserted what the code does rather than what the claim says.

  • A wait timer whose deadline was armed on the wrong event, with a source scan that could not tell.
  • A rehearsal mode read from React state set two lines above the read, proved wrong only by rendering the real hook in both directions.
  • A praiseGate whose verdict was computed and discarded.
  • A prompt-coverage scan keyed by basename, so a prompt in a subdirectory was unaddressable.
  • A noise buffer connected but never started — the check asserted the graph's nodes and edges, never that the source ran.
  • A pace grade written at prepare time and overwritten by every play().
  • Two listening variables offered on a tier where nothing implements them.
  • A miss deleted in the same tick it was recorded, taking the comprehension number's only path to a value below 100% with it.
  • A prompt-chain check that re-implemented the production concatenation and then asserted its own copy: deleting the single line that carries the goal into the coach's prompt left all 51 checks green.

The method that caught them: for every claim, write a throwaway probe that drives the production path and prints the boundary behaviour; for every fix, remove the rule and confirm the check turns red. Eleven of the commits here are that loop closing.

Verification

  • npm run check — 51 check files, 51 passed
  • invariants: 27 asserted, 0 pending
  • repair ledger: 24 asserted, 0 pending

Two acceptance criteria remain for a person, not a check: a phone-quality listening chapter has to be heard to have lost its high end, and the Coach panel has to be read on a real profile.

🤖 Generated with Claude Code

ozerozdas and others added 21 commits September 1, 2026 15:02
Derives the implementation plan for docs/plans/4-verba-repair-katmani-spec.md:
the breakdown/bluff engine (PLAN-027..029), the rewind (030), controlled
difficulty (031), the human-coach rules (032, 033), rehearsal and brought
content (034, 035), listening conditions (036) and the surfaces (037).

Two design calls made once, in M6-README: the repair inventory is derived from
signals rather than stored, and repair observation rides the turn the coach is
already producing rather than a per-language phrase list or a second call.

Spec 4 §12's 24 claims get a second ledger array in invariants.check.ts,
audited by the machinery spec 3 §5's 27 claims already use.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…PLAN-030)

`playClip` resolved only on `ended`/`error`. `byteTier.cancel` pauses the
element and `webSpeech.cancel` cancels the utterance — neither fires an
event, so the awaited `speak` never settled. PLAN-030's speech queue waits
on it before starting the next clip, so one push-to-talk while the coach
was speaking left the coach silent for the rest of the session and marked
every later turn `speakUnknown`, killing the timing signals with it.

Both tiers now settle the in-flight clip with the floor it actually held,
and the mic drops what was queued behind it rather than playing the rest
of a rewind at a learner who just interrupted it.

`send` no longer bumps the speech generation: nothing cancels the audio on
a send, so a clip still playing keeps holding the floor into the next
turn's latency window and belongs to that window's sum. Dropping it
under-stripped the next turn's latency — the direction that invents a
`slowResponse`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…ssion (PLAN-031)

Four faults, all of which a green check hid.

`pickAxis` rotated inside the *eligible* set, but the last axis used is
almost always one of the two the pick excludes — so the search for it
found nothing, the start index collapsed to zero, and every session fell
to the first eligible axis. Over a run that cycled pace → vocabulary →
length forever, leaving `structure` and `direction` unreachable for the
life of the app. The rotation now walks AXES from the last one used and
takes the first eligible axis after it.

`recapsFrom` grouped `recentSignals` by timestamp and called every batch a
session — but that store holds every activity's signals, not the
conversation's alone. A Read or a Listen wrote a batch with no learner
turn in it, which read as a session with zero breakdowns, so `calibrate`
was handed a free easy session for every activity the learner finished:
one clean conversation with any activity behind it raised the step, and
§5.2's "two, not one" never held. A batch with no learner turn is now not
a session, which also stops a conversation abandoned before its first turn
counting as an easy one.

The in-session drop asked whether an axis was active — in `dropOnDrown`
and again at its call site. But the session with no axis is exactly what
`pickAxis` hands a learner whose last session drowned, so the learner who
drowns twice running, the one who most needs the step lowered, could never
get it. The drop is conditioned on the learner drowning, as §5.2 says, and
the unused axis parameter is gone.

Case 3 now runs the rotation over fifteen sessions rather than one pair,
and case 5 runs the rise over real stored signals rather than hand-built
recaps — the two shapes that let these through. The source-scan probes
write to the OS temp directory instead of seeding a real file inside src.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…e (PLAN-032)

The flag and the clock were the same thing, and they are not. `waiting` belongs
at turn land — the chips stay hidden for the whole of the coach's reply — but
arming the deadline there spends the wait on the coach's own audio: a six-second
reply against the eight-second floor left the learner two seconds before being
offered help, which is the behaviour §6.1 exists to remove.

`armWait` now sets the flag only. `onSpeechEnd` is the one place a deadline comes
from, driven by `say`'s queue-empty path — so a reply, a rewind's own → repeat
and an offer's own line all end into a full wait of real silence. With speech off
nothing is ever queued, so the turn starts the clock itself.

The praise sits inside PLAN-021's curtain (it is the coach's own target-language
text) and is spoken like any other coach line — Talk is voice-primary, and a
praise the learner can only read is one they never receive.

The timeline harness gains the case it was missing: an ordinary turn, whose reply
is *shorter* than the wait. Every offer is now asserted against the silence that
actually preceded it, across three medians, three steps and six reply lengths.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…not drift (PLAN-033)

§6.3 puts memory inside the conversation rather than in a list: `openingDetail`
picks at most one fact a session may open with — recent, open-ended, unasked — and
`useTalk` stamps it at the door, because a fact that generated a question is spent
whether or not the model used it. An unclassified fact is not an opening, which is
every fact recorded before this plan; existing learners get quiet openings until
new ones land, and that is the right side to be wrong on.

The stance and the opening are reconciled by who chooses: the model may not reach
into the list, Verba may hand it one fact by name. The same shape settles the
honesty clause — the stance forbids *volunteering* that notes are kept, and the
honesty clause owns answering when asked.

§6.4 is coverage. `styleGuidance` rides the nine prompts the learner hears the
coach through and none of the twelve that extract structured data, and the check
asserts every `(file, name)` prompt in `src/lib` is classified in exactly one of
the two lists — keyed by path, so two files may share a prompt name and a prompt
added later fails the build until someone decides which it is. The persona needed
no column: it is a field on the scenario, so the check asserts it rather than
storing a second copy.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…t (PLAN-034)

The mode is decided from `start`'s parameters, never from the `rehearsal` state:
`setRehearsal` lands on the next render, so reading it there made the first call
of a rehearsal run the whole session on the tutor prompt. The wait's offer gate
reads the mirrored ref for the same reason — the timer that fires it captured the
closure from the render where the wait was scheduled.

`resume` clears the mode alongside the eighteen other per-session resets it
already does. It is the one door into a session that was not opening a rehearsal,
and left uncleared the resumed conversation inherited the last rehearsal's
silence: no offer, no corrections shown, no suggestions, turns parsed as in-role,
a `rehearsal` marker written into the record and calibration skipped.

In role the turn carries `reply`, `repair`, `missed` and `keyWord` — teaching is
dropped, observation is kept, because PLAN-028's breakdown detection and
PLAN-027's inventory are built on the last three. The rewind stops after `repeat`;
`unpack` and `gift` are teaching and move to the debrief. A `rehearsal` marker
signal keeps the batch out of PLAN-031's calibration for good.

The mode's rules are pinned from behaviour, not from source text: the real hook is
rendered and driven, and the assertions read the system prompt that actually went
to the provider and the lines that were actually spoken.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
… honestly produce (PLAN-036)

Five listening variables, each graded, at most two hardened at once, and the
rule that outranks them: a grade the speech engine cannot actually produce is
not shown. `Tts.can` declares rate / voices / filterable per tier; `supported`
reads it, and offers neither accent nor speakers at all — nothing in this repo
selects a voice per grade or synthesises a second speaker, so offering them
would be the exact fake the plan exists to prevent.

Noise and channel run through one shared WebAudio context (a context per clip
exhausts the webview's budget mid-chapter) resumed on play (a context born
outside a user gesture starts suspended and silences the element routed
through it), and release takes the clip back out of the graph. Pace folds into
the transport's single rate door, so `playFrom` and `changeRate` cannot clobber
it.

A miss eases the hardest active variable one grade immediately; the replay it
earns waits for the learner, so PLAN-026's miss panel is still on screen and
the miss is still in `graded` — resetting in the tick that recorded the result
would delete both and leave comprehension able to read only 100%. At grade 0
nothing eases, so nothing resets: today's Listen, byte for byte.

REPAIR_LEDGER row 20 asserted. 51 check files green.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The draft was written on 2026-09-01 and assumed a UI-language layer that does
not exist, a buildDailyPlan that could read signals (it is pure by contract), a
settings.rewinds that was never built, and a SURFACES row for a panel that is
not a surface. It also missed the gap that matters: the prompt reports repair
moves but is never asked to create an opening for one, so Today's sentence
would have been a promise the session does not keep.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The last plan of M6, and the only one the learner reads. Today names one repair
target a day as an outcome about the coach, and the same activity's goal carries
it into the system prompt — a card promising work the session does not do is the
invented metric with a friendlier face. Coach shows the six categories under
readable titles with the learner's own phrasings verbatim, the change over time
as a direction in words, and an honest empty state below twenty judged turns.
Talk and Listen offer the moments that broke for another pass.

The direction's "same" band is one turn's movement in the smaller window,
compared in integers: a 0.05 constant splits one-turn gaps by binary rounding
alone (2→3 reads same, 3→4 reads worse, both are one turn), and it does not
scale — with 200 turns behind it, five points is signal.

`settings.rewinds` feeds SessionBudget.off on both the fresh and the resumed
path; measurement continues either way. The rendered-string scan sees codes
arriving through expressions, not only literals, and the goal chain is driven
through the real useTalk, so deleting the one line that carries it turns the
check red.

REPAIR_LEDGER 24 asserted, 0 pending. Spec 4 §12 closed; M6 with it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@ozerozdas ozerozdas added this to the M6 · Repair layer milestone Sep 4, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

Deploying verba with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6b3b2f5
Status: ✅  Deploy successful!
Preview URL: https://9e2d6275.verba-bu8.pages.dev
Branch Preview URL: https://plan-m6-repair-layer.verba-bu8.pages.dev

View logs

@ozerozdas
ozerozdas merged commit c80f49b into master Sep 4, 2026
2 of 3 checks passed
@ozerozdas
ozerozdas deleted the plan/m6-repair-layer branch September 4, 2026 08:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant