Add bad habit slip alert feature with AI notifications#5
Merged
Conversation
Detect day-of-week and time-of-day patterns in bad habit slip-up logs and send proactive AI-generated motivational push + bell notifications before predicted slip windows. Configurable per habit via slipAlertEnabled toggle. AI chat defaults slipAlertEnabled to true when creating bad habits. - Add SlipAlertEnabled property to Habit entity (Create/Update) - Add SentSlipAlert idempotency entity (1 alert/habit/week) - Add SlipPatternDetectionService (60-day lookback, day+time patterns) - Add SlipAlertSchedulerService (background, every 5 min) - Add GeminiSlipAlertMessageService for AI-generated motivational messages - Wire through API layer (commands, controller DTOs, query response) - Update AI prompt with slipAlertEnabled schema and bad habit example - Add EF migration for new column and table Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
thomasluizon
added a commit
that referenced
this pull request
Apr 11, 2026
AI was making poor structuring decisions: creating 3 separate daily habits for a single study routine, creating sub-habits for atomic gym prep steps, and dropping shopping list items into the description with no checklist. Root cause was missing guidance in the system prompt. The image flow had hierarchy rules but the text flow had none, so the model guessed from scratch every time. - Add StructuringStrategySection (Order 250) teaching when to use checklist_items (atomic sub-steps, shopping lists, prep lists) vs sub_habits (independently trackable activities) vs separate parent habits, with concrete examples from the failure cases. - Refine GlobalRules rule #5 to explicitly permit ONE targeted clarifying question when structure or schedule is ambiguous (days for weekly habits, unspecified time, checklist-vs-subhabit unclear). - Tighten CreateHabitTool Description and the checklist_items/sub_habits schema descriptions so the model sees the distinction in the tool schema, not just the system prompt. Tests: new StructuringStrategySectionTests, plus builder-level assertion that the new section is wired in. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
5 tasks
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.
Summary
SlipPatternDetectionService(60-day lookback, 3+ occurrences threshold)SlipAlertSchedulerService(runs every 5 min)GeminiSlipAlertMessageServicegenerates creative, varied, inspiring messages in the user's language (with static fallback)slipAlertEnabledtoggle, wired through full API layerslipAlertEnabled: truewhen creating bad habitsSlipAlertEnabledcolumn +SentSlipAlertstable (weekly idempotency)Test plan
dotnet test-- 160 unit tests pass, no regressionsslipAlertEnabled: true, verify field persists in GET responseSlipAlertSchedulerService startedin logs on startupslipAlertEnabled: truedotnet ef database update)🤖 Generated with Claude Code