Documentation
¶
Overview ¶
Package harness holds the self-optimization decisions (SPEC-ADDITIONS §18): classify a miss as a harness defect or an execution lapse (§18.3), and accept a candidate only on a strict held-out improvement via the gate ratchet (§18.2). It composes skillet/ratchet as a leaf; it performs no effect.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Accept ¶
Accept applies the comparative ratchet on a held-out score (§18.2): a candidate is kept only if it strictly beats the current held-out score and becomes the best only if it also beats the best. bestStep/globalStep are 0 for a single-shot consolidation.
func GraderSelfTest ¶
func GraderSelfTest() error
GraderSelfTest calibrates the grader (§18.2): a toothless gate is caught by SelfTest, but a *blind grader* — one that cannot tell a strong artifact from a weak one — makes the ratchet measure noise. It scores a known-strong artifact and a known-weak one through the rubric and returns EINTERNAL unless the strong scores strictly higher — proof the deterministic grader discriminates before the loop trusts it.
**Both fixtures run a command, and that is load-bearing.** The deterministic dimensions are failure-handling and boundary, and both are inapplicable to an artifact that executes nothing: a document with no runtime has no failure to encode and no rule-under-pressure to constrain. Scoring one is a category error the rubric now declines to make.
The earlier fixtures were plain prose, and they discriminated only because the boundary dimension docked the weak one for lacking a prohibition list — the exact deduction skilllens describes as harmful for artifacts of that shape. So the self-test passed for the wrong reason, calibrating the grader on inputs it is not valid for, and it failed the moment the rubric stopped making that mistake. That is the self-test doing its job in the direction that is easy to miss: it caught a correct change, and reading why is what showed the fixtures were wrong.
func SelfTest ¶
func SelfTest() error
SelfTest is the negative control for the self-optimization gate (SPEC-ADDITIONS §18.4), mirroring SkillOpt's planted-harmful-edit probe: a candidate that does not strictly beat the held-out baseline must be rejected. It feeds a regression and a tie through the ratchet and returns EINTERNAL if either is accepted — proof the gate has teeth before the loop is trusted.
Types ¶
type Calibration ¶
type Calibration struct {
Cases int `json:"cases"`
Agree int `json:"agree"`
Disagree []string `json:"disagree,omitempty"`
}
Calibration is the judge-calibration outcome: how many labeled fixtures the deterministic judge scored in agreement with their label, and the names of the ones it disagreed with.
func CalibrateJudge ¶
func CalibrateJudge(cases []JudgeCase) (Calibration, error)
CalibrateJudge runs the deterministic rule-judge over labeled fixtures and reports agreement (§18.2): a judge that scores a known-good fixture as failing, or a known-bad one as passing, is miscalibrated, so the ratchet cannot trust its verdicts. It extends the negative-control discipline from the gate/grader to the judge's actual verdicts on cases the operator labeled. It is pure; an empty check set on a case is a caller error surfaced as EINVALID.
type Disposition ¶
type Disposition string
Disposition is how the reflect step treats a miss.
const ( Defect Disposition = "defect" // the artifact is wrong/missing → edit it Lapse Disposition = "lapse" // a correct rule was not followed → do not churn it )
Disposition values classify a miss.
func Classify ¶
func Classify(ruleExists bool) Disposition
Classify decides whether a miss is a harness defect or an execution lapse (§18.3). When a correct rule already exists but was not followed, it is a lapse; the artifact is protected. When uncertain, callers pass ruleExists as false only if the rule is genuinely absent — otherwise treat it as a lapse.
type EvalReport ¶
type EvalReport struct {
Rubric rubric.Report `json:"rubric"`
Diagnosis string `json:"diagnosis"`
Behavioral *judge.Result `json:"behavioral,omitempty"`
}
EvalReport is the outcome of scoring a harness guiding artifact (§18.2): the rubric's deterministic floor and judge-only dimensions, the recommendation of what to fix first, and an optional behavioral rule-judge result. Behavioral is nil when no checks were supplied.
func Eval ¶
func Eval(doc, output string, checks []judge.Check) (EvalReport, error)
Eval scores a harness guiding artifact: the rubric's deterministic floor and judge-only dimensions (§18.2), the fix-this-first diagnosis, and — when checks are supplied — a behavioral rule-judge pass over output (§11). It is pure; the command shell reads the artifact and checks and passes them in.
func (*EvalReport) MeetsFloor ¶
func (r *EvalReport) MeetsFloor(floor float64) bool
MeetsFloor reports whether the report's deterministic score meets the minimum floor. A non-positive floor disables the gate; since DetScore is always >= 0, floor == 0 is equivalent to "no floor".