Pulse/internal/ai
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
..
baseline Improve AI test coverage 2025-12-21 20:22:47 +00:00
context feat(ai): pass raw metric samples to LLM for pattern interpretation 2025-12-21 21:09:24 +00:00
correlation fix: Allow Host Agent thresholds to be set to 0 to disable alerting. Related to #864 2025-12-20 20:25:20 +00:00
cost fix: Allow Host Agent thresholds to be set to 0 to disable alerting. Related to #864 2025-12-20 20:25:20 +00:00
knowledge fix: Allow Host Agent thresholds to be set to 0 to disable alerting. Related to #864 2025-12-20 20:25:20 +00:00
memory Improve AI test coverage 2025-12-21 20:22:47 +00:00
patterns fix: Allow Host Agent thresholds to be set to 0 to disable alerting. Related to #864 2025-12-20 20:25:20 +00:00
providers test: improve test coverage for AI, license, config, and monitoring packages 2025-12-19 22:49:30 +00:00
alert_adapter.go test: add unit tests for AI, Kubernetes agent, and clients 2025-12-17 12:47:36 +00:00
alert_adapter_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
alert_provider.go AI Problem Solver implementation and various fixes 2025-12-06 23:46:08 +00:00
alert_provider_test.go test: add unit tests for AI, Kubernetes agent, and clients 2025-12-17 12:47:36 +00:00
alert_threshold_adapter.go refactor(ai): Remove over-engineered URL discovery service 2025-12-10 08:35:24 +00:00
alert_threshold_adapter_test.go test: add unit tests for AI, Kubernetes agent, and clients 2025-12-17 12:47:36 +00:00
alert_triggered.go feat: enhance AI baseline context visibility and incident timeline improvements 2025-12-21 00:14:20 +00:00
alert_triggered_test.go test(ai): improve AI package test coverage from 59.7% to 69.5% 2025-12-19 21:53:06 +00:00
baseline_adapter.go feat(ai): Add baseline learning and anomaly detection (Phase 2) 2025-12-12 11:26:31 +00:00
baseline_adapter_test.go test: add unit tests for AI, Kubernetes agent, and clients 2025-12-17 12:47:36 +00:00
baseline_exports.go feat(ai): Wire baseline learning loop into router startup 2025-12-12 11:29:47 +00:00
config.go AI Problem Solver implementation and various fixes 2025-12-06 23:46:08 +00:00
correlation_exports.go feat(ai): Add multi-resource correlation detection (Phase 6) 2025-12-12 14:26:10 +00:00
cost_persistence.go feat(ai): Add enriched context with historical trends and predictions 2025-12-12 09:45:57 +00:00
cost_persistence_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
exports_test.go test(ai): improve AI package test coverage from 59.7% to 69.5% 2025-12-19 21:53:06 +00:00
findings.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
findings_persistence.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
findings_persistence_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
findings_test.go Add more AI test coverage 2025-12-21 20:31:24 +00:00
intelligence.go feat(ai): add unified Intelligence orchestrator 2025-12-21 10:32:02 +00:00
intelligence_test.go Add more AI test coverage 2025-12-21 20:31:24 +00:00
kubernetes_analysis.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
kubernetes_analysis_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
memory_exports.go feat(ai): Add operational memory (Phase 3) - change detection and remediation logging 2025-12-12 13:49:37 +00:00
metadata_provider.go fix: add missing HandleLicenseFeatures method and related changes 2025-12-19 22:59:52 +00:00
metrics_history_adapter.go feat(ai): Add enriched context with historical trends and predictions 2025-12-12 09:45:57 +00:00
mock_test.go test(ai): improve AI package test coverage from 59.7% to 69.5% 2025-12-19 21:53:06 +00:00
patrol.go refactor: only show critical/warning patrol findings 2025-12-21 18:34:51 +00:00
patrol_history_persistence.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
patrol_history_persistence_test.go test(ai): improve AI package test coverage from 59.7% to 69.5% 2025-12-19 21:53:06 +00:00
patrol_test.go test: update GetAllFindings test to match filtering behavior 2025-12-21 19:20:27 +00:00
pattern_exports.go feat(ai): Add failure pattern detection for predictive intelligence (Phase 5) 2025-12-12 14:11:28 +00:00
resource_context.go Add AI monitoring enhancements and host metadata features 2025-12-09 16:27:46 +00:00
routing.go Add AI monitoring enhancements and host metadata features 2025-12-09 16:27:46 +00:00
routing_test.go AI Problem Solver implementation and various fixes 2025-12-06 23:46:08 +00:00
sanitize_test.go refactor(ai): Remove over-engineered URL discovery service 2025-12-10 08:35:24 +00:00
service.go feat(ai): add real-time anomaly detection endpoint 2025-12-21 10:52:54 +00:00
service_extended_test.go feat(ai): add unified Intelligence orchestrator 2025-12-21 10:32:02 +00:00
service_remediation_test.go feat(ai): add unified Intelligence orchestrator 2025-12-21 10:32:02 +00:00
service_test.go test(ai): improve AI package test coverage from 59.7% to 69.5% 2025-12-19 21:53:06 +00:00
service_tools_test.go test(ai): improve AI package test coverage from 59.7% to 69.5% 2025-12-19 21:53:06 +00:00
target_host_test.go AI Problem Solver implementation and various fixes 2025-12-06 23:46:08 +00:00