Household context builder with token budget
CI / ci (push) Successful in 2m12s
CI / ci (pull_request) Successful in 1m31s

harness.BuildContext reads the household context in one read transaction:
today and its weekday in the household timezone, Regulars (cuisine, method,
minutes, favorite), the Quest log, the last 60 passed Side quests and the
plans of the last four ISO weeks. A character budget trims the oldest plans
first, then the oldest passes, never Regulars; a budget too small for what
is never trimmed is an error.

Maestro task 2f54cec9-ec41-42af-b8ee-9e24b8c63057

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-05 08:19:37 -04:00
co-authored by Claude Opus 5.5
parent 942ac42b86
commit b3740ddc12
6 changed files with 701 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
-- Reads for the AI household context block (internal/ai/harness).
-- name: ListRecentDeclinedNames :many
-- The names of the most recently declined suggestions, newest first.
SELECT dinners.name
FROM suggestions
JOIN dinners ON dinners.id = suggestions.dinner_id
WHERE suggestions.status = 'declined'
ORDER BY suggestions.decided_at DESC, suggestions.id DESC
LIMIT ?;
-- name: ListPlannedDinners :many
-- The planned dinners dated from from_date up to but not including
-- to_date, oldest first. Days with no dinner are left out.
SELECT plan_days.date, dinners.name
FROM plan_days
JOIN dinners ON dinners.id = plan_days.dinner_id
WHERE plan_days.date >= sqlc.arg(from_date) AND plan_days.date < sqlc.arg(to_date)
ORDER BY plan_days.date, plan_days.id;