sil-openclaw 0.2.3 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/skill/SKILL.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: sil
3
- description: This skill should be used when the user wants to shop on sil — register an identity, see who they are, search the catalog for purchasable products, or look up specific products by id. The plugin exposes sil_register, sil_whoami, sil_search, and sil_product_get.
3
+ description: This skill should be used when the user wants to shop on sil — register an identity, see who they are, search the catalog for purchasable products, or look up specific products by id — or when they want to create a dedicated sil-wired shopping expert (a new OpenClaw agent profile) and then list, view, or remove the experts they have created. The plugin exposes sil_register, sil_whoami, sil_search, sil_product_get, sil_profile_materialize, sil_profile_list, sil_profile_get, and sil_profile_remove.
4
4
  metadata:
5
5
  openclaw:
6
6
  emoji: "\U0001F6D2"
@@ -8,55 +8,48 @@ metadata:
8
8
 
9
9
  # sil
10
10
 
11
- ## 1. Role
11
+ Drive the sil plugin's tools on the user's behalf: register them on sil, read their identity, help them find purchasable products in the sil catalog — and, when asked, create a dedicated sil-wired shopping expert, then list, view, or remove the experts they have created. Read user intent, route to the matching tool (loading its reference on demand), call it, and report what came back.
12
12
 
13
- Drive the sil plugin's tools on the user's behalf: register them on sil, read their identity, and help them find purchasable products in the sil catalog. Read user intent, pick the matching tool, call it, and report what came back.
13
+ ## Always-on behavioural contract
14
14
 
15
- Principles:
15
+ These three principles hold on every path, before any reference is loaded:
16
16
 
17
17
  - **Act, don't narrate.** When intent maps to a tool, call it. Don't re-confirm what was already stated.
18
- - **Fail visibly, recover correctly.** Every tool returns a `status`. On a non-`ok` status, say what happened and follow the tool's own `recovery` hint — never improvise a different one (re-registering can't fix a bad query or a transient 5xx, and would derail the user).
18
+ - **Fail visibly, recover correctly.** Every tool returns a `status`. On a non-`ok` status, say what happened and follow the tool's own `recovery` hint — never improvise a different one.
19
19
  - **Relay prices as point-in-time.** A product's price, availability, and `checkout_url` are a snapshot, not a guarantee. Before the user buys, re-fetch with `sil_product_get` rather than trusting an earlier `sil_search` result.
20
20
 
21
- ## 2. Session start
21
+ ## Session start
22
22
 
23
- Confirm the `sil_*` tools are exposed. If they are missing from the available tool list, the host runtime is filtering them out — tell the user to consult the host's tool-allowlist docs and stop.
23
+ Confirm the `sil_*` tools are exposed. If they are missing from the available tool list, the host runtime is filtering them out — tell the user to consult the host's tool-allowlist docs and stop. Most flows need an identity: if the user has not registered this session, the catalog tools return an unregistered status whose `recovery` points at `sil_register` (the [catalog tools reference](references/catalog_tools_reference.md) has the full taxonomy) — so calling a catalog tool first lets that outcome route, or run `sil_register` up front when the user's intent clearly requires it.
24
24
 
25
- Most flows need an identity. If the user has not registered this session, the catalog tools return `status: "not_registered"` with `recovery: "sil_register"` — so you can call a catalog tool first and let that outcome route you, or run `sil_register` up front when the user's intent clearly requires it.
25
+ ## Routing — match intent to a tool, load its reference on demand
26
26
 
27
- ## 3. Acting on user intent
28
-
29
- When intent maps to a tool, execute:
30
-
31
- | Intent | Tool |
32
- |---|---|
33
- | "sign me up" / "log me in to sil" / "register" | `sil_register` (takes no arguments; returns an auth URL to open in a browser) |
34
- | "who am I?" / "what's on my account" / show my saved name + addresses | `sil_whoami` (takes no arguments) |
35
- | "find X" / "search for X" / browse a category or price range | `sil_search` (free-text `query` and/or `category`, `price_min`, `price_max`; paginate with `cursor`/`limit`) |
36
- | "look up these items" / re-check ids from a prior result, a saved list, or a deep link | `sil_product_get` (pass `ids` — one or more product/variant ids) |
27
+ | Intent | Tool | Reference to load |
28
+ |---|---|---|
29
+ | "sign me up" / "log me in to sil" / "register" | `sil_register` | [`references/catalog_tools_reference.md`](references/catalog_tools_reference.md) |
30
+ | "who am I?" / "what's on my account" / show my saved name + addresses | `sil_whoami` | [`references/catalog_tools_reference.md`](references/catalog_tools_reference.md) |
31
+ | "find X" / "search for X" / browse a category or price range | `sil_search` | [`references/catalog_tools_reference.md`](references/catalog_tools_reference.md) |
32
+ | "look up these items" / re-check ids from a prior result, a saved list, or a deep link | `sil_product_get` | [`references/catalog_tools_reference.md`](references/catalog_tools_reference.md) |
33
+ | "make me a shopping expert" / "set up an agent that shops for me" / build a dedicated shopping expert | (interview, then the engine) | see the two-step gate below |
34
+ | "what experts do I have?" / "list my experts" | `sil_profile_list` | [`references/manage_experts.md`](references/manage_experts.md) |
35
+ | "show me / tell me about <expert>" | `sil_profile_get` | [`references/manage_experts.md`](references/manage_experts.md) |
36
+ | "remove / delete <expert>" | `sil_profile_remove` (host-CLI-first — see the reference) | [`references/manage_experts.md`](references/manage_experts.md) |
37
+ | (inside a created expert) a shopping intent — "find me something for X" on the expert's niche | `sil_search` → `sil_product_get` (driven by the loaded profile) | [`references/expert_shopping.md`](references/expert_shopping.md) |
38
+ | "refine / sharpen / improve <expert>" / "the gift buyer keeps surfacing the wrong stuff — fix it" | (load → propose → confirm → persist — see the reference) | [`references/refine_expert.md`](references/refine_expert.md) |
37
39
 
38
- How each behaves:
40
+ [`references/catalog_tools_reference.md`](references/catalog_tools_reference.md) holds the per-tool behaviour for the four core tools and the shared status taxonomy. Basic shopping needs only that one reference.
39
41
 
40
- - **`sil_register`** starts browser-based registration. It returns promptly with `status: "awaiting_browser"` and an `auth_url` — share that URL with the user. The plugin polls in the background; once the user finishes signing in, call `sil_register` again to confirm (it reports `already_registered`).
41
- - **`sil_whoami`** returns the registered user's identity (name and addresses). An expired access token is refreshed transparently and the read retried; if the session is fully dead, the result names the recovery (`sil_register`).
42
- - **`sil_search`** returns a ranked list of purchasable variants (`id`, `title`, `price`, `availability`, `checkout_url`, `source`), best match first — present them in order, do not re-rank. An empty list means nothing matched: a normal `ok` outcome, not an error. Use the returned `cursor` for the next page; its absence means no more results (never infer end-of-results from page size).
43
- - **`sil_product_get`** is the lookup companion to `sil_search`. Pass ids you already hold and get the matching products back with fresh detail (description, options, the featured variant). Each variant carries an `inputs` list correlating it back to the id(s) you asked about (the response is NOT in request order). Ids that no longer resolve come back in a `not_found` list — a normal partial-success outcome, not an error; the other products are still valid.
42
+ When the session is running **inside a created expert** (a loaded profile under `$SIL_DATA_DIR/agents/<agentId>/`) and the user states a shopping intent, follow [`references/expert_shopping.md`](references/expert_shopping.md) — the profile-driven shop-time loop. It is additive: a plain, profile-less session keeps shopping via the "find X" → `sil_search` row above, unchanged.
44
43
 
45
- All four return the canonical envelope: a single text content block whose JSON body carries a `status`. Prices are in the currency's ISO 4217 minor unit (e.g. cents).
44
+ [`references/manage_experts.md`](references/manage_experts.md) holds the list / view / remove flow for the experts the user has created — including the host-CLI-first remove ordering and the confirm-before-remove gate. Load it the moment the user wants to see or remove an existing expert.
46
45
 
47
- ### Status taxonomy (shared across the tools)
46
+ [`references/refine_expert.md`](references/refine_expert.md) holds the refinement loop for an *existing* expert — sharpening it from observed sessions, with a confirm-before-persist gate (nothing changes silently). Load it when the user wants to refine, sharpen, or amend an expert they already have.
48
47
 
49
- | `status` | Meaning | What to do |
50
- |---|---|---|
51
- | `ok` | Success. Catalog results may be empty (`products: []`) or partial (`not_found: [...]`) — still a success. | Relay the data. |
52
- | `not_registered` | No stored credentials. | Run `sil_register`, then retry the tool. |
53
- | `must_reregister` | The session is dead (refresh rejected / 401). | Run `sil_register` to sign in again, then retry. |
54
- | `forbidden` | Authenticated but not authorized (e.g. account not provisioned). | Follow the message; usually complete onboarding via `sil_register`. |
55
- | `invalid_request` | The query/ids were rejected (e.g. empty input). | Fix the input and call again — do NOT re-register. |
56
- | `retryable` | A transient network/5xx blip. | Try the same call again — do NOT re-register. |
48
+ ### Creating a shopping expert — the endorsement-gated two-step
57
49
 
58
- ## 4. Adding a real tool
50
+ When the user asks to create / set up / build a dedicated shopping expert:
59
51
 
60
- The mechanical steps live in the repo's `CLAUDE.md` ("How to add a tool"); the short version is three steps: register the tool inside a `registerXTools(api)` group in `src/tools/`, wire that group into `register()` in `src/index.ts`, and add the tool's name to `openclaw.plugin.json#contracts.tools`. The manifest↔code drift-guard test fails if those disagree, which keeps the pattern self-enforcing.
52
+ 1. **Interview first.** Read and run [`references/brainstorm_interview.md`](references/brainstorm_interview.md) — the open, back-and-forth interview that converges a tailored spec *with* the user. While running it, load [`references/search_param_mapping.md`](references/search_param_mapping.md) when authoring the answer→`sil_search`-param mapping section.
53
+ 2. **Engine only after explicit endorsement.** Only after the user explicitly endorses the assembled draft, read and follow [`references/agent_creation_engine.md`](references/agent_creation_engine.md) — the ordered engine that persists the sil-wired agent. Running ANY engine step before that explicit endorsement is forbidden (the interview reference owns the endorsement gate).
61
54
 
62
- The reference group is `src/tools/identity.ts` (`sil_register`, `sil_whoami`) — it sets the `jsonResult` success shape and the structured-error/recovery envelope every real tool follows; `src/tools/catalog.ts` (`sil_search`, `sil_product_get`) is the catalog counterpart. All I/O lives inside a tool's `execute()`; `register()` stays synchronous and opens nothing.
55
+ Want a concrete walkthrough? [`examples/road_cycling_expert_walkthrough.md`](examples/road_cycling_expert_walkthrough.md) is an end-to-end worked example: a free-form request → interview convergence → assembled spec → created expert.
@@ -0,0 +1,106 @@
1
+ # Worked example — a road-cycling shopping expert, end to end
2
+
3
+ A complete walkthrough from a free-form request through the interview ([`../references/brainstorm_interview.md`](../references/brainstorm_interview.md)) to a created expert via the engine ([`../references/agent_creation_engine.md`](../references/agent_creation_engine.md)). The transcript is illustrative — a real interview adapts to the user; this shows the *shape* of convergence and the load-bearing gates.
4
+
5
+ ## 1. The free-form request
6
+
7
+ > **User:** "I want an expert that shops for road-cycling gear for me."
8
+
9
+ Reflect the request back and open with one orienting question — not a form:
10
+
11
+ > **Expert:** "A shopping expert for road-cycling gear — let's shape it together. We can revise anything as we go. To start: are you after a complete bike, or kit and components (wheels, groupsets, apparel)?"
12
+
13
+ ## 2. Narrow the (vague) domain FIRST
14
+
15
+ "Road-cycling gear" is broad. Narrow it before any other section:
16
+
17
+ > **User:** "Mostly components and apparel — I already have a frame."
18
+ > **Expert:** "Got it — so the niche is **road-cycling components & apparel for an existing frame** (wheels, groupsets, finishing kit, clothing), not complete bikes. Does that capture it?"
19
+ > **User:** "Yes."
20
+
21
+ The concrete, confirmed niche is locked before persona/mapping/rubric — the narrow-first gate is satisfied.
22
+
23
+ ## 3. Converge the persona (section 2)
24
+
25
+ > **Expert:** "How should this expert come across — a terse spec-checker, or a chatty guide who explains trade-offs? Any standing rules?"
26
+ > **User:** "Knowledgeable but concise. Always flag compatibility issues with my groupset. No carbon-fibre handlebars — I don't trust them."
27
+ > **Expert:** "Persona: a concise, knowledgeable road-cycling components advisor; standing rules — always flag groupset compatibility, never recommend carbon handlebars. Good?"
28
+ > **User:** "Perfect."
29
+
30
+ → lands in `persona`.
31
+
32
+ ## 4. Converge the three playbook sections (3–5)
33
+
34
+ **Elicitation style:**
35
+ > **Expert:** "When you ask it to shop, should it search right away on a one-line request, or ask a clarifying question or two first?"
36
+ > **User:** "Ask at most one clarifying question, then search."
37
+
38
+ **Answer→`sil_search`-param mapping** (loading [`../references/search_param_mapping.md`](../references/search_param_mapping.md)):
39
+ > **Expert:** "For components the decision-attributes are budget, groupset tier, new vs. secondhand, and where you buy. Where do you stand?"
40
+ > **User:** "Budget around €1200, secondhand is fine, I'm in France and prefer local shops."
41
+
42
+ Translating each stated input to a real param:
43
+
44
+ ```
45
+ query: "road-cycling components 105 groupset" # niche descriptors
46
+ category: "cycling-components"
47
+ price_max: 120000 # €1200 → minor units (cents)
48
+ condition: ["secondhand"] # "secondhand is fine"
49
+ local_merchants: true # "prefer local shops" → ranking bias; query issued in French
50
+ # ship_to: OMITTED — server resolves the registered default address; no sil_whoami round-trip
51
+ ```
52
+
53
+ **Recommendation rubric:**
54
+ > **Expert:** "What matters most when I pick among results?"
55
+ > **User:** "Compatibility first, then value, then weight. Brand X is a hard no."
56
+
57
+ → Rubric: rank by groupset compatibility, then value, then weight; exclude brand X. Tied to the user's *stated* priorities, not a fixed order.
58
+
59
+ All three sections are authored as prose into the single `playbook` string.
60
+
61
+ ## 5. Derive + confirm the identity
62
+
63
+ > **Expert:** "I'll call it **Road-Cycling Buyer** (`road-cycling-buyer`). Good?"
64
+ > **User:** "Yes."
65
+
66
+ → `agentId: road-cycling-buyer` (lower-kebab, ≠ `main`), `name: "Road-Cycling Buyer"`.
67
+
68
+ ## 6. Assemble the draft and present it back
69
+
70
+ The assembled spec — a valid `sil_profile_materialize` input:
71
+
72
+ ```jsonc
73
+ {
74
+ "agentId": "road-cycling-buyer",
75
+ "name": "Road-Cycling Buyer",
76
+ "persona": "A concise, knowledgeable road-cycling components advisor. Standing rules: always flag groupset compatibility; never recommend carbon-fibre handlebars.",
77
+ "playbook": "## Elicitation style\nAsk at most one clarifying question, then search.\n\n## Answer→sil_search-param mapping\n- Budget → price_min/price_max (minor units). Secondhand-ok → condition: [\"secondhand\"]. Local shops → local_merchants: true, query in French. ship_to left empty (server resolves the registered default; no sil_whoami round-trip).\n\n## Recommendation rubric\nRank by groupset compatibility, then value, then weight. Brand X is a hard no."
78
+ }
79
+ ```
80
+
81
+ > **Expert:** "Here's the expert: a concise components advisor that flags compatibility, searches secondhand within ~€1200, biases to local French shops, and ranks compatibility → value → weight. Shall I create it?"
82
+
83
+ ## 7. Explicit endorsement — the gate
84
+
85
+ > **User:** "Yes, create it."
86
+
87
+ **This affirmative act is the gate.** Up to this point, **zero engine steps have run** — nothing was written. Only now does the engine proceed.
88
+
89
+ ## 8. Run the engine (after endorsement)
90
+
91
+ Following [`../references/agent_creation_engine.md`](../references/agent_creation_engine.md) in order:
92
+
93
+ 1. **Validate the spec FIRST** — `agentId` lower-kebab & ≠ `main` ✓, `name` non-blank ✓, `persona` non-blank ✓, `workspace` present ✓.
94
+ 2. **Collision check** — `openclaw agents list --json`; no existing `road-cycling-buyer` → proceed.
95
+ 3. **Create the shell** — `openclaw agents add road-cycling-buyer --workspace ~/.openclaw/workspace-road-cycling-buyer --non-interactive --json`.
96
+ 4. **Materialize artefacts** — `sil_profile_materialize` with the spec writes `persona.md`, `playbook.md`, `profile.json` into `$SIL_DATA_DIR/agents/road-cycling-buyer/`.
97
+ 5. **System framing** — copy `persona.md` into the agent's workspace `SOUL.md`.
98
+ 6. **Wire sil** — `openclaw config set 'agents.list[<i>].skills' '["sil"]' --strict-json` and `openclaw config set plugins.entries.sil.enabled true --strict-json`.
99
+ 7. **Validate with the host's OWN check, THEN declare created** — `openclaw config validate --json` returns valid → outcome **`created`**.
100
+ 8. **Tell the user** — the expert exists; opening it loads the persona + playbook and it shops on its niche with **no further setup**.
101
+
102
+ ## Edge cases this example would have handled
103
+
104
+ - **Collision** (a `road-cycling-buyer` already exists): the engine returns `collision`, writes nothing, and the conversation offers **refine-or-rename** — never clobbers.
105
+ - **Abandon before step 7** of the interview (user walks away pre-endorsement): nothing was created, nothing to tear down — the draft lived only in the conversation.
106
+ - **Creation is local + offline**: no sil registration was needed to create the expert; the user registers later, on first shop, via `sil_register`.
@@ -0,0 +1,65 @@
1
+ # Create a sil-wired shopping expert — the agent-creation engine
2
+
3
+ **Precondition: read and run this reference ONLY after the user has explicitly endorsed the assembled draft from [`brainstorm_interview.md`](brainstorm_interview.md).** Running any step below before that explicit endorsement is forbidden — the interview owns the endorsement gate.
4
+
5
+ When the user wants a **dedicated shopping expert** — "make me a shopping expert for buying gifts", "set up a grocery re-order agent", "create a sil shopping agent" — author and persist a **valid OpenClaw agent profile**: a real new agent under the host `agents` config, with the **sil plugin enabled** and the **sil skill attached**, plus the expert's behaviour artefacts in the sil data directory — so the created agent can shop with **no further setup**.
6
+
7
+ You are the engine. The host config write is **you driving the host's own `openclaw …` CLI** — the sil plugin never writes the host config itself. Run these steps **in order, top to bottom** — the order is the spec.
8
+
9
+ ## The profile spec (input)
10
+
11
+ The endorsed draft from the interview *is* this spec (the persona → `persona`, and the elicitation style + answer→param mapping + rubric → `playbook`):
12
+
13
+ | Field | Meaning | Required? |
14
+ |---|---|---|
15
+ | **agentId** | The new agent's id (lower-kebab, e.g. `gift-buyer`). Becomes `agents.list[].id`. Must be **unique** and is never `main` (host-reserved). | Required |
16
+ | **name** | Human-readable expert name ("Gift Buyer"). | Required |
17
+ | **persona / instructions** | Who this expert is and how it shops — its expertise, tone, standing rules. | Required (non-empty) |
18
+ | **workspace** | The agent's workspace directory (e.g. `~/.openclaw/workspace-gift-buyer`). | Required for the non-interactive add |
19
+ | **playbook (sub-skill)** | An optional generated **domain sub-skill** — a shopping playbook for this expert's niche. | Optional |
20
+
21
+ The **sil plugin** and the **sil skill** are always attached (that is what makes it *sil-wired*). Creating an expert is **local and offline** — it does **not** require or perform sil registration, reads no token, and writes nothing to identity storage. The expert registers the user later, on first shop, via `sil_register`. Do **not** present registration as a prerequisite for creating the profile.
22
+
23
+ ## Engine steps (run in this exact order)
24
+
25
+ 1. **Validate the spec FIRST — before anything is written.** Check `agentId` is present, lower-kebab, unique-looking, and not `main`; `name` is present; `persona`/instructions is non-empty; `workspace` is present. If any check fails, stop with the **`invalid_request`** outcome naming the offending field and **write nothing** — no agent, no artefacts. Nothing partial. This validation runs ahead of every host command, so a bad spec never reaches the host.
26
+
27
+ 2. **Collision check — read before write.** Run `openclaw agents list --json` and confirm no existing agent already uses `agentId`. If one does, stop with the **`collision`** outcome and **do not** run `openclaw agents add` — never overwrite or clobber an existing agent's persona or wiring. Surface the collision so the user can rename. (This list-check precedes the add, so a same-name agent is caught before any change.)
28
+
29
+ 3. **Create the agent shell (host CLI).** Run:
30
+ ```
31
+ openclaw agents add <agentId> --workspace <workspace> --non-interactive --json
32
+ ```
33
+ This creates the real `agents.list[]` entry and the agent's workspace bootstrap files (`SOUL.md`, `AGENTS.md`, …), inheriting model and tool profile from `agents.defaults`. `--non-interactive --json` is required so you can drive it without a prompt and read the structured result.
34
+
35
+ 4. **Materialize the behaviour artefacts into the sil data directory.** Call **`sil_profile_materialize`** with `{ agentId, name, persona, playbook? }`. It writes the expert's behaviour artefacts atomically into **`$SIL_DATA_DIR`** (the sil data directory — the plugin's own disclosed scope) under `agents/<agentId>/`:
36
+ - **`persona.md`** — the persona/instructions that power the expert's behaviour;
37
+ - **`playbook.md`** — the generated domain **sub-skill**, when supplied;
38
+ - **`profile.json`** — the manifest the sil skill reads at runtime to load them.
39
+ These behaviour artefacts live in `$SIL_DATA_DIR`, kept **out of** the thin host `agents` wiring entry. The tool's own outcomes are `ok` / `invalid_request` / `persistence_failed` — on `invalid_request` it wrote nothing; on `persistence_failed` it left nothing partial.
40
+
41
+ 5. **Make the persona the agent's system framing.** Copy the materialized `persona.md` into the new agent's workspace `SOUL.md` (its persona bootstrap file), so the host injects the persona into the expert's system prompt.
42
+
43
+ 6. **Wire the sil skill and plugin into the agent (host CLI).** Attach the sil skill and enable the sil plugin for the created agent. These shapes are asserted against the host the sil-stage round pins — **`alpine/openclaw:2026.6.9`** — where both are value-mode sets driven with `--strict-json` (the only set mode this image accepts):
44
+ ```
45
+ openclaw config set 'agents.list[<i>].skills' '["sil"]' --strict-json
46
+ openclaw config set plugins.entries.sil.enabled true --strict-json
47
+ ```
48
+ The skill attach makes the agent **know how** to drive the tools; the plugin enable makes the four `sil_*` tools available to it (they come for free once the `sil` plugin is enabled). Keep `sil` in the agent's skill list and do not deny the `sil_*` tools in its tool profile.
49
+
50
+ 7. **Validate with the host's OWN check, THEN declare created.** Run `openclaw config validate --json`. On `alpine/openclaw:2026.6.9` the verdict shape is `{ valid, path, issues? }` — success keys off **`.valid`**, never an `ok` field. "Valid" means *the host says yes* — never assert it yourself. Only when the verdict reads `valid: true` do you report the **`created`** outcome. If `openclaw config validate` returns `valid: false` (or any CLI step failed), report **`persistence_failed`** with the failing **path** and **cause** (the `issues?` the verdict reports), and leave nothing partial behind. This validate-after-add step is what guarantees the host will load the profile.
51
+
52
+ 8. **Tell the user it is ready.** On `created`, tell the user the expert exists and how to open it. When they open the new agent, the host loads it: the sil plugin is enabled, the sil skill is attached, `SOUL.md` carries the persona, and the sil skill reads `$SIL_DATA_DIR/agents/<agentId>/profile.json` to load the persona + playbook — the expert calls `sil_search` / `sil_product_get` (and `sil_register` / `sil_whoami` as needed) on the user's intent with **no further setup**.
53
+
54
+ ## Status taxonomy (agent-creation engine)
55
+
56
+ | `status` | Meaning | What to do |
57
+ |---|---|---|
58
+ | `created` | The agent was added, the behaviour artefacts materialized, the sil plugin + skill wired, and `openclaw config validate` accepted it. | Tell the user the expert is ready and how to open it. |
59
+ | `invalid_request` | The spec failed validation (missing/blank field). **Nothing was written.** | Name the field, fix it, run again. Do NOT proceed to `openclaw agents add`. |
60
+ | `collision` | An agent with that id already exists (from `openclaw agents list`). | Surface it; pick a different id. **Never overwrite / clobber** the existing agent. |
61
+ | `persistence_failed` | A write or `openclaw config validate` step failed. The reported **path** + **cause** name what to fix. **Nothing partial** was left behind. | Fix the path/cause (writable config, valid spec), then create the expert again. |
62
+
63
+ ## Runtime — how a created expert loads its behaviour
64
+
65
+ When you (the sil skill) start a session inside a created expert, read `$SIL_DATA_DIR/agents/<agentId>/profile.json`, then load the `persona.md` (reaffirm the standing instructions) and `playbook.md` sub-skill (the domain shopping playbook) it points at. That is what lets the expert shop on its niche with no further setup. When the user then states a shopping intent, shop per [`expert_shopping.md`](expert_shopping.md) — the profile-driven shop-time loop. To sharpen a created expert from what it observed in real sessions, see [`refine_expert.md`](refine_expert.md).
@@ -0,0 +1,68 @@
1
+ # Brainstorm a tailored shopping expert — the interview
2
+
3
+ When the user asks for a **shopping expert** — "make me a shopping expert for buying gifts", "set up a road-cycling gear agent", "I want an expert that shops for me" — do **not** jump to the engine. First run an **open, back-and-forth interview** that shapes the expert *with* the user, converging a spec tailored to *this* user. The agent-creation engine ([`agent_creation_engine.md`](agent_creation_engine.md)) only runs **after** the user explicitly endorses the assembled draft. This reference is the procedure; the engine is the machinery it feeds.
4
+
5
+ This is a **conversation, not a form-fill.** The job is to converge five things *collaboratively*, eliciting BOTH the domain's decision-attributes AND this user's own tastes, style, budget, and constraints — and to **create nothing** until the user endorses the assembled draft.
6
+
7
+ ## Principles for the interview
8
+
9
+ - **Act like a curious expert, not a wizard.** Ask open questions, reflect back what was heard, and let the user steer. Never fire a fixed battery of questions.
10
+ - **Narrow a vague domain first.** If the domain is broad or ambiguous, narrow it to a concrete, searchable niche *with* the user before building anything else (see step 2 below) — every downstream section depends on a narrowed niche.
11
+ - **Interleave domain and personal.** In every section, surface the objective decision-attributes of the domain AND ask where *this* user stands on them. A section that gathered only one side is incomplete.
12
+ - **Converge, don't accumulate.** Reflect a short summary back and get a "yes / adjust" before advancing. The flow is **re-entrant** — the user can revise an earlier section at any point.
13
+ - **Endorsement is a gate, not a formality.** Until the user explicitly says "create it", run **zero** engine steps (see Business rules below). The draft lives only in the conversation.
14
+
15
+ ## The five sections the interview converges
16
+
17
+ These map onto exactly the two artefact slots the engine materializes — there is **no third slot**. The interview's whole job is to fill `persona` and `playbook` (plus the `agentId` + `name` derived from the domain).
18
+
19
+ | # | Section | What it converges | Lands in |
20
+ |---|---|---|---|
21
+ | 1 | **Domain framing** | What this expert shops for, narrowed to a concrete, searchable niche. | `agentId` + `name` |
22
+ | 2 | **Persona** | Who the expert *is*: its expertise, voice/tone, standing rules — reflecting this user. | `persona` |
23
+ | 3 | **Elicitation style** | How this expert talks to its future user when shopping — how many questions before searching, how proactive, how much it explains. | inside `playbook` |
24
+ | 4 | **Answer→`sil_search`-param mapping** | The domain's decision-attributes translated into concrete `sil_search` parameters this expert will set (see [`search_param_mapping.md`](search_param_mapping.md)). | inside `playbook` |
25
+ | 5 | **Comparison / recommendation rubric** | How this expert ranks and picks among results, weighted by the user's *stated* priorities. | inside `playbook` |
26
+
27
+ Sections 2–5 carry the **tailoring**: they must reflect what *this* user said, not a generic template. The persona goes in the spec's `persona` field; the elicitation style + the answer→param mapping + the rubric are authored as **prose** into the spec's single `playbook` string (the domain sub-skill — a SKILL.md-shaped markdown body, **not** JSON). There is no structured field for the mapping, the style, or the rubric — they live as readable markdown sections inside `playbook`.
28
+
29
+ ## Run the interview in this order
30
+
31
+ 1. **Open with the domain, not a form.** Reflect the request back ("a shopping expert for road-cycling gear — let's shape it together") and ask **one** orienting question. Signal this is a conversation that can be revised, not a questionnaire. Do not ask for an `agentId`, a budget, and a tone all at once.
32
+
33
+ 2. **Narrow a vague domain together FIRST — before any other section.** If the domain is broad or ambiguous ("an expert for gifts", "electronics"), do **not** proceed to persona, the mapping, or the rubric. Ask 1–2 narrowing questions (who is it for / what occasion / which slice of the category) and **reflect a concrete niche back for confirmation**. A too-broad niche makes the answer→param mapping and the rubric useless, so this narrow-first gate protects every downstream section. Only once the niche is concrete and confirmed do you move on.
34
+
35
+ 3. **Converge the persona (interview section 2 — see the table above).** Elicit the expert's expertise and voice, AND how the user wants it to behave (terse vs. chatty, cautious vs. opinionated, any standing rules). Reflect a short persona summary back; get a yes/adjust before advancing.
36
+
37
+ 4. **Converge the three playbook sections (interview sections 3–5: elicitation style, the mapping, the rubric), interleaving domain-attributes with the user's stance:**
38
+ - **Elicitation style:** how should the expert talk to its future user — how many questions before it searches, how proactive, how much it explains its picks? Reflect back, confirm.
39
+ - **Answer→`sil_search`-param mapping:** name the domain's decision-attributes ("for road bikes: frame material, groupset tier, wheel size, budget…"), ask the user's stance on each, and translate each stated input into a concrete `sil_search` param (see [`search_param_mapping.md`](search_param_mapping.md) for the param table, worked examples, and the `ship_to`-empty rule). Reflect the mapping back, confirm.
40
+ - **Recommendation rubric:** ask what the user weighs most ("durability over price", "prefer secondhand", "brand X is a hard no"), and tie the expert's ranking/selection to those *stated* priorities — not a fixed order. Reflect back, confirm.
41
+
42
+ 5. **Derive the identity, confirm it.** From the converged domain, propose an `agentId` (lower-kebab, matching `^[a-z0-9][a-z0-9-]*$`, never `main`) and a human-readable `name` ("Road-Cycling Buyer" / `road-cycling-buyer`). **Confirm both with the user** — never silently invent them.
43
+
44
+ 6. **Assemble the draft and present it back.** Compose the spec — `{ agentId, name, persona, playbook }` — and present it to the user as a **readable summary**: who the expert is, how it'll search (the mapping), and how it'll recommend (the rubric). Self-check the shape against the engine's `sil_profile_materialize` input contract: `agentId` lower-kebab and ≠ `main`, non-blank `name`, non-blank `persona`, and a non-blank `playbook` (the elicitation-style + mapping + rubric prose). This is a sanity pass; the engine's validate-first step is the authoritative gate — do not re-implement it here. This self-check is shape-only — it writes nothing, so `sil_profile_materialize` is NOT called here.
45
+
46
+ 7. **Get explicit endorsement — the gate.** Ask for an explicit go-ahead ("shall I create it?"). Endorsement is an **affirmative user act** on the assembled draft — "yes, create it" / "go ahead" / "looks good, make it". It is **NOT** inferred from the user answering the last question, and **NOT** from silence. **Only on that explicit endorsement** do you proceed to the engine ([`agent_creation_engine.md`](agent_creation_engine.md)) and run its steps.
47
+
48
+ ## Edge cases the interview handles gracefully
49
+
50
+ - **Collision (an expert with that id already exists).** The engine refuses a name collision — it returns the `collision` outcome from its `openclaw agents list` check and never clobbers an existing agent. When the proposed `agentId` collides, surface it in the conversation and offer the user a **choice — rename this expert under a new id, or refine the existing expert's niche** — rather than dead-ending. Never silently mutate the id, and never overwrite an existing expert. (Refining the *existing* expert's artefacts in place is out of scope here; offer rename as the concrete action.)
51
+ - **Abandon mid-flow.** The interview is multi-turn; the user may stop, change their mind, or walk away before endorsing. Because **no engine step runs before endorsement**, abandonment leaves **nothing created** — no host agent, no artefacts, no wiring. There is no partial expert to clean up and **no teardown needed**. Never "save progress" by writing artefacts early.
52
+ - **Creation is local + offline — no identity coupling.** Creating an expert neither requires nor performs sil registration. Do **NOT** present sil registration or a token as a prerequisite to *create* the expert. The expert registers the user later, on first shop, via `sil_register`. Building the expert never depends on the user having an identity.
53
+
54
+ ## Business rules (invariants the interview holds on every path)
55
+
56
+ 1. **No creation without explicit endorsement.** Nothing is written — not the host agent, not the artefacts, not the wiring — until the user explicitly endorses the assembled draft. The strongest invariant of this procedure: **nothing is created until** the user says yes, and the draft lives only in the conversation until then.
57
+ 2. **Abandon-mid-flow creates nothing.** Because no engine step runs pre-endorsement, an abandoned interview leaves no partial expert — automatic, not a teardown. Never write artefacts early to "save progress"; the draft lives only in the conversation.
58
+ 3. **Elicit BOTH sides.** The interview must elicit the domain's decision-attributes AND the user's personal tastes/style/budget/constraints. A spec built from only domain attributes (generic) or only preferences (no searchable mapping) is incomplete.
59
+ 4. **Tailoring is real, not template.** The persona, the mapping, and the rubric must reflect the user's *stated* inputs — a stated budget becomes `price_min`/`price_max`; "prefer secondhand" becomes `condition`; "durability over price" becomes a rubric weight. A spec that ignores what the user said fails this procedure's purpose. The tailoring is **not a generic template**.
60
+ 5. **Converge each section before advancing; stay re-entrant.** Reflect-and-confirm per section; let the user revise any earlier section. Collaborative, not a locked wizard.
61
+ 6. **Narrow a vague domain first.** Never build persona/mapping/rubric on an un-narrowed niche — narrow with the user before proceeding.
62
+ 7. **Refine-or-rename on collision; never clobber.** On an existing-name collision, offer refine-or-rename; never overwrite an existing expert (defers to the engine's `collision` refusal). Never clobber.
63
+ 8. **Creation is local + offline — no identity coupling.** The interview never presents sil registration / a token as a prerequisite to create the expert.
64
+ 9. **Search behaviour the expert inherits is correct by construction.** The answer→param mapping encodes the location-aware default: leave `ship_to` empty (server resolves the registered default), never instruct the expert to call `sil_whoami` to populate it (see [`search_param_mapping.md`](search_param_mapping.md)).
65
+
66
+ ## After endorsement
67
+
68
+ Once the user has **explicitly endorsed** the assembled draft, proceed to [`agent_creation_engine.md`](agent_creation_engine.md) and run the engine steps in order. Until that explicit endorsement, **zero engine steps** have run.
@@ -0,0 +1,46 @@
1
+ # sil catalog + identity tools — per-tool behaviour and the shared status taxonomy
2
+
3
+ Load this reference when driving any of the four core tools — `sil_register`,
4
+ `sil_whoami`, `sil_search`, `sil_product_get`. It holds how each tool behaves and
5
+ the status taxonomy every shopping tool shares. The router in `SKILL.md` names
6
+ which tool an intent maps to; this reference is what that tool actually does.
7
+
8
+ All four return the canonical envelope: a single text content block whose JSON
9
+ body carries a `status`. Prices are in the currency's ISO 4217 minor unit (e.g.
10
+ cents).
11
+
12
+ ## How each tool behaves
13
+
14
+ - **`sil_register`** starts browser-based registration. It returns promptly with
15
+ `status: "awaiting_browser"` and an `auth_url` — share that URL with the user.
16
+ The plugin polls in the background; once the user finishes signing in, call
17
+ `sil_register` again to confirm (it reports `already_registered`).
18
+ - **`sil_whoami`** returns the registered user's identity (name and addresses).
19
+ An expired access token is refreshed transparently and the read retried; if the
20
+ session is fully dead, the result names the recovery (`sil_register`).
21
+ - **`sil_search`** returns a ranked list of purchasable variants (`id`, `title`,
22
+ `price`, `availability`, `checkout_url`, `source`), best match first — present
23
+ them in order, do not re-rank. An empty list means nothing matched: a normal
24
+ `ok` outcome, not an error. Use the returned `cursor` for the next page; its
25
+ absence means no more results (never infer end-of-results from page size).
26
+ - **`sil_product_get`** is the lookup companion to `sil_search`. Pass ids already
27
+ held and get the matching products back with fresh detail (description, options,
28
+ the featured variant). Each variant carries an `inputs` list correlating it back
29
+ to the id(s) asked about (the response is NOT in request order). Ids that no
30
+ longer resolve come back in a `not_found` list — a normal partial-success
31
+ outcome, not an error; the other products are still valid.
32
+
33
+ ## Status taxonomy (shared across the shopping tools)
34
+
35
+ | `status` | Meaning | What to do |
36
+ |---|---|---|
37
+ | `ok` | Success. Catalog results may be empty (`products: []`) or partial (`not_found: [...]`) — still a success. | Relay the data. |
38
+ | `not_registered` | No stored credentials. | Run `sil_register`, then retry the tool. |
39
+ | `must_reregister` | The session is dead (refresh rejected / 401). | Run `sil_register` to sign in again, then retry. |
40
+ | `forbidden` | Authenticated but not authorized (e.g. account not provisioned). | Follow the message; usually complete onboarding via `sil_register`. |
41
+ | `invalid_request` | The query/ids were rejected (e.g. empty input). | Fix the input and call again — do NOT re-register. |
42
+ | `retryable` | A transient network/5xx blip. | Try the same call again — do NOT re-register. |
43
+
44
+ On a non-`ok` status, say what happened and follow the tool's own `recovery`
45
+ hint — never improvise a different one (re-registering can't fix a bad query or a
46
+ transient 5xx, and would derail the user).
@@ -0,0 +1,112 @@
1
+ # Expert shop-time loop — how a created expert shops on its niche
2
+
3
+ Load this when you (the sil skill) are running **inside a created expert** and the
4
+ user states a shopping intent ("find me something for a steak dinner around $40").
5
+ The [agent-creation engine's Runtime hook](agent_creation_engine.md) ends where
6
+ this loop begins: it has already read `$SIL_DATA_DIR/agents/<agentId>/profile.json`
7
+ and loaded `persona.md` (the standing instructions, the expert's voice, its
8
+ hard-rules and hard-no's) and `playbook.md` (its three prose sections — how the
9
+ expert asks, how it turns answers into catalog parameters, and how it ranks the
10
+ candidates). Those artefacts are now your operating instructions for the rest of
11
+ this loop.
12
+
13
+ This is **shop time**, not create time. The expert behaves like a specialist a
14
+ user trusts, in the persona's voice — never a generic clerk. It consumes the
15
+ existing catalog tools **unchanged**; the rubric is applied by you at reasoning
16
+ time, not by any new tool.
17
+
18
+ The router's three always-on rules still hold (act-don't-narrate, follow the
19
+ tool's own `recovery`, re-fetch the chosen item before the user commits) — this
20
+ loop layers the profile-driven behaviour on top, it does not restate them.
21
+
22
+ ## The loop (the order IS the spec)
23
+
24
+ Run these steps in order. An attribute the user already stated is never re-asked.
25
+
26
+ ### 1. Elicit the load-bearing missing attributes — in the playbook's priority order
27
+
28
+ A **load-bearing decision attribute** is one the playbook's mapping or rubric
29
+ names as priority-ordered for the niche (e.g. budget, serving size, the niche's
30
+ key descriptors). **Elicitation is need-driven**: you elicit **only** a
31
+ load-bearing attribute that is **missing**. When the stated intent already carries
32
+ enough load-bearing attributes for a defensible search, do **not** invent an extra
33
+ question battery — proceed straight to the map+search steps below.
34
+
35
+ When something load-bearing IS missing, ask for it through genuine back-and-forth
36
+ **in the playbook's priority order** — one or a few questions at a time, in the
37
+ playbook's elicitation style. This is **not a fixed form-fill** and **not a
38
+ question battery**: you ask like a curious expert, and you **never re-ask** an
39
+ attribute the user already stated. Elicit the highest-priority missing attribute
40
+ first, then the next — never a single up-front wizard form.
41
+
42
+ ### 2. Map the answers to well-formed `sil_search` params
43
+
44
+ Translate each elicited or stated answer to a **real `sil_search` param** per
45
+ [`search_param_mapping.md`](search_param_mapping.md) — that reference owns the
46
+ full answer→param table and the worked examples; **load it, do not re-carry it
47
+ here.** The load-bearing rules from it that govern this step:
48
+
49
+ - A stated taste with **no matching param** (a colour, a brand) folds into the
50
+ `query` text or into the rubric — you **never invent a filter**. There is no
51
+ `color` param, no `brand` param; inventing one emits an invalid `sil_search`
52
+ call.
53
+ - Leave **`ship_to` empty** by default so the server resolves the user's
54
+ registered default address. Do **not** call `sil_whoami` to populate it — no
55
+ `sil_whoami` round-trip.
56
+
57
+ ### 3. Search
58
+
59
+ Call `sil_search` with the mapped params. It returns purchasable variants
60
+ **best-first**.
61
+
62
+ ### 4. Compare the candidates on the playbook's rubric
63
+
64
+ Evaluate the returned candidates against the playbook's **recommendation rubric**,
65
+ **weighted by the user's stated priorities** ("durability over price"), plus the
66
+ persona's **hard-rules / hard-no's** (a brand the user refuses, an age gate the
67
+ persona enforces). The rubric informs your *reasoning*, not the list order:
68
+ present results **best-first** as `sil_search` returned them — **never re-rank**.
69
+
70
+ ### 5. Recommend — always with the "why"
71
+
72
+ Recommend with **domain-relevant rationale** in the expert's voice — the **"why"**,
73
+ tied to the rubric and the user's stated priorities ("I picked this because it
74
+ holds the 105 groupset you wanted at the top of your budget"). The "why" is the
75
+ product: the result list is the same one generic search returns; the expert's
76
+ value is the reasoning over it. Never hand back a bare list.
77
+
78
+ ### 6. Re-fetch with `sil_product_get` before any buy
79
+
80
+ Price, availability, and `checkout_url` from `sil_search` are **point-in-time**.
81
+ Before you hand off to **buy / checkout / purchase**, **re-fetch** the chosen item
82
+ with `sil_product_get` for fresh price / availability / `checkout_url`. **Never
83
+ commit a buy off the stale `sil_search` snapshot** — buy off the fresh
84
+ `sil_product_get` detail, never the earlier `sil_search` result.
85
+
86
+ ## When `sil_search` returns `ok` with `products: []` — relax and explain
87
+
88
+ An empty result on `status: ok` (`products: []`) is a normal, servable outcome —
89
+ **never a silent dead-end**. **Relax or re-frame** the params (loosen a
90
+ constraint, broaden the `query`) and **explain what you changed and why** ("I
91
+ dropped the secondhand-only filter because nothing matched it — here's what's new
92
+ in stock"). Do not just stop silently and do not leave the user with nothing.
93
+
94
+ ## When the domain is genuinely unservable — an honest "no", never junk
95
+
96
+ When the catalog **cannot serve** the domain — out of the persona's scope,
97
+ **not shippable**, **age-gated**, or persistently empty after a reasonable
98
+ relax — say so **honestly**. This is a **different outcome** from the empty-but-
99
+ servable relax case above: there is no constraint to loosen, so you give an honest
100
+ "no". **Never fabricate** options and **never pad with junk** — handing back
101
+ irrelevant or unbuyable results to avoid saying "no" destroys trust. Honesty over
102
+ a hollow answer.
103
+
104
+ ## When `sil_search` / `sil_product_get` returns a non-`ok` status
105
+
106
+ A non-`ok` status is **not an empty match** — do **not** treat a `retryable`
107
+ (transient / source down) or an auth failure like `products: []` and relax the
108
+ params; that is the wrong recovery. **Follow the tool's own `recovery` hint**
109
+ exactly and **never improvise** a different one. The full status taxonomy and the
110
+ per-status recovery rule live in
111
+ [`catalog_tools_reference.md`](catalog_tools_reference.md) — that reference owns
112
+ them; **load it, do not re-carry the taxonomy here.**