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.
@@ -0,0 +1,68 @@
1
+ ---
2
+ name: setup-onboarding
3
+ description: The one-time setup script the router defers to — the five-stage onboarding progression, the after-register shopper offer, and the per-search pitch. Load while a shopper is still being set up (SKILL.md routes here); it is shed once setup is complete.
4
+ ---
5
+
6
+ # Setting up the shopper — the staged onboarding
7
+
8
+ The router defers the **one-time setup script** here: the five-stage **progression**, the
9
+ after-register offer, and the per-search pitch. None of it applies once setup is complete
10
+ — the router sheds it. Read every stage from state, never guess: `sil_whoami` (is there a
11
+ sil identity yet?) plus the no-arg `sil_profile_get` overview (does a shopper exist — the
12
+ `name` field — and does it hold any `domains`?). Present **only the current stage's beat
13
+ and its single next step**.
14
+
15
+ ## The five-stage progression — present one stage, shed it on completion
16
+
17
+ 1. **Unregistered** — `sil_whoami` finds no sil identity. Before `sil_register` runs, set
18
+ the expectation: state plainly what registering does and **how 4GPTs & SIL use the
19
+ user's data**, grounded strictly in this plugin — no invented policy. Registering opens
20
+ a browser sign-in and creates their **sil identity** (name + addresses, read by
21
+ `sil_whoami`), stored **locally**; their shopper's setup and memory live in a **local
22
+ profile store** under `$SIL_DATA_DIR`, never leaving the device via the plugin; catalog
23
+ **search** queries sil's product catalog. Next: `sil_register`.
24
+ 2. **Registered, no shopper** — a sil identity exists, no shopper yet. Bare `sil_search`
25
+ works now, but is not the finished state. Guide the user to **set up their shopper**,
26
+ naming **up front, before the onboarding starts**, that it takes a **couple of minutes
27
+ and a few questions**. The after-register offer below owns the gate.
28
+ 3. **Shopper, no domain yet** — `name` present, `domains: []`. The first shopping intent
29
+ **mints the first domain**, announced with the inferred niche stated so the user can
30
+ correct it. Next: state a shopping intent.
31
+ 4. **Shopper active** — `name` present, `domains` non-empty. Check off the completion
32
+ **milestones**: the **first domain created** (`domains` now non-empty) and, softer, that
33
+ the learn tool has been used (`sil_learn` stored a fact or taste — a soft self-check
34
+ judged from whether this shopper has ever learned anything).
35
+ 5. **Setup complete** — a shopper with at least one domain. **Shed** every onboarding beat:
36
+ none of the stages above apply. **Show only how to use** the plugin well — the
37
+ **domain-gated shop loop** and **Spec-Driven Shopping** ([`shop_loop.md`](shop_loop.md)).
38
+
39
+ ## After register — offer to set up the shopper, once (offer_shopper)
40
+
41
+ `sil_register` returns `already_registered` with `next_step: "offer_shopper"` on a
42
+ confirmed registration. That hint is a breadcrumb: first run a **no-arg `sil_profile_get`**
43
+ (the overview) to read shopper state, then branch:
44
+
45
+ - **Empty store — no shopper yet:** introduce the shopper in one short beat and offer to
46
+ set it up — name the value (it shops each niche in depth, reuses the sizes and hard
47
+ limits it already knows so nothing is re-asked, explains why each pick fits). Load
48
+ [`brainstorm_interview.md`](brainstorm_interview.md) **only if the user accepts** (a
49
+ yes). Take no for an answer; bare `sil_search` stays first-class.
50
+ - **A shopper already exists:** **skip this beat** entirely. The shopper is a **singleton**
51
+ — never offer a second one.
52
+
53
+ ## After a bare search — the per-search pitch (post-result)
54
+
55
+ When a plain `sil_search` **completes with status `ok`** in a **profile-less** session,
56
+ present the results best-first **exactly as they came back**, then append **one short
57
+ trailing line** naming what a shopper would add. It is never a pre-search question and
58
+ never a re-rank. Name one or two of the three levers, rotating which you lead with:
59
+
60
+ - **niche depth** — a shopper weighs these picks against how the niche actually buys;
61
+ - **memory** — it keeps your sizes and hard limits on file, so no search re-asks them;
62
+ - **the why** — it explains which pick fits you and why.
63
+
64
+ This line **recurs on every** completed profile-less search — the recurrence is the point;
65
+ there is **no fire-once or seen-it gate, and no cooldown**. Brevity plus lever rotation
66
+ keep it from nagging. Two things suppress it: a **shopper already exists** (that session is
67
+ the shopper's — **drop the line**), or the search **did not complete `ok`** (a non-ok
68
+ status carries its own recovery — follow that and add no tip).
@@ -1,134 +1,117 @@
1
- # Shop-time loop — how the one shopper shops any niche, minting domains on the fly
2
-
3
- Load this when you (the sil skill) are running as the user's **shopper** and they state a shopping intent ("find me something for a steak dinner around $40"). There is **ONE shopper** — a generalist that goes deep on whatever the user shops for — and it holds **many domains** (niches it has learned), each **minted lazily on first shop**. The [engine's Runtime hook](agent_creation_engine.md) ends where this loop begins: the host has injected the shopper's persona via the workspace **`SOUL.md`** (voice, standing rules, hard-no's), and the sil skill has read `$SIL_DATA_DIR/shopper/profile.json` — the **shared `user_spec.md`** (the person's cross-niche facts + hard constraints) plus the slug-keyed **`domains`** map. The per-niche packs load lazily, at shop time, per the beats below.
4
-
5
- This is **shop time**, not create time — behave like a specialist the user trusts, in the persona's voice. Consume the catalog tools **unchanged**; the rubric is applied by you at reasoning time, not by any new tool.
6
-
7
- This is **Spec-Driven Shopping (SDS)** over **one shopper, many domains**. The **shared `user_spec.md`** carries the person across *every* niche — a fact learned while shopping niche A is reused in niche B **without being re-asked**. Each domain's pack is scoped to that niche: **`domain_spec.md`** (deep researched niche expertise), **`intent_spec.md`** (the decomposition-dimension schema), and **`playbook.md`** (the **shopping taste** for *this* niche). **Taste does not leak across domains** — a price band or brand leaning learned in A lives in A's playbook, never B's; only the shared facts and cross-cutting values carry.
8
-
9
- The router's three always-on rules still hold (act-don't-narrate, follow the tool's own `recovery`, re-check the chosen item before commit) — this loop layers on top, it does not restate them.
10
-
11
- ## The five-beat spine — the order IS the spec, non-skippable on every query
12
-
13
- Every shopping query runs these five beats **in order**; the order is not a suggestion. "Non-skippable" governs your **reasoning**, not the user's inbox — every beat RUNS every query, but a beat only ASKS the user when something is genuinely unresolved (a fully-resolved query asks nothing and passes straight through):
14
-
15
- 1. **Domain-exists check first** — classify the query's niche, read `profile.json.domains` (via the no-args `sil_profile_get`), reuse a semantically-matching domain or register a miss. This precedes search — the shopper never reaches search without first resolving which domain the query belongs to.
16
- 2. **Learn the domain on a miss** — mint the domain on the fly (deep `domain_spec` + derived `intent_spec` + partial `playbook`), or web-refresh it on a hit. Either way the pack is present and current before the gate; the shopper never searches a niche it does not hold.
17
- 3. **Gather what's missing from the user, before searching** — the elicitation gate: decompose the request, resolve each dimension against the request + the shared `user_spec` + the active `playbook` (+ `domain_spec` defaults) FIRST, then ask **only for what is genuinely unresolved**. Runs to completion before any `sil_search`.
18
- 4. **Persist what surfaced** — append each surfaced fact/taste with a single `sil_remember`, fired only when something new surfaced.
19
- 5. **Then search → rubric → recommend-with-why → re-fetch before purchase.**
20
-
21
- ## Beat 1 — Domain-exists check first (every query, non-skippable)
22
-
23
- Before anything else, decide *which domain this query belongs to* and make sure the shopper holds it. No agent switch and no re-onboarding ever happens here — the **one** shopper handles every niche in the same session. This check is **non-skippable**: the shopper never reaches search without first resolving the domain.
24
-
25
- ### Classify the query's niche (skill reasoning — no tool call)
26
-
27
- From the user's words, name the **shopping niche** this request belongs to ("a waterproof trail shoe for a wet ultra next month" → trail running; "a first road bike" → road cycling). This is your own reasoning, not a tool call — you need the niche to decide whether the shopper already knows it.
28
-
29
- ### Reuse an existing domain before minting — semantic slug dedup is YOUR job
30
-
31
- Read `profile.json.domains` (via the no-args `sil_profile_get`) and match the classified niche against the slugs the shopper already holds **semantically — not by exact string**. If an existing domain covers this niche, **reuse it**: load that pack and go straight to the gate. The store enforces only *shape* (valid kebab, upsert-by-key) — it will happily mint `cycling`, `road-cycling`, and `bikes` as three thin packs for the **same** niche. **Reuse-before-mint is the shop loop's job**, load-bearing: without it the one shopper fragments into duplicate shallow domains and the "shop deep" promise dies. When torn between a close existing slug and a new one, **prefer the existing slug** — reuse over fragment. When no existing domain matches, register a **miss** — and learn it in Beat 2.
32
-
33
- ## Beat 2 — On a miss, learn the domain and how SDS decomposes in it
34
-
35
- The pack must be present **and current** before the gate. On a **miss**, mint the niche on the fly — the research that used to run at create time runs **here, on first shop in this niche**. On a **hit** (a reused domain), the parallel web-refresh keeps that domain's spec current. Either way the shopper never searches a niche it does not hold-and-currently-know.
36
-
37
- ### On a miss — mint the domain on the fly, announced
38
-
39
- When no existing domain matches, mint the niche **on the spot**:
40
-
41
- - **Announce it — never silently.** Tell the user, in the shopper's voice, that this is a new niche ("I haven't shopped cycling for you yet — setting that up"). **State the inferred domain so the user can correct it** before it is used; a mis-inferred niche is the user's to fix.
42
- - **Research the niche (web + knowledge).** Pull how to shop well in this niche deeply — its decision-attributes and mechanics — into a **deep `domainSpec`** (a shallow bullet list a layperson could write fails the SDS bar). Derive the **`intentSpec`** decomposition dimensions **from** that domain spec (agent-specific, a *schema* not a filled instance). Seed a *partial* **`playbook`** — the niche shopping taste, an honest non-blank "to be learned as we shop" body. If you lack a web tool, say so and compose the domain spec from well-established public shopping knowledge — never present a guess as verified research.
43
- - **Persist with the whole-doc `sil_profile_materialize` — WITH the `domain` object.** Call **`sil_profile_materialize { name, userSpec, domain: { slug, name, domainSpec, intentSpec, playbook } }`** — the **deduped slug** from Beat 1, the deep `domainSpec`, the derived `intentSpec`, the partial `playbook`; `userSpec` is the current **shared** spec (the call re-persists it atomically alongside). One atomic call upserts `domains[slug]`. This is a **whole-doc path** (see Beat 4 + the cheap/heavy split) — `sil_profile_materialize`, **never** `sil_remember`.
44
-
45
- ### On a hit — web-refresh the active domain's spec
46
-
47
- Before decomposing the request, go to the **web** and **enhance the active domain's `domain_spec.md`** so it stays current (new models, standards, prices, technique). Fold what you learn in and **persist** it by re-running **`sil_profile_materialize`** **with** the `domain` object carrying the updated `domainSpec` for this slug (the in-place re-mint — the same atomic store path the entry-mint and refine use). This is a **real web step** — if the host has no web/fetch tool, say so honestly and proceed on the existing domain spec; never pretend the refresh happened.
48
-
49
- ## Beat 3 — Gather what's missing from the user, before searching (the elicitation gate)
50
-
51
- This is the promoted gate — a first-class, ordered step, **not** a clause folded inside the domain or the persist beat. It runs to completion **before any `sil_search`**: decompose the request, resolve each dimension against everything already known, then ask the user **only for what is genuinely unresolved**. It always RUNS; it asks only when something is missing.
52
-
53
- ### Decompose the request along the intent-spec dimensions (ephemeral — NEVER persisted)
54
-
55
- Read the active domain's `intent_spec.md` — the decomposition **dimensions** a good query must resolve — and **fill them in for *this* request** from the user's words ("a waterproof trail shoe for a wet ultra next month, around €160" → use-case: trail/ultra; weather: wet; budget: ~€160; timeline: next month). State the filled decomposition back so the layering is legible. This filled instance is the **per-query intent** — **ephemeral**: it lives only in this conversation and is **NEVER persisted**. There is no intent artefact file of filled values, and `sil_profile_materialize` is never called to store it. Only the `intent_spec.md` *schema* is persisted; the fill is throwaway.
56
-
57
- ### Resolve each dimension, then elicit ONLY what is genuinely unresolved
58
-
59
- For each decomposition dimension, **resolve it FIRST against — in order — the request's own words, the shared `user_spec` (standing facts + hard constraints, reused across every niche), the active `playbook` (this niche's standing taste), and any defensible `domain_spec` default.** Only then elicit, and elicit **only what is genuinely unresolved**. A dimension is genuinely unresolved, and *only then* asked, when it is **BOTH**:
60
-
61
- - **load-bearing** — the active `domain_spec` / `intent_spec` marks it as materially changing the recommendation in this niche (not asked for completeness's sake), **AND**
62
- - **still unfilled** after the resolve above — the request did not state it, and neither the shared `user_spec` nor the active `playbook` nor a domain default supplies it.
63
-
64
- Elicitation is **need-driven**: only a dimension **missing** from BOTH the request AND the stored side is elicited — ask **only for what** a defensible pick actually needs, in the persona's voice, one or a few questions at a time, each tied to *why* the pick needs it — **never a battery**, never a form or questionnaire. An attribute the shared `user_spec` or the active `playbook` **already holds is never re-asked** — the stored value fills it silently; re-asking a known fact or taste is the exact defect this spine kills. When the request plus the stored side already carry every load-bearing dimension, **ask nothing and pass straight through** to Beat 5 — the gate is **bounded**, it does not hold the user hostage for perfect completeness. Elicitation gates search **quality, not access**: if the user skips or can't answer an elicited question, proceed on the **best defensible params**, state what you assumed, and never block shopping — a declined question narrows quality, never a dead-end.
65
-
66
- ## Beat 4 — Persist what surfaced (fact → shared user spec, taste → active domain)
67
-
68
- When the gate surfaces a new user **fact** (a measurement, a compatibility detail, a hard constraint) or a new **shopping taste** for this niche (price sensitivity, brand leaning), persist it with a **single `sil_remember` call** — fired **only when something new surfaced** — so a future query fills it from the store instead of re-asking:
69
-
70
- - A **fact / measurement / hard constraint** → **`sil_remember { kind: "fact", text, hard? }`** — the **cheap append** that adds one entry to the **shared** `user_spec.md` *without* re-emitting the whole doc. A fact carries across **every** niche (it never takes a `domain`). Mark a true, never-break rule ("never leather", "nothing over 8 kg", an allergy, an age gate) with **`hard: true`** so it appends as an inviolable constraint the reject-at-pick rule can grep; a bendable fact is a plain **soft** entry.
71
- - A **shopping-taste preference** (budget band, brand likes/dislikes) → **`sil_remember { kind: "taste", text, domain }`** — one entry appended to **this niche's** `playbook.md`, the **active domain**. Pass the active domain's `domain` slug whenever the shopper holds more than one niche (with 2+ domains, omitting it is ambiguous and rejected). Taste is always **soft** — never `hard` — and is **scoped to this domain**: it shapes this niche's picks only, never another's.
72
-
73
- **`sil_remember` is THE per-query persist verb** for a freshly surfaced fact or taste — the lightweight append the shopper takes *every query*, so rich information from the interaction is never lost under load. Reserve the **whole-doc `sil_profile_materialize`** round-trip for the heavy paths ONLY: the **Beat-2 mint** of a new domain, the Beat-2 domain-spec **web refresh**, a full **refine**/overwrite ([`refine_shopper.md`](refine_shopper.md)), and **contradiction-resolution** — when a new statement *contradicts* a stored soft preference, that visible rewrite is the whole-doc path, because an append is **accretive, never corrective**.
74
-
75
- The shared user spec and the active domain's playbook **grow incrementally, per-query** — augmenting what is there, never a big up-front form. Fire this persist **only when something new actually surfaced** — a measurement stated, a brand preference revealed, a hard constraint learned, that the shared user spec / this domain's playbook did **not already hold**. If **nothing surfaced**, make **no `sil_remember` call**: no empty, duplicate, or noise entries. One discrete learning per call — two facts and a taste are three calls. A request that contradicts a stored **soft** preference **updates** it visibly (the whole-doc re-materialize); a **hard constraint** is not overridden (see precedence). Everything is **per-user, per-shopper, and local** — written only to this user's `$SIL_DATA_DIR/shopper/`, no server aggregation, no cross-user signal. Capture is **in the open**: each new fact or taste is elicited **in-context, in the persona's voice, only when a dimension needs it** — never silently harvested — and the user can review everything the shopper has stored with `sil_profile_get` (overview + per-domain) and erase a niche with `sil_profile_remove`.
76
-
77
- ### Layering — precedence intent > playbook(domain) > user_spec(SHARED) > domain_spec(domain)
78
-
79
- - **Intent** (the per-query decomposition) narrows the field — what this request demands.
80
- - **Playbook** (this domain's shopping taste) shapes preferences — price sensitivity, brand, taste — within what the intent allows. Scoped to the **active domain** only.
81
- - **User spec** (the **shared**, agent-level spec) fills standing **facts** the request left unsaid (a measurement kept from before, a compatibility constraint) — never re-asked, reused across every niche — and carries the **hard constraints**.
82
- - **Domain spec** (this domain's) supplies the **decision-mechanics and trade-offs** to reason over (for trail running, last volume and lug depth matter more than weight here) — the substrate, not a tiebreaker over the user's wants.
83
-
84
- **Precedence resolves conflicts: intent > playbook > user_spec > domain_spec — for *preferences*.** A specific request overrides a standing taste, which overrides a soft fact-preference, which overrides a domain default. **Exception — hard constraints are inviolable:** a shared `user_spec.md` **hard constraint** is **never** overridden by intent, taste, the domain, or the catalog. Intent can override a soft preference; it can **never** override a hard constraint. A weight bends; a hard constraint does not.
85
-
86
- **Route every hard constraint to a real enforcement point, never only soft `query` text.** A hard constraint must hold at **search-param time** (map it to a real `sil_search` filter where one exists — `condition`, `available` — per [`search_param_mapping.md`](search_param_mapping.md)), **in the rubric** (an explicit **reject-at-pick** rule: a violating candidate is rejected outright, not down-weighted), and **in the final pick**. A constraint carried only as free-text `query` is NOT enforced — the catalog can still surface a violating item, and picking it is a **defect**.
87
-
88
- > **Terminology — "reject-at-pick" here = the "reject-at-…-rule" phrasing in [`search_param_mapping.md`](search_param_mapping.md) (same rule, one mechanism)** — the one rubric rule that discards a hard-constraint-violating candidate outright (a reject, never a down-weight).
89
-
90
- ## Beat 5 — Search → rubric → recommend-with-why → re-fetch before purchase
91
-
92
- With the domain present, the gate run to completion, and anything surfaced persisted, run the search tail. This tail is **re-ordered, not re-designed** — best-first, never re-rank, reject-at-pick for hard constraints, re-fetch before purchase.
93
-
94
- ### Map the answers to well-formed `sil_search` params
95
-
96
- Translate each filled intent dimension — **plus the shared user-spec facts, this domain's shopping taste, and the domain-spec mechanics** the layering brought in — to a **real `sil_search` param** per [`search_param_mapping.md`](search_param_mapping.md). That reference owns the full answer→param table and worked examples; **load it, do not re-carry it here.** The load-bearing rules that govern this step:
97
-
98
- - A stated taste with **no matching param** (a colour, a brand) folds into the `query` text or the rubric — you **never invent a filter**. There is no `color` param, no `brand` param.
99
- - A user-spec **hard constraint** maps to a **real filter where one exists** (`condition`, `available`) so the catalog never returns a violating item; where no param matches, it does NOT collapse to `query` text — it becomes an explicit **reject-at-pick** rubric rule (the compare step).
100
- - Leave **`ship_to` empty** by default so the server resolves the registered default address. Do **not** call `sil_whoami` to populate it.
101
-
102
- ### Search
103
-
104
- Call `sil_search` with the mapped params. It returns purchasable variants **best-first**.
105
-
106
- ### Compare the candidates on the rubric — reject hard-constraint violators outright
107
-
108
- The **rubric emerges here, at pick time** — not a stored seller artefact. Build it from the active **domain-spec dimensions and trade-offs** (last volume vs. weight, rim depth vs. crosswind — the mechanics the domain spec named) **weighted by this domain's shopping taste** (`playbook.md`), the **shared user facts** (`user_spec.md`), and the **per-query intent**. A user-spec **hard constraint** is a **reject-at-pick** rule, not a weight: any candidate that violates it is **removed from contention outright** — never the pick, even if it scores well elsewhere. (A soft preference only down-weights.) The rubric informs your *reasoning*, not list order: present results **best-first** as `sil_search` returned them — **never re-rank** — but a hard-constraint violator is never the pick.
109
-
110
- ### Recommend — always with the "why" that cites the layers
111
-
112
- Recommend with **domain-relevant rationale** in the shopper's voice — the **"why"** must make the layering **legible**: cite the **per-query intent** (what this request demanded), at least one **stored shared-user fact or this-domain taste you did NOT re-ask** ("you're a wide D-width, kept from before"), and at least one **researched domain-spec dimension** ("for trail running, last volume and lug depth matter more than weight here") — tied to the user's priorities. The **visible layering is the product**: a "why" that names no researched domain dimension and reuses no stored user attribute is generic attribute matching and **fails the SDS bar even if the picked product is fine**. Never hand back a bare list.
113
-
114
- ### Re-fetch with `sil_product_get` before any buy
115
-
116
- Price, availability, and `checkout_url` from `sil_search` are **point-in-time**. Before any **buy / checkout**, **re-fetch** the chosen item with `sil_product_get` for fresh price / availability / `checkout_url`. **Never commit a buy off the stale `sil_search` snapshot.**
117
-
118
- ### After the recommendation — capture what surfaced via `sil_remember`
119
-
120
- **After every recommendation, before the turn ends**, persist anything new the interaction surfaced that Beat 4 did not already capture — each via its **own single `sil_remember`** call (a person fact with `kind: "fact"` → the shared user spec, a niche buying taste with `kind: "taste"` + the active `domain` → this domain's playbook). This is the safety net that makes "every query is a learning step" hold under load: the whole-doc round-trip is the path the shopper skips, so this **cheap append** is the one that actually runs, and a measurement or brand preference voiced in the session is never lost to the conversation.
121
-
122
- Fire this capture **only when something new actually surfaced** — a measurement stated, a brand preference revealed, a hard constraint learned, that the shared user spec / this domain's playbook did **not already hold**. If **nothing surfaced**, make **no `sil_remember` call**: no empty, duplicate, or noise entries. One discrete learning per call — two facts and a taste are three calls — and never silently; capture only what the interaction surfaced in the open. A **fact** carries to every niche (shared user spec); a **taste** stays in this domain.
123
-
124
- ## When `sil_search` returns `ok` with `products: []` — relax and explain
125
-
126
- An empty result on `status: ok` is a normal, servable outcome — **never a silent dead-end**. **Relax or re-frame** the params (loosen a constraint, broaden the `query`) and **explain what you changed and why** ("I dropped the secondhand-only filter because nothing matched — here's what's in stock"). Never just stop silently.
127
-
128
- ## When the domain is genuinely unservable — an honest "no", never junk
129
-
130
- When the catalog **cannot serve** the niche — out of scope, **not shippable**, **age-gated**, or persistently empty after a reasonable relax — say so **honestly**. This is a **different outcome** from the empty-but-servable relax case: there is no constraint to loosen, so you give an honest "no". **Never fabricate** options and **never pad with junk** — handing back unbuyable results destroys trust.
131
-
132
- ## When `sil_search` / `sil_product_get` returns a non-`ok` status
133
-
134
- A non-`ok` status is **not an empty match** — do **not** treat a `retryable` or an auth failure like `products: []` and relax the params. **Follow the tool's own `recovery` hint** exactly and **never improvise**. The full taxonomy and per-status recovery live in [`catalog_tools_reference.md`](catalog_tools_reference.md) — **load it, do not re-carry the taxonomy here.**
1
+ ---
2
+ name: shop-loop
3
+ description: The six-beat Spec-Driven Shopping loop — the state machine the shopper runs on every niche. Owns Beat 1 (classify), Beat 4 (search-space) and Beat 5 (reflect); routes Beats 2, 3 and 6 to the references that own them. Load when shopping as the shopper.
4
+ ---
5
+
6
+ # The six-beat Spec-Driven Shopping loop
7
+
8
+ As the shopper you run one loop on every request — a **six-beat** state machine.
9
+ Most of it is reasoning over what you already know; you only ask the buyer about
10
+ the genuine residue. The beats run **in this order**:
11
+
12
+ 1. **Classify** — resolve the request's `{domain, product, intent}` and reuse a
13
+ learned domain/PRD before minting (owned here, below).
14
+ 2. **Method load / mint / refresh** — recover or research the domain's method +
15
+ its intent-keyed PRDs — [`method_and_prds.md`](method_and_prds.md).
16
+ 3. **Fill** — resolve the PRD by precedence, eliciting only the residue (Beat 3).
17
+ 4. **Search-space** — project the filled PRD into a bounded fan-out (owned here).
18
+ 5. **Reflect** — judge best-available against the PRD + method (owned here).
19
+ 6. **Feedback** — capture what the reaction surfaced (Beat 6).
20
+
21
+ Beats 2, 3 and 6 live in their references; this file owns Beats 1, 4 and 5.
22
+
23
+ ## Beat 1 — Classify: `{domain, product, intent}`, reuse before mint
24
+
25
+ Resolve the request through **three coordinates, top-down**: the **domain** (the
26
+ niche that owns the method), the **product** type within it, and the **intent**
27
+ (the use-context that reshapes the requirements). **Intent is always present**: a
28
+ **context-free** request keys the `general` intent (`ski/boots-general`), so every
29
+ job carries all three coordinates and stays uniformly queryable.
30
+
31
+ **Reuse-before-mint.** Query existing coordinates with **`sil_profile_search`**
32
+ (the frontmatter-as-truth discovery tool — never a filesystem guess) and
33
+ **semantic-match** the request against them: **prefer existing** when a learned
34
+ domain/PRD already covers the job, and only mint when nothing does. The one guard
35
+ against over-merging is the requirements-divergence test — two requests share a
36
+ PRD only if they resolve to the same requirements.
37
+
38
+ **Never over-ask just to key.** Keying **never** forces an extra question: a
39
+ silent request keys `general` and moves on. When intent is genuinely
40
+ requirement-defining but the request is silent, that surfaces as the first Beat-3
41
+ question — not a keying interrogation here.
42
+
43
+ **Announce a mint.** A new-domain or new-PRD mint is **announced** — state the
44
+ inferred `domain / product / intent` so the buyer can **correct** it — **never
45
+ silent**. A reuse passes through with no announcement.
46
+
47
+ ## Beat 4 — Search-space: a bounded, priority-ordered fan-out (not a re-rank)
48
+
49
+ Project the filled PRD onto **`sil_search`** as a **bounded ≤ 4 priority-ordered**
50
+ fan-out, not one search and not unbounded — the bound is a production budget (each
51
+ call is a round-trip + tokens):
52
+
53
+ - **Call 1 is the tightest projection of the PRD's core** (its load-bearing
54
+ requirements); **calls 2–4 are deliberate widenings** — relax the least
55
+ load-bearing requirement, an adjacent phrasing that improves recall, or an
56
+ explicit either/or branch. **Core first, widenings after** — that is the
57
+ **priority order**.
58
+ - **Merge by dedup + concatenate in issue order — this is NOT a re-rank.**
59
+ Concatenate the per-call backend-ranked lists in issue order and **drop** any
60
+ product already **seen** in an earlier call. Because issue order *is* priority
61
+ order, concatenation **never re-ranks** a backend list nor lifts a peripheral
62
+ hit above a core one — the engine owns order *within* each call, the fan-out
63
+ owns order *across* calls.
64
+ - **Project each requirement onto existing params, then `specs` predicates, then
65
+ query enrichment — in that order.** Map each requirement onto the tightest real
66
+ channel:
67
+ 1. an **existing** `sil_search` **param** where one fits (`category`,
68
+ `price_min`/`price_max`, `condition`, `available`, `local_merchants`);
69
+ 2. else a structured **`filters.specs` predicate**, built from the method's
70
+ Beat-2 canonical `## Search vocabulary` (the `sil_specs`-coined names) — one
71
+ `{ns, key, op, value, unit?, hard?}` per annotated requirement, marking an
72
+ inviolable one `hard:true`. **Prefer a dedicated param over a predicate** for
73
+ the SAME attribute — never send both (a `price_max` param OR a price spec, not
74
+ both);
75
+ 3. else — a purely descriptive residue (a colour, a phrasing) — fold it into the
76
+ free-text `query`, which **you author yourself**. The plugin is **pure
77
+ transport**: it never folds a predicate into `query`, so a requirement that
78
+ belongs in `filters.specs` stays a predicate, never `query` prose.
79
+ Leave **`ship_to`** empty (the server resolves the registered default). **Never
80
+ invent** a param or a predicate that isn't real — the params live in the
81
+ `sil_search` description, the predicate vocabulary in the domain method (see
82
+ [`search_param_mapping.md`](search_param_mapping.md)). Then read the per-predicate
83
+ **`specs_status`** the response returns (each `{ns, key, applied}`) — it feeds
84
+ Beat 5's honesty pass, which rejects at pick any `hard` predicate the backend left
85
+ `applied:false`.
86
+
87
+ ## Beat 5 — Reflect: honesty pass first, judgment not threshold, propose-and-wait
88
+
89
+ Take Beat 4's merged issue-order list and its per-call `specs_status`. Run in
90
+ order — **honesty pass → judge → branch** — and **never re-rank**: the engine owns
91
+ order, you own the verdict.
92
+
93
+ **1 — Honesty pass, first.** Before judging fitness, walk the survivors and
94
+ **reject-at-pick** any candidate that violates a *hard* constraint the backend
95
+ could not enforce — exactly the predicates the response marked **`applied:false`**,
96
+ plus the `user_spec` `[hard]` markers. A violator is removed from contention, never
97
+ the pick; if rejection empties the set, fall through to the empty path.
98
+
99
+ **2 — Judge, then branch.** Weigh the best surviving candidate against the PRD +
100
+ method. Whether it satisfies or falls short is a **judgment** call, **not a
101
+ threshold** and not a mechanical any-unmet-requirement rule — read the whole set.
102
+
103
+ - **Satisfies → a hero + 1–2 justified alternatives.** Lead with **one**
104
+ recommendation carrying the SDS-bar *why* (a met requirement, a researched method
105
+ mechanic, and a stored preference reused without re-asking), then **one or two**
106
+ considered **alternatives**, each with a one-line reason. Best-first **as
107
+ returned** — **never re-rank**, never a bare list.
108
+ - **Shortfall or empty → propose a specific relaxation and wait.** Name the gap,
109
+ show the closest survivors, and **propose** the specific change that would widen
110
+ it — then **wait** for the buyer's nod. **No silent re-search** and no silent
111
+ auto-widen; the buyer can redirect instead.
112
+
113
+ A **non-`ok`** status is not an empty match — do not relax params; follow that
114
+ tool's own **`recovery`** exactly.
115
+
116
+ **Then Beat 6.** The buyer's reaction to the recommendation is what Beat 6 captures
117
+ — [`fill_and_feedback.md`](fill_and_feedback.md).
@@ -1,56 +0,0 @@
1
- # Manage your shopper's domains — view, forget
2
-
3
- Load this when the user wants to see what their **shopper** knows or **forget a domain** (a niche) — "what does my shopper know?", "which domains has it learned?", "show me the cycling domain", "forget the grocery niche". The router in `SKILL.md` names which `sil_profile_*` tool each intent maps to; this reference is what those tools do, plus the **two remove granularities** and the confirm-before-remove gate.
4
-
5
- These are pure local-lifecycle operations over the two stores the create-engine established — **host config + workspace `SOUL.md` = wiring + persona; `$SIL_DATA_DIR/shopper/` = the shared user spec + per-domain packs**. No server call, no token read, no identity coupling: a shopper with zero domains still shops generically — the first shop in a niche mints it. The shopper is a **singleton**, scoped to the fixed `$SIL_DATA_DIR/shopper/` path, so these tools take **no caller `agentId`** — only an optional `domainSlug` to address one niche.
6
-
7
- **The source of truth for "what the shopper knows" is the sil artefact store, not the host agent list.** The directory `$SIL_DATA_DIR/shopper/` with a readable `profile.json` IS the shopper; its `domains` map is the niche index. A bare host `agents.list[]` entry without a `profile.json` is just a host agent, not ours to view/forget. Always read `profile.json`, **never the host agent list**, to decide what exists.
8
-
9
- ## Match intent to a tool
10
-
11
- | Intent | Tool |
12
- |---|---|
13
- | "what does my shopper know?" / "which domains has it learned?" / "show me the shopper" (overview) | `sil_profile_get` (no `domainSlug` — the overview absorbs the old listing) |
14
- | "show me / tell me about the <niche> domain" | `sil_profile_get` (pass the `domainSlug`) |
15
- | "forget / remove / delete the <niche> domain" | `sil_profile_remove` (pass the `domainSlug`) |
16
- | "decommission / tear down my whole shopper" | host CLI `openclaw agents remove <agentId>` **FIRST**, then clear the artefact tree (see the two granularities) |
17
-
18
- ## How the read tool behaves
19
-
20
- `sil_profile_get` reads the **singleton** shopper in two modes:
21
-
22
- - **No `domainSlug` (overview — the folded listing):** returns the shopper's `name`, the **shared `userSpec`** (the person's cross-niche facts + hard constraints), and the **`domains` index** (each niche's `slug`, `name`, `createdAt`, `updatedAt` — no per-domain bodies), plus any degraded directory in **`unreadable`**. A shopper **with no domains yet still reads ok, with an empty domain index — that is healthy, not an error** (the first shop in a niche mints it); so is an empty store ("you haven't set up a shopper yet" → point at create — it returns `ok`, never `not_found`). Render a human summary: the shopper, what it knows about the user (shared facts + hard constraints), the domains it has learned, and a wiring summary (a real host agent, sil plugin enabled, sil skill attached, ready with no further setup). A degraded/legacy directory lands in `unreadable` — mention it inline, but never let it hide the healthy state. (A flat-layout directory left over from the retired one-agent-per-niche model reads as `unreadable` — frame it as an **old-model leftover** and steer the user to re-create their shopper; do not try to read it as a domain.)
23
- - **With a `domainSlug` (one domain):** returns that niche's pack — `domainSpec` + `intentSpec` + `playbook` (the niche buying taste) **plus** the shared `userSpec`. Render the niche (from the domain spec), its decomposition dimensions, and the buying taste learned for it. An unminted/unloadable domain returns `not_found` (its `recovery` is `sil_profile_get`, the no-args overview) — frame it plainly ("no `<slug>` domain — here's what the shopper has learned") and list what DOES exist. **Never surface a stack trace or a raw filesystem path.**
24
-
25
- ## The two remove granularities — forget a domain vs decommission the shopper
26
-
27
- Removal is **destructive and irreversible**, so **confirm before removing**: state exactly what will be deleted and proceed only on the user's **explicit go-ahead**. There are **two distinct granularities** — pick the one the user means, and when ambiguous, ask:
28
-
29
- ### Forget ONE domain (the common case — `sil_profile_remove`)
30
-
31
- "forget the grocery niche", "remove the cycling domain", **"delete the grocery agent"** now mean **forget that one DOMAIN** — the niche pack only. The shopper, the **shared user spec**, and **every sibling domain survive**. This is the **artefact half only**, scoped to one niche; **no host wiring is touched** (the shopper agent stays):
32
-
33
- - Call **`sil_profile_remove { domainSlug }`** — `domainSlug` is **REQUIRED** (it never deletes the whole shopper). It removes exactly the one `domains/<slug>/` leaf and de-registers it from the manifest. A malformed/traversal/`main`/missing slug returns `invalid_request` and deletes nothing; an unregistered slug returns `not_found` (idempotent — safe to re-run); a filesystem failure returns `persistence_failed`.
34
- - After it, confirm the domain is gone and the shopper, the shared user spec, and its **sibling domains are untouched**.
35
-
36
- ### Decommission the WHOLE shopper (the host-CLI-first path)
37
-
38
- "tear down my shopper", "decommission the whole thing" means remove the **entire shopper** — host wiring + `SOUL.md` + the whole artefact tree. This is the **host-CLI-first** flow, for the **whole agent** (not a single niche):
39
-
40
- 1. **Existence check (read).** Run `openclaw agents list --json` and confirm the `agentId` is the sil-wired shopper.
41
- 2. **Remove the host wiring (host CLI) — FIRST.** Run `openclaw agents remove <agentId>`, then `openclaw config validate --json` to confirm the host config is still valid. The plugin cannot write the host config, so this half is the host CLI's and runs ahead of the artefact removal.
42
- 3. **Remove the sil artefacts — SECOND.** Clear the shopper's whole `$SIL_DATA_DIR/shopper/` tree (the shared user spec + every domain pack). `sil_profile_remove` is **per-domain** by design (its `domainSlug` is required), so decommissioning the shopper's full tree is the host-side concern, not a single tool call — remove each domain, or clear the shopper directory as part of the host teardown.
43
-
44
- **Never artefacts-first for the whole-shopper path.** The order is a safety decision: a failed artefact step after the host removal leaves only *residual artefacts with no host entry* — harmless disk cruft the no-args `sil_profile_get` still surfaces, so the user retries clean. The **reverse** is unsafe — artefacts gone, then a failed host step, leaves a *host entry whose `profile.json` is gone*: the agent still loads but the sil skill ENOENTs at runtime, a visibly broken shopper. Both halves are individually idempotent, so a re-run from any partial state converges to clean.
45
-
46
- Leave `plugins.entries.sil.enabled` alone on any removal — it is shared host state (the shopper depends on it), not per-domain. Even decommissioning the shopper leaves it enabled for a future re-create.
47
-
48
- ## Status taxonomy (manage: view / remove)
49
-
50
- | `status` | Meaning | What to do |
51
- |---|---|---|
52
- | `ok` | A view returned the overview (a shopper's `domains` may be empty — normal; an absent shopper is still `ok`, empty-is-healthy) or one domain's detail. | Relay the data; on an empty domain index, say so plainly and point at "just shop a niche". |
53
- | `not_found` | No domain matches the `domainSlug` (view or remove). Its `recovery` is `sil_profile_get` (the no-args overview). | Frame it plainly and list what DOES exist; do NOT re-register. For remove, a re-run is safe (idempotent). |
54
- | `invalid_request` | The `domainSlug` was malformed, `main`, traversal-shaped, or (remove) missing. **Nothing was read or deleted.** | Fix the slug and call again — never a stack trace or raw path to the user. |
55
- | `removed` | `sil_profile_remove` deleted exactly one domain pack. | Confirm that niche is gone; the shopper + shared user spec + sibling domains are untouched. |
56
- | `persistence_failed` | The domain directory could not be removed (the **path** + **cause** name what to fix). | Fix the data directory (writable), then remove again. |
@@ -1,48 +0,0 @@
1
- # Refine your shopper or one of its domains — the refinement loop
2
-
3
- When the user wants to **sharpen their shopper** — "refine my shopper", "the cycling domain keeps surfacing the wrong stuff, let's fix it", "amend what you know about me" — do **not** re-onboard from scratch and do **not** quietly mutate anything. Run this **targeted-amend** loop: load the relevant artefact, propose concrete refinements drawn from what the shopper actually **observed** in real shopping sessions, let the user **confirm a subset**, and persist **only** the confirmed subset by re-running the existing persist step. Nothing changes silently; nothing persists without the user's explicit confirmation.
4
-
5
- Refine has **two targets** — pick the one the user means:
6
-
7
- - **The shopper itself** — the **shared `user_spec.md`** (cross-niche facts + hard constraints that carry across every niche), or the **persona** (the host `SOUL.md`).
8
- - **One domain** — a single niche pack (target it by **slug**): its `domain_spec.md` (niche mechanics), `intent_spec.md` (decomposition dimensions), or `playbook.md` (the niche buying taste).
9
-
10
- This is a distinct capability from creating the shopper ([`agent_creation_engine.md`](agent_creation_engine.md), which CREATES) and from the shop-time loop (which SHOPS). The default is a **targeted amend**, not a full cold re-onboard. Run these steps **in order, top to bottom** — the order is the spec.
11
-
12
- ## The refinement loop (run in this exact order)
13
-
14
- 1. **Trigger + load the target.** Refinement starts only when the user **explicitly asks** to sharpen the shopper or a **named** domain. At the end of a session you MAY *offer* to refine — but that offer is a prompt only: it loads nothing, proposes nothing, and persists nothing until the user accepts and then clears the explicit confirm gate in step 3. An ambiguous, silent, or off-topic remark is **never** a trigger. Once triggered, load the relevant artefacts with **`sil_profile_get { domainSlug? }`**:
15
- - To refine the **shopper**, load the **overview** (no `domainSlug`) — the shared `userSpec` + the domain index.
16
- - To refine **one domain**, pass its **`domainSlug`** — its `domainSpec` / `intentSpec` / `playbook` bodies **plus** the shared `userSpec`.
17
- The persona is the host workspace **`SOUL.md`**, read separately when a persona refinement is on the table. Everything you propose is grounded in what the shopper already is.
18
-
19
- 2. **Propose, session-grounded — concretely, never a generic template.** Propose a small set of **concrete refinements drawn from the observed session** — what the shopper actually saw in the just-completed (or in-progress) session. Each proposal must name **two things**:
20
- - **which artefact element it changes** — a **persona** standing rule (the host `SOUL.md`), a **shared user-spec** fact or hard constraint (`user_spec.md` — e.g. a standing measurement, "never leather" as a hard constraint — carries across every niche), or, within **one named domain**, a **domain-spec** mechanic (`domain_spec.md`), an **intent-spec** dimension (`intent_spec.md`), or a **buying-taste** preference (`playbook.md` — a brand the user keeps rejecting in this niche, a tightened budget band); and
21
- - **the concrete observed evidence behind it** — a `sil_search` param mapping that returned **relevant** vs **irrelevant** items, a question that turned out to matter (or was noise), a candidate the user **accepted** or **rejected**, or a fact/taste/constraint the user **volunteered but the spec never captured** (e.g. "you said 'nothing over 8kg' three times" → a shared `user_spec.md` hard constraint; "you rejected every leather option" → a shared hard constraint; "you kept asking about lug depth, which the cycling domain spec never covered" → that domain's `domain_spec.md` mechanic; "every cycling request turned on frame size, but its intent schema never decomposed on it" → that domain's `intent_spec.md` dimension).
22
-
23
- **Scope each proposal correctly:** a cross-niche fact/constraint or persona change targets the **shopper** (shared `user_spec.md` / `SOUL.md`); a niche-mechanical change targets **one domain's** pack. The **per-query intent** is ephemeral and is never a refine target — only a domain's `intent_spec.md` *dimension schema* is. Every proposal cites the observed evidence — it is **grounded**, not guesswork; a proposal not tied to anything the session showed is forbidden. (When the observed session is unavailable, do not invent one — see the fallback at the foot of this reference.)
24
-
25
- 3. **Confirm — the gate, before anything persists.** Present the proposals and let the user **confirm a subset** — all, some, or none (per-proposal accept/reject). Confirmation is an **explicit affirmative act** on specific proposals. It is **never inferred from silence**, and **never** from the user answering an **off-topic** / unrelated question. This is the strongest invariant of the loop, re-applying the create engine's endorsement discipline at refine time — *see [`brainstorm_interview.md`](brainstorm_interview.md) for the endorsement-gate discipline; do not restate it here.* Until the user confirms, the proposals live **only in the conversation**.
26
-
27
- 4. **Persist ONLY the confirmed subset — scoped to the right target.** Fold **only the confirmed** proposals into the right artefact, then re-run the engine's persist step over the matching target — refine is a **whole-doc path**, so it uses **`sil_profile_materialize`** (not `sil_remember`):
28
- - A **shared user-spec** change (cross-niche fact / hard constraint) → **`sil_profile_materialize { name, userSpec }`** with **NO `domain`** — read the current shared `userSpec`, fold the confirmed change in, pass it back. This overwrites only the shared `user_spec.md`; no domain pack is touched.
29
- - A **domain** change (a domain-spec mechanic, an intent-spec dimension, or a buying-taste preference for one niche) → **`sil_profile_materialize { name, userSpec, domain: { slug, name, domainSpec, intentSpec, playbook } }`** scoped to **that one slug** — read the current pack, fold the confirmed change into the relevant body, pass all three domain bodies (+ the unchanged shared `userSpec`) back. This re-mints exactly that one `domains/<slug>/` pack; sibling domains and the shared spec are untouched.
30
- - A **persona** change → refresh the agent's workspace **`SOUL.md`** via the host CLI — the persona is the `SOUL.md`, not a sil artefact, so a persona refinement is a host-CLI `SOUL.md` re-write, **NOT** a `sil_profile_materialize` call.
31
-
32
- The unconfirmed proposals are **discarded** with the conversation; nothing else persists. If the user confirms nothing, nothing changes. The re-materialize is an **atomic in-place re-write** of the targeted artefact(s) (the store's existing idiom; do **not** hand-roll a write under the sil data directory). **On a persist failure the prior artefacts are left intact** — the shopper is never served half-refined, and you tell the user the refinement **did not stick**. *Truthful failure-safety note: the re-write is per-file atomic and dir-preserving — a failed re-write never tears the shopper down and never serves a coherent half-refined pack (a broken manifest reads back as not-found, fail-closed). It is **not** a cross-file transaction; the safety property is "fails closed, prior state intact / never half-served", not "all files roll back together".*
33
-
34
- 5. **Close the loop — the refined shopper reflects the kept changes on re-run.** A later session loads the **updated** artefacts (the same Runtime hook the engine documents) and behaves accordingly — the new shared hard-no, the deeper cycling domain spec, the sharper intent dimensions, the tightened niche taste. The improvement is durable: refinement is **iterative, never one-shot** — a change that did not land well is itself refinable next time.
35
-
36
- 6. **Isolation — the targeted artefact only.** A domain refinement touches exactly that one `domains/<slug>/` pack — **siblings and the shared user spec are untouched** (unless the shared spec is the target). A shared-spec or persona refinement touches the shopper level and **no domain pack**. And the **generic, profile-less shopping path is untouched** (a plain sil session still shops exactly as today). One target's sharpening never leaks into another.
37
-
38
- ## Privacy + scope — per-user and local
39
-
40
- The improvement is **per-user and local**: written only to this user's sil data directory (`$SIL_DATA_DIR/shopper/`), on this machine. There is **no server-side aggregation, no shared store, no cross-user signal** — the refine path calls **no server endpoint** and performs **no identity round-trip**. The shopper gets sharper for this user alone; nothing is pooled or shared.
41
-
42
- ## How a refinement reaches the `sil_search` params
43
-
44
- A refinement to what the shopper searches on lands in an artefact — a shared fact in `user_spec.md`, or, within a domain, a mechanic in `domain_spec.md`, a dimension in `intent_spec.md`, or a taste in `playbook.md` — and those feed the **shop-time** mapping ([`search_param_mapping.md`](search_param_mapping.md)). The mapping maps **only onto real `sil_search` params** — a refined fact/taste with **no matching param** folds into the `query` text or the recommend-time rubric, **never an invented filter**. The `ship_to` rule is unchanged at refine time too: leave it empty (the server resolves the registered default) — no identity round-trip to populate it. **Do not restate the param table here** — point at [`search_param_mapping.md`](search_param_mapping.md).
45
-
46
- ## When there is no observed-session signal
47
-
48
- If the user asks to refine but **no observed session** is available — a fresh session, or the prior session is out of context — do **not fabricate** session observations to propose against. Fall back to a **guided amend**: ask the user what they want to change (and apply the same confirm-before-persist gate to whatever they describe), or **invite them to shop a session first** so the next refinement has real evidence to ground proposals in. Never invent observations.