Experimental research reports
Use these pure helpers to report caller-supplied observations in offline experiments. They do not enforce permissions, validate source provenance, evaluate task artifacts, inspect causal traces, or measure provider cache hits. The host owns those checks. See Inspiration primitives (host import guide) for stable integration surfaces and Trouble research and implementation for the remaining Trouble acceptance gaps.
Paired verdict reporting
Paired task-success and harness-fidelity scores.
A correct file can hide a dropped tool error, and a faithful harness can still
deliver a wrong answer. Missing observations stay unknown; they are not
rewritten as a pass or as an infrastructure failure.
- class mechaharness.layered_verdict.LayeredEvaluation(*, task: Claim, harness: Claim, outcome: EvaluationOutcome, causal_support: Claim | None = None)[source]
Bases:
BaseModelTyped report over existing evaluation claims; supplied claims are not observations.
- causal_support: Claim | None
- harness: Claim
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- outcome: EvaluationOutcome
- task: Claim
- mechaharness.layered_verdict.score_layers(*, task: Literal['pass', 'fail'], harness: Literal['pass', 'fail'] | None = None, harness_observed: bool = True, infrastructure_failure: bool = False, trace_supports_cause: bool = False) dict[str, Any][source]
Combine caller-supplied task and harness verdicts for one run.
The caller evaluates task success and trace fidelity before calling this helper. Missing harness observations yield
unknown; an infrastructure failure leaves both layersunscored. A run is clean only if both pass.attribution='caller_asserted'records the caller’strace_supports_causeassertion when both fail; this helper does not inspect causal evidence.Example
>>> lucky = score_layers(task="pass", harness="fail") >>> (lucky["task"], lucky["harness"], lucky["clean"]) ('pass', 'fail', False) >>> score_layers(task="pass")["harness"] 'unknown' >>> score_layers(task="fail", harness="fail")["attribution"] 'hypothesis'
Selected request-field comparison
Compare selected request fields without storing their prompt text.
The report labels tool-order and policy changes for offline experiments. It neither observes the serialized provider request nor measures cache misses.
- mechaharness.request_prefix.classify_prefix_change(before: dict[str, Any], after: dict[str, Any], *, provider_metrics: bool) dict[str, Any][source]
Label a change between two
prefix_snapshot()reports.provider_metricsis caller-supplied availability, not measured telemetry. Identical snapshots yieldunknownwithout it.volatile_systemmeans policy text changed without a version bump; the helper cannot tell a clock from a legitimate edit. Labels are heuristic experiment categories, not observed cache-miss causes. Policy-version changes take precedence over tool-order changes. Changed tool names or schemas take priority and yieldunknown: their legitimacy cannot be determined by comparing hashes alone.Example
>>> snap = prefix_snapshot(tools=[], policy="policy", policy_version="1", ... dynamic="task") >>> classify_prefix_change(snap, snap, provider_metrics=False)["cause"] 'unknown' >>> classify_prefix_change(snap, snap, provider_metrics=True)["cause"] 'match'
- mechaharness.request_prefix.prefix_snapshot(*, tools: list[dict[str, Any]], policy: str, policy_version: str, dynamic: str) dict[str, Any][source]
Hash caller-supplied tool, policy, and dynamic blocks.
Tool fingerprints include only
nameandparameters(missing or empty parameters normalize to an empty dict). Descriptions and provider-specific fields are omitted. Policy text and dynamic text are hashed; policy_version is retained verbatim and must be a nonsensitive identifier. These hashes are diagnostics, not a secrecy guarantee or full wire-request fingerprints.Example
>>> snap = prefix_snapshot(tools=[{"name": "read"}], policy="Be concise", ... policy_version="1", dynamic="Read a file") >>> sorted(snap) ['dynamic', 'policy', 'policy_version', 'tools_canonical', 'tools_order'] >>> snap["policy_version"] '1'