Skip to content

feat(cli): add health metrics to fossel doctor - #53

Merged
7vignesh merged 2 commits into
mainfrom
feat/doctor-health-metrics
Oct 13, 2026
Merged

7vignesh merged 2 commits into
mainfrom
feat/doctor-health-metrics

Conversation

@7vignesh

Copy link
Copy Markdown
Owner

Closes #33.

Problem

fossel doctor reported repo keys, duplicate clusters, stale-alias mentions, and detected MCP config - but nothing about the actual health of the stored memories, even though access-tracking and validity columns now exist.

Fix

Extend the doctor report with per-repo health metrics:

  • live vs superseded counts
  • stale ratio - memories never accessed (access_count = 0) and older than 90 days, shown as a fraction + percentage of live
  • side-table coverage - how many live memories have embeddings / entities / file refs

The logic lives in a new src/lib/stats.ts (gatherHealthMetrics) so it is unit-testable; the doctor command just renders it (thin-logic convention per AGENTS.md).

Fails soft: every optional metric is computed in a try/catch and returns null if its column or side table is absent (older db, or a feature never enabled), rather than throwing - matching the existing report-gathering style. Stale and coverage lines are only shown when there are live memories to report on.

Example added lines:

Memories for acme/app: 12 live, 2 superseded.
Stale (never accessed, older than 90d): 3/12 (25%).
Coverage of 12 live: embeddings 12, entities 10, file refs 7.

Tests

tests/stats.test.ts: live/superseded split (and that other repos do not leak), stale detection (and that accessing a memory clears it), side-table coverage, and the fail-soft null path when a table is dropped.

Verification

npm run typecheck clean; full suite 256/256 pass; npm run build succeeds; verified the doctor command renders the new lines end-to-end.

Extend the doctor report with per-repo health metrics: live vs superseded
counts, a stale ratio (never-accessed memories older than 90 days), and
coverage of the embedding / entity / file-ref side tables.

Logic lives in a new src/lib/stats.ts (gatherHealthMetrics) so it is unit
testable; the doctor just renders the result. Every optional metric is
computed defensively and returns null if its column/table is absent, so
the report degrades gracefully on older databases. Stale and coverage
lines are only shown when there are live memories to report on.

Covered by tests for the live/superseded split, stale detection (and that
accessing a memory clears it), side-table coverage, and the fail-soft null
path when a table is dropped.
@vercel

vercel Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
fossel Ready Ready Preview Oct 13, 2026 11:07am UTC

@7vignesh
7vignesh merged commit 23db43e into main Oct 13, 2026
6 checks passed

This branch was successfully deployed

1 active deployment
Preview — 7b19c904 Deployed Oct 13, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add health metrics to fossel doctor

1 participant