ship BRAINSTORM item 1: folder skill store, contract+testgen, config tiering

Skill leaves become folders (skill.py, skill.test.py, contract.json,
mock_data.json, config.json); clean switch, old single-file layout ignored.
SKILL.md owns the runner-data doctrine (no mock data); TESTGEN.md owns
mocking/testing. Async authoring pipeline: codegen body -> decoupled contract
gen -> shared-context testgen -> subprocess auto-run test with a 4-option SemIf
regen ladder (trace-only). Opt-in requirements elicitation (REPL asker) with
anti-pattern guardrails. Config search auto-populates skill config via SemIf
(global -> category); runner resolves tiers into ctx.config and pauses
pre-predict for unresolved contract vars with record/ask-again choices.
This commit is contained in:
Denton Social committed 2026-09-25 22:46:07 -05:00
1 parent 927f66b696
commit ddd2495f81
14 files changed
+1946 -164

No files matched your search

+25 -15
View File
@@ -5,6 +5,9 @@ body must be written. It is fed verbatim to the code-generation model so every
generated skill is consistent, and it is read by humans who want to know what a
good skill looks like.
The mocking/testing side of a skill is NOT specified here — it has its own
contract, `TESTGEN.md`. This file is about the runnable body only.
## What a skill is
A skill is a **leaf** in the agent's skill tree, reached by a chain of SemIf
@@ -38,8 +41,8 @@ skill is exercised.
## Code body contract
The generated module is persisted to `data/skills/<category>/<name>.py` and
imported at runtime. It must satisfy **all** of the following:
The generated module is persisted to `data/skills/<category>/<name>/skill.py`
and imported at runtime. It must satisfy **all** of the following:
### Required functions
@@ -52,7 +55,7 @@ def act(ctx, request, prediction) -> ActionResult:
```
- `ctx` is an `ActionContext` with `ctx.engine` (the real SemIf engine) and
`ctx.config` (the agent config dict).
`ctx.config` (the merged agent config, including this skill's own config).
- `request` is the `Request` being handled.
- `Prediction(text: str, decisions: list)` and
`ActionResult(action_log: str, new_state: str, needs_input: str | None = None)`
@@ -72,20 +75,22 @@ def act(ctx, request, prediction) -> ActionResult:
- **Never swallow the request.** If the skill cannot act, return an
`ActionResult` with a short `action_log` explaining why and set `new_state`
back to `request.text`.
- **Reusable module with its own data model.** A skill body is executed across
many requests — it is a reusable module, never a one-shot exchange. It must
not rely on the human to supply its working data at predict/act time. The
skill owns its source of truth: a self-contained internal/mock data model
(module-level fixtures or config-file-backed state). The REPL input path is
for clarifying questions only — never the primary data source.
- **Data comes from the runner, never from you.** A skill body is executed
across many requests and owns no working data. Every 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, never
invent mock data, and never ask the human for operational data. Whether a
value is remembered across runs (config) or collected fresh each fire (input)
is decided by the config step at first fire — treat every variable the same
here: read it from `ctx.config`. Choose names a reader can extract into a
contract (e.g. `sender_address`, `tracking_id`).
- **Request input for clarification when requirements are unclear from the
prompt.** If the human's intent is ambiguous, do not guess: return an
`ActionResult(action_log="...", new_state=request.text, needs_input="<question>")`.
The run pauses and the human answers on `request.user_input`; `act` is then
called again with the *same* prediction — check `request.user_input` on the
resume pass to finish the run. This disambiguates intent only, never
operational data — a skill asking for data it should own (tracking IDs,
coordinates, statuses) is missing its data model.
resume pass to finish the run. This refines the product goal and requirements
only — never operational data (the runner supplies that).
- **Write files under configured data dirs only** (e.g. `ctx.config["drafts"]`),
never anywhere else on disk.
- **Fail fast on budget.** Keep the work small; do not loop or retry in code.
@@ -100,6 +105,9 @@ def act(ctx, request, prediction) -> ActionResult:
sub-decisions, mirroring how `email.compose` resolves its recipient.
- `act` performs the concrete action and writes a human-readable `action_log`
that the self-assessment LLM can judge.
- Act like a developer eliciting requirements from a product owner: when the
prompt leaves a behavioral choice open, prefer a clarifying `needs_input`
over guessing — a clarifying question is cheaper than a wrong body.
## Acceptance criteria
@@ -112,6 +120,8 @@ A generated skill is accepted only if:
4. It uses `ctx.engine` (never mocks) and returns proper `Prediction` /
`ActionResult` types.
5. It is single-purpose and does not duplicate an existing category leaf.
6. Every operational value it needs is read from `ctx.config` under a clear
snake_case name — nothing is embedded, fabricated, or asked of the human.
## Worked example
@@ -120,7 +130,7 @@ draft file:
```python
def predict(ctx, request):
contacts = read_contacts(ctx.config) # config-driven, local data
contacts = read_contacts(ctx.config) # runner-provided data
decision = DecisionRequest(
state=f"{request.text} [current process: none]",
question="Which contact is the intended recipient?",
@@ -144,5 +154,5 @@ def act(ctx, request, prediction):
```
Write skill bodies in this shape: resolve ambiguity in `predict` via
`ctx.engine`, do the work in `act`, keep both stdlib-only, and return the
proper types.
`ctx.engine`, do the work in `act`, keep both stdlib-only, read data from
`ctx.config`, and return the proper types.