feat(learn): the classifier program and its response cache (decision-engine 6.4)

learn/program.py: the declared signature (code, signals, roles, family in;
verdict, family, confidence, rationale with cited lines out), the
baseline instruction, rendering as [system: instruction + demonstrations]
-- byte-identical for every candidate, so the provider's prefix cache can
hit -- then [user: retrieved examples with their labels, the candidate
without one]. Signals pass validate_x first (no EXCLUDED_FIELDS, missing
instruments in words). Answers are one JSON object; one that does not
parse or cites no line inside the excerpt is asked once more at
temperature 0 and otherwise becomes unsure/parse_failed, never
not_vulnerable. Classify(k): sample 1 at 0.0, the rest at 0.7; score s =
mean p_j; majority verdict, ties unsure; a majority unsure cannot BLOCK.
Caller caches each response as responses/<sha>.json keyed by (model,
Model parameters digest, messages, temperature, sample, json_object) and
replays at $0; spend is priced from the recorded usage once per distinct
request, so a replay reports the same usd. Program.decide asserts the
evaluation boundary on the rendered ids before any call.

MeteredClient.complete passes temperature/logprobs through (only when
set); DeepSeekChatClient sends temperature beside thinking=disabled.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01EmM1j46qgKMh3zqD1QMwEo
This commit is contained in:
Marius Ciepluch
2026-10-01 10:13:31 +02:00
co-authored by Claude Opus 5.5
parent f5180a14ec
commit ea61dc1bb3
8 changed files with 764 additions and 13 deletions
@@ -1,7 +1,7 @@
{
"modules": 149,
"modules": 150,
"counts": {
"load_bearing": 142,
"load_bearing": 143,
"standalone_capability": 7
},
"orphaned": [],
@@ -358,6 +358,7 @@
"learn.excerpt",
"learn.features",
"learn.folds",
"learn.program",
"learn.retrieve",
"learn.roles",
"plane.tasks.features",
@@ -389,6 +390,7 @@
"importers": [
"learn.cli",
"learn.folds",
"learn.program",
"learn.retrieve"
]
},
@@ -413,8 +415,9 @@
{
"module": "learn.folds",
"classification": "load_bearing",
"reason": "imported by learn.retrieve",
"reason": "imported by learn.program, learn.retrieve",
"importers": [
"learn.program",
"learn.retrieve"
]
},
@@ -430,11 +433,19 @@
"learn.retrieve"
]
},
{
"module": "learn.program",
"classification": "load_bearing",
"reason": "learned-decision-engine Req 3.1/3.3: the AI classifier program (signature, Retrieve -> Classify(k), response cache); `ousast learn compile` (task 6.5) and the decide task (task 8) are its callers",
"importers": []
},
{
"module": "learn.retrieve",
"classification": "load_bearing",
"reason": "learned-decision-engine Req 3.2/3.4: retrieval from the local memory and the evaluation boundary; the program (task 6.4) and `ousast learn compile` (6.5) are its callers",
"importers": []
"reason": "imported by learn.program",
"importers": [
"learn.program"
]
},
{
"module": "learn.roles",
@@ -452,6 +463,7 @@
"reason": "reachable from gate, map_gate, pair_gate or the CLI",
"importers": [
"learn.features",
"learn.program",
"learn.retrieve",
"learn.roles",
"plane.tasks.remember",
@@ -785,6 +797,7 @@
"learn.cli",
"learn.embeddings",
"learn.examples",
"learn.program",
"plane.egress",
"plane.engine_alerts",
"plane.generate",
@@ -806,6 +819,7 @@
"importers": [
"learn.cli",
"learn.embeddings",
"learn.program",
"plane.generate",
"plane.tasks.roles",
"plane.tasks.verify"
@@ -864,6 +878,7 @@
"learn.cli",
"learn.embeddings",
"learn.examples",
"learn.program",
"plane.generate",
"plane.tasks.loop",
"plane.tasks.remember"
@@ -1073,6 +1088,7 @@
"reason": "reachable from gate, map_gate, pair_gate or the CLI",
"importers": [
"learn.cli",
"learn.program",
"model.endpoint",
"tool_hunter"
]
@@ -1083,6 +1099,7 @@
"reason": "reachable from gate, map_gate, pair_gate or the CLI",
"importers": [
"learn.cli",
"learn.program",
"model.endpoint",
"tool_hunter"
]