@wowok/skills 1.3.4 → 2.0.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.
@@ -1,275 +0,0 @@
1
- ---
2
- name: wowok-safety
3
- description: |
4
- WoWok operational safety and best practices — ensures AI follows correct
5
- conventions for security, transaction confirmation, object building workflow,
6
- and common mistake prevention.
7
-
8
- This skill is AUTOMATICALLY triggered before any on-chain operation.
9
- when_to_use:
10
- - AI is about to execute an on-chain write operation
11
- - AI is about to transfer funds or modify financial parameters
12
- - AI is about to publish a Service or Machine
13
- - AI is building multiple interdependent objects
14
- - User mentions "confirm", "approve", "safe", "warning", "best practice"
15
- always: true
16
- ---
17
-
18
- # WoWok Safety & Best Practices
19
-
20
- ## 1. Core Principles
21
-
22
- ### 1.1 Object Reuse Principle (General Best Practice)
23
-
24
- **ALWAYS prefer reusing existing objects over creating new ones** — this enables centralized permission control and reduces management overhead.
25
-
26
- | Object Type | Reuse Strategy | Why |
27
- |-------------|----------------|-----|
28
- | **Permission** | **Strongly recommended** — ask user for existing Permission name/ID | Centralized permission control across all services |
29
- | Machine | Reuse if workflow fits | Save design time for similar processes |
30
- | Guards | Reuse if validation logic matches | Avoid redundant rules |
31
- | Contact | Reuse existing customer service Contact | Single point of management |
32
- | Arbitration | Always reuse existing Arbitration services | Customers choose from established arbiters |
33
-
34
- **How to Reuse**:
35
- - Ask user: *"Do you have an existing object you'd like to reuse? Provide the name or ID."*
36
- - Use string value `"<name_or_id>"` to reference existing objects
37
- - Use object shape `{ name?, ... }` only when creating new
38
-
39
- **CREATE vs MODIFY Pattern** (SDK-enforced, not Move-level):
40
- | Format | Meaning | Use When |
41
- |--------|---------|----------|
42
- | String `"<name>"` or `"<0x...>"` | **REUSE** existing | Object already exists |
43
- | Object `{ name?, ... }` | **CREATE** new | Need new object |
44
-
45
- The SDK resolves names to addresses via `GetObjectExisted()` — a string that fails resolution triggers a hard error. An object shape always creates.
46
-
47
- ### 1.2 Security & Safety
48
-
49
- - **Hot Wallet Usage**: WoWok never exposes private keys. Treat it as a spending account for transfers, receipts, and commerce. Flag large transactions for explicit user confirmation.
50
- - **Amount-Sensitive Operations**: Any token transfer, payment, or reward distribution MUST be verbally confirmed with the user before execution. Use `Payment` objects for commercial transfers when possible (they offer Guard validation and purpose tracking).
51
-
52
- ### 1.3 LOCAL vs ON-CHAIN
53
-
54
- | Type | Tools | Gas | Confirmation |
55
- |------|-------|-----|--------------|
56
- | **LOCAL ONLY** | `account_operation`, `local_mark_operation`, `local_info_operation` | None | Not needed |
57
- | **ON-CHAIN** | `onchain_operations`, `messenger_operation` (some ops), `wip_file` (sign) | Yes | Required |
58
- | **QUERY** | `query_toolkit`, `onchain_table_data`, `onchain_events`, `guard2file`, `machineNode2file` | Read-only | Not needed |
59
- | **ENCRYPTED** | `messenger_operation` (watch/send messages) | Local encryption | Not needed |
60
-
61
- ### 1.4 Default Account
62
-
63
- Empty string `""` means the default account. Always use `""` when the user does not specify an account.
64
-
65
- ---
66
-
67
- ## 2. Transaction Confirmation Protocol
68
-
69
- **Core rule**: NEVER execute an on-chain write without explicit user confirmation.
70
-
71
- ### 2.1 Confirmation Template
72
-
73
- Present a preview table (Operation, Object, Network, Account) with a warning describing what will happen, then ask: "Proceed with execution?"
74
-
75
- ### 2.2 Amount Verification
76
-
77
- - Always display amounts with token symbol (e.g., "10 WOW" not "10000000000").
78
- - Query token decimals first if unsure.
79
-
80
- **Tool**: `query_toolkit` with `query_type: "token_list"`.
81
-
82
- - **Amounts in operations are ALWAYS submitted as U64 integers**. If the user specifies "2 WOW", do NOT submit the string "2 WOW". Instead, calculate and submit `2000000000` (2 × 10^9, where 9 is WOW's decimals).
83
- - **Never assume token decimals**. If the token's decimals cannot be queried, HALT the amount submission and alert the user. Do not proceed with hardcoded or guessed precision.
84
- - Show both raw and human-readable amounts when clarifying with users.
85
-
86
- ### 2.3 Publish Confirmation
87
-
88
- Before publishing a Service or Machine: (1) Export and review — use `guard2file` to export Guard definitions, `machineNode2file` to export Machine nodes; (2) Verify logic — confirm Guards and Machine nodes match user intent; (3) Warn about immutability — once published, many fields become locked. Present a publish confirmation warning listing what becomes immutable, then ask: "This action cannot be easily undone. Proceed?"
89
-
90
- #### 2.3.1 R-M1-11 Pre-Publish Hard Gate (Refund/Deduction Topology)
91
-
92
- For any Machine touching deposits, refunds, escrow, or deductions (rental, freelance milestone, dispute-aware e-commerce), the AI MUST verify R-M1-11 compliance before allowing publish:
93
-
94
- - **Hard blocker**: any node named `deposit_refunded`, `deposit_deducted`, `refunded`, or any name implying the Machine itself performs fund movement.
95
- - **Required pattern**: refund/deduction flows through an **Allocator** triggered by a routing node (e.g., `return_approved`, `damage_confirmed`). The Allocator watches `progress.current == <routing_node>` and executes fund movement.
96
- - **Dispute path**: `arbiter_rule` (routing) → Arbitration off-Machine — no Allocator; arbitration::dispute handles fund distribution.
97
- - **Verification**: review the `machineNode2file` export and grep node names against the forbidden list. If any match, BLOCK publish and alert the user.
98
-
99
- **Why critical**: A refund terminal node without a bound Allocator causes funds to lock permanently in the Order escrow — there is no primitive to move funds out. This was the root cause of P0-01 (Turo deployment: `deposit_refunded` node locked 0.25 WOW customer refunds). See [wowok-machine](../wowok-machine/SKILL.md) "R-M1-11 Anti-Pattern" and [wowok-scenario](../wowok-scenario/SKILL.md) "Rental Mode Template (R-M1-11 Compliant)".
100
-
101
- ---
102
-
103
- ## 3. Common Mistakes to Avoid
104
-
105
- | Mistake | Why It Happens | Prevention |
106
- |---------|---------------|------------|
107
- | **Forgetting no_cache** | Cache lag in dependency chain | Set `env.no_cache: true` on all operations when building multiple objects |
108
- | **Missing permission indices** | Machine forwards reference non-existent indices | Verify Permission object has required indices before creating Machine |
109
- | **R-M1-11 violation** (refund terminal node) | Designing Machine with `deposit_refunded`/`deposit_deducted`/`refunded` nodes implying the Machine refunds — funds lock in escrow with no Allocator path (root cause of P0-01) | Use routing nodes (`return_approved`/`damage_confirmed`/`arbiter_rule`) + bound Allocators; grep `machineNode2file` output for forbidden names BEFORE publish |
110
-
111
- ---
112
-
113
- ## 4. Naming Conventions
114
-
115
- When users request complex systems without naming, propose this scheme:
116
-
117
- ```
118
- <projectPrefix>_<type>_<purpose>_<version>
119
- ```
120
-
121
- | Part | Example | Purpose |
122
- |------|---------|---------|
123
- | Project prefix | `shopFunny_` | Prevents cross-project collisions |
124
- | Type prefix | `machine_`, `guard_`, `service_` | Clarifies object type |
125
- | Purpose suffix | `serviceWithdraw` | Describes function |
126
- | Version suffix | `_v2` | Enables iteration |
127
-
128
- - Always provide `tags` on object creation for filtering and management
129
- - Use short address form (`0x1234...def`); use names as primary identifiers
130
-
131
- ### 4.1 `replaceExistName` Flag
132
-
133
- Controls name collision behavior. **DISCOURAGED** — prefer versioned names (`_v1`, `_v2`).
134
-
135
- | Value | Effect |
136
- |-------|--------|
137
- | `false` (default) | Throws error if name is in use — safe default |
138
- | `true` | Existing object/account with the same name is **suspended** (deactivated) to free the name |
139
-
140
- **Account-specific rules** (stricter than on-chain objects):
141
- - `replaceExistName: true` on the **default account** (`name=''` or omitted) is **FORBIDDEN** — throws error. The default account is unique and cannot be suspended by replacement; use `suspend()` explicitly if needed.
142
- - On non-default account names, `replaceExistName: true` **suspends** the old account (moves to Suspended tab, clears name + messenger). The old account can be reactivated via `resume(address, new_name)`.
143
- - This prevents the "orphan unnamed account" bug where old accounts leaked into the Active list without a name.
144
-
145
- **On-chain objects** (NamedObjectSchema): `replaceExistName: true` steals the name; the old object becomes unnamed (address-only reference). Prefer versioned names for production.
146
-
147
- ---
148
-
149
- ## 5. Network & Token Defaults
150
-
151
- | Parameter | Default Value | Notes |
152
- |-----------|---------------|-------|
153
- | Network | `testnet` | Override via `env.network` |
154
- | Token | `0x2::wow::WOW` | 9 decimals (1 WOW = 1_000_000_000) |
155
-
156
- ### 5.1 Multi-Token Support & Amount Formats
157
-
158
- - **Multi-Token**: All operations support custom `token_type`. ALWAYS query precision via `query_toolkit` with `query_type: "token_list"` first. Never assume decimals.
159
- - **Amount Formats**:
160
- - With unit: `"2WOW"`, `"10.5USDT"` — auto-converted using token precision.
161
- - Plain number: internal unit (e.g., `1000000000` = 1 WOW). Always clarify with users when displaying plain numbers.
162
- - **U64 integers**: Amounts in operations are ALWAYS submitted as U64 integers. If the user specifies "2 WOW", do NOT submit the string "2 WOW" — calculate and submit `2000000000` (2 × 10^9).
163
- - **Never assume token decimals**: If the token's decimals cannot be queried, HALT the amount submission and alert the user.
164
-
165
- ### 5.2 Payment Objects for Commercial Transfers
166
-
167
- Use `Payment` objects for commercial transfers when possible — they offer Guard validation and purpose tracking beyond a simple `account_operation (transfer)`.
168
-
169
- ### 5.3 Cross-Network Switching (testnet → mainnet)
170
-
171
- WoWok objects are network-specific — the same object name resolves to different addresses on testnet vs mainnet. The `local_mark` system manages this mapping automatically.
172
-
173
- **Prerequisites**:
174
- - testnet deployment verified (all objects created, order lifecycle tested)
175
- - Record all object names (query `local_mark_list` for the full list)
176
- - mainnet account has sufficient WOW balance (faucet is testnet-only; use `account_operation transfer` from a funded mainnet account)
177
-
178
- **Switching Steps**:
179
- 1. Change `env.network` from `"testnet"` to `"mainnet"` in all MCP calls
180
- 2. Re-create all objects on mainnet with `replaceExistName: true` (names stay the same, addresses change)
181
- 3. Order matters — follow the dependency chain: Permission → Machine → Guards → Contact → Service → (Order/Progress/Allocation are created at purchase time)
182
- 4. Verify each object creation succeeds and `local_mark` is updated
183
- 5. Test the critical path: place a test order → advance Progress → verify Allocation
184
-
185
- **Key Mechanism**:
186
- ```
187
- testnet: local_mark["my_service"] = 0x867a... (testnet address)
188
- mainnet: local_mark["my_service"] = 0xdef0... (mainnet address, auto-overwritten)
189
- ```
190
- - All object references in Guard tables, Service bindings, and Machine forwards use NAMES (not addresses)
191
- - SDK's `GetObjectExisted()` resolves names to the current network's address at transaction build time
192
- - `replaceExistName: true` ensures the name mapping is overwritten for the new network
193
-
194
- **Important Notes**:
195
- - testnet objects remain on testnet (they don't disappear) — mainnet is a completely fresh deployment
196
- - Guard tables that reference other objects by NAME will auto-resolve to mainnet addresses
197
- - Service.order_allocators and Machine nodes are immutable after publish — verify design before mainnet publish
198
- - mainnet has no faucet — fund accounts via `account_operation` with `transfer` from an existing funded account
199
-
200
- ### 5.4 Publish Pre-Check Checklist
201
-
202
- Before calling `publish: true` on a Service or Machine, verify:
203
-
204
- **Service Publish Checklist**:
205
- - [ ] `order_allocators` is set and design is verified (PERMANENTLY immutable after publish)
206
- - [ ] `machine` is bound and already published
207
- - [ ] `buy_guard` is bound (if purchase validation is needed)
208
- - [ ] `permission` is bound with all required indexes granted
209
- - [ ] If `compensation_fund > 0`: `arbitrations` MUST be bound (contract enforces: `E_ARBITRATION_NOT_SET_WITH_COMPENSATION_FUND`)
210
- - [ ] All Guard names in `order_allocators` resolve correctly
211
- - [ ] All sharing amounts and recipient types (Entity/Signer/GuardIdentifier) are intended
212
- - [ ] Use `dry_run: true` first to simulate the publish transaction
213
-
214
- **Machine Publish Checklist**:
215
- - [ ] All nodes have at least one forward (except terminal nodes)
216
- - [ ] Each forward has `namedOperator` or `permissionIndex` (or both = OR semantic)
217
- - [ ] `namedOperator: ""` means OrderHolder (customer), NOT "anyone"
218
- - [ ] All `permissionIndex` values are granted in the bound Permission object
219
- - [ ] Entry node has `prev_node: ""` and `threshold: 0`
220
- - [ ] Terminal nodes have empty `pairs: []`
221
-
222
- ---
223
-
224
- ## 6. Query-First Pattern
225
-
226
- - **Query before mutate**: Always query current state before modifications.
227
-
228
- **Tool**: `query_toolkit` with appropriate filters.
229
-
230
- - **Pagination**: All on-chain list queries (events, tables, received) support `cursor`/`limit`. Loop for large datasets.
231
- - **Cache control**: Use `no_cache: true` for time-sensitive reads.
232
-
233
- ---
234
-
235
- ## 7. Error Patterns
236
-
237
- | Error | Likely Cause |
238
- |-------|-------------|
239
- | Guard validation failure | After re-submitting with `submission`, Guard logic evaluated to false. Review Guard's rule tree via `guard2file` and submitted data values. |
240
- | File parsing failure | `machineNode2file` or `guard2file` output format error. Check file format and schema compliance. |
241
- | Cache stale reads | Sequential operations fail unexpectedly (e.g., "object not found" when just created). Retry with `env.no_cache: true`. |
242
- | Permission denied | Operating account lacks the required Permission index. Check the object's Permission configuration. |
243
-
244
- ---
245
-
246
- ## 8. Testing & Validation Workflow
247
-
248
- 1. **Design Phase**: Discover available permissions, Guard instructions, and value types via `wowok_buildin_info` (`info: "built-in permissions"` / `"guard instructions"` / `"value types"`).
249
- 2. **Export & Review**: Before publishing, use `guard2file` and `machineNode2file` to export and review definitions.
250
- 3. **Incremental Testing**: Build objects step-by-step, verifying each step.
251
- 4. **Final Validation**: Test all Guard conditions and Machine transitions before publishing.
252
- 5. **Publish**: Only after thorough testing, publish Service and Machine.
253
-
254
- ### 8.1 Value Types — Built-in Type Annotation System
255
-
256
- Every data field in a Guard table or submission carries a `value_type` annotation. Value types matter when: defining Guard table columns, submitting data to Guards, reading `guard2file` exports, and designing query instructions. **String format is recommended** (`"U64"`, `"Address"`, `"VecString"`) for readability; numeric codes (0–18) are accepted but obscure. `Value` (19) is protocol-internal — never use in user-defined Guards. Available types are queried via `wowok_buildin_info` with `info: "value types"`.
257
-
258
- ---
259
-
260
- ## 9. Incremental Object Building
261
-
262
- For complex objects with many fields (Service, Machine), use **incremental building** instead of creating everything in one call:
263
-
264
- - Each step can be verified before proceeding
265
- - Errors are isolated to specific fields
266
- - Easier to retry failed steps without re-executing successful ones
267
- - Better user feedback at each stage
268
-
269
- ---
270
-
271
- ## Schema Reference
272
-
273
- **Related Skills**: [wowok-tools](../wowok-tools/SKILL.md) | [wowok-guard](../wowok-guard/SKILL.md) | [wowok-machine](../wowok-machine/SKILL.md) | [wowok-order](../wowok-order/SKILL.md) | [wowok-provider](../wowok-provider/SKILL.md) | [wowok-arbitrator](../wowok-arbitrator/SKILL.md) | [wowok-messenger](../wowok-messenger/SKILL.md)
274
-
275
- ---
@@ -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