Skip to content

Expose intelligence snapshots via API and UI #22

Description

@vishr

Problem

The intelligence detector (internal/intelligence/detector.go) runs every 60 seconds computing:

  • Error rate anomalies (z-score vs baseline)
  • Latency degradation detection
  • Volume change detection
  • Log pattern clustering
  • Overall health score (0-100)

These results are only logged via slog.Info and discarded. There is no:

  • API endpoint to retrieve current or historical snapshots
  • Chat/AI tool exposing intelligence data
  • Way for the LLM orchestrator to access anomaly insights

Current architecture

The chat UI uses an AI orchestrator with tools (status, diagnose, timeline, etc.) that query DuckDB. The intelligence detector runs independently but its analysis isn't available to any tool.

Proposal

  1. Persist snapshots (in-memory ring buffer or persistent DuckDB table with Switch to persistent DuckDB for rollup tables #21)
  2. Add GET /api/intelligence endpoint returning current snapshot
  3. Add an AI tool (or enrich existing status tool) with intelligence data so the LLM can report anomalies proactively
  4. Optionally surface health score in the chat UI sidebar

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions