---
name: ctxfr-health
description: Run a comprehensive ctxfr context infrastructure health report. Use when the user asks for ctxfr health, routing completeness, decision integrity, agent effectiveness, context health scores, or the equivalent of /ctxfr-health.
---

# ctxfr Health

Run `ctxfr health`. Use `ctxfr health --enforce-thresholds` when the user wants a CI-style pass/fail gate from configured threshold values.

If `ctxfr` is not found, tell the user: `The ctxfr binary is not installed. Run cmake --build build && cmake --install build from the ctxfr repo.`

Then add these LLM checks:

- Retrieval: use `ctxfr route-check` and `ctxfr sources --grouped` when available; list top-level source directories without spec coverage; flag retrieval gaps.
- Decisions: read `docs/decisions.md`; verify referenced ADRs and specs exist.
- Agents: list installable `agents/*.md`; flag missing metadata or install coverage.

Use this report shape:

```text
=== CONTEXT HEALTH REPORT ===
Date: YYYY-MM-DD
<ctxfr health output>

RETRIEVAL: X specs, Y agents
  Unrouted directories: ...
  Context gaps: ...

DECISION INTEGRITY: X decisions, Y broken links
  ...

AGENT EFFECTIVENESS: X agents, Y discoverable
  ...

COMPOSITE HEALTH: score / 1.0
  Routing:    score  (weight: 0.30)
  Coverage:   score  (weight: 0.25)
  Freshness:  score  (weight: 0.25)
  Decisions:  score  (weight: 0.10)
  Agents:     score  (weight: 0.10)
```

Provide concrete recommendations for any failing area.
