@wowok/skills 3.0.2 → 3.0.4

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.
@@ -2764,6 +2764,12 @@ If customer doesn't return within 10 days, merchant can mark as Return Fail.
2764
2764
 
2765
2765
  ## Part 4: Fund Allocation
2766
2766
 
2767
+ > **IMPORTANT — Per-order Allocation**: Every order created via `service order_new` gets its **own** `Allocation` object (the Service-level `myshop_allocation_v2` is only the allocator **template** — it holds no funds). The order's escrow lives at the address in the Order's `allocation` field. `alloc_by_guard` MUST target that **per-order Allocation**, not the service-level one — otherwise the transaction aborts with `Insufficient balance` (abort code 7 in `allocation::alloc`).
2768
+ >
2769
+ > Resolve it from the Order object: query `myshop_order_v2` → read its `allocation` field (e.g. `0x1db0a7c9...`) → use that address as `object` below.
2770
+ >
2771
+ > **CoinWrapper claim (auto since SDK 2026-09)**: `alloc_by_guard` pays each recipient a `CoinWrapper` object (contract-side escrow, `payment::transfer_multi_imp`). The SDK **auto-claims the wrappers this tx created for the signer** (`payment::unwrap_to_myself`) right after the alloc commits — for the Signer-recipient refund case the tokens land directly in the caller's wallet in one logical operation. Manual claim (`operation_type: "payment"` `{object: "<coinwrapper_id>", receive: true}`) is only needed for legacy/historical wrappers or wrappers received from another party's transaction. Object recipients (Order escrow / Treasury) claim through their own receive entries (`order receive` / `treasury receive`) as before.
2772
+
2767
2773
  ### Merchant Wins (Order Complete, Wonderful, Return Fail)
2768
2774
 
2769
2775
  When order reaches Order Complete, Wonderful, or Return Fail, merchant can withdraw funds.
@@ -2776,7 +2782,7 @@ When order reaches Order Complete, Wonderful, or Return Fail, merchant can withd
2776
2782
  "data": {
2777
2783
  "operation_type": "allocation",
2778
2784
  "data": {
2779
- "object": "myshop_allocation_v2",
2785
+ "object": "<order_allocation_address — from myshop_order_v2.allocation>",
2780
2786
  "alloc_by_guard": "service_merchant_win_v2"
2781
2787
  },
2782
2788
  "env": {
@@ -2822,7 +2828,7 @@ When order reaches Lost or Return Complete, customer can withdraw funds.
2822
2828
  "data": {
2823
2829
  "operation_type": "allocation",
2824
2830
  "data": {
2825
- "object": "myshop_allocation_v2",
2831
+ "object": "<order_allocation_address — from myshop_order_v2.allocation>",
2826
2832
  "alloc_by_guard": "service_customer_win_v2"
2827
2833
  },
2828
2834
  "env": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wowok/skills",
3
- "version": "3.0.2",
3
+ "version": "3.0.4",
4
4
  "description": "WoWok AI Skills for Claude and other AI assistants - Dialogue orchestration layer on top of the WoWok MCP server (rules/reference knowledge is served by MCP directly since v2.0.0)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -20,6 +20,8 @@
20
20
  "wowok-onboard/",
21
21
  "wowok-planner/",
22
22
  "wowok-auditor/",
23
+ "wowok-governance/",
24
+ "wowok-market/",
23
25
  "examples/",
24
26
  "scripts/install.js",
25
27
  "README.md",
@@ -41,6 +41,7 @@ const SKILL_DIRS = [
41
41
  'wowok-supplier',
42
42
  'wowok-collaborator',
43
43
  'wowok-market',
44
+ 'wowok-governance',
44
45
  ];
45
46
 
46
47
  /**
@@ -0,0 +1,115 @@
1
+ ---
2
+ name: wowok-governance
3
+ description: |
4
+ WoWok Governance — the canonical skill for on-chain permission, data, and
5
+ financial governance: the account that OWNS the objects keeps them healthy
6
+ after setup.
7
+
8
+ Covers Permission lifecycle (indexes, role assignment, entity table, admin
9
+ transfer), Treasury/Allocation fund stewardship (deposit/withdraw, history
10
+ audit, unclaimed payments), and Personal data boundaries (public identity,
11
+ profile records). Governance is a continuous loop — inventory, decide,
12
+ execute, audit — not a one-time setup.
13
+
14
+ For building services, see wowok-provider. For market operations, see
15
+ wowok-market.
16
+ when_to_use:
17
+ - User wants to manage who can operate their objects (permission indexes, entity table)
18
+ - User wants to deposit/withdraw treasury funds or audit fund history
19
+ - User has unclaimed payments or wants to check claimable balances
20
+ - User wants to update their public on-chain profile or personal data
21
+ - User mentions "permission", "treasury", "governance", "manage assets", "audit funds"
22
+ role: shared
23
+ loading: on-demand
24
+ related:
25
+ - wowok-provider
26
+ - wowok-market
27
+ - wowok-messenger
28
+ ---
29
+
30
+ # WoWok Governance Guide
31
+
32
+ > **Role**: Object owner/admin — the account that carries administrative responsibility for Permission, Treasury, and Personal objects
33
+ > **Related Skills**: [wowok-provider](../wowok-provider/SKILL.md) (service build), [wowok-market](../wowok-market/SKILL.md) (market ops), [wowok-messenger](../wowok-messenger/SKILL.md) (contact)
34
+
35
+ ---
36
+
37
+ ## MCP Knowledge Layer
38
+
39
+ The following content has been pushed down to the MCP knowledge layer and is applied automatically — this Skill does NOT duplicate it:
40
+
41
+ | Content | Access via (MCP action) | Applied Via |
42
+ |---------|--------------------------|-------------|
43
+ | Permission safety rules (owner/admin/entity hierarchy) | `schema_query` action='get_safety_rules' | `onchain_operations` permission |
44
+ | Treasury/Permission/Personal object schema | `schema_query` action='get_schema' | governance operations |
45
+ | Unclaimed-payment detection | `keeper_operation` (payment_unclaimed scan) | monitor loop |
46
+ | Fund-flow event meanings (TreasuryEvent / AllocationEvent / RewardClaimEvent / RewardFundEvent) | event semantic registry | audit & monitor |
47
+
48
+ This Skill keeps the governance **conversation flow** — what to inventory, what to decide, what to execute, and how to audit.
49
+
50
+ ---
51
+
52
+ ## Governance Is a Loop, Not a Setup
53
+
54
+ Inventory → Decide → Execute → Audit. Governance objects are LIVE: a permission change takes effect on the next call, a withdraw is irreversible, a personal profile record is permanently public. Every change deserves an audit pass after execution.
55
+
56
+ ---
57
+
58
+ ## Domain 1: Permission Governance
59
+
60
+ A Permission object defines WHO can perform WHICH operations on your business objects (Service / Machine / Treasury …).
61
+
62
+ - **Indexes** (`permission.index_create`): create named role indexes (e.g. operator=1, finance=2) before assigning.
63
+ - **Role assignment** (`permission.role_assign`): bind indexes onto target objects — a mis-assigned role grants unintended operational authority immediately.
64
+ - **Entity table**: add/remove addresses per index. Review-first: list current entities before mutating (`query_objects` on the Permission object).
65
+ - **Audit**: `query_toolkit` query_type='onchain_table_item_permission_perm' checks what a specific address may do; query_type='address_profile' shows an address's permission memberships across all objects.
66
+
67
+ Rules of thumb:
68
+ - One Permission per business object family; reuse named indexes, don't proliferate unnamed ones.
69
+ - Removing an entity is immediate — the next operation by that address fails with "Permission denied" (abort code 5).
70
+ - Admin transfer is a high-trust operation: the new admin controls the whole table.
71
+
72
+ ---
73
+
74
+ ## Domain 2: Financial Governance
75
+
76
+ Fund stewardship across Treasury / Allocation / Reward / Payment.
77
+
78
+ - **Treasury**: deposit joins coins in (a Payment receipt is minted); withdraw splits balance out — irreversible, and when an `external_guard` is set the guard must validate first. `query_toolkit` query_type='onchain_table_item_treasury_history' audits every flow (op 0 Withdraw / 1 Deposit / 2 Receive) with amount + guard + timestamp.
79
+ - **Allocation**: runs distribute pool funds per sharing mode (Amount / Rate ‰ / Surplus). Review allocator guards periodically — a stale guard blocks legitimate distributions.
80
+ - **Unclaimed payments**: recipients hold frozen CoinWrappers until they unwrap. The keeper `payment_unclaimed` scan owns this reminder surface — run `keeper_operation` to list claimable payments and nudge recipients via Messenger. NewPaymentEvent is deliberately NOT push-bridged, to avoid duplicate reminders (P2-4 channel split).
81
+ - **Reward pools**: RewardFundEvent in / RewardClaimEvent out; a dry pool blocks claims — watch balances before announcing campaigns.
82
+
83
+ ---
84
+
85
+ ## Domain 3: Data Governance
86
+
87
+ - **Personal profile** (`personal` operations): your public on-chain identity. Everything here is PERMANENTLY PUBLIC — never anchor private data. Review-first: show the current record before every mutation.
88
+ - **Entity info**: description/info updates re-emit NewEntityEvent — counterparties' cached profiles refresh; keep descriptions accurate.
89
+ - **Repository data**: contribution/usage policies are designed at Repository level (see wowok-provider); governance audits consumption through the event stream.
90
+
91
+ ---
92
+
93
+ ## Monitor Loop
94
+
95
+ Governance goals close the loop through three channels:
96
+
97
+ - **Push**: fund-flow events (TreasuryEvent / AllocationEvent / RewardClaimEvent / RewardFundEvent) become goal-bound suggestions via SuggestionBridge.
98
+ - **Pull**: keeper scans (payment_unclaimed, balance thresholds) repeat reminders until resolved.
99
+ - **Audit**: after every governance write, re-query the object and confirm the post-state matches the intent.
100
+
101
+ ---
102
+
103
+ ## Core Interaction Principles
104
+
105
+ 1. **Review-first**: always show current state + the exact delta before executing.
106
+ 2. **User-driven**: surface options, never auto-execute — withdraw and admin transfer are irreversible.
107
+ 3. **Disclose irreversibility**: say it explicitly for withdraw, admin transfer, and any personal-data write.
108
+ 4. **Audit after**: every governance write ends with a re-query confirmation.
109
+
110
+ ## Quick Reference
111
+
112
+ - Permission: indexes → role assignment → entity table; audit via permission_perm + address_profile.
113
+ - Treasury: deposit/withdraw + history audit; external_guard gates withdrawals.
114
+ - Unclaimed payments: keeper scan owns reminders; recipients unwrap CoinWrappers.
115
+ - Personal data: permanently public — review before every write.
@@ -0,0 +1,98 @@
1
+ ---
2
+ name: wowok-market
3
+ description: |
4
+ WoWok Market — the canonical skill for market discovery and operations. It
5
+ covers the "matchmaking + operations" layer (K3 13/14/15): how a demand finds
6
+ candidate services, how a merchant picks a trustworthy arbitrator, how the
7
+ account's on-chain attention is surfaced, and how the market is measured and
8
+ governed.
9
+
10
+ Covers match_discover / discover_services / discover_demands (discovery),
11
+ arbitration_score (trust selection), account_events (attention), market_metrics
12
+ (supply/demand/trust), anti_cheat (governance), market_operations (journey
13
+ funnel / referral / CRM), and category match rules.
14
+
15
+ For the merchant who owns a Service, see wowok-provider. For the customer
16
+ placing an order, see wowok-order. For the arbitrator, see wowok-arbitrator.
17
+ when_to_use:
18
+ - User wants to discover services for an intent ("find a plumber in Shanghai")
19
+ - Merchant wants to discover open Demands to present to
20
+ - Merchant wants to pick/compare arbitrators (arbitration_score)
21
+ - User wants their on-chain attention items surfaced (account_events)
22
+ - User wants market metrics / anti-cheat signals / journey funnel / referral / CRM
23
+ - User mentions "market", "match", "discover", "matchmaking", "operations", "funnel", "referral", "customer relationship"
24
+ ---
25
+
26
+ # WoWok Market Guide
27
+
28
+ > **Role**: Market discovery & operations (matchmaking + Observe layer)
29
+ > **Related Skills**: [wowok-provider](../wowok-provider/SKILL.md) (merchant), [wowok-order](../wowok-order/SKILL.md) (customer), [wowok-arbitrator](../wowok-arbitrator/SKILL.md) (arbitrator), [wowok-supplier](../wowok-supplier/SKILL.md) (demand presenter)
30
+
31
+ ---
32
+
33
+ ## MCP Knowledge Layer
34
+
35
+ The matching/routing/aggregation logic is pushed down to MCP and applied automatically — this Skill does NOT duplicate it. All market actions live under `evaluation_operation`:
36
+
37
+ | Capability | MCP action | Purpose |
38
+ |------------|------------|---------|
39
+ | Service discovery (intent → candidates) | `match_discover` / `discover_services` | enumerate + location gate + 6-dim score |
40
+ | Demand discovery (merchant → open demand) | `discover_demands` | enumerate shared Demands |
41
+ | Arbitrator trust selection | `arbitration_score` | dual-perspective trust/fairness |
42
+ | Account attention | `account_events` | unread messenger / collectible / arbitrable |
43
+ | Market metrics | `market_metrics` | supply / demand / trust counts |
44
+ | Anti-cheat | `anti_cheat` | fake order / fake review / shell merchant |
45
+ | Operational aggregation | `market_operations` | journey funnel / referral / CRM |
46
+
47
+ This Skill keeps the **market conversation flow** — discover → compare → trust → act → measure. The MCP layer handles enumeration, scoring, and chain-derived aggregation.
48
+
49
+ ---
50
+
51
+ ## Core Interaction Principles
52
+
53
+ 1. **Review-first**: State (a) what the AI understood, (b) the decision order, and (c) the interaction contract — before the first choice.
54
+ 2. **User-driven**: Every step is an explicit user decision; the AI provides a `recommend` but never auto-advances.
55
+ 3. **Neutrality**: the AI surfaces trade-offs and scores, never chooses the branch for the user.
56
+
57
+ ---
58
+
59
+ ## Phase 1: Discover (intent → candidates)
60
+
61
+ **Demand side** — `evaluation_operation` action=`match_discover`:
62
+ - Provide `description` + `location` (+ optional `budget`, `required_capabilities`, `category`).
63
+ - Returns location-gated, 6-dimension-scored services + recommendation reasons.
64
+ - `category` (e.g. `life_service` / `retail`) applies hard-constraint filtering + weight re-anchoring (K3 15 §3).
65
+
66
+ **Merchant side** — `evaluation_operation` action=`discover_demands`:
67
+ - Enumerate open Demands (optional `location` filter).
68
+ - A Demand carries rewards (incentive pointers); read the Reward objects by id for amounts.
69
+
70
+ ---
71
+
72
+ ## Phase 2: Compare & Trust
73
+
74
+ - **Compare**: the `match_discover` result already surfaces per-service scores + reasons. Surface the top-N side-by-side; highlight differences, never force a single pick.
75
+ - **Arbitrator trust**: `evaluation_operation` action=`arbitration_score` with the Arbitration `object` (history auto-fetched via `query_arbs`). Returns `trust` + `fairness` + `combined`. Use it when a merchant chooses which Arbitration to bind, or a customer judges a Service's arbitration guarantee.
76
+
77
+ ---
78
+
79
+ ## Phase 3: Act
80
+
81
+ - **Attention**: `evaluation_operation` action=`account_events` with the account — surfaces actionable items (unread messages, collectible payments, demand presented). Let the user act on each, never auto-act.
82
+ - **Discovery → order**: hand off to [wowok-order](../wowok-order/SKILL.md) for due diligence + order placement once the user picks a service.
83
+
84
+ ---
85
+
86
+ ## Phase 4: Measure & Govern
87
+
88
+ - **Metrics**: `evaluation_operation` action=`market_metrics` → active services / open demands / disputes / supply-demand ratio.
89
+ - **Anti-cheat**: `evaluation_operation` action=`anti_cheat` with a Service's orders/reviews/object-stack → returns negative-factor signals (fake order / fake review / shell merchant).
90
+ - **Operations**: `evaluation_operation` action=`market_operations` with `op` = `journey_funnel` / `referral_attribution` / `customer_relationship`.
91
+
92
+ ---
93
+
94
+ ## Design Principles
95
+
96
+ - **Events signal opportunities only**: chain events are emitted only for participatable/profitable opportunities (K3 13 §6.7) — not for create/pause/noise.
97
+ - **Read the object for authority**: event previews (description ≤260 chars, reward addresses) are routing hints; amounts and authoritative state are read from the object by id.
98
+ - **No fabricated matching**: always run the MCP enumeration/scoring; never invent candidates or scores.