sil-openclaw 0.3.7 → 0.3.8
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 +57 -0
- package/dist/tools/identity.js +9 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +3 -2
- package/scripts/create-shopper.mjs +516 -0
- package/sil-shopping/SKILL.md +20 -1
- package/sil-shopping/references/agent_creation_engine.md +39 -28
- package/sil-shopping/references/brainstorm_interview.md +25 -15
- package/sil-shopping/references/shop_loop.md +53 -28
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,63 @@ release (`clawhub package publish --changelog`). See [README](./README.md#releas
|
|
|
10
10
|
|
|
11
11
|
## [Unreleased]
|
|
12
12
|
|
|
13
|
+
## [0.3.8] - 2026-07-06
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- **One-tap shopper creation via a single operator bin.** A new bin
|
|
18
|
+
`sil-openclaw-create-shopper` (`scripts/create-shopper.mjs`, wired through
|
|
19
|
+
`package.json#bin`) runs the **whole** shopper-creation choreography atomically
|
|
20
|
+
over one stdin JSON payload — reusing `materializeProfile` and the
|
|
21
|
+
`sil-openclaw-allowlist` bin — instead of the skill hand-driving the host CLI
|
|
22
|
+
step by step. It reports a four-outcome taxonomy (`created` / `invalid_request`
|
|
23
|
+
/ `collision` / `persistence_failed`) plus a louder `teardown_failed` emitted
|
|
24
|
+
only when snapshot-restore itself cannot revert; a whole-file snapshot-restore
|
|
25
|
+
teardown returns the host to its **exact** pre-run state on any failure (no
|
|
26
|
+
half-created shopper, no orphaned config/workspace). The skill references were
|
|
27
|
+
rewritten around the one command: `agent_creation_engine.md` now invokes the
|
|
28
|
+
single bin, and `brainstorm_interview.md` becomes a session-seeded, **local +
|
|
29
|
+
offline** pre-fill with the explicit endorsement gate intact — nothing is
|
|
30
|
+
created until the user endorses the assembled draft. No new plugin tool; the
|
|
31
|
+
8-tool manifest is unchanged. (#45)
|
|
32
|
+
- **Post-register shopper nudge + per-search pitch.** `sil_register`'s
|
|
33
|
+
`already_registered` payload now carries an additive, unconditional
|
|
34
|
+
`next_step: "offer_shopper"` routing hint — `identity.ts` reads **no**
|
|
35
|
+
profile-store state (it stays decoupled from the store); the skill owns the
|
|
36
|
+
actual gate. The `sil-shopping` skill gains two always-on beats: an
|
|
37
|
+
after-register offer to create the shopper, gated on a no-arg `sil_profile_get`
|
|
38
|
+
empty-store check (a user who already has the singleton shopper is never offered
|
|
39
|
+
a second one), and a recurring post-result per-search pitch that introduces the
|
|
40
|
+
shopper after a bare search. Lane 1 (bare `sil_search`) stays untouched and the
|
|
41
|
+
pitch carries no frequency gate by design. (#44)
|
|
42
|
+
|
|
43
|
+
### Changed
|
|
44
|
+
|
|
45
|
+
- **On-query SDS spine hardened into five non-skippable beats.** The shop loop
|
|
46
|
+
(`sil-shopping/references/shop_loop.md`) is re-ordered in place into a hard,
|
|
47
|
+
ordered spine — **domain-exists → learn-on-miss → elicit-missing gate → persist
|
|
48
|
+
→ search** — splitting the old Step 3 into a first-class **elicitation gate
|
|
49
|
+
(Beat 3) that runs ahead of search** and a distinct **persist beat (Beat 4)**,
|
|
50
|
+
so the shopper never searches before it has decomposed intent and captured what
|
|
51
|
+
it learned. `SKILL.md` gains one non-skippable domain-exists reinforcement line,
|
|
52
|
+
scoped "as the shopper" (Lane 1 stays bare). The first-`buy` and
|
|
53
|
+
after-recommendation windows remain downstream of the Beat-5 web re-fetch.
|
|
54
|
+
Prose-only: no tool change, `contracts.tools` byte-unchanged. (#46)
|
|
55
|
+
|
|
56
|
+
### Fixed
|
|
57
|
+
|
|
58
|
+
- **The version-bump gate is now immune to a stale `dist/`.** The preversion test
|
|
59
|
+
path that reads the registered tool set is now **source-authoritative** — an
|
|
60
|
+
unconditional `await import("../index.js")` with the dist-preference and
|
|
61
|
+
non-behavioural breadcrumb removed — so an out-of-date compiled artifact can no
|
|
62
|
+
longer mask a source regression (the 0.3.6 `sil_profile_list` phantom-mismatch
|
|
63
|
+
class). A new `compiled-artifact-load.integration.test.ts` plants a poisoned
|
|
64
|
+
9-tool compiled entry under a hermetic `outDir` and proves the fresh-build
|
|
65
|
+
harness wipes it and loads a source-faithful dist (registered set ==
|
|
66
|
+
runtime-read `contracts.tools`, no `sil_profile_list`, marker gone). Test-only:
|
|
67
|
+
no tool added/removed, `contracts.tools` / `manifest-contract` / `package.json`
|
|
68
|
+
/ `scripts/release.mjs` byte-untouched. (#43)
|
|
69
|
+
|
|
13
70
|
## [0.3.7] - 2026-06-29
|
|
14
71
|
|
|
15
72
|
### Fixed
|
package/dist/tools/identity.js
CHANGED
|
@@ -52,11 +52,20 @@ function registerRegister(api) {
|
|
|
52
52
|
parameters: Type.Object({}),
|
|
53
53
|
async execute() {
|
|
54
54
|
// 1 — already registered: short-circuit, no mint, no poll, no overwrite.
|
|
55
|
+
// `next_step` is an ADDITIVE, UNCONDITIONAL routing hint (not a decision):
|
|
56
|
+
// it tells the skill "the moment after a confirmed registration is where to
|
|
57
|
+
// introduce the shopper". identity.ts stays decoupled from the profile store
|
|
58
|
+
// — it reads NO shopper state here; the skill owns the actual gate (a no-arg
|
|
59
|
+
// sil_profile_get empty-store check) so a user who already has a shopper is
|
|
60
|
+
// never offered a second one (the shopper is a singleton). The hint rides
|
|
61
|
+
// ONLY this confirmed-registration path — never the pre-registration
|
|
62
|
+
// `awaiting_browser` return, nor any poll/error terminal.
|
|
55
63
|
if (hasTokens()) {
|
|
56
64
|
const config = readConfig();
|
|
57
65
|
return jsonResult({
|
|
58
66
|
status: "already_registered",
|
|
59
67
|
user: config?.user ?? null,
|
|
68
|
+
next_step: "offer_shopper",
|
|
60
69
|
});
|
|
61
70
|
}
|
|
62
71
|
// A fresh registration attempt clears any prior in-process persist-failure
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sil-openclaw",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.8",
|
|
4
4
|
"description": "Turn your OpenClaw into an expert shopping agent.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
},
|
|
28
28
|
"main": "./dist/index.js",
|
|
29
29
|
"bin": {
|
|
30
|
-
"sil-openclaw-allowlist": "./scripts/allowlist-openclaw.mjs"
|
|
30
|
+
"sil-openclaw-allowlist": "./scripts/allowlist-openclaw.mjs",
|
|
31
|
+
"sil-openclaw-create-shopper": "./scripts/create-shopper.mjs"
|
|
31
32
|
},
|
|
32
33
|
"files": [
|
|
33
34
|
"dist",
|
|
@@ -0,0 +1,516 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Operator bin: create the user's ONE sil-wired shopper in a single atomic run.
|
|
4
|
+
*
|
|
5
|
+
* This is Change 3 of the onboarding-ux plan — it collapses the nine-step,
|
|
6
|
+
* agent-driven host-CLI choreography (`agent_creation_engine.md`) into ONE shipped
|
|
7
|
+
* package `bin`, a sibling of `scripts/allowlist-openclaw.mjs`. Like that bin it is
|
|
8
|
+
* a standalone operator script — NOT the plugin process — so the plugin's
|
|
9
|
+
* "never write host config / `noChildProcess: true`" guarantees do not bind it; it
|
|
10
|
+
* legitimately drives `openclaw …` via `execFileSync`.
|
|
11
|
+
*
|
|
12
|
+
* It runs POST-endorsement: the interview (`brainstorm_interview.md`) owns the
|
|
13
|
+
* consent gate; this bin executes an already-assembled, already-endorsed spec
|
|
14
|
+
* non-interactively. It never prompts, never re-runs the interview.
|
|
15
|
+
*
|
|
16
|
+
* Input — ONE JSON object `{ agentId, name, workspace, persona, userSpec }`, read
|
|
17
|
+
* from stdin (primary) or `--spec <path>` (fallback). Passing multiline
|
|
18
|
+
* persona/userSpec as JSON dodges shell-arg escaping. Unparseable/blank input →
|
|
19
|
+
* `invalid_request`, nothing attempted.
|
|
20
|
+
*
|
|
21
|
+
* Choreography (validate-first, then atomic, fail-closed):
|
|
22
|
+
* 1. validate the spec — bad/blank field ⇒ invalid_request, nothing attempted
|
|
23
|
+
* 2. resolve the host config — none ⇒ persistence_failed (precondition), nothing written
|
|
24
|
+
* 3. singleton + agentId pre-flight — a shopper OR the agentId already exists ⇒ collision;
|
|
25
|
+
* an INCONCLUSIVE read (degraded store / CLI error) fails closed — never fabricates
|
|
26
|
+
* a "no shopper" verdict, never proceeds to `agents add`
|
|
27
|
+
* 4. snapshot openclaw.json — the whole-file teardown anchor, taken BEFORE step 5
|
|
28
|
+
* 5. openclaw agents add — create the real agents.list entry + workspace bootstrap
|
|
29
|
+
* 6. write <workspace>/SOUL.md — the persona (atomic tmp→rename); never a sil artefact
|
|
30
|
+
* 7. materializeProfile — REUSED; { name, userSpec }, NO domain ⇒ shared user_spec.md
|
|
31
|
+
* + profile.json with an empty `domains: {}` map
|
|
32
|
+
* 8. attach the sil skill + enable the sil plugin (openclaw config set --strict-json)
|
|
33
|
+
* 9. sil-openclaw-allowlist — REUSED whole; additive/idempotent/atomic three-surface
|
|
34
|
+
* 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`.
|
|
37
|
+
*
|
|
38
|
+
* Teardown on ANY failure after step 5 = whole-file snapshot-restore of
|
|
39
|
+
* openclaw.json (reverses the agents.list entry + skill + plugin + trust in ONE
|
|
40
|
+
* atomic op, superseding the allowlist bin's inner `.bak`), plus removal of the
|
|
41
|
+
* workspace dir (only if WE created it) and the singleton shopper dir (only if it
|
|
42
|
+
* did not pre-exist — the singleton pre-flight guarantees it was ours). This
|
|
43
|
+
* returns the host to its EXACT pre-run state, so a co-installed `klodi` that was
|
|
44
|
+
* trusted pre-run stays trusted. A teardown that CANNOT fully revert is a distinct,
|
|
45
|
+
* LOUDER outcome (`teardown_failed`) that names the residue — never a green-washed
|
|
46
|
+
* `persistence_failed`.
|
|
47
|
+
*
|
|
48
|
+
* Outcome taxonomy (four terminal, + the louder teardown_failed), in sil's
|
|
49
|
+
* `snake_case_marker` NDJSON style (no api.logger outside the gateway). No PII, no
|
|
50
|
+
* secrets — the persona/userSpec text is NEVER logged:
|
|
51
|
+
* - created (info, stdout) — carries name + agentId + workspace [+ warnings]
|
|
52
|
+
* - invalid_request (error, stderr) — bad/blank spec; nothing attempted; names the field
|
|
53
|
+
* - collision (error, stderr) — singleton / agentId clash; nothing written
|
|
54
|
+
* - persistence_failed (error, stderr) — a step failed after writes began; teardown fully
|
|
55
|
+
* reverted; nothing partial; names path + cause
|
|
56
|
+
* - teardown_failed (error, stderr) — teardown could NOT fully revert; names the residue
|
|
57
|
+
*
|
|
58
|
+
* All real write/merge logic lives in the typed libs (`materializeProfile` from
|
|
59
|
+
* `dist/lib/profile-store.js`, the `sil-openclaw-allowlist` bin). This shell is
|
|
60
|
+
* thin choreography + teardown only — it re-implements none of it.
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
import { execFileSync } from "node:child_process";
|
|
64
|
+
import { existsSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
65
|
+
import { homedir } from "node:os";
|
|
66
|
+
import { dirname, join, resolve } from "node:path";
|
|
67
|
+
import { randomBytes } from "node:crypto";
|
|
68
|
+
import { fileURLToPath } from "node:url";
|
|
69
|
+
|
|
70
|
+
import {
|
|
71
|
+
materializeProfile,
|
|
72
|
+
readAgentProfile,
|
|
73
|
+
getShopperArtefactDir,
|
|
74
|
+
} from "../dist/lib/profile-store.js";
|
|
75
|
+
|
|
76
|
+
const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
77
|
+
/** The sibling operator bin that performs the additive, self-validating trust merge. */
|
|
78
|
+
const ALLOWLIST_BIN = resolve(ROOT, "scripts", "allowlist-openclaw.mjs");
|
|
79
|
+
|
|
80
|
+
/** A shopper id path-segment shape — lower-kebab, never `main` (host-reserved). */
|
|
81
|
+
const AGENT_ID_RE = /^[a-z0-9][a-z0-9-]*$/;
|
|
82
|
+
|
|
83
|
+
const CREATED_EVENT = "sil_shopper_created";
|
|
84
|
+
const FAILED_EVENT = "sil_shopper_create_failed";
|
|
85
|
+
|
|
86
|
+
/** Emit one structured NDJSON line in sil's marker style: `{event, level, ...}`. */
|
|
87
|
+
function logMarker(stream, level, event, fields) {
|
|
88
|
+
stream.write(JSON.stringify({ event, level, ...fields }) + "\n");
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** Terminal success emit — one `created` object on stdout, exit 0. */
|
|
92
|
+
function emitCreated(fields) {
|
|
93
|
+
logMarker(process.stdout, "info", CREATED_EVENT, { status: "created", ...fields });
|
|
94
|
+
process.exit(0);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** Terminal failure emit — one object on stderr carrying the taxonomy `status`,
|
|
98
|
+
* exit 1. Never carries persona/userSpec text. */
|
|
99
|
+
function emitFailure(status, fields) {
|
|
100
|
+
logMarker(process.stderr, "error", FAILED_EVENT, { status, ...fields });
|
|
101
|
+
process.exit(1);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** True when `s` is a present, non-blank string. */
|
|
105
|
+
function nonBlank(s) {
|
|
106
|
+
return typeof s === "string" && s.trim().length > 0;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** Human-readable cause from an unknown thrown value (never PII). */
|
|
110
|
+
function errCause(err) {
|
|
111
|
+
return err instanceof Error ? err.message : String(err);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** Atomic single-file write: tmp sibling → write → rename over target, preserving
|
|
115
|
+
* the given mode. A reader sees the old file or the new one, never a half-written
|
|
116
|
+
* one (mirrors `allowlist-openclaw.mjs` / `profile-store.ts`). */
|
|
117
|
+
function atomicWrite(path, contents, mode) {
|
|
118
|
+
const tmp = path + "." + randomBytes(6).toString("hex") + ".tmp";
|
|
119
|
+
writeFileSync(tmp, contents, mode !== undefined ? { mode } : undefined);
|
|
120
|
+
renameSync(tmp, path);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** Resolve the host config path by precedence (first existing wins) — identical to
|
|
124
|
+
* `allowlist-openclaw.mjs` so every subprocess agrees on ONE config file. Returns
|
|
125
|
+
* the resolved path, or null if none exists (caller fails closed). */
|
|
126
|
+
function resolveConfigPath() {
|
|
127
|
+
const candidates = [];
|
|
128
|
+
if (process.env["OPENCLAW_CONFIG_PATH"]) {
|
|
129
|
+
candidates.push(process.env["OPENCLAW_CONFIG_PATH"]);
|
|
130
|
+
}
|
|
131
|
+
if (process.env["OPENCLAW_STATE_DIR"]) {
|
|
132
|
+
candidates.push(join(process.env["OPENCLAW_STATE_DIR"], "openclaw.json"));
|
|
133
|
+
}
|
|
134
|
+
candidates.push(join(homedir(), ".openclaw", "openclaw.json"));
|
|
135
|
+
for (const candidate of candidates) {
|
|
136
|
+
if (existsSync(candidate)) return candidate;
|
|
137
|
+
}
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** Read the raw spec text — `--spec <path>` if present, else stdin (fd 0). Returns
|
|
142
|
+
* `{ raw }` or `{ error }` (a structured cause, never the spec contents). */
|
|
143
|
+
function readSpecRaw() {
|
|
144
|
+
const argv = process.argv.slice(2);
|
|
145
|
+
const specIdx = argv.indexOf("--spec");
|
|
146
|
+
if (specIdx >= 0) {
|
|
147
|
+
const path = argv[specIdx + 1];
|
|
148
|
+
if (!path) return { error: "--spec requires a file path argument" };
|
|
149
|
+
try {
|
|
150
|
+
return { raw: readFileSync(path, "utf8") };
|
|
151
|
+
} catch (err) {
|
|
152
|
+
return { error: "could not read --spec file: " + errCause(err) };
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
try {
|
|
156
|
+
return { raw: readFileSync(0, "utf8") };
|
|
157
|
+
} catch (err) {
|
|
158
|
+
return { error: "could not read the spec from stdin: " + errCause(err) };
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** Validate the endorsed spec — deterministic field order (agentId → name →
|
|
163
|
+
* workspace → persona → userSpec). Returns `{ field, message }` on the FIRST bad
|
|
164
|
+
* field, or null when the whole spec is good. Writes/attempts nothing. */
|
|
165
|
+
function validateSpec(spec) {
|
|
166
|
+
if (typeof spec !== "object" || spec === null || Array.isArray(spec)) {
|
|
167
|
+
return {
|
|
168
|
+
field: "spec",
|
|
169
|
+
message: "spec must be a JSON object with { agentId, name, workspace, persona, userSpec }.",
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
if (!nonBlank(spec.agentId)) {
|
|
173
|
+
return { field: "agentId", message: "agentId is required and must be non-empty." };
|
|
174
|
+
}
|
|
175
|
+
if (spec.agentId === "main") {
|
|
176
|
+
return { field: "agentId", message: '"main" is host-reserved and cannot be an agentId.' };
|
|
177
|
+
}
|
|
178
|
+
if (!AGENT_ID_RE.test(spec.agentId)) {
|
|
179
|
+
return {
|
|
180
|
+
field: "agentId",
|
|
181
|
+
message: "agentId must be lower-kebab (a-z, 0-9, hyphen) — got: " + JSON.stringify(spec.agentId),
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
if (!nonBlank(spec.name)) {
|
|
185
|
+
return { field: "name", message: "name is required and must be non-empty." };
|
|
186
|
+
}
|
|
187
|
+
if (!nonBlank(spec.workspace)) {
|
|
188
|
+
return { field: "workspace", message: "workspace is required and must be non-empty." };
|
|
189
|
+
}
|
|
190
|
+
if (!nonBlank(spec.persona)) {
|
|
191
|
+
return { field: "persona", message: "persona is required and must be non-empty." };
|
|
192
|
+
}
|
|
193
|
+
if (!nonBlank(spec.userSpec)) {
|
|
194
|
+
return { field: "userSpec", message: "userSpec is required and must be non-empty." };
|
|
195
|
+
}
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/** Run `openclaw <args>` pinned to the resolved config. Returns
|
|
200
|
+
* `{ ok, stdout, stderr, code }` — never throws across the boundary. */
|
|
201
|
+
function runOpenclaw(args, configPath) {
|
|
202
|
+
try {
|
|
203
|
+
const stdout = execFileSync("openclaw", args, {
|
|
204
|
+
env: { ...process.env, OPENCLAW_CONFIG_PATH: configPath },
|
|
205
|
+
encoding: "utf8",
|
|
206
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
207
|
+
});
|
|
208
|
+
return { ok: true, stdout, stderr: "", code: 0 };
|
|
209
|
+
} catch (err) {
|
|
210
|
+
return {
|
|
211
|
+
ok: false,
|
|
212
|
+
stdout: typeof err?.stdout === "string" ? err.stdout : "",
|
|
213
|
+
stderr: typeof err?.stderr === "string" ? err.stderr : "",
|
|
214
|
+
code: err?.code,
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/** Read + parse the host config JSON, or null on any read/parse failure. */
|
|
220
|
+
function readConfig(configPath) {
|
|
221
|
+
try {
|
|
222
|
+
return JSON.parse(readFileSync(configPath, "utf8"));
|
|
223
|
+
} catch {
|
|
224
|
+
return null;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/** The agentId path-segment ids already registered in the host config's
|
|
229
|
+
* `agents.list` — the authoritative, shim-independent clash source. */
|
|
230
|
+
function existingAgentIds(config) {
|
|
231
|
+
const list = Array.isArray(config?.agents?.list) ? config.agents.list : [];
|
|
232
|
+
return list.map((a) => a?.id).filter((id) => typeof id === "string");
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/** The index of `agentId` in `agents.list`, or -1 (used to target the skill attach). */
|
|
236
|
+
function agentIndex(config, agentId) {
|
|
237
|
+
const list = Array.isArray(config?.agents?.list) ? config.agents.list : [];
|
|
238
|
+
return list.findIndex((a) => a?.id === agentId);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/** Best-effort web-capability check (SA ruling: warn, never hard-fail). The shopper
|
|
242
|
+
* lazily mints/refreshes a domain over the web (inherited from `agents.defaults`);
|
|
243
|
+
* bare `sil_search` works without it. Warn ONLY when `agents.defaults` is present
|
|
244
|
+
* yet names no web/fetch capability — never fabricate a gap on an absent defaults
|
|
245
|
+
* block (the host may grant web by other means). */
|
|
246
|
+
function webCapabilityWarnings(config) {
|
|
247
|
+
const defaults = config?.agents?.defaults;
|
|
248
|
+
if (defaults === undefined || defaults === null || typeof defaults !== "object") return [];
|
|
249
|
+
const json = JSON.stringify(defaults).toLowerCase();
|
|
250
|
+
const WEB_TOKENS = ["web", "fetch", "browse", "http"];
|
|
251
|
+
if (WEB_TOKENS.some((t) => json.includes(t))) return [];
|
|
252
|
+
return [
|
|
253
|
+
"the created shopper inherits its tool profile from agents.defaults, which does not appear to"
|
|
254
|
+
+ " grant a web/fetch tool — a domain cannot be lazily minted or web-refreshed without it"
|
|
255
|
+
+ " (bare sil_search still works). Confirm agents.defaults grants a web capability.",
|
|
256
|
+
];
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Whole-file snapshot-restore teardown. Reverses everything this run created and
|
|
261
|
+
* returns the residue it could NOT revert (empty ⇒ clean, host at exact pre-run
|
|
262
|
+
* state). Each step is best-effort/idempotent so one failure never aborts the rest.
|
|
263
|
+
*/
|
|
264
|
+
function teardown({ configPath, snapshot, mode, bakPreexisted, workspace, workspacePreexisted, shopperDirPreexisted }) {
|
|
265
|
+
const residue = [];
|
|
266
|
+
|
|
267
|
+
// 1. Restore openclaw.json to its exact pre-run bytes — reverses the agents.list
|
|
268
|
+
// entry, the skill attach, the plugin enable, AND the trust merge in one op.
|
|
269
|
+
if (snapshot !== null && configPath) {
|
|
270
|
+
try {
|
|
271
|
+
atomicWrite(configPath, snapshot, mode);
|
|
272
|
+
} catch (err) {
|
|
273
|
+
residue.push({ path: configPath, cause: "could not restore openclaw.json: " + errCause(err) });
|
|
274
|
+
}
|
|
275
|
+
// Remove the allowlist bin's inner `.bak` if it did not pre-exist this run.
|
|
276
|
+
const bakPath = configPath + ".bak";
|
|
277
|
+
if (!bakPreexisted && existsSync(bakPath)) {
|
|
278
|
+
try {
|
|
279
|
+
rmSync(bakPath, { force: true });
|
|
280
|
+
} catch {
|
|
281
|
+
// A lingering .bak is cosmetic — not host state; do not escalate to residue.
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// 2. Remove the workspace dir ONLY if WE created it (never a pre-existing one).
|
|
287
|
+
if (workspace && !workspacePreexisted) {
|
|
288
|
+
try {
|
|
289
|
+
rmSync(workspace, { recursive: true, force: true });
|
|
290
|
+
} catch (err) {
|
|
291
|
+
residue.push({ path: workspace, cause: "could not remove the workspace dir: " + errCause(err) });
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// 3. Remove the singleton shopper dir ONLY if it did not pre-exist (the singleton
|
|
296
|
+
// pre-flight guarantees it was ours this run).
|
|
297
|
+
// KNOWN GAP (narrow): this keys on WHOLE-DIR pre-existence, not on the leaf we
|
|
298
|
+
// wrote — it DIVERGES from `materializeProfile`'s `!leafPreexisted` discipline
|
|
299
|
+
// (profile-store.ts). If `shopper/` pre-existed but EMPTY (no profile.json), the
|
|
300
|
+
// singleton read passes ("no shopper") yet `shopperDirPreexisted` is true, so a
|
|
301
|
+
// post-materialize failure leaves THIS run's profile.json/user_spec.md un-removed
|
|
302
|
+
// and does NOT surface as residue → `teardown_failed`. Extremely narrow (normal
|
|
303
|
+
// operation never leaves an empty `shopper/`; a materialize-STEP failure is
|
|
304
|
+
// already covered by materializeProfile's own leaf teardown). To close it, key
|
|
305
|
+
// this removal on "we wrote profile.json this run", mirroring `!leafPreexisted`.
|
|
306
|
+
if (!shopperDirPreexisted) {
|
|
307
|
+
const shopperDir = getShopperArtefactDir();
|
|
308
|
+
try {
|
|
309
|
+
rmSync(shopperDir, { recursive: true, force: true });
|
|
310
|
+
} catch (err) {
|
|
311
|
+
residue.push({ path: shopperDir, cause: "could not remove the shopper dir: " + errCause(err) });
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
return residue;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
function main() {
|
|
319
|
+
// --- 1. Read + validate the endorsed spec (validate-first, nothing attempted) ---
|
|
320
|
+
const specRaw = readSpecRaw();
|
|
321
|
+
if (specRaw.error) {
|
|
322
|
+
emitFailure("invalid_request", { field: "spec", cause: specRaw.error });
|
|
323
|
+
}
|
|
324
|
+
let spec;
|
|
325
|
+
try {
|
|
326
|
+
spec = JSON.parse(specRaw.raw);
|
|
327
|
+
} catch (err) {
|
|
328
|
+
emitFailure("invalid_request", {
|
|
329
|
+
field: "spec",
|
|
330
|
+
cause: "the spec is not valid JSON: " + errCause(err),
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
const bad = validateSpec(spec);
|
|
334
|
+
if (bad) {
|
|
335
|
+
emitFailure("invalid_request", { field: bad.field, cause: bad.message });
|
|
336
|
+
}
|
|
337
|
+
const { agentId, name, workspace, persona, userSpec } = spec;
|
|
338
|
+
|
|
339
|
+
// --- 2. Resolve the host config (precondition — nothing written yet) ---
|
|
340
|
+
const configPath = resolveConfigPath();
|
|
341
|
+
if (configPath === null) {
|
|
342
|
+
emitFailure("persistence_failed", {
|
|
343
|
+
path: null,
|
|
344
|
+
cause:
|
|
345
|
+
"no OpenClaw config found at OPENCLAW_CONFIG_PATH, $OPENCLAW_STATE_DIR/openclaw.json, or "
|
|
346
|
+
+ "~/.openclaw/openclaw.json — start the OpenClaw gateway once so it writes its base config, then re-run",
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
const preConfig = readConfig(configPath);
|
|
350
|
+
if (preConfig === null) {
|
|
351
|
+
emitFailure("persistence_failed", {
|
|
352
|
+
path: configPath,
|
|
353
|
+
cause: "the host openclaw.json is not readable/parseable JSON — fix it, then re-run",
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
// --- 3. Singleton + agentId pre-flight (nothing written; inconclusive → fail closed) ---
|
|
358
|
+
// The sil artefact store is the source of truth for "a shopper exists".
|
|
359
|
+
const overview = readAgentProfile();
|
|
360
|
+
if (!overview.ok) {
|
|
361
|
+
emitFailure("persistence_failed", {
|
|
362
|
+
path: getShopperArtefactDir(),
|
|
363
|
+
cause: "could not read the sil shopper store to check the singleton — failing closed rather than risk a second shopper",
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
if (Array.isArray(overview.unreadable) && overview.unreadable.length > 0) {
|
|
367
|
+
// A degraded store is INCONCLUSIVE — never fabricate a "no shopper" verdict.
|
|
368
|
+
emitFailure("persistence_failed", {
|
|
369
|
+
path: getShopperArtefactDir(),
|
|
370
|
+
cause: "the sil shopper store is degraded (" + overview.unreadable.map((u) => u.error).join("; ")
|
|
371
|
+
+ ") — cannot confirm the singleton; failing closed",
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
if (nonBlank(overview.name)) {
|
|
375
|
+
emitFailure("collision", {
|
|
376
|
+
cause:
|
|
377
|
+
"a shopper already exists — a user has exactly ONE shopper. Shop a new niche (it lazily mints a"
|
|
378
|
+
+ " domain on the spot) or refine the existing shopper; never mint a second shopper.",
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
// Run the host-native agent list (ordered before the add) — a CLI error is
|
|
382
|
+
// inconclusive and fails closed; the config file is the authoritative clash source.
|
|
383
|
+
const listRes = runOpenclaw(["agents", "list", "--json"], configPath);
|
|
384
|
+
if (!listRes.ok) {
|
|
385
|
+
emitFailure("persistence_failed", {
|
|
386
|
+
path: configPath,
|
|
387
|
+
cause: "could not list host agents (`openclaw agents list --json` failed) — failing closed",
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
if (existingAgentIds(preConfig).includes(agentId)) {
|
|
391
|
+
emitFailure("collision", {
|
|
392
|
+
cause: "the agentId " + JSON.stringify(agentId)
|
|
393
|
+
+ " already exists in the host agents.list — refusing to overwrite an existing agent's persona or wiring.",
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// --- 4. Snapshot openclaw.json (the teardown anchor) BEFORE the first mutation ---
|
|
398
|
+
const snapshot = readFileSync(configPath, "utf8");
|
|
399
|
+
const mode = statSync(configPath).mode & 0o777;
|
|
400
|
+
const bakPreexisted = existsSync(configPath + ".bak");
|
|
401
|
+
const workspacePreexisted = existsSync(workspace);
|
|
402
|
+
const shopperDirPreexisted = existsSync(getShopperArtefactDir());
|
|
403
|
+
const teardownCtx = {
|
|
404
|
+
configPath,
|
|
405
|
+
snapshot,
|
|
406
|
+
mode,
|
|
407
|
+
bakPreexisted,
|
|
408
|
+
workspace,
|
|
409
|
+
workspacePreexisted,
|
|
410
|
+
shopperDirPreexisted,
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
/** Unwind everything and emit the honest terminal outcome: persistence_failed
|
|
414
|
+
* when teardown fully reverted, the LOUDER teardown_failed when it could not. */
|
|
415
|
+
const failAndTeardown = (path, cause) => {
|
|
416
|
+
const residue = teardown(teardownCtx);
|
|
417
|
+
if (residue.length > 0) {
|
|
418
|
+
emitFailure("teardown_failed", {
|
|
419
|
+
path,
|
|
420
|
+
cause,
|
|
421
|
+
residue,
|
|
422
|
+
note: "teardown could NOT fully revert — the host was NOT returned to its pre-run state; the residue above remains",
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
emitFailure("persistence_failed", { path, cause });
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
// --- 5. Create the host agent shell (workspace bootstrap: SOUL.md, AGENTS.md, …) ---
|
|
429
|
+
const addRes = runOpenclaw(
|
|
430
|
+
["agents", "add", agentId, "--workspace", workspace, "--non-interactive", "--json"],
|
|
431
|
+
configPath,
|
|
432
|
+
);
|
|
433
|
+
if (!addRes.ok) {
|
|
434
|
+
failAndTeardown(configPath, "`openclaw agents add` failed: " + (addRes.stderr || "non-zero exit"));
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
// --- 6. Write the persona into the workspace SOUL.md (host CLI has no writer) ---
|
|
438
|
+
const soulPath = join(workspace, "SOUL.md");
|
|
439
|
+
try {
|
|
440
|
+
atomicWrite(soulPath, persona.endsWith("\n") ? persona : persona + "\n");
|
|
441
|
+
} catch (err) {
|
|
442
|
+
failAndTeardown(soulPath, "could not write SOUL.md: " + errCause(err));
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
// --- 7. Materialize the shared user spec — REUSED lib; NO domain at create ---
|
|
446
|
+
const mat = materializeProfile({ name, userSpec });
|
|
447
|
+
if (!mat.ok) {
|
|
448
|
+
const path = mat.kind === "persistence_failed" ? (mat.error?.split(":")[0] ?? getShopperArtefactDir()) : getShopperArtefactDir();
|
|
449
|
+
failAndTeardown(path, "sil_profile_materialize " + mat.kind + ": " + (mat.message ?? mat.error ?? "failed"));
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
// --- 8. Attach the sil skill + enable the sil plugin (value-mode, --strict-json) ---
|
|
453
|
+
const postAddConfig = readConfig(configPath);
|
|
454
|
+
const idx = agentIndex(postAddConfig, agentId);
|
|
455
|
+
if (idx < 0) {
|
|
456
|
+
failAndTeardown(configPath, "the created agent " + JSON.stringify(agentId) + " is not in agents.list after `openclaw agents add`");
|
|
457
|
+
}
|
|
458
|
+
const skillRes = runOpenclaw(
|
|
459
|
+
["config", "set", `agents.list[${idx}].skills`, '["sil"]', "--strict-json"],
|
|
460
|
+
configPath,
|
|
461
|
+
);
|
|
462
|
+
if (!skillRes.ok) {
|
|
463
|
+
failAndTeardown(configPath, "attaching the sil skill failed: " + (skillRes.stderr || "non-zero exit"));
|
|
464
|
+
}
|
|
465
|
+
const enableRes = runOpenclaw(
|
|
466
|
+
["config", "set", "plugins.entries.sil.enabled", "true", "--strict-json"],
|
|
467
|
+
configPath,
|
|
468
|
+
);
|
|
469
|
+
if (!enableRes.ok) {
|
|
470
|
+
failAndTeardown(configPath, "enabling the sil plugin failed: " + (enableRes.stderr || "non-zero exit"));
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
// --- 9. Admit sil at the three allow surfaces — REUSED whole allowlist bin ---
|
|
474
|
+
let allowlistOk = true;
|
|
475
|
+
let allowlistCause = "";
|
|
476
|
+
try {
|
|
477
|
+
execFileSync(process.execPath, [ALLOWLIST_BIN], {
|
|
478
|
+
env: { ...process.env, OPENCLAW_CONFIG_PATH: configPath },
|
|
479
|
+
encoding: "utf8",
|
|
480
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
481
|
+
});
|
|
482
|
+
} catch (err) {
|
|
483
|
+
allowlistOk = false;
|
|
484
|
+
allowlistCause = typeof err?.stderr === "string" && err.stderr.trim().length > 0
|
|
485
|
+
? err.stderr.trim()
|
|
486
|
+
: "non-zero exit";
|
|
487
|
+
}
|
|
488
|
+
if (!allowlistOk) {
|
|
489
|
+
// A failed admission leaves the sil_* tools filtered — NEVER a green `created`.
|
|
490
|
+
failAndTeardown(configPath, "the sil-openclaw-allowlist admission helper failed: " + allowlistCause);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
// --- 10. Validate with the host's OWN check — success keys off `.valid` ---
|
|
494
|
+
// The shim/host writes its structured verdict to stdout even on a non-zero exit,
|
|
495
|
+
// so read stdout regardless of the exit code (fail closed if it is not JSON).
|
|
496
|
+
const validateRes = runOpenclaw(["config", "validate", "--json"], configPath);
|
|
497
|
+
let verdict = null;
|
|
498
|
+
try {
|
|
499
|
+
verdict = JSON.parse(validateRes.stdout);
|
|
500
|
+
} catch {
|
|
501
|
+
verdict = null;
|
|
502
|
+
}
|
|
503
|
+
if (verdict === null || verdict.valid !== true) {
|
|
504
|
+
const issues = verdict && verdict.issues !== undefined ? JSON.stringify(verdict.issues) : undefined;
|
|
505
|
+
const cause = verdict && (verdict.error || verdict.message)
|
|
506
|
+
? String(verdict.error || verdict.message)
|
|
507
|
+
: "`openclaw config validate` did not return valid: true";
|
|
508
|
+
failAndTeardown(configPath, issues ? cause + " — issues: " + issues : cause);
|
|
509
|
+
}
|
|
510
|
+
|
|
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 });
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
main();
|
package/sil-shopping/SKILL.md
CHANGED
|
@@ -22,6 +22,25 @@ These three principles hold on every path, before any reference is loaded:
|
|
|
22
22
|
|
|
23
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
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.
|
|
31
|
+
|
|
32
|
+
## After a bare search — name what a shopper would add (recurring, by design)
|
|
33
|
+
|
|
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.
|
|
35
|
+
|
|
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:
|
|
37
|
+
|
|
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.
|
|
41
|
+
|
|
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).
|
|
43
|
+
|
|
25
44
|
## Routing — match intent to a tool, load its reference on demand
|
|
26
45
|
|
|
27
46
|
| Intent | Tool | Reference to load |
|
|
@@ -40,7 +59,7 @@ Confirm the `sil_*` tools are exposed. If they are missing from the available to
|
|
|
40
59
|
|
|
41
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.
|
|
42
61
|
|
|
43
|
-
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. The one shopper shops every niche; a plain, profile-less session keeps shopping via the "find X" → `sil_search` row above, unchanged.
|
|
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.
|
|
44
63
|
|
|
45
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.
|
|
46
65
|
|
|
@@ -1,14 +1,27 @@
|
|
|
1
1
|
# Create your sil-wired shopper — the agent-creation engine
|
|
2
2
|
|
|
3
|
-
**Precondition: run this ONLY after the user has explicitly endorsed the assembled draft from [`brainstorm_interview.md`](brainstorm_interview.md).**
|
|
3
|
+
**Precondition: run this ONLY after the user has explicitly endorsed the assembled draft from [`brainstorm_interview.md`](brainstorm_interview.md).** Anything below before that endorsement is forbidden — the interview owns the gate.
|
|
4
4
|
|
|
5
5
|
When the user wants to **set up shopping**, author and persist **one** valid OpenClaw agent profile — the user's **shopper**: a real new agent under the host `agents` config, with the **sil plugin enabled**, the **sil skill attached**, its persona written into the workspace **`SOUL.md`**, plus the shopper's **shared user spec** in the sil data directory — so it shops with **no further setup**. The shopper is a **singleton**: you create it **once**, then it learns **domains** (niches) lazily on first shop — you never mint a second shopper.
|
|
6
6
|
|
|
7
|
-
The shopper runs **entirely on Spec-Driven Shopping (SDS)** — the operating model, not an optional layer. At create time
|
|
7
|
+
The shopper runs **entirely on Spec-Driven Shopping (SDS)** — the operating model, not an optional layer. At create time exactly **one** sil artefact is persisted: the **shared, agent-level `userSpec`** (the person's cross-niche facts + hard constraints, seeded *partial* by the interview). **No** niche is researched and **no** per-domain pack is written at create time — there is **no** `domainSpec` / `intentSpec` / `playbook` here. Those are minted **lazily, per niche, on first shop** ([`shop_loop.md`](shop_loop.md)) into `domains/<slug>/`. A freshly-created shopper has an **empty `domains` map** — that is **healthy**, not a deficiency.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## The one command
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
After the explicit endorsement, you run exactly **ONE** shipped command — the package `bin` **`sil-openclaw-create-shopper`** — and it runs the whole choreography **atomically** and fail-closed. You do **NOT** hand-run the nine host-CLI steps yourself; the bin runs them **for you, in order, as one transaction**, then returns a single structured JSON result. Feed it the endorsed spec as **one JSON object on `stdin`** (or via **`--spec <path>`**):
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
sil-openclaw-create-shopper <<'JSON'
|
|
15
|
+
{ "agentId": "my-shopper", "name": "My Shopper", "workspace": "~/.openclaw/workspace-my-shopper",
|
|
16
|
+
"persona": "…the endorsed persona…", "userSpec": "…the seeded shared user spec…" }
|
|
17
|
+
JSON
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Passing the multiline `persona` / `userSpec` as JSON dodges shell-arg escaping. The bin is **non-interactive**: it executes an **already-assembled, already-endorsed** spec — it never re-runs the interview and never prompts (the endorsement gate lives upstream in the interview; the bin's own validate-first + singleton pre-flight still protect a direct caller). Creation is **local and offline** — the bin reads **no token**, performs **no** `sil_register` / `sil_whoami`, and makes **no network call**. The `sil` **plugin** and `sil` **skill** are always wired (that is what makes it *sil-wired*). Do **not** present sil registration as a prerequisite — the shopper registers the user later, on first shop, via `sil_register`.
|
|
21
|
+
|
|
22
|
+
> The bin is a standalone operator script (the same class as the other shipped `sil-openclaw` operator bins), **not** the plugin process — so the plugin's `noChildProcess` / "never write host config" guarantee is intact; the bin legitimately drives the host `openclaw …` CLI on your behalf.
|
|
23
|
+
|
|
24
|
+
## The profile spec (input) — the JSON the bin reads
|
|
12
25
|
|
|
13
26
|
The endorsed draft feeds two stores. The **persona** becomes the host workspace **`SOUL.md`** (its identity / voice / standing rules — via the host CLI, **not** a sil artefact). The **shared user spec** becomes the sil data-dir artefact:
|
|
14
27
|
|
|
@@ -22,53 +35,51 @@ The endorsed draft feeds two stores. The **persona** becomes the host workspace
|
|
|
22
35
|
|
|
23
36
|
There is **no** per-niche input at create time. The deep `domainSpec`, the derived `intentSpec` schema, and the niche `playbook` are **not** authored here — they are researched and minted on first shop in each niche.
|
|
24
37
|
|
|
25
|
-
The **sil plugin** and **sil skill** are always attached (that is what makes it *sil-wired*). Creation is **local and offline** — it does **not** require or perform sil registration, reads no token, and writes nothing to identity storage. The shopper registers the user later, on first shop, via `sil_register`. Do **not** present registration as a prerequisite.
|
|
26
|
-
|
|
27
38
|
## The created shopper needs WEB tools
|
|
28
39
|
|
|
29
|
-
The shopper **lazily mints a domain on first shop** (its research pass reaches the web) and **web-refreshes each domain spec on every query**. So the created agent must have **web/fetch tools in its tool profile** — inherited from `agents.defaults` when its shell is created
|
|
40
|
+
The shopper **lazily mints a domain on first shop** (its research pass reaches the web) and **web-refreshes each domain spec on every query**. So the created agent must have **web/fetch tools in its tool profile** — inherited from `agents.defaults` when its shell is created. If `agents.defaults` does **not** grant a web tool, the bin reports **`created` with a `warnings` entry** naming the gap (bare `sil_search` still works, so it does **not** hard-fail) — it never silently swallows the gap and never pretends the research happened. Surface that warning to the user.
|
|
30
41
|
|
|
31
|
-
##
|
|
42
|
+
## What the bin does atomically (the choreography it runs for you, in this exact order)
|
|
32
43
|
|
|
33
|
-
1. **
|
|
44
|
+
1. **Validates the spec FIRST — before anything is written.** It checks `agentId` (present, lower-kebab, ≠ `main`), `name`, `persona`, `workspace`, and the **shared `userSpec` — present and non-blank** (the only sil artefact at create; seeded *partial* by the interview, never omitted). There is **no** `domainSpec` / `intentSpec` / `playbook` to validate here. On any failure it stops with **`invalid_request`** naming the field and **writes nothing**. This runs ahead of every host command, so a bad spec never reaches the host.
|
|
34
45
|
|
|
35
|
-
2. **Singleton check — a user has exactly ONE shopper.** The
|
|
46
|
+
2. **Singleton check — a user has exactly ONE shopper.** The bin runs `openclaw agents list --json` and reads the sil artefact store (the no-args `sil_profile_get` overview, `ok` empty-is-healthy when no shopper exists) **before** the add; if a sil shopper **already exists**, it stops with **`collision`** — **"a shopper already exists"** — and **does not** run `openclaw agents add`. That steers the user to **shop a new niche** (which lazily mints a domain on the spot) or **refine the existing shopper** — **never mint a second shopper**. An `agentId` that collides with any existing agent is likewise refused (`collision`) — never overwriting an existing agent's persona or wiring. If either read is **inconclusive** (a CLI error, a degraded store), the bin fails closed rather than fabricate a "no shopper" verdict.
|
|
36
47
|
|
|
37
|
-
3. **
|
|
48
|
+
3. **Creates the agent shell (host CLI).** It runs:
|
|
38
49
|
```
|
|
39
50
|
openclaw agents add <agentId> --workspace <workspace> --non-interactive --json
|
|
40
51
|
```
|
|
41
|
-
This creates the real `agents.list[]` entry and the workspace bootstrap files (`SOUL.md`, `AGENTS.md`, …), inheriting model and **tool profile** (which must grant **web/fetch** — see above) from `agents.defaults`. `--non-interactive --json`
|
|
52
|
+
This creates the real `agents.list[]` entry and the workspace bootstrap files (`SOUL.md`, `AGENTS.md`, …), inheriting model and **tool profile** (which must grant **web/fetch** — see above) from `agents.defaults`. `--non-interactive --json` drives it without a prompt.
|
|
42
53
|
|
|
43
|
-
4. **
|
|
54
|
+
4. **Writes the persona into the workspace `SOUL.md` (host CLI).** The persona is the shopper's soul / system framing — the host's `SOUL.md`, **not** a sil artefact. The bin writes the endorsed persona text **straight into** the new agent's `SOUL.md`. There is **no** `persona.md` in the sil store and **no copy** step — the persona lives in exactly one place.
|
|
44
55
|
|
|
45
|
-
5. **
|
|
56
|
+
5. **Materializes the shared user spec — NO `domain`.** The bin calls **`sil_profile_materialize`** with **`{ name, userSpec }`** — the shared `userSpec` seeded by the interview. The shopper is a singleton, so this takes **no `agentId`**. **With no `domain`** at create, the tool writes the shared **`user_spec.md`** + **`profile.json`** (with an **empty `domains: {}` map**) into the fixed **`$SIL_DATA_DIR/shopper/`**, atomically. There is **no** `domain_spec.md` / `intent_spec.md` / `playbook.md` yet — the first shop in a niche mints that niche's pack (with a `domain` object) lazily. On `invalid_request` it wrote nothing; on `persistence_failed` it left nothing partial.
|
|
46
57
|
|
|
47
|
-
6. **
|
|
58
|
+
6. **Wires the sil skill + plugin (host CLI).** Asserted against the pinned host — **`alpine/openclaw:2026.6.9`** — both value-mode sets with `--strict-json` (the only set mode this image accepts):
|
|
48
59
|
```
|
|
49
60
|
openclaw config set 'agents.list[<i>].skills' '["sil"]' --strict-json
|
|
50
61
|
openclaw config set plugins.entries.sil.enabled true --strict-json
|
|
51
62
|
```
|
|
52
|
-
The skill attach makes the agent **know how** to drive the tools; the plugin enable turns the sil plugin **on** — but it does **not** by itself un-filter the `sil_*` tools (see the admission step next).
|
|
63
|
+
The skill **attach** makes the agent **know how** to drive the tools; the plugin **enable** turns the sil plugin **on** — but it does **not** by itself un-filter the `sil_*` tools (see the admission step next). `sil` stays in the agent's skill list and the `sil_*` tools are not denied.
|
|
53
64
|
|
|
54
|
-
7. **
|
|
55
|
-
```
|
|
56
|
-
sil-openclaw-allowlist
|
|
57
|
-
```
|
|
58
|
-
It re-confirms the plugin-enable as an idempotent no-op, so re-running it on every creation never duplicates or clobbers an existing entry. **If the helper exits non-zero (a failed admission), report `persistence_failed` with the path + cause and do NOT declare `created`** — never a green `created` over still-filtered tools, exactly as a rejected `openclaw config validate` is handled in the next step.
|
|
65
|
+
7. **Admits sil at the host allow surfaces — the shipped helper.** Enabling the plugin is necessary but not sufficient: until `sil` is admitted at the **global** allow surfaces `plugins.allow` + **`tools.alsoAllow`**, the host keeps the `sil_*` tools **filtered**. Admission is **plugin-ID only** — no per-tool key. The value-mode `openclaw config set` above is **overwrite-only** on this image, so it cannot additively merge those shared global arrays without clobbering another already-admitted plugin (e.g. `klodi`). The bin therefore runs the shipped admission helper — the sibling package `bin` `sil-openclaw-allowlist` (same artefact as the `openclaw:allowlist` script) — which performs the **additive, idempotent, atomic, self-validating** three-surface merge (`plugins.allow` + `tools.alsoAllow` + `plugins.entries.sil`). **If the helper exits non-zero (a failed admission), the bin reports `persistence_failed` with the path + cause and does NOT declare `created`** — never a green `created` over still-filtered tools.
|
|
59
66
|
|
|
60
|
-
8. **
|
|
67
|
+
8. **Validates with the host's OWN check, THEN declares created.** The bin runs `openclaw config validate --json`. The verdict is `{ valid, path, issues? }` — success keys off **`.valid`**, never an `ok` field. Only when `valid: true` **and** the admission (step 7) succeeded does it report **`created`**. If `valid: false`, the admission helper exited non-zero, or any step failed, it reports **`persistence_failed`** with the failing **path** + **cause** (the `issues?`).
|
|
61
68
|
|
|
62
|
-
9. **
|
|
69
|
+
9. **On any failure after writes begin, tears down — leaving nothing partial.** The bin snapshots `openclaw.json` before step 3 and, on any failure, **restores that whole-file snapshot** (reversing the `agents.list` entry + the skill + the plugin + the trust admission in one atomic op), then removes the workspace dir (only if it created it) and the singleton shopper dir (only if it did not pre-exist). This returns the host to its **exact pre-run state** — a co-installed `klodi` that was trusted pre-run stays trusted — so `persistence_failed` truthfully means **nothing partial** is left.
|
|
70
|
+
|
|
71
|
+
The bin emits **one** `{ status, … }` JSON result and exits 0 **only** on `created`.
|
|
63
72
|
|
|
64
73
|
## Status taxonomy (agent-creation engine)
|
|
65
74
|
|
|
66
75
|
| `status` | Meaning | What to do |
|
|
67
76
|
|---|---|---|
|
|
68
|
-
| `created` | Shopper added, shared user spec materialized, sil plugin + skill wired, `openclaw config validate` accepted it. | Tell the user it's ready and how to open it. |
|
|
69
|
-
| `invalid_request` | Spec failed validation (missing/blank field). **Nothing
|
|
70
|
-
| `collision` | A shopper already exists (the singleton). | Surface it — "a shopper already exists"; steer to shop-a-new-niche (lazy mint) or refine. **Never mint a second shopper.** |
|
|
71
|
-
| `persistence_failed` | A write, the allow-list admission helper (non-zero exit), or `openclaw config validate` step failed. **
|
|
77
|
+
| `created` | Shopper added, shared user spec materialized, sil plugin + skill wired, `openclaw config validate` accepted it. Carries `name` + `agentId` + `workspace`. | Tell the user it's ready and how to open it. |
|
|
78
|
+
| `invalid_request` | Spec failed validation (missing/blank field). **Nothing attempted.** | Name the field, fix it, run the command again — nothing reached `openclaw agents add`. |
|
|
79
|
+
| `collision` | A shopper already exists (the singleton), or the `agentId` clashes. **Nothing written.** | Surface it — "a shopper already exists"; steer to shop-a-new-niche (lazy mint) or refine. **Never mint a second shopper.** |
|
|
80
|
+
| `persistence_failed` | A write, the allow-list admission helper (non-zero exit), or `openclaw config validate` step failed. Teardown ran — **nothing partial** left. | Fix the reported path/cause, run the command again (a re-run is safe). |
|
|
81
|
+
|
|
82
|
+
In the **rare** case teardown itself cannot fully revert (e.g. the agent was added but reverting it fails), the bin reports a **distinct, louder** outcome that **names the residue** — do **not** voice that as `persistence_failed`'s "nothing partial"; tell the user exactly what remains and where.
|
|
72
83
|
|
|
73
84
|
## Runtime — how the shopper loads its behaviour
|
|
74
85
|
|
|
@@ -76,4 +87,4 @@ When you (the sil skill) start a session as the shopper, the host has already in
|
|
|
76
87
|
- the **shared `user_spec.md`** — the person's cross-niche facts + hard constraints (seeded partial, augmented per-query), reused across **every** niche;
|
|
77
88
|
- the slug-keyed **`domains`** map — the niches the shopper has already learned. An **empty** map is healthy; the per-domain packs (`domains/<slug>/{domain_spec,intent_spec,playbook}.md`) load **lazily at shop time**, not here.
|
|
78
89
|
|
|
79
|
-
Loading these is what lets the shopper shop any niche with no further setup. When the user states a shopping intent, shop per [`shop_loop.md`](shop_loop.md) — the loop that classifies the niche, **reuses an existing domain or mints one on the fly**, then on **every query** web-refreshes that domain's spec, decomposes the request along its intent-spec dimensions (the ephemeral per-query intent), and **learns** every query (a fact → the shared `user_spec.md`, a taste → the active domain's `playbook.md`, each via a single `sil_remember` append). To sharpen the shopper or one of its domains from observed sessions, see [`refine_shopper.md`](refine_shopper.md).
|
|
90
|
+
Loading these is what lets the shopper shop any niche with no further setup. When the user states a shopping intent, shop per [`shop_loop.md`](shop_loop.md) — the loop that classifies the niche, **reuses an existing domain or mints one on the fly**, then on **every query** web-refreshes that domain's spec, decomposes the request along its intent-spec dimensions (the ephemeral per-query intent), and **learns** every query (a fact → the shared `user_spec.md`, a taste → the active domain's `playbook.md`, each via a single `sil_remember` append). Because the `sil_*` tools were admitted at create, the shopper calls **`sil_search`** / **`sil_product_get`** (and `sil_register` / `sil_whoami` as needed) on the user's intent with **no further setup**, minting each niche's domain pack on the fly the first time the user shops it. To sharpen the shopper or one of its domains from observed sessions, see [`refine_shopper.md`](refine_shopper.md).
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
# Set up your shopper — the onboarding interview
|
|
2
2
|
|
|
3
|
-
When the user asks to **set up shopping** — "create my shopper", "set up an agent that shops for me", "I want something that shops for me" — do **not** jump to the engine. Run a short, **two-touchpoint** onboarding that shapes the shopper *with* the user
|
|
3
|
+
When the user asks to **set up shopping** — "create my shopper", "set up an agent that shops for me", "I want something that shops for me" — do **not** jump to the engine. Run a short, **two-touchpoint** onboarding that shapes the shopper *with* the user — **pre-seeded from what they already said this session** — then **create nothing** until the user endorses the assembled draft. The agent-creation engine ([`agent_creation_engine.md`](agent_creation_engine.md)) only runs **after** that explicit endorsement.
|
|
4
4
|
|
|
5
|
-
This is a **conversation, not a form-fill** — and a **short** one. The shopper is a **generalist**: it goes deep on whatever the user later buys, **lazily minting a domain on first shop in each niche**. So onboarding does **NOT** research any niche and does **NOT** ask the user to pick one. It touches exactly **two** things: the **persona** (how their shopper should behave) and a **shared user-spec seed** (cross-niche facts + hard constraints). Everything niche-specific — how to shop a niche well, what each request in it should resolve, the niche shopping taste — is **deferred to first shop**, not authored here.
|
|
5
|
+
This is a **conversation, not a form-fill** — and a **short** one. Because you **pre-seed** from the session, you open by **reflecting a filled draft back**, not with a cold question. The shopper is a **generalist**: it goes deep on whatever the user later buys, **lazily minting a domain on first shop in each niche**. So onboarding does **NOT** research any niche and does **NOT** ask the user to pick one. It touches exactly **two** things: the **persona** (how their shopper should behave) and a **shared user-spec seed** (cross-niche facts + hard constraints). Everything niche-specific — how to shop a niche well, what each request in it should resolve, the niche shopping taste — is **deferred to first shop**, not authored here.
|
|
6
|
+
|
|
7
|
+
## Session pre-seed — open with a reflected draft, never a cold question
|
|
8
|
+
|
|
9
|
+
Before you ask anything, assemble a **draft** from what the user has **already said** *this session*: the **persona** (their own words on how the shopper should behave) and the **shared user-spec seed** (any sizes, hard limits, or ethics rules they mentioned in passing). Then **open by reflecting that draft back** — *"from what you've told me, here's the shopper I'd set up…"* — and ask only to **confirm-or-adjust**. That is the **rich** (a filled draft, so the shopper demonstrably listened) + **light** (one confirm) shape.
|
|
10
|
+
|
|
11
|
+
- **Pre-seed, don't interrogate.** **Pre-fill** the persona + the shared `user_spec` from the session; ask only to fill genuine gaps, never to re-collect what the user already told you.
|
|
12
|
+
- **Never invent facts you did not hear.** If the session gave little, seed a **minimal honest** draft ("cross-niche facts to be learned as we shop; no hard constraints stated yet") and say so — never fabricate a size or a limit.
|
|
13
|
+
- **Session-only — local + offline.** The seed is assembled **only** from this conversation. It does **NOT** pull `sil_whoami`, reads **no** token, and makes no network call. (The shopper registers the user later, on first shop, via `sil_register` — never a prerequisite here.)
|
|
14
|
+
- **The endorsement gate is untouched.** A rich pre-fill is a **proposal**, never consent — see the gate in §3 below.
|
|
6
15
|
|
|
7
16
|
## The two onboarding touchpoints — persona + shared user spec
|
|
8
17
|
|
|
@@ -10,52 +19,53 @@ A created shopper runs on a persona (`SOUL.md`) plus the **shared, agent-level `
|
|
|
10
19
|
|
|
11
20
|
| Artefact | Where | What it holds | Seeded |
|
|
12
21
|
|---|---|---|---|
|
|
13
|
-
| **`SOUL.md`** (persona) | host workspace (via host CLI) | the shopper's identity / voice / standing rules — a **generalist**, not a niche specialist |
|
|
14
|
-
| **`user_spec.md`** (shared) | sil data dir (**required**) | the user's **cross-niche** facts + hard constraints (addresses, sizes, allergy/ethics rules, budget psychology) | seeded partial
|
|
22
|
+
| **`SOUL.md`** (persona) | host workspace (via host CLI) | the shopper's identity / voice / standing rules — a **generalist**, not a niche specialist | pre-seeded from the session (§1 below); refined on persona refine, stable per query |
|
|
23
|
+
| **`user_spec.md`** (shared) | sil data dir (**required**) | the user's **cross-niche** facts + hard constraints (addresses, sizes, allergy/ethics rules, budget psychology) | pre-seeded partial from the session (§2); augmented every query, reused across **every** niche |
|
|
15
24
|
|
|
16
25
|
The niche packs — the deep niche know-how, the per-request template a query is resolved against, and the niche shopping taste — are **NOT** authored here; they are minted **on first shop in each niche** ([`shop_loop.md`](shop_loop.md)). The per-query fill (the template filled in for one request) is **ephemeral** — never persisted, never authored here.
|
|
17
26
|
|
|
18
27
|
## Principles for the interview
|
|
19
28
|
|
|
29
|
+
- **Pre-seed from the session; open with the draft.** Assemble the persona + shared user-spec draft from what the user already said, and lead with it (reflect-back), not a cold questionnaire. The interview is **rich but light** — a filled draft plus one confirm-or-adjust per touchpoint.
|
|
20
30
|
- **Two touchpoints, no niche research.** Touch the persona and the shared user spec — that is the whole onboarding. The shopper is a **generalist**; there is **no narrow-the-niche step** and **no domain interview**. The deep niche expertise is researched **lazily, at first shop**, never interrogated here.
|
|
21
|
-
- **The persona question shapes voice, not a niche.**
|
|
22
|
-
- **Seed the shared facts, ask little.** The shared user spec holds cross-niche facts + hard constraints that carry across every niche. Seed what the user
|
|
31
|
+
- **The persona question shapes voice, not a niche.** The persona surfaces the **voice / standing rules** — terse vs. chatty, cautious vs. opinionated, any never-break rules. It does **not** bind the shopper to one niche.
|
|
32
|
+
- **Seed the shared facts, ask little.** The shared user spec holds cross-niche facts + hard constraints that carry across every niche. Seed what the user volunteered — don't run a questionnaire; the rest is **augmented per-query** at shop time.
|
|
23
33
|
- **Converge, don't accumulate.** Reflect a short summary back and get a yes/adjust before advancing. The flow is **collaborative** and **re-entrant** — the user can revise an earlier touchpoint at any point.
|
|
24
34
|
- **Endorsement is a gate, not a formality.** Until the user explicitly says "create it", run **zero** engine steps. The draft lives only in the conversation.
|
|
25
35
|
|
|
26
36
|
## Run the interview in this order — two touchpoints
|
|
27
37
|
|
|
28
|
-
### 1. `SOUL.md` —
|
|
38
|
+
### 1. `SOUL.md` — persona + behaviour (a generalist shopper), pre-seeded
|
|
29
39
|
|
|
30
|
-
Open by reflecting the
|
|
40
|
+
Open by **reflecting the session-seeded persona draft back** ("from what you've told me, your shopper sounds like…"), then confirm-or-adjust its **voice/tone** (terse vs. chatty, cautious vs. opinionated) and any **standing rules** it should always follow. Only ask the persona/identity question cold if the session gave you nothing to reflect. This is the shopper's **system framing**, a **generalist** that will shop whatever the user buys — **not** a niche choice; the niche is decided later, per query, when the user actually shops. This becomes the host workspace **`SOUL.md`** (the persona is the agent's system framing — **not** a sil artefact, no `persona.md`).
|
|
31
41
|
|
|
32
42
|
### 2. `user_spec.md` (shared) — seed the cross-niche facts + hard constraints
|
|
33
43
|
|
|
34
|
-
|
|
44
|
+
**Pre-fill** the **shared user spec** from the session: the user's **cross-niche** facts and any **hard constraints** that should hold in *every* niche — addresses / sizes the user volunteered, an allergy or ethics rule ("never leather"), a budget psychology. Reflect the pre-filled seed back and mark each as **hard** (inviolable — an allergy, an ethics rule, an age gate) vs **soft** (a bendable preference). Don't run a questionnaire — seed what the user offered; the rest is **augmented per-query** at shop time, and a niche-specific fact is learned when that niche is first shopped. If the user gave little, seed a minimal honest body (e.g. "cross-niche facts to be learned as we shop; no hard constraints stated yet") — non-blank, but partial. This lands in `userSpec` (→ the shared `user_spec.md`). **No niche taste, no domain question, no intent dimensions are gathered here** — those belong to first-shop lazy mint.
|
|
35
45
|
|
|
36
46
|
### 3. Derive the identity, assemble, endorse
|
|
37
47
|
|
|
38
48
|
- **Identity.** Propose an `agentId` (lower-kebab, `^[a-z0-9][a-z0-9-]*$`, never `main`) and a human-readable `name` ("My Shopper" / `my-shopper`). **Confirm both** — never silently invent them.
|
|
39
49
|
- **Assemble + present.** Compose **`{ agentId, name, persona, userSpec }`** and present a **readable summary**: who the shopper is (its persona/voice + standing rules) and the **seeded shared user spec** (cross-niche facts + hard constraints, partial, to grow per-query). Self-check the shape against the engine's contract: `agentId` lower-kebab & ≠ `main` (it keys the host `openclaw agents add`, not the sil tool), non-blank `name`/`persona`, and a non-blank shared `userSpec` — the only sil artefact at create (the engine passes just `name` + `userSpec` to the singleton `sil_profile_materialize`; no niche pack is authored here). This is shape-only — it writes nothing; the engine's validate-first step is the authoritative gate.
|
|
40
|
-
- **Endorse — the gate.** Ask for an explicit go-ahead ("shall I create your shopper?"). Endorsement is an **affirmative user act** on the assembled draft — "yes, create it" / "go ahead". It is **NOT** inferred from the user answering the last question, and **NOT** from silence. **Only on that explicit endorsement** do you proceed to the engine ([`agent_creation_engine.md`](agent_creation_engine.md)).
|
|
50
|
+
- **Endorse — the gate.** Ask for an explicit go-ahead ("shall I create your shopper?"). Endorsement is an **affirmative user act** on the assembled draft — "yes, create it" / "go ahead". It is **NOT** inferred from the user answering the last question, and **NOT** from silence. **Only on that explicit endorsement** do you proceed to the engine ([`agent_creation_engine.md`](agent_creation_engine.md)) and run the one command.
|
|
41
51
|
|
|
42
52
|
## Edge cases the interview handles gracefully
|
|
43
53
|
|
|
44
54
|
- **A shopper already exists (the singleton).** The shopper is a singleton — the engine refuses a second create (its `collision` outcome, "a shopper already exists") and never clobbers the existing one. Surface it and steer the user to **shop a new niche** (which lazily mints a domain on the spot) or **refine the existing shopper** — **never** mint a second shopper, never silently mutate the existing one.
|
|
45
55
|
- **Abandon mid-flow.** Because **no engine step runs before endorsement**, abandonment leaves **nothing created** — no host agent, no artefacts, no wiring, no teardown. Never "save progress" by writing artefacts early.
|
|
46
|
-
- **Creation is local + offline (for the user's identity).** Creating a shopper neither requires nor performs sil registration. Do **NOT** present sil registration or a token as a prerequisite to create the shopper;
|
|
56
|
+
- **Creation is local + offline (for the user's identity).** Creating a shopper neither requires nor performs sil registration. Do **NOT** present sil registration or a token as a prerequisite to create the shopper; the session seed does **not** pull `sil_whoami`, reads no token, and never reaches the network. It registers the user later, on first shop, via `sil_register`. (No web access is needed at onboarding either — the niche research that reaches the web happens later, at first shop.)
|
|
47
57
|
|
|
48
58
|
## Business rules (invariants the interview holds on every path)
|
|
49
59
|
|
|
50
60
|
1. **No creation without explicit endorsement.** Nothing is written — not the host agent, the `SOUL.md`, the shared user spec, or the wiring — until the user explicitly endorses. The draft lives only in the conversation until then.
|
|
51
|
-
2. **Abandon-mid-flow creates nothing.** No engine step runs pre-endorsement, so an abandoned interview leaves no partial shopper — automatic, not a teardown.
|
|
52
|
-
3. **Two touchpoints only — persona, then shared user spec.** `SOUL.md` (
|
|
61
|
+
2. **Abandon-mid-flow creates nothing.** No engine step runs pre-endorsement (**zero engine steps** before the explicit "yes"), so an abandoned interview leaves no partial shopper — automatic, not a teardown. Nothing is created, nothing partial.
|
|
62
|
+
3. **Two touchpoints only — persona, then shared user spec.** `SOUL.md` (persona/voice, a generalist, NOT a niche) and the shared `user_spec.md` (cross-niche facts + hard constraints), both **pre-seeded from the session**. **No** niche know-how, no niche shopping taste, and no per-request template work at onboarding — those move to first-shop lazy mint.
|
|
53
63
|
4. **No niche is researched or chosen at onboarding.** The shopper is a generalist; the deep niche know-how, the per-request template, and the niche shopping taste are minted **lazily, on first shop** in each niche ([`shop_loop.md`](shop_loop.md)). Onboarding never interrogates a niche or asks the user to pick one.
|
|
54
64
|
5. **Converge each touchpoint before advancing; stay re-entrant.** Reflect-and-confirm per touchpoint; let the user revise an earlier one.
|
|
55
65
|
6. **Singleton: refuse a second shopper; never clobber.** Defer to the engine's `collision` refusal ("a shopper already exists"); steer to shop-a-new-niche or refine.
|
|
56
|
-
7. **Creation is local + offline for the user's identity.** Never present sil registration / a token as a prerequisite to create.
|
|
66
|
+
7. **Creation is local + offline for the user's identity.** Never present sil registration / a token as a prerequisite to create, and never pull `sil_whoami` to seed — the seed is session-only.
|
|
57
67
|
8. **The persona is the host `SOUL.md`, not a sil artefact.** No `persona.md` in the sil store. The only sil artefact seeded at create is the **shared** `user_spec.md`; the niche packs (the deep niche know-how, the per-request template, the niche shopping taste) are minted later, per niche.
|
|
58
68
|
|
|
59
69
|
## After endorsement
|
|
60
70
|
|
|
61
|
-
Once the user has **explicitly endorsed** the assembled draft, proceed to [`agent_creation_engine.md`](agent_creation_engine.md) and run the
|
|
71
|
+
Once the user has **explicitly endorsed** the assembled draft, proceed to [`agent_creation_engine.md`](agent_creation_engine.md) and run the **one command**. Until that explicit endorsement, **zero engine steps** have run.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Shop-time loop — how the one shopper shops any niche, minting domains on the fly
|
|
2
2
|
|
|
3
|
-
Load this when you (the sil skill) are running as the user's **shopper** and they state a shopping intent ("find me something for a steak dinner around $40"). There is **ONE shopper** — a generalist that goes deep on whatever the user shops for — and it holds **many domains** (niches it has learned), each **minted lazily on first shop**. The [engine's Runtime hook](agent_creation_engine.md) ends where this loop begins: the host has injected the shopper's persona via the workspace **`SOUL.md`** (voice, standing rules, hard-no's), and the sil skill has read `$SIL_DATA_DIR/shopper/profile.json` — the **shared `user_spec.md`** (the person's cross-niche facts + hard constraints) plus the slug-keyed **`domains`** map. The per-niche packs load lazily, at shop time, per the
|
|
3
|
+
Load this when you (the sil skill) are running as the user's **shopper** and they state a shopping intent ("find me something for a steak dinner around $40"). There is **ONE shopper** — a generalist that goes deep on whatever the user shops for — and it holds **many domains** (niches it has learned), each **minted lazily on first shop**. The [engine's Runtime hook](agent_creation_engine.md) ends where this loop begins: the host has injected the shopper's persona via the workspace **`SOUL.md`** (voice, standing rules, hard-no's), and the sil skill has read `$SIL_DATA_DIR/shopper/profile.json` — the **shared `user_spec.md`** (the person's cross-niche facts + hard constraints) plus the slug-keyed **`domains`** map. The per-niche packs load lazily, at shop time, per the beats below.
|
|
4
4
|
|
|
5
5
|
This is **shop time**, not create time — behave like a specialist the user trusts, in the persona's voice. Consume the catalog tools **unchanged**; the rubric is applied by you at reasoning time, not by any new tool.
|
|
6
6
|
|
|
@@ -8,50 +8,71 @@ This is **Spec-Driven Shopping (SDS)** over **one shopper, many domains**. The *
|
|
|
8
8
|
|
|
9
9
|
The router's three always-on rules still hold (act-don't-narrate, follow the tool's own `recovery`, re-check the chosen item before commit) — this loop layers on top, it does not restate them.
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## The five-beat spine — the order IS the spec, non-skippable on every query
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Every shopping query runs these five beats **in order**; the order is not a suggestion. "Non-skippable" governs your **reasoning**, not the user's inbox — every beat RUNS every query, but a beat only ASKS the user when something is genuinely unresolved (a fully-resolved query asks nothing and passes straight through):
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
1. **Domain-exists check first** — classify the query's niche, read `profile.json.domains` (via the no-args `sil_profile_get`), reuse a semantically-matching domain or register a miss. This precedes search — the shopper never reaches search without first resolving which domain the query belongs to.
|
|
16
|
+
2. **Learn the domain on a miss** — mint the domain on the fly (deep `domain_spec` + derived `intent_spec` + partial `playbook`), or web-refresh it on a hit. Either way the pack is present and current before the gate; the shopper never searches a niche it does not hold.
|
|
17
|
+
3. **Gather what's missing from the user, before searching** — the elicitation gate: decompose the request, resolve each dimension against the request + the shared `user_spec` + the active `playbook` (+ `domain_spec` defaults) FIRST, then ask **only for what is genuinely unresolved**. Runs to completion before any `sil_search`.
|
|
18
|
+
4. **Persist what surfaced** — append each surfaced fact/taste with a single `sil_remember`, fired only when something new surfaced.
|
|
19
|
+
5. **Then search → rubric → recommend-with-why → re-fetch before purchase.**
|
|
20
|
+
|
|
21
|
+
## Beat 1 — Domain-exists check first (every query, non-skippable)
|
|
22
|
+
|
|
23
|
+
Before anything else, decide *which domain this query belongs to* and make sure the shopper holds it. No agent switch and no re-onboarding ever happens here — the **one** shopper handles every niche in the same session. This check is **non-skippable**: the shopper never reaches search without first resolving the domain.
|
|
24
|
+
|
|
25
|
+
### Classify the query's niche (skill reasoning — no tool call)
|
|
16
26
|
|
|
17
27
|
From the user's words, name the **shopping niche** this request belongs to ("a waterproof trail shoe for a wet ultra next month" → trail running; "a first road bike" → road cycling). This is your own reasoning, not a tool call — you need the niche to decide whether the shopper already knows it.
|
|
18
28
|
|
|
19
|
-
###
|
|
29
|
+
### Reuse an existing domain before minting — semantic slug dedup is YOUR job
|
|
20
30
|
|
|
21
|
-
Read `profile.json.domains` (via the no-args `sil_profile_get`) and match the classified niche against the slugs the shopper already holds **semantically — not by exact string**. If an existing domain covers this niche, **reuse it**: load that pack and go straight to the
|
|
31
|
+
Read `profile.json.domains` (via the no-args `sil_profile_get`) and match the classified niche against the slugs the shopper already holds **semantically — not by exact string**. If an existing domain covers this niche, **reuse it**: load that pack and go straight to the gate. The store enforces only *shape* (valid kebab, upsert-by-key) — it will happily mint `cycling`, `road-cycling`, and `bikes` as three thin packs for the **same** niche. **Reuse-before-mint is the shop loop's job**, load-bearing: without it the one shopper fragments into duplicate shallow domains and the "shop deep" promise dies. When torn between a close existing slug and a new one, **prefer the existing slug** — reuse over fragment. When no existing domain matches, register a **miss** — and learn it in Beat 2.
|
|
22
32
|
|
|
23
|
-
|
|
33
|
+
## Beat 2 — On a miss, learn the domain and how SDS decomposes in it
|
|
24
34
|
|
|
25
|
-
|
|
35
|
+
The pack must be present **and current** before the gate. On a **miss**, mint the niche on the fly — the research that used to run at create time runs **here, on first shop in this niche**. On a **hit** (a reused domain), the parallel web-refresh keeps that domain's spec current. Either way the shopper never searches a niche it does not hold-and-currently-know.
|
|
36
|
+
|
|
37
|
+
### On a miss — mint the domain on the fly, announced
|
|
38
|
+
|
|
39
|
+
When no existing domain matches, mint the niche **on the spot**:
|
|
26
40
|
|
|
27
41
|
- **Announce it — never silently.** Tell the user, in the shopper's voice, that this is a new niche ("I haven't shopped cycling for you yet — setting that up"). **State the inferred domain so the user can correct it** before it is used; a mis-inferred niche is the user's to fix.
|
|
28
42
|
- **Research the niche (web + knowledge).** Pull how to shop well in this niche deeply — its decision-attributes and mechanics — into a **deep `domainSpec`** (a shallow bullet list a layperson could write fails the SDS bar). Derive the **`intentSpec`** decomposition dimensions **from** that domain spec (agent-specific, a *schema* not a filled instance). Seed a *partial* **`playbook`** — the niche shopping taste, an honest non-blank "to be learned as we shop" body. If you lack a web tool, say so and compose the domain spec from well-established public shopping knowledge — never present a guess as verified research.
|
|
29
|
-
- **Persist with the whole-doc `sil_profile_materialize` — WITH the `domain` object.** Call **`sil_profile_materialize { name, userSpec, domain: { slug, name, domainSpec, intentSpec, playbook } }`** — the **deduped slug** from
|
|
30
|
-
|
|
31
|
-
Then run the loop below on the freshly-minted (or reused) domain.
|
|
43
|
+
- **Persist with the whole-doc `sil_profile_materialize` — WITH the `domain` object.** Call **`sil_profile_materialize { name, userSpec, domain: { slug, name, domainSpec, intentSpec, playbook } }`** — the **deduped slug** from Beat 1, the deep `domainSpec`, the derived `intentSpec`, the partial `playbook`; `userSpec` is the current **shared** spec (the call re-persists it atomically alongside). One atomic call upserts `domains[slug]`. This is a **whole-doc path** (see Beat 4 + the cheap/heavy split) — `sil_profile_materialize`, **never** `sil_remember`.
|
|
32
44
|
|
|
33
|
-
|
|
45
|
+
### On a hit — web-refresh the active domain's spec
|
|
34
46
|
|
|
35
|
-
|
|
47
|
+
Before decomposing the request, go to the **web** and **enhance the active domain's `domain_spec.md`** so it stays current (new models, standards, prices, technique). Fold what you learn in and **persist** it by re-running **`sil_profile_materialize`** **with** the `domain` object carrying the updated `domainSpec` for this slug (the in-place re-mint — the same atomic store path the entry-mint and refine use). This is a **real web step** — if the host has no web/fetch tool, say so honestly and proceed on the existing domain spec; never pretend the refresh happened.
|
|
36
48
|
|
|
37
|
-
|
|
49
|
+
## Beat 3 — Gather what's missing from the user, before searching (the elicitation gate)
|
|
38
50
|
|
|
39
|
-
|
|
51
|
+
This is the promoted gate — a first-class, ordered step, **not** a clause folded inside the domain or the persist beat. It runs to completion **before any `sil_search`**: decompose the request, resolve each dimension against everything already known, then ask the user **only for what is genuinely unresolved**. It always RUNS; it asks only when something is missing.
|
|
40
52
|
|
|
41
|
-
###
|
|
53
|
+
### Decompose the request along the intent-spec dimensions (ephemeral — NEVER persisted)
|
|
42
54
|
|
|
43
55
|
Read the active domain's `intent_spec.md` — the decomposition **dimensions** a good query must resolve — and **fill them in for *this* request** from the user's words ("a waterproof trail shoe for a wet ultra next month, around €160" → use-case: trail/ultra; weather: wet; budget: ~€160; timeline: next month). State the filled decomposition back so the layering is legible. This filled instance is the **per-query intent** — **ephemeral**: it lives only in this conversation and is **NEVER persisted**. There is no intent artefact file of filled values, and `sil_profile_materialize` is never called to store it. Only the `intent_spec.md` *schema* is persisted; the fill is throwaway.
|
|
44
56
|
|
|
45
|
-
###
|
|
57
|
+
### Resolve each dimension, then elicit ONLY what is genuinely unresolved
|
|
46
58
|
|
|
47
|
-
|
|
59
|
+
For each decomposition dimension, **resolve it FIRST against — in order — the request's own words, the shared `user_spec` (standing facts + hard constraints, reused across every niche), the active `playbook` (this niche's standing taste), and any defensible `domain_spec` default.** Only then elicit, and elicit **only what is genuinely unresolved**. A dimension is genuinely unresolved, and *only then* asked, when it is **BOTH**:
|
|
60
|
+
|
|
61
|
+
- **load-bearing** — the active `domain_spec` / `intent_spec` marks it as materially changing the recommendation in this niche (not asked for completeness's sake), **AND**
|
|
62
|
+
- **still unfilled** after the resolve above — the request did not state it, and neither the shared `user_spec` nor the active `playbook` nor a domain default supplies it.
|
|
63
|
+
|
|
64
|
+
Elicitation is **need-driven**: only a dimension **missing** from BOTH the request AND the stored side is elicited — ask **only for what** a defensible pick actually needs, in the persona's voice, one or a few questions at a time, each tied to *why* the pick needs it — **never a battery**, never a form or questionnaire. An attribute the shared `user_spec` or the active `playbook` **already holds is never re-asked** — the stored value fills it silently; re-asking a known fact or taste is the exact defect this spine kills. When the request plus the stored side already carry every load-bearing dimension, **ask nothing and pass straight through** to Beat 5 — the gate is **bounded**, it does not hold the user hostage for perfect completeness. Elicitation gates search **quality, not access**: if the user skips or can't answer an elicited question, proceed on the **best defensible params**, state what you assumed, and never block shopping — a declined question narrows quality, never a dead-end.
|
|
65
|
+
|
|
66
|
+
## Beat 4 — Persist what surfaced (fact → shared user spec, taste → active domain)
|
|
67
|
+
|
|
68
|
+
When the gate surfaces a new user **fact** (a measurement, a compatibility detail, a hard constraint) or a new **shopping taste** for this niche (price sensitivity, brand leaning), persist it with a **single `sil_remember` call** — fired **only when something new surfaced** — so a future query fills it from the store instead of re-asking:
|
|
48
69
|
|
|
49
70
|
- A **fact / measurement / hard constraint** → **`sil_remember { kind: "fact", text, hard? }`** — the **cheap append** that adds one entry to the **shared** `user_spec.md` *without* re-emitting the whole doc. A fact carries across **every** niche (it never takes a `domain`). Mark a true, never-break rule ("never leather", "nothing over 8 kg", an allergy, an age gate) with **`hard: true`** so it appends as an inviolable constraint the reject-at-pick rule can grep; a bendable fact is a plain **soft** entry.
|
|
50
71
|
- A **shopping-taste preference** (budget band, brand likes/dislikes) → **`sil_remember { kind: "taste", text, domain }`** — one entry appended to **this niche's** `playbook.md`, the **active domain**. Pass the active domain's `domain` slug whenever the shopper holds more than one niche (with 2+ domains, omitting it is ambiguous and rejected). Taste is always **soft** — never `hard` — and is **scoped to this domain**: it shapes this niche's picks only, never another's.
|
|
51
72
|
|
|
52
|
-
**`sil_remember` is THE per-query persist verb** for a freshly surfaced fact or taste — the lightweight append the shopper takes *every query*, so rich information from the interaction is never lost under load. Reserve the **whole-doc `sil_profile_materialize`** round-trip for the heavy paths ONLY: the **
|
|
73
|
+
**`sil_remember` is THE per-query persist verb** for a freshly surfaced fact or taste — the lightweight append the shopper takes *every query*, so rich information from the interaction is never lost under load. Reserve the **whole-doc `sil_profile_materialize`** round-trip for the heavy paths ONLY: the **Beat-2 mint** of a new domain, the Beat-2 domain-spec **web refresh**, a full **refine**/overwrite ([`refine_shopper.md`](refine_shopper.md)), and **contradiction-resolution** — when a new statement *contradicts* a stored soft preference, that visible rewrite is the whole-doc path, because an append is **accretive, never corrective**.
|
|
53
74
|
|
|
54
|
-
The shared user spec and the active domain's playbook **grow incrementally, per-query** — augmenting what is there, never a big up-front form.
|
|
75
|
+
The shared user spec and the active domain's playbook **grow incrementally, per-query** — augmenting what is there, never a big up-front form. Fire this persist **only when something new actually surfaced** — a measurement stated, a brand preference revealed, a hard constraint learned, that the shared user spec / this domain's playbook did **not already hold**. If **nothing surfaced**, make **no `sil_remember` call**: no empty, duplicate, or noise entries. One discrete learning per call — two facts and a taste are three calls. A request that contradicts a stored **soft** preference **updates** it visibly (the whole-doc re-materialize); a **hard constraint** is not overridden (see precedence). Everything is **per-user, per-shopper, and local** — written only to this user's `$SIL_DATA_DIR/shopper/`, no server aggregation, no cross-user signal. Capture is **in the open**: each new fact or taste is elicited **in-context, in the persona's voice, only when a dimension needs it** — never silently harvested — and the user can review everything the shopper has stored with `sil_profile_get` (overview + per-domain) and erase a niche with `sil_profile_remove`.
|
|
55
76
|
|
|
56
77
|
### Layering — precedence intent > playbook(domain) > user_spec(SHARED) > domain_spec(domain)
|
|
57
78
|
|
|
@@ -66,33 +87,37 @@ The shared user spec and the active domain's playbook **grow incrementally, per-
|
|
|
66
87
|
|
|
67
88
|
> **Terminology — "reject-at-pick" here = the "reject-at-…-rule" phrasing in [`search_param_mapping.md`](search_param_mapping.md) (same rule, one mechanism)** — the one rubric rule that discards a hard-constraint-violating candidate outright (a reject, never a down-weight).
|
|
68
89
|
|
|
69
|
-
|
|
90
|
+
## Beat 5 — Search → rubric → recommend-with-why → re-fetch before purchase
|
|
91
|
+
|
|
92
|
+
With the domain present, the gate run to completion, and anything surfaced persisted, run the search tail. This tail is **re-ordered, not re-designed** — best-first, never re-rank, reject-at-pick for hard constraints, re-fetch before purchase.
|
|
93
|
+
|
|
94
|
+
### Map the answers to well-formed `sil_search` params
|
|
70
95
|
|
|
71
96
|
Translate each filled intent dimension — **plus the shared user-spec facts, this domain's shopping taste, and the domain-spec mechanics** the layering brought in — to a **real `sil_search` param** per [`search_param_mapping.md`](search_param_mapping.md). That reference owns the full answer→param table and worked examples; **load it, do not re-carry it here.** The load-bearing rules that govern this step:
|
|
72
97
|
|
|
73
98
|
- A stated taste with **no matching param** (a colour, a brand) folds into the `query` text or the rubric — you **never invent a filter**. There is no `color` param, no `brand` param.
|
|
74
|
-
- A user-spec **hard constraint** maps to a **real filter where one exists** (`condition`, `available`) so the catalog never returns a violating item; where no param matches, it does NOT collapse to `query` text — it becomes an explicit **reject-at-pick** rubric rule (
|
|
99
|
+
- A user-spec **hard constraint** maps to a **real filter where one exists** (`condition`, `available`) so the catalog never returns a violating item; where no param matches, it does NOT collapse to `query` text — it becomes an explicit **reject-at-pick** rubric rule (the compare step).
|
|
75
100
|
- Leave **`ship_to` empty** by default so the server resolves the registered default address. Do **not** call `sil_whoami` to populate it.
|
|
76
101
|
|
|
77
|
-
###
|
|
102
|
+
### Search
|
|
78
103
|
|
|
79
104
|
Call `sil_search` with the mapped params. It returns purchasable variants **best-first**.
|
|
80
105
|
|
|
81
|
-
###
|
|
106
|
+
### Compare the candidates on the rubric — reject hard-constraint violators outright
|
|
82
107
|
|
|
83
108
|
The **rubric emerges here, at pick time** — not a stored seller artefact. Build it from the active **domain-spec dimensions and trade-offs** (last volume vs. weight, rim depth vs. crosswind — the mechanics the domain spec named) **weighted by this domain's shopping taste** (`playbook.md`), the **shared user facts** (`user_spec.md`), and the **per-query intent**. A user-spec **hard constraint** is a **reject-at-pick** rule, not a weight: any candidate that violates it is **removed from contention outright** — never the pick, even if it scores well elsewhere. (A soft preference only down-weights.) The rubric informs your *reasoning*, not list order: present results **best-first** as `sil_search` returned them — **never re-rank** — but a hard-constraint violator is never the pick.
|
|
84
109
|
|
|
85
|
-
###
|
|
110
|
+
### Recommend — always with the "why" that cites the layers
|
|
86
111
|
|
|
87
112
|
Recommend with **domain-relevant rationale** in the shopper's voice — the **"why"** must make the layering **legible**: cite the **per-query intent** (what this request demanded), at least one **stored shared-user fact or this-domain taste you did NOT re-ask** ("you're a wide D-width, kept from before"), and at least one **researched domain-spec dimension** ("for trail running, last volume and lug depth matter more than weight here") — tied to the user's priorities. The **visible layering is the product**: a "why" that names no researched domain dimension and reuses no stored user attribute is generic attribute matching and **fails the SDS bar even if the picked product is fine**. Never hand back a bare list.
|
|
88
113
|
|
|
89
|
-
###
|
|
114
|
+
### Re-fetch with `sil_product_get` before any buy
|
|
90
115
|
|
|
91
116
|
Price, availability, and `checkout_url` from `sil_search` are **point-in-time**. Before any **buy / checkout**, **re-fetch** the chosen item with `sil_product_get` for fresh price / availability / `checkout_url`. **Never commit a buy off the stale `sil_search` snapshot.**
|
|
92
117
|
|
|
93
|
-
###
|
|
118
|
+
### After the recommendation — capture what surfaced via `sil_remember`
|
|
94
119
|
|
|
95
|
-
**After every recommendation, before the turn ends**, persist anything new the interaction surfaced — each via its **own single `sil_remember`** call (a person fact with `kind: "fact"` → the shared user spec, a niche buying taste with `kind: "taste"` + the active `domain` → this domain's playbook). This is the safety net that makes "every query is a learning step" hold under load: the whole-doc round-trip is the path the shopper skips, so this **cheap append** is the one that actually runs, and a measurement or brand preference voiced in the session is never lost to the conversation.
|
|
120
|
+
**After every recommendation, before the turn ends**, persist anything new the interaction surfaced that Beat 4 did not already capture — each via its **own single `sil_remember`** call (a person fact with `kind: "fact"` → the shared user spec, a niche buying taste with `kind: "taste"` + the active `domain` → this domain's playbook). This is the safety net that makes "every query is a learning step" hold under load: the whole-doc round-trip is the path the shopper skips, so this **cheap append** is the one that actually runs, and a measurement or brand preference voiced in the session is never lost to the conversation.
|
|
96
121
|
|
|
97
122
|
Fire this capture **only when something new actually surfaced** — a measurement stated, a brand preference revealed, a hard constraint learned, that the shared user spec / this domain's playbook did **not already hold**. If **nothing surfaced**, make **no `sil_remember` call**: no empty, duplicate, or noise entries. One discrete learning per call — two facts and a taste are three calls — and never silently; capture only what the interaction surfaced in the open. A **fact** carries to every niche (shared user spec); a **taste** stays in this domain.
|
|
98
123
|
|