A speaking coach that starts sessions on its own has to decide when not to. Three sequential conditions gate every scheduled check-in, it fails closed, and each refusal is written to a table with the rule that caused it.
Method
AudioLanguage
Topic
SocietyScience & Tech
An AI speaking coach starts practice sessions at times the user did not choose, so most of its scheduling code decides when to say nothing. Three ordered rules gate each check-in, and every refusal is logged with its reason. That suppression logic turned out to be the more interesting half of the design.
Quiet hours, a cap of four a day and a 45-minute cooldown gate every check-in
The rules run in order and fail closed, so the first rule that rejects ends the check.
Quiet hours default to 20:00 through 08:00. The window wraps past midnight, so the test is hour >= start or hour < end.
The daily cap counts from the events table, so a restart does not reset it.
Each refusal is logged as quiet_hours, daily_cap, cooldown or none, so a silent period and a broken scheduler can be told apart.
During a coding session, check-ins are off and only the wake phrase starts one, because a mid-task interruption costs the most.
The reply answers the content first, then gives at most two corrections
The coach responds to what was said before it corrects how it was said.
Leading with the correction turns each turn into an assessment, and the speaker starts performing for the grader.
The prompt asks for plain words on what was weak and what to change. Vague encouragement is the common failure of automated coaching.
Each turn ends with one named primary fix and a retry script of 30 to 60 seconds.
Any metric below 60 in the scoring layer raises flags, and the flags decide what gets corrected.
142 tests across seven files cover the Flask backend
The Flask backend is built and tested.
Transcription and coaching run on a cloud model. Everything else runs locally.