@wowok/skills 2.0.1 → 2.1.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.
@@ -14,38 +14,24 @@ when_to_use:
14
14
 
15
15
  # WoWok Customer Guide
16
16
 
17
- > **Role**: Customer (Buyer/Order Holder)
18
- > **Provider Guide**: [wowok-provider](../wowok-provider/SKILL.md) | **Arbitration Guide**: [wowok-arbitrator](../wowok-arbitrator/SKILL.md) | **Machine**: [wowok-machine](../wowok-machine/SKILL.md) | **Messenger**: [wowok-messenger](../wowok-messenger/SKILL.md)
19
- > Guard design patterns, safety rules, and tool references now live in the MCP knowledge layer — query via `schema_query` actions `get_guard_design_patterns`, `get_safety_rules`, `get_tool_reference`.
17
+ > **Role**: Customer (Buyer/Order Holder)
18
+ > **Guides**: [wowok-provider](../wowok-provider/SKILL.md) · [wowok-arbitrator](../wowok-arbitrator/SKILL.md) · [wowok-machine](../wowok-machine/SKILL.md) · [wowok-messenger](../wowok-messenger/SKILL.md)
19
+ > Guard patterns / safety rules / tool references live in the MCP knowledge layer — query via `schema_query` (`get_guard_design_patterns`, `get_safety_rules`, `get_tool_reference`).
20
20
 
21
21
  ---
22
22
 
23
23
  ## Core Concepts (Design Invariants Not in Schema)
24
24
 
25
- ### Object Relationships
26
-
27
- Purchase creates three objects: **Order** (fund escrow, you are `builder`), **Progress** (Machine node tracker), **Allocation** (fund distribution engine). Only `builder` withdraws funds. Agents may operate but never access funds.
28
-
29
- ### The No-Bypass Rule
30
-
31
- A forward with `namedOperator === ""` signals "user-operable". **However**: if that forward also binds a Guard, passport verification is mandatory and **cannot be bypassed**. `order.next` fails without validated passport. This is a protocol invariant.
32
-
33
- ### Weight Accumulation
34
-
35
- Each forward contributes `weight` toward a node's `threshold`. `weight ≥ threshold` → one operation suffices. Multi-forward nodes may require cumulative multi-party contributions. Parse the `machineNode2file` JSON output; never query node-by-node.
36
-
37
- ### Allocation Triggers
38
-
39
- Allocation evaluates when Progress reaches **any** configured node (not just exit nodes). The winning Allocator is the first whose Guard returns `true`. Rules are immutable after Service publish — both parties see identical conditions.
25
+ - **Objects**: Purchase creates **Order** (fund escrow, you are `builder`), **Progress** (Machine node tracker), **Allocation** (fund distribution). Only `builder` withdraws; agents operate but never access funds.
26
+ - **No-Bypass Rule**: A forward with `namedOperator === ""` is "user-operable", but if it also binds a Guard, passport verification is mandatory and cannot be bypassed (`order.next` fails without validated passport).
27
+ - **Weight Accumulation**: Each forward contributes `weight` toward a node's `threshold`; `weight ≥ threshold` → one operation suffices. Parse `machineNode2file` JSON; never query node-by-node.
28
+ - **Allocation Triggers**: Allocation evaluates when Progress reaches **any** configured node (not just exit nodes). Winning Allocator = first whose Guard returns `true`. Rules immutable after publish.
40
29
 
41
30
  ---
42
31
 
43
32
  ## Phase 1: Pre-Purchase Due Diligence (MANDATORY GATE)
44
33
 
45
- > **⛔ Complete E1-E11 in order. User must explicitly confirm every item.**
46
- > **⚠️ = explain risk, wait for decision. 🔴 = strongly advise against purchase.**
47
-
48
- ---
34
+ > **⛔ Complete E1-E11 in order; user must confirm every item.** **⚠️** = explain risk, wait. **🔴** = strongly advise against.
49
35
 
50
36
  ### E1 — Service Basic Status
51
37
 
@@ -55,52 +41,35 @@ Query `query_toolkit` → `onchain_objects` for `<service_name_or_id>`. Save: `b
55
41
  - `bPaused === true` → 🔴 **ABORT**
56
42
  - OK → E2
57
43
 
58
- ---
59
-
60
44
  ### E2 — Product & WIP Verification
61
45
 
62
- From E1 `sales[]`. Skip `suspension === true` items.
63
-
64
- **WIP Verification** (mandatory when `wip_hash` non-empty):
46
+ From E1 `sales[]`; skip `suspension === true`. Verify WIP (mandatory when `wip_hash` non-empty): `wip_file` → `type: "verify"`, `wipFilePath: "<wip_url>"`, `hash_equal: "<wip_hash>"`.
65
47
 
66
- Use `wip_file` → `type: "verify"`, `wipFilePath: "<wip_url>"`, `hash_equal: "<wip_hash>"`.
67
-
68
- - `wip_hash` empty → no on-chain commitment (auto-verified, weaker evidence)
48
+ - `wip_hash` empty → no on-chain commitment (weaker evidence)
69
49
  - Verification fails → 🔴 **WIP tampered after publish**
70
50
  - No `wip` URL → ⚠️ No product evidence
71
- - Verified → E3
72
-
73
- ---
74
51
 
75
52
  ### E3 — Machine Workflow Analysis (CORE)
76
53
 
77
- **Step 1**: `query_toolkit` → `onchain_objects` for `<machine_id>`. Fail if `bPublished === false` or `bPaused === true`.
78
-
79
- **Step 1b (entry-node forward check)**: In the exported Machine JSON, verify the entry node (`prev_node: ""`) has ≥1 forward. If empty, Progress will be permanently stuck at `current=""` — flag as 🔴 BLOCKER. (New Machines are schema-blocked from this, but legacy Machines may still have it.)
54
+ 1. `query_toolkit` → `onchain_objects` for `<machine_id>`; fail if `bPublished === false` or `bPaused === true`.
55
+ 2. Entry-node check: entry node (`prev_node: ""`) must have ≥1 forward, else Progress stuck at `current=""` → 🔴 BLOCKER.
56
+ 3. `machineNode2file` → export full Machine JSON (parse locally; see [wowok-machine](../wowok-machine/SKILL.md)).
80
57
 
81
- **Step 2**: `machineNode2file` → export the complete Machine JSON. Contains all nodes and forwards — parse locally, never node-by-node. Machine structure: see [wowok-machine](../wowok-machine/SKILL.md).
82
-
83
- **Step 3: Classify every forward**:
58
+ **Classify every forward**:
84
59
 
85
60
  | `namedOperator` | `guard` | User Can Execute? | Operation Path |
86
61
  |-----------------|---------|-------------------|----------------|
87
- | `Some("")` | `None` | ✅ Independently | **`order.progress`** (uses `order.has_op_permission`) |
88
- | `Some("")` | `Some({...})` | ⚠️ Need Guard passport — **no bypass** | **`order.progress`** + Passport |
89
- | `None` | Any | ❌ Provider/permission-holder only | `progress.operate` (provider path) |
90
- | `Some("<other>")` | Any | ❌ Named operator required | `progress.operate` (named operator path) |
91
-
92
- > **⚠ CRITICAL ROUTING RULE**: When `namedOperator=""` (empty string = OrderHolder), you MUST use `order.progress` (NOT `progress.operate`). Direct `progress::next` will abort with "Permission denied" (code 5) because the Progress-level permission check does not recognize the OrderHolder short-circuit. The empty-string `namedOperator` is set automatically by `service::buy` when an Order is created — the customer (order.builder) becomes the operator for the `""` namespace. In ALL other cases (non-empty `namedOperator` or `permissionIndex`-only), use `progress.operate` on the Progress object directly.
62
+ | `Some("")` | `None` | ✅ Independently | `order.progress` |
63
+ | `Some("")` | `Some({...})` | ⚠️ Guard passport (no bypass) | `order.progress` + Passport |
64
+ | `None` | Any | ❌ Provider/permission-holder | `progress.operate` |
65
+ | `Some("<other>")` | Any | ❌ Named operator | `progress.operate` |
93
66
 
94
- **Step 4: Detect paths**:
95
- - Terminal nodes (no outgoing forwards) → order ends
96
- - Refund paths → lead to 100%→Order Allocator (cross-check E5)
97
- - Arbitration paths → lead to arbitration nodes
98
- - User-blocked paths → all forwards require `namedOperator ≠ ""`
67
+ > **⚠ ROUTING RULE**: `namedOperator=""` (OrderHolder) → use `order.progress` (NOT `progress.operate`); `progress::next` aborts "Permission denied" (code 5) because Progress-level checks don't recognize the OrderHolder short-circuit. The `""` operator is set by `service::buy` (customer = operator). All other cases (non-empty `namedOperator` or `permissionIndex`) → `progress.operate`.
99
68
 
100
- **Risk Rules**:
69
+ **Detect paths**: terminal (no outgoing) → order ends; refund → 100%→Order Allocator (E5); arbitration → arb nodes; user-blocked → all forwards `namedOperator ≠ ""`.
101
70
 
102
- | Signal | Level |
103
- |--------|-------|
71
+ | Risk Signal | Level |
72
+ |-------------|-------|
104
73
  | No user-operable path from critical node | 🔴 Stuck unless provider acts |
105
74
  | No refund path | 🔴 No fund recovery |
106
75
  | No arbitration path | 🔴 No recourse |
@@ -109,35 +78,21 @@ Use `wip_file` → `type: "verify"`, `wipFilePath: "<wip_url>"`, `hash_equal: "<
109
78
 
110
79
  > **🔴 "No refund" + "No arbitration" → strongly advise against purchase.**
111
80
 
112
- ---
113
-
114
81
  ### E4 — Guards Analysis
115
82
 
116
- Guard structure and instruction reference: MCP `schema_query` action='get_guard_design_patterns' (design patterns) and action='get_guard_templates' (ready-made templates).
117
-
118
- **Step 1**: Collect unique Guard IDs from E3 Machine JSON (`forward.guard.guard`), E1 `order_allocators`, E1 `buy_guard`. Deduplicate.
119
-
120
- **Step 2**: `guard2file` → export each unique Guard as JSON. Skip duplicates (same address = same Guard).
121
-
122
- **Step 3**: `wowok_buildin_info` → `info: "guard instructions"` for instruction reference.
123
-
124
- **Step 4**: For each exported Guard file, classify:
83
+ Guard structure/instructions: `schema_query` action='get_guard_design_patterns' + action='get_guard_templates'. Steps: (1) collect unique Guard IDs from E3 `forward.guard.guard` + E1 `order_allocators` + `buy_guard`, dedupe; (2) `guard2file` export each; (3) `wowok_buildin_info` → `info: "guard instructions"`; (4) classify:
125
84
 
126
85
  | Level | Criteria | Action |
127
86
  |-------|----------|--------|
128
87
  | 🟢 Simple | Clear purpose, few conditions | Explain |
129
88
  | 🟡 Complex | Multi-layer, intent clear | Explain step-by-step |
130
- | 🔴 Ambiguous | Unclear logic or dependencies | **Warn. Never speculate. User must review file.** |
89
+ | 🔴 Ambiguous | Unclear logic/dependencies | **Warn. Never speculate. User must review file.** |
131
90
 
132
91
  > **⛔ Never invent Guard logic. Prioritize Guards gating user-operable forwards and refund allocators.**
133
92
 
134
- ---
135
-
136
93
  ### E5 — Fund Allocation Rules
137
94
 
138
- From E1 `order_allocators.allocators[]`. For each Allocator: cross-reference Guard (E4) → trigger condition; map to Machine node (E3) → when it fires; present distribution outcome.
139
-
140
- **Risk Rules**:
95
+ From E1 `order_allocators.allocators[]`: cross-ref Guard (E4) → trigger; map to Machine node (E3) → when fires; present outcome.
141
96
 
142
97
  | Check | Risk |
143
98
  |-------|------|
@@ -146,22 +101,16 @@ From E1 `order_allocators.allocators[]`. For each Allocator: cross-reference Gua
146
101
  | Triggers only on provider-only paths | ⚠️ Unilateral collection |
147
102
  | No allocators on user-operable paths | ⚠️ No financial control |
148
103
 
149
- > **Key safeguard**: 100%→Order Allocator on a user-operable forward.
150
-
151
- ---
104
+ > **Safeguard**: 100%→Order Allocator on a user-operable forward.
152
105
 
153
106
  ### E6 — Arbitration Availability
154
107
 
155
- Batch query E1 `arbitrations[]` via `onchain_objects`. Arb process: [wowok-arbitrator](../wowok-arbitrator/SKILL.md).
156
-
157
- Also: `onchain_events` → `type: "ArbEvent"`, `limit: 20`, filter for these Arb IDs.
108
+ Batch query E1 `arbitrations[]` via `onchain_objects` (process: [wowok-arbitrator](../wowok-arbitrator/SKILL.md)). Also `onchain_events` → `type: "ArbEvent"`, `limit: 20`, filter those Arb IDs.
158
109
 
159
110
  - `arbitrations[]` empty → 🔴 no recourse
160
111
  - Any Arb `bPaused === true` → 🔴 unavailable
161
112
  - High `fee` / closed `voting_guard` / no history → ⚠️
162
113
 
163
- ---
164
-
165
114
  ### E7 — Compensation Fund
166
115
 
167
116
  From E1: `compensation_fund`, `compensation_lock_duration`.
@@ -169,8 +118,6 @@ From E1: `compensation_fund`, `compensation_lock_duration`.
169
118
  - Balance < planned order amount → ⚠️ may not cover award
170
119
  - Lock near expiry → ⚠️ provider may withdraw
171
120
 
172
- ---
173
-
174
121
  ### E8 — Contact Channel
175
122
 
176
123
  Query `onchain_objects` for E1 `um` ID.
@@ -179,61 +126,48 @@ Query `onchain_objects` for E1 `um` ID.
179
126
  - `ims[]` empty → 🔴 **No Messenger**
180
127
  - Has active `ims[]` → E9
181
128
 
182
- ---
183
-
184
129
  ### E9 — Chain Reputation
185
130
 
186
- **Sentiment**: `query_toolkit` → `onchain_table_item_entity_linker` for provider address. Compute likes/dislikes ratio from `votes[]`.
187
-
188
- **Orders**: Batch query `votes[].address` via `onchain_objects` (50/batch, max 200). Filter Order-type objects where `service` matches. Aggregate dispute rate (`dispute ≠ []` / total) and repeat buyer ratio.
189
-
190
- - Dispute rate >10% → ⚠️
191
-
192
- ---
131
+ Sentiment: `query_toolkit` → `onchain_table_item_entity_linker` for provider; compute likes/dislikes from `votes[]`. Orders: batch query `votes[].address` via `onchain_objects` (50/batch, max 200), filter `service` match; aggregate dispute rate (`dispute ≠ []` / total) + repeat-buyer ratio. Dispute rate >10% → ⚠️.
193
132
 
194
- ### E10 — Privacy Information Matching
133
+ ### E10 — Privacy Information Matching (LocalInfo reuse)
195
134
 
196
- From E1 `customer_required[]`. Check locally via `query_toolkit` → `local_info_list`. Match against local `name` fields.
135
+ From E1 `customer_required[]` (e.g. `["name", "phone", "shipping_address"]`). Reuse locally-stored private info so the user never re-types it:
197
136
 
198
- > **⛔ Never send private info without explicit user confirmation per item.**
137
+ 1. `query_toolkit` → `query_type: "local_info_list"` to list stored private info (each `name` → `default` + optional `contents`).
138
+ 2. Match each `customer_required` name against a local `name` (case-insensitive):
139
+ - **Matched** → auto-fill the `default`; confirm "use this?" and offer any `contents` alternatives.
140
+ - **Missing** → ask the user for the value.
141
+ 3. **Save** any newly-provided value via `local_info_operation` → `add: { op: "add", data: [{ name, default }] }` (100% local, never on-chain).
199
142
 
200
- For matched: present value, ask "correct?" and "OK to send?". For missing: ask user to provide. Transmission: **Messenger only** (Phase 2), never on-chain.
201
-
202
- ---
143
+ > **⛔ Never send private info without explicit user confirmation per item.** Transmission: **Messenger only** (Phase 2), never on-chain.
203
144
 
204
145
  ### E11 — Trust Score Synthesis (Preorder Advice)
205
146
 
206
- Aggregate E1–E10 into a decision-grade assessment via `trust_score`:
207
-
208
- `wowok({ tool: "trust_score", data: { service: "<service_id>", depth: "preorder", order_amount: "<planned_amount>" } })`
147
+ `wowok({ tool: "trust_score", data: { service: "<service_id>", depth: "preorder", order_amount: "<planned_amount>" } })`.
209
148
 
210
149
  - Returns trust score + per-dimension risks + preorder advice (order confidence, game strategies, preference match, industry risks, `blocking_reminders`); non-empty `blocking_reminders` → ⛔ resolve with user BEFORE Phase 2.
211
- - Comparing multiple candidates → add `compare_with: ["<id2>", ...]` (1–9, same `depth: "preorder"`): output gains a `comparison` block with per-metric bests — **NO overall ranking**; present trade-offs, the buyer decides.
212
- - Optional `preferences` / `user_metrics` reflect the buyer's own priorities.
213
-
214
- > Fast pre-screen: at E1 you may call `depth: "evaluate"` (default) for a quick score; 🔴 `risk_score` (<50) → advise early abort, skip E2–E10.
215
-
216
- ---
150
+ - Compare candidates: `compare_with: ["<id2>", ...]` (1–9, same `depth: "preorder"`) → gains `comparison` block with per-metric bests, **NO overall ranking** (buyer decides).
151
+ - Optional `preferences` / `user_metrics` reflect the buyer's priorities.
152
+ - Fast pre-screen at E1: `depth: "evaluate"` (default); 🔴 `risk_score` <50 → advise early abort, skip E2–E10.
217
153
 
218
154
  ### Pre-Purchase GATE
219
155
 
220
- **Abort conditions**: E1 `bPublished=false`/`bPaused=true` → ABORT; E8 `um=null` → ABORT; E3 no-refund + E6 no-arb → strongly advise ABORT; E4 ambiguous Guards → user MUST manually review; E11 `blocking_reminders` → resolve with user BEFORE proceeding.
221
-
222
- **Any ⚠️** → explain risk, wait for user decision. **All OK** → Phase 2.
156
+ **Abort**: E1 `bPublished=false`/`bPaused=true`; E8 `um=null`; E3 no-refund + E6 no-arb → strongly advise ABORT; E4 ambiguous Guards → user must review; E11 `blocking_reminders` → resolve. **Any ⚠️** → explain + wait. **All OK** → Phase 2.
223
157
 
224
158
  ---
225
159
 
226
160
  ## Phase 2: Consensus Building
227
161
 
228
- Consensus foundation: immutable on-chain rules (Phase 1). Messenger: encrypted, self-verifiable supplement — clarifies, cannot override on-chain. Full operations: [wowok-messenger](../wowok-messenger/SKILL.md).
162
+ Foundation = immutable on-chain rules (Phase 1). Messenger = encrypted, self-verifiable supplement (clarifies, cannot override on-chain). Full ops: [wowok-messenger](../wowok-messenger/SKILL.md).
229
163
 
230
164
  ### 2.1 Send Privacy Info
231
165
 
232
- Contact `ims[]` from E8. Send E10 info via `messenger_operation` → `send_message`. **Messenger only — never on-chain.** Get explicit user confirmation per item.
166
+ Contact `ims[]` from E8. Send E10 info via `messenger_operation` → `send_message`. **Messenger only — never on-chain.** Explicit user confirmation per item. After sending, persist any newly-provided value via `local_info_operation` `add` (so future orders auto-fill).
233
167
 
234
168
  ### 2.2 Negotiate
235
169
 
236
- Clarify via Messenger: deliverables (E2 WIP), timeline (E3 nodes), refund/cancellation (E3/E5), privacy info received (E10). Evidence value requires recipient **explicit confirmation** (ARK signature). WTS evidence: [wowok-messenger](../wowok-messenger/SKILL.md).
170
+ Clarify via Messenger: deliverables (E2 WIP), timeline (E3 nodes), refund/cancellation (E3/E5), privacy received (E10). Evidence value requires recipient **explicit confirmation** (ARK signature). WTS evidence: [wowok-messenger](../wowok-messenger/SKILL.md).
237
171
 
238
172
  ### 2.3 Consensus GATE
239
173
 
@@ -245,11 +179,7 @@ Clarify via Messenger: deliverables (E2 WIP), timeline (E3 nodes), refund/cancel
245
179
 
246
180
  ## Phase 3: Order Creation
247
181
 
248
- **Not in schema**:
249
- - Excess `buy.total_pay` auto-refunded. Agents cannot withdraw.
250
- - Discounts: query `onchain_received` (type `0x2::service::Discount`), filter by `service`, validate time/benchmark. Rate: `total_pay × (off / 10000)`. Fixed: `min(off, total_pay)`.
251
-
252
- Post-creation: notify via Messenger with order ID.
182
+ Not in schema: excess `buy.total_pay` auto-refunded; agents cannot withdraw. Discounts: query `onchain_received` (type `0x2::service::Discount`), filter by `service`, validate time/benchmark; rate = `total_pay × (off / 10000)`; fixed = `min(off, total_pay)`. Post-creation: notify via Messenger with order ID.
253
183
 
254
184
  ---
255
185
 
@@ -257,142 +187,67 @@ Post-creation: notify via Messenger with order ID.
257
187
 
258
188
  ### Progress Advancement
259
189
 
260
- When user reaches a node, AI MUST cross-reference Phase 1:
190
+ When user reaches a node, cross-reference Phase 1: (1) E3 user-operable forwards; (2) E4 Guard requirements; (3) E5 financial outcome. Present all three — never just the operation name.
261
191
 
262
- 1. **E3 Machine JSON**: user-operable forwards from current node?
263
- 2. **E4 Guard files**: Guard requirements? Can user satisfy?
264
- 3. **E5 Allocation**: financial outcome of each path?
265
-
266
- Present all three dimensions. Never just the operation name.
267
-
268
- - `namedOperator === ""` + no Guard → `order.progress` directly
269
- - `namedOperator === ""` + Guard → passport required, no bypass
192
+ - `namedOperator === ""` + no Guard → `order.progress`
193
+ - `namedOperator === ""` + Guard → passport required (no bypass)
270
194
  - `namedOperator !== ""` → not user-operable
271
195
 
272
196
  ### Progress.current="" Diagnostic (stuck at initial state)
273
197
 
274
- If `query_toolkit` returns a Progress with `current: ""`:
275
-
276
- 1. **Root cause**: Machine entry node (`prev_node: ""`) has empty `forwards[]` — Progress cannot advance.
277
- 2. **Query Machine**: `query_toolkit` → `onchain_objects` for `progress.machine` → inspect `node.pairs` for `prev_node: ""`.
278
- 3. **If forwards empty**: Machine must be republished with ≥1 forward on the entry node (nodes are immutable after publish — clone + add forward + new Machine + rebind to Service).
279
- 4. **MCP auto-diagnostic**: `query_toolkit` now attaches `_diagnostic` with cause + 5-step fix guide when `current=""` is detected.
198
+ Root cause: entry node (`prev_node: ""`) has empty `forwards[]`. Fix: clone Machine + add forward + republish + rebind (nodes immutable after publish). MCP `query_toolkit` attaches `_diagnostic` (cause + 5-step fix) when `current=""` is detected.
280
199
 
281
200
  ---
282
201
 
283
202
  ## Phase 5: Arbitration
284
203
 
285
- Process: [wowok-arbitrator](../wowok-arbitrator/SKILL.md).
286
-
287
- Flow: `arbitration.dispute` → WTS evidence → Messenger → `order.arb_confirm` → voting → (`order.arb_objection`) → `order.arb_claim_compensation`.
204
+ Process: [wowok-arbitrator](../wowok-arbitrator/SKILL.md). Flow: `arbitration.dispute` → WTS evidence → Messenger → `order.arb_confirm` → voting → (`order.arb_objection`) → `order.arb_claim_compensation`.
288
205
 
289
- **Not in schema**: fee paid separately, not from Order. One compensation claim per Order. Source: `compensation_fund` (E7).
206
+ Not in schema: fee paid separately (not from Order); one compensation claim per Order; source = `compensation_fund` (E7).
290
207
 
291
208
  ---
292
209
 
293
210
  ## Fund Management
294
211
 
295
- Builder-only operations: `order.transfer_to` (ownership), `order.receive` (withdraw — agents can execute, only builder receives).
212
+ Builder-only: `order.transfer_to` (ownership), `order.receive` (withdraw). Agents may execute `receive`, but only the builder receives funds.
296
213
 
297
- ### How to Withdraw Funds from Order (`order.receive`)
214
+ ### Withdraw via `order.receive`
298
215
 
299
- After Allocation distributes funds to Order (as `CoinWrapper` objects), the builder (Order owner) MUST call `order.receive` to unwrap and withdraw the funds. Without this step, funds stay locked in the Order as `CoinWrapper` objects.
216
+ After Allocation distributes `CoinWrapper` objects to the Order, the builder MUST call `order.receive` to unwrap + withdraw; otherwise funds stay locked as `CoinWrapper`.
300
217
 
301
- > **P0-01 / P3-04 fix**: The `receive` field now uses `ReceivedObjectsOrRecentlySchema` (consistent with `owner_receive` on all other objects). Do NOT wrap in `{result: ...}` — pass directly.
302
-
303
- #### Step 1: Query received objects (optional but recommended)
304
-
305
- Before calling `order.receive`, query what the Order has received to verify there are funds to withdraw:
218
+ - **Schema**: `receive` accepts `ReceivedObjectsOrRecentlySchema` (consistent with `owner_receive` on ALL objects). Pass directly — do NOT wrap in `{result: ...}` (that is `QueryReceivedResult`).
219
+ - **Simplest form** — `"recently"` auto-receives all recently-received `CoinWrapper`:
306
220
 
307
221
  ```json
308
- {
309
- "tool": "query_toolkit",
310
- "query_type": "onchain_received",
311
- "name_or_address": "<order_name_or_address>",
312
- "type": "CoinWrapper"
313
- }
222
+ { "tool": "onchain_operations", "data": { "operation_type": "order", "data": { "object": "<order_id>", "receive": "recently" } }, "env": { "account": "<builder>", "network": "testnet", "confirmed": true } }
314
223
  ```
315
224
 
316
- **Expected response**: A `ReceivedBalance` object with `token_type`, `balance`, and `received[]` array of `CoinWrapper` objects. If empty, there is nothing to withdraw yet.
317
-
318
- #### Step 2: Call `order.receive` with `"recently"` (simplest form)
319
-
320
- Use the string `"recently"` to auto-receive all recently received `CoinWrapper` objects:
321
-
322
- ```json
323
- {
324
- "tool": "onchain_operations",
325
- "data": {
326
- "operation_type": "order",
327
- "data": {
328
- "object": "<order_name_or_address>",
329
- "receive": "recently"
330
- }
331
- },
332
- "env": {
333
- "account": "<builder_account_name>",
334
- "network": "testnet",
335
- "confirmed": true
336
- }
337
- }
338
- ```
339
-
340
- **Expected result**:
341
- - Builder account receives the underlying token (e.g., WOW) — `CoinWrapper` is auto-unwrapped
342
- - Transaction digest returned
343
- - Order's received `CoinWrapper` objects are consumed
344
-
345
- #### Step 2 (alternatives)
225
+ - **Precise form** — pass an explicit `[{id, type}]` array, or pass the `ReceivedBalance` from `query_toolkit` → `query_type: "onchain_received"` (type `CoinWrapper`) directly as `receive`.
226
+ - **Result** — builder receives the underlying token (CoinWrapper auto-unwrapped); digest returned.
346
227
 
347
- For precise control, pass an explicit array of `{id, type}` objects, or pass the `ReceivedBalance` object from Step 1 query directly as `receive`. Both forms accept the same `env` block as the `"recently"` form above.
228
+ **When to call**:
348
229
 
349
- #### Common Pitfalls
230
+ | Trigger | Action |
231
+ |---------|--------|
232
+ | Allocation fires (refund on `return_approved`) | `order.receive` → withdraw to builder |
233
+ | Arbitration awards compensation | `order.receive` → withdraw to builder |
234
+ | Multi-stage allocation (partial refund + deduction) | `order.receive` `"recently"` (all at once) |
235
+ | Order closed with no allocation | Do NOT call (nothing to withdraw) |
350
236
 
351
- - ❌ **Do NOT wrap in `{result: ...}`** — the `receive` field accepts `ReceivedObjectsOrRecently` directly, NOT `QueryReceivedResult` (`{result: [...]}`)
352
- - ❌ **Do NOT call `order.receive` if no funds received yet** — query first via Step 1
353
- - ✅ Only the **builder** (Order owner) can call `receive` — agents cannot withdraw funds (they can execute the call, but only builder receives)
354
- - ✅ `CoinWrapper` is auto-unwrapped to the underlying token (e.g., WOW)
355
- - ✅ The `receive` field is consistent with `owner_receive` on all other objects (arbitration/contact/demand/machine/permission/repository/reward/service/treasury)
356
-
357
- #### When to Call `order.receive`
358
-
359
- | Trigger | Why | Action |
360
- |---------|-----|--------|
361
- | Allocation fires (e.g., refund Allocator triggers on `return_approved`) | Order receives `CoinWrapper` with refund amount | Call `order.receive` to withdraw to builder account |
362
- | Arbitration awards compensation | Order receives `CoinWrapper` with award amount | Call `order.receive` to withdraw to builder account |
363
- | Multi-stage allocation (partial refund + partial deduction) | Order receives multiple `CoinWrapper` objects | Call `order.receive` with `"recently"` to receive all at once |
364
- | Order closed with no allocation | No `CoinWrapper` received | Do NOT call `order.receive` (nothing to withdraw) |
237
+ **Pitfalls**: don't wrap in `{result:...}`; query first (don't call with no funds); only builder receives; CoinWrapper auto-unwraps to the underlying token.
365
238
 
366
239
  ---
367
240
 
368
- ## Phase 3: Customer Intelligence (MCP-Handled)
369
-
370
- > **MCP auto-populates `semantic.customer_advice`** in order/query responses when `customer_intelligence` is ON (default). Read these fields from MCP output — do NOT recompute internally.
371
-
372
- **Key fields in `semantic.customer_advice`**:
373
- - `reminders[]`: stage-aware reminders with priority (`required` blocks purchase; `recommended` = strong caution; `info` = advisory; `reminder` = timed nudge)
374
- - `risk_score`: 0-100 (🟢≥85 low | 🟡70-84 | 🟠50-69 | 🔴<50 high — advise against purchase)
375
- - `preference_match`: 0-100 score with `matches`/`mismatches` arrays (≥75 strong match, <50 significant mismatch)
241
+ ## Phase 6: Customer Intelligence (MCP-Handled)
376
242
 
377
- **Red lines** (do not purchase): no arb + no refund path, OR compensation_ratio < 0.5.
243
+ > **MCP auto-populates `semantic.customer_advice`** in order/query responses when `customer_intelligence` is ON (default). Read from MCP output — do NOT recompute.
378
244
 
379
- **Post-purchase**: monitor refund Allocator triggers, WIP hash mismatch, merchant unreachable (>3d warning, >7d arb advice), evidence collection (≥3 items).
245
+ Key fields: `reminders[]` (`required` blocks purchase; `recommended` = strong caution; `info` = advisory; `reminder` = timed nudge); `risk_score` 0-100 (🟢≥85 | 🟡70-84 | 🟠50-69 | 🔴<50 advise against); `preference_match` 0-100 with `matches`/`mismatches` (≥75 strong, <50 mismatch).
380
246
 
381
- **Runtime toggle**: `config_operation` → `action: "toggle"`, `service: "order_monitor"` (default OFF) to enable active Progress stall + compensation change + Messenger timeout monitoring.
247
+ **Red lines** (do not purchase): no arb + no refund path, OR `compensation_ratio < 0.5`. **Post-purchase**: monitor refund Allocator triggers, WIP hash mismatch, merchant unreachable (>3d warning, >7d arb), evidence collection (≥3 items). **Runtime toggle**: `config_operation` → `action: "toggle"`, `service: "order_monitor"` (default OFF).
382
248
 
383
249
  ---
384
250
 
385
251
  ### Phase Dependency
386
252
 
387
- E1 (Service) → E2 (Products/WIP), E8 (Contact), E10 (Privacy), E7 (Compensation), E6 (Arbitrations) run in parallel after E1. E3 (Machine) → E4 (Guards) → E5 (Allocators) is a strict chain. E9 (Reputation) follows E3. E11 (Trust Score) runs LAST — it aggregates all prior findings.
388
-
389
- ### ⚠️ Critical Attention Items
390
-
391
- 1. **E4 Ambiguous Guards** — blind spot. User must review file directly. AI must not speculate.
392
- 2. **E3 no-refund + E6 no-arb** — no mechanism to recover funds. Single most important decision factor.
393
- 3. **E3 Forward with Guard** — "user-operable" is misleading if Guard blocks you. Verify requirements.
394
- 4. **E2 WIP hash mismatch** — seller altered claims post-publish. Red flag regardless of other factors.
395
- 5. **E9 High dispute rate** — >10% quantitative warning independent of structural analysis.
396
- 6. **Phase 3 customer_advice** — when `customer_intelligence` is ON, read `semantic.customer_advice` first in every order/query response. The `reminders` array is pre-sorted by priority; `required` items block purchase.
397
-
398
- ---
253
+ E1 (Service) → E2 (Products/WIP), E8 (Contact), E10 (Privacy), E7 (Compensation), E6 (Arbitrations) run in parallel after E1. E3 (Machine) → E4 (Guards) → E5 (Allocators) is a strict chain. E9 (Reputation) follows E3. E11 (Trust Score) runs LAST — aggregates all prior findings.
@@ -21,13 +21,23 @@ this skill's shortening rules are DISABLED — display complete 66-character add
21
21
 
22
22
  ## Short Address Format
23
23
 
24
- **MUST APPLY TO ALL ADDRESSES** (0x prefix + 64 hex chars = 66 chars total):
25
- 1. Remove `0x` prefix
26
- 2. Take first 5 characters
27
- 3. Convert to UPPERCASE
28
- 4. Wrap in parentheses `()`
24
+ **MUST APPLY TO ALL ADDRESSES AND OBJECT IDs** (0x prefix + 64 hex chars = 66 chars total).
29
25
 
30
- **Example**: `0xa1d421902a3e5f2e4da7590e8f243712b3b3479d1a07c48c2de543184fc97a33` → `(A1D42)`
26
+ Generate a short ID by the following rules:
27
+ 1. Remove `0x` prefix → get the hex string
28
+ 2. Take the first 5 characters (or fewer if the address is shorter)
29
+ 3. Convert to UPPERCASE
30
+ 4. **If all 5 characters are the same character** (e.g., `00000` → `AAAAA`), fall back to the last 5 characters, prefixed with `...`
31
+ 5. **If even the last 5 are all the same character** (extremely rare), find 5 consecutive characters near the middle that differ, wrapped with `...` on both sides
32
+ 6. **Display rule**: no parentheses by default; parentheses are only used when paired with a name (see Display Format Rules below)
33
+
34
+ **Examples**:
35
+ | Full Address | Short ID | Rule |
36
+ |---|---|---|
37
+ | `0xa1d421902a3e5f2e4da7590e8f243712b3b3479d1a07c48c2de543184fc97a33` | `A1D42` | Normal: first 5 |
38
+ | `0x00000123456789abcdef0123456789abcdef0123456789abcdef000000000000` | `...00000` | First 5 all same → last 5 |
39
+ | `0x00000000000000000000000000000000000000000000000000000000000000000` | `...00000...` | Both ends all same → middle 5 |
40
+ | `0x2` | `2` | Short address, take actual length |
31
41
 
32
42
  ## Resolution Priority & Display Format
33
43
 
@@ -39,10 +49,10 @@ Returns: `{ account?: string, local_mark?: string, address: string }`
39
49
 
40
50
  | Condition | Display Format | Example |
41
51
  |-----------|----------------|---------|
42
- | **Both account AND local_mark exist** | `{account_name} \| {local_mark_name} (ABCDE)` | `alice \| my_mark (A1D42)` |
43
- | **Only account exists** | `{account_name} (ABCDE)` | `alice_wallet (A1D42)` |
44
- | **Only local_mark exists** | `{local_mark_name} (ABCDE)` | `my_service (A1D42)` |
45
- | **Neither exists** | `(ABCDE)` | `(A1D42)` |
52
+ | **Both account AND local_mark exist** | `{account_name} \| {local_mark_name}({ID})` | `alice \| my_mark(A1D42)` |
53
+ | **Only account exists** | `{account_name}({ID})` | `alice_wallet(A1D42)` |
54
+ | **Only local_mark exists** | `{local_mark_name}({ID})` | `my_service(A1D42)` |
55
+ | **Neither exists** | `{ID}` | `A1D42` |
46
56
 
47
57
  ---
48
58
 
@@ -54,24 +64,32 @@ Returns: `{ account?: string, local_mark?: string, address: string }`
54
64
 
55
65
  # Amount Formatting Rules
56
66
 
57
- ## Conservative Principle
67
+ ## Primary Source: `_money_display`
68
+
69
+ The MCP fund layer now annotates all monetary query results with `_money_display` — a map of field paths to `ChainValueDisplay` objects containing `{raw, display, symbol, decimals, precision_known, text}`. **Use `_money_display` directly when present** — it is the authoritative formatted display, consistent with the MCP's own precision resolution.
70
+
71
+ - `precision_known === true` → `text` field already contains the complete formatted string: e.g. `"2.2 WOW (decimals: 9; raw: 2200000000)"`
72
+ - `precision_known === false` → `text` contains the raw value with a retry hint; show as-is (the true raw value is authoritative)
73
+
74
+ Supported query types with `_money_display`:
75
+ - `account_balance` — balance and coin amounts
76
+ - `onchain_objects` — Treasury, Service, Order, Allocation, Payment, Reward, Arb, Discount monetary fields
77
+ - `onchain_table_item_treasury_history` / `onchain_table_item_reward_record` — table entry amounts
78
+ - `onchain_received` — CoinWrapper balances
79
+ - `onchain_transaction` — balance_changes (each change has its own `coin_type`)
80
+ - `onchain_events` — NewOrderEvent.amount (via the order's Service generic token type)
81
+
82
+ ## Fallback (when `_money_display` is absent)
58
83
 
59
84
  **When in doubt, display raw value.**
60
85
 
61
86
  | Condition | Display | Example |
62
87
  |-----------|---------|---------|
63
88
  | Token info UNAVAILABLE | Raw amount | `500000000` |
64
- | Token info AVAILABLE | Converted + symbol + precision | `0.5 WOW (9P)` |
65
-
66
- ## Conversion Requirements
67
-
68
- ONLY convert when ALL conditions met:
69
- 1. Token type explicitly identified
70
- 2. Successfully queried via `query_toolkit` with `query_type: "token_list"`
71
- 3. Metadata contains valid `decimals` and `symbol`
89
+ | Token info AVAILABLE | Converted + symbol + precision | `2.2 WOW (decimals: 9; raw: 2200000000)` |
72
90
 
73
91
  **Formula**: `converted = raw / (10 ^ decimals)`
74
- **Format**: `{amount} {symbol} ({decimals}P)`
92
+ **Format**: `{amount} {symbol} (decimals: {N}; raw: {raw})`
75
93
 
76
94
  ---
77
95
 
@@ -82,10 +100,10 @@ ONLY convert when ALL conditions met:
82
100
  ```
83
101
  | # | Time | Sender | Service | Amount | Order |
84
102
  |---|------|--------|---------|--------|-------|
85
- | 1 | {time} | {name} (ABCDE) | {name} (ABCDE) | {amount} | (ABCDE) |
103
+ | 1 | {time} | {name}(ABCDE) | {name}(ABCDE) | {amount} | ABCDE |
86
104
  ```
87
105
 
88
- **Note**: `{name}` follows Display Format Rules above (account | local_mark). If no name, show only `(ABCDE)`.
106
+ **Note**: `{name}` follows Display Format Rules above (account | local_mark). If no name, show only the short ID (no parentheses).
89
107
 
90
108
  ## Event Type Fields
91
109
 
@@ -108,12 +126,13 @@ When user asks about field meanings:
108
126
  - **Sender**: Account that initiated the transaction
109
127
  - **Service**: Service object being ordered/interacted with
110
128
  - **Order Object**: Unique on-chain identifier for this order
111
- - **Short Address (ABCDE)**: First 5 chars for quick visual identification
129
+ - **Short Address (ABCDE)**: Shortened ID for quick visual identification — see Short Address Format rules (first 5 chars; fallback to last 5 or middle 5 if all same)
112
130
 
113
131
  ## Amounts
114
132
  - **Raw**: Actual U64 integer stored on-chain
115
133
  - **Converted**: Human-readable after applying decimals
116
- - **Precision (XP)**: Number of decimal places
134
+ - **Precision (N decimals)**: Number of decimal places
135
+ - **`_money_display`**: MCP-annotated display map (see Amount Formatting Rules above)
117
136
 
118
137
  ## Time
119
138
  - **Timestamp**: Unix milliseconds since epoch
@@ -125,9 +144,10 @@ When user asks about field meanings:
125
144
 
126
145
  - [ ] Extract unique addresses from response
127
146
  - [ ] Query `local_names` for resolution
128
- - [ ] Query `token_list` for amount formatting
147
+ - [ ] Check for `_money_display` annotations in query results (primary amount source)
148
+ - [ ] If `_money_display` absent, query `token_list` for manual amount formatting
129
149
  - [ ] Apply address format rules
130
- - [ ] Apply amount format rules (conservative)
150
+ - [ ] Apply amount format rules (use `_money_display` first; fallback to conservative)
131
151
  - [ ] Render final output
132
152
 
133
153
  ---