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

+5
View File
@@ -111,6 +111,11 @@ BODY_DIRECTIVES = (
"specifies: a flat map of variable name -> semantic description. Every key "
"in CONTRACT must be read from `ctx.config`; do not declare optional "
"values with safe defaults — read those with `ctx.config.get(...)` instead.\n"
"Read `request.text` and derive the action's per-request arguments from it "
"(recipient, subject/body, date, target, search terms); never declare a "
"query argument in CONTRACT and never ask the human for one. Return the real "
"result in `new_state` and a truthful `action_log` — the fetched data or the "
"service's real response, never an empty or placeholder output.\n"
"Perform the real action: if this skill interacts with an external system, "
"`act` must call the user's configured service with a stdlib transport "
"(urllib.request/http.client for HTTP, imaplib/smtplib/poplib for mail, "