Knowledge Portal · engineering documentation

Skip to content

Federated from workspace · PRD-001 · Dental Clinic Revenue Operating System/docs/technical/CLINIC_CAPABILITY_COVERAGE_TESTING.md Do not edit canonical truth here — update the source repo, then re-run npm run docs:sync.


Clinic Capability Coverage Testing

Status: Implemented (2026-07-05)
Authority: App\Modules\AI\Application\Coverage

Purpose

Intent coverage testing ensures every natural-language variant for a registered capability resolves to the same capability key — the pattern used by OpenAI evals, Cursor agent routing tests, and similar systems.

Example for clinic.operations.daily_report:

  • Show today's report
  • Today's report
  • Daily report
  • Report today
  • Can I see today's report?

All must resolve to clinic.operations.daily_report.

Pipeline

ClinicCapabilityCoverageCatalog     ← capability key + seed phrases

ClinicCapabilityCoveragePhraseGenerator   ← template expansion

ClinicIntentUnderstandingEngine     ← signals (LLM off in tests)

CapabilityMatcher (PL-003)          ← same matcher as production

Assert capability key

Adding coverage for a capability

Edit ClinicCapabilityCoverageCatalog::definitions():

php
'clinic.operations.daily_report' => [
    'seeds' => ['today\'s report', 'daily report'],
    'extras' => ['Report today', 'Can I see today\'s report?'],
],

Default templates (override with templates key):

  • {seed}
  • Show {seed}
  • Give me {seed}
  • {seed} please
  • Can I see {seed}?

Run

bash
php artisan test app/Modules/AI/Tests/Unit/ClinicCapabilityCoverageTest.php

Failures indicate routing gaps — fix Intent Engine / catalog, not the test expectation.

Components

ComponentRole
ClinicCapabilityCoverageCatalogRegistered capabilities + seeds
ClinicCapabilityCoveragePhraseGeneratorExpands seeds into phrase matrix
ClinicCapabilityCoverageResolverPhrase → intent signals → matched capability

ZAIXOS Knowledge Portal — public engineering docs at /docs · Staff operations at /admin