@wowok/skills 1.1.3 → 1.1.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.
@@ -25,417 +25,242 @@ Build and operate commercial services on WoWok as a service provider.
25
25
 
26
26
  > **Role**: Service Provider (Merchant/Seller)
27
27
  > **Prerequisites**: Understand CREATE vs MODIFY pattern — use `schema_query({ action: "get", name: "onchain_operations" })`
28
- > **Customer Perspective**: See [wowok-order](../wowok-order/SKILL.md)
29
- > **Arbitration**: See [wowok-arbitrator](../wowok-arbitrator/SKILL.md)
30
- > **Machine Design**: See [wowok-machine](../wowok-machine/SKILL.md) for workflow details
31
- > **Messenger**: See [wowok-messenger](../wowok-messenger/SKILL.md) for customer communication
32
- > **Tools**: See [wowok-tools](../wowok-tools/SKILL.md)
28
+ > **Related Skills**: [wowok-order](../wowok-order/SKILL.md) (customer), [wowok-machine](../wowok-machine/SKILL.md) (workflow), [wowok-messenger](../wowok-messenger/SKILL.md) (communication)
33
29
 
34
30
  ---
35
31
 
36
- ## Core Concepts
32
+ ## AI Decision Framework
37
33
 
38
- ### Dependency-First Construction
34
+ When user wants to create/publish a service, follow this **strict dependency order**:
39
35
 
40
- Commercial services MUST be built in strict dependency order. An object cannot reference another that does not yet exist.
41
-
42
- **Build Sequence**:
43
36
  ```
44
- Permission Service (unpublished) Machine (Nodes but unpublished) → Guards → Allocators → Reward/Arbitration → Publish Machine → Bind to Service → Publish Service
37
+ STEP 1: Foundation (CREATE or REUSE)
38
+ ├── Permission — REUSE existing if available (strongly recommended)
39
+ ├── Service (unpublished) — CREATE new
40
+ └── Machine (unpublished) — CREATE new or REUSE template
41
+
42
+ STEP 2: Trust Layer (CREATE or REUSE)
43
+ └── Guards — CREATE new or REUSE existing
44
+
45
+ STEP 3: Business Logic (MODIFY)
46
+ ├── Machine — bind Guards to nodes
47
+ ├── Service — set Allocators
48
+ ├── Service — add Arbitrations (optional, REUSE existing Arb services)
49
+ ├── Service — add Compensation Fund (optional)
50
+ └── Reward — incentive pools (optional)
51
+
52
+ STEP 4: Publication
53
+ ├── Publish Machine → IMMUTABLE
54
+ ├── Bind Machine to Service
55
+ └── Publish Service → machine/allocators LOCKED
56
+
57
+ STEP 5: Post-Publish (MODIFY Service)
58
+ ├── description, location
59
+ ├── sales (products with WIP)
60
+ ├── customer_required
61
+ └── um (REUSE existing Contact or CREATE new)
45
62
  ```
46
63
 
47
- **Immutability Rules**:
48
- | Object | When Immutable | Impact |
49
- |--------|---------------|--------|
50
- | **Guard** | After creation | CREATE-only, cannot modify |
51
- | **Machine** | After `publish: true` | Nodes locked, workflow frozen |
52
- | **Service** | After `publish: true` | `machine` and `order_allocators` locked |
53
-
54
- ### CREATE vs MODIFY Pattern
64
+ ### Object Reuse (See [wowok-safety](../wowok-safety/SKILL.md))
55
65
 
56
- The unified pattern across all operations:
57
- - **Object shape** (`{ name?, ... }`) = **CREATE** new object
58
- - **String value** (`"<name>"`) = **MODIFY** existing object
66
+ **General Rule**: Reuse existing objects when available. See wowok-safety for detailed reuse principles and CREATE vs MODIFY patterns.
59
67
 
60
- **Schema Reference**: `schema_query({ action: "get", name: "onchain_operations" })`
61
-
62
- ### Key Object Relationships
63
-
64
- ```
65
- Service (merchant storefront)
66
- ├── machine Machine (workflow definition)
67
- ├── order_allocators → Allocators (fund distribution rules)
68
- ├── arbitrations → Arbitration[] (dispute resolution options)
69
- ├── compensation_fund → Customer protection pool
70
- ├── sales → SalesItem[] (products with WIP files)
71
- ├── discount → Discount[] (coupons)
72
- ├── rewards → Reward[] (order/user behavior incentives)
73
- └── um → Contact (customer service)
68
+ **Provider-Specific Reuse Notes**:
69
+ | Object | Reuse Strategy |
70
+ |--------|----------------|
71
+ | **Permission** | **Strongly recommended** — enables centralized permission control across all your services |
72
+ | Machine | Reuse via `machineNode2file` export/import for similar workflows |
73
+ | Contact (um) | Reuse existing customer service Contact |
74
+ | Arbitration | Always reuse existing Arbitration services (customers choose from your approved list) |
74
75
 
75
- Order (created per purchase)
76
- ├── builder Customer (order owner)
77
- ├── progress → Progress (workflow state)
78
- └── allocation Allocation (fund distribution engine)
79
- ```
76
+ **Immutability Rules**:
77
+ | Object | When Locked | Impact |
78
+ |--------|-------------|--------|
79
+ | Guard | After creation | Cannot modify |
80
+ | Machine | After publish | Nodes frozen |
81
+ | Service | After publish | machine, order_allocators frozen |
80
82
 
81
83
  ---
82
84
 
83
- ## Phase 1: Service Design (Commercial Intent)
84
-
85
- Design your service offering before building. This phase defines what customers see and how orders flow.
86
-
87
- ### 1.1 Product Promise (WIP Files)
88
-
89
- WIP (Witness Immutable Promise) files are **immutable product commitments** your on-chain promise to customers.
90
-
91
- **Creating WIP Files**:
92
-
93
- **Tool**: `wip_file` with `type: "generate"` operation.
94
-
95
- **Schema Reference**: `schema_query({ action: "get", name: "wip_file" })`
96
-
97
- **Key Parameters**:
98
- - `options.markdown_text`: Product description in markdown format
99
- - `options.images`: Array of image sources for product visuals
100
- - `outputPath`: Output file path for generated WIP file
101
-
102
- **Attaching to Service**:
103
-
104
- **Operation**: `onchain_operations` with `operation_type: "service"`.
105
-
106
- **Key Fields**:
107
- - `sales.op`: Operation type ("add", "set", "remove")
108
- - `sales.sales`: Array of sales items, each with:
109
- - `name`: Product name
110
- - `price`: Price in token units
111
- - `stock`: Available quantity
112
- - `wip`: URL to WIP file (your official site, GitHub, etc.)
113
- - `wip_hash`: SHA256 hash of WIP file for verification (default: `""`, uses hash embedded in WIP file unless explicitly set for verification)
114
-
115
- **Why WIP Matters**:
116
- - **Immutable commitment**: Hashed and signed on-chain
117
- - **Arbitration evidence**: Disputes resolved against your WIP claims
118
- - **Customer trust**: Transparent specifications reduce uncertainty
119
- - **Legal protection**: Tamper-proof record of promises
120
-
121
- ### 1.2 Service Workflow (Machine Design)
122
-
123
- Machine defines your **service process** — from order creation to completion. Design from a **commercial intent** perspective, not technical implementation.
124
-
125
- **Key Design Questions**:
126
- 1. **Service stages**: What are the key milestones? (e.g., confirmed → processing → shipped → delivered)
127
- 2. **Validation points**: Where do you need customer confirmation or external verification?
128
- 3. **Branching paths**: What happens on success vs. failure? (e.g., on-time vs. late delivery)
129
- 4. **Fund release triggers**: At which nodes and how to allocate order funds?
130
-
131
- **Integration with Allocators**:
132
- - Each terminal node should map to an allocator strategy
133
- - Guards determine which allocator executes
134
- - Design Machine and Allocators together for coherent fund flow
135
-
136
- > **Implementation**: See [wowok-machine](../wowok-machine/SKILL.md) for node definition syntax, Guard conditions, and Forward configurations.
137
-
138
- ### 1.3 Fund Distribution Strategy (Allocators)
139
-
140
- Allocators define **who gets what** under different outcomes. Design these alongside your Machine workflow.
141
-
142
- **Allocator + Machine Integration**:
143
- ```
144
- "delivered" → "order_complete" (threshold: 1)
145
- └── Forward: "customer_signed" (weight: 1)
146
- └── Allocator: "completed" → 95% merchant, 5% platform
147
-
148
- "delivered" → "package_lost" (threshold: 2)
149
- ├── Forward: "customer_reports_lost" (weight: 1)
150
- ├── Forward: "merchant_confirms_lost" (weight: 1)
151
- └── Allocator: "package_lost" → 100% to order (buyer can withdraw)
152
-
153
- Note: Arbitration is an independent action that can be triggered at any time.
154
- ```
155
-
156
- **Allocation Modes** (3 types, executed in order):
157
- 1. **Amount**: Fixed allocation amount (U64) for each recipient
158
- 2. **Rate**: Percentage in basis points (10000 = 100%, 500 = 5%)
159
- - If no Surplus defined, sum of all Rates must equal 10000 (100%)
160
- 3. **Surplus**: Receives remaining funds (maximum one per allocator)
161
-
162
- **How Allocation Executes**:
163
- - When an allocator Guard returns `true`, funds are distributed immediately per that allocator's `sharing` rules. If multiple Guards may evaluate to `true`, query and compare their validation logic and `sharing` rules to determine the most favorable outcome for your interests.
164
-
165
- **Query Guard Logic**: Use `query_toolkit` with `query_type: "onchain_objects"` to query Guard objects by ID or name. Retrieve detailed validation logic including required node conditions, evidence submissions, and permission checks.
166
-
167
- **Schema Reference**: `schema_query({ action: "get", name: "onchain_operations_service" })` — look for `order_allocators` field
85
+ ## Service Build Checklist
86
+
87
+ Use this checklist when guiding users through service creation:
88
+
89
+ | Phase | Step | Required | Tool/Operation | Key Fields |
90
+ |-------|------|----------|----------------|------------|
91
+ | 1 | Permission | | `onchain_operations` (permission) | name, type_parameter |
92
+ | 1 | Service (unpublished) | ✅ | `onchain_operations` (service) | object: {name, type_parameter, permission} |
93
+ | 1 | Machine (unpublished) | ✅ | `onchain_operations` (machine) | nodes, pairs, forwards |
94
+ | 2 | Guards | ✅ | `onchain_operations` (guard) | logic, instructions |
95
+ | 3 | Machine + Guards | ✅ | `onchain_operations` (machine) | bind guards to forwards |
96
+ | 3 | Allocators | ✅ | `onchain_operations` (service) | order_allocators |
97
+ | 3 | Arbitrations | | `onchain_operations` (service) | arbitrations.list |
98
+ | 3 | Compensation Fund | ❌ | `onchain_operations` (service) | compensation_fund_add, setting_locked_time_add |
99
+ | 4 | Publish Machine | ✅ | `onchain_operations` (machine) | publish: true |
100
+ | 4 | Bind Machine | ✅ | `onchain_operations` (service) | machine: "<machine_id>" |
101
+ | 4 | Publish Service | | `onchain_operations` (service) | publish: true |
102
+ | 5 | Description/Location | | `onchain_operations` (service) | description, location |
103
+ | 5 | Sales Products | ❌ | `onchain_operations` (service) | sales.sales[] |
104
+ | 5 | Customer Required | ❌ | `onchain_operations` (service) | customer_required[], um |
105
+
106
+ **Critical Rules**:
107
+ 1. **Reuse First**: Always ask if user has existing Permission/Machine/Guard/Contact to reuse
108
+ 2. If `customer_required` is set → `um` (Contact) **MUST** be set
109
+ 3. Physical goods **MUST** have WIP files
110
+ 4. `wip_hash` default `""` (uses embedded hash)
168
111
 
169
112
  ---
170
113
 
171
- ## Phase 2: Trust Mechanisms (Customer Confidence)
172
-
173
- Configure mechanisms that assure customers they can trust your service.
114
+ ## Key Concepts
174
115
 
175
- ### 2.1 Compensation Fund (compensation_fund)
116
+ ### Service Object Relationships
176
117
 
177
- A **dedicated pool** that pays customers if arbitration rules in their favor. Demonstrates your commitment to fair resolution.
178
-
179
- **Setting Up Compensation Fund**:
180
-
181
- **Operation**: `onchain_operations` with `operation_type: "service"`.
182
-
183
- **Key Fields**:
184
- - `compensation_fund_add`: Add funds to compensation pool (BalanceType)
185
- - `setting_locked_time_add`: Lock duration in milliseconds (minimum 30 days = 2592000000ms)
186
-
187
- **Merchant Commitment (Constraint)**:
188
118
  ```
189
- Merchant withdrawal constraints from compensation_fund:
190
- 1. Pause Service (stop accepting new orders)
191
- 2. Wait compensation_lock_duration (≥30 days)
192
- 3. Then can withdraw remaining funds via compensation_fund_receive
119
+ Service (merchant storefront)
120
+ ├── machine Machine (workflow)
121
+ ├── order_allocators Fund distribution rules
122
+ ├── arbitrations Dispute resolution (optional)
123
+ ├── compensation_fund → Customer protection (optional)
124
+ ├── sales → Products with WIP files
125
+ ├── rewards → Incentive pools (optional)
126
+ └── um → Contact (customer service)
193
127
 
194
- This commitment ensures existing orders can still claim compensation during the lock period.
128
+ Order (per purchase)
129
+ ├── builder → Customer
130
+ ├── progress → Workflow state
131
+ └── allocation → Fund distribution engine
195
132
  ```
196
133
 
197
- **Customer-Facing Benefits**:
198
- - Display `compensation_fund` balance in service listing
199
- - Higher balance + longer lock = more confidence for high-value orders
200
- - Shows merchant has "skin in the game" for fair resolution
201
- - Customers can claim compensation via arbitration — see [wowok-order](../wowok-order/SKILL.md) for customer arbitration process
202
-
203
- ### 2.2 Arbitration Configuration
204
-
205
- Configure which arbitration services can resolve disputes for your orders.
206
-
207
- **Operation**: `onchain_operations` with `operation_type: "service"`.
208
-
209
- **Key Fields**:
210
- - `arbitrations.op`: Operation type ("add", "set", "remove")
211
- - `arbitrations.list`: Array of Arbitration object IDs/names
212
-
213
- **Why Multiple Arbitrations**:
214
- - Customers evaluate on-chain data to choose the most trusted Arbitration from your approved list
215
- - Different arbitrations may specialize (e.g., product quality vs. service delivery)
134
+ ### WIP Files (Witness Immutable Promise)
216
135
 
217
- ---
218
-
219
- ## Phase 3: Build & Publish
220
-
221
- Execute the dependency-first build process.
222
-
223
- ### 3.1 4-Phase Build Process
136
+ **Purpose**: Immutable product commitment for arbitration evidence.
224
137
 
138
+ **Creating WIP**:
225
139
  ```
226
- PHASE 1 — Foundation
227
- ├── 1. Permission (CREATE)
228
- ├── 2. Service (CREATE, unpublished) — define basic info
229
- └── 3. Machine (CREATE, unpublished) — define ALL nodes and transitions
230
-
231
- PHASE 2 — Trust Layer
232
- └── 4. Guards (CREATE) — schema_query({ action: "get", name: "onchain_operations_guard" }) — validate Reward claims, Allocator conditions, Machine node transitions, etc. Create all Guards needed for your workflow.
233
-
234
- PHASE 3 — Business Logic
235
- ├── 5. Machine Node Guards (MODIFY Machine) — bind Guards to Machine node forwards for workflow validation at each operation
236
- ├── 6. Allocators (MODIFY Service) — fund distribution rules
237
- ├── 7. Rewards (CREATE/MODIFY Service) — optional incentive pools
238
- ├── 8. Arbitrations (MODIFY Service) — dispute resolution options
239
- └── 9. Compensation Fund (MODIFY Service) — add funds
240
-
241
- PHASE 4 — Publication
242
- ├── 10. Publish Machine — nodes become IMMUTABLE
243
- ├── 11. Bind Machine to Service — MODIFY Service.machine
244
- └── 12. Publish Service — everything LOCKED
140
+ Tool: wip_file
141
+ type: "generate"
142
+ options.markdown_text: Product description
143
+ options.images: Product visuals
144
+ outputPath: Output file path
245
145
  ```
246
146
 
247
- ### 3.2 Pre-Build Discovery
248
-
249
- Query existing resources to avoid collisions:
250
-
251
- **Tools**:
252
- - `query_toolkit` with `query_type: "account_list"` — list account objects
253
- - `query_toolkit` with `query_type: "local_mark_list"` — list local marks
254
- - `query_toolkit` with `query_type: "onchain_objects"` — query specific objects
255
-
256
- ### 3.3 Reuse Existing Templates
257
-
258
- Export from proven services instead of building from scratch:
259
-
260
- **Tools**:
261
- - `machineNode2file` — export Machine nodes to JSON file for editing
262
- - `guard2file` — export Guard rules to JSON file for editing
263
-
264
- **Schema References**:
265
- - `schema_query({ action: "get", name: "machineNode2file" })`
266
- - `schema_query({ action: "get", name: "guard2file" })`
267
-
268
- ---
269
-
270
- ## Phase 4: Customer Attraction & Incentives
271
-
272
- Optional mechanisms to attract and retain customers.
273
-
274
- ### 4.1 Discount Coupons
275
-
276
- Issue promotional discounts to attract new customers or reward loyal ones (AI: query `schema_query` for `onchain_operations_service` to view `discount` field definitions).
277
- **Operation**: `onchain_operations` with `operation_type: "service"`.
278
-
279
- ### 4.2 Review & Reward Incentives
280
-
281
- Encourage post-order feedback and engagement.
282
-
283
- **Design Pattern — Review Incentive**:
147
+ **Attaching to Service**:
284
148
  ```
285
- Machine Workflow:
286
- "order_completed" "like" (threshold: 1)
287
- └── Forward: "positive_feedback" (weight: 1)
288
-
289
- "order_completed" "suggest" (threshold: 1)
290
- └── Forward: "negative_feedback" (weight: 1)
149
+ Operation: onchain_operations (service)
150
+ sales.op: "add"
151
+ sales.sales: [{
152
+ name: Product name
153
+ price: Token amount
154
+ stock: Quantity
155
+ wip: URL to WIP file
156
+ wip_hash: "" (default, uses embedded hash)
157
+ }]
291
158
  ```
292
159
 
293
- **Creating Reward Pool**:
294
-
295
- **Operation**: `onchain_operations` with `operation_type: "reward"`.
296
-
297
- **Example Configuration**:
160
+ ### Allocators + Machine Integration
298
161
 
299
- Create 2 Guards that check if Progress reached "like" node, then bind to Reward with different amounts:
162
+ Design together for coherent fund flow:
300
163
 
301
164
  ```
302
- Guard 1: "reward_like_200k"
303
- └── Condition: progress.current_node == "like"
304
-
305
- Guard 2: "reward_suggest_100k"
306
- └── Condition: progress.current_node == "suggest"
307
-
308
- Reward Configuration:
309
- ├── Guard: "reward_like_200k"
310
- │ └── Amount: 200000
311
-
312
- └── Guard: "reward_suggest_100k"
313
- └── Amount: 100000
314
- ```
315
-
316
- > **Note**: Reward is an optional advanced feature. See `schema_query({ action: "get", name: "onchain_operations_reward" })` for full configuration.
317
-
318
- ### 4.3 Supply Chain Promises (Sub-Orders)
319
-
320
- Demonstrate quality by committing to purchase from trusted suppliers.
165
+ Example: Delivery workflow
166
+ "delivered" "order_complete" (threshold: 1)
167
+ └── Forward: "customer_signed"
168
+ └── Allocator: 95% merchant, 5% platform
321
169
 
322
- **Use Case Travel Service**:
323
- ```
324
- Travel Service promises:
325
- "We only book 5-star hotels from trusted hotel groups"
326
-
327
- Machine Implementation:
328
- ├── "Book Hotel" Node
329
- │ └── forward_to_order_create: {
330
- │ service: "trusted-hotel-group-service",
331
- │ // Creates sub-order on hotel service
332
- │ }
333
-
334
- └── Guard: "hotel_booking_confirmed"
335
- └── Validates sub-order created and confirmed
170
+ "delivered" "package_lost" (threshold: 2)
171
+ ├── Forward: "customer_reports_lost"
172
+ ├── Forward: "merchant_confirms_lost"
173
+ └── Allocator: 100% to order (buyer withdraws)
336
174
  ```
337
175
 
338
- **Benefits**:
339
- - **Transparency & Quality assurance**: Commits you to vetted suppliers
340
- - **Trust building**: "We use X brand" becomes verifiable on-chain
341
-
342
- **Prerequisites**:
343
- - Supplier Service must be published first
344
- - Your Machine references their Service ID
176
+ **Allocation Modes** (execute in order):
177
+ 1. **Amount**: Fixed U64 per recipient
178
+ 2. **Rate**: Basis points (10000 = 100%)
179
+ 3. **Surplus**: Receives remainder (max 1 per allocator)
345
180
 
346
181
  ---
347
182
 
348
- ## Phase 5: Order Fulfillment
183
+ ## Phase Details
349
184
 
350
- Handle active orders through workflow progression.
185
+ ### Phase 1: Foundation
351
186
 
352
- ### 5.1 Progress Operations
187
+ Create base objects. Service starts unpublished.
353
188
 
354
- Advance orders through your Machine workflow via the Progress object.
189
+ **Pre-Build Discovery**:
190
+ - `query_toolkit` (account_list) — list accounts
191
+ - `query_toolkit` (local_mark_list) — list marks
192
+ - `query_toolkit` (onchain_objects) — query existing
355
193
 
356
- **Key Principle**:
357
- | Object | Purpose | Operation Target |
358
- |--------|---------|------------------|
359
- | **Order** | Fund escrow, ownership | Read-only for workflow |
360
- | **Progress** | Workflow state, node execution | **Operate via this** |
194
+ **Reuse Templates**:
195
+ - `machineNode2file` export Machine for editing
196
+ - `guard2file` — export Guard for editing
361
197
 
362
- **Two-Phase Operation** (recommended):
198
+ ### Phase 2: Trust Layer
363
199
 
364
- **Operation**: `onchain_operations` with `operation_type: "progress"`.
200
+ Create all Guards needed for workflow validation.
365
201
 
366
- **Step 1: Lock permission** (Prevents race conditions):
367
- - `object`: Progress object ID (from Order.progress)
368
- - `operate.operation`: Target node operation (e.g., `{ Next: "shipped" }`)
369
- - `operate.hold`: `true` to lock permission
202
+ ### Phase 3: Business Logic
370
203
 
371
- **Step 2: Complete off-chain work, then submit**:
372
- - Same operation with `hold: false` to release lock and submit
204
+ **Compensation Fund** (optional but recommended):
205
+ - `compensation_fund_add`: Add funds
206
+ - `setting_locked_time_add`: Lock duration (min 30 days = 2592000000ms)
373
207
 
374
- **Schema Reference**: `schema_query({ action: "get", name: "onchain_operations_progress" })`
208
+ **Merchant Withdrawal Constraints**:
209
+ 1. Pause Service
210
+ 2. Wait lock duration
211
+ 3. Withdraw via `compensation_fund_receive`
375
212
 
376
- ### 5.2 Voluntary Compensation
213
+ **Arbitration** (optional):
214
+ - Without it: Lower setup, but customers bear full dispute risk
215
+ - With it: Customer trust ↑, dispute resolution available
377
216
 
378
- Proactively compensate for service failures to maintain relationships.
217
+ ### Phase 4: Publication
379
218
 
380
- **Scenario Late Delivery**:
381
- ```
382
- Machine Design:
383
- ├── "Shipping" Node
384
- │ ├── Forward: "On Time" (normal)
385
- │ └── Forward: "Late" (penalty trigger)
386
-
387
- └── Guard "late_penalty"
388
- ├── IF delivery_time > promised + grace_period
389
- ├── THEN require Payment from merchant to Order
390
- └── Validate: Payment ≥ configured_penalty
391
- ```
219
+ **Order Matters**: Publish Machine → Bind → Publish Service
392
220
 
393
- **Payment Flow**:
394
- ```
395
- Merchant or Participant Wallet
396
- ├──→ Payment (penalty) ──→ Customer's Order
397
- │ └──→ Customer extracts via receive()
398
- └──→ Guard validates before workflow continues
399
- ```
221
+ After publish: machine, order_allocators are **LOCKED**
400
222
 
401
- **Benefits**:
402
- - Retains customers through proactive accountability
403
- - Avoids escalation to arbitration
404
- - Differentiates your service with guarantees
223
+ ### Phase 5: Post-Publish Configuration
405
224
 
406
- ### 5.3 Customer Service
225
+ These can be updated after publication:
407
226
 
408
- Handle inquiries and issues via Messenger.
227
+ | Field | Purpose | Required |
228
+ |-------|---------|----------|
229
+ | description | Service description | ❌ |
230
+ | location | Service area | ❌ |
231
+ | sales | Products with WIP | ❌ (but needed to sell) |
232
+ | customer_required | Required customer info | ❌ |
233
+ | um | Contact for customer service | ❌ (REQUIRED if customer_required set) |
409
234
 
410
- **Setup**:
235
+ **Customer Required + Contact Rule**:
411
236
  ```
412
- Service.um Contact.object_id
413
- Contact.ims[] Your customer service addresses
237
+ If customer_required: ["phone", "address"]
238
+ Then um: "<contact_id>" ← MUST be set
414
239
  ```
415
240
 
416
- **Best Practices**:
417
- - Respond promptly to build trust
418
- - Document all agreements (generates WTS evidence)
419
- - Confirm understanding explicitly (ARK signature required for evidence)
420
- - Proactively communicate delays
241
+ **Contact Setup**:
242
+ 1. Create Contact object
243
+ 2. Set `um` to Contact ID
244
+ 3. Customers use Messenger to provide info securely
421
245
 
422
- > **AI reminder**: When fulfilling an order, the AI should proactively check whether the Service's `customer_required` fields (phone, email, delivery address, etc.) have been provided by the customer. If any are missing, prompt the provider to request them from the customer via Messenger using `messenger_operation` with `send_message`.
246
+ ---
423
247
 
424
- > **Full Guide**: See [wowok-messenger](../wowok-messenger/SKILL.md) for messaging, WTS generation, and evidence management.
248
+ ## Order Fulfillment
425
249
 
426
- ---
250
+ ### Progress Operations
251
+
252
+ | Object | Purpose | Target |
253
+ |--------|---------|--------|
254
+ | Order | Fund escrow | Read-only |
255
+ | Progress | Workflow state | **Operate this** |
427
256
 
428
- ## Best Practices & Common Pitfalls
257
+ **Two-Phase Pattern**:
258
+ 1. Lock: `hold: true` (prevents race conditions)
259
+ 2. Submit: `hold: false` (after off-chain work)
429
260
 
430
- ### Design Principles
261
+ ### Customer Service
431
262
 
432
- | Do | Don't |
433
- |----|-------|
434
- | Design Machine + Allocators together | Design workflow without considering fund flow |
435
- | Provide generous compensation_fund | Skip compensation fund for high-value services |
436
- | Use clear, verifiable Guard conditions | Create ambiguous validation logic |
437
- | Test on testnet first, then mainnet | Publish to mainnet without testing |
438
- | Document WIP thoroughly | Make vague product promises |
263
+ **AI Reminder**: When fulfilling orders, check if `customer_required` fields are provided. If missing, prompt provider to request via Messenger.
439
264
 
440
265
  ---
441
266
 
@@ -443,13 +268,20 @@ Contact.ims[] → Your customer service addresses
443
268
 
444
269
  ### Essential Schemas
445
270
 
446
- | Purpose | Schema Name |
447
- |---------|-------------|
448
- | Service operations | `onchain_operations_service` |
449
- | Machine operations | `onchain_operations_machine` |
450
- | Guard operations | `onchain_operations_guard` |
451
- | WIP file generation | `wip_file` |
452
- | Messenger operations | `messenger_operation` |
453
- | Query toolkit | `query_toolkit` |
271
+ | Purpose | Schema |
272
+ |---------|--------|
273
+ | Service ops | `onchain_operations_service` |
274
+ | Machine ops | `onchain_operations_machine` |
275
+ | Guard ops | `onchain_operations_guard` |
276
+ | Progress ops | `onchain_operations_progress` |
277
+ | WIP generation | `wip_file` |
278
+ | Messenger | `messenger_operation` |
279
+ | Query | `query_toolkit` |
280
+
281
+ ### Common Operations
454
282
 
455
283
  **Query Schema**: `schema_query({ action: "get", name: "<schema_name>" })`
284
+
285
+ **Export Templates**:
286
+ - `machineNode2file` — Machine → JSON
287
+ - `guard2file` — Guard → JSON