@wowok/skills 3.1.2 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -7
- package/dist/installer.d.ts +4 -3
- package/dist/installer.d.ts.map +1 -1
- package/dist/installer.js +61 -13
- package/dist/installer.js.map +1 -1
- package/dist/targets.d.ts +34 -9
- package/dist/targets.d.ts.map +1 -1
- package/dist/targets.js +135 -21
- package/dist/targets.js.map +1 -1
- package/package.json +2 -2
- package/wowok-arbitrator/SKILL.md +60 -189
- package/wowok-auditor/SKILL.md +3 -3
- package/wowok-collaborator/SKILL.md +33 -73
- package/wowok-governance/SKILL.md +32 -71
- package/wowok-machine/SKILL.md +64 -206
- package/wowok-market/SKILL.md +25 -62
- package/wowok-messenger/SKILL.md +50 -172
- package/wowok-onboard/SKILL.md +50 -124
- package/wowok-order/SKILL.md +93 -211
- package/wowok-output/SKILL.md +59 -168
- package/wowok-planner/SKILL.md +26 -74
- package/wowok-provider/SKILL.md +66 -168
- package/wowok-supplier/SKILL.md +51 -76
package/wowok-machine/SKILL.md
CHANGED
|
@@ -2,255 +2,113 @@
|
|
|
2
2
|
name: wowok-machine
|
|
3
3
|
description: "WoWok Machine Workflow Design — design, build and operate workflow templates (Machines): directed graphs that define how orders progress through stages, who can advance them, and what conditions must be met at each step. Covers Nodes/Pairs/Forwards/Guards/Thresholds, lifecycle (create, configure, publish, pause), node and forward operations, Progress integration, cross-Machine supply chains via Guard verification, and machineNode2file import/export. Use when: User wants to create or modify a Machine workflow; User asks about workflow steps, state transitions, or progress; User needs to design order processing pipelines; User mentions \"machine\", \"workflow\", \"progress\", \"state machine\", \"pipeline\"; User wants to export/import Machine nodes via a file; User needs threshold mechanics, forward permissions, or guard bindings."
|
|
4
4
|
metadata:
|
|
5
|
-
version: "2.
|
|
5
|
+
version: "2.1.0"
|
|
6
6
|
role: provider
|
|
7
7
|
related: "wowok-provider"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# WoWok Machine Workflow Design
|
|
11
11
|
|
|
12
|
-
Design, build, and operate automated workflow templates.
|
|
13
|
-
|
|
14
12
|
> **Role**: Service Provider or Workflow Designer
|
|
15
|
-
> **
|
|
16
|
-
> **Related
|
|
13
|
+
> **Main tool**: `onchain_operations` operation_type=`machine` (schema file `onchain_operations_machine`)
|
|
14
|
+
> **Related**: [wowok-provider](../wowok-provider/SKILL.md) (Service binding) · [wowok-order](../wowok-order/SKILL.md) (execution) · [wowok-messenger](../wowok-messenger/SKILL.md) (privacy)
|
|
17
15
|
|
|
18
16
|
---
|
|
19
17
|
|
|
20
|
-
##
|
|
21
|
-
|
|
22
|
-
**Machine** = workflow blueprint (directed graph of Nodes → Pairs → Forwards). **Progress** = live workflow instance, one per order.
|
|
23
|
-
|
|
24
|
-
Machines are **immutable after `publish: true`**; Guards are **CREATE-only**. Design the complete workflow before publishing.
|
|
25
|
-
|
|
26
|
-
## MCP Knowledge Layer
|
|
18
|
+
## What the MCP already handles
|
|
27
19
|
|
|
28
|
-
|
|
20
|
+
- Node topology validation (entry forward required, malformed pairs) at schema + publish time; risk aggregation via `goal_operation` action=`aggregate_risks`, incl. the R-M1-11 refund-terminal rule.
|
|
21
|
+
- Guard design patterns / Guard instructions / safety rules: `schema_query` actions `get_guard_design_patterns`, `get_safety_rules` (instructions list also via `wowok_buildin_info`).
|
|
22
|
+
- Industry default shapes: `industry_pack_operation` action=`list_modes` (e.g. the `rental` mode ships an R-M1-11-compliant topology).
|
|
23
|
+
- **Runtime execution routing**: `query_toolkit` query_type=`participation_radar` → `operable[].recommended_call` picks the exact tool/path for the signing account. Designers still need the identity model below; executors do not hand-route.
|
|
29
24
|
|
|
30
|
-
|
|
31
|
-
|---------|--------------------------|-------------|
|
|
32
|
-
| Node design rules (node type specs, forward guard patterns, topology limits) | auto-applied | Industry mode defaults (`industry_pack_operation` action='list_modes') + `goal_operation` action='aggregate_risks' |
|
|
33
|
-
| Machine scene/template selection | auto-applied | Industry mode defaults (`industry_pack_operation` action='list_modes') |
|
|
34
|
-
| Forward Guard design patterns | `schema_query` action='get_guard_design_patterns' | `goal_operation` action='aggregate_risks' |
|
|
35
|
-
| Safety rules (immutability, confirmation) | `schema_query` action='get_safety_rules' | Pre-publish checks + `goal_operation` action='aggregate_risks' |
|
|
36
|
-
| Publish gate (4-layer fail-closed: checklist → risk → user → environment) | auto-applied | `goal_operation` action='aggregate_risks' + pre-publish gate |
|
|
37
|
-
|
|
38
|
-
This Skill keeps the **workflow conversation guidance**, **business flow design patterns**, and **machine lifecycle scripts**. The MCP layer handles node-design rule evaluation, scene/template selection, and risk aggregation.
|
|
25
|
+
This skill keeps design conversation, topology patterns, and the lifecycle discipline.
|
|
39
26
|
|
|
40
27
|
---
|
|
41
28
|
|
|
42
|
-
##
|
|
43
|
-
|
|
44
|
-
**Machine** → **Nodes** → **Pairs** (`prev_node` ["" = the single entry pair — pair keys are unique on chain (`E_DUPLICATE_NODE_PREV`); its `forwards` vector may carry multiple forwards to different first nodes], `threshold` [required total forward weight to advance]) → **Forwards** (`name`, `weight`, `permissionIndex` | `namedOperator` [who can execute], `guard` [optional condition]).
|
|
45
|
-
|
|
46
|
-
> All field types, limits, and valid values are in the MCP schema (`onchain_operations_machine`). This document focuses on design decisions **not captured** by the schema.
|
|
47
|
-
|
|
48
|
-
### Forward Permission Model
|
|
49
|
-
|
|
50
|
-
| Field | Scope | When to Use |
|
|
51
|
-
|-------|-------|-------------|
|
|
52
|
-
| `permissionIndex` | Shared across ALL Progress instances | Internal staff (warehouse, admin, platform) — same for every order |
|
|
53
|
-
| `namedOperator` | Per-Progress namespace | Roles that differ per order (delivery person, reviewer, agent) |
|
|
54
|
-
|
|
55
|
-
- `namedOperator: ""` (empty string): grants **order owner and agents** the right to execute. Standard way to let customers operate. **⚠ Must be advanced via `order.progress`** (uses `order.has_op_permission`); direct `progress::next` aborts with Permission denied (code 5).
|
|
56
|
-
- `namedOperator: "<role_name>"`: role-based operators managed per Progress instance. Each Progress independently assigns addresses to role names. **Advanced via `progress.operate`** directly.
|
|
57
|
-
- **Both fields set**: executor needs EITHER permission — internal staff OR external roles. **Advanced via `progress.operate`** (the non-empty namedOperator takes precedence for routing).
|
|
58
|
-
- **Design principle**: Use custom permissions (dedicated Permission object with custom indices), not built-in indices. Define workflow-specific roles, reference those indices in Forwards.
|
|
59
|
-
|
|
60
|
-
### Guard on Forwards
|
|
61
|
-
|
|
62
|
-
A Guard validates the Forward's execution condition. **Retained submissions**: when `retained_submission` is set on a Guard, submitted values are stored in Progress history, uniquely located by `(current_node, next_node, forward_name)`. Later nodes query these values from history.
|
|
63
|
-
|
|
64
|
-
> **Guard construction**: Forward Guard design patterns (table design, computation trees, query instructions) now live in the MCP knowledge layer — query via `schema_query` action='get_guard_design_patterns', auto-applied via `goal_operation` action='aggregate_risks'. Query available Guard instructions via `wowok_buildin_info`.
|
|
65
|
-
|
|
66
|
-
### Threshold Mechanics
|
|
29
|
+
## Model
|
|
67
30
|
|
|
68
|
-
|
|
31
|
+
- **Machine** = blueprint. Node-centric encoding: each Node `{name, pairs: [{prev_node, threshold, forwards[]}]}` declares how work ENTERS it. `prev_node: ""` = entry pair (Progress starts at current node `""`). A `prev_node` must be unique within one node's pairs (`E_DUPLICATE_NODE_PREV` = 7); several different first nodes may each declare an entry pair.
|
|
32
|
+
- **Forward** = `{name, weight, namedOperator | permissionIndex (≥1 required), guard?}`. String shorthand `"g"` or object `{guard:"g", retained_submission:[1,2]}`.
|
|
33
|
+
- **Progress** = one live instance per order (auto-created by `order_new` on a Service with a bound Machine) or standalone via machine data `progress_new: {task?, repository?, progress_namedOperator?, namedNew?}`.
|
|
34
|
+
- **Freeze points**: a published Machine's nodes/pairs/forwards are immutable (`publish:true` also gates Service binding). A Guard is immutable **from creation** — a flawed Guard can never be edited, only replaced.
|
|
35
|
+
- `pause: true` stops NEW Progress being generated from the Machine; it does not freeze existing instances.
|
|
69
36
|
|
|
70
|
-
|
|
37
|
+
## Forward identity model (design-time)
|
|
71
38
|
|
|
72
|
-
|
|
39
|
+
| Binding | Shared across instances | Typical operator |
|
|
40
|
+
|---|---|---|
|
|
41
|
+
| `permissionIndex` (custom index ≥1000 recommended) | Yes — same role for every order | Internal staff, platform ops |
|
|
42
|
+
| `namedOperator: "<role>"` | No — addresses assigned per Progress namespace | Delivery person, reviewer, agent |
|
|
43
|
+
| `namedOperator: ""` | Order-scoped wildcard | The order owner + order agents |
|
|
73
44
|
|
|
74
|
-
|
|
45
|
+
Both may be set (executor needs EITHER). At runtime the radar resolves the path per account: order-holder wildcard → `onchain_operations` operation_type=`order` `data.progress` (calling the Progress entrypoint directly aborts permission#5); permission index / named role → `workflow_operation` action=`operate`. Do not put this routing table in application code — read `recommended_call`.
|
|
75
46
|
|
|
76
|
-
|
|
77
|
-
|---------|-----------|----------|
|
|
78
|
-
| Sequential | `threshold=1`, single Forward `weight=1` | Single actor each step |
|
|
79
|
-
| Parallel AND | `threshold=N`, N Forwards `weight=1` | All parties must contribute |
|
|
80
|
-
| Parallel OR | Multiple Pairs, each `threshold=1` | Mutually exclusive branches |
|
|
81
|
-
| Weighted Voting | `threshold=100`, varied weights (e.g., 60+40) | Unequal stakeholder power |
|
|
82
|
-
| Hybrid | `threshold=5`, mixed weights (3+1+1) | Key party required, others optional |
|
|
47
|
+
Every custom `permissionIndex` used MUST be granted in the bound Permission (`permission` op `add perm by index`) before publish. An ungranted index means the forward can never execute — Progress stuck forever; the handler warns, but the design review must catch it.
|
|
83
48
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
## Machine Lifecycle
|
|
87
|
-
|
|
88
|
-
### Dependency-First Construction
|
|
89
|
-
|
|
90
|
-
Build in this exact order: (1) Permission (CREATE/MODIFY) → access control foundation; (2) Machine (CREATE, unpublished) → define all nodes; (3) Guards (CREATE) → build validation conditions; (4) Bind Guards to Forwards (MODIFY Machine) → set `guard` on each Forward; all operations (`add`, `set`, `add forward`) accept full `MachineForward` including `guard` + `retained_submission`; (5) Publish Machine → nodes IMMUTABLE; (6) Bind Machine to Service → workflow goes live.
|
|
91
|
-
|
|
92
|
-
**Why this order matters**: Publishing locks the Machine. Guards are immutable. Publishing before Guards are ready means Guards can never be added — the Machine is frozen without validation rules. **Create Guards, test them, then publish.**
|
|
93
|
-
|
|
94
|
-
### Node Operations (Pre-Publish Only)
|
|
95
|
-
|
|
96
|
-
Nine operations are available via the `node` field. Key design notes not captured by schema:
|
|
49
|
+
## Guards on forwards
|
|
97
50
|
|
|
98
|
-
-
|
|
99
|
-
- `
|
|
100
|
-
-
|
|
101
|
-
-
|
|
51
|
+
- The Guard validates BEFORE the transition. A Guard reading the SAME Progress sees the source node — never write "current == target_node" (always fails). For post-transition verification, bind the Guard to the **Allocator** (`alloc` runs after the state transition).
|
|
52
|
+
- `retained_submission: [identifier…]` stores the submitted values on the forward's execution record in the Progress session/history (located by node + forward), so later nodes and cross-machine Guards can read them.
|
|
53
|
+
- **No on-chain cron (T1 lossy point)**: "after N days, auto-X" decomposes into a time Guard PLUS an off-chain keeper that submits the forward once it passes. A time Guard without a keeper never fires.
|
|
54
|
+
- Design every Guard via `get_guard_design_patterns`; test it with the standalone `gen_passport` operation BEFORE binding — immutability makes post-hoc fixes impossible.
|
|
102
55
|
|
|
103
|
-
|
|
56
|
+
## Sessions & thresholds
|
|
104
57
|
|
|
105
|
-
|
|
106
|
-
1.
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
58
|
+
- Executing forwards accumulates weight in a session keyed by target node; when total ≥ the pair's `threshold`, the session finalizes, history is appended, and the node transitions.
|
|
59
|
+
- **One forward = one weight contribution.** It locks to its first accomplisher: that account may re-submit to update message/evidence (no extra weight); any OTHER account re-executing it aborts `E_NOT_THE_HOLDER`. Threshold > 1 therefore requires DISTINCT forwards per contributor (e.g. `a` weight 1 + `b` weight 1), never one shared forward.
|
|
60
|
+
- If achievable weight (sum of distinct forwards) < threshold, the pair can NEVER complete — dead branch by construction.
|
|
61
|
+
- Competing pairs from one node: the first pair to reach its threshold wins; the other open sessions are abandoned. Mutual exclusion is intentional.
|
|
62
|
+
- Sessions persist on-chain until they finalize — there is no automatic expiry; only an explicit transition or order terminal resolves them.
|
|
110
63
|
|
|
111
|
-
|
|
64
|
+
| Pattern | Shape | Use |
|
|
65
|
+
|---|---|---|
|
|
66
|
+
| Sequential | threshold 1, one forward weight 1 | Single actor per step |
|
|
67
|
+
| Parallel AND | threshold N, N distinct forwards weight 1 | All parties must contribute |
|
|
68
|
+
| Parallel OR | multiple pairs each threshold 1 | Mutually exclusive branches |
|
|
69
|
+
| Weighted vote | threshold 100, weights 60/40/… | Unequal power |
|
|
70
|
+
| Hybrid | threshold 5, weights 3+1+1 | One required party + optional others |
|
|
112
71
|
|
|
113
72
|
---
|
|
114
73
|
|
|
115
|
-
##
|
|
116
|
-
|
|
117
|
-
### Machine vs Progress
|
|
118
|
-
|
|
119
|
-
- **Machine**: Workflow blueprint — defines the topology, permissions, thresholds, and Guards. Shared across all orders.
|
|
120
|
-
- **Progress**: Live instance — tracks current node, session state, history. One per order (when Service-bound) or standalone.
|
|
121
|
-
|
|
122
|
-
### Progress Creation
|
|
123
|
-
|
|
124
|
-
Two paths: **Service Order** (automatic when Order created on Service with bound Machine) or **Direct Creation** (via `progress_new`). For direct creation, pre-configure via `progress_new` fields on the Machine operation — this sets initial named operators, task binding, and repository list before the first Progress is spawned.
|
|
125
|
-
|
|
126
|
-
### Execution Paths
|
|
127
|
-
|
|
128
|
-
- **Order-associated Progress**: When a Forward uses `namedOperator: ""`, the order owner/agents execute via `order` operations.
|
|
129
|
-
- **Standalone Progress**: All other cases — advance via direct `progress` operations.
|
|
130
|
-
|
|
131
|
-
Two-phase operations (`hold`/`unhold`) allow locking resources during multi-step operations; `adminUnhold` force-releases stale locks.
|
|
74
|
+
## Lifecycle
|
|
132
75
|
|
|
133
|
-
|
|
76
|
+
1. Permission → 2. Machine unpublished (`object:{name, type_parameter, permission}`) → 3. Guards created + tested (`gen_passport`) → 4. bind Guards on forwards → 5. test end-to-end → 6. `publish:true` → 7. Service binds the Machine.
|
|
134
77
|
|
|
135
|
-
|
|
78
|
+
**Node field ops** (`data.node`, pre-publish only — 9): `add` / `set` (with `bReplace`, default false = MERGE into existing nodes; true = full replace), `remove`, `clear` (irreversible wipe — export first), `exchange` (swap two node positions), `rename` (updates pair references), `remove prior node`, `add forward`, `remove forward`. All forward-bearing ops accept the full forward shape including the Guard object with `retained_submission`.
|
|
136
79
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
**What the user sees**: At any node, callers can discover which Forwards are available (by querying the Machine definition and cross-referencing with their permissions). Executing a Forward that requires a Guard triggers Guard verification — the caller must submit required data. Successful Forward execution is recorded on-chain; failed Guard rejections are visible as transaction errors.
|
|
140
|
-
|
|
141
|
-
**Session lifecycle**: A session begins when the first Forward executes from a new node. It stays open until threshold is met (closing the session and advancing) or the order completes/aborts. No session timeout — sessions persist until resolved. `hold`/`unhold` lock the session during multi-step external operations; `adminUnhold` force-releases stale locks.
|
|
142
|
-
|
|
143
|
-
> **Order-associated execution**: Forwards with `namedOperator: ""` are executable via `order` operations by the order owner/agents. All other Forwards use `progress` operations. See [wowok-order](../wowok-order/SKILL.md) for the customer execution flow.
|
|
80
|
+
**File workflow**: `machineNode2file` exports the exact on-chain node set; edit; then `data.node: {json_or_markdown_file: "<path>"}` performs a COMPLETE replacement (node array, not an op object; JSON or ```json markdown). Always start from an export.
|
|
144
81
|
|
|
145
82
|
---
|
|
146
83
|
|
|
147
|
-
##
|
|
148
|
-
|
|
149
|
-
### Multi-Path Workflow Example
|
|
150
|
-
|
|
151
|
-
**MyShop Advanced** — demonstrates branching, dual-signature, and time guards:
|
|
152
|
-
```
|
|
153
|
-
Shipping → Delivery Complete → Order Complete
|
|
154
|
-
│ ├──→ Wonderful (rating, reward)
|
|
155
|
-
│ ├──→ Order Complete (time guard: ≥10 days, anyone push)
|
|
156
|
-
│ └──→ Lost (threshold: 2, merchant+customer dual-sig)
|
|
157
|
-
│
|
|
158
|
-
└── Delivery Complete → Non-receipt Return (threshold: 2)
|
|
159
|
-
└──→ Receipt Return (threshold: 2) → Return Fail (time guard)
|
|
160
|
-
└──→ Return Complete
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
### Cross-Machine Supply Chain Composition
|
|
164
|
-
|
|
165
|
-
Decompose complex workflows into multiple Machines connected by Guard-based validation — avoiding monolithic bloat.
|
|
166
|
-
|
|
167
|
-
**Sub-Progress Dependency**: Machine A's Forward Guards query Machine B's Progress to verify it has reached a target node before advancing.
|
|
168
|
-
|
|
169
|
-
**Sub-Order Verification**: Machine A's Forward Guard validates an Order exists on another Service with its Progress at the required state. The sub-order is created independently — the Guard only verifies.
|
|
170
|
-
|
|
171
|
-
**Multi-Party Chain**: Supplier → Manufacturer → Retailer, each Machine's entry condition verifies upstream completion via Guards querying `retained_submission` values.
|
|
172
|
-
|
|
173
|
-
**When to decompose** into multiple Machines:
|
|
174
|
-
- A sub-process is independently valuable as a standalone Service
|
|
175
|
-
- Different participant sets operate in different phases
|
|
176
|
-
- The sub-process is reusable across multiple parent workflows
|
|
177
|
-
|
|
178
|
-
**When to keep in one**:
|
|
179
|
-
- Same participants and permission model throughout
|
|
180
|
-
- Dense sequential data flow with no clear boundary
|
|
181
|
-
|
|
182
|
-
**Questions to ask the user**:
|
|
183
|
-
1. "Are there phases handled by different teams or services?"
|
|
184
|
-
2. "Could any part be offered as a standalone service?"
|
|
185
|
-
3. "Does any step depend on an external process completing first?"
|
|
186
|
-
4. "Which party creates the sub-order, and which party verifies it?"
|
|
187
|
-
|
|
188
|
-
> **Guard construction**: Cross-Machine Guards use `convert_witness` with Progress query instructions. Design rules now live in the MCP knowledge layer — query via `schema_query` action='get_guard_design_patterns', applied via `goal_operation` action='aggregate_risks'. Query available Guard instructions via `wowok_buildin_info`.
|
|
84
|
+
## Runtime: operating a Progress
|
|
189
85
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
### Privacy (Messenger)
|
|
195
|
-
|
|
196
|
-
Sensitive data flows through Messenger's end-to-end encryption; only Merkle Root proofs go on-chain. The principle: **who performs the action submits the proof**.
|
|
197
|
-
|
|
198
|
-
> **Full Guide**: See [wowok-messenger](../wowok-messenger/SKILL.md) for WTS evidence generation.
|
|
86
|
+
- Operators see their actionable view in `workflow_operation` action=`list` and in the participation radar (`operable[]` with `recommended_call`, guard requirements, waiting roles). Execute only what the radar returns for the signing account.
|
|
87
|
+
- Canonical forward op (`workflow_operation operate` / order `data.progress`): `next` (accomplish; default), `hold` (reserve this forward slot for yourself while doing external work), `unhold` (release own hold), `adminUnhold` (force-release via permission 224).
|
|
88
|
+
- Guard-gated forwards require a valid Passport carrying the submitted fields (progress#9 "Passport required"); the call's submission prompt lists exactly what to provide.
|
|
89
|
+
- Read state via `onchain_objects`; completed sessions via query type `onchain_table_item_progress_history`; full context via `machine_panorama`.
|
|
199
90
|
|
|
200
91
|
---
|
|
201
92
|
|
|
202
|
-
##
|
|
203
|
-
|
|
204
|
-
### Mutability Traps
|
|
205
|
-
|
|
206
|
-
All stem from the same root: **every on-chain object has a publish/create freeze point**. See [Guard + Machine Immutability Deadlock](#guard--machine-immutability-deadlock). Key rules:
|
|
207
|
-
- Never publish before all Guards are created, tested, and bound.
|
|
208
|
-
- `clear` is irreversible — export via `machineNode2file` first.
|
|
209
|
-
|
|
210
|
-
### R-M1-11 Anti-Pattern: Refund Terminal Nodes (CRITICAL)
|
|
93
|
+
## Composition & design patterns
|
|
211
94
|
|
|
212
|
-
**
|
|
95
|
+
**Cross-Machine supply chain**: a forward Guard on Machine A queries Machine B's Progress/Order state (convert_witness with Progress query instructions — patterns in `get_guard_design_patterns`). The Guard only VERIFIES; the sub-order is created independently. Decompose when a sub-process is a standalone sellable Service, has a different participant set, or is reusable; keep one Machine when participants and dense sequential flow are shared. Ask: which phases are run by different teams? What external completion must be awaited? Who creates the sub-order, who verifies it?
|
|
213
96
|
|
|
214
|
-
**
|
|
97
|
+
**Dual-signature**: threshold 2 with two DISTINCT forwards — `namedOperator:""` for the customer, `permissionIndex` for the merchant, each weight 1.
|
|
215
98
|
|
|
216
|
-
**
|
|
217
|
-
| Wrong | Correct (R-M1-11 compliant) |
|
|
218
|
-
|-------|------------------------------|
|
|
219
|
-
| `deposit_refunded` (terminal) | `return_approved` (routing) → Allocator fires refund |
|
|
220
|
-
| `deposit_deducted` (terminal) | `damage_confirmed` (routing) → Allocator fires deduction |
|
|
221
|
-
| `refunded` (terminal) | `refund_routing` (routing) → Allocator fires |
|
|
222
|
-
| N/A (dispute) | `arbiter_rule` (routing) → Arbitration off-Machine (no Allocator) |
|
|
223
|
-
|
|
224
|
-
A complete R-M1-11-compliant rental topology ships as the `rental` industry mode's default Machine shape — query `industry_pack_operation` action='list_modes' for the per-industry defaults.
|
|
225
|
-
|
|
226
|
-
### Pre-Publish Validation Checklist
|
|
227
|
-
|
|
228
|
-
Before `publish: true`, verify:
|
|
229
|
-
|
|
230
|
-
- [ ] **Entry point exists**: at least one Pair with `prev_node: ""` — workflow cannot start otherwise
|
|
231
|
-
- [ ] **⚠ Entry node has ≥1 Forward** (CRITICAL): entry node (`prev_node: ""`) MUST have at least one forward — Progress starts at `current=""` and follows the entry node's forwards to advance. Empty entry forwards = Progress permanently stuck at `current=""`. Schema-enforced (P0-2). Example: `{name:"Ordered", pairs:[{prev_node:"", forwards:[{next_node:"Ordered", namedOperator:"", weight:1}]}]}`
|
|
232
|
-
- [ ] **Every node has outgoing Forwards** (except terminals): no dead-end nodes
|
|
233
|
-
- [ ] **Every node has incoming Pair** (except entry): no orphaned nodes
|
|
234
|
-
- [ ] **All thresholds independently achievable**: no dead branches (competing Pair always wins first)
|
|
235
|
-
- [ ] **⚠ R-M1-11 Compliance** (CRITICAL for deposit/refund scenarios): NO terminal nodes named `deposit_refunded`, `deposit_deducted`, `refunded`, or any name implying Machine-internal refund/deduction. Refund/deduction MUST flow through an **Allocator** triggered by a routing node (e.g., `return_approved`, `damage_confirmed`, `arbiter_rule`). Violating this causes funds to lock in the Machine with no Allocator path. Auto-enforced by MCP pre-publish checks and `goal_operation` action='aggregate_risks'.
|
|
236
|
-
- [ ] All Guards exist on-chain and tested (use `gen_passport`)
|
|
237
|
-
- [ ] `namedOperator` vs `permissionIndex` correct per Forward
|
|
238
|
-
- [ ] Every Forward has at least one of `namedOperator` or `permissionIndex`
|
|
239
|
-
- [ ] **⚠ Permission indexes authorized** (P0): every `permissionIndex` used in forwards MUST have at least one entity granted in the Permission object. Call `permission.op="add perm by index"` for each custom index (≥1000) BEFORE publishing. Un-granted indexes = forward can NEVER execute = Progress permanently stuck. The MCP handler auto-checks this and warns on missing grants.
|
|
240
|
-
- [ ] Terminal nodes mapped to Allocator entries for fund distribution
|
|
241
|
-
- [ ] Tested end-to-end on testnet via a test Progress
|
|
242
|
-
- [ ] Current state exported via `machineNode2file` as backup
|
|
243
|
-
|
|
244
|
-
**Always test on testnet before mainnet** — Machines are immutable after publish.
|
|
99
|
+
**Privacy**: sensitive material goes through Messenger E2E encryption; only WTS/Merkle proofs go on-chain. Whoever performs the action submits the proof (see [wowok-messenger](../wowok-messenger/SKILL.md)).
|
|
245
100
|
|
|
246
101
|
---
|
|
247
102
|
|
|
248
|
-
##
|
|
249
|
-
|
|
250
|
-
Both Guards and published Machines are **immutable**. A Guard created with a bug cannot be fixed (immutable) → must create new Guard → must rebind to Machine → but Machine already published cannot be modified (immutable) → **DEADLOCK**: new Guard exists but cannot be attached.
|
|
251
|
-
|
|
252
|
-
**Prevention**: Test every Guard via `gen_passport` before binding. Verify computation tree, submission types, and query instructions against all scenarios.
|
|
103
|
+
## Pre-publish checklist (publishing is irreversible)
|
|
253
104
|
|
|
254
|
-
|
|
105
|
+
- [ ] Entry pair `prev_node:""` exists on ≥1 first node AND carries ≥1 forward (schema/P0-enforced) — empty entry forwards = Progress stuck at `""`.
|
|
106
|
+
- [ ] Every non-terminal node has a reachable outgoing path; every non-entry node has an incoming pair.
|
|
107
|
+
- [ ] Every pair's threshold ≤ the sum of its DISTINCT forward weights (no dead branches); competing transitions are intended.
|
|
108
|
+
- [ ] Every forward binds exactly the intended identity (wildcard / role / permission index), and ALL custom indexes are already granted.
|
|
109
|
+
- [ ] Guards created, `gen_passport`-tested (all submission scenarios), bound; time Guards have a keeper plan; post-transition checks live on Allocators, not forwards.
|
|
110
|
+
- [ ] R-M1-11: NO node named `refunded`/`deposit_refunded`/`deposit_deducted`/`disputed` or implying the Machine moves funds. Machines never move money — refund/deduction terminals route to Allocator slots (`return_approved` → Allocator), disputes route to the bound Arbitration. The pre-publish gate rejects violations.
|
|
111
|
+
- [ ] Terminal nodes are mapped to Allocator entries, or funds lock in escrow.
|
|
112
|
+
- [ ] Export via `machineNode2file`; run a test Progress on testnet first.
|
|
255
113
|
|
|
256
|
-
|
|
114
|
+
**Deadlock recovery**: published Machine + buggy bound Guard = unrecoverable (both immutable). The only fix is a NEW Machine (new nodes, new Guards), re-bound to a NEW Service version. Prevention is the only cheap path.
|
package/wowok-market/SKILL.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: wowok-market
|
|
3
3
|
description: "WoWok Market — market discovery and operations (the matchmaking layer): how a demand finds candidate services, how a merchant picks a trustworthy arbitrator, how the account's on-chain attention is surfaced, and how the market is measured and governed. Covers match_discover/discover_services/discover_demands, arbitration_score (trust selection), account_events (attention), market_metrics, anti_cheat, market_operations (journey funnel / referral / CRM) and category match rules. Use when: User wants to discover services for an intent (\"find a plumber in Shanghai\"); Merchant wants to find open Demands to present to; Merchant wants to pick or compare arbitrators; User wants their on-chain attention items surfaced; User wants market metrics, anti-cheat signals, journey funnel, referral or CRM; User mentions \"market\", \"match\", \"discover\", \"matchmaking\", \"funnel\", \"referral\"."
|
|
4
4
|
metadata:
|
|
5
|
-
version: "1.
|
|
5
|
+
version: "1.1.0"
|
|
6
6
|
role: shared
|
|
7
7
|
related: "wowok-provider, wowok-order, wowok-arbitrator"
|
|
8
8
|
---
|
|
@@ -11,72 +11,35 @@ metadata:
|
|
|
11
11
|
|
|
12
12
|
> **Role**: Market discovery & operations (matchmaking + Observe layer)
|
|
13
13
|
> **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)
|
|
14
|
+
> All mechanics — parameters, six-dimension weights, thresholds, output fields — live in the tool schema and query outputs. Read them at call time; do not hand-maintain them here.
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
## MCP Knowledge Layer
|
|
18
|
-
|
|
19
|
-
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`:
|
|
20
|
-
|
|
21
|
-
| Capability | MCP action | Purpose |
|
|
22
|
-
|------------|------------|---------|
|
|
23
|
-
| Service discovery (intent → candidates) | `match_discover` / `discover_services` | enumerate + location gate + 6-dim score |
|
|
24
|
-
| Demand discovery (merchant → open demand) | `discover_demands` | enumerate shared Demands |
|
|
25
|
-
| Arbitrator trust selection | `arbitration_score` | dual-perspective trust/fairness |
|
|
26
|
-
| Account attention | `account_events` | unread messenger / collectible / arbitrable |
|
|
27
|
-
| Market metrics | `market_metrics` | supply / demand / trust counts |
|
|
28
|
-
| Anti-cheat | `anti_cheat` | fake order / fake review / shell merchant |
|
|
29
|
-
| Operational aggregation | `market_operations` | journey funnel / referral / CRM |
|
|
30
|
-
|
|
31
|
-
This Skill keeps the **market conversation flow** — discover → compare → trust → act → measure. The MCP layer handles enumeration, scoring, and chain-derived aggregation.
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
## Core Interaction Principles
|
|
36
|
-
|
|
37
|
-
1. **Review-first**: State (a) what the AI understood, (b) the decision order, and (c) the interaction contract — before the first choice.
|
|
38
|
-
2. **User-driven**: Every step is an explicit user decision; the AI provides a `recommend` but never auto-advances.
|
|
39
|
-
3. **Neutrality**: the AI surfaces trade-offs and scores, never chooses the branch for the user.
|
|
16
|
+
## Action routing (all under `evaluation_operation`)
|
|
40
17
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
## Phase 1: Discover (intent → candidates)
|
|
18
|
+
Pick the action by intent, then read its input schema:
|
|
44
19
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
20
|
+
| Intent | action |
|
|
21
|
+
|---|---|
|
|
22
|
+
| Discover scored services for a demand intent | `match_discover` — `description` + `location` required; budget / required capabilities / `category` / region optional. `category` (registered keys: `life_service`, `retail`, …) adds hard-constraint filtering and re-anchors the six-dimension weights; omit for generic scoring. |
|
|
23
|
+
| Enumerate services without scoring | `discover_services` |
|
|
24
|
+
| Enumerate demands (merchant side) | `discover_demands` — returns **all** shared Demands with `presenters_count`; an *open* demand is `presenters_count = 0` (the action does not pre-filter). |
|
|
25
|
+
| Trust / compare an arbitrator | `arbitration_score` — pass `arbitration.object`; when real case `history` is omitted it is auto-fetched on-chain for `context_network`. Output carries trust, fairness and a 0–100 combined score with per-rule reasons. |
|
|
26
|
+
| Surface this account's actionable attention | `account_events` — omit `categories` to run every watcher; each returned row is self-describing (`category` / `title` / `action`). Never pre-list category names for the user — the rows are the list. |
|
|
27
|
+
| Market size & balance | `market_metrics` — active services, open demands, open arb cases, supply/demand ratio, order flow. |
|
|
28
|
+
| Cheat signals on one Service | `anti_cheat` — **evidence must be gathered first** (Service object stack, its orders, its review rows) and passed in; returns fake-order / fake-review / shell-merchant / reputation-trade signals. |
|
|
29
|
+
| Operational aggregation | `market_operations` — `op`: `journey_funnel` / `referral_attribution` / `customer_relationship` / `dynamic_pricing`. |
|
|
49
30
|
|
|
50
|
-
**
|
|
51
|
-
- Enumerate open Demands (optional `location` filter).
|
|
52
|
-
- A Demand carries rewards (incentive pointers); read the Reward objects by id for amounts.
|
|
31
|
+
**Deep structural trust** — for multi-hop questions (who really controls Service/Permission/Arbitration, shell/affiliation structure, money-flow exposure, workflow single points), run `query_toolkit` → `query_type: "onchain_topology"` with `focus` = the address/object/LocalMark. It batches every chain read and returns typed edges, reached Machines' workflow graphs and R/A/O/G findings; conclusions crossing a `bounded_window` edge are lower bounds. It supplies structural facts to `anti_cheat` and arbitrator comparison; it never produces a score itself.
|
|
53
32
|
|
|
54
|
-
|
|
33
|
+
## Conversation flow: discover → compare → trust → act → measure
|
|
55
34
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
---
|
|
62
|
-
|
|
63
|
-
## Phase 3: Act
|
|
64
|
-
|
|
65
|
-
- **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.
|
|
66
|
-
- **Discovery → order**: hand off to [wowok-order](../wowok-order/SKILL.md) for due diligence + order placement once the user picks a service.
|
|
67
|
-
|
|
68
|
-
---
|
|
69
|
-
|
|
70
|
-
## Phase 4: Measure & Govern
|
|
71
|
-
|
|
72
|
-
- **Metrics**: `evaluation_operation` action=`market_metrics` → active services / open demands / disputes / supply-demand ratio.
|
|
73
|
-
- **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).
|
|
74
|
-
- **Operations**: `evaluation_operation` action=`market_operations` with `op` = `journey_funnel` / `referral_attribution` / `customer_relationship` / `dynamic_pricing`.
|
|
75
|
-
|
|
76
|
-
---
|
|
35
|
+
1. **Review-first**: before the first choice, state (a) what you understood, (b) the decision order, (c) the interaction contract.
|
|
36
|
+
2. **User-driven**: every step is an explicit user decision; you give a `recommend`, never auto-advance and never auto-act on attention items.
|
|
37
|
+
3. **Neutrality**: surface scores and trade-offs side by side; never force a single pick.
|
|
38
|
+
4. **No fabricated matching**: always run the MCP enumeration/scoring; never invent candidates, counts or scores.
|
|
39
|
+
5. **Hand off cleanly**: picked a service → [wowok-order](../wowok-order/SKILL.md) for due diligence and buying; merchant wants to present → [wowok-supplier](../wowok-supplier/SKILL.md).
|
|
77
40
|
|
|
78
|
-
##
|
|
41
|
+
## Authority rules
|
|
79
42
|
|
|
80
|
-
- **
|
|
81
|
-
- **
|
|
82
|
-
- **
|
|
43
|
+
- **Objects are authoritative**: event rows (descriptions, reward addresses, counts) are routing hints only — amounts and current state are read from the objects by id.
|
|
44
|
+
- **Opportunity events are deliberately sparse**: a reward-less Demand emits no event. No event is not proof of no demand; enumerate when the question matters.
|
|
45
|
+
- **Network awareness**: discovery and trust calls default to testnet — pass `context_network` explicitly for real decisions.
|