sil-openclaw 0.3.5 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/README.md +8 -9
- package/dist/lib/profile-store.js +520 -337
- package/dist/tools/profile.js +317 -194
- package/openclaw.plugin.json +4 -4
- package/package.json +1 -1
- package/sil-shopping/SKILL.md +18 -17
- package/sil-shopping/examples/multi_domain_shopper_walkthrough.md +190 -0
- package/sil-shopping/references/agent_creation_engine.md +35 -32
- package/sil-shopping/references/brainstorm_interview.md +31 -47
- package/sil-shopping/references/manage_domains.md +56 -0
- package/sil-shopping/references/refine_shopper.md +48 -0
- package/sil-shopping/references/search_param_mapping.md +12 -12
- package/sil-shopping/references/shop_loop.md +109 -0
- package/sil-shopping/examples/road_cycling_expert_walkthrough.md +0 -150
- package/sil-shopping/references/expert_shopping.md +0 -79
- package/sil-shopping/references/manage_experts.md +0 -42
- package/sil-shopping/references/refine_expert.md +0 -43
|
@@ -1,76 +1,60 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Set up your shopper — the onboarding interview
|
|
2
2
|
|
|
3
|
-
When the user asks
|
|
3
|
+
When the user asks to **set up shopping** — "create my shopper", "set up an agent that shops for me", "I want something that shops for me" — do **not** jump to the engine. Run a short, **two-touchpoint** onboarding that shapes the shopper *with* the user, then **create nothing** until the user endorses the assembled draft. The agent-creation engine ([`agent_creation_engine.md`](agent_creation_engine.md)) only runs **after** that explicit endorsement.
|
|
4
4
|
|
|
5
|
-
This is a **conversation, not a form-fill
|
|
5
|
+
This is a **conversation, not a form-fill** — and a **short** one. The shopper is a **generalist**: it goes deep on whatever the user later buys, **lazily minting a domain on first shop in each niche**. So onboarding does **NOT** research any niche and does **NOT** ask the user to pick one. It touches exactly **two** things: the **persona** (how their shopper should behave) and a **shared user-spec seed** (cross-niche facts + hard constraints). Everything niche-specific — how to shop a niche well, what each request in it should resolve, the niche shopping taste — is **deferred to first shop**, not authored here.
|
|
6
6
|
|
|
7
|
-
## The
|
|
7
|
+
## The two onboarding touchpoints — persona + shared user spec
|
|
8
8
|
|
|
9
|
-
A created
|
|
9
|
+
A created shopper runs on a persona (`SOUL.md`) plus the **shared, agent-level `user_spec.md`**, both seeded here. The per-domain packs are minted lazily at shop time, not at onboarding.
|
|
10
10
|
|
|
11
11
|
| Artefact | Where | What it holds | Seeded |
|
|
12
12
|
|---|---|---|---|
|
|
13
|
-
| **`SOUL.md`** (persona) | host workspace (via host CLI) | the
|
|
14
|
-
| **`
|
|
15
|
-
| **`intent_spec.md`** | sil data dir (**required**) | the agent-specific **decomposition dimensions** (PRD-style) a query must resolve | at creation (§5 — derived from the domain) |
|
|
16
|
-
| **`user_spec.md`** | sil data dir (**required**) | the user's domain-relevant facts + hard constraints | seeded partial at creation (§3); augmented every query |
|
|
17
|
-
| **`playbook.md`** | sil data dir (**required**) | the user's **buying taste** (price sensitivity, brand, preferences) | seeded partial at creation (§4); augmented every query |
|
|
13
|
+
| **`SOUL.md`** (persona) | host workspace (via host CLI) | the shopper's identity / voice / standing rules — a **generalist**, not a niche specialist | at onboarding (§1 below); refined on persona refine, stable per query |
|
|
14
|
+
| **`user_spec.md`** (shared) | sil data dir (**required**) | the user's **cross-niche** facts + hard constraints (addresses, sizes, allergy/ethics rules, budget psychology) | seeded partial at onboarding (§2); augmented every query, reused across **every** niche |
|
|
18
15
|
|
|
19
|
-
The per-query
|
|
16
|
+
The niche packs — the deep niche know-how, the per-request template a query is resolved against, and the niche shopping taste — are **NOT** authored here; they are minted **on first shop in each niche** ([`shop_loop.md`](shop_loop.md)). The per-query fill (the template filled in for one request) is **ephemeral** — never persisted, never authored here.
|
|
20
17
|
|
|
21
18
|
## Principles for the interview
|
|
22
19
|
|
|
23
|
-
- **
|
|
24
|
-
- **The persona question
|
|
25
|
-
- **
|
|
26
|
-
- **Converge, don't accumulate.** Reflect a short summary back and get a yes/adjust before advancing. The flow is **collaborative** and **re-entrant** —
|
|
20
|
+
- **Two touchpoints, no niche research.** Touch the persona and the shared user spec — that is the whole onboarding. The shopper is a **generalist**; there is **no narrow-the-niche step** and **no domain interview**. The deep niche expertise is researched **lazily, at first shop**, never interrogated here.
|
|
21
|
+
- **The persona question shapes voice, not a niche.** Asking "how should your shopper behave?" surfaces the **voice / standing rules** — terse vs. chatty, cautious vs. opinionated, any never-break rules. It does **not** bind the shopper to one niche.
|
|
22
|
+
- **Seed the shared facts, ask little.** The shared user spec holds cross-niche facts + hard constraints that carry across every niche. Seed what the user volunteers — don't run a questionnaire; the rest is **augmented per-query** at shop time.
|
|
23
|
+
- **Converge, don't accumulate.** Reflect a short summary back and get a yes/adjust before advancing. The flow is **collaborative** and **re-entrant** — the user can revise an earlier touchpoint at any point.
|
|
27
24
|
- **Endorsement is a gate, not a formality.** Until the user explicitly says "create it", run **zero** engine steps. The draft lives only in the conversation.
|
|
28
25
|
|
|
29
|
-
## Run the interview in this order —
|
|
26
|
+
## Run the interview in this order — two touchpoints
|
|
30
27
|
|
|
31
|
-
### 1. `SOUL.md` — ASK FIRST: persona + behaviour (
|
|
28
|
+
### 1. `SOUL.md` — ASK FIRST: persona + behaviour (a generalist shopper)
|
|
32
29
|
|
|
33
|
-
Open by reflecting the request back ("
|
|
30
|
+
Open by reflecting the request back ("let's set up your shopper"), then ask the **persona/identity** question: **"How do you want your shopper to behave?"** — its voice/tone (terse vs. chatty, cautious vs. opinionated) and any **standing rules** it should always follow. This is the shopper's **system framing**, a **generalist** that will shop whatever the user buys — **not** a niche choice; the niche is decided later, per query, when the user actually shops. Reflect a short persona summary back and confirm. This becomes the host workspace **`SOUL.md`** (the persona is the agent's system framing — **not** a sil artefact, no `persona.md`).
|
|
34
31
|
|
|
35
|
-
### 2. `
|
|
32
|
+
### 2. `user_spec.md` (shared) — seed the cross-niche facts + hard constraints
|
|
36
33
|
|
|
37
|
-
|
|
34
|
+
Seed the **shared user spec**: the user's **cross-niche** facts and any **hard constraints** that should hold in *every* niche — addresses / sizes the user volunteers, an allergy or ethics rule ("never leather"), a budget psychology. Mark each as **hard** (inviolable — an allergy, an ethics rule, an age gate) vs **soft** (a bendable preference). Don't run a questionnaire — seed what the user offers; the rest is **augmented per-query** at shop time, and a niche-specific fact is learned when that niche is first shopped. If the user gives little, seed a minimal honest body (e.g. "cross-niche facts to be learned as we shop; no hard constraints stated yet") — non-blank, but partial. This lands in `userSpec` (→ the shared `user_spec.md`). **No niche taste, no domain question, no intent dimensions are gathered here** — those belong to first-shop lazy mint.
|
|
38
35
|
|
|
39
|
-
### 3.
|
|
36
|
+
### 3. Derive the identity, assemble, endorse
|
|
40
37
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
Surface the user's **buying taste** with **one** question: ask them to **compare a set of options** ("of these three — a value alloy build, a mid-range carbon, a premium race bike — which appeals, and why?"). Their choice and reasoning reveal price sensitivity, brand leanings, and how they weigh value vs. performance — taste a direct "what's your budget?" wouldn't. Seed a *partial* **`playbook`** from the answer (budget feel, brand leanings, value-vs-performance lean), augmented per-query. This lands in `playbook` (→ `playbook.md`). The old seller's-method playbook (elicitation style + answer→param mapping + rubric) is gone: the voice folds into the persona, what to search on lives in the domain spec + the generic [`search_param_mapping.md`](search_param_mapping.md), and the rubric **emerges at recommend time** from the domain dimensions weighted by taste + facts + the per-query intent.
|
|
46
|
-
|
|
47
|
-
### 5. `intent_spec.md` — SIGN-OFF: present the decomposition dimensions
|
|
48
|
-
|
|
49
|
-
From what you learned writing the domain spec, derive the **decomposition dimensions** every query in this niche must resolve — a PRD-style schema (for cycling: use-case, terrain, budget band, fit envelope, timeline, compatibility, performance priorities, aesthetics). These are **agent-specific** — from *this* niche's domain spec, not a generic checklist. Present them and ask the user to **sign off** ("every request, I'll decompose along these — sound right?"). This is the **schema** (the dimensions to resolve), never a filled-in instance (that is the ephemeral per-query intent). This lands in `intentSpec` (→ `intent_spec.md`).
|
|
50
|
-
|
|
51
|
-
### 6. Derive the identity, assemble, endorse
|
|
52
|
-
|
|
53
|
-
- **Identity.** Propose an `agentId` (lower-kebab, `^[a-z0-9][a-z0-9-]*$`, never `main`) and a human-readable `name` ("Road-Cycling Buyer" / `road-cycling-buyer`) from the converged niche. **Confirm both** — never silently invent them.
|
|
54
|
-
- **Assemble + present.** Compose `{ agentId, name, persona, domainSpec, intentSpec, userSpec, playbook }` and present a **readable summary**: who the expert is, the **deep domain spec**, the **intent dimensions**, and the **seeded user spec + buying taste** (partial, to grow per-query). Self-check the shape against the engine's `sil_profile_materialize` contract: `agentId` lower-kebab & ≠ `main`, non-blank `name`/`persona`, and a non-blank `domainSpec`/`intentSpec`/`userSpec`/`playbook` (all four present, seeded partial, never absent). This is shape-only — it writes nothing; the engine's validate-first step is the authoritative gate.
|
|
55
|
-
- **Endorse — the gate.** Ask for an explicit go-ahead ("shall I create it?"). Endorsement is an **affirmative user act** on the assembled draft — "yes, create it" / "go ahead". It is **NOT** inferred from the user answering the last question, and **NOT** from silence. **Only on that explicit endorsement** do you proceed to the engine ([`agent_creation_engine.md`](agent_creation_engine.md)).
|
|
38
|
+
- **Identity.** Propose an `agentId` (lower-kebab, `^[a-z0-9][a-z0-9-]*$`, never `main`) and a human-readable `name` ("My Shopper" / `my-shopper`). **Confirm both** — never silently invent them.
|
|
39
|
+
- **Assemble + present.** Compose **`{ agentId, name, persona, userSpec }`** and present a **readable summary**: who the shopper is (its persona/voice + standing rules) and the **seeded shared user spec** (cross-niche facts + hard constraints, partial, to grow per-query). Self-check the shape against the engine's contract: `agentId` lower-kebab & ≠ `main` (it keys the host `openclaw agents add`, not the sil tool), non-blank `name`/`persona`, and a non-blank shared `userSpec` — the only sil artefact at create (the engine passes just `name` + `userSpec` to the singleton `sil_profile_materialize`; no niche pack is authored here). This is shape-only — it writes nothing; the engine's validate-first step is the authoritative gate.
|
|
40
|
+
- **Endorse — the gate.** Ask for an explicit go-ahead ("shall I create your shopper?"). Endorsement is an **affirmative user act** on the assembled draft — "yes, create it" / "go ahead". It is **NOT** inferred from the user answering the last question, and **NOT** from silence. **Only on that explicit endorsement** do you proceed to the engine ([`agent_creation_engine.md`](agent_creation_engine.md)).
|
|
56
41
|
|
|
57
42
|
## Edge cases the interview handles gracefully
|
|
58
43
|
|
|
59
|
-
- **
|
|
44
|
+
- **A shopper already exists (the singleton).** The shopper is a singleton — the engine refuses a second create (its `collision` outcome, "a shopper already exists") and never clobbers the existing one. Surface it and steer the user to **shop a new niche** (which lazily mints a domain on the spot) or **refine the existing shopper** — **never** mint a second shopper, never silently mutate the existing one.
|
|
60
45
|
- **Abandon mid-flow.** Because **no engine step runs before endorsement**, abandonment leaves **nothing created** — no host agent, no artefacts, no wiring, no teardown. Never "save progress" by writing artefacts early.
|
|
61
|
-
- **Creation is local + offline (for the user's identity).** Creating
|
|
46
|
+
- **Creation is local + offline (for the user's identity).** Creating a shopper neither requires nor performs sil registration. Do **NOT** present sil registration or a token as a prerequisite to create the shopper; it registers the user later, on first shop, via `sil_register`. (No web access is needed at onboarding either — the niche research that reaches the web happens later, at first shop.)
|
|
62
47
|
|
|
63
48
|
## Business rules (invariants the interview holds on every path)
|
|
64
49
|
|
|
65
|
-
1. **No creation without explicit endorsement.** Nothing is written — not the host agent, the `SOUL.md`, the
|
|
66
|
-
2. **Abandon-mid-flow creates nothing.** No engine step runs pre-endorsement, so an abandoned interview leaves no partial
|
|
67
|
-
3. **
|
|
68
|
-
4. **
|
|
69
|
-
5. **
|
|
70
|
-
6. **
|
|
71
|
-
7. **
|
|
72
|
-
8. **
|
|
73
|
-
9. **The persona is the host `SOUL.md`, not a sil artefact.** No `persona.md` in the sil store. The buying taste IS seeded — a *partial* `playbook.md` — but the old seller's-method playbook is gone (the rubric emerges at recommend time).
|
|
50
|
+
1. **No creation without explicit endorsement.** Nothing is written — not the host agent, the `SOUL.md`, the shared user spec, or the wiring — until the user explicitly endorses. The draft lives only in the conversation until then.
|
|
51
|
+
2. **Abandon-mid-flow creates nothing.** No engine step runs pre-endorsement, so an abandoned interview leaves no partial shopper — automatic, not a teardown.
|
|
52
|
+
3. **Two touchpoints only — persona, then shared user spec.** `SOUL.md` (ask first — persona/voice, a generalist, NOT a niche) and the shared `user_spec.md` (cross-niche facts + hard constraints). **No** niche know-how, no niche shopping taste, and no per-request template work at onboarding — those move to first-shop lazy mint.
|
|
53
|
+
4. **No niche is researched or chosen at onboarding.** The shopper is a generalist; the deep niche know-how, the per-request template, and the niche shopping taste are minted **lazily, on first shop** in each niche ([`shop_loop.md`](shop_loop.md)). Onboarding never interrogates a niche or asks the user to pick one.
|
|
54
|
+
5. **Converge each touchpoint before advancing; stay re-entrant.** Reflect-and-confirm per touchpoint; let the user revise an earlier one.
|
|
55
|
+
6. **Singleton: refuse a second shopper; never clobber.** Defer to the engine's `collision` refusal ("a shopper already exists"); steer to shop-a-new-niche or refine.
|
|
56
|
+
7. **Creation is local + offline for the user's identity.** Never present sil registration / a token as a prerequisite to create.
|
|
57
|
+
8. **The persona is the host `SOUL.md`, not a sil artefact.** No `persona.md` in the sil store. The only sil artefact seeded at create is the **shared** `user_spec.md`; the niche packs (the deep niche know-how, the per-request template, the niche shopping taste) are minted later, per niche.
|
|
74
58
|
|
|
75
59
|
## After endorsement
|
|
76
60
|
|
|
@@ -0,0 +1,56 @@
|
|
|
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. |
|
|
@@ -0,0 +1,48 @@
|
|
|
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.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Answer→`sil_search`-param mapping (the mapping is real)
|
|
2
2
|
|
|
3
|
-
Load this at shop time, when
|
|
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
4
|
|
|
5
5
|
## The parameters available to map onto
|
|
6
6
|
|
|
@@ -13,35 +13,35 @@ Load this at shop time, when an expert's loop maps a decomposed request into a `
|
|
|
13
13
|
| "In stock only" (the default) / "show me out-of-stock too" | `available` (omit for in-stock default; `false` to include unavailable) |
|
|
14
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
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
|
|
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
17
|
|
|
18
|
-
## SDS mapping inputs — the decomposed intent, the user facts, the buying taste, the domain mechanics
|
|
18
|
+
## SDS mapping inputs — the decomposed intent, the shared user facts, the domain buying taste, the domain mechanics
|
|
19
19
|
|
|
20
|
-
Under [Spec-Driven Shopping](
|
|
20
|
+
Under [Spec-Driven Shopping](shop_loop.md), the mapping reads several layers, not only the user's words for *this* request:
|
|
21
21
|
|
|
22
|
-
- The **decomposed per-query intent** (the `intent_spec.md` dimensions filled in for this request — ephemeral) is the most specific layer and wins for *preferences* (precedence **intent > playbook > user_spec > domain_spec**).
|
|
23
|
-
- The **buying taste** (`playbook.md`) supplies the user's standing preferences — 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**.
|
|
24
|
-
- The **user spec** (`user_spec.md`) supplies the user's standing **facts** (a foot profile, a compatibility detail) and the **hard constraints** — facts map to params like any stated answer; the stored value fills the param, never re-asked.
|
|
25
|
-
- The **domain spec** (`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.
|
|
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.
|
|
26
26
|
|
|
27
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
28
|
|
|
29
29
|
## Hard constraints — route to a real filter AND a reject-at-recommend rule, NEVER only `query` text
|
|
30
30
|
|
|
31
|
-
A **user-spec hard constraint** ("never leather", "nothing over 8 kg", an allergy, an age gate) is **inviolable** — the
|
|
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
32
|
|
|
33
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-
|
|
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
35
|
|
|
36
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
37
|
|
|
38
38
|
## `ship_to` stays EMPTY by default — inline rule (do not skip)
|
|
39
39
|
|
|
40
|
-
Do **not** map the user's location onto `ship_to`, and do **not** instruct the
|
|
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
41
|
|
|
42
42
|
## Worked param examples
|
|
43
43
|
|
|
44
|
-
At shop time the mapping translates the decomposed intent + the stored facts/taste into concrete params. For a road-cycling
|
|
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":
|
|
45
45
|
|
|
46
46
|
```
|
|
47
47
|
query: "<niche descriptors from the answer>" # e.g. "endurance road bike 105 groupset"
|
|
@@ -0,0 +1,109 @@
|
|
|
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 steps 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
|
+
## Entry — classify the niche, then reuse or mint the domain
|
|
12
|
+
|
|
13
|
+
Before the loop, 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.
|
|
14
|
+
|
|
15
|
+
### A. Classify the query's niche (skill reasoning — no tool call)
|
|
16
|
+
|
|
17
|
+
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.
|
|
18
|
+
|
|
19
|
+
### B. Reuse an existing domain before minting — semantic slug dedup is YOUR job
|
|
20
|
+
|
|
21
|
+
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 loop. 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.
|
|
22
|
+
|
|
23
|
+
### C. On a MISS — mint the domain on the fly, announced
|
|
24
|
+
|
|
25
|
+
When no existing domain matches, mint the niche **on the spot** — the research that used to run at create time runs **here, on first shop in this niche**:
|
|
26
|
+
|
|
27
|
+
- **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.
|
|
28
|
+
- **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.
|
|
29
|
+
- **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 step B, 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 Step 3 + the cheap/heavy split) — `sil_profile_materialize`, **never** `sil_remember`.
|
|
30
|
+
|
|
31
|
+
Then run the loop below on the freshly-minted (or reused) domain.
|
|
32
|
+
|
|
33
|
+
## The shop loop (the order IS the spec)
|
|
34
|
+
|
|
35
|
+
Run these steps in order on the **active domain** (the one reused or minted above). An attribute the user already stated **or the shared user spec already holds** is never re-asked.
|
|
36
|
+
|
|
37
|
+
### 1. Refresh the active domain's spec from the web
|
|
38
|
+
|
|
39
|
+
Before anything else, 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.
|
|
40
|
+
|
|
41
|
+
### 2. Decompose the request along the intent-spec dimensions (ephemeral — NEVER persisted)
|
|
42
|
+
|
|
43
|
+
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.
|
|
44
|
+
|
|
45
|
+
### 3. Learn every query — fact → shared user spec, taste → active domain, via `sil_remember`
|
|
46
|
+
|
|
47
|
+
Resolving the intent dimensions may surface a new user **fact** (a measurement, a compatibility detail, a hard constraint) or a new **shopping taste** for this niche (price sensitivity, brand leaning) — asked in-context for *this* query, in the persona's voice, **only when a dimension actually needs it** — then persist it with a **single `sil_remember` call** and never re-ask:
|
|
48
|
+
|
|
49
|
+
- 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.
|
|
50
|
+
- 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.
|
|
51
|
+
|
|
52
|
+
**`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 **entry-mint** of a new domain (above), the Step-1 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**.
|
|
53
|
+
|
|
54
|
+
The shared user spec and the active domain's playbook **grow incrementally, per-query** — augmenting what is there, never a big up-front form. Elicitation is **need-driven**: only a dimension **missing** from BOTH the request AND the stored side is elicited, in the persona's style — one or a few questions at a time, never a battery. An attribute the shared user spec or the active playbook **already holds is never re-asked** — the stored value fills it. When the request plus the stored side already carry enough load-bearing attributes for a defensible search, proceed **straight to** the map+search steps. 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`.
|
|
55
|
+
|
|
56
|
+
### Layering — precedence intent > playbook(domain) > user_spec(SHARED) > domain_spec(domain)
|
|
57
|
+
|
|
58
|
+
- **Intent** (the per-query decomposition) narrows the field — what this request demands.
|
|
59
|
+
- **Playbook** (this domain's shopping taste) shapes preferences — price sensitivity, brand, taste — within what the intent allows. Scoped to the **active domain** only.
|
|
60
|
+
- **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**.
|
|
61
|
+
- **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.
|
|
62
|
+
|
|
63
|
+
**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.
|
|
64
|
+
|
|
65
|
+
**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**.
|
|
66
|
+
|
|
67
|
+
> **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).
|
|
68
|
+
|
|
69
|
+
### 4. Map the answers to well-formed `sil_search` params
|
|
70
|
+
|
|
71
|
+
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:
|
|
72
|
+
|
|
73
|
+
- 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.
|
|
74
|
+
- 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 (Step 6).
|
|
75
|
+
- Leave **`ship_to` empty** by default so the server resolves the registered default address. Do **not** call `sil_whoami` to populate it.
|
|
76
|
+
|
|
77
|
+
### 5. Search
|
|
78
|
+
|
|
79
|
+
Call `sil_search` with the mapped params. It returns purchasable variants **best-first**.
|
|
80
|
+
|
|
81
|
+
### 6. Compare the candidates on the rubric — reject hard-constraint violators outright
|
|
82
|
+
|
|
83
|
+
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.
|
|
84
|
+
|
|
85
|
+
### 7. Recommend — always with the "why" that cites the layers
|
|
86
|
+
|
|
87
|
+
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.
|
|
88
|
+
|
|
89
|
+
### 8. Re-fetch with `sil_product_get` before any buy
|
|
90
|
+
|
|
91
|
+
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.**
|
|
92
|
+
|
|
93
|
+
### 9. After the recommendation — capture what surfaced via `sil_remember`
|
|
94
|
+
|
|
95
|
+
**After every recommendation, before the turn ends**, persist anything new the interaction surfaced — 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.
|
|
96
|
+
|
|
97
|
+
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.
|
|
98
|
+
|
|
99
|
+
## When `sil_search` returns `ok` with `products: []` — relax and explain
|
|
100
|
+
|
|
101
|
+
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.
|
|
102
|
+
|
|
103
|
+
## When the domain is genuinely unservable — an honest "no", never junk
|
|
104
|
+
|
|
105
|
+
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.
|
|
106
|
+
|
|
107
|
+
## When `sil_search` / `sil_product_get` returns a non-`ok` status
|
|
108
|
+
|
|
109
|
+
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.**
|