symfonic.capabilities.critic.capability¶
capability ¶
Post-draft reflection as something Agent can be handed (CORE-403).
A port of MetacognitiveMiddleware's core contract -- the
confidence/sensitive gate plus one hidden reflection call returning
approve/revise/refuse -- as an opt-in post-model capability. Absent from
capabilities=[...] the stage does not exist and turns behave exactly as
before; composed, it records its verdict on the turn snapshot per turn.
What the port deliberately does not carry: callback-manager emission, OTel
hooks, usage extraction (the kernel attributes model calls through run
observation instead), the role_models["critic"] override (the provider
is injected directly), and the selective smart gate with adopter callables
and fabrication/intent threading. Those stay on the middleware.
Two kernel facts bound what the stage can do. The verdict is recorded,
not applied: post-model contributions apply nothing yet, so a revise does
not rewrite the response -- the same "recorded, wired later" standing the
triage port shipped with. And no kernel stage publishes activation records,
so per-turn signals arrive through the resolved critic.signals entry
(see :mod:.signals); absent, the gate degrades to cold-start neutral.
CriticCapability
dataclass
¶
CriticCapability(model_provider: Any, confidence_threshold: float = 0.6, sensitive_tags: frozenset[str] = frozenset(), preferences: tuple[CriticPreference, ...] = (), rules_source: ProceduralRulesSource | None = None, prompt_template: str = DEFAULT_REFLECTION_PROMPT, model_config: Any = None)
Review each turn's draft; record approve, revise, or refuse.
Usage::
Agent(provider, capabilities=[
CriticCapability(
model_provider=provider,
preferences=(CriticPreference(10.0, "Never reveal keys"),),
),
])
The hidden reflection call runs under the model_call effect grant.
contribute ¶
Declare the critic stage and the handler that answers it.
Source code in src/symfonic/capabilities/critic/capability.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | |