Knowledge Portal · engineering documentation

Skip to content

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


Clinic Agent Action Policy

Action Policy is the guardrail layer between tool planning (PL-003 goal/task routing) and tool execution (handler invocation). It answers more than permission checks:

  • Is the user allowed to run this action class?
  • Is the tool read-only or write?
  • Does it require staff confirmation?
  • Is it idempotent?
  • Is there duplication risk on real customer/clinic data?

Execution logic keys off action class, not ad-hoc tool name string matching.

Pipeline position

text
User message
  → Intent classification (product)
  → Goal / task planning (PL-003)
  → Tool routing (PL-003)
  → Action Policy authorize()   ← this layer
  → Tool handler execution
  → Response composition + UI blocks

Tool classification

ToolAction classMutationIdempotentDuplication risk
list_today_appointmentsReadread_onlyyeslow
search_leadsReadread_onlyyeslow
get_admin_navigationNavigateread_onlyyesnone
get_operational_snapshotSensitiveread_onlyyesmedium
generate_daily_reportSensitiveread_onlyyesmedium
propose_booking_for_leadWritewritenohigh

Action classes

  • Read — relatively safe lookups (list_today_appointments, search_leads)
  • Navigate — admin links and page routing (get_admin_navigation)
  • Write — creates or queues mutations (propose_booking_for_lead)
  • Sensitive — financial/export-grade operational data (get_operational_snapshot, generate_daily_report)

Policy decisions

ClinicToolActionPolicyEvaluator returns one of:

StatusMeaning
allowedHandler may execute
blockedDo not execute (permissions, unknown tool, duplicate write)
requires_confirmationReserved for explicit staff confirmation before execution

Blocked and confirmation-required results are returned to the LLM/runtime as structured JSON so the agent can explain the guardrail instead of failing silently.

Implementation map

ComponentRole
ClinicToolActionPolicyRegistryCanonical tool catalog + classification
ClinicToolActionPolicyEvaluatorPolicy rules
ClinicToolActionPolicyGuardTurn-scoped facade
ClinicToolActionDedupStoreShort-window dedup for non-idempotent tools
PolicyAwareProductToolHandlerBridgeEnforces policy at PL-003 handler boundary
AiToolExecutionOrchestratorEnforces policy on local execution path
ClinicAgentOrchestratorBinds policy context for each agent turn

Extending tools

When adding a clinic agent tool:

  1. Register handler + schema in ClinicDomainToolRegistration
  2. Add a policy definition in ClinicToolActionPolicyRegistry
  3. Choose action class and duplication risk explicitly
  4. Add unit coverage in ClinicToolActionPolicyTest

Never rely on tool name checks scattered across orchestrators — extend the registry instead.

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