sil-openclaw 0.3.8 → 0.4.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.
@@ -1,190 +1,56 @@
1
- # Worked example — one shopper, two unrelated niches, one session
2
-
3
- A short walkthrough of the **headline capability**: create **ONE shopper**
4
- ([`../references/brainstorm_interview.md`](../references/brainstorm_interview.md) →
5
- [`../references/agent_creation_engine.md`](../references/agent_creation_engine.md)),
6
- then shop **two unrelated niches in the same session** — the second **minted on
7
- the fly** — with a **shared fact reused across both** and **per-domain taste that
8
- does not leak**. The transcript is illustrative — it shows the *shape*, the gates,
9
- and the SDS layering, not exact wording.
10
-
11
- ## Onboarding — two touchpoints, NO niche research
12
-
13
- > **User:** "Set up something that shops for me."
14
-
15
- The shopper is a **generalist** — onboarding touches only the persona and the
16
- shared user spec; it researches **no** niche.
17
-
18
- **1. `SOUL.md` — ask first (persona; a generalist, NOT a niche).**
19
-
20
- > **Shopper:** "Let's set up your shopper. How do you want it to behave?"
21
- > **User:** "Be concise and a bit opinionated — and never recommend anything with
22
- > leather, it's an ethics thing for me."
23
-
24
- → Persona (→ host **`SOUL.md`**): *concise, lightly opinionated generalist.* No
25
- niche is chosen — it will shop whatever the user buys.
26
-
27
- **2. `user_spec.md` (shared) — seed the cross-niche facts + hard constraints.**
28
-
29
- > **Shopper:** "Anything I should always know — sizes, where to ship, hard rules?"
30
- > **User:** "Ship to 12 Rue Centrale, Lyon, France. And the no-leather rule is
31
- > absolute."
32
-
33
- → Seeded partial **shared `userSpec`** (→ `user_spec.md`): *ship-to Lyon, France
34
- (soft fact); **HARD-NO: leather** (inviolable, carries across every niche).* The
35
- rest is augmented per query.
36
-
37
- ## Assemble + endorse — the gate
38
-
39
- Identity confirmed (`my-shopper` / "My Shopper"), the assembled draft splits across
40
- the two stores — `agentId` + `persona` drive the host wiring (`openclaw agents add`
41
- + `SOUL.md`); `name` + the **shared user spec only** feed the singleton
42
- `sil_profile_materialize` **create** (no `agentId`, no domain pack at create):
43
-
44
- ```jsonc
45
- {
46
- "agentId": "my-shopper",
47
- "name": "My Shopper",
48
- "persona": "A concise, lightly opinionated generalist shopper.",
49
- "userSpec": "## Shared user spec (seeded partial)\n### Soft facts\n- Ship-to: 12 Rue Centrale, Lyon, France.\n### Hard constraints (INVIOLABLE — every niche)\n- HARD-NO: leather (ethics)."
50
- }
51
- ```
52
-
53
- > **Shopper:** "Here's your shopper — shall I create it?"
54
- > **User:** "Yes, create it."
55
-
56
- **This affirmative act is the gate** — up to here, **zero engine steps ran**. Only
57
- now does the engine proceed
58
- ([`../references/agent_creation_engine.md`](../references/agent_creation_engine.md)):
59
- validate-first → singleton check → `openclaw agents add my-shopper --workspace
60
- ~/.openclaw/workspace-my-shopper --non-interactive --json` (confirm the inherited
61
- profile grants a web tool) → write the persona into `SOUL.md` →
62
- `sil_profile_materialize { name, userSpec }` **(NO `domain` — writes the shared
63
- `user_spec.md` + `profile.json` with an empty `domains: {}`)** → wire sil:
64
-
65
- ```
66
- openclaw config set 'agents.list[<i>].skills' '["sil"]' --strict-json
67
- openclaw config set plugins.entries.sil.enabled true --strict-json
68
- ```
69
-
70
- → then **admit sil at the host allow surfaces** so the `sil_*` tools are un-filtered
71
- — the shipped helper does the additive, idempotent merge of `plugins.allow` +
72
- `tools.alsoAllow` (never clobbering another admitted plugin like `klodi`):
73
-
74
- ```
75
- sil-openclaw-allowlist
76
- ```
77
-
78
- → `openclaw config validate --json` returns valid → **`created`** (a non-zero
79
- helper exit would be `persistence_failed`, not `created` — never a green shopper
80
- over still-filtered tools). The shopper now exists with an **empty `domains` map** —
81
- healthy; it will mint each niche on first shop.
82
-
83
- ## Niche A — road cycling (minted on the fly, announced)
84
-
85
- > **User:** "Find me a first road bike, around €1500."
86
-
87
- The shop loop ([`../references/shop_loop.md`](../references/shop_loop.md) owns the
88
- machinery — not repeated here) classifies the niche (**road cycling**), reads
89
- `profile.json.domains`, finds **no** matching domain, and **mints it on the spot —
90
- announced**:
91
-
92
- > **Shopper:** "I haven't shopped cycling for you yet — setting that up now (road
93
- > cycling, first bike). One sec while I do the homework."
94
-
95
- It **researches** the niche deeply (the deep `domainSpec` — the full how-to-buy:
96
- **fit is everything** — frame size from height *and* inseam, stack/reach, saddle
97
- setback, crank length; geometry; gearing theory; material/wheel trade-offs),
98
- derives the `intentSpec` dimensions, seeds a partial `playbook`, then persists with
99
- the **whole-doc** mint:
100
-
101
- ```jsonc
102
- sil_profile_materialize {
103
- name: "My Shopper",
104
- userSpec: "…the current shared spec (re-persisted)…",
105
- domain: {
106
- slug: "road-cycling", name: "Road cycling",
107
- domainSpec: "## First road bike — how to buy well (deep)\nFit is everything: size from height AND inseam; stack/reach set torso angle; saddle setback from KOPS; crank length scales with inseam…\n## Geometry: endurance vs race. ## Gearing: gear-inches, compact vs mid-compact. ## Material/wheels: alloy vs carbon; rim depth vs crosswind.",
108
- intentSpec: "## Dimensions (schema)\nuse-case; terrain; budget band; fit envelope; timeline; compatibility; performance priorities; aesthetics.",
109
- playbook: "## Buying taste (seeded partial)\nTo be learned as we shop."
110
- }
111
- }
112
- ```
113
-
114
- Then the loop runs on the active **road-cycling** domain: decompose the intent
115
- (first bike, ~€1500), map → `sil_search` → compare on the rubric, and recommend
116
- with a **"why" that cites the layers** — "for a first bike **fit/comfort outrank
117
- outright speed** (a domain mechanic), a 54 cm endurance frame sits right, and I kept
118
- it within your value budget; **no leather anywhere** (your standing hard rule)." A
119
- rationale naming no domain mechanic and reusing no stored fact would **fail the SDS
120
- bar** even if the bike were fine.
121
-
122
- The session surfaces a **taste**, captured the **cheap** way — one append, scoped to
123
- this domain:
124
-
125
- > **User:** "I don't chase brands — value over name."
126
-
127
- ```
128
- sil_remember { kind: "taste", text: "Value over brand; ~€1500 band.", domain: "road-cycling" }
129
- ```
130
-
131
- That taste lands in **`domains/road-cycling/playbook.md`** — this niche only.
132
-
133
- ## Niche B — espresso (a SECOND niche, same session, no switch)
134
-
135
- Moments later, **same session, no agent switch, no re-onboarding**:
136
-
137
- > **User:** "Different thing — I want a home espresso machine, decent but not crazy."
138
-
139
- The loop classifies the niche (**espresso**), reads `profile.json.domains`, finds
140
- no match, and **mints espresso on the fly — announced** ("new niche for me —
141
- setting up espresso") with its own deep `domainSpec` (boiler type, PID, pressure
142
- profiling, portafilter size, grinder pairing), `intentSpec`, and partial `playbook`,
143
- via a second whole-doc `sil_profile_materialize` with `domain.slug: "espresso"`.
144
-
145
- **The shared fact carries — without being re-asked:**
146
-
147
- > **Shopper:** "I'll ship to your Lyon address as usual" — **the ship-to from the
148
- > shared `user_spec.md`, captured during onboarding, reused in espresso with no
149
- > re-ask.** The **no-leather hard rule** also still applies (it rejects a
150
- > leather-wrapped tamper handle outright).
151
-
152
- **The niche taste does NOT leak:** the *value-over-brand, ~€1500* taste lives in
153
- `domains/road-cycling/playbook.md` and **does not shape** the espresso picks —
154
- espresso starts with its own (partial) taste, learned fresh:
155
-
156
- > **User:** "For coffee I'll happily pay for a known reliable brand."
157
-
158
- ```
159
- sil_remember { kind: "taste", text: "Pays up for a reliable known brand.", domain: "espresso" }
160
- ```
161
-
162
- → lands in **`domains/espresso/playbook.md`** only. Road cycling's "value over
163
- brand" and espresso's "pay for a known brand" coexist **without contradiction** —
164
- that is per-domain taste isolation. A **fact** (a new measurement, a hard rule) would
165
- instead go to the **shared** `user_spec.md` (`kind: "fact"`) and carry to *both*
166
- niches.
167
-
168
- ## The singleton edge — refuse a second shopper
169
-
170
- > **User:** "Can you make me a second shopper just for coffee?"
171
- > **Shopper:** "You already have a shopper — it handles every niche. I've added
172
- > espresso as a domain on it; I won't create a second shopper. Want me to refine
173
- > the espresso domain instead?"
174
-
175
- The engine's **singleton refusal** (`collision`, "a shopper already exists") — one
176
- shopper, many domains; you never mint a second.
177
-
178
- ## Edge cases this example would have handled
179
-
180
- - **Reuse before mint** — asking for "another road bike, this time for winter" reuses
181
- the **existing `road-cycling` domain** (semantic dedup), never mints a near-duplicate
182
- `cycling` / `bikes` pack.
183
- - **Forget one domain ≠ decommission the shopper** — "forget espresso" runs
184
- `sil_profile_remove { domainSlug: "espresso" }` (artefact-only; the shopper,
185
- the shared user spec, and the road-cycling domain survive). Tearing down the whole
186
- shopper is the separate host-CLI-first path.
187
- - **No web tool**: the shopper says so honestly at mint time and composes the domain
188
- spec from public buying knowledge — never pretends the research happened.
189
- - **Creation is local + offline** (for identity): no sil registration to create; the
190
- user registers later, on first shop, via `sil_register`.
1
+ ---
2
+ name: multi-domain-shopper-walkthrough
3
+ description: A worked six-beat, multi-domain run — create one shopper (after an explicit endorsement), then shop two unrelated niches in one session, the second minted on the fly and announced, with a shared user_spec fact reused across both. Illustrative, not a spec.
4
+ ---
5
+
6
+ # Worked run — one shopper, two niches, six beats
7
+
8
+ A concrete end-to-end walkthrough of the six-beat loop across two unrelated
9
+ niches. It is illustrative — the authoritative rules live in the beat references.
10
+
11
+ ## Create the shopper (once, after endorsement)
12
+
13
+ The two-touchpoint interview assembles a draft persona + a shared user-spec seed.
14
+ Only after the user **endorses** the assembled draft does the engine run
15
+ `openclaw agents add` and materialize the shared `user_spec.md`. Nothing is created
16
+ before that endorsement. The result is **one** shopper — a **singleton**.
17
+
18
+ The seeded shared spec already holds one durable fact: `- [hard] ships to Berlin;
19
+ allergic to wool` — a cross-niche fact, kept in `user_spec` because it stays true in
20
+ **every niche**.
21
+
22
+ ## Niche A — ski gloves (all six beats)
23
+
24
+ 1. **Classify** — the request "warm gloves for the slope" resolves to
25
+ `{ domain: ski, product: gloves, intent: slope }`. `sil_profile_search` finds no
26
+ ski domain yet → a MISS.
27
+ 2. **Method** — research ski gear and **mint** the method via `sil_learn create`,
28
+ **announced** ("I read this as *ski gloves for the slope* — correct me if not").
29
+ 3. **Fill** — precedence resolves waterproofing and cuff length from the method;
30
+ the wool allergy is **reused** from the **shared** `user_spec` **without
31
+ re-asking**. Only the budget is elicited — one question, tied to why.
32
+ 4. **Search-space** — a bounded fan-out of ≤ 4 `sil_search` calls, core first.
33
+ 5. **Reflect** — honesty pass, then a **hero + one alternative**, each with a why.
34
+ 6. **Feedback** — the buyer reacts "I always run Hestra" → confirm, then persist a
35
+ durable per-domain taste to the method via **`sil_learn`**.
36
+
37
+ ## Niche B — an espresso grinder (same session, minted on the fly)
38
+
39
+ In the **same session** the user pivots: "now I need a burr grinder." This is a
40
+ **second niche**, **unrelated** to ski gear. No agent switch — the one shopper
41
+ handles it:
42
+
43
+ 1. **Classify** → `{ domain: espresso, product: grinder, intent: general }` (a
44
+ context-free request keys `general`).
45
+ 2. **Method** — a MISS again → research + **mint on the fly**, **announced**.
46
+ 3. **Fill** — the "ships to Berlin" fact is again **reused across** niches from the
47
+ **shared** `user_spec`, **kept from** the ski session — never re-asked. The
48
+ Hestra taste, being per-domain on the ski method, does **not** leak here.
49
+
50
+ The two niches coexist: shared facts flow to both; per-domain taste stays isolated.
51
+
52
+ ## The singleton edge
53
+
54
+ If the user later says "set me up a second shopper," the engine refuses: **a
55
+ shopper already exists**. Steer them to shop a new niche (it mints a domain on the
56
+ spot) or refine the existing one with `sil_learn` — never a second shopper.
@@ -1,90 +1,140 @@
1
- # Create your sil-wired shopper — the agent-creation engine
1
+ ---
2
+ name: agent-creation-engine
3
+ description: The ordered, one-command engine that persists the single sil-wired shopper after the user endorses the assembled draft. Load only after explicit endorsement in the interview.
4
+ ---
2
5
 
3
- **Precondition: run this ONLY after the user has explicitly endorsed the assembled draft from [`brainstorm_interview.md`](brainstorm_interview.md).** Anything below before that endorsement is forbidden — the interview owns the gate.
6
+ # Create your sil-wired shopper — the agent-creation engine
4
7
 
5
- When the user wants to **set up shopping**, author and persist **one** valid OpenClaw agent profile — the user's **shopper**: a real new agent under the host `agents` config, with the **sil plugin enabled**, the **sil skill attached**, its persona written into the workspace **`SOUL.md`**, plus the shopper's **shared user spec** in the sil data directory — so it shops with **no further setup**. The shopper is a **singleton**: you create it **once**, then it learns **domains** (niches) lazily on first shop — you never mint a second shopper.
8
+ **Precondition: run this ONLY after the user has explicitly endorsed the assembled draft
9
+ from [`brainstorm_interview.md`](brainstorm_interview.md).** The interview owns that gate.
6
10
 
7
- The shopper runs **entirely on Spec-Driven Shopping (SDS)** — the operating model, not an optional layer. At create time exactly **one** sil artefact is persisted: the **shared, agent-level `userSpec`** (the person's cross-niche facts + hard constraints, seeded *partial* by the interview). **No** niche is researched and **no** per-domain pack is written at create time — there is **no** `domainSpec` / `intentSpec` / `playbook` here. Those are minted **lazily, per niche, on first shop** ([`shop_loop.md`](shop_loop.md)) into `domains/<slug>/`. A freshly-created shopper has an **empty `domains` map** — that is **healthy**, not a deficiency.
11
+ This persists **one** valid OpenClaw agent — the user's **shopper**: a real agent under
12
+ the host `agents` config, sil plugin enabled, sil skill attached, its persona in the
13
+ workspace **`SOUL.md`**, plus the **shared user spec** in the sil data dir — so it shops
14
+ with **no further setup**. The shopper is a **singleton**: created once, then it learns
15
+ **domains** lazily on first shop, so a fresh shopper has an **empty `domains` map** —
16
+ healthy. Creation is **local and offline**: no token is read, no `sil_register` /
17
+ `sil_whoami`, no network call. The shopper registers the user later, on first shop.
8
18
 
9
19
  ## The one command
10
20
 
11
- After the explicit endorsement, you run exactly **ONE** shipped command — the package `bin` **`sil-openclaw-create-shopper`** — and it runs the whole choreography **atomically** and fail-closed. You do **NOT** hand-run the nine host-CLI steps yourself; the bin runs them **for you, in order, as one transaction**, then returns a single structured JSON result. Feed it the endorsed spec as **one JSON object on `stdin`** (or via **`--spec <path>`**):
21
+ After the endorsement, run exactly **one** shipped command — the package bin
22
+ **`sil-openclaw-create-shopper`** — and it runs the whole choreography **atomically** and
23
+ **fail-closed**, then returns one structured JSON result. You do **not** hand-run the
24
+ host-CLI steps; the bin runs them **for you, in order, as one transaction**. Feed it the
25
+ endorsed spec as one JSON object on **`stdin`** (or via **`--spec <path>`**):
12
26
 
13
27
  ```
14
28
  sil-openclaw-create-shopper <<'JSON'
15
- { "agentId": "my-shopper", "name": "My Shopper", "workspace": "~/.openclaw/workspace-my-shopper",
16
- "persona": "…the endorsed persona…", "userSpec": "…the seeded shared user spec…" }
29
+ { "agentId": "my-shopper", "name": "My Shopper",
30
+ "workspace": "~/.openclaw/workspace-my-shopper",
31
+ "persona": "…the endorsed persona…", "userSpec": "…the seeded shared user spec…",
32
+ "channel": "telegram" }
17
33
  JSON
18
34
  ```
19
35
 
20
- Passing the multiline `persona` / `userSpec` as JSON dodges shell-arg escaping. The bin is **non-interactive**: it executes an **already-assembled, already-endorsed** spec — it never re-runs the interview and never prompts (the endorsement gate lives upstream in the interview; the bin's own validate-first + singleton pre-flight still protect a direct caller). Creation is **local and offline** — the bin reads **no token**, performs **no** `sil_register` / `sil_whoami`, and makes **no network call**. The `sil` **plugin** and `sil` **skill** are always wired (that is what makes it *sil-wired*). Do **not** present sil registration as a prerequisite — the shopper registers the user later, on first shop, via `sil_register`.
21
-
22
- > The bin is a standalone operator script (the same class as the other shipped `sil-openclaw` operator bins), **not** the plugin process — so the plugin's `noChildProcess` / "never write host config" guarantee is intact; the bin legitimately drives the host `openclaw …` CLI on your behalf.
36
+ The bin is **non-interactive**: it executes an **already-assembled, already-endorsed**
37
+ spec — it **never re-runs the interview** and never prompts. The sil **plugin** and sil
38
+ **skill** are always wired — that is what makes it *sil-wired*. It is a standalone
39
+ operator script, **not** the plugin process, so the plugin's "never write host config"
40
+ guarantee holds; the bin legitimately drives `openclaw …` on your behalf.
23
41
 
24
- ## The profile spec (input) — the JSON the bin reads
25
-
26
- The endorsed draft feeds two stores. The **persona** becomes the host workspace **`SOUL.md`** (its identity / voice / standing rules — via the host CLI, **not** a sil artefact). The **shared user spec** becomes the sil data-dir artefact:
42
+ ## The spec (input)
27
43
 
28
44
  | Field | Meaning | Goes to | Required? |
29
45
  |---|---|---|---|
30
- | **agentId** | Lower-kebab id (e.g. `my-shopper`) → `agents.list[].id`. Unique, never `main`. | host | Required |
46
+ | **agentId** | Lower-kebab id → `agents.list[].id`. Unique, never `main`. | host | Required |
31
47
  | **name** | Human-readable name ("My Shopper"). | sil manifest | Required |
32
- | **persona** | Who this shopper is and how it shops — a generalist, voice/tone, standing rules. | host **`SOUL.md`** (via host CLI — no `persona.md`) | Required (non-empty) |
33
- | **workspace** | The shopper's workspace directory (e.g. `~/.openclaw/workspace-my-shopper`). | host | Required for the non-interactive add |
34
- | **userSpec** | The user's **shared, cross-niche** facts + hard constraints (addresses, sizes, allergy/ethics rules, budget psychology). **Seeded partial** by the interview, then augmented per-query. | sil `user_spec.md` | **Required (non-empty)** |
35
-
36
- There is **no** per-niche input at create time. The deep `domainSpec`, the derived `intentSpec` schema, and the niche `playbook` are **not** authored here — they are researched and minted on first shop in each niche.
37
-
38
- ## The created shopper needs WEB tools
39
-
40
- The shopper **lazily mints a domain on first shop** (its research pass reaches the web) and **web-refreshes each domain spec on every query**. So the created agent must have **web/fetch tools in its tool profile** — inherited from `agents.defaults` when its shell is created. If `agents.defaults` does **not** grant a web tool, the bin reports **`created` with a `warnings` entry** naming the gap (bare `sil_search` still works, so it does **not** hard-fail) — it never silently swallows the gap and never pretends the research happened. Surface that warning to the user.
41
-
42
- ## What the bin does atomically (the choreography it runs for you, in this exact order)
43
-
44
- 1. **Validates the spec FIRST — before anything is written.** It checks `agentId` (present, lower-kebab, ≠ `main`), `name`, `persona`, `workspace`, and the **shared `userSpec` — present and non-blank** (the only sil artefact at create; seeded *partial* by the interview, never omitted). There is **no** `domainSpec` / `intentSpec` / `playbook` to validate here. On any failure it stops with **`invalid_request`** naming the field and **writes nothing**. This runs ahead of every host command, so a bad spec never reaches the host.
45
-
46
- 2. **Singleton check — a user has exactly ONE shopper.** The bin runs `openclaw agents list --json` and reads the sil artefact store (the no-args `sil_profile_get` overview, `ok` empty-is-healthy when no shopper exists) **before** the add; if a sil shopper **already exists**, it stops with **`collision`** — **"a shopper already exists"** — and **does not** run `openclaw agents add`. That steers the user to **shop a new niche** (which lazily mints a domain on the spot) or **refine the existing shopper** — **never mint a second shopper**. An `agentId` that collides with any existing agent is likewise refused (`collision`) — never overwriting an existing agent's persona or wiring. If either read is **inconclusive** (a CLI error, a degraded store), the bin fails closed rather than fabricate a "no shopper" verdict.
47
-
48
- 3. **Creates the agent shell (host CLI).** It runs:
49
- ```
50
- openclaw agents add <agentId> --workspace <workspace> --non-interactive --json
51
- ```
52
- This creates the real `agents.list[]` entry and the workspace bootstrap files (`SOUL.md`, `AGENTS.md`, …), inheriting model and **tool profile** (which must grant **web/fetch** — see above) from `agents.defaults`. `--non-interactive --json` drives it without a prompt.
53
-
54
- 4. **Writes the persona into the workspace `SOUL.md` (host CLI).** The persona is the shopper's soul / system framing — the host's `SOUL.md`, **not** a sil artefact. The bin writes the endorsed persona text **straight into** the new agent's `SOUL.md`. There is **no** `persona.md` in the sil store and **no copy** step — the persona lives in exactly one place.
55
-
56
- 5. **Materializes the shared user spec — NO `domain`.** The bin calls **`sil_profile_materialize`** with **`{ name, userSpec }`** — the shared `userSpec` seeded by the interview. The shopper is a singleton, so this takes **no `agentId`**. **With no `domain`** at create, the tool writes the shared **`user_spec.md`** + **`profile.json`** (with an **empty `domains: {}` map**) into the fixed **`$SIL_DATA_DIR/shopper/`**, atomically. There is **no** `domain_spec.md` / `intent_spec.md` / `playbook.md` yet — the first shop in a niche mints that niche's pack (with a `domain` object) lazily. On `invalid_request` it wrote nothing; on `persistence_failed` it left nothing partial.
57
-
58
- 6. **Wires the sil skill + plugin (host CLI).** Asserted against the pinned host — **`alpine/openclaw:2026.6.9`** — both value-mode sets with `--strict-json` (the only set mode this image accepts):
48
+ | **persona** | Who the shopper is / how it shops — a generalist, voice, standing rules. | host **`SOUL.md`** (no separate persona file) | Required |
49
+ | **workspace** | The shopper's workspace directory. | host | Required |
50
+ | **userSpec** | The user's **shared, cross-niche** facts + hard constraints. Seeded partial by the interview. | sil `user_spec.md` | **Required** |
51
+ | **channel** | The channel the setup conversation is on — bound to the new shopper. | host `openclaw.json` bindings | **Optional (fail-open)** |
52
+
53
+ There is **no per-niche input at create** — no method and no PRD; those are minted lazily
54
+ on first shop via `sil_learn create`. The shopper reaches the web to mint and refresh
55
+ domains, so the agent needs web/fetch tools (inherited from `agents.defaults`); if
56
+ defaults grant none, the bin reports `created` with a `warnings` entry naming the gap
57
+ (bare `sil_search` still works) — surface it.
58
+
59
+ ## What the bin does atomically (in this exact order)
60
+
61
+ 1. **Validate the spec FIRST** — `agentId` (present, lower-kebab, ≠ `main`), `name`,
62
+ `persona`, `workspace`, and the shared **`userSpec`** (present, non-blank — the only
63
+ sil artefact at create). No per-domain method or PRD to validate. Any failure stops with
64
+ **`invalid_request`** naming the field and **writes nothing**, ahead of every host
65
+ command.
66
+ 2. **Singleton check.** Run `openclaw agents list --json` and read the sil store (whether a
67
+ shopper `user_spec.md` already exists) **before** the add. If a sil shopper already
68
+ exists, stop with **`collision`** — **"a shopper already exists"** — and do **not** run
69
+ `openclaw agents add`; steer to shop-a-new-niche (lazy mint) or refine — **never mint a
70
+ second shopper**. An `agentId` clashing with any existing agent is likewise
71
+ `collision`. An inconclusive read fails closed.
72
+ 3. **Create the agent shell.** `openclaw agents add <agentId> --workspace <workspace>
73
+ --non-interactive --json` — the real `agents.list[]` entry + workspace bootstrap
74
+ (`SOUL.md`, `AGENTS.md`, …), inheriting model and tool profile from `agents.defaults`.
75
+ 4. **Write the persona straight into the workspace `SOUL.md`** (host CLI). The persona is
76
+ the shopper's soul — the host's `SOUL.md`, not a sil artefact. There is **no separate
77
+ persona file** and **no copy** step.
78
+ 5. **Materialize the shared user spec — SETUP-ONLY, NO `domain`.** Call
79
+ `sil_profile_materialize { name, userSpec }` (the singleton takes no `agentId`). It is
80
+ **setup-only**: it writes the shared **`user_spec.md`** into `$SIL_DATA_DIR/shopper/`,
81
+ atomically, with the shopper **name in its frontmatter** — there is **no manifest**, and
82
+ it mints **no method or PRD**. Those are minted lazily on first shop via
83
+ `sil_learn create`.
84
+ 6. **Wire the sil skill + plugin** (host CLI). Asserted against the pinned host
85
+ **`alpine/openclaw:2026.6.9`**, both value-mode sets with `--strict-json` (the only set
86
+ mode this image accepts):
59
87
  ```
60
88
  openclaw config set 'agents.list[<i>].skills' '["sil"]' --strict-json
61
89
  openclaw config set plugins.entries.sil.enabled true --strict-json
62
90
  ```
63
- The skill **attach** makes the agent **know how** to drive the tools; the plugin **enable** turns the sil plugin **on** — but it does **not** by itself un-filter the `sil_*` tools (see the admission step next). `sil` stays in the agent's skill list and the `sil_*` tools are not denied.
64
-
65
- 7. **Admits sil at the host allow surfaces — the shipped helper.** Enabling the plugin is necessary but not sufficient: until `sil` is admitted at the **global** allow surfaces `plugins.allow` + **`tools.alsoAllow`**, the host keeps the `sil_*` tools **filtered**. Admission is **plugin-ID only** — no per-tool key. The value-mode `openclaw config set` above is **overwrite-only** on this image, so it cannot additively merge those shared global arrays without clobbering another already-admitted plugin (e.g. `klodi`). The bin therefore runs the shipped admission helper — the sibling package `bin` `sil-openclaw-allowlist` (same artefact as the `openclaw:allowlist` script) — which performs the **additive, idempotent, atomic, self-validating** three-surface merge (`plugins.allow` + `tools.alsoAllow` + `plugins.entries.sil`). **If the helper exits non-zero (a failed admission), the bin reports `persistence_failed` with the path + cause and does NOT declare `created`** — never a green `created` over still-filtered tools.
66
-
67
- 8. **Validates with the host's OWN check, THEN declares created.** The bin runs `openclaw config validate --json`. The verdict is `{ valid, path, issues? }` — success keys off **`.valid`**, never an `ok` field. Only when `valid: true` **and** the admission (step 7) succeeded does it report **`created`**. If `valid: false`, the admission helper exited non-zero, or any step failed, it reports **`persistence_failed`** with the failing **path** + **cause** (the `issues?`).
68
-
69
- 9. **On any failure after writes begin, tears down — leaving nothing partial.** The bin snapshots `openclaw.json` before step 3 and, on any failure, **restores that whole-file snapshot** (reversing the `agents.list` entry + the skill + the plugin + the trust admission in one atomic op), then removes the workspace dir (only if it created it) and the singleton shopper dir (only if it did not pre-exist). This returns the host to its **exact pre-run state** — a co-installed `klodi` that was trusted pre-run stays trusted — so `persistence_failed` truthfully means **nothing partial** is left.
70
-
71
- The bin emits **one** `{ status, … }` JSON result and exits 0 **only** on `created`.
72
-
73
- ## Status taxonomy (agent-creation engine)
91
+ The skill **attach** makes the agent know how to drive the tools; the plugin **enable**
92
+ turns sil on — but does not un-filter the tools by itself (next step).
93
+ 7. **Admit sil at the host allow surfaces.** Until sil is admitted at `plugins.allow` +
94
+ **`tools.alsoAllow`**, the host keeps the `sil_*` tools filtered. The value-mode `config
95
+ set` above is overwrite-only, so it cannot additively merge those shared arrays without
96
+ clobbering another admitted plugin (e.g. `klodi`). The bin runs the shipped admission
97
+ helper — the sibling bin `sil-openclaw-allowlist` (the `openclaw:allowlist` script) —
98
+ the additive, idempotent, self-validating three-surface merge. **If the helper exits
99
+ non-zero (a failed admission), the bin reports `persistence_failed` with the path +
100
+ cause and does NOT declare `created`** — never a green `created` over filtered tools.
101
+ 8. **Bind the current channel — FAIL-OPEN.** Resolve the channel (`spec.channel`, else the
102
+ host's `OPENCLAW_MCP_MESSAGE_CHANNEL`) and, if one resolves, run `openclaw agents bind
103
+ --agent <agentId> --bind <channel> --json`, then **verify** the route stuck (read-back +
104
+ `openclaw config validate` still passes). If undetermined, owned by another agent (no
105
+ `--force`), or unverifiable, revert any partial route and degrade to a manual-bind hint
106
+ in `warnings` — this step **never fails creation**.
107
+ 9. **Validate with the host's own check, THEN declare created.** `openclaw config validate
108
+ --json` returns `{ valid, path, issues? }` — success keys off **`.valid`**, never an
109
+ `ok` field. Only when `valid: true` **and** admission (step 7) succeeded does it report
110
+ **`created`**, carrying `boundChannel` (or `null`). Otherwise it reports
111
+ **`persistence_failed`** with the failing **path** + **cause**.
112
+ 10. **On any failure after writes begin, tear down** — restore the pre-run `openclaw.json`
113
+ snapshot (reversing the agent entry + skill + plugin + admission + any channel
114
+ binding), remove the workspace dir (only if it created it) and the singleton shopper
115
+ dir (only if it did not pre-exist). `persistence_failed` truthfully means **nothing
116
+ partial** is left. In the rare case teardown cannot fully revert, the bin reports a
117
+ distinct, louder outcome that **names the residue** — never voiced as "nothing partial".
118
+
119
+ The bin emits **one** `{ status, … }` result and exits 0 **only** on `created`.
120
+
121
+ ## Status taxonomy
74
122
 
75
123
  | `status` | Meaning | What to do |
76
124
  |---|---|---|
77
- | `created` | Shopper added, shared user spec materialized, sil plugin + skill wired, `openclaw config validate` accepted it. Carries `name` + `agentId` + `workspace`. | Tell the user it's ready and how to open it. |
78
- | `invalid_request` | Spec failed validation (missing/blank field). **Nothing attempted.** | Name the field, fix it, run the command again — nothing reached `openclaw agents add`. |
79
- | `collision` | A shopper already exists (the singleton), or the `agentId` clashes. **Nothing written.** | Surface it — "a shopper already exists"; steer to shop-a-new-niche (lazy mint) or refine. **Never mint a second shopper.** |
80
- | `persistence_failed` | A write, the allow-list admission helper (non-zero exit), or `openclaw config validate` step failed. Teardown ran — **nothing partial** left. | Fix the reported path/cause, run the command again (a re-run is safe). |
81
-
82
- In the **rare** case teardown itself cannot fully revert (e.g. the agent was added but reverting it fails), the bin reports a **distinct, louder** outcome that **names the residue** — do **not** voice that as `persistence_failed`'s "nothing partial"; tell the user exactly what remains and where.
125
+ | `created` | Shopper added, shared user spec materialized, plugin + skill wired, `openclaw config validate` accepted it. Carries `name` + `agentId` + `workspace` + `boundChannel` (or `null`). | Tell the user it's ready; if `boundChannel` is `null`, relay the manual-bind hint. |
126
+ | `invalid_request` | Spec failed validation. **Nothing attempted.** | Name the field, fix it, run again. |
127
+ | `collision` | A shopper already exists (the singleton), or the `agentId` clashes. **Nothing written.** | Surface "a shopper already exists"; steer to shop-a-new-niche or refine. **Never a second shopper.** |
128
+ | `persistence_failed` | A write, the allow-list helper (non-zero exit), or `openclaw config validate` failed. Teardown ran — **nothing partial** left. | Fix the reported path/cause and re-run (safe). |
83
129
 
84
130
  ## Runtime — how the shopper loads its behaviour
85
131
 
86
- When you (the sil skill) start a session as the shopper, the host has already injected the persona via the workspace **`SOUL.md`**. Then read `$SIL_DATA_DIR/shopper/profile.json` and load:
87
- - the **shared `user_spec.md`** — the person's cross-niche facts + hard constraints (seeded partial, augmented per-query), reused across **every** niche;
88
- - the slug-keyed **`domains`** map — the niches the shopper has already learned. An **empty** map is healthy; the per-domain packs (`domains/<slug>/{domain_spec,intent_spec,playbook}.md`) load **lazily at shop time**, not here.
89
-
90
- Loading these is what lets the shopper shop any niche with no further setup. When the user states a shopping intent, shop per [`shop_loop.md`](shop_loop.md) — the loop that classifies the niche, **reuses an existing domain or mints one on the fly**, then on **every query** web-refreshes that domain's spec, decomposes the request along its intent-spec dimensions (the ephemeral per-query intent), and **learns** every query (a fact → the shared `user_spec.md`, a taste → the active domain's `playbook.md`, each via a single `sil_remember` append). Because the `sil_*` tools were admitted at create, the shopper calls **`sil_search`** / **`sil_product_get`** (and `sil_register` / `sil_whoami` as needed) on the user's intent with **no further setup**, minting each niche's domain pack on the fly the first time the user shops it. To sharpen the shopper or one of its domains from observed sessions, see [`refine_shopper.md`](refine_shopper.md).
132
+ When you (the sil skill) start a session as the shopper, the host has already injected the
133
+ persona via **`SOUL.md`**. Load the shared **`user_spec.md`** (cross-niche facts + hard
134
+ constraints, reused across every niche); its frontmatter carries the shopper **name**, and
135
+ `sil_profile_search` scans the domains it has learned — an empty set is healthy, and each
136
+ per-domain method loads **lazily at shop time**. Because the `sil_*` tools were admitted at
137
+ create, the shopper calls **`sil_search`** / **`sil_product_get`** (and `sil_register` /
138
+ `sil_whoami` as needed) with **no further setup**, minting each niche on the fly the first
139
+ time the user shops it, per [`shop_loop.md`](shop_loop.md). To sharpen the shopper or a
140
+ domain, see [`fill_and_feedback.md`](fill_and_feedback.md).