Evaluating the health of a repository usually requires running multiple disjointed tools: linters, circular dependency checkers, dead code detectors, and test runners.

In TokenCap, we unified these signals into an objective 0-to-100 repository health diagnostic in src/health/buildHealth.js.

What Factors Drive the Health Score?

  1. Call Resolution Ratio (30% weight): Percentage of intra-repo call expressions that successfully resolve to declared symbols.
  2. Dead Code Ratio (20% weight): Ratio of uncalled internal functions relative to total declared symbols.
  3. Architecture Boundaries (20% weight): Frequency of circular dependencies and unexpected cross-cluster imports.
  4. Test Mapping Coverage (15% weight): Ratio of exported functions with direct unit test mappings.
  5. Security Cleanliness (15% weight): Absence of unescaped static taint sinks and credential leaks.

CLI Health Diagnostic

tokencap analyze health 

Output:

Evaluating repository health across 94 files... ------------------------------------------------------ OVERALL BUILD HEALTH SCORE: 88 / 100 [GRADE: A-] ------------------------------------------------------ ✓ Call Resolution: 91% (891 / 978 call sites resolved) ✓ Circular Dependencies: 0 detected ! Dead Code: 6 uncalled functions (-4 pts) ! Untested Exports: 14 exported functions missing tests (-6 pts) ✓ Security Sinks: 0 critical taint paths ------------------------------------------------------ Report saved to .tokencap/health-report.json 

By running health checks before and after agent sessions, teams can verify that automated code changes improve the overall score rather than degrading it.

Learn more at tokencap.vansharora.app