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

M7: the fluency layer — eight plans, and a metric that stays off - #105

Merged
ozerozdas merged 17 commits into
masterfrom
plan/m7-fluency
Sep 28, 2026
Merged

ozerozdas merged 17 commits into
masterfrom
plan/m7-fluency

Conversation

@ozerozdas

Copy link
Copy Markdown
Contributor

Closes the fluency and monitor-load layer — spec 5, eight plans, and a third ledger that reads 13 asserted, 0 pending.

The layer measures what slows a learner down when they speak: pauses, self-repairs, sentences left unfinished, the slip back into the native language. It holds to two rules. A metric the learner sees has to have been checked by hand. And measuring can be turned off, and what was measured can be deleted.

The eight plans

Plan What it added
PLAN-039 Every measurement records the conditions it was taken under. A switch stops the measuring, and one action deletes what was measured
PLAN-040 Six timing numbers per spoken turn. The two that cannot be measured exactly are reported as bounds
PLAN-041 Five kinds of self-repair, found by the model and believed only when both halves are in the learner's own transcript
PLAN-042 The sentence left unfinished, the slip into the native language, and the structure never attempted
PLAN-043 Fluency mode and its opposite, accuracy mode. Fluency is entered only through a contract shown every session
PLAN-044 Planning time, 4/3/2, a pressure ladder the learner climbs at their own pace, and naming what was avoided
PLAN-045 The monitor-load profile: four differences, never collapsed into one number
PLAN-046 Coach holds up the mirror — sentences grounded in the record, and §6.3's five prohibitions

The hand sample, and a metric that stays off

PLAN-041 says falseAlarmRepair does not reach a screen until a person has checked real turns and disagreed with no more than a fifth of the surviving falseAlarms. The sample had four inputs: three natural sessions, one staged session, and three models.

  • gemma4:31b clears the bar: it produced no falseAlarm a person disagreed with.
  • deepseek-v4-pro does not: each of its falseAlarms on natural speech was wrong.
  • qwen3.5:4b finds nothing at all.

The learner chooses the model, and the flag cannot be set per model. So FALSE_ALARM_ON_SCREEN stays false by decision: a wrong falseAlarm tells a learner their mistake was right. The signal is still recorded. The tables and the decision are in PLAN-041.

The sample also found three bugs that no check had caught:

  • Session closing. "New scenario" was clickable while the wrap-up was being written. A new session then reset the old one's state mid-wrap-up: its summary was saved under the wrong session, and its spoken turns were gone before the self-repair pass read them (closing.check.ts).
  • Self-repair model call. At temperature 0.7 the same transcript gave one repair on one run and six on the next. The call now runs at 0, and the prompt names the confusions the sample exposed.
  • Self-repair gate. A phrase was matched at its first occurrence, so a learner who repeated themselves lost their real repair. A pair split across two turns was also accepted.

Coaching settings (#76)

§7.4's default mode and pressure-ladder ceiling had been deferred by PLAN-039 and never built. They are added now. Their defaults leave the Talk screen as it was.

Patience stays relative to the learner's own latency rather than a fixed 1–5 s. Audio retention opt-in is deliberately not built (roadmap D5): nothing retains audio today, and the checks assert that.

Verification

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

Every fix in the last stretch was checked the same way: remove the rule and confirm the check turns red.

🤖 Generated with Claude Code

ozerozdas and others added 17 commits September 28, 2026 20:50
…e ladder, and naming what was dodged (PLAN-044)
…LAN-041 hand sample)

The hand sample could not have measured anything as it stood.

Deepgram removes "uh"/"um" unless `filler_words=true` — for readability, which
is the wrong trade here: §2.2's evidence *is* the disfluency, and
`verifySelfRepairs` requires the abandoned fragment and its replacement to both
appear in the transcript, so a tidied transcript drops every repair at gate 1
while the layer looks like it works. `smart_format=true` stays: it is the
punctuation `clauseCount` is built out of, and `midClausePauseRatio` out of that.
speech.check.ts asserts both, and fails without either.

And three of the sample table's four counts are unrecoverable after the fact —
gate 1's drops and gate 2's downgrades leave no trace and only survivors reach
SQLite. A temporary log at the verification site carries them, marked for
deletion when the sample is filled in.

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

The console log only reaches the person at the keyboard, and three of the
sample table's four counts exist nowhere else: gate 1's drops and gate 2's
downgrades leave no trace inside `verifySelfRepairs`, and only survivors reach
the signals table. The raw report and what survived it now go to localStorage
alongside the log.

Not a table: backup.check.ts requires every table created in db.ts to be
exportable, restorable and wipeable, and this is scaffolding — the rule is
right and the exception would be how the next forgotten table gets in. The key
sits outside the `verba.` namespace so backup's wholesale `verba.*` sync does
not pick it up either.

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

A silent catch cost a sampling round: the log was simply absent and nothing
said why.

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

`end()` awaits the model several times and reads the session's refs —
`sessionId`, `voice`, `history`, `produced` — after those awaits. The
reflection screen offered "New scenario" while it still said "Looking
back…", and a `start` landing there reset every one of them: the summary
was filed under the next session's row, and the spoken turns were gone
before the self-repair pass could read them. Found in the hand sample,
where a six-turn session left no log entry at all.

A `closing` ref now holds from the start of `end()` until its last ref
read; `start`, `resume` and `reset` do nothing while it is set, which
covers Today's launcher and the session list as well as the button. The
button itself is disabled while the wrap-up is written.

closing.check.ts drives the real hook: one spoken turn through the mic,
the provider parked inside `end()`'s first call, a `start` and a `reset`
tried from there, and the self-repair pass asserted to receive the
closing session's own transcript. Removing the guard turns it red.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r pass (PLAN-041)

Seventeen spoken turns through Deepgram, run against qwen3.5:4b in the app
and deepseek-v4-pro offline on the same transcript. `falseAlarmRepair` does
not reach a screen: no surviving `falseAlarm` from either model, and the one
the pipeline ever produced was a restart a human would not call a repair.
`FALSE_ALARM_ON_SCREEN` stays false; the table and the reasons are in
PLAN-041's `## Hand sample`.

What the sample changed:

- The self-repair call runs at temperature 0. At 0.7 the same transcript
  came back with one repair, then six, the same repair typed D, C, D.
- The prompt says, one line each, that a word said twice is hesitation,
  that `after` starts where `before` stops, and that a word the learner did
  not say makes it the model's correction. The five types carry one example
  each — none from the sampled transcript — and a fixed order to decide in.
- Gate 1 drops an `after` that opens with the whole of `before`: nothing was
  abandoned. The sample's only `falseAlarm` was exactly this, and it passed
  because "we need" matched an earlier turn.

Gate 1 still accepts a pair split across turns; that is noted as open in the
plan rather than changed here. The hand-sample scaffolding stays until a
staged session gives the bar something to judge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… before (PLAN-041)

The staged falseAlarm session (66) lost its one clean case: "she does not"
opened the line as well as closing it, first-occurrence matching put `after`
ahead of `before`, and gate 1 dropped the real repair. `saidInOrder` now
looks for `after` from the end of `before`, inside one line only — which
also closes the cross-turn hole the natural sample left open.

PLAN-041 records the staged result: precision clears the bar, recall does
not; FALSE_ALARM_ON_SCREEN stays false pending one natural session.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ed (PLAN-041)

A natural session under the new gate (67): gemma reports no falseAlarm,
deepseek reports one and it is wrong — both of deepseek's falseAlarms on
natural speech were. The bar is met by one model and not by another, the
model is the learner's to choose, and FALSE_ALARM_ON_SCREEN is not per
model: it stays false, by decision. The signal is still recorded.

The handSample.log block is removed. The pin that read PLAN-041's blank
template row (and so asserted nothing once the sample was filled in) now
reads the plan's recorded decision. The 4/3/2 card no longer promises the
row will appear after hand-verification.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lete pinned (#76)

§7.4's two rows PLAN-039 left for later and no later plan picked up.
`defaultMode` (ask | fluency | accuracy, default ask) arms the Talk
screen's mode on mount and whenever the picker comes back; fluency still
enters through its contract. `topRung` (1–4, default 4) hides the rungs
above it. The defaults are the Talk screen as it was.

The re-arm lives in the one `talk.started` effect that clears the
entry-armings: a separate effect on the same dependency was overwritten by
that effect's setPendingMode(null), so the default was gone after the
first session — found in the browser, not by the source scan, which now
checks the effect itself.

`deleteMonitorSignals` had no check at all; §27 pins it to one language and
MONITOR_KINDS. Patience stays relative to the learner's own latency rather
than 1–5 s; the reason is in PLAN-039.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PLAN-039 through PLAN-046 are implemented on this branch and every
FLUENCY_LEDGER row is asserted; their frontmatter still read ready.
PLAN-041's hand sample is filled in and its decision recorded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying verba with  Cloudflare Pages  Cloudflare Pages

Latest commit: 65da0d3
Status: ✅  Deploy successful!
Preview URL: https://fbe803bf.verba-bu8.pages.dev
Branch Preview URL: https://plan-m7-fluency.verba-bu8.pages.dev

View logs

@ozerozdas
ozerozdas merged commit e1394b7 into master Sep 28, 2026
3 checks passed
@ozerozdas
ozerozdas deleted the plan/m7-fluency branch September 28, 2026 18:09
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