sil-openclaw 0.2.4 → 0.3.0
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 +111 -0
- package/README.md +67 -3
- package/dist/index.js +2 -0
- package/dist/lib/profile-store.js +426 -0
- package/dist/tools/profile.js +283 -0
- package/openclaw.plugin.json +7 -3
- package/package.json +1 -1
- package/skill/SKILL.md +29 -36
- package/skill/examples/road_cycling_expert_walkthrough.md +106 -0
- package/skill/references/agent_creation_engine.md +65 -0
- package/skill/references/brainstorm_interview.md +68 -0
- package/skill/references/catalog_tools_reference.md +46 -0
- package/skill/references/expert_shopping.md +112 -0
- package/skill/references/manage_experts.md +100 -0
- package/skill/references/refine_expert.md +41 -0
- package/skill/references/search_param_mapping.md +35 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Brainstorm a tailored shopping expert — the interview
|
|
2
|
+
|
|
3
|
+
When the user asks for a **shopping expert** — "make me a shopping expert for buying gifts", "set up a road-cycling gear agent", "I want an expert that shops for me" — do **not** jump to the engine. First run an **open, back-and-forth interview** that shapes the expert *with* the user, converging a spec tailored to *this* user. The agent-creation engine ([`agent_creation_engine.md`](agent_creation_engine.md)) only runs **after** the user explicitly endorses the assembled draft. This reference is the procedure; the engine is the machinery it feeds.
|
|
4
|
+
|
|
5
|
+
This is a **conversation, not a form-fill.** The job is to converge five things *collaboratively*, eliciting BOTH the domain's decision-attributes AND this user's own tastes, style, budget, and constraints — and to **create nothing** until the user endorses the assembled draft.
|
|
6
|
+
|
|
7
|
+
## Principles for the interview
|
|
8
|
+
|
|
9
|
+
- **Act like a curious expert, not a wizard.** Ask open questions, reflect back what was heard, and let the user steer. Never fire a fixed battery of questions.
|
|
10
|
+
- **Narrow a vague domain first.** If the domain is broad or ambiguous, narrow it to a concrete, searchable niche *with* the user before building anything else (see step 2 below) — every downstream section depends on a narrowed niche.
|
|
11
|
+
- **Interleave domain and personal.** In every section, surface the objective decision-attributes of the domain AND ask where *this* user stands on them. A section that gathered only one side is incomplete.
|
|
12
|
+
- **Converge, don't accumulate.** Reflect a short summary back and get a "yes / adjust" before advancing. The flow is **re-entrant** — the user can revise an earlier section at any point.
|
|
13
|
+
- **Endorsement is a gate, not a formality.** Until the user explicitly says "create it", run **zero** engine steps (see Business rules below). The draft lives only in the conversation.
|
|
14
|
+
|
|
15
|
+
## The five sections the interview converges
|
|
16
|
+
|
|
17
|
+
These map onto exactly the two artefact slots the engine materializes — there is **no third slot**. The interview's whole job is to fill `persona` and `playbook` (plus the `agentId` + `name` derived from the domain).
|
|
18
|
+
|
|
19
|
+
| # | Section | What it converges | Lands in |
|
|
20
|
+
|---|---|---|---|
|
|
21
|
+
| 1 | **Domain framing** | What this expert shops for, narrowed to a concrete, searchable niche. | `agentId` + `name` |
|
|
22
|
+
| 2 | **Persona** | Who the expert *is*: its expertise, voice/tone, standing rules — reflecting this user. | `persona` |
|
|
23
|
+
| 3 | **Elicitation style** | How this expert talks to its future user when shopping — how many questions before searching, how proactive, how much it explains. | inside `playbook` |
|
|
24
|
+
| 4 | **Answer→`sil_search`-param mapping** | The domain's decision-attributes translated into concrete `sil_search` parameters this expert will set (see [`search_param_mapping.md`](search_param_mapping.md)). | inside `playbook` |
|
|
25
|
+
| 5 | **Comparison / recommendation rubric** | How this expert ranks and picks among results, weighted by the user's *stated* priorities. | inside `playbook` |
|
|
26
|
+
|
|
27
|
+
Sections 2–5 carry the **tailoring**: they must reflect what *this* user said, not a generic template. The persona goes in the spec's `persona` field; the elicitation style + the answer→param mapping + the rubric are authored as **prose** into the spec's single `playbook` string (the domain sub-skill — a SKILL.md-shaped markdown body, **not** JSON). There is no structured field for the mapping, the style, or the rubric — they live as readable markdown sections inside `playbook`.
|
|
28
|
+
|
|
29
|
+
## Run the interview in this order
|
|
30
|
+
|
|
31
|
+
1. **Open with the domain, not a form.** Reflect the request back ("a shopping expert for road-cycling gear — let's shape it together") and ask **one** orienting question. Signal this is a conversation that can be revised, not a questionnaire. Do not ask for an `agentId`, a budget, and a tone all at once.
|
|
32
|
+
|
|
33
|
+
2. **Narrow a vague domain together FIRST — before any other section.** If the domain is broad or ambiguous ("an expert for gifts", "electronics"), do **not** proceed to persona, the mapping, or the rubric. Ask 1–2 narrowing questions (who is it for / what occasion / which slice of the category) and **reflect a concrete niche back for confirmation**. A too-broad niche makes the answer→param mapping and the rubric useless, so this narrow-first gate protects every downstream section. Only once the niche is concrete and confirmed do you move on.
|
|
34
|
+
|
|
35
|
+
3. **Converge the persona (interview section 2 — see the table above).** Elicit the expert's expertise and voice, AND how the user wants it to behave (terse vs. chatty, cautious vs. opinionated, any standing rules). Reflect a short persona summary back; get a yes/adjust before advancing.
|
|
36
|
+
|
|
37
|
+
4. **Converge the three playbook sections (interview sections 3–5: elicitation style, the mapping, the rubric), interleaving domain-attributes with the user's stance:**
|
|
38
|
+
- **Elicitation style:** how should the expert talk to its future user — how many questions before it searches, how proactive, how much it explains its picks? Reflect back, confirm.
|
|
39
|
+
- **Answer→`sil_search`-param mapping:** name the domain's decision-attributes ("for road bikes: frame material, groupset tier, wheel size, budget…"), ask the user's stance on each, and translate each stated input into a concrete `sil_search` param (see [`search_param_mapping.md`](search_param_mapping.md) for the param table, worked examples, and the `ship_to`-empty rule). Reflect the mapping back, confirm.
|
|
40
|
+
- **Recommendation rubric:** ask what the user weighs most ("durability over price", "prefer secondhand", "brand X is a hard no"), and tie the expert's ranking/selection to those *stated* priorities — not a fixed order. Reflect back, confirm.
|
|
41
|
+
|
|
42
|
+
5. **Derive the identity, confirm it.** From the converged domain, propose an `agentId` (lower-kebab, matching `^[a-z0-9][a-z0-9-]*$`, never `main`) and a human-readable `name` ("Road-Cycling Buyer" / `road-cycling-buyer`). **Confirm both with the user** — never silently invent them.
|
|
43
|
+
|
|
44
|
+
6. **Assemble the draft and present it back.** Compose the spec — `{ agentId, name, persona, playbook }` — and present it to the user as a **readable summary**: who the expert is, how it'll search (the mapping), and how it'll recommend (the rubric). Self-check the shape against the engine's `sil_profile_materialize` input contract: `agentId` lower-kebab and ≠ `main`, non-blank `name`, non-blank `persona`, and a non-blank `playbook` (the elicitation-style + mapping + rubric prose). This is a sanity pass; the engine's validate-first step is the authoritative gate — do not re-implement it here. This self-check is shape-only — it writes nothing, so `sil_profile_materialize` is NOT called here.
|
|
45
|
+
|
|
46
|
+
7. **Get explicit endorsement — the gate.** Ask for an explicit go-ahead ("shall I create it?"). Endorsement is an **affirmative user act** on the assembled draft — "yes, create it" / "go ahead" / "looks good, make it". It is **NOT** inferred from the user answering the last question, and **NOT** from silence. **Only on that explicit endorsement** do you proceed to the engine ([`agent_creation_engine.md`](agent_creation_engine.md)) and run its steps.
|
|
47
|
+
|
|
48
|
+
## Edge cases the interview handles gracefully
|
|
49
|
+
|
|
50
|
+
- **Collision (an expert with that id already exists).** The engine refuses a name collision — it returns the `collision` outcome from its `openclaw agents list` check and never clobbers an existing agent. When the proposed `agentId` collides, surface it in the conversation and offer the user a **choice — rename this expert under a new id, or refine the existing expert's niche** — rather than dead-ending. Never silently mutate the id, and never overwrite an existing expert. (Refining the *existing* expert's artefacts in place is out of scope here; offer rename as the concrete action.)
|
|
51
|
+
- **Abandon mid-flow.** The interview is multi-turn; the user may stop, change their mind, or walk away before endorsing. Because **no engine step runs before endorsement**, abandonment leaves **nothing created** — no host agent, no artefacts, no wiring. There is no partial expert to clean up and **no teardown needed**. Never "save progress" by writing artefacts early.
|
|
52
|
+
- **Creation is local + offline — no identity coupling.** Creating an expert neither requires nor performs sil registration. Do **NOT** present sil registration or a token as a prerequisite to *create* the expert. The expert registers the user later, on first shop, via `sil_register`. Building the expert never depends on the user having an identity.
|
|
53
|
+
|
|
54
|
+
## Business rules (invariants the interview holds on every path)
|
|
55
|
+
|
|
56
|
+
1. **No creation without explicit endorsement.** Nothing is written — not the host agent, not the artefacts, not the wiring — until the user explicitly endorses the assembled draft. The strongest invariant of this procedure: **nothing is created until** the user says yes, and the draft lives only in the conversation until then.
|
|
57
|
+
2. **Abandon-mid-flow creates nothing.** Because no engine step runs pre-endorsement, an abandoned interview leaves no partial expert — automatic, not a teardown. Never write artefacts early to "save progress"; the draft lives only in the conversation.
|
|
58
|
+
3. **Elicit BOTH sides.** The interview must elicit the domain's decision-attributes AND the user's personal tastes/style/budget/constraints. A spec built from only domain attributes (generic) or only preferences (no searchable mapping) is incomplete.
|
|
59
|
+
4. **Tailoring is real, not template.** The persona, the mapping, and the rubric must reflect the user's *stated* inputs — a stated budget becomes `price_min`/`price_max`; "prefer secondhand" becomes `condition`; "durability over price" becomes a rubric weight. A spec that ignores what the user said fails this procedure's purpose. The tailoring is **not a generic template**.
|
|
60
|
+
5. **Converge each section before advancing; stay re-entrant.** Reflect-and-confirm per section; let the user revise any earlier section. Collaborative, not a locked wizard.
|
|
61
|
+
6. **Narrow a vague domain first.** Never build persona/mapping/rubric on an un-narrowed niche — narrow with the user before proceeding.
|
|
62
|
+
7. **Refine-or-rename on collision; never clobber.** On an existing-name collision, offer refine-or-rename; never overwrite an existing expert (defers to the engine's `collision` refusal). Never clobber.
|
|
63
|
+
8. **Creation is local + offline — no identity coupling.** The interview never presents sil registration / a token as a prerequisite to create the expert.
|
|
64
|
+
9. **Search behaviour the expert inherits is correct by construction.** The answer→param mapping encodes the location-aware default: leave `ship_to` empty (server resolves the registered default), never instruct the expert to call `sil_whoami` to populate it (see [`search_param_mapping.md`](search_param_mapping.md)).
|
|
65
|
+
|
|
66
|
+
## After endorsement
|
|
67
|
+
|
|
68
|
+
Once the user has **explicitly endorsed** the assembled draft, proceed to [`agent_creation_engine.md`](agent_creation_engine.md) and run the engine steps in order. Until that explicit endorsement, **zero engine steps** have run.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# sil catalog + identity tools — per-tool behaviour and the shared status taxonomy
|
|
2
|
+
|
|
3
|
+
Load this reference when driving any of the four core tools — `sil_register`,
|
|
4
|
+
`sil_whoami`, `sil_search`, `sil_product_get`. It holds how each tool behaves and
|
|
5
|
+
the status taxonomy every shopping tool shares. The router in `SKILL.md` names
|
|
6
|
+
which tool an intent maps to; this reference is what that tool actually does.
|
|
7
|
+
|
|
8
|
+
All four return the canonical envelope: a single text content block whose JSON
|
|
9
|
+
body carries a `status`. Prices are in the currency's ISO 4217 minor unit (e.g.
|
|
10
|
+
cents).
|
|
11
|
+
|
|
12
|
+
## How each tool behaves
|
|
13
|
+
|
|
14
|
+
- **`sil_register`** starts browser-based registration. It returns promptly with
|
|
15
|
+
`status: "awaiting_browser"` and an `auth_url` — share that URL with the user.
|
|
16
|
+
The plugin polls in the background; once the user finishes signing in, call
|
|
17
|
+
`sil_register` again to confirm (it reports `already_registered`).
|
|
18
|
+
- **`sil_whoami`** returns the registered user's identity (name and addresses).
|
|
19
|
+
An expired access token is refreshed transparently and the read retried; if the
|
|
20
|
+
session is fully dead, the result names the recovery (`sil_register`).
|
|
21
|
+
- **`sil_search`** returns a ranked list of purchasable variants (`id`, `title`,
|
|
22
|
+
`price`, `availability`, `checkout_url`, `source`), best match first — present
|
|
23
|
+
them in order, do not re-rank. An empty list means nothing matched: a normal
|
|
24
|
+
`ok` outcome, not an error. Use the returned `cursor` for the next page; its
|
|
25
|
+
absence means no more results (never infer end-of-results from page size).
|
|
26
|
+
- **`sil_product_get`** is the lookup companion to `sil_search`. Pass ids already
|
|
27
|
+
held and get the matching products back with fresh detail (description, options,
|
|
28
|
+
the featured variant). Each variant carries an `inputs` list correlating it back
|
|
29
|
+
to the id(s) asked about (the response is NOT in request order). Ids that no
|
|
30
|
+
longer resolve come back in a `not_found` list — a normal partial-success
|
|
31
|
+
outcome, not an error; the other products are still valid.
|
|
32
|
+
|
|
33
|
+
## Status taxonomy (shared across the shopping tools)
|
|
34
|
+
|
|
35
|
+
| `status` | Meaning | What to do |
|
|
36
|
+
|---|---|---|
|
|
37
|
+
| `ok` | Success. Catalog results may be empty (`products: []`) or partial (`not_found: [...]`) — still a success. | Relay the data. |
|
|
38
|
+
| `not_registered` | No stored credentials. | Run `sil_register`, then retry the tool. |
|
|
39
|
+
| `must_reregister` | The session is dead (refresh rejected / 401). | Run `sil_register` to sign in again, then retry. |
|
|
40
|
+
| `forbidden` | Authenticated but not authorized (e.g. account not provisioned). | Follow the message; usually complete onboarding via `sil_register`. |
|
|
41
|
+
| `invalid_request` | The query/ids were rejected (e.g. empty input). | Fix the input and call again — do NOT re-register. |
|
|
42
|
+
| `retryable` | A transient network/5xx blip. | Try the same call again — do NOT re-register. |
|
|
43
|
+
|
|
44
|
+
On a non-`ok` status, say what happened and follow the tool's own `recovery`
|
|
45
|
+
hint — never improvise a different one (re-registering can't fix a bad query or a
|
|
46
|
+
transient 5xx, and would derail the user).
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Expert shop-time loop — how a created expert shops on its niche
|
|
2
|
+
|
|
3
|
+
Load this when you (the sil skill) are running **inside a created expert** and the
|
|
4
|
+
user states a shopping intent ("find me something for a steak dinner around $40").
|
|
5
|
+
The [agent-creation engine's Runtime hook](agent_creation_engine.md) ends where
|
|
6
|
+
this loop begins: it has already read `$SIL_DATA_DIR/agents/<agentId>/profile.json`
|
|
7
|
+
and loaded `persona.md` (the standing instructions, the expert's voice, its
|
|
8
|
+
hard-rules and hard-no's) and `playbook.md` (its three prose sections — how the
|
|
9
|
+
expert asks, how it turns answers into catalog parameters, and how it ranks the
|
|
10
|
+
candidates). Those artefacts are now your operating instructions for the rest of
|
|
11
|
+
this loop.
|
|
12
|
+
|
|
13
|
+
This is **shop time**, not create time. The expert behaves like a specialist a
|
|
14
|
+
user trusts, in the persona's voice — never a generic clerk. It consumes the
|
|
15
|
+
existing catalog tools **unchanged**; the rubric is applied by you at reasoning
|
|
16
|
+
time, not by any new tool.
|
|
17
|
+
|
|
18
|
+
The router's three always-on rules still hold (act-don't-narrate, follow the
|
|
19
|
+
tool's own `recovery`, re-fetch the chosen item before the user commits) — this
|
|
20
|
+
loop layers the profile-driven behaviour on top, it does not restate them.
|
|
21
|
+
|
|
22
|
+
## The loop (the order IS the spec)
|
|
23
|
+
|
|
24
|
+
Run these steps in order. An attribute the user already stated is never re-asked.
|
|
25
|
+
|
|
26
|
+
### 1. Elicit the load-bearing missing attributes — in the playbook's priority order
|
|
27
|
+
|
|
28
|
+
A **load-bearing decision attribute** is one the playbook's mapping or rubric
|
|
29
|
+
names as priority-ordered for the niche (e.g. budget, serving size, the niche's
|
|
30
|
+
key descriptors). **Elicitation is need-driven**: you elicit **only** a
|
|
31
|
+
load-bearing attribute that is **missing**. When the stated intent already carries
|
|
32
|
+
enough load-bearing attributes for a defensible search, do **not** invent an extra
|
|
33
|
+
question battery — proceed straight to the map+search steps below.
|
|
34
|
+
|
|
35
|
+
When something load-bearing IS missing, ask for it through genuine back-and-forth
|
|
36
|
+
**in the playbook's priority order** — one or a few questions at a time, in the
|
|
37
|
+
playbook's elicitation style. This is **not a fixed form-fill** and **not a
|
|
38
|
+
question battery**: you ask like a curious expert, and you **never re-ask** an
|
|
39
|
+
attribute the user already stated. Elicit the highest-priority missing attribute
|
|
40
|
+
first, then the next — never a single up-front wizard form.
|
|
41
|
+
|
|
42
|
+
### 2. Map the answers to well-formed `sil_search` params
|
|
43
|
+
|
|
44
|
+
Translate each elicited or stated answer to a **real `sil_search` param** per
|
|
45
|
+
[`search_param_mapping.md`](search_param_mapping.md) — that reference owns the
|
|
46
|
+
full answer→param table and the worked examples; **load it, do not re-carry it
|
|
47
|
+
here.** The load-bearing rules from it that govern this step:
|
|
48
|
+
|
|
49
|
+
- A stated taste with **no matching param** (a colour, a brand) folds into the
|
|
50
|
+
`query` text or into the rubric — you **never invent a filter**. There is no
|
|
51
|
+
`color` param, no `brand` param; inventing one emits an invalid `sil_search`
|
|
52
|
+
call.
|
|
53
|
+
- Leave **`ship_to` empty** by default so the server resolves the user's
|
|
54
|
+
registered default address. Do **not** call `sil_whoami` to populate it — no
|
|
55
|
+
`sil_whoami` round-trip.
|
|
56
|
+
|
|
57
|
+
### 3. Search
|
|
58
|
+
|
|
59
|
+
Call `sil_search` with the mapped params. It returns purchasable variants
|
|
60
|
+
**best-first**.
|
|
61
|
+
|
|
62
|
+
### 4. Compare the candidates on the playbook's rubric
|
|
63
|
+
|
|
64
|
+
Evaluate the returned candidates against the playbook's **recommendation rubric**,
|
|
65
|
+
**weighted by the user's stated priorities** ("durability over price"), plus the
|
|
66
|
+
persona's **hard-rules / hard-no's** (a brand the user refuses, an age gate the
|
|
67
|
+
persona enforces). The rubric informs your *reasoning*, not the list order:
|
|
68
|
+
present results **best-first** as `sil_search` returned them — **never re-rank**.
|
|
69
|
+
|
|
70
|
+
### 5. Recommend — always with the "why"
|
|
71
|
+
|
|
72
|
+
Recommend with **domain-relevant rationale** in the expert's voice — the **"why"**,
|
|
73
|
+
tied to the rubric and the user's stated priorities ("I picked this because it
|
|
74
|
+
holds the 105 groupset you wanted at the top of your budget"). The "why" is the
|
|
75
|
+
product: the result list is the same one generic search returns; the expert's
|
|
76
|
+
value is the reasoning over it. Never hand back a bare list.
|
|
77
|
+
|
|
78
|
+
### 6. Re-fetch with `sil_product_get` before any buy
|
|
79
|
+
|
|
80
|
+
Price, availability, and `checkout_url` from `sil_search` are **point-in-time**.
|
|
81
|
+
Before you hand off to **buy / checkout / purchase**, **re-fetch** the chosen item
|
|
82
|
+
with `sil_product_get` for fresh price / availability / `checkout_url`. **Never
|
|
83
|
+
commit a buy off the stale `sil_search` snapshot** — buy off the fresh
|
|
84
|
+
`sil_product_get` detail, never the earlier `sil_search` result.
|
|
85
|
+
|
|
86
|
+
## When `sil_search` returns `ok` with `products: []` — relax and explain
|
|
87
|
+
|
|
88
|
+
An empty result on `status: ok` (`products: []`) is a normal, servable outcome —
|
|
89
|
+
**never a silent dead-end**. **Relax or re-frame** the params (loosen a
|
|
90
|
+
constraint, broaden the `query`) and **explain what you changed and why** ("I
|
|
91
|
+
dropped the secondhand-only filter because nothing matched it — here's what's new
|
|
92
|
+
in stock"). Do not just stop silently and do not leave the user with nothing.
|
|
93
|
+
|
|
94
|
+
## When the domain is genuinely unservable — an honest "no", never junk
|
|
95
|
+
|
|
96
|
+
When the catalog **cannot serve** the domain — out of the persona's scope,
|
|
97
|
+
**not shippable**, **age-gated**, or persistently empty after a reasonable
|
|
98
|
+
relax — say so **honestly**. This is a **different outcome** from the empty-but-
|
|
99
|
+
servable relax case above: there is no constraint to loosen, so you give an honest
|
|
100
|
+
"no". **Never fabricate** options and **never pad with junk** — handing back
|
|
101
|
+
irrelevant or unbuyable results to avoid saying "no" destroys trust. Honesty over
|
|
102
|
+
a hollow answer.
|
|
103
|
+
|
|
104
|
+
## When `sil_search` / `sil_product_get` returns a non-`ok` status
|
|
105
|
+
|
|
106
|
+
A non-`ok` status is **not an empty match** — do **not** treat a `retryable`
|
|
107
|
+
(transient / source down) or an auth failure like `products: []` and relax the
|
|
108
|
+
params; that is the wrong recovery. **Follow the tool's own `recovery` hint**
|
|
109
|
+
exactly and **never improvise** a different one. The full status taxonomy and the
|
|
110
|
+
per-status recovery rule live in
|
|
111
|
+
[`catalog_tools_reference.md`](catalog_tools_reference.md) — that reference owns
|
|
112
|
+
them; **load it, do not re-carry the taxonomy here.**
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Manage your sil shopping experts — list, view, remove
|
|
2
|
+
|
|
3
|
+
Load this reference the moment the user wants to see or remove an expert they
|
|
4
|
+
created — "what experts do I have?", "show me the gift buyer", "delete the
|
|
5
|
+
grocery agent". The router in `SKILL.md` names which `sil_profile_*` tool each
|
|
6
|
+
intent maps to; this reference is what those tools actually do, plus the
|
|
7
|
+
host-CLI-first ordering and the confirm-before-remove gate the remove flow
|
|
8
|
+
turns on.
|
|
9
|
+
|
|
10
|
+
These are pure local-lifecycle operations over the two stores the
|
|
11
|
+
create-engine established — **host config = wiring, `$SIL_DATA_DIR/agents/<id>/`
|
|
12
|
+
= behaviour artefacts**. No server call, no token read, no identity coupling: a
|
|
13
|
+
user with zero experts (or who just removed their last) still shops generically
|
|
14
|
+
exactly as before.
|
|
15
|
+
|
|
16
|
+
**The source of truth for "what is a sil expert" is the sil artefact store, not
|
|
17
|
+
the host agent list.** A directory `$SIL_DATA_DIR/agents/<id>/` with a readable
|
|
18
|
+
`profile.json` IS a sil expert; a bare host `agents.list[]` entry without one is
|
|
19
|
+
just a host agent and is not ours to list, view, or remove. Always read the
|
|
20
|
+
artefact store — `profile.json` — never the host agent list, to decide what
|
|
21
|
+
exists.
|
|
22
|
+
|
|
23
|
+
## Match intent to a tool
|
|
24
|
+
|
|
25
|
+
| Intent | Tool |
|
|
26
|
+
|---|---|
|
|
27
|
+
| "list my experts" / "what shopping experts do I have?" | `sil_profile_list` (no arguments) |
|
|
28
|
+
| "show me / tell me about <expert>" | `sil_profile_get` (pass the expert's `agentId`) |
|
|
29
|
+
| "remove / delete / get rid of <expert>" | host CLI `openclaw agents remove <agentId>` **FIRST**, then `sil_profile_remove` (see the remove flow below) |
|
|
30
|
+
|
|
31
|
+
## How the two read tools behave
|
|
32
|
+
|
|
33
|
+
- **`sil_profile_list`** enumerates the artefact store and returns the user's
|
|
34
|
+
experts most-recently-created first (`createdAt` desc), each with its
|
|
35
|
+
`agentId`, `name`, `hasPlaybook`, and `createdAt`. Present a name + a short
|
|
36
|
+
domain summary (distilled from the persona; a playbook signals a specialized
|
|
37
|
+
domain) plus the `agentId` so the user can refer to one unambiguously. An
|
|
38
|
+
empty `experts: []` is a normal, successful outcome — say plainly "you have no
|
|
39
|
+
sil shopping experts yet" and point at how to create one ("ask me to make a
|
|
40
|
+
shopping expert for …"). One degraded expert lands in `unreadable[]` — mention
|
|
41
|
+
it inline, but never let it hide the healthy ones.
|
|
42
|
+
- **`sil_profile_get`** resolves one expert by `agentId` and returns its `name`,
|
|
43
|
+
`persona`, optional `playbook`, `profilePath`, and `createdAt`. Render a human
|
|
44
|
+
summary: the expert's name, its domain/persona, whether it carries a domain
|
|
45
|
+
playbook (and a summary when present), and a wiring summary — it is a real
|
|
46
|
+
host agent with the sil plugin enabled and the sil skill attached, ready to
|
|
47
|
+
shop with no further setup. An unknown expert returns `not_found` — frame it
|
|
48
|
+
plainly ("no sil expert named '<x>'") and list the experts that DO exist (or
|
|
49
|
+
say there are none) so the next step is obvious. Never surface a stack trace or
|
|
50
|
+
a raw filesystem path.
|
|
51
|
+
|
|
52
|
+
## Remove flow — host-CLI FIRST, then the artefact tool
|
|
53
|
+
|
|
54
|
+
Removal is **destructive and irreversible** (the persona and playbook the user
|
|
55
|
+
authored are deleted), so **confirm before removing**: state exactly what will
|
|
56
|
+
be deleted — this one named expert, both its host wiring and its sil behaviour
|
|
57
|
+
artefacts — and proceed only on the user's explicit go-ahead. Then run these
|
|
58
|
+
steps **in this exact order**:
|
|
59
|
+
|
|
60
|
+
1. **Existence check (read).** Run `openclaw agents list --json` and confirm the
|
|
61
|
+
`agentId` is a sil-wired agent the user means.
|
|
62
|
+
2. **Remove the host wiring (host CLI) — FIRST.** Run
|
|
63
|
+
`openclaw agents remove <agentId>`, then `openclaw config validate --json` to
|
|
64
|
+
confirm the host config is still valid. The plugin cannot write the host
|
|
65
|
+
config, so this half is always the host CLI's, and it runs ahead of the
|
|
66
|
+
artefact removal.
|
|
67
|
+
3. **Remove the sil artefacts (plugin tool) — SECOND.** Call
|
|
68
|
+
`sil_profile_remove { agentId }` to delete the expert's behaviour-artefact
|
|
69
|
+
directory. It deletes the **artefact half only** — the expert's
|
|
70
|
+
`$SIL_DATA_DIR/agents/<id>/` directory — scoped to exactly the one validated
|
|
71
|
+
`agentId`; a malformed/traversal/`main` id returns `invalid_request` and
|
|
72
|
+
deletes nothing, and an unknown id returns `not_found` (idempotent — safe to
|
|
73
|
+
re-run).
|
|
74
|
+
|
|
75
|
+
**Never artefacts-first.** The order is a safety decision, not a style choice:
|
|
76
|
+
if step 3 fails after step 2, the only survivor is a *residual artefact
|
|
77
|
+
directory with no host entry* — harmless disk cruft, no broken agent ever loads,
|
|
78
|
+
and `sil_profile_list` still surfaces it so the user retries `sil_profile_remove`
|
|
79
|
+
clean. The **reverse** order is unsafe: artefacts removed first, then a failed
|
|
80
|
+
host step, leaves a *host `agents` entry whose `profile.json` is gone* — the
|
|
81
|
+
agent still loads but the sil skill ENOENTs on its persona/playbook at runtime,
|
|
82
|
+
a visible, confusing, broken expert. Both halves are individually idempotent
|
|
83
|
+
(host `agents remove` and `sil_profile_remove` both no-op on an absent target),
|
|
84
|
+
so a re-run from any partial state converges to clean. After a successful
|
|
85
|
+
removal, confirm the expert is gone and that the user's **other experts and
|
|
86
|
+
generic shopping are untouched**.
|
|
87
|
+
|
|
88
|
+
Leave `plugins.entries.sil.enabled` alone on removal — it is shared host state
|
|
89
|
+
(every other expert depends on it; generic shopping is unaffected by it), not
|
|
90
|
+
per-agent. Even removing the last expert leaves it enabled.
|
|
91
|
+
|
|
92
|
+
## Status taxonomy (manage: list / view / remove)
|
|
93
|
+
|
|
94
|
+
| `status` | Meaning | What to do |
|
|
95
|
+
|---|---|---|
|
|
96
|
+
| `ok` | List succeeded (`experts` may be empty — a normal outcome), or a view returned the expert's detail. | Relay the data; on an empty list, say so plainly and point at creation. |
|
|
97
|
+
| `not_found` | No sil expert matches the `agentId` (view or remove). | Frame it plainly and list the experts that DO exist; do NOT re-register. For remove, this also means a re-run is safe (idempotent). |
|
|
98
|
+
| `invalid_request` | The `agentId` was malformed, `main`, or traversal-shaped. **Nothing was read or deleted.** | Fix the id and call again — never a stack trace or a raw path to the user. |
|
|
99
|
+
| `removed` | `sil_profile_remove` deleted the expert's artefact directory. | Confirm it is gone; ensure the host-wiring removal (step 2) ran first. |
|
|
100
|
+
| `persistence_failed` | The artefact directory could not be removed (the **path** + **cause** name what to fix). | Fix the data directory (writable), then remove again; the already-done host-wiring half need not be redone. |
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Refine an existing expert from observed sessions — the refinement loop
|
|
2
|
+
|
|
3
|
+
When the user wants to **sharpen an expert they already have** — "refine my road-cycling buyer", "the gift buyer keeps surfacing the wrong stuff, let's fix it", "amend this expert" — do **not** re-brainstorm it from scratch and do **not** quietly mutate it. Run this **targeted-amend** loop: load the existing expert, propose concrete refinements drawn from what the agent actually **observed** in real shopping sessions under it, let the user **confirm a subset**, and persist **only** the confirmed subset by re-running the existing persist step. Nothing changes silently; nothing persists without the user's explicit confirmation.
|
|
4
|
+
|
|
5
|
+
This is a distinct capability from creating an expert ([`agent_creation_engine.md`](agent_creation_engine.md), which CREATES) and from the shop-time loop (which SHOPS). Refining **sharpens an existing expert** — the named one — from observed evidence. The default is a **targeted amend**, not a full cold re-brainstorm; a wholesale re-shape via the full interview remains available only on explicit request.
|
|
6
|
+
|
|
7
|
+
Run these steps **in order, top to bottom** — the order is the spec.
|
|
8
|
+
|
|
9
|
+
## The refinement loop (run in this exact order)
|
|
10
|
+
|
|
11
|
+
1. **Trigger + load the named expert.** The user names the expert to refine (or an end-of-session signal invites a refinement). Load that one expert's current artefacts with **`sil_profile_get { agentId }`** — the manifest plus the `persona` and `playbook` bodies. This is the working expert you are about to sharpen; everything you propose is grounded in what it already is.
|
|
12
|
+
|
|
13
|
+
2. **Propose, session-grounded — concretely, never a generic template.** Propose a small set of **concrete refinements drawn from the observed session** — what the agent actually saw in the just-completed (or in-progress) shopping session under this expert. Each proposal must name **two things**:
|
|
14
|
+
- **which artefact element it changes** — a `persona` standing rule, a `playbook` answer→param **mapping** entry, or a recommendation **rubric** weight; and
|
|
15
|
+
- **the concrete observed evidence behind it** — a `sil_search` param mapping that returned **relevant** vs **irrelevant** items, a question that turned out to matter (or was noise), a candidate the user **accepted** or **rejected**, or a taste/constraint the user **volunteered but the playbook never captured** (e.g. "you said 'nothing over 8kg' three times", "you rejected every leather option").
|
|
16
|
+
|
|
17
|
+
Every proposal cites the observed evidence — it is **grounded**, not guesswork. This is **not a generic template** and **not** a plausible-sounding ungrounded "improvement"; a proposal not tied to anything the session showed is forbidden. (When the observed session is unavailable, do not invent one — see the fallback at the foot of this reference.)
|
|
18
|
+
|
|
19
|
+
3. **Confirm — the gate, before anything persists.** Present the proposals and let the user **confirm a subset** — all, some, or none (per-proposal accept/reject; the user chooses **which to keep**). Confirmation is an **explicit affirmative act** on specific proposals. It is **never inferred from silence**, and **never** from the user answering an **off-topic** / unrelated question. This is the strongest invariant of the loop, re-applying the create engine's endorsement discipline at refine time — *see [`brainstorm_interview.md`](brainstorm_interview.md) for the endorsement-gate discipline; do not restate it here.* Until the user confirms, the proposals live **only in the conversation**.
|
|
20
|
+
|
|
21
|
+
4. **Persist ONLY the confirmed subset.** Fold **only the confirmed** proposals into the expert's **full** spec (persona drift → the `persona` body; mapping / rubric / elicitation drift → the `playbook` body), then re-run the engine's persist step — **`sil_profile_materialize { agentId, name, persona, playbook? }`** — over that one `agentId`. The unconfirmed proposals are **discarded** with the conversation; nothing else persists, no more than what the user agreed to. If the user confirms nothing, nothing changes.
|
|
22
|
+
|
|
23
|
+
The re-materialize is an **atomic in-place re-write** of that one expert's artefacts — `persona.md` and `playbook.md` are overwritten and the manifest refreshed, all-or-nothing per file (the store's existing idiom; do **not** hand-roll a write under the sil data directory). **On a persist failure the prior artefacts are left intact** — the expert is never served half-refined, and you tell the user the refinement **did not stick** (the failure leaves the prior state unchanged, so there is nothing to undo). *Truthful failure-safety note: the re-write is per-file atomic and dir-preserving — a failed re-write never tears the expert down and never serves a coherent half-refined expert (a broken manifest reads back as not-found, fail-closed). It is **not** a cross-file transaction; the safety property is "fails closed, prior expert intact / never half-served", not "all three files roll back together".*
|
|
24
|
+
|
|
25
|
+
When a confirmed refinement changes the **persona** (the expert's system framing), also refresh the agent's workspace `SOUL.md` via the host CLI — the wiring half, mirroring the engine's persona-as-system-framing step. Behaviour artefacts go to the sil data directory via the plugin tool; the `SOUL.md` refresh is host-CLI; identity is untouched.
|
|
26
|
+
|
|
27
|
+
5. **Close the loop — the refined expert reflects the kept changes on re-run.** A later session opened inside the refined expert loads the **updated** artefacts (the same Runtime hook the engine documents) and behaves accordingly — the sharper mapping, the new hard-no, the re-weighted rubric. The improvement is durable: refinement is **iterative, never one-shot** — a change that did not land well is itself refinable next time.
|
|
28
|
+
|
|
29
|
+
6. **Isolation + the no-signal fallback.** A refinement touches exactly the named expert's `agents/<agentId>/` directory — keyed off the single validated `agentId`. **Other experts are untouched** (no sibling expert's artefacts mutate), and the **generic, profile-less shopping path is untouched** (a plain sil session still shops exactly as today). One expert's sharpening never leaks into another or into generic shopping.
|
|
30
|
+
|
|
31
|
+
## Privacy + scope — per-user and local
|
|
32
|
+
|
|
33
|
+
The improvement is **per-user and local**: it is written only to this user's sil data directory (`$SIL_DATA_DIR/agents/<agentId>/`), on this machine. There is **no server-side aggregation, no shared store, no shared expert, and no cross-user signal** — the refine path calls **no server endpoint** and performs **no identity round-trip**. The expert gets sharper for this user alone; nothing is pooled or shared.
|
|
34
|
+
|
|
35
|
+
## Refining the answer→`sil_search`-param mapping
|
|
36
|
+
|
|
37
|
+
A refinement to the mapping (e.g. a taste the user volunteered but the playbook never captured) maps **only onto real `sil_search` params** — and a volunteered taste with **no matching param** folds into the `query` text or the recommendation **rubric**, **never an invented filter**. The `ship_to` rule is unchanged at refine time too: leave it empty (the server resolves the registered default) — no identity round-trip to populate it. **Do not restate the param table here** — point at [`search_param_mapping.md`](search_param_mapping.md) (the table, the worked params, and the `ship_to`-empty rule); refining the mapping uses exactly those rules.
|
|
38
|
+
|
|
39
|
+
## When there is no observed-session signal
|
|
40
|
+
|
|
41
|
+
If the user asks to refine but **no observed session** is available — a fresh session, or the prior session is out of context — do **not fabricate** session observations to propose against. Fall back to a **guided amend**: ask the user what they want to change (and apply the same confirm-before-persist gate to whatever they describe), or **invite them to shop a session first** so the next refinement has real evidence to ground proposals in. Never invent observations.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Answer→`sil_search`-param mapping (the mapping is real)
|
|
2
|
+
|
|
3
|
+
Load this while converging interview section 4 (the answer→`sil_search`-param mapping) in [`brainstorm_interview.md`](brainstorm_interview.md). The mapping must target the **real `sil_search` parameters** (the shopping loop's catalog tool, named in `SKILL.md`) and nothing else — never invent a filter.
|
|
4
|
+
|
|
5
|
+
## The parameters available to map onto
|
|
6
|
+
|
|
7
|
+
| User's stated input | `sil_search` param it maps to |
|
|
8
|
+
|---|---|
|
|
9
|
+
| A budget ("under €1500", "€800–1200") | `price_min` / `price_max` — **in the currency's ISO 4217 minor unit** (cents): €1500 → `price_max: 150000` |
|
|
10
|
+
| "Prefer secondhand" / "used is fine" | `condition: ["secondhand"]` |
|
|
11
|
+
| "New only" | `condition: ["new"]` |
|
|
12
|
+
| The narrowed niche + key descriptors | `query` (free text) and/or `category` |
|
|
13
|
+
| "In stock only" (the default) / "show me out-of-stock too" | `available` (omit for in-stock default; `false` to include unavailable) |
|
|
14
|
+
| "Buy from a local/domestic shop" | `local_merchants: true` (a best-effort ranking *bias*, not a hard filter — also issue the `query` in the user's language to actually surface local shops) |
|
|
15
|
+
|
|
16
|
+
A stated taste with **no matching param** (e.g. "I like bold colours", "prefer eco-friendly brands") does **not** become a new param — fold it into the `query` text or into the recommendation rubric. There is no `color` filter, no `brand` filter; inventing one produces an expert that emits invalid `sil_search` calls at shop time.
|
|
17
|
+
|
|
18
|
+
## `ship_to` stays EMPTY by default — inline rule (do not skip)
|
|
19
|
+
|
|
20
|
+
Do **not** map the user's location onto `ship_to`, and do **not** instruct the expert to call `sil_whoami` to populate it. When `ship_to` is absent, sil-api resolves the user's **registered default address** server-side. Set `ship_to` (a `{ country, region?, postal_code? }` object of ISO codes) **only** to OVERRIDE the default with a *different* destination than the registered address (e.g. "ship this to my office in Germany"). The expert inherits correct location-aware search by construction — leave `ship_to` out, and never round-trip `sil_whoami` to fill it.
|
|
21
|
+
|
|
22
|
+
## Worked param examples
|
|
23
|
+
|
|
24
|
+
A converged mapping translates the user's stated inputs into concrete params the expert will set at shop time. For a road-cycling expert whose user said "budget around €1200, secondhand is fine, I'm in France and want local shops":
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
query: "<niche descriptors from the answer>" # e.g. "endurance road bike 105 groupset"
|
|
28
|
+
category: "<the narrowed niche category>"
|
|
29
|
+
price_max: 120000 # €1200 → minor units (cents)
|
|
30
|
+
condition: ["secondhand"] # "secondhand is fine"
|
|
31
|
+
local_merchants: true # "want local shops" → ranking bias; issue query in French
|
|
32
|
+
# ship_to: OMITTED — server resolves the registered default address; no sil_whoami round-trip
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The stated budget became `price_max` (in cents), "secondhand is fine" became `condition`, "want local shops" became `local_merchants: true` — and `ship_to` was deliberately left out so the server resolves the registered default. A non-param taste ("I like understated colours") would fold into `query` text or the rubric, never a new filter.
|