sil-openclaw 0.3.9 → 0.4.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.
- package/CHANGELOG.md +124 -0
- package/dist/lib/profile-store.js +578 -581
- package/dist/lib/sil-client.js +282 -33
- package/dist/tools/catalog.js +475 -7
- package/dist/tools/profile.js +229 -371
- package/openclaw.plugin.json +6 -4
- package/package.json +1 -1
- package/scripts/create-shopper.mjs +71 -40
- package/sil-shopping/SKILL.md +65 -89
- package/sil-shopping/examples/multi_domain_shopper_walkthrough.md +34 -103
- package/sil-shopping/references/agent_creation_engine.md +177 -118
- package/sil-shopping/references/fill_and_feedback.md +86 -0
- package/sil-shopping/references/method_and_prds.md +111 -0
- package/sil-shopping/references/setup_onboarding.md +48 -52
- package/sil-shopping/references/shop_loop.md +109 -160
- package/sil-shopping/references/brainstorm_interview.md +0 -97
- package/sil-shopping/references/catalog_tools_reference.md +0 -44
- package/sil-shopping/references/manage_domains.md +0 -77
- package/sil-shopping/references/refine_shopper.md +0 -97
- package/sil-shopping/references/search_param_mapping.md +0 -79
package/openclaw.plugin.json
CHANGED
|
@@ -2,20 +2,22 @@
|
|
|
2
2
|
"id": "sil",
|
|
3
3
|
"name": "sil",
|
|
4
4
|
"description": "Turn your OpenClaw into an expert shopping agent.",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.4.1",
|
|
6
6
|
"skills": ["./sil-shopping"],
|
|
7
7
|
"activation": {
|
|
8
8
|
"onCapabilities": ["tool"]
|
|
9
9
|
},
|
|
10
10
|
"contracts": {
|
|
11
11
|
"tools": [
|
|
12
|
+
"sil_learn",
|
|
12
13
|
"sil_product_get",
|
|
13
14
|
"sil_profile_get",
|
|
14
15
|
"sil_profile_materialize",
|
|
15
16
|
"sil_profile_remove",
|
|
17
|
+
"sil_profile_search",
|
|
16
18
|
"sil_register",
|
|
17
|
-
"sil_remember",
|
|
18
19
|
"sil_search",
|
|
20
|
+
"sil_specs",
|
|
19
21
|
"sil_whoami"
|
|
20
22
|
]
|
|
21
23
|
},
|
|
@@ -51,7 +53,7 @@
|
|
|
51
53
|
},
|
|
52
54
|
"security": {
|
|
53
55
|
"shipsRuntimeCode": true,
|
|
54
|
-
"packagingNote": "Compiled JavaScript ships under ./dist. register() stays synchronous and opens nothing — it only registers tools. ALL I/O happens inside a tool's execute(): sil_register calls sil-web over the network, writes tokens.json + config.json to the plugin data directory (owner-only, 0600), and arms a bounded background poll timer that stops on the first terminal claim outcome or after the session deadline. sil_whoami reads the stored session token and calls sil-api for the user's identity, refreshing transparently via sil-web on a 401 (at most one refresh + one retry per call, no timer); a confirmed-dead session clears tokens.json. sil_search and sil_product_get read the stored session token and call sil-api's catalog endpoints (search / lookup) with it — read-only on catalog data, no timer, but with the SAME bounded 401 recovery as sil_whoami: on a 401 they refresh ONCE via sil-web (rotating tokens.json) and retry the read ONCE; a second 401 or a dead (invalid_grant) refresh token clears tokens.json and is reported as a terminal re-register hint. A non-401 error writes no token.
|
|
56
|
+
"packagingNote": "Compiled JavaScript ships under ./dist. register() stays synchronous and opens nothing — it only registers tools. ALL I/O happens inside a tool's execute(): sil_register calls sil-web over the network, writes tokens.json + config.json to the plugin data directory (owner-only, 0600), and arms a bounded background poll timer that stops on the first terminal claim outcome or after the session deadline. sil_whoami reads the stored session token and calls sil-api for the user's identity, refreshing transparently via sil-web on a 401 (at most one refresh + one retry per call, no timer); a confirmed-dead session clears tokens.json. sil_search and sil_product_get read the stored session token and call sil-api's catalog endpoints (search / lookup) with it — read-only on catalog data, no timer, but with the SAME bounded 401 recovery as sil_whoami: on a 401 they refresh ONCE via sil-web (rotating tokens.json) and retry the read ONCE; a second 401 or a dead (invalid_grant) refresh token clears tokens.json and is reported as a terminal re-register hint. A non-401 error writes no token. The five profile verbs make NO network call and read no token; they write the one sil shopper's SINGLETON behaviour artefacts under a fixed $SIL_DATA_DIR/shopper/ (owner-only, files 0600, dirs 0700) as frontmatter-as-truth markdown — there is NO profile.json manifest; each file's own frontmatter IS the source of truth, discovered by a filesystem scan. sil_profile_materialize is SETUP-ONLY: it writes shopper/user_spec.md (the shared person spec; its frontmatter carries the shopper name), minting no domain. sil_learn is the single target+change verb over shopper/domains/<slug>/{method.md, prds/<product>-<intent>.md, assets/}: create mints a whole method or PRD; append/amend/retract refine a section-aware markdown body in place (single-occurrence match, fail-closed if the target or the named section is absent); attach-asset persists image bytes (size-capped, image MIME allowlist) into the domain's assets/ owner-only and links them by RELATIVE path, never inline bytes. sil_profile_search scans artefact FRONTMATTER and returns coordinates only (no bodies) — a domain/PRD with malformed frontmatter is skipped and surfaced as unreadable, never silently dropped or half-read. sil_profile_get reads ONE whole body (method or PRD); sil_profile_remove deletes a whole validated domain subtree, or one PRD file, fail-closed on a malformed/traversal/\"main\" or missing slug (never the whole shopper). The only caller-supplied path segments are the domain slug and the PRD key, both validated (lower-kebab, not \"main\") before any join; the shopper segment is a compile-time constant. Every write is atomic (tmp file → rename over target → chmod), so a reader sees a whole file or none. The persona is the shopper's host workspace SOUL.md, written by the host CLI (not this plugin, not a sil artefact), and the shopper's host-config wiring is driven separately by the host CLI. The PKCE verifier is held only in memory and is never written to disk. Artefact bodies, tokens, and identity PII are never logged.",
|
|
55
57
|
"registersLongLivedService": false,
|
|
56
58
|
"serviceIds": [],
|
|
57
59
|
"runsTimers": true,
|
|
@@ -61,7 +63,7 @@
|
|
|
61
63
|
"https://sil.4gpts.com"
|
|
62
64
|
],
|
|
63
65
|
"filesystemScope": [
|
|
64
|
-
"$SIL_DATA_DIR (default $XDG_DATA_HOME/sil, else ~/.local/share/sil) — tokens.json, config.json, shopper/
|
|
66
|
+
"$SIL_DATA_DIR (default $XDG_DATA_HOME/sil, else ~/.local/share/sil) — tokens.json, config.json, shopper/user_spec.md + shopper/domains/<slug>/{method.md, prds/<product>-<intent>.md, assets/<content-hash>.<ext>} (the ONE sil shopper's singleton behaviour artefacts, frontmatter-as-truth with NO profile.json manifest: sil_profile_materialize writes the shared user_spec.md at setup (its frontmatter carries the shopper name), and sil_learn mints/refines per-domain methods, intent-keyed PRDs, and per-domain image assets. The `shopper` segment is a fixed compile-time constant, not caller input; the domain slug and PRD key are the only caller-supplied path segments, validated (lower-kebab, not \"main\") before any join. All writes are atomic + owner-only (files 0600, dirs 0700). The persona is the host workspace SOUL.md, not a sil artefact)"
|
|
65
67
|
],
|
|
66
68
|
"credentialsOnDisk": [
|
|
67
69
|
"tokens.json (access + refresh token)",
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* "never write host config / `noChildProcess: true`" guarantees do not bind it; it
|
|
10
10
|
* legitimately drives `openclaw …` via `execFileSync`.
|
|
11
11
|
*
|
|
12
|
-
* It runs POST-endorsement: the interview (`
|
|
12
|
+
* It runs POST-endorsement: the interview (`agent_creation_engine.md` Part 1) owns the
|
|
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
|
*
|
|
@@ -28,9 +28,11 @@
|
|
|
28
28
|
* 4. snapshot openclaw.json — the whole-file teardown anchor, taken BEFORE step 5
|
|
29
29
|
* 5. openclaw agents add — create the real agents.list entry + workspace bootstrap
|
|
30
30
|
* 6. write <workspace>/SOUL.md — the persona (atomic tmp→rename); never a sil artefact
|
|
31
|
-
* 7. materializeProfile — REUSED; { name, userSpec }
|
|
32
|
-
*
|
|
33
|
-
*
|
|
31
|
+
* 7. materializeProfile — REUSED; SETUP-ONLY { name, userSpec } ⇒ shared
|
|
32
|
+
* user_spec.md (its frontmatter carries the name);
|
|
33
|
+
* NO manifest, no domain minted at create
|
|
34
|
+
* 8. attach the sil skill + deny the escape-hatch tools (exec/write/edit/apply_patch,
|
|
35
|
+
* a per-agent tools.deny that keeps sil + web) + enable the sil plugin (config set)
|
|
34
36
|
* 9. sil-openclaw-allowlist — REUSED whole; additive/idempotent/atomic three-surface
|
|
35
37
|
* trust merge (plugins.allow + tools.alsoAllow + plugins.entries.sil)
|
|
36
38
|
* 10. bind the current channel — FAIL-OPEN convenience, NOT fail-closed: resolve the channel
|
|
@@ -81,7 +83,7 @@ import { fileURLToPath } from "node:url";
|
|
|
81
83
|
|
|
82
84
|
import {
|
|
83
85
|
materializeProfile,
|
|
84
|
-
|
|
86
|
+
readShopperIdentity,
|
|
85
87
|
getShopperArtefactDir,
|
|
86
88
|
} from "../dist/lib/profile-store.js";
|
|
87
89
|
import { resolveBindChannel } from "../dist/lib/bind-channel.js";
|
|
@@ -96,6 +98,37 @@ const MANIFEST_PATH = resolve(ROOT, "openclaw.plugin.json");
|
|
|
96
98
|
/** A shopper id path-segment shape — lower-kebab, never `main` (host-reserved). */
|
|
97
99
|
const AGENT_ID_RE = /^[a-z0-9][a-z0-9-]*$/;
|
|
98
100
|
|
|
101
|
+
/** The escape-hatch tools the shopper is DENIED at the per-agent level — the shell
|
|
102
|
+
* (`exec`) and the filesystem mutators (`write`/`edit`/`apply_patch`). A shopper shops
|
|
103
|
+
* through the sil tools; it has no business running a shell (which it wasted re-reading
|
|
104
|
+
* its own skill files) or writing host files (which it used to persist shopping memory
|
|
105
|
+
* into the workspace instead of the sil store). `deny` is the SAFE lever: per the host's
|
|
106
|
+
* tool-precedence model it only further-RESTRICTS and cannot re-grant, so it removes
|
|
107
|
+
* exactly these and CANNOT strip the sil tools (a per-agent `tools.profile` override,
|
|
108
|
+
* by contrast, replaces the base set and would risk the sil grant). Web + messaging
|
|
109
|
+
* tools are intentionally kept — web still feeds gap-filling method research. */
|
|
110
|
+
const SHOPPER_TOOL_DENY = ["exec", "write", "edit", "apply_patch"];
|
|
111
|
+
|
|
112
|
+
/** The sil creed appended to every shopper's SOUL.md after its persona — a soul, not a
|
|
113
|
+
* rulebook. It carries the mantra (explore first), the loop in three lines, and the one
|
|
114
|
+
* distinction that matters (the catalog is where you buy, the web is where you learn),
|
|
115
|
+
* so the shopper's character carries the method. The mechanics live in the attached
|
|
116
|
+
* sil-shopping skill; this is the philosophy the model weights as identity. */
|
|
117
|
+
const SOUL_SIL_RULES =
|
|
118
|
+
"\n## The sil way\n\n"
|
|
119
|
+
+ "You are a spec-driven shopper, and your mantra is **explore first**: before you buy"
|
|
120
|
+
+ " in a niche, you learn how it is really bought.\n\n"
|
|
121
|
+
+ "The loop, in three lines:\n"
|
|
122
|
+
+ "1. **Learn the domain** — the first time you shop a niche, explore it on the web,"
|
|
123
|
+
+ " research how it is bought, and remember what you find (`sil_learn`).\n"
|
|
124
|
+
+ "2. **Know the person** — reuse the sizes, tastes, and limits you already hold; ask"
|
|
125
|
+
+ " only what you genuinely cannot infer.\n"
|
|
126
|
+
+ "3. **Find the thing** — search the sil catalog, weigh what comes back against what"
|
|
127
|
+
+ " you learned, and say why your pick fits.\n\n"
|
|
128
|
+
+ "The **sil catalog is where you buy; the open web is where you learn.** Research a"
|
|
129
|
+
+ " niche freely and often, but the products you recommend always come from the"
|
|
130
|
+
+ " catalog. Keep what you learn so tomorrow's shop starts smarter than today's.\n";
|
|
131
|
+
|
|
99
132
|
const CREATED_EVENT = "sil_shopper_created";
|
|
100
133
|
const FAILED_EVENT = "sil_shopper_create_failed";
|
|
101
134
|
|
|
@@ -283,23 +316,10 @@ function agentIndex(config, agentId) {
|
|
|
283
316
|
return list.findIndex((a) => a?.id === agentId);
|
|
284
317
|
}
|
|
285
318
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
* block (the host may grant web by other means). */
|
|
291
|
-
function webCapabilityWarnings(config) {
|
|
292
|
-
const defaults = config?.agents?.defaults;
|
|
293
|
-
if (defaults === undefined || defaults === null || typeof defaults !== "object") return [];
|
|
294
|
-
const json = JSON.stringify(defaults).toLowerCase();
|
|
295
|
-
const WEB_TOKENS = ["web", "fetch", "browse", "http"];
|
|
296
|
-
if (WEB_TOKENS.some((t) => json.includes(t))) return [];
|
|
297
|
-
return [
|
|
298
|
-
"the created shopper inherits its tool profile from agents.defaults, which does not appear to"
|
|
299
|
-
+ " grant a web/fetch tool — a domain cannot be lazily minted or web-refreshed without it"
|
|
300
|
-
+ " (bare sil_search still works). Confirm agents.defaults grants a web capability.",
|
|
301
|
-
];
|
|
302
|
-
}
|
|
319
|
+
// The shopper's per-agent escape-hatch deny-list (step 8) is the INTENDED end state, not
|
|
320
|
+
// a degradation — so it rides no `warnings` entry (that rail is for real gaps, and the
|
|
321
|
+
// happy path stays clean). What the shopper keeps (sil tools + web) and drops (the shell
|
|
322
|
+
// + fs mutators) is documented in CHANGELOG.md + agent_creation_engine.md.
|
|
303
323
|
|
|
304
324
|
/** True iff `openclaw config validate --json` reported `{valid:true}`. The host
|
|
305
325
|
* writes its verdict to stdout even on a non-zero exit, so read stdout, never the
|
|
@@ -398,14 +418,12 @@ function teardown({ configPath, snapshot, mode, bakPreexisted, workspace, worksp
|
|
|
398
418
|
// 3. Remove the singleton shopper dir ONLY if it did not pre-exist (the singleton
|
|
399
419
|
// pre-flight guarantees it was ours this run).
|
|
400
420
|
// KNOWN GAP (narrow): this keys on WHOLE-DIR pre-existence, not on the leaf we
|
|
401
|
-
// wrote
|
|
402
|
-
// (profile-store.ts). If `shopper/` pre-existed but EMPTY (no profile.json), the
|
|
421
|
+
// wrote. If `shopper/` pre-existed but held no readable user_spec.md, the
|
|
403
422
|
// singleton read passes ("no shopper") yet `shopperDirPreexisted` is true, so a
|
|
404
|
-
// post-materialize failure leaves THIS run's
|
|
405
|
-
//
|
|
406
|
-
//
|
|
407
|
-
//
|
|
408
|
-
// this removal on "we wrote profile.json this run", mirroring `!leafPreexisted`.
|
|
423
|
+
// post-materialize failure leaves THIS run's user_spec.md un-removed and does NOT
|
|
424
|
+
// surface as residue → `teardown_failed`. Extremely narrow (normal operation
|
|
425
|
+
// never leaves an empty `shopper/`). To close it, key this removal on "we wrote
|
|
426
|
+
// user_spec.md this run".
|
|
409
427
|
if (!shopperDirPreexisted) {
|
|
410
428
|
const shopperDir = getShopperArtefactDir();
|
|
411
429
|
try {
|
|
@@ -467,14 +485,9 @@ function main() {
|
|
|
467
485
|
const skillAttachName = skill.name;
|
|
468
486
|
|
|
469
487
|
// --- 3. Singleton + agentId pre-flight (nothing written; inconclusive → fail closed) ---
|
|
470
|
-
// The sil artefact store is the source of truth for "a shopper exists".
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
emitFailure("persistence_failed", {
|
|
474
|
-
path: getShopperArtefactDir(),
|
|
475
|
-
cause: "could not read the sil shopper store to check the singleton — failing closed rather than risk a second shopper",
|
|
476
|
-
});
|
|
477
|
-
}
|
|
488
|
+
// The sil artefact store is the source of truth for "a shopper exists": user_spec.md
|
|
489
|
+
// present + its frontmatter `name` reads (frontmatter-as-truth, no manifest).
|
|
490
|
+
const overview = readShopperIdentity();
|
|
478
491
|
if (Array.isArray(overview.unreadable) && overview.unreadable.length > 0) {
|
|
479
492
|
// A degraded store is INCONCLUSIVE — never fabricate a "no shopper" verdict.
|
|
480
493
|
emitFailure("persistence_failed", {
|
|
@@ -546,10 +559,13 @@ function main() {
|
|
|
546
559
|
failAndTeardown(configPath, "`openclaw agents add` failed: " + (addRes.stderr || "non-zero exit"));
|
|
547
560
|
}
|
|
548
561
|
|
|
549
|
-
// --- 6. Write the persona into the workspace SOUL.md
|
|
562
|
+
// --- 6. Write the persona + standing sil rules into the workspace SOUL.md ---
|
|
563
|
+
// The endorsed persona, then SOUL_SIL_RULES — the identity-level restatement of the
|
|
564
|
+
// shopping contract, so the shopper's tool discipline is anchored in its soul, not the
|
|
565
|
+
// skill alone (host CLI has no SOUL.md writer, so the bin does it).
|
|
550
566
|
const soulPath = join(workspace, "SOUL.md");
|
|
551
567
|
try {
|
|
552
|
-
atomicWrite(soulPath, persona.endsWith("\n") ? persona : persona + "\n");
|
|
568
|
+
atomicWrite(soulPath, (persona.endsWith("\n") ? persona : persona + "\n") + SOUL_SIL_RULES);
|
|
553
569
|
} catch (err) {
|
|
554
570
|
failAndTeardown(soulPath, "could not write SOUL.md: " + errCause(err));
|
|
555
571
|
}
|
|
@@ -577,6 +593,21 @@ function main() {
|
|
|
577
593
|
if (!skillRes.ok) {
|
|
578
594
|
failAndTeardown(configPath, "attaching the sil skill failed: " + (skillRes.stderr || "non-zero exit"));
|
|
579
595
|
}
|
|
596
|
+
// Deny the shopper the escape-hatch tools at the per-agent level — sibling of the
|
|
597
|
+
// `.skills` set above. This subtracts the shell + fs mutators from whatever the host's
|
|
598
|
+
// global profile grants, so the sil tools (admitted via plugin trust, step 9) and web
|
|
599
|
+
// survive while the shell/file-write hatches are gone. `deny` is chosen over a
|
|
600
|
+
// per-agent `tools.profile` override precisely because it only further-restricts and
|
|
601
|
+
// can never strip the sil grant (SHOPPER_TOOL_DENY rationale). `--strict-json` requires
|
|
602
|
+
// a valid-JSON value, so the array is passed via JSON.stringify (→ '["exec",…]'),
|
|
603
|
+
// exactly like the `["…"]` / `true` values above; a bare token would exit 0 but no-op.
|
|
604
|
+
const denyRes = runOpenclaw(
|
|
605
|
+
["config", "set", `agents.list[${idx}].tools.deny`, JSON.stringify(SHOPPER_TOOL_DENY), "--strict-json"],
|
|
606
|
+
configPath,
|
|
607
|
+
);
|
|
608
|
+
if (!denyRes.ok) {
|
|
609
|
+
failAndTeardown(configPath, "setting the shopper tool deny-list failed: " + (denyRes.stderr || "non-zero exit"));
|
|
610
|
+
}
|
|
580
611
|
const enableRes = runOpenclaw(
|
|
581
612
|
["config", "set", "plugins.entries.sil.enabled", "true", "--strict-json"],
|
|
582
613
|
configPath,
|
|
@@ -671,7 +702,7 @@ function main() {
|
|
|
671
702
|
}
|
|
672
703
|
|
|
673
704
|
// --- 12. Declare created — carry the identity + the bound channel (honesty rail) ---
|
|
674
|
-
const warnings = [...
|
|
705
|
+
const warnings = [...bindWarnings];
|
|
675
706
|
emitCreated({ name, agentId, workspace, boundChannel, warnings });
|
|
676
707
|
}
|
|
677
708
|
|
package/sil-shopping/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: sil-shopping
|
|
3
|
-
description: 'Use for any sil shopping, identity, or shopper-setup intent: register
|
|
3
|
+
description: 'Use for any sil shopping, identity, or shopper-setup intent: register, check the account, search the sil catalog, look up products by id — plus the single-shopper lifecycle: create the shopper (a two-touchpoint onboarding), search what it knows or which domains (niches) it learned, view or forget a domain or PRD, refine it — or, as the shopper, run the six-beat Spec-Driven Shopping loop and learn a fact or taste it surfaces. Drives sil_register, sil_whoami, sil_search, sil_product_get, sil_specs, sil_profile_materialize, sil_profile_search, sil_profile_get, sil_profile_remove, sil_learn.'
|
|
4
4
|
metadata:
|
|
5
5
|
openclaw:
|
|
6
6
|
emoji: "\U0001F6D2"
|
|
@@ -8,111 +8,87 @@ metadata:
|
|
|
8
8
|
|
|
9
9
|
# sil-shopping
|
|
10
10
|
|
|
11
|
-
Drive the sil plugin's tools on the user's behalf:
|
|
12
|
-
|
|
13
|
-
**shopper**
|
|
14
|
-
view or forget a domain,
|
|
15
|
-
(loading its reference on demand), call it, and report what came back.
|
|
11
|
+
Drive the sil plugin's tools on the user's behalf: read intent, route to the
|
|
12
|
+
matching tool or reference (loading on demand), call it, report what came back. The
|
|
13
|
+
**shopper** is one sil-wired agent that shops every niche — set it up, search what
|
|
14
|
+
it knows, view or forget a domain, refine it.
|
|
16
15
|
|
|
17
16
|
## Always-on contract
|
|
18
17
|
|
|
19
18
|
- **Act, don't narrate.** When intent maps to a tool, call it — don't re-confirm
|
|
20
19
|
what was already stated.
|
|
21
20
|
- **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
|
|
23
|
-
improvise
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
non-`ok` one, say what happened and follow that tool's own `recovery` hint —
|
|
22
|
+
never improvise.
|
|
23
|
+
- **Prices are point-in-time.** Re-fetch with `sil_product_get` before the user
|
|
24
|
+
buys — never trust an earlier `sil_search` snapshot.
|
|
25
|
+
- **Buy-intent in an unlearned niche ⇒ mint first.** A request whose niche you
|
|
26
|
+
have not learned is a MISS — `sil_profile_search` returns it with `next_step:
|
|
27
|
+
mint_domain`. Research the buying guide and `sil_learn create` the domain method
|
|
28
|
+
**before** searching; never skip the mint. The picks you return are always sil
|
|
29
|
+
catalog products (`sil_search` → `checkout_url`), **never** open-web results —
|
|
30
|
+
the web only researches the method, it never sources a pick.
|
|
27
31
|
|
|
28
32
|
## Session start
|
|
29
33
|
|
|
30
|
-
Confirm the `sil_*` tools are exposed. If
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
Confirm the `sil_*` tools are exposed. If missing, the host is filtering them —
|
|
35
|
+
run the shipped admission helper `sil-openclaw-allowlist` (it additively admits
|
|
36
|
+
sil at `plugins.allow` + `tools.alsoAllow`), then reopen the session. Most flows
|
|
37
|
+
need an identity: call a catalog tool first and let an unregistered outcome route
|
|
38
|
+
to `sil_register`, or run `sil_register` up front when intent requires it.
|
|
35
39
|
|
|
36
40
|
## Routing — read the stage, then match intent to a tool
|
|
37
41
|
|
|
38
|
-
**Read the stage from state — never guess
|
|
39
|
-
`sil_whoami` (is a sil identity **registered
|
|
40
|
-
|
|
41
|
-
present only once a shopper exists).
|
|
42
|
+
**Read the stage from state — never guess.** Two cheap reads settle it:
|
|
43
|
+
`sil_whoami` (is a sil identity **registered**?) and `sil_profile_search` (is a
|
|
44
|
+
shopper set up — any `domains`?).
|
|
42
45
|
|
|
43
46
|
- **No identity** ⇒ guide the user to register.
|
|
44
|
-
-
|
|
45
|
-
|
|
46
|
-
-
|
|
47
|
+
- **No shopper / no domains** ⇒ bare shopping is a first-class quick lookup, with
|
|
48
|
+
the setup path offered alongside.
|
|
49
|
+
- **Shopper present** ⇒ shop through what you know about the person via the loop.
|
|
47
50
|
|
|
48
51
|
[`references/setup_onboarding.md`](references/setup_onboarding.md) owns the setup
|
|
49
52
|
script — the staged ladder, the after-register offer, the per-search pitch. Load
|
|
50
|
-
|
|
53
|
+
while setup is incomplete; it sheds once a shopper exists.
|
|
51
54
|
|
|
52
|
-
### Intent → tool (load
|
|
55
|
+
### Intent → tool / reference (load on demand)
|
|
53
56
|
|
|
54
|
-
| Intent | Tool | Reference |
|
|
57
|
+
| Intent | Tool / path | Reference |
|
|
55
58
|
|---|---|---|
|
|
56
|
-
| "sign me up" / "log me in" / "register" | `sil_register` |
|
|
57
|
-
| "who am I?" / show my saved name + addresses | `sil_whoami` |
|
|
58
|
-
| "find X" / "search for X" / browse a category or price range | `sil_search` |
|
|
59
|
-
| "look up these items" / re-check ids from a prior result | `sil_product_get` |
|
|
60
|
-
| "set up an agent that shops for me" / "create my shopper" | (onboarding, then the engine) |
|
|
61
|
-
| "what does my shopper know?" / "which domains
|
|
62
|
-
| "show me the <niche> domain" | `sil_profile_get`
|
|
63
|
-
| "forget the <niche> domain" | `sil_profile_remove` | [`
|
|
64
|
-
| (as the shopper) a shopping intent on any niche |
|
|
65
|
-
| "remember this" — a fact or taste the shopper surfaced | `
|
|
66
|
-
| "refine / sharpen my shopper" / fix a niche | (
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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).
|
|
59
|
+
| "sign me up" / "log me in" / "register" | `sil_register` | — |
|
|
60
|
+
| "who am I?" / show my saved name + addresses | `sil_whoami` | — |
|
|
61
|
+
| "find X" / "search for X" / browse a category or price range | `sil_search` | — |
|
|
62
|
+
| "look up these items" / re-check ids from a prior result | `sil_product_get` | — |
|
|
63
|
+
| "set up an agent that shops for me" / "create my shopper" | (onboarding, then the engine) | [`agent_creation_engine.md`](references/agent_creation_engine.md) |
|
|
64
|
+
| "what does my shopper know?" / "which domains / PRDs?" | `sil_profile_search` | [`method_and_prds.md`](references/method_and_prds.md) |
|
|
65
|
+
| "show me the <niche> domain" (method or one PRD) | `sil_profile_get` | [`method_and_prds.md`](references/method_and_prds.md) |
|
|
66
|
+
| "forget the <niche> domain" (or one PRD) | `sil_profile_remove` | [`method_and_prds.md`](references/method_and_prds.md) |
|
|
67
|
+
| (as the shopper) a shopping intent on any niche | the six-beat loop | [`shop_loop.md`](references/shop_loop.md) |
|
|
68
|
+
| "learn / remember this" — a fact or taste the shopper surfaced | `sil_learn` | [`fill_and_feedback.md`](references/fill_and_feedback.md) |
|
|
69
|
+
| "refine / sharpen my shopper" / fix a niche | `sil_learn` (target + change) | [`fill_and_feedback.md`](references/fill_and_feedback.md) |
|
|
70
|
+
|
|
71
|
+
Each core tool's behaviour + status taxonomy live in its own tool definition and
|
|
72
|
+
response (the `recovery`/`status` it returns) — basic shopping needs only that. A full
|
|
73
|
+
run: [`examples/multi_domain_shopper_walkthrough.md`](examples/multi_domain_shopper_walkthrough.md).
|
|
74
|
+
|
|
75
|
+
**Setting up the shopper — endorsement-gated.** The shopper is a singleton (refused
|
|
76
|
+
once one exists). Run
|
|
77
|
+
[`references/agent_creation_engine.md`](references/agent_creation_engine.md) — it holds
|
|
78
|
+
both the two-touchpoint onboarding and the engine that persists the one sil-wired
|
|
79
|
+
shopper. Nothing is created until the user explicitly **endorses** the draft.
|
|
80
|
+
|
|
81
|
+
## As the shopper — the six-beat Spec-Driven-Shopping loop
|
|
82
|
+
|
|
83
|
+
Once a shopper exists, shop through what you know about the person. The loop is a
|
|
84
|
+
**six-beat** state machine — **classify → method → fill → search-space → reflect →
|
|
85
|
+
feedback** — loaded on demand from the references that own each beat: **1 classify,
|
|
86
|
+
4 search-space, 5 reflect** → [`references/shop_loop.md`](references/shop_loop.md);
|
|
87
|
+
**2 method** (load/mint/refresh, intent-keyed PRDs, the frontmatter-as-truth store)
|
|
88
|
+
→ [`references/method_and_prds.md`](references/method_and_prds.md); **3 fill, 6
|
|
89
|
+
feedback** → [`references/fill_and_feedback.md`](references/fill_and_feedback.md).
|
|
90
|
+
|
|
91
|
+
The loop shapes the shopper's **reasoning, not the user's inbox**: a reused domain
|
|
92
|
+
plus a fully-resolved request **passes straight through, asking nothing**. It gates
|
|
93
|
+
only `sil_search`-driven discovery — identity, a direct `sil_product_get` re-check,
|
|
94
|
+
and shopper-management run ungated.
|
|
@@ -1,118 +1,49 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: multi-domain-shopper-walkthrough
|
|
3
|
-
description:
|
|
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. Illustrative, not a spec.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Worked
|
|
6
|
+
# Worked run — one shopper, two niches, six beats
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
([`../references/brainstorm_interview.md`](../references/brainstorm_interview.md) →
|
|
10
|
-
[`../references/agent_creation_engine.md`](../references/agent_creation_engine.md)), then
|
|
11
|
-
shop **two unrelated niches in the same session** — the second **minted on the fly** —
|
|
12
|
-
with a **shared fact reused across both** and **per-domain taste that does not leak**. It
|
|
13
|
-
shows the shape and the gates, not exact wording; the machinery lives in the references.
|
|
8
|
+
Illustrative only — authoritative rules live in the beat references.
|
|
14
9
|
|
|
15
|
-
##
|
|
10
|
+
## Create the shopper (once, after endorsement)
|
|
16
11
|
|
|
17
|
-
|
|
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).
|
|
18
17
|
|
|
19
|
-
A
|
|
18
|
+
## Niche A — ski gloves (all six beats)
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
1. **Classify** — "warm gloves for the slope" → `{ domain: ski, product: gloves, intent:
|
|
21
|
+
slope }`; `sil_profile_search` finds no ski domain → a MISS.
|
|
22
|
+
2. **Method** — research ski gear, **mint** via `sil_learn create`, **announced** ("I read this
|
|
23
|
+
as *ski gloves for the slope* — correct me if not").
|
|
24
|
+
3. **Fill** — the method resolves waterproofing + cuff length; the wool allergy is **reused**
|
|
25
|
+
from the shared `user_spec` **without re-asking**; only the budget is elicited (one question,
|
|
26
|
+
tied to why).
|
|
27
|
+
4. **Search-space** — a bounded fan-out of ≤ 4 `sil_search` calls, core first.
|
|
28
|
+
5. **Reflect** — honesty pass, then a **hero + one alternative**, each with a why.
|
|
29
|
+
6. **Feedback** — "I always run Hestra" → confirm, persist a per-domain taste to the method via
|
|
30
|
+
`sil_learn`.
|
|
26
31
|
|
|
27
|
-
|
|
28
|
-
`userSpec`: *ship-to Lyon (soft fact); **HARD-NO: leather** (inviolable, carries across
|
|
29
|
-
every niche).*
|
|
32
|
+
## Niche B — an espresso grinder (same session, minted on the fly)
|
|
30
33
|
|
|
31
|
-
|
|
34
|
+
The user pivots: "now I need a burr grinder" — a **second, unrelated niche**. No agent switch;
|
|
35
|
+
the one shopper handles it:
|
|
32
36
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
```
|
|
37
|
+
1. **Classify** → `{ domain: espresso, product: grinder, intent: general }` (context-free →
|
|
38
|
+
`general`).
|
|
39
|
+
2. **Method** — a MISS again → research + **mint on the fly**, **announced**.
|
|
40
|
+
3. **Fill** — "ships to Berlin" is **reused across** niches from the shared `user_spec`, kept
|
|
41
|
+
from the ski session. The Hestra taste, per-domain on the ski method, does **not** leak here.
|
|
40
42
|
|
|
41
|
-
|
|
43
|
+
Shared facts flow to both; per-domain taste stays isolated.
|
|
42
44
|
|
|
43
|
-
|
|
44
|
-
the engine run — `openclaw agents add my-shopper …` → persona into `SOUL.md` →
|
|
45
|
-
`sil_profile_materialize { name, userSpec }` (no `domain`; writes the shared
|
|
46
|
-
`user_spec.md` + an empty `domains: {}`) → wire + admit sil → validate → **`created`**,
|
|
47
|
-
with an **empty `domains` map** (healthy; each niche mints on first shop).
|
|
45
|
+
## The singleton edge
|
|
48
46
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
>
|
|
52
|
-
|
|
53
|
-
The shop loop classifies the niche (**road cycling**), finds no match, and **mints it on
|
|
54
|
-
the spot — announced** ("I haven't shopped cycling for you yet — setting that up"). It
|
|
55
|
-
researches a deep `domainSpec` (fit is everything; geometry; gearing; material/wheel
|
|
56
|
-
trade-offs), derives the `intentSpec`, seeds a partial `playbook`, and persists with the
|
|
57
|
-
whole-doc `sil_profile_materialize` carrying `domain.slug: "road-cycling"`. It recommends
|
|
58
|
-
with a **"why" that cites the layers** — "for a first bike **fit/comfort outrank outright
|
|
59
|
-
speed** (a domain mechanic), a 54 cm endurance frame fits, kept within your value budget;
|
|
60
|
-
**no leather anywhere** (your standing hard rule)."
|
|
61
|
-
|
|
62
|
-
A taste surfaces, captured the cheap way — one append, scoped to this domain:
|
|
63
|
-
|
|
64
|
-
> **User:** "I don't chase brands — value over name."
|
|
65
|
-
|
|
66
|
-
```
|
|
67
|
-
sil_remember { kind: "taste", text: "Value over brand; ~€1500 band.", domain: "road-cycling" }
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
→ lands in `domains/road-cycling/playbook.md` only.
|
|
71
|
-
|
|
72
|
-
## Niche B — espresso (a second niche, same session, no switch)
|
|
73
|
-
|
|
74
|
-
> **User:** "Different thing — a home espresso machine, decent but not crazy."
|
|
75
|
-
|
|
76
|
-
Same session, **no agent switch, no re-onboarding**. The loop classifies **espresso**,
|
|
77
|
-
finds no match, and **mints espresso on the fly — announced**, with its own deep
|
|
78
|
-
`domainSpec` (boiler type, PID, pressure profiling, grinder pairing) via a second
|
|
79
|
-
whole-doc `sil_profile_materialize` (`domain.slug: "espresso"`).
|
|
80
|
-
|
|
81
|
-
**The shared fact carries — without being re-asked:** the ship-to from the shared
|
|
82
|
-
`user_spec.md` is reused in espresso with **no re-ask** ("I'll ship to your Lyon address
|
|
83
|
-
as usual"), and the no-leather hard rule still rejects a leather-wrapped tamper handle.
|
|
84
|
-
|
|
85
|
-
**The niche taste does not leak:** the *value-over-brand* taste lives in
|
|
86
|
-
`domains/road-cycling/playbook.md` and does not shape the espresso picks — espresso learns
|
|
87
|
-
its own:
|
|
88
|
-
|
|
89
|
-
> **User:** "For coffee I'll happily pay for a known reliable brand."
|
|
90
|
-
|
|
91
|
-
```
|
|
92
|
-
sil_remember { kind: "taste", text: "Pays up for a reliable known brand.", domain: "espresso" }
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
→ `domains/espresso/playbook.md` only. The two tastes coexist without contradiction —
|
|
96
|
-
per-domain taste isolation. A **fact** would instead go to the shared `user_spec.md`
|
|
97
|
-
(`kind: "fact"`) and carry to *both* niches.
|
|
98
|
-
|
|
99
|
-
## The singleton edge — refuse a second shopper
|
|
100
|
-
|
|
101
|
-
> **User:** "Can you make me a second shopper just for coffee?"
|
|
102
|
-
> **Shopper:** "You already have a shopper — it handles every niche. I've added espresso
|
|
103
|
-
> as a domain; I won't create a second. Want me to refine the espresso domain instead?"
|
|
104
|
-
|
|
105
|
-
The engine's **singleton refusal** (`collision`, "a shopper already exists") — one
|
|
106
|
-
shopper, many domains.
|
|
107
|
-
|
|
108
|
-
## Edge cases this example would have handled
|
|
109
|
-
|
|
110
|
-
- **Reuse before mint** — "another road bike, for winter" reuses the existing
|
|
111
|
-
`road-cycling` domain (semantic dedup), never a near-duplicate pack.
|
|
112
|
-
- **Forget one domain ≠ decommission the shopper** — "forget espresso" runs
|
|
113
|
-
`sil_profile_remove { domainSlug: "espresso" }`; the shopper, shared user spec, and
|
|
114
|
-
road-cycling domain survive.
|
|
115
|
-
- **No web tool** — the shopper says so honestly at mint time and composes from public
|
|
116
|
-
knowledge, never pretending the research happened.
|
|
117
|
-
- **Creation is local + offline** — no sil registration to create; the user registers
|
|
118
|
-
later, on first shop.
|
|
47
|
+
"Set me up a second shopper" → the engine refuses: **a shopper already exists**. Steer to shop
|
|
48
|
+
a new niche (mints a domain on the spot) or refine with `sil_learn` — never a second shopper.
|
|
49
|
+
</content>
|