sil-openclaw 0.2.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +128 -0
- package/README.md +68 -4
- package/dist/index.js +2 -0
- package/dist/lib/poller.js +9 -3
- package/dist/lib/profile-store.js +426 -0
- package/dist/tools/identity.js +201 -23
- package/dist/tools/profile.js +283 -0
- package/openclaw.plugin.json +7 -3
- package/package.json +1 -1
- package/skill/SKILL.md +29 -36
- package/skill/examples/road_cycling_expert_walkthrough.md +106 -0
- package/skill/references/agent_creation_engine.md +65 -0
- package/skill/references/brainstorm_interview.md +68 -0
- package/skill/references/catalog_tools_reference.md +46 -0
- package/skill/references/expert_shopping.md +112 -0
- package/skill/references/manage_experts.md +100 -0
- package/skill/references/refine_expert.md +41 -0
- package/skill/references/search_param_mapping.md +35 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Manage your sil shopping experts — list, view, remove
|
|
2
|
+
|
|
3
|
+
Load this reference the moment the user wants to see or remove an expert they
|
|
4
|
+
created — "what experts do I have?", "show me the gift buyer", "delete the
|
|
5
|
+
grocery agent". The router in `SKILL.md` names which `sil_profile_*` tool each
|
|
6
|
+
intent maps to; this reference is what those tools actually do, plus the
|
|
7
|
+
host-CLI-first ordering and the confirm-before-remove gate the remove flow
|
|
8
|
+
turns on.
|
|
9
|
+
|
|
10
|
+
These are pure local-lifecycle operations over the two stores the
|
|
11
|
+
create-engine established — **host config = wiring, `$SIL_DATA_DIR/agents/<id>/`
|
|
12
|
+
= behaviour artefacts**. No server call, no token read, no identity coupling: a
|
|
13
|
+
user with zero experts (or who just removed their last) still shops generically
|
|
14
|
+
exactly as before.
|
|
15
|
+
|
|
16
|
+
**The source of truth for "what is a sil expert" is the sil artefact store, not
|
|
17
|
+
the host agent list.** A directory `$SIL_DATA_DIR/agents/<id>/` with a readable
|
|
18
|
+
`profile.json` IS a sil expert; a bare host `agents.list[]` entry without one is
|
|
19
|
+
just a host agent and is not ours to list, view, or remove. Always read the
|
|
20
|
+
artefact store — `profile.json` — never the host agent list, to decide what
|
|
21
|
+
exists.
|
|
22
|
+
|
|
23
|
+
## Match intent to a tool
|
|
24
|
+
|
|
25
|
+
| Intent | Tool |
|
|
26
|
+
|---|---|
|
|
27
|
+
| "list my experts" / "what shopping experts do I have?" | `sil_profile_list` (no arguments) |
|
|
28
|
+
| "show me / tell me about <expert>" | `sil_profile_get` (pass the expert's `agentId`) |
|
|
29
|
+
| "remove / delete / get rid of <expert>" | host CLI `openclaw agents remove <agentId>` **FIRST**, then `sil_profile_remove` (see the remove flow below) |
|
|
30
|
+
|
|
31
|
+
## How the two read tools behave
|
|
32
|
+
|
|
33
|
+
- **`sil_profile_list`** enumerates the artefact store and returns the user's
|
|
34
|
+
experts most-recently-created first (`createdAt` desc), each with its
|
|
35
|
+
`agentId`, `name`, `hasPlaybook`, and `createdAt`. Present a name + a short
|
|
36
|
+
domain summary (distilled from the persona; a playbook signals a specialized
|
|
37
|
+
domain) plus the `agentId` so the user can refer to one unambiguously. An
|
|
38
|
+
empty `experts: []` is a normal, successful outcome — say plainly "you have no
|
|
39
|
+
sil shopping experts yet" and point at how to create one ("ask me to make a
|
|
40
|
+
shopping expert for …"). One degraded expert lands in `unreadable[]` — mention
|
|
41
|
+
it inline, but never let it hide the healthy ones.
|
|
42
|
+
- **`sil_profile_get`** resolves one expert by `agentId` and returns its `name`,
|
|
43
|
+
`persona`, optional `playbook`, `profilePath`, and `createdAt`. Render a human
|
|
44
|
+
summary: the expert's name, its domain/persona, whether it carries a domain
|
|
45
|
+
playbook (and a summary when present), and a wiring summary — it is a real
|
|
46
|
+
host agent with the sil plugin enabled and the sil skill attached, ready to
|
|
47
|
+
shop with no further setup. An unknown expert returns `not_found` — frame it
|
|
48
|
+
plainly ("no sil expert named '<x>'") and list the experts that DO exist (or
|
|
49
|
+
say there are none) so the next step is obvious. Never surface a stack trace or
|
|
50
|
+
a raw filesystem path.
|
|
51
|
+
|
|
52
|
+
## Remove flow — host-CLI FIRST, then the artefact tool
|
|
53
|
+
|
|
54
|
+
Removal is **destructive and irreversible** (the persona and playbook the user
|
|
55
|
+
authored are deleted), so **confirm before removing**: state exactly what will
|
|
56
|
+
be deleted — this one named expert, both its host wiring and its sil behaviour
|
|
57
|
+
artefacts — and proceed only on the user's explicit go-ahead. Then run these
|
|
58
|
+
steps **in this exact order**:
|
|
59
|
+
|
|
60
|
+
1. **Existence check (read).** Run `openclaw agents list --json` and confirm the
|
|
61
|
+
`agentId` is a sil-wired agent the user means.
|
|
62
|
+
2. **Remove the host wiring (host CLI) — FIRST.** Run
|
|
63
|
+
`openclaw agents remove <agentId>`, then `openclaw config validate --json` to
|
|
64
|
+
confirm the host config is still valid. The plugin cannot write the host
|
|
65
|
+
config, so this half is always the host CLI's, and it runs ahead of the
|
|
66
|
+
artefact removal.
|
|
67
|
+
3. **Remove the sil artefacts (plugin tool) — SECOND.** Call
|
|
68
|
+
`sil_profile_remove { agentId }` to delete the expert's behaviour-artefact
|
|
69
|
+
directory. It deletes the **artefact half only** — the expert's
|
|
70
|
+
`$SIL_DATA_DIR/agents/<id>/` directory — scoped to exactly the one validated
|
|
71
|
+
`agentId`; a malformed/traversal/`main` id returns `invalid_request` and
|
|
72
|
+
deletes nothing, and an unknown id returns `not_found` (idempotent — safe to
|
|
73
|
+
re-run).
|
|
74
|
+
|
|
75
|
+
**Never artefacts-first.** The order is a safety decision, not a style choice:
|
|
76
|
+
if step 3 fails after step 2, the only survivor is a *residual artefact
|
|
77
|
+
directory with no host entry* — harmless disk cruft, no broken agent ever loads,
|
|
78
|
+
and `sil_profile_list` still surfaces it so the user retries `sil_profile_remove`
|
|
79
|
+
clean. The **reverse** order is unsafe: artefacts removed first, then a failed
|
|
80
|
+
host step, leaves a *host `agents` entry whose `profile.json` is gone* — the
|
|
81
|
+
agent still loads but the sil skill ENOENTs on its persona/playbook at runtime,
|
|
82
|
+
a visible, confusing, broken expert. Both halves are individually idempotent
|
|
83
|
+
(host `agents remove` and `sil_profile_remove` both no-op on an absent target),
|
|
84
|
+
so a re-run from any partial state converges to clean. After a successful
|
|
85
|
+
removal, confirm the expert is gone and that the user's **other experts and
|
|
86
|
+
generic shopping are untouched**.
|
|
87
|
+
|
|
88
|
+
Leave `plugins.entries.sil.enabled` alone on removal — it is shared host state
|
|
89
|
+
(every other expert depends on it; generic shopping is unaffected by it), not
|
|
90
|
+
per-agent. Even removing the last expert leaves it enabled.
|
|
91
|
+
|
|
92
|
+
## Status taxonomy (manage: list / view / remove)
|
|
93
|
+
|
|
94
|
+
| `status` | Meaning | What to do |
|
|
95
|
+
|---|---|---|
|
|
96
|
+
| `ok` | List succeeded (`experts` may be empty — a normal outcome), or a view returned the expert's detail. | Relay the data; on an empty list, say so plainly and point at creation. |
|
|
97
|
+
| `not_found` | No sil expert matches the `agentId` (view or remove). | Frame it plainly and list the experts that DO exist; do NOT re-register. For remove, this also means a re-run is safe (idempotent). |
|
|
98
|
+
| `invalid_request` | The `agentId` was malformed, `main`, or traversal-shaped. **Nothing was read or deleted.** | Fix the id and call again — never a stack trace or a raw path to the user. |
|
|
99
|
+
| `removed` | `sil_profile_remove` deleted the expert's artefact directory. | Confirm it is gone; ensure the host-wiring removal (step 2) ran first. |
|
|
100
|
+
| `persistence_failed` | The artefact directory could not be removed (the **path** + **cause** name what to fix). | Fix the data directory (writable), then remove again; the already-done host-wiring half need not be redone. |
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Refine an existing expert from observed sessions — the refinement loop
|
|
2
|
+
|
|
3
|
+
When the user wants to **sharpen an expert they already have** — "refine my road-cycling buyer", "the gift buyer keeps surfacing the wrong stuff, let's fix it", "amend this expert" — do **not** re-brainstorm it from scratch and do **not** quietly mutate it. Run this **targeted-amend** loop: load the existing expert, propose concrete refinements drawn from what the agent actually **observed** in real shopping sessions under it, let the user **confirm a subset**, and persist **only** the confirmed subset by re-running the existing persist step. Nothing changes silently; nothing persists without the user's explicit confirmation.
|
|
4
|
+
|
|
5
|
+
This is a distinct capability from creating an expert ([`agent_creation_engine.md`](agent_creation_engine.md), which CREATES) and from the shop-time loop (which SHOPS). Refining **sharpens an existing expert** — the named one — from observed evidence. The default is a **targeted amend**, not a full cold re-brainstorm; a wholesale re-shape via the full interview remains available only on explicit request.
|
|
6
|
+
|
|
7
|
+
Run these steps **in order, top to bottom** — the order is the spec.
|
|
8
|
+
|
|
9
|
+
## The refinement loop (run in this exact order)
|
|
10
|
+
|
|
11
|
+
1. **Trigger + load the named expert.** The user names the expert to refine (or an end-of-session signal invites a refinement). Load that one expert's current artefacts with **`sil_profile_get { agentId }`** — the manifest plus the `persona` and `playbook` bodies. This is the working expert you are about to sharpen; everything you propose is grounded in what it already is.
|
|
12
|
+
|
|
13
|
+
2. **Propose, session-grounded — concretely, never a generic template.** Propose a small set of **concrete refinements drawn from the observed session** — what the agent actually saw in the just-completed (or in-progress) shopping session under this expert. Each proposal must name **two things**:
|
|
14
|
+
- **which artefact element it changes** — a `persona` standing rule, a `playbook` answer→param **mapping** entry, or a recommendation **rubric** weight; and
|
|
15
|
+
- **the concrete observed evidence behind it** — a `sil_search` param mapping that returned **relevant** vs **irrelevant** items, a question that turned out to matter (or was noise), a candidate the user **accepted** or **rejected**, or a taste/constraint the user **volunteered but the playbook never captured** (e.g. "you said 'nothing over 8kg' three times", "you rejected every leather option").
|
|
16
|
+
|
|
17
|
+
Every proposal cites the observed evidence — it is **grounded**, not guesswork. This is **not a generic template** and **not** a plausible-sounding ungrounded "improvement"; a proposal not tied to anything the session showed is forbidden. (When the observed session is unavailable, do not invent one — see the fallback at the foot of this reference.)
|
|
18
|
+
|
|
19
|
+
3. **Confirm — the gate, before anything persists.** Present the proposals and let the user **confirm a subset** — all, some, or none (per-proposal accept/reject; the user chooses **which to keep**). Confirmation is an **explicit affirmative act** on specific proposals. It is **never inferred from silence**, and **never** from the user answering an **off-topic** / unrelated question. This is the strongest invariant of the loop, re-applying the create engine's endorsement discipline at refine time — *see [`brainstorm_interview.md`](brainstorm_interview.md) for the endorsement-gate discipline; do not restate it here.* Until the user confirms, the proposals live **only in the conversation**.
|
|
20
|
+
|
|
21
|
+
4. **Persist ONLY the confirmed subset.** Fold **only the confirmed** proposals into the expert's **full** spec (persona drift → the `persona` body; mapping / rubric / elicitation drift → the `playbook` body), then re-run the engine's persist step — **`sil_profile_materialize { agentId, name, persona, playbook? }`** — over that one `agentId`. The unconfirmed proposals are **discarded** with the conversation; nothing else persists, no more than what the user agreed to. If the user confirms nothing, nothing changes.
|
|
22
|
+
|
|
23
|
+
The re-materialize is an **atomic in-place re-write** of that one expert's artefacts — `persona.md` and `playbook.md` are overwritten and the manifest refreshed, all-or-nothing per file (the store's existing idiom; do **not** hand-roll a write under the sil data directory). **On a persist failure the prior artefacts are left intact** — the expert is never served half-refined, and you tell the user the refinement **did not stick** (the failure leaves the prior state unchanged, so there is nothing to undo). *Truthful failure-safety note: the re-write is per-file atomic and dir-preserving — a failed re-write never tears the expert down and never serves a coherent half-refined expert (a broken manifest reads back as not-found, fail-closed). It is **not** a cross-file transaction; the safety property is "fails closed, prior expert intact / never half-served", not "all three files roll back together".*
|
|
24
|
+
|
|
25
|
+
When a confirmed refinement changes the **persona** (the expert's system framing), also refresh the agent's workspace `SOUL.md` via the host CLI — the wiring half, mirroring the engine's persona-as-system-framing step. Behaviour artefacts go to the sil data directory via the plugin tool; the `SOUL.md` refresh is host-CLI; identity is untouched.
|
|
26
|
+
|
|
27
|
+
5. **Close the loop — the refined expert reflects the kept changes on re-run.** A later session opened inside the refined expert loads the **updated** artefacts (the same Runtime hook the engine documents) and behaves accordingly — the sharper mapping, the new hard-no, the re-weighted rubric. The improvement is durable: refinement is **iterative, never one-shot** — a change that did not land well is itself refinable next time.
|
|
28
|
+
|
|
29
|
+
6. **Isolation + the no-signal fallback.** A refinement touches exactly the named expert's `agents/<agentId>/` directory — keyed off the single validated `agentId`. **Other experts are untouched** (no sibling expert's artefacts mutate), and the **generic, profile-less shopping path is untouched** (a plain sil session still shops exactly as today). One expert's sharpening never leaks into another or into generic shopping.
|
|
30
|
+
|
|
31
|
+
## Privacy + scope — per-user and local
|
|
32
|
+
|
|
33
|
+
The improvement is **per-user and local**: it is written only to this user's sil data directory (`$SIL_DATA_DIR/agents/<agentId>/`), on this machine. There is **no server-side aggregation, no shared store, no shared expert, and no cross-user signal** — the refine path calls **no server endpoint** and performs **no identity round-trip**. The expert gets sharper for this user alone; nothing is pooled or shared.
|
|
34
|
+
|
|
35
|
+
## Refining the answer→`sil_search`-param mapping
|
|
36
|
+
|
|
37
|
+
A refinement to the mapping (e.g. a taste the user volunteered but the playbook never captured) maps **only onto real `sil_search` params** — and a volunteered taste with **no matching param** folds into the `query` text or the recommendation **rubric**, **never an invented filter**. The `ship_to` rule is unchanged at refine time too: leave it empty (the server resolves the registered default) — no identity round-trip to populate it. **Do not restate the param table here** — point at [`search_param_mapping.md`](search_param_mapping.md) (the table, the worked params, and the `ship_to`-empty rule); refining the mapping uses exactly those rules.
|
|
38
|
+
|
|
39
|
+
## When there is no observed-session signal
|
|
40
|
+
|
|
41
|
+
If the user asks to refine but **no observed session** is available — a fresh session, or the prior session is out of context — do **not fabricate** session observations to propose against. Fall back to a **guided amend**: ask the user what they want to change (and apply the same confirm-before-persist gate to whatever they describe), or **invite them to shop a session first** so the next refinement has real evidence to ground proposals in. Never invent observations.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Answer→`sil_search`-param mapping (the mapping is real)
|
|
2
|
+
|
|
3
|
+
Load this while converging interview section 4 (the answer→`sil_search`-param mapping) in [`brainstorm_interview.md`](brainstorm_interview.md). The mapping must target the **real `sil_search` parameters** (the shopping loop's catalog tool, named in `SKILL.md`) and nothing else — never invent a filter.
|
|
4
|
+
|
|
5
|
+
## The parameters available to map onto
|
|
6
|
+
|
|
7
|
+
| User's stated input | `sil_search` param it maps to |
|
|
8
|
+
|---|---|
|
|
9
|
+
| A budget ("under €1500", "€800–1200") | `price_min` / `price_max` — **in the currency's ISO 4217 minor unit** (cents): €1500 → `price_max: 150000` |
|
|
10
|
+
| "Prefer secondhand" / "used is fine" | `condition: ["secondhand"]` |
|
|
11
|
+
| "New only" | `condition: ["new"]` |
|
|
12
|
+
| The narrowed niche + key descriptors | `query` (free text) and/or `category` |
|
|
13
|
+
| "In stock only" (the default) / "show me out-of-stock too" | `available` (omit for in-stock default; `false` to include unavailable) |
|
|
14
|
+
| "Buy from a local/domestic shop" | `local_merchants: true` (a best-effort ranking *bias*, not a hard filter — also issue the `query` in the user's language to actually surface local shops) |
|
|
15
|
+
|
|
16
|
+
A stated taste with **no matching param** (e.g. "I like bold colours", "prefer eco-friendly brands") does **not** become a new param — fold it into the `query` text or into the recommendation rubric. There is no `color` filter, no `brand` filter; inventing one produces an expert that emits invalid `sil_search` calls at shop time.
|
|
17
|
+
|
|
18
|
+
## `ship_to` stays EMPTY by default — inline rule (do not skip)
|
|
19
|
+
|
|
20
|
+
Do **not** map the user's location onto `ship_to`, and do **not** instruct the expert to call `sil_whoami` to populate it. When `ship_to` is absent, sil-api resolves the user's **registered default address** server-side. Set `ship_to` (a `{ country, region?, postal_code? }` object of ISO codes) **only** to OVERRIDE the default with a *different* destination than the registered address (e.g. "ship this to my office in Germany"). The expert inherits correct location-aware search by construction — leave `ship_to` out, and never round-trip `sil_whoami` to fill it.
|
|
21
|
+
|
|
22
|
+
## Worked param examples
|
|
23
|
+
|
|
24
|
+
A converged mapping translates the user's stated inputs into concrete params the expert will set at shop time. For a road-cycling expert whose user said "budget around €1200, secondhand is fine, I'm in France and want local shops":
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
query: "<niche descriptors from the answer>" # e.g. "endurance road bike 105 groupset"
|
|
28
|
+
category: "<the narrowed niche category>"
|
|
29
|
+
price_max: 120000 # €1200 → minor units (cents)
|
|
30
|
+
condition: ["secondhand"] # "secondhand is fine"
|
|
31
|
+
local_merchants: true # "want local shops" → ranking bias; issue query in French
|
|
32
|
+
# ship_to: OMITTED — server resolves the registered default address; no sil_whoami round-trip
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The stated budget became `price_max` (in cents), "secondhand is fine" became `condition`, "want local shops" became `local_merchants: true` — and `ship_to` was deliberately left out so the server resolves the registered default. A non-param taste ("I like understated colours") would fold into `query` text or the rubric, never a new filter.
|