mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-12 14:16:12 +00:00
fix(coach): keep a turn's fact and plan only with the answer that carries them
remember_fact and propose_plan wrote their rows during the tool round. An answer that was then blocked, failed or abandoned left the fact in memory without its note and Undo, and left the plan listed, activatable and fed into later turns and the briefing. Both are now staged under an id minted up front and written in the transaction that stores the assistant message, only when its provenance carries them. A background proposal counts as offered only once an answer carrying it is stored. Plan text is model text: ifCue, thenAction and target pass the outbound dose and risk screen in the person's locale, with their scheduled doses and medication names, and the injection screen; a trip declines as "unsafe". The trail route serves recalled facts and the proposal's fact to the owner whatever the AI capability (only the model-written entries are gated), and withholds medication facts while the medications module is off. Accepting a fact proposal is decided under a per-message advisory lock, so concurrent taps write one fact. Editing a fact re-reads its wording: text naming a medication moves to "medication", other health wording moves a non-health fact to "condition", and a health fact the person edited counts as confirmed.
This commit is contained in:
1 parent
fac55720a4
commit
5361239ae5
21 files changed
+1176
-157
No files matched your search
@@ -5,7 +5,10 @@
|
||||
* Coach proposes. A plan is an "if-then" implementation intention tied to one
|
||||
* metric, with an optional target. The Coach extractor writes a plan as
|
||||
* `status: "proposed"`; only the user-facing PATCH (`/api/coach/plans/[id]`)
|
||||
* activates it. There is no silent self-edit of the user's plan set.
|
||||
* activates it. There is no silent self-edit of the user's plan set. A plan
|
||||
* the Coach proposes in a turn (`propose_plan`, v1.41) exists only once the
|
||||
* answer carrying it is stored (`memory/turn-writes.ts`), so a turn that was
|
||||
* blocked, failed or abandoned has nothing here to list.
|
||||
*
|
||||
* Ownership: every query is scoped `where: { userId, ... }`, so a caller can
|
||||
* only ever see their own plans. The free-text fields (if-cue, then-action,
|
||||
|
||||
Reference in new issue
Block a user