feat(handoff): since-last-seen digest + grounded follow-up prototypes - #17
Merged
Merged
Conversation
@journal/handoff prototypes for delivery slots 23/24 — two interaction shapes over one input model: - composeSinceLastSeen: static digest with per-event claims (every claim carries a NonEmptyArray of source refs), verbatim routine context, unresolved questions for draft/pending/failed/low-confidence captures, per-category coverage, and care-neutral gap disclosures for every capture-free day in the window. - answerFollowUp: interactive surface over the same DigestInput — citation-bearing answers, explicit refusals for medical questions and out-of-window spans, care-neutral not-logged statements. Hard rules enforced in code, not comments: no medical conclusions (a word-anchored guard rejects interpreting vocabulary in all system- generated language, while verbatim human quotes stay exempt as sources); absence of logs never reads as absence of care (gap disclosures are first-class data); unpublished capture content never leaks (draft/ pending/failed captures are cited, never quoted); window semantics [lastSeenAt, generatedAt) rendered in the caller's IANA timezone. Six schema-checked synthetic fixtures (all ids syn-*) + 21 Bun tests (invariants + fixture-driven acceptance). scripts/gen-handoff-fixtures.mjs regenerates the fixtures from verified epoch constants. Co-authored-by: Gilbert Polanco <gilbertpolanco42@gmail.com>
Contributor
Author
Evidence receipt
Remote branch Human author: Gilbert Polanco (gilbertpolanco42@gmail.com) |
This was referenced Sep 17, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Acceptance criteria
composeSinceLastSeen) and interactive follow-up (answerFollowUp); renderers for both.NonEmptyArrayof source refs); unpublished capture content never leaks.Why
An invited caregiver (a grandparent, a nanny) currently has no way to catch up on a child's window without paging through raw captures — or worse, trusting an unsourced summary. Slots 23/24 call for a handoff that is reviewable instead of impressive: what was logged, where each claim came from, what the journal could not see, and explicit refusals where a summary would otherwise start interpreting. Absence of logs is the failure mode that hurts families most — a summary that reads a quiet day as a bad day is worse than no summary.
What
New workspace package
@journal/handoff(Effect v4 contracts + pure composition; no model call, no Convex call — deterministic so fixtures pin exact behavior):composeSinceLastSeen(input)GapDisclosureper capture-free local day; source index; suggested follow-ups (the bridge into the interactive shape).answerFollowUp(question, input)DigestInput. Citation-bearing answers; explicitrefused-medicalandrefused-out-of-window; care-neutral not-logged statements. Classification is deliberately heuristic keyword matching — the refusals and citation invariants are the part meant to survive; the matcher is replaceable.digestToText/answerToTextDecisions worth a reviewer's attention:
evaluation/src/adapter.tsprecedent): handoff duplicates the six-category union rather than reach into domain internals, so the package grafts cleanly without a domain value export. Keep-both-in-sync comment marks the seam.assertCareNeutral(word-anchored, suffix-tolerant) applies to system-GENERATED language only. Verbatim transcript snippets are exempt — quoting a human source is not drawing a conclusion. Family-profile notes ARE guarded (inclusion is endorsement).[lastSeenAt, generatedAt)in caller's IANA timezone; hourly day-walk handles DST without fixed-24h assumptions; events atlastSeenAtin, entries atgeneratedAtout.How to Review
packages/handoff/src/contracts.ts— the hard rules are structural (SourceRefsisNonEmptyArray; there is no field for severity/comparison/normality anywhere inHandoffDigest).src/gaps.ts— word-anchored matching so stems catch inflections ("diagnos" → "diagnosed") while "still" never trips "ill".src/compose.ts— published+structured filter, question escalation, gap disclosure, coverage.packages/handoff/fixtures/*.json(six, allsyn-*ids) + generatorscripts/gen-handoff-fixtures.mjs(epochs verified against America/New_York viaIntl).Test Evidence
Full local verification table, run against HEAD
8b7c7ee(post-rebase onto master00581f5):pnpm turbo run typecheck— 8/8 packagespnpm turbo run test— all workspaces;@journal/handoff: 21 tests / 156 assertions (invariants + schema-checked acceptance fixtures)pnpm turbo run build— 4/4bun test ./security— 17/17 fail-closed access casescd evaluation && bun src/run.ts— 6/6 corpus fixtures; negative control (broken-adapter --expect-failure) fails as designedCI is the final gate for merge; no human approval is required by repo policy.
Human author: Gilbert Polanco (gilbertpolanco42@gmail.com)
🔗 Obvious Project · 🧵 Obvious Thread