codegen: never expose user data to the cloud codegen endpoint

Codegen is the primarily-cloud model, so it must receive only a de-identified,
reusable spec. The trusted local `llm` now authors a `goal` (plus a generic
service/transport) with every user-specific value stripped, and that is the only
task data any codegen prompt ever carries.

- skills: SkillDraft carries `goal` (not `requirements`); generate_skill ->
  generate_skill_spec; the spec prompt/parser ask for a de-identified goal +
  generic service/transport; registry persists `goal`, never request_text.
- codegen: every prompt builder (body, retry, regen, testgen) drops the
  Request/requirements parameters and builds from the spec alone; the whole
  elicitation surface is removed.
- scheduler: the codegen worker runs body -> fidelity -> contract -> test only;
  repair and fidelity evidence bundles are de-identified (failure_kind +
  integration + goal + previous body); approval gate moved to
  codegen.approval.wait_timeout; the question queue is now the repair ask_user
  path only.
- config: drop the codegen.elicitation block; add codegen.approval.
- docs/assets: update AGENTS.md, CODEGEN.md, README.md, docs/flow.md,
  bootstrap comment, static app.js; regenerate docs/flow-authoring.svg.
- tests: add tests/test_codegen_privacy.py (structural + behavioural sentinel
  checks, de-identified repair evidence, registry goal); update/remove the rest.

Purged (no migration): data/decisions.jsonl, data/runs.jsonl, data/categories.json.
This commit is contained in:
gabby committed 2026-10-11 00:52:30 +00:00
1 parent def51f81dc
commit 1833932f1c
19 files changed
+560 -906

No files matched your search

+53 -54
View File
@@ -79,14 +79,14 @@ scheduler.py no up-front gate: every input is dispatched
after the proposal is authored and before anything is
registered — one prompt per request, denial/timeout aborts
creation, surfaced via the approval queue; the body worker runs the full
pipeline: elicitation ->
codegen body (declares its own flat `CONTRACT`) -> fidelity
pipeline: codegen body from a **de-identified spec** (goal +
service/transport; codegen never sees the request, question
answers, or run output) that declares its own flat
`CONTRACT` -> fidelity
gate -> test -> auto-run test (SemIf regen ladder on failure,
code/test); config
search auto-populates the skill config from the full config
cascade; elicitation asks implementation questions one at a
time (all front ends defer via the question queue, `answer_timeout`
per question); a
cascade; a
`failed` step triggers a logged SemIf repair choice
(retry/repair_skill/ask_user/no_repair) surfaced to the user,
while a `continue` step is re-dispatched into next-step routing
@@ -199,13 +199,12 @@ codegen.py CodegenClient (OpenAI-compatible) writes real-integration skill
+ parse_contract / parse_integration /
infer_integration / integration_findings; the bridge catalog
(describe_bridges()) is injected into the body, retry, regen,
elicitation, and testgen prompts — it is the single source of
and testgen prompts — it is the single source of
bridge specifics (service, base-URL var, auth header/token var,
config-var docs, endpoints with error shapes), while CODEGEN.md/
TESTGEN.md carry only the generic pattern; the advisory
elicitation integration hint rides on every body/retry/regen
prompt; elicitation questions
+ integration hint; TESTGEN.md drives the shared-context test
service/transport integration hint rides on every body/retry/regen
prompt; TESTGEN.md drives the shared-context test
call producing skill.test.py (hermetic mechanics test: inline
fixtures, loopback http.server for HTTP bodies, no external
network, no mock_data.json); run_skill_test executes
@@ -488,7 +487,7 @@ CLI, unit tests (24) + integration tests (2).
per creation request — a new category's chained skill is covered by the
category approval (`DraftAuthor.approved`). Denial or timeout aborts creation:
nothing is registered, no body is written, and the request is not
re-dispatched; the wait reuses `codegen.elicitation.wait_timeout`. With no
re-dispatched; the wait reuses `codegen.approval.wait_timeout`. With no
deferring front end `ask` denies immediately rather than stalling the worker.
The mode is resolved by `Scheduler._category_mode` (deny for the hard-locked
`housekeeping`/`response` categories) and checked in `_dispatch`,
@@ -534,19 +533,21 @@ CLI, unit tests (24) + integration tests (2).
(`HARD_LOCKED_CATEGORIES`/`CANNED_CATEGORIES`) and can never be changed. The
mode is creation-only: existing skills still run and repair/regen of an
existing leaf is allowed.
- **Real integrations, implementation questions, fidelity + repair** (Sep 2026):
elicitation is on by default and asks implementation questions (which
service/account, how to connect, where the credential comes from, what success
looks like); every front end defers via the question queue
(`/api/questions`, worker waits `codegen.elicitation.answer_timeout` per
question, one at a time). Bodies
- **Real integrations, de-identified codegen, fidelity + repair** (Sep 2026;
codegen privacy Oct 2026): the codegen endpoint is the primarily-cloud model,
so it is shown **only a de-identified spec** — the trusted local `llm` authors a
reusable `goal` (plus a generic service/transport) with every user-specific
value stripped; the user's request, question answers, and run output never reach
codegen. Bodies
must perform the real action via stdlib transports with values from
`ctx.config` and declare `INTEGRATION` (service/transport/config_vars); a
fidelity gate (`authoring:fidelity`, a SemIf accept/reconsider decision) plus
static declaration checks regenerates a simulated body once with the raw
evidence bundle, then accepts it badged `unverified`. A failed real run logs a
static declaration checks regenerates a simulated body once with the
de-identified evidence bundle, then accepts it badged `unverified`. A failed real run logs a
SemIf repair choice (retry / repair_skill / ask_user / no_repair) surfaced in
REPL/dashboard; repair writes carry the raw observed-failure bundle and are
REPL/dashboard; repair writes carry a de-identified evidence bundle (a generic
failure kind, the integration, the goal, and the previous body — never the run's
action log/new state or the request) and are
bounded by `codegen.repair.max_attempts`. Tests are hermetic mechanics checks
(loopback `http.server` for HTTP bodies) and never certify the live
integration — only a real run does.
@@ -757,7 +758,7 @@ CLI, unit tests (24) + integration tests (2).
- **A local reasoning model needs thinking off for `llm`.** A reasoning model
emits hidden chain-of-thought and puts the answer in `content`. Through the
`/v1` compat endpoint the CoT consumes the entire reply budget, so
`generate_category`/`generate_skill`'s `max_tokens=128` returns
`generate_category`/`generate_skill_spec`'s small `max_tokens` returns
`finish_reason: length` with `content: ""` → `JSONDecodeError` and a traced
`draft_failed` (no category/skill is ever authored — the whole create branch
is silently dead). `LLMClient` sends `reasoning_effort: "none"`
@@ -956,39 +957,36 @@ CLI, unit tests (24) + integration tests (2).
subprocess in the skill folder). The provisioned host is the intended target;
treat the endpoint as trusted.
- Flow in `scheduler._dispatch_skill`: the request is queued to the **single-slot
`llm` draft worker** (small model authors title+description) → stub registered
+ hot-merged into the tree → the body write is queued to a **separate
single-slot codegen worker** (the 12G codegen model can't run twice), the gate
stays free for new input. A category request chains the same way in one worker.
The codegen worker runs the full authoring pipeline:
1. **elicitation** (`generate_elicitation`): implementation questions +
integration hint. Every front end (REPL, dashboard, gateway) sets
`defer_questions` and the worker posts them to the question queue one at a
time, waiting `codegen.elicitation.answer_timeout` seconds for each (the
clock resets on every answer submit; a timeout stops the sequence).
2. **codegen body** (`generate_skill_body` / `regenerate_skill_body` on
repair): CODEGEN.md + request + tree + requirements answers; the body is a
`llm` draft worker** (small model authors title+description+a **de-identified
goal**) → stub registered + hot-merged into the tree → the body write is queued
to a **separate single-slot codegen worker** (the 12G codegen model can't run
twice), the gate stays free for new input. A category request chains the same
way in one worker. The codegen worker runs the full authoring pipeline:
1. **codegen body** (`generate_skill_body` / `regenerate_skill_body` on
repair): CODEGEN.md + the **de-identified spec** (goal + generic
service/transport) + tree + bridge catalog — never the request, question
answers, or run output; the body is a
single `act(ctx, request)`, reads every operational value from `ctx.config`,
performs the real action, and declares `INTEGRATION` and its own flat
`CONTRACT` (every contract key must be read from `ctx.config`, and every
name the body references must be imported/bound — both enforced by
`parse_skill_body`).
3. **fidelity gate** (`authoring:fidelity` SemIf decision +
2. **fidelity gate** (`authoring:fidelity` SemIf decision +
`integration_findings`): a rapid sanity check (accept/reconsider) — is the
action real or simulated/declared-but-unused? It only triggers a rewrite,
never a diagnosis. One corrective regen with the raw evidence bundle
never a diagnosis. One corrective regen with the de-identified evidence bundle
(`codegen.fidelity.max_attempts`), then accept with a trace rather than
hard-failing authoring.
4. **contract** (`parse_contract`): read from the body's own flat `CONTRACT`
3. **contract** (`parse_contract`): read from the body's own flat `CONTRACT`
constant — a single flat object of snake_case variable name -> semantic
description, for user input and SemIf only (no types/validation; that lives
in the code + test). No separate generation call; `materialize_skill`
rewrites `contract.json` as a mirror.
5. **test** (`generate_skill_tests`): a shared-context call (seeded with
4. **test** (`generate_skill_tests`): a shared-context call (seeded with
TESTGEN.md + `skill.py` + the body's `CONTRACT`) produces `skill.test.py` —
hermetic mechanics, loopback fixture injects the endpoint through config,
fixtures inline.
6. **auto-run test** (`run_skill_test`): subprocess in the skill folder,
5. **auto-run test** (`run_skill_test`): subprocess in the skill folder,
`codegen.test_timeout`; on failure a **2-option SemIf decision**
(`codegen_regen`, trace-only) picks code/test to regenerate (the contract
rides in the code), the error + existing files are fed back, bounded by
@@ -1030,27 +1028,28 @@ CLI, unit tests (24) + integration tests (2).
resolution → action → chain path; secret-named
variables (pass/token/secret/key/credential/auth) are redacted to `***` so
credentials never reach the decision log.
- **Requirements elicitation (implementation questions, default on).**
`codegen.elicitation.enabled` asks the product owner how the new skill should
connect (which service/account, how to connect, where the credential comes
from, what success looks like, how failure should behave). Every front end
defers — the single-slot worker posts
questions to `scheduler.questions` (`GET/POST /api/questions`) one at a time
and waits up to `codegen.elicitation.answer_timeout` seconds for each (the
clock resets on every answer submit, so the next question is only shown after
the current is answered; a timeout stops the sequence), then proceeds with
whatever answers arrived (`questions_timeout` trace). Answers ride on the draft into
every body attempt (including retries and regens) and are persisted in the
registry so a `restart` does not ask again. The prompt keeps an explicit
anti-pattern block: never config-vs-input cadence questions ("should the
sender address change?"), never operational data values, never trivia.
- **Codegen privacy (de-identified spec, no elicitation).** The codegen endpoint
is the primarily-cloud model, so it is shown **only a de-identified spec**. The
trusted local `llm` authors a reusable `goal` (plus a generic
service/transport) from the request, with every user-specific value stripped:
names, addresses, emails, phone numbers, dates, times, numbers, account names,
hostnames, credentials, and quoted content are removed, and the body derives
those from `request.text` at runtime. The user's request, question answers, and
run output are **never** placed in a codegen prompt (body, retry, regen, or
testgen); the repair/fidelity evidence bundles are reduced to a generic failure
kind + integration + goal + previous body. The stub's `goal` is persisted in
the registry so a restart/regen re-drives codegen without the request.
Implementation questions were removed with this change: the spec's
service/transport carries what the questions used to; the only remaining
question queue is the repair `ask_user` path (local).
- **Fidelity gate.** After the body lands, `authoring:fidelity` — a real SemIf
accept/reconsider decision (`P(reconsider) >= tau` or any static
`integration_findings` from the declared transport vs. real calls and declared
config_vars actually read) decides whether the body really performs the
action. The gate never diagnoses: it only triggers a rewrite, which is handed
the raw evidence bundle as-is (request, description, requirements, raw
INTEGRATION, findings, SemIf verdict+probs, previous body). A rejected body is
the de-identified evidence bundle as-is (goal, description, raw
INTEGRATION, findings, SemIf verdict+probs, previous body — no request). A
rejected body is
rewritten once (`codegen.fidelity.max_attempts`, reason_kind `fidelity`); a
body that still fails is accepted (never hard-fail authoring) but traced
(`fidelity_review`, `performs_real_action=false`) and badged `unverified` in
@@ -1361,7 +1360,7 @@ CLI, unit tests (24) + integration tests (2).
(`BridgeInfo`: name, service, description, URL config var, other config vars
with one-line docs, auth header + token config var, and endpoints with
request/response/error shapes) is injected into every codegen prompt
(body/retry/regen/elicitation/testgen) via `describe_bridges()` and is the
(body/retry/regen/testgen) via `describe_bridges()` and is the
single source of bridge specifics — CODEGEN.md/TESTGEN.md carry only the generic
pattern. The bridge's optional shared secret is mirrored to the top-level
`simplex_bridge_token` config var (bootstrap syncs it) so bodies can send the
+5 -4
View File
@@ -194,8 +194,7 @@ The registry is a map of category -> bucket:
{
"name": "<leaf_name>",
"description": "<what this leaf does, for navigation>",
"request_text": "<the originating request, optional>",
"requirements": {"<question>": "<answer>"}
"goal": "<the de-identified, reusable action statement>"
}
]
}
@@ -205,8 +204,10 @@ The registry is a map of category -> bucket:
- A leaf `name` is a single snake_case token (`[a-z0-9_]+(?:\.[a-z0-9_]+)*`),
not dotted with the category; the category is the key it lives under, and the
runner joins them as `category.name` only when it builds the run summary.
- `request_text` and `requirements` are recorded by the scheduler so a stub can
be re-driven later; the body never sets them.
- `goal` is the de-identified, reusable action statement authored by the local
`llm`; the scheduler records it so a stub can be re-driven later. The
originating request and any user detail are never persisted here, and never
reach the codegen endpoint.
## Code body contract
+29 -31
View File
@@ -178,23 +178,21 @@ When navigation chooses a create branch, the scheduler queues the draft to a
single-slot `llm` worker and the body write to a separate single-slot codegen
worker. It is **asynchronous**, so the gate stays free while either model thinks:
1. **Stub.** The small `llm` provider (`generate_skill`) authors a title +
description on its own worker. The stub is registered and hot-merged into the
running tree as
soon as it lands; a `skill_writing` trace event is emitted.
2. **Elicitation** (`generate_elicitation`, default on): implementation
questions — which service/account, how to connect, where the credential
comes from, what success looks like. Every front end (REPL, dashboard,
gateway) defers to a question queue and the worker waits
(`codegen.elicitation.wait_timeout`).
3. **Codegen body** (`generate_skill_body`): a larger OpenAI-compatible model
1. **Spec.** The small `llm` provider (`generate_skill_spec`) authors a title +
description **and a de-identified, reusable goal** (plus the generic
service/transport) on its own worker. The stub is registered and hot-merged
into the running tree as soon as it lands; a `skill_writing` trace event is
emitted. The goal is the *only* task data codegen is ever shown.
2. **Codegen body** (`generate_skill_body`): a larger OpenAI-compatible model
(`codegen`, your configured code-capable model) writes a single `act` against `CODEGEN.md`,
reading every operational value from `ctx.config` and declaring `INTEGRATION`
(service / transport / config_vars) plus its own flat `CONTRACT`
(variable → description; every key must be read from `ctx.config`).
(variable → description; every key must be read from `ctx.config`). **Privacy:**
codegen is the primarily-cloud model, so it receives only the de-identified
spec — never the user's request, question answers, or run output.
4. **Fidelity gate** (`authoring:fidelity` SemIf accept/reconsider decision +
static `integration_findings`): is the action real, or simulated? One
corrective regen with the raw evidence bundle, then accept-with-badge
corrective regen with the de-identified evidence bundle, then accept-with-badge
(`unverified`) rather than hard-fail.
5. **Contract** (`parse_contract`): read from the body's own `CONTRACT`
constant — a flat map of snake_case variable name → semantic description, for
@@ -228,11 +226,13 @@ forward pass. There is no hidden system prompt and no growing conversation:
what you see in the table below is the entire input. Probabilities are
conditional on exactly the supplied options.
A **generative call** (`llm` for titles/descriptions, `codegen` for bodies and
tests) is a built OpenAI-style `messages` list. Its context is assembled from
the request, the tree, the elicitation answers, the runtime **bridge catalog**
(`describe_bridges()`), and — for bodies and tests — the contract files
(`CODEGEN.md`, `TESTGEN.md`).
A **generative call** (`llm` for titles/descriptions/goals, `codegen` for bodies
and tests) is a built OpenAI-style `messages` list. The trusted local `llm`
context is assembled from the request and the tree; the **codegen** context is
assembled only from the de-identified spec (goal + generic service/transport),
the tree, the runtime **bridge catalog** (`describe_bridges()`), and — for bodies
and tests — the contract files (`CODEGEN.md`, `TESTGEN.md`). Codegen never
receives the user's request, question answers, or run output.
#### SemIf decisions
@@ -257,13 +257,11 @@ the request, the tree, the elicitation answers, the runtime **bridge catalog**
| Call | Client | System context | User context | File |
| --- | --- | --- | --- | --- |
| `generate_category` | `llm` | authoring instruction: propose one broad category, JSON-only | request text + full tree summary | `skills.py:896` |
| `generate_skill` | `llm` | authoring instruction: propose one specific skill, JSON-only | request + category + existing skill names | `skills.py:947` |
| `generate_skill_body` | `codegen` | full **CODEGEN.md** | request, category, name, description, existing skills + tree summary, elicitation answers, integration hint, **bridge catalog**, `BODY_DIRECTIVES` | `codegen.py:156` |
| body retry | `codegen` | full **CODEGEN.md** | rejection reason, request, category, name, description, elicitation answers, integration hint, **bridge catalog**, `BODY_DIRECTIVES` | `codegen.py:474` |
| `generate_elicitation` | `codegen` | elicitation instructions + example questions + anti-patterns + `max_questions` | request, category, name, description, existing skills + tree summary, **bridge catalog** | `codegen.py:580` |
| `generate_data_contract` | `codegen` | full **TESTGEN.md** | skill, request, full body code, **bridge catalog** + the contract ask | `codegen.py:833` |
| `generate_skill_tests` | `codegen` | full **TESTGEN.md** | skill, request, full body code, **bridge catalog**; continued with the accepted **contract JSON** as an assistant turn + the test-gen ask | `codegen.py:942` |
| `regenerate_skill_body` | `codegen` | full **CODEGEN.md** | correction header, request, description, **raw evidence bundle** (rendered verbatim), previous body, integration hint, **bridge catalog**, `BODY_DIRECTIVES` | `codegen.py:1046` |
| `generate_skill_spec` | `llm` | authoring instruction: propose one specific skill + a **de-identified goal** and generic service/transport, JSON-only | request + category + existing skill names | `skills.py:947` |
| `generate_skill_body` | `codegen` | full **CODEGEN.md** | **de-identified spec** (goal + description), category, name, existing skills + tree summary, integration hint, **bridge catalog**, `BODY_DIRECTIVES` | `codegen.py:156` |
| body retry | `codegen` | full **CODEGEN.md** | rejection reason, de-identified spec (goal + description), integration hint, **bridge catalog**, `BODY_DIRECTIVES` | `codegen.py:474` |
| `generate_skill_tests` | `codegen` | full **TESTGEN.md** | skill, de-identified goal, full body code, **bridge catalog**; continued with the accepted **contract JSON** as an assistant turn + the test-gen ask | `codegen.py:942` |
| `regenerate_skill_body` | `codegen` | full **CODEGEN.md** | correction header, de-identified goal + description, **de-identified evidence bundle** (rendered verbatim), previous body, integration hint, **bridge catalog**, `BODY_DIRECTIVES` | `codegen.py:1046` |
The **bridge catalog** is `describe_bridges()` (`bridges/registry.py:33`): each
known bridge's name, service, description, base-URL config var, auth header +
@@ -271,9 +269,9 @@ token var, documented config vars, and endpoints. It is the single runtime
source of bridge specifics — `CODEGEN.md` and `TESTGEN.md` carry only the generic
pattern — so a bridge can be added without touching either contract file.
The **raw evidence bundle** handed to a corrective regen carries the request,
description, requirements, the observed failure fields (error, action log, new
state, summary) and the previous body, rendered as-is with no prose diagnosis.
The **evidence bundle** handed to a corrective regen is de-identified: a generic
failure kind, the integration, the goal, and the previous body, rendered as-is
with no prose diagnosis. It carries no request text and no run output.
### Data contracts and tiered config
@@ -338,7 +336,7 @@ fine-tuning loop — it is not yet the fine-tune itself.
to the closed `response` canned tree.
- **Real integrations by construction** — bodies must perform the real action,
read data from `ctx.config`, declare `INTEGRATION`, and report real failures.
- **Async skill authoring** — elicitation → body → fidelity → contract → test →
- **Async skill authoring** — spec → body → fidelity → contract → test →
auto-run, with a SemIf regeneration ladder on test failure. Gate stays free.
- **Tiered config + first-fire collection** — global/category/skill config with
a `record-vs-ask` decision per answer.
@@ -376,7 +374,7 @@ semif_agent/
summary; pre-act contract collection; resolved-input state
skills.py tree + registry, canned `response` tree, navigation,
create gates, intent guard, tiered config resolution
codegen.py OpenAI-compatible client; body/elicitation/test generation;
codegen.py OpenAI-compatible client; body/test generation;
parse/validate; CONTRACT + INTEGRATION extraction; test runner
provider.py shared OpenAI-compatible transport (SSE/budget/idle/watchdog);
SemIfEngineClient generates text from the in-process engine
@@ -516,7 +514,7 @@ Key blocks:
| --- | --- |
| `engine` | per-machine engine settings: backend, context, threads, optional GGUF path override (refs come from `pins.json`) |
| `llm` | small model endpoint that authors new category/skill title + description |
| `codegen` | skill-body model endpoint, timeouts, sampler, elicitation, fidelity, repair, test, degeneration watchdog, token budget |
| `codegen` | skill-body model endpoint, timeouts, sampler, approval gate, fidelity, repair, test, degeneration watchdog, token budget |
| `navigation` | two-stage guards: leaf `intent_tau`, category `category_tau` |
| `tau` | decision threshold; `max_reentries` requeue bound |
| `queue` | `max_size` |
@@ -938,7 +936,7 @@ works.
**Done.** Core loop, FIFO queue, skill tree, real SemIf assessment, decision
logging, `dream` cost pass, REPL + JSONL CLI; live `create_category` /
`create_skill` with the async authoring pipeline (elicitation → body → fidelity →
`create_skill` with the async authoring pipeline (spec → body → fidelity →
contract → test → auto-run → re-dispatch); tiered config + first-fire
collection; runtime repair loop; the closed `response` canned tree; real
integrations with `INTEGRATION` declarations; the SimpleX command gateway and the
+3 -6
View File
@@ -74,7 +74,7 @@
}
},
"codegen": {
"_comment": "OpenAI-compatible model that writes runnable skill bodies. Runs on a REMOTE ollama host (bootstrap reads base_url/model from here; a --codegen-url/--codegen-model flag overrides for that run only); the local small model is `llm` above. `model` is required (no default): set it to a code-capable model the endpoint serves. Bodies perform real actions against the user's configured services via stdlib transports, read every operational value from ctx.config, and declare their integration (INTEGRATION: service/transport/config_vars). Larger/slower than the decision or title/description model. The transport always streams so the client-side token budget (output cap / peak total fill) can abort a runaway in real time; stream only toggles console echo of tokens. timeout is total seconds; idle_warn/idle_timeout surface a silent (wedged) stream. The context window is auto-detected via ollama /api/show; context_window is the manual fallback (0 = auto/default 100000). smart_limit/warn_limit and max_fill_ratio/warn_fill_ratio bound total fill; max_output caps streamed output (>=1 absolute tokens, 0<x<1 fraction of window); chars_per_token converts chars to the token estimate. temperature/top_p/presence_penalty/frequency_penalty are opt-in: an unset value is omitted from the request so the server's model/Modelfile default applies; set them here only when you know the right values for the model. A rejected body retries with a fresh short prompt (max_attempts attempts), reusing the same sampler params. elicitation asks the product owner implementation questions before the body is written (posted to the question queue; every front end defers). After the body lands it is reviewed for real-action fidelity, then the data contract (contract.json) is derived in a separate call, then skill.test.py (hermetic mechanics test: loopback http.server for HTTP bodies, fixtures inline, no external network) in a shared-context call, and the test is auto-run as a subprocess (test_timeout seconds); on failure a 3-option SemIf decision (code/contract/test) regenerates the failing piece, bounded by test_max_attempts. contract_search.enabled auto-populates the skill config.json via SemIf against the global + category config. provider selects the transport: \"ollama\" (default; local OpenAI-compatible server, context auto-detected via /api/show) or \"opencode\" (the hosted OpenCode Console inference API at https://opencode.ai/inference/openai/v1 — set model to a Chat Completions family id such as kimi-k2.7-code, glm-5.3, or deepseek-v4.1-flash, and provide api_key or api_key_env; the ollama probe is skipped).",
"_comment": "OpenAI-compatible model that writes runnable skill bodies. Runs on a REMOTE ollama host (bootstrap reads base_url/model from here; a --codegen-url/--codegen-model flag overrides for that run only); the local small model is `llm` above. `model` is required (no default): set it to a code-capable model the endpoint serves. Bodies perform real actions against the user's configured services via stdlib transports, read every operational value from ctx.config, and declare their integration (INTEGRATION: service/transport/config_vars). Larger/slower than the decision or title/description model. The transport always streams so the client-side token budget (output cap / peak total fill) can abort a runaway in real time; stream only toggles console echo of tokens. timeout is total seconds; idle_warn/idle_timeout surface a silent (wedged) stream. The context window is auto-detected via ollama /api/show; context_window is the manual fallback (0 = auto/default 100000). smart_limit/warn_limit and max_fill_ratio/warn_fill_ratio bound total fill; max_output caps streamed output (>=1 absolute tokens, 0<x<1 fraction of window); chars_per_token converts chars to the token estimate. temperature/top_p/presence_penalty/frequency_penalty are opt-in: an unset value is omitted from the request so the server's model/Modelfile default applies; set them here only when you know the right values for the model. A rejected body retries with a fresh short prompt (max_attempts attempts), reusing the same sampler params. PRIVACY: codegen is the primarily-cloud model, so it is shown ONLY a de-identified, reusable spec authored by the local `llm` (goal + generic service/transport) — never the user's request text, question answers, or any run output. After the body lands it is reviewed for real-action fidelity, then the data contract (contract.json) is derived in a separate call, then skill.test.py (hermetic mechanics test: loopback http.server for HTTP bodies, fixtures inline, no external network) in a shared-context call, and the test is auto-run as a subprocess (test_timeout seconds); on failure a 3-option SemIf decision (code/contract/test) regenerates the failing piece, bounded by test_max_attempts. contract_search.enabled auto-populates the skill config.json via SemIf against the global + category config. provider selects the transport: \"ollama\" (default; local OpenAI-compatible server, context auto-detected via /api/show) or \"opencode\" (the hosted OpenCode Console inference API at https://opencode.ai/inference/openai/v1 — set model to a Chat Completions family id such as kimi-k2.7-code, glm-5.3, or deepseek-v4.1-flash, and provide api_key or api_key_env; the ollama probe is skipped).",
"provider": "ollama",
"base_url": "http://localhost:11434/v1",
"model": "",
@@ -97,11 +97,8 @@
"presence_penalty": 0,
"frequency_penalty": 1,
"max_attempts": 3,
"elicitation": {
"_comment": "Ask the product owner implementation questions before the body is written: which service/account, how to connect, where the credential comes from, what success looks like. Every front end defers questions to the questions panel; the single-slot writer asks them one at a time and waits answer_timeout seconds for each (the clock resets on every answer submit, so the user only ever sees the next question after answering the current one; a timeout stops the sequence). wait_timeout is the separate, longer wait for the optional creation-approval gate. Questions never ask for operational data values (collected at first fire) or config-vs-input cadence (the config step owns that).",
"enabled": true,
"max_questions": 4,
"answer_timeout": 30,
"approval": {
"_comment": "The optional creation-approval gate (new_skill_creation == \"ask\"): the single-slot draft worker blocks after it authors a proposal and before anything is registered, waiting up to wait_timeout seconds for a human approve/deny. Denial or timeout aborts creation. Set 0 to wait forever.",
"wait_timeout": 900
},
"fidelity": {
+2 -2
View File
@@ -1,4 +1,4 @@
<svg id="my-svg" width="100%" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" class="flowchart" style="max-width: 746.35px; background-color: white;" viewBox="4 4 746.3495483398438 4081.421875" role="graphics-document document" aria-roledescription="flowchart-v2"><style>#my-svg{font-family:"Recursive Variable",arial,sans-serif;font-size:14px;fill:#28253D;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#my-svg .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#my-svg .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#my-svg .error-icon{fill:#ffffff;}#my-svg .error-text{fill:#000000;stroke:#000000;}#my-svg .edge-thickness-normal{stroke-width:2px;}#my-svg .edge-thickness-thick{stroke-width:3.5px;}#my-svg .edge-pattern-solid{stroke-dasharray:0;}#my-svg .edge-thickness-invisible{stroke-width:0;fill:none;}#my-svg .edge-pattern-dashed{stroke-dasharray:3;}#my-svg .edge-pattern-dotted{stroke-dasharray:2;}#my-svg .marker{fill:#000000;stroke:#000000;}#my-svg .marker.cross{stroke:#000000;}#my-svg svg{font-family:"Recursive Variable",arial,sans-serif;font-size:14px;}#my-svg p{margin:0;}#my-svg [data-look="neo"][data-color-id="color-0"].cluster:not(.swimlane) rect{stroke:#E879F9;fill:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].cluster:not(.swimlane) path{stroke:#E879F9;fill:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster rect.swimlane-title,#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster rect.swimlane-body{stroke:#E879F9;fill:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster .swimlane-title path:nth-of-type(2),#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster .swimlane-body path:nth-of-type(2){stroke:#E879F9;}#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster .swimlane-title path:first-of-type,#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster .swimlane-body path:first-of-type{stroke:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].node .collapsed-group,#my-svg [data-look="neo"][data-color-id="color-0"].rough-node .collapsed-group,#my-svg [data-look="neo"][data-color-id="color-0"].node .collapsed-group path,#my-svg [data-look="neo"][data-color-id="color-0"].rough-node .collapsed-group path{stroke:#E879F9;fill:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].node .collapsed-indicator,#my-svg [data-look="neo"][data-color-id="color-0"].rough-node .collapsed-indicator{fill:#E879F9;}#my-svg [data-look="neo"][data-color-id="color-0"].node .collapsed-separator,#my-svg [data-look="neo"][data-color-id="color-0"].rough-node .collapsed-separator{stroke:#E879F9;}#my-svg [data-look="neo"][data-color-id="color-1"].cluster:not(.swimlane) rect{stroke:#2DD4BF;fill:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].cluster:not(.swimlane) path{stroke:#2DD4BF;fill:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster rect.swimlane-title,#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster rect.swimlane-body{stroke:#2DD4BF;fill:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster .swimlane-title path:nth-of-type(2),#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster .swimlane-body path:nth-of-type(2){stroke:#2DD4BF;}#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster .swimlane-title path:first-of-type,#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster .swimlane-body path:first-of-type{stroke:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].node .collapsed-group,#my-svg [data-look="neo"][data-color-id="color-1"].rough-node .collapsed-group,#my-svg [data-look="neo"][data-color-id="color-1"].node .collapsed-group path,#my-svg [data-look="neo"][data-color-id="color-1"].rough-node .collapsed-group path{stroke:#2DD4BF;fill:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].node .collapsed-indicator,#my-svg [data-look="neo"][data-color-id="color-1"].rough-node .collapsed-indicator{fill:#2DD4BF;}#my-svg [data-look="neo"][data-color-id="color-1"].node .collapsed-separator,#my-svg [data-look="neo"][data-color-id="color-1"].rough-node .collapsed-separator{stroke:#2DD4BF;}#my-svg [data-look="neo"][data-color-id="color-2"].cluster:not(.swimlane) rect{stroke:#FB923C;fill:#FFF7ED;}#my-svg [data-look="neo"][data-color-id="color-2"].cluster:not(.swimlane) path{stroke:#FB923C;fill:#FFF7ED;}#my-svg [data-look="neo"][data-color-id="color-2"].swimlane.cluster rect.swimlane-title,#my-svg [data-look="neo"][data-color-id="color-2"].swimlane.cluster rect.swimlane-body{stroke:#FB923C;fill:#FFF7ED;}#my-svg [data-look="neo"][data-color-id="color-2"].swimlane.cluster .swimlane-title path:nth-of-type(2),#my-svg [data-look="neo"][Line truncated
<svg id="my-svg" width="100%" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" class="flowchart" style="max-width: 763.308px; background-color: white;" viewBox="4 4 763.308349609375 3864" role="graphics-document document" aria-roledescription="flowchart-v2"><style>#my-svg{font-family:"Recursive Variable",arial,sans-serif;font-size:14px;fill:#28253D;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#my-svg .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#my-svg .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#my-svg .error-icon{fill:#ffffff;}#my-svg .error-text{fill:#000000;stroke:#000000;}#my-svg .edge-thickness-normal{stroke-width:2px;}#my-svg .edge-thickness-thick{stroke-width:3.5px;}#my-svg .edge-pattern-solid{stroke-dasharray:0;}#my-svg .edge-thickness-invisible{stroke-width:0;fill:none;}#my-svg .edge-pattern-dashed{stroke-dasharray:3;}#my-svg .edge-pattern-dotted{stroke-dasharray:2;}#my-svg .marker{fill:#000000;stroke:#000000;}#my-svg .marker.cross{stroke:#000000;}#my-svg svg{font-family:"Recursive Variable",arial,sans-serif;font-size:14px;}#my-svg p{margin:0;}#my-svg [data-look="neo"][data-color-id="color-0"].cluster:not(.swimlane) rect{stroke:#E879F9;fill:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].cluster:not(.swimlane) path{stroke:#E879F9;fill:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster rect.swimlane-title,#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster rect.swimlane-body{stroke:#E879F9;fill:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster .swimlane-title path:nth-of-type(2),#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster .swimlane-body path:nth-of-type(2){stroke:#E879F9;}#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster .swimlane-title path:first-of-type,#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster .swimlane-body path:first-of-type{stroke:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].node .collapsed-group,#my-svg [data-look="neo"][data-color-id="color-0"].rough-node .collapsed-group,#my-svg [data-look="neo"][data-color-id="color-0"].node .collapsed-group path,#my-svg [data-look="neo"][data-color-id="color-0"].rough-node .collapsed-group path{stroke:#E879F9;fill:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].node .collapsed-indicator,#my-svg [data-look="neo"][data-color-id="color-0"].rough-node .collapsed-indicator{fill:#E879F9;}#my-svg [data-look="neo"][data-color-id="color-0"].node .collapsed-separator,#my-svg [data-look="neo"][data-color-id="color-0"].rough-node .collapsed-separator{stroke:#E879F9;}#my-svg [data-look="neo"][data-color-id="color-1"].cluster:not(.swimlane) rect{stroke:#2DD4BF;fill:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].cluster:not(.swimlane) path{stroke:#2DD4BF;fill:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster rect.swimlane-title,#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster rect.swimlane-body{stroke:#2DD4BF;fill:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster .swimlane-title path:nth-of-type(2),#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster .swimlane-body path:nth-of-type(2){stroke:#2DD4BF;}#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster .swimlane-title path:first-of-type,#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster .swimlane-body path:first-of-type{stroke:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].node .collapsed-group,#my-svg [data-look="neo"][data-color-id="color-1"].rough-node .collapsed-group,#my-svg [data-look="neo"][data-color-id="color-1"].node .collapsed-group path,#my-svg [data-look="neo"][data-color-id="color-1"].rough-node .collapsed-group path{stroke:#2DD4BF;fill:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].node .collapsed-indicator,#my-svg [data-look="neo"][data-color-id="color-1"].rough-node .collapsed-indicator{fill:#2DD4BF;}#my-svg [data-look="neo"][data-color-id="color-1"].node .collapsed-separator,#my-svg [data-look="neo"][data-color-id="color-1"].rough-node .collapsed-separator{stroke:#2DD4BF;}#my-svg [data-look="neo"][data-color-id="color-2"].cluster:not(.swimlane) rect{stroke:#FB923C;fill:#FFF7ED;}#my-svg [data-look="neo"][data-color-id="color-2"].cluster:not(.swimlane) path{stroke:#FB923C;fill:#FFF7ED;}#my-svg [data-look="neo"][data-color-id="color-2"].swimlane.cluster rect.swimlane-title,#my-svg [data-look="neo"][data-color-id="color-2"].swimlane.cluster rect.swimlane-body{stroke:#FB923C;fill:#FFF7ED;}#my-svg [data-look="neo"][data-color-id="color-2"].swimlane.cluster .swimlane-title path:nth-of-type(2),#my-svg [data-look="neo"][data-coLine truncated
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
@@ -96,4 +96,4 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
@font-face { font-family: "Recursive Variable"; font-style: normal; font-display: swap; font-weight: 300 1000; src: url("data:font/woff2;base64,d09GMgABAAAAAAfcABMAAAAAENQAAAdzAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGx4cKD9NVkFSgQQGYD9TVEFUgWInLgBUL3QRCAqDIIMLCw4AMIV2ATYCJAMUBCAFjXYHTgwHG2MPSI7UVnlAcpP/PG76574XKIQgNQ9aMWYOzJzOnNE6+ESr23eT2sQ1RNFtdi+PQgg0oMcgECuU/O/3a6IXUT+YhE5qlMRjzRMmUcT/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h9PkTSJXTwmOOKaKUC1vAGyM5QoST71NBbZatdtImLzhfDZmNr/uaktFxS3VYLKggKCo0DRpuF9c7arT+g3tnMXvz+AfJeulnNNA/eigcqN2katYjfxJh3Dz8pptSODrWvQf7MUjBYWsFgmfrzenXgaRzbCSf0P8xGkiguqczHOhW1xMjaByoqxQtVqrhbhlyvkENaoQBPN+/5ViVgvxqxCpor8IgzSq9EGZy6kBcGLESSBVQjxQ63S6nWn2E8on0tNX4uR5oz4hpf0d4U4AAAA=") format("woff2-variations"); unicode-range: U+460-52F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "Recursive Variable"; font-style: normal; font-display: swap; font-weight: 300 1000; src: url("data:font/woff2;base64,d09GMgABAAAAAC98ABQAAAAAckwAAC8MAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGnUbh2wcKD9NVkFSgQQGYD9TVEFUgWInLgCDAC90EQgKxVy+FwuCHAAw6w4BNgIkA4QkBCAFjXYHilcMBxsPbCXs2Eu4HUBQUm2iiIrVrkZUkiIm//8lQY64LdyqxwUoEfFu9YzNaLwD6TZ2ztHaAWFzikR5Xi6076tcblFCgSgoqF/G54g+NvH2HKUdx3BKkns+Jt0QAZc+7CS+BWwZfEVglBik+hP91k9GW3FD9t4jNPZJ7g+0uX+XcHccHHAcNTJHLora3AarNlZGz8gZf8rMqT9S/RmlPyL8qT0IyjFyL8kDl1kBCsMOyBGwAgLX8cRCtcJVdTzJDOhWBs7hzXz7nyticzuapbqZjG9W6neOBA5N8KghySGB4IEiuu3FmkCQJa9BABJw5s3S2nYlkDL5TQ2Vq7Whm0ikdKLRZ0gkjW+OaG78vH+v533AkadUDDxM7Zat4Nb1/cC4jyGxV8PmvKVJiB0q1KnfzJAjnZZmZ0GA5iPi9j5F8wgtgeVHhO4A0YkVkCKwFoXJbIAd/X9v0yrt37+fbZlWGi0MkLzbs9ag7aV0RvIsRccUXQSRWr/lVnerNTKW1LY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FF114waxGLGzFUBEjIRuDGIOUMJ0PNhLdBEGJKeKmsAf/bQp1SP1YWWrd7Pdn1a1aFU+nV8TrVs96b3Zi3Yqyrd+VWFoOdiWLYhX94dhg7aeuc88s65qh89f3lbgHE+l7pqAXb2ryhr/r+77T8/7f72sWS+QiaoGYNAjKsutff6O4WMSyHFV7+8b1LXLODSGSZUVoSK5A0Z4777qzpyCRvM6h8ZKLL85qIzZ/IKN9V13rSxy4olkb1tJKWv3E9N57V1emPpso7rV3zXS37/HcmIq3GkAb/r1FdXsrTwcXHewQPeQ8+psPN+9mkcvZdJHiGxgNQ7bH0PfLh0oH40PXrXY7T48PjvVXDOcYobuL9fy8SEe0K9YVaZ/LchMpWHuiM9Yd64l0gXZT+65FzIl1bvatadesxvIRfZXW57RbOHw+3nVLfCC6KhcXlRkS502cl+S9UWvLqKe4r/515+P7E8l/jvsd6epyA6n/ZSgFZazJNAerh/S15bZZafh+oSmZSpqUPfO7eQlKoBJKTpFdBIFjvOfm7/XOHidnMXPRXS+XGnsCt0toBY0pobbcyPojDYpPVKnZfHAs5qkVUuWxfmOgPMP7wnXmOYEiayZ/kcOazDjFS3ipN5PxF+374on7BAiqY3M8VcM9Kcwewc2cmVPOGSFZMiLUz4tut7X0987t11/t+GJ9VhOzLxIukkhUYhSTF2KGdlcM6I+a2kvnpO19PzQL4FOHW4y7DLnAxmT58HBJJWBMlQ+9TzLF5U1BVy64ynGgO7beUt4ccjb5Vrm2dkfXwcWL8YgND862ORaXdAY0f07X3NugvWrLSae1Tq0wBvoH/OYaE63sL9mlbu9UncZlEGf1s8CG99x5Z7eIZUHFEpe7itoqbyi7KrK/8WhLzE5pBA4jOkUOidKhtD513zrLYHB79OLYpUIKpyjqIfGoMxFaE9ngW2TK5vQLine truncated
@font-face { font-family: "Recursive Variable"; font-style: normal; font-display: swap; font-weight: 300 1000; src: url("data:font/woff2;base64,d09GMgABAAAAAMcoABQAAAACIVgAAMazAAEAAAAAAAAAAAAAAAAAAAAAAAAAA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pH635szFCIg4KKwMZUmlF+tGrRem9SuXr3VR3031hzN1Txt0kpdx6zbTtp5u2xPHKIYykQt3X4iK6/KuwIvyIIuuEJFaAk9YTWgCUwOzA8kB3ICZXKFXC3Xy63y95+HKnrSZxSIAlcEFFFFQpFW5BR5894ZDRLOBHBZRaPDztp0Rm/0QV+1aY6pAHfCJ+AL8wDqKOPxychL8pbACZKgCY5QFppCV5gPhAfiA9MCiwKZgUK5XK66m/YGjOaPKOIKQpFtq9nzIvyE/a0PZPhgoQDQwsib87fnob5YX6Tfps/S1+oDP3f5GL3qz9cAiPjNmy/0AHz5/+7bnnc+TzyPM07kefh58Hnguf/5GIBA7iTPk/PTqfYrqZQKVaxSVeiSrnPXRc+oW6d14clkenVV13VTt3VXffqmC5ZDBCYxhVmsN8x6OPwtQ6IEG5BsxGErLtvw2I7PjpeX/xlcmy2G2kiLine truncated
@font-face { font-family: "Recursive Variable"; font-style: normal; font-display: swap; font-weight: 300 1000; src: url("data:font/woff2;base64,d09GMgABAAAAANo0ABQAAAABw5wAANnAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGoNJG+NQHJFiP01WQVKBBAZgP1NUQVSBYicuAIUuL3QRCAqClRSB7QQLhEwAMIPENgE2AiQDiRAEIAWNdgeLCAwHW+GrcUA2xSrj8Xqzqt7vcDOutoLdMgy1E/ncqmGr3EUHco+DocGCzf//OUmHDA24BYDSav30gpTm5oLukVWFEcnonETmsMyRwaxVlcU6uxC9iCZsnT5P+qBoOkFJiqiJxWuPNWT7PHCRw81p1qChF3rCbO9Tu7fKOEyVB/700RQcsJ+gQiqTRi2ocJv6bJMhDPbujiO3awaKVPgtloNHC3ypGDWXlJT8TCcDP38oPBpOaRPPvYUR27Ml25a6QKxwENkIP/a69v/FRGp+aQ7XI8XziaUuA2OXQYk21onIvMPT3P69d7HtlowxR4Zz4BwVR6VBW2SMlChRwmzEbMxGP1b9j1EBH3DbDdCcdsQEon7JRfwSB2JOgISEoFrXAasoq9ikuqrMWE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"Recursive Variable"; font-style: normal; font-display: swap; font-weight: 300 1000; src: url("data:font/woff2;base64,d09GMgABAAAAANo0ABQAAAABw5wAANnAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGoNJG+NQHJFiP01WQVKBBAZgP1NUQVSBYicuAIUuL3QRCAqClRSB7QQLhEwAMIPENgE2AiQDiRAEIAWNdgeLCAwHW+GrcUA2xSrj8Xqzqt7vcDOutoLdMgy1E/ncqmGr3EUHco+DocGCzf//OUmHDA24BYDSav30gpTm5oLukVWFEcnonETmsMyRwaxVlcU6uxC9iCZsnT5P+qBoOkFJiqiJxWuPNWT7PHCRw81p1qChF3rCbO9Tu7fKOEyVB/700RQcsJ+gQiqTRi2ocJv6bJMhDPbujiO3awaKVPgtloNHC3ypGDWXlJT8TCcDP38oPBpOaRPPvYUR27Ml25a6QKxwENkIP/a69v/FRGp+aQ7XI8XziaUuA2OXQYk21onIvMPT3P69d7HtlowxR4Zz4BwVR6VBW2SMlChRwmzEbMxGP1b9j1EBH3DbDdCcdsQEon7JRfwSB2JOgISEoFrXAasoq9ikuqrMWEV/62jp5u1E+1v/V5m3nf1UU7+qXlFXNUotNMcB/IgeADjNAt72urO3lVp2YBGuBJyZT+j874Adx5a4m6t4+H87sPv+xERJd6LbnJR0C9XSut7hn/pD3nP3/VCsEWY8IKVyL0BRbPrJwpkALvSfe/ntnpvXkl+oTdlum8K2LiSDUyiDU4xHZ6hWWmURJHAkUCRwVVYWcFc1qyW2TDDkPQCUy/ISPQnRMEiSLBlE0Gqe0tm/u7JkGT8STP/bEDVVzrq7D1ilTqbPpASCR+Q7gyzJwiWc/zr//9vnfT/qQEpcRgoKK0nFOCd9V1qjXj3ukTmFPIN8B77N7El80zWp+LXb3t1TsS//NOl0e2JW0WxECQkSbGAYYRgxQQcLGfht9f844fRGn+hkZjZuva6/iAQxMBsTRBRsREHF6MneytsxPPxzr75PAd4cWpYTG2vx7vJiXWpQLuaqqxWIIP5+vZN6z+wSQHMa4tInAyKJ2j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5YOb12pjm7cc55F5qLj25XXXMz7gzjnuI+8SB5Fs8VL/BSv/8NGDREh5krkFcIFilrNmzZsedAzhvdc3a3TAprp7fObeDqdrvdblT3f3bbufl+E4BoTAS81czMRESkxMTMzMzMfGNzkCr4IPhwwgxc3FsEAJiZKzMYAAAAeBamvWW367vZplUq9gSVmSSp72dTbxER4SofXDI07b0w+uLW3GOci7O4ePgEhCu4/xu3SVBnco+soMDgCCQKjcHiGv7ITwECkUSmUGl0RoYzq9jC5nB5fIFwiKZuiyPx+hEjRWkU1V+dTy4XVw1uHx8w+WF4PbzDpwnfxA8d/giIQAQJFiI0wi6H8FtEiGyiSrQYo40ZxrbY4RB3iUeCREmSY3w7THhMVEySyU3KLVWadBkyI0uyI0dyh7xT/nUUmEJFikPd/LXkUhplR5RLRVMZUyarHtW3msNazbpx1CsaGo1/brpiKU7n4xWgIP4o+U4ePZjydRr25K9KhImUIlWadBkyZatWc19jdz8U3lqP/XJRt6uuuemeB+NCsREhMo+TRkREWmRP5q5Zo0bjOKtKFH8M7IQBlH8Ei8ULine truncated

Before

Width:  |  Height:  |  Size: 367 KiB

After

Width:  |  Height:  |  Size: 364 KiB

+5 -7
View File
@@ -2,7 +2,7 @@
How one input travels through the agent. Every diamond marked **SemIf** is a
real decision-engine call that is logged as a training row; the LLM only ever
*generates* (skill drafts, bodies, questions). There is no up-front
*generates* (skill drafts, bodies, tests). There is no up-front
handle/ignore gate — every input is dispatched, and an explicit housekeeping
command is routed deterministically before navigation.
@@ -133,7 +133,7 @@ flowchart TD
DRAFT --> GEN{"category or skill?"}
GEN -- "category" --> GC["generate_category()<br/>title + description"]
GEN -- "skill" --> GS["generate_skill()<br/>title + description"]
GEN -- "skill" --> GS["generate_skill_spec()<br/>title + description +<br/>de-identified goal +<br/>generic service/transport"]
GC --> APPROVE
GS --> APPROVE
@@ -150,11 +150,9 @@ flowchart TD
CHAIN --> DRAFT
REGISTER -- "skill" --> WRITE["single-slot codegen worker<br/>SkillWrite queue<br/>leaf.writing = true, trace 'skill_writing'"]
WRITE --> ELICIT["generate_elicitation()<br/>implementation questions + integration hint"]
ELICIT --> QS["Output: questions<br/>posted one at a time<br/>answer_timeout per question"]
QS -- "answers / timeout" --> BODY
WRITE --> BODY
BODY["generate_skill_body()<br/>or regenerate_skill_body() for<br/>repair / fidelity / test / manual regen<br/>CODEGEN.md + bridge catalog<br/>declares INTEGRATION + flat CONTRACT"] --> FID["SemIf choice<br/>phase 'authoring:fidelity'<br/>accept / reconsider<br/>+ static integration_findings"]
BODY["generate_skill_body()<br/>de-identified spec only: goal + service/transport<br/>or regenerate_skill_body() for<br/>repair / fidelity / test / manual regen<br/>CODEGEN.md + bridge catalog<br/>declares INTEGRATION + flat CONTRACT"] --> FID["SemIf choice<br/>phase 'authoring:fidelity'<br/>accept / reconsider<br/>+ static integration_findings"]
FID -- "reconsider (once)" --> BODY
FID -- "accept" --> CONTRACT["parse_contract()<br/>read body's CONTRACT constant"]
@@ -177,7 +175,7 @@ flowchart TD
classDef output fill:#fce8e6,stroke:#d93025;
classDef author fill:#e6f4ea,stroke:#34a853;
class FID,CFG,REGEN semfill;
class PROMPT,ABORT,ABORT2,QS,FAIL,CANCELLED output;
class PROMPT,ABORT,ABORT2,FAIL,CANCELLED output;
class START,DIRECT,BACK,MAT,REQ author;
```
+1 -1
View File
@@ -520,7 +520,7 @@ echo "== verifying imports"
"$PYTHON" -c "import semif_phase1, semif_agent; print('engine + agent import OK')"
# The small self-assessment model runs on this machine's local ollama; ensure it
# is pulled so assess/elicitation/fidelity work without a remote dependency.
# is pulled so assess/fidelity work without a remote dependency.
# With llm.provider == "semif" the loaded decision engine generates the text
# in-process, so no ollama model/endpoint is involved.
if [[ "$LLM_PROVIDER" == "semif" ]]; then
+1 -1
View File
@@ -16,7 +16,7 @@ Two boundaries matter:
own processes (`python -m semif_agent.cli bridge`) against their own service
daemons/profiles. This isolation is non-negotiable (see AGENTS.md).
- **The catalog is visible to codegen.** `describe_bridges()` is injected into
every code-generation prompt (body, retry, regen, elicitation, testgen) and is
every code-generation prompt (body, retry, regen, testgen) and is
the single source of bridge specifics: the model learns which real services it
may build against, each one's base-URL config var, auth header/token var,
config-var docs, and its endpoints with request/response/error shapes. CODEGEN.md
+1 -1
View File
@@ -70,7 +70,7 @@ def derived_config_vars(config: dict) -> dict[str, str]:
def describe_bridges() -> str:
"""A prompt block describing every available bridge service.
Injected into the skill-body, retry, regen, elicitation, and testgen
Injected into the skill-body, retry, regen, and testgen
prompts so codegen knows which real services it may build a skill against,
how to reach and authenticate to each one, and which `ctx.config` variables
carry its URL, token, and other values. This is the single source of bridge
+44 -256
View File
@@ -21,7 +21,6 @@ from pathlib import Path
from typing import Callable, NamedTuple
from .bridges.registry import describe_bridges
from .decisions import Request
from .provider import OpenAICompatClient, ProviderError
from .skills import SkillDraft, tree_summary
@@ -104,10 +103,9 @@ class CodegenClient(OpenAICompatClient):
BODY_DIRECTIVES = (
"This body is a reusable module executed across many requests. It owns no "
"working data: every required operational value is provided by the runner "
"through `ctx.config` under a clear snake_case name — request data from the "
"runner, never embed or fabricate working values, and never ask the human "
"for operational data. Ask the human only to refine the product goal and "
"requirements.\n"
"through `ctx.config` under a clear snake_case name — never embed or "
"fabricate working values, and never assume a specific user, account, "
"address, or value.\n"
"Write a single `act(ctx, request)` function. Declare the required "
"operational values as a module-level `CONTRACT` dict exactly as CODEGEN.md "
"specifies: a flat map of variable name -> semantic description. Every key "
@@ -115,16 +113,16 @@ BODY_DIRECTIVES = (
"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"
"query argument in CONTRACT. 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, "
"subprocess for a configured local CLI) using endpoint, account, "
"credential, and CLI-path values read from `ctx.config`. Never simulate "
"success, never return canned output, and never default to writing a draft "
"unless the requirements explicitly ask for draft-only. The auto-run test "
"unless the reusable goal explicitly asks for draft-only. The auto-run test "
"is a hermetic mechanics check and will not exercise the live service, so "
"no localhost defaults, test ports, or fixture values may appear in the "
"body.\n"
@@ -137,52 +135,38 @@ BODY_DIRECTIVES = (
"candidates to choose from (contacts, conversations, calendars, targets), "
"employ a `ctx.engine` SemIf sub-decision over them and return the "
"`(DecisionRequest, DecisionResult)` pairs on `ActionResult.decisions`; "
"send only when the request or requirements ask for it.\n"
"send only when the reusable goal calls for it.\n"
)
def _requirements_block(requirements: dict[str, str] | None) -> str:
if not requirements:
return ""
lines = "\n".join(
f"- {question} -> {answer}" for question, answer in requirements.items()
)
return f"Requirements gathered from the product owner:\n{lines}\n"
def _integration_hint_block(draft: SkillDraft) -> str:
"""Advisory integration hint from elicitation: service + transport.
Never overrides the request, requirements, or CODEGEN.md contract — it only
biases the body writer toward the integration the questions were aiming at.
"""
"""Advisory integration hint from the de-identified skill spec: service +
transport. Never overrides the reusable goal or the CODEGEN.md contract — it
only biases the body writer toward the integration the spec named."""
integration = getattr(draft, "integration", None) or {}
service = integration.get("service")
transport = integration.get("transport")
if not service and not transport:
return ""
return (
"Elicitation pointed at this integration (advisory only: follow the "
"request, requirements, and contract if they disagree): "
"The skill spec points at this integration (advisory only: follow the "
"reusable goal and the contract if they disagree): "
f"service={service or 'unknown'}, transport={transport or 'unknown'}.\n"
)
def build_skill_body_prompt(
request: Request,
category: str,
draft: SkillDraft,
tree: dict,
contract: str,
requirements: dict[str, str] | None = None,
) -> list[dict]:
"""Messages for the code-generation model.
The small model already chose the title + description; the big model only
writes the runnable body against the CODEGEN.md contract, informed by the
request, the category, and the existing skills so it avoids duplication.
`requirements` carries the answers to elicitation questions asked of the
human during authoring.
Built ONLY from the de-identified spec (goal + generic service/transport),
the category, the existing tree, and the CODEGEN.md contract. It never
carries the user's request, question answers, or any run output: codegen
must be able to write a reusable body from the generalized goal alone.
"""
existing = ", ".join(s.name for s in tree.get(category, [])) or "(none)"
system = (
@@ -190,15 +174,14 @@ def build_skill_body_prompt(
"is authoritative: follow it exactly.\n\n"
f"{contract}"
)
req_block = _requirements_block(requirements)
user = (
f"Request: {request.text}\n"
f"Category: {category}\n"
f"Skill name: {draft.name}\n"
f"Reusable goal (de-identified; never embed or ask for user-specific "
f"values): {draft.goal}\n"
f"Skill description: {draft.description}\n"
f"Existing skills in this category: {existing}\n"
f"Existing categories:\n{tree_summary(tree)}\n"
f"{req_block}"
f"{_integration_hint_block(draft)}"
f"{describe_bridges()}\n"
f"{BODY_DIRECTIVES}"
@@ -556,18 +539,16 @@ def integration_findings(integration: dict, source: str, code: str) -> list[str]
def _retry_prompt(
request: Request,
category: str,
draft: SkillDraft,
contract: str,
error: Exception,
requirements: dict[str, str] | None = None,
) -> list[dict]:
"""Fresh short prompt for a corrective retry.
Not a growing conversation: the context resets to SMART (new request, tiny
prompt) and the model is told in one line to stop looping and emit the
final Python. The elicitation answers are repeated so a retry cannot fall
final Python. The de-identified goal is repeated so a retry cannot fall
back to a toy body.
"""
system = (
@@ -578,11 +559,10 @@ def _retry_prompt(
user = (
f"The previous attempt to write the skill body for {category}.{draft.name} "
f"was rejected: {error}. You are looping; emit the final Python now.\n"
f"Request: {request.text}\n"
f"Category: {category}\n"
f"Skill name: {draft.name}\n"
f"Reusable goal (de-identified): {draft.goal}\n"
f"Skill description: {draft.description}\n"
f"{_requirements_block(requirements)}"
f"{_integration_hint_block(draft)}"
f"{describe_bridges()}\n"
f"{BODY_DIRECTIVES}"
@@ -597,24 +577,23 @@ def _retry_prompt(
def generate_skill_body(
client: CodegenClient,
request: Request,
category: str,
draft: SkillDraft,
tree: dict,
contract: str | None = None,
max_tokens: int | None = None,
degeneration_check: Callable[[str], str | None] | None = None,
requirements: dict[str, str] | None = None,
) -> str:
"""Author a skill body with the big model; retry up to `max_attempts`.
Built only from the de-identified spec (goal + generic integration), the
category, the tree, and the CODEGEN.md contract — never the user's request.
Every attempt uses the client's configured sampler parameters (or omits
them when unset). A rejected parse (ValueError) retries with a fresh short
prompt that resets the context to SMART and tells the model to emit the
final Python now. Only an invalid parse retries; a DegenerationError or
other CodegenError propagates immediately so the scheduler can stub out
gracefully. `requirements` (elicitation answers) are fed to the
first-attempt prompt only.
gracefully.
"""
contract_text = contract if contract is not None else read_skill_contract()
if client.stream:
@@ -624,16 +603,14 @@ def generate_skill_body(
for attempt in range(1, attempts + 1):
if attempt == 1:
messages = build_skill_body_prompt(
request,
category,
draft,
tree,
contract_text,
requirements=requirements,
)
else:
messages = _retry_prompt(
request, category, draft, contract_text, last_error, requirements
category, draft, contract_text, last_error
)
try:
raw = client.chat(
@@ -647,197 +624,6 @@ def generate_skill_body(
raise ValueError(f"skill body rejected {attempts} times: {last_error}")
# ---- requirements elicitation ----
ELICITATION_EXAMPLES = [
"Should this skill really send/query/execute against the live service, or produce a reviewable draft first?",
"Which service or account should it use, and how should it connect (HTTP API base URL, IMAP/SMTP host, CalDAV URL, local CLI command)?",
"How does it authenticate with the service, and should that credential come from the app's config?",
"What does a successful run look like — what should it report back to you?",
"If the service is unreachable or refuses the action, should the run fail loudly or record 'could not complete' as the result?",
"Should this skill read or send through one of the available bridge services (see the catalog below), and if so which conversation or target?",
]
def build_elicitation_prompt(
request: Request,
category: str,
draft: SkillDraft,
tree: dict,
max_questions: int = 4,
) -> list[dict]:
"""Messages asking the big model to propose implementation questions.
The agent does real tasks against the user's actual services, so success
depends on pinning down how the new skill will connect. The questions
refine the product goal and the integration — never operational data values
(the runner collects those after the body is written) and never
config-vs-input cadence questions (the config step decides that at first
fire). The examples are deliberately concrete so a weaker model can mirror
them.
"""
examples = "\n".join(f"- \"{q}\"" for q in ELICITATION_EXAMPLES)
existing = ", ".join(s.name for s in tree.get(category, [])) or "(none)"
system = (
"You are eliciting requirements for a new skill in a local agent. The "
"agent performs real tasks for an everyday person against their actual "
"services, so success depends on understanding HOW the skill will "
"connect. You ask the human (the product owner) up to "
f"{max_questions} questions that refine the product goal and the "
"integration. Ask about product behavior and integration, not code.\n\n"
"Good example questions:\n"
f"{examples}\n\n"
"Never ask:\n"
"- for operational data values (passwords, API keys, addresses, "
"tracking numbers, hostnames) — the runner collects those after the "
"body is written;\n"
"- config-vs-input cadence questions like \"should the sender address "
"change?\" — the config step owns that decision at first fire;\n"
"- trivia you can decide yourself (variable names, formatting, "
"internal wording).\n\n"
"If the request and description already make the integration clear, "
"return an empty list rather than inventing questions.\n\n"
"Also give your best guess of the integration the questions are aiming "
"at, so the body writer implements exactly that. Reply with JSON only: "
'{"questions": ["...", "..."], "integration": {"service": '
'"<lowercase_snake_case or unknown>", "transport": '
'"<http|caldav|imap|smtp|pop|subprocess|file|compute>"}}'
)
user = (
f"Request: {request.text}\n"
f"Category: {category}\n"
f"Skill name: {draft.name}\n"
f"Skill description: {draft.description}\n"
f"Existing skills in this category: {existing}\n"
f"Existing categories:\n{tree_summary(tree)}\n"
f"{describe_bridges()}\n"
)
return [
{"role": "system", "content": system},
{"role": "user", "content": user},
]
class ElicitationResult(NamedTuple):
"""Questions for the human plus the integration they are aiming at."""
questions: list[str]
integration: dict
def _parse_elicitation_object(raw: str) -> dict:
text = raw.strip()
start, end = text.find("{"), text.rfind("}")
if start == -1 or end == -1:
raise ValueError(f"elicitation reply is not a JSON object: {raw!r}")
try:
return json.loads(text[start : end + 1])
except ValueError as exc:
raise ValueError(f"elicitation reply is not valid JSON: {exc}") from exc
def parse_elicitation(raw: str) -> list[str]:
"""Extract a JSON {"questions": [...]} list of non-empty strings."""
parsed = _parse_elicitation_object(raw)
questions = parsed.get("questions")
if not isinstance(questions, list):
raise ValueError("elicitation reply must have a `questions` list")
cleaned = []
for question in questions:
if isinstance(question, str) and question.strip():
cleaned.append(question.strip())
return cleaned
def parse_elicitation_result(raw: str) -> ElicitationResult:
"""Questions plus the model's integration hint (service + transport).
A bad or absent hint is dropped, never fatal: the questions are the point
and the body writer can still declare the integration itself.
"""
parsed = _parse_elicitation_object(raw)
integration: dict = {}
hint = parsed.get("integration")
if isinstance(hint, dict):
service = hint.get("service")
transport = hint.get("transport")
if (
isinstance(service, str)
and _SERVICE_RE.fullmatch(service)
and transport in INTEGRATION_TRANSPORTS
):
integration = {"service": service, "transport": transport}
return ElicitationResult(parse_elicitation(raw), integration)
def _retry_elicitation_prompt(
request: Request,
category: str,
draft: SkillDraft,
tree: dict,
error: Exception,
max_questions: int = 4,
) -> list[dict]:
messages = build_elicitation_prompt(
request, category, draft, tree, max_questions=max_questions
)
messages[1]["content"] += (
f"\nYour previous reply was rejected: {error}. Reply with JSON only: "
'{"questions": ["...", "..."], "integration": {"service": "...", '
'"transport": "..."}}'
)
return messages
def generate_elicitation(
client: CodegenClient,
request: Request,
category: str,
draft: SkillDraft,
tree: dict,
max_questions: int = 4,
) -> ElicitationResult:
"""Propose implementation questions + an integration hint with the big model.
Returns an empty result when the model produced none or the reply failed to
parse after the retry ladder — elicitation must never block authoring.
"""
attempts = max(client.max_attempts, 1)
last_error: Exception | None = None
for attempt in range(1, attempts + 1):
if attempt == 1:
messages = build_elicitation_prompt(
request, category, draft, tree, max_questions=max_questions
)
else:
messages = _retry_elicitation_prompt(
request, category, draft, tree, last_error, max_questions=max_questions
)
try:
raw = client.chat(messages)
result = parse_elicitation_result(raw)
return ElicitationResult(
result.questions[: max(0, max_questions)], result.integration
)
except ValueError as exc:
last_error = exc
return ElicitationResult([], {})
def generate_requirements(
client: CodegenClient,
request: Request,
category: str,
draft: SkillDraft,
tree: dict,
max_questions: int = 4,
) -> list[str]:
"""Question-only view of generate_elicitation (kept for callers/tests)."""
return generate_elicitation(
client, request, category, draft, tree, max_questions=max_questions
).questions
# ---- data contract + test ----
TESTGEN_CONTRACT = Path(__file__).resolve().parent.parent / "TESTGEN.md"
@@ -852,14 +638,15 @@ def read_testgen_contract(path: str | None = None) -> str:
def build_testgen_base_prompt(
request: Request, category: str, name: str, skill_code: str, contract_md: str
category: str, draft: SkillDraft, skill_code: str, contract_md: str
) -> list[dict]:
"""The shared context for the contract + test generation calls.
Seeded with the TESTGEN.md contract and the finished skill body; the
contract call appends its ask, and the testgen call appends the contract
output (as the assistant turn) plus its own ask — the two calls share this
context but produce distinct artifacts.
Seeded with the TESTGEN.md contract, the de-identified spec, and the
finished skill body; the contract call appends its ask, and the testgen call
appends the contract output (as the assistant turn) plus its own ask — the
two calls share this context but produce distinct artifacts. Never carries
the user's request.
"""
system = (
"You produce the data contract and test for a skill body of a "
@@ -867,8 +654,8 @@ def build_testgen_base_prompt(
f"{contract_md}"
)
user = (
f"Skill: {category}.{name}\n"
f"Request: {request.text}\n"
f"Skill: {category}.{draft.name}\n"
f"Reusable goal (de-identified): {draft.goal}\n"
f"Finished skill body:\n```python\n{skill_code}\n```\n"
f"{describe_bridges()}"
)
@@ -1006,7 +793,6 @@ def parse_skill_test(raw: str) -> str:
def generate_skill_tests(
client: CodegenClient,
request: Request,
category: str,
draft: SkillDraft,
skill_code: str,
@@ -1019,7 +805,8 @@ def generate_skill_tests(
Shares the base context with the contract call (TESTGEN.md + skill.py) and
continues it with the accepted contract, so the test stays compatible with
the body and the contract. Fixture data is embedded inline in the test.
the body and the contract. Built only from the de-identified spec — never
the user's request. Fixture data is embedded inline in the test.
Escalates on parse failure; `reason` + `target` drive a corrective
regeneration.
"""
@@ -1033,7 +820,7 @@ def generate_skill_tests(
note = str(last_error)
messages = build_testgen_request_prompt(
build_testgen_base_prompt(
request, category, draft.name, skill_code, contract_text
category, draft, skill_code, contract_text
),
contract,
note=note,
@@ -1072,7 +859,6 @@ def render_evidence(evidence: dict) -> str:
def _regen_body_prompt(
request: Request,
category: str,
draft: SkillDraft,
contract: str,
@@ -1081,7 +867,9 @@ def _regen_body_prompt(
reason_kind: str = "test",
) -> list[dict]:
"""Fresh corrective prompt carrying the raw evidence bundle, not a prose
diagnosis. `reason_kind` labels the corrective context in one word."""
diagnosis. `reason_kind` labels the corrective context in one word. Built
only from the de-identified spec and the evidence — never the user's
request."""
system = (
"You write runnable skill bodies for a local agent. The contract below "
"is authoritative: follow it exactly.\n\n"
@@ -1089,7 +877,7 @@ def _regen_body_prompt(
)
user = (
f"Correct a skill body for {category}.{draft.name} ({reason_kind}).\n"
f"Request: {request.text}\n"
f"Reusable goal (de-identified): {draft.goal}\n"
f"Skill description: {draft.description}\n"
f"Evidence:\n{render_evidence(evidence)}\n"
f"Previous body:\n```python\n{previous_code}\n```\n"
@@ -1107,7 +895,6 @@ def _regen_body_prompt(
def regenerate_skill_body(
client: CodegenClient,
request: Request,
category: str,
draft: SkillDraft,
previous_code: str,
@@ -1120,8 +907,9 @@ def regenerate_skill_body(
Fresh prompt (context resets) carrying the raw evidence bundle and the
previous body; retry ladder identical to generate_skill_body.
`reason_kind` labels the corrective context (`test`, `fidelity`, or
`run_failure`). The bundle is handed through as-is — the caller includes
requirements and the raw failure fields, never a paraphrase. A
`run_failure`). The evidence bundle must be de-identified by the caller: it
carries only the generalized failure kind, integration, goal, and previous
body — never the user's request or any run output. A
DegenerationError or other CodegenError propagates immediately.
"""
contract_text = contract if contract is not None else read_skill_contract()
@@ -1132,7 +920,7 @@ def regenerate_skill_body(
if attempt > 1:
attempt_evidence["previous_parse_error"] = str(last_error)
messages = _regen_body_prompt(
request, category, draft, contract_text, previous_code,
category, draft, contract_text, previous_code,
attempt_evidence, reason_kind=reason_kind,
)
try:
+38 -212
View File
@@ -23,7 +23,6 @@ from .codegen import (
CodegenClient,
CodegenError,
extract_integration,
generate_elicitation,
generate_skill_body,
generate_skill_tests,
integration_findings,
@@ -60,7 +59,7 @@ from .skills import (
build_tree,
confirm_skill_fit,
generate_category,
generate_skill,
generate_skill_spec,
materialize_skill,
merge_registry,
merge_seed_store,
@@ -163,13 +162,12 @@ class DraftAuthor:
@dataclass
class PendingQuestion:
"""A question waiting for the human (deferred elicitation or repair).
"""A repair question waiting for the human.
Posted by the codegen worker; answered via
the dashboard (`/api/questions`) or `Scheduler.answer_question`. Elicitation
posts one at a time and waits `codegen.elicitation.answer_timeout` seconds
for each (the clock resets on every answer); the worker then continues with
whatever answers arrived.
Posted when a failed run's repair is chosen as `ask_user`; answered via the
dashboard (`/api/questions`), the gateway, or `Scheduler.answer_question`.
The answer starts the repair. Authoring itself never asks the human
anything: codegen works from the de-identified spec alone.
"""
id: str
@@ -177,7 +175,7 @@ class PendingQuestion:
category: str
skill: str
question: str
kind: str = "elicitation"
kind: str = "repair"
offer_id: str | None = None
answer: str | None = None
skipped: bool = False
@@ -329,13 +327,8 @@ class Scheduler:
self.regen_decision_factory = regen_decision_factory
self.on_request_requeued = on_request_requeued
codegen_cfg = config.get("codegen", {}) or {}
elicitation_cfg = codegen_cfg.get("elicitation", {}) or {}
self.elicitation_enabled = bool(elicitation_cfg.get("enabled", True))
self.elicitation_max = int(elicitation_cfg.get("max_questions", 4))
self.elicitation_wait = float(elicitation_cfg.get("wait_timeout", 900.0))
self.elicitation_answer_timeout = float(
elicitation_cfg.get("answer_timeout", 30.0)
)
approval_cfg = codegen_cfg.get("approval", {}) or {}
self.approval_wait = float(approval_cfg.get("wait_timeout", 900.0))
self.defer_questions = False
#: Global new-skill creation mode: "allow" (default), "deny", or "ask".
#: A category may override it in its category config.
@@ -1005,10 +998,10 @@ class Scheduler:
Executing a repair is user-confirmed (a codegen write takes tens of
minutes), so the offer is recorded and surfaced in REPL/dashboard. The
choice is logged as a real decision (phase `repair:choice`); the offer
lifecycle is traced. The raw failure evidence bundle is captured as-is —
error, action log, new state, and summary — so a repair hands the codegen
model the observed failure verbatim, never a paraphrase and never
credentials.
lifecycle is traced. The evidence handed to codegen is **de-identified**:
only a generic failure kind, the integration, the goal, and the previous
body — never the run's action log/new state/summary or the user's
request. The full failure text stays local (in the offer) for the human.
"""
if (
not self.repair_enabled
@@ -1017,13 +1010,9 @@ class Scheduler:
):
return
evidence = {
"error": outcome.error,
"action_log": outcome.action_log,
"new_state": outcome.new_state,
"summary": outcome.summary,
"request": request.text,
"failure_kind": "a real run against the live service failed",
"integration": skill.integration or {},
"description": skill.description,
"requirements": self._skill_requirements(skill),
"previous_body": self._read_body(skill.category, skill.name),
}
failure = (
@@ -1296,27 +1285,17 @@ class Scheduler:
return "ok", f"declined repair for {offer.category}.{offer.skill}"
return self._start_repair(offer, detail=answer)
def _skill_requirements(self, skill: Skill) -> dict[str, str]:
row = next(
(
s
for s in self.registry.read().get(skill.category, {}).get("skills", [])
if s.get("name") == skill.name
),
{},
)
return dict(row.get("requirements") or {})
def _start_repair(self, offer: RepairOffer, detail: str | None) -> tuple[str, str]:
draft = self._stub_draft(offer.category, offer.skill)
evidence = dict(offer.evidence)
if detail:
draft.requirements[f"how to fix {offer.skill}"] = detail
evidence["guidance"] = detail
with self._lock:
self._repair_counts[offer.skill] = self._repair_counts.get(offer.skill, 0) + 1
offer.status = "done"
request = Request(offer.request_text, source="repair")
self._start_skill_write(
request, offer.category, draft, repair_evidence=offer.evidence
request, offer.category, draft, repair_evidence=evidence
)
self.trace.append(
"repair_executed",
@@ -1335,7 +1314,7 @@ class Scheduler:
return SkillDraft(
name=name,
description=row.get("description") or name,
requirements=dict(row.get("requirements") or {}),
goal=row.get("goal") or row.get("description") or name,
)
# ---- async draft authoring (single-slot `llm` worker) ----
@@ -1442,7 +1421,7 @@ class Scheduler:
approves the proposed skill (a chained skill inside an already-approved
category skips this).
"""
draft = generate_skill(
draft = generate_skill_spec(
self.llm, job.request, job.category, self._tree_snapshot()
)
if not self._request_approval(job, "skill", draft.name, draft.description):
@@ -1470,7 +1449,7 @@ class Scheduler:
job.category,
draft.name,
draft.description,
request_text=job.request.text,
goal=draft.goal,
)
self.tree.setdefault(job.category, []).append(
Skill(
@@ -1591,8 +1570,8 @@ class Scheduler:
)
deadline = (
None
if self.elicitation_wait <= 0
else time.monotonic() + self.elicitation_wait
if self.approval_wait <= 0
else time.monotonic() + self.approval_wait
)
with self._lock:
while approval.status == "pending":
@@ -1729,30 +1708,28 @@ class Scheduler:
def _write_skill_body(self, job: SkillWrite) -> None:
"""Run the full authoring pipeline for one queued write (no scheduler
lock held here): deferred elicitation -> codegen body (or repair
rewrite) -> fidelity gate -> parse the body's CONTRACT -> test ->
auto-run test (with a SemIf regen ladder on failure).
lock held here): codegen body (or repair rewrite) -> fidelity gate ->
parse the body's CONTRACT -> test -> auto-run test (with a SemIf regen
ladder on failure).
The tree is snapshotted under the lock so the prompt build reads a
stable view even if the main thread merges another skill meanwhile.
The prompt is built only from the de-identified spec. The tree is
snapshotted under the lock so the prompt build reads a stable view even
if the main thread merges another skill meanwhile.
"""
if self._is_cancelled(job.category, job.draft.name):
return
with self._lock:
tree_snapshot = {category: list(skills) for category, skills in self.tree.items()}
if job.repair_evidence is None and not job.draft.requirements:
self._deferred_elicit(job, tree_snapshot)
try:
if job.repair_evidence is not None:
evidence = dict(job.repair_evidence)
evidence.update({
"description": job.draft.description,
"requirements": job.draft.requirements,
"goal": job.draft.goal,
"previous_body": self._read_body(job.category, job.draft.name),
})
code = regenerate_skill_body(
self.codegen,
job.request,
job.category,
job.draft,
self._read_body(job.category, job.draft.name),
@@ -1762,11 +1739,9 @@ class Scheduler:
else:
code = generate_skill_body(
self.codegen,
job.request,
job.category,
job.draft,
tree_snapshot,
requirements=job.draft.requirements,
degeneration_check=(
self.degeneration_check_factory(job.request.id)
if self.degeneration_check_factory is not None
@@ -1805,129 +1780,6 @@ class Scheduler:
except OSError:
return ""
def _deferred_elicit(self, job: SkillWrite, tree: dict) -> None:
"""Generate questions in the background, post them, wait for answers.
The single-slot worker itself asks: the REPL, dashboard, and gateway all
defer questions to `self.questions` now that authoring is async. It asks
them one at a time, waiting up to `elicitation.answer_timeout` seconds
for each (the clock resets on every answer); the gate stays free while
it waits and other requests proceed. A timeout stops the sequence and
the worker proceeds with whatever answers arrived (possibly none).
"""
if not (self.defer_questions and self.elicitation_enabled and self.codegen):
if self.elicitation_enabled and self.codegen is not None:
self.trace.append(
"requirements_skipped",
job.request.id,
category=job.category,
skill=job.draft.name,
reason="questions not deferred by this front end",
)
return
try:
elicited = generate_elicitation(
self.codegen, job.request, job.category, job.draft, tree,
max_questions=self.elicitation_max,
)
except CodegenError:
return
if elicited.integration:
job.draft.integration = elicited.integration
if not elicited.questions:
return
answers = self._post_questions(job, elicited.questions)
job.draft.requirements.update(answers)
if job.draft.requirements or job.draft.integration:
self._registry_requirements(job)
self.trace.append(
"requirements",
job.request.id,
category=job.category,
skill=job.draft.name,
questions=list(job.draft.requirements.keys()),
integration=job.draft.integration or None,
)
def _post_questions(
self, job: SkillWrite, questions: list[str]
) -> dict[str, str]:
"""Ask the questions one at a time, waiting for each answer.
Only one question is live at a time: the next is posted only after the
current is answered (an empty answer is accepted) or skipped. Each
question gets a fresh `elicitation.answer_timeout` seconds — the clock
resets on every answer submit. A timeout stops the sequence so the
worker proceeds with whatever answers arrived.
"""
self.trace.append(
"questions_asked",
job.request.id,
category=job.category,
skill=job.draft.name,
questions=questions,
)
print(
f"[codegen] {len(questions)} question(s) about "
f"{job.category}.{job.draft.name} — answer in the dashboard."
)
answers: dict[str, str] = {}
asked = 0
timed_out = False
for question in questions:
pending = PendingQuestion(
id=uuid.uuid4().hex[:12],
run_id=job.request.id,
category=job.category,
skill=job.draft.name,
question=question,
)
with self._lock:
self.questions.append(pending)
self._question_notify.notify_all()
asked += 1
deadline = (
None
if self.elicitation_answer_timeout <= 0
else time.monotonic() + self.elicitation_answer_timeout
)
with self._lock:
while pending.answer is None and not pending.skipped:
if deadline is not None and time.monotonic() >= deadline:
timed_out = True
break
self._question_notify.wait(timeout=1.0)
if pending.answer is not None:
answers[question] = pending.answer
self.questions = [q for q in self.questions if q is not pending]
self._question_notify.notify_all()
if pending.answer is None and not pending.skipped:
# The current question timed out; don't post the rest.
break
if timed_out:
self.trace.append(
"questions_timeout",
job.request.id,
category=job.category,
skill=job.draft.name,
answered=len(answers),
asked=asked,
)
return answers
def _registry_requirements(self, job: SkillWrite) -> None:
entry = self.registry.read().get(job.category, {})
row = next(
(s for s in entry.get("skills", []) if s.get("name") == job.draft.name), {}
)
self.registry.register_skill(
job.category,
job.draft.name,
job.draft.description,
request_text=row.get("request_text", job.request.text),
requirements=job.draft.requirements,
)
def _fidelity_gate(self, job: SkillWrite, code: str) -> str:
"""Rapid SemIf sanity gate on the body; regen once only on reconsider.
@@ -1996,9 +1848,8 @@ class Scheduler:
if attempt >= attempts:
return reviewed
evidence = {
"request": job.request.text,
"goal": job.draft.goal,
"description": job.draft.description,
"requirements": job.draft.requirements,
"INTEGRATION": integration,
"findings": findings,
"verdict": result.selected,
@@ -2008,7 +1859,6 @@ class Scheduler:
try:
reviewed = regenerate_skill_body(
self.codegen,
job.request,
job.category,
job.draft,
reviewed,
@@ -2045,14 +1895,13 @@ class Scheduler:
if target == "regen_code":
code = regenerate_skill_body(
self.codegen,
job.request,
job.category,
job.draft,
code,
{
"test_output": reason,
"description": job.draft.description,
"requirements": job.draft.requirements,
"goal": job.draft.goal,
"previous_body": code,
},
reason_kind="test",
@@ -2061,7 +1910,7 @@ class Scheduler:
contract = parse_contract(code)
self.body_store.write_contract(job.category, job.draft.name, contract)
test = generate_skill_tests(
self.codegen, job.request, job.category, job.draft, code, contract,
self.codegen, job.category, job.draft, code, contract,
reason=reason, target=target,
)
self.body_store.write_test(job.category, job.draft.name, test)
@@ -2259,19 +2108,9 @@ class Scheduler:
draft = self._stub_draft(category, name)
if leaf.description:
draft.description = leaf.description
row = next(
(
s
for s in self.registry.read().get(category, {}).get("skills", [])
if s.get("name") == name
),
{},
)
request_text = row.get("request_text")
origin = (
Request(request_text, source="restart")
if request_text
else Request(f"write the body for {category}.{name}: {draft.description}", source="restart")
origin = Request(
f"write the body for {category}.{name}: {draft.goal}",
source="restart",
)
self._start_skill_write(origin, category, draft)
self.trace.append("skill_restarted", origin.id, category=category, skill=name)
@@ -2389,23 +2228,10 @@ class Scheduler:
draft = self._stub_draft(category, name)
if leaf.description:
draft.description = leaf.description
row = next(
(
s
for s in self.registry.read().get(category, {}).get("skills", [])
if s.get("name") == name
),
{},
)
request_text = row.get("request_text")
origin = (
Request(request_text, source="regen")
if request_text
else Request(
f"regenerate the body for {category}.{name}: {draft.description}",
origin = Request(
f"regenerate the body for {category}.{name}: {draft.goal}",
source="regen",
)
)
previous = self._read_body(category, name)
evidence = {"guidance": guidance or "(none given)"} if previous else None
self._start_skill_write(
+48 -24
View File
@@ -121,17 +121,19 @@ class CategoryDraft:
class SkillDraft:
"""An authored skill leaf stub: one specific action within a category.
`requirements` maps elicitation questions (asked of the human during
authoring) to their answers; they are fed to the body-writer so the body
reflects the refined product goal. `integration` carries the service and
transport the answers point at; it is fed to the body writer as an advisory
hint only — the CODEGEN.md contract, request, and requirements still win.
`goal` is the **de-identified** statement of the reusable action, authored
by the trusted local `llm` from the request and stripped of every
user-specific value (names, addresses, dates, accounts, credentials, quoted
content). It is the only task data the codegen endpoint is ever shown —
codegen never receives the request text or any user detail. `integration`
carries the generic service and transport (e.g. `nextcloud`/`caldav`), never
an account.
"""
name: str
description: str
goal: str = ""
code: str = ""
requirements: dict[str, str] = field(default_factory=dict)
integration: dict = field(default_factory=dict)
@@ -162,14 +164,13 @@ class CategoryRegistry:
category: str,
name: str,
description: str,
request_text: str = "",
requirements: dict[str, str] | None = None,
goal: str = "",
) -> None:
"""Add a skill leaf to a category, creating the category entry if needed.
`request_text` is the originating request, kept so a later restart of the
stub can re-drive codegen with the same context. `requirements` are the
elicitation answers, kept so a restart does not have to ask again.
`goal` is the de-identified, reusable action statement authored by the
local `llm`. Neither the originating request nor any user detail is
persisted here (see the codegen privacy invariant).
"""
categories = self.read()
entry = categories.setdefault(category, {"description": "", "skills": []})
@@ -178,9 +179,7 @@ class CategoryRegistry:
if entry_row is None:
entry_row = {"name": name, "description": description}
skills.append(entry_row)
entry_row["request_text"] = request_text
if requirements:
entry_row["requirements"] = requirements
entry_row["goal"] = goal
self.path.parent.mkdir(parents=True, exist_ok=True)
self.path.write_text(json.dumps(categories, indent=2) + "\n")
@@ -1717,19 +1716,31 @@ def generate_category(
def build_skill_prompt(
request: Request, category: str, tree: dict[str, list[Skill]]
) -> list[dict]:
"""Chat messages for the decision model used as the skill author.
"""Chat messages for the spec-authoring step (trusted local `llm`).
The skill must be one specific, single-purpose action that fits inside the
given category — not a broad bucket. Existing skills in the category are
included so the model avoids duplicating them.
given category. Alongside the title + description the model must author a
**de-identified** reusable goal: the codegen endpoint never sees the original
request, so every user-specific value (names, addresses, dates, accounts,
credentials, quoted content) must be stripped and left for the script to
derive from the request at runtime.
"""
system = (
"You are the skill-tree authoring step of a local agent. A request inside "
f"the '{category}' category did not fit any existing skill. Propose ONE "
"new skill for this category: a specific, single-purpose action the agent "
"can take. Reply with JSON only: "
"can take. Also write a DE-IDENTIFIED reusable goal for that action: the "
"code writer will never see the original request, so you MUST remove every "
"user-specific value — names, addresses, emails, phone numbers, dates, "
"times, numbers, account names, hostnames, credentials, and quoted content "
"— and describe only the generic action plus which values it must derive "
"from the request at runtime. Reply with JSON only: "
'{"title": "<short lowercase snake_case id, no spaces, generic and reusable>", '
'"description": "<one to two sentence description of how it benefits user>"}'
'"description": "<one to two sentence description of how it benefits the '
'user, no user-specific values>", '
'"goal": "<de-identified reusable action, no user-specific values>", '
'"service": "<generic service family in lowercase snake_case, or unknown>", '
'"transport": "<http|caldav|imap|smtp|pop|subprocess|file|compute>"}'
)
existing = ", ".join(s.name for s in tree.get(category, [])) or "(none)"
user = (
@@ -1745,7 +1756,8 @@ def build_skill_prompt(
def parse_skill_draft(raw: str) -> SkillDraft:
"""Parse the model's JSON reply into a SkillDraft."""
"""Parse the model's JSON reply into a SkillDraft (title, description, goal,
integration)."""
parsed = LLMClient._parse_json(raw)
title = str(parsed.get("title", "")).strip()
description = str(parsed.get("description", "")).strip()
@@ -1754,12 +1766,24 @@ def parse_skill_draft(raw: str) -> SkillDraft:
name = re.sub(r"\s+", "_", title.lower())
if not re.fullmatch(r"[a-z0-9_]+(?:\.[a-z0-9_]+)*", name):
raise ValueError(f"skill title must be snake_case alnum (dots allowed): {title!r}")
return SkillDraft(name=name, description=description)
goal = str(parsed.get("goal", "")).strip() or description
integration: dict = {}
service = str(parsed.get("service", "")).strip().lower()
transport = str(parsed.get("transport", "")).strip().lower()
# Validate the advisory hint against the generic transport set; a bad or
# absent hint is dropped, never fatal.
from .codegen import INTEGRATION_TRANSPORTS
if re.fullmatch(r"[a-z0-9_]+", service) and transport in INTEGRATION_TRANSPORTS:
integration = {"service": service, "transport": transport}
return SkillDraft(
name=name, description=description, goal=goal, integration=integration
)
def generate_skill(
def generate_skill_spec(
client: LLMClient, request: Request, category: str, tree: dict[str, list[Skill]]
) -> SkillDraft:
"""Author a new skill leaf stub with the `llm` provider."""
raw = client.chat(build_skill_prompt(request, category, tree), max_tokens=128)
"""Author a de-identified skill spec (stub) with the local `llm` provider."""
raw = client.chat(build_skill_prompt(request, category, tree), max_tokens=256)
return parse_skill_draft(raw)
-4
View File
@@ -146,8 +146,6 @@ function eventRow(evt) {
div.textContent = `ready: ${evt.skill}`;
} else if (evt.kind === "codegen_regen") {
div.textContent = `regen → ${evt.selected}`;
} else if (evt.kind === "requirements") {
div.textContent = "refinement questions asked";
} else if (evt.kind === "skill_write_failed") {
div.textContent = `body write failed: ${evt.skill}`;
div.title = evt.message || "";
@@ -490,8 +488,6 @@ function eventNode(evt) {
out.textContent = evt.reason.slice(0, 160);
body.appendChild(out);
}
} else if (evt.kind === "requirements") {
body.textContent = `refinement: ${(evt.questions || []).join(" | ")}`;
} else if (evt.kind === "skill_write_failed") {
node.classList.add("stub");
const title = document.createElement("div");
+11 -16
View File
@@ -42,7 +42,7 @@ from semif_agent.skills import (
build_skills,
build_tree,
generate_category,
generate_skill,
generate_skill_spec,
materialize_skill,
navigate,
)
@@ -380,19 +380,20 @@ def test_generate_category(tmp_path):
def test_generate_skill(tmp_path):
"""Authoring a skill leaf stub through the real `llm` provider."""
"""Authoring a de-identified skill spec through the real `llm` provider."""
config = load_config()
require_real(config)
scheduler, config = build_scheduler(config)
draft = generate_skill(
draft = generate_skill_spec(
scheduler.llm,
Request("tell me if my package was delivered"),
"tracking",
scheduler.tree,
)
print(f"draft: {draft.name!r} — {draft.description!r}")
print(f"draft: {draft.name!r} — {draft.description!r} / goal: {draft.goal!r}")
assert isinstance(draft, SkillDraft)
assert draft.name and draft.description
assert draft.goal
def test_generate_skill_body_codegen(tmp_path):
@@ -415,23 +416,18 @@ def test_generate_skill_body_codegen(tmp_path):
tree = build_tree(build_skills({"skills": {}}))
draft = SkillDraft(
name="check_service",
description="Check whether an HTTP service is reachable.",
)
requirements = {
"How should it connect?": (
"HTTP GET the service_url from config (no auth) and report the "
"status code; treat a non-2xx or unreachable host as a failure."
description="Check whether a generic HTTP service is reachable.",
goal=(
"HTTP GET the service URL from config and report the status code; "
"treat a non-2xx or unreachable host as a failure"
),
"Should it use a test fixture address?": "No; the endpoint comes from config.",
}
request = Request("check whether my home server is reachable")
integration={"service": "http_service", "transport": "http"},
)
code = generate_skill_body(
client,
request,
"tracking",
draft,
tree,
requirements=requirements,
)
print(f"generated {len(code)} bytes of skill body")
integration = parse_integration(code)
@@ -447,7 +443,6 @@ def test_generate_skill_body_codegen(tmp_path):
print(f"data contract: {contract}")
test = generate_skill_tests(
client,
request,
"tracking",
draft,
code,
+47 -153
View File
@@ -21,18 +21,14 @@ from semif_agent.codegen import (
CodegenError,
DegenerationError,
_retry_prompt,
build_elicitation_prompt,
build_skill_body_prompt,
build_testgen_base_prompt,
extract_integration,
generate_requirements,
generate_skill_body,
generate_skill_tests,
infer_integration,
integration_findings,
parse_contract,
parse_elicitation,
parse_elicitation_result,
parse_integration,
parse_skill_body,
parse_skill_test,
@@ -43,7 +39,6 @@ from semif_agent.codegen import (
skill_contract_ref,
)
from semif_agent.bridges.registry import describe_bridges
from semif_agent.decisions import Request
from semif_agent.skills import (
Skill,
SkillDraft,
@@ -197,7 +192,7 @@ def test_testgen_contract_embeds_fixtures_inline():
assert "not** proof that the real integration works" in text
def test_build_skill_body_prompt_includes_contract_request_and_draft():
def test_build_skill_body_prompt_includes_contract_goal_and_draft():
tree = build_tree(build_skills({"skills": {}}))
tree["tracking"] = [
Skill(
@@ -206,24 +201,39 @@ def test_build_skill_body_prompt_includes_contract_request_and_draft():
description="Check the delivery status of a package.",
)
]
draft = SkillDraft(name="probe", description="Probe the service.")
messages = build_skill_body_prompt(
Request("check if the service is up"), "tracking", draft, tree, "THE CONTRACT"
draft = SkillDraft(
name="probe",
description="Probe the service.",
goal="query a generic service health endpoint and report its status",
)
messages = build_skill_body_prompt("tracking", draft, tree, "THE CONTRACT")
assert messages[0]["role"] == "system"
assert "THE CONTRACT" in messages[0]["content"]
joined = messages[1]["content"]
assert "check if the service is up" in joined
assert "query a generic service health endpoint" in joined
assert "probe" in joined
assert "tracking.check" in joined
def test_build_skill_body_prompt_never_carries_the_request():
"""The codegen endpoint must never see user-specific task data: only the
de-identified spec reaches it."""
tree = build_tree(build_skills({"skills": {}}))
draft = SkillDraft(
name="probe",
description="Probe the service.",
goal="query a generic service health endpoint",
)
messages = build_skill_body_prompt("tracking", draft, tree, "THE CONTRACT")
joined = messages[1]["content"]
assert "Request:" not in joined
assert "SENTINEL" not in joined
def test_build_skill_body_prompt_directs_runner_provided_data():
tree = build_tree(build_skills({"skills": {}}))
draft = SkillDraft(name="probe", description="Probe the service.")
messages = build_skill_body_prompt(
Request("check if the service is up"), "tracking", draft, tree, "THE CONTRACT"
)
messages = build_skill_body_prompt("tracking", draft, tree, "THE CONTRACT")
joined = messages[1]["content"]
assert "owns no working data" in joined
assert "`ctx.config`" in joined
@@ -231,25 +241,8 @@ def test_build_skill_body_prompt_directs_runner_provided_data():
assert "internal/mock data model" not in joined
def test_build_skill_body_prompt_includes_requirements():
tree = build_tree(build_skills({"skills": {}}))
draft = SkillDraft(name="probe", description="Probe the service.")
messages = build_skill_body_prompt(
Request("check if the service is up"),
"tracking",
draft,
tree,
"THE CONTRACT",
requirements={"Should it actually send, or draft first?": "draft first"},
)
joined = messages[1]["content"]
assert "Requirements gathered from the product owner" in joined
assert "draft first" in joined
def test_retry_prompt_directs_runner_provided_data():
messages = _retry_prompt(
Request("check if the service is up"),
"tracking",
SkillDraft(name="probe", description="Probe the service."),
"THE CONTRACT",
@@ -536,7 +529,7 @@ def test_generate_skill_body_end_to_end(tmp_path):
client = CodegenClient(base_url=base, model="test", timeout=10)
tree = build_tree(build_skills({"skills": {}}))
draft = SkillDraft(name="probe", description="Probe the service.")
code = generate_skill_body(client, Request("is the service up?"), "tracking", draft, tree)
code = generate_skill_body(client, "tracking", draft, tree)
assert "def act" in code and "CONTRACT" in code
finally:
httpd.shutdown()
@@ -552,7 +545,7 @@ def test_sent_payload_system_message_contains_contract_phrase():
client = CodegenClient(base_url=base, model="test", timeout=10)
tree = build_tree(build_skills({"skills": {}}))
draft = SkillDraft(name="probe", description="Probe the service.")
generate_skill_body(client, Request("is the service up?"), "tracking", draft, tree)
generate_skill_body(client, "tracking", draft, tree)
sent = httpd.RequestHandlerClass.received[0]
system = sent["messages"][0]["content"]
assert "data/skills" in system
@@ -569,7 +562,7 @@ def test_generate_skill_body_retries_then_fails(tmp_path):
tree = build_tree(build_skills({"skills": {}}))
draft = SkillDraft(name="probe", description="Probe the service.")
with pytest.raises(ValueError):
generate_skill_body(client, Request("is the service up?"), "tracking", draft, tree)
generate_skill_body(client, "tracking", draft, tree)
finally:
httpd.shutdown()
httpd.server_close()
@@ -580,7 +573,7 @@ def test_codegen_client_unreachable_raises(tmp_path):
tree = build_tree(build_skills({"skills": {}}))
draft = SkillDraft(name="probe", description="Probe the service.")
with pytest.raises(CodegenError):
generate_skill_body(client, Request("is the service up?"), "tracking", draft, tree)
generate_skill_body(client, "tracking", draft, tree)
class _SilentOpenAI(BaseHTTPRequestHandler):
@@ -1438,7 +1431,7 @@ def test_generate_skill_body_retries_with_fresh_prompt(tmp_path):
tree = build_tree(build_skills({"skills": {}}))
draft = SkillDraft(name="probe", description="Probe the service.")
code = generate_skill_body(
client, Request("is the service up?"), "tracking", draft, tree
client, "tracking", draft, tree
)
assert "def act" in code and "CONTRACT" in code
reqs = httpd.RequestHandlerClass.received
@@ -1468,7 +1461,7 @@ def test_generate_skill_body_exhausts_max_attempts(tmp_path):
draft = SkillDraft(name="probe", description="Probe the service.")
with pytest.raises(ValueError, match="rejected 3 times"):
generate_skill_body(
client, Request("is the service up?"), "tracking", draft, tree
client, "tracking", draft, tree
)
assert httpd.RequestHandlerClass.chat_calls == 3
finally:
@@ -1537,7 +1530,6 @@ def test_degeneration_error_propagates_without_retry():
with pytest.raises(DegenerationError, match="degeneration detected"):
generate_skill_body(
client,
Request("is the service up?"),
"tracking",
draft,
tree,
@@ -1572,7 +1564,6 @@ def test_other_codegen_error_does_not_retry():
with pytest.raises(CodegenError, match="token budget"):
generate_skill_body(
client,
Request("is the service up?"),
"tracking",
draft,
tree,
@@ -1584,86 +1575,6 @@ def test_other_codegen_error_does_not_retry():
httpd.server_close()
# ---- elicitation ----
def test_elicitation_prompt_contains_examples_and_antipatterns():
tree = build_tree(build_skills({"skills": {}}))
draft = SkillDraft(name="probe", description="Probe the service.")
messages = build_elicitation_prompt(
Request("is the service up?"), "tracking", draft, tree, max_questions=3
)
system = messages[0]["content"]
joined = messages[1]["content"]
assert "product goal" in system
assert "HOW the skill will connect" in system
assert "should the sender address change?" in system
assert "tracking" in joined
for example in (
"against the live service, or produce a reviewable draft",
"how should it connect",
"How does it authenticate",
"successful run look like",
"fail loudly",
):
assert example in system
def test_parse_elicitation():
assert parse_elicitation('{"questions": ["A?", "B?"]}') == ["A?", "B?"]
assert parse_elicitation('Sure:\n{"questions": [" A? "]}') == ["A?"]
assert parse_elicitation('{"questions": []}') == []
with pytest.raises(ValueError):
parse_elicitation("not json")
with pytest.raises(ValueError):
parse_elicitation('{"questions": "nope"}')
def test_generate_requirements_end_to_end():
httpd, base = _sequenced_server(['{"questions": ["Draft or send?", "Which one?"]}'])
try:
client = CodegenClient(base_url=base, model="test", timeout=10)
tree = build_tree(build_skills({"skills": {}}))
draft = SkillDraft(name="probe", description="Probe the service.")
questions = generate_requirements(
client, Request("is the service up?"), "tracking", draft, tree, max_questions=3
)
assert questions == ["Draft or send?", "Which one?"]
finally:
httpd.shutdown()
httpd.server_close()
def test_generate_requirements_truncates_to_max():
httpd, base = _sequenced_server(['{"questions": ["A?", "B?", "C?", "D?"]}'])
try:
client = CodegenClient(base_url=base, model="test", timeout=10)
tree = build_tree(build_skills({"skills": {}}))
draft = SkillDraft(name="probe", description="Probe the service.")
questions = generate_requirements(
client, Request("is the service up?"), "tracking", draft, tree, max_questions=2
)
assert questions == ["A?", "B?"]
finally:
httpd.shutdown()
httpd.server_close()
def test_generate_requirements_degrades_on_parse_failure():
"""Elicitation must never block authoring: a garbage reply degrades to []."""
httpd, base = _sequenced_server(["this is not json at all"])
try:
client = CodegenClient(base_url=base, model="test", timeout=10, max_attempts=2)
tree = build_tree(build_skills({"skills": {}}))
draft = SkillDraft(name="probe", description="Probe the service.")
assert generate_requirements(
client, Request("is the service up?"), "tracking", draft, tree
) == []
assert httpd.RequestHandlerClass.chat_calls == 2
finally:
httpd.shutdown()
httpd.server_close()
# ---- data contract ----
def test_parse_contract_reads_the_module_constant():
@@ -1712,7 +1623,7 @@ def test_generate_skill_tests_shares_contract_context(tmp_path):
client = CodegenClient(base_url=base, model="test", timeout=10)
draft = SkillDraft(name="probe", description="Probe the service.")
test = generate_skill_tests(
client, Request("is the service up?"), "tracking", draft, GOOD_BODY, GOOD_CONTRACT
client, "tracking", draft, GOOD_BODY, GOOD_CONTRACT
)
assert test == GOOD_TEST.strip()
messages = httpd.RequestHandlerClass.received[0]["messages"]
@@ -1761,7 +1672,7 @@ def test_regenerate_skill_body_rewrites_from_raw_evidence(tmp_path):
client = CodegenClient(base_url=base, model="test", timeout=10)
draft = SkillDraft(name="probe", description="Probe the service.")
code = regenerate_skill_body(
client, Request("is the service up?"), "tracking", draft, GOOD_BODY,
client, "tracking", draft, GOOD_BODY,
{"test_output": "test failed with an error", "previous_body": GOOD_BODY},
)
assert "def act" in code and "CONTRACT" in code
@@ -1815,9 +1726,7 @@ def test_body_directives_expose_bridge_services():
def test_body_prompts_require_real_action_and_integration():
tree = build_tree(build_skills({"skills": {}}))
draft = SkillDraft(name="probe", description="Probe the service.")
messages = build_skill_body_prompt(
Request("check if the service is up"), "tracking", draft, tree, "THE CONTRACT"
)
messages = build_skill_body_prompt("tracking", draft, tree, "THE CONTRACT")
joined = messages[1]["content"]
assert "Perform the real action" in joined
assert "INTEGRATION" in joined
@@ -1825,7 +1734,6 @@ def test_body_prompts_require_real_action_and_integration():
assert "service: simplex" in joined
assert "simplex_bridge_url" in joined
retry = _retry_prompt(
Request("check if the service is up"),
"tracking",
draft,
"THE CONTRACT",
@@ -1843,9 +1751,7 @@ def test_body_prompt_carries_the_advisory_integration_hint():
description="Probe the service.",
integration={"service": "simplex", "transport": "http"},
)
messages = build_skill_body_prompt(
Request("send a message"), "messaging", draft, tree, "THE CONTRACT"
)
messages = build_skill_body_prompt("messaging", draft, tree, "THE CONTRACT")
joined = messages[1]["content"]
assert "advisory only" in joined
assert "service=simplex" in joined
@@ -1861,12 +1767,11 @@ def test_regen_prompt_includes_catalog_and_integration_hint():
integration={"service": "simplex", "transport": "http"},
)
messages = _regen_body_prompt(
Request("send a message"),
"messaging",
draft,
"THE CONTRACT",
GOOD_BODY,
{"error": "boom"},
{"failure_kind": "a real run against the live service failed"},
reason_kind="run_failure",
)
joined = messages[1]["content"]
@@ -1877,26 +1782,29 @@ def test_regen_prompt_includes_catalog_and_integration_hint():
def test_testgen_base_prompt_includes_catalog():
draft = SkillDraft(name="send_message", description="Send a message.")
messages = build_testgen_base_prompt(
Request("send a message"), "messaging", "send_message", GOOD_BODY, "THE CONTRACT"
"messaging", draft, GOOD_BODY, "THE CONTRACT"
)
joined = messages[1]["content"]
assert describe_bridges().strip() in joined
assert "simplex_bridge_url" in joined
def test_retry_prompt_carries_requirements():
def test_retry_prompt_carries_goal_and_not_the_request():
messages = _retry_prompt(
Request("check if the service is up"),
"tracking",
SkillDraft(name="probe", description="Probe the service."),
SkillDraft(
name="probe",
description="Probe the service.",
goal="query a generic service health endpoint",
),
"THE CONTRACT",
ValueError("bad"),
requirements={"Which service?": "Nextcloud"},
)
joined = messages[1]["content"]
assert "Requirements gathered from the product owner" in joined
assert "Which service? -> Nextcloud" in joined
assert "query a generic service health endpoint" in joined
assert "Request:" not in joined
def test_regen_prompt_hands_raw_evidence_bundle():
@@ -1904,9 +1812,9 @@ def test_regen_prompt_hands_raw_evidence_bundle():
draft = SkillDraft(name="probe", description="Probe the service.")
evidence = {
"request": "send the report",
"failure_kind": "a real run against the live service failed",
"description": "Probe the service.",
"requirements": {"Should it really send?": "yes"},
"goal": "query a generic service health endpoint",
"INTEGRATION": {"service": "mail", "transport": "smtp"},
"findings": ["INTEGRATION declares transport 'smtp' but the body shows no smtp calls"],
"verdict": "reconsider",
@@ -1914,7 +1822,6 @@ def test_regen_prompt_hands_raw_evidence_bundle():
"previous_body": GOOD_BODY,
}
messages = _regen_body_prompt(
Request("send the report"),
"tracking",
draft,
"THE CONTRACT",
@@ -1930,7 +1837,7 @@ def test_regen_prompt_hands_raw_evidence_bundle():
assert "smtp" in joined
# The bundle is rendered as-is, no prose diagnosis headers.
assert "Review finding" not in joined
assert render_evidence(evidence).startswith("request: send the report")
assert render_evidence(evidence).startswith("failure_kind: a real run")
def test_render_evidence_is_deterministic_and_handles_missing():
@@ -2011,19 +1918,6 @@ def test_integration_findings_flag_mismatches():
assert any("INTEGRATION" in finding for finding in inferred)
def test_parse_elicitation_result_reads_integration_hint():
result = parse_elicitation_result(
'{"questions": ["Which service?"], '
'"integration": {"service": "nextcloud_calendar", "transport": "caldav"}}'
)
assert result.questions == ["Which service?"]
assert result.integration == {"service": "nextcloud_calendar", "transport": "caldav"}
bad = parse_elicitation_result(
'{"questions": [], "integration": {"service": "Nope!", "transport": "smtp"}}'
)
assert bad.integration == {}
def test_testgen_prompt_requires_loopback_fixture_and_hermeticity():
base = [
{"role": "system", "content": "TESTGEN"},
+220
View File
@@ -0,0 +1,220 @@
"""Codegen privacy invariant: the (primarily-cloud) codegen endpoint is shown
ONLY a de-identified spec.
The user's request, question answers, and run output must never reach a codegen
prompt (body, retry, regen, or testgen). These tests assert that structurally
(the builders take no `Request`) and behaviourally (no captured message contains
a sentinel that only ever lived in the request/run data).
"""
from __future__ import annotations
import inspect
from semif_agent.codegen import (
_regen_body_prompt,
_retry_prompt,
build_skill_body_prompt,
build_testgen_base_prompt,
generate_skill_body,
generate_skill_tests,
regenerate_skill_body,
)
from semif_agent.decisions import Request
from semif_agent.llm import LLMClient
from semif_agent.log import DecisionLog
from semif_agent.scheduler import Scheduler
from semif_agent.skill import RunResult
from semif_agent.skills import ActionResult, CategoryRegistry, Skill, SkillDraft
from semif_agent.trace import TraceLog
from tests.conftest import ScriptedEngine
#: Values that ONLY appear in the user's request / run output. Any of these in a
#: codegen message would be a leak.
SENTINELS = [
"Dana",
"dana@corp.example",
"Project Falcon",
"Oct 15",
"hunter2",
"4111 1111 1111 1111",
]
GOOD_BODY = """\
import urllib.request
from semif_agent.skills import ActionResult
INTEGRATION = {"service": "probe_service", "transport": "http", "config_vars": ["probe_url"]}
CONTRACT = {"probe_url": "The service base URL."}
def act(ctx, request):
url = ctx.config["probe_url"]
with urllib.request.urlopen(f"{url}/status", timeout=15) as resp:
body = resp.read().decode("utf-8")
return ActionResult(action_log=f"GET {url}/status", new_state=body)
"""
GOOD_TEST = "import sys\nprint('ok')\n"
class _RecordingCodegen:
"""Minimal codegen client double that captures every outbound message list."""
stream = False
max_attempts = 1
def __init__(self, reply: str):
self.reply = reply
self.calls: list[list[dict]] = []
def chat(self, messages, max_tokens=None, degeneration_check=None, timeout=None):
self.calls.append(messages)
return self.reply
def all_text(self) -> str:
return "\n".join(
message.get("content", "")
for messages in self.calls
for message in messages
)
def _draft() -> SkillDraft:
return SkillDraft(
name="check_status",
description="Check the status of a generic HTTP service.",
goal="request a service status endpoint and report the response body",
integration={"service": "probe_service", "transport": "http"},
)
def _assert_clean(text: str) -> None:
for sentinel in SENTINELS:
assert sentinel not in text, f"codegen message leaked {sentinel!r}"
def test_prompt_builders_take_no_request():
"""Structural guard: every codegen prompt builder works from the spec only."""
for func in (
build_skill_body_prompt,
_retry_prompt,
_regen_body_prompt,
build_testgen_base_prompt,
generate_skill_body,
regenerate_skill_body,
generate_skill_tests,
):
params = inspect.signature(func).parameters
assert "request" not in params, f"{func.__name__} must not take a Request"
assert "requirements" not in params, (
f"{func.__name__} must not take elicitation answers"
)
def test_body_and_retry_prompts_carry_only_the_deidentified_goal():
tree = {"tracking": []}
draft = _draft()
body = build_skill_body_prompt("tracking", draft, tree, "THE CONTRACT")
retry = _retry_prompt("tracking", draft, "THE CONTRACT", ValueError("bad"))
for messages in (body, retry):
_assert_clean("\n".join(m.get("content", "") for m in messages))
assert draft.goal in body[1]["content"]
assert draft.goal in retry[1]["content"]
def test_generate_skill_body_never_sees_run_or_request_data():
client = _RecordingCodegen(GOOD_BODY)
code = generate_skill_body(client, "tracking", _draft(), {"tracking": []})
assert "def act" in code
_assert_clean(client.all_text())
def test_regenerate_skill_body_evidence_is_deidentified():
client = _RecordingCodegen(GOOD_BODY)
evidence = {
"failure_kind": "a real run against the live service failed",
"goal": _draft().goal,
"previous_body": GOOD_BODY,
}
regenerate_skill_body(client, "tracking", _draft(), GOOD_BODY, evidence)
_assert_clean(client.all_text())
def test_generate_skill_tests_never_sees_the_request():
client = _RecordingCodegen(GOOD_TEST)
tests = generate_skill_tests(
client, "tracking", _draft(), GOOD_BODY, {"probe_url": "URL"}, contract_md="TESTGEN"
)
assert tests.strip()
_assert_clean(client.all_text())
def test_registry_never_stores_the_request_or_answers(tmp_path):
registry = CategoryRegistry(str(tmp_path / "categories.json"))
registry.register_skill(
"tracking",
"check_status",
"Check a service.",
goal="request a service status endpoint and report the response body",
)
row = registry.read()["tracking"]["skills"][0]
assert row["goal"] == "request a service status endpoint and report the response body"
assert "request_text" not in row
assert "requirements" not in row
_assert_clean(str(row))
def _scheduler(tmp_path) -> Scheduler:
return Scheduler(
engine=ScriptedEngine(default="retry"),
llm=LLMClient(base_url="http://localhost:1/v1", model="test"),
log=DecisionLog(str(tmp_path / "decisions.jsonl")),
config={
"skills": {},
"category_registry": str(tmp_path / "categories.json"),
"skill_bodies": str(tmp_path / "skills"),
"skill_seeds": str(tmp_path / "seeds"),
},
trace=TraceLog(str(tmp_path / "runs.jsonl")),
)
def test_repair_evidence_is_deidentified(tmp_path):
"""The bundle handed to codegen on repair carries no request or run output."""
scheduler = _scheduler(tmp_path)
def act(ctx, request):
return ActionResult(action_log="ran", new_state="ran")
skill = Skill(
name="check_status",
category="tracking",
description="Check a service.",
act=act,
)
request = Request(
"email Dana at dana@corp.example about Project Falcon on Oct 15; card 4111 1111 1111 1111"
)
outcome = RunResult(
skill="check_status",
success=False,
summary="failed to reach dana@corp.example",
action_log="POST https://svc returned 401 for hunter2",
new_state="Dana, Project Falcon, Oct 15",
outcome="failed",
error="connection refused for Project Falcon",
)
scheduler._propose_repair(skill, request, outcome)
offer = scheduler.repairs[-1]
evidence = offer.evidence
# Only the de-identified fields are present.
assert "request" not in evidence
assert "action_log" not in evidence
assert "new_state" not in evidence
assert "summary" not in evidence
assert "error" not in evidence
assert evidence["failure_kind"]
_assert_clean(repr(evidence))
+1 -1
View File
@@ -488,7 +488,7 @@ def test_questions_endpoint_roundtrip(tmp_path):
status, payload = server.get("/api/questions")
assert status == 200
assert payload["questions"][0]["id"] == "q1"
assert payload["questions"][0]["kind"] == "elicitation"
assert payload["questions"][0]["kind"] == "repair"
status, payload = server.post("/api/questions", {"id": "q1", "text": "Nextcloud"})
assert payload["status"] == "ok"
+7 -3
View File
@@ -18,7 +18,7 @@ from semif_agent.skills import (
build_skills,
build_tree,
generate_category,
generate_skill,
generate_skill_spec,
)
@@ -106,11 +106,13 @@ def test_generate_category_via_provider():
def test_generate_skill_via_provider():
httpd, base = _fake_server(
'{"title": "track.live", "description": "Follow a package in real time."}'
'{"title": "track.live", "description": "Follow a package in real time.", '
'"goal": "poll a parcel tracking endpoint and report status", '
'"service": "tracking", "transport": "http"}'
)
try:
client = LLMClient(base_url=base, model="test", timeout=10)
draft = generate_skill(
draft = generate_skill_spec(
client,
Request("track my drone delivery"),
"tracking",
@@ -118,6 +120,8 @@ def test_generate_skill_via_provider():
)
assert isinstance(draft, SkillDraft)
assert draft.name == "track.live"
assert draft.goal == "poll a parcel tracking endpoint and report status"
assert draft.integration == {"service": "tracking", "transport": "http"}
finally:
httpd.shutdown()
httpd.server_close()
+44 -130
View File
@@ -51,7 +51,7 @@ from semif_agent.skills import (
CATEGORY_DESCRIPTIONS,
compose_state,
generate_category,
generate_skill,
generate_skill_spec,
last_result,
merge_registry,
merge_seed_store,
@@ -297,7 +297,7 @@ def test_build_tree_includes_registry_stubs(tmp_path):
assert tree["delivery"] == []
def test_build_skill_prompt_contains_request_category_and_skills():
def test_build_skill_prompt_asks_for_a_deidentified_goal():
tree = build_tree(build_skills({"skills": {}}))
tree["tracking"] = [
Skill(
@@ -309,6 +309,9 @@ def test_build_skill_prompt_contains_request_category_and_skills():
messages = build_skill_prompt(Request("tracking for my drone delivery"), "tracking", tree)
assert messages[0]["role"] == "system"
assert "tracking" in messages[0]["content"]
system = messages[0]["content"]
assert "DE-IDENTIFIED" in system
assert '"goal"' in system
joined = messages[1]["content"]
assert "tracking for my drone delivery" in joined
assert "tracking.check" in joined
@@ -320,6 +323,26 @@ def test_parse_skill_draft_plain_json():
)
assert draft.name == "track_live"
assert "real time" in draft.description
# No goal supplied: it degrades to the description (both are de-identified).
assert draft.goal == draft.description
def test_parse_skill_draft_reads_goal_and_integration():
draft = parse_skill_draft(
'{"title": "track_live", "description": "Follow a package.", '
'"goal": "poll a tracking endpoint and report status", '
'"service": "tracking", "transport": "http"}'
)
assert draft.goal == "poll a tracking endpoint and report status"
assert draft.integration == {"service": "tracking", "transport": "http"}
def test_parse_skill_draft_drops_bad_integration_hint():
draft = parse_skill_draft(
'{"title": "track_live", "description": "Follow a package.", '
'"service": "Nope!", "transport": "smtp"}'
)
assert draft.integration == {}
def test_parse_skill_draft_json_in_prose():
@@ -359,7 +382,7 @@ def test_parse_skill_draft_rejects_unclean_title():
def test_generate_skill_without_endpoint_raises():
client = LLMClient(base_url="http://127.0.0.1:1/v1", model="test", timeout=2)
with pytest.raises(LLMError):
generate_skill(client, Request("anything"), "tracking", {})
generate_skill_spec(client, Request("anything"), "tracking", {})
def test_category_registry_register_skill(tmp_path):
@@ -373,27 +396,29 @@ def test_category_registry_register_skill(tmp_path):
{
"name": "track_live",
"description": "Follow a package in real time.",
"request_text": "",
"goal": "",
}
]
assert loaded["brand_new"] == {
"description": "",
"skills": [{"name": "ping", "description": "Probe the service.", "request_text": ""}],
"skills": [{"name": "ping", "description": "Probe the service.", "goal": ""}],
}
def test_category_registry_register_skill_keeps_request_text(tmp_path):
def test_category_registry_register_skill_stores_goal_not_request(tmp_path):
registry = CategoryRegistry(str(tmp_path / "categories.json"))
registry.register_skill(
"delivery",
"track_live",
"Follow a package in real time.",
request_text="track my drone delivery in real time",
goal="poll a parcel tracking endpoint and report status",
)
loaded = registry.read()
assert loaded["delivery"]["skills"][0]["request_text"] == (
"track my drone delivery in real time"
)
row = loaded["delivery"]["skills"][0]
assert row["goal"] == "poll a parcel tracking endpoint and report status"
# The originating request and any user detail are never persisted.
assert "request_text" not in row
assert "requirements" not in row
def test_merge_registry_loads_categories_and_skills(tmp_path):
@@ -1433,7 +1458,7 @@ def test_creation_approval_timeout_denies(tmp_path):
scheduler = _scheduler(tmp_path)
scheduler.new_skill_mode = "ask"
scheduler.defer_questions = True
scheduler.elicitation_wait = 0.1
scheduler.approval_wait = 0.1
job = DraftAuthor(
request=Request("book a trip"), category="travel", kind="skill"
)
@@ -1500,7 +1525,7 @@ def test_author_skill_denied_does_not_register(tmp_path, monkeypatch):
scheduler.new_skill_mode = "ask"
scheduler.defer_questions = True
monkeypatch.setattr(
"semif_agent.scheduler.generate_skill",
"semif_agent.scheduler.generate_skill_spec",
lambda client, request, category, tree: SkillDraft(
name="book_flight", description="Book a flight."
),
@@ -1852,40 +1877,6 @@ def test_unresolved_variables_respects_tiered_config(tmp_path):
assert unresolved_variables(store, skill2, {}) == ["sender_address", "tag"]
assert unresolved_variables(store, skill2, {}, answered={"tag": "per-fire"}) == ["sender_address"]
def test_deferred_elicitation_asks_and_records(tmp_path):
"""Opt-in elicitation runs on the codegen worker (deferred): questions are
posted to the question queue, the worker waits, and the answers ride the
draft into the body prompt."""
httpd, base = _pipeline_codegen_server(
['{"questions": ["Draft or send?"]}']
)
try:
scheduler = _scheduler(tmp_path, codegen=CodegenClient(base_url=base, model="test", timeout=10))
scheduler.defer_questions = True
scheduler.elicitation_enabled = True
request = Request("track my package")
draft = SkillDraft(name="track_live", description="Follow a package.")
job = SkillWrite(request=request, category="tracking", draft=draft)
def answerer() -> None:
deadline = time.monotonic() + 5
while time.monotonic() < deadline:
pending = scheduler.pending_questions()
if pending:
scheduler.answer_question(pending[0]["id"], "draft first")
return
time.sleep(0.02)
thread = threading.Thread(target=answerer)
thread.start()
scheduler._deferred_elicit(job, scheduler.tree)
thread.join()
assert draft.requirements == {"Draft or send?": "draft first"}
assert any(e["kind"] == "requirements" for e in scheduler.trace.read())
finally:
httpd.shutdown()
httpd.server_close()
def test_async_skill_write_regen_ladder_on_failing_test(tmp_path):
"""A failing auto-run test triggers the regen decision (regen_test by
@@ -1967,97 +1958,20 @@ def test_answer_question_unknown_id_errors(tmp_path):
assert "no pending question" in detail
def test_post_questions_asks_one_at_a_time(tmp_path):
scheduler = _scheduler(tmp_path)
scheduler.elicitation_answer_timeout = 5.0
job = SkillWrite(
request=Request("track it"),
category="tracking",
draft=SkillDraft(name="probe", description="Probe."),
)
result: dict = {}
thread = threading.Thread(
target=lambda: result.update(scheduler._post_questions(job, ["Q1?", "Q2?"]))
)
thread.start()
# ---- goal persistence ----
def next_pending(deadline: float) -> list:
while time.monotonic() < deadline:
pending = scheduler.pending_questions()
if pending:
return pending
time.sleep(0.02)
return []
deadline = time.monotonic() + 5
first = next_pending(deadline)
assert [q["question"] for q in first] == ["Q1?"]
scheduler.answer_question(first[0]["id"], "A1")
second = next_pending(deadline)
assert [q["question"] for q in second] == ["Q2?"]
scheduler.answer_question(second[0]["id"], "")
thread.join(timeout=5)
assert result == {"Q1?": "A1"}
assert scheduler.pending_questions() == []
kinds = [e["kind"] for e in scheduler.trace.read()]
assert "questions_asked" in kinds
# An empty answer is accepted (the question is dismissed), not a timeout.
assert "questions_timeout" not in kinds
def test_post_questions_timeout_drops_remaining(tmp_path):
scheduler = _scheduler(tmp_path)
scheduler.elicitation_answer_timeout = 0.2
job = SkillWrite(
request=Request("track it"),
category="tracking",
draft=SkillDraft(name="probe", description="Probe."),
)
result: dict = {}
thread = threading.Thread(
target=lambda: result.update(scheduler._post_questions(job, ["Q1?", "Q2?"]))
)
thread.start()
deadline = time.monotonic() + 3
while time.monotonic() < deadline:
pending = scheduler.pending_questions()
if pending:
scheduler.answer_question(pending[0]["id"], "A1")
break
time.sleep(0.02)
thread.join(timeout=3)
assert result == {"Q1?": "A1"}
assert scheduler.pending_questions() == []
events = [e for e in scheduler.trace.read() if e["kind"] == "questions_timeout"]
assert events and events[-1]["answered"] == 1 and events[-1]["asked"] == 2
def test_post_questions_times_out(tmp_path):
scheduler = _scheduler(tmp_path)
scheduler.elicitation_answer_timeout = 0.1
job = SkillWrite(
request=Request("track it"),
category="tracking",
draft=SkillDraft(name="probe", description="Probe."),
)
assert scheduler._post_questions(job, ["Q?"]) == {}
assert scheduler.pending_questions() == []
assert any(e["kind"] == "questions_timeout" for e in scheduler.trace.read())
# ---- requirements persistence ----
def test_registry_stores_requirements_for_restart(tmp_path):
def test_registry_stores_goal_for_restart(tmp_path):
registry = CategoryRegistry(str(tmp_path / "categories.json"))
registry.register_skill(
"tracking", "probe", "Probe.", request_text="track it",
requirements={"Which service?": "Nextcloud"},
"tracking", "probe", "Probe.",
goal="poll a tracking endpoint and report status",
)
row = registry.read()["tracking"]["skills"][0]
assert row["requirements"] == {"Which service?": "Nextcloud"}
assert row["goal"] == "poll a tracking endpoint and report status"
assert "request_text" not in row and "requirements" not in row
scheduler = _scheduler(tmp_path)
draft = scheduler._stub_draft("tracking", "probe")
assert draft.requirements == {"Which service?": "Nextcloud"}
assert draft.goal == "poll a tracking endpoint and report status"
# ---- repair loop ----