sil-openclaw 0.3.9 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,110 @@
1
+ ---
2
+ name: method-and-prds
3
+ description: Beat 2 of the loop — load, mint or signal-refresh a domain's method — plus the intent-keyed PRD model, the frontmatter-as-truth store, and discovery/manage via sil_profile_search / sil_profile_get / sil_profile_remove. Load when resolving a domain's method or managing what the shopper knows.
4
+ ---
5
+
6
+ # Beat 2 — the domain method, intent-keyed PRDs, and the store
7
+
8
+ Beat 1 hands off a resolved `domain` — a **HIT** (the method exists) or a **MISS**
9
+ (no method yet). Beat 2 turns that into a method body in context, ready for Beat 3
10
+ to fill. Three paths, not one.
11
+
12
+ ## LOAD — the hot path (HIT, fresh)
13
+
14
+ A plain revisit **LOADS**: `sil_profile_get(domain)` reads the durable method body
15
+ — **no research**, no round-trip. This is the default on every revisit; the method
16
+ is **recovered, never rebuilt**. Loading the method's `## Search vocabulary` also
17
+ brings its coined `ns.key` dimensions into context for Beat 4.
18
+
19
+ ## MINT — cold (MISS)
20
+
21
+ No method exists, so **research** the niche (a web tool where available, else
22
+ public knowledge stated plainly) and **mint** one. Draft the buying guide + the
23
+ buyer's durable per-domain taste (seeded from `user_spec`) + the whole-domain
24
+ **spec vocabulary** you **coin** from the research (`ns.key` + data type + unit +
25
+ why-it-matters) + a **volatility marker** (the domain's volatile axis + rough
26
+ cadence). Persist with **`sil_learn create`** — `target: "method"`, with the domain
27
+ + name + body — the file **is** the registration. The mint verb is **`sil_learn
28
+ create`**, never the **setup-only** `sil_profile_materialize` (which writes only the
29
+ shared `user_spec.md` and mints no domain). Then **announce** the inferred domain so
30
+ the buyer can correct it.
31
+
32
+ The coined vocabulary is **coined to converge, then canonicalized before persist**.
33
+ `sil_specs` is **precision-first** — two coined specs converge only when **every field**
34
+ agrees within the same `namespace` and `data_type`, so the name you coin decides whether a
35
+ concept converges or forks: a synonym (`speed_mbps` vs `transfer_speed_mbps`) splits one
36
+ concept into two specs that never match. So coin for the match. **One concept,
37
+ one spelling:** reuse the exact `ns.key`, `display_name`, `data_type`, and `unit` you
38
+ already coined for that concept — verbatim, across every domain (consult a sibling
39
+ method with `sil_profile_get` only when the concept plausibly recurs, never an
40
+ exhaustive scan). For a common, widely-shared attribute you have **not** coined before
41
+ (screen size, weight, RAM, waterproof rating, material…), take its **conventional**
42
+ name over a personal synonym — a Schelling point, since there is no registry to read.
43
+ Coin a fresh name only for a genuinely niche attribute. On each coined spec carry a
44
+ concept-naming **`description`** — the load-bearing **corroborator** the dedupe leans on
45
+ to merge true synonyms and the veto that keeps distinct concepts apart — and get
46
+ **`data_type`** and **`namespace`** right, the hard floors a wrong value forks the
47
+ concept past. Then submit the coined spec
48
+ definitions to **`sil_specs`** (dedupe-or-create) and adopt the returned **canonical**
49
+ `ns.key` for every spec: a **`matched`** result means an equivalent canonical spec
50
+ already exists — **drop your coined synonym and adopt the canonical name**; a
51
+ **`created`** result means yours is novel and is canonical going forward (keep it).
52
+ Rewrite the method's `## Search vocabulary` and any PRD `specs` predicates to those
53
+ canonical names, then persist — the method is **born canonical**, never
54
+ write-then-amend. This convergence is what makes `filters.specs` actually filter
55
+ across methods; good naming is never a gate — a fragmenting name never blocks a
56
+ search, it only costs precision. If `sil_specs` is **not `ok`** (a registry blip),
57
+ **do not block the mint**: persist with the **raw coined names** (every predicate
58
+ reads `applied:false`) and shop on — convergence retries on the next mint/refresh.
59
+ Canonicalization is **silent to the buyer**: never surface `ns.key` plumbing.
60
+
61
+ ## REFRESH — signal-driven (HIT, stale)
62
+
63
+ A plain revisit LOADS; a refresh fires **only on a signal**, never on a TTL and
64
+ **not every revisit**. The three signals: the buyer **contradicts** the guide, the
65
+ method's own **volatility marker** is overdue, or the buyer **explicitly asks**. So
66
+ refresh is **signal-driven** — `contradict` · overdue volatility `marker` ·
67
+ `explicit ask` — not a clock.
68
+
69
+ Refresh is **create-with-merge**: load the current method, re-research **only** the
70
+ stale volatile material, **carry every buyer-authored line forward verbatim**,
71
+ re-emit the whole body via `sil_learn create` (overwrite), and announce the delta.
72
+ The merge **preserves** every **buyer** `sil_learn` edit — it rewrites stale
73
+ *research* claims and **never clobbers** a buyer edit. The method is fully
74
+ buyer-mutable at any time via `sil_learn` append/amend/retract.
75
+
76
+ Canonicalize any **newly-coined** specs via `sil_specs` before persisting the
77
+ refreshed method — coin them with the same convergence discipline (reuse a name you
78
+ already coined for the concept; take the conventional name for a common attribute)
79
+ and resubmit **only** the specs not yet carrying a canonical name (already-canonical
80
+ names are stable; do not resubmit them).
81
+
82
+ ## Intent-keyed PRDs
83
+
84
+ A PRD's identity is the **job-to-be-done**. Its key carries three coordinates so it
85
+ stays queryable: `{ domain, product, intent }` → `ski/gloves-slope`. Intent is
86
+ always present (a context-free request keys `general`). A PRD holds the method's
87
+ requirements **specialized to this job** plus the buyer's **durable** filled
88
+ preferences (the per-job slice; the per-domain durable taste lives in the method).
89
+ PRDs are **durable** and **revisitable** — you re-buy the same thing, or you don't
90
+ finish in one session, and the PRD is **recovered**, never rebuilt.
91
+
92
+ ## The store — frontmatter-as-truth (no manifest)
93
+
94
+ Artefacts live at `shopper/domains/<slug>/{method.md, prds/<product>-<intent>.md,
95
+ assets/}`. There is **no manifest** — each file's own **frontmatter** IS the source
96
+ of truth, discovered by a filesystem **scan** over those **coordinates**. A file
97
+ with malformed frontmatter is skipped and surfaced as `unreadable`, never half-read.
98
+
99
+ ## Discovery + manage
100
+
101
+ - **Discover / reuse-before-mint** with **`sil_profile_search`** — it queries
102
+ artefact **frontmatter** and returns **coordinates** only (no bodies): the
103
+ domains the shopper has learned and its PRDs. This is the frontmatter-as-truth
104
+ query, **not a manifest** and not a filesystem guess. The no-filter call is the
105
+ "what does my shopper know?" overview.
106
+ - **Read one body** with **`sil_profile_get`** — `domainSlug` for the method body,
107
+ `+prd` for that PRD's body.
108
+ - **Remove** with **`sil_profile_remove`** — `domainSlug` alone removes the
109
+ **whole domain** subtree; `+prd` removes **just that PRD** (method + siblings
110
+ survive). It is destructive: **confirm** with the buyer first.
@@ -12,29 +12,30 @@ Load this at shop time, when the shop loop maps a decomposed request into a
12
12
  **The param catalog lives in the `sil_search` tool description** — the full list and
13
13
  their forms (`query`/`category`; `price_min`/`price_max` in the currency's ISO 4217
14
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.
15
+ `ship_to` as ISO codes). Read it there; do not restate it here. There is no stored
16
+ "answer→param" seller artefact — *what* to search on for a niche lives in the active
17
+ domain's **method**; this reference covers only the SDS layers that feed the mapping and
18
+ the two rules the mapping must hold.
19
19
 
20
20
  ## What feeds the mapping — the SDS layers
21
21
 
22
- The mapping reads several layers, not just the user's words for this request:
22
+ The mapping reads several layers, not just the user's words for this request (the fill
23
+ precedence — see [`fill_and_feedback.md`](fill_and_feedback.md) — is
24
+ **request-intent > PRD filled-pref > method taste > user_spec fact > method default**):
23
25
 
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.
26
+ - The **filled PRD** for this job is most specific and wins for *preferences* — its
27
+ filled answers map onto params exactly like a freshly-stated answer, but **never
28
+ re-asked**.
29
+ - The buyer's durable per-domain **taste** (in the **method**) supplies standing
30
+ preferences for *this niche* — a budget band → `price_min`/`price_max`.
30
31
  - The **shared user spec** (`user_spec.md`) supplies standing **facts** and the **hard
31
32
  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
+ - The **method** supplies the niche's decision-mechanics — which attributes are
33
34
  load-bearing here — so the mapping knows what to map and what matters.
34
35
 
35
36
  These layers are inputs to the same params, not new params. A stated taste with **no
36
37
  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
+ recommendation reflection — **never a new filter**. There is no `color` or `brand` param;
38
39
  inventing one emits invalid `sil_search` calls.
39
40
 
40
41
  ## Hard constraints — a real filter AND a reject-at-recommend rule, NEVER only `query`
@@ -48,7 +49,7 @@ Route each to **two** points, **not merely `query`** (see
48
49
  1. **A real `sil_search` filter where one exists** — "new/secondhand only" →
49
50
  `condition`; "in stock only" → `available` (omit for the in-stock default). Where a
50
51
  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
+ 2. **An explicit reject-at-pick rule** for a constraint with no matching param
52
53
  (no `material` filter for "never leather"): the constraint **rejects** any violating
53
54
  candidate outright, never down-weights it. A hard constraint is a reject, not a
54
55
  weight.
@@ -75,5 +76,5 @@ local_merchants: true # ranking bias; optionally query in French to sur
75
76
  # ship_to: OMITTED — server resolves the registered default address
76
77
  ```
77
78
 
78
- A non-param taste ("understated colours") folds into `query` or the rubric, never a new
79
- filter.
79
+ A non-param taste ("understated colours") folds into `query` or the recommendation
80
+ reflection, never a new filter.
@@ -30,8 +30,8 @@ and its single next step**.
30
30
  correct it. Next: state a shopping intent.
31
31
  4. **Shopper active** — `name` present, `domains` non-empty. Check off the completion
32
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).
33
+ the learn tool has been used (`sil_learn` stored a fact or taste — a soft self-check
34
+ judged from whether this shopper has ever learned anything).
35
35
  5. **Setup complete** — a shopper with at least one domain. **Shed** every onboarding beat:
36
36
  none of the stages above apply. **Show only how to use** the plugin well — the
37
37
  **domain-gated shop loop** and **Spec-Driven Shopping** ([`shop_loop.md`](shop_loop.md)).
@@ -1,164 +1,117 @@
1
1
  ---
2
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.
3
+ description: The six-beat Spec-Driven Shopping loop — the state machine the shopper runs on every niche. Owns Beat 1 (classify), Beat 4 (search-space) and Beat 5 (reflect); routes Beats 2, 3 and 6 to the references that own them. Load when shopping as the shopper.
4
4
  ---
5
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.
78
-
79
- ## Beat 4 — Persist what surfaced (fact → shared user spec, taste → active domain)
80
-
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/`.
100
-
101
- ### Layering — precedence intent > playbook(domain) > user_spec(SHARED) > domain_spec(domain)
102
-
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.
106
-
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.
114
-
115
- ## Beat 5 — Search → rubric → recommend-with-why → re-fetch before purchase
116
-
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.
6
+ # The six-beat Spec-Driven Shopping loop
7
+
8
+ As the shopper you run one loop on every request — a **six-beat** state machine.
9
+ Most of it is reasoning over what you already know; you only ask the buyer about
10
+ the genuine residue. The beats run **in this order**:
11
+
12
+ 1. **Classify** — resolve the request's `{domain, product, intent}` and reuse a
13
+ learned domain/PRD before minting (owned here, below).
14
+ 2. **Method load / mint / refresh** — recover or research the domain's method +
15
+ its intent-keyed PRDs — [`method_and_prds.md`](method_and_prds.md).
16
+ 3. **Fill** — resolve the PRD by precedence, eliciting only the residue (Beat 3).
17
+ 4. **Search-space** — project the filled PRD into a bounded fan-out (owned here).
18
+ 5. **Reflect** — judge best-available against the PRD + method (owned here).
19
+ 6. **Feedback** — capture what the reaction surfaced (Beat 6).
20
+
21
+ Beats 2, 3 and 6 live in their references; this file owns Beats 1, 4 and 5.
22
+
23
+ ## Beat 1 — Classify: `{domain, product, intent}`, reuse before mint
24
+
25
+ Resolve the request through **three coordinates, top-down**: the **domain** (the
26
+ niche that owns the method), the **product** type within it, and the **intent**
27
+ (the use-context that reshapes the requirements). **Intent is always present**: a
28
+ **context-free** request keys the `general` intent (`ski/boots-general`), so every
29
+ job carries all three coordinates and stays uniformly queryable.
30
+
31
+ **Reuse-before-mint.** Query existing coordinates with **`sil_profile_search`**
32
+ (the frontmatter-as-truth discovery tool — never a filesystem guess) and
33
+ **semantic-match** the request against them: **prefer existing** when a learned
34
+ domain/PRD already covers the job, and only mint when nothing does. The one guard
35
+ against over-merging is the requirements-divergence test — two requests share a
36
+ PRD only if they resolve to the same requirements.
37
+
38
+ **Never over-ask just to key.** Keying **never** forces an extra question: a
39
+ silent request keys `general` and moves on. When intent is genuinely
40
+ requirement-defining but the request is silent, that surfaces as the first Beat-3
41
+ question — not a keying interrogation here.
42
+
43
+ **Announce a mint.** A new-domain or new-PRD mint is **announced** — state the
44
+ inferred `domain / product / intent` so the buyer can **correct** it — **never
45
+ silent**. A reuse passes through with no announcement.
46
+
47
+ ## Beat 4 — Search-space: a bounded, priority-ordered fan-out (not a re-rank)
48
+
49
+ Project the filled PRD onto **`sil_search`** as a **bounded ≤ 4 priority-ordered**
50
+ fan-out, not one search and not unbounded — the bound is a production budget (each
51
+ call is a round-trip + tokens):
52
+
53
+ - **Call 1 is the tightest projection of the PRD's core** (its load-bearing
54
+ requirements); **calls 2–4 are deliberate widenings** — relax the least
55
+ load-bearing requirement, an adjacent phrasing that improves recall, or an
56
+ explicit either/or branch. **Core first, widenings after** — that is the
57
+ **priority order**.
58
+ - **Merge by dedup + concatenate in issue order — this is NOT a re-rank.**
59
+ Concatenate the per-call backend-ranked lists in issue order and **drop** any
60
+ product already **seen** in an earlier call. Because issue order *is* priority
61
+ order, concatenation **never re-ranks** a backend list nor lifts a peripheral
62
+ hit above a core one — the engine owns order *within* each call, the fan-out
63
+ owns order *across* calls.
64
+ - **Project each requirement onto existing params, then `specs` predicates, then
65
+ query enrichment — in that order.** Map each requirement onto the tightest real
66
+ channel:
67
+ 1. an **existing** `sil_search` **param** where one fits (`category`,
68
+ `price_min`/`price_max`, `condition`, `available`, `local_merchants`);
69
+ 2. else a structured **`filters.specs` predicate**, built from the method's
70
+ Beat-2 canonical `## Search vocabulary` (the `sil_specs`-coined names) — one
71
+ `{ns, key, op, value, unit?, hard?}` per annotated requirement, marking an
72
+ inviolable one `hard:true`. **Prefer a dedicated param over a predicate** for
73
+ the SAME attribute — never send both (a `price_max` param OR a price spec, not
74
+ both);
75
+ 3. else — a purely descriptive residue (a colour, a phrasing) — fold it into the
76
+ free-text `query`, which **you author yourself**. The plugin is **pure
77
+ transport**: it never folds a predicate into `query`, so a requirement that
78
+ belongs in `filters.specs` stays a predicate, never `query` prose.
79
+ Leave **`ship_to`** empty (the server resolves the registered default). **Never
80
+ invent** a param or a predicate that isn't real — the params live in the
81
+ `sil_search` description, the predicate vocabulary in the domain method (see
82
+ [`search_param_mapping.md`](search_param_mapping.md)). Then read the per-predicate
83
+ **`specs_status`** the response returns (each `{ns, key, applied}`) — it feeds
84
+ Beat 5's honesty pass, which rejects at pick any `hard` predicate the backend left
85
+ `applied:false`.
86
+
87
+ ## Beat 5 — Reflect: honesty pass first, judgment not threshold, propose-and-wait
88
+
89
+ Take Beat 4's merged issue-order list and its per-call `specs_status`. Run in
90
+ order — **honesty pass → judge → branch** — and **never re-rank**: the engine owns
91
+ order, you own the verdict.
92
+
93
+ **1 — Honesty pass, first.** Before judging fitness, walk the survivors and
94
+ **reject-at-pick** any candidate that violates a *hard* constraint the backend
95
+ could not enforce — exactly the predicates the response marked **`applied:false`**,
96
+ plus the `user_spec` `[hard]` markers. A violator is removed from contention, never
97
+ the pick; if rejection empties the set, fall through to the empty path.
98
+
99
+ **2 — Judge, then branch.** Weigh the best surviving candidate against the PRD +
100
+ method. Whether it satisfies or falls short is a **judgment** call, **not a
101
+ threshold** and not a mechanical any-unmet-requirement rule — read the whole set.
102
+
103
+ - **Satisfies → a hero + 1–2 justified alternatives.** Lead with **one**
104
+ recommendation carrying the SDS-bar *why* (a met requirement, a researched method
105
+ mechanic, and a stored preference reused without re-asking), then **one or two**
106
+ considered **alternatives**, each with a one-line reason. Best-first **as
107
+ returned** — **never re-rank**, never a bare list.
108
+ - **Shortfall or empty → propose a specific relaxation and wait.** Name the gap,
109
+ show the closest survivors, and **propose** the specific change that would widen
110
+ it — then **wait** for the buyer's nod. **No silent re-search** and no silent
111
+ auto-widen; the buyer can redirect instead.
112
+
113
+ A **non-`ok`** status is not an empty match — do not relax params; follow that
114
+ tool's own **`recovery`** exactly.
115
+
116
+ **Then Beat 6.** The buyer's reaction to the recommendation is what Beat 6 captures
117
+ — [`fill_and_feedback.md`](fill_and_feedback.md).
@@ -1,77 +0,0 @@
1
- ---
2
- name: manage-domains
3
- description: View or forget the shopper's learned domains — the two sil_profile tools, the two remove granularities, confirm-before-remove. Load when the user wants to see what the shopper knows or forget a niche.
4
- ---
5
-
6
- # Manage your shopper's domains — view, forget
7
-
8
- Load this when the user wants to see what their **shopper** knows or **forget a domain**
9
- (a niche) — "what does my shopper know?", "which domains has it learned?", "show me the
10
- cycling domain", "forget the grocery niche". The router names which `sil_profile_*` tool
11
- each intent maps to; this reference is what those tools do, plus the **two remove
12
- granularities** and the confirm-before-remove gate.
13
-
14
- These are pure local-lifecycle operations — no server call, no token read. The shopper is
15
- a **singleton** scoped to the fixed `$SIL_DATA_DIR/shopper/` path, so these tools take
16
- **no caller `agentId`** — only an optional `domainSlug`. **The source of truth is the sil
17
- artefact store, not the host agent list:** `$SIL_DATA_DIR/shopper/` with a readable
18
- `profile.json` IS the shopper; its `domains` map is the niche index. Always read
19
- `profile.json`, **never the host agent list**, to decide what exists.
20
-
21
- ## Match intent to a tool
22
-
23
- | Intent | Tool |
24
- |---|---|
25
- | "what does my shopper know?" / "which domains has it learned?" (overview) | `sil_profile_get` (no `domainSlug`) |
26
- | "show me / tell me about the &lt;niche&gt; domain" | `sil_profile_get` (pass the `domainSlug`) |
27
- | "forget / remove / delete the &lt;niche&gt; domain" | `sil_profile_remove` (pass the `domainSlug`) |
28
- | "decommission / tear down my whole shopper" | host CLI `openclaw agents remove <agentId>` **FIRST**, then clear the artefact tree |
29
-
30
- ## How `sil_profile_get` reads the singleton shopper
31
-
32
- - **No `domainSlug` (overview):** returns the `name`, the shared `userSpec` (cross-niche
33
- facts + hard constraints), the **`domains` index** (each niche's `slug`/`name`/
34
- timestamps — no bodies), plus any degraded directory in **`unreadable`**. A shopper
35
- with **no domains yet still reads `ok`, empty index — healthy** (the first shop mints
36
- one); so does an empty store ("you haven't set up a shopper yet" → point at create —
37
- still `ok`, never `not_found`). Render a human summary (shopper, what it knows, domains
38
- learned, wiring); a flat-layout leftover from the old one-agent-per-niche model reads
39
- as `unreadable` — frame it as an old-model leftover, do not read it as a domain.
40
- - **With a `domainSlug`:** returns that niche's pack (`domainSpec` + `intentSpec` +
41
- `playbook`) plus the shared `userSpec`. An unminted/unloadable domain returns
42
- `not_found` (its `recovery` is the no-args `sil_profile_get`) — frame it plainly and
43
- list what DOES exist. **Never surface a stack trace or a raw filesystem path.**
44
-
45
- ## The two remove granularities
46
-
47
- Removal is **destructive and irreversible**, so **confirm before removing**: state
48
- exactly what will be deleted and proceed only on the user's **explicit go-ahead**. When
49
- ambiguous, ask.
50
-
51
- **Forget ONE domain (`sil_profile_remove`).** "forget the grocery niche", "remove the
52
- cycling domain", **"delete the grocery agent"** all mean **forget that one DOMAIN** — the
53
- niche pack only. The shopper, the shared user spec, and every **sibling domain survive**;
54
- no host wiring is touched. Call **`sil_profile_remove { domainSlug }`** — `domainSlug` is
55
- **REQUIRED**. A malformed/traversal/`main`/missing slug returns `invalid_request` and
56
- deletes nothing; an unregistered slug returns `not_found` (idempotent); a filesystem
57
- failure returns `persistence_failed`.
58
-
59
- **Decommission the WHOLE shopper (host-CLI-first).** Remove the entire shopper — host
60
- wiring + `SOUL.md` + the whole artefact tree: (1) `openclaw agents list --json` to
61
- confirm the `agentId`; (2) `openclaw agents remove <agentId>` then `openclaw config
62
- validate --json` — the plugin cannot write host config, so this half runs **first**; (3)
63
- clear the whole `$SIL_DATA_DIR/shopper/` tree. Host-first is a safety order: a failed
64
- artefact step after the host removal leaves only harmless residual artefacts, whereas the
65
- reverse leaves a host entry whose `profile.json` is gone — a visibly broken shopper. Both
66
- halves are idempotent. Leave `plugins.entries.sil.enabled` alone — it is shared host
67
- state for a future re-create.
68
-
69
- ## Status taxonomy (manage: view / remove)
70
-
71
- | `status` | Meaning | What to do |
72
- |---|---|---|
73
- | `ok` | A view returned the overview (a `domains` map may be empty — normal; an absent shopper is still `ok`) or one domain's detail. | Relay the data; on an empty index, point at "just shop a niche". |
74
- | `not_found` | No domain matches the `domainSlug`. Its `recovery` is the no-args `sil_profile_get`. | Frame it plainly and list what DOES exist; for remove, a re-run is safe. |
75
- | `invalid_request` | The `domainSlug` was malformed, `main`, traversal-shaped, or (remove) missing. **Nothing read or deleted.** | Fix the slug and call again — never a stack trace or raw path. |
76
- | `removed` | `sil_profile_remove` deleted exactly one domain pack. | Confirm that niche is gone; the shopper + shared user spec + sibling domains are untouched. |
77
- | `persistence_failed` | The domain directory could not be removed (the **path** + **cause** name what to fix). | Fix the data directory (writable), then remove again. |