Agent-First Health Reports

Loka's health endpoint produces structured text designed for AI agent consumption. Instead of dashboards with charts, it outputs context-rich text that an agent can read, reason about, and act on:

$ loka health --data my_graph.sdb

Overall: HEALTHY

HNSW Index: :hasEmbedding
  Status: HEALTHY
  Vectors: 435 (0 deleted, 0.0% tombstone ratio)
  Layers: 3 (L0: 435, L1: 28, L2: 3)
  Connectivity: avg 12.4, min 4, max 16
  Entry points: 3

Pseudo-Tables: 2 discovered
  Coverage: 78% of triples in pseudo-tables
  Cliff steepness: 8.2 (good schema consistency)

Storage:
  Triples: 16,234
  Terms: 4,891
  Predicates: 47

What Gets Measured

CategoryMetricsWhy It Matters
HNSW HealthTombstone ratio, layer distribution, avg/min/max connectivity, entry point diversityHigh tombstone ratio degrades search quality. Low connectivity indicates graph fragmentation.
Pseudo-Table CoverageCoverage ratio, cliff steepness, segment count, tail propertiesLow coverage means most queries can't use columnar acceleration. Shallow cliff means messy data.
StorageTriple count, term dictionary size, unique predicatesBaseline metrics for capacity planning and anomaly detection.

Actionable Recommendations

The health report suggests specific actions based on thresholds:

An AI agent can read these recommendations and execute loka health --rebuild-hnsw without human intervention.

Three Severity Levels

LevelMeaningAction
HEALTHYAll metrics within normal rangeNo action needed
WARNINGSome metrics approaching thresholdsSchedule maintenance during next low-usage period
CRITICALMetrics exceed thresholds, performance impactedImmediate maintenance recommended