/resonance-ops-system-health: measure the pulse, diagnose the drift
Role: the Doctor and benchmark engine.
Invoked as: /system-health (to run a full health check).
Input: Codebase State.
Output: Health Score (0-100) + Qualitative Flags.
Definition of Done: A final score is calculated using Test/Lint/Build weights. Qualitative flags for Auth Inconsistency, Env Fragility, Shallow Tests, and State Drift are explicitly marked.
You need to measure the system's pulse. A "Healthy" system has high confidence (tests pass), low entropy (clean lint), synced state (Map == Territory), consistent authorization, and environmental safety.
Prerequisites (fail fast)
Algorithm (Execution)
Copy this checklist and tick items as you go.
- Automated Vitals: Detect the project's toolchain first (see Toolchain Detection); do not assume npm. Run the project's own commands:
- Tests: the project's test command, with coverage if available. (Weight: 40%)
- Lint: the project's lint command. (Weight: 30%)
- Build: the project's build command. (Weight: 30%)
- Manual Vitals (The Qualitative Flags):
- Drift Check: Read
01_state.md. Does it match git log -10? (Flag: DRIFT_DETECTED)
- Auth Model Consistency: Do routes, policies, and UI templates agree on access rules? Delegate to
resonance-ops-security. (Flag: AUTH_INCONSISTENT)
- Environment Assumption Check: Are there hardcoded paths or missing fallbacks? Would the app survive deploying to a fresh environment? (Flag:
ENV_FRAGILE)
- Test Depth Check: Do tests cover failure paths and unauthorized paths? Quick scan against the 8-Path Matrix. Delegate to
resonance-ops-qa. (Flag: TEST_SHALLOW)
- Stale Tests Check: Do tests encode product decisions that have since changed? (Flag:
STALE_TESTS)
- Calculation:
Score = (Test% * 0.4) + (LintClean * 0.3) + (BuildPass * 0.3)
- Compile the qualitative flags.
- Synthesis: Output the Health Report.
Recovery
- Score < 80 → PRESCRIPTION: "Run
/test to boost coverage" or "Run /refactor to fix lint."
- Build Fail → IMMEDIATE: "Run
/debug."
- Auth Inconsistent → PRESCRIPTION: "Run
/audit Step 3 (Authorization Model Audit)."
- Env Fragile → PRESCRIPTION: "Add environment fallbacks."
Out of Scope
- Fixing the problems (delegate to
/refactor or /debug).
Cognitive Frameworks
Quantified Self
You cannot improve what you cannot measure. The Health Score provides a single metric to benchmark technical debt over time.
Qualitative Flags
A 100/100 score is useless if the tests only check the happy path (TEST_SHALLOW) or if the environment is hardcoded to localhost (ENV_FRAGILE). The flags are just as important as the score.
Reference Library
Operating Standard
Apply the Resonance operating standard from AGENTS.md (always loaded): the builder Voice and its banned-word list (no AI slop, no em dashes), Recommendation-First decisions (models recommend, the user decides), the Completion protocol (end with DONE / DONE_WITH_CONCERNS / BLOCKED / NEEDS_CONTEXT, backed by evidence, escalate after 3 failed tries), and the Ratchet (record durable learnings in the project memory; when .resonance/ledger/ exists it is the system of record for decisions, lessons, metrics, customers, and experiments, while 02_memory.md keeps [lib] notes and pointers).
Execution note: Use the host's native file, search, shell, browser, and delegation tools. Follow the procedure and verify material claims with evidence. Keep internal reasoning private and report decisions, actions, and results clearly.
1---2name: resonance-ops-system-health3description: System health assessor. Produces a repeatable whole-system health baseline and trend score across stability, test health, security posture, maintainability, and operational readiness. Use for periodic health checks or release readiness trends. Use Audit for finding-level review of a branch, change set, or concrete codebase scope.4---56# /resonance-ops-system-health: measure the pulse, diagnose the drift78> **Role:** the Doctor and benchmark engine.9> **Invoked as:** `/system-health` (to run a full health check).10> **Input:** Codebase State.11> **Output:** Health Score (0-100) + Qualitative Flags.12> **Definition of Done:** A final score is calculated using Test/Lint/Build weights. Qualitative flags for Auth Inconsistency, Env Fragility, Shallow Tests, and State Drift are explicitly marked.1314You need to measure the system's pulse. A "Healthy" system has high confidence (tests pass), low entropy (clean lint), synced state (Map == Territory), consistent authorization, and environmental safety.1516## Prerequisites (fail fast)1718- [ ] Project is initialized (has a `.resonance/` directory).1920## Algorithm (Execution)2122Copy this checklist and tick items as you go.23241. **Automated Vitals**: Detect the project's toolchain first (see Toolchain Detection); do not assume npm. Run the project's own commands:25 - **Tests**: the project's test command, with coverage if available. (Weight: 40%)26 - **Lint**: the project's lint command. (Weight: 30%)27 - **Build**: the project's build command. (Weight: 30%)282. **Manual Vitals (The Qualitative Flags)**:29 - **Drift Check**: Read `01_state.md`. Does it match `git log -10`? (Flag: `DRIFT_DETECTED`)30 - **Auth Model Consistency**: Do routes, policies, and UI templates agree on access rules? Delegate to `resonance-ops-security`. (Flag: `AUTH_INCONSISTENT`)31 - **Environment Assumption Check**: Are there hardcoded paths or missing fallbacks? Would the app survive deploying to a fresh environment? (Flag: `ENV_FRAGILE`)32 - **Test Depth Check**: Do tests cover failure paths and unauthorized paths? Quick scan against the 8-Path Matrix. Delegate to `resonance-ops-qa`. (Flag: `TEST_SHALLOW`)33 - **Stale Tests Check**: Do tests encode product decisions that have since changed? (Flag: `STALE_TESTS`)343. **Calculation**:35 - `Score = (Test% * 0.4) + (LintClean * 0.3) + (BuildPass * 0.3)`36 - Compile the qualitative flags.374. **Synthesis**: Output the Health Report.3839## Recovery4041- Score < 80 → PRESCRIPTION: "Run `/test` to boost coverage" or "Run `/refactor` to fix lint."42- Build Fail → IMMEDIATE: "Run `/debug`."43- Auth Inconsistent → PRESCRIPTION: "Run `/audit` Step 3 (Authorization Model Audit)."44- Env Fragile → PRESCRIPTION: "Add environment fallbacks."4546## Out of Scope4748- Fixing the problems (delegate to `/refactor` or `/debug`).4950## Cognitive Frameworks5152### Quantified Self53You cannot improve what you cannot measure. The Health Score provides a single metric to benchmark technical debt over time.5455### Qualitative Flags56A 100/100 score is useless if the tests only check the happy path (`TEST_SHALLOW`) or if the environment is hardcoded to `localhost` (`ENV_FRAGILE`). The flags are just as important as the score.5758## Reference Library5960- **[QA Health Rubric](../qa/references/qa_health_rubric.md)**: Full, Quick, and Regression modes.61- **[Toolchain Detection](../core/references/toolchain_detection.md)**: Detect and run the project's test/lint/build, not npm by reflex.62- **[Audit Classification Taxonomy](../core/references/audit_classification_taxonomy.md)**: Finding categories and P0-P3 ranking.6364## Operating Standard6566Apply the Resonance operating standard from AGENTS.md (always loaded): the builder Voice and its banned-word list (no AI slop, no em dashes), Recommendation-First decisions (models recommend, the user decides), the Completion protocol (end with DONE / DONE_WITH_CONCERNS / BLOCKED / NEEDS_CONTEXT, backed by evidence, escalate after 3 failed tries), and the Ratchet (record durable learnings in the project memory; when `.resonance/ledger/` exists it is the system of record for decisions, lessons, metrics, customers, and experiments, while `02_memory.md` keeps `[lib]` notes and pointers).6768> **Execution note:** Use the host's native file, search, shell, browser, and delegation tools. Follow the procedure and verify material claims with evidence. Keep internal reasoning private and report decisions, actions, and results clearly.