@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.
@@ -147,571 +147,12 @@ When user asks about field meanings:
147
147
 
148
148
  ---
149
149
 
150
- ## Dialogue Scripts (R1-R10)
151
-
152
- A guided 10-round dialogue for the output processing journey — runs after EVERY WoWok tool response. Each round has a specific AI Goal, Key Questions, Tool Calls, Success Criteria, Fallback, and Checkpoint. This skill is `always: true` and post-processes all responses for human-readable presentation.
153
-
154
- > **Trigger**: This dialogue is automatically invoked after any WoWok MCP tool returns a response. It does NOT require user interaction unless field explanations are requested.
155
-
156
- ### R1Response Detection & Classification
157
-
158
- **AI Goal**: Detect that a WoWok tool response has been received. Classify the response type (object, list, event, transaction result, error) to determine which formatting rules apply.
159
-
160
- **Key Questions**:
161
- - What type of response is this? (single object, object list, event list, transaction digest, error message)
162
- - Does it contain addresses? Amounts? Events?
163
- - Does the user want a summary or full detail?
164
-
165
- **Tool Calls**:
166
- 1. Parse the response structure: identify top-level fields and their types.
167
- 2. Classify: `object` / `list` / `event` / `transaction` / `error` / `mixed`.
168
- 3. Extract: addresses (66-char hex starting with `0x`), amounts (numeric fields), events (objects with `type` field matching known event types).
169
- 4. `local_info_operation` → create a processing checkpoint `{ round: R1, response_type, has_addresses, has_amounts, has_events }`.
170
-
171
- **Success Criteria**: Response classified. Addresses, amounts, and events identified for further processing.
172
-
173
- **Fallback**: Response is empty → display "No results found." Response is an error → display the error message clearly, suggest remediation per [wowok-safety](../wowok-safety/SKILL.md) Error Patterns. Response is unknown type → display raw JSON with a note.
174
-
175
- **Checkpoint**: Persist `{ round: R1, response_type, extraction: {addresses: N, amounts: N, events: N} }`. Mark R1 COMPLETE.
176
-
177
- ### R2 — Address Extraction & Shortening
178
-
179
- **AI Goal**: Extract all unique addresses from the response. Apply the short address format (first 5 chars, uppercase, in parentheses) to every address.
180
-
181
- **Key Questions**:
182
- - (Internal) Did the user request full addresses? If so, skip shortening.
183
- - (Internal) Are there any duplicate addresses? Deduplicate before resolution.
184
-
185
- **Tool Calls**:
186
- 1. Scan the response for all 66-character hex strings starting with `0x`.
187
- 2. Deduplicate: collect unique addresses.
188
- 3. For each unique address, apply the short format:
189
- - Remove `0x` prefix.
190
- - Take first 5 characters.
191
- - Convert to UPPERCASE.
192
- - Wrap in parentheses `()`.
193
- - Example: `0xa1d421902a...` → `(A1D42)`.
194
- 4. `local_info_operation` → persist the address mapping.
195
-
196
- **Success Criteria**: All addresses shortened to the `(ABCDE)` format. No raw 66-character addresses displayed (unless override condition is active).
197
-
198
- **Fallback**: User explicitly requested full addresses ("show full addresses", "do not abbreviate") → OVERRIDE: display complete 66-character addresses. Disable shortening for this response. Address is less than 66 characters → may be a malformed address; display as-is with a warning.
199
-
200
- **Checkpoint**: Persist `{ round: R2, address_count, shortening_applied: true|false, override_active: bool }`. Mark R2 COMPLETE.
201
-
202
- ### R3 — Name Resolution (local_names Query)
203
-
204
- **AI Goal**: Query `local_names` to resolve addresses to human-readable names (account names, local_mark names). Apply the Display Format Rules based on resolution results.
205
-
206
- **Key Questions**:
207
- - (Internal) Which addresses have associated account or local_mark names?
208
- - (Internal) What is the correct display format for each address based on the resolution priority?
209
-
210
- **Tool Calls**:
211
- 1. `query_toolkit` → `local_names` with the unique addresses from R2.
212
- 2. For each address, capture: `account` (account name, if exists) and `local_mark` (local_mark name, if exists).
213
- 3. Apply the Display Format Rules:
214
- - Both account AND local_mark exist → `{account_name} | {local_mark_name} (ABCDE)`
215
- - Only account exists → `{account_name} (ABCDE)`
216
- - Only local_mark exists → `{local_mark_name} (ABCDE)`
217
- - Neither exists → `(ABCDE)`
218
- 4. Enforce the Name Length Limit: max 20 characters. Overflow → truncate to 17 chars + `...`.
219
- 5. `local_info_operation` → persist the name resolution mapping.
220
-
221
- **Success Criteria**: All addresses resolved (or confirmed as unresolved). Display format applied per the rules. Name length limit enforced.
222
-
223
- **Fallback**: `local_names` query fails → display addresses with short format only: `(ABCDE)`. No names available. Query returns empty → no names exist for these addresses; display `(ABCDE)`.
224
-
225
- **Checkpoint**: Persist `{ round: R3, resolution: {address: {account, local_mark, display_format}} }`. Mark R3 COMPLETE.
226
-
227
- ### R4 — Amount Detection & Token Query
228
-
229
- **AI Goal**: Detect all numeric amount fields in the response. Query token metadata (decimals, symbol) for conversion. Apply the Conservative Principle: when in doubt, display raw value.
230
-
231
- **Key Questions**:
232
- - (Internal) Which amounts have identifiable token types?
233
- - (Internal) Can we query the token metadata, or is it unavailable?
234
-
235
- **Tool Calls**:
236
- 1. Scan the response for numeric fields that represent amounts (balance, amount, fee, indemnity, etc.).
237
- 2. For each amount, identify the token type (if possible from context or explicit `token_type` field).
238
- 3. `query_toolkit` → `token_list` to get `decimals` and `symbol` for each identified token.
239
- 4. Apply the Conservative Principle:
240
- - Token info UNAVAILABLE → display raw amount (e.g., `500000000`).
241
- - Token info AVAILABLE → proceed to R5 for conversion.
242
- 5. `local_info_operation` → persist the amount detection and token metadata.
243
-
244
- **Success Criteria**: All amounts detected. Token metadata queried for identifiable tokens. Conservative principle applied for unidentifiable tokens.
245
-
246
- **Fallback**: Token type cannot be identified → display raw amount. `token_list` query fails → display raw amount. Token metadata is incomplete (missing decimals or symbol) → display raw amount.
247
-
248
- **Checkpoint**: Persist `{ round: R4, amounts: [{field, raw_value, token_type, metadata_available: bool}] }`. Mark R4 COMPLETE.
249
-
250
- ### R5 — Amount Conversion & Formatting
251
-
252
- **AI Goal**: Convert raw amounts to human-readable format using token decimals. Format as `{amount} {symbol} ({decimals}P)`.
253
-
254
- **Key Questions**:
255
- - (Internal) Is the conversion formula correct? `converted = raw / (10 ^ decimals)`.
256
- - (Internal) Is the display format correct? `{amount} {symbol} ({decimals}P)`.
257
-
258
- **Tool Calls**:
259
- 1. For each amount with available token metadata:
260
- - Calculate: `converted = raw / (10 ^ decimals)`.
261
- - Format: `{converted} {symbol} ({decimals}P)`.
262
- - Example: `500000000` with WOW (9 decimals) → `0.5 WOW (9P)`.
263
- 2. For amounts without token metadata: display raw value.
264
- 3. Present both raw and converted when clarifying with users (per [wowok-safety](../wowok-safety/SKILL.md) §2.2).
265
- 4. `local_info_operation` → persist the converted amounts.
266
-
267
- **Success Criteria**: All convertible amounts formatted as `{amount} {symbol} ({decimals}P)`. Non-convertible amounts displayed as raw values.
268
-
269
- **Fallback**: Conversion results in a very small number (e.g., `0.000000001`) → display with full precision, do not round. Conversion results in overflow (very large number) → display in scientific notation or with thousand separators. Decimals is 0 → display as integer with symbol.
270
-
271
- **Checkpoint**: Persist `{ round: R5, converted_amounts: [{field, raw, converted, display_format}] }`. Mark R5 COMPLETE.
272
-
273
- ### R6 — Event Detection & Classification
274
-
275
- **AI Goal**: Detect events in the response. Classify by event type to determine which fields to display in the event table.
276
-
277
- **Key Questions**:
278
- - (Internal) What event types are present? (NewOrderEvent, ProgressEvent, ArbEvent, DemandPresentEvent, DemandFeedbackEvent, NewEntityEvent)
279
- - (Internal) Which key fields should be displayed for each event type?
280
-
281
- **Tool Calls**:
282
- 1. Scan the response for objects with a `type` field matching known event types.
283
- 2. Classify each event:
284
- - `NewOrderEvent` → key fields: sender, service, amount, object.
285
- - `ProgressEvent` → key fields: order, operator, machine.
286
- - `ArbEvent` → key fields: arbitration, voter, order, service.
287
- - `DemandPresentEvent` → key fields: demand, presenter, service.
288
- - `DemandFeedbackEvent` → key fields: demand, feedbacker.
289
- - `NewEntityEvent` → key fields: entity.
290
- 3. For unknown event types → display all available fields.
291
- 4. `local_info_operation` → persist the event classification.
292
-
293
- **Success Criteria**: All events classified. Key fields identified for each event type.
294
-
295
- **Fallback**: Event type is unknown → display all available fields with a note. Event is missing expected fields → display available fields, note the missing ones. Event list is empty → display "No events found."
296
-
297
- **Checkpoint**: Persist `{ round: R6, events: [{type, key_fields: [...]}] }`. Mark R6 COMPLETE.
298
-
299
- ### R7 — Event Table Rendering
300
-
301
- **AI Goal**: Render events in a table format with the standard columns: #, Time, Sender, Service, Amount, Order. Apply address and amount formatting from R2-R5.
302
-
303
- **Key Questions**:
304
- - (Internal) Are all addresses in the event table formatted per R2-R3?
305
- - (Internal) Are all amounts in the event table formatted per R4-R5?
306
-
307
- **Tool Calls**:
308
- 1. Render the event table:
309
- ```
310
- | # | Time | Sender | Service | Amount | Order |
311
- |---|------|--------|---------|--------|-------|
312
- | 1 | {time} | {name} (ABCDE) | {name} (ABCDE) | {amount} | (ABCDE) |
313
- ```
314
- 2. Apply address formatting: `{name}` follows Display Format Rules (R3). If no name, show only `(ABCDE)`.
315
- 3. Apply amount formatting: converted amount with symbol (R5), or raw value if token info unavailable.
316
- 4. Format time: convert Unix milliseconds to human-readable local time.
317
- 5. `local_info_operation` → persist the rendered table.
318
-
319
- **Success Criteria**: Event table rendered with all columns populated. Addresses and amounts formatted per rules. Time converted to human-readable format.
320
-
321
- **Fallback**: Event has no sender → display `(UNKNOWN)`. Event has no amount → display `-`. Event has no time → display `N/A`. Table is too wide for the display → wrap or truncate non-essential columns.
322
-
323
- **Checkpoint**: Persist `{ round: R7, table_rendered: true, row_count }`. Mark R7 COMPLETE.
324
-
325
- ### R8 — Field Explanation (On User Request)
326
-
327
- **AI Goal**: When the user asks about field meanings ("what does sender mean?", "what is XP?"), provide clear explanations using the Field Explanations reference.
328
-
329
- **Key Questions**:
330
- - Which field does the user want explained?
331
- - Is the explanation about addresses, amounts, time, or event-specific fields?
332
-
333
- **Tool Calls**:
334
- 1. Identify the field the user is asking about.
335
- 2. Look up the explanation in the Field Explanations section:
336
- - **Addresses**: Sender (initiated the transaction), Service (object being ordered), Order Object (unique identifier), Short Address (first 5 chars for visual ID).
337
- - **Amounts**: Raw (actual U64 integer on-chain), Converted (human-readable after decimals), Precision (XP = decimal places).
338
- - **Time**: Timestamp (Unix milliseconds since epoch), Human-readable (converted local time).
339
- 3. Present the explanation in plain language.
340
- 4. `local_info_operation` → persist the field explanation request (for improving documentation).
341
-
342
- **Success Criteria**: User's question answered clearly. Field meaning explained in plain language.
343
-
344
- **Fallback**: Field is not in the reference → explain based on context and schema. If still unclear → query the schema via `schema_query` for the field definition. User asks about a complex field → break down the explanation into components.
345
-
346
- **Checkpoint**: Persist `{ round: R8, field_explained, user_satisfied: bool }`. Mark R8 COMPLETE. (Skip if user doesn't ask.)
347
-
348
- ### R9 — Final Output Assembly
349
-
350
- **AI Goal**: Assemble all formatted components (addresses, amounts, events, field explanations) into the final human-readable output. Apply the Implementation Checklist.
351
-
352
- **Key Questions**:
353
- - (Internal) Have all addresses been extracted and resolved?
354
- - (Internal) Have all amounts been converted (or displayed raw per conservative principle)?
355
- - (Internal) Have all events been rendered in table format?
356
- - (Internal) Is the output clean and readable?
357
-
358
- **Tool Calls**:
359
- 1. Run through the Implementation Checklist:
360
- - [ ] Extract unique addresses from response
361
- - [ ] Query `local_names` for resolution
362
- - [ ] Query `token_list` for amount formatting
363
- - [ ] Apply address format rules
364
- - [ ] Apply amount format rules (conservative)
365
- - [ ] Render final output
366
- 2. Assemble the final output: formatted addresses, converted amounts, event tables, and any field explanations.
367
- 3. Ensure consistency: same address always displays the same way within a single output.
368
- 4. `local_info_operation` → persist the final output snapshot.
369
-
370
- **Success Criteria**: Implementation Checklist complete. Final output assembled with all formatting rules applied. Output is clean, readable, and consistent.
371
-
372
- **Fallback**: Checklist has unchecked items → go back to the relevant R round. Output is inconsistent → re-apply formatting rules. Output is too long → summarize, offer to show full details on request.
373
-
374
- **Checkpoint**: Persist `{ round: R9, checklist_complete: true, output_assembled: true }`. Mark R9 COMPLETE.
375
-
376
- ### R10 — Delivery & User Feedback
377
-
378
- **AI Goal**: Deliver the formatted output to the user. Offer follow-up actions (view full addresses, explain fields, query more data).
379
-
380
- **Key Questions**:
381
- - Is the output clear? Would you like me to explain any field?
382
- - Would you like to see full addresses instead of shortened ones?
383
- - Would you like to query more data (related objects, more events)?
384
-
385
- **Tool Calls**:
386
- 1. Present the final formatted output.
387
- 2. Offer follow-up actions:
388
- - "Would you like full addresses? Say 'show full addresses'."
389
- - "Would you like me to explain any field?"
390
- - "Would you like to see more events or related objects?"
391
- 3. If user requests full addresses → re-render with override condition (R2 fallback).
392
- 4. If user asks for field explanation → proceed to R8.
393
- 5. `local_info_operation` → persist the delivery and user feedback.
394
-
395
- **Success Criteria**: Output delivered. User acknowledges or requests follow-up. Follow-up actions offered.
396
-
397
- **Fallback**: User is confused → offer to explain fields (R8). User wants raw data → display the raw JSON response. User wants different formatting → adjust per user preference (e.g., full addresses, raw amounts).
398
-
399
- **Checkpoint**: Persist `{ round: R10, output_delivered: true, user_feedback, follow_up_offered: true }`. Mark output processing COMPLETE.
400
-
401
- ---
402
-
403
- ## Decision Trees
404
-
405
- ### D1: Address Display Format Selection
406
-
407
- ```
408
- An address is found in the response:
409
- ├── Did the user request full addresses?
410
- │ ├── YES ("show full addresses", "do not abbreviate")
411
- │ │ └── OVERRIDE: Display complete 66-character address.
412
- │ │ Example: 0xa1d421902a3e5f2e4da7590e8f243712b3b3479d1a07c48c2de543184fc97a33
413
- │ └── NO (default)
414
- │ └── Apply Short Address Format:
415
- │ 1. Remove 0x prefix
416
- │ 2. Take first 5 characters
417
- │ 3. Convert to UPPERCASE
418
- │ 4. Wrap in parentheses ()
419
- │ Example: (A1D42)
420
- ├── After shortening, query local_names for resolution:
421
- │ ├── Both account AND local_mark exist
422
- │ │ └── Format: {account_name} | {local_mark_name} (ABCDE)
423
- │ │ Example: alice | my_mark (A1D42)
424
- │ ├── Only account exists
425
- │ │ └── Format: {account_name} (ABCDE)
426
- │ │ Example: alice_wallet (A1D42)
427
- │ ├── Only local_mark exists
428
- │ │ └── Format: {local_mark_name} (ABCDE)
429
- │ │ Example: my_service (A1D42)
430
- │ └── Neither exists
431
- │ └── Format: (ABCDE)
432
- │ Example: (A1D42)
433
- └── Name Length Limit:
434
- ├── Name ≤ 20 characters → Display as-is
435
- └── Name > 20 characters → Truncate to 17 chars + "..."
436
- Example: three_body_signature_service_v2 → three_body_sig...
437
- ```
438
-
439
- ### D2: Amount Conversion Decision
440
-
441
- ```
442
- A numeric amount is found in the response:
443
- ├── Is the token type identifiable?
444
- │ ├── NO (no token_type field, no context)
445
- │ │ └── Display raw amount
446
- │ │ Example: 500000000
447
- │ └── YES (token_type field present or inferable from context)
448
- │ └── Query token_list for metadata:
449
- │ ├── Query fails or returns empty
450
- │ │ └── Display raw amount (Conservative Principle)
451
- │ │ Example: 500000000
452
- │ └── Query succeeds with decimals and symbol
453
- │ └── Convert and format:
454
- │ ├── Formula: converted = raw / (10 ^ decimals)
455
- │ ├── Format: {converted} {symbol} ({decimals}P)
456
- │ └── Example: 500000000 → 0.5 WOW (9P)
457
- ├── Special cases:
458
- │ ├── Decimals = 0 → Display as integer with symbol
459
- │ │ Example: 100 USDC (0P)
460
- │ ├── Very small converted value → Display with full precision
461
- │ │ Example: 1 → 0.000000001 WOW (9P)
462
- │ └── Very large converted value → Use thousand separators
463
- │ Example: 1000000000000 → 1,000 WOW (9P)
464
- └── When clarifying with users: Show BOTH raw and converted
465
- Example: "Amount: 500000000 (0.5 WOW, 9 decimals)"
466
- ```
467
-
468
- ### D3: Event Rendering Format
469
-
470
- ```
471
- Events are detected in the response:
472
- ├── How many events?
473
- │ ├── 0 → Display "No events found."
474
- │ ├── 1-20 → Render in a single table
475
- │ └── >20 → Render first 20, offer pagination
476
- ├── Table columns:
477
- │ | # | Time | Sender | Service | Amount | Order |
478
- │ ├── #: Sequential index (1, 2, 3, ...)
479
- │ ├── Time: Unix ms → human-readable local time
480
- │ ├── Sender: {name} (ABCDE) per D1
481
- │ ├── Service: {name} (ABCDE) per D1
482
- │ ├── Amount: {converted} per D2
483
- │ └── Order: (ABCDE) per D1
484
- ├── Event type-specific fields (supplementary):
485
- │ ├── NewOrderEvent → sender, service, amount, object
486
- │ ├── ProgressEvent → order, operator, machine
487
- │ ├── ArbEvent → arbitration, voter, order, service
488
- │ ├── DemandPresentEvent → demand, presenter, service
489
- │ ├── DemandFeedbackEvent → demand, feedbacker
490
- │ └── NewEntityEvent → entity
491
- ├── Missing fields:
492
- │ ├── No sender → (UNKNOWN)
493
- │ ├── No amount → -
494
- │ └── No time → N/A
495
- └── {name} follows Display Format Rules:
496
- ├── Both names → account | local_mark (ABCDE)
497
- ├── One name → {name} (ABCDE)
498
- └── No name → (ABCDE)
499
- ```
500
-
501
- ### D4: Response Type Classification
502
-
503
- ```
504
- A WoWok tool response is received:
505
- ├── What is the top-level structure?
506
- │ ├── Single object (has fields like id, name, balance, etc.)
507
- │ │ └── Type: object → Apply address/amount formatting to fields
508
- │ ├── Array of objects (has length, items)
509
- │ │ └── Type: list → Apply formatting to each item, render as table or list
510
- │ ├── Event list (items have type field matching event types)
511
- │ │ └── Type: event → Apply event table rendering (D3)
512
- │ ├── Transaction digest (has digest field)
513
- │ │ └── Type: transaction → Display digest, offer to query result
514
- │ ├── Error message (has error field)
515
- │ │ └── Type: error → Display error, suggest remediation
516
- │ └── Mixed (object with nested events, amounts, addresses)
517
- │ └── Type: mixed → Apply all relevant formatting rules
518
- └── After classification, route to the appropriate formatting rounds:
519
- ├── Has addresses → R2 (shortening) + R3 (resolution)
520
- ├── Has amounts → R4 (detection) + R5 (conversion)
521
- ├── Has events → R6 (classification) + R7 (table rendering)
522
- └── Has unknown fields → R8 (explanation on request)
523
- ```
524
-
525
- ### D5: Name Resolution Priority
526
-
527
- ```
528
- Querying local_names for an address:
529
- ├── Query: query_toolkit → local_names with the address
530
- ├── Response contains:
531
- │ ├── account field (account name)
532
- │ │ ├── Present → Use as primary name
533
- │ │ └── Absent → No account name
534
- │ ├── local_mark field (local_mark name)
535
- │ │ ├── Present → Use as secondary name
536
- │ │ └── Absent → No local_mark name
537
- │ └── address field (the queried address)
538
- │ └── Always present (confirms the query matched)
539
- ├── Display format based on resolution:
540
- │ ├── Both present → {account} | {local_mark} (ABCDE)
541
- │ │ Priority: account name first, then local_mark
542
- │ ├── Only account → {account} (ABCDE)
543
- │ ├── Only local_mark → {local_mark} (ABCDE)
544
- │ └── Neither → (ABCDE)
545
- ├── Name Length Limit (max 20 chars):
546
- │ ├── account name > 20 chars → truncate to 17 + "..."
547
- │ ├── local_mark name > 20 chars → truncate to 17 + "..."
548
- │ └── Combined format > 20 chars → truncate the longer name first
549
- └── Consistency: Same address always displays the same way
550
- within a single output (cache the resolution for the session)
551
- ```
552
-
553
- ---
554
-
555
- ## Failure Playbooks
556
-
557
- ### F1: Address Resolution Fails (No local_names Match)
558
-
559
- **Trigger**: An address in the response has no entry in `local_names`. The `query_toolkit` → `local_names` query returns empty for this address.
560
-
561
- **Diagnosis**:
562
- - The address has never been assigned a local name (account or local_mark).
563
- - The address belongs to an external account not in the user's local registry.
564
- - The local_names query failed (network error, cache issue).
565
-
566
- **Recovery**:
567
- 1. Display the address with short format only: `(ABCDE)`.
568
- 2. Do not display a name (since none exists).
569
- 3. If the user asks "who is this address?" → query `onchain_objects` for the address to see if it's a known object type (Service, Machine, Guard, etc.).
570
- 4. If the user wants to assign a name → `local_mark_operation` to create a local mark for this address.
571
-
572
- **Prevention**: Always handle the "neither exists" case in the Display Format Rules. Display `(ABCDE)` without a name. Do not fabricate names.
573
-
574
- ### F2: Token Metadata Unavailable
575
-
576
- **Trigger**: An amount in the response has an identifiable token type, but `query_toolkit` → `token_list` fails to return metadata (decimals, symbol).
577
-
578
- **Diagnosis**:
579
- - The token is not in the local token registry.
580
- - The token has been delisted or is unknown to the WoWok SDK.
581
- - The `token_list` query failed (network error, cache issue).
582
- - The token type was inferred incorrectly.
583
-
584
- **Recovery**:
585
- 1. Apply the Conservative Principle: display the raw amount.
586
- - Example: `500000000` (no symbol, no conversion).
587
- 2. Do NOT guess or hardcode token decimals.
588
- 3. Inform the user: "Token metadata unavailable. Displaying raw amount."
589
- 4. If the user knows the token decimals → let them specify, then convert manually.
590
- 5. If the token is WOW (`0x2::wow::WOW`) → it's safe to use 9 decimals (protocol default), but still query to confirm.
591
-
592
- **Prevention**: NEVER assume token decimals. ALWAYS query via `query_toolkit` with `query_type: "token_list"`. If the query fails, display raw amounts. This is documented in the Conservative Principle and §Amount Formatting Rules.
593
-
594
- ### F3: Event Type Unknown
595
-
596
- **Trigger**: An event in the response has a `type` field that doesn't match any known event type (NewOrderEvent, ProgressEvent, ArbEvent, DemandPresentEvent, DemandFeedbackEvent, NewEntityEvent).
597
-
598
- **Diagnosis**:
599
- - The event is a new type added in a recent WoWok protocol upgrade.
600
- - The event type string is malformed or uses a different naming convention.
601
- - The event is from a custom module not covered by the standard event types.
602
-
603
- **Recovery**:
604
- 1. Display all available fields in the event.
605
- 2. Note: "Unknown event type. Displaying all fields."
606
- 3. Do NOT attempt to map it to a known type.
607
- 4. If the user asks → query the schema via `schema_query` for the event type definition.
608
- 5. If the event type is from a custom module → display the raw event data.
609
-
610
- **Prevention**: Maintain the event type field reference table (§Event Type Fields). When new event types are added to the WoWok protocol, update the table. For unknown types, always display all fields rather than omitting data.
611
-
612
- ### F4: User Requests Full Addresses (Override Condition)
613
-
614
- **Trigger**: The user explicitly says "show full addresses", "do not abbreviate", or similar. The shortening rules must be disabled for this response.
615
-
616
- **Diagnosis**:
617
- - The user wants to see complete 66-character addresses for verification or copying.
618
- - The override condition is active for this response (or session).
619
-
620
- **Recovery**:
621
- 1. Disable the Short Address Format for this response.
622
- 2. Display complete 66-character addresses: `0xa1d421902a3e5f2e4da7590e8f243712b3b3479d1a07c48c2de543184fc97a33`.
623
- 3. Still apply name resolution (if names exist, display `{name} {full_address}`).
624
- 4. If the user later says "shorten addresses" or "use short format" → re-enable shortening.
625
-
626
- **Prevention**: Always check for the override condition at R2 (Address Extraction & Shortening). The condition is documented in §Override Condition. Respect the user's preference for the session.
627
-
628
- ### F5: Amount Overflow / Precision Loss
629
-
630
- **Trigger**: An amount conversion results in a very small number (e.g., `0.000000001`) or a very large number (e.g., `1000000000000`), causing display issues.
631
-
632
- **Diagnosis**:
633
- - Very small: the raw amount is small relative to the token's decimals (e.g., 1 unit with 9 decimals = 0.000000001).
634
- - Very large: the raw amount is very large (e.g., billions of units).
635
- - Standard float display may lose precision or use scientific notation.
636
-
637
- **Recovery**:
638
- 1. For very small numbers: display with full precision. Do NOT round.
639
- - Example: `0.000000001 WOW (9P)` (not `1e-9 WOW`).
640
- 2. For very large numbers: use thousand separators for readability.
641
- - Example: `1,000,000 WOW (9P)` (not `1000000 WOW`).
642
- 3. If precision is critical (financial contexts): display both raw and converted.
643
- - Example: `500000000 (0.5 WOW, 9 decimals)`.
644
- 4. If the number is too large for standard display → use scientific notation with a note.
645
- - Example: `1e18 WOW (9P) — very large amount, verify raw value: 1000000000000000000`.
646
-
647
- **Prevention**: Always use integer arithmetic for conversion (raw / 10^decimals). Avoid float precision loss. For display, format with appropriate precision based on the token's decimals.
648
-
649
- ### F6: Mixed Response Types (Addresses + Amounts + Events)
650
-
651
- **Trigger**: A single response contains multiple types of data: addresses, amounts, and events. The formatting rules must be applied consistently across all types.
652
-
653
- **Diagnosis**:
654
- - The response is a complex object with nested fields (e.g., a Service object with `machine`, `sales`, `arbitrations`).
655
- - Addresses, amounts, and events are intermixed.
656
- - Risk of inconsistent formatting (same address displayed differently in different parts of the response).
657
-
658
- **Recovery**:
659
- 1. Extract ALL addresses first (R2), deduplicate, and resolve names (R3) in a single pass.
660
- 2. Extract ALL amounts (R4), query token metadata once per token type (R5).
661
- 3. Extract ALL events (R6), render in table format (R7).
662
- 4. Assemble the final output (R9) with consistent formatting:
663
- - Same address always displays the same way (cache the resolution).
664
- - Same token always uses the same decimals/symbol (cache the metadata).
665
- 5. If the response is very complex → summarize, offer to show full details on request.
666
-
667
- **Prevention**: Process all addresses, amounts, and events in separate passes (R2-R3, R4-R5, R6-R7) before assembling the final output (R9). Cache resolutions and metadata for consistency. The Implementation Checklist (R9) ensures all types are processed.
668
-
669
- ---
670
-
671
- ## Tier Layering
672
-
673
- ### Novice — Basic Address Shortening and Amount Display
674
-
675
- **Profile**: First-time user. Needs simple, readable output. Not concerned with advanced formatting or field explanations.
676
-
677
- **AI Behavior**:
678
- - Always apply the Short Address Format: `(ABCDE)`.
679
- - For amounts: always query `token_list` for WOW (9 decimals). For unknown tokens, display raw.
680
- - For events: render in the standard table format with all columns.
681
- - Do NOT offer field explanations unless the user asks.
682
- - Do NOT offer full address override unless the user asks.
683
- - Keep output concise: summaries over full details.
684
- - For complex responses: display a summary, offer to show more on request.
685
-
686
- **Typical Journey**: R1 (detect) → R2 (shorten addresses) → R3 (resolve names, basic) → R4-R5 (WOW amounts only) → R7 (event table) → R9 (assemble) → R10 (deliver).
687
-
688
- ### Advanced — Full Name Resolution and Event Table Rendering
689
-
690
- **Profile**: Experienced user. Wants full name resolution, multi-token support, and detailed event tables. May ask for field explanations.
691
-
692
- **AI Behavior**:
693
- - Apply full Display Format Rules: `{account} | {local_mark} (ABCDE)`.
694
- - For amounts: query `token_list` for all identifiable tokens. Support multi-token responses.
695
- - For events: render in table format with type-specific key fields.
696
- - Proactively offer field explanations for non-obvious fields.
697
- - Support full address override: detect when the user requests full addresses.
698
- - For complex responses: display full details with consistent formatting.
699
- - Support pagination for large event lists (>20 events).
700
-
701
- **Typical Journey**: R1 (detect) → R2 (shorten) → R3 (full resolution) → R4-R5 (multi-token) → R6-R7 (event classification + table) → R8 (field explanations on request) → R9 (assemble) → R10 (deliver with follow-up offers).
702
-
703
- ### Expert — Custom Formatting and Batch Processing
704
-
705
- **Profile**: Power user. Manages multiple queries. Wants custom formatting, batch processing, and consistent display across responses.
706
-
707
- **AI Behavior**:
708
- - Support custom display preferences: user-configurable name length limit, preferred address format, amount precision.
709
- - For batch queries: process multiple responses in a single pass, maintain consistent formatting across all.
710
- - Cache name resolutions and token metadata across responses for consistency.
711
- - Support advanced event filtering: filter by event type, time range, sender, service.
712
- - Support export format: render output as Markdown table, CSV, or JSON for external use.
713
- - For very large responses: paginate, summarize, offer drill-down.
714
- - Support comparative display: show before/after state for operations that modify objects.
715
- - Integrate with [wowok-safety](../wowok-safety/SKILL.md) R10 (Post-Operation Verification): display state changes clearly, highlight differences.
716
-
717
- **Typical Journey**: R1 (detect, batch) → R2 (shorten, batch) → R3 (full resolution, cached) → R4-R5 (multi-token, cached) → R6-R7 (event classification, filtered table) → R8 (field explanations, proactive) → R9 (assemble, custom format) → R10 (deliver with export options).
150
+ ## Appendices (Progressive Disclosure)
151
+
152
+ > The following sections have been extracted to [APPENDIX.md](./APPENDIX.md) for on-demand loading:
153
+ > - Dialogue Scripts (R1-R10) — guided conversation scripts
154
+ > - Decision Trees branching logic reference
155
+ > - Failure Playbooks — recovery scenarios
156
+ > - Tier Layering expertise-tier based guidance
157
+ >
158
+ > Load APPENDIX.md when the user needs guided dialogue, recovery help, or tier-specific guidance.