sil-openclaw 0.4.2 → 0.4.4

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.
@@ -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
  },
@@ -138,6 +144,7 @@ function registerLearn(api) {
138
144
  ...(result.prd !== undefined ? { prd: result.prd } : {}),
139
145
  path: result.path,
140
146
  ...(result.assetPath !== undefined ? { assetPath: result.assetPath } : {}),
147
+ ...wiringAdvisories(api),
141
148
  });
142
149
  }
143
150
  return mapFailure(api, "sil_learn", result);
@@ -195,6 +202,7 @@ function registerSearch(api) {
195
202
  + " answered from the sil catalog, never from the open web.",
196
203
  }
197
204
  : {}),
205
+ ...wiringAdvisories(api),
198
206
  });
199
207
  },
200
208
  });
@@ -228,6 +236,7 @@ function registerGet(api) {
228
236
  fields: result.fields,
229
237
  body: result.body,
230
238
  path: result.path,
239
+ ...wiringAdvisories(api),
231
240
  });
232
241
  }
233
242
  return mapFailure(api, "sil_profile_get", result);
@@ -258,6 +267,7 @@ function registerRemove(api) {
258
267
  status: "removed",
259
268
  domainSlug: result.domainSlug,
260
269
  ...(result.prd !== undefined ? { prd: result.prd } : {}),
270
+ ...wiringAdvisories(api),
261
271
  });
262
272
  }
263
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.2",
5
+ "version": "0.4.4",
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
  ],
@@ -70,7 +72,7 @@
70
72
  "config.json (user identity)"
71
73
  ],
72
74
  "noNativeModules": true,
73
- "noChildProcess": true,
75
+ "noChildProcess": false,
74
76
  "noInstallScripts": true,
75
77
  "reportVulnerabilitiesTo": "https://x.com/4gpts"
76
78
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sil-openclaw",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "Turn your OpenClaw into an expert shopping agent.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -32,7 +32,8 @@
32
32
  },
33
33
  "files": [
34
34
  "dist",
35
- "scripts",
35
+ "scripts/create-shopper.mjs",
36
+ "scripts/allowlist-openclaw.mjs",
36
37
  "sil-shopping",
37
38
  "openclaw.plugin.json",
38
39
  "README.md",
@@ -5,22 +5,25 @@
5
5
  * This is Change 3 of the onboarding-ux plan — it collapses the nine-step,
6
6
  * agent-driven host-CLI choreography (`agent_creation_engine.md`) into ONE shipped
7
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`.
8
+ * a standalone operator script — NOT the plugin process — that drives the host
9
+ * `openclaw` CLI via `execFileSync`.
11
10
  *
12
11
  * It runs POST-endorsement: the interview (`agent_creation_engine.md` Part 1) owns the
13
12
  * consent gate; this bin executes an already-assembled, already-endorsed spec
14
13
  * non-interactively. It never prompts, never re-runs the interview.
15
14
  *
16
- * Input — ONE JSON object `{ agentId, name, workspace, persona, userSpec, channel? }`,
15
+ * Input — ONE JSON object `{ name, workspace, persona, userSpec, channel? }`,
17
16
  * read from stdin (primary) or `--spec <path>` (fallback). Passing multiline
18
17
  * 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.
18
+ * `invalid_request`, nothing attempted. There is NO `agentId` input — it is derived
19
+ * from `name` (`deriveAgentId`), so the user never invents an id; a stray `agentId`
20
+ * key is ignored. `channel` is OPTIONAL — the current-channel override for the
21
+ * step-10 bind; absent/blank is fail-open, never invalid_request.
21
22
  *
22
23
  * Choreography (validate-first, then atomic, fail-closed):
23
- * 1. validate the spec — bad/blank field ⇒ invalid_request, nothing attempted
24
+ * 1. validate the spec + derive the id — bad/blank field ⇒ invalid_request, nothing
25
+ * attempted; then agentId = deriveAgentId(name) (lower-kebab; empty/`main` slug ⇒
26
+ * the silent `sil-shopper` fallback — the postcondition guarantees a conforming id)
24
27
  * 2. resolve the host config — none ⇒ persistence_failed (precondition), nothing written
25
28
  * 3. singleton + agentId pre-flight — a shopper OR the agentId already exists ⇒ collision;
26
29
  * an INCONCLUSIVE read (degraded store / CLI error) fails closed — never fabricates
@@ -86,6 +89,7 @@ import {
86
89
  getShopperArtefactDir,
87
90
  } from "../dist/lib/profile-store.js";
88
91
  import { resolveBindChannel } from "../dist/lib/bind-channel.js";
92
+ import { deriveAgentId } from "../dist/lib/derive-agent-id.js";
89
93
 
90
94
  const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..");
91
95
  /** The sibling operator bin that performs the additive, self-validating trust merge. */
@@ -94,9 +98,6 @@ const ALLOWLIST_BIN = resolve(ROOT, "scripts", "allowlist-openclaw.mjs");
94
98
  * skill name), read the same way `scripts/allowlist-openclaw.mjs` reads it. */
95
99
  const MANIFEST_PATH = resolve(ROOT, "openclaw.plugin.json");
96
100
 
97
- /** A shopper id path-segment shape — lower-kebab, never `main` (host-reserved). */
98
- const AGENT_ID_RE = /^[a-z0-9][a-z0-9-]*$/;
99
-
100
101
  /** The sil creed appended to every shopper's SOUL.md after its persona — a soul, not a
101
102
  * rulebook. It carries the mantra (explore first), the loop in three lines, and the one
102
103
  * distinction that matters (the catalog is where you buy, the web is where you learn),
@@ -196,29 +197,18 @@ function readSpecRaw() {
196
197
  }
197
198
  }
198
199
 
199
- /** Validate the endorsed spec — deterministic field order (agentId → name →
200
- * workspace → persona → userSpec). Returns `{ field, message }` on the FIRST bad
201
- * field, or null when the whole spec is good. Writes/attempts nothing. `channel`
202
- * is deliberately NOT validated: it is an optional fail-open convenience, so an
203
- * absent/blank/malformed channel is never invalid_request — it folds to `null` in
204
- * `resolveBindChannel` and degrades to a manual-bind hint at step 10. */
200
+ /** Validate the endorsed spec — deterministic field order (name → workspace →
201
+ * persona → userSpec). Returns `{ field, message }` on the FIRST bad field, or null
202
+ * when the whole spec is good. Writes/attempts nothing. `agentId` is NOT a spec field
203
+ * — it is derived from `name` (`deriveAgentId`) after validate; a stray `agentId` key
204
+ * is ignored. `channel` is deliberately NOT validated: it is an optional fail-open
205
+ * convenience, so an absent/blank/malformed channel is never invalid_request — it
206
+ * folds to `null` in `resolveBindChannel` and degrades to a manual-bind hint at step 10. */
205
207
  function validateSpec(spec) {
206
208
  if (typeof spec !== "object" || spec === null || Array.isArray(spec)) {
207
209
  return {
208
210
  field: "spec",
209
- message: "spec must be a JSON object with { agentId, name, workspace, persona, userSpec, channel? }.",
210
- };
211
- }
212
- if (!nonBlank(spec.agentId)) {
213
- return { field: "agentId", message: "agentId is required and must be non-empty." };
214
- }
215
- if (spec.agentId === "main") {
216
- return { field: "agentId", message: '"main" is host-reserved and cannot be an agentId.' };
217
- }
218
- if (!AGENT_ID_RE.test(spec.agentId)) {
219
- return {
220
- field: "agentId",
221
- message: "agentId must be lower-kebab (a-z, 0-9, hyphen) — got: " + JSON.stringify(spec.agentId),
211
+ message: "spec must be a JSON object with { name, workspace, persona, userSpec, channel? }.",
222
212
  };
223
213
  }
224
214
  if (!nonBlank(spec.name)) {
@@ -438,7 +428,11 @@ function main() {
438
428
  if (bad) {
439
429
  emitFailure("invalid_request", { field: bad.field, cause: bad.message });
440
430
  }
441
- const { agentId, name, workspace, persona, userSpec, channel } = spec;
431
+ const { name, workspace, persona, userSpec, channel } = spec;
432
+ // Derive the host id from the ONE friendly name — the user never invents an id.
433
+ // The lib's postcondition guarantees a conforming lower-kebab id, never `main`
434
+ // (empty/`main` slug ⇒ silent `sil-shopper`), so no runtime re-validation here.
435
+ const agentId = deriveAgentId(name);
442
436
 
443
437
  // --- 2. Resolve the host config (precondition — nothing written yet) ---
444
438
  const configPath = resolveConfigPath();
@@ -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 when the user explicitly asks to shop with sil or manage their sil shopper: register or check their sil account, search the sil catalog or re-check products by id, set up their one shopper (a two-touchpoint, endorsement-gated onboarding), view or forget what it has learned (domains/PRDs), or — running as that shopper — execute the six-beat Spec-Driven Shopping loop and record a fact or taste it surfaced. 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"
@@ -34,9 +34,13 @@ it knows, view or forget a domain, refine it.
34
34
 
35
35
  ## Session start
36
36
 
37
- Confirm the `sil_*` tools are exposed. If missing, the host is filtering them —
38
- run the shipped admission helper `sil-openclaw-allowlist` (it additively admits
39
- 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
40
44
  need an identity: call a catalog tool first and let an unregistered outcome route
41
45
  to `sil_register`, or run `sil_register` up front when intent requires it.
42
46
 
@@ -70,6 +74,7 @@ while setup is incomplete; it sheds once a shopper exists.
70
74
  | (as the shopper) a shopping intent on any niche | the six-beat loop | [`shop_loop.md`](references/shop_loop.md) |
71
75
  | "learn / remember this" — a fact or taste the shopper surfaced | `sil_learn` | [`fill_and_feedback.md`](references/fill_and_feedback.md) |
72
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` | — |
73
78
 
74
79
  Each core tool's behaviour + status taxonomy live in its own tool definition and
75
80
  response (the `recovery`/`status` it returns) — basic shopping needs only that. A full
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: agent-creation-engine
3
- description: Create the single sil-wired shopper end to end — the two-touchpoint onboarding interview (persona + shared user-spec seed, endorsement-gated) then the one-command engine that persists it. Load when the user asks to set up or create their shopper.
3
+ description: Create the single sil-wired shopper end to end — the two-touchpoint onboarding interview (persona + shared user-spec seed, endorsement-gated) then the one-command engine that persists it. Load when the user asks to create or set up their sil shopper.
4
4
  ---
5
5
 
6
6
  # Create the 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
@@ -145,11 +172,8 @@ to mint/refresh domains; if defaults grant none, the bin reports `created` with
145
172
  mode the pinned `alpine/openclaw:2026.6.9` accepts):
146
173
  `agents.list[<idx>].skills` ← `["sil-shopping"]`; `plugins.entries.sil.enabled` ←
147
174
  `true`. **No per-agent `tools.deny`** — the shopper inherits the host default toolset.
148
- An fs-mutator deny is inert while codex's own shell (surfaced as `bash`) stays open by
149
- design: it reads the shopper's skill files and can write regardless. The shell stays
150
- open (trusted single-operator posture); persistence is steered through the sil tools by
151
- the skill, not enforced by tool policy.
152
- 8. **Admit sil (plugin trust)** — the shipped **`sil-openclaw-allowlist`** helper
175
+ 8. **Admit sil (plugin trust)** — the shipped **`scripts/allowlist-openclaw.mjs`** helper
176
+ (which the script runs itself, by absolute path via `node` — never the bare name)
153
177
  additively merges the three trust surfaces (`plugins.allow` + `tools.alsoAllow` +
154
178
  `plugins.entries.sil`) — the only way to un-filter `sil_*` without clobbering a
155
179
  co-installed plugin. A non-zero exit → **`persistence_failed`** (never a green
@@ -175,7 +199,8 @@ carrying the **explore-first** mantra, the loop in three lines, and the one dist
175
199
  that matters: the shopper **mints an unlearned niche first** (a `sil_profile_search`
176
200
  MISS → `sil_learn create`, then search); **the sil catalog is where you buy, the open
177
201
  web is where you learn** (web only researches a niche's buying guide, never sources a
178
- pick); **persists only through `sil_learn`**, never to host files.
202
+ pick); and its **shopping memory is the sil store** — it records what it learns through
203
+ `sil_learn` / `sil_profile_*`.
179
204
 
180
205
  ### Status taxonomy
181
206
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: fill-and-feedback
3
- description: Beat 3 (fill the PRD by precedence, multi-turn, author the Search specs block, hard-constraint dual-enforce, the persistence split) and Beat 6 (the reaction half — capture-gate, confirm-before-write, route-by-scope), plus sil_learn, the one target+change write verb (create | write | attach-asset). Load when eliciting requirements or capturing what a reaction surfaced.
3
+ description: Beats 3 and 6 of the sil shopping loop. Beat 3 fills the PRD by precedence (multi-turn, authors the Search specs block, hard-constraint dual-enforce, the persistence split); Beat 6 is the reaction half (capture-gate, confirm-before-write, route-by-scope). Covers sil_learn, the one target+change write verb (create | write | attach-asset). Load within an active sil shopping loop.
4
4
  ---
5
5
 
6
6
  # Beat 3 (Fill) and Beat 6 (Feedback) — via `sil_learn`
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: setup-onboarding
3
- description: The one-time setup script the router defers to — the five-stage onboarding progression, the after-register shopper offer, and the per-search pitch. Load while a shopper is still being set up; shed once setup is complete.
3
+ description: The one-time setup script the router defers to when state shows sil setup is incomplete (no shopper, or a shopper with no domains) — the five-stage onboarding progression, the after-register shopper offer, and the per-search pitch. Sheds once setup is complete.
4
4
  ---
5
5
 
6
6
  # Setting up the shopper — the staged onboarding
Binary file
@@ -1,228 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Build, pack, and publish to npm and ClawHub.
4
- *
5
- * The two registries publish under DIFFERENT names, by hard constraint:
6
- * - npm: `sil-openclaw` (unscoped — the bare `sil` is taken upstream)
7
- * - ClawHub: `@4gpts/sil` (the plugin id `sil` cannot be claimed on its own;
8
- * it is already owned by the @4gpts/sil package, so ClawHub publishes
9
- * under the scoped @<owner>/<plugin-id> name. The runtime plugin id
10
- * stays `sil`, but install uses the scoped name `openclaw plugins install clawhub:@4gpts/sil`.)
11
- *
12
- * One clean build, then the SAME file content to both registries: npm gets the
13
- * packed `sil-openclaw` tarball as-is; ClawHub gets those identical files
14
- * re-packed with only package.json#name rewritten to `@4gpts/sil` (ClawHub
15
- * requires --name to equal the tarball's package.json#name). Same content, the
16
- * name field is the only difference — no drift in what the two registries serve.
17
- *
18
- * Usage:
19
- * pnpm release publish for real (npm + ClawHub)
20
- * pnpm release:dry dry-run both: build + pack + preview, upload NOTHING
21
- *
22
- * Real-publish preflight (skipped under --dry-run, which is a pure preview):
23
- * - clean git working tree
24
- * - HEAD carries the v<version> tag (run `pnpm version <bump>` first)
25
- * - `npm whoami` succeeds (run `npm login`)
26
- * - `clawhub` CLI on PATH (npm i -g clawhub && clawhub login)
27
- *
28
- * ClawHub attribution: --family code-plugin, --owner (env CLAWHUB_OWNER,
29
- * default below), --source-repo (derived from package.json#repository),
30
- * --source-commit HEAD, and --tags latest on a real publish.
31
- */
32
-
33
- import { execFileSync } from "node:child_process";
34
- import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
35
- import { tmpdir } from "node:os";
36
- import { resolve, dirname, basename } from "node:path";
37
- import { fileURLToPath } from "node:url";
38
-
39
- const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..");
40
- const DRY_RUN = process.argv.includes("--dry-run");
41
- // The 4gpts ClawHub org we publish under (mirrors the @4gpts npm scope). You
42
- // authenticate as an org member via `clawhub login`; override with CLAWHUB_OWNER.
43
- const DEFAULT_CLAWHUB_OWNER = "4gpts";
44
- const CLAWHUB_OWNER = process.env.CLAWHUB_OWNER || DEFAULT_CLAWHUB_OWNER;
45
- const CLAWHUB_FAMILY = "code-plugin";
46
-
47
- const pkg = JSON.parse(readFileSync(resolve(ROOT, "package.json"), "utf8"));
48
- const version = pkg.version;
49
- const tag = `v${version}`;
50
-
51
- // ClawHub package name: the SCOPED @<owner>/<plugin-id> identity (e.g. @4gpts/sil).
52
- // The bare plugin id (`sil`, openclaw.plugin.json#id) cannot be a package name on
53
- // its own — it is already claimed by the @4gpts/sil package — so the scoped name is
54
- // the ClawHub identity, while the runtime plugin id stays `sil`. Derived from owner
55
- // + id so it never drifts from the manifest.
56
- const CLAWHUB_PLUGIN_ID = JSON.parse(
57
- readFileSync(resolve(ROOT, "openclaw.plugin.json"), "utf8"),
58
- ).id;
59
- const CLAWHUB_NAME = `@${CLAWHUB_OWNER}/${CLAWHUB_PLUGIN_ID}`;
60
-
61
- const log = (msg) => console.log(`[release] ${msg}`);
62
- function fail(msg) {
63
- console.error(`[release] ${msg}`);
64
- process.exit(1);
65
- }
66
-
67
- /** Run a command, inheriting stdio (output streams to the terminal). */
68
- function runInherit(cmd, args) {
69
- execFileSync(cmd, args, { cwd: ROOT, stdio: "inherit" });
70
- }
71
- /** Run a command and capture trimmed stdout. */
72
- function capture(cmd, args) {
73
- return execFileSync(cmd, args, { cwd: ROOT, encoding: "utf8" }).trim();
74
- }
75
- /** Capture stdout, or null on any non-zero exit / spawn failure. */
76
- function tryCapture(cmd, args) {
77
- try {
78
- return capture(cmd, args);
79
- } catch {
80
- return null;
81
- }
82
- }
83
- /** True if `cmd` is resolvable on PATH (a non-zero exit still means present). */
84
- function commandExists(cmd) {
85
- try {
86
- execFileSync(cmd, ["--version"], { stdio: "ignore" });
87
- return true;
88
- } catch (err) {
89
- return err.code !== "ENOENT";
90
- }
91
- }
92
-
93
- /** Derive "Owner/Repo" for ClawHub --source-repo from package.json#repository.url. */
94
- function sourceRepo() {
95
- const url = pkg.repository?.url ?? "";
96
- const m = url.match(/github\.com[/:]([^/]+\/[^/]+?)(?:\.git)?$/);
97
- if (!m) fail(`cannot derive --source-repo from package.json#repository.url: "${url}"`);
98
- return m[1];
99
- }
100
-
101
- function preflight() {
102
- if (!pkg.name) fail("package.json#name is missing — cannot publish.");
103
- if (DRY_RUN) {
104
- log("dry-run: skipping clean-tree / tag / auth preflight (pure preview).");
105
- return;
106
- }
107
- const dirty = capture("git", ["status", "--porcelain"]);
108
- if (dirty) fail(`working tree is dirty — commit or stash first:\n${dirty}`);
109
-
110
- const headTags = (tryCapture("git", ["tag", "--points-at", "HEAD"]) ?? "").split("\n");
111
- if (!headTags.includes(tag)) {
112
- fail(`HEAD is not tagged ${tag}. Run \`pnpm version <patch|minor|major>\` first.`);
113
- }
114
-
115
- const npmUser = tryCapture("npm", ["whoami"]);
116
- if (!npmUser) fail("not authenticated with npm. Run `npm login`.");
117
- log(`npm user: ${npmUser}`);
118
-
119
- if (!commandExists("clawhub")) {
120
- fail("clawhub CLI not found on PATH. Run `npm i -g clawhub && clawhub login`.");
121
- }
122
- }
123
-
124
- /** Clean-build dist, then pack a single tarball. Returns its absolute path. */
125
- function buildAndPack() {
126
- log("building (clean dist → tsc)…");
127
- runInherit("pnpm", ["build"]);
128
- log("packing tarball…");
129
- // --ignore-scripts: dist is already fresh from the explicit build above, so
130
- // skip prepack here and keep `npm pack --json` stdout pure JSON.
131
- const out = capture("npm", ["pack", "--json", "--ignore-scripts"]);
132
- const filename = JSON.parse(out)?.[0]?.filename;
133
- if (!filename) fail("`npm pack --json` did not report a tarball filename.");
134
- return resolve(ROOT, filename);
135
- }
136
-
137
- function publishNpm(tarball) {
138
- const args = ["publish", tarball];
139
- if (DRY_RUN) args.push("--dry-run");
140
- log(`npm publish${DRY_RUN ? " --dry-run" : ""} ${basename(tarball)}`);
141
- runInherit("npm", args);
142
- }
143
-
144
- /**
145
- * Re-pack the just-built npm tarball under the ClawHub name. ClawHub requires
146
- * --name to EQUAL the tarball's package.json#name, and the npm tarball carries
147
- * `sil-openclaw` — so extract it, rewrite ONLY package.json#name to CLAWHUB_NAME
148
- * (@4gpts/sil), and `npm pack` the renamed package. The content is identical to
149
- * npm's (same extracted files); only the name field changes. Returns the staged
150
- * tarball path — its parent temp dir is the caller's to remove.
151
- */
152
- function packClawhubTarball(npmTarball) {
153
- const stage = mkdtempSync(resolve(tmpdir(), "sil-clawhub-"));
154
- // Extract the already-built npm tarball (→ <stage>/package/...) so the ClawHub
155
- // artifact ships the exact same files, not a separate build.
156
- runInherit("tar", ["-xzf", npmTarball, "-C", stage]);
157
- const pkgPath = resolve(stage, "package", "package.json");
158
- const staged = JSON.parse(readFileSync(pkgPath, "utf8"));
159
- staged.name = CLAWHUB_NAME;
160
- writeFileSync(pkgPath, `${JSON.stringify(staged, null, 2)}\n`, "utf8");
161
- // Re-pack the renamed package dir into the same temp dir. --ignore-scripts: no
162
- // prepack rebuild (the dist is already inside the extracted package).
163
- const out = capture("npm", [
164
- "pack",
165
- resolve(stage, "package"),
166
- "--json",
167
- "--ignore-scripts",
168
- "--pack-destination",
169
- stage,
170
- ]);
171
- const filename = JSON.parse(out)?.[0]?.filename;
172
- if (!filename) fail("clawhub stage: `npm pack --json` did not report a tarball filename.");
173
- return resolve(stage, filename);
174
- }
175
-
176
- function publishClawhub(npmTarball) {
177
- const sha = capture("git", ["rev-parse", "HEAD"]);
178
- // The release notes for this version, straight from CHANGELOG.md (empty if the
179
- // version has no section yet — then we just omit --changelog).
180
- const changelog = (tryCapture("node", ["scripts/changelog.mjs", "show", version]) ?? "").trim();
181
- // Stage the @4gpts/sil-named tarball (ClawHub requires --name == package name).
182
- const tarball = packClawhubTarball(npmTarball);
183
- try {
184
- const args = [
185
- "package",
186
- "publish",
187
- tarball,
188
- "--family",
189
- CLAWHUB_FAMILY,
190
- "--name",
191
- CLAWHUB_NAME,
192
- "--owner",
193
- CLAWHUB_OWNER,
194
- "--source-repo",
195
- sourceRepo(),
196
- "--source-commit",
197
- sha,
198
- ];
199
- if (changelog) args.push("--changelog", changelog);
200
- if (DRY_RUN) args.push("--dry-run");
201
- else args.push("--tags", "latest");
202
- log(
203
- `clawhub package publish${DRY_RUN ? " --dry-run" : ""} (name=${CLAWHUB_NAME}, owner=${CLAWHUB_OWNER}, ` +
204
- `repo=${sourceRepo()}, changelog=${changelog ? "yes" : "none"})`,
205
- );
206
- runInherit("clawhub", args);
207
- } finally {
208
- rmSync(dirname(tarball), { recursive: true, force: true });
209
- }
210
- }
211
-
212
- log(`${DRY_RUN ? "DRY-RUN " : ""}release ${pkg.name}@${version} (npm) + ${CLAWHUB_NAME}@${version} (ClawHub)`);
213
- preflight();
214
- const tarball = buildAndPack();
215
- try {
216
- publishNpm(tarball);
217
- publishClawhub(tarball);
218
- } finally {
219
- rmSync(tarball, { force: true });
220
- }
221
- log(
222
- DRY_RUN
223
- ? "dry-run complete — nothing was uploaded."
224
- : `published ${pkg.name}@${version} (npm) + ${CLAWHUB_NAME}@${version} (ClawHub).`,
225
- );
226
- if (!DRY_RUN) {
227
- log(`next: \`clawhub package readiness ${CLAWHUB_NAME}\` to check ClawHub readiness blockers.`);
228
- }