sil-openclaw 0.3.8 → 0.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -10,6 +10,62 @@ release (`clawhub package publish --changelog`). See [README](./README.md#releas
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [0.3.9] - 2026-07-10
14
+
15
+ ### Added
16
+
17
+ - **A new shopper is auto-bound to the current channel — fail-open, verified.**
18
+ Creation grew a final bind beat: `resolveBindChannel` picks the channel
19
+ (`spec.channel` > `OPENCLAW_MCP_MESSAGE_CHANNEL` > none), and
20
+ `create-shopper.mjs` binds the freshly-minted shopper to it and **verifies the
21
+ bind from the host's own JSON** before declaring success (the `created` outcome
22
+ now carries `boundChannel`). The bind is **fail-open**: a bind or verify
23
+ failure never fails the create and never leaves a half-bound agent — it
24
+ self-reverts and returns a manual-bind hint naming the shopper and the exact
25
+ step to run. No channel resolvable is a clean no-op, not an error. (#48)
26
+ - **`SKILL.md` is now stage-aware and gates the shopper's search on a learned
27
+ domain.** The always-loaded router reads two live signals — registration
28
+ (`sil_whoami`) and shopper state (the no-arg `sil_profile_get` overview) — and
29
+ presents a **five-stage onboarding progression** while setup is incomplete,
30
+ then **sheds to usage-only** once complete, so a steady-state session isn't
31
+ taxed with setup prose. When acting *as the shopper*, search is gated behind a
32
+ learned domain (classify → learn-on-miss before any `sil_search`); the
33
+ profile-less **Lane 1 bare search stays untouched**. Prose-only — no tool
34
+ change, `contracts.tools` byte-unchanged. (#49)
35
+
36
+ ### Changed
37
+
38
+ - **The `sil-shopping` skill bundle was refactored to progressive disclosure and
39
+ de-rigidified** — same SDS state machine and file-creation flow, leaner and
40
+ more legible. The one-time onboarding script was **evicted from the
41
+ always-loaded `SKILL.md`** into `references/setup_onboarding.md` (loads on
42
+ demand, shed once setup completes); the router collapses to a **pure state
43
+ branch** (no identity / no shopper / shopper) — body **2394 → 1042 words
44
+ (−56%)**, description **917 → 622 chars**. Language firmness was then matched to
45
+ the task: firm only at the genuine cliffs (endorsement gate, singleton refusal,
46
+ confirm-before-remove/persist, hard-constraint reject-at-pick,
47
+ re-fetch-before-buy, follow-the-tool's-recovery), plain heuristics everywhere
48
+ else. The **whole 10-file bundle** was rewritten leaner (**15,644 → 9,101
49
+ words, −41%**; `shop_loop` −56%): killed tool↔skill and cross-file duplication
50
+ and dropped the `sil_search` param-catalog table (the tool description owns it —
51
+ the mapping now points there). Skill prose + tests only; the 8-tool floor and
52
+ `contracts.tools` are unchanged. (#50, #51)
53
+
54
+ ### Fixed
55
+
56
+ - **The `sil-shopping` skill now actually loads into the created shopper agent.**
57
+ `create-shopper.mjs` attached the **plugin id** (`["sil"]`) at
58
+ `agents.list[i].skills`, but a skill attaches by its **published name** — the
59
+ skill-dir basename `sil-shopping` (`basename(openclaw.plugin.json#skills[0])`,
60
+ == the `SKILL.md` frontmatter `name`) — so the host looked up a skill named
61
+ `sil`, found none, and the shopper ran with **no skill driving its `sil_*`
62
+ tools**. The `["sil"]` literal is deleted; the attach value is now
63
+ **single-sourced from the shipped manifest** and resolved as a fail-closed
64
+ precondition (a blank/absent `skills[0]` attaches nothing, never `[""]`). A
65
+ static name-agreement drift guard (`basename(skills[0]) == SKILL.md name !=
66
+ plugin id`) keeps the plugin-id/skill-name conflation from silently returning.
67
+ (#47)
68
+
13
69
  ## [0.3.8] - 2026-07-06
14
70
 
15
71
  ### Added
@@ -0,0 +1,10 @@
1
+ export function resolveBindChannel(sources) {
2
+ return normalizeChannel(sources.specChannel) ?? normalizeChannel(sources.envChannel);
3
+ }
4
+ /** A present, non-blank string trimmed of surrounding whitespace, else `null`. */
5
+ function normalizeChannel(value) {
6
+ if (typeof value !== "string")
7
+ return null;
8
+ const trimmed = value.trim();
9
+ return trimmed.length > 0 ? trimmed : null;
10
+ }
@@ -2,7 +2,7 @@
2
2
  "id": "sil",
3
3
  "name": "sil",
4
4
  "description": "Turn your OpenClaw into an expert shopping agent.",
5
- "version": "0.3.8",
5
+ "version": "0.3.9",
6
6
  "skills": ["./sil-shopping"],
7
7
  "activation": {
8
8
  "onCapabilities": ["tool"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sil-openclaw",
3
- "version": "0.3.8",
3
+ "version": "0.3.9",
4
4
  "description": "Turn your OpenClaw into an expert shopping agent.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -13,10 +13,11 @@
13
13
  * consent gate; this bin executes an already-assembled, already-endorsed spec
14
14
  * non-interactively. It never prompts, never re-runs the interview.
15
15
  *
16
- * Input — ONE JSON object `{ agentId, name, workspace, persona, userSpec }`, read
17
- * from stdin (primary) or `--spec <path>` (fallback). Passing multiline
16
+ * Input — ONE JSON object `{ agentId, name, workspace, persona, userSpec, channel? }`,
17
+ * read from stdin (primary) or `--spec <path>` (fallback). Passing multiline
18
18
  * persona/userSpec as JSON dodges shell-arg escaping. Unparseable/blank input →
19
- * `invalid_request`, nothing attempted.
19
+ * `invalid_request`, nothing attempted. `channel` is OPTIONAL — the current-channel
20
+ * override for the step-10 bind; absent/blank is fail-open, never invalid_request.
20
21
  *
21
22
  * Choreography (validate-first, then atomic, fail-closed):
22
23
  * 1. validate the spec — bad/blank field ⇒ invalid_request, nothing attempted
@@ -32,8 +33,13 @@
32
33
  * 8. attach the sil skill + enable the sil plugin (openclaw config set --strict-json)
33
34
  * 9. sil-openclaw-allowlist — REUSED whole; additive/idempotent/atomic three-surface
34
35
  * trust merge (plugins.allow + tools.alsoAllow + plugins.entries.sil)
35
- * 10. openclaw config validate — success keys off `.valid`, never an `ok` field
36
- * 11. one { status, … } JSON result; exit 0 ONLY on `created`.
36
+ * 10. bind the current channel — FAIL-OPEN convenience, NOT fail-closed: resolve the channel
37
+ * (spec.channel > OPENCLAW_MCP_MESSAGE_CHANNEL), bind + VERIFY
38
+ * from the JSON verdict (never the exit code), keep a verified
39
+ * route, revert an unverifiable one; an undetermined/unverifiable
40
+ * channel degrades to a manual-bind hint — it NEVER fails creation
41
+ * 11. openclaw config validate — success keys off `.valid`, never an `ok` field
42
+ * 12. one { status, … } JSON result; exit 0 ONLY on `created`.
37
43
  *
38
44
  * Teardown on ANY failure after step 5 = whole-file snapshot-restore of
39
45
  * openclaw.json (reverses the agents.list entry + skill + plugin + trust in ONE
@@ -45,6 +51,12 @@
45
51
  * LOUDER outcome (`teardown_failed`) that names the residue — never a green-washed
46
52
  * `persistence_failed`.
47
53
  *
54
+ * The step-10 channel bind is the ONE step that never routes into teardown: it is
55
+ * fail-open by design (a convenience, not a precondition), so it self-reverts a bad
56
+ * bind in place and continues. Because a VERIFIED route lives in openclaw.json, the
57
+ * step-4 snapshot restore reverses it FOR FREE if any earlier-or-later step then
58
+ * fails — no `agents unbind`, no bind-specific teardown code.
59
+ *
48
60
  * Outcome taxonomy (four terminal, + the louder teardown_failed), in sil's
49
61
  * `snake_case_marker` NDJSON style (no api.logger outside the gateway). No PII, no
50
62
  * secrets — the persona/userSpec text is NEVER logged:
@@ -63,7 +75,7 @@
63
75
  import { execFileSync } from "node:child_process";
64
76
  import { existsSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
65
77
  import { homedir } from "node:os";
66
- import { dirname, join, resolve } from "node:path";
78
+ import { basename, dirname, join, resolve } from "node:path";
67
79
  import { randomBytes } from "node:crypto";
68
80
  import { fileURLToPath } from "node:url";
69
81
 
@@ -72,10 +84,14 @@ import {
72
84
  readAgentProfile,
73
85
  getShopperArtefactDir,
74
86
  } from "../dist/lib/profile-store.js";
87
+ import { resolveBindChannel } from "../dist/lib/bind-channel.js";
75
88
 
76
89
  const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..");
77
90
  /** The sibling operator bin that performs the additive, self-validating trust merge. */
78
91
  const ALLOWLIST_BIN = resolve(ROOT, "scripts", "allowlist-openclaw.mjs");
92
+ /** The shipped plugin manifest — the single source of truth for sil's facts (id,
93
+ * skill name), read the same way `scripts/allowlist-openclaw.mjs` reads it. */
94
+ const MANIFEST_PATH = resolve(ROOT, "openclaw.plugin.json");
79
95
 
80
96
  /** A shopper id path-segment shape — lower-kebab, never `main` (host-reserved). */
81
97
  const AGENT_ID_RE = /^[a-z0-9][a-z0-9-]*$/;
@@ -161,12 +177,15 @@ function readSpecRaw() {
161
177
 
162
178
  /** Validate the endorsed spec — deterministic field order (agentId → name →
163
179
  * workspace → persona → userSpec). Returns `{ field, message }` on the FIRST bad
164
- * field, or null when the whole spec is good. Writes/attempts nothing. */
180
+ * field, or null when the whole spec is good. Writes/attempts nothing. `channel`
181
+ * is deliberately NOT validated: it is an optional fail-open convenience, so an
182
+ * absent/blank/malformed channel is never invalid_request — it folds to `null` in
183
+ * `resolveBindChannel` and degrades to a manual-bind hint at step 10. */
165
184
  function validateSpec(spec) {
166
185
  if (typeof spec !== "object" || spec === null || Array.isArray(spec)) {
167
186
  return {
168
187
  field: "spec",
169
- message: "spec must be a JSON object with { agentId, name, workspace, persona, userSpec }.",
188
+ message: "spec must be a JSON object with { agentId, name, workspace, persona, userSpec, channel? }.",
170
189
  };
171
190
  }
172
191
  if (!nonBlank(spec.agentId)) {
@@ -225,6 +244,32 @@ function readConfig(configPath) {
225
244
  }
226
245
  }
227
246
 
247
+ /** Resolve the sil SKILL's published name to attach at `agents.list[i].skills`,
248
+ * single-sourced from the shipped manifest (mirrors `allowlist-openclaw.mjs`'s
249
+ * `readSilFacts`). A skill attaches by its PUBLISHED name = the skill-dir basename
250
+ * = `basename(openclaw.plugin.json#skills[0])` (`sil-shopping`) — NOT the plugin id
251
+ * (`sil`), which is the tools/trust key. The per-agent attach is the ONLY skill
252
+ * surface (no global skill allow-list), so the plugin id here loads no skill at
253
+ * all. Fail-closed: an unreadable manifest or a blank/absent `skills[0]` returns
254
+ * `{ error }` so the create errors rather than attaching `[""]`. */
255
+ function readSkillAttachName() {
256
+ let manifest;
257
+ try {
258
+ manifest = JSON.parse(readFileSync(MANIFEST_PATH, "utf8"));
259
+ } catch (err) {
260
+ return { error: "the shipped manifest " + MANIFEST_PATH + " is not readable/parseable JSON: " + errCause(err) };
261
+ }
262
+ const ref = Array.isArray(manifest.skills) ? manifest.skills[0] : undefined;
263
+ if (!nonBlank(ref)) {
264
+ return { error: "the shipped manifest " + MANIFEST_PATH + " declares no skills[0] — cannot resolve the sil skill name to attach" };
265
+ }
266
+ const name = basename(ref);
267
+ if (!nonBlank(name)) {
268
+ return { error: "the shipped manifest skills[0] " + JSON.stringify(ref) + " has no usable basename" };
269
+ }
270
+ return { name };
271
+ }
272
+
228
273
  /** The agentId path-segment ids already registered in the host config's
229
274
  * `agents.list` — the authoritative, shim-independent clash source. */
230
275
  function existingAgentIds(config) {
@@ -256,6 +301,64 @@ function webCapabilityWarnings(config) {
256
301
  ];
257
302
  }
258
303
 
304
+ /** True iff `openclaw config validate --json` reported `{valid:true}`. The host
305
+ * writes its verdict to stdout even on a non-zero exit, so read stdout, never the
306
+ * exit code (fail closed if it is not JSON). */
307
+ function configValidates(stdout) {
308
+ try {
309
+ const verdict = JSON.parse(stdout);
310
+ return verdict !== null && verdict.valid === true;
311
+ } catch {
312
+ return false;
313
+ }
314
+ }
315
+
316
+ /** True iff `openclaw agents bind --json` reported the channel APPLIED — landed in
317
+ * `added` or `updated`, with an EMPTY `conflicts`. `agents bind` exits 0 even on a
318
+ * conflict or an empty `--bind`, so the JSON verdict — never the exit code — is the
319
+ * source of truth (the same discipline the bin applies to `config validate.valid`). */
320
+ function bindApplied(stdout) {
321
+ let v;
322
+ try {
323
+ v = JSON.parse(stdout);
324
+ } catch {
325
+ return false;
326
+ }
327
+ if (v === null || typeof v !== "object") return false;
328
+ const added = Array.isArray(v.added) ? v.added : [];
329
+ const updated = Array.isArray(v.updated) ? v.updated : [];
330
+ const conflicts = Array.isArray(v.conflicts) ? v.conflicts : [];
331
+ return (added.length > 0 || updated.length > 0) && conflicts.length === 0;
332
+ }
333
+
334
+ /** True iff the `openclaw agents bindings --json` read-back (an ARRAY of
335
+ * `{agentId, match:{channel}}`) actually shows the route `<channel> → <agentId>`.
336
+ * This is the honesty rail: a bind is only "verified" once the read-back proves the
337
+ * write stuck — issuing the write is not the same as the next message reaching it. */
338
+ function bindingPresent(stdout, agentId, channel) {
339
+ let v;
340
+ try {
341
+ v = JSON.parse(stdout);
342
+ } catch {
343
+ return false;
344
+ }
345
+ if (!Array.isArray(v)) return false;
346
+ return v.some((b) => b?.agentId === agentId && b?.match?.channel === channel);
347
+ }
348
+
349
+ /** The fail-open manual-bind hint appended to `created` warnings when the channel
350
+ * could not be auto-routed (undetermined) or the bind could not be verified. It
351
+ * states the shopper WAS created, names the one-command manual bind, and never
352
+ * implies a broken create — a convenience that didn't fire, not an error. */
353
+ function manualBindHint(agentId, channel) {
354
+ const target = channel ? `the "${channel}" channel` : "the current channel";
355
+ return (
356
+ `the shopper "${agentId}" was created but ${target} was not auto-routed to it. `
357
+ + `To route it manually, run: openclaw agents bind --agent ${agentId} --bind <channel> `
358
+ + `(or switch in-chat with /agent ${agentId}). The shopper is fully created and ready.`
359
+ );
360
+ }
361
+
259
362
  /**
260
363
  * Whole-file snapshot-restore teardown. Reverses everything this run created and
261
364
  * returns the residue it could NOT revert (empty ⇒ clean, host at exact pre-run
@@ -334,7 +437,7 @@ function main() {
334
437
  if (bad) {
335
438
  emitFailure("invalid_request", { field: bad.field, cause: bad.message });
336
439
  }
337
- const { agentId, name, workspace, persona, userSpec } = spec;
440
+ const { agentId, name, workspace, persona, userSpec, channel } = spec;
338
441
 
339
442
  // --- 2. Resolve the host config (precondition — nothing written yet) ---
340
443
  const configPath = resolveConfigPath();
@@ -354,6 +457,15 @@ function main() {
354
457
  });
355
458
  }
356
459
 
460
+ // --- 2b. Resolve the sil skill's published name to attach (shipped manifest is the
461
+ // single source of truth) — a packaging defect fails closed BEFORE any host
462
+ // write, so nothing is attempted. Reused at step 8. ---
463
+ const skill = readSkillAttachName();
464
+ if (skill.error) {
465
+ emitFailure("persistence_failed", { path: MANIFEST_PATH, cause: skill.error });
466
+ }
467
+ const skillAttachName = skill.name;
468
+
357
469
  // --- 3. Singleton + agentId pre-flight (nothing written; inconclusive → fail closed) ---
358
470
  // The sil artefact store is the source of truth for "a shopper exists".
359
471
  const overview = readAgentProfile();
@@ -455,8 +567,11 @@ function main() {
455
567
  if (idx < 0) {
456
568
  failAndTeardown(configPath, "the created agent " + JSON.stringify(agentId) + " is not in agents.list after `openclaw agents add`");
457
569
  }
570
+ // Attach the skill by its PUBLISHED name (`sil-shopping`), NOT the plugin id
571
+ // (`sil`) — a skill and the plugin are two distinct host keys, and the per-agent
572
+ // attach is the only skill surface, so the plugin id here would load no skill.
458
573
  const skillRes = runOpenclaw(
459
- ["config", "set", `agents.list[${idx}].skills`, '["sil"]', "--strict-json"],
574
+ ["config", "set", `agents.list[${idx}].skills`, JSON.stringify([skillAttachName]), "--strict-json"],
460
575
  configPath,
461
576
  );
462
577
  if (!skillRes.ok) {
@@ -490,7 +605,54 @@ function main() {
490
605
  failAndTeardown(configPath, "the sil-openclaw-allowlist admission helper failed: " + allowlistCause);
491
606
  }
492
607
 
493
- // --- 10. Validate with the host's OWN check — success keys off `.valid` ---
608
+ // --- 10. Bind the current channel to the new shopper (FAIL-OPEN convenience) ---
609
+ // Route the channel the user is talking on to the new shopper by default, so their
610
+ // next message reaches it with no manual bind. This step NEVER fails creation: an
611
+ // undetermined channel, a conflict (already owned by another agent — no auto-steal),
612
+ // or an unverifiable bind all degrade to a manual-bind hint. The bind lands in
613
+ // openclaw.json `bindings[]`, so a VERIFIED route is reversed for free by the
614
+ // step-4 snapshot if a later step tears the whole create down.
615
+ const bindWarnings = [];
616
+ // The channel the route was VERIFIED-bound to (null ⇒ nothing bound). It rides in
617
+ // `created` as the honesty rail: a bound channel is named ONLY when the read-back +
618
+ // config validate confirm it — issuing the write is never enough.
619
+ let boundChannel = null;
620
+ const channelToBind = resolveBindChannel({
621
+ specChannel: channel,
622
+ envChannel: process.env["OPENCLAW_MCP_MESSAGE_CHANNEL"],
623
+ });
624
+ if (channelToBind === null) {
625
+ bindWarnings.push(manualBindHint(agentId, null));
626
+ } else {
627
+ // Snapshot BEFORE the bind so an unverifiable write reverts to a valid config —
628
+ // never falling through to the fail-closed step-11 validate (which would tear
629
+ // down a fully-created shopper over a convenience shortfall).
630
+ const bindSnapshot = readFileSync(configPath, "utf8");
631
+ const bindRes = runOpenclaw(["agents", "bind", "--agent", agentId, "--bind", channelToBind, "--json"], configPath);
632
+ const readBack = runOpenclaw(["agents", "bindings", "--agent", agentId, "--json"], configPath);
633
+ const bindValidateRes = runOpenclaw(["config", "validate", "--json"], configPath);
634
+ const verified =
635
+ bindRes.ok
636
+ && bindApplied(bindRes.stdout)
637
+ && readBack.ok
638
+ && bindingPresent(readBack.stdout, agentId, channelToBind)
639
+ && configValidates(bindValidateRes.stdout);
640
+ if (verified) {
641
+ boundChannel = channelToBind;
642
+ } else {
643
+ // Revert JUST the route (config back to its pre-bind valid state) and degrade
644
+ // to the manual-bind hint. A failed revert is still fail-open: a well-formed
645
+ // bind is validation-safe, so step 11 certifies the config either way.
646
+ try {
647
+ atomicWrite(configPath, bindSnapshot, mode);
648
+ } catch {
649
+ // best-effort — never escalate a convenience revert into a torn-down create
650
+ }
651
+ bindWarnings.push(manualBindHint(agentId, channelToBind));
652
+ }
653
+ }
654
+
655
+ // --- 11. Validate with the host's OWN check — success keys off `.valid` ---
494
656
  // The shim/host writes its structured verdict to stdout even on a non-zero exit,
495
657
  // so read stdout regardless of the exit code (fail closed if it is not JSON).
496
658
  const validateRes = runOpenclaw(["config", "validate", "--json"], configPath);
@@ -508,9 +670,9 @@ function main() {
508
670
  failAndTeardown(configPath, issues ? cause + " — issues: " + issues : cause);
509
671
  }
510
672
 
511
- // --- 11. Declare created — carry the identity so the agent can open the shopper ---
512
- const warnings = webCapabilityWarnings(readConfig(configPath) ?? postAddConfig);
513
- emitCreated({ name, agentId, workspace, warnings });
673
+ // --- 12. Declare created — carry the identity + the bound channel (honesty rail) ---
674
+ const warnings = [...webCapabilityWarnings(readConfig(configPath) ?? postAddConfig), ...bindWarnings];
675
+ emitCreated({ name, agentId, workspace, boundChannel, warnings });
514
676
  }
515
677
 
516
678
  main();
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: sil-shopping
3
- description: This skill should be used whenever the user wants to shop on sil or set up their sil shopper: register or sign in to sil, check who they are, search the sil catalog for purchasable products, or look up specific products by id — and for the full single-shopper lifecycle: "set up an agent that shops for me" / "create my shopper" (a short two-touchpoint onboarding, then create ONE shopper), see what their shopper knows or which domains (niches) it has learned, view or forget a domain, refine the shopper or one domain — or, as the shopper, run a profile-driven Spec-Driven Shopping query on any niche (reusing a learned domain or minting one on the fly) and remember a fact or buying taste it surfaces. Route here for any shopping, identity, or shopper-setup intent on sil. Drives sil_register, sil_whoami, sil_search, sil_product_get, sil_profile_materialize, sil_profile_get, sil_profile_remove, and sil_remember.
3
+ description: 'Use for any sil shopping, identity, or shopper-setup intent: register or sign in, check the account, search the sil catalog for purchasable products, or look up products by id — plus the single-shopper lifecycle: create the shopper (a short two-touchpoint onboarding), see what it knows or which domains (niches) it has learned, view or forget a domain, refine it — or, as the shopper, run a Spec-Driven Shopping query on any niche and remember a fact or buying taste it surfaces. Drives sil_register, sil_whoami, sil_search, sil_product_get, sil_profile_materialize, sil_profile_get, sil_profile_remove, and sil_remember.'
4
4
  metadata:
5
5
  openclaw:
6
6
  emoji: "\U0001F6D2"
@@ -8,68 +8,111 @@ metadata:
8
8
 
9
9
  # sil-shopping
10
10
 
11
- Drive the sil plugin's tools on the user's behalf: register them on sil, read their identity, help them find purchasable products in the sil catalog — and, when asked, set up their **shopper** (one sil-wired agent that shops every niche), then see what it knows, view or forget a domain, or refine it. Read user intent, route to the matching tool (loading its reference on demand), call it, and report what came back.
11
+ Drive the sil plugin's tools on the user's behalf: register them, read their
12
+ identity, help them find purchasable products — and, when asked, set up their
13
+ **shopper** (one sil-wired agent that shops every niche), then see what it knows,
14
+ view or forget a domain, or refine it. Read intent, route to the matching tool
15
+ (loading its reference on demand), call it, and report what came back.
12
16
 
13
- ## Always-on behavioural contract
17
+ ## Always-on contract
14
18
 
15
- These three principles hold on every path, before any reference is loaded:
16
-
17
- - **Act, don't narrate.** When intent maps to a tool, call it. Don't re-confirm what was already stated.
18
- - **Fail visibly, recover correctly.** Every tool returns a `status`. On a non-`ok` status, say what happened and follow the tool's own `recovery` hint — never improvise a different one.
19
- - **Relay prices as point-in-time.** A product's price, availability, and `checkout_url` are a snapshot, not a guarantee. Before the user buys, re-fetch with `sil_product_get` rather than trusting an earlier `sil_search` result.
19
+ - **Act, don't narrate.** When intent maps to a tool, call it — don't re-confirm
20
+ what was already stated.
21
+ - **Follow the tool's own `recovery`.** Every tool returns a `status`; on a
22
+ non-`ok` one, say what happened and follow that tool's `recovery` hint, never
23
+ improvise another. The taxonomy lives in
24
+ [`references/catalog_tools_reference.md`](references/catalog_tools_reference.md).
25
+ - **Prices are point-in-time.** Before the user buys, re-fetch the item with
26
+ `sil_product_get` rather than trusting an earlier `sil_search` snapshot.
20
27
 
21
28
  ## Session start
22
29
 
23
- Confirm the `sil_*` tools are exposed. If they are missing from the available tool list, the host runtime is filtering them out because sil is not admitted at the host allow surfaces — run the shipped admission helper `sil-openclaw-allowlist` (it additively admits sil at `plugins.allow` + `tools.alsoAllow`, leaving any other trusted plugin untouched), then reopen the session so the tools load. Most flows need an identity: if the user has not registered this session, the catalog tools return an unregistered status whose `recovery` points at `sil_register` (the [catalog tools reference](references/catalog_tools_reference.md) has the full taxonomy) — so calling a catalog tool first lets that outcome route, or run `sil_register` up front when the user's intent clearly requires it.
24
-
25
- ## After register — offer to set up the shopper (once, only when there's none)
26
-
27
- `sil_register` returns `already_registered` with `next_step: "offer_shopper"` on a confirmed registration (a fresh sign-in this session, or a returning session that was already signed in). That hint is a routing breadcrumb, not a decision — act on it by first running a no-arg `sil_profile_get` to read shopper state, then branch:
28
-
29
- - **Empty store (no shopper yet):** introduce the shopper in one short beat and offer to set it up. Name the value in its own terms — it shops each niche in depth, reuses the sizes and hard limits it already knows so nothing is re-asked, and explains why each pick fits — a standing buyer's advisor, not a one-off search. Only on a yes, load [`references/brainstorm_interview.md`](references/brainstorm_interview.md) (a two-touchpoint onboarding, never a form). Take no for an answer: bare `sil_search` stays a first-class path, so don't re-offer in the same turn.
30
- - **A shopper already exists:** skip this beat entirely. The shopper is a singleton — never offer a second one.
30
+ Confirm the `sil_*` tools are exposed. If they are missing, the host is filtering
31
+ them — run the shipped admission helper `sil-openclaw-allowlist` (it additively
32
+ admits sil at `plugins.allow` + `tools.alsoAllow`), then reopen the session. Most
33
+ flows need an identity: calling a catalog tool first lets an unregistered outcome
34
+ route to `sil_register`, or run `sil_register` up front when intent requires it.
31
35
 
32
- ## After a bare search — name what a shopper would add (recurring, by design)
36
+ ## Routing — read the stage, then match intent to a tool
33
37
 
34
- When a plain `sil_search` completes with status `ok` in a profile-less session, present the results best-first exactly as they came back, then append **one** short trailing line — a post-result tip with a soft CTA — naming what a shopper would add on top. It is never a pre-search question and never a re-rank: bare search stays a legitimate quick lookup, and these are the same results a shopper would start from.
38
+ **Read the stage from state — never guess it.** Two cheap reads settle it:
39
+ `sil_whoami` (is a sil identity **registered** yet?) and the no-arg
40
+ `sil_profile_get` overview (its **`name` field** is the whole discriminator —
41
+ present only once a shopper exists).
35
42
 
36
- Name one or two of the three levers a bare search leaves on the table, and rotate which you lead with so the recurring line stays fresh:
43
+ - **No identity** ⇒ guide the user to register.
44
+ - **`name` absent ⇒ profile-less stage** — bare shopping is a first-class quick
45
+ lookup; the setup path is offered alongside it.
46
+ - **`name` present ⇒ shopper stage** — shop through what you know about the person.
37
47
 
38
- - **niche depth** — a shopper weighs these against how the niche actually buys, instead of just listing them;
39
- - **memory** — it keeps your sizes and hard limits on file, so no search re-asks them;
40
- - **the why** — it explains which pick fits you and why, instead of a flat ranked list.
48
+ [`references/setup_onboarding.md`](references/setup_onboarding.md) owns the setup
49
+ script — the staged ladder, the after-register offer, the per-search pitch. Load
50
+ it while setup is incomplete; it sheds once a shopper exists.
41
51
 
42
- This line recurs on **every** completed profile-less search: there is no fire-once or seen-it gate, and no cooldown — the recurrence is the point, and brevity plus lever rotation are all that keep it from nagging. Exactly two things suppress it, and only these two: a shopper already exists (that session is the shopper's — drop the line), or the search did not complete `ok` (a non-`ok` status carries its own recovery, so follow that and add no tip).
52
+ ### Intent → tool (load the reference on demand)
43
53
 
44
- ## Routing — match intent to a tool, load its reference on demand
45
-
46
- | Intent | Tool | Reference to load |
54
+ | Intent | Tool | Reference |
47
55
  |---|---|---|
48
- | "sign me up" / "log me in to sil" / "register" | `sil_register` | [`references/catalog_tools_reference.md`](references/catalog_tools_reference.md) |
49
- | "who am I?" / "what's on my account" / show my saved name + addresses | `sil_whoami` | [`references/catalog_tools_reference.md`](references/catalog_tools_reference.md) |
50
- | "find X" / "search for X" / browse a category or price range | `sil_search` | [`references/catalog_tools_reference.md`](references/catalog_tools_reference.md) |
51
- | "look up these items" / re-check ids from a prior result, a saved list, or a deep link | `sil_product_get` | [`references/catalog_tools_reference.md`](references/catalog_tools_reference.md) |
52
- | "set up an agent that shops for me" / "create my shopper" | (onboarding, then the engine) | see the two-step gate below |
53
- | "what does my shopper know?" / "which domains has it learned?" | `sil_profile_get` (no `domainSlug` — the shopper overview, which absorbs the old listing) | [`references/manage_domains.md`](references/manage_domains.md) |
54
- | "show me the shopper / the &lt;niche&gt; domain" | `sil_profile_get` (`domainSlug` for one domain) | [`references/manage_domains.md`](references/manage_domains.md) |
55
- | "forget / remove the &lt;niche&gt; domain" | `sil_profile_remove` (per-domain; whole-shopper teardown is host-CLI-first — see the reference) | [`references/manage_domains.md`](references/manage_domains.md) |
56
- | (as the shopper) a shopping intent — "find me something for X" on any niche | `sil_search` → `sil_product_get` (driven by the loaded profile, reusing or minting the domain) | [`references/shop_loop.md`](references/shop_loop.md) |
57
- | "remember this" — a fact or buying taste the shopper surfaced this query | `sil_remember` | [`references/shop_loop.md`](references/shop_loop.md) |
58
- | "refine / sharpen my shopper" / "the cycling domain keeps surfacing the wrong stuff — fix it" | (load → propose → confirm → persist — see the reference) | [`references/refine_shopper.md`](references/refine_shopper.md) |
59
-
60
- [`references/catalog_tools_reference.md`](references/catalog_tools_reference.md) holds the per-tool behaviour for the four core tools and the shared status taxonomy. Basic shopping needs only that one reference.
61
-
62
- When the session is running **as the shopper** (a loaded profile under `$SIL_DATA_DIR/shopper/` — the shared `user_spec` plus a slug-keyed `domains` map) and the user states a shopping intent, follow [`references/shop_loop.md`](references/shop_loop.md) — the profile-driven, **Spec-Driven Shopping (SDS)** shop-time loop that classifies the niche, **reuses a learned domain or mints one on the fly**, web-refreshes that domain's spec, decomposes the request along its intent spec, and learns every query — persisting each surfaced fact (→ the shared user spec) or taste (→ the active domain) with a single lightweight `sil_remember` append. **As the shopper, the domain-exists check is non-skippable on every query: classify the niche and reuse a learned domain or mint one first, before any `sil_search` — it is the shop loop's first beat, never skipped.** The one shopper shops every niche; a plain, profile-less session keeps shopping via the "find X" → `sil_search` row above, unchanged — Lane 1 stays bare, with no domain check and no pre-search questions.
63
-
64
- [`references/manage_domains.md`](references/manage_domains.md) holds the list / view / forget flow over the shopper's domains — including the **two remove granularities** (forget one domain vs decommission the whole shopper, host-CLI-first) and the confirm-before-remove gate. Load it the moment the user wants to see what the shopper knows or forget a niche.
65
-
66
- [`references/refine_shopper.md`](references/refine_shopper.md) holds the refinement loop — sharpening the shopper (the shared user spec or the persona) or **one domain** from observed sessions, with a confirm-before-persist gate (nothing changes silently). Load it when the user wants to refine, sharpen, or amend their shopper or a niche.
67
-
68
- ### Setting up your shopper — the endorsement-gated two-step
69
-
70
- When the user asks to set up / create their shopper (the singleton agent that shops every niche):
71
-
72
- 1. **Onboard first.** Read and run [`references/brainstorm_interview.md`](references/brainstorm_interview.md) — the short, two-touchpoint onboarding (persona + a shared user-spec seed) that converges a draft *with* the user. It researches **no** niche — the shopper is a generalist that mints domains lazily on first shop. While running it, load [`references/search_param_mapping.md`](references/search_param_mapping.md) only if you need the shop-time answer→`sil_search`-param mapping (it is a shop-time reference, not an onboarding one).
73
- 2. **Engine only after explicit endorsement.** Only after the user explicitly endorses the assembled draft, read and follow [`references/agent_creation_engine.md`](references/agent_creation_engine.md) — the ordered engine that persists the one sil-wired shopper. Running ANY engine step before that explicit endorsement is forbidden (the onboarding reference owns the endorsement gate). The shopper is a **singleton**: a second create attempt is refused ("a shopper already exists").
74
-
75
- Want a concrete walkthrough? [`examples/multi_domain_shopper_walkthrough.md`](examples/multi_domain_shopper_walkthrough.md) is an end-to-end worked example: create one shopper → shop two unrelated niches in one session (the second minted on the fly) → a shared fact reused across both → per-domain taste that does not leak.
56
+ | "sign me up" / "log me in" / "register" | `sil_register` | [`catalog_tools_reference.md`](references/catalog_tools_reference.md) |
57
+ | "who am I?" / show my saved name + addresses | `sil_whoami` | [`catalog_tools_reference.md`](references/catalog_tools_reference.md) |
58
+ | "find X" / "search for X" / browse a category or price range | `sil_search` | [`catalog_tools_reference.md`](references/catalog_tools_reference.md) |
59
+ | "look up these items" / re-check ids from a prior result | `sil_product_get` | [`catalog_tools_reference.md`](references/catalog_tools_reference.md) |
60
+ | "set up an agent that shops for me" / "create my shopper" | (onboarding, then the engine) | the two-step below |
61
+ | "what does my shopper know?" / "which domains has it learned?" | `sil_profile_get` (no `domainSlug`) | [`manage_domains.md`](references/manage_domains.md) |
62
+ | "show me the &lt;niche&gt; domain" | `sil_profile_get` (`domainSlug`) | [`manage_domains.md`](references/manage_domains.md) |
63
+ | "forget the &lt;niche&gt; domain" | `sil_profile_remove` | [`manage_domains.md`](references/manage_domains.md) |
64
+ | (as the shopper) a shopping intent on any niche | `sil_search` → `sil_product_get` | [`shop_loop.md`](references/shop_loop.md) |
65
+ | "remember this" — a fact or taste the shopper surfaced | `sil_remember` | [`shop_loop.md`](references/shop_loop.md) |
66
+ | "refine / sharpen my shopper" / fix a niche | (load → propose → confirm → persist) | [`refine_shopper.md`](references/refine_shopper.md) |
67
+
68
+ [`references/catalog_tools_reference.md`](references/catalog_tools_reference.md)
69
+ holds the per-tool behaviour + status taxonomy — basic shopping needs only that.
70
+ The answer→`sil_search`-param mapping is
71
+ [`references/search_param_mapping.md`](references/search_param_mapping.md); a full
72
+ run is
73
+ [`examples/multi_domain_shopper_walkthrough.md`](examples/multi_domain_shopper_walkthrough.md).
74
+
75
+ **Setting up the shopper — the endorsement-gated two-step.** The shopper is a
76
+ singleton (refused once one exists). (1) **Onboard first:** run
77
+ [`references/brainstorm_interview.md`](references/brainstorm_interview.md), the
78
+ two-touchpoint onboarding. (2) **Only after** the user explicitly **endorses** the
79
+ assembled draft, run
80
+ [`references/agent_creation_engine.md`](references/agent_creation_engine.md), the
81
+ engine that persists the one sil-wired shopper. No engine step runs before that
82
+ endorsement.
83
+
84
+ ### Profile-less stage — the bare lane stays bare
85
+
86
+ **`name` absent.** A shopping intent takes the "find X" → `sil_search` row above
87
+ **unchanged** — no domain check, no mint, no pre-search question. Bare search is a
88
+ legitimate quick lookup; the only nudge is the profile-less per-search pitch
89
+ ([`references/setup_onboarding.md`](references/setup_onboarding.md)).
90
+
91
+ ### Shopper stage — shop through what you know
92
+
93
+ **`name` present.** As the shopper, shop through what you know about the person:
94
+ classify the query's niche and **reuse a learned domain or mint one before
95
+ searching** — the shop loop's first beat — then follow
96
+ [`references/shop_loop.md`](references/shop_loop.md), the profile-driven
97
+ **Spec-Driven Shopping** loop that web-refreshes the domain, decomposes the
98
+ request, and persists each surfaced fact or taste with a single `sil_remember`.
99
+
100
+ - **An empty `domains` map means no niche yet:** the first shopping intent **mints
101
+ the domain before searching**, **announced** with the inferred niche stated so
102
+ the user can correct it — never a silent mint.
103
+
104
+ This shapes the shopper's **reasoning, not the user's inbox**: a reused domain plus
105
+ a fully-resolved query **passes straight through, asking nothing**. It scopes to
106
+ `sil_search`-driven product discovery only — identity (`sil_register` /
107
+ `sil_whoami`), a direct `sil_product_get` id re-check, and shopper-management
108
+ intents (view / forget a domain) route normally, **ungated**.
109
+
110
+ **Per-query self-check (prose, not a tool).** As you shop, keep track of which
111
+ beat you're on and that you resolved the domain before searching — an in-context
112
+ guardrail, not a new tool, table, or telemetry surface.
113
+
114
+ Management + refinement load on demand:
115
+ [`references/manage_domains.md`](references/manage_domains.md) (view/forget,
116
+ confirm-before-remove) and
117
+ [`references/refine_shopper.md`](references/refine_shopper.md) (sharpen from observed
118
+ sessions, confirm-before-persist).