sil-openclaw 0.3.0 → 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 CHANGED
@@ -10,6 +10,40 @@ release (`clawhub package publish --changelog`). See [README](./README.md#releas
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [0.3.1] - 2026-06-24
14
+
15
+ ### Added
16
+
17
+ - **Spec-Driven Shopping (SDS) is the operating model for created experts.** A
18
+ created shopping expert now runs **entirely** on SDS — not coarse attribute
19
+ matching, and not an optional layer. The persona left the sil store: it is the
20
+ agent's host workspace **`SOUL.md`** (identity/voice), written by the engine via
21
+ the host CLI — there is **no `persona.md`**. The sil store holds **four SDS
22
+ behaviour artefacts**: two **required at creation** — **`domain_spec.md`** (deep
23
+ *researched* niche expertise — how to buy well, the full mechanics; the agent
24
+ researches it itself from web + knowledge, and **web-refreshes it on every
25
+ query**) and **`intent_spec.md`** (the agent-specific **decomposition dimensions**,
26
+ a PRD-style schema derived from the domain) — and **`user_spec.md`** (the user's
27
+ domain-relevant facts + **hard constraints**) and **`playbook.md`** (the user's
28
+ **buying taste** — price sensitivity, brand, preferences). **All four are required
29
+ and present from creation** — seeded *partial* by the light setup, then **augmented
30
+ every query** (we keep learning), never re-asked. The per-query **intent** (the
31
+ dimensions filled in for one request) is
32
+ **ephemeral** — only the dimension *schema* is persisted. The shop-time loop
33
+ web-refreshes the domain, decomposes the request, lazily captures the user side,
34
+ and layers **intent → playbook → user_spec → domain_spec** (a user-spec **hard
35
+ constraint is inviolable** — routed to a real `sil_search` filter *and* a
36
+ reject-at-pick rubric rule, never only soft `query` text), recommending with a
37
+ "why" that visibly cites the intent + a stored user fact + a domain mechanic.
38
+ Setup stays **light (≤10 questions)** — the depth comes from the agent's own
39
+ research. All four artefacts ride the existing **`sil_profile_materialize`** store
40
+ path (`domainSpec` + `intentSpec` + `userSpec` + `playbook` all required) with
41
+ **no new tool** (the 8-tool manifest is unchanged) and the same atomic,
42
+ validate-first, per-file-all-or-nothing discipline. Refinement can target the
43
+ domain spec, the intent-spec dimensions, a user-spec fact/hard-constraint, or the
44
+ buying taste as distinct refinable elements (a persona refinement refreshes
45
+ `SOUL.md` via the host CLI).
46
+
13
47
  ## [0.3.0] - 2026-06-23
14
48
 
15
49
  ### Added
package/README.md CHANGED
@@ -6,13 +6,12 @@
6
6
  ███████║██║███████╗
7
7
  ╚══════╝╚═╝╚══════╝
8
8
 
9
- commerce, handled by your agent
9
+ Shop like you code
10
10
  ```
11
11
 
12
12
  **The shopping layer your agent runs for you.**
13
13
 
14
- *You say what you want. Your agent searches the catalog, compares, and hands you a ready-to-buy link.*
15
- *No store. No tabs. No forms.*
14
+ *Introducing Spec Driven Shopping: the way Agents should be shopping.*
16
15
 
17
16
  [![license](https://img.shields.io/badge/license-Apache--2.0-blue)](https://github.com/Context4GPTs/sil-openclaw/blob/main/LICENSE)
18
17
  [![npm](https://img.shields.io/npm/v/sil-openclaw?logo=npm&logoColor=white&color=cb3837)](https://www.npmjs.com/package/sil-openclaw)
@@ -58,7 +57,7 @@ The agent loads the bundled skill on first commerce intent and takes it from the
58
57
 
59
58
  sil is a [UCP](https://github.com/universal-commerce-protocol/ucp) (Universal Commerce Protocol) commerce service, and `sil-openclaw` wires it into your OpenClaw agent — so it can find products, compare prices and availability, pull up full detail, and surface a checkout link the moment you say *buy*. Powered by [4GPTs](https://4gpts.com).
60
59
 
61
- Today the plugin covers **identity, catalog, and dedicated shopping experts** — registration, catalog search and product lookup, plus a one-conversation flow that mints a new OpenClaw agent pre-wired to shop a single niche for you. The rest of the UCP journey (cart, checkout, order, fulfillment) lands as those domains ship, and the same plugin grows with them.
60
+ Today the plugin covers **identity, catalog, and dedicated shopping experts**. The rest of the UCP journey (cart, checkout, order, fulfillment) lands as those domains ship, and the same plugin grows with them.
62
61
 
63
62
  ---
64
63
 
@@ -96,27 +95,28 @@ agent done — here's your checkout link, ready to pay:
96
95
 
97
96
  ## Turn your OpenClaw into a shopping expert
98
97
 
99
- So far your *general* agent did the shopping. Go one step further: mint a **dedicated** OpenClaw agent that shops a single niche like a specialist — its taste, budget, and hard rules baked in once, then reused on every visit.
98
+ So far your *general* agent did the shopping. Go one step further: mint a **dedicated** OpenClaw agent that shops a single niche like a true specialist — it **researches how to buy well in that niche itself**, then fits *you* the way an expert would.
100
99
 
101
- **TL;DR** — say *"make me a shopping expert for road-cycling gear"* and the plugin **interviews you** (the niche, your taste, your budget, the rules it must never break), then creates a real OpenClaw agent wired to sil with that persona and playbook. Open it later and it already knows your niche: it asks only what's still missing, searches sil with your constraints pre-set, and ranks results your way. **Nothing is created until you say "create it"** — and building one is local and offline, no sign-in required.
100
+ **Spec-Driven Shopping (SDS).** Say *"make me a shopping expert for road-cycling gear"* and the plugin runs a **light** interview (≤10 questions) to narrow the niche and shape the persona — then **researches the niche deeply on its own** (the full how-to-buy-well: fit, gearing, geometry, the trade-offs) and derives the **dimensions** every request should be decomposed along. Open it later and on **every query** it refreshes that knowledge from the web, decomposes what you asked, and **learns your facts and taste as it goes** (your measurements, your budget, the rules it must never break) — captured once, never re-asked. It recommends with a "why" that cites *what you asked*, *a fact it remembered*, and *a niche mechanic you'd never have named*. **Nothing is created until you say "create it"** — and building one is local and offline, no sign-in required.
102
101
 
103
- **1 — One conversation builds the expert:**
102
+ **1 — One light conversation builds the expert (it does the deep research itself):**
104
103
 
105
104
  ```text
106
105
  you make me a shopping expert for road-cycling gear
107
106
 
108
- agent Love it — let's shape it together. Components and apparel,
109
- or complete bikes too?
107
+ agent Love it — let's shape it lightly. A complete bike, or
108
+ components and apparel?
110
109
 
111
- you components and apparel, I've got the frame. ~€1200 budget,
112
- secondhand is fine, and I'm in France
110
+ you a complete road bike, my first proper one
113
111
 
114
- agent Here's the expert I'll build:
112
+ agent Got it. I've researched how to buy a first road bike well —
113
+ fit (size from height AND inseam, stack/reach, saddle setback),
114
+ endurance-vs-race geometry, gearing theory, the comfort/speed
115
+ trade-offs. I'll decompose every request along use-case, terrain,
116
+ budget, your fit envelope, timeline, and priorities.
115
117
 
116
- Road-Cycling Buyer — a concise components advisor
117
- · always flags groupset compatibility · never carbon bars
118
- · searches secondhand to ~€1200, French shops first
119
- · ranks compatibility → value → weight
118
+ Road-Cycling Buyer — a patient first-bike advisor
119
+ · always explains fit · never carbon bars
120
120
 
121
121
  shall I create it?
122
122
 
@@ -126,33 +126,27 @@ agent done — "Road-Cycling Buyer" is live. Open it anytime;
126
126
  it shops your niche with no further setup.
127
127
  ```
128
128
 
129
- **2 — The expert shops like a specialist, not a clerk:**
129
+ **2 — The expert shops like a specialist, learning you as it goes:**
130
130
 
131
131
  ```text
132
- you (inside Road-Cycling Buyer) I need new wheels
132
+ you (inside Road-Cycling Buyer) find me a road bike, ~€1500
133
133
 
134
- agent what groupset are you running? — so I only show compatible builds
134
+ agent Before I search — two numbers I'll keep so I never re-ask:
135
+ your height and inseam. Any brand you won't touch?
135
136
 
136
- you Shimano 105
137
+ you 178cm, 81cm inseam. No strong feelings, secondhand is fine
137
138
 
138
- agent searched sil — secondhand, France-first, 105-compatible:
139
+ agent searched sil — endurance, 54cm for your fit, ~€1500:
139
140
 
140
- 1. Fulcrum Racing 4 (used) €420 Shimano HG ✓ · 1560 g
141
- 2. DT Swiss P1800 (used) €505 Shimano HG ✓ · 1700 g
141
+ 1. Alloy endurance bike, 54cm, 105 (used) €1420
142
+ 2. Carbon endurance bike, 54cm, 105 (used) €1610
142
143
 
143
- ranked compatibility → value → weight, the way you set it up.
144
- want detail or a checkout link on either?
144
+ Why #1: for your 178/81 fit a 54cm endurance frame sits where a
145
+ first buyer wants it — fit and comfort outrank outright speed on a
146
+ first bike — and it's inside your budget. Want detail or a link?
145
147
  ```
146
148
 
147
- > **You teach it once; it stays an expert.** List the experts you've made, look at how one is set up, retire one you're done with — or **refine** one from what it watched you reject, so it gets sharper every session.
148
-
149
- ---
150
-
151
- ## Identity & authentication
152
-
153
- **sil gives your agent an identity — and the capability to use it.** One browser sign-in links your OpenClaw agent to a sil identity it holds on your behalf — your name, your saved addresses. That identity is what lets the agent *transact*: it can search, compare, and surface checkout links with any merchant that speaks [UCP](https://github.com/universal-commerce-protocol/ucp) (the Universal Commerce Protocol), all under your account, without you ever touching a store login.
154
-
155
- Registering is the only manual step. After that the agent carries your identity for you — ask *"who am I on sil?"* anytime to see exactly what it's holding.
149
+ > **You teach it once; it stays an expert.** It keeps your facts and taste, web-refreshes its niche knowledge each visit, and never re-asks what it already knows. List the experts you've made, look at how one is set up, retire one you're done with — or **refine** one from what it watched you reject, so it gets sharper every session.
156
150
 
157
151
  ---
158
152
 
@@ -178,9 +172,9 @@ Namespaced `sil_*` so they never collide with other plugins. Your agent calls th
178
172
 
179
173
  | Tool | What it does |
180
174
  |---|---|
181
- | `sil_profile_materialize` | Persist a created expert's behaviour artefacts — `persona.md`, an optional `playbook.md` domain sub-skill, and a `profile.json` manifest — under `$SIL_DATA_DIR/agents/<id>/`. Driven by the skill's creation engine once you endorse the draft; validate-first and fail-closed, it never clobbers an existing expert. |
175
+ | `sil_profile_materialize` | Persist a created expert's SDS behaviour artefacts — `domain_spec.md` (deep researched niche expertise) + `intent_spec.md` (the decomposition-dimension schema) + `user_spec.md` (your facts + hard constraints) + `playbook.md` (your buying taste), all four required and present from creation, plus a `profile.json` manifest — under `$SIL_DATA_DIR/agents/<id>/`. (The persona is the agent's host workspace `SOUL.md`, not a sil artefact.) Driven by the skill's creation engine once you endorse the draft, and again per-query to web-refresh the domain and augment your facts/taste; validate-first and fail-closed, it never clobbers an existing expert. |
182
176
  | `sil_profile_list` | List the experts you've created, most-recently-made first. Takes no arguments. |
183
- | `sil_profile_get` | Show one expert in full — `name`, `persona`, optional `playbook`, manifest path, and `createdAt`. |
177
+ | `sil_profile_get` | Show one expert in full — `name`, its `domainSpec` + `intentSpec` + `userSpec` + `playbook` (all four present), manifest path, and `createdAt`. |
184
178
  | `sil_profile_remove` | Delete one expert's behaviour artefacts. Scoped and idempotent; the agent confirms with you before removing. |
185
179
 
186
180
  ---
@@ -190,7 +184,7 @@ Namespaced `sil_*` so they never collide with other plugins. Your agent calls th
190
184
  The plugin ships one bundled skill — **`sil`** 🛒 — that your agent loads automatically the first time you express a shopping intent. You don't invoke it; it's the playbook that makes the tools work well together:
191
185
 
192
186
  - **Routes intent to the right tool.** *"find me a keyboard"* → `sil_search`, *"look these up"* → `sil_product_get`, *"who am I?"* → `sil_whoami`, *"sign me up"* → `sil_register`, *"make me an expert for X"* → the create flow, *"list / show / remove my experts"* → the `sil_profile_*` tools.
193
- - **Interviews before it builds.** Asked for a shopping expert, it runs an open interview to shape the niche, persona, and rules *with* you — and creates nothing until you explicitly endorse the assembled draft.
187
+ - **Interviews lightly, then researches deeply.** Asked for a shopping expert, it runs a light interview (≤10 questions) to shape the niche and persona *with* you, then researches the niche itself and derives how to decompose every request — and creates nothing until you explicitly endorse the assembled draft.
194
188
  - **Recovers the right way.** Every tool reports a status; the skill follows that tool's own recovery hint — re-register, fix the query, or retry — instead of guessing a fix that won't work.
195
189
  - **Keeps prices honest.** It treats price, availability, and checkout links as point-in-time and re-checks an item right before you buy, so the link you get is the link you pay.
196
190
 
@@ -9,24 +9,49 @@
9
9
  *
10
10
  * What the plugin DOES own is the agent's *behaviour* layer, materialized into
11
11
  * its own disclosed `filesystemScope` — `$SIL_DATA_DIR` (the same directory
12
- * `lib/credentials.ts` uses for tokens/identity). Per the founder steer
13
- * (2026-06-22) the engine writes a fixed, minimal set of artefacts there that
14
- * power the created expert's behaviour, read by the sil skill at runtime:
12
+ * `lib/credentials.ts` uses for tokens/identity). The created expert runs
13
+ * entirely on Spec-Driven Shopping (SDS): the engine writes the SDS behaviour
14
+ * artefacts there, read by the sil skill at runtime:
15
15
  *
16
16
  * $SIL_DATA_DIR/agents/<agentId>/
17
- * ├─ persona.md the shopping persona/instructions (host-natural —
18
- * │ same shape as a workspace SOUL.md; the skill copies it
19
- * │ into the agent workspace SOUL.md and re-reads it at
20
- * │ session start)
21
- * ├─ playbook.md the generated domain sub-skill (host-natural — same
22
- * │ shape as a SKILL.md body; loaded by the sil skill at
23
- * │ session start). OPTIONAL — written only when supplied.
24
- * └─ profile.json the strictly-typed manifest the sil skill resolves the
25
- * artefacts from (no filesystem guessing)
17
+ * ├─ domain_spec.md the SDS DOMAIN SPEC — deep researched niche expertise:
18
+ * │ how to buy well, the full mechanics (gearing theory,
19
+ * │ frame geometry, the complete bike-fit process…).
20
+ * │ REQUIRED at creation; web-refreshed every query.
21
+ * ├─ intent_spec.md the SDS INTENT SPEC — the agent-specific decomposition
22
+ * │ DIMENSIONS (a PRD-style template) a query must resolve,
23
+ * │ derived from domain_spec. REQUIRED at creation. The
24
+ * │ per-query intent (dimensions filled in) is EPHEMERAL —
25
+ * │ never persisted.
26
+ * ├─ user_spec.md the SDS USER SPEC — the user's domain-relevant facts +
27
+ * │ hard constraints. REQUIRED at creation (seeded partial
28
+ * │ by the ≤10-question setup), AUGMENTED every query.
29
+ * ├─ playbook.md the SDS PLAYBOOK — the user's buying TASTE (price
30
+ * │ sensitivity, brand, preferences). REQUIRED at creation
31
+ * │ (seeded partial), AUGMENTED every query.
32
+ * └─ profile.json the strictly-typed manifest the sil skill resolves the
33
+ * artefacts from (no filesystem guessing)
26
34
  *
27
- * Store boundary: host config = wiring; `$SIL_DATA_DIR` = behaviour artefacts.
28
- * Identity/tokens already live in `$SIL_DATA_DIR` but stay logically separate
29
- * (no identity coupling — creating an expert reads/writes no token).
35
+ * The persona is NOT a sil artefact: the agent's identity/voice/standing rules
36
+ * are the host workspace `SOUL.md`, written directly via the host CLI by the
37
+ * engine — there is no `persona.md` in this store and no copy step. This store
38
+ * holds only the four SDS BEHAVIOUR artefacts.
39
+ *
40
+ * All FOUR slots are REQUIRED at creation (`domainSpec` + `intentSpec` +
41
+ * `userSpec` + `playbook`) — SDS is the operating model, not an optional layer,
42
+ * so a created expert without all four is a defect (Founder review round 2: all
43
+ * four sil docs are present, non-blank, from creation). They are seeded *partial*
44
+ * (the ≤10-question setup + a quick initial research pass), then lazily
45
+ * AUGMENTED / reinforced on EVERY query — domain_spec web-refreshed, intent_spec
46
+ * dimensions sharpened, user_spec facts and playbook taste reinforced. We keep
47
+ * learning. All four are refine-mutable in place. The per-query intent is NOT a
48
+ * slot here: only the intent_spec *dimension schema* is persisted; the filled
49
+ * dimensions for one request are ephemeral, derived in the conversation.
50
+ *
51
+ * Store boundary: host config + `SOUL.md` (identity/wiring) = host; the four SDS
52
+ * behaviour artefacts = `$SIL_DATA_DIR` via this plugin tool. Identity/tokens
53
+ * already live in `$SIL_DATA_DIR` but stay logically separate (no identity
54
+ * coupling — creating an expert reads/writes no token).
30
55
  *
31
56
  * Writes are atomic and all-or-nothing (Product invariant 7): a bad spec
32
57
  * writes NOTHING (validate first), and a mid-write failure leaves no partial
@@ -43,8 +68,11 @@ const DIR_MODE = 0o700;
43
68
  /** The sub-tree under `$SIL_DATA_DIR` that holds per-agent behaviour artefacts. */
44
69
  const AGENTS_SUBDIR = "agents";
45
70
  /** Artefact filenames (stable — the sil skill resolves them from profile.json,
46
- * but the names are also documented so a human can find them). */
47
- const PERSONA_FILE = "persona.md";
71
+ * but the names are also documented so a human can find them). The three SDS
72
+ * *specs* carry the `_spec.md` suffix; `playbook.md` (taste) does not. */
73
+ const DOMAIN_SPEC_FILE = "domain_spec.md";
74
+ const INTENT_SPEC_FILE = "intent_spec.md";
75
+ const USER_SPEC_FILE = "user_spec.md";
48
76
  const PLAYBOOK_FILE = "playbook.md";
49
77
  const PROFILE_FILE = "profile.json";
50
78
  /** A host-agent id must be lower-kebab and is never `main` (host-reserved). */
@@ -93,23 +121,36 @@ export function materializeProfile(spec) {
93
121
  if (!nonBlank(spec.name)) {
94
122
  return invalid("name", "name is required and must be non-empty.");
95
123
  }
96
- if (!nonBlank(spec.persona)) {
97
- return invalid("persona", "persona is required and must be non-empty.");
124
+ // All FOUR SDS specs are REQUIRED at creation — SDS is the operating model,
125
+ // not an optional layer. A created expert always carries all four (Founder
126
+ // review round 2): they are seeded *partial* at creation, then augmented every
127
+ // query. A present-but-blank or omitted spec is rejected (validate-first; write
128
+ // nothing).
129
+ if (!nonBlank(spec.domainSpec)) {
130
+ return invalid("domainSpec", "domainSpec is required and must be non-empty.");
131
+ }
132
+ if (!nonBlank(spec.intentSpec)) {
133
+ return invalid("intentSpec", "intentSpec is required and must be non-empty.");
98
134
  }
99
- // playbook is optional, but if present it must be non-blank (an empty string
100
- // would materialize a useless artefact — reject it loudly rather than write it).
101
- if (spec.playbook !== undefined && !nonBlank(spec.playbook)) {
102
- return invalid("playbook", "playbook, when provided, must be non-empty.");
135
+ if (!nonBlank(spec.userSpec)) {
136
+ return invalid("userSpec", "userSpec is required and must be non-empty.");
137
+ }
138
+ if (!nonBlank(spec.playbook)) {
139
+ return invalid("playbook", "playbook is required and must be non-empty.");
103
140
  }
104
141
  const dir = getAgentArtefactDir(spec.agentId);
105
- const personaPath = join(dir, PERSONA_FILE);
106
- const playbookPath = spec.playbook !== undefined ? join(dir, PLAYBOOK_FILE) : undefined;
142
+ const domainSpecPath = join(dir, DOMAIN_SPEC_FILE);
143
+ const intentSpecPath = join(dir, INTENT_SPEC_FILE);
144
+ const userSpecPath = join(dir, USER_SPEC_FILE);
145
+ const playbookPath = join(dir, PLAYBOOK_FILE);
107
146
  const profilePath = join(dir, PROFILE_FILE);
108
147
  const manifest = {
109
148
  agentId: spec.agentId,
110
149
  name: spec.name,
111
- personaPath,
112
- ...(playbookPath ? { playbookPath } : {}),
150
+ domainSpecPath,
151
+ intentSpecPath,
152
+ userSpecPath,
153
+ playbookPath,
113
154
  createdAt: new Date().toISOString(),
114
155
  };
115
156
  // Whether the artefact directory already existed before this call. If it did,
@@ -120,10 +161,10 @@ export function materializeProfile(spec) {
120
161
  const dirPreexisted = existsSync(dir);
121
162
  try {
122
163
  mkdirSync(dir, { recursive: true, mode: DIR_MODE });
123
- atomicWrite(personaPath, spec.persona);
124
- if (playbookPath && spec.playbook !== undefined) {
125
- atomicWrite(playbookPath, spec.playbook);
126
- }
164
+ atomicWrite(domainSpecPath, spec.domainSpec);
165
+ atomicWrite(intentSpecPath, spec.intentSpec);
166
+ atomicWrite(userSpecPath, spec.userSpec);
167
+ atomicWrite(playbookPath, spec.playbook);
127
168
  atomicWrite(profilePath, JSON.stringify(manifest, null, 2) + "\n");
128
169
  }
129
170
  catch (err) {
@@ -151,8 +192,10 @@ export function materializeProfile(spec) {
151
192
  ok: true,
152
193
  agentId: spec.agentId,
153
194
  dir,
154
- personaPath,
155
- ...(playbookPath ? { playbookPath } : {}),
195
+ domainSpecPath,
196
+ intentSpecPath,
197
+ userSpecPath,
198
+ playbookPath,
156
199
  profilePath,
157
200
  };
158
201
  }
@@ -221,7 +264,10 @@ function readManifestFile(profilePath) {
221
264
  parsed === null ||
222
265
  typeof parsed.agentId !== "string" ||
223
266
  typeof parsed.name !== "string" ||
224
- typeof parsed.personaPath !== "string" ||
267
+ typeof parsed.domainSpecPath !== "string" ||
268
+ typeof parsed.intentSpecPath !== "string" ||
269
+ typeof parsed.userSpecPath !== "string" ||
270
+ typeof parsed.playbookPath !== "string" ||
225
271
  typeof parsed.createdAt !== "string") {
226
272
  throw new Error("profile.json is missing required manifest fields");
227
273
  }
@@ -274,7 +320,6 @@ export function listAgentProfiles() {
274
320
  experts.push({
275
321
  agentId: manifest.agentId,
276
322
  name: manifest.name,
277
- hasPlaybook: manifest.playbookPath !== undefined,
278
323
  createdAt: manifest.createdAt,
279
324
  });
280
325
  }
@@ -299,13 +344,17 @@ function createdAtDesc(a, b) {
299
344
  return tb - ta;
300
345
  }
301
346
  /**
302
- * Read one expert's full detail — the manifest PLUS the persona/playbook bodies
303
- * from the files it points at — so the skill can render a complete view.
347
+ * Read one expert's full detail — the manifest PLUS the SDS artefact bodies from
348
+ * the files it points at — so the skill can render a complete view.
304
349
  *
305
350
  * Re-runs the writer's `agentId` gate BEFORE any `join`/read (a traversal-shaped
306
351
  * id → `invalid_request`, reading nothing). An unknown id, an absent/unreadable
307
- * manifest, or an absent persona body → `not_found` (a degraded expert is, from
308
- * the user's view, not viewable). Never throws across the boundary; reads only.
352
+ * manifest, or an absent body of ANY of the four REQUIRED SDS specs
353
+ * (`domain_spec.md` / `intent_spec.md` / `user_spec.md` / `playbook.md`) →
354
+ * `not_found` (Founder review round 2: all four always exist; a degraded expert
355
+ * is, from the user's view, not viewable). There is no degrade-to-undefined path
356
+ * any more — a referenced-but-missing body of any of the four fails the read
357
+ * closed. Never throws across the boundary; reads only.
309
358
  */
310
359
  export function readAgentProfile(agentId) {
311
360
  const bad = rejectBadAgentId(agentId);
@@ -326,32 +375,35 @@ export function readAgentProfile(agentId) {
326
375
  // raw parse error across the boundary.
327
376
  return notFoundRead(agentId);
328
377
  }
329
- let persona;
378
+ // All FOUR SDS spec bodies are REQUIRED for a created expert — they gate the
379
+ // read fail-closed (the role the persona body played pre-SDS). A manifest that
380
+ // points at a domain_spec.md / intent_spec.md / user_spec.md / playbook.md whose
381
+ // body is gone (a partial write, a hand-deleted file) is, to the viewer, an
382
+ // expert that cannot be loaded. This is the per-file-atomic, NOT-cross-file-
383
+ // transactional safety boundary: a partial write degrades to a fail-closed
384
+ // not_found, never a coherent-but-incomplete expert (Founder review round 2:
385
+ // all four are present from creation, so none degrades to absence).
386
+ let domainSpec;
387
+ let intentSpec;
388
+ let userSpec;
389
+ let playbook;
330
390
  try {
331
- persona = readFileSync(manifest.personaPath, "utf8");
391
+ domainSpec = readFileSync(manifest.domainSpecPath, "utf8");
392
+ intentSpec = readFileSync(manifest.intentSpecPath, "utf8");
393
+ userSpec = readFileSync(manifest.userSpecPath, "utf8");
394
+ playbook = readFileSync(manifest.playbookPath, "utf8");
332
395
  }
333
396
  catch {
334
- // Manifest present but its persona body is gone (a partial removal, or a
335
- // hand-deleted file) — the expert is not viewable.
336
397
  return notFoundRead(agentId);
337
398
  }
338
- let playbook;
339
- if (manifest.playbookPath !== undefined) {
340
- try {
341
- playbook = readFileSync(manifest.playbookPath, "utf8");
342
- }
343
- catch {
344
- // The playbook is optional detail; its absence does not make the expert
345
- // unviewable. Render the rest without it.
346
- playbook = undefined;
347
- }
348
- }
349
399
  return {
350
400
  ok: true,
351
401
  agentId: manifest.agentId,
352
402
  name: manifest.name,
353
- persona,
354
- ...(playbook !== undefined ? { playbook } : {}),
403
+ domainSpec,
404
+ intentSpec,
405
+ userSpec,
406
+ playbook,
355
407
  profilePath,
356
408
  createdAt: manifest.createdAt,
357
409
  };