How it works
ModelSelectionServiceInterface::resolveModelForCall() returns a ModelResolution: the model and a RoutingSummary. Behind it, RoutingDecisionService runs discovery, then EligibilityEvaluator, then CandidateRanker. Eligibility is a hard constraint: a refused candidate gets a RoutingRejectionReason (capability missing, adapter not allowed, context too small, cost above limit, operation capability missing) and no score. Provider priority sorts above the score, because a priority is an instruction. routing.policyMode selects providerPriority (the default, no measured signals), balanced, quality or economy; a model with no measurement contributes nothing rather than a zero. ConfigurationCallPlanner records the summary on TelemetrySignals, and the telemetry row stores the policy mode, the candidate count, the distinct rejection reasons and which signals actually moved the decision. Fixed mode stores an empty mode, because nothing was chosen.
ContextWindowManager::fit() takes the resolved model and prefers it over the configuration's relation; an unknown context length falls back to 8192 tokens. LlmServiceManager binds chat, tool-calling and streaming sends at the pipeline terminal, the first place the resolved model exists, and tool schemas count against the same budget. A completion prompt is measured and an overflow is logged, but it is never pruned. A transcript that does not fit even at its floor is sent unpruned with a warning.
ToolDataClass is one scale from publicContent to secretAdjacent. TrustZone (local, privateHosted, externalEu, externalGlobal) maps each zone to a maximum class. TrustZoneResolver::zoneFor() returns the least trusted zone a run can reach: the configuration's provider, or the serving model's provider in criteria mode, plus one hop of the fallback chain; anything unknown is externalGlobal. The tool gate removes tools above the ceiling. InputContextTrustGate refuses a send whose strictest declared source exceeds the zone — snippets, skills, the system prompt, and the sources a run forces in (ADR-164). An undeclared source constrains nothing. tools.dataClassEnforcement decides for both directions: only a literal observe observes. Denials and refusals are written to tx_nrllm_governance_event.
On the Governance tab, EffectivePolicyReadout shows privacy.level, privacy.retentionDays, tools.dataClassEnforcement and skills.minTrustLevel as the runtime resolves them; a row that cannot be answered reads unknown. GovernanceProfile defines expected values per posture, and GovernanceProfileEvaluator::deviations() compares them with the readout's rows and names where each value is set. There is no apply path (ADR-140). GovernanceSimulator asks configuration access, the tool gate, the input-context gate, routing and human approval, and returns allow, allowWithApproval or block. Each telemetry row also carries actual_input_tokens, actual_output_tokens, actual_cost, response_model, provider_retries and model-independent facts_* columns; UsageMiddleware passes source_extension to UsageTrackerServiceInterface::trackUsage(), which aggregates cost per day and extension in tx_nrllm_service_usage.
Netresearch\NrLlm\Service\Routing\RoutingDecisionService
The routing decision point: discovery, eligibility, ranking. Returns a RoutingDecision with every candidate; used by the runtime and by the Governance tab.
Netresearch\NrLlm\Service\Routing\EligibilityEvaluator
The only implementation of "may this model serve this call". Returns a RoutingRejectionReason instead of false; modelMatchesCriteria() delegates to it.
Netresearch\NrLlm\Domain\ValueObject\RoutingSummary
Six values persisted per routed call: policy mode, candidate count, distinct rejection reasons, and whether quality, health and cost moved the decision.
Netresearch\NrLlm\Service\Context\ContextWindowManager
Sizes the send budget from the model that serves the call, prunes whole oldest turns, and reports an overflow instead of refusing the send.
Netresearch\NrLlm\Service\Governance\TrustZoneResolver
Least trusted zone a run can reach across the provider and one fallback hop; ceilingFor() turns it into the tool data-class ceiling. Unknown fails closed to externalGlobal.
Netresearch\NrLlm\Service\Context\InputContextTrustGate
Refuses (enforce) or records (observe) a send whose strictest declared snippet, skill, system-prompt or forced-source class exceeds the reachable zone.
Netresearch\NrLlm\Service\Governance\GovernanceProfileEvaluator
Compares the readout's rows with a GovernanceProfile and returns each deviation with where to change it. Reads nothing itself and writes nothing.
Netresearch\NrLlm\Service\Tool\GovernanceSimulator
The "Would this be allowed?" panel: calls the runtime's own gates for a configuration, a tool and optionally a backend user, and records nothing.