Remove the predict phase; contract-driven resolution

Skills now have a single `act(ctx, request)` body phase. The free-string
`Prediction.text` handoff, the `Prediction` type, and the predict phase are
gone.

- Resolution is pipeline-owned: the tiered config merge (global -> category ->
  skill) fills contract vars; the authoring-time SemIf search now searches the
  whole cascade; unresolved vars pause pre-act (`pre_act`, renamed from
  `pre_predict`) and are asked of the human one at a time.
- The data contract is a module-level `CONTRACT` constant in the body, parsed by
  `parse_contract`; `contract.json` is a derived mirror. The separate
  `generate_data_contract` codegen call is removed.
- Candidate selection stays in the body: a set of candidates (bridge endpoint,
  direct API, hard-coded list) gets a SemIf query, and the decisions ride back on
  `ActionResult.decisions` to be logged with the run outcome (phase `act`).
- `assess:outcome`/`assess:requeue` state carries the resolved inputs (secrets
  redacted by name) so the decision sees the full query -> resolution -> action
  path.
- Authoring validation enforces: compiles + `act`; `INTEGRATION` flat and valid;
  `CONTRACT` flat str->str; every CONTRACT key actually read from `ctx.config`.
- Test-regen ladder narrowed to code/test (the contract rides in the code).

SKILL.md/TESTGEN.md rewritten; seeds (calendar.next_event, simplex.next_message,
simplex.connect_link) rewritten to act-only + CONTRACT; docs updated.

BREAKING: persisted bodies in data/skills/ must be regenerated.
This commit is contained in:
gabby committed 2026-10-01 10:21:31 +00:00
1 parent 4a62e794a5
commit 567c280ee2
26 files changed
+679 -706

No files matched your search

+5 -12
View File
@@ -17,7 +17,7 @@ from semif_agent.engine import EngineConfig, SemIfEngine
from semif_agent.llm import LLMClient
from semif_agent.log import DecisionLog
from semif_agent.scheduler import PendingQuestion, RepairOffer, Scheduler
from semif_agent.skills import ActionResult, Prediction, Skill
from semif_agent.skills import ActionResult, Skill
from semif_agent.trace import TraceLog
from tests.conftest import ScriptedEngine
@@ -92,14 +92,11 @@ def test_tree_endpoint(tmp_path):
def test_tree_endpoint_carries_skill_status(tmp_path):
scheduler = build_scheduler(tmp_path)
def predict(ctx, request):
return Prediction(text="", decisions=[])
def act(ctx, request, prediction):
def act(ctx, request):
return ActionResult(action_log="ok", new_state=request.text)
scheduler.tree["tracking"] = [
Skill(name="ready", category="tracking", description="r", predict=predict, act=act),
Skill(name="ready", category="tracking", description="r", act=act),
Skill(name="stub", category="tracking", description="s"),
]
stub = next(s for s in scheduler.tree["tracking"] if s.name == "stub")
@@ -242,10 +239,7 @@ def test_skill_writing_and_created_events_in_payload(tmp_path):
def need_input_skill(seen):
def predict(ctx, request):
return Prediction(text="", decisions=[])
def act(ctx, request, prediction):
def act(ctx, request):
if request.user_input:
seen.append(request.user_input)
return ActionResult(action_log="ok", new_state=f"done {request.user_input}")
@@ -259,8 +253,7 @@ def need_input_skill(seen):
name="track.manual",
category="tracking",
description="Resolve a tracking number with the human.",
predict=predict,
act=act,
act=act,
)