@wowok/skills 1.3.4 → 2.0.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.
@@ -1,371 +0,0 @@
1
- ---
2
- name: wowok-scenario
3
- description: |
4
- WoWok Industry Driving Modes — opinionated bundles of Permission, Machine,
5
- Guard, and Allocator defaults per industry. Each mode is a "scene preset"
6
- (like SUV driving modes: sand / road / water) that pre-fills best-practice
7
- configuration so a new merchant can publish a working Service in 10 rounds.
8
-
9
- Use when: user describes an industry ("I do freelance design", "I rent
10
- cameras", "I run a course"), when wowok-onboard needs default parameters
11
- for R3-R8, or when a merchant wants to switch from general configuration
12
- to an industry-tuned preset.
13
-
14
- Phase 1 covers freelance and rental modes in full detail. Education,
15
- travel, and subscription modes are outlined for Phase 2/3.
16
- when_to_use:
17
- - User mentions an industry (freelance, rental, education, travel, subscription)
18
- - wowok-onboard R2 needs to load mode defaults
19
- - User asks "what configuration works for my business"
20
- - User wants to switch from general mode to an industry preset
21
- - User wants to compose two modes (e.g., freelance + subscription)
22
- ---
23
-
24
- # WoWok Industry Driving Modes
25
-
26
- > **Related Skills**: [wowok-onboard](../wowok-onboard/SKILL.md) (uses mode defaults in R3-R8), [wowok-machine](../wowok-machine/SKILL.md) (Machine design authority), [wowok-guard](../wowok-guard/SKILL.md) (Guard design authority), [wowok-provider](../wowok-provider/SKILL.md) (Allocator operation), [wowok-safety](../wowok-safety/SKILL.md) (immutability rules)
27
-
28
- ---
29
-
30
- ## Overview
31
-
32
- A **driving mode** is a curated bundle of: industry traits, default Permission indexes, default Machine node graph, default Guard templates, default Allocator strategy, a 10-round build script, an audit checklist, and a failure playbook. Modes are **presets, not constraints** — every underlying MCP operation remains available. Users can override any default or switch to `general` (free) mode at any time.
33
-
34
- ### On-Chain Capacity Limits (Inline Reference)
35
-
36
- Mode defaults respect these on-chain constants. When a mode's suggested count exceeds a limit, the SDK will reject the operation.
37
-
38
- | Constant | Value | Scope |
39
- |----------|-------|-------|
40
- | `MAX_NODE_COUNT_SDK` | 100 | Max nodes per Machine (SDK limit; on-chain allows 200) |
41
- | `MAX_FORWARD_COUNT` | 20 | Max global forwards per Machine |
42
- | `MAX_FORWARD_ORDER_COUNT` | 20 | Max forwards per node pair |
43
- | `MAX_NODE_PAIR_COUNT` | 40 | Max pairs per node |
44
- | `USER_DEFINED_PERM_INDEX_START` | 1000 | Custom permission_index start (0-999 reserved for built-in) |
45
- | `MAX_PERM_FOR_ENTITY` | 1000 | Max permissions per Entity |
46
- | `MAX_ADMIN_COUNT` | 500 | Max admins per Permission object |
47
- | `MAX_AGENT_COUNT` | 10 | Max agents per Order |
48
- | `MAX_DISPUTE_COUNT` | 10 | Max concurrent disputes per Order |
49
- | `MAX_SHARING_COUNT` | 100 | Max sharing entries per allocator |
50
- | `MAX_VOTING_GUARD_COUNT` | 50 | Max voting guards per Arbitration |
51
- | `MAX_POLICY_COUNT` | 50 | Max policies per Repository |
52
- | `MAX_ID_COUNT_ONCE` | 100 | Max IDs per Repository operation |
53
- | `MAX_REWARD_COUNT` | 20 | Max rewards per Demand/Repository |
54
- | `MAX_CONTEXT_REPOSITORY_COUNT` | 30 | Max context repositories per Progress |
55
- | `MAX_NAMED_OPERATOR_COUNT` | 60 | Max named operators per Forward |
56
- | `MAX_NAMED_OPERATOR_ADDRESS_COUNT` | 80 | Max addresses per named operator |
57
-
58
- ### What Driving Modes Solve
59
-
60
- The "object_type wall" — new users do not know which Machine topology, which Guards, which Allocator strategy fits their industry. Modes pre-answer these questions using best practices distilled from real usage (and refined by Loop Engineering over time).
61
-
62
- ### Mode Catalog
63
-
64
- | Mode | Phase | Industry | Trust Pattern |
65
- |------|-------|----------|---------------|
66
- | `freelance` | 1 | Design / dev / consulting / writing | Milestone allocation, acceptance gate |
67
- | `rental` | 1 | Equipment / vehicle / property rental | Deposit escrow, return inspection |
68
- | `education` | 2 | Courses / training / tutoring | Periodic release per session, attendance Guard |
69
- | `travel` | 2 | Custom tours / multi-segment trips | Multi-tier allocation per segment |
70
- | `subscription` | 3 | SaaS / content membership / periodic service | Periodic charge, cancel Guard |
71
- | `general` | always | Anything not covered / hybrid | User-defined from scratch |
72
-
73
- ---
74
-
75
- ## Mode Selection Logic
76
-
77
- The selection algorithm maps the user's business description to industry traits, then to a mode.
78
-
79
- ### Trait Extraction
80
-
81
- Industry traits used for mode selection: `has_logistics` (physical goods to ship?), `communication_heavy` (lots of back-and-forth before delivery?), `pure_digital` (deliverable is a file/digital artifact?), `long_cycle` (multi-week or multi-month engagement?), `deposit_required` (collect refundable deposit?), `multi_tier_allocation` (pay multiple parties per segment?).
82
-
83
- ### Selection Matrix
84
-
85
- | Trait Signature | Mode |
86
- |-----------------|------|
87
- | `pure_digital + communication_heavy + !deposit_required` | freelance |
88
- | `deposit_required + has_logistics + returnable` | rental |
89
- | `long_cycle + attendance + periodic_release` | education |
90
- | `multi_tier_allocation + segment_based + long_cycle` | travel |
91
- | `periodic_charge + cancel_anytime + pure_digital` | subscription |
92
- | none of the above / multiple conflicts | general |
93
-
94
- ### Composition (Mode Stacking)
95
-
96
- Two modes can combine. Conflicts surface for user decision:
97
-
98
- | Combination | Use Case | Conflict Resolution |
99
- |-------------|----------|---------------------|
100
- | freelance + subscription | Retainer consulting (monthly + milestone) | Allocator: split into retainer (subscription) + milestone (freelance) |
101
- | rental + education | Equipment training rental | Machine: extend rental nodes with attendance gates |
102
- | travel + rental | Tour with equipment | Allocator: segment allocation + deposit escrow side-by-side |
103
-
104
- When two modes specify different Permission indexes for the same role, user decides which set to use.
105
-
106
- ---
107
-
108
- ## Phase 1 Mode Details (Freelance & Rental)
109
-
110
- > **Mode defaults** (traits, machine_shape, guards, allocator, key_risk, build_notes) are provided by MCP `project_operation` action `create_project` — pass `project_industry` parameter and the MCP auto-fills scenario defaults from `knowledge/scenario-modes.ts`. The AI does NOT need to look up per-industry presets manually.
111
-
112
- ### Quick Reference (mode summaries)
113
-
114
- | Mode | Machine Shape | Guards | Allocators | Key Risk |
115
- |------|---------------|--------|------------|----------|
116
- | `freelance` | 7 nodes (ordered→...→completed→{wonder\|no_wonder}) | 5 (buy/deliver/accept/withdraw/rating_window) | 2 (100% provider at completed / 0 at wonder-no_wonder) | Customer never accepts delivery |
117
- | `rental` | 10 nodes (reserved→...→completed→{wonder\|no_wonder}) | 5 (deposit/return/inspect/damage/rating_window) | 3 (rent at completed / refund-to-order via Allocator / damage deduct) | Owner claims damage without pre-rental WIP |
118
-
119
- > **Freelance entry-node forward (CRITICAL)**: the entry node (`prev_node: ""`, typically "Ordered") MUST have ≥1 forward (e.g. `{next_node:"Ordered", namedOperator:"", weight:1}`). Without it, Progress is permanently stuck at `current=""`. The 5-Guard default covers buy/deliver/accept/withdraw/rating_window; `penalty_guard` is OPTIONAL (add only if penalty deduction is needed — most freelance flows omit it).
120
-
121
- > **Dispute Independence**: `refunded`/`disputed`/`arb` MUST NOT appear as Machine nodes (R-M1-11 critical). Refunds flow through Allocator (100%→OrderHolder) or Arbitration (dispute → ruling → arb_withdraw), both off-Machine. Wonder/no_wonder are post-completion reputation terminals only.
122
-
123
- ### Freelance Audit Checklist (pre-publish BLOCKERS)
124
-
125
- - `accept_guard` exists + `gen_passport` tested — BLOCKER (no acceptance = funds stuck)
126
- - 100% refund Allocator (sharing.who=OrderHolder) — BLOCKER (no refund path = dispute deadlock)
127
- - Machine MUST NOT contain `refunded`/`disputed`/`arb` nodes (R-M1-11 critical) — BLOCKER. Refund flows through Allocator or Arbitration, both off-Machine
128
- - `withdraw_guard` only triggers at `Progress.current=completed` — BLOCKER (prevents premature payout)
129
- - `deliver_guard` validates WIP hash — recommended
130
- - Optional: wonder/no_wonder terminals after `completed` for post-purchase rating (enables Reward wonder_praise template)
131
-
132
- ### Freelance Failure Playbooks
133
-
134
- - Customer never accepts: `accept_guard` includes timeout auto-accept forward (threshold met by `namedOperator:""` after N days)
135
- - Wrong deliverable hash: `deliver_guard` enforces WIP match → re-generate WIP, re-submit via `progress.hold:false`
136
- - No arbiter assigned: bind Arbitration via `service.arbitrations` AND configure `Arbitration.voting_guard` (NOT Permission index 1500 — arbiters live in voting_guard, never in Permission)
137
-
138
- ### Rental Audit Checklist (pre-publish BLOCKERS)
139
-
140
- - `deposit_guard` validates `Order.balance ≥ deposit_amount` — BLOCKER (renter runs off with item)
141
- - 100% refund Allocator (sharing.who=OrderHolder) — BLOCKER (no refund = deposit theft)
142
- - `damage_guard` requires pre+post WIP hash diff — BLOCKER (no evidence = arbitrary deduction)
143
- - Machine MUST NOT contain `deposit_refunded`/`deposit_deducted`/`refunded` nodes (R-M1-11 critical) — BLOCKER. Deposit refund/deduction flows through Allocator, not Machine terminals
144
- - Pre-rental WIP generated + hash stored — BLOCKER (can't prove damage without pre-hash)
145
- - Rental period timeout forward on `in_use` node — recommended
146
-
147
- ### Rental Failure Playbooks
148
-
149
- - Renter never returns: timeout forward to `damage_confirmed`, `damage_deduct` Allocator fires (deduct deposit to host)
150
- - No pre-rental WIP: impossible post-publish — audit checklist blocks this at publish time
151
- - Owner refuses inspect: timeout forward auto-passes `inspect_guard`, `refund_guard` fires on `return_approved`, deposit returns to customer
152
- - Double-spend dispute: Machine topology ensures mutually exclusive forwards (first-Pair-wins), `escalate_arbiter` routes to Arbitration
153
-
154
- ### Rental Mode Template (R-M1-11 Compliant)
155
-
156
- > **P3-03 fix**: The original Turo deployment used `deposit_refunded`/`deposit_deducted` as Machine nodes, which violates R-M1-11. This template replaces them with R-M1-11-compliant node names (`return_approved` / `damage_confirmed`). Deposit refund/deduction flows through Allocator triggered by these nodes, NOT through "refund terminal" nodes.
157
-
158
- #### Corrected 10-Node Machine Topology
159
-
160
- ```
161
- reserved → paid_deposit → in_use → returned → inspected ─┬─→ return_approved → completed
162
- ├─→ damage_confirmed → completed
163
- └─→ arbiter_rule → completed
164
-
165
- completed → wonder | no_wonder (rating terminals, optional)
166
- ```
167
-
168
- **Node inventory (10 nodes)**:
169
-
170
- | # | Node | Operator | Business meaning | Entry forward |
171
- |---|------|----------|------------------|---------------|
172
- | 1 | `reserved` | system | Renter selected item, pending payment | Order creation (auto) |
173
- | 2 | `paid_deposit` | customer | Paid rent + deposit | `pay_deposit_and_rent` (Customer, `namedOperator:""`) |
174
- | 3 | `in_use` | host | Item handed over, renter using | `pickup` (Host, `permissionIndex:1000`) |
175
- | 4 | `returned` | customer | Renter returned item | `trigger_return` (Customer, `namedOperator:""`) |
176
- | 5 | `inspected` | host | Host inspected condition | `inspect_item` (Host, `permissionIndex:1000`) |
177
- | 6 | `return_approved` | host | No damage — refund deposit | `approve_return` (Host, `permissionIndex:1000`) — **path 1** |
178
- | 7 | `damage_confirmed` | host | Damage confirmed — deduct deposit | `claim_damage` (Host, `permissionIndex:1000`) — **path 2** |
179
- | 8 | `arbiter_rule` | system | Escalated to arbitration | `escalate_arbiter` (Customer, `namedOperator:""`) — **path 3** |
180
- | 9 | `completed` | host | Trip finalized | `finalize` (Host, `permissionIndex:1000`) |
181
- | 10 | `wonder` / `no_wonder` | customer | Rating terminal (one of two) | `rate_good` / `rate_bad` (Customer, `namedOperator:""`) |
182
-
183
- **R-M1-11 compliance**: NO `deposit_refunded`, `deposit_deducted`, or `refunded` nodes. Deposit refund/deduction flows through Allocator triggered by `return_approved` / `damage_confirmed` nodes. `arbiter_rule` is allowed (it routes to Arbitration, not a refund terminal).
184
-
185
- #### 3 Mutually Exclusive Forwards from `inspected`
186
-
187
- | Forward | Next node | Operator | Trigger condition | Allocator fired |
188
- |---------|-----------|----------|-------------------|----------------|
189
- | `approve_return` | `return_approved` | Host (perm 1000) | No damage WIP diff | Allocator 1 (refund to customer) |
190
- | `claim_damage` | `damage_confirmed` | Host (perm 1000) | Damage WIP diff > 0 | Allocator 2 (deduct to host) |
191
- | `escalate_arbiter` | `arbiter_rule` | Customer (`namedOperator:""`) | Dispute | Arbitration (off-Machine) |
192
-
193
- Move contract guarantees first-Forward-wins: Progress can only advance from `inspected` to ONE of the three next nodes.
194
-
195
- #### 3 Allocator Templates (Amount mode recommended)
196
-
197
- > **Why Amount mode**: Rate mode requires sum == 10000 (hard constraint). Amount mode is clearer for fixed rent/deposit amounts. See [Allocation Mode Documentation](../../wiki/market/行业/租赁-Turo/06-Allocation模式说明-待审核.md) for details.
198
-
199
- **Allocator 0 — Rent payment (triggers on `completed`)**:
200
- ```json
201
- {
202
- "guard": "rent_completed_guard",
203
- "sharing": [
204
- { "who": { "Entity": { "name_or_address": "<host>" } }, "sharing": "750000000", "mode": "Amount" }
205
- ]
206
- }
207
- ```
208
- - Fires when `progress.current == "completed"` (via `rent_completed_guard`)
209
- - Pays 0.75 WOW rent to host
210
-
211
- **Allocator 1 — Deposit refund (triggers on `return_approved`)**:
212
- ```json
213
- {
214
- "guard": "refund_guard",
215
- "sharing": [
216
- { "who": { "GuardIdentifier": 0 }, "sharing": "250000000", "mode": "Amount" }
217
- ]
218
- }
219
- ```
220
- - Fires when `progress.current == "return_approved"` (via `refund_guard`)
221
- - Refunds 0.25 WOW deposit to customer (Order owner, via `GuardIdentifier:0`)
222
-
223
- **Allocator 2 — Damage deduction (triggers on `damage_confirmed`)**:
224
- ```json
225
- {
226
- "guard": "damage_guard",
227
- "sharing": [
228
- { "who": { "Entity": { "name_or_address": "<host>" } }, "sharing": "250000000", "mode": "Amount" }
229
- ]
230
- }
231
- ```
232
- - Fires when `progress.current == "damage_confirmed"` (via `damage_guard`)
233
- - Deducts 0.25 WOW deposit to host
234
-
235
- #### 5 Guard Templates
236
-
237
- | Guard | Type | Trigger condition | Purpose |
238
- |-------|------|-------------------|---------|
239
- | `deposit_guard` | Permission | `progress.current == "paid_deposit"` + signer is Customer | Verify customer paid rent + deposit |
240
- | `return_guard` | Permission | `progress.current == "returned"` + signer is Host | Verify item returned |
241
- | `inspect_guard` | Permission | `progress.current == "inspected"` + signer is Host | Verify inspection done |
242
- | `damage_guard` | WIP | Pre + post WIP hash diff > 0 | Verify damage evidence |
243
- | `rating_window_guard` | Permission | `progress.current == "completed"` + within N days | Rating window timer |
244
-
245
- #### Permission Index Design
246
-
247
- | Role | Permission Index | Operations |
248
- |------|------------------|------------|
249
- | Host | 1000 | pickup / inspect / approve_return / claim_damage / finalize |
250
- | Arbiter | 1500 | arbitration ruling (via `voting_guard`, NOT Permission index) |
251
- | Customer | (no index) | pay_deposit / trigger_return / escalate_arbiter (via `namedOperator:""`) |
252
-
253
- **Customer authorization**: uses `namedOperator: ""` (empty string = OrderHolder). Set automatically by `service::buy` when Order is created. No Permission index needed.
254
-
255
- #### Migration Guide (from R-M1-11 violating deployment)
256
-
257
- If you have an existing rental Machine with `deposit_refunded`/`deposit_deducted` nodes:
258
-
259
- 1. **Clone the Machine** (nodes are immutable after publish)
260
- 2. **Rename nodes**: `deposit_refunded` → `return_approved`; `deposit_deducted` → (remove, merge into `damage_confirmed`)
261
- 3. **Rebind Allocators**: Allocator 1 trigger node `deposit_refunded` → `return_approved`; Allocator 2 trigger node `deposit_deducted` → `damage_confirmed`
262
- 4. **Publish new Machine** and rebind to Service (requires Service to be in draft state; if already published, use `service.machine_rebind` with setting_lock_duration wait)
263
-
264
- ---
265
-
266
- ## Education Mode (Phase 2 — Outline)
267
-
268
- **Traits**: communication_heavy, long_cycle, deposit_required (tuition pre-pay), not pure_digital.
269
-
270
- ### Mode Outline
271
-
272
- - **Default Machine**: enroll → pay_tuition → session_1 → session_2 → ... → session_N → completed → {wonder | no_wonder}
273
- - **Default Guards**: `attendance_guard` (per session, student signs), `refund_guard` (institution approval OR arbiter)
274
- - **Default Allocator**: 1/N of tuition released per session attendance; unearned portion refundable on `refund_guard`
275
- - **Key trait**: `setting_locked_time` on Service prevents institution from changing rules mid-semester (regulatory compliance)
276
- - **GTM angle**: targets "tutoring institutions run away with prepaid tuition" pain point; policy-driven adoption
277
-
278
- ---
279
-
280
- ## Travel Mode (Phase 2 — Outline)
281
-
282
- **Traits**: communication_heavy, long_cycle, deposit_required (deposit + final payment), multi_tier_allocation (agency → hotel → guide → driver).
283
-
284
- ### Mode Outline
285
-
286
- - **Default Machine**: order → pay_deposit → pay_final → segment_D1 → segment_D2 → ... → return → completed → {wonder | no_wonder}
287
- - **Default Guards**: `segment_guard` (per-segment arrival WIP, e.g., hotel check-in), `refund_guard` (agency approval OR arbiter for trip interruption)
288
- - **Default Allocator**: multi-tier — deposit 20% to agency, final 80% to agency, then agency-side Allocation splits to hotel/guide/driver per segment
289
- - **Key trait**: multi-tier Allocation is WoWok's unique advantage over traditional travel platforms
290
- - **GTM angle**: targets "paid in full then service shrinks" pain point
291
-
292
- ### Travel Mode Preset (Reference)
293
-
294
- > Concise preset for quick deployment. For full template, see Phase 2 expansion.
295
-
296
- **10-Node Machine Workflow**:
297
- ```
298
- inquiry → booking → payment → confirmation → preparation → departure → in-progress → completion → review → refund
299
- ```
300
- - `refund` is a routing node (Allocator-triggered), NOT a refund terminal — R-M1-11 compliant
301
- - Rating terminals (`wonder` / `no_wonder`) optional after `review`
302
-
303
- **4 Guards**:
304
-
305
- | Guard | Type | Trigger | Purpose |
306
- |-------|------|---------|---------|
307
- | `buy_guard` | Permission | Order creation | Validate customer eligibility + segment WIP |
308
- | `withdraw_guard` | Permission | `progress.current == "completion"` | Verify trip completed before host payout |
309
- | `refund_guard` | Permission | `progress.current == "refund"` | Verify trip interruption / agency approval |
310
- | `dispute_guard` | Permission | Arb escalation | Route to Arbitration (off-Machine) |
311
-
312
- **2 Allocators** (Rate mode, sum = 10000 each):
313
-
314
- | Allocator | Trigger Node | sharing[0] | sharing[1] |
315
- |-----------|--------------|------------|------------|
316
- | Withdraw | `completion` | Agency 80% (Entity) | Hotel/Guide/Driver 20% (Entity) |
317
- | Refund | `refund` | Customer 100% (GuardIdentifier:0 = Order owner) | — |
318
-
319
- **Required flags**: `require_compensation_fund = true` (protects customer prepayment if agency defaults)
320
-
321
- ---
322
-
323
- ## Subscription Mode (Phase 3 — Outline)
324
-
325
- **Traits**: pure_digital, long_cycle, not deposit_required, not communication_heavy.
326
-
327
- ### Mode Outline
328
-
329
- - **Default Machine**: subscribe → charge_period_1 → deliver_period_1 → charge_period_2 → ... → cancel / expire
330
- - **Default Guards**: `charge_guard` (user confirms each charge — no auto-renew trap), `cancel_guard` (user cancels anytime, takes effect next period), `deliver_guard` (creator WIP hash per period — prevents content abandonment)
331
- - **Default Allocator**: each charge → 100% to creator; unearned periods → refund to subscriber
332
- - **Key trait**: pure digital, native WoWok soil; directly attacks "auto-renew trap" and "platform takes 30%" pain points
333
- - **GTM angle**: independent creators (Indie Hackers, niche SaaS, paid newsletters)
334
-
335
- ---
336
-
337
- ## Escape Hatch
338
-
339
- Any user can switch from a driving mode to `general` (free) mode at any time. This ditches all defaults and exposes raw MCP operations.
340
-
341
- ### When to Use the Escape Hatch
342
-
343
- - User's business doesn't fit any Phase 1-3 mode
344
- - User wants a hybrid not supported by Mode Composition
345
- - Expert user wants full manual control
346
- - Industry-specific edge case (e.g., freelance with deposit requirement that's not rental)
347
-
348
- ### How to Switch
349
-
350
- When user says "switch to general mode" or "configure manually": stop applying mode defaults to remaining rounds, surface the `IndustryModeSchema` shape as a blank template, let user provide Permission indexes/Machine nodes/Guards/Allocators manually. wowok-onboard R3-R8 still execute with empty defaults; wowok-machine / wowok-guard / wowok-provider become primary references.
351
-
352
- ### Warning
353
-
354
- Switching to general mode mid-onboarding does NOT discard already-created objects. The Service draft, Permission, and Machine created under a previous mode remain on-chain. The user can:
355
- - Continue building on top of them (REUSE pattern)
356
- - Abandon them and start fresh (CREATE new objects)
357
-
358
- ### Recommitting to a Mode
359
-
360
- User can switch back to a driving mode after using general mode:
361
- - wowok-onboard re-loads mode defaults for any unconfigured rounds
362
- - Already-configured objects are kept (REUSE); only missing pieces get mode defaults
363
- - Checkpoint is updated with the new mode
364
-
365
- ---
366
-
367
- ## Tier Layering
368
-
369
- - **Novice**: Full driving mode — mode defaults fill all rounds, user only confirms
370
- - **Advanced**: Customize defaults — user overrides specific fields (e.g., Allocator split), audit checklist still runs
371
- - **Expert**: General mode — no defaults, raw MCP operations, wowok-machine/guard/provider become primary references