sil-openclaw 0.4.1 → 0.4.2
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 +41 -0
- package/dist/lib/profile-store.js +44 -147
- package/dist/tools/profile.js +14 -24
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/scripts/create-shopper.mjs +7 -33
- package/sil-shopping/SKILL.md +7 -0
- package/sil-shopping/examples/multi_domain_shopper_walkthrough.md +28 -12
- package/sil-shopping/references/agent_creation_engine.md +8 -8
- package/sil-shopping/references/fill_and_feedback.md +40 -24
- package/sil-shopping/references/method_and_prds.md +56 -24
- package/sil-shopping/references/shop_loop.md +37 -32
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,47 @@ release (`clawhub package publish --changelog`). See [README](./README.md#releas
|
|
|
10
10
|
|
|
11
11
|
## [Unreleased]
|
|
12
12
|
|
|
13
|
+
## [0.4.2] - 2026-07-14
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- **The shopper no longer sets a per-agent `tools.deny`.** `create-shopper.mjs` used to
|
|
18
|
+
deny `["exec","write","edit","apply_patch"]`; removed. On the codex runtime the shell is
|
|
19
|
+
codex-native (surfaced as `bash`) — a tool the deny never named, so it read skill files
|
|
20
|
+
and could write host files regardless, while the denied OpenClaw `exec` tool was one
|
|
21
|
+
codex never used. Denying fs-mutators while a shell stays open buys nothing (an open
|
|
22
|
+
shell writes anyway — documented OpenClaw behaviour). The shopper now inherits the host
|
|
23
|
+
default toolset; the shell is open by design (trusted single-operator posture) and is how
|
|
24
|
+
codex reads its progressively-disclosed skill references. Persistence is steered to the
|
|
25
|
+
sil tools by the skill, not by tool policy.
|
|
26
|
+
- **`SKILL.md`'s always-on contract now pins two behaviours that lived only in read-once
|
|
27
|
+
references:** the shopper's memory is the sil store (`sil_learn` / `sil_profile_*`),
|
|
28
|
+
never a workspace `MEMORY.md`; and Beat 4 is bounded to **≤ 4 spec-filtered `sil_search`
|
|
29
|
+
calls** per request (core first, then widenings — never brand-by-brand). Both went stale
|
|
30
|
+
in attention when they lived two lazy reference-hops deep.
|
|
31
|
+
- **`sil_learn`'s write model is now document-first: `create` / `write` / `attach-asset`.**
|
|
32
|
+
The surgical bullet ops (`append` / `amend` / `retract`) are removed. `create` mints a
|
|
33
|
+
NEW method/PRD (errors if one exists); `write` replaces an existing doc's whole body with
|
|
34
|
+
a reconciled version the model authors (read it first, carry every buyer line forward). A
|
|
35
|
+
correction now rewrites the line it changes instead of stacking a contradicting bullet —
|
|
36
|
+
the self-contradicting PRD (a "prefer transparency" requirement beside a "transparency not
|
|
37
|
+
valued" correction) becomes structurally impossible. The method now holds only the general
|
|
38
|
+
buying guide + coined spec **vocabulary** (never this-buyer values); the PRD carries a
|
|
39
|
+
**`## Search specs`** block — the resolved `{ns,key,op,value,hard?}` predicate set projected
|
|
40
|
+
verbatim into `sil_search`, so structured filters no longer decay to keyword-only
|
|
41
|
+
mid-session. Beat 1 pins the domain to the broad, reusable product category (never folding
|
|
42
|
+
the use-context into the slug), and a "prefer X, Y/Z acceptable" requirement becomes one
|
|
43
|
+
`op:in` set with the favourite applied as ranking, not an over-hard `eq`.
|
|
44
|
+
|
|
45
|
+
### Fixed
|
|
46
|
+
|
|
47
|
+
- **Artefacts no longer serialize two stacked frontmatter blocks.** A model-authored
|
|
48
|
+
`sil_learn create` body (or `sil_profile_materialize` userSpec) that began with its own
|
|
49
|
+
`--- … ---` block got the store's canonical frontmatter wrapped around it.
|
|
50
|
+
`serializeArtefact` now strips a leading frontmatter fence from the body first, so every
|
|
51
|
+
artefact carries exactly one (the store's — frontmatter-as-truth); existing
|
|
52
|
+
double-frontmatter files self-heal on their next write.
|
|
53
|
+
|
|
13
54
|
## [0.4.1] - 2026-07-14
|
|
14
55
|
|
|
15
56
|
### Fixed
|
|
@@ -45,9 +45,6 @@ const METHOD_FILE = "method.md";
|
|
|
45
45
|
/** A domain slug / PRD key must be lower-kebab and never `main` (host-reserved). Both
|
|
46
46
|
* are joined as filesystem path segments, so they carry this guard before any join. */
|
|
47
47
|
const SEGMENT_RE = /^[a-z0-9][a-z0-9-]*$/;
|
|
48
|
-
/** The stable marker the shop loop's reject-at-pick rule greps for an inviolable
|
|
49
|
-
* constraint (e.g. `- [hard] never leather`). */
|
|
50
|
-
const HARD_MARKER = "[hard]";
|
|
51
48
|
/** attach-asset limits: ~8 MB decoded, image MIME allowlist → file extension. */
|
|
52
49
|
const MAX_ASSET_BYTES = 8 * 1024 * 1024;
|
|
53
50
|
const MIME_EXT = {
|
|
@@ -126,7 +123,10 @@ function serializeArtefact(fields, body) {
|
|
|
126
123
|
const fm = Object.entries(fields)
|
|
127
124
|
.map(([k, v]) => k + ": " + scalar(v))
|
|
128
125
|
.join("\n");
|
|
129
|
-
|
|
126
|
+
// The store owns frontmatter — strip any block a model prepended to the body so the
|
|
127
|
+
// artefact never stacks two (self-heals a previously double-wrapped file on re-write).
|
|
128
|
+
const clean = stripLeadingFrontmatter(body);
|
|
129
|
+
const b = clean.endsWith("\n") ? clean : clean + "\n";
|
|
130
130
|
return "---\n" + fm + "\n---\n" + b;
|
|
131
131
|
}
|
|
132
132
|
/** Parse `--- key: value … ---` frontmatter + body. Returns null (⇒ `unreadable`) on
|
|
@@ -150,6 +150,15 @@ function parseArtefact(raw) {
|
|
|
150
150
|
return null;
|
|
151
151
|
return { fields, body };
|
|
152
152
|
}
|
|
153
|
+
/** Strip a leading `--- … ---` frontmatter block a model may have prepended to a body,
|
|
154
|
+
* reusing `parseArtefact` so ONLY a fence whose content is real frontmatter (≥1
|
|
155
|
+
* `key: value`) is removed — a body opening with a bare `---` thematic break parses to
|
|
156
|
+
* null and is returned untouched. The store owns frontmatter (frontmatter-as-truth), so a
|
|
157
|
+
* model-authored block must never survive into the serialized body and stack a second. */
|
|
158
|
+
function stripLeadingFrontmatter(body) {
|
|
159
|
+
const parsed = parseArtefact(body);
|
|
160
|
+
return parsed === null ? body : parsed.body;
|
|
161
|
+
}
|
|
153
162
|
/** Read + parse one artefact file, or null if absent/unreadable/malformed. */
|
|
154
163
|
function readArtefactFile(path) {
|
|
155
164
|
if (!existsSync(path))
|
|
@@ -251,36 +260,25 @@ function resolveTarget(spec) {
|
|
|
251
260
|
};
|
|
252
261
|
}
|
|
253
262
|
export function learnArtefact(spec) {
|
|
254
|
-
// `hard` is valid ONLY on append to user_spec / prd. Every other combination —
|
|
255
|
-
// all four non-append kinds on any target, and append to method — is rejected
|
|
256
|
-
// LOUDLY, never silently dropped: a buyer who passes `hard:true` expecting to
|
|
257
|
-
// promote a constraint must learn at once when the promotion does not land.
|
|
258
|
-
// Hoisted ABOVE the kind switch so a hard misuse wins error-precedence over the
|
|
259
|
-
// per-kind field checks (this subsumes the old method-only append guard).
|
|
260
|
-
if (spec.hard === true && !(spec.kind === "append" && spec.target !== "method")) {
|
|
261
|
-
return invalid("hard", "hard is valid only on append to user_spec or prd — a method carries no hard"
|
|
262
|
-
+ " constraints, and create/amend/retract/attach-asset take no hard flag.");
|
|
263
|
-
}
|
|
264
263
|
switch (spec.kind) {
|
|
265
264
|
case "create":
|
|
266
265
|
return learnCreate(spec);
|
|
267
|
-
case "
|
|
268
|
-
return
|
|
269
|
-
case "amend":
|
|
270
|
-
case "retract":
|
|
271
|
-
return learnAmendRetract(spec);
|
|
266
|
+
case "write":
|
|
267
|
+
return learnWrite(spec);
|
|
272
268
|
case "attach-asset":
|
|
273
269
|
return learnAttachAsset(spec);
|
|
274
270
|
default:
|
|
275
|
-
return invalid("kind", "kind must be one of create|
|
|
271
|
+
return invalid("kind", "kind must be one of create|write|attach-asset.");
|
|
276
272
|
}
|
|
277
273
|
}
|
|
278
|
-
/** `create` mints a
|
|
279
|
-
*
|
|
274
|
+
/** `create` mints a NEW method or PRD body atomically — the file IS the registration
|
|
275
|
+
* (no manifest). Refuses if one already exists at these coordinates (→ use `write` to
|
|
276
|
+
* replace it), so a mint never silently clobbers. NOT valid for user_spec (that is
|
|
277
|
+
* materialize; refine it with `write`). */
|
|
280
278
|
function learnCreate(spec) {
|
|
281
279
|
if (spec.target === "user_spec") {
|
|
282
280
|
return invalid("target", "create is not valid for user_spec — the shopper's shared spec is written by"
|
|
283
|
-
+ " sil_profile_materialize (setup), then refined with
|
|
281
|
+
+ " sil_profile_materialize (setup), then refined with kind:write.");
|
|
284
282
|
}
|
|
285
283
|
if (!nonBlank(spec.body))
|
|
286
284
|
return invalid("body", "body is required and must be non-empty.");
|
|
@@ -293,6 +291,10 @@ function learnCreate(spec) {
|
|
|
293
291
|
if (!nonBlank(spec.name))
|
|
294
292
|
return invalid("name", "name is required for a method.");
|
|
295
293
|
const path = join(getDomainArtefactDir(slug), METHOD_FILE);
|
|
294
|
+
if (existsSync(path)) {
|
|
295
|
+
return invalid("kind", 'a method already exists for domain "' + slug + '" — use kind:write to replace its'
|
|
296
|
+
+ " body (create only mints a new one, it never overwrites).");
|
|
297
|
+
}
|
|
296
298
|
const fields = { domain: slug, name: spec.name, updated_at: now };
|
|
297
299
|
try {
|
|
298
300
|
atomicWrite(path, serializeArtefact(fields, spec.body));
|
|
@@ -312,16 +314,17 @@ function learnCreate(spec) {
|
|
|
312
314
|
return invalid(f, f + " is required for a prd.");
|
|
313
315
|
}
|
|
314
316
|
const path = join(getDomainArtefactDir(slug), PRDS_SUBDIR, prd + ".md");
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
317
|
+
if (existsSync(path)) {
|
|
318
|
+
return invalid("kind", 'a PRD "' + prd + '" already exists in domain "' + slug + '" — use kind:write to'
|
|
319
|
+
+ " replace its body (create only mints a new one, it never overwrites).");
|
|
320
|
+
}
|
|
318
321
|
const fields = {
|
|
319
322
|
key: prd,
|
|
320
323
|
product: spec.product,
|
|
321
324
|
intent: spec.intent,
|
|
322
325
|
title: spec.title,
|
|
323
326
|
domain: slug,
|
|
324
|
-
created_at:
|
|
327
|
+
created_at: now,
|
|
325
328
|
updated_at: now,
|
|
326
329
|
};
|
|
327
330
|
try {
|
|
@@ -332,81 +335,26 @@ function learnCreate(spec) {
|
|
|
332
335
|
}
|
|
333
336
|
return { ok: true, kind: "create", target: "prd", domain: slug, prd, path };
|
|
334
337
|
}
|
|
335
|
-
/**
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
*
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
338
|
+
/** `write` replaces the WHOLE body of an EXISTING method / PRD / user_spec with a
|
|
339
|
+
* reconciled version — the model reads current (`sil_profile_get`), reconciles in
|
|
340
|
+
* context, and writes the whole doc back. Frontmatter coordinates + `created_at` are
|
|
341
|
+
* preserved and `updated_at` bumps (user_spec carries no timestamp). Fail-closed on a
|
|
342
|
+
* missing doc (`not_found` — write never mints, that is create) and on a present-but-
|
|
343
|
+
* corrupt one (`unreadable` — inspect / repair, never clobber a recoverable artefact). */
|
|
344
|
+
function learnWrite(spec) {
|
|
345
|
+
if (!nonBlank(spec.body))
|
|
346
|
+
return invalid("body", "body is required and must be non-empty.");
|
|
342
347
|
const target = resolveTarget(spec);
|
|
343
348
|
if ("ok" in target)
|
|
344
349
|
return target;
|
|
345
350
|
const existing = readArtefactFile(target.path);
|
|
346
351
|
if (existing === null) {
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
const bullet = "- " + mark + spec.text.trim();
|
|
352
|
-
let body;
|
|
353
|
-
if (nonBlank(spec.section)) {
|
|
354
|
-
const inserted = insertUnderSection(existing.body, spec.section, bullet);
|
|
355
|
-
if (inserted === null) {
|
|
356
|
-
const sections = listSections(existing.body);
|
|
357
|
-
return invalid("section", 'no "## ' + spec.section + '" heading in the ' + target.label + "; existing sections: "
|
|
358
|
-
+ (sections.length > 0 ? sections.join(", ") : "(none)"));
|
|
359
|
-
}
|
|
360
|
-
body = inserted;
|
|
352
|
+
if (existsSync(target.path))
|
|
353
|
+
return unreadable(target.path);
|
|
354
|
+
return notFound("The target " + target.label + " does not exist — mint it with kind:create first"
|
|
355
|
+
+ " (write replaces an existing doc, it never mints).");
|
|
361
356
|
}
|
|
362
|
-
|
|
363
|
-
body = existing.body.replace(/\n*$/, "\n") + bullet + "\n";
|
|
364
|
-
}
|
|
365
|
-
return writeArtefactBody(target, existing.fields, body, "append");
|
|
366
|
-
}
|
|
367
|
-
/** amend/retract — exact single-occurrence bullet match on `from`; 0 → not_found,
|
|
368
|
-
* 2+ → invalid_request(ambiguous_match). A `[hard]` marker is preserved on amend. */
|
|
369
|
-
function learnAmendRetract(spec) {
|
|
370
|
-
if (!nonBlank(spec.from))
|
|
371
|
-
return invalid("from", "from is required and must be non-empty.");
|
|
372
|
-
if (spec.kind === "amend" && !nonBlank(spec.to)) {
|
|
373
|
-
return invalid("to", "to is required for amend.");
|
|
374
|
-
}
|
|
375
|
-
const target = resolveTarget(spec);
|
|
376
|
-
if ("ok" in target)
|
|
377
|
-
return target;
|
|
378
|
-
const existing = readArtefactFile(target.path);
|
|
379
|
-
if (existing === null) {
|
|
380
|
-
return notFound("The target " + target.label + " does not exist — nothing to change.");
|
|
381
|
-
}
|
|
382
|
-
const from = spec.from.trim();
|
|
383
|
-
const lines = existing.body.split("\n");
|
|
384
|
-
const matches = [];
|
|
385
|
-
const scoped = nonBlank(spec.section)
|
|
386
|
-
? sectionLineRange(lines, spec.section)
|
|
387
|
-
: { start: 0, end: lines.length };
|
|
388
|
-
for (let i = scoped.start; i < scoped.end; i++) {
|
|
389
|
-
const parsed = parseBullet(lines[i]);
|
|
390
|
-
if (parsed && parsed.text.trim() === from)
|
|
391
|
-
matches.push(i);
|
|
392
|
-
}
|
|
393
|
-
if (matches.length === 0) {
|
|
394
|
-
return notFound('No bullet matching "' + from + '" in the ' + target.label + ".");
|
|
395
|
-
}
|
|
396
|
-
if (matches.length > 1) {
|
|
397
|
-
return invalid("ambiguous_match", "the text matches " + matches.length + " bullets — refine `from` (or scope with"
|
|
398
|
-
+ " `section`) so it matches exactly one; refusing an ambiguous multi-write.");
|
|
399
|
-
}
|
|
400
|
-
const idx = matches[0];
|
|
401
|
-
if (spec.kind === "retract") {
|
|
402
|
-
lines.splice(idx, 1);
|
|
403
|
-
}
|
|
404
|
-
else {
|
|
405
|
-
const parsed = parseBullet(lines[idx]);
|
|
406
|
-
const mark = parsed.hard ? HARD_MARKER + " " : "";
|
|
407
|
-
lines[idx] = parsed.indent + "- " + mark + spec.to.trim();
|
|
408
|
-
}
|
|
409
|
-
return writeArtefactBody(target, existing.fields, lines.join("\n"), spec.kind);
|
|
357
|
+
return writeArtefactBody(target, existing.fields, spec.body, "write");
|
|
410
358
|
}
|
|
411
359
|
/** attach-asset — persist image bytes into `domains/<slug>/assets/<hash>.<ext>`
|
|
412
360
|
* (owner-only, content-hash = free dedup), then link them into the target by a
|
|
@@ -493,57 +441,6 @@ function writeArtefactBody(target, fields, body, kind) {
|
|
|
493
441
|
path: target.path,
|
|
494
442
|
};
|
|
495
443
|
}
|
|
496
|
-
/** Parse a markdown bullet line (`- text` / `- [hard] text`), or null. */
|
|
497
|
-
function parseBullet(line) {
|
|
498
|
-
const m = /^(\s*)-\s+(\[hard\]\s+)?(.*)$/.exec(line);
|
|
499
|
-
if (!m)
|
|
500
|
-
return null;
|
|
501
|
-
return { indent: m[1], hard: m[2] !== undefined, text: m[3] };
|
|
502
|
-
}
|
|
503
|
-
/** All `## <section>` heading texts present in a body (for a fail-closed message). */
|
|
504
|
-
function listSections(body) {
|
|
505
|
-
return body
|
|
506
|
-
.split("\n")
|
|
507
|
-
.map((l) => /^##\s+(.*)$/.exec(l))
|
|
508
|
-
.filter((m) => m !== null)
|
|
509
|
-
.map((m) => m[1].trim());
|
|
510
|
-
}
|
|
511
|
-
/** The [start,end) line range of a `## <section>` body (heading exclusive, up to the
|
|
512
|
-
* next `## ` heading or EOF). `start === -1` when the heading is absent. */
|
|
513
|
-
function sectionLineRange(lines, section) {
|
|
514
|
-
const target = section.trim();
|
|
515
|
-
let start = -1;
|
|
516
|
-
for (let i = 0; i < lines.length; i++) {
|
|
517
|
-
const m = /^##\s+(.*)$/.exec(lines[i]);
|
|
518
|
-
if (m && m[1].trim() === target) {
|
|
519
|
-
start = i + 1;
|
|
520
|
-
break;
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
if (start === -1)
|
|
524
|
-
return { start: 0, end: 0 };
|
|
525
|
-
let end = lines.length;
|
|
526
|
-
for (let i = start; i < lines.length; i++) {
|
|
527
|
-
if (/^##\s+/.test(lines[i])) {
|
|
528
|
-
end = i;
|
|
529
|
-
break;
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
return { start, end };
|
|
533
|
-
}
|
|
534
|
-
/** Insert `bullet` at the end of `## <section>` (before the next heading, after the
|
|
535
|
-
* section's last non-blank line), or null when the heading is absent. */
|
|
536
|
-
function insertUnderSection(body, section, bullet) {
|
|
537
|
-
if (!listSections(body).includes(section.trim()))
|
|
538
|
-
return null;
|
|
539
|
-
const lines = body.split("\n");
|
|
540
|
-
const range = sectionLineRange(lines, section);
|
|
541
|
-
let at = range.end;
|
|
542
|
-
while (at > range.start && lines[at - 1].trim() === "")
|
|
543
|
-
at--;
|
|
544
|
-
lines.splice(at, 0, bullet);
|
|
545
|
-
return lines.join("\n");
|
|
546
|
-
}
|
|
547
444
|
export function searchProfileFrontmatter(query = {}) {
|
|
548
445
|
const domainsRoot = join(getShopperArtefactDir(), DOMAINS_SUBDIR);
|
|
549
446
|
const domains = [];
|
package/dist/tools/profile.js
CHANGED
|
@@ -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
|
|
11
|
-
*
|
|
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.
|
|
@@ -80,33 +80,28 @@ function registerLearn(api) {
|
|
|
80
80
|
label: "Teach the sil shopper (create or refine a method / PRD)",
|
|
81
81
|
description: "The single target+change verb owning the sil shopper's method/PRD lifecycle."
|
|
82
82
|
+ " `target` (user_spec | method | prd) picks WHERE the change lands; `kind`"
|
|
83
|
-
+ " (create |
|
|
84
|
-
+ "
|
|
85
|
-
+ "
|
|
86
|
-
+ "
|
|
87
|
-
+ "
|
|
88
|
-
+ "
|
|
83
|
+
+ " (create | write | attach-asset) picks the change. `create` mints a NEW method/"
|
|
84
|
+
+ "PRD (not valid for user_spec; errors if one already exists — use write). `write`"
|
|
85
|
+
+ " replaces an EXISTING doc's whole body with a reconciled version you author (read"
|
|
86
|
+
+ " it first with sil_profile_get and carry every buyer line forward; else not_found)."
|
|
87
|
+
+ " `attach-asset` links image bytes. To change anything, WRITE the whole reconciled"
|
|
88
|
+
+ " doc — there is no append/amend, so a correction never stacks a contradicting"
|
|
89
|
+
+ " line. Local-only, atomic, owner-only, no network; a bad field → invalid_request"
|
|
90
|
+
+ " and writes nothing.",
|
|
89
91
|
parameters: Type.Object({
|
|
90
92
|
target: Type.Union([Type.Literal("user_spec"), Type.Literal("method"), Type.Literal("prd")], { description: "WHERE the change lands: user_spec | method | prd." }),
|
|
91
93
|
kind: Type.Union([
|
|
92
94
|
Type.Literal("create"),
|
|
93
|
-
Type.Literal("
|
|
94
|
-
Type.Literal("amend"),
|
|
95
|
-
Type.Literal("retract"),
|
|
95
|
+
Type.Literal("write"),
|
|
96
96
|
Type.Literal("attach-asset"),
|
|
97
|
-
], { description: "The change: create
|
|
97
|
+
], { description: "The change: create (mint new) | write (replace whole body) | attach-asset." }),
|
|
98
98
|
domain: Type.Optional(Type.String({ description: "The domain slug (lower-kebab, not \"main\") — required for method/prd." })),
|
|
99
99
|
prd: Type.Optional(Type.String({ description: "The PRD key <product>-<intent> (lower-kebab) — required for a prd target." })),
|
|
100
100
|
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
|
|
101
|
+
body: Type.Optional(Type.String({ description: "create / write: the whole markdown body (mint, or the reconciled replacement)." })),
|
|
102
102
|
product: Type.Optional(Type.String({ description: "create prd: the product type." })),
|
|
103
103
|
intent: Type.Optional(Type.String({ description: "create prd: the use-context (general when context-free)." })),
|
|
104
104
|
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
105
|
bytes: Type.Optional(Type.String({ description: "attach-asset: the image bytes, base64-encoded." })),
|
|
111
106
|
mime: Type.Optional(Type.String({ description: "attach-asset: image/jpeg | image/png | image/webp | image/gif." })),
|
|
112
107
|
caption: Type.Optional(Type.String({ description: "attach-asset: an optional caption for the markdown link." })),
|
|
@@ -114,7 +109,7 @@ function registerLearn(api) {
|
|
|
114
109
|
async execute(_callId, params) {
|
|
115
110
|
const spec = {
|
|
116
111
|
target: params["target"] ?? "method",
|
|
117
|
-
kind: params["kind"] ?? "
|
|
112
|
+
kind: params["kind"] ?? "write",
|
|
118
113
|
domain: optString(params["domain"]),
|
|
119
114
|
prd: optString(params["prd"]),
|
|
120
115
|
name: optString(params["name"]),
|
|
@@ -122,11 +117,6 @@ function registerLearn(api) {
|
|
|
122
117
|
product: optString(params["product"]),
|
|
123
118
|
intent: optString(params["intent"]),
|
|
124
119
|
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
120
|
bytes: optString(params["bytes"]),
|
|
131
121
|
mime: optString(params["mime"]),
|
|
132
122
|
caption: optString(params["caption"]),
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -31,8 +31,7 @@
|
|
|
31
31
|
* 7. materializeProfile — REUSED; SETUP-ONLY { name, userSpec } ⇒ shared
|
|
32
32
|
* user_spec.md (its frontmatter carries the name);
|
|
33
33
|
* NO manifest, no domain minted at create
|
|
34
|
-
* 8. attach the sil skill +
|
|
35
|
-
* a per-agent tools.deny that keeps sil + web) + enable the sil plugin (config set)
|
|
34
|
+
* 8. attach the sil skill + enable the sil plugin (config set)
|
|
36
35
|
* 9. sil-openclaw-allowlist — REUSED whole; additive/idempotent/atomic three-surface
|
|
37
36
|
* trust merge (plugins.allow + tools.alsoAllow + plugins.entries.sil)
|
|
38
37
|
* 10. bind the current channel — FAIL-OPEN convenience, NOT fail-closed: resolve the channel
|
|
@@ -98,17 +97,6 @@ const MANIFEST_PATH = resolve(ROOT, "openclaw.plugin.json");
|
|
|
98
97
|
/** A shopper id path-segment shape — lower-kebab, never `main` (host-reserved). */
|
|
99
98
|
const AGENT_ID_RE = /^[a-z0-9][a-z0-9-]*$/;
|
|
100
99
|
|
|
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
100
|
/** The sil creed appended to every shopper's SOUL.md after its persona — a soul, not a
|
|
113
101
|
* rulebook. It carries the mantra (explore first), the loop in three lines, and the one
|
|
114
102
|
* distinction that matters (the catalog is where you buy, the web is where you learn),
|
|
@@ -316,11 +304,6 @@ function agentIndex(config, agentId) {
|
|
|
316
304
|
return list.findIndex((a) => a?.id === agentId);
|
|
317
305
|
}
|
|
318
306
|
|
|
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
307
|
/** True iff `openclaw config validate --json` reported `{valid:true}`. The host
|
|
325
308
|
* writes its verdict to stdout even on a non-zero exit, so read stdout, never the
|
|
326
309
|
* exit code (fail closed if it is not JSON). */
|
|
@@ -593,21 +576,12 @@ function main() {
|
|
|
593
576
|
if (!skillRes.ok) {
|
|
594
577
|
failAndTeardown(configPath, "attaching the sil skill failed: " + (skillRes.stderr || "non-zero exit"));
|
|
595
578
|
}
|
|
596
|
-
//
|
|
597
|
-
//
|
|
598
|
-
//
|
|
599
|
-
//
|
|
600
|
-
//
|
|
601
|
-
//
|
|
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
|
-
}
|
|
579
|
+
// No per-agent `tools.deny` is set: the shopper inherits the host's default toolset
|
|
580
|
+
// untouched. A deny of the fs-mutators is inert here — codex brings its OWN shell
|
|
581
|
+
// (surfaced as `bash`), which the deny cannot name and which reads the shopper's
|
|
582
|
+
// skill files anyway, and an open shell writes files regardless of any fs-mutator
|
|
583
|
+
// deny. The shell stays open by design (trusted single-operator posture); persistence
|
|
584
|
+
// is steered through the sil tools by the skill, not enforced by tool policy.
|
|
611
585
|
const enableRes = runOpenclaw(
|
|
612
586
|
["config", "set", "plugins.entries.sil.enabled", "true", "--strict-json"],
|
|
613
587
|
configPath,
|
package/sil-shopping/SKILL.md
CHANGED
|
@@ -28,6 +28,9 @@ 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
|
|
|
@@ -88,6 +91,10 @@ feedback** — loaded on demand from the references that own each beat: **1 clas
|
|
|
88
91
|
→ [`references/method_and_prds.md`](references/method_and_prds.md); **3 fill, 6
|
|
89
92
|
feedback** → [`references/fill_and_feedback.md`](references/fill_and_feedback.md).
|
|
90
93
|
|
|
94
|
+
**Beat 4 is bounded: ≤ 4 spec-filtered `sil_search` calls** per request — the tightest
|
|
95
|
+
projection of the PRD's core first, then deliberate widenings; never brand-by-brand
|
|
96
|
+
enumeration.
|
|
97
|
+
|
|
91
98
|
The loop shapes the shopper's **reasoning, not the user's inbox**: a reused domain
|
|
92
99
|
plus a fully-resolved request **passes straight through, asking nothing**. It gates
|
|
93
100
|
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
|
|
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 }
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
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,
|
|
30
|
-
`
|
|
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
|
|
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
|
|
49
|
-
|
|
64
|
+
a new niche (mints a domain on the spot) or refine an existing one with `sil_learn write` — never
|
|
65
|
+
a second shopper.
|
|
@@ -141,14 +141,14 @@ to mint/refresh domains; if defaults grant none, the bin reports `created` with
|
|
|
141
141
|
6. **Materialize the shared user spec** — `sil_profile_materialize { name, userSpec }`
|
|
142
142
|
(singleton, no agentId) writes **`user_spec.md`** atomically, name in its
|
|
143
143
|
frontmatter. **Setup-only: no domain, no method, no PRD.**
|
|
144
|
-
7. **Attach skill + enable plugin
|
|
145
|
-
|
|
146
|
-
`agents.list[<idx>].skills` ← `["sil"]`; `plugins.entries.sil.enabled` ←
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
144
|
+
7. **Attach skill + enable plugin** (value-mode `config set --strict-json`, the only
|
|
145
|
+
mode the pinned `alpine/openclaw:2026.6.9` accepts):
|
|
146
|
+
`agents.list[<idx>].skills` ← `["sil-shopping"]`; `plugins.entries.sil.enabled` ←
|
|
147
|
+
`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
152
|
8. **Admit sil (plugin trust)** — the shipped **`sil-openclaw-allowlist`** helper
|
|
153
153
|
additively merges the three trust surfaces (`plugins.allow` + `tools.alsoAllow` +
|
|
154
154
|
`plugins.entries.sil`) — the only way to un-filter `sil_*` without clobbering a
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: fill-and-feedback
|
|
3
|
-
description: Beat 3 (fill the PRD by precedence, multi-turn, 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. Load when eliciting requirements or capturing what a reaction surfaced.
|
|
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.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Beat 3 (Fill) and Beat 6 (Feedback) — via `sil_learn`
|
|
7
7
|
|
|
8
8
|
Beats 1–2 hand off the resolved PRD + method body. Beat 3 fills it; Beat 6 captures
|
|
9
|
-
what the reaction surfaces — both persist through **`sil_learn
|
|
9
|
+
what the reaction surfaces — both persist through **`sil_learn write`** (the whole
|
|
10
|
+
reconciled doc, never a stacked bullet).
|
|
10
11
|
|
|
11
12
|
## Beat 3 — Fill by precedence
|
|
12
13
|
|
|
@@ -24,27 +25,37 @@ Pursue each until **resolved** or explicitly **declined**, then search. Each tur
|
|
|
24
25
|
**a few at a time, never a battery**, each tied to **why**, playing the filled
|
|
25
26
|
understanding back.
|
|
26
27
|
|
|
28
|
+
**Author the `## Search specs` block.** As dimensions resolve, project each into a
|
|
29
|
+
`{ ns, key, op, value, unit?, hard? }` predicate (keys from the method's `## Search
|
|
30
|
+
vocabulary`) — the block Beat 4 sends verbatim. A **preferred-value-with-fallback**
|
|
31
|
+
("prefer ear hooks, fins acceptable") is **one `op:in` set** over the acceptable
|
|
32
|
+
values, **not** a hard `eq` on the favourite; the favourite is a **Beat-5 ranking**
|
|
33
|
+
preference. Mark a predicate **`hard: true`** only when a miss must **reject at pick** —
|
|
34
|
+
loose hard-marking empties result sets.
|
|
35
|
+
|
|
27
36
|
**Live request vs a stored durable pref — ask, don't guess.** When the request
|
|
28
37
|
contradicts a stored **durable** PRD preference, the request wins **this** search,
|
|
29
38
|
but ask whether it is **one-off** or **standing**. "Just this once" → ephemeral, no
|
|
30
|
-
write. "From now on" → a **standing** change:
|
|
31
|
-
**Never silently overwrite** a standing preference.
|
|
39
|
+
write. "From now on" → a **standing** change: **`write`** the reconciled PRD (the
|
|
40
|
+
changed line rewritten in place). **Never silently overwrite** a standing preference.
|
|
32
41
|
|
|
33
|
-
**Hard constraints are inviolable — dual-enforced.** `user_spec [hard]`
|
|
34
|
-
|
|
35
|
-
**reject-at-pick** check — because a `specs` predicate can read
|
|
42
|
+
**Hard constraints are inviolable — dual-enforced.** A `user_spec` `[hard]` line and a
|
|
43
|
+
PRD `## Search specs` `hard:true` predicate route to a real **filter** where one exists
|
|
44
|
+
**and** to Beat 5's **reject-at-pick** check — because a `specs` predicate can read
|
|
45
|
+
`applied:false`.
|
|
36
46
|
|
|
37
47
|
**The split — persist stated durable answers NOW.** Fill is the **first** of two
|
|
38
48
|
persistence moments: a durable answer the buyer **stated** during elicitation is
|
|
39
|
-
**written**
|
|
40
|
-
abandoned session still recovers what was settled. What
|
|
41
|
-
surfaces is **Beat 6's** write
|
|
49
|
+
**written** into the PRD **now** — a `write` that folds it into `## Search specs` /
|
|
50
|
+
`## Filled preferences` — so an abandoned session still recovers what was settled. What
|
|
51
|
+
the buyer's **reaction** surfaces is **Beat 6's** write. One-off direction stays
|
|
42
52
|
**ephemeral**, **never written** by either.
|
|
43
53
|
|
|
44
54
|
**Decline never blocks.** A declined question narrows **quality**, never **access**
|
|
45
55
|
— proceed on the best-defensible params and **state the assumption** ("assuming
|
|
46
56
|
waterproofing, since it's for the slope"). Unresolved-and-declined dimensions land
|
|
47
|
-
in the PRD's
|
|
57
|
+
in the PRD's **`## Notes / open`** so the next session recovers, not re-asks — a
|
|
58
|
+
non-answer is a note, never a preference.
|
|
48
59
|
|
|
49
60
|
## Beat 6 — Feedback: the reaction half
|
|
50
61
|
|
|
@@ -64,23 +75,28 @@ reactions ask nothing.
|
|
|
64
75
|
scope where it stays true**:
|
|
65
76
|
|
|
66
77
|
- a cross-domain **fact** / **hard** constraint → **`user_spec`**;
|
|
67
|
-
- a durable per-domain **taste** → the **method
|
|
68
|
-
- a **this-job** preference → the **PRD
|
|
78
|
+
- a durable per-domain **taste** → the **method** (`## Durable taste`);
|
|
79
|
+
- a **this-job** preference or spec → the **PRD** (`## Filled preferences` /
|
|
80
|
+
`## Search specs`);
|
|
69
81
|
- an **image** → **`attach-asset`** (per-domain).
|
|
70
82
|
|
|
71
|
-
**
|
|
72
|
-
|
|
73
|
-
|
|
83
|
+
**Every write is a reconciled whole-doc `write`.** Read the target
|
|
84
|
+
(`sil_profile_get`), fold the new signal into the coherent whole, and `sil_learn write`
|
|
85
|
+
it back — a correction **rewrites** the line it changes, so the doc **never stacks a
|
|
86
|
+
contradicting bullet**. There is no append/amend/retract; reconciliation is the only
|
|
87
|
+
update path.
|
|
74
88
|
|
|
75
|
-
**Re-scope = write-broader-then-
|
|
76
|
-
|
|
77
|
-
**
|
|
89
|
+
**Re-scope = write-broader-then-write-narrower.** When a reaction shows a stored fact
|
|
90
|
+
is broader than where it lives, `write` it into the **broader** target and `write` the
|
|
91
|
+
**narrower** one without the moved line (two `sil_learn write` calls). There is **no
|
|
92
|
+
promote verb**.
|
|
78
93
|
|
|
79
94
|
## `sil_learn` — the one target + change write verb
|
|
80
95
|
|
|
81
96
|
`sil_learn` is the single **target + change** verb owning the whole method/PRD
|
|
82
|
-
lifecycle. `target` selects where the change lands (`user_spec` / `method` /
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
97
|
+
lifecycle. `target` selects where the change lands (`user_spec` / `method` / `prd`);
|
|
98
|
+
the **kind** selects the change. **Three kinds:** **create** (mint a NEW method/PRD —
|
|
99
|
+
errors if one already exists), **write** (replace an existing doc's whole body with the
|
|
100
|
+
reconciled version you author — read it first, carry every buyer line forward),
|
|
101
|
+
**attach-asset** (persist image bytes, linked by path). Every capture is reviewable via
|
|
102
|
+
`sil_profile_get` and erasable via `sil_profile_remove` — never silently harvested.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: method-and-prds
|
|
3
|
-
description: Beat 2 of the loop — load, mint or signal-refresh a domain's method — plus the intent-keyed PRD model, the frontmatter-as-truth store, and discovery/manage via sil_profile_search / sil_profile_get / sil_profile_remove. Load when resolving a domain's method or managing what the shopper knows.
|
|
3
|
+
description: Beat 2 of the loop — load, mint or signal-refresh a domain's method — plus the intent-keyed PRD model, the method/PRD templates, the frontmatter-as-truth store, and discovery/manage via sil_profile_search / sil_profile_get / sil_profile_remove. Load when resolving a domain's method or managing what the shopper knows.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Beat 2 — the domain method, intent-keyed PRDs, and the store
|
|
@@ -23,14 +23,27 @@ on the web **freely and often** to learn how it is *really* bought: its load-bea
|
|
|
23
23
|
attributes, its failure modes, what separates a good buy from a bad one. The one
|
|
24
24
|
boundary — you research the **domain** (how it's bought), you **never source products**
|
|
25
25
|
from the web; every pick comes only from `sil_search` in Beat 4.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
|
|
27
|
+
**The method is GENERAL — the whole product category, reusable across every intent.**
|
|
28
|
+
It holds *how the category is bought* and the *dimensions* that decide a buy — **never
|
|
29
|
+
this buyer's values** (those are the PRD). Mint at the **broadest slug whose buying
|
|
30
|
+
guide generalises**: `earbuds` serves gym, commute, and office; the gym specifics live
|
|
31
|
+
in the gym PRD, not a `wireless-gym-earbuds` method. Folding the use-context into the
|
|
32
|
+
domain forks a near-duplicate method per intent and kills reuse.
|
|
33
|
+
|
|
34
|
+
Persist with **`sil_learn create`** (`target: "method"`, domain + name + body) — the
|
|
35
|
+
file **is** the registration (it errors if the method already exists: a revisit LOADs,
|
|
36
|
+
a stale one REFRESHes with `write`). Never the setup-only `sil_profile_materialize`.
|
|
37
|
+
Then **announce** the inferred domain so the buyer can correct it. The method body
|
|
38
|
+
carries these sections, and only these:
|
|
39
|
+
|
|
40
|
+
- **`## How it's bought`** — the buying guide: load-bearing attributes, failure modes,
|
|
41
|
+
what separates a good buy from a bad one — general to the category, not this buyer.
|
|
42
|
+
- **`## Search vocabulary`** — the spec **dimensions** you coin (`ns.key` + `data_type`
|
|
43
|
+
+ unit + `allowed_values` + why-it-matters) — names only, **no values**.
|
|
44
|
+
- **`## Durable taste`** — the buyer's cross-intent per-domain taste, seeded from
|
|
45
|
+
`user_spec` (omit until something durable is known).
|
|
46
|
+
- **`## Volatility`** — the volatile axis + a rough refresh cadence.
|
|
34
47
|
|
|
35
48
|
The vocabulary is **canonicalized before persist**. `sil_specs` is
|
|
36
49
|
**precision-first** — two specs converge only when **every field** agrees within the
|
|
@@ -54,9 +67,9 @@ specs that never match. So coin for the match:
|
|
|
54
67
|
Submit the definitions to **`sil_specs`** (dedupe-or-create) and adopt the returned
|
|
55
68
|
**canonical** `ns.key`: **`matched`** → an equivalent exists, **drop your synonym for
|
|
56
69
|
the canonical**; **`created`** → yours is novel and canonical going forward (keep it).
|
|
57
|
-
Rewrite the `## Search vocabulary` and any PRD
|
|
58
|
-
before persisting — the method is **born canonical**, never write-then-
|
|
59
|
-
what makes `filters.specs` filter across methods; naming is never a gate — a
|
|
70
|
+
Rewrite the `## Search vocabulary` and any PRD `## Search specs` predicates to those
|
|
71
|
+
names before persisting — the method is **born canonical**, never write-then-fix. This
|
|
72
|
+
is what makes `filters.specs` filter across methods; naming is never a gate — a
|
|
60
73
|
fragmenting name costs precision, never blocks a search. If `sil_specs` is **not
|
|
61
74
|
`ok`** (a registry blip), **do not block the mint**: persist the **raw coined names**
|
|
62
75
|
(every predicate reads `applied:false`) and shop on — convergence retries next
|
|
@@ -70,11 +83,11 @@ every revisit. The three signals: the buyer **contradicts** the guide, the
|
|
|
70
83
|
**volatility marker** is overdue, or the buyer **explicitly asks**. Signal-driven,
|
|
71
84
|
not a clock.
|
|
72
85
|
|
|
73
|
-
Refresh is **
|
|
74
|
-
stale volatile material, **carry every buyer-authored line forward verbatim**,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
86
|
+
Refresh is a **reconciled `write`**: load the current method, re-research **only** the
|
|
87
|
+
stale volatile material, **carry every buyer-authored line forward verbatim**, and
|
|
88
|
+
`sil_learn write` (`target: "method"`) the whole reconciled body — announce the delta.
|
|
89
|
+
The rewrite supersedes stale *research* claims and **never clobbers** a buyer line. The
|
|
90
|
+
method stays fully buyer-mutable — every edit is a `write` of the reconciled whole.
|
|
78
91
|
|
|
79
92
|
Canonicalize any **newly-coined** specs via `sil_specs` before persisting — same
|
|
80
93
|
convergence discipline (reuse a name already coined for the concept; take the
|
|
@@ -84,12 +97,30 @@ carrying a canonical name (already-canonical names are stable).
|
|
|
84
97
|
## Intent-keyed PRDs
|
|
85
98
|
|
|
86
99
|
A PRD's identity is the **job-to-be-done**, keyed by three coordinates so it stays
|
|
87
|
-
queryable: `{ domain, product, intent }` → `ski/gloves-slope` (intent always
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
100
|
+
queryable: `{ domain, product, intent }` → `ski/gloves-slope` (intent always present;
|
|
101
|
+
a context-free request keys `general`). It holds the method's dimensions **resolved to
|
|
102
|
+
this job** — the buyer's actual values — **specialized, never a copy of the method's
|
|
103
|
+
guide**. PRDs are **durable** and **revisitable** — re-buying the same thing, or
|
|
104
|
+
resuming an unfinished session, **recovers** the PRD, never rebuilds it. The PRD body
|
|
105
|
+
carries these sections:
|
|
106
|
+
|
|
107
|
+
- **`## Search specs`** — the load-bearing block: the **resolved predicate set**, a
|
|
108
|
+
list of `{ ns, key, op, value, unit?, hard? }` entries **projected verbatim** into
|
|
109
|
+
`sil_search`'s `filters.specs` at Beat 4 (one entry per decided dimension, keys drawn
|
|
110
|
+
from the method's `## Search vocabulary`). A *"prefer X, Y/Z acceptable"* requirement
|
|
111
|
+
is **one `op:in` set** over `{X, Y, Z}` — mark it `hard` only when a miss must
|
|
112
|
+
reject-at-pick — with the X-preference applied as **Beat-5 ranking**, **never** a hard
|
|
113
|
+
`eq` on X alone (that rejects the acceptable alternatives and empties the set).
|
|
114
|
+
- **`## Filled preferences`** — the buyer's stated durable answers, reconciled: **one
|
|
115
|
+
truth per dimension**. A correction **rewrites** the line it changes; it never adds a
|
|
116
|
+
second, contradicting one.
|
|
117
|
+
- **`## Notes / open`** — declined or unresolved dimensions, so the next session
|
|
118
|
+
recovers rather than re-asks. A **non-answer** ("no budget stated") lives here,
|
|
119
|
+
**never** as a preference.
|
|
120
|
+
|
|
121
|
+
Every PRD write is a whole-body **`sil_learn write`** (or **`create`** for the first
|
|
122
|
+
mint): read the current PRD, reconcile in context, write the coherent whole — so the
|
|
123
|
+
`## Search specs` block and `## Filled preferences` never drift apart or self-contradict.
|
|
93
124
|
|
|
94
125
|
## The store — frontmatter-as-truth (no manifest)
|
|
95
126
|
|
|
@@ -105,7 +136,8 @@ skipped and surfaced as `unreadable`, never half-read.
|
|
|
105
136
|
their PRDs. The frontmatter-as-truth query, **not a manifest** and not a
|
|
106
137
|
filesystem guess. The no-filter call is the "what does my shopper know?" overview.
|
|
107
138
|
- **Read one body** with **`sil_profile_get`** — `domainSlug` for the method body,
|
|
108
|
-
`+prd` for that PRD's body.
|
|
139
|
+
`+prd` for that PRD's body. **Read before every `write`** — reconcile from the real
|
|
140
|
+
current body, never from memory.
|
|
109
141
|
- **Remove** with **`sil_profile_remove`** — `domainSlug` alone removes the **whole
|
|
110
142
|
domain** subtree; `+prd` removes **just that PRD** (method + siblings survive).
|
|
111
143
|
Destructive: **confirm** with the buyer first.
|
|
@@ -24,11 +24,21 @@ This file owns Beats 1, 4 and 5.
|
|
|
24
24
|
|
|
25
25
|
## Beat 1 — Classify: `{domain, product, intent}`, reuse before mint
|
|
26
26
|
|
|
27
|
-
Resolve the request through **three coordinates, top-down**:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
**
|
|
31
|
-
|
|
27
|
+
Resolve the request through **three coordinates, top-down**:
|
|
28
|
+
|
|
29
|
+
- **domain** — the **broad product category** that owns the reusable buying guide.
|
|
30
|
+
Pick the **widest** slug whose method generalises across use-contexts: `earbuds`,
|
|
31
|
+
not `wireless-gym-earbuds`; `ski`, not `ski-touring`.
|
|
32
|
+
- **product** — the product type within the domain (`earbuds`, `boots`).
|
|
33
|
+
- **intent** — the **use-context** that reshapes the requirements (`gym`, `slope`).
|
|
34
|
+
|
|
35
|
+
**Never fold the use-context into the domain.** "Earbuds for the gym" is
|
|
36
|
+
`domain: earbuds, product: earbuds, intent: gym` — the gym-ness is the **intent**, so
|
|
37
|
+
next week's "earbuds for the office" reuses the same method and only mints a new PRD. A
|
|
38
|
+
`wireless-gym-earbuds` domain forks a near-duplicate buying guide per use and kills that
|
|
39
|
+
reuse. **Intent is always present**: a **context-free** request keys the `general`
|
|
40
|
+
intent (`ski/boots-general`), so every job carries all three coordinates and stays
|
|
41
|
+
uniformly queryable.
|
|
32
42
|
|
|
33
43
|
**Reuse-before-mint.** Query existing coordinates with **`sil_profile_search`**
|
|
34
44
|
(the frontmatter-as-truth discovery tool — never a filesystem guess) and
|
|
@@ -48,37 +58,32 @@ silent**. A reuse passes through unannounced.
|
|
|
48
58
|
|
|
49
59
|
## Beat 4 — Search-space: a bounded, priority-ordered fan-out (not a re-rank)
|
|
50
60
|
|
|
61
|
+
The PRD's **`## Search specs`** block is the resolved predicate set — Beat 4 **projects
|
|
62
|
+
it, never re-derives it**. Send those `{ns, key, op, value, unit?, hard?}` predicates
|
|
63
|
+
**verbatim** as `sil_search`'s `filters.specs`; the only per-call work is choosing the
|
|
64
|
+
fan-out and lifting any attribute a **dedicated param** serves better.
|
|
65
|
+
|
|
51
66
|
Project the filled PRD onto **`sil_search`** as a **bounded ≤ 4 priority-ordered**
|
|
52
|
-
fan-out — not one search, not unbounded (the bound is a production budget: each
|
|
53
|
-
|
|
67
|
+
fan-out — not one search, not unbounded (the bound is a production budget: each call is
|
|
68
|
+
a round-trip + tokens):
|
|
54
69
|
|
|
55
|
-
- **Call 1 is the tightest projection
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
70
|
+
- **Call 1 is the tightest projection** — the full `## Search specs` set. **Calls 2–4
|
|
71
|
+
are deliberate widenings**: relax the least load-bearing **soft** predicate, an
|
|
72
|
+
adjacent phrasing that lifts recall, or an explicit either/or branch. **Never relax a
|
|
73
|
+
`hard` predicate.** Core first, widenings after — the **priority order**.
|
|
59
74
|
- **Merge = dedup + concatenate in issue order — NOT a re-rank.** Concatenate the
|
|
60
75
|
per-call backend-ranked lists in issue order and **drop** any product already
|
|
61
|
-
**seen** earlier. Because issue order *is* priority order, this **never
|
|
62
|
-
|
|
63
|
-
- **
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
free-text `query`, which **you author yourself**. The plugin is **pure
|
|
73
|
-
transport**: it never folds a predicate into `query`, so a requirement that
|
|
74
|
-
belongs in `filters.specs` stays a predicate, never `query` prose.
|
|
75
|
-
Leave **`ship_to`** empty (the server resolves the registered default). **Never
|
|
76
|
-
invent** a param or predicate that isn't real — the real `sil_search` params live in
|
|
77
|
-
its tool description, the predicate vocabulary in the domain method. Then read the
|
|
78
|
-
per-predicate **`specs_status`** the response returns (each `{ns, key, applied}`) — it
|
|
79
|
-
feeds
|
|
80
|
-
Beat 5's honesty pass, which rejects at pick any `hard` predicate the backend left
|
|
81
|
-
`applied:false`.
|
|
76
|
+
**seen** earlier. Because issue order *is* priority order, this **never re-ranks** —
|
|
77
|
+
the engine owns order *within* a call, the fan-out *across* calls.
|
|
78
|
+
- **Prefer a dedicated param over a predicate** for the SAME attribute — a `price_max`
|
|
79
|
+
param OR a price spec, never both; likewise `category`, `condition`, `available`,
|
|
80
|
+
`local_merchants`. A purely descriptive residue (a colour, a phrasing) folds into the
|
|
81
|
+
free-text `query`, which **you author** — the plugin is **pure transport** and never
|
|
82
|
+
folds a predicate into `query`. Leave **`ship_to`** empty (the server resolves the
|
|
83
|
+
registered default); **never invent** a param or predicate that isn't real. Then read
|
|
84
|
+
the per-predicate **`specs_status`** the response returns (each `{ns, key, applied}`) —
|
|
85
|
+
it feeds Beat 5's honesty pass, which rejects at pick any `hard` predicate the backend
|
|
86
|
+
left `applied:false`.
|
|
82
87
|
|
|
83
88
|
## Beat 5 — Reflect: honesty pass first, judgment not threshold, propose-and-wait
|
|
84
89
|
|