sil-openclaw 0.4.1 → 0.4.3

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.
@@ -7,8 +7,8 @@
7
7
  * - `sil_profile_materialize { name, userSpec }` — SETUP-ONLY: write user_spec.md
8
8
  * (its frontmatter carries the shopper name). Does NOT mint methods/PRDs.
9
9
  * - `sil_learn { target, domain?, prd?, kind, … }` — the single target+change verb
10
- * for the whole method/PRD lifecycle: create mints a whole doc; append/amend/
11
- * retract refine in place; attach-asset persists image bytes by path.
10
+ * for the whole method/PRD lifecycle: create mints a NEW doc; write replaces an
11
+ * existing doc's whole body (reconciled); attach-asset persists image bytes by path.
12
12
  * - `sil_profile_search { domain?, product?, intent?, query? }` — query artefact
13
13
  * FRONTMATTER (coordinates only, no bodies); the discovery / reuse-before-mint
14
14
  * primitive. Malformed frontmatter surfaces in `unreadable`, never dropped.
@@ -21,6 +21,7 @@
21
21
  * nothing). The persona is NOT written here — it is the host workspace SOUL.md.
22
22
  */
23
23
  import { Type } from "typebox";
24
+ import { wiringAdvisories } from "../lib/host-wiring.js";
24
25
  import { learnArtefact, materializeProfile, readArtefactBody, removeArtefact, searchProfileFrontmatter, } from "../lib/profile-store.js";
25
26
  import { jsonResult } from "../lib/tool-result.js";
26
27
  /** Narrow a host-validated param to a string, defaulting to "" so the store does the
@@ -68,7 +69,12 @@ function registerMaterialize(api) {
68
69
  });
69
70
  if (result.ok) {
70
71
  api.logger.info("sil_profile_materialized", {});
71
- return jsonResult({ status: "ok", dir: result.dir, userSpecPath: result.userSpecPath });
72
+ return jsonResult({
73
+ status: "ok",
74
+ dir: result.dir,
75
+ userSpecPath: result.userSpecPath,
76
+ ...wiringAdvisories(api),
77
+ });
72
78
  }
73
79
  return mapFailure(api, "sil_profile_materialize", result);
74
80
  },
@@ -80,33 +86,28 @@ function registerLearn(api) {
80
86
  label: "Teach the sil shopper (create or refine a method / PRD)",
81
87
  description: "The single target+change verb owning the sil shopper's method/PRD lifecycle."
82
88
  + " `target` (user_spec | method | prd) picks WHERE the change lands; `kind`"
83
- + " (create | append | amend | retract | attach-asset) picks the change — the"
84
- + " per-field schema names which fields each needs. `create` mints a whole method/"
85
- + "PRD (not valid for user_spec); append/amend/retract/attach-asset need the target"
86
- + " to exist (else not_found). `hard` (append to user_spec/prd only) marks an"
87
- + " inviolable constraint. Local-only, atomic, owner-only, no network; a bad field"
88
- + " → invalid_request and writes nothing.",
89
+ + " (create | write | attach-asset) picks the change. `create` mints a NEW method/"
90
+ + "PRD (not valid for user_spec; errors if one already exists — use write). `write`"
91
+ + " replaces an EXISTING doc's whole body with a reconciled version you author (read"
92
+ + " it first with sil_profile_get and carry every buyer line forward; else not_found)."
93
+ + " `attach-asset` links image bytes. To change anything, WRITE the whole reconciled"
94
+ + " doc — there is no append/amend, so a correction never stacks a contradicting"
95
+ + " line. Local-only, atomic, owner-only, no network; a bad field → invalid_request"
96
+ + " and writes nothing.",
89
97
  parameters: Type.Object({
90
98
  target: Type.Union([Type.Literal("user_spec"), Type.Literal("method"), Type.Literal("prd")], { description: "WHERE the change lands: user_spec | method | prd." }),
91
99
  kind: Type.Union([
92
100
  Type.Literal("create"),
93
- Type.Literal("append"),
94
- Type.Literal("amend"),
95
- Type.Literal("retract"),
101
+ Type.Literal("write"),
96
102
  Type.Literal("attach-asset"),
97
- ], { description: "The change: create | append | amend | retract | attach-asset." }),
103
+ ], { description: "The change: create (mint new) | write (replace whole body) | attach-asset." }),
98
104
  domain: Type.Optional(Type.String({ description: "The domain slug (lower-kebab, not \"main\") — required for method/prd." })),
99
105
  prd: Type.Optional(Type.String({ description: "The PRD key <product>-<intent> (lower-kebab) — required for a prd target." })),
100
106
  name: Type.Optional(Type.String({ description: "create method: the human-readable domain name." })),
101
- body: Type.Optional(Type.String({ description: "create: the whole markdown body to mint." })),
107
+ body: Type.Optional(Type.String({ description: "create / write: the whole markdown body (mint, or the reconciled replacement)." })),
102
108
  product: Type.Optional(Type.String({ description: "create prd: the product type." })),
103
109
  intent: Type.Optional(Type.String({ description: "create prd: the use-context (general when context-free)." })),
104
110
  title: Type.Optional(Type.String({ description: "create prd: the human-readable job title." })),
105
- text: Type.Optional(Type.String({ description: "append: the one bullet to add." })),
106
- from: Type.Optional(Type.String({ description: "amend/retract: the exact bullet text to match (single occurrence)." })),
107
- to: Type.Optional(Type.String({ description: "amend: the replacement bullet text." })),
108
- section: Type.Optional(Type.String({ description: "append/amend/retract: the `## section` to scope to." })),
109
- hard: Type.Optional(Type.Boolean({ description: "append to user_spec/prd only: mark an inviolable constraint the shop loop rejects against." })),
110
111
  bytes: Type.Optional(Type.String({ description: "attach-asset: the image bytes, base64-encoded." })),
111
112
  mime: Type.Optional(Type.String({ description: "attach-asset: image/jpeg | image/png | image/webp | image/gif." })),
112
113
  caption: Type.Optional(Type.String({ description: "attach-asset: an optional caption for the markdown link." })),
@@ -114,7 +115,7 @@ function registerLearn(api) {
114
115
  async execute(_callId, params) {
115
116
  const spec = {
116
117
  target: params["target"] ?? "method",
117
- kind: params["kind"] ?? "append",
118
+ kind: params["kind"] ?? "write",
118
119
  domain: optString(params["domain"]),
119
120
  prd: optString(params["prd"]),
120
121
  name: optString(params["name"]),
@@ -122,11 +123,6 @@ function registerLearn(api) {
122
123
  product: optString(params["product"]),
123
124
  intent: optString(params["intent"]),
124
125
  title: optString(params["title"]),
125
- text: optString(params["text"]),
126
- from: optString(params["from"]),
127
- to: optString(params["to"]),
128
- section: optString(params["section"]),
129
- hard: params["hard"] === true ? true : undefined,
130
126
  bytes: optString(params["bytes"]),
131
127
  mime: optString(params["mime"]),
132
128
  caption: optString(params["caption"]),
@@ -148,6 +144,7 @@ function registerLearn(api) {
148
144
  ...(result.prd !== undefined ? { prd: result.prd } : {}),
149
145
  path: result.path,
150
146
  ...(result.assetPath !== undefined ? { assetPath: result.assetPath } : {}),
147
+ ...wiringAdvisories(api),
151
148
  });
152
149
  }
153
150
  return mapFailure(api, "sil_learn", result);
@@ -205,6 +202,7 @@ function registerSearch(api) {
205
202
  + " answered from the sil catalog, never from the open web.",
206
203
  }
207
204
  : {}),
205
+ ...wiringAdvisories(api),
208
206
  });
209
207
  },
210
208
  });
@@ -238,6 +236,7 @@ function registerGet(api) {
238
236
  fields: result.fields,
239
237
  body: result.body,
240
238
  path: result.path,
239
+ ...wiringAdvisories(api),
241
240
  });
242
241
  }
243
242
  return mapFailure(api, "sil_profile_get", result);
@@ -268,6 +267,7 @@ function registerRemove(api) {
268
267
  status: "removed",
269
268
  domainSlug: result.domainSlug,
270
269
  ...(result.prd !== undefined ? { prd: result.prd } : {}),
270
+ ...wiringAdvisories(api),
271
271
  });
272
272
  }
273
273
  return mapFailure(api, "sil_profile_remove", result);
@@ -2,13 +2,14 @@
2
2
  "id": "sil",
3
3
  "name": "sil",
4
4
  "description": "Turn your OpenClaw into an expert shopping agent.",
5
- "version": "0.4.1",
5
+ "version": "0.4.3",
6
6
  "skills": ["./sil-shopping"],
7
7
  "activation": {
8
8
  "onCapabilities": ["tool"]
9
9
  },
10
10
  "contracts": {
11
11
  "tools": [
12
+ "sil_doctor",
12
13
  "sil_learn",
13
14
  "sil_product_get",
14
15
  "sil_profile_get",
@@ -53,12 +54,13 @@
53
54
  },
54
55
  "security": {
55
56
  "shipsRuntimeCode": true,
56
- "packagingNote": "Compiled JavaScript ships under ./dist. register() stays synchronous and opens nothing — it only registers tools. ALL I/O happens inside a tool's execute(): sil_register calls sil-web over the network, writes tokens.json + config.json to the plugin data directory (owner-only, 0600), and arms a bounded background poll timer that stops on the first terminal claim outcome or after the session deadline. sil_whoami reads the stored session token and calls sil-api for the user's identity, refreshing transparently via sil-web on a 401 (at most one refresh + one retry per call, no timer); a confirmed-dead session clears tokens.json. sil_search and sil_product_get read the stored session token and call sil-api's catalog endpoints (search / lookup) with it — read-only on catalog data, no timer, but with the SAME bounded 401 recovery as sil_whoami: on a 401 they refresh ONCE via sil-web (rotating tokens.json) and retry the read ONCE; a second 401 or a dead (invalid_grant) refresh token clears tokens.json and is reported as a terminal re-register hint. A non-401 error writes no token. The five profile verbs make NO network call and read no token; they write the one sil shopper's SINGLETON behaviour artefacts under a fixed $SIL_DATA_DIR/shopper/ (owner-only, files 0600, dirs 0700) as frontmatter-as-truth markdown — there is NO profile.json manifest; each file's own frontmatter IS the source of truth, discovered by a filesystem scan. sil_profile_materialize is SETUP-ONLY: it writes shopper/user_spec.md (the shared person spec; its frontmatter carries the shopper name), minting no domain. sil_learn is the single target+change verb over shopper/domains/<slug>/{method.md, prds/<product>-<intent>.md, assets/}: create mints a whole method or PRD; append/amend/retract refine a section-aware markdown body in place (single-occurrence match, fail-closed if the target or the named section is absent); attach-asset persists image bytes (size-capped, image MIME allowlist) into the domain's assets/ owner-only and links them by RELATIVE path, never inline bytes. sil_profile_search scans artefact FRONTMATTER and returns coordinates only (no bodies) — a domain/PRD with malformed frontmatter is skipped and surfaced as unreadable, never silently dropped or half-read. sil_profile_get reads ONE whole body (method or PRD); sil_profile_remove deletes a whole validated domain subtree, or one PRD file, fail-closed on a malformed/traversal/\"main\" or missing slug (never the whole shopper). The only caller-supplied path segments are the domain slug and the PRD key, both validated (lower-kebab, not \"main\") before any join; the shopper segment is a compile-time constant. Every write is atomic (tmp file → rename over target → chmod), so a reader sees a whole file or none. The persona is the shopper's host workspace SOUL.md, written by the host CLI (not this plugin, not a sil artefact), and the shopper's host-config wiring is driven separately by the host CLI. The PKCE verifier is held only in memory and is never written to disk. Artefact bodies, tokens, and identity PII are never logged.",
57
+ "packagingNote": "Compiled JavaScript ships under ./dist. register() stays synchronous and opens nothing — it only registers tools. ALL I/O happens inside a tool's execute(): sil_register calls sil-web over the network, writes tokens.json + config.json to the plugin data directory (owner-only, 0600), and arms a bounded background poll timer that stops on the first terminal claim outcome or after the session deadline. sil_whoami reads the stored session token and calls sil-api for the user's identity, refreshing transparently via sil-web on a 401 (at most one refresh + one retry per call, no timer); a confirmed-dead session clears tokens.json. sil_search and sil_product_get read the stored session token and call sil-api's catalog endpoints (search / lookup) with it — read-only on catalog data, no timer, but with the SAME bounded 401 recovery as sil_whoami: on a 401 they refresh ONCE via sil-web (rotating tokens.json) and retry the read ONCE; a second 401 or a dead (invalid_grant) refresh token clears tokens.json and is reported as a terminal re-register hint. A non-401 error writes no token. The five profile verbs make NO network call and read no token; they write the one sil shopper's SINGLETON behaviour artefacts under a fixed $SIL_DATA_DIR/shopper/ (owner-only, files 0600, dirs 0700) as frontmatter-as-truth markdown — there is NO profile.json manifest; each file's own frontmatter IS the source of truth, discovered by a filesystem scan. sil_profile_materialize is SETUP-ONLY: it writes shopper/user_spec.md (the shared person spec; its frontmatter carries the shopper name), minting no domain. sil_learn is the single target+change verb over shopper/domains/<slug>/{method.md, prds/<product>-<intent>.md, assets/}: create mints a whole method or PRD, fail-closed if one already exists; write replaces an existing doc's whole body with a caller-authored reconciled version, fail-closed if the target is absent — there is no in-place section edit, so every change rewrites the whole document; attach-asset persists image bytes (size-capped, image MIME allowlist) into the domain's assets/ owner-only and links them by RELATIVE path, never inline bytes. sil_profile_search scans artefact FRONTMATTER and returns coordinates only (no bodies) — a domain/PRD with malformed frontmatter is skipped and surfaced as unreadable, never silently dropped or half-read. sil_profile_get reads ONE whole body (method or PRD); sil_profile_remove deletes a whole validated domain subtree, or one PRD file, fail-closed on a malformed/traversal/\"main\" or missing slug (never the whole shopper). sil_doctor is a report-first diagnostic over the SAME $SIL_DATA_DIR state: it reads the data dir, file modes, tokens.json/config.json metadata, and artefact frontmatter, and returns a machine-readable findings array. It reads no token contents out and rotates no token: token health is metadata only (present / mode / parses / expired), where expiry is decoded from the access token's own JWT exp claim strictly LOCALLY (decode-only, no signature verification, no network, no claim other than exp extracted, never a token byte emitted or logged). Its only writes are two safe idempotent fixes under $SIL_DATA_DIR — tightening a too-open mode and creating the missing data dir; a tighten only ever NARROWS (it detects bits set outside the expected mask and chmods to mode & expected, which can only clear bits, never grant them). Enumerated entries under the data dir are lstat'd, and a symlink found among them is REPORTED, never chmod'd-through — that is what keeps a tighten inside the store. The data directory ROOT itself is stat'd rather than lstat'd, because chmod follows a symlink regardless (Linux exposes no lchmod), so lstat there would prevent nothing and merely re-report the same fix forever; a symlinked $SIL_DATA_DIR is an operator-declared indirection, so the tighten lands on the directory the plugin already stores everything in. anything that would mutate the bytes of an existing artefact (clearing a corrupt tokens.json, deleting an orphaned tmp file, repairing an artefact) is REPORTED as needs_confirmation and never run. It makes exactly ONE outbound request, and it is the only reason https://clawhub.ai is declared: an unauthenticated read-only GET of the published version of @4gpts/sil, bounded by an explicit timeout + abort, carrying no token, no PII, no store contents, and no Authorization header, pinned to that one host (redirects are refused). It fails soft to silence — an unreachable, slow, non-200, or unparseable response yields no finding at all and never fails the run. sil_doctor never acts on the version it reports: it installs nothing, spawns no process, writes no host config, and prompts nobody. The only caller-supplied path segments are the domain slug and the PRD key, both validated (lower-kebab, not \"main\") before any join; the shopper segment is a compile-time constant. Every write is atomic (tmp file → rename over target → chmod), so a reader sees a whole file or none. The persona is the shopper's host workspace SOUL.md, written by the host CLI (not this plugin, not a sil artefact), and the shopper's host-config wiring is driven separately by the host CLI. The PKCE verifier is held only in memory and is never written to disk. Artefact bodies, tokens, and identity PII are never logged.",
57
58
  "registersLongLivedService": false,
58
59
  "serviceIds": [],
59
60
  "runsTimers": true,
60
61
  "inboundHttpRoutes": [],
61
62
  "networkEndpoints": [
63
+ "https://clawhub.ai",
62
64
  "https://sil-api.4gpts.com",
63
65
  "https://sil.4gpts.com"
64
66
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sil-openclaw",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "description": "Turn your OpenClaw into an expert shopping agent.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -13,14 +13,18 @@
13
13
  * consent gate; this bin executes an already-assembled, already-endorsed spec
14
14
  * non-interactively. It never prompts, never re-runs the interview.
15
15
  *
16
- * Input — ONE JSON object `{ agentId, name, workspace, persona, userSpec, channel? }`,
16
+ * Input — ONE JSON object `{ name, workspace, persona, userSpec, channel? }`,
17
17
  * read from stdin (primary) or `--spec <path>` (fallback). Passing multiline
18
18
  * persona/userSpec as JSON dodges shell-arg escaping. Unparseable/blank input →
19
- * `invalid_request`, nothing attempted. `channel` is OPTIONAL — the current-channel
20
- * override for the step-10 bind; absent/blank is fail-open, never invalid_request.
19
+ * `invalid_request`, nothing attempted. There is NO `agentId` input — it is derived
20
+ * from `name` (`deriveAgentId`), so the user never invents an id; a stray `agentId`
21
+ * key is ignored. `channel` is OPTIONAL — the current-channel override for the
22
+ * step-10 bind; absent/blank is fail-open, never invalid_request.
21
23
  *
22
24
  * Choreography (validate-first, then atomic, fail-closed):
23
- * 1. validate the spec — bad/blank field ⇒ invalid_request, nothing attempted
25
+ * 1. validate the spec + derive the id — bad/blank field ⇒ invalid_request, nothing
26
+ * attempted; then agentId = deriveAgentId(name) (lower-kebab; empty/`main` slug ⇒
27
+ * the silent `sil-shopper` fallback — the postcondition guarantees a conforming id)
24
28
  * 2. resolve the host config — none ⇒ persistence_failed (precondition), nothing written
25
29
  * 3. singleton + agentId pre-flight — a shopper OR the agentId already exists ⇒ collision;
26
30
  * an INCONCLUSIVE read (degraded store / CLI error) fails closed — never fabricates
@@ -31,8 +35,7 @@
31
35
  * 7. materializeProfile — REUSED; SETUP-ONLY { name, userSpec } ⇒ shared
32
36
  * user_spec.md (its frontmatter carries the name);
33
37
  * NO manifest, no domain minted at create
34
- * 8. attach the sil skill + deny the escape-hatch tools (exec/write/edit/apply_patch,
35
- * a per-agent tools.deny that keeps sil + web) + enable the sil plugin (config set)
38
+ * 8. attach the sil skill + enable the sil plugin (config set)
36
39
  * 9. sil-openclaw-allowlist — REUSED whole; additive/idempotent/atomic three-surface
37
40
  * trust merge (plugins.allow + tools.alsoAllow + plugins.entries.sil)
38
41
  * 10. bind the current channel — FAIL-OPEN convenience, NOT fail-closed: resolve the channel
@@ -87,6 +90,7 @@ import {
87
90
  getShopperArtefactDir,
88
91
  } from "../dist/lib/profile-store.js";
89
92
  import { resolveBindChannel } from "../dist/lib/bind-channel.js";
93
+ import { deriveAgentId } from "../dist/lib/derive-agent-id.js";
90
94
 
91
95
  const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..");
92
96
  /** The sibling operator bin that performs the additive, self-validating trust merge. */
@@ -95,20 +99,6 @@ const ALLOWLIST_BIN = resolve(ROOT, "scripts", "allowlist-openclaw.mjs");
95
99
  * skill name), read the same way `scripts/allowlist-openclaw.mjs` reads it. */
96
100
  const MANIFEST_PATH = resolve(ROOT, "openclaw.plugin.json");
97
101
 
98
- /** A shopper id path-segment shape — lower-kebab, never `main` (host-reserved). */
99
- const AGENT_ID_RE = /^[a-z0-9][a-z0-9-]*$/;
100
-
101
- /** The escape-hatch tools the shopper is DENIED at the per-agent level — the shell
102
- * (`exec`) and the filesystem mutators (`write`/`edit`/`apply_patch`). A shopper shops
103
- * through the sil tools; it has no business running a shell (which it wasted re-reading
104
- * its own skill files) or writing host files (which it used to persist shopping memory
105
- * into the workspace instead of the sil store). `deny` is the SAFE lever: per the host's
106
- * tool-precedence model it only further-RESTRICTS and cannot re-grant, so it removes
107
- * exactly these and CANNOT strip the sil tools (a per-agent `tools.profile` override,
108
- * by contrast, replaces the base set and would risk the sil grant). Web + messaging
109
- * tools are intentionally kept — web still feeds gap-filling method research. */
110
- const SHOPPER_TOOL_DENY = ["exec", "write", "edit", "apply_patch"];
111
-
112
102
  /** The sil creed appended to every shopper's SOUL.md after its persona — a soul, not a
113
103
  * rulebook. It carries the mantra (explore first), the loop in three lines, and the one
114
104
  * distinction that matters (the catalog is where you buy, the web is where you learn),
@@ -208,29 +198,18 @@ function readSpecRaw() {
208
198
  }
209
199
  }
210
200
 
211
- /** Validate the endorsed spec — deterministic field order (agentId → name →
212
- * workspace → persona → userSpec). Returns `{ field, message }` on the FIRST bad
213
- * field, or null when the whole spec is good. Writes/attempts nothing. `channel`
214
- * is deliberately NOT validated: it is an optional fail-open convenience, so an
215
- * absent/blank/malformed channel is never invalid_request — it folds to `null` in
216
- * `resolveBindChannel` and degrades to a manual-bind hint at step 10. */
201
+ /** Validate the endorsed spec — deterministic field order (name → workspace →
202
+ * persona → userSpec). Returns `{ field, message }` on the FIRST bad field, or null
203
+ * when the whole spec is good. Writes/attempts nothing. `agentId` is NOT a spec field
204
+ * — it is derived from `name` (`deriveAgentId`) after validate; a stray `agentId` key
205
+ * is ignored. `channel` is deliberately NOT validated: it is an optional fail-open
206
+ * convenience, so an absent/blank/malformed channel is never invalid_request — it
207
+ * folds to `null` in `resolveBindChannel` and degrades to a manual-bind hint at step 10. */
217
208
  function validateSpec(spec) {
218
209
  if (typeof spec !== "object" || spec === null || Array.isArray(spec)) {
219
210
  return {
220
211
  field: "spec",
221
- message: "spec must be a JSON object with { agentId, name, workspace, persona, userSpec, channel? }.",
222
- };
223
- }
224
- if (!nonBlank(spec.agentId)) {
225
- return { field: "agentId", message: "agentId is required and must be non-empty." };
226
- }
227
- if (spec.agentId === "main") {
228
- return { field: "agentId", message: '"main" is host-reserved and cannot be an agentId.' };
229
- }
230
- if (!AGENT_ID_RE.test(spec.agentId)) {
231
- return {
232
- field: "agentId",
233
- message: "agentId must be lower-kebab (a-z, 0-9, hyphen) — got: " + JSON.stringify(spec.agentId),
212
+ message: "spec must be a JSON object with { name, workspace, persona, userSpec, channel? }.",
234
213
  };
235
214
  }
236
215
  if (!nonBlank(spec.name)) {
@@ -316,11 +295,6 @@ function agentIndex(config, agentId) {
316
295
  return list.findIndex((a) => a?.id === agentId);
317
296
  }
318
297
 
319
- // The shopper's per-agent escape-hatch deny-list (step 8) is the INTENDED end state, not
320
- // a degradation — so it rides no `warnings` entry (that rail is for real gaps, and the
321
- // happy path stays clean). What the shopper keeps (sil tools + web) and drops (the shell
322
- // + fs mutators) is documented in CHANGELOG.md + agent_creation_engine.md.
323
-
324
298
  /** True iff `openclaw config validate --json` reported `{valid:true}`. The host
325
299
  * writes its verdict to stdout even on a non-zero exit, so read stdout, never the
326
300
  * exit code (fail closed if it is not JSON). */
@@ -455,7 +429,11 @@ function main() {
455
429
  if (bad) {
456
430
  emitFailure("invalid_request", { field: bad.field, cause: bad.message });
457
431
  }
458
- const { agentId, name, workspace, persona, userSpec, channel } = spec;
432
+ const { name, workspace, persona, userSpec, channel } = spec;
433
+ // Derive the host id from the ONE friendly name — the user never invents an id.
434
+ // The lib's postcondition guarantees a conforming lower-kebab id, never `main`
435
+ // (empty/`main` slug ⇒ silent `sil-shopper`), so no runtime re-validation here.
436
+ const agentId = deriveAgentId(name);
459
437
 
460
438
  // --- 2. Resolve the host config (precondition — nothing written yet) ---
461
439
  const configPath = resolveConfigPath();
@@ -593,21 +571,12 @@ function main() {
593
571
  if (!skillRes.ok) {
594
572
  failAndTeardown(configPath, "attaching the sil skill failed: " + (skillRes.stderr || "non-zero exit"));
595
573
  }
596
- // Deny the shopper the escape-hatch tools at the per-agent level — sibling of the
597
- // `.skills` set above. This subtracts the shell + fs mutators from whatever the host's
598
- // global profile grants, so the sil tools (admitted via plugin trust, step 9) and web
599
- // survive while the shell/file-write hatches are gone. `deny` is chosen over a
600
- // per-agent `tools.profile` override precisely because it only further-restricts and
601
- // can never strip the sil grant (SHOPPER_TOOL_DENY rationale). `--strict-json` requires
602
- // a valid-JSON value, so the array is passed via JSON.stringify (→ '["exec",…]'),
603
- // exactly like the `["…"]` / `true` values above; a bare token would exit 0 but no-op.
604
- const denyRes = runOpenclaw(
605
- ["config", "set", `agents.list[${idx}].tools.deny`, JSON.stringify(SHOPPER_TOOL_DENY), "--strict-json"],
606
- configPath,
607
- );
608
- if (!denyRes.ok) {
609
- failAndTeardown(configPath, "setting the shopper tool deny-list failed: " + (denyRes.stderr || "non-zero exit"));
610
- }
574
+ // No per-agent `tools.deny` is set: the shopper inherits the host's default toolset
575
+ // untouched. A deny of the fs-mutators is inert here — codex brings its OWN shell
576
+ // (surfaced as `bash`), which the deny cannot name and which reads the shopper's
577
+ // skill files anyway, and an open shell writes files regardless of any fs-mutator
578
+ // deny. The shell stays open by design (trusted single-operator posture); persistence
579
+ // is steered through the sil tools by the skill, not enforced by tool policy.
611
580
  const enableRes = runOpenclaw(
612
581
  ["config", "set", "plugins.entries.sil.enabled", "true", "--strict-json"],
613
582
  configPath,
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: sil-shopping
3
- description: 'Use for any sil shopping, identity, or shopper-setup intent: register, check the account, search the sil catalog, look up products by id — plus the single-shopper lifecycle: create the shopper (a two-touchpoint onboarding), search what it knows or which domains (niches) it learned, view or forget a domain or PRD, refine it — or, as the shopper, run the six-beat Spec-Driven Shopping loop and learn a fact or taste it surfaces. Drives sil_register, sil_whoami, sil_search, sil_product_get, sil_specs, sil_profile_materialize, sil_profile_search, sil_profile_get, sil_profile_remove, sil_learn.'
3
+ description: 'Use for any sil shopping, identity, or shopper-setup intent: register, check the account, search the sil catalog, look up products by id — plus the single-shopper lifecycle: create the shopper (a two-touchpoint onboarding), search what it knows or which domains (niches) it learned, view or forget a domain or PRD, refine it — or, as the shopper, run the six-beat Spec-Driven Shopping loop and learn a fact or taste it surfaces. Drives sil_register, sil_whoami, sil_search, sil_product_get, sil_specs, sil_profile_materialize, sil_profile_search, sil_profile_get, sil_profile_remove, sil_learn, sil_doctor.'
4
4
  metadata:
5
5
  openclaw:
6
6
  emoji: "\U0001F6D2"
@@ -28,12 +28,19 @@ it knows, view or forget a domain, refine it.
28
28
  **before** searching; never skip the mint. The picks you return are always sil
29
29
  catalog products (`sil_search` → `checkout_url`), **never** open-web results —
30
30
  the web only researches the method, it never sources a pick.
31
+ - **Your memory is the sil store, never a `MEMORY.md`.** Persist and recall every
32
+ shopping fact, taste, and domain method through `sil_learn` / `sil_profile_*` — a
33
+ workspace `MEMORY.md` is not the shopper's memory; do not read or write it.
31
34
 
32
35
  ## Session start
33
36
 
34
- Confirm the `sil_*` tools are exposed. If missing, the host is filtering them —
35
- run the shipped admission helper `sil-openclaw-allowlist` (it additively admits
36
- sil at `plugins.allow` + `tools.alsoAllow`), then reopen the session. Most flows
37
+ Confirm the `sil_*` tools are exposed. If missing, the host is filtering them — the
38
+ shipped admission helper repairs it (additively admitting sil at `plugins.allow` +
39
+ `tools.alsoAllow`), then reopen the session. If `sil_doctor` still runs, its
40
+ `wiring.tools_not_admitted` finding names the exact command: a `node "<absolute
41
+ path>"` invocation, never a bare bin name (that name is on PATH only for some
42
+ installs). If no sil tool runs at all, this is an operator fix — run
43
+ `node scripts/allowlist-openclaw.mjs` from the sil plugin's install directory. Most flows
37
44
  need an identity: call a catalog tool first and let an unregistered outcome route
38
45
  to `sil_register`, or run `sil_register` up front when intent requires it.
39
46
 
@@ -67,6 +74,7 @@ while setup is incomplete; it sheds once a shopper exists.
67
74
  | (as the shopper) a shopping intent on any niche | the six-beat loop | [`shop_loop.md`](references/shop_loop.md) |
68
75
  | "learn / remember this" — a fact or taste the shopper surfaced | `sil_learn` | [`fill_and_feedback.md`](references/fill_and_feedback.md) |
69
76
  | "refine / sharpen my shopper" / fix a niche | `sil_learn` (target + change) | [`fill_and_feedback.md`](references/fill_and_feedback.md) |
77
+ | "sil is broken" / "check my sil install" / a store or identity read misbehaves | `sil_doctor` | — |
70
78
 
71
79
  Each core tool's behaviour + status taxonomy live in its own tool definition and
72
80
  response (the `recovery`/`status` it returns) — basic shopping needs only that. A full
@@ -88,6 +96,10 @@ feedback** — loaded on demand from the references that own each beat: **1 clas
88
96
  → [`references/method_and_prds.md`](references/method_and_prds.md); **3 fill, 6
89
97
  feedback** → [`references/fill_and_feedback.md`](references/fill_and_feedback.md).
90
98
 
99
+ **Beat 4 is bounded: ≤ 4 spec-filtered `sil_search` calls** per request — the tightest
100
+ projection of the PRD's core first, then deliberate widenings; never brand-by-brand
101
+ enumeration.
102
+
91
103
  The loop shapes the shopper's **reasoning, not the user's inbox**: a reused domain
92
104
  plus a fully-resolved request **passes straight through, asking nothing**. It gates
93
105
  only `sil_search`-driven discovery — identity, a direct `sil_product_get` re-check,
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: multi-domain-shopper-walkthrough
3
- description: A worked six-beat run — create one shopper (after endorsement), then shop two unrelated niches in one session, the second minted on the fly, with a shared user_spec fact reused across both. Illustrative, not a spec.
3
+ description: A worked six-beat run — create one shopper (after endorsement), then shop two unrelated niches in one session (the second minted on the fly), with a shared user_spec fact reused across both and a mid-session correction reconciled by a whole-doc write. Illustrative, not a spec.
4
4
  ---
5
5
 
6
6
  # Worked run — one shopper, two niches, six beats
@@ -18,16 +18,31 @@ lives in `user_spec` (true in **every** niche).
18
18
  ## Niche A — ski gloves (all six beats)
19
19
 
20
20
  1. **Classify** — "warm gloves for the slope" → `{ domain: ski, product: gloves, intent:
21
- slope }`; `sil_profile_search` finds no ski domain → a MISS.
22
- 2. **Method** — research ski gear, **mint** via `sil_learn create`, **announced** ("I read this
23
- as *ski gloves for the slope* — correct me if not").
24
- 3. **Fill** — the method resolves waterproofing + cuff length; the wool allergy is **reused**
21
+ slope }`. The domain is the **broad category** (`ski`, not `ski-slope-gloves`), so a later
22
+ "ski goggles" reuses this method. `sil_profile_search` finds no ski domain → a MISS.
23
+ 2. **Method** — research ski gear, then **mint the general buying guide** via `sil_learn create`
24
+ (`target: method`, domain `ski`): a `## How it's bought` section + a coined `## Search
25
+ vocabulary` (e.g. `product.waterproof_rating`, `product.insulation_g`) — **dimensions, never
26
+ this buyer's values**. **Announced** ("I read this as *ski gloves for the slope*").
27
+ 3. **Fill** — the method's dimensions resolve from stored state; the wool allergy is **reused**
25
28
  from the shared `user_spec` **without re-asking**; only the budget is elicited (one question,
26
- tied to why).
27
- 4. **Search-space** — a bounded fan-out of ≤ 4 `sil_search` calls, core first.
29
+ tied to why). The resolved values are authored into the PRD's **`## Search specs`** block —
30
+ e.g. `{ns:product, key:waterproof_rating, op:gte, value:10000, unit:mm, hard:true}` — and
31
+ persisted with `sil_learn create` (`target: prd`, `ski/gloves-slope`).
32
+ 4. **Search-space** — **project** the PRD's `## Search specs` block **verbatim** into a bounded
33
+ ≤ 4 `sil_search` fan-out, core first, deliberate widenings after.
28
34
  5. **Reflect** — honesty pass, then a **hero + one alternative**, each with a why.
29
- 6. **Feedback** — "I always run Hestra" → confirm, persist a per-domain taste to the method via
30
- `sil_learn`.
35
+ 6. **Feedback** — "I always run Hestra" → confirm, then **`sil_learn write`** the ski method with
36
+ a `## Durable taste` line folded in (a whole-doc reconcile, per-domain — not a stray bullet).
37
+
38
+ ### A correction, mid-session — the write-reconcile
39
+
40
+ The buyer pushes back: "the €120 cap was just for today — my real ceiling is €90, and I don't
41
+ care about touchscreen fingers." That **contradicts** two filled preferences and is a
42
+ **standing** change, so reconcile the PRD with a single **`sil_learn write`**: read the current
43
+ `ski/gloves-slope`, **rewrite** the budget predicate and drop the touchscreen one in place, and
44
+ write the coherent whole back. No second, contradicting bullet is ever added — the PRD stays
45
+ **one truth per dimension**, and the next search projects the corrected block.
31
46
 
32
47
  ## Niche B — an espresso grinder (same session, minted on the fly)
33
48
 
@@ -36,7 +51,8 @@ the one shopper handles it:
36
51
 
37
52
  1. **Classify** → `{ domain: espresso, product: grinder, intent: general }` (context-free →
38
53
  `general`).
39
- 2. **Method** — a MISS again → research + **mint on the fly**, **announced**.
54
+ 2. **Method** — a MISS again → research + **mint the general method on the fly** (`create`),
55
+ **announced**.
40
56
  3. **Fill** — "ships to Berlin" is **reused across** niches from the shared `user_spec`, kept
41
57
  from the ski session. The Hestra taste, per-domain on the ski method, does **not** leak here.
42
58
 
@@ -45,5 +61,5 @@ Shared facts flow to both; per-domain taste stays isolated.
45
61
  ## The singleton edge
46
62
 
47
63
  "Set me up a second shopper" → the engine refuses: **a shopper already exists**. Steer to shop
48
- a new niche (mints a domain on the spot) or refine with `sil_learn` — never a second shopper.
49
- </content>
64
+ a new niche (mints a domain on the spot) or refine an existing one with `sil_learn write` — never
65
+ a second shopper.
@@ -57,11 +57,12 @@ authored here**; they mint **lazily on first shop** ([`shop_loop.md`](shop_loop.
57
57
 
58
58
  ### Assemble + endorse — the gate
59
59
 
60
- - **Identity** — propose an `agentId` (lower-kebab, ≠ `main`) and a `name`; confirm both.
61
- - **Assemble** — compose **`{ agentId, name, persona, userSpec }`**, present a readable
62
- summary, self-check the shape (`agentId` lower-kebab & ≠ `main`; non-blank
63
- `name`/`persona`/`userSpec`). Writes nothing — the engine's validate-first step is the
64
- authoritative gate.
60
+ - **Identity** — confirm ONE friendly display `name`. There is **no `agentId` to invent**:
61
+ the engine derives it from `name` (lower-kebab; a `main`/empty slug silently falls back
62
+ to `sil-shopper`), so identity is just the name.
63
+ - **Assemble** — compose **`{ name, persona, userSpec }`**, present a readable summary,
64
+ self-check the shape (non-blank `name`/`persona`/`userSpec`). Writes nothing — the
65
+ engine's validate-first step is the authoritative gate.
65
66
  - **Endorse** — ask for an explicit go-ahead. Endorsement is an affirmative act
66
67
  ("yes, create it") — **not** inferred from the last answer or from silence. **Only on
67
68
  that explicit yes** do you run Part 2.
@@ -94,31 +95,56 @@ first shop.
94
95
 
95
96
  ### The one command
96
97
 
97
- Run one shipped bin — **`sil-openclaw-create-shopper`** — **non-interactive**,
98
- **atomic**, **fail-closed**; it emits one JSON result. It is a standalone operator
99
- script, not the plugin process, so the plugin's "never write host config" guarantee
100
- holds. Feed the endorsed spec as one JSON object on **`stdin`** (or `--spec <path>`):
98
+ Run one shipped script — **non-interactive**, **atomic**, **fail-closed**; it emits one
99
+ JSON result. It is a standalone operator script, not the plugin process, so the plugin's
100
+ "never write host config" guarantee holds.
101
101
 
102
+ **Get its path from `sil_doctor` — never guess it, and never derive it from this file's
103
+ own location.** Call `sil_doctor` and read the report's top-level **`creationEntrypoint`**:
104
+ an absolute path, reported every run. It is the only sound source. This file is published
105
+ to you as a *symlink*, so a `../scripts/…` hop off this directory does not resolve for
106
+ `node` even though `cat` and `ls` say it does; and the bare bin name is on PATH only for
107
+ some installs. Both dead-end at this exact step.
108
+
109
+ Feed the endorsed spec as a **file**, not a heredoc — shell quoting must never touch
110
+ model-authored prose (apostrophes, quotes, backticks, `$`, newlines are the norm in a
111
+ persona). Write it **0600 under a private dir**, run, then **remove it**: the spec carries
112
+ the user's `userSpec` (address, sizes, allergy/ethics rules), so it must not linger
113
+ world-readable. The script never deletes an input it does not own — that is yours.
114
+
115
+ ```
116
+ # 1. sil_doctor → creationEntrypoint (absolute path to the creation script)
117
+ # 2. write the endorsed spec, owner-only, in a private dir:
118
+ umask 077 && mkdir -p ~/.sil-tmp && SPEC=~/.sil-tmp/shopper-spec.json
119
+ # …write the JSON object below to "$SPEC"…
120
+ # 3. run it by absolute path, via node:
121
+ node "<creationEntrypoint>" --spec "$SPEC"
122
+ # 4. remove it, whatever the result:
123
+ rm -f "$SPEC"
102
124
  ```
103
- sil-openclaw-create-shopper <<'JSON'
104
- { "agentId": "my-shopper", "name": "My Shopper",
125
+
126
+ The spec file's contents — one JSON object:
127
+
128
+ ```json
129
+ { "name": "My Shopper",
105
130
  "workspace": "~/.openclaw/workspace-my-shopper",
106
131
  "persona": "…endorsed persona…", "userSpec": "…seeded shared user spec…",
107
132
  "channel": "telegram" }
108
- JSON
109
133
  ```
110
134
 
111
135
  ### The spec (input)
112
136
 
113
137
  | Field | Meaning | Goes to | Required? |
114
138
  |---|---|---|---|
115
- | **agentId** | Lower-kebab (`^[a-z0-9][a-z0-9-]*$`), never `main`. | host | yes |
116
- | **name** | Human-readable name. | sil store | yes |
139
+ | **name** | Human-readable display name; the `agentId` is **derived** from it. | sil store | yes |
117
140
  | **persona** | Who the shopper is — a generalist, its voice, standing rules. | host **`SOUL.md`** | yes |
118
141
  | **workspace** | The shopper's workspace directory. | host | yes |
119
142
  | **userSpec** | Shared **cross-niche** facts + hard constraints (seeded partial). | sil `user_spec.md` | yes |
120
143
  | **channel** | Setup conversation's channel, bound to the shopper. | host bindings | optional (fail-open) |
121
144
 
145
+ The `agentId` is **not an input** — the bin derives it as `deriveAgentId(name)`
146
+ (lower-kebab `^[a-z0-9][a-z0-9-]*$`; a `main`/empty slug silently folds to `sil-shopper`).
147
+
122
148
  **No per-niche input at create** — no method, no PRD; those mint lazily on first shop
123
149
  via `sil_learn create`. The shopper needs web tools (inherited from `agents.defaults`)
124
150
  to mint/refresh domains; if defaults grant none, the bin reports `created` with a
@@ -126,9 +152,10 @@ to mint/refresh domains; if defaults grant none, the bin reports `created` with
126
152
 
127
153
  ### What the bin does, in order (atomic, fail-closed)
128
154
 
129
- 1. **Validate first** — bad/blank `agentId` (lower-kebab, ≠ `main`), `name`, `persona`,
130
- `workspace`, or `userSpec` → **`invalid_request`** naming the field; **nothing
131
- written**.
155
+ 1. **Validate first, then derive the id** — bad/blank `name`, `persona`, `workspace`, or
156
+ `userSpec` → **`invalid_request`** naming the field; **nothing written**. Then
157
+ `agentId = deriveAgentId(name)` — the derivation always yields a conforming id (empty
158
+ or `main` slug → the silent `sil-shopper` fallback), so the id is never a failure mode.
132
159
  2. **Config + singleton pre-flight** — no host config → `persistence_failed`. An
133
160
  existing shopper `user_spec.md`, or an `agentId` clash → **`collision`** ("a shopper
134
161
  already exists"); steer to shop-a-new-niche or refine, **never a second shopper**. An
@@ -141,15 +168,16 @@ to mint/refresh domains; if defaults grant none, the bin reports `created` with
141
168
  6. **Materialize the shared user spec** — `sil_profile_materialize { name, userSpec }`
142
169
  (singleton, no agentId) writes **`user_spec.md`** atomically, name in its
143
170
  frontmatter. **Setup-only: no domain, no method, no PRD.**
144
- 7. **Attach skill + enable plugin + harden tools** (value-mode `config set
145
- --strict-json`, the only mode the pinned `alpine/openclaw:2026.6.9` accepts):
146
- `agents.list[<idx>].skills` ← `["sil"]`; `plugins.entries.sil.enabled` ← `true`;
147
- **`agents.list[<idx>].tools.deny`** ← **`["exec","write","edit","apply_patch"]`** — a
148
- per-agent **deny-list** removing the shell (`exec`) + filesystem mutators while
149
- **keeping the sil tools + web**. A deny (not replacing the base tool set) is used
150
- because per OpenClaw precedence it only *further-restricts* and can never strip the
151
- sil grant.
152
- 8. **Admit sil (plugin trust)** — the shipped **`sil-openclaw-allowlist`** helper
171
+ 7. **Attach skill + enable plugin** (value-mode `config set --strict-json`, the only
172
+ mode the pinned `alpine/openclaw:2026.6.9` accepts):
173
+ `agents.list[<idx>].skills` ← `["sil-shopping"]`; `plugins.entries.sil.enabled` ←
174
+ `true`. **No per-agent `tools.deny`** — the shopper inherits the host default toolset.
175
+ An fs-mutator deny is inert while codex's own shell (surfaced as `bash`) stays open by
176
+ design: it reads the shopper's skill files and can write regardless. The shell stays
177
+ open (trusted single-operator posture); persistence is steered through the sil tools by
178
+ the skill, not enforced by tool policy.
179
+ 8. **Admit sil (plugin trust)** — the shipped **`scripts/allowlist-openclaw.mjs`** helper
180
+ (which the script runs itself, by absolute path via `node` — never the bare name)
153
181
  additively merges the three trust surfaces (`plugins.allow` + `tools.alsoAllow` +
154
182
  `plugins.entries.sil`) — the only way to un-filter `sil_*` without clobbering a
155
183
  co-installed plugin. A non-zero exit → **`persistence_failed`** (never a green