@wowok/skills 1.2.3 → 1.2.5

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.
Files changed (53) hide show
  1. package/README.md +34 -16
  2. package/dist/cli.js +6 -2
  3. package/dist/cli.js.map +1 -1
  4. package/dist/skills.d.ts +32 -1
  5. package/dist/skills.d.ts.map +1 -1
  6. package/dist/skills.js +63 -0
  7. package/dist/skills.js.map +1 -1
  8. package/dist/types.d.ts +8 -0
  9. package/dist/types.d.ts.map +1 -1
  10. package/examples/Insurance/Insurance.md +543 -475
  11. package/examples/MyShop/MyShop.md +865 -746
  12. package/examples/MyShop_Advanced/MyShop_Advanced.md +1520 -1376
  13. package/examples/ThreeBody_Signature/ThreeBody_Signature.md +891 -651
  14. package/examples/Travel/Travel.md +952 -848
  15. package/package.json +2 -2
  16. package/scripts/install.js +3 -17
  17. package/wowok-arbitrator/SKILL.md +18 -57
  18. package/wowok-auditor/SKILL.md +16 -12
  19. package/wowok-distill/SKILL.md +237 -0
  20. package/wowok-guard/SKILL.md +40 -354
  21. package/wowok-machine/SKILL.md +21 -127
  22. package/wowok-messenger/SKILL.md +14 -59
  23. package/wowok-onboard/SKILL.md +42 -12
  24. package/wowok-order/SKILL.md +20 -169
  25. package/wowok-output/SKILL.md +0 -10
  26. package/wowok-planner/SKILL.md +28 -9
  27. package/wowok-provider/SKILL.md +91 -49
  28. package/wowok-safety/SKILL.md +8 -80
  29. package/wowok-scenario/SKILL.md +63 -98
  30. package/wowok-tools/SKILL.md +111 -122
  31. package/references/glossary.ts +0 -297
  32. package/references/guard-scenario-ledger.md +0 -353
  33. package/references/guard-template-library.md +0 -481
  34. package/references/machine-design-reference.md +0 -398
  35. package/references/machine-scenario-ledger.md +0 -227
  36. package/references/machine-template-library.md +0 -522
  37. package/references/merchant-scenario-coordination.md +0 -383
  38. package/references/object-collaboration.md +0 -362
  39. package/references/onchain-constants.md +0 -81
  40. package/wowok-arbitrator/APPENDIX.md +0 -545
  41. package/wowok-auditor/APPENDIX.md +0 -487
  42. package/wowok-guard/APPENDIX.md +0 -428
  43. package/wowok-machine/APPENDIX.md +0 -407
  44. package/wowok-messenger/APPENDIX.md +0 -550
  45. package/wowok-onboard/APPENDIX.md +0 -500
  46. package/wowok-order/APPENDIX.md +0 -777
  47. package/wowok-output/APPENDIX.md +0 -575
  48. package/wowok-planner/APPENDIX.md +0 -724
  49. package/wowok-provider/APPENDIX.md +0 -453
  50. package/wowok-safety/APPENDIX.md +0 -561
  51. package/wowok-scenario/APPENDIX.md +0 -97
  52. package/wowok-scenario/MODE-DETAILS.md +0 -275
  53. package/wowok-tools/APPENDIX.md +0 -388
@@ -48,7 +48,7 @@ Allocation evaluates when Progress reaches **any** configured node (not just exi
48
48
 
49
49
  ### E1 — Service Basic Status
50
50
 
51
- Query `query_toolkit` → `onchain_objects` for `<service_name_or_id>`. Fields in schema. Save: `bPublished`, `bPaused`, `sales`, `machine`, `buy_guard`, `customer_required`, `arbitrations`, `compensation_fund`, `compensation_lock_duration`, `order_allocators`, `um`.
51
+ Query `query_toolkit` → `onchain_objects` for `<service_name_or_id>`. Save: `bPublished`, `bPaused`, `sales`, `machine`, `buy_guard`, `customer_required`, `arbitrations`, `compensation_fund`, `compensation_lock_duration`, `order_allocators`, `um`.
52
52
 
53
53
  - `bPublished === false` → 🔴 **ABORT**
54
54
  - `bPaused === true` → 🔴 **ABORT**
@@ -130,7 +130,7 @@ Guard structure and instruction reference: [wowok-guard](../wowok-guard/SKILL.md
130
130
 
131
131
  ### E5 — Fund Allocation Rules
132
132
 
133
- From E1 `order_allocators.allocators[]`. Fields in schema. For each Allocator: cross-reference Guard (E4) → trigger condition; map to Machine node (E3) → when it fires; present distribution outcome.
133
+ From E1 `order_allocators.allocators[]`. For each Allocator: cross-reference Guard (E4) → trigger condition; map to Machine node (E3) → when it fires; present distribution outcome.
134
134
 
135
135
  **Risk Rules**:
136
136
 
@@ -147,7 +147,7 @@ From E1 `order_allocators.allocators[]`. Fields in schema. For each Allocator: c
147
147
 
148
148
  ### E6 — Arbitration Availability
149
149
 
150
- Batch query E1 `arbitrations[]` via `onchain_objects`. Fields in schema. Arb process: [wowok-arbitrator](../wowok-arbitrator/SKILL.md).
150
+ Batch query E1 `arbitrations[]` via `onchain_objects`. Arb process: [wowok-arbitrator](../wowok-arbitrator/SKILL.md).
151
151
 
152
152
  Also: `onchain_events` → `type: "ArbEvent"`, `limit: 20`, filter for these Arb IDs.
153
153
 
@@ -159,7 +159,7 @@ Also: `onchain_events` → `type: "ArbEvent"`, `limit: 20`, filter for these Arb
159
159
 
160
160
  ### E7 — Compensation Fund
161
161
 
162
- From E1: `compensation_fund`, `compensation_lock_duration`. Balance type in schema.
162
+ From E1: `compensation_fund`, `compensation_lock_duration`.
163
163
 
164
164
  - Balance < planned order amount → ⚠️ may not cover award
165
165
  - Lock near expiry → ⚠️ provider may withdraw
@@ -168,7 +168,7 @@ From E1: `compensation_fund`, `compensation_lock_duration`. Balance type in sche
168
168
 
169
169
  ### E8 — Contact Channel
170
170
 
171
- Query `onchain_objects` for E1 `um` ID. Contact fields in schema.
171
+ Query `onchain_objects` for E1 `um` ID.
172
172
 
173
173
  - `um === null` → 🔴 **ABORT**
174
174
  - `ims[]` empty → 🔴 **No Messenger**
@@ -178,7 +178,7 @@ Query `onchain_objects` for E1 `um` ID. Contact fields in schema.
178
178
 
179
179
  ### E9 — Chain Reputation
180
180
 
181
- **Sentiment**: `query_toolkit` → `onchain_table_item_entity_linker` for provider address. Compute likes/dislikes ratio from `votes[]` (fields in schema).
181
+ **Sentiment**: `query_toolkit` → `onchain_table_item_entity_linker` for provider address. Compute likes/dislikes ratio from `votes[]`.
182
182
 
183
183
  **Orders**: Batch query `votes[].address` via `onchain_objects` (50/batch, max 200). Filter Order-type objects where `service` matches. Aggregate dispute rate (`dispute ≠ []` / total) and repeat buyer ratio.
184
184
 
@@ -198,28 +198,9 @@ For matched: present value, ask "correct?" and "OK to send?". For missing: ask u
198
198
 
199
199
  ### Pre-Purchase GATE
200
200
 
201
- ```
202
- ┌──────────────────────────────────────────────────────┐
203
- │ PRE-PURCHASE GATE │
204
- ├──────────┬───────────────────────────────────────────┤
205
- │ E1 │ Service Status [ ] OK [ ] ⚠️ │
206
- │ E2 │ Product & WIP [ ] OK [ ] ⚠️ │
207
- │ E3 │ Machine Workflow [ ] OK [ ] ⚠️ │
208
- │ E4 │ Guards Logic [ ] OK [ ] 🔴 │
209
- │ E5 │ Fund Allocation [ ] OK [ ] ⚠️ │
210
- │ E6 │ Arbitration [ ] OK [ ] ⚠️ │
211
- │ E7 │ Compensation Fund [ ] OK [ ] ⚠️ │
212
- │ E8 │ Contact Channel [ ] OK [ ] ⚠️ │
213
- │ E9 │ Chain Reputation [ ] OK [ ] ⚠️ │
214
- │ E10 │ Privacy Info Match [ ] OK [ ] ⚠️ │
215
- ├──────────┴───────────────────────────────────────────┤
216
- │ ⛔ E1 bPublished=false / E8 um=null → ABORT │
217
- │ ⛔ E3 no-refund + E6 no-arb → strongly advise ABORT │
218
- │ ⛔ E4 ambiguous Guards → user MUST manually review │
219
- │ ⛔ Any ⚠️ → explain risk, wait for user decision │
220
- │ ✅ All OK → Phase 2 │
221
- └──────────────────────────────────────────────────────┘
222
- ```
201
+ **Abort conditions**: E1 `bPublished=false`/`bPaused=true` → ABORT; E8 `um=null` → ABORT; E3 no-refund + E6 no-arb → strongly advise ABORT; E4 ambiguous Guards → user MUST manually review.
202
+
203
+ **Any ⚠️** → explain risk, wait for user decision. **All OK** → Phase 2.
223
204
 
224
205
  ---
225
206
 
@@ -245,8 +226,6 @@ Clarify via Messenger: deliverables (E2 WIP), timeline (E3 nodes), refund/cancel
245
226
 
246
227
  ## Phase 3: Order Creation
247
228
 
248
- Schema: `schema_query({ action: "get", name: "onchain_operations_service" })`. Safety: [wowok-safety](../wowok-safety/SKILL.md).
249
-
250
229
  **Not in schema**:
251
230
  - Excess `buy.total_pay` auto-refunded. Agents cannot withdraw.
252
231
  - Discounts: query `onchain_received` (type `0x2::service::Discount`), filter by `service`, validate time/benchmark. Rate: `total_pay × (off / 10000)`. Fixed: `min(off, total_pay)`.
@@ -257,8 +236,6 @@ Post-creation: notify via Messenger with order ID.
257
236
 
258
237
  ## Phase 4: Order Operations
259
238
 
260
- Schema: `schema_query({ action: "get", name: "onchain_operations_order" })`.
261
-
262
239
  ### Progress Advancement
263
240
 
264
241
  When user reaches a node, AI MUST cross-reference Phase 1:
@@ -277,7 +254,7 @@ Present all three dimensions. Never just the operation name.
277
254
 
278
255
  ## Phase 5: Arbitration
279
256
 
280
- Schema: `schema_query({ action: "get", name: "onchain_operations_arbitration" })`. Process: [wowok-arbitrator](../wowok-arbitrator/SKILL.md).
257
+ Process: [wowok-arbitrator](../wowok-arbitrator/SKILL.md).
281
258
 
282
259
  Flow: `arbitration.dispute` → WTS evidence → Messenger → `order.arb_confirm` → voting → (`order.arb_objection`) → `order.arb_claim_compensation`.
283
260
 
@@ -287,145 +264,30 @@ Flow: `arbitration.dispute` → WTS evidence → Messenger → `order.arb_confir
287
264
 
288
265
  ## Fund Management
289
266
 
290
- Schema: `onchain_operations_order`. Builder-only operations: `order.transfer_to` (ownership), `order.receive` (withdraw — agents can execute, only builder receives).
267
+ Builder-only operations: `order.transfer_to` (ownership), `order.receive` (withdraw — agents can execute, only builder receives).
291
268
 
292
269
  ---
293
270
 
294
- ## Phase 3: Customer Intelligence (Optional Enhancement)
295
-
296
- > **When to use**: When `customer_intelligence` runtime service is enabled (default ON), the MCP server automatically populates `semantic.customer_advice` in order/query operations. This is a layer ON TOP of E1-E10 — never a replacement for due diligence.
297
-
298
- ### Information Puzzle (6 dimensions)
299
-
300
- E1-E10 captures static facts. The information puzzle assembles them into a dynamic, evolving picture that gets richer with every query:
301
-
302
- | Dimension | Source | Fragments |
303
- |-----------|--------|-----------|
304
- | Service basics | E1 query | publish/pause/price/sales/WIP |
305
- | Workflow structure | E3 machineNode2file | nodes/forwards/user-operable/refund path |
306
- | Fund safety | E5 + E7 | allocators/compensation/price anomaly |
307
- | Trust signals | E6 + E9 | arbitration/reviews/dispute rate |
308
- | Merchant behavior | onchain_events | completion rate/trend/refund rate |
309
- | Market context | batch query_toolkit | similar services/price distribution |
310
-
311
- **Incremental collection**: Don't fetch all 6 every time. Browse = dim 1+6, Evaluate = +2/3/4, Preorder = +5, Monitoring = 2+5.
312
-
313
- ### Risk Scoring (4 dimensions, 100 points)
314
-
315
- E1-E10 produces ⚠️/🔴 flags. Risk scoring converts them to a quantitative score:
316
-
317
- | Dimension | Max | Key checks |
318
- |-----------|-----|------------|
319
- | Workflow | 35 | refund path / arbitration path / user-operable / dead ends |
320
- | Fund | 25 | compensation coverage / allocator fairness / price anomaly / lock duration |
321
- | Trust | 20 | arbitration independence / dispute rate / reputation / trust score |
322
- | Behavior | 20 | completion trend / response time / refund rate / arb loss rate / anomalies |
323
-
324
- **Levels**: 🟢 ≥85 low | 🟡 70-84 medium-low | 🟠 50-69 medium-high | 🔴 <50 high (advise against)
325
-
326
- ### User Preference Matching (7 dimensions, 100 points)
327
-
328
- When the user has 3+ historical orders, the system infers preferences and scores each Service:
329
-
330
- | Dimension | Max | What it measures |
331
- |-----------|-----|------------------|
332
- | Price | 25 | budget fit or market avg comparison |
333
- | Time | 15 | cycle ≤ max_acceptable_cycle |
334
- | Region | 10 | preferred_region match |
335
- | Brand | 10 | min_order_history + merchant age |
336
- | Bargain | 15 | reward/discount presence |
337
- | Emotion | 10 | after_sales_expectation + transparency |
338
- | Risk | 15 | risk_score ≥ min_trust_score + arb/comp requirements |
339
-
340
- **Score ≥ 75** = strong match. **< 50** = significant mismatch. The `matches`/`mismatches` arrays explain the score so you can present tradeoffs to the user.
341
-
342
- ### Reminder System (6 stages, 4 priorities)
343
-
344
- Reminders are populated in `semantic.customer_advice.reminders` based on the operation stage:
271
+ ## Phase 3: Customer Intelligence (MCP-Handled)
345
272
 
346
- | Stage | When | Example reminders |
347
- |-------|------|-------------------|
348
- | browse | query_toolkit on Service | reviews summary / price anomaly / no arb / no comp |
349
- | evaluate | deeper analysis | checklist / high risk (required) / ambiguous guard (required) / no refund path |
350
- | preorder | order creation | payment confirm (required) / compensation insufficient / arb missing (required) |
351
- | in_progress | order monitoring | progress stalled / compensation drop / messenger unanswered |
352
- | complete | order done | review reminder / review window |
353
- | after_sale | post-purchase | arb window / refund received |
273
+ > **MCP auto-populates `semantic.customer_advice`** in order/query responses when `customer_intelligence` is ON (default). Read these fields from MCP output — do NOT recompute internally.
354
274
 
355
- **Priority order**: `required` (blocks purchase) > `recommended` (strong caution) > `info` (advisory) > `reminder` (timed nudge). Fatigue control: max 3 high-risk reminders per response.
356
-
357
- ### Game Strategy Quick Reference (8 scenarios)
358
-
359
- When the user faces a specific negotiation, refer to the strategy matrix:
360
-
361
- | Scenario | Merchant tactic | User strategy |
362
- |----------|------------------|---------------|
363
- | Info asymmetry | Hides Machine details | Demand machineNode2file export + Messenger Q&A |
364
- | Fund safety | No/low compensation | Require 100% coverage + WTS agreement |
365
- | Refund dispute | No refund path | Demand 100%→Order Allocator + Messenger terms |
366
- | Arb fairness | Self-built arbitration | Verify arb owner via query_toolkit |
367
- | Pricing | Price >120% market avg | Reference market_context.avg_price + request discount/Reward |
368
- | Delivery SLA | No milestone nodes | Require milestone config + written timeline |
369
- | Quality | WIP hash unverified | Require WIP verify + sample/staged delivery |
370
- | After-sales | No Messenger | Require Messenger config + written after-sales terms |
275
+ **Key fields in `semantic.customer_advice`**:
276
+ - `reminders[]`: stage-aware reminders with priority (`required` blocks purchase; `recommended` = strong caution; `info` = advisory; `reminder` = timed nudge)
277
+ - `risk_score`: 0-100 (🟢≥85 low | 🟡70-84 | 🟠50-69 | 🔴<50 high — advise against purchase)
278
+ - `preference_match`: 0-100 score with `matches`/`mismatches` arrays (≥75 strong match, <50 significant mismatch)
371
279
 
372
280
  **Red lines** (do not purchase): no arb + no refund path, OR compensation_ratio < 0.5.
373
281
 
374
- ### Industry Personalization (6 industries)
375
-
376
- Each industry has specific risk checks and preference templates:
377
-
378
- | Industry | Cycle (days) | Response (h) | Arb | Comp | Risk appetite | Delivery |
379
- |----------|--------------|--------------|-----|------|---------------|----------|
380
- | freelance | 30 | 4 | ✓ | ✓ | balanced | normal |
381
- | rental | 7 | 8 | ✓ | ✓ | conservative | normal |
382
- | education | 90 | 24 | ✓ | ✓ | conservative | flexible |
383
- | travel | 14 | 2 | ✓ | ✓ | conservative | urgent |
384
- | subscription | 30 | 24 | – | – | aggressive | normal |
385
- | retail | 7 | 8 | ✓ | ✓ | balanced | normal |
386
-
387
- **Industry-specific risks**: freelance checks WIP verified + milestone nodes; rental checks compensation coverage + lock duration; travel checks urgent delivery + Messenger; subscription checks no-lockin + user-operable; etc.
388
-
389
- ### Post-Purchase Support (4 phases)
390
-
391
- When the order is in progress or completed, post-purchase support covers:
392
-
393
- - **Refund tracking**: monitor refund Allocator triggers, check refunded vs order amount
394
- - **Quality issue**: WIP hash mismatch detection + evidence collection (≥3 items recommended)
395
- - **Merchant unreachable**: >3 days warning, >7 days arbitration advice (if available)
396
- - **Arbitration support**: evidence collection → application template → progress monitoring → result interpretation
282
+ **Post-purchase**: monitor refund Allocator triggers, WIP hash mismatch, merchant unreachable (>3d warning, >7d arb advice), evidence collection (≥3 items).
397
283
 
398
- ### Runtime Service Toggles
399
-
400
- Use `config_operation` to toggle Phase 3 services at runtime:
401
-
402
- | Service | Default | What it controls |
403
- |---------|---------|------------------|
404
- | `customer_intelligence` | ON | Populates `semantic.customer_advice` (reminders + risk + preference match) |
405
- | `order_monitor` | OFF | Active order monitoring (Progress stall + compensation change + Messenger timeout) |
406
-
407
- Toggle example: `config_operation` → `action: "toggle"`, `service: "order_monitor"` to enable active monitoring when the user has active orders.
284
+ **Runtime toggle**: `config_operation` → `action: "toggle"`, `service: "order_monitor"` (default OFF) to enable active Progress stall + compensation change + Messenger timeout monitoring.
408
285
 
409
286
  ---
410
287
 
411
- ## Quick Reference
412
-
413
- Schemas: `schema_query({ action: "get", name: "<name>" })` for `onchain_operations_service`, `onchain_operations_order`, `onchain_operations_arbitration`, `messenger_operation`, `query_toolkit`, `onchain_table_data`, `wip_file`.
414
-
415
288
  ### Phase Dependency
416
289
 
417
- ```
418
- E1 (Service) ──→ E2 (Products/WIP)
419
- │ │
420
- │ ├──→ E8 (Contact) ├──→ E7 (Compensation)
421
- │ ├──→ E10 (Privacy) └──→ E6 (Arbitrations)
422
-
423
- └──→ E3 (Machine) ──→ E4 (Guards) ──→ E5 (Allocators)
424
-
425
- └──→ E9 (Reputation)
426
- ```
427
-
428
- > E3→E4→E5 is a strict chain. E6-E10 run in parallel after E1.
290
+ E1 (Service) → E2 (Products/WIP), E8 (Contact), E10 (Privacy), E7 (Compensation), E6 (Arbitrations) run in parallel after E1. E3 (Machine) → E4 (Guards) → E5 (Allocators) is a strict chain. E9 (Reputation) follows E3.
429
291
 
430
292
  ### ⚠️ Critical Attention Items
431
293
 
@@ -437,14 +299,3 @@ E1 (Service) ──→ E2 (Products/WIP)
437
299
  6. **Phase 3 customer_advice** — when `customer_intelligence` is ON, read `semantic.customer_advice` first in every order/query response. The `reminders` array is pre-sorted by priority; `required` items block purchase.
438
300
 
439
301
  ---
440
-
441
- ## Appendices (Progressive Disclosure)
442
-
443
- > The following sections have been extracted to [APPENDIX.md](./APPENDIX.md) for on-demand loading:
444
- > - Dialogue Scripts (R1-R10) — guided conversation scripts
445
- > - Decision Trees — branching logic reference
446
- > - Failure Playbooks — recovery scenarios
447
- > - Tier Layering — expertise-tier based guidance
448
- > - Phase 3 Integration — information puzzle + risk scoring + preference matching + game strategy + post-purchase playbook
449
- >
450
- > Load APPENDIX.md when the user needs guided dialogue, recovery help, or tier-specific guidance.
@@ -146,13 +146,3 @@ When user asks about field meanings:
146
146
  | [wowok-messenger](../wowok-messenger/SKILL.md) | Encrypted communication |
147
147
 
148
148
  ---
149
-
150
- ## Appendices (Progressive Disclosure)
151
-
152
- > The following sections have been extracted to [APPENDIX.md](./APPENDIX.md) for on-demand loading:
153
- > - Dialogue Scripts (R1-R10) — guided conversation scripts
154
- > - Decision Trees — branching logic reference
155
- > - Failure Playbooks — recovery scenarios
156
- > - Tier Layering — expertise-tier based guidance
157
- >
158
- > Load APPENDIX.md when the user needs guided dialogue, recovery help, or tier-specific guidance.
@@ -62,12 +62,31 @@ A confirmed ODG JSON document (see §ODG Data Structure) with: scenario tag, com
62
62
 
63
63
  ---
64
64
 
65
- ## Appendices (Progressive Disclosure)
66
-
67
- > The following sections have been extracted to [APPENDIX.md](./APPENDIX.md) for on-demand loading:
68
- > - Dialogue Scripts (R1-R10) — guided conversation scripts
69
- > - Decision Trees — branching logic reference
70
- > - Failure Playbooks — recovery scenarios
71
- > - Tier Layering — expertise-tier based guidance
72
- >
73
- > Load APPENDIX.md when the user needs guided dialogue, recovery help, or tier-specific guidance.
65
+ ## ODG Data Structure
66
+
67
+ The ODG (Object Dependency Graph) is the single output artifact, persisted via `local_info_operation` and consumed by the Harness:
68
+
69
+ ```json
70
+ {
71
+ "task_id": "task_20260714_001",
72
+ "scenario": "freelance",
73
+ "version": 1,
74
+ "status": "confirmed",
75
+ "account": "merchant_v1",
76
+ "objects": [
77
+ { "id": "obj_permission", "type": "permission", "status": "planned", "reversible": true, "dependencies": [], "user_decisions": { "reuse": false, "indexes": { "provider": 1000, "arbiter": 1500 } } },
78
+ { "id": "obj_service", "type": "service", "status": "planned", "reversible": true, "dependencies": ["obj_permission"], "user_decisions": { "name": "...", "publish": "deferred" } },
79
+ { "id": "obj_machine", "type": "machine", "status": "planned", "reversible": false, "dependencies": ["obj_permission"], "user_decisions": { "nodes": [...], "forwards": [...], "publish": "deferred" } }
80
+ ],
81
+ "phases": [
82
+ { "phase": 1, "objects": ["obj_permission"], "gate": "user_confirm" },
83
+ { "phase": 2, "objects": ["obj_service", "obj_machine"], "gate": "risk_check" },
84
+ { "phase": 3, "objects": ["obj_guard_*"], "gate": "passport_test" },
85
+ { "phase": 4, "objects": ["obj_allocator_*"], "gate": "allocation_audit" },
86
+ { "phase": 5, "objects": ["publish"], "gate": "final_audit" }
87
+ ],
88
+ "risk_assessment": { "critical": [], "warnings": [], "irreversible_count": 1 }
89
+ }
90
+ ```
91
+
92
+ Each object has: `id`, `type`, `status` (planned/created/published), `reversible` (true/false), `dependencies` (other object IDs), `user_decisions` (typed fields). Phases gate progression — `risk_check` calls `aggregate_risks`, `final_audit` calls `generate_deployment_doc` + `trace_substeps`.
@@ -22,7 +22,23 @@ when_to_use:
22
22
  # WoWok Service Provider Guide
23
23
 
24
24
  > **Role**: Service Provider (Merchant/Seller)
25
- > **Related Skills**: [wowok-order](../wowok-order/SKILL.md) (customer), [wowok-machine](../wowok-machine/SKILL.md) (workflow), [wowok-guard](../wowok-guard/SKILL.md) (validation rules), [wowok-messenger](../wowok-messenger/SKILL.md) (communication), [wowok-safety](../wowok-safety/SKILL.md) (safety), [wowok-tools](../wowok-tools/SKILL.md) (MCP tools)
25
+ > **Related Skills**: [wowok-order](../wowok-order/SKILL.md) (customer), [wowok-machine](../wowok-machine/SKILL.md) (workflow), [wowok-messenger](../wowok-messenger/SKILL.md) (communication), [wowok-distill](../wowok-distill/SKILL.md) (distillation review)
26
+
27
+ ---
28
+
29
+ ## MCP Knowledge Layer
30
+
31
+ The following rule tables have been pushed down to the MCP knowledge layer and are automatically applied during project operations. You do NOT need to manually check these — the MCP server enforces them.
32
+
33
+ | Rule Category | MCP Knowledge Module | Applied By |
34
+ |---------------|---------------------|------------|
35
+ | Safety rules (confirmation, immutability, object reuse) | `knowledge/safety-rules.ts` | `aggregate_risks` + `onchain_operations` pre-publish |
36
+ | Guard design patterns | `knowledge/guard-design-patterns.ts` | `aggregate_risks` (guard risk assessment) |
37
+ | Machine topology rules | `knowledge/machine-risk.ts` | `aggregate_risks` (machine risk assessment) |
38
+ | Scenario mode defaults | `knowledge/scenario-modes.ts` | `analyze_intent` (pass `industry` parameter) |
39
+ | Tool reference (gas, faucet, wrappers) | `knowledge/tools-reference.ts` | All tool calls automatically |
40
+
41
+ **How to use**: Call `project_operation` with `action: "aggregate_risks"` after completing your puzzle — the MCP server will automatically apply all relevant safety rules and return risk findings.
26
42
 
27
43
  ---
28
44
 
@@ -91,45 +107,47 @@ STEP 0: Present checklist R1-R7 to user
91
107
  Once R1-R7 confirmed, execute in strict order. All operations use R1 (Account) as `env.account`.
92
108
 
93
109
  ```
110
+ All Tool: references below are sub-tools invoked via wowok({ tool: "<name>", data: { operation_type: "<type>", ... } })
111
+
94
112
  STEP 1: Foundation
95
113
  ├── Permission — REUSE existing (strongly recommended)
96
- │ Tool: onchain_operations (permission) | Fields: name, type_parameter
114
+ │ Tool: "onchain_operations" (permission) | Fields: name, type_parameter
97
115
  ├── Service (unpublished) — CREATE new
98
- │ Tool: onchain_operations (service) | Fields: name, type_parameter, permission
116
+ │ Tool: "onchain_operations" (service) | Fields: name, type_parameter, permission
99
117
  └── Machine (unpublished) — CREATE new or REUSE template
100
- Tool: onchain_operations (machine) | Fields: nodes, pairs, forwards
101
- Discovery: query_toolkit (account_list, local_mark_list, onchain_objects)
102
- Template: machineNode2file (export existing for editing)
118
+ Tool: "onchain_operations" (machine) | Fields: nodes, pairs, forwards
119
+ Discovery: "query_toolkit" (account_list, local_mark_list, onchain_objects)
120
+ Template: "machineNode2file" (export existing for editing)
103
121
 
104
122
  STEP 2: Trust Layer
105
123
  └── Guards — CREATE new or REUSE existing
106
- Tool: onchain_operations (guard) | Fields: logic, instructions
107
- Template: guard2file (export existing for editing)
124
+ Tool: "onchain_operations" (guard) | Fields: logic, instructions
125
+ Template: "guard2file" (export existing for editing)
108
126
  ⚠️ Design your Guard tables based on how the target object reads data:
109
127
  - buy_guard → pass/fail only, no data extraction
110
128
  - Allocator guard → pass/fail only
111
129
  - Machine forward guard → if retained_submission is used, ensure b_submission:true entries match expected types
112
130
  - Reward guard → pass/fail only
113
- Full design reference: [wowok-guard](../wowok-guard/SKILL.md)
131
+ Guard design patterns: MCP `knowledge/guard-design-patterns.ts` (auto-applied via `aggregate_risks`)
114
132
 
115
133
  STEP 3: Business Logic (MODIFY)
116
134
  ├── Machine — bind Guards to forwards
117
- │ Tool: onchain_operations (machine)
135
+ │ Tool: "onchain_operations" (machine)
118
136
  ├── Service — set Allocators
119
- │ Tool: onchain_operations (service) | Fields: order_allocators
137
+ │ Tool: "onchain_operations" (service) | Fields: order_allocators
120
138
  ├── Arbitrations (optional) — REUSE existing Arb services
121
- │ Tool: onchain_operations (service) | Fields: arbitrations.list
139
+ │ Tool: "onchain_operations" (service) | Fields: arbitrations.list
122
140
  ├── Compensation Fund (optional): compensation_fund_add + setting_locked_time_add (default 30 days, configurable)
123
- │ Tool: onchain_operations (service)
141
+ │ Tool: "onchain_operations" (service)
124
142
  └── Reward (optional) — incentive pools
125
143
 
126
144
  STEP 4: Publication
127
145
  ├── Publish Machine → IMMUTABLE
128
- │ Tool: onchain_operations (machine) | publish: true
146
+ │ Tool: "onchain_operations" (machine) | publish: true
129
147
  ├── Bind Machine to Service
130
- │ Tool: onchain_operations (service) | machine: "<machine_id>"
148
+ │ Tool: "onchain_operations" (service) | machine: "<machine_id>"
131
149
  └── Publish Service → machine/allocators LOCKED
132
- Tool: onchain_operations (service) | publish: true
150
+ Tool: "onchain_operations" (service) | publish: true
133
151
 
134
152
  ⚠️ Pre-Publish Verification:
135
153
  1. Re-check PRE-FLIGHT: all R1-R7 still confirmed?
@@ -163,8 +181,7 @@ STEP 5: Post-Publish (MODIFY Service — mutable after publish)
163
181
 
164
182
  ### Service Object Relationships
165
183
 
166
- > **Authoritative source**: [Object Collaboration Diagram](../references/object-collaboration.md) §1 (22-object collaboration DAG, 83 relationships).
167
- > This tree is a simplified view. Cross-reference the above for the full graph and [Object Boundary Conditions](../references/object-collaboration.md#boundary-conditions) for mutability rules.
184
+ > **Boundary conditions**: Use MCP `project_operation` with action `get_reversibility` to query the full 22-object lifecycle reversibility matrix (mutability, prerequisites, capacity limits, irreversibility). Key rules: Service/Machine are IMMUTABLE after publish; Payment is FROZEN at creation; Order/Progress/Arbitration operations are irreversible.
168
185
 
169
186
  ```
170
187
  Service (merchant storefront)
@@ -187,10 +204,10 @@ Order (per purchase, runtime-created)
187
204
  ├── arbitration → Arbitration (optional, immutable once set)
188
205
  └── allocation → Fund distribution engine (triggered via Progress.forward)
189
206
 
190
- Cross-object references (see [Object Collaboration Diagram §6](../references/object-collaboration.md#guard-and-machine-global-usage) for Guard/Machine global usage):
207
+ Cross-object references:
191
208
  - Guard is referenced by 9 object types (Service.buy_guard, Machine.forward.guard, Allocation.allocation_guard, Arbitration.voting_guard, Reward.claim_guard, Repository.write_guard, Treasury.external_guard, Demand.recommend_guard, Passport.guard)
192
209
  - Machine is referenced by 4 object types (Service.machine, Order.machine, Progress.machine, Order snapshot)
193
- - Permission is the central hub — 11 objects hold BuiltinPermissionIndex (see [Object Collaboration Diagram §5](../references/object-collaboration.md#permission-reverse-reference-table) for reverse-reference table)
210
+ - Permission is the central hub — 11 objects hold BuiltinPermissionIndex
194
211
  ```
195
212
 
196
213
  ### Allocators + Machine Integration
@@ -233,7 +250,7 @@ Each `sharing[].who` field determines where funds go. Choose the correct type ba
233
250
  After the Progress reaches a terminal state, the fund allocation is NOT automatic — it must be triggered explicitly. **Anyone can call this operation**; the caller does not need to be the merchant or customer. The Guard verification determines which allocator's rules apply.
234
251
 
235
252
  ```
236
- Tool: onchain_operations (allocation)
253
+ Tool: wowok({ tool: "onchain_operations", data: { operation_type: "allocation", ... } })
237
254
  Operation: alloc_by_guard
238
255
  Required submission: Order ID (matching the Guard's b_submission identifier)
239
256
  ```
@@ -249,8 +266,8 @@ Required submission: Order ID (matching the Guard's b_submission identifier)
249
266
  Immutable product commitment for arbitration evidence.
250
267
 
251
268
  ```
252
- Create: wip_file generate → markdown_text + images → outputPath
253
- Attach: onchain_operations (service) → sales.sales[{
269
+ Create: wowok({ tool: "wip_file", data: { op: "generate", ... } }) → markdown_text + images → outputPath
270
+ Attach: wowok({ tool: "onchain_operations", data: { operation_type: "service", ... } }) → sales.sales[{
254
271
  name, price, stock, wip: "<URL>", wip_hash: "" (auto)
255
272
  }]
256
273
  ```
@@ -262,41 +279,66 @@ Attach: onchain_operations (service) → sales.sales[{
262
279
 
263
280
  ---
264
281
 
265
- ## Order Fulfillment
282
+ ## Project Iteration: Fork vs In-Place
266
283
 
267
- | Object | Purpose | Operation |
268
- |--------|---------|-----------|
269
- | Order | Fund escrow | Read-only |
270
- | **Progress** | Workflow state | **Operate this** — `hold: true` (lock) → work → `hold: false` (submit) |
284
+ When a merchant wants to modify an existing service (change workflow, add allocators, update guards), the AI must determine whether to modify the current version (in-place) or fork a new version.
271
285
 
272
- **AI Reminder**: When fulfilling, check `customer_required` fields. Missing → prompt via Messenger.
286
+ ### Decision Rule
273
287
 
274
- ---
288
+ | Scenario | Strategy | MCP Action |
289
+ |----------|----------|------------|
290
+ | Service NOT yet published | **In-place** — modify the current version directly | `onchain_operations` (modify) |
291
+ | Service IS published | **Fork** — create a new version, preserve original as read-only | `project_operation` → `fork_project` |
292
+
293
+ ### Fork Workflow
275
294
 
276
- ## Quick Reference
295
+ When the service is already published and the user wants structural changes, use MCP `project_operation` action `fork_project` (creates a new version with copies of stage.json/manifest/deployment docs; original v1 stays read-only; no on-chain objects copied since they're immutable). Then work on v2 using the normal 5-stage flow, reusing v1 on-chain objects by address and creating new objects only for changed parts. Publish v2 when ready — v1 continues running uninterrupted.
277
296
 
278
- | Purpose | Schema |
279
- |---------|--------|
280
- | Service ops | `onchain_operations_service` |
281
- | Machine ops | `onchain_operations_machine` |
282
- | Guard ops | `onchain_operations_guard` |
283
- | Progress ops | `onchain_operations_progress` |
284
- | WIP generation | `wip_file` |
285
- | Messenger | `messenger_operation` |
286
- | Query | `query_toolkit` |
297
+ Before forking, verify necessity via `get_reversibility` (query_object_type: "service", query_lifecycle_state: "published") → `struct_reversible="immutable"` confirms fork is required, or `get_project_status` → `has_published_object=true`.
287
298
 
288
- **Export**: `machineNode2file`, `guard2file` | **Query Schema**: `schema_query({ action: "get", name: "<name>" })`
299
+ ### When to Recommend Forking
300
+
301
+ - User says "I want to change my workflow" → check if published → recommend fork
302
+ - User says "I want to add a new product line" → if same Machine can handle it, in-place modify Service.sales; if needs new Machine, fork
303
+ - User says "I want to change fund distribution" → if Service not published, in-place; if published, fork (allocators are frozen after publish)
289
304
 
290
305
  ---
291
306
 
307
+ ## Distillation Review
308
+
309
+ The MCP server runs an offline flywheel that collects operational signals from your deployments and generates improvement proposals. Periodically review these proposals to optimize your service.
310
+
311
+ ### When to Review
312
+
313
+ - After publishing a service and running it for a while
314
+ - When the user asks "any improvements?" or "what did the system learn?"
315
+ - As part of routine service maintenance
316
+
317
+ ### How to Review
318
+
319
+ Use the [wowok-distill](../wowok-distill/SKILL.md) skill for guided review, or call MCP `project_operation` actions directly in order: (1) `get_improvement_queue` with `queue_filter_status: "pending"` to list proposals (title, priority, confidence, description); (2) `apply_improvement` with `proposal_id` + `review_status: "approved"` or `"rejected"` — approved proposals write overrides to `~/.wowok/overrides/` (config) or `patches/` (source); (3) `get_flywheel_config` to verify `applied_count` increased and `pending_count` decreased. Overrides are hot-loaded — next operation uses the new config immediately.
320
+
321
+ ### Override Categories
322
+
323
+ Only these categories can be overridden (no arbitrary changes):
324
+
325
+ | Category | What It Controls | Example |
326
+ |----------|-----------------|---------|
327
+ | risk-thresholds | Risk assessment cutoffs | max_retries, min_deposit |
328
+ | descriptions | AI guidance text | industry descriptions |
329
+ | industry-profiles | Industry trait profiles | rental traits, freelance traits |
330
+ | scenario-defaults | Default parameters per scenario | default allocators, machine nodes |
331
+ | recovery-priorities | Error recovery order | which failures to fix first |
332
+
292
333
  ---
293
334
 
294
- ## Appendices (Progressive Disclosure)
335
+ ## Order Fulfillment
295
336
 
296
- > The following sections have been extracted to [APPENDIX.md](./APPENDIX.md) for on-demand loading:
297
- > - Dialogue Scripts (R1-R10) — guided conversation scripts
298
- > - Decision Trees branching logic reference
299
- > - Failure Playbooksrecovery scenarios
300
- > - Tier Layering — expertise-tier based guidance
301
- >
302
- > Load APPENDIX.md when the user needs guided dialogue, recovery help, or tier-specific guidance.
337
+ | Object | Purpose | Operation |
338
+ |--------|---------|-----------|
339
+ | Order | Fund escrow | Read-only |
340
+ | **Progress** | Workflow state | **Operate this** `hold: true` (lock) → work → `hold: false` (submit) |
341
+
342
+ **AI Reminder**: When fulfilling, check `customer_required` fields. Missing → prompt via Messenger.
343
+
344
+ ---