sil-openclaw 0.2.4 → 0.3.1
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 +145 -0
- package/README.md +67 -9
- package/dist/index.js +2 -0
- package/dist/lib/profile-store.js +478 -0
- package/dist/tools/profile.js +319 -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 +150 -0
- package/skill/references/agent_creation_engine.md +76 -0
- package/skill/references/brainstorm_interview.md +77 -0
- package/skill/references/catalog_tools_reference.md +46 -0
- package/skill/references/expert_shopping.md +79 -0
- package/skill/references/manage_experts.md +42 -0
- package/skill/references/refine_expert.md +43 -0
- package/skill/references/search_param_mapping.md +55 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Create a sil-wired shopping expert — the agent-creation engine
|
|
2
|
+
|
|
3
|
+
**Precondition: run this ONLY after the user has explicitly endorsed the assembled draft from [`brainstorm_interview.md`](brainstorm_interview.md).** Any step below before that endorsement is forbidden — the interview owns the gate.
|
|
4
|
+
|
|
5
|
+
When the user wants a **dedicated shopping expert**, author and persist a **valid OpenClaw agent profile**: a real new agent under the host `agents` config, with the **sil plugin enabled**, the **sil skill attached**, its persona written into the workspace **`SOUL.md`**, plus the expert's SDS behaviour artefacts in the sil data directory — so it shops with **no further setup**.
|
|
6
|
+
|
|
7
|
+
Every created expert runs **entirely on Spec-Driven Shopping (SDS)** — the operating model, not an optional layer. The engine persists **all four** SDS specs, each **required and non-blank**: the deep researched `domainSpec`, the derived `intentSpec` schema, and an **initial** `userSpec` + `playbook` (seeded *partial* by the interview's one-touchpoint-per-document setup). All four are present from creation, then **augmented every query** ([`expert_shopping.md`](expert_shopping.md)) — we keep learning.
|
|
8
|
+
|
|
9
|
+
You are the engine: the host config write (and the `SOUL.md` write) is **you driving the host's own `openclaw …` CLI** — the sil plugin never writes the host config. Run the steps **in order, top to bottom** — the order is the spec.
|
|
10
|
+
|
|
11
|
+
## The profile spec (input)
|
|
12
|
+
|
|
13
|
+
The endorsed draft feeds two stores. The **persona** becomes the host workspace **`SOUL.md`** (its identity / voice / standing rules — via the host CLI, **not** a sil artefact). The **four SDS specs** become the sil data-dir artefacts:
|
|
14
|
+
|
|
15
|
+
| Field | Meaning | Goes to | Required? |
|
|
16
|
+
|---|---|---|---|
|
|
17
|
+
| **agentId** | Lower-kebab id (e.g. `gift-buyer`) → `agents.list[].id`. Unique, never `main`. | host | Required |
|
|
18
|
+
| **name** | Human-readable name ("Gift Buyer"). | sil manifest | Required |
|
|
19
|
+
| **persona** | Who this expert is and how it shops. | host **`SOUL.md`** (via host CLI — no `persona.md`) | Required (non-empty) |
|
|
20
|
+
| **workspace** | The agent's workspace directory (e.g. `~/.openclaw/workspace-gift-buyer`). | host | Required for the non-interactive add |
|
|
21
|
+
| **domainSpec** | The niche's **deep researched expertise** — how to buy well, the full mechanics — from the interview's §2 research pass. Web-refreshed every query. | sil `domain_spec.md` | **Required (non-empty)** |
|
|
22
|
+
| **intentSpec** | The agent-specific **decomposition dimensions** (PRD-style schema) **derived from `domainSpec`**, signed off in §5. | sil `intent_spec.md` | **Required (non-empty)** |
|
|
23
|
+
| **userSpec** | The user's domain-relevant facts + hard constraints. **Seeded partial** from §3 (the one basic fact), then augmented per-query. | sil `user_spec.md` | **Required (non-empty)** |
|
|
24
|
+
| **playbook** | The user's **buying taste**. **Seeded partial** from §4 (the compare-options answer), then augmented per-query. | sil `playbook.md` | **Required (non-empty)** |
|
|
25
|
+
|
|
26
|
+
The **sil plugin** and **sil skill** are always attached (that is what makes it *sil-wired*). Creation is **local and offline** — it does **not** require or perform sil registration, reads no token, and writes nothing to identity storage. The expert registers the user later, on first shop, via `sil_register`. Do **not** present registration as a prerequisite.
|
|
27
|
+
|
|
28
|
+
## The created expert needs WEB tools
|
|
29
|
+
|
|
30
|
+
SDS **web-refreshes the domain spec on every query** and the §2 research pass also reaches the web. So the created agent must have **web/fetch tools in its tool profile** — inherited from `agents.defaults` when its shell is created (step 3). Confirm that profile grants a web-fetch/browse capability and **do not deny it** (alongside not denying the `sil_*` tools). If `agents.defaults` does **not** grant a web tool, the expert cannot keep its domain spec current — surface that to the user as a host-capability gap; do **not** pretend the refresh happened.
|
|
31
|
+
|
|
32
|
+
## Engine steps (run in this exact order)
|
|
33
|
+
|
|
34
|
+
1. **Validate the spec FIRST — before anything is written.** Check `agentId` (present, lower-kebab, unique-looking, ≠ `main`), `name`, `persona`, `workspace`, and the **four SDS specs — `domainSpec`, `intentSpec`, `userSpec`, `playbook` — all present and non-blank** (none is an "absent-is-fine" slot; the user side is seeded *partial* by the interview, never omitted). On any failure, stop with **`invalid_request`** naming the field and **write nothing**. This runs ahead of every host command, so a bad spec never reaches the host.
|
|
35
|
+
|
|
36
|
+
2. **Collision check — read before write.** Run `openclaw agents list --json`; if `agentId` already exists, stop with **`collision`** and **do not** run `openclaw agents add` — never overwrite an existing agent's persona or wiring. Surface it so the user can rename.
|
|
37
|
+
|
|
38
|
+
3. **Create the agent shell (host CLI).** Run:
|
|
39
|
+
```
|
|
40
|
+
openclaw agents add <agentId> --workspace <workspace> --non-interactive --json
|
|
41
|
+
```
|
|
42
|
+
This creates the real `agents.list[]` entry and the workspace bootstrap files (`SOUL.md`, `AGENTS.md`, …), inheriting model and **tool profile** (which must grant **web/fetch** — see above) from `agents.defaults`. `--non-interactive --json` lets you drive it without a prompt and read the result.
|
|
43
|
+
|
|
44
|
+
4. **Write the persona into the workspace `SOUL.md` (host CLI).** The persona is the agent's soul / system framing — the host's `SOUL.md`, **not** a sil artefact. Write the endorsed persona text straight into the new agent's `SOUL.md` via the host CLI. There is **no** `persona.md` in the sil store and **no** copy step — the persona lives in exactly one place.
|
|
45
|
+
|
|
46
|
+
5. **Materialize the SDS behaviour artefacts.** Call **`sil_profile_materialize`** with `{ agentId, name, domainSpec, intentSpec, userSpec, playbook }` — the deep `domainSpec`, the derived `intentSpec` schema, and the initial `userSpec` + `playbook` seeded by the interview (partial, augmented per-query). All four are **required and non-blank**. It writes atomically into **`$SIL_DATA_DIR/agents/<agentId>/`**: `domain_spec.md`, `intent_spec.md`, `user_spec.md`, `playbook.md`, plus `profile.json` (the manifest the sil skill reads at runtime). All four are seeded at creation — none deferred. There is **no `persona.md`** here. The tool's outcomes are `ok` / `invalid_request` / `persistence_failed` — on `invalid_request` it wrote nothing; on `persistence_failed` it left nothing partial.
|
|
47
|
+
|
|
48
|
+
6. **Wire the sil skill + plugin (host CLI).** Asserted against the pinned host — **`alpine/openclaw:2026.6.9`** — both value-mode sets with `--strict-json` (the only set mode this image accepts):
|
|
49
|
+
```
|
|
50
|
+
openclaw config set 'agents.list[<i>].skills' '["sil"]' --strict-json
|
|
51
|
+
openclaw config set plugins.entries.sil.enabled true --strict-json
|
|
52
|
+
```
|
|
53
|
+
The skill attach makes the agent **know how** to drive the tools; the plugin enable makes the four `sil_*` tools available. Keep `sil` in the agent's skill list and do not deny the `sil_*` tools.
|
|
54
|
+
|
|
55
|
+
7. **Validate with the host's OWN check, THEN declare created.** Run `openclaw config validate --json`. On `alpine/openclaw:2026.6.9` the verdict is `{ valid, path, issues? }` — success keys off **`.valid`**, never an `ok` field. Only when `valid: true` do you report **`created`**. If `valid: false` (or any CLI step failed), report **`persistence_failed`** with the failing **path** + **cause** (the `issues?`), leaving nothing partial.
|
|
56
|
+
|
|
57
|
+
8. **Tell the user it is ready.** On `created`, tell them the expert exists and how to open it. Opening it loads the persona (`SOUL.md`) and all four SDS specs (`profile.json`), and the expert calls `sil_search` / `sil_product_get` (and `sil_register` / `sil_whoami` as needed) on the user's intent with **no further setup**.
|
|
58
|
+
|
|
59
|
+
## Status taxonomy (agent-creation engine)
|
|
60
|
+
|
|
61
|
+
| `status` | Meaning | What to do |
|
|
62
|
+
|---|---|---|
|
|
63
|
+
| `created` | Agent added, artefacts materialized, sil plugin + skill wired, `openclaw config validate` accepted it. | Tell the user it's ready and how to open it. |
|
|
64
|
+
| `invalid_request` | Spec failed validation (missing/blank field). **Nothing written.** | Name the field, fix it, run again — do NOT proceed to `openclaw agents add`. |
|
|
65
|
+
| `collision` | An agent with that id already exists. | Surface it; pick a different id. **Never overwrite.** |
|
|
66
|
+
| `persistence_failed` | A write or `openclaw config validate` step failed. **Nothing partial** left. | Fix the reported path/cause, create again. |
|
|
67
|
+
|
|
68
|
+
## Runtime — how a created expert loads its behaviour
|
|
69
|
+
|
|
70
|
+
When you (the sil skill) start a session inside a created expert, the host has already injected the persona via the workspace **`SOUL.md`**. Then read `$SIL_DATA_DIR/agents/<agentId>/profile.json` and load the four **SDS behaviour artefacts** it points at — all **always present** (required at creation):
|
|
71
|
+
- **`domain_spec.md`** — deep researched niche expertise (how to buy well, the full mechanics) to reason over;
|
|
72
|
+
- **`intent_spec.md`** — the decomposition-dimension schema a query must resolve;
|
|
73
|
+
- **`user_spec.md`** — the user's domain-relevant facts + hard constraints (seeded partial, augmented per-query);
|
|
74
|
+
- **`playbook.md`** — the user's buying taste (seeded partial, augmented per-query).
|
|
75
|
+
|
|
76
|
+
Loading these is what lets the expert shop on its niche with no further setup. When the user states a shopping intent, shop per [`expert_shopping.md`](expert_shopping.md) — the loop that on **every query** web-refreshes the domain spec, decomposes the request along the intent-spec dimensions (the ephemeral per-query intent), and **augments** the already-present `user_spec.md` + `playbook.md` — we keep learning. To sharpen an expert from observed sessions, see [`refine_expert.md`](refine_expert.md).
|
|
@@ -0,0 +1,77 @@
|
|
|
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. Run an **open, back-and-forth interview** that shapes the expert *with* the user, then **create nothing** until the user endorses the assembled draft. The agent-creation engine ([`agent_creation_engine.md`](agent_creation_engine.md)) only runs **after** that explicit endorsement.
|
|
4
|
+
|
|
5
|
+
This is a **conversation, not a form-fill.** The rule is **at least one touchpoint per document** — you walk the five artefacts in order, one touchpoint each, and the deep work (the domain research) is **yours**, not the user's. The depth comes from the agent's own research, not from interrogating the user.
|
|
6
|
+
|
|
7
|
+
## The five SDS artefacts — all four sil docs SEEDED at creation
|
|
8
|
+
|
|
9
|
+
A created expert runs on five artefacts. **All four sil docs are present (non-blank) from creation**, seeded *partial* by this interview + the agent's research, then **lazily augmented / reinforced on every query** ([`expert_shopping.md`](expert_shopping.md)). No sil doc is created blank or deferred to a later first shop. What grows is their *content* — we keep learning.
|
|
10
|
+
|
|
11
|
+
| Artefact | Where | What it holds | Seeded |
|
|
12
|
+
|---|---|---|---|
|
|
13
|
+
| **`SOUL.md`** (persona) | host workspace (via host CLI) | the expert's identity / voice / standing rules | at creation (§1 below); refined on persona refine, stable per query |
|
|
14
|
+
| **`domain_spec.md`** | sil data dir (**required**) | deep researched niche expertise — how to buy well, the full mechanics; web-refreshed every query | at creation (§2 — the agent's own research) |
|
|
15
|
+
| **`intent_spec.md`** | sil data dir (**required**) | the agent-specific **decomposition dimensions** (PRD-style) a query must resolve | at creation (§5 — derived from the domain) |
|
|
16
|
+
| **`user_spec.md`** | sil data dir (**required**) | the user's domain-relevant facts + hard constraints | seeded partial at creation (§3); augmented every query |
|
|
17
|
+
| **`playbook.md`** | sil data dir (**required**) | the user's **buying taste** (price sensitivity, brand, preferences) | seeded partial at creation (§4); augmented every query |
|
|
18
|
+
|
|
19
|
+
The per-query intent (the dimensions filled in for one request) is **ephemeral** — never persisted, never authored here.
|
|
20
|
+
|
|
21
|
+
## Principles for the interview
|
|
22
|
+
|
|
23
|
+
- **One touchpoint per document, walked in order.** Touch each of the five artefacts exactly once during setup (the domain is the exception — agent-researched, **zero questions**). Don't fire a fixed battery; don't over-burden the user. The deep domain spec is the **agent's own research**, never interrogated from the user.
|
|
24
|
+
- **The persona question comes first, and the niche falls out of it.** Asking "what kind of expert, and how should it behave?" surfaces the niche as a by-product — there is **no separate narrow-the-niche step**.
|
|
25
|
+
- **Research, don't interrogate.** The objective decision-mechanics of the domain are *yours* to research (web + knowledge); the user supplies the persona, one basic fact, one taste comparison, and a sign-off — not the domain expertise.
|
|
26
|
+
- **Converge, don't accumulate.** Reflect a short summary back and get a yes/adjust before advancing. The flow is **collaborative** and **re-entrant** — not a locked wizard; the user can revise an earlier section at any point.
|
|
27
|
+
- **Endorsement is a gate, not a formality.** Until the user explicitly says "create it", run **zero** engine steps. The draft lives only in the conversation.
|
|
28
|
+
|
|
29
|
+
## Run the interview in this order — one touchpoint per document
|
|
30
|
+
|
|
31
|
+
### 1. `SOUL.md` — ASK FIRST: persona + behaviour (the niche falls out of this)
|
|
32
|
+
|
|
33
|
+
Open by reflecting the request back ("a shopping expert — let's shape it together"), then ask the **persona/identity** question: **"What kind of expert do you want, and how should it behave?"** — its expertise, voice/tone (terse vs. chatty, cautious vs. opinionated), and any standing rules. This is **not** niche-narrowing: the **niche falls out of the answer** ("a patient first-bike advisor" → the niche is *first road bikes*). Reflect a short persona summary back and confirm. This becomes the host workspace **`SOUL.md`** (the persona is the agent's system framing — **not** a sil artefact, no `persona.md`). If the niche is still vague after the persona answer, fold one clarifying turn into this section — do not run a dedicated narrow-the-niche step.
|
|
34
|
+
|
|
35
|
+
### 2. `domain_spec.md` — NO QUESTION: the agent researches the web itself
|
|
36
|
+
|
|
37
|
+
With the niche surfaced from §1, **actively research it yourself (web + knowledge)** — pull *everything* about how to buy well in the niche, its **decision-attributes**, and its mechanics, deeply. For a bike that is the full domain: gearing/groupsets and gearing theory, frame types and geometry, **the complete process of fitting a bike to a person**, wheel/tyre selection, the trade-offs that drive a good buy. Converge a **deep domain spec**: how a person *should* buy in this niche, closing the gap where the consumer was uninformed (higher satisfaction, fewer returns). **The fit is everything** — this is researched substance, not restated persona prose and not generic filler; a shallow bullet list, or anything a layperson could have written, **fails the SDS bar** (business rule 4). Reflect the shape back briefly ("for a road bike, fit comes from stack/reach, saddle setback, crank length — here's how I'll think about your buy") and confirm. **Ask the user no domain question — you research it.** This lands in `domainSpec` (→ `domain_spec.md`). **If you lack web access, tell the user** you need web search, then write `domain_spec.md` from your own knowledge — never fake the research, never silently proceed.
|
|
38
|
+
|
|
39
|
+
### 3. `user_spec.md` — ONE basic question
|
|
40
|
+
|
|
41
|
+
Ask the **single most-basic niche fact** the domain mechanics turn on — for shoes, *foot length + width*; for a bike, *height + leg length*. Plus any **hard constraint** the user volunteers ("never leather", an allergy, a budget hard-no). Seed a *partial* **`userSpec`**: the basic fact(s) + any stated hard constraints, marked **hard** (inviolable) vs **soft** (a bendable preference). Don't run a questionnaire — one basic question; the rest is **augmented per-query** at shop time. If the user gives little, seed a minimal honest body (e.g. "facts to be learned as we shop; no hard constraints stated yet") — non-blank, but partial. This lands in `userSpec` (→ `user_spec.md`).
|
|
42
|
+
|
|
43
|
+
### 4. `playbook.md` — ONE question: compare a set of options (buying taste)
|
|
44
|
+
|
|
45
|
+
Surface the user's **buying taste** with **one** question: ask them to **compare a set of options** ("of these three — a value alloy build, a mid-range carbon, a premium race bike — which appeals, and why?"). Their choice and reasoning reveal price sensitivity, brand leanings, and how they weigh value vs. performance — taste a direct "what's your budget?" wouldn't. Seed a *partial* **`playbook`** from the answer (budget feel, brand leanings, value-vs-performance lean), augmented per-query. This lands in `playbook` (→ `playbook.md`). The old seller's-method playbook (elicitation style + answer→param mapping + rubric) is gone: the voice folds into the persona, what to search on lives in the domain spec + the generic [`search_param_mapping.md`](search_param_mapping.md), and the rubric **emerges at recommend time** from the domain dimensions weighted by taste + facts + the per-query intent.
|
|
46
|
+
|
|
47
|
+
### 5. `intent_spec.md` — SIGN-OFF: present the decomposition dimensions
|
|
48
|
+
|
|
49
|
+
From what you learned writing the domain spec, derive the **decomposition dimensions** every query in this niche must resolve — a PRD-style schema (for cycling: use-case, terrain, budget band, fit envelope, timeline, compatibility, performance priorities, aesthetics). These are **agent-specific** — from *this* niche's domain spec, not a generic checklist. Present them and ask the user to **sign off** ("every request, I'll decompose along these — sound right?"). This is the **schema** (the dimensions to resolve), never a filled-in instance (that is the ephemeral per-query intent). This lands in `intentSpec` (→ `intent_spec.md`).
|
|
50
|
+
|
|
51
|
+
### 6. Derive the identity, assemble, endorse
|
|
52
|
+
|
|
53
|
+
- **Identity.** Propose an `agentId` (lower-kebab, `^[a-z0-9][a-z0-9-]*$`, never `main`) and a human-readable `name` ("Road-Cycling Buyer" / `road-cycling-buyer`) from the converged niche. **Confirm both** — never silently invent them.
|
|
54
|
+
- **Assemble + present.** Compose `{ agentId, name, persona, domainSpec, intentSpec, userSpec, playbook }` and present a **readable summary**: who the expert is, the **deep domain spec**, the **intent dimensions**, and the **seeded user spec + buying taste** (partial, to grow per-query). Self-check the shape against the engine's `sil_profile_materialize` contract: `agentId` lower-kebab & ≠ `main`, non-blank `name`/`persona`, and a non-blank `domainSpec`/`intentSpec`/`userSpec`/`playbook` (all four present, seeded partial, never absent). This is shape-only — it writes nothing; the engine's validate-first step is the authoritative gate.
|
|
55
|
+
- **Endorse — 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". 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)).
|
|
56
|
+
|
|
57
|
+
## Edge cases the interview handles gracefully
|
|
58
|
+
|
|
59
|
+
- **Collision (an expert with that id already exists).** The engine refuses a name collision (its `collision` outcome from `openclaw agents list`) and never clobbers an existing agent. Surface it and offer a **choice — rename under a new id, or refine the existing expert** — never silently mutate the id or overwrite.
|
|
60
|
+
- **Abandon mid-flow.** Because **no engine step runs before endorsement**, abandonment leaves **nothing created** — no host agent, no artefacts, no wiring, no teardown. Never "save progress" by writing artefacts early.
|
|
61
|
+
- **Creation is local + offline (for the user's identity).** 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`. (The §2 domain research reaches the **web** for niche knowledge — the agent's own research, not the user's identity.)
|
|
62
|
+
|
|
63
|
+
## Business rules (invariants the interview holds on every path)
|
|
64
|
+
|
|
65
|
+
1. **No creation without explicit endorsement.** Nothing is written — not the host agent, the `SOUL.md`, the SDS artefacts, or the wiring — until the user explicitly endorses. The draft lives only in the conversation until then.
|
|
66
|
+
2. **Abandon-mid-flow creates nothing.** No engine step runs pre-endorsement, so an abandoned interview leaves no partial expert — automatic, not a teardown.
|
|
67
|
+
3. **One touchpoint per document, walked in order.** `SOUL.md` (ask first — persona, the niche falls out), `domain_spec.md` (no question — agent researches the web), `user_spec.md` (one basic fact), `playbook.md` (one compare-options question), `intent_spec.md` (sign-off). The deep domain expertise is the agent's **own research**, never interrogated. All four sil docs are **present (partial) from creation** — seeded fast, then augmented per-query; the user side is never "filled from empty later".
|
|
68
|
+
4. **The domain spec is DEEP and researched, never generic or restated persona prose.** It carries niche-concrete mechanics a layperson couldn't enumerate — the full how-to-buy-well (for a bike: the complete fit process, gearing theory, geometry — **the fit is everything**). A shallow bullet list or relabelled persona prose **fails SDS**. Research the niche; do not relabel latent knowledge. If you lack web access, say so, then write from your own knowledge — never fake it.
|
|
69
|
+
5. **The intent spec is derived FROM the domain spec, and is a schema not an instance.** The dimensions come from *this* niche's domain spec (agent-specific) and are the **template** to resolve — never the filled-in values for one request (the ephemeral per-query intent).
|
|
70
|
+
6. **Converge each section before advancing; stay re-entrant.** Reflect-and-confirm per section; let the user revise any earlier section.
|
|
71
|
+
7. **Refine-or-rename on collision; never clobber.** Defer to the engine's `collision` refusal; offer refine-or-rename.
|
|
72
|
+
8. **Creation is local + offline for the user's identity.** Never present sil registration / a token as a prerequisite to create. (Domain research may reach the web — the agent's research, not the user's account.)
|
|
73
|
+
9. **The persona is the host `SOUL.md`, not a sil artefact.** No `persona.md` in the sil store. The buying taste IS seeded — a *partial* `playbook.md` — but the old seller's-method playbook is gone (the rubric emerges at recommend time).
|
|
74
|
+
|
|
75
|
+
## After endorsement
|
|
76
|
+
|
|
77
|
+
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,79 @@
|
|
|
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)).
|
|
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.**
|
|
@@ -0,0 +1,42 @@
|
|
|
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 <expert>" | `sil_profile_get` (pass the `agentId`) |
|
|
15
|
+
| "remove / delete <expert>" | 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. |
|
|
@@ -0,0 +1,43 @@
|
|
|
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 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.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Answer→`sil_search`-param mapping (the mapping is real)
|
|
2
|
+
|
|
3
|
+
Load this at shop time, when an expert's loop maps a decomposed request into a `sil_search` call ([`expert_shopping.md`](expert_shopping.md) Step 4). 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. (Under SDS there is no stored "answer→param mapping" seller artefact — the niche knowledge of *what* to search on lives in the domain spec; this reference is the generic param table the mapping draws on.)
|
|
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
|
+
## SDS mapping inputs — the decomposed intent, the user facts, the buying taste, the domain mechanics
|
|
19
|
+
|
|
20
|
+
Under [Spec-Driven Shopping](expert_shopping.md), the mapping reads several layers, not only the user's words for *this* request:
|
|
21
|
+
|
|
22
|
+
- The **decomposed per-query intent** (the `intent_spec.md` dimensions filled in for this request — ephemeral) is the most specific layer and wins for *preferences* (precedence **intent > playbook > user_spec > domain_spec**).
|
|
23
|
+
- The **buying taste** (`playbook.md`) supplies the user's standing preferences — budget band, brand likes/dislikes — these map to params (a budget band → `price_min`/`price_max`) exactly like a freshly-stated answer would, but are **never re-asked**.
|
|
24
|
+
- The **user spec** (`user_spec.md`) supplies the user's standing **facts** (a foot profile, a compatibility detail) and the **hard constraints** — facts map to params like any stated answer; the stored value fills the param, never re-asked.
|
|
25
|
+
- The **domain spec** (`domain_spec.md`) supplies the niche's **decision-mechanics** — which attributes are load-bearing for *this* niche (last volume, rim depth, gearing range), so the mapping knows what to map and what matters.
|
|
26
|
+
|
|
27
|
+
The param table itself is **unchanged** — these layers are inputs to the same mapping, not new params. A domain dimension, a standing user fact, or a taste with **no matching param** folds into `query`/rubric per the no-invented-filter rule above, exactly like any other non-param taste.
|
|
28
|
+
|
|
29
|
+
## Hard constraints — route to a real filter AND a reject-at-recommend rule, NEVER only `query` text
|
|
30
|
+
|
|
31
|
+
A **user-spec hard constraint** ("never leather", "nothing over 8 kg", an allergy, an age gate) is **inviolable** — the expert never recommends a violating item. A hard constraint carried **only** as soft `query` free text leaks: the catalog can still surface a violating product, and recommending it is a defect. So map every hard constraint to **two** enforcement points, **not merely `query`**:
|
|
32
|
+
|
|
33
|
+
1. **A real `sil_search` filter where one exists.** "New only" / "secondhand only" → `condition`; "in stock only" → `available` (omit for the in-stock default). Where a param matches the constraint, set it so the catalog never returns the violating item at all.
|
|
34
|
+
2. **An explicit reject-at-recommend rubric rule** (`expert_shopping.md` Step 4). For a constraint with **no matching param** (no `material` filter for "never leather"), the constraint becomes a rubric rule that **rejects** any violating candidate outright — **never recommend** it — rather than down-weighting it. A hard constraint is a reject, not a weight.
|
|
35
|
+
|
|
36
|
+
A hard constraint that lands **only** in `query` text is **not** enforced — it is a hint, not a filter, and the catalog may ignore it. Route it to a filter and a reject rule; the `query` text is at most an additional nudge, never the sole carrier of an inviolable constraint.
|
|
37
|
+
|
|
38
|
+
## `ship_to` stays EMPTY by default — inline rule (do not skip)
|
|
39
|
+
|
|
40
|
+
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.
|
|
41
|
+
|
|
42
|
+
## Worked param examples
|
|
43
|
+
|
|
44
|
+
At shop time the mapping translates the decomposed intent + the stored facts/taste into concrete params. For a road-cycling expert whose user said (this request, plus a stored €1200 budget taste) "secondhand is fine, I'm in France and want local shops":
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
query: "<niche descriptors from the answer>" # e.g. "endurance road bike 105 groupset"
|
|
48
|
+
category: "<the narrowed niche category>"
|
|
49
|
+
price_max: 120000 # €1200 → minor units (cents)
|
|
50
|
+
condition: ["secondhand"] # "secondhand is fine"
|
|
51
|
+
local_merchants: true # "want local shops" → ranking bias; issue query in French
|
|
52
|
+
# ship_to: OMITTED — server resolves the registered default address; no sil_whoami round-trip
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Budget → `price_max` (cents), "secondhand is fine" → `condition`, "want local shops" → `local_merchants: true`; `ship_to` left out so the server resolves the registered default. A non-param taste ("understated colours") folds into `query` or the rubric, never a new filter.
|