aicp-ops-metrics
Inspect AICP live metrics (LocalAI Prometheus + GPU + API call stats) or aggregated history (per-backend tokens/cost/latency) via the CLI surface. Replaces the deprecated aicp_metrics MCP tool per `wi
SKILL.md.claude/skills/aicp-ops-metrics/SKILL.md
GitHubaicp-ops-metrics
Inspect AICP performance and resource metrics via the aicp CLI. AICP exposes
two complementary metric surfaces: --metrics (LIVE LocalAI Prometheus +
GPU + API call stats) and --stats (AGGREGATED task history — tokens, cost,
per-backend breakdown). This skill teaches both via the CLI surface, NOT the
deprecated aicp_metrics MCP tool.
Trigger phrases (when to load this skill)
Load when the conversation matches any of:
- Direct verb: operator says "show metrics", "what's the GPU usage", "how many tokens did we use", "what's our cost", "API call stats", "is LocalAI responsive", "performance check", "show me the dashboard summary"
- Pre-tuning: operator wants to compare current performance against a baseline before changing a profile or model
- Post-deployment: after switching profile/model, verify the new config is performing as expected
- Cost concern: token/cost rollup needed for a project review
- Resource pressure: GPU memory or LocalAI worker pool saturation suspected — live metrics confirm or rule it out
Do NOT load when:
- The concern is dashboard SETUP (load
infra-monitoring— Prometheus + Grafana stack management) - The concern is reliability metrics specifically (load
aicp-ops-dlqfor DLQ +--health-reportfor trend analysis) - The concern is detailed task forensics (load
--history/--replayvia this skill's reference, or useaicp-ops-dlqfor failed-task analysis)
Operations
Operation 1 — Live snapshot (LocalAI + GPU + API)
When: operator wants the CURRENT state of the inference stack.
Process:
- Run
aicp --metrics - Output sections:
- LocalAI: URL, goroutines, memory_alloc/sys MiB, loaded models, backends
- API Call Stats table: per-method count + total_ms + avg_ms (from
/metrics) - GPU: name, VRAM used/total %, utilization %, temperature
- The output's closing
NEXT:recommends--statsfor aggregates or--health-reportfor trend analysis - If LocalAI is unreachable, the output will say so and the NEXT line will
recommend
docker compose up -d localai— verify withaicp --checkif needed
Quality bar: a healthy snapshot has GPU memory <70% (color-coded green), goroutines stable across calls, and API avg_ms within historical norms. Anomalies in any of these signal investigation.
Operation 2 — Aggregated history (per-backend tokens/cost)
When: operator wants to see the overall trend, not the current instant.
Process:
- Run
aicp --stats - Output sections:
- Summary table: tasks today/week/total, avg latency, error rate, prompt tokens, completion tokens, total tokens, est. cost USD
- Per-backend breakdown table: tasks/avg_latency/error_rate/tokens/cost per backend (local, claude, openrouter, fleet)
- The output's closing
NEXT:recommends--history <N>for per-task detail or--health-reportfor trend deltas - If
total_tasks == 0, the output says "No history yet" and the NEXT line recommends running a task first
Quality bar: per-backend breakdown should match the operator's expected
mission progress (per CLAUDE.md ## The Mission: more tasks should be hitting
local than claude as Stage 3 progresses). If claude's task count exceeds
local, the routing is wrong (or the workload is genuinely too complex —
investigate).
Operation 3 — Health trend analysis
When: operator wants delta-over-time, not point-in-time, on system health.
Process:
- Run
aicp --health-report - Output is a generated trend report comparing current state to a baseline
(per
aicp/core/health_report.py); save_report() also persists to disk - The output's closing
NEXT:recommends--checkfor live status or--dlq-statusif the report flagged failures - Trend deltas highlight degradation (e.g., latency creeping up, error rate trending higher) before they become incidents
Quality bar: a baseline-vs-current report should be the FIRST signal
operator sees during periodic health reviews; live --metrics is a deeper
follow-up if the trend report flags something.
Operation 4 — Tune metric collection
When: operator wants to change Prometheus endpoint, scrape interval, or metric retention.
Process:
- Edit
config/default.yamlprometheus:section (port, retention) - Restart AICP to pick up changes (
docker compose restartfor the LocalAI side; AICP CLI re-reads on each invocation) - For Grafana dashboards, refer to
infra-monitoringskill — this skill teaches CONSUMING metrics, not authoring dashboards
Quality bar: changes to scrape interval must be coordinated with Grafana dashboard refresh rates (mismatched rates produce visible gaps in graphs).
Gotchas
Detection: agent uses
aicp_metricsMCP tool instead ofaicp --metricsCLI. Rule: NEVER callaicp_metricsMCP tool — it's deprecated and will be removed. Reasoning: per audit decision, MCP overhead is paid per turn for a tool used during specific workflows; CLI+Skills loads this skill on demand only when the operator's request matches the trigger phrases above.Detection: agent confuses
--metrics(live snapshot) with--stats(aggregated history). Rule:--metricsshows what's happening NOW;--statsshows what HAS HAPPENED. Reasoning: live snapshot answers "is it healthy right now?"; aggregated history answers "how have we performed?". Operator question phrasing usually disambiguates; if unclear, ask before running.Detection: agent treats GPU temperature as a primary KPI. Rule: GPU temp is informational; the primary GPU KPI is VRAM utilization % (which directly affects whether models can load) and GPU utilization % (which affects throughput). Reasoning: GPU temperature is bounded by the hardware's thermal throttling; unless thermal throttling is suspected, it's not actionable.
Detection: agent reports raw cost numbers without context. Rule: cost is meaningful only against the mission target — CLAUDE.md
## The MissionStage 5 = "80%+ Claude token reduction". Always frame cost in terms of that target, not absolute USD. Reasoning: AICP's cost optimization is structural (route to local), not per-token frugality; an absolute USD number doesn't show whether the routing is doing its job.Detection: agent re-runs
--metricsrepeatedly in a tight loop. Rule: each call queries LocalAI's/metricsendpoint plus runsnvidia-smi; tight-loop calls add load to the inference stack and don't add information. Wait at least 5-10s between calls if monitoring transient behavior. Reasoning: live snapshots are point-in-time; multiple within seconds of each other observe noise, not signal.
Reference exemplars
aicp/cli/main.py_run_metrics()line 1386+ for live snapshot implementationaicp/cli/main.py_run_stats()line 1462+ for aggregated history implementationaicp/core/metrics.pyfor the underlyingaggregate()andoffload_report()helpersaicp/core/health_report.pyfor the trend analysis backendwiki/decisions/00_inbox/aicp-mcp-tool-surface-audit-2026-04-19.md— Category D rationale for this skill's existencewiki/decisions/00_inbox/aicp-cli-mcp-outputs-adopt-gateway-output-contract.md— explains theNEXT:lines this skill's commands produce
Domain context
AICP exposes metrics at three levels: LocalAI's built-in /metrics (Prometheus
format on port 8090), AICP's own metrics exporter (/metrics on port 9101 per
CLAUDE.md ## Observability), and aggregated task history (file-based, read by
--stats). The optional Grafana stack (make monitoring-up) provides the
dashboards on port 3000 (admin/aicp). This skill operates at the CLI summary
layer; the visualization layer is infra-monitoring's scope.
Related skills
| Skill | When to use |
|---|---|
infra-monitoring |
When setting up Prometheus + Grafana stack or adding alerts |
aicp-ops-dlq |
When the metric concern is reliability/failure (DLQ growth specifically) |
quality-performance |
When the concern is performance regression analysis (uses these metrics as input) |