codegen: steer skill bodies to derive query arguments and return real output

CODEGEN.md was strong on real integrations and config plumbing but silent on
the two things that make a skill turn a query into an output: reading
request.text for per-request arguments and returning the real result. Bodies
(and the old query-agnostic health-check example) were free to ignore the
request and return a generic string.

- add "Turning the request into arguments": read request.text, keep
  per-request arguments out of CONTRACT, resolve targets with a SemIf
  sub-decision, needs_input only for genuine ambiguity
- add "Producing the result (output)": action_log/new_state must carry the
  fetched data or the service's real response, never a placeholder
- replace the worked example with a task-shaped body (extract tracking number
  from the query, real HTTP lookup, real result) that passes the parser
- add import-time-safety and single-phase-resume rules + acceptance criteria
- mirror the two requirements into BODY_DIRECTIVES so first/retry/regen
  prompts carry them, with tests asserting both
This commit is contained in:
gabby committed 2026-10-02 22:12:44 +00:00
1 parent 341eb9f8a0
commit 18f3d6fee5
3 files changed
+159 -31

No files matched your search

+21
View File
@@ -133,6 +133,27 @@ def test_contract_directs_runner_provided_data():
assert "internal/mock data model" not in text
def test_contract_directs_request_arguments_and_output():
"""CODEGEN.md must steer the body writer to derive per-request arguments
from the query and to return the real result — the difference between a
body that merely runs and one that turns a query into the desired output."""
text = read_skill_contract()
assert "Turning the request into arguments" in text
assert "Producing the result (output)" in text
assert "request.text" in text
assert "per-request" in text
assert "new_state" in text
assert "No work at import time" in text
def test_body_directives_require_query_arguments_and_output():
"""The prompt directives (used by the first, retry, and regen prompts) must
echo the query->arguments and real-output requirements, not just CODEGEN.md."""
assert "request.text" in BODY_DIRECTIVES
assert "per-request" in BODY_DIRECTIVES
assert "new_state" in BODY_DIRECTIVES
def test_testgen_contract_owns_mocking():
"""Mocking/testing has its own contract: TESTGEN.md. It must define the
flat semantic contract shape and forbid structure/type declarations."""