Skip to content

**AutoPresets** Automatically activate a Loop override presets during walking/running activity#2402

Open
taylorpatterson-T1D wants to merge 232 commits intoLoopKit:devfrom
TaylorJPatterson:feat/AutoPresets
Open

**AutoPresets** Automatically activate a Loop override presets during walking/running activity#2402
taylorpatterson-T1D wants to merge 232 commits intoLoopKit:devfrom
TaylorJPatterson:feat/AutoPresets

Conversation

@taylorpatterson-T1D
Copy link
Copy Markdown

@taylorpatterson-T1D taylorpatterson-T1D commented Feb 8, 2026

Screenshot 2026-05-02 at 11 48 45 AM

Summary

How many times are you out and about and you forget to set your Loop Preset and then you go low? Happens to me on vacations a lot because I do a ton more walking than normal life. The more automation of Loop we can bring to our lives the better. So here I have just automated our Presets so forgetting doesn't put you in a medicaly risky situation. Part of the Loop AI PowerPack.

The Problem That We're Solving

People with Type 1 diabetes who use Loop often need to manually activate an override preset before physical activity like walking or running. This is easy to forget, especially for spontaneous activity — a walk with the dog, touring a new city on travel, or an unplanned errand on foot. Forgetting to activate an exercise preset can lead to lows, since Loop's algorithm doesn't know the user is moving and continues dosing at normal rates.

There is currently no way in Loop to automatically respond to real-world physical activity by adjusting insulin delivery. Users must either remember to manually activate a preset before every walk or run, or accept the risk of going low. This is a big quality-of-life gap, especially for active users who move throughout the day.

New Feature's Impact

AutoPresets adds automatic, hands-free override preset activation based on real-time walking and running detection using Apple's CoreMotion framework. When the user starts walking or running, Loop detects the activity and activates the preset they've chosen for that activity type. When they stop, Loop automatically deactivates it.

What it does

  • Detects walking and running activity using CMPedometer (step counting) and CMMotionActivityManager (activity classification)
  • Applies a user-selected override preset automatically when sustained activity is confirmed
  • Removes the override automatically after activity stops, with a configurable delay
  • Respects manually-activated overrides — won't override a preset the user set themselves
  • Supports separate preset assignments for walking vs. running (e.g., a mild reduction for walks, a stronger reduction for runs)
  • Geofence triggers — auto-activate presets when arriving at or leaving saved locations (gym, park, office)
  • Calendar triggers — scan your calendars for keyword-matched events and activate presets before scheduled activities

User-configurable settings

  • Enable/disable the feature entirely
  • Activity types — toggle walking and/or running detection independently
  • Preset selection — choose which existing override preset to apply for each activity type
  • Continuous Activity Time — how long sustained activity must continue before the preset activates (10 sec to 10 min, acts as a confirmation to avoid false triggers from brief movement)
  • Stop Delay — how long to wait after motion stops before deactivating the preset (10 sec to 2 hours)
  • Require High Confidence — optionally require CoreMotion's high-confidence classification for stricter detection
  • Location Triggers — create named locations with configurable radius (50–500m), trigger on arrival/departure/both, auto-deactivate on exit
  • Calendar Triggers — add keywords (e.g. "Gym", "Spin Class"), choose a preset, set lead time (0–60 min before event), filter which calendars to watch, auto-deactivate when event ends
  • Activity log — view recent activation/deactivation events with timestamps and durations
  • Debug logging — optional detailed logging for troubleshooting

How detection works

  1. CMPedometer counts steps in real-time
  2. After 20+ steps, a "Continuous Activity Time" timer starts
  3. CMMotionActivityManager classifies the activity as walking or running
  4. When the timer fires, it verifies steps are still accumulating (> 5 additional steps)
  5. If confirmed, the mapped preset is activated via Loop's existing override system
  6. A stop timer monitors for inactivity — if no significant steps occur during the stop interval, the preset is deactivated
  7. If the user resumes walking/running during the stop interval, the deactivation is cancelled

How geofence triggers work

  1. User creates named locations (Gym, Office, Park) with "Use My Current Location" or map picker
  2. Each location gets a preset, trigger type (arrival/departure/both), and configurable radius (50–500m)
  3. Uses iOS CLCircularRegion monitoring — battery-efficient, no continuous GPS
  4. On region entry/exit, the assigned preset is activated/deactivated
  5. Won't override a manually-set preset

How calendar triggers work

  1. User adds keywords that match calendar event titles (case-insensitive)
  2. Each keyword maps to a preset to activate
  3. AutoPresets scans all calendars (iCloud, Google, Outlook, Exchange) every 15 minutes for events in the next 24 hours
  4. When a match is found, the preset activates at the configured lead time before the event starts
  5. Optionally deactivates when the event ends
  6. User can filter which calendars to watch

Safety considerations

  • Uses Loop's existing TemporaryScheduleOverride system — no new insulin delivery pathways
  • Will not override a manually-activated preset
  • Automatically deactivates when activity stops / you leave a geofence / calendar event ends
  • All activation/deactivation events are logged
  • Feature is off by default and requires explicit user configuration
  • Errors in motion detection do not disable the feature or affect Loop's core operation

Architecture

  • 12 new files, all within Loop/Loop/ following Loop's layer-based architecture (Views, Managers, Models)
  • 2 existing files modified with minimal changes:
    • /Loop/Loop/Views/SettingsView.swift — NavigationLink to the new settings screen
    • /Loop/Loop/Managers/LoopDataManager.swift — ~40-line delegate extension for preset activation/deactivation
  • Self-contained feature with a single delegate protocol for all communication with Loop
  • No changes to LoopKit, LoopAlgorithm, or any other submodules
  • Developed from v3.10.0 DEV branch

New files

File Location Purpose
AutoPresets_SettingsView.swift Views/AutoPresets/ SwiftUI settings UI
AutoPresets_GeofenceSettingsView.swift Views/AutoPresets/ Geofence location management UI
AutoPresets_CalendarSettingsView.swift Views/AutoPresets/ Calendar trigger keyword management UI
AutoPresets_AIRecommendationView.swift Views/AutoPresets/ AI-powered preset recommendations
AutoPresets_Coordinator.swift Managers/AutoPresets/ Main coordinator — activity detection and preset activation logic
AutoPresets_Delegate.swift Managers/AutoPresets/ Protocol for communicating with LoopDataManager
AutoPresets_Storage.swift Managers/AutoPresets/ UserDefaults persistence
AutoPresets_Logger.swift Managers/AutoPresets/ Debug logging infrastructure
AutoPresets_ActivityDetectionManager.swift Managers/AutoPresets/ CoreMotion wrapper (CMPedometer, CMMotionActivityManager)
AutoPresets_GeofenceManager.swift Managers/AutoPresets/ CLLocationManager region monitoring
AutoPresets_CalendarManager.swift Managers/AutoPresets/ EventKit calendar scanning and timer scheduling
AutoPresets_Models.swift Resources/AutoPresets/ Data models (ActivityType, Settings, LogEntry, etc.)

Screenshots

  1. Settings menu showing the Auto-Apply Presets entry
Screenshot 2026-02-07 at 3 59 09 PM
  1. AutoPresets main settings screen (feature enabled, activity types visible)
  2. Preset selection for an activity type
  3. Detection settings (sliders for timing)
Screenshot 2026-02-07 at 3 59 21 PM
  1. Activity log showing activation/deactivation events
Screenshot 2026-02-07 at 3 59 37 PM ---

Video Demo

https://youtube.com/shorts/H45iZCnL2XQ


Recent Updates (since initial PR)

  • Geofence location triggers — Auto-activate presets when arriving at or leaving saved locations (gym, park, office). Uses iOS CLCircularRegion monitoring — battery-efficient, no GPS polling. Configurable radius (50–500m), trigger on arrival/departure/both, auto-deactivate on exit.
  • Calendar event triggers — Scan all calendars (iCloud, Google, Outlook, Exchange) for keyword-matched events. Activate presets at configurable lead time (0–60 min before event). Per-calendar filtering and auto-deactivation when event ends.
  • AI Preset Advisor — LoopInsights-powered recommendations that analyze glucose patterns and suggest optimal preset configurations.
  • False activation fix — Stale pedometer callback guard + fixed recency window to prevent phantom activations after app resume.
  • Stop Delay extended to 2 hours — Supports longer post-activity recovery periods.

FoodFinder adds barcode scanning, AI camera analysis, voice search, and
text-based food lookup to Loop's carb entry workflow. All feature code
lives in dedicated FoodFinder/ subdirectories with FoodFinder_ prefixed
filenames for clean isolation and portability to other Loop forks.

Integration touchpoints: ~29 lines across 3 existing files
(CarbEntryView, SettingsView, FavoriteFoodDetailView). Feature is
controlled by a single toggle in FoodFinder_FeatureFlags.swift.

New files: 34 (11 views, 3 models, 13 services, 2 view models,
1 feature flags, 1 documentation, 3 tests)
Voice search (microphone button) now uses the AI analysis pipeline
instead of USDA text search, enabling natural language food descriptions
like "a medium bowl of spicy ramen and a side of gyoza". Text-typed
searches continue using USDA/OpenFoodFacts as before.

Changes:
- SearchBar: Add mic button with voice search callback
- SearchRouter: Add analyzeFoodByDescription() routing through AI providers
- SearchViewModel: Add performVoiceSearch() async method
- EntryPoint: Wire VoiceSearchView sheet to AI analysis pipeline
Replace the separate mic button with automatic natural language detection.
When the user dictates into the search field via iOS keyboard dictation,
the text is analyzed: short queries (1-3 words like "apple") use USDA,
while longer descriptive phrases (4+ words like "a medium bowl of spicy
ramen and a side of gyoza") automatically route to the AI analysis path.

Changes:
- SearchBar: Remove mic button and onVoiceSearchTapped parameter
- SearchViewModel: Add isNaturalLanguageQuery() heuristic, route detected
  natural language through performVoiceSearch in performFoodSearch
- EntryPoint: Remove voice search sheet, wire onGenerativeSearchResult
  callback to handleAIFoodAnalysis
The Python script created group definitions but didn't properly attach
all of them to their parent groups. Fixes:
- Services group → now child of Loop app root (was orphaned)
- Resources group → now child of Loop app root (was orphaned)
- Documentation group → now child of project root (was orphaned)
- ViewModels/FoodFinder → moved from Loop root to View Models group
- Tests/FoodFinder → moved from project root to LoopTests group
…, analysis history

- Fix triple barcode fire by consuming scan result immediately in Combine sink
- Replace AsyncImage with pre-downloaded thumbnail to avoid SwiftUI rebuild issues
- Use smallest OFF thumbnail (100px) with static food icon fallback for slow servers
- Add secure Keychain storage for AI provider API keys
- Add analysis history tracking with FoodFinder_AnalysisRecord
- Consolidate AI provider settings and remove BYOTestConfig
- Remove barcode connectivity pre-check that added 3+ seconds latency per scan
- Add NSCache to ImageDownloader for thumbnail deduplication (50 items, 10MB)
- Remove artificial minimumSearchDuration delay from search and error paths
- Merge duplicate Combine observers into single combineLatest for AI recomputation
- Decode image_thumb_url from OpenFoodFacts API for smallest available thumbnail
- Wrap 369 bare print() calls in #if DEBUG across 8 FoodFinder files
…eaders

File consolidations (6 files removed, 2 new files created):

1. FoodFinder_ScanResult.swift + FoodFinder_VoiceResult.swift
   → FoodFinder_InputResults.swift

2. FoodFinder_FavoriteDetailView.swift + FoodFinder_FavoriteEditView.swift
   + FoodFinder_FavoritesView.swift → FoodFinder_FavoritesHelpers.swift

3. FoodFinder_AISettingsManager.swift
   → absorbed into FoodFinder_AIProviderConfig.swift

4. FoodFinder_FavoritesViewModel.swift
   → absorbed into FoodFinder_SearchViewModel.swift

Other changes:
- Fix long analysis titles overflowing the screen by programmatically
  truncating picker row names and constraining food type to 20 chars
- Improve AI prompts for menu/recipe/text image analysis
- Add text-only AI analysis path in AIServiceManager
- Increase AI token budget for multi-item responses
- Standardize all 26 FoodFinder file headers with consistent format
- Add originalAICarbs and aiConfidencePercent fields to
  FoodFinder_AnalysisRecord for tracking AI estimate accuracy
- Add Notification.Name.foodFinderMealLogged for real-time
  meal event observation
- Add MealDataProvider protocol with date-range query interface
  and AnalysisHistoryStore conformance
- Add "Last 30 days" retention option to Analysis History settings
- Add originalAICarbs and aiConfidencePercent fields to
  FoodFinder_AnalysisRecord for tracking AI estimate accuracy
- Add Notification.Name.foodFinderMealLogged for real-time
  meal event observation
- Add MealDataProvider protocol with date-range query interface
  and AnalysisHistoryStore conformance
- Add "Last 30 days" retention option to Analysis History settings
@taylorpatterson-T1D taylorpatterson-T1D changed the title Add AutoPresets feature: automatically activate your Loop override presets during walking/running activity AutoPresets feature: automatically activate your Loop override presets during walking/running activity Feb 9, 2026
taylorpatterson-T1D and others added 13 commits February 9, 2026 16:58
- Absorption time model: conservative adjustments anchored to Loop's
  3-hour default. FPU adds +0/+0.5/+1.0 hr (was +1/+2.5/+4), fiber
  +0/+0.25/+0.5 (was +0/+1/+2), meal size +0/+0.25/+0.5 (was +0/+1/+2).
  Cap reduced from 8 to 5 hours. Updated AI prompt and 3 examples.
- OCR routing fix: raised menu detection threshold from 1 to 5 significant
  lines and always include image on menu path to prevent food photo
  misclassification (fixes "Unidentifiable Food Item" on food photos).
- Inline "Why X hrs?" pill on Absorption Time row replaces standalone
  DisclosureGroup row. Purple centered pill with fixed width, expands
  reasoning on tap. Uses AIAbsorptionTimePickerRow when AI-generated.
Add LoopInsights feature: an AI-driven therapy settings advisor that analyzes
glucose, insulin, and carb data to suggest adjustments to Carb Ratios, Insulin
Sensitivity Factors, and Basal Rates.

Core components:
- Dashboard with therapy settings overview, pattern detection, and AI suggestions
- Configurable AI provider (OpenAI, Anthropic, Gemini, Grok, self-hosted)
- Data aggregation pipeline with test data fixtures from Tidepool
- Suggestion lifecycle: pending → applied/dismissed with full history
- AI personality settings (Supportive Coach, Clinical Expert, Dry Wit, Tough Love)
- Developer mode with auto-apply and test data toggles
- Secure API key storage via Keychain
- Safety guardrails: max 20% change per adjustment, one setting at a time
- Unit tests for models, data aggregation, and suggestion store

22 new files, 4 modified files across Views, View Models, Models, Services,
Managers, Resources, and Tests.
…ng, and UI refinements

- Wire real therapy settings writes via LoopInsightsSettingsWriter closure
- Schedule splitting: insert new entries when AI suggests times not in user's schedule
- Revert feature: restore pre-apply settings from suggestion history
- Settings Score (0-100) with TIR, Safety, Stability, GMI breakdown
- Clinical reasoning framework: AI now understands AID-specific patterns
  (corrections/day, basal/bolus ratio, time-of-day analysis, cross-setting interactions)
- All three settings visible in every AI prompt for cross-setting reasoning
- Pre-computed red flags injected into prompt (algorithm workload, basal % alerts)
- Stale-data guard: excludes manually reverted changes from recent context
- Suggestion merge: consolidates split AI responses into single cards
- Pre-Fill Editor: editable proposed values before applying
- Auto-applied notification banner
- Debug log with Copy Full Log for troubleshooting AI behavior
- Temperature forced to 0.0 for deterministic analysis
… advisor UI

Add Ask LoopInsights chat with AI advisor powered by therapy context and glucose data.
Background monitoring with configurable frequency and notification banners. New Trends
& Insights view with Daily/Weekly/Monthly/Stats/Advisor tabs. Dark gradient styling
for chat and trends views. Banner now includes Ask button to open chat directly.
…ports

Add clinical goal tracking (TIR, A1C, below-range, custom) with progress bars,
AI-powered 30-day pattern discovery with sick day and negative basal detection,
timestamped reflection journal with mood tags, and HTML-to-PDF report generation
with share sheet. Goals & Patterns accessible from the Dashboard navigation section.
… analysis

Add HealthKit biometric data (heart rate, HRV, steps, sleep, active energy, weight)
to the AI analysis and chat pipelines. Biometrics are read-only, independently
authorized, and gracefully degrade when individual types are unavailable.

New file: LoopInsights_HealthKitManager.swift
Modified: Models, DataAggregator, AIAnalysis, ChatViewModel, Coordinator,
FeatureFlags, SettingsView, DashboardView, pbxproj, Localizable.xcstrings
…nsights, Nightscout import

- Ambulatory Glucose Profile (AGP) chart with percentile bands and median line
- Clarity-style dashboard redesign: Glucose card, Time in Range 5-zone stacked bar,
  capsule period picker with exact Clarity colors (#C14F0C, #F0CA4C, #74A52E, #D36265, #7F0302)
- Caffeine tracker with half-life decay modeling and glucose correlation
- Meal insights with food response analysis and per-meal glucose impact
- Nightscout data import support
- Advanced analyzers for pattern detection
- 5-zone TIR breakdown (Very High/High/In Range/Low/Very Low) replacing 3-zone model
- Compact list section spacing for tighter dashboard layout
- Chat view UI refinements
…card fixes

P1: Parallel HealthKit queries via async let (6 concurrent fetches)
P2: Single-pass TIR zone counting (5-zone) replacing multiple filter passes
P3: Pre-fetch raw data in DataAggregator, cache for cross-component reuse
P4: Binary search for glucose lookups in FoodResponseAnalyzer
P5: Pre-sorted glucose samples with binary search in AdvancedAnalyzers
P6: Pre-compute AGP data in ViewModel instead of SwiftUI view body
P7: Static DateFormatter in LoopInsightsTimeBlock.formatTime
P8: Pre-sort schedule items before dose loops, pre-sort in ViewModel
P9: Pre-convert glucose to parallel arrays avoiding repeated doubleValue calls
P10: Pass precomputed hourly averages to circadian profile builder

Also: enhanced step/activity data in AI prompts with time-of-day breakdowns
and activity-glucose correlation analysis (2h lag), and meal card layout cleanup.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…y fixes

Glucose chart now operates in two modes: standard Ambulatory Glucose Profile
(24-hour overlay with percentile bands) for 14-day lookback, and Glucose Profile
(multi-day time series) for all other periods. Both modes include an info button
explaining the visualization. HealthKit glucose data supplements Loop store for
longer analysis periods. Chart data clears on period change to prevent stale labels.

Additional fixes across 22 files: improved HealthKit data pipeline reliability,
enhanced test data provider, refined food response analysis, and minor bug fixes
in background monitor, coordinator, caffeine tracker, and goals/trends views.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…y fixes

Glucose chart now operates in two modes: standard Ambulatory Glucose Profile
(24-hour overlay with percentile bands) for 14-day lookback, and Glucose Profile
(multi-day time series) for all other periods. Both modes include an info button
explaining the visualization. HealthKit glucose data supplements Loop store for
longer analysis periods. Chart data clears on period change to prevent stale labels.

Additional fixes across 22 files: improved HealthKit data pipeline reliability,
enhanced test data provider, refined food response analysis, and minor bug fixes
in background monitor, coordinator, caffeine tracker, and goals/trends views.
@taylorpatterson-T1D taylorpatterson-T1D changed the title AutoPresets feature: automatically activate your Loop override presets during walking/running activity AutoPresets: automatically activate your Loop override presets during walking/running activity Feb 13, 2026
Bump all body text, headers, and stat values to full white for readability
on dark backgrounds. Replace .toolbarColorScheme (iOS 16+) with manual
toolbar principal title for compatibility. Restore UINavigationBarAppearance
approach in ChatView.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@taylorpatterson-T1D taylorpatterson-T1D changed the title AutoPresets: automatically activate your Loop override presets during walking/running activity AutoPresets: Automatically activate your Loop override presets during walking/running activity Feb 14, 2026
taylorpatterson-T1D and others added 2 commits February 14, 2026 14:30
The 20-char limit was truncating food names (e.g. "Baked pastry with f…")
which made them unreadable in LoopInsights Meal Insights. The RowEmojiTextField
maxLength only restricts keyboard input, so longer programmatic values are safe.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Added steps for creating and using test data in developer mode for demos and feature functionality testing.
Root cause: servings was computed as the SUM of per-item USDA serving
multipliers (e.g. salmon=2 + egg=1 + potatoes=3 = 6+ servings) instead
of representing 1 plate/meal. This inflated numberOfServings to 10+ and
scaled all nutrition values up accordingly.

Fix: AI analysis = 1 serving = 1 plate as photographed. The per-item
USDA multipliers are internal to the item-level breakdown, not the
user-facing serving count. originalServings is now always 1.0, and
convertAIResultToFoodProduct no longer divides by the aggregate USDA
serving count.
Implements three programmatic safeguards from Street (2026) "Frontier LLMs
require explicit clinical context to avoid training-data anchoring for
insulin pump settings" (https://www.diabettech.com/wp-content/uploads/2026/04/diabettech_preprint-3.pdf):

1. Bounds clamping (recommendation #2): Values exceeding the max change %
   by up to 1.5x are clamped to the limit instead of hard-rejected, with a
   logged validation note.

2. Citation verification (recommendation LoopKit#3): Glucose values cited in AI
   reasoning are cross-checked against the actual hourly averages sent to
   the model (±2 mg/dL tolerance). Misattribution rate is reported as a
   validation note.

3. Confidence adjustment by data availability: CR analysis with <5 meals or
   ISF analysis with <3 corrections is capped at Low confidence with an
   explicit warning about anchor substitution risk. Basal (the most data-
   driven setting per Street's anchoring spectrum) is not capped.

All changes are in the response parsing layer — no prompt modifications:
- LoopInsights_AIAnalysis.swift: parseResponse() + extractCitedGlucoseValues()
- LoopInsights_Models.swift: validationNotes field on LoopInsightsAnalysisResponse
- LoopInsights_DashboardView.swift: validation notes display in UI
Additional safeguards addressing Street (2026) findings that LLMs cannot
distinguish "I have evidence" from "I should generate something plausible":

1. Stronger refusal mandate in system prompt: Model MUST return empty
   suggestions when data is insufficient to validate a setting. Explicitly
   forbids echoing current values with medium/high confidence when no
   supporting data pattern exists.

2. Explicit AID system context in user prompt: States "Loop (oref-based)"
   with DIA prominently positioned and marked as DO NOT CHANGE. Prevents
   catastrophic DIA collapse to 4-5h textbook values (Street 2026 found
   100% of models defaulted to textbook DIA without this context).

3. Contradiction detection (validation pass LoopKit#4): Scans reasoning for
   admissions like "cannot be derived", "insufficient data", "no meal data"
   while confidence is medium/high. If found, suppresses the suggestion
   entirely — the model was filling gaps with training priors.

All changes in LoopInsights_AIAnalysis.swift (system prompt, user prompt,
and parseResponse validation layer).

Reference: Street T. "Frontier LLMs require explicit clinical context to
avoid training-data anchoring for insulin pump settings." April 2026.
https://www.diabettech.com/wp-content/uploads/2026/04/diabettech_preprint-3.pdf
…tering

- Replace CarbQuantityRow with inline slider when AI analysis is active
  (Amount Consumed | slider | editable text field | g)
- Slider turns grey and centers when user manually types a value
- Locale-aware AI prompts: metric users get cm/mm, imperial get inches
- Location service only includes venue name when a restaurant/POI is
  confirmed; bare street addresses are filtered out
- Teal "LI" circle on glucose chart opens dashboard directly
- Red badge dot appears when pending suggestions exist
- Only visible when LoopInsights feature is enabled
- Made DashboardContainer and wrapper internal for reuse
…rtion control

DataLayer: wire barcodeScanned, chatMessage, mealDebrief, therapySettingsChanged,
overrideActivated/Deactivated, activityDetected, biometricSnapshot events.

FoodFinder: fix location race condition — request GPS on camera button tap and
wait up to 1.5s for reverse geocode before AI analysis. Restructure food detail
cards with per-item USDA serving steppers so users can fine-tune portion estimates
independently. Nutrition circles and totals update live with stepper changes.

AI prompt: clarify serving_multiplier = visible portion / USDA serving with examples.
…rompt

- Remove 500ms cosmetic delays after analysis success/error in AICameraView
- Add fast VNDetectTextRectanglesRequest gate before expensive OCR — skips
  full text recognition when <5 text regions detected (most food photos)
- Consolidate mandatory prompt rules (43 → 13) and remove 2 of 3 worked
  examples, keeping the high-GI Teriyaki example most relevant for diabetes
Shows relative timestamps ("2 hours ago", "in 4 hours") so the user
can verify background monitoring is actually running on schedule.
- Remove unused extractNumericConfidence(), shouldUseParallelProcessing,
  and createPlaceholderImage() from FoodFinder services/view models
- Add onDisappear to clear cached location when FoodFinder is dismissed
Defer prediction snapshot capture to next .LoopDataUpdated instead of
capturing immediately on .foodFinderMealLogged. StatusExtensionContext
predictions are stale until the Loop algorithm re-runs with the new
carbs — capturing immediately was the primary cause of "no prediction
data captured" failures in Meal Insights.
A1: Extend AutoPresets Stop Delay slider from 10min max to 2hr max
with dedicated value steps (10s, 20s, 30s, 1m, 2m, 3m, 5m, 10m,
15m, 20m, 30m, 45m, 1hr, 1.5hr, 2hr) for post-exercise recovery.

F5: Add mandatory pre-bolus timing advisory to FoodFinder AI prompt
for all analyses (not just advanced mode). Recommends bolus timing
based on GI category, meal composition, and current glucose.

N5: Add user engagement/burnout awareness to LoopInsights AI system.
Teaches AI to interpret low carb logging, declining corrections, and
high suggestion reversion as possible disengagement signals. Computes
engagement metrics in supplemental context for every analysis.
Remove advanced-mode gate on absorption time recalculation so fat/
protein adjustments always apply when items are removed. Increase
high-FPU adjustment from +1.0h to +1.5h and raise total cap from
5h to 6h to better handle pizza/nachos/high-fat meals that cause
delayed glucose rises.
Capture glucose stats (TIR, avg, below-range, CV) at suggestion apply
time via new LoopInsightsGlucoseStatsSnapshot. Show "Settings Impact"
section on dashboard with recently applied suggestions, days-since,
outcome verdict, key metrics at time of change, and AI reasoning.
…data

Analyzes FoodFinder meal history for systematic user corrections by food type,
location, time of day, and AI confidence level. Surfaces patterns as alerts on
the dashboard and in a dedicated Behavior Insights view. Injects patterns into
AI supplemental context and Post-Meal debrief prompts for richer recommendations.
Also makes Settings Impact section collapsible via DisclosureGroup.
@taylorpatterson-T1D taylorpatterson-T1D changed the title AutoPresets: Automatically activate your Loop override presets during walking/running activity **AutoPresets:** Automatically activate your Loop override presets during walking/running activity May 2, 2026
@taylorpatterson-T1D taylorpatterson-T1D changed the title **AutoPresets:** Automatically activate your Loop override presets during walking/running activity **AutoPresets** Automatically activate a Loop override presets during walking/running activity May 2, 2026
…ights

Adds one-tap PDF report for endocrinologist appointments with branded LoopInsights
teal header, toggleable sections, vertical Dexcom Clarity-style Time in Range bar,
detected glucose/insulin patterns, behavior correction patterns, and custom email
subject line. Report covers glucose, insulin, nutrition, settings changes, biometrics,
engagement, caffeine/alcohol, and pump suspensions.
…very

Configurable digest for caregivers with recipient email/phone storage, delivery
method picker (Email or iMessage), frequency (daily/weekly), and personalized
greeting. Send Now generates summary and opens pre-filled compose view — recipient
just taps Send. Includes TIR, glucose stats, insulin delivery, and meal data.
Automatically activate presets when arriving at or leaving saved locations
(gym, office, park) using iOS region monitoring. Battery-efficient — no
continuous GPS tracking. Includes map picker, radius config, trigger type
selection, and full integration with existing AutoPresets activity log.
EventKit integration that scans calendars for keyword-matched events and
auto-activates presets with configurable lead time. Supports all calendar
providers, per-calendar filtering, and deactivation on event end.
Replaces the existing minimal chart touch highlight with a rich detail
popup showing glucose, IOB, COB, bolus, basal, preset, AutoPreset, and
heart rate data at any point on the glucose chart. Supports scrubbing
left/right with haptic feedback, auto-fades after 5 seconds, respects
safe areas in both orientations, and works standalone with optional
enhanced data when other features (AutoPresets, etc.) are enabled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant