@wowok/skills 1.0.6 → 1.1.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.
Files changed (52) hide show
  1. package/README.md +26 -30
  2. package/dist/cli.js +114 -19
  3. package/dist/cli.js.map +1 -1
  4. package/dist/index.d.ts +1 -1
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +11 -1
  7. package/dist/index.js.map +1 -1
  8. package/dist/skills.d.ts +46 -1
  9. package/dist/skills.d.ts.map +1 -1
  10. package/dist/skills.js +154 -16
  11. package/dist/skills.js.map +1 -1
  12. package/dist/types.d.ts +31 -0
  13. package/dist/types.d.ts.map +1 -1
  14. package/package.json +3 -4
  15. package/scripts/install.js +5 -3
  16. package/wowok-arbitrator/SKILL.md +279 -0
  17. package/wowok-guard/SKILL.md +166 -139
  18. package/wowok-machine/SKILL.md +215 -280
  19. package/wowok-order/SKILL.md +290 -404
  20. package/wowok-provider/SKILL.md +453 -0
  21. package/wowok-safety/SKILL.md +176 -279
  22. package/wowok-tools/SKILL.md +329 -344
  23. package/schemas/onchain_operations/_common.md +0 -236
  24. package/schemas/onchain_operations/_index.md +0 -22
  25. package/schemas/onchain_operations/allocation.md +0 -50
  26. package/schemas/onchain_operations/arbitration.md +0 -95
  27. package/schemas/onchain_operations/contact.md +0 -36
  28. package/schemas/onchain_operations/demand.md +0 -52
  29. package/schemas/onchain_operations/gen_passport.md +0 -43
  30. package/schemas/onchain_operations/guard.md +0 -136
  31. package/schemas/onchain_operations/machine.md +0 -70
  32. package/schemas/onchain_operations/order.md +0 -57
  33. package/schemas/onchain_operations/payment.md +0 -32
  34. package/schemas/onchain_operations/permission.md +0 -57
  35. package/schemas/onchain_operations/personal.md +0 -59
  36. package/schemas/onchain_operations/progress.md +0 -35
  37. package/schemas/onchain_operations/repository.md +0 -81
  38. package/schemas/onchain_operations/reward.md +0 -40
  39. package/schemas/onchain_operations/service.md +0 -104
  40. package/schemas/onchain_operations/treasury.md +0 -74
  41. package/schemas/schema-account_operation.md +0 -402
  42. package/schemas/schema-guard2file.md +0 -153
  43. package/schemas/schema-local_info_operation.md +0 -160
  44. package/schemas/schema-local_mark_operation.md +0 -148
  45. package/schemas/schema-machineNode2file.md +0 -155
  46. package/schemas/schema-messenger_operation.md +0 -547
  47. package/schemas/schema-onchain_events.md +0 -201
  48. package/schemas/schema-onchain_table_data.md +0 -334
  49. package/schemas/schema-query_toolkit.md +0 -375
  50. package/schemas/schema-wip_file.md +0 -240
  51. package/schemas/schema-wowok_buildin_info.md +0 -296
  52. package/wowok-build/SKILL.md +0 -606
@@ -1,98 +1,49 @@
1
- ---
1
+ ---
2
2
  name: wowok-safety
3
3
  description: |
4
- WoWok safety and authorization protocol — ensures AI always obtains user
5
- confirmation before executing irreversible on-chain operations. Covers
6
- amount verification, publish confirmation, critical operation warnings,
7
- and the mandatory two-phase submission pattern.
8
-
9
- This skill is AUTOMATICALLY triggered before any on-chain write operation.
10
- It ensures the AI never executes transactions without explicit user approval.
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.
11
9
  when_to_use:
12
- - AI is about to execute an onchain_operations call with submission
13
- - AI is about to publish a Service or Machine
10
+ - AI is about to execute an on-chain write operation
14
11
  - AI is about to transfer funds or modify financial parameters
15
- - AI is about to delete or irreversibly modify on-chain objects
16
- - User mentions "confirm", "approve", "safe", "warning"
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"
17
15
  always: true
18
16
  ---
19
17
 
20
- # WoWok Safety & Authorization Protocol
21
-
22
- ## Core Safety Principle
23
-
24
- **NEVER execute an on-chain write without explicit user confirmation.**
25
-
26
- WoWok operations involve real blockchain transactions with real economic consequences. The AI MUST always:
27
- 1. Preview what will happen (dry run)
28
- 2. Present the preview clearly to the user
29
- 3. Wait for explicit confirmation
30
- 4. Only then execute
31
-
32
- ## Mandatory Two-Phase Pattern
33
-
34
- ### Phase 1: Dry Run (ALWAYS first)
35
-
36
- ```
37
- onchain_operations({
38
- operation_type: "<type>",
39
- data: { op: "<action>", ... }
40
- // NO submission field → dry run only
41
- })
42
- ```
43
-
44
- The dry run validates parameters, checks permissions, and returns a preview of what will happen. **No state is changed.**
45
-
46
- ### Phase 2: Execute (ONLY after user confirms)
47
-
48
- ```
49
- onchain_operations({
50
- operation_type: "<type>",
51
- data: { op: "<action>", ... },
52
- submission: {
53
- sender: "<account_name>",
54
- gas_budget: "<amount>"
55
- }
56
- })
57
- ```
18
+ # WoWok Safety & Best Practices
58
19
 
59
- ## Critical Operations Requiring Extra Confirmation
20
+ ## 1. Core Principles
60
21
 
61
- ### 🔴 HIGH RISK: Financial Operations
22
+ ### 1.1 Security & Safety
62
23
 
63
- These operations involve real token transfers and MUST be double-confirmed:
24
+ - **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.
25
+ - **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).
64
26
 
65
- | Operation | Risk | Extra Confirmation Required |
66
- |-----------|------|---------------------------|
67
- | `payment` (send coins) | Direct fund transfer | ✅ Show amount, recipient, token type |
68
- | `treasury` (deposit/withdraw) | Team fund changes | ✅ Show amount, operation type |
69
- | `reward` (create/modify) | Incentive pool changes | ✅ Show reward rules, amounts |
70
- | `allocation` (create/modify) | Auto-distribution rules | ✅ Show split percentages, recipients |
71
- | `order` (create/confirm) | Order with payment | ✅ Show price, service, parties |
27
+ ### 1.2 LOCAL vs ON-CHAIN
72
28
 
73
- ### 🟡 MEDIUM RISK: Structural Operations
29
+ | Type | Tools | Gas | Confirmation |
30
+ |------|-------|-----|--------------|
31
+ | **LOCAL ONLY** | `account_operation`, `local_mark_operation`, `local_info_operation` | None | Not needed |
32
+ | **ON-CHAIN** | `onchain_operations`, `messenger_operation` (some ops), `wip_file` (sign) | Yes | Required |
33
+ | **QUERY** | `query_toolkit`, `onchain_table_data`, `onchain_events`, `guard2file`, `machineNode2file` | Read-only | Not needed |
34
+ | **ENCRYPTED** | `messenger_operation` (watch/send messages) | Local encryption | Not needed |
74
35
 
75
- These modify system structure and should be confirmed:
36
+ ### 1.3 Default Account
76
37
 
77
- | Operation | Risk | Confirmation Required |
78
- |-----------|------|----------------------|
79
- | `service` (publish) | Makes service public | ✅ Confirm publish intent |
80
- | `machine` (publish) | Makes workflow public | ✅ Confirm publish intent |
81
- | `guard` (create/modify) | Changes validation rules | ✅ Show Guard logic summary |
82
- | `permission` (modify) | Changes access control | ✅ Show permission changes |
38
+ Empty string `""` means the default account. Always use `""` when the user does not specify an account.
83
39
 
84
- ### 🟢 LOW RISK: Read-Only Operations
40
+ ---
85
41
 
86
- These are always safe and need no confirmation:
87
- - All `query_toolkit` operations
88
- - All `onchain_table_data` operations
89
- - `wowok_buildin_info`
90
- - `documents_and_learn`
91
- - `guard2file`, `machineNode2file` (export only)
42
+ ## 2. Transaction Confirmation Protocol
92
43
 
93
- ## Confirmation Template
44
+ **Core rule**: NEVER execute an on-chain write without explicit user confirmation.
94
45
 
95
- When presenting a dry-run result for confirmation, ALWAYS use this format:
46
+ ### 2.1 Confirmation Template
96
47
 
97
48
  ```
98
49
  📋 **Operation Preview**
@@ -102,280 +53,226 @@ When presenting a dry-run result for confirmation, ALWAYS use this format:
102
53
  | Operation | {operation_type} — {op} |
103
54
  | Object | {object_name} |
104
55
  | Network | {network} |
105
- | Gas Budget | {estimated_gas} |
56
+ | Account | {account} |
106
57
 
107
58
  ⚠️ **This will {describe_what_will_happen}**
108
59
 
109
60
  Proceed with execution?
110
61
  ```
111
62
 
112
- ## Amount Verification Rules
63
+ ### 2.2 Amount Verification
64
+
65
+ - Always display amounts with token symbol (e.g., "10 WOW" not "10000000000").
66
+ - Query token decimals first if unsure.
113
67
 
114
- When an operation involves token amounts:
68
+ **Tool**: `query_toolkit` with `query_type: "token_list"`.
115
69
 
116
- 1. **Always display the amount with token symbol** (not just raw number)
117
- 2. **Query token decimals first** if unsure about precision
118
- ```
119
- query_toolkit({ query_type: "token_list" })
120
- ```
121
- 3. **Show both the raw amount and the human-readable amount**
122
- 4. **For allocations**: Show each recipient's percentage and estimated amount
123
- 5. **For rewards**: Show total pool size and distribution rules
70
+ - **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).
71
+ - **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.
72
+ - Show both raw and human-readable amounts when clarifying with users.
124
73
 
125
- ## Publish Confirmation
74
+ ### 2.3 Publish Confirmation
126
75
 
127
- Publishing a Service or Machine makes it publicly accessible. Before publishing:
76
+ Before publishing a Service or Machine:
128
77
 
129
- 1. **Verify all Guards are correct** — export with `guard2file` and review
130
- 2. **Verify all Machine nodes** — export with `machineNode2file` and review
131
- 3. **Test with dry runs** simulate operations against the unpublished objects
132
- 4. **Confirm the publish intent** — publishing is irreversible in practice
78
+ 1. **Export and review**:
79
+ - Use `guard2file` to export Guard definitions
80
+ - Use `machineNode2file` to export Machine nodes
81
+
82
+ 2. **Verify logic**: Confirm Guards and Machine nodes match user intent
83
+
84
+ 3. **Warn about immutability**: Once published, many fields become locked
133
85
 
134
86
  ```
135
87
  ⚠️ PUBLISH CONFIRMATION REQUIRED
136
88
 
137
89
  You are about to publish:
138
- - Service: {name} ({id})
90
+ - {Service|Machine}: {name}
139
91
  - This will make it publicly accessible on-chain
140
- - Guard rules: {summary}
141
- - Machine workflow: {summary} (if applicable)
92
+ - After publish: {list what becomes immutable}
142
93
 
143
94
  This action cannot be easily undone. Proceed?
144
95
  ```
145
96
 
146
- ## Account Safety
97
+ ---
147
98
 
148
- - **Never create accounts without user request** — `account_operation` with `op: "generate"`
149
- - **Never share private keys or sensitive data** — these are local-only
150
- - **Always confirm which account is being used** as the sender for transactions
151
- - **Check account balance** before operations that require gas
99
+ ## 3. Common Mistakes to Avoid
152
100
 
153
- ## What the AI MUST Do
101
+ | Mistake | Why It Happens | Prevention |
102
+ |---------|---------------|------------|
103
+ | **Forgetting no_cache** | Cache lag in dependency chain | Set `env.no_cache: true` on all operations when building multiple objects |
104
+ | **Missing permission indices** | Machine forwards reference non-existent indices | Verify Permission object has required indices before creating Machine |
154
105
 
155
- 1. ✅ Always dry-run first, show preview
156
- 2. ✅ Always get explicit confirmation before executing
157
- 3. ✅ Always show amounts with token symbols
158
- 4. ✅ Always warn before publishing
159
- 5. ✅ Always confirm the sender account
160
- 6. ✅ Always check for sufficient gas balance
106
+ ---
161
107
 
162
- ## What the AI MUST NOT Do
108
+ ## 4. Naming Conventions
163
109
 
164
- 1. Never execute on-chain writes without user confirmation
165
- 2. ❌ Never skip the dry-run phase
166
- 3. ❌ Never hide or obscure financial amounts
167
- 4. ❌ Never publish without explicit user request
168
- 5. ❌ Never use a different account than what the user specified
169
- 6. ❌ Never proceed if the dry run shows errors
110
+ When users request complex systems without naming, propose this scheme:
170
111
 
171
- ## Real-World Safety Patterns (from tested examples)
112
+ ```
113
+ <projectPrefix>_<type>_<purpose>_<version>
114
+ ```
172
115
 
173
- ### Pattern 1: Dry-Run Before Every Structural Change
116
+ | Part | Example | Purpose |
117
+ |------|---------|---------|
118
+ | Project prefix | `shopFunny_` | Prevents cross-project collisions |
119
+ | Type prefix | `machine_`, `guard_`, `service_` | Clarifies object type |
120
+ | Purpose suffix | `serviceWithdraw` | Describes function |
121
+ | Version suffix | `_v2` | Enables iteration |
174
122
 
175
- **From [Insurance](../examples/Insurance/Insurance.md), [Travel](../examples/Travel/Travel.md), [MyShop Advanced](../examples/MyShop_Advanced/MyShop_Advanced.md)**
123
+ - Always provide `tags` on object creation for filtering and management
124
+ - Use short address form (`0x1234...def`); use names as primary identifiers
176
125
 
177
- Every structural operation in the tested examples follows this exact two-phase pattern:
126
+ ### 4.1 `replaceExistName` Flag
178
127
 
179
- ```
180
- // Phase 1: Validate (no submission → no state change)
181
- onchain_operations({
182
- operation_type: "<type>",
183
- data: { ... },
184
- env: { account: "<name>", network: "testnet" }
185
- })
186
- → Review the returned preview. Check: object IDs, guard logic, amounts.
187
-
188
- // Phase 2: Execute (only after user confirms)
189
- onchain_operations({
190
- operation_type: "<type>",
191
- data: { ... },
192
- env: { account: "<name>", network: "testnet" },
193
- submission: { sender: "<name>", gas_budget: "10000000" }
194
- })
195
- ```
128
+ Controls name collision behavior:
196
129
 
197
- ### Pattern 2: Guard Logic Verification Before Deployment
130
+ | Value | Effect |
131
+ |-------|--------|
132
+ | `false` (default) | Throws error if name is in use — safe default |
133
+ | `true` | Steals name from existing object; old object becomes unnamed |
198
134
 
199
- **From [Insurance](../examples/Insurance/Insurance.md) Time-Lock Guard**
135
+ - Use `true` during development to reuse fixed names without cleanup
136
+ - Default to `false` in production to prevent accidental name hijacking
137
+ - Prefer versioned names (`_v1`, `_v2`) over `replaceExistName` for production
200
138
 
201
- Before deploying a Guard that controls fund release (Payment, Allocation, Reward), ALWAYS:
139
+ ### 4.2 Address Display Rules
202
140
 
203
- 1. Export the Guard for human review:
204
- ```
205
- guard2file({ guard: "insurance_complete_guard_v1", file_path: "./guard_review.json", format: "json" })
206
- ```
207
- 2. Test the Guard logic with `gen_passport`:
208
- ```
209
- onchain_operations({
210
- operation_type: "gen_passport",
211
- data: { guard: "insurance_complete_guard_v1" },
212
- info: { name: "guard_test", b_submission: true }
213
- })
214
- ```
215
- This submits runtime values to the Guard and returns pass/fail — without any state change.
141
+ When displaying an address (0x prefix + 64 hex characters) to the user:
216
142
 
217
- **From [Travel](../examples/Travel/Travel.md) Weather Check Guard**
143
+ 1. **Query local mark first**:
218
144
 
219
- The Travel example demonstrates guard testing with specific runtime values:
220
- - The Guard queries `weather_repo_v2` for a given date
221
- - Test with `gen_passport`, submitting a timestamp that maps to "sunny" → should pass
222
- - Test with a timestamp that maps to "rainy" → should fail
223
- - This validates the Guard BEFORE it protects real funds in an Allocation
145
+ **Tool**: `query_toolkit` with `query_type: "local_mark_list"` and filter by address.
224
146
 
225
- **From [MyShop Advanced](../examples/MyShop_Advanced/MyShop_Advanced.md) Service Guard Testing**
147
+ 2. **Display format**:
148
+ - If local mark exists: `{name} ({short_address})`
149
+ - If no local mark: `{first8}...{last3}` (e.g., `0x3a2f8e1...8c1`)
226
150
 
227
- Service-level Guards (`service_merchant_win_v2`, `service_customer_win_v2`) control fund allocation. Before binding these to `order_allocators`:
228
- 1. Export each Guard with `guard2file`
229
- 2. Test with `gen_passport`, submitting mock order progress data
230
- 3. Verify: correct node → pass, wrong node → fail
231
- 4. Only then bind to Service's `order_allocators`
151
+ 3. **Short address format**: Include `0x` prefix, take first 8 chars + `...` + last 3 chars
232
152
 
233
- ### Pattern 3: Publish-Immutability Checklist
153
+ ---
234
154
 
235
- **From [MyShop Advanced](../examples/MyShop_Advanced/MyShop_Advanced.md) Build Order Rationale**
155
+ ## 5. Network & Token Defaults
236
156
 
237
- Before any publish operation, verify this checklist:
157
+ | Parameter | Default Value | Notes |
158
+ |-----------|---------------|-------|
159
+ | Network | `testnet` | Override via `env.network` |
160
+ | Token | `0x2::wow::WOW` | 9 decimals (1 WOW = 1_000_000_000) |
238
161
 
239
- ```
240
- PUBLISH CHECKLIST
241
- ├─ Machine publish:
242
- │ ├─ ✅ All nodes defined and reviewed (machineNode2file)
243
- │ ├─ ✅ All forward guards created and tested (gen_passport)
244
- │ ├─ ✅ Permission indexes assigned to correct accounts
245
- │ └─ ⚠️ After publish: nodes become IMMUTABLE
246
-
247
- ├─ Service publish:
248
- │ ├─ ✅ Machine bound to Service (machine field set)
249
- │ ├─ ✅ Allocation rules finalized (order_allocators)
250
- │ ├─ ✅ Sales/products defined (sales)
251
- │ ├─ ✅ Guards tested (buy_guard, sell_guard)
252
- │ └─ ⚠️ After publish: machine + allocation LOCKED
253
-
254
- └─ Reward (post-publish):
255
- └─ ✅ Can be added after Service publish (not locked)
256
- ```
162
+ ### 5.1 Multi-Token Support & Amount Formats
257
163
 
258
- ### Pattern 4: Multi-Provider Coordination Safety
164
+ - **Multi-Token**: All operations support custom `token_type`. ALWAYS query precision via `query_toolkit` with `query_type: "token_list"` first. Never assume decimals.
165
+ - **Amount Formats**:
166
+ - With unit: `"2WOW"`, `"10.5USDT"` — auto-converted using token precision.
167
+ - Plain number: internal unit (e.g., `1000000000` = 1 WOW). Always clarify with users when displaying plain numbers.
168
+ - **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).
169
+ - **Never assume token decimals**: If the token's decimals cannot be queried, HALT the amount submission and alert the user.
259
170
 
260
- **From [Travel](../examples/Travel/Travel.md) Two-Provider System**
171
+ ### 5.2 Payment Objects for Commercial Transfers
261
172
 
262
- When building a system that spans multiple accounts/providers:
173
+ Use `Payment` objects for commercial transfers when possible — they offer Guard validation and purpose tracking beyond a simple `account_operation (transfer)`.
263
174
 
264
- 1. **Each provider uses their own account** for operations on their own objects
265
- - `weather_provider_v1` creates and manages `weather_repo_v2`
266
- - `travel_provider_v1` creates and manages `travel_service_v1`
175
+ ---
267
176
 
268
- 2. **Cross-provider references use names, not raw addresses**
269
- - The weather check Guard references `"weather_repo_v2"` by name
270
- - The MCP server resolves names to addresses automatically
177
+ ## 6. Query-First Pattern
271
178
 
272
- 3. **Data providers build their objects BEFORE consumers**
273
- - Weather Repository + data exists before the Guard that queries it
274
- - Insurance Service exists before Travel creates sub-orders on it
179
+ - **Query before mutate**: Always query current state before modifications.
275
180
 
276
- ### Pattern 5: Amount Verification for Financial Operations
181
+ **Tool**: `query_toolkit` with appropriate filters.
277
182
 
278
- **From all examples Payment, Order, Allocation operations**
183
+ - **Pagination**: All on-chain list queries (events, tables, received) support `cursor`/`limit`. Loop for large datasets.
184
+ - **Cache control**: Use `no_cache: true` for time-sensitive reads.
279
185
 
280
- All financial operations in the tested examples follow these conventions:
186
+ ---
281
187
 
282
- | Operation | Amount Format | Verification |
283
- |-----------|--------------|-------------|
284
- | `service.sales[].price` | Raw integer (smallest unit) | Verify with: `wowok_buildin_info({ info_type: "token_list" })` |
285
- | `order.buy.total_pay.balance` | Raw integer | Confirm matches sales price × quantity |
286
- | `reward.coin_add` | Raw integer | Confirm pool size against expected payouts |
287
- | `allocation.sharing[].sharing` | Integer (Rate mode: basis points) | 10000 = 100%, 500 = 5% |
188
+ ## 7. Name Resolution & Display
288
189
 
289
- **From [Insurance](../examples/Insurance/Insurance.md):**
290
- ```
291
- sales: [{ name: "Outdoor Accident Insurance", price: 100000000, stock: 1000 }]
292
- // 100000000 = 1 WOW (if 1 WOW = 10^8 smallest units)
293
- ```
190
+ ### 7.1 Name Resolution Priority
191
+
192
+ | Priority | Source | Display Format | Example |
193
+ |----------|--------|----------------|---------|
194
+ | 1 (Highest) | `local_mark_operation` | `{local_mark_name} (localmark)` | `my_service (localmark)` |
195
+ | 2 | `account_operation` (account name) | `{account_name}` | `alice_wallet` |
196
+ | 3 (Fallback) | None / Unnamed | `{first6}...{last3}` | `0x3a2f...8c1` |
197
+
198
+ ### 7.2 Address Resolution & Display Format
199
+
200
+ **Resolve addresses to names** via `query_toolkit`:
201
+
202
+ **Tool**: `query_toolkit` with `query_type: "local_names"` and `addresses` array parameter.
203
+
204
+ - Each address must be a valid WOW ID: `0x` prefix + **64 hex characters**.
205
+ - Returns resolved account name and/or local mark name for each address.
206
+ - Name priority follows [7.1](#71-name-resolution-priority): `local_mark` > `account`.
207
+
208
+ **Address truncation** (for display):
294
209
 
295
- **From [MyShop Advanced](../examples/MyShop_Advanced/MyShop_Advanced.md):**
296
210
  ```
297
- order_allocators.allocators[].sharing: { sharing: 10000, mode: "Rate" }
298
- // 10000 in Rate mode = 100% allocation
211
+ {first_6_chars}...{last_3_chars}
299
212
  ```
300
213
 
301
- ### Pattern 6: no_cache After Creation
214
+ - Include the `0x` prefix in the character count.
215
+ - Use exactly **three dots** (`...`) as the separator.
216
+ - Example: `0x3a2f...8c1`
302
217
 
303
- **From [MyShop Advanced Test Results](../examples/MyShop_Advanced/MyShop_Advanced_MerchantSystem_TestResults.md)**
218
+ **Combined display**: human-readable name + truncated address in parentheses.
304
219
 
305
- When querying an object immediately after creating it, always use `no_cache: true`:
220
+ | Name Source | Display Format | Example |
221
+ |-------------|----------------|---------|
222
+ | local_mark | `{local_mark} ({first6}...{last3})` | `my_service (0x3a2f...8c1)` |
223
+ | account | `{account_name} ({first6}...{last3})` | `alice_wallet (0x3a2f...8c1)` |
224
+ | none (fallback) | `{first6}...{last3}` | `0x3a2f...8c1` |
306
225
 
307
- ```
308
- // After creating a Permission:
309
- onchain_operations({ operation_type: "permission", data: { object: { name: "myshop_permission_v2", ... } }, env: { ... } })
226
+ ---
310
227
 
311
- // Query it — must bypass cache:
312
- query_toolkit({ query_type: "onchain_objects", objects: ["myshop_permission_v2"], no_cache: true })
313
- ```
228
+ ## 8. Error Patterns
314
229
 
315
- Without `no_cache: true`, the query may return stale data (object not found), causing the AI to incorrectly conclude the creation failed.
230
+ | Error | Likely Cause |
231
+ |-------|-------------|
232
+ | Guard validation failure | After re-submitting with `submission`, Guard logic evaluated to false. Review Guard's rule tree via `guard2file` and submitted data values. |
233
+ | File parsing failure | `machineNode2file` or `guard2file` output format error. Check file format and schema compliance. |
234
+ | Cache stale reads | Sequential operations fail unexpectedly (e.g., "object not found" when just created). Retry with `env.no_cache: true`. |
235
+ | Permission denied | Operating account lacks the required Permission index. Check the object's Permission configuration. |
316
236
 
317
- ### Pattern 7: replaceExistName for Development Iterations
237
+ ---
318
238
 
319
- **From all examples object naming convention**
239
+ ## 9. Testing & Validation Workflow
320
240
 
321
- During development, when iterating on object designs, use `replaceExistName: true` to overwrite previous versions:
241
+ 1. **Design Phase**: Use `wowok_buildin_info` to discover available permissions and Guard instructions
322
242
 
323
- ```
324
- data: {
325
- object: { name: "myshop_permission_v2", replaceExistName: true, ... }
326
- }
327
- ```
243
+ **Tool**: `wowok_buildin_info` with `info_type: "permissions"` or `info_type: "guard_instructions"`.
328
244
 
329
- ⚠️ **Safety note**: `replaceExistName: true` destroys the previous object with that name. Only use during development. In production, use versioned names (`_v1`, `_v2`, `_v3`).
245
+ 2. **Export & Review**: Before publishing, use `guard2file` and `machineNode2file` to export and review definitions
330
246
 
331
- ### Pattern 8: Machine Creation Order Nodes First, Then Publish
247
+ 3. **Incremental Testing**: Build objects step-by-step, verifying each step
332
248
 
333
- **From [Insurance](../examples/Insurance/Insurance.md) Key Discovery**
249
+ 4. **Final Validation**: Test all Guard conditions and Machine transitions before publishing
334
250
 
335
- The Insurance example documents a critical finding: Machine nodes must be added during creation (same transaction) before publishing. Adding nodes in separate transactions after creation may not persist correctly.
251
+ 5. **Publish**: Only after thorough testing, publish Service and Machine
336
252
 
337
- ✅ **Correct** (single transaction):
338
- ```
339
- onchain_operations({
340
- operation_type: "machine",
341
- data: {
342
- object: { name: "insurance_machine_v1", permission: "..." },
343
- node: { op: "add", nodes: [...] }, // nodes in same call
344
- publish: true // publish in same call
345
- }
346
- })
347
- ```
253
+ ---
348
254
 
349
- **Incorrect** (separate transactions):
350
- ```
351
- // Step 1: Create machine (no nodes)
352
- onchain_operations({ operation_type: "machine", data: { object: {...} } })
353
- // Step 2: Add nodes (may not persist)
354
- onchain_operations({ operation_type: "machine", data: { object: "...", node: { op: "add", nodes: [...] } } })
355
- // Step 3: Publish
356
- onchain_operations({ operation_type: "machine", data: { object: "...", publish: true } })
357
- ```
255
+ ## 10. Incremental Object Building
358
256
 
359
- ## Safety Decision Tree for On-Chain Operations
257
+ For complex objects with many fields (Service, Machine), use **incremental building** instead of creating everything in one call:
360
258
 
361
- ```
362
- About to execute onchain_operations?
363
- ├─ Is this a READ operation? (query_toolkit, onchain_table_data, etc.)
364
- │ └─ SAFE proceed without confirmation
365
-
366
- ├─ Is this a WRITE operation? (onchain_operations with submission)
367
- │ ├─ Does it involve money? (payment, reward, treasury, allocation)
368
- │ │ └─ 🔴 HIGH RISK — must show amounts + token type + recipient + get double confirmation
369
- │ │
370
- │ ├─ Does it publish something? (service.publish, machine.publish)
371
- │ │ └─ 🟡 MEDIUM RISK — must show what will be locked + get confirmation
372
- │ │
373
- │ ├─ Does it modify guards/permissions? (guard, permission)
374
- │ │ └─ 🟡 MEDIUM RISK must explain what access changes + get confirmation
375
- │ │
376
- │ └─ Is it a structural change? (service.update, machine.node)
377
- │ └─ 🟢 LOW-MEDIUM — show what changes + get confirmation
378
-
379
- └─ Is this a DRY RUN? (no submission field)
380
- └─ SAFE no state change, but still review the preview for errors
381
- ```
259
+ - Each step can be verified before proceeding
260
+ - Errors are isolated to specific fields
261
+ - Easier to retry failed steps without re-executing successful ones
262
+ - Better user feedback at each stage
263
+
264
+ ---
265
+
266
+ ## Schema Reference
267
+
268
+ | Purpose | Schema Name |
269
+ |---------|-------------|
270
+ | Query toolkit | `query_toolkit` |
271
+ | Token list | `query_toolkit` with `query_type: "token_list"` |
272
+ | Guard export | `guard2file` |
273
+ | Machine export | `machineNode2file` |
274
+ | Build-in info | `wowok_buildin_info` |
275
+
276
+ **Query Schema**: `schema_query({ action: "get", name: "<schema_name>" })`
277
+
278
+ **Related Skills**: [wowok-tools](../wowok-tools/SKILL.md) | [wowok-guard](../wowok-guard/SKILL.md) | [wowok-machine](../wowok-machine/SKILL.md)