Pulse/internal/ai/context
rcourtman 4d7d2e42dc feat(ai): pass raw metric samples to LLM for pattern interpretation
Instead of relying on pre-computed trend heuristics (which can be misleading
for edge cases like step changes vs continuous growth), we now pass downsampled
raw data points to the LLM so it can interpret patterns directly.

Changes:
- Add MetricSamples field to ResourceContext
- Add DownsampleMetrics() to reduce data points for LLM consumption
- Add formatMetricSamples() to format data compactly (e.g., 'Disk: 26→26→31%')
- Add computeGuestMetricSamples() to gather 7-day sampled history
- Populate MetricSamples for VMs and containers during context build
- Add History section to formatted context output

The LLM now sees actual patterns like 'stable for 6 days then jumped' rather
than just '45.8%/day growth rate' - allowing for much more nuanced interpretation.

This approach:
- Leverages LLM's pattern recognition instead of hard-coded heuristics
- Provides 7 days of data (~24 samples) for context on normal behavior
- Uses minimal tokens due to compact formatting with deduplication
- Is more future-proof as LLMs improve

Example output:
  **History (7d sampled, oldest→newest)**: Disk: 26→26→26→26→26→31%

Refs: Frigate disk usage false positive investigation
2025-12-21 21:09:24 +00:00
..
builder.go feat(ai): pass raw metric samples to LLM for pattern interpretation 2025-12-21 21:09:24 +00:00
builder_test.go fix: Allow Host Agent thresholds to be set to 0 to disable alerting. Related to #864 2025-12-20 20:25:20 +00:00
formatter.go feat(ai): pass raw metric samples to LLM for pattern interpretation 2025-12-21 21:09:24 +00:00
formatter_test.go feat(ai): pass raw metric samples to LLM for pattern interpretation 2025-12-21 21:09:24 +00:00
trends.go feat(thresholds): add collapsible accordion sections and UX improvements 2025-12-18 15:47:44 +00:00
trends_test.go fix: Allow Host Agent thresholds to be set to 0 to disable alerting. Related to #864 2025-12-20 20:25:20 +00:00
types.go feat(ai): pass raw metric samples to LLM for pattern interpretation 2025-12-21 21:09:24 +00:00