sil-openclaw 0.3.5 → 0.3.6

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.
@@ -1,150 +0,0 @@
1
- # Worked example — a road-cycling shopping expert as general counsel
2
-
3
- A short walkthrough from a **create-expert request** through the interview
4
- ([`../references/brainstorm_interview.md`](../references/brainstorm_interview.md))
5
- to a created expert via the engine
6
- ([`../references/agent_creation_engine.md`](../references/agent_creation_engine.md)),
7
- then how it acts as **general counsel to the buyer** — an ongoing advisor across
8
- the buyer's cycling needs, not a one-query optimizer. The interview walks the
9
- **five artefacts, one touchpoint each, in order**; the deep domain work is the
10
- agent's own research. The transcript is illustrative — it shows the *shape*, the
11
- gates, and the SDS layering.
12
-
13
- ## The interview — one touchpoint per document
14
-
15
- > **User:** "I want an expert that shops for road-cycling gear for me."
16
-
17
- **1. `SOUL.md` — ask first (persona; the niche falls out).** No separate
18
- narrow-the-niche step:
19
-
20
- > **Expert:** "Let's shape it. What kind of expert do you want, and how should it
21
- > behave?"
22
- > **User:** "A patient guide — I'm buying my first proper road bike and I'm new to
23
- > this. Always explain fit. And no carbon-fibre handlebars, a friend cracked one."
24
-
25
- → Persona (→ host **`SOUL.md`**): *a patient first-bike advisor who always explains
26
- fit; standing rule — never recommend carbon handlebars.* The niche — **a complete
27
- first road bike** — fell out of the answer.
28
-
29
- **2. `domain_spec.md` — no question (the agent researches the web).** The agent
30
- researches how to buy a first road bike well, then reflects the shape back:
31
-
32
- > **Expert:** "I've done the homework. The short version: **the fit is everything** —
33
- > frame size from height *and* inseam, stack/reach set torso angle, saddle setback
34
- > from KOPS, crank length scales with inseam. Then endurance-vs-race geometry,
35
- > groupset/gearing theory (gear-inches, compact vs mid-compact for your terrain),
36
- > and alloy-vs-carbon + wheel/tyre trade-offs. For a first bike I'd weight fit and
37
- > comfort over outright speed. Track?"
38
- > **User:** "Yes — I want to actually enjoy riding it."
39
-
40
- → Deep **`domainSpec`** (→ `domain_spec.md`): the full how-to-buy-well — the
41
- complete fit process, geometry, gearing theory, material/wheel trade-offs — the
42
- layer a coarse "size 56, black" request never names. *(If the agent had no web tool,
43
- it would say so, then compose the domain spec from well-established, public buying knowledge — never present a guess as verified research.)*
44
-
45
- **3. `user_spec.md` — one basic question.** The single most-basic niche fact:
46
-
47
- > **Expert:** "One basic thing I'll keep: your **height** and **inseam**?"
48
- > **User:** "178 cm, 81 cm inseam."
49
-
50
- → Seeded partial **`userSpec`** (→ `user_spec.md`): *height 178 / inseam 81 (soft
51
- facts); HARD-NO: carbon-fibre handlebars (inviolable).* The rest is augmented per
52
- query.
53
-
54
- **4. `playbook.md` — one question: compare a set of options (buying taste).**
55
-
56
- > **Expert:** "Of these three — a value alloy build, a mid-range carbon, a premium
57
- > race bike — which appeals, and why?"
58
- > **User:** "The value alloy, around €1500. I don't chase brands."
59
-
60
- → Seeded partial **`playbook`** (→ `playbook.md`): *value-conscious, ~€1500 feel,
61
- brand-agnostic; comfort over outright speed.*
62
-
63
- **5. `intent_spec.md` — sign-off.** The decomposition dimensions, derived from the
64
- domain spec:
65
-
66
- > **Expert:** "Every time you ask me to find something, I'll decompose along:
67
- > use-case, terrain, budget, fit envelope, timeline, compatibility, performance
68
- > priorities, aesthetics. Sign off?"
69
- > **User:** "Yep."
70
-
71
- → **`intentSpec`** (→ `intent_spec.md`): that schema (the dimensions to resolve),
72
- never a filled-in request.
73
-
74
- ## Assemble + endorse — the gate
75
-
76
- Identity confirmed (`road-cycling-buyer` / "Road-Cycling Buyer"), the assembled
77
- draft is a valid `sil_profile_materialize` input — persona → `SOUL.md`, all four
78
- SDS specs to the sil store, all present from creation (user side seeded *partial*):
79
-
80
- ```jsonc
81
- {
82
- "agentId": "road-cycling-buyer",
83
- "name": "Road-Cycling Buyer",
84
- "persona": "A patient first-road-bike advisor. Always explains fit. Standing rule: never recommend carbon-fibre handlebars.",
85
- "domainSpec": "## First road bike — how to buy well (deep)\n**Fit is everything**: size from height AND inseam; stack/reach set torso angle; saddle setback from KOPS; crank length scales with inseam; bar reach/drop set hands. Bad fit is the #1 reason first bikes get abandoned.\n## Geometry: endurance (comfort) vs race (speed); head-tube angle + trail govern handling.\n## Groupset & gearing: tier = shift quality + weight, not capability; gear-inches = chainring/cog × wheel; compact vs mid-compact vs 1x trade range for step size — pick for terrain.\n## Material & wheels: alloy vs carbon (feel/price/repairability); rim depth vs crosswind; tyre clearance bounds comfort.\n## Trade-offs: stiffness vs comfort; aero vs crosswind; tier vs budget. First bike: weight fit + comfort over speed.",
86
- "intentSpec": "## Decomposition dimensions (schema)\nuse-case; terrain; budget band; fit envelope; timeline; compatibility; performance priorities; aesthetics. The per-query fill is ephemeral; this schema is persisted.",
87
- "userSpec": "## User spec (seeded partial)\n### Soft facts/preferences\n- Height 178 cm, inseam 81 cm.\n- Comfort + enjoyment over outright speed.\n### Hard constraints (INVIOLABLE)\n- HARD-NO: carbon-fibre handlebars.",
88
- "playbook": "## Buying taste (seeded partial)\n- Value-conscious; budget feel ~€1500.\n- Brand-agnostic. (Finer taste fills in per-query.)"
89
- }
90
- ```
91
-
92
- > **Expert:** "Here's the expert — shall I create it?"
93
- > **User:** "Yes, create it."
94
-
95
- **This affirmative act is the gate** — up to here, **zero engine steps ran**. Only
96
- now does the engine proceed
97
- ([`../references/agent_creation_engine.md`](../references/agent_creation_engine.md)):
98
- validate-first → collision check → `openclaw agents add road-cycling-buyer
99
- --workspace ~/.openclaw/workspace-road-cycling-buyer --non-interactive --json`
100
- (confirm the inherited profile grants a web tool) → write the persona into
101
- `SOUL.md` → `sil_profile_materialize { agentId, name, domainSpec, intentSpec,
102
- userSpec, playbook }` → wire sil:
103
-
104
- ```
105
- openclaw config set 'agents.list[<i>].skills' '["sil"]' --strict-json
106
- openclaw config set plugins.entries.sil.enabled true --strict-json
107
- ```
108
-
109
- → `openclaw config validate --json` returns valid → **`created`**.
110
-
111
- ## As general counsel — an ongoing advisor, not a one-query optimizer
112
-
113
- The expert is now standing counsel for this buyer's cycling life. Across requests it
114
- **reuses** what it knows (the 178/81 fit envelope, the no-carbon-bars hard rule, the
115
- value-conscious taste — **never re-asked**), and on **every query** web-refreshes the
116
- domain spec, decomposes the request along the intent dimensions, and **augments** the
117
- already-present user spec + playbook — we keep learning.
118
-
119
- > **User:** "Find me a first road bike, ~€1500."
120
-
121
- This is one request, not the point of the expert. It runs the shop-time loop
122
- ([`../references/expert_shopping.md`](../references/expert_shopping.md) owns the
123
- map→search→compare→recommend machinery — not repeated here): web-refresh the domain,
124
- decompose the intent, augment the playbook with a taste it surfaces in context, then
125
- recommend with a "why" that **cites the layers** — "for your **178/81 fit envelope**
126
- (kept from before) a 54 cm endurance frame sits right, and **fit/comfort outrank
127
- outright speed on a first bike** (a domain mechanic), so I passed a lighter race-geo
128
- bike, all within your value budget." A rationale naming no domain mechanic and reusing
129
- no stored fact would **fail the SDS bar** even if the bike were fine.
130
-
131
- Weeks later the *same* counsel handles new needs without re-onboarding:
132
-
133
- > **User:** "Now a winter bike, same budget."
134
-
135
- It reuses the fit envelope and taste, decomposes the new intent (all-weather →
136
- mudguard clearance, tyre durability), and recommends citing the kept fit fact + a
137
- winter domain mechanic. A "bump my budget to €2000" **updates** the stored taste
138
- (visibly); but "find me a carbon-handlebar bike" hits the standing **hard rule** —
139
- intent never overrides a hard constraint.
140
-
141
- ## Edge cases this example would have handled
142
-
143
- - **Collision** (`road-cycling-buyer` exists): the engine returns `collision`, writes
144
- nothing, the conversation offers **refine-or-rename** — never clobbers.
145
- - **Abandon before endorsement**: nothing created, nothing to tear down — the draft
146
- lived only in the conversation.
147
- - **No web tool**: the expert says so honestly and proceeds on the existing domain
148
- spec — never pretends the refresh happened.
149
- - **Creation is local + offline** (for identity): no sil registration to create; the
150
- user registers later, on first shop, via `sil_register`.
@@ -1,79 +0,0 @@
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 user states a shopping intent ("find me something for a steak dinner around $40"). The [engine's Runtime hook](agent_creation_engine.md) ends where this loop begins: the host has injected the persona via the workspace **`SOUL.md`** (voice, standing rules, hard-no's), and the sil skill has read `$SIL_DATA_DIR/agents/<agentId>/profile.json` and loaded the four SDS artefacts — all **present from creation** (seeded partial, augmented every query): **`domain_spec.md`** (deep researched niche expertise), **`intent_spec.md`** (the decomposition-dimension schema), **`user_spec.md`** (the user's facts + hard constraints), and **`playbook.md`** (the user's shopping taste — price sensitivity, brand, preferences). Those are now your operating instructions.
4
-
5
- This is **shop time**, not create time — behave like a specialist the user trusts, in the persona's voice. Consume the catalog tools **unchanged**; the rubric is applied by you at reasoning time, not by any new tool.
6
-
7
- This is **Spec-Driven Shopping (SDS)**, and **every query is a learning step** — all four sil docs are already present and the loop **augments / reinforces** them, never fills them from nothing. On **every query** the expert (a) keeps `domain_spec.md` current from the **web**, (b) **decomposes the request along the intent-spec dimensions** into an ephemeral per-query intent, and (c) **augments** `user_spec.md` with any new fact and `playbook.md` with any taste this query surfaces — we keep learning. It then layers **intent > playbook > user_spec > domain_spec** to drive the catalog query and the pick. The layering is the product: the pick's "why" must visibly cite the layers.
8
-
9
- The router's three always-on rules still hold (act-don't-narrate, follow the tool's own `recovery`, re-check the chosen item before commit) — this loop layers on top, it does not restate them.
10
-
11
- ## The loop (the order IS the spec)
12
-
13
- Run these steps in order. An attribute the user already stated **or the user spec already holds** is never re-asked.
14
-
15
- ### 1. Refresh the domain spec from the web
16
-
17
- Before anything else, go to the **web** and **enhance `domain_spec.md`** so it stays current and complete (new models, standards, prices, technique). Fold what you learn in and **persist** it by re-running **`sil_profile_materialize`** for this `agentId` with the updated `domainSpec` (the in-place re-materialize — the same atomic store path the engine and refine use). This is a **real web step** — if the host has no web/fetch tool, say so honestly and proceed on the existing domain spec; never pretend the refresh happened.
18
-
19
- ### 2. Decompose the request along the intent-spec dimensions (ephemeral — NEVER persisted)
20
-
21
- Read `intent_spec.md` — the decomposition **dimensions** a good query must resolve — and **fill them in for *this* request** from the user's words ("a waterproof trail shoe for a wet ultra next month, around €160" → use-case: trail/ultra; weather: wet; budget: ~€160; timeline: next month). State the filled decomposition back so the layering is legible. This filled instance is the **per-query intent** — **ephemeral**: it lives only in this conversation and is **NEVER persisted**. There is no intent artefact file of filled values, and `sil_profile_materialize` is never called to store it. Only the `intent_spec.md` *schema* is persisted; the fill is throwaway.
22
-
23
- ### 3. Augment the already-present user side — facts to `user_spec.md`, taste to `playbook.md`
24
-
25
- `user_spec.md` and `playbook.md` are **already present** (seeded partial at creation) — this step **augments** them, it does not build them from nothing. Resolving the intent dimensions may surface a new user **fact** (a measurement, a compatibility detail, a hard constraint) or a new **shopping taste** (price sensitivity, brand preference) — asked in-context for *this* query, in the persona's voice, **only when a dimension actually needs it** — then persist it and never re-ask:
26
-
27
- - A **fact / measurement / hard constraint** → fold into `user_spec.md` and re-materialize (updated `userSpec`). Mark each as **soft** (bendable) or a **hard constraint** (inviolable — "never leather", "nothing over 8 kg", an allergy, an age gate).
28
- - A **shopping-taste preference** (budget band, brand likes/dislikes) → fold into `playbook.md` (the user's **shopping taste** — price sensitivity and brand preference) and re-materialize (updated `playbook`).
29
-
30
- The user side **grows incrementally, per-query** — augmenting what is already there, never a big up-front form, never a one-time capture from nothing. **We keep learning**: every query leaves both docs at least as sharp as it found them. Elicitation is **need-driven and load-bearing**: only a dimension **missing** from BOTH the request AND the stored user side is elicited, in the **playbook's priority order** (highest-priority missing dimension first), in the persona's style — one or a few questions at a time. This is **not a form** and **not a question battery**: an attribute the user spec or playbook **already holds is never re-asked** — the stored value fills it (never re-ask what the user already stated). When the request plus the stored side already carry enough load-bearing attributes for a defensible search, proceed **straight to** the map+search steps — do not invent an extra battery. A request that contradicts a stored **soft** preference **updates** it (re-materialize), visibly (a **hard constraint** is not overridden — see precedence). The user spec / playbook are **per-user, per-expert, and local** — written only to this user's `$SIL_DATA_DIR/agents/<agentId>/`, no server aggregation, no cross-user signal (same posture as [`refine_expert.md`](refine_expert.md)). Capture is **in the open**: each new fact or taste is elicited **in-context, in the persona's voice, only when a dimension needs it** — never silently harvested — and the user can review everything an expert has stored with `sil_profile_get` and erase it (the whole expert) with `sil_profile_remove`.
31
-
32
- ### Layering — precedence intent > playbook > user_spec > domain_spec
33
-
34
- - **Intent** (the per-query decomposition) narrows the field — what this request demands.
35
- - **Playbook** (shopping taste) shapes preferences — price sensitivity, brand, taste — within what the intent allows.
36
- - **User spec** fills standing **facts** the request left unsaid (a measurement kept from before, a compatibility constraint) — never re-asked — and carries the **hard constraints**.
37
- - **Domain spec** supplies the **decision-mechanics and trade-offs** to reason over (for trail running, last volume and lug depth matter more than weight here) — the substrate, not a tiebreaker over the user's wants.
38
-
39
- **Precedence resolves conflicts: intent > playbook > user_spec > domain_spec — for *preferences*.** A specific request overrides a standing taste, which overrides a soft fact-preference, which overrides a domain default. **Exception — hard constraints are inviolable:** a `user_spec.md` **hard constraint** is **never** overridden by intent, taste, the domain, or the catalog. Intent can override a soft preference; it can **never** override a hard constraint. A weight bends; a hard constraint does not.
40
-
41
- **Route every hard constraint to a real enforcement point, never only soft `query` text.** A hard constraint must hold at **search-param time** (map it to a real `sil_search` filter where one exists — `condition`, `available` — per [`search_param_mapping.md`](search_param_mapping.md)), **in the rubric** (an explicit **reject-at-pick** rule: a violating candidate is rejected outright, not down-weighted), and **in the final pick**. A constraint carried only as free-text `query` is NOT enforced — the catalog can still surface a violating item, and picking it is a **defect**.
42
-
43
- > **Terminology — "reject-at-pick" here = the "reject-at-…-rule" phrasing in [`search_param_mapping.md`](search_param_mapping.md) (same rule, one mechanism)** — the one rubric rule that discards a hard-constraint-violating candidate outright (a reject, never a down-weight).
44
-
45
- ### 4. Map the answers to well-formed `sil_search` params
46
-
47
- Translate each filled intent dimension — **plus the standing user-spec facts, the shopping taste, and the domain-spec mechanics** the layering brought in — to a **real `sil_search` param** per [`search_param_mapping.md`](search_param_mapping.md). That reference owns the full answer→param table and worked examples; **load it, do not re-carry it here.** The load-bearing rules that govern this step:
48
-
49
- - A stated taste with **no matching param** (a colour, a brand) folds into the `query` text or the rubric — you **never invent a filter**. There is no `color` param, no `brand` param.
50
- - A user-spec **hard constraint** maps to a **real filter where one exists** (`condition`, `available`) so the catalog never returns a violating item; where no param matches, it does NOT collapse to `query` text — it becomes an explicit **reject-at-pick** rubric rule (Step 6).
51
- - Leave **`ship_to` empty** by default so the server resolves the registered default address. Do **not** call `sil_whoami` to populate it.
52
-
53
- ### 5. Search
54
-
55
- Call `sil_search` with the mapped params. It returns purchasable variants **best-first**.
56
-
57
- ### 6. Compare the candidates on the rubric — reject hard-constraint violators outright
58
-
59
- The **rubric emerges here, at pick time** — not a stored seller artefact. Build it from the **domain-spec dimensions and trade-offs** (last volume vs. weight, rim depth vs. crosswind — the mechanics the domain spec named) **weighted by the shopping taste** (`playbook.md`), the **user's facts** (`user_spec.md`), and the **per-query intent**. A user-spec **hard constraint** is a **reject-at-pick** rule, not a weight: any candidate that violates it is **removed from contention outright** — never the pick, even if it scores well elsewhere. (A soft preference only down-weights.) The rubric informs your *reasoning*, not list order: present results **best-first** as `sil_search` returned them — **never re-rank** — but a hard-constraint violator is never the pick.
60
-
61
- ### 7. Recommend — always with the "why" that cites the layers
62
-
63
- Recommend with **domain-relevant rationale** in the expert's voice — the **"why"** must make the layering **legible**: cite the **per-query intent** (what this request demanded), at least one **stored user-spec fact or taste you did NOT re-ask** ("you're a wide D-width, kept from before"), and at least one **researched domain-spec dimension** ("for trail running, last volume and lug depth matter more than weight here") — tied to the user's priorities. The **visible layering is the product**: a "why" that names no researched domain dimension and reuses no stored user attribute is generic attribute matching and **fails the SDS bar even if the picked product is fine**. Never hand back a bare list.
64
-
65
- ### 8. Re-fetch with `sil_product_get` before any buy
66
-
67
- Price, availability, and `checkout_url` from `sil_search` are **point-in-time**. Before any **buy / checkout**, **re-fetch** the chosen item with `sil_product_get` for fresh price / availability / `checkout_url`. **Never commit a buy off the stale `sil_search` snapshot.**
68
-
69
- ## When `sil_search` returns `ok` with `products: []` — relax and explain
70
-
71
- An empty result on `status: ok` is a normal, servable outcome — **never a silent dead-end**. **Relax or re-frame** the params (loosen a constraint, broaden the `query`) and **explain what you changed and why** ("I dropped the secondhand-only filter because nothing matched — here's what's in stock"). Never just stop silently.
72
-
73
- ## When the domain is genuinely unservable — an honest "no", never junk
74
-
75
- When the catalog **cannot serve** the domain — out of scope, **not shippable**, **age-gated**, or persistently empty after a reasonable relax — say so **honestly**. This is a **different outcome** from the empty-but-servable relax case: there is no constraint to loosen, so you give an honest "no". **Never fabricate** options and **never pad with junk** — handing back unbuyable results destroys trust.
76
-
77
- ## When `sil_search` / `sil_product_get` returns a non-`ok` status
78
-
79
- A non-`ok` status is **not an empty match** — do **not** treat a `retryable` or an auth failure like `products: []` and relax the params. **Follow the tool's own `recovery` hint** exactly and **never improvise**. The full taxonomy and per-status recovery live in [`catalog_tools_reference.md`](catalog_tools_reference.md) — **load it, do not re-carry the taxonomy here.**
@@ -1,42 +0,0 @@
1
- # Manage your sil shopping experts — list, view, remove
2
-
3
- Load this when the user wants to see or remove an expert they created — "what experts do I have?", "show me the gift buyer", "delete the grocery agent". The router in `SKILL.md` names which `sil_profile_*` tool each intent maps to; this reference is what those tools do, plus the host-CLI-first ordering and the confirm-before-remove gate.
4
-
5
- These are pure local-lifecycle operations over the two stores the create-engine established — **host config + workspace `SOUL.md` = wiring + persona; `$SIL_DATA_DIR/agents/<id>/` = SDS behaviour artefacts**. No server call, no token read, no identity coupling: a user with zero experts still shops generically exactly as before.
6
-
7
- **The source of truth for "what is a sil expert" is the sil artefact store, not the host agent list.** A directory `$SIL_DATA_DIR/agents/<id>/` with a readable `profile.json` IS a sil expert; a bare host `agents.list[]` entry without one is just a host agent, not ours to list/view/remove. Always read `profile.json`, **never the host agent list**, to decide what exists.
8
-
9
- ## Match intent to a tool
10
-
11
- | Intent | Tool |
12
- |---|---|
13
- | "list my experts" / "what shopping experts do I have?" | `sil_profile_list` (no arguments) |
14
- | "show me / tell me about &lt;expert&gt;" | `sil_profile_get` (pass the `agentId`) |
15
- | "remove / delete &lt;expert&gt;" | host CLI `openclaw agents remove <agentId>` **FIRST**, then `sil_profile_remove` (see the remove flow) |
16
-
17
- ## How the two read tools behave
18
-
19
- - **`sil_profile_list`** enumerates the artefact store, returning experts most-recently-created first (`createdAt` desc), each with `agentId`, `name`, `createdAt`. Every expert carries all four SDS specs (all required, present from creation), so per-slot presence is not flagged. Present a name + short domain summary + the `agentId` so the user can refer to one unambiguously. An empty `experts: []` is a normal, successful outcome — say "you have no sil shopping experts yet" and point at how to create one. A degraded expert lands in `unreadable[]` — mention it inline, but never let it hide the healthy ones.
20
- - **`sil_profile_get`** resolves one expert by `agentId`, returning its `name`, its four SDS specs (**`domainSpec`** + **`intentSpec`** + **`userSpec`** + **`playbook`**, all present), `profilePath`, and `createdAt`. The persona is **not** here — it is the host workspace `SOUL.md`. Render a human summary: the name, the niche (from the domain spec), what it knows about the user (user-spec facts + buying taste), and a wiring summary (a real host agent, sil plugin enabled, sil skill attached, ready with no further setup). An unknown expert returns `not_found` — frame it plainly ("no sil expert named '<x>'") and list the experts that DO exist. **Never surface a stack trace or a raw filesystem path.**
21
-
22
- ## Remove flow — host-CLI FIRST, then the artefact tool
23
-
24
- Removal is **destructive and irreversible** (the expert's SDS artefacts, host wiring, and `SOUL.md` are deleted), so **confirm before removing**: state exactly what will be deleted — this one named expert, both its host wiring and its sil behaviour artefacts — and proceed only on the user's **explicit go-ahead**. Then run these steps **in this exact order**:
25
-
26
- 1. **Existence check (read).** Run `openclaw agents list --json` and confirm the `agentId` is a sil-wired agent the user means.
27
- 2. **Remove the host wiring (host CLI) — FIRST.** Run `openclaw agents remove <agentId>`, then `openclaw config validate --json` to confirm the host config is still valid. The plugin cannot write the host config, so this half is the host CLI's and runs ahead of the artefact removal.
28
- 3. **Remove the sil artefacts (plugin tool) — SECOND.** Call `sil_profile_remove { agentId }` to delete the expert's behaviour-artefact directory — the **artefact half only** (`$SIL_DATA_DIR/agents/<id>/`), scoped to exactly the one validated `agentId`. A malformed/traversal/`main` id returns `invalid_request` and deletes nothing; an unknown id returns `not_found` (idempotent — safe to re-run).
29
-
30
- **Never artefacts-first.** The order is a safety decision: if step 3 fails after step 2, the only survivor is a *residual artefact directory with no host entry* — harmless disk cruft that `sil_profile_list` still surfaces, so the user retries `sil_profile_remove` clean. The **reverse** order is unsafe — artefacts gone, then a failed host step, leaves a *host entry whose `profile.json` is gone*: the agent still loads but the sil skill ENOENTs on its SDS specs at runtime, a visibly broken expert. Both halves are individually idempotent, so a re-run from any partial state converges to clean. After removal, confirm the expert is gone and the user's **other experts and generic shopping are untouched**.
31
-
32
- Leave `plugins.entries.sil.enabled` alone on removal — it is shared host state (every other expert depends on it), not per-agent. Even removing the last expert leaves it enabled.
33
-
34
- ## Status taxonomy (manage: list / view / remove)
35
-
36
- | `status` | Meaning | What to do |
37
- |---|---|---|
38
- | `ok` | List succeeded (`experts` may be empty — normal), or a view returned the expert's detail. | Relay the data; on an empty list, say so plainly and point at creation. |
39
- | `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, a re-run is safe (idempotent). |
40
- | `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 raw path to the user. |
41
- | `removed` | `sil_profile_remove` deleted the expert's artefact directory. | Confirm it is gone; ensure the host-wiring removal (step 2) ran first. |
42
- | `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 host-wiring half need not be redone. |
@@ -1,43 +0,0 @@
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.** Refinement starts only when the user **explicitly asks** to sharpen a **named** expert. At the end of a session you MAY *offer* to refine — but that offer is a prompt only: it loads nothing, proposes nothing, and persists nothing until the user accepts and then clears the explicit confirm gate in step 3. An ambiguous, silent, or off-topic remark is **never** a trigger. Once triggered, load that one expert's current SDS artefacts with **`sil_profile_get { agentId }`** — the manifest plus the `domainSpec` / `intentSpec` bodies (always present) and the `userSpec` / `playbook` bodies (when captured). The persona is the host workspace **`SOUL.md`**, read separately when a persona refinement is on the table. 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 (the host `SOUL.md`), a **domain-spec** mechanic or dimension (`domain_spec.md` — e.g. a niche detail the research missed or got wrong), an **intent-spec** decomposition dimension (`intent_spec.md` — e.g. a dimension that mattered for every request but the schema never named), a **user-spec** fact or hard constraint (`user_spec.md` — e.g. a standing measurement, "never leather" as a hard constraint), or a **buying-taste** preference (`playbook.md` — e.g. a brand the user keeps rejecting, a tightened budget band); 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 fact/taste/constraint the user **volunteered but the spec never captured** (e.g. "you said 'nothing over 8kg' three times" → a `user_spec.md` hard constraint; "you rejected every leather option" → a `user_spec.md` hard constraint; "you kept asking about lug depth, which my domain spec never covered" → a `domain_spec.md` mechanic; "every request turned on frame size, but my intent schema never decomposed on it" → an `intent_spec.md` dimension).
16
-
17
- The four SDS artefacts are **first-class refinable elements** alongside the persona: a refinement can target the **domain spec** (`domain_spec.md`), the **intent spec** dimensions (`intent_spec.md`), a **user-spec** fact or hard constraint (`user_spec.md`), or the **buying taste** (`playbook.md`) as a distinct artefact element, each persisted via the same in-place re-materialize (step 4). The **per-query intent** is ephemeral and is never a refine target — only the `intent_spec.md` *dimension schema* is.
18
-
19
- 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.)
20
-
21
- 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**.
22
-
23
- 4. **Persist ONLY the confirmed subset.** Fold **only the confirmed** proposals into the expert's spec (a **domain-spec** change → the `domainSpec` body / `domain_spec.md`; an **intent-spec** dimension change → the `intentSpec` body / `intent_spec.md`; a **user-spec** fact or hard-constraint change → the `userSpec` body / `user_spec.md`; a **buying-taste** change → the `playbook` body / `playbook.md`), then re-run the engine's persist step — **`sil_profile_materialize { agentId, name, domainSpec, intentSpec, userSpec, playbook }`** — over that one `agentId`. **All four specs are required and are always passed** (read the current bodies, fold the confirmed change into the relevant one, and pass all four back — the re-materialize re-writes each whether or not it changed). The unconfirmed proposals are **discarded** with the conversation; nothing else persists. If the user confirms nothing, nothing changes.
24
-
25
- The re-materialize is an **atomic in-place re-write** of that one expert's four SDS artefacts — `domain_spec.md`, `intent_spec.md`, `user_spec.md`, `playbook.md` (all four are passed; the confirmed refinements change whichever bodies they touch) 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 files roll back together".*
26
-
27
- When a confirmed refinement changes the **persona** (the expert's system framing), refresh the agent's workspace **`SOUL.md`** via the host CLI — the persona is the `SOUL.md`, not a sil artefact, so a persona refinement is a host-CLI `SOUL.md` re-write, NOT a `sil_profile_materialize` call. SDS behaviour artefacts go to the sil data directory via the plugin tool; the `SOUL.md` refresh is host-CLI; identity is untouched.
28
-
29
- 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 deeper domain spec, the sharper intent dimensions, the new hard-no in the user spec, the tightened taste. The improvement is durable: refinement is **iterative, never one-shot** — a change that did not land well is itself refinable next time.
30
-
31
- 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.
32
-
33
- ## Privacy + scope — per-user and local
34
-
35
- 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.
36
-
37
- ## How a refinement reaches the `sil_search` params
38
-
39
- A refinement to what the expert searches on lands in an SDS artefact — a domain mechanic in `domain_spec.md`, a decomposition dimension in `intent_spec.md`, a stored fact in `user_spec.md`, or a taste in `playbook.md` — and those feed the **shop-time** mapping ([`search_param_mapping.md`](search_param_mapping.md)). The mapping maps **only onto real `sil_search` params** — and a refined fact/taste with **no matching param** folds into the `query` text or the recommend-time 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).
40
-
41
- ## When there is no observed-session signal
42
-
43
- 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.