sil-openclaw 0.4.6 → 0.5.1

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.
Files changed (58) hide show
  1. package/CHANGELOG.md +185 -0
  2. package/README.md +34 -46
  3. package/SECURITY.md +61 -11
  4. package/dist/gateway/search-results.js +11 -7
  5. package/dist/index.js +24 -24
  6. package/dist/lib/allowlist-script.js +13 -0
  7. package/dist/lib/artifacts.js +30 -0
  8. package/dist/lib/credentials.js +2 -3
  9. package/dist/lib/host-wiring.js +44 -15
  10. package/dist/lib/pkce.js +3 -3
  11. package/dist/lib/search-results-log.js +23 -0
  12. package/dist/lib/search-results-store.js +4 -4
  13. package/dist/lib/shopping-call.js +143 -0
  14. package/dist/lib/sil-client.js +185 -1046
  15. package/dist/lib/tool-result.js +10 -3
  16. package/dist/tools/catalog.js +311 -1197
  17. package/dist/tools/doctor.js +25 -63
  18. package/dist/tools/identity.js +110 -245
  19. package/openclaw.plugin.json +12 -33
  20. package/package.json +10 -9
  21. package/schema/PROVENANCE.md +15 -0
  22. package/schema/shopping-brief-create-request.schema.json +98 -0
  23. package/schema/shopping-brief-create-response.schema.json +24 -0
  24. package/schema/shopping-brief-edit-request.schema.json +125 -0
  25. package/schema/shopping-brief-edit-response.schema.json +24 -0
  26. package/schema/shopping-brief-read-request.schema.json +15 -0
  27. package/schema/shopping-brief-read-response.schema.json +235 -0
  28. package/schema/shopping-domain-create-request.schema.json +160 -0
  29. package/schema/shopping-domain-create-response.schema.json +60 -0
  30. package/schema/shopping-domain-get-request.schema.json +18 -0
  31. package/schema/shopping-domain-get-response.schema.json +307 -0
  32. package/schema/shopping-domain-search-request.schema.json +18 -0
  33. package/schema/shopping-domain-search-response.schema.json +92 -0
  34. package/schema/shopping-offers-request.schema.json +31 -0
  35. package/schema/shopping-offers-response.schema.json +172 -0
  36. package/schema/shopping-product-get-request.schema.json +24 -0
  37. package/schema/shopping-product-get-response.schema.json +121 -0
  38. package/schema/shopping-profile-edit-request.schema.json +97 -0
  39. package/schema/shopping-profile-edit-response.schema.json +17 -0
  40. package/schema/shopping-search-request.schema.json +106 -0
  41. package/schema/shopping-search-response.schema.json +182 -0
  42. package/schema/shopping-seller-get-request.schema.json +24 -0
  43. package/schema/shopping-seller-get-response.schema.json +342 -0
  44. package/scripts/allowlist-openclaw.mjs +6 -7
  45. package/sil-shopping/SKILL.md +196 -97
  46. package/sil-shopping/references/mint.md +190 -0
  47. package/dist/lib/bind-channel.js +0 -10
  48. package/dist/lib/creation-entrypoint.js +0 -111
  49. package/dist/lib/derive-agent-id.js +0 -36
  50. package/dist/lib/profile-store.js +0 -568
  51. package/dist/tools/profile.js +0 -300
  52. package/scripts/create-shopper.mjs +0 -677
  53. package/sil-shopping/examples/multi_domain_shopper_walkthrough.md +0 -65
  54. package/sil-shopping/references/agent_creation_engine.md +0 -223
  55. package/sil-shopping/references/fill_and_feedback.md +0 -102
  56. package/sil-shopping/references/method_and_prds.md +0 -143
  57. package/sil-shopping/references/setup_onboarding.md +0 -64
  58. package/sil-shopping/references/shop_loop.md +0 -118
@@ -1,65 +0,0 @@
1
- ---
2
- name: multi-domain-shopper-walkthrough
3
- description: A worked six-beat run — create one shopper (after endorsement), then shop two unrelated niches in one session (the second minted on the fly), with a shared user_spec fact reused across both and a mid-session correction reconciled by a whole-doc write. Illustrative, not a spec.
4
- ---
5
-
6
- # Worked run — one shopper, two niches, six beats
7
-
8
- Illustrative only — authoritative rules live in the beat references.
9
-
10
- ## Create the shopper (once, after endorsement)
11
-
12
- The two-touchpoint interview assembles a draft persona + shared user-spec seed. Only after the
13
- user **endorses** it does the engine run `openclaw agents add` and materialize the shared
14
- `user_spec.md` — nothing before that. The result is **one** shopper, a **singleton**. The seed
15
- holds one durable fact — `- [hard] ships to Berlin; allergic to wool` — cross-niche, so it
16
- lives in `user_spec` (true in **every** niche).
17
-
18
- ## Niche A — ski gloves (all six beats)
19
-
20
- 1. **Classify** — "warm gloves for the slope" → `{ domain: ski, product: gloves, intent:
21
- slope }`. The domain is the **broad category** (`ski`, not `ski-slope-gloves`), so a later
22
- "ski goggles" reuses this method. `sil_profile_search` finds no ski domain → a MISS.
23
- 2. **Method** — research ski gear, then **mint the general buying guide** via `sil_learn create`
24
- (`target: method`, domain `ski`): a `## How it's bought` section + a coined `## Search
25
- vocabulary` (e.g. `product.waterproof_rating`, `product.insulation_g`) — **dimensions, never
26
- this buyer's values**. **Announced** ("I read this as *ski gloves for the slope*").
27
- 3. **Fill** — the method's dimensions resolve from stored state; the wool allergy is **reused**
28
- from the shared `user_spec` **without re-asking**; only the budget is elicited (one question,
29
- tied to why). The resolved values are authored into the PRD's **`## Search specs`** block —
30
- e.g. `{ns:product, key:waterproof_rating, op:gte, value:10000, unit:mm, hard:true}` — and
31
- persisted with `sil_learn create` (`target: prd`, `ski/gloves-slope`).
32
- 4. **Search-space** — **project** the PRD's `## Search specs` block **verbatim** into a bounded
33
- ≤ 4 `sil_search` fan-out, core first, deliberate widenings after.
34
- 5. **Reflect** — honesty pass, then a **hero + one alternative**, each with a why.
35
- 6. **Feedback** — "I always run Hestra" → confirm, then **`sil_learn write`** the ski method with
36
- a `## Durable taste` line folded in (a whole-doc reconcile, per-domain — not a stray bullet).
37
-
38
- ### A correction, mid-session — the write-reconcile
39
-
40
- The buyer pushes back: "the €120 cap was just for today — my real ceiling is €90, and I don't
41
- care about touchscreen fingers." That **contradicts** two filled preferences and is a
42
- **standing** change, so reconcile the PRD with a single **`sil_learn write`**: read the current
43
- `ski/gloves-slope`, **rewrite** the budget predicate and drop the touchscreen one in place, and
44
- write the coherent whole back. No second, contradicting bullet is ever added — the PRD stays
45
- **one truth per dimension**, and the next search projects the corrected block.
46
-
47
- ## Niche B — an espresso grinder (same session, minted on the fly)
48
-
49
- The user pivots: "now I need a burr grinder" — a **second, unrelated niche**. No agent switch;
50
- the one shopper handles it:
51
-
52
- 1. **Classify** → `{ domain: espresso, product: grinder, intent: general }` (context-free →
53
- `general`).
54
- 2. **Method** — a MISS again → research + **mint the general method on the fly** (`create`),
55
- **announced**.
56
- 3. **Fill** — "ships to Berlin" is **reused across** niches from the shared `user_spec`, kept
57
- from the ski session. The Hestra taste, per-domain on the ski method, does **not** leak here.
58
-
59
- Shared facts flow to both; per-domain taste stays isolated.
60
-
61
- ## The singleton edge
62
-
63
- "Set me up a second shopper" → the engine refuses: **a shopper already exists**. Steer to shop
64
- a new niche (mints a domain on the spot) or refine an existing one with `sil_learn write` — never
65
- a second shopper.
@@ -1,223 +0,0 @@
1
- ---
2
- name: agent-creation-engine
3
- description: Create the single sil-wired shopper end to end — the two-touchpoint onboarding interview (persona + shared user-spec seed, endorsement-gated) then the one-command engine that persists it. Load when the user asks to create or set up their sil shopper.
4
- ---
5
-
6
- # Create the shopper
7
-
8
- Two parts, in order: an **onboarding interview** that shapes the shopper *with* the
9
- user, then the **engine** that persists it. Nothing is created until the user
10
- **explicitly endorses** the draft — the gate lives in Part 1 and the engine refuses
11
- to run before it.
12
-
13
- ---
14
-
15
- ## Part 1 — The onboarding interview
16
-
17
- When the user asks to **set up shopping** ("create my shopper"), do **not** jump to
18
- the engine. Run a short, **two-touchpoint** onboarding — **pre-seeded from what they
19
- already said this session** — and create nothing until they endorse the draft.
20
-
21
- This is a **conversation, not a form-fill**. The shopper is a **generalist**: it goes
22
- deep on whatever the user later buys, **lazily minting a domain on first shop**.
23
- Onboarding researches **no niche** and picks **none** — it touches exactly two things:
24
- the **persona** and a **shared user-spec seed**.
25
-
26
- ### Open with a reflected draft
27
-
28
- Before asking anything, **pre-seed** from what the user said *this session* — the
29
- persona (how it should behave) and the user-spec seed (sizes, hard limits, ethics
30
- rules mentioned in passing) — then **reflect it back** ("from what you've told me,
31
- here's the shopper I'd set up…") and ask only to confirm-or-adjust.
32
-
33
- - **Pre-fill, don't interrogate** — fill only genuine gaps. Little said? Seed a
34
- **minimal honest** draft ("facts to be learned as we shop; no hard constraints
35
- yet") and say so — never fabricate a size or limit.
36
- - **Session-only, local + offline** — no token, no `sil_whoami`, no network.
37
- - **The pre-fill is a proposal, never consent** — the endorsement gate stands.
38
-
39
- ### The two touchpoints
40
-
41
- | Artefact | Where | Holds |
42
- |---|---|---|
43
- | **`SOUL.md`** (persona) | host workspace | the shopper's voice / standing rules — a **generalist** |
44
- | **`user_spec.md`** (shared) | sil data dir (**required**) | **cross-niche** facts + hard constraints (addresses, sizes, allergy/ethics rules, budget psychology) |
45
-
46
- The niche packs — deep know-how, per-request template, niche taste — are **not
47
- authored here**; they mint **lazily on first shop** ([`shop_loop.md`](shop_loop.md)).
48
-
49
- 1. **Persona** — confirm-or-adjust the seeded **voice/tone** and any **standing
50
- rules**. This surfaces voice, **not a niche**. Becomes the workspace **`SOUL.md`**.
51
- 2. **Shared user spec** — pre-fill the **cross-niche** facts and any **hard
52
- constraints** holding in *every* niche (addresses/sizes, an allergy or ethics rule,
53
- budget psychology). Reflect back; mark each **hard** (inviolable) vs **soft**
54
- (bendable). Seed what's offered; the rest is augmented per-query at shop time.
55
- Lands in `userSpec`. **No niche taste, no domain question, no intent dimensions
56
- here.**
57
-
58
- ### Assemble + endorse — the gate
59
-
60
- - **Identity** — confirm ONE friendly display `name`. There is **no `agentId` to invent**:
61
- the engine derives it from `name` (lower-kebab; a `main`/empty slug silently falls back
62
- to `sil-shopper`), so identity is just the name.
63
- - **Assemble** — compose **`{ name, persona, userSpec }`**, present a readable summary,
64
- self-check the shape (non-blank `name`/`persona`/`userSpec`). Writes nothing — the
65
- engine's validate-first step is the authoritative gate.
66
- - **Endorse** — ask for an explicit go-ahead. Endorsement is an affirmative act
67
- ("yes, create it") — **not** inferred from the last answer or from silence. **Only on
68
- that explicit yes** do you run Part 2.
69
-
70
- ### Interview invariants
71
-
72
- - **No creation without explicit endorsement** — zero engine steps before the "yes";
73
- the draft lives only in the conversation, so an abandoned interview leaves no partial
74
- shopper.
75
- - **Two touchpoints only** — persona, then shared user spec, both session-seeded. No
76
- niche researched or chosen; that is first-shop lazy mint.
77
- - **Converge each touchpoint before advancing; stay re-entrant** — the user can revise
78
- earlier.
79
- - **Singleton** — if a shopper exists the engine refuses (its `collision`); surface it,
80
- steer to shop-a-new-niche or refine, never clobber the existing.
81
- - **Local + offline for identity** — never present registration or a token as a
82
- prerequisite, never pull `sil_whoami` to seed.
83
-
84
- ---
85
-
86
- ## Part 2 — The creation engine
87
-
88
- **Run ONLY after the endorsement gate above clears.** The engine persists **one**
89
- OpenClaw agent — the **shopper**: a host `agents` entry, sil plugin enabled + skill
90
- attached, persona in the workspace **`SOUL.md`**, the **shared user spec** in the sil
91
- data dir. A **singleton** that learns **domains** lazily on first shop — a fresh
92
- shopper's `domains` map is empty, which is healthy. Creation is **local + offline**: no
93
- token, no `sil_register`/`sil_whoami`, no network — it registers the user later, on
94
- first shop.
95
-
96
- ### The one command
97
-
98
- Run one shipped script — **non-interactive**, **atomic**, **fail-closed**; it emits one
99
- JSON result. It is a standalone operator script, not the plugin process, so the plugin's
100
- "never write host config" guarantee holds.
101
-
102
- **Get its path from `sil_doctor` — never guess it, and never derive it from this file's
103
- own location.** Call `sil_doctor` and read the report's top-level **`creationEntrypoint`**:
104
- an absolute path, reported every run. It is the only sound source. This file is published
105
- to you as a *symlink*, so a `../scripts/…` hop off this directory does not resolve for
106
- `node` even though `cat` and `ls` say it does; and the bare bin name is on PATH only for
107
- some installs. Both dead-end at this exact step.
108
-
109
- Feed the endorsed spec as a **file**, not a heredoc — shell quoting must never touch
110
- model-authored prose (apostrophes, quotes, backticks, `$`, newlines are the norm in a
111
- persona). Write it **0600 under a private dir**, run, then **remove it**: the spec carries
112
- the user's `userSpec` (address, sizes, allergy/ethics rules), so it must not linger
113
- world-readable. The script never deletes an input it does not own — that is yours.
114
-
115
- ```
116
- # 1. sil_doctor → creationEntrypoint (absolute path to the creation script)
117
- # 2. write the endorsed spec, owner-only, in a private dir:
118
- umask 077 && mkdir -p ~/.sil-tmp && SPEC=~/.sil-tmp/shopper-spec.json
119
- # …write the JSON object below to "$SPEC"…
120
- # 3. run it by absolute path, via node:
121
- node "<creationEntrypoint>" --spec "$SPEC"
122
- # 4. remove it, whatever the result:
123
- rm -f "$SPEC"
124
- ```
125
-
126
- The spec file's contents — one JSON object:
127
-
128
- ```json
129
- { "name": "My Shopper",
130
- "workspace": "~/.openclaw/workspace-my-shopper",
131
- "persona": "…endorsed persona…", "userSpec": "…seeded shared user spec…",
132
- "channel": "telegram" }
133
- ```
134
-
135
- ### The spec (input)
136
-
137
- | Field | Meaning | Goes to | Required? |
138
- |---|---|---|---|
139
- | **name** | Human-readable display name; the `agentId` is **derived** from it. | sil store | yes |
140
- | **persona** | Who the shopper is — a generalist, its voice, standing rules. | host **`SOUL.md`** | yes |
141
- | **workspace** | The shopper's workspace directory. | host | yes |
142
- | **userSpec** | Shared **cross-niche** facts + hard constraints (seeded partial). | sil `user_spec.md` | yes |
143
- | **channel** | Setup conversation's channel, bound to the shopper. | host bindings | optional (fail-open) |
144
-
145
- The `agentId` is **not an input** — the bin derives it as `deriveAgentId(name)`
146
- (lower-kebab `^[a-z0-9][a-z0-9-]*$`; a `main`/empty slug silently folds to `sil-shopper`).
147
-
148
- **No per-niche input at create** — no method, no PRD; those mint lazily on first shop
149
- via `sil_learn create`. The shopper needs web tools (inherited from `agents.defaults`)
150
- to mint/refresh domains; if defaults grant none, the bin reports `created` with a
151
- `warnings` gap (bare `sil_search` still works) — surface it.
152
-
153
- ### What the bin does, in order (atomic, fail-closed)
154
-
155
- 1. **Validate first, then derive the id** — bad/blank `name`, `persona`, `workspace`, or
156
- `userSpec` → **`invalid_request`** naming the field; **nothing written**. Then
157
- `agentId = deriveAgentId(name)` — the derivation always yields a conforming id (empty
158
- or `main` slug → the silent `sil-shopper` fallback), so the id is never a failure mode.
159
- 2. **Config + singleton pre-flight** — no host config → `persistence_failed`. An
160
- existing shopper `user_spec.md`, or an `agentId` clash → **`collision`** ("a shopper
161
- already exists"); steer to shop-a-new-niche or refine, **never a second shopper**. An
162
- inconclusive read fails closed.
163
- 3. **Snapshot `openclaw.json`** — the teardown anchor, before any write.
164
- 4. **`openclaw agents add`** — the real `agents.list[]` entry + workspace bootstrap,
165
- inheriting model + tools from `agents.defaults`.
166
- 5. **Write `SOUL.md`** = endorsed **persona + the standing "The sil way" creed block**
167
- (below).
168
- 6. **Materialize the shared user spec** — `sil_profile_materialize { name, userSpec }`
169
- (singleton, no agentId) writes **`user_spec.md`** atomically, name in its
170
- frontmatter. **Setup-only: no domain, no method, no PRD.**
171
- 7. **Attach skill + enable plugin** (value-mode `config set --strict-json`, the only
172
- mode the pinned `alpine/openclaw:2026.6.9` accepts):
173
- `agents.list[<idx>].skills` ← `["sil-shopping"]`; `plugins.entries.sil.enabled` ←
174
- `true`. **No per-agent `tools.deny`** — the shopper inherits the host default toolset.
175
- 8. **Admit sil (plugin trust)** — the shipped **`scripts/allowlist-openclaw.mjs`** helper
176
- (which the script runs itself, by absolute path via `node` — never the bare name)
177
- additively merges the three trust surfaces (`plugins.allow` + `tools.alsoAllow` +
178
- `plugins.entries.sil`) — the only way to un-filter `sil_*` without clobbering a
179
- co-installed plugin. A non-zero exit → **`persistence_failed`** (never a green
180
- `created` over filtered tools).
181
- 9. **Bind the channel — FAIL-OPEN** — resolve (`spec.channel`, else
182
- `OPENCLAW_MCP_MESSAGE_CHANNEL`), bind, **verify** the route stuck. Undetermined /
183
- owned / unverifiable → revert + a manual-bind hint in `warnings`. Never fails
184
- creation.
185
- 10. **Validate then declare** — `config validate --json` keys off **`.valid`**. Only
186
- `valid: true` **and** step 8 ok → **`created`** (with `boundChannel`, or `null`).
187
- Any failure **after step 4** tears down (restore the snapshot; remove the workspace
188
- + shopper dir only if it created them), so `persistence_failed` means **nothing
189
- partial**. If teardown cannot fully revert, a louder **`teardown_failed`** names the
190
- residue.
191
-
192
- Exit 0 **only** on `created`.
193
-
194
- ### The `SOUL.md` "The sil way" creed block
195
-
196
- The persona is followed by a standing **"The sil way"** creed — an identity-level
197
- restatement (a philosophy, not a rulebook; the mechanics live in the attached skill)
198
- carrying the **explore-first** mantra, the loop in three lines, and the one distinction
199
- that matters: the shopper **mints an unlearned niche first** (a `sil_profile_search`
200
- MISS → `sil_learn create`, then search); **the sil catalog is where you buy, the open
201
- web is where you learn** (web only researches a niche's buying guide, never sources a
202
- pick); and its **shopping memory is the sil store** — it records what it learns through
203
- `sil_learn` / `sil_profile_*`.
204
-
205
- ### Status taxonomy
206
-
207
- | `status` | Meaning | Do |
208
- |---|---|---|
209
- | `created` | Shopper added, spec materialized, plugin + skill + hardening wired, config valid. Carries `name`/`agentId`/`workspace`/`boundChannel` (or `null`). | Tell the user; if `boundChannel` null, relay the manual-bind hint. |
210
- | `invalid_request` | Spec failed validation. Nothing attempted. | Name the field, fix, re-run. |
211
- | `collision` | A shopper (singleton) or `agentId` already exists. Nothing written. | Steer to shop-a-new-niche or refine — never a second shopper. |
212
- | `persistence_failed` | A write, the allow-list helper, or `config validate` failed; teardown fully reverted. | Fix the path/cause, re-run (safe). |
213
- | `teardown_failed` | Teardown could NOT fully revert. | Louder — names the residue; the host is not at its pre-run state. |
214
-
215
- ### Runtime
216
-
217
- At session start the host has injected the persona via **`SOUL.md`**. Load the shared
218
- **`user_spec.md`** (cross-niche facts + hard constraints; frontmatter carries the name);
219
- `sil_profile_search` scans the learned domains (empty is healthy) and each per-domain
220
- method loads **lazily at shop time**. The `sil_*` tools admitted at create, the shopper
221
- shops with no further setup, minting each niche on the fly on first shop
222
- ([`shop_loop.md`](shop_loop.md)). To sharpen it, see
223
- [`fill_and_feedback.md`](fill_and_feedback.md).
@@ -1,102 +0,0 @@
1
- ---
2
- name: fill-and-feedback
3
- description: Beats 3 and 6 of the sil shopping loop. Beat 3 fills the PRD by precedence (multi-turn, authors the Search specs block, hard-constraint dual-enforce, the persistence split); Beat 6 is the reaction half (capture-gate, confirm-before-write, route-by-scope). Covers sil_learn, the one target+change write verb (create | write | attach-asset). Load within an active sil shopping loop.
4
- ---
5
-
6
- # Beat 3 (Fill) and Beat 6 (Feedback) — via `sil_learn`
7
-
8
- Beats 1–2 hand off the resolved PRD + method body. Beat 3 fills it; Beat 6 captures
9
- what the reaction surfaces — both persist through **`sil_learn write`** (the whole
10
- reconciled doc, never a stacked bullet).
11
-
12
- ## Beat 3 — Fill by precedence
13
-
14
- Enumerate the load-bearing dimensions the method names, then resolve each down the
15
- chain, **first hit wins**:
16
-
17
- **request-intent > PRD filled-pref > method taste > user_spec fact > method default**
18
-
19
- A pure **read-compose** — **most** dimensions **resolve** from stored state with
20
- **no question** (a revisited niche does not re-ask).
21
-
22
- **Elicit the residue — multi-turn.** Only a dimension that is unresolved **and**
23
- load-bearing **and** not answerable from a sensible default goes to the buyer.
24
- Pursue each until **resolved** or explicitly **declined**, then search. Each turn is
25
- **a few at a time, never a battery**, each tied to **why**, playing the filled
26
- understanding back.
27
-
28
- **Author the `## Search specs` block.** As dimensions resolve, project each into a
29
- `{ ns, key, op, value, unit?, hard? }` predicate (keys from the method's `## Search
30
- vocabulary`) — the block Beat 4 sends verbatim. A **preferred-value-with-fallback**
31
- ("prefer ear hooks, fins acceptable") is **one `op:in` set** over the acceptable
32
- values, **not** a hard `eq` on the favourite; the favourite is a **Beat-5 ranking**
33
- preference. Mark a predicate **`hard: true`** only when a miss must **reject at pick** —
34
- loose hard-marking empties result sets.
35
-
36
- **Live request vs a stored durable pref — ask, don't guess.** When the request
37
- contradicts a stored **durable** PRD preference, the request wins **this** search,
38
- but ask whether it is **one-off** or **standing**. "Just this once" → ephemeral, no
39
- write. "From now on" → a **standing** change: **`write`** the reconciled PRD (the
40
- changed line rewritten in place). **Never silently overwrite** a standing preference.
41
-
42
- **Hard constraints are inviolable — dual-enforced.** A `user_spec` `[hard]` line and a
43
- PRD `## Search specs` `hard:true` predicate route to a real **filter** where one exists
44
- **and** to Beat 5's **reject-at-pick** check — because a `specs` predicate can read
45
- `applied:false`.
46
-
47
- **The split — persist stated durable answers NOW.** Fill is the **first** of two
48
- persistence moments: a durable answer the buyer **stated** during elicitation is
49
- **written** into the PRD **now** — a `write` that folds it into `## Search specs` /
50
- `## Filled preferences` — so an abandoned session still recovers what was settled. What
51
- the buyer's **reaction** surfaces is **Beat 6's** write. One-off direction stays
52
- **ephemeral**, **never written** by either.
53
-
54
- **Decline never blocks.** A declined question narrows **quality**, never **access**
55
- — proceed on the best-defensible params and **state the assumption** ("assuming
56
- waterproofing, since it's for the slope"). Unresolved-and-declined dimensions land
57
- in the PRD's **`## Notes / open`** so the next session recovers, not re-asks — a
58
- non-answer is a note, never a preference.
59
-
60
- ## Beat 6 — Feedback: the reaction half
61
-
62
- Beat 6 is the loop's **only reaction-time persistence**, a standing beat.
63
-
64
- **The capture gate — most reactions persist nothing.** Write only a signal that is
65
- **durable AND new** — no **duplicate** (not already stored), no **noise**, no
66
- **empty** entry. A this-pick reaction ("too pricey this time") is not durable, never
67
- written.
68
-
69
- **Confirm before every durable write.** When the gate surfaces a new durable
70
- candidate, **confirm before** writing it ("want me to remember you run Shimano?") —
71
- **never a silent harvest**. The confirm is gated behind the candidate, so most
72
- reactions ask nothing.
73
-
74
- **Route by scope — the placement rule.** A confirmed signal lands at the **broadest
75
- scope where it stays true**:
76
-
77
- - a cross-domain **fact** / **hard** constraint → **`user_spec`**;
78
- - a durable per-domain **taste** → the **method** (`## Durable taste`);
79
- - a **this-job** preference or spec → the **PRD** (`## Filled preferences` /
80
- `## Search specs`);
81
- - an **image** → **`attach-asset`** (per-domain).
82
-
83
- **Every write is a reconciled whole-doc `write`.** Read the target
84
- (`sil_profile_get`), fold the new signal into the coherent whole, and `sil_learn write`
85
- it back — a correction **rewrites** the line it changes, so the doc **never stacks a
86
- contradicting bullet**. There is no append/amend/retract; reconciliation is the only
87
- update path.
88
-
89
- **Re-scope = write-broader-then-write-narrower.** When a reaction shows a stored fact
90
- is broader than where it lives, `write` it into the **broader** target and `write` the
91
- **narrower** one without the moved line (two `sil_learn write` calls). There is **no
92
- promote verb**.
93
-
94
- ## `sil_learn` — the one target + change write verb
95
-
96
- `sil_learn` is the single **target + change** verb owning the whole method/PRD
97
- lifecycle. `target` selects where the change lands (`user_spec` / `method` / `prd`);
98
- the **kind** selects the change. **Three kinds:** **create** (mint a NEW method/PRD —
99
- errors if one already exists), **write** (replace an existing doc's whole body with the
100
- reconciled version you author — read it first, carry every buyer line forward),
101
- **attach-asset** (persist image bytes, linked by path). Every capture is reviewable via
102
- `sil_profile_get` and erasable via `sil_profile_remove` — never silently harvested.
@@ -1,143 +0,0 @@
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 method/PRD templates, 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** (method exists) or a **MISS** (no
9
- method yet). Beat 2 turns that into a method body in context, ready for Beat 3 to
10
- fill. Three paths.
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**. This is the default on every revisit; the method is
16
- **recovered, never rebuilt**. Loading its `## Search vocabulary` brings the coined
17
- `ns.key` dimensions into context for Beat 4.
18
-
19
- ## MINT — cold (MISS)
20
-
21
- No method exists, so **mint** one — this is where you **explore**. Research the niche
22
- on the web **freely and often** to learn how it is *really* bought: its load-bearing
23
- attributes, its failure modes, what separates a good buy from a bad one. The one
24
- boundary — you research the **domain** (how it's bought), you **never source products**
25
- from the web; every pick comes only from `sil_search` in Beat 4.
26
-
27
- **The method is GENERAL — the whole product category, reusable across every intent.**
28
- It holds *how the category is bought* and the *dimensions* that decide a buy — **never
29
- this buyer's values** (those are the PRD). Mint at the **broadest slug whose buying
30
- guide generalises**: `earbuds` serves gym, commute, and office; the gym specifics live
31
- in the gym PRD, not a `wireless-gym-earbuds` method. Folding the use-context into the
32
- domain forks a near-duplicate method per intent and kills reuse.
33
-
34
- Persist with **`sil_learn create`** (`target: "method"`, domain + name + body) — the
35
- file **is** the registration (it errors if the method already exists: a revisit LOADs,
36
- a stale one REFRESHes with `write`). Never the setup-only `sil_profile_materialize`.
37
- Then **announce** the inferred domain so the buyer can correct it. The method body
38
- carries these sections, and only these:
39
-
40
- - **`## How it's bought`** — the buying guide: load-bearing attributes, failure modes,
41
- what separates a good buy from a bad one — general to the category, not this buyer.
42
- - **`## Search vocabulary`** — the spec **dimensions** you coin (`ns.key` + `data_type`
43
- + unit + `allowed_values` + why-it-matters) — names only, **no values**.
44
- - **`## Durable taste`** — the buyer's cross-intent per-domain taste, seeded from
45
- `user_spec` (omit until something durable is known).
46
- - **`## Volatility`** — the volatile axis + a rough refresh cadence.
47
-
48
- The vocabulary is **canonicalized before persist**. `sil_specs` is
49
- **precision-first** — two specs converge only when **every field** agrees within the
50
- same `namespace` and `data_type`, so the name decides whether a concept converges or
51
- forks: a synonym (`speed_mbps` vs `transfer_speed_mbps`) splits one concept into two
52
- specs that never match. So coin for the match:
53
-
54
- - **One concept, one spelling.** Reuse the exact `ns.key`, `display_name`,
55
- `data_type`, and `unit` you already coined for that concept — verbatim, across
56
- every domain (consult a sibling method with `sil_profile_get` only when the
57
- concept plausibly recurs, never an exhaustive scan).
58
- - **Common attribute → conventional name.** For a widely-shared attribute you have
59
- **not** coined before (screen size, weight, RAM, waterproof rating, material…),
60
- take its **conventional** name — a Schelling point, there being no registry to
61
- read. Coin fresh only for a genuinely niche attribute.
62
- - **Corroborate the name.** Carry a concept-naming **`description`** — the
63
- **corroborator** the dedupe leans on to merge synonyms and keep distinct concepts
64
- apart — and get **`data_type`** and **`namespace`** right, the hard floors a wrong
65
- value forks the concept past.
66
-
67
- Submit the definitions to **`sil_specs`** (dedupe-or-create) and adopt the returned
68
- **canonical** `ns.key`: **`matched`** → an equivalent exists, **drop your synonym for
69
- the canonical**; **`created`** → yours is novel and canonical going forward (keep it).
70
- Rewrite the `## Search vocabulary` and any PRD `## Search specs` predicates to those
71
- names before persisting — the method is **born canonical**, never write-then-fix. This
72
- is what makes `filters.specs` filter across methods; naming is never a gate — a
73
- fragmenting name costs precision, never blocks a search. If `sil_specs` is **not
74
- `ok`** (a registry blip), **do not block the mint**: persist the **raw coined names**
75
- (every predicate reads `applied:false`) and shop on — convergence retries next
76
- mint/refresh. Canonicalization is **silent to the buyer**: never surface `ns.key`
77
- plumbing.
78
-
79
- ## REFRESH — signal-driven (HIT, stale)
80
-
81
- A plain revisit LOADS; a refresh fires **only on a signal** — never on a TTL, not
82
- every revisit. The three signals: the buyer **contradicts** the guide, the
83
- **volatility marker** is overdue, or the buyer **explicitly asks**. Signal-driven,
84
- not a clock.
85
-
86
- Refresh is a **reconciled `write`**: load the current method, re-research **only** the
87
- stale volatile material, **carry every buyer-authored line forward verbatim**, and
88
- `sil_learn write` (`target: "method"`) the whole reconciled body — announce the delta.
89
- The rewrite supersedes stale *research* claims and **never clobbers** a buyer line. The
90
- method stays fully buyer-mutable — every edit is a `write` of the reconciled whole.
91
-
92
- Canonicalize any **newly-coined** specs via `sil_specs` before persisting — same
93
- convergence discipline (reuse a name already coined for the concept; take the
94
- conventional name for a common attribute), resubmitting **only** specs not yet
95
- carrying a canonical name (already-canonical names are stable).
96
-
97
- ## Intent-keyed PRDs
98
-
99
- A PRD's identity is the **job-to-be-done**, keyed by three coordinates so it stays
100
- queryable: `{ domain, product, intent }` → `ski/gloves-slope` (intent always present;
101
- a context-free request keys `general`). It holds the method's dimensions **resolved to
102
- this job** — the buyer's actual values — **specialized, never a copy of the method's
103
- guide**. PRDs are **durable** and **revisitable** — re-buying the same thing, or
104
- resuming an unfinished session, **recovers** the PRD, never rebuilds it. The PRD body
105
- carries these sections:
106
-
107
- - **`## Search specs`** — the load-bearing block: the **resolved predicate set**, a
108
- list of `{ ns, key, op, value, unit?, hard? }` entries **projected verbatim** into
109
- `sil_search`'s `filters.specs` at Beat 4 (one entry per decided dimension, keys drawn
110
- from the method's `## Search vocabulary`). A *"prefer X, Y/Z acceptable"* requirement
111
- is **one `op:in` set** over `{X, Y, Z}` — mark it `hard` only when a miss must
112
- reject-at-pick — with the X-preference applied as **Beat-5 ranking**, **never** a hard
113
- `eq` on X alone (that rejects the acceptable alternatives and empties the set).
114
- - **`## Filled preferences`** — the buyer's stated durable answers, reconciled: **one
115
- truth per dimension**. A correction **rewrites** the line it changes; it never adds a
116
- second, contradicting one.
117
- - **`## Notes / open`** — declined or unresolved dimensions, so the next session
118
- recovers rather than re-asks. A **non-answer** ("no budget stated") lives here,
119
- **never** as a preference.
120
-
121
- Every PRD write is a whole-body **`sil_learn write`** (or **`create`** for the first
122
- mint): read the current PRD, reconcile in context, write the coherent whole — so the
123
- `## Search specs` block and `## Filled preferences` never drift apart or self-contradict.
124
-
125
- ## The store — frontmatter-as-truth (no manifest)
126
-
127
- Artefacts live at `shopper/domains/<slug>/{method.md, prds/<product>-<intent>.md,
128
- assets/}`. There is **no manifest** — each file's own **frontmatter** IS the truth,
129
- discovered by a filesystem **scan** over those coordinates. Malformed frontmatter is
130
- skipped and surfaced as `unreadable`, never half-read.
131
-
132
- ## Discovery + manage
133
-
134
- - **Discover / reuse-before-mint** with **`sil_profile_search`** — queries artefact
135
- **frontmatter**, returns **coordinates** only (no bodies): the learned domains and
136
- their PRDs. The frontmatter-as-truth query, **not a manifest** and not a
137
- filesystem guess. The no-filter call is the "what does my shopper know?" overview.
138
- - **Read one body** with **`sil_profile_get`** — `domainSlug` for the method body,
139
- `+prd` for that PRD's body. **Read before every `write`** — reconcile from the real
140
- current body, never from memory.
141
- - **Remove** with **`sil_profile_remove`** — `domainSlug` alone removes the **whole
142
- domain** subtree; `+prd` removes **just that PRD** (method + siblings survive).
143
- Destructive: **confirm** with the buyer first.
@@ -1,64 +0,0 @@
1
- ---
2
- name: setup-onboarding
3
- description: The one-time setup script the router defers to when state shows sil setup is incomplete (no shopper, or a shopper with no domains) — the five-stage onboarding progression, the after-register shopper offer, and the per-search pitch. Sheds once setup is complete.
4
- ---
5
-
6
- # Setting up the shopper — the staged onboarding
7
-
8
- The router defers the **one-time setup script** here: the five-stage progression, the
9
- after-register offer, the per-search pitch. None applies once setup is complete — the router
10
- sheds it. **Read the stage from state, never guess:** `sil_whoami` (registered?) + a no-arg
11
- **`sil_profile_search`** (any `domains`?). Present **only the current stage's beat and its
12
- single next step**.
13
-
14
- ## The five-stage progression
15
-
16
- 1. **Unregistered** — `sil_whoami` finds no identity. Before `sil_register`, state plainly
17
- what it does and **how 4GPTs & SIL use the user's data**, grounded strictly in this plugin
18
- (no invented policy): registering opens a browser sign-in creating their **sil identity**
19
- (name + addresses, read by `sil_whoami`), stored **locally**; the shopper's setup + memory
20
- live under `$SIL_DATA_DIR`, never leaving the device via the plugin; **search** hits sil's
21
- catalog. Next: `sil_register`.
22
- 2. **Registered, no shopper** — identity exists, `sil_profile_search` returns no domains, no
23
- shopper created. Bare `sil_search` works but isn't the finished state; guide the user to
24
- **set up their shopper**, naming up front it takes a **couple of minutes and a few
25
- questions**. The after-register offer owns the gate.
26
- 3. **Shopper, no domain** — the shopper was created (engine `created`) but `sil_profile_search`
27
- still returns no domains. The first shopping intent **mints the first domain**, announced
28
- with the inferred niche so the user can correct it. Next: state a shopping intent.
29
- 4. **Shopper active** — `sil_profile_search` returns ≥ 1 domain. Milestones: the **first domain
30
- created**, and softer, that `sil_learn` stored a fact or taste.
31
- 5. **Setup complete** — a shopper with ≥ 1 domain. **Shed** every onboarding beat; **show only
32
- how to use** the plugin well — the domain-gated six-beat loop and Spec-Driven Shopping
33
- ([`shop_loop.md`](shop_loop.md)).
34
-
35
- ## After register — offer the shopper, once (offer_shopper)
36
-
37
- `sil_register` returns `already_registered` with `next_step: "offer_shopper"` on a confirmed
38
- registration. Run a no-arg **`sil_profile_search`**, then branch:
39
-
40
- - **No domains, no shopper:** introduce the shopper in one beat and offer to set it up — name
41
- the value (shops each niche in depth; reuses the sizes + hard limits it knows so nothing is
42
- re-asked; explains why each pick fits). Load
43
- [`agent_creation_engine.md`](agent_creation_engine.md) **only if the user accepts** — its
44
- Part 1 onboarding runs first, the engine only after endorsement. Take no for an answer; bare
45
- `sil_search` stays first-class.
46
- - **A shopper exists:** **skip this beat.** The shopper is a **singleton** — never offer a
47
- second.
48
-
49
- ## After a bare search — the per-search pitch (post-result)
50
-
51
- When a plain `sil_search` **completes `ok`** in a **profile-less** session, present the results
52
- best-first **exactly as returned**, then append **one short trailing line** naming what a
53
- shopper adds. Never a pre-search question, never a re-rank. Name one or two of three levers,
54
- rotating which you lead with:
55
-
56
- - **niche depth** — weighs picks against how the niche actually buys;
57
- - **memory** — keeps your sizes + hard limits on file, so no search re-asks them;
58
- - **the why** — explains which pick fits you and why.
59
-
60
- It **recurs on every** completed profile-less search — **no fire-once gate, no cooldown**;
61
- brevity + lever rotation keep it from nagging. Two suppressors: a **shopper exists** (that
62
- session is the shopper's — drop the line), or the search **not `ok`** (its own recovery
63
- carries; add no tip).
64
- </content>