sil-openclaw 0.3.8 → 0.3.9

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,55 +1,79 @@
1
- # Answer→`sil_search`-param mapping (the mapping is real)
2
-
3
- Load this at shop time, when the shop loop maps a decomposed request into a `sil_search` call ([`shop_loop.md`](shop_loop.md) Step 4). The mapping must target the **real `sil_search` parameters** (the shopping loop's catalog tool, named in `SKILL.md`) and nothing else — never invent a filter. (Under SDS there is no stored "answer→param mapping" seller artefact — the niche knowledge of *what* to search on lives in the active domain's domain spec; this reference is the generic param table the mapping draws on.)
4
-
5
- ## The parameters available to map onto
6
-
7
- | User's stated input | `sil_search` param it maps to |
8
- |---|---|
9
- | A budget ("under €1500", "€800–1200") | `price_min` / `price_max` — **in the currency's ISO 4217 minor unit** (cents): €1500 → `price_max: 150000` |
10
- | "Prefer secondhand" / "used is fine" | `condition: ["secondhand"]` |
11
- | "New only" | `condition: ["new"]` |
12
- | The narrowed niche + key descriptors | `query` (free text) and/or `category` |
13
- | "In stock only" (the default) / "show me out-of-stock too" | `available` (omit for in-stock default; `false` to include unavailable) |
14
- | "Buy from a local/domestic shop" | `local_merchants: true` (a best-effort ranking *bias*, not a hard filter — and *optionally*, to surface more local shops, issue the `query` in that country's language; a tactic, never an override of a language the user deliberately chose) |
15
-
16
- A stated taste with **no matching param** (e.g. "I like bold colours", "prefer eco-friendly brands") does **not** become a new param — fold it into the `query` text or into the recommendation rubric. There is no `color` filter, no `brand` filter; inventing one produces a shopper that emits invalid `sil_search` calls at shop time.
17
-
18
- ## SDS mapping inputs — the decomposed intent, the shared user facts, the domain buying taste, the domain mechanics
19
-
20
- Under [Spec-Driven Shopping](shop_loop.md), the mapping reads several layers, not only the user's words for *this* request:
21
-
22
- - The **decomposed per-query intent** (the active domain's `intent_spec.md` dimensions filled in for this request — ephemeral) is the most specific layer and wins for *preferences* (precedence **intent > playbook(domain) > user_spec(SHARED) > domain_spec(domain)**).
23
- - The **buying taste** (the active domain's `playbook.md`) supplies the user's standing preferences for *this niche* — budget band, brand likes/dislikes — these map to params (a budget band → `price_min`/`price_max`) exactly like a freshly-stated answer would, but are **never re-asked**. Taste is per-domain — it does not carry to another niche.
24
- - The **shared user spec** (`user_spec.md`) supplies the user's standing **facts** (a foot profile, a compatibility detail) and the **hard constraints**, reused across **every** niche — facts map to params like any stated answer; the stored value fills the param, never re-asked.
25
- - The **domain spec** (the active domain's `domain_spec.md`) supplies the niche's **decision-mechanics** — which attributes are load-bearing for *this* niche (last volume, rim depth, gearing range), so the mapping knows what to map and what matters.
1
+ ---
2
+ name: search-param-mapping
3
+ description: The shop-time answer→sil_search parameter mapping — real params only, hard-constraint routing, the ship_to rule. Load when mapping a decomposed request into a sil_search call.
4
+ ---
26
5
 
27
- The param table itself is **unchanged** — these layers are inputs to the same mapping, not new params. A domain dimension, a standing user fact, or a taste with **no matching param** folds into `query`/rubric per the no-invented-filter rule above, exactly like any other non-param taste.
28
-
29
- ## Hard constraints — route to a real filter AND a reject-at-recommend rule, NEVER only `query` text
30
-
31
- A **shared user-spec hard constraint** ("never leather", "nothing over 8 kg", an allergy, an age gate) is **inviolable** in *every* niche — the shopper never recommends a violating item. A hard constraint carried **only** as soft `query` free text leaks: the catalog can still surface a violating product, and recommending it is a defect. So map every hard constraint to **two** enforcement points, **not merely `query`**:
32
-
33
- 1. **A real `sil_search` filter where one exists.** "New only" / "secondhand only" → `condition`; "in stock only" → `available` (omit for the in-stock default). Where a param matches the constraint, set it so the catalog never returns the violating item at all.
34
- 2. **An explicit reject-at-pick rubric rule** ([`shop_loop.md`](shop_loop.md) Step 6). For a constraint with **no matching param** (no `material` filter for "never leather"), the constraint becomes a rubric rule that **rejects** any violating candidate outright — **never recommend** it — rather than down-weighting it. A hard constraint is a reject, not a weight.
35
-
36
- A hard constraint that lands **only** in `query` text is **not** enforced — it is a hint, not a filter, and the catalog may ignore it. Route it to a filter and a reject rule; the `query` text is at most an additional nudge, never the sole carrier of an inviolable constraint.
37
-
38
- ## `ship_to` stays EMPTY by default — inline rule (do not skip)
39
-
40
- Do **not** map the user's location onto `ship_to`, and do **not** instruct the shopper to call `sil_whoami` to populate it. When `ship_to` is absent, sil-api resolves the user's **registered default address** server-side. Set `ship_to` (a `{ country, region?, postal_code? }` object of ISO codes) **only** to OVERRIDE the default with a *different* destination than the registered address (e.g. "ship this to my office in Germany"). The shopper inherits correct location-aware search by construction — leave `ship_to` out, and never round-trip `sil_whoami` to fill it.
41
-
42
- ## Worked param examples
6
+ # Answer→`sil_search`-param mapping (the mapping is real)
43
7
 
44
- At shop time the mapping translates the decomposed intent + the stored facts/taste into concrete params. For a shopper's road-cycling domain whose user said (this request, plus a stored €1200 budget taste in that domain) "secondhand is fine, I'm in France and want local shops":
8
+ Load this at shop time, when the shop loop maps a decomposed request into a
9
+ `sil_search` call ([`shop_loop.md`](shop_loop.md) Beat 5). The mapping targets the
10
+ **real `sil_search` parameters** and nothing else — never invent a filter.
11
+
12
+ **The param catalog lives in the `sil_search` tool description** — the full list and
13
+ their forms (`query`/`category`; `price_min`/`price_max` in the currency's ISO 4217
14
+ minor unit; `condition` = `["new"]`/`["secondhand"]`; `available`; `local_merchants`;
15
+ `ship_to` as ISO codes). Read it there; do not restate it here. Under SDS there is no
16
+ stored "answer→param" seller artefact — *what* to search on for a niche lives in the
17
+ active domain's `domain_spec.md`; this reference covers only the SDS layers that feed
18
+ the mapping and the two rules the mapping must hold.
19
+
20
+ ## What feeds the mapping — the SDS layers
21
+
22
+ The mapping reads several layers, not just the user's words for this request:
23
+
24
+ - The **decomposed per-query intent** (the active `intent_spec.md` filled for this
25
+ request — ephemeral) is most specific and wins for *preferences* (precedence
26
+ **intent > playbook(domain) > user_spec(SHARED) > domain_spec(domain)**).
27
+ - The **shopping taste** (the active `playbook.md`) supplies standing preferences for
28
+ *this niche* — a budget band → `price_min`/`price_max` exactly like a freshly-stated
29
+ answer, but **never re-asked**. Taste is per-domain.
30
+ - The **shared user spec** (`user_spec.md`) supplies standing **facts** and the **hard
31
+ constraints**, reused across **every** niche — a fact maps to a param like any answer.
32
+ - The **domain spec** supplies the niche's decision-mechanics — which attributes are
33
+ load-bearing here — so the mapping knows what to map and what matters.
34
+
35
+ These layers are inputs to the same params, not new params. A stated taste with **no
36
+ matching param** (a colour, a brand, "eco-friendly") folds into the `query` text or the
37
+ recommendation rubric — **never a new filter**. There is no `color` or `brand` param;
38
+ inventing one emits invalid `sil_search` calls.
39
+
40
+ ## Hard constraints — a real filter AND a reject-at-recommend rule, NEVER only `query`
41
+
42
+ A shared user-spec **hard constraint** ("never leather", "nothing over 8 kg", an
43
+ allergy, an age gate) is **inviolable** in every niche. A hard constraint carried
44
+ **only** as soft `query` text leaks — the catalog can still surface a violating item.
45
+ Route each to **two** points, **not merely `query`** (see
46
+ [`shop_loop.md`](shop_loop.md) Beat 5):
47
+
48
+ 1. **A real `sil_search` filter where one exists** — "new/secondhand only" →
49
+ `condition`; "in stock only" → `available` (omit for the in-stock default). Where a
50
+ param matches, set it so the catalog never returns the violating item.
51
+ 2. **An explicit reject-at-pick rubric rule** for a constraint with no matching param
52
+ (no `material` filter for "never leather"): the constraint **rejects** any violating
53
+ candidate outright, never down-weights it. A hard constraint is a reject, not a
54
+ weight.
55
+
56
+ ## `ship_to` stays EMPTY by default
57
+
58
+ Do **not** map the user's location onto `ship_to`, and do **not** call `sil_whoami` to
59
+ populate it. When `ship_to` is absent, sil-api resolves the user's **registered default
60
+ address** server-side. Set `ship_to` only to OVERRIDE the default with a *different*
61
+ destination (e.g. "ship this to my office in Germany"). The shopper inherits
62
+ location-aware search by construction — leave `ship_to` out.
63
+
64
+ ## Worked example
65
+
66
+ For a road-cycling domain whose user said (this request + a stored budget taste in that
67
+ domain) "secondhand is fine, I'm in France and want local shops":
45
68
 
46
69
  ```
47
- query: "<niche descriptors from the answer>" # e.g. "endurance road bike 105 groupset"
70
+ query: "endurance road bike 105 groupset" # niche descriptors
48
71
  category: "<the narrowed niche category>"
49
72
  price_max: 120000 # €1200 → minor units (cents)
50
- condition: ["secondhand"] # "secondhand is fine"
51
- local_merchants: true # "want local shops" → ranking bias; optionally query in the local language (e.g. French) to surface more of them
52
- # ship_to: OMITTED — server resolves the registered default address; no sil_whoami round-trip
73
+ condition: ["secondhand"]
74
+ local_merchants: true # ranking bias; optionally query in French to surface more local shops
75
+ # ship_to: OMITTED — server resolves the registered default address
53
76
  ```
54
77
 
55
- Budget → `price_max` (cents), "secondhand is fine" → `condition`, "want local shops" → `local_merchants: true`; `ship_to` left out so the server resolves the registered default. A non-param taste ("understated colours") folds into `query` or the rubric, never a new filter.
78
+ A non-param taste ("understated colours") folds into `query` or the rubric, never a new
79
+ filter.
@@ -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 memory tool has been used (`sil_remember` stored a fact or taste — a soft self-check
34
+ judged from whether this shopper has ever remembered 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,164 @@
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.
1
+ ---
2
+ name: shop-loop
3
+ description: The Spec-Driven Shopping loop — the one shopper shops any niche, reusing or minting a domain on the fly, then decomposing the request and learning from it. Load when running as the shopper and the user states a shopping intent.
4
+ ---
5
+
6
+ # Shop-time loop — how the one shopper shops any niche
7
+
8
+ Load this when you (the sil skill) run as the user's **shopper** and they state a
9
+ shopping intent. There is **one shopper** — a generalist holding **many domains**
10
+ (niches), each **minted lazily on first shop**. The [engine's Runtime
11
+ hook](agent_creation_engine.md) leaves you here: the persona is injected via
12
+ **`SOUL.md`**, and the skill has read the shared **`user_spec.md`** (cross-niche facts +
13
+ hard constraints, reused across every niche) plus the slug-keyed **`domains`** map from
14
+ `$SIL_DATA_DIR/shopper/profile.json`.
15
+
16
+ This is **Spec-Driven Shopping (SDS)**: a fact from niche A is reused in niche B without
17
+ being re-asked, while each domain's **`domain_spec.md`** (deep niche expertise),
18
+ **`intent_spec.md`** (decomposition schema), and **`playbook.md`** (the **shopping
19
+ taste**) stay niche-scoped — taste does not leak, only shared facts carry. Behave like a
20
+ specialist in the persona's voice; apply the rubric at reasoning time, not via a new tool.
21
+
22
+ ## The five beats — run every query, in order
23
+
24
+ A beat only **asks** when something is genuinely unresolved; a fully-resolved query asks
25
+ nothing and passes straight through.
26
+
27
+ 1. **Domain-exists check** — classify the niche, reuse a matching domain or register a miss.
28
+ 2. **Learn on a miss** (or refresh on a hit) — the pack is present and current before you search.
29
+ 3. **Gather what's missing before searching** — resolve each dimension, then ask only what's unresolved.
30
+ 4. **Persist what surfaced** — a single `sil_remember` per new fact or taste.
31
+ 5. **Search → rubric → recommend-with-why → re-fetch before purchase.**
32
+
33
+ ## Beat 1 — Domain-exists check
34
+
35
+ Name the **shopping niche** this request belongs to ("a waterproof trail shoe for a wet
36
+ ultra" → trail running) — your reasoning, no tool call. Then read `profile.json.domains`
37
+ (via the no-args `sil_profile_get`) and match the niche **semantically, not by exact
38
+ string**. If a domain covers it, **reuse it** and go to the gate. **Reuse-before-mint**
39
+ is the shop loop's job: the store enforces only shape, so without **semantic dedup** the
40
+ shopper fragments into duplicate thin packs (`cycling`, `road-cycling`,
41
+ `bikes` for one niche). Torn between a close existing slug and a new one, prefer the
42
+ existing. No match ⇒ register a **miss** for Beat 2.
43
+
44
+ ## Beat 2 — Learn the domain (mint on a miss, refresh on a hit)
45
+
46
+ **On a miss — mint the domain on the fly, announced.** Tell the user, in the shopper's
47
+ voice — **never silently** — that this is a new niche ("I haven't shopped cycling for
48
+ you yet — setting that up"), and **state the inferred niche so the user can correct it**.
49
+ **Research** it (web + knowledge) into a **deep `domainSpec`** (a shallow bullet list a
50
+ layperson could write fails the SDS bar), derive the **`intentSpec`** dimensions, and
51
+ seed a partial **`playbook`**. No web tool? Say so and compose from public knowledge —
52
+ never present a guess as verified research. Persist with the **whole-doc**
53
+ **`sil_profile_materialize { name, userSpec, domain: { slug, name, domainSpec,
54
+ intentSpec, playbook } }`** — the deduped slug from Beat 1, `userSpec` re-persisted
55
+ atomically alongside. One atomic call upserts `domains[slug]`. Never `sil_remember`.
56
+
57
+ **On a hit — web-refresh the active domain's `domain_spec.md`** so it stays current, and
58
+ persist by re-running `sil_profile_materialize` with the `domain` object carrying the
59
+ fresh `domainSpec`. A real web step — no web tool? Say so and proceed on the existing
60
+ spec; never pretend the refresh happened.
61
+
62
+ ## Beat 3 — Gather what's missing before searching
63
+
64
+ Runs to completion **before any `sil_search`**. Read the active `intent_spec.md`
65
+ dimensions and fill them for **this** request ("a waterproof trail shoe for a wet ultra,
66
+ around €160" → use-case: trail/ultra; weather: wet; budget: ~€160). This filled
67
+ **per-query intent** is **ephemeral** — it lives only in this conversation and is
68
+ **never persisted**; only the `intent_spec.md` *schema* is stored.
69
+
70
+ Resolve each dimension against — in order — the **request**, the shared **`user_spec`**,
71
+ the active **`playbook`**, and any defensible `domain_spec` default. Then **elicit only
72
+ what is genuinely unresolved** — a dimension the `domain_spec`/`intent_spec` marks
73
+ **load-bearing** *and* still unfilled. Ask in the persona's voice, a few at a time, each
74
+ tied to *why* — never a battery. A stored attribute is never re-asked. When everything
75
+ load-bearing is covered, **ask nothing and pass straight through** to Beat 5. If the user
76
+ skips a question, proceed on the best defensible params and state what you assumed — a
77
+ declined question narrows quality, never access.
65
78
 
66
79
  ## Beat 4 — Persist what surfaced (fact → shared user spec, taste → active domain)
67
80
 
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`.
81
+ When the interaction surfaces a new user **fact** or **shopping taste**, persist it with
82
+ a **single `sil_remember`** — fired **only when something new surfaced**:
83
+
84
+ - A **fact / measurement / hard constraint** → **`sil_remember { kind: "fact", text,
85
+ hard? }`** — the cheap append to the **shared** `user_spec.md`. A fact carries across
86
+ every niche (no `domain`). Mark a never-break rule (an allergy, an ethics rule, an age
87
+ gate) with **`hard: true`**; a bendable fact is a soft entry.
88
+ - A **shopping taste** (budget band, brand leaning) → **`sil_remember { kind: "taste",
89
+ text, domain }`** — one entry to **this niche's** `playbook.md`, the **active domain**.
90
+ Pass the active `domain` slug (with 2+ domains, omitting it is rejected). Taste is soft
91
+ and scoped to this domain.
92
+
93
+ Reserve the **whole-doc** `sil_profile_materialize` for the heavy paths only — the Beat-2
94
+ mint, the web refresh, a full **refine** ([`refine_shopper.md`](refine_shopper.md)), and
95
+ **contradiction-resolution** (a new statement contradicting a stored *soft* preference is
96
+ a visible whole-doc rewrite; an append is accretive, never corrective). One learning per
97
+ call; if nothing surfaced, no call. Capture is **in the open** — never silently harvested
98
+ — reviewable with `sil_profile_get`, erasable with `sil_profile_remove`, per-user and
99
+ local under `$SIL_DATA_DIR/shopper/`.
76
100
 
77
101
  ### Layering — precedence intent > playbook(domain) > user_spec(SHARED) > domain_spec(domain)
78
102
 
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.
103
+ - **Intent** narrows the field. **Playbook** shapes preferences within it. **User spec**
104
+ (the **shared** spec) fills standing **facts** the request left unsaid and carries the
105
+ **hard constraints**. **Domain spec** supplies the decision-mechanics — the substrate.
83
106
 
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).
107
+ A specific request overrides a standing taste, over a soft fact-preference, over a domain
108
+ default. **Hard constraints are inviolable:** a shared `user_spec.md` **hard constraint**
109
+ is **never overridden** by intent, taste, the domain, or the catalog. Route each to a
110
+ real enforcement point — a `sil_search` filter where one exists (`condition`,
111
+ `available`, per [`search_param_mapping.md`](search_param_mapping.md)) **and** a
112
+ reject-at-pick rubric rule (rejected outright, not down-weighted). A constraint carried
113
+ only as free-text `query` is not enforced.
89
114
 
90
115
  ## Beat 5 — Search → rubric → recommend-with-why → re-fetch before purchase
91
116
 
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.**
117
+ Best-first, never re-rank, reject-at-pick for hard constraints, re-fetch before purchase.
118
+
119
+ **Map the answers to `sil_search` params.** Translate each filled dimension — plus the
120
+ shared facts, this domain's taste, and the domain-spec mechanics — to real params per
121
+ [`search_param_mapping.md`](search_param_mapping.md) (that reference owns the table; do
122
+ not re-carry it). A taste with no matching param folds into `query` or the rubric —
123
+ **never invent a filter**. Leave **`ship_to` empty** so the server resolves the
124
+ registered default; do not call `sil_whoami` to populate it.
125
+
126
+ **Search.** Call `sil_search` with the mapped params. It returns purchasable variants
127
+ best-first.
128
+
129
+ **Compare on the rubric — reject hard-constraint violators outright.** Build the rubric
130
+ from the active domain-spec dimensions, weighted by this domain's taste, the shared user
131
+ facts, and the per-query intent. A hard constraint is a **reject-at-pick** rule: a
132
+ violating candidate is removed from contention, never the pick. Present results
133
+ **best-first** as returned — **never re-rank** — but a violator is never the pick.
134
+
135
+ **Recommend — always with the "why" that cites the layers.** The "why" must cite the
136
+ per-query intent, at least one stored shared fact or this-domain taste you did **not**
137
+ re-ask ("you're a wide D-width, kept from before"), and at least one researched
138
+ domain-spec dimension ("for trail running, last volume and lug depth matter more than
139
+ weight here"). A "why" naming no researched dimension and reusing no stored attribute is
140
+ generic attribute matching and **fails the SDS bar** even if the product is fine. Never
141
+ hand back a bare list.
142
+
143
+ **Re-fetch with `sil_product_get` before any buy.** Price, availability, and
144
+ `checkout_url` from `sil_search` are **point-in-time**. Before any buy / checkout,
145
+ re-fetch the chosen item with `sil_product_get`. Never commit a buy off the stale
146
+ `sil_search` snapshot.
147
+
148
+ **After every recommendation, before the turn ends,** persist anything the interaction
149
+ newly surfaced that Beat 4 did not capture — each via a single `sil_remember` (a fact
150
+ `kind: "fact"` → shared user spec; a taste `kind: "taste"` + the active `domain` → this
151
+ domain's playbook) — and **only when something surfaced** (no empty, duplicate, or noise
152
+ entries).
153
+
154
+ ## Empty, unservable, and non-`ok` results
155
+
156
+ - **`ok` with `products: []`** — a normal, servable outcome. **Relax or re-frame** the
157
+ params and **explain** the change ("I dropped the secondhand-only filter — here's
158
+ what's in stock"). Never stop silently.
159
+ - **Genuinely unservable** (out of scope, not shippable, age-gated, or persistently
160
+ empty after a reasonable relax) — say so **honestly**. Never fabricate options and
161
+ never pad with junk.
162
+ - **A non-`ok` status** is not an empty match — do not relax the params. **Follow the
163
+ tool's own `recovery`** exactly and never improvise. The taxonomy lives in
164
+ [`catalog_tools_reference.md`](catalog_tools_reference.md); load it, don't re-carry it.