Skip to content

symfonic.capabilities.governance.contracts

contracts

The ports governance binds to, none of which it implements (T3.4.4).

Every one is structural. The capability never imports a classifier, a detector, a critic, or a tokenizer: it states the shape it needs and the composition root supplies it. That is what keeps this package importable without dragging the agent, a provider SDK, or a tokenizer download in behind it.

ConfidenceReporter

Bases: Protocol

How sure the caller is of this draft, when nothing else knows.

Synchronous and offline, like :class:TokenMeter and unlike :class:Reflector: the gate exists to decide whether the one expensive port is worth calling, so the signal it decides on must not cost a model call of its own.

Returning None withholds the claim and leaves the gate unfired, which is the same tri-state rule GovernanceSubject.confidence follows. The framework never computes this: a confidence synthesised from whatever happened to be in reach is how the legacy gate came to fire on every turn.

FabricationDetector

Bases: Protocol

Scans a draft against what actually grounded it.

Synchronous by contract: the legacy detector is regex over text, and an async signature would invite someone to put a network call behind the one stage that has to be cheap enough to run on every turn.

GovernanceStage

Bases: Protocol

One governed concern.

The three class-level declarations are not metadata: the pipeline checks them against the rulebook at composition time and refuses a stage whose claims differ. apply may raise โ€” that is precisely what failure_mode is a declaration about.

IntentClassifier

Bases: Protocol

Reads the user's turn. Async because the real one calls a model.

MetacognitionTriggerPolicy

Bases: Protocol

Names the evidence that requires reflection for one draft.

None means the policy deliberately skipped a trivial acknowledgment; a non-empty string is copied into the trace as the trigger. The policy is synchronous and uses only the subject/context evidence already present at the governance boundary.

Objector

Bases: Protocol

A precondition or a policy guard: same shape, different authority.

Returns the objection text, or None to admit. tool_name scopes a precondition to one tool; a guard that omits it sees every call.

Reflector

Bases: Protocol

The critic. Async, and the only port that costs a model call.

TokenMeter

Bases: Protocol

Counts a payload. Offline by construction โ€” see T3.2.1's budgeting rule.