@wowok/skills 1.1.11 → 1.1.13

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.
@@ -0,0 +1,545 @@
1
+ # Appendix — wowok-arbitrator
2
+
3
+ > This file is loaded on-demand (Progressive Disclosure).
4
+ > Main skill: [SKILL.md](./SKILL.md)
5
+
6
+ ---
7
+
8
+ ## Dialogue Scripts (R1-R10)
9
+
10
+ A guided 10-round dialogue for the arbitrator journey — from service conception to daily case operations. Each round has a specific AI Goal, Key Questions, Tool Calls, Success Criteria, Fallback, and Checkpoint. Checkpoints persist via `local_info_operation` so the journey can resume after interruption.
11
+
12
+ > **Note**: The R1-R10 below is distinct from the PRE-FLIGHT checklist (R1-R6) in §PRE-FLIGHT above. The PRE-FLIGHT items are the *required inputs*; the R1-R10 dialogue is the *end-to-end journey* that consumes those inputs.
13
+
14
+ ### R1 — Intent Capture & Arbitrator Role Establishment
15
+
16
+ **AI Goal**: Understand why the user wants to become an arbitrator, what domain they specialize in, and what kind of disputes they intend to resolve. Establish the arbitrator identity before any configuration.
17
+
18
+ **Key Questions**:
19
+ - What is your arbitration domain (e-commerce, freelance work, rentals, general)?
20
+ - Are you an individual arbitrator or representing a panel/organization?
21
+ - What is your reputation or credentials in this domain?
22
+ - Do you have a WoWok account set up? If not, hand off to [wowok-onboard](../wowok-onboard/SKILL.md).
23
+
24
+ **Tool Calls**:
25
+ 1. `account_operation` → `get` to confirm the active account exists.
26
+ 2. `account_operation` → `messenger` to verify a messenger name is set (required for `um` contact).
27
+ 3. `query_toolkit` → `onchain_objects` to check if the user already owns any Arbitration services.
28
+ 4. `local_info_operation` → create a session checkpoint `{ round: R1, domain, role, existing_arbitrations: [...] }`.
29
+
30
+ **Success Criteria**: User's arbitration domain and role confirmed. Account and Messenger verified. Existing Arbitration services (if any) identified for reuse consideration.
31
+
32
+ **Fallback**: User has no account → hand off to [wowok-onboard](../wowok-onboard/SKILL.md). User has no Messenger name → guide through `account_operation` → `messenger`. User already has an Arbitration service → ask whether to reuse or create a new one (different domain or voting structure).
33
+
34
+ **Checkpoint**: Persist `{ round: R1, domain, role, account, messenger_name, existing_arbitrations }`. Mark R1 COMPLETE.
35
+
36
+ ### R2 — PRE-FLIGHT Checklist Collection
37
+
38
+ **AI Goal**: Collect all six required items (R1-R6 from §PRE-FLIGHT) with explicit user confirmation. Enforce the Golden Rule: never guess, never fabricate, never proceed with missing items.
39
+
40
+ **Key Questions**:
41
+ - Account: which account? Default `""` is fine.
42
+ - Arbitration Name: what is the service name?
43
+ - Fee: how much per case? (e.g., "10 WOW per dispute")
44
+ - Voting Guard(s): open voting (centralized) or Guard-based (decentralized)? If Guard-based, who votes and with what weight?
45
+ - Usage Guard: who can file disputes? Public or restricted?
46
+ - Contact (um): Messenger Contact name/ID for evidence exchange.
47
+
48
+ **Tool Calls**:
49
+ 1. Present the PRE-FLIGHT checklist (R1-R6) to the user.
50
+ 2. For each item: ask "Reuse or create new? Provide details."
51
+ 3. Track status: `[pending]` / `[confirmed: reuse <id>]` / `[confirmed: create]`.
52
+ 4. For reuse items: `query_toolkit` → `onchain_objects` to verify the object exists and is owned by the account.
53
+ 5. `local_info_operation` → persist checklist status after each confirmation.
54
+
55
+ **Success Criteria**: ALL R1-R6 items are `[confirmed]`. The GATE is passed. If any item is `[pending]`, STOP — do not suggest creating the Arbitration.
56
+
57
+ **Fallback**: User says "just make something up" → REFUSE and explain why each item matters (fee = revenue model, voting_guard = governance, usage_guard = case quality, um = evidence channel). User provides incomplete info → ask for clarification. User wants to defer a decision → persist partial state and resume later.
58
+
59
+ **Checkpoint**: Persist `{ round: R2, checklist: { R1_account, R2_name, R3_fee, R4_voting_guard, R5_usage_guard, R6_um }, gate_passed: true }`. Mark R2 COMPLETE.
60
+
61
+ ### R3 — Voting Guard Design (CRITICAL — Immutable)
62
+
63
+ **AI Goal**: Design the voting_guard(s) — the most critical and irreversible decision in Arbitration creation. Guards are immutable after creation; wrong design requires creating a replacement Guard. This round must be thorough.
64
+
65
+ **Key Questions**:
66
+ - Open voting (you cast votes directly, weight=1) or Guard-based (voters authenticate via Passport)?
67
+ - If Guard-based: how many voting guards? (max 50)
68
+ - For each guard: `FixedValue(u32)` (equal weight) or `GuardIdentifier(u8)` (dynamic weight from credential)?
69
+ - If `GuardIdentifier`: which table index holds the weight value? It must be `b_submission: true` and numeric (U8–U256).
70
+ - What credentials should voters hold? (reputation, token balance, NFT, partner org membership)
71
+
72
+ **Tool Calls**:
73
+ 1. `wowok_buildin_info` → `info: "guard instructions"` for instruction reference.
74
+ 2. `wowok_buildin_info` → `info: "value types"` for type annotation reference.
75
+ 3. `guard2file` → export any existing Guard the user wants to reuse as a template.
76
+ 4. For new Guards: design the table, computation tree, and submission requirements per [wowok-guard](../wowok-guard/SKILL.md).
77
+ 5. `local_info_operation` → persist the voting_guard design (table schemas, weight rules, voter criteria).
78
+
79
+ **Success Criteria**: User has explicitly chosen open vs Guard-based. If Guard-based: each Guard's table, weight rule, and voter criteria are documented. The `GuardIdentifier` index (if used) is confirmed as `b_submission: true` and numeric. User understands immutability — this design cannot be changed after creation.
80
+
81
+ **Fallback**: User is unsure between open and Guard-based → present the trade-offs: open = centralized, simpler, faster; Guard-based = decentralized, transparent, scales to more voters. User wants to modify an existing Guard → impossible (immutable); must create a new one. User's `GuardIdentifier` index is not numeric or not `b_submission: true` → flag the error, redesign.
82
+
83
+ **Checkpoint**: Persist `{ round: R3, voting_mode, guards: [{id_or_design, weight_rule, voter_criteria}], immutability_acknowledged: true }`. Mark R3 COMPLETE.
84
+
85
+ ### R4 — Usage Guard & Contact Configuration
86
+
87
+ **AI Goal**: Configure the usage_guard (who can file disputes) and the Contact (`um`) for evidence exchange. These control case volume and the evidence channel.
88
+
89
+ **Key Questions**:
90
+ - Usage Guard: public (anyone can file) or restricted (specific criteria)?
91
+ - If restricted: what criteria? (token holding, reputation, invitation, partner org)
92
+ - Contact: reuse an existing Contact or create new? What Messenger addresses should be in `ims[]`?
93
+ - Have you tested that your Messenger address can receive WTS files?
94
+
95
+ **Tool Calls**:
96
+ 1. For usage_guard reuse: `query_toolkit` → `onchain_objects` to verify the Guard exists.
97
+ 2. For usage_guard create: design per [wowok-guard](../wowok-guard/SKILL.md) — typically simpler than voting_guard.
98
+ 3. For Contact reuse: `query_toolkit` → `onchain_objects` for the Contact ID. Verify `ims[]` is non-empty.
99
+ 4. For Contact create: `schema_query` → `onchain_operations` to confirm the `contact` operation shape.
100
+ 5. `local_info_operation` → persist usage_guard and Contact configuration.
101
+
102
+ **Success Criteria**: Usage_guard configured (public or restricted with documented criteria). Contact configured with at least one active Messenger address in `ims[]`. User has verified they can receive messages at that address.
103
+
104
+ **Fallback**: User wants public usage_guard but is worried about spam → suggest a minimal Guard (e.g., small fee or basic reputation threshold). Contact `ims[]` empty → 🔴 cannot unpause without evidence channel. User's Messenger address is wrong → guide through `account_operation` → `messenger` to fix.
105
+
106
+ **Checkpoint**: Persist `{ round: R4, usage_guard: {mode, criteria}, contact: {id, ims: [...]} }`. Mark R4 COMPLETE.
107
+
108
+ ### R5 — CREATE Arbitration Service
109
+
110
+ **AI Goal**: Execute the Arbitration creation transaction with all R2-R4 inputs. Start paused (`pause: true`) — unpause happens at R7 after testing.
111
+
112
+ **Key Questions**:
113
+ - Ready to create the Arbitration service with the confirmed configuration?
114
+ - Confirm: name, fee, voting_guard, usage_guard, um, pause=true.
115
+ - This is an on-chain write operation. Do you want to proceed? (per [wowok-safety](../wowok-safety/SKILL.md))
116
+
117
+ **Tool Calls**:
118
+ 1. `schema_query` → `onchain_operations_arbitration` to confirm the `create` operation shape.
119
+ 2. Assemble the operation with all R2-R4 inputs. Set `pause: true`.
120
+ 3. First call without `submission` — SDK returns a prompt confirming the operation.
121
+ 4. Re-call with `submission` after user confirmation per [wowok-safety](../wowok-safety/SKILL.md).
122
+ 5. `query_toolkit` → `onchain_objects` for the new Arbitration ID. Verify all fields.
123
+ 6. `local_info_operation` → persist the Arbitration ID and configuration snapshot.
124
+
125
+ **Success Criteria**: Arbitration created on-chain. ID captured. All fields verified (fee, voting_guard, usage_guard, um, pause=true). Two-phase submission loop completed.
126
+
127
+ **Fallback**: Creation fails → check for name collision (`replaceExistName` flag), insufficient gas, or invalid Guard references. Voting_guard references a non-existent Guard → create the Guard first, then retry. `um` Contact not found → verify the ID, recreate if needed.
128
+
129
+ **Checkpoint**: Persist `{ round: R5, arbitration_id, config_snapshot, pause: true }`. Mark R5 COMPLETE.
130
+
131
+ ### R6 — Test Guards with gen_passport
132
+
133
+ **AI Goal**: Validate all Guard designs (voting_guard and usage_guard) before unpausing. Use `gen_passport` to simulate voter and complainant authentication. Catch design errors while the service is still paused.
134
+
135
+ **Key Questions**:
136
+ - Ready to test your voting_guard? I will simulate a voter obtaining a passport.
137
+ - For each voting_guard: can a valid voter obtain a passport? Does the weight calculation work?
138
+ - For usage_guard: can a valid complainant obtain a passport? Does an invalid complainant get rejected?
139
+
140
+ **Tool Calls**:
141
+ 1. `onchain_operations` → `gen_passport` for each voting_guard with test voter data.
142
+ 2. Verify the passport is issued and the weight (if `GuardIdentifier`) is calculated correctly.
143
+ 3. `onchain_operations` → `gen_passport` for the usage_guard with test complainant data.
144
+ 4. Verify valid complainants pass and invalid complainants fail.
145
+ 5. `guard2file` → export each Guard to review the logic if any test fails.
146
+ 6. `local_info_operation` → persist test results.
147
+
148
+ **Success Criteria**: All voting_guard tests pass — valid voters obtain passports with correct weights. Usage_guard tests pass — valid complainants pass, invalid ones fail. No design errors detected.
149
+
150
+ **Fallback**: `gen_passport` fails for a valid voter → the Guard logic is wrong. Since Guards are immutable, must create a replacement Guard and reconfigure the Arbitration. Weight calculation is wrong → check the `GuardIdentifier` index: is it `b_submission: true`? Is it numeric? Is the value being cast to u32 correctly? Usage_guard is too restrictive → create a replacement with looser criteria.
151
+
152
+ **Checkpoint**: Persist `{ round: R6, guard_tests: [{guard_id, valid_voter_pass, weight_correct, invalid_voter_rejected}], all_passed: true }`. Mark R6 COMPLETE.
153
+
154
+ ### R7 — Unpause & Go Live
155
+
156
+ **AI Goal**: Unpause the Arbitration service. This is the point of no return — disputes can now be filed. Confirm all configuration is complete and tested.
157
+
158
+ **Key Questions**:
159
+ - Final check: fee set? voting_guard tested? usage_guard tested? Contact configured?
160
+ - Ready to unpause? After this, disputes can be filed immediately.
161
+ - Do you want to notify any Service providers that your Arbitration is live?
162
+
163
+ **Tool Calls**:
164
+ 1. `query_toolkit` → `onchain_objects` for the Arbitration. Verify: `fee`, `voting_guard`, `usage_guard`, `um`, `pause: true`.
165
+ 2. `onchain_operations` → `arbitration.modify` to set `pause: false`.
166
+ 3. `query_toolkit` → `onchain_objects` to confirm `pause: false`.
167
+ 4. `messenger_operation` → `send_message` to notify partner Service providers (optional).
168
+ 5. `local_info_operation` → persist the go-live timestamp and notification list.
169
+
170
+ **Success Criteria**: Arbitration is unpaused (`pause: false`). Service providers notified (if applicable). User understands disputes can now be filed.
171
+
172
+ **Fallback**: Unpause fails → check if all required fields are set (fee, um). If `um` is null → 🔴 cannot unpause (no evidence channel). User wants to re-pause later → possible via `arbitration.modify` with `pause: true`, but filed disputes are already in the pipeline.
173
+
174
+ **Checkpoint**: Persist `{ round: R7, unpaused: true, go_live_timestamp, notifications_sent: [...] }`. Mark R7 COMPLETE.
175
+
176
+ ### R8 — First Case — Review & Confirm
177
+
178
+ **AI Goal**: Handle the first dispute case. Arrive at state (1) Arbitrator_confirming. Review evidence, decide whether to `confirm` (proceed to voting) or `reset` (send back for revision).
179
+
180
+ **Key Questions**:
181
+ - A case has been filed. Here are the propositions and evidence. Do you understand the dispute?
182
+ - Is the evidence sufficient to proceed, or does the customer need to provide more?
183
+ - If insufficient: what feedback should I send with the `reset`?
184
+
185
+ **Tool Calls**:
186
+ 1. `query_toolkit` → `onchain_objects` for the Arb case. Capture propositions, fee, state.
187
+ 2. `onchain_events` → `type: "ArbEvent"`, filter for this Arb ID — check case history.
188
+ 3. `messenger_operation` → `watch_messages` or `watch_conversations` for WTS evidence files from the customer.
189
+ 4. `messenger_operation` → `verify_wts` on all received evidence files. Only verified evidence is valid.
190
+ 5. Decision: `confirm` (proceed) or `reset` (send back with feedback).
191
+ 6. `onchain_operations` → `arb.confirm` or `arb.reset` with feedback.
192
+ 7. `local_info_operation` → persist case review notes and decision.
193
+
194
+ **Success Criteria**: Evidence reviewed and verified. Decision made: confirm (case proceeds to voting) or reset (case sent back with clear feedback). If reset, feedback is specific and actionable.
195
+
196
+ **Fallback**: Evidence is unverified → do not evaluate until `verify_wts` passes. Evidence is insufficient → MUST reset with specific feedback (what's missing, what to clarify). Reset feedback is empty → 🔴 customer doesn't know what to fix; always provide feedback. Evidence is encrypted but no WTS file → ask customer to generate and send via Messenger.
197
+
198
+ **Checkpoint**: Persist `{ round: R8, case_id, propositions, evidence_verified: bool, decision: confirm|reset, feedback }`. Mark R8 COMPLETE.
199
+
200
+ ### R9 — Voting & Finalization
201
+
202
+ **AI Goal**: Conduct the voting phase and finalize the verdict. Set voting deadline, cast votes (open mode) or monitor voter participation (Guard-based mode), execute `arbitration` to set `feedback` + `indemnity`. This is irreversible.
203
+
204
+ **Key Questions**:
205
+ - What is the voting deadline? (≤ 3 days recommended)
206
+ - For open voting: how do you vote on each proposition?
207
+ - For Guard-based voting: are voters participating? Do you need to extend the deadline?
208
+ - What is the `indemnity` (compensation amount)? Proportional to order value and dispute nature?
209
+ - What is the `feedback` (public, permanent on-chain rationale)?
210
+
211
+ **Tool Calls**:
212
+ 1. `onchain_operations` → `arb.vote` on each proposition (open mode) or monitor voter participation (Guard-based mode).
213
+ 2. Set `voting_deadline` — future timestamp, ≤ 3 days recommended.
214
+ 3. `onchain_events` → `type: "ArbEvent"` to monitor vote submissions.
215
+ 4. After voting concludes: `onchain_operations` → `arbitration` to finalize. Sets `feedback` + `indemnity`. **IRREVERSIBLE**.
216
+ 5. `local_info_operation` → persist the verdict, indemnity, and feedback.
217
+
218
+ **Success Criteria**: Voting conducted. Deadline enforced. Verdict finalized via `arbitration` operation. `feedback` is professional, reasoned, and fair (permanently public). `indemnity` is proportional to the dispute.
219
+
220
+ **Fallback**: Past voting deadline → vote cannot be finalized. Must set a new future deadline. Voter participation is low → extend deadline or accept the votes cast. `arbitration` fails → check that voting_deadline has passed and at least one vote was cast. User wants to revise the verdict after `arbitration` → impossible (irreversible by arbitrator); only customer can object.
221
+
222
+ **Checkpoint**: Persist `{ round: R9, case_id, votes: {...}, deadline, verdict: {feedback, indemnity}, irreversible: true }`. Mark R9 COMPLETE.
223
+
224
+ ### R10 — Operations Handoff
225
+
226
+ **AI Goal**: Hand off the arbitrator to daily operations. Equip them with the withdrawal process, reputation management guidance, and case pipeline monitoring. The arbitrator journey transitions to ongoing service operation.
227
+
228
+ **Key Questions**:
229
+ - Do you understand the withdrawal timing? Finished cases = immediate; others = 30-day mandatory wait.
230
+ - Do you know how to monitor your case pipeline? (onchain_events for ArbEvent)
231
+ - Do you know how to maintain your on-chain reputation? (feedback is permanent)
232
+
233
+ **Tool Calls**:
234
+ 1. `local_info_operation` → write the handoff packet: Arbitration ID, voting_guard design, usage_guard design, Contact ID, case pipeline monitoring query.
235
+ 2. Orient the user to Phase 3 (Business Model): revenue flow, withdrawal timing, compensation system.
236
+ 3. Set up case monitoring: `onchain_events` → `type: "ArbEvent"`, filter by Arbitration ID.
237
+ 4. Recommend next Skills: [wowok-messenger](../wowok-messenger/SKILL.md) for ongoing evidence exchange, [wowok-guard](../wowok-guard/SKILL.md) for advanced Guard design, [wowok-output](../wowok-output/SKILL.md) for event display.
238
+
239
+ **Success Criteria**: User has the handoff packet. User understands withdrawal timing (immediate for Finished, 30-day wait for others). User knows how to monitor the case pipeline. User understands feedback is permanent and reputation matters.
240
+
241
+ **Fallback**: User wants to withdraw immediately after a non-Finished case → explain the 30-day mandatory wait (cannot bypass). User wants to modify the Arbitration configuration → some fields are mutable (fee, pause, um), but voting_guard and usage_guard require replacement Guard creation. User wants to pause the service → `arbitration.modify` with `pause: true`; existing cases continue, new filings blocked.
242
+
243
+ **Checkpoint**: Persist `{ round: R10, handoff_emitted: true, arbitration_id, journey: complete }`. Mark arbitrator setup COMPLETE.
244
+
245
+ **Handoff Packet** (emitted to [wowok-messenger](../wowok-messenger/SKILL.md) for evidence exchange, and to [wowok-order](../wowok-order/SKILL.md) for customer-side dispute filing):
246
+ - Arbitration ID + name + fee
247
+ - Voting_guard design (mode, weight rules, voter criteria)
248
+ - Usage_guard design (criteria for filing)
249
+ - Contact (`um`) ID + Messenger address
250
+ - Case pipeline monitoring query (onchain_events filter)
251
+ - Withdrawal timing rules
252
+ - Recommended next Skill: wowok-messenger (evidence), wowok-guard (advanced Guard design), wowok-output (event display)
253
+
254
+ ---
255
+
256
+ ## Decision Trees
257
+
258
+ ### D1: Voting Mode Selection
259
+
260
+ ```
261
+ Designing voting_guard for Arbitration:
262
+ ├── How many voters do you expect?
263
+ │ ├── Just me (or a small trusted panel)
264
+ │ │ └── Open Voting (voting_guard: [])
265
+ │ │ - You cast votes directly, weight = 1
266
+ │ │ - Centralized, fast, simple
267
+ │ │ - Best for: individual arbitrators, small panels
268
+ │ └── Many voters (community, token holders, experts)
269
+ │ └── Guard-Based Voting (voting_guard: [{guard, vote_weight}, ...])
270
+ │ ├── How should weight be determined?
271
+ │ │ ├── Equal weight for all qualified voters
272
+ │ │ │ └── FixedValue(u32) — e.g., every voter has weight 1
273
+ │ │ └── Dynamic weight from credential
274
+ │ │ └── GuardIdentifier(u8) — e.g., reputation score, token balance
275
+ │ │ ├── Referenced index must be b_submission: true
276
+ │ │ ├── Must be numeric (U8–U256)
277
+ │ │ └── Value cast to u32 as voter's weight
278
+ │ └── How many guards? (max 50)
279
+ │ ├── 1-3 guards: simple tiered voting
280
+ │ └── 4-50 guards: complex multi-stakeholder voting
281
+ └── Immutability reminder: Guard design CANNOT be changed after creation.
282
+ Test with gen_passport before finalizing.
283
+ ```
284
+
285
+ ### D2: Case Review Decision (Confirm vs Reset)
286
+
287
+ ```
288
+ Arb case arrives at state (1) Arbitrator_confirming:
289
+ ├── Is the evidence verified? (verify_wts passed)
290
+ │ ├── NO → Do not evaluate. Ask customer to send valid WTS.
291
+ │ └── YES → continue
292
+ ├── Is the evidence sufficient to understand the dispute?
293
+ │ ├── YES → `confirm` → state (2) Voting
294
+ │ └── NO → `reset` → state (0) Revision Pending
295
+ │ ├── What's missing? (specific evidence, clarification, documents)
296
+ │ ├── Write feedback: specific, actionable, professional
297
+ │ ├── Feedback channel:
298
+ │ │ ├── Messenger (preferred for privacy-sensitive details)
299
+ │ │ └── on-chain feedback (general clarification, procedural)
300
+ │ └── Customer revises → `arb_confirm` → back to (1)
301
+ ├── Is the case outside your domain?
302
+ │ ├── YES → reset with feedback recommending a different Arbitration
303
+ │ └── NO → continue
304
+ └── Are there conflicts of interest?
305
+ ├── YES → reset with feedback declaring conflict
306
+ └── NO → confirm
307
+ ```
308
+
309
+ ### D3: Verdict & Indemnity Setting
310
+
311
+ ```
312
+ Voting concluded, ready for `arbitration` (irreversible):
313
+ ├── Review vote distribution across propositions
314
+ ├── Determine the winning proposition(s)
315
+ ├── Set `indemnity` (compensation amount):
316
+ │ ├── Proportional to order value?
317
+ │ ├── Proportional to dispute nature? (minor delay vs major breach)
318
+ │ ├── Covers customer's actual loss? (from verified evidence)
319
+ │ ├── Within provider's compensation_fund balance? (from E7)
320
+ │ │ ├── YES → set indemnity
321
+ │ │ └── NO → set indemnity = fund balance (can't pay more than available)
322
+ │ └── Zero indemnity if provider is not at fault
323
+ ├── Set `feedback` (permanently public on-chain):
324
+ │ ├── Professional, reasoned, fair
325
+ │ ├── References specific evidence (WTS)
326
+ │ ├── Explains the verdict logic
327
+ │ └── Avoids personal attacks, emotional language
328
+ └── Execute `arbitration` → state (3) Arbitrated
329
+ ⛔ IRREVERSIBLE by arbitrator
330
+ Only customer can: arb_claim_compensation → (5) or arb_objection → (4)
331
+ ```
332
+
333
+ ### D4: Withdrawal Timing
334
+
335
+ ```
336
+ Arbitrator wants to withdraw fee (arb_withdraw):
337
+ ├── What state is the Arb case in?
338
+ │ ├── (5) Finished
339
+ │ │ └── Immediate withdrawal. No wait.
340
+ │ ├── (3) Arbitrated
341
+ │ │ └── ⛔ 30-day mandatory wait from arbitration timestamp
342
+ │ ├── (4) Objectionable
343
+ │ │ └── ⛔ 30-day mandatory wait from objection timestamp
344
+ │ ├── (6) Withdrawn
345
+ │ │ └── Already withdrawn. Nothing to do.
346
+ │ └── (0), (1), (2) — case still in progress
347
+ │ └── ⛔ 30-day mandatory wait (case not resolved)
348
+ ├── Has the 30-day wait elapsed (for non-Finished states)?
349
+ │ ├── YES → `arb_withdraw` succeeds
350
+ │ └── NO → `arb_withdraw` fails. Wait.
351
+ └── Why the 30-day wait?
352
+ - Protects customer's right to object or claim compensation
353
+ - Prevents arbitrator from extracting fee before resolution is final
354
+ ```
355
+
356
+ ### D5: Objection Handling
357
+
358
+ ```
359
+ Customer executes `arb_objection` → state (4) Objectionable:
360
+ ├── Why did the customer object?
361
+ │ ├── Disagrees with verdict
362
+ │ │ ├── Review the objection feedback (if provided)
363
+ │ │ ├── Re-examine evidence (verify_wts again if needed)
364
+ │ │ └── Decide: reset for revision, or maintain verdict
365
+ │ ├── Disagrees with indemnity amount
366
+ │ │ ├── Too low: customer wants more compensation
367
+ │ │ ├── Too high: provider may push back (rare, provider doesn't object directly)
368
+ │ │ └── Reset allows adjusting indemnity in next arbitration call
369
+ │ ├── Procedural concern
370
+ │ │ ├── Voting deadline was too short
371
+ │ │ ├── Evidence wasn't properly reviewed
372
+ │ │ └── Reset, address concern, re-arbitrate
373
+ │ └── No reason given
374
+ │ └── Reset with feedback asking for specific objection grounds
375
+ ├── After reset → state (0) → customer `arb_confirm` → (1) → re-review
376
+ └── Multiple objection cycles possible:
377
+ - Each cycle: reset → (0) → arb_confirm → (1) → confirm → (2) → arbitration → (3) → objection → (4)
378
+ - No hard limit on cycles, but reputation impact for both parties
379
+ ```
380
+
381
+ ---
382
+
383
+ ## Failure Playbooks
384
+
385
+ ### F1: Paused Arbitration Silently Rejects Disputes
386
+
387
+ **Trigger**: A customer files a dispute via `arbitration.dispute`, but the case never appears in the arbitrator's pipeline. No error message is returned to the customer.
388
+
389
+ **Diagnosis**:
390
+ - The Arbitration service is still paused (`pause: true`). This is the default after creation.
391
+ - Paused services silently reject all disputes — no error, no feedback.
392
+ - The arbitrator forgot to unpause after configuration (R7 was skipped).
393
+
394
+ **Recovery**:
395
+ 1. `query_toolkit` → `onchain_objects` for the Arbitration. Check `pause` field.
396
+ 2. If `pause: true` → verify all required fields are set (fee, voting_guard, usage_guard, um).
397
+ 3. If all fields set → `onchain_operations` → `arbitration.modify` with `pause: false`.
398
+ 4. If `um` is null → 🔴 cannot unpause. Configure Contact first (R4).
399
+ 5. Notify affected customers to re-file their disputes.
400
+
401
+ **Prevention**: Always unpause at R7 after R6 (Guard testing) confirms all configuration is correct. Add a post-creation checklist: fee set? voting_guard tested? usage_guard tested? um configured? → unpause.
402
+
403
+ ### F2: Wrong Voting Guard Design (Immutable)
404
+
405
+ **Trigger**: After creating the Arbitration and testing with `gen_passport`, the arbitrator discovers the voting_guard logic is wrong — weights are miscalculated, voter criteria are too restrictive, or the `GuardIdentifier` index is invalid.
406
+
407
+ **Diagnosis**:
408
+ - `GuardIdentifier` references an index that is not `b_submission: true` → weight cannot be read.
409
+ - `GuardIdentifier` references a non-numeric index → cast to u32 fails.
410
+ - Voter criteria are too restrictive → no voters can obtain passports.
411
+ - Voter criteria are too loose → unqualified voters can participate.
412
+ - Guards are immutable after creation — the design cannot be patched.
413
+
414
+ **Recovery**:
415
+ 1. Design a replacement Guard with the corrected logic per [wowok-guard](../wowok-guard/SKILL.md).
416
+ 2. `onchain_operations` → `guard.create` for the replacement Guard.
417
+ 3. Test the replacement with `gen_passport` before proceeding.
418
+ 4. `onchain_operations` → `arbitration.modify` to update `voting_guard` with the replacement Guard ID.
419
+ 5. Archive the old Guard (it remains on-chain but unused).
420
+ 6. Update the handoff packet (R10) with the new Guard ID.
421
+
422
+ **Prevention**: Always test Guards with `gen_passport` at R6 BEFORE unpausing. Design Guards per [wowok-guard](../wowok-guard/SKILL.md) guidelines. For `GuardIdentifier`, verify the index is `b_submission: true` and numeric before creating the Guard.
423
+
424
+ ### F3: Past Voting Deadline
425
+
426
+ **Trigger**: The arbitrator tries to finalize the verdict via `arbitration`, but the operation fails because the `voting_deadline` has not passed, or votes were cast after the deadline.
427
+
428
+ **Diagnosis**:
429
+ - `voting_deadline` was set to a past timestamp initially, then votes came in after — votes are invalid.
430
+ - `voting_deadline` was set too far in the future, and the arbitrator tries to finalize early.
431
+ - The deadline timestamp was in seconds but the system expects milliseconds (or vice versa).
432
+
433
+ **Recovery**:
434
+ 1. `query_toolkit` → `onchain_objects` for the Arb case. Check `voting_deadline`.
435
+ 2. If deadline hasn't passed → wait, or extend the deadline if needed.
436
+ 3. If deadline has passed → `arbitration` should succeed. If it still fails, check for other issues (no votes cast, proposition format error).
437
+ 4. If votes were cast after the deadline → those votes are invalid. Only votes before the deadline count.
438
+ 5. If no valid votes were cast → reset the case (state (2) → not directly possible; must go through objection flow or wait for customer action).
439
+
440
+ **Prevention**: Set `voting_deadline` to a future timestamp ≤ 3 days from now. Verify the timestamp unit (milliseconds since epoch). Use `onchain_events` to monitor vote submissions before the deadline.
441
+
442
+ ### F4: Unverified Evidence Accepted
443
+
444
+ **Trigger**: The arbitrator evaluates evidence and makes a ruling, only to discover later that the WTS file was tampered with or never verified via `verify_wts`.
445
+
446
+ **Diagnosis**:
447
+ - The arbitrator skipped `verify_wts` and reviewed the WTS content directly.
448
+ - The WTS hash chain was broken (messages were modified or gaps exist).
449
+ - The WTS file was generated selectively (not the full conversation), undermining credibility.
450
+ - The arbitrator's ruling is now based on invalid evidence.
451
+
452
+ **Recovery**:
453
+ 1. If the case is still in progress (state (1) or (2)) → pause evaluation, request complete and verified WTS from the customer.
454
+ 2. If the verdict has been finalized (`arbitration` executed) → the ruling is irreversible by the arbitrator. Only the customer can object.
455
+ 3. If the customer objects based on the evidence issue → reset (state (4) → (0)), re-evaluate with verified evidence.
456
+ 4. Document the evidence verification failure in the feedback (permanently public).
457
+ 5. For future cases: always run `verify_wts` before evaluating any evidence.
458
+
459
+ **Prevention**: Always run `verify_wts` on every WTS file before evaluating. Never accept unverified evidence. Require the full conversation (not selective exports) per [wowok-messenger](../wowok-messenger/SKILL.md) guidelines.
460
+
461
+ ### F5: Premature Withdrawal Attempt
462
+
463
+ **Trigger**: The arbitrator tries to withdraw the fee via `arb_withdraw` on a case that is not in state (5) Finished, expecting immediate access. The operation fails or funds are locked.
464
+
465
+ **Diagnosis**:
466
+ - The case is in state (3) Arbitrated, (4) Objectionable, or still in progress (0/1/2).
467
+ - Non-Finished states have a mandatory 30-day wait before withdrawal.
468
+ - The arbitrator did not track the case state and tried to withdraw too early.
469
+
470
+ **Recovery**:
471
+ 1. `query_toolkit` → `onchain_objects` for the Arb case. Check the current state.
472
+ 2. If state is (3), (4), or in-progress → calculate the 30-day wait expiry from the last state transition timestamp.
473
+ 3. Wait until the 30-day period elapses, then retry `arb_withdraw`.
474
+ 4. If state is (5) Finished → withdrawal should be immediate. If it fails, check for other issues (insufficient balance, permission error).
475
+ 5. If state is (6) Withdrawn → already withdrawn, nothing to do.
476
+
477
+ **Prevention**: Track case states carefully. Only attempt immediate withdrawal on (5) Finished cases. For other states, set a reminder for the 30-day expiry. Use `onchain_events` to monitor state transitions.
478
+
479
+ ### F6: Empty Reset Feedback
480
+
481
+ **Trigger**: The arbitrator executes `reset` to send a case back for revision, but provides no feedback or vague feedback. The customer doesn't know what to fix and resubmits unchanged.
482
+
483
+ **Diagnosis**:
484
+ - The `reset` operation was called without the `feedback` field, or feedback was an empty string.
485
+ - The customer received no guidance on what was insufficient.
486
+ - The case cycles: (1) → reset → (0) → arb_confirm → (1) → reset → ... with no progress.
487
+
488
+ **Recovery**:
489
+ 1. If the case is at (0) Revision Pending → wait for the customer to `arb_confirm`.
490
+ 2. When it returns to (1) → if still insufficient, `reset` again WITH specific feedback.
491
+ 3. Feedback should include: what evidence is missing, what needs clarification, what documents are required.
492
+ 4. Use Messenger for privacy-sensitive feedback details; on-chain feedback for general procedural guidance.
493
+ 5. If the customer cycles multiple times without addressing feedback → consider rejecting (maintain reset with escalating specificity) or confirm with noted evidence gaps.
494
+
495
+ **Prevention**: Always provide specific, actionable feedback on every `reset`. Use the feedback template: "Insufficient: [specific gap]. Required: [what to provide]. Channel: [Messenger for details]." Never submit an empty feedback field.
496
+
497
+ ---
498
+
499
+ ## Tier Layering
500
+
501
+ ### Novice — Open Voting, Single Arbitrator
502
+
503
+ **Profile**: First-time arbitrator. Individual operator. Wants a simple setup with direct control over voting.
504
+
505
+ **AI Behavior**:
506
+ - Recommend open voting (`voting_guard: []`) — simplest mode, arbitrator casts votes directly.
507
+ - Guide through PRE-FLIGHT checklist step-by-step. Confirm each item explicitly.
508
+ - For Contact (`um`): recommend reusing an existing Contact or creating a simple one with one Messenger address.
509
+ - For usage_guard: recommend public (no restriction) to maximize case volume initially.
510
+ - At R8 (case review): guide through `verify_wts` step-by-step. Explain state machine transitions.
511
+ - At R9 (voting): recommend short deadlines (1-2 days) for faster resolution. Help draft `feedback` text.
512
+ - At R10 (handoff): explain withdrawal timing clearly. Set up basic case monitoring.
513
+
514
+ **Typical Journey**: R1 (individual arbitrator) → R2 (guided checklist) → R3 (open voting) → R4 (public usage_guard, simple Contact) → R5 (create paused) → R6 (test — minimal for open voting) → R7 (unpause) → R8-R9 (first case guided) → R10 (basic operations).
515
+
516
+ ### Advanced — Guard-Based Voting, Weighted Panel
517
+
518
+ **Profile**: Experienced arbitrator. Represents a panel or wants decentralized voting. Needs Guard-based voter authentication with weighted voting.
519
+
520
+ **AI Behavior**:
521
+ - Recommend Guard-based voting with 1-3 voting guards.
522
+ - Help design `FixedValue(u32)` guards for equal-weight panels, or `GuardIdentifier(u8)` for dynamic-weight (reputation-based) panels.
523
+ - For usage_guard: suggest a minimal Guard (e.g., small fee or basic reputation) to filter spam.
524
+ - At R6 (Guard testing): thoroughly test each guard with `gen_passport` — verify weight calculation, voter eligibility.
525
+ - At R8 (case review): assume familiarity with `verify_wts`. Focus on evidence analysis and feedback drafting.
526
+ - At R9 (voting): monitor voter participation via `onchain_events`. Help manage deadlines and quorum.
527
+ - At R10 (handoff): set up advanced case monitoring, track multiple active cases, manage withdrawal timing across cases.
528
+
529
+ **Typical Journey**: R1 (panel arbitrator) → R2 (checklist with Guard designs) → R3 (Guard-based voting, 1-3 guards) → R4 (restricted usage_guard, multi-address Contact) → R5 (create paused) → R6 (thorough Guard testing) → R7 (unpause) → R8-R9 (case with voter participation) → R10 (multi-case operations).
530
+
531
+ ### Expert — Multi-Guard Tiered Voting, Decentralized Panel
532
+
533
+ **Profile**: Large-scale arbitration service. Complex multi-stakeholder voting (experts + community, token holders + NFT holders). Up to 50 voting guards.
534
+
535
+ **AI Behavior**:
536
+ - Support complex tiered voting: multiple Guard types for different voter segments.
537
+ - Design `GuardIdentifier(u8)` guards that reference dynamic credentials (reputation scores, token balances, stake durations).
538
+ - For usage_guard: design sophisticated filtering (multi-criteria, partner org whitelists, time-bound eligibility).
539
+ - At R6 (Guard testing): comprehensive test suite — valid voters, invalid voters, edge cases, weight boundary conditions.
540
+ - At R8 (case review): support batch case processing. Prioritize cases by complexity and stakes.
541
+ - At R9 (voting): manage large voter pools (up to 520 voters). Monitor participation rates. Extend deadlines strategically.
542
+ - At R10 (handoff): full operations dashboard — case pipeline, voter analytics, revenue tracking, reputation monitoring.
543
+ - Support service evolution: create replacement Guards for improved voting logic, migrate voting_guard configuration, maintain service continuity.
544
+
545
+ **Typical Journey**: R1 (large-scale service) → R2 (complex checklist) → R3 (multi-guard tiered design, 4-50 guards) → R4 (sophisticated usage_guard, multi-channel Contact) → R5 (create paused) → R6 (comprehensive test suite) → R7 (unpause) → R8-R9 (high-volume case management) → R10 (full operations dashboard).