@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.
- package/examples/Insurance/Insurance.md +142 -23
- package/examples/MyShop/MyShop.md +216 -218
- package/examples/MyShop/myshop_machine_nodes.json +14 -8
- package/examples/MyShop_Advanced/MyShop_Advanced.md +57 -56
- package/examples/ThreeBody_Signature/ThreeBody_Signature.md +431 -111
- package/examples/Travel/Travel.md +64 -18
- package/package.json +1 -1
- package/wowok-arbitrator/APPENDIX.md +545 -0
- package/wowok-arbitrator/SKILL.md +8 -535
- package/wowok-auditor/APPENDIX.md +487 -0
- package/wowok-auditor/SKILL.md +9 -480
- package/wowok-guard/APPENDIX.md +428 -0
- package/wowok-guard/SKILL.md +117 -421
- package/wowok-machine/APPENDIX.md +407 -0
- package/wowok-machine/SKILL.md +9 -400
- package/wowok-messenger/APPENDIX.md +550 -0
- package/wowok-messenger/SKILL.md +9 -543
- package/wowok-onboard/APPENDIX.md +472 -0
- package/wowok-onboard/SKILL.md +10 -465
- package/wowok-order/APPENDIX.md +777 -0
- package/wowok-order/SKILL.md +110 -506
- package/wowok-output/APPENDIX.md +575 -0
- package/wowok-output/SKILL.md +9 -568
- package/wowok-planner/APPENDIX.md +700 -0
- package/wowok-planner/SKILL.md +9 -693
- package/wowok-provider/APPENDIX.md +425 -0
- package/wowok-provider/SKILL.md +8 -415
- package/wowok-safety/APPENDIX.md +561 -0
- package/wowok-safety/SKILL.md +9 -554
- package/wowok-scenario/APPENDIX.md +97 -0
- package/wowok-scenario/MODE-DETAILS.md +275 -0
- package/wowok-scenario/SKILL.md +20 -353
- package/wowok-tools/APPENDIX.md +388 -0
- package/wowok-tools/SKILL.md +9 -381
package/wowok-auditor/SKILL.md
CHANGED
|
@@ -99,483 +99,12 @@ pass / warn / fail report. A FAIL blocks the publish in R10.
|
|
|
99
99
|
|
|
100
100
|
---
|
|
101
101
|
|
|
102
|
-
##
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
**AI Goal**: Pin down exactly what is being audited and the audit tier.
|
|
113
|
-
|
|
114
|
-
**Key Questions**:
|
|
115
|
-
- What are we auditing? (Service + Machine + Guards + Allocators, or a subset?)
|
|
116
|
-
- Is this a Tier-1 (single Service + single Guard), Tier-2 (multi-Guard + multi-state Machine), or Tier-3 (complex dependency chains + arbitration) audit?
|
|
117
|
-
- Which network? (testnet default; mainnet doubles the confirmation burden)
|
|
118
|
-
- Is this a pre-publish audit (Service/Machine still `bPublished: false`) or a post-publish diagnostic?
|
|
119
|
-
|
|
120
|
-
**Tool Calls**:
|
|
121
|
-
1. (Internal) Classify tier per §Tier Layering.
|
|
122
|
-
2. `local_info_operation` → create audit session `{ round: R1, scope: [...], tier: 1|2|3, network, phase: pre-publish|diagnostic }`.
|
|
123
|
-
|
|
124
|
-
**Success Criteria**: Scope, tier, network, and phase recorded. User confirms.
|
|
125
|
-
|
|
126
|
-
**Fallback**: User is vague ("audit my stuff") → list all owned objects via `query_toolkit` → `local_names`, ask which to include. User doesn't know the tier → default to Tier-2 (Standard).
|
|
127
|
-
|
|
128
|
-
**Checkpoint**: Persist R1; mark COMPLETE.
|
|
129
|
-
|
|
130
|
-
### R2: Object Inventory & Dependency Map
|
|
131
|
-
|
|
132
|
-
**AI Goal**: Enumerate every object in scope and build the dependency graph (Permission → Machine → Guards → Allocators → Service → Progress → Arbitration).
|
|
133
|
-
|
|
134
|
-
**Key Questions**:
|
|
135
|
-
- For each object: name, ID, type, and `bPublished` state?
|
|
136
|
-
- Which objects depend on which? (e.g., Machine Forwards reference Permission indices; Allocators reference Guards; Service references Machine + Allocators.)
|
|
137
|
-
|
|
138
|
-
**Tool Calls**:
|
|
139
|
-
1. `query_toolkit` → `onchain_objects` for each named object (use `no_cache: true` — we need fresh state).
|
|
140
|
-
2. `guard2file` → export each Guard to a local JSON/Markdown file.
|
|
141
|
-
3. `machineNode2file` → export each Machine's node topology.
|
|
142
|
-
4. (Internal) Build dependency graph: nodes = objects, edges = "references". Detect cycles in the dependency graph (object-level, not Machine-level — those are R4).
|
|
143
|
-
|
|
144
|
-
**Success Criteria**: Every object in scope is queried, exported, and placed in the dependency graph. No unresolved references.
|
|
145
|
-
|
|
146
|
-
**Fallback**: Object not found → check name spelling, switch `env.network`, retry with `no_cache: true`. Circular dependency (Guard references Service that references Guard) → confirm the circular reference pattern was followed (CREATE object → CREATE Guard by name → MODIFY object to bind). Unresolved name → treat as audit FAIL (broken reference, cannot publish).
|
|
147
|
-
|
|
148
|
-
**Checkpoint**: Persist `{ round: R2, objects: [{name, id, type, bPublished}], dependency_graph, exports: [...] }`.
|
|
149
|
-
|
|
150
|
-
### R3: Guard Completeness
|
|
151
|
-
|
|
152
|
-
**AI Goal**: For every operation that moves funds, verify a Guard is bound and the Guard table is well-formed.
|
|
153
|
-
|
|
154
|
-
**Key Questions**:
|
|
155
|
-
- For each Service: is `buy_guard` set? (Required if Service accepts payments.)
|
|
156
|
-
- For each Service `order_allocators[].guard`: is a Guard bound to each Allocator?
|
|
157
|
-
- For each Machine Forward with fund flow: is `forward.guard` set?
|
|
158
|
-
- For each Guard: does the table have all submission entries the host object expects? (e.g., Repository `id_from_submission` must be Address-type; Arbitration `voting_guard` `GuardIdentifier` must be numeric.)
|
|
159
|
-
|
|
160
|
-
**Tool Calls**:
|
|
161
|
-
1. Apply **GUARD_COMPLETENESS_RULES** to every operation type discovered in R2.
|
|
162
|
-
2. For each Guard: cross-reference the host object's extraction field against the Guard table (per [wowok-guard](../wowok-guard/SKILL.md) §Type Requirements by Object).
|
|
163
|
-
3. `guard2file` → re-export any Guard whose host binding is ambiguous; inspect the table.
|
|
164
|
-
|
|
165
|
-
**Success Criteria**: Every fund-flow operation has a Guard bound. Every Guard table satisfies its host object's type constraints. Zero FAILs.
|
|
166
|
-
|
|
167
|
-
**Fallback**: FAIL — list the unguarded operation, the host object, and the recommended Guard pattern (cite [wowok-guard](../wowok-guard/SKILL.md) §Quick Decision). WARN (treasury deposit, repository write) — note for user acknowledgement in R10.
|
|
168
|
-
|
|
169
|
-
**Checkpoint**: Persist `{ round: R3, guard_checks: [{op, host, guard_bound: bool, action: PASS|WARN|FAIL}] }`.
|
|
170
|
-
|
|
171
|
-
### R4: Machine Soundness
|
|
172
|
-
|
|
173
|
-
**AI Goal**: Verify the state graph is acyclic, single-entry, fully reachable, with correct terminals and valid forward permissions.
|
|
174
|
-
|
|
175
|
-
**Key Questions** (skip if no Machine in scope — Tier-1 single-Guard audit):
|
|
176
|
-
- Is there exactly one entry node (Pair with `prev_node: ""`)?
|
|
177
|
-
- Are all terminals reachable from the entry?
|
|
178
|
-
- Are there cycles in the state graph?
|
|
179
|
-
- Does every non-terminal have an outgoing Forward? Every non-entry have an incoming Pair?
|
|
180
|
-
- Does every Forward have `permissionIndex` ≥ 1000 OR `namedOperator` set (or both)?
|
|
181
|
-
- Are thresholds achievable? (No dead branches where a competing Pair always wins.)
|
|
182
|
-
|
|
183
|
-
**Tool Calls**:
|
|
184
|
-
1. Parse `machineNode2file` output into nodes, Pairs, Forwards.
|
|
185
|
-
2. Apply **MACHINE_SOUNDNESS_RULES**: cycle detection (DFS with visited stack), entry count, reachability (BFS from entry), dead-end/orphan checks, forward permission validation, threshold sum vs. Pair threshold.
|
|
186
|
-
3. `wowok_buildin_info` → `info: "built-in permissions"` — confirm 0–999 are reserved; user indices must be ≥ 1000.
|
|
187
|
-
|
|
188
|
-
**Success Criteria**: All MACHINE_SOUNDNESS_RULES pass. Graph drawn and confirmed acyclic.
|
|
189
|
-
|
|
190
|
-
**Fallback**: Cycle detected → FAIL, recommend splitting into two phases / two Machines (cite [wowok-machine](../wowok-machine/SKILL.md) §Cross-Machine Composition). Multiple entries → FAIL, merge into one. Unreachable terminal → FAIL, add a Forward or remove the terminal. Forward with neither permission → FAIL, set `namedOperator: ""` for customer or add `permissionIndex`. Dead branch → WARN, recommend time-lock auto-advance Forward or removal.
|
|
191
|
-
|
|
192
|
-
**Checkpoint**: Persist `{ round: R4, machine_checks: [...], graph_acyclic: bool, single_entry: bool, all_reachable: bool }`.
|
|
193
|
-
|
|
194
|
-
### R5: Fund Flow Analysis
|
|
195
|
-
|
|
196
|
-
**AI Goal**: Trace every money path: payment → escrow → allocation. Verify refund symmetry and allocation sums.
|
|
197
|
-
|
|
198
|
-
**Key Questions**:
|
|
199
|
-
- For each Service: trace the payment path (customer pays → escrow → Allocator distributes). Does every payment path have a refund path?
|
|
200
|
-
- For each Allocator: does the `sharing` array sum to 10000 (100%)?
|
|
201
|
-
- Is the treasury balance sufficient for pending allocations?
|
|
202
|
-
- Are gas coins (SUI/WOW) mixed into business-token allocations?
|
|
203
|
-
- Does the escrow amount equal the sum of Allocation paths from that order?
|
|
204
|
-
|
|
205
|
-
**Tool Calls**:
|
|
206
|
-
1. Apply **FUND_FLOW_RULES** to every payment/allocation path discovered in R2.
|
|
207
|
-
2. `query_toolkit` → `onchain_objects` for the Service's `order_allocators`; for each Allocator, sum the `sharing` values.
|
|
208
|
-
3. `query_toolkit` → `onchain_objects` for the treasury / compensation fund; compare balance to sum of pending allocations.
|
|
209
|
-
4. For refund paths: confirm a terminal node exists whose Allocator returns funds to the buyer (`Entity` with buyer address or `GuardIdentifier` resolving to buyer).
|
|
210
|
-
|
|
211
|
-
**Success Criteria**: Every payment path has a refund path. Every Allocator sums to 10000. No gas coin in business allocations. Escrow symmetry holds.
|
|
212
|
-
|
|
213
|
-
**Fallback**: No refund path → FAIL, recommend creating a refund Allocator on a dispute terminal (cite [wowok-onboard](../wowok-onboard/SKILL.md) R8). Allocation sum ≠ 10000 → FAIL, recommend adjusting `sharing` percentages (auto-correct to 10000 with user confirmation per [wowok-onboard](../wowok-onboard/SKILL.md) R8 fallback). Gas coin in allocation → WARN, recommend separating gas wallet from business treasury. Low treasury balance → WARN, recommend funding before publish.
|
|
214
|
-
|
|
215
|
-
**Checkpoint**: Persist `{ round: R5, fund_flow_checks: [...], refund_paths: [...], allocation_sums: [{allocator, sum, valid: bool}] }`.
|
|
216
|
-
|
|
217
|
-
### R6: Permission Consistency
|
|
218
|
-
|
|
219
|
-
**AI Goal**: Verify every permission index is in valid range and named operators match intended roles.
|
|
220
|
-
|
|
221
|
-
**Key Questions**:
|
|
222
|
-
- For each Forward's `permissionIndex`: is it ≥ 1000 (user-defined)? (Indices 0–999 are protocol-reserved.)
|
|
223
|
-
- Does the referenced Permission object actually have that index configured?
|
|
224
|
-
- For each `namedOperator`: does the role name match the intended business role? (e.g., `"delivery_person"` not `"dp"`.)
|
|
225
|
-
- For Arbitration `voting_guard` with `GuardIdentifier`: is the referenced table entry numeric (U8–U256)?
|
|
226
|
-
|
|
227
|
-
**Tool Calls**:
|
|
228
|
-
1. `query_toolkit` → `onchain_objects` for the Permission object; list all configured indices.
|
|
229
|
-
2. Cross-reference every Forward's `permissionIndex` against the Permission's configured indices.
|
|
230
|
-
3. `wowok_buildin_info` → `info: "built-in permissions"` — confirm reserved range.
|
|
231
|
-
4. For Arbitration `voting_guard`: `guard2file` → inspect the table entry at `GuardIdentifier`; confirm numeric type.
|
|
232
|
-
|
|
233
|
-
**Success Criteria**: All `permissionIndex` values ≥ 1000 and present in the Permission object. All `namedOperator` names are descriptive. All `GuardIdentifier` entries are numeric.
|
|
234
|
-
|
|
235
|
-
**Fallback**: Index < 1000 → FAIL, recommend switching to a user-defined index ≥ 1000. Index not in Permission → FAIL, add the index to the Permission object (if mutable) or recreate Permission. Non-numeric `GuardIdentifier` → FAIL, recreate Guard with numeric table entry (cite [wowok-guard](../wowok-guard/SKILL.md) F5). Cryptic `namedOperator` name → WARN, recommend rename pre-publish.
|
|
236
|
-
|
|
237
|
-
**Checkpoint**: Persist `{ round: R6, permission_checks: [...], named_operators: [...] }`.
|
|
238
|
-
|
|
239
|
-
### R7: Semantic Verification
|
|
240
|
-
|
|
241
|
-
**AI Goal**: Read the `semantic` field from recent operations on the audited objects. Confirm the intended roles were created/modified/released and the event stream matches expectations.
|
|
242
|
-
|
|
243
|
-
**Key Questions**:
|
|
244
|
-
- For each recent operation on the audited objects: what does `semantic.created` list? (Should match the objects we expect to exist.)
|
|
245
|
-
- What does `semantic.modified` list? (Should match intended field updates.)
|
|
246
|
-
- What does `semantic.released` list? (Should match fund movements — escrow, allocation, refund.)
|
|
247
|
-
- What does `semantic.events` show? (Cross-reference with `onchain_events` query results.)
|
|
248
|
-
|
|
249
|
-
**Tool Calls**:
|
|
250
|
-
1. `onchain_events` → query recent events for each object in scope (NewOrderEvent, ProgressEvent, PublishEvent, ArbEvent, AllocationEvent).
|
|
251
|
-
2. For each event: map to the corresponding `semantic` field. E.g., a `PublishEvent` should appear in `semantic.events`; an `AllocationEvent` should appear in `semantic.released`.
|
|
252
|
-
3. Cross-check: every object we expect to exist (from R2) should appear in `semantic.created` of the operation that created it.
|
|
253
|
-
4. Cross-check: every fund movement we expect (from R5) should appear in `semantic.released` of the corresponding operation.
|
|
254
|
-
|
|
255
|
-
**Success Criteria**: `semantic.created` / `modified` / `released` / `events` all match the expected object and fund-flow inventory. No phantom objects, no missing events.
|
|
256
|
-
|
|
257
|
-
**Fallback**: Phantom object in `semantic.created` (created but not in our inventory) → WARN, investigate — may be an orphan from a failed prior attempt. Missing event (operation succeeded but event not in `semantic.events`) → WARN, retry query with `no_cache: true` (cache lag). Fund movement in `semantic.released` that doesn't match R5's expected path → FAIL, investigate — may indicate an unintended Allocator fired.
|
|
258
|
-
|
|
259
|
-
**Checkpoint**: Persist `{ round: R7, semantic_cross_check: {created_ok, modified_ok, released_ok, events_ok} }`.
|
|
260
|
-
|
|
261
|
-
### R8: Risk Assessment & Blast Radius
|
|
262
|
-
|
|
263
|
-
**AI Goal**: Classify each remaining issue by irreversibility and estimate blast radius if publish proceeds.
|
|
264
|
-
|
|
265
|
-
**Key Questions**:
|
|
266
|
-
- Which operations in scope are irreversible? (Publish, arbitration verdict, transfer.)
|
|
267
|
-
- For each FAIL/WARN: if the user publishes anyway, what breaks? Can it be recovered?
|
|
268
|
-
- What is the blast radius? (Single order, all orders on the Service, all Services using this Machine, all arbitrations using this Guard?)
|
|
269
|
-
|
|
270
|
-
**Tool Calls**:
|
|
271
|
-
1. (Internal) For each open issue, classify:
|
|
272
|
-
- **Permanent** (post-publish, no recovery): Guard logic bug on a published Machine, allocation sum ≠ 10000 on a published Service, cycle in a published Machine.
|
|
273
|
-
- **Recoverable** (post-publish, with new object creation): missing Guard on a Forward (create new Machine), wrong `namedOperator` name (create new Machine).
|
|
274
|
-
- **Cosmetic** (no operational impact): cryptic role name, missing backup export.
|
|
275
|
-
2. Estimate blast radius per issue: `single_order | all_orders_on_service | all_services_on_machine | all_arbitrations_on_guard`.
|
|
276
|
-
3. Rank issues by `severity = permanence × blast_radius`.
|
|
277
|
-
|
|
278
|
-
**Success Criteria**: Every open issue has a severity label and a documented recovery path (or "no recovery — permanent").
|
|
279
|
-
|
|
280
|
-
**Fallback**: User wants to publish despite a Permanent issue → refuse the R10 approval, cite the irreversibility, recommend the recovery path (usually: create replacement object pre-publish).
|
|
281
|
-
|
|
282
|
-
**Checkpoint**: Persist `{ round: R8, risk_assessment: [{issue, permanence, blast_radius, severity, recovery_path}] }`.
|
|
283
|
-
|
|
284
|
-
### R9: Audit Report
|
|
285
|
-
|
|
286
|
-
**AI Goal**: Present the consolidated pass/warn/fail report with specific issues and fix recommendations.
|
|
287
|
-
|
|
288
|
-
**Key Questions**:
|
|
289
|
-
- (None — this round presents findings and asks for acknowledgement of WARNs.)
|
|
290
|
-
|
|
291
|
-
**Tool Calls**:
|
|
292
|
-
1. (Internal) Aggregate R2-R8 findings into a report:
|
|
293
|
-
```
|
|
294
|
-
AUDIT REPORT — <scope> (Tier <n>)
|
|
295
|
-
─────────────────────────────────────
|
|
296
|
-
PASS: <count> checks passed
|
|
297
|
-
WARN: <count> issues requiring acknowledgement
|
|
298
|
-
FAIL: <count> blocking issues
|
|
299
|
-
|
|
300
|
-
FAIL details:
|
|
301
|
-
- [R3] Guard completeness: <op> on <host> has no Guard bound.
|
|
302
|
-
Fix: <recommended Guard pattern>
|
|
303
|
-
- [R4] Machine soundness: cycle detected at <node> → <node>.
|
|
304
|
-
Fix: split into two Machines
|
|
305
|
-
...
|
|
306
|
-
|
|
307
|
-
WARN details:
|
|
308
|
-
- [R5] Treasury balance low (<amount> < <pending>).
|
|
309
|
-
Acknowledge: fund treasury before publish, or accept risk.
|
|
310
|
-
...
|
|
311
|
-
|
|
312
|
-
Risk assessment (R8):
|
|
313
|
-
- <issue> — Permanent, blast radius: all_orders_on_service.
|
|
314
|
-
Recovery: create replacement <object> pre-publish.
|
|
315
|
-
```
|
|
316
|
-
2. `local_info_operation` → persist the full report.
|
|
317
|
-
|
|
318
|
-
**Success Criteria**: Report presented. User acknowledges each WARN. Each FAIL has a documented fix.
|
|
319
|
-
|
|
320
|
-
**Fallback**: User disputes a FAIL → re-run the specific check with `no_cache: true`; if still FAIL, the rule is binding. User wants to override a FAIL → only possible via explicit "publish anyway" confirmation recorded in the checkpoint (the auditor still records it as a FAIL-with-override; [wowok-safety](../wowok-safety/SKILL.md) R7 will re-confirm).
|
|
321
|
-
|
|
322
|
-
**Checkpoint**: Persist `{ round: R9, report: {...}, warns_acknowledged: [...], fails_overridden: [...] }`.
|
|
323
|
-
|
|
324
|
-
### R10: Publish Decision
|
|
325
|
-
|
|
326
|
-
**AI Goal**: Emit the publish go/no-go decision. This Skill does NOT execute the publish — it hands off to [wowok-onboard](../wowok-onboard/SKILL.md) R10 or [wowok-machine](../wowok-machine/SKILL.md) R10.
|
|
327
|
-
|
|
328
|
-
**Key Questions**:
|
|
329
|
-
- (Decision logic; no user questions unless a WARN needs final confirmation.)
|
|
330
|
-
|
|
331
|
-
**Tool Calls**:
|
|
332
|
-
1. (Internal) Apply decision logic:
|
|
333
|
-
- If any FAIL (not overridden) → **BLOCK**. List fixes needed. Do not hand off.
|
|
334
|
-
- If only WARNs and all acknowledged → **APPROVE WITH WARNINGS**. Hand off to the publish Skill.
|
|
335
|
-
- If all PASS → **APPROVE**. Hand off.
|
|
336
|
-
2. Emit handoff packet:
|
|
337
|
-
```
|
|
338
|
-
AUDIT DECISION: <APPROVE | APPROVE_WITH_WARNINGS | BLOCK>
|
|
339
|
-
Scope: <objects>
|
|
340
|
-
Tier: <n>
|
|
341
|
-
Fails: <count> (list)
|
|
342
|
-
Warns: <count> (acknowledged: <count>)
|
|
343
|
-
Risk max severity: <level>
|
|
344
|
-
Next: wowok-onboard R10 (publish) — or wowok-machine R10 (Machine-only publish)
|
|
345
|
-
```
|
|
346
|
-
3. `local_info_operation` → persist the decision and handoff packet.
|
|
347
|
-
|
|
348
|
-
**Success Criteria**: Decision emitted. Handoff packet persisted. If BLOCK, the user has a clear list of fixes. If APPROVE, the publish Skill receives a clean audit reference.
|
|
349
|
-
|
|
350
|
-
**Fallback**: User insists on publishing despite BLOCK → refuse handoff; advise that [wowok-safety](../wowok-safety/SKILL.md) R7 will still require confirmation and the audit FAIL will be visible in the session log. Recommend fixing the FAILs first.
|
|
351
|
-
|
|
352
|
-
**Checkpoint**: Persist `{ round: R10, decision, handoff_emitted: true }`. Mark audit COMPLETE.
|
|
353
|
-
|
|
354
|
-
---
|
|
355
|
-
|
|
356
|
-
## Decision Trees
|
|
357
|
-
|
|
358
|
-
### D1: Guard Necessity (operation type + fund flow direction)
|
|
359
|
-
|
|
360
|
-
```
|
|
361
|
-
For each operation in scope:
|
|
362
|
-
├── Does it move funds?
|
|
363
|
-
│ ├── YES
|
|
364
|
-
│ │ ├── payment / allocation execute / order create / fund-release forward / reward claim?
|
|
365
|
-
│ │ │ └── YES → Guard REQUIRED. FAIL if none bound. (GUARD_COMPLETENESS_RULES)
|
|
366
|
-
│ │ └── treasury deposit / repository write?
|
|
367
|
-
│ │ └── Guard RECOMMENDED. WARN if none bound.
|
|
368
|
-
│ └── NO (service publish, machine publish, non-fund forward)
|
|
369
|
-
│ └── Guard NOT required. PASS.
|
|
370
|
-
└── Is the bound Guard's table well-formed for the host extraction field?
|
|
371
|
-
├── Repository id_from_submission → Address? data_from_submission → matches value_type?
|
|
372
|
-
│ └── NO → FAIL (type constraint violation).
|
|
373
|
-
├── Arbitration voting_guard GuardIdentifier → numeric (U8–U256)?
|
|
374
|
-
│ └── NO → FAIL (E_GUARD_IDENTIFIER_NOT_NUMBER risk).
|
|
375
|
-
└── OK → PASS.
|
|
376
|
-
```
|
|
377
|
-
|
|
378
|
-
### D2: Machine State Graph Validation
|
|
379
|
-
|
|
380
|
-
```
|
|
381
|
-
Parse machineNode2file output → graph (nodes, Pairs, Forwards):
|
|
382
|
-
├── Cycle check (DFS with recursion stack):
|
|
383
|
-
│ ├── Cycle found → FAIL: cycle at <path>. Recommend split into two Machines.
|
|
384
|
-
│ └── Acyclic → continue.
|
|
385
|
-
├── Entry check:
|
|
386
|
-
│ ├── Zero nodes with no inbound Pair → FAIL: no entry.
|
|
387
|
-
│ ├── More than one → FAIL: multiple entries <list>. Recommend merging.
|
|
388
|
-
│ └── Exactly one → continue.
|
|
389
|
-
├── Reachability (BFS from entry):
|
|
390
|
-
│ ├── Any terminal unreachable → FAIL: unreachable terminal <name>.
|
|
391
|
-
│ ├── Any non-terminal with no outgoing Forward → FAIL: dead-end <name>.
|
|
392
|
-
│ └── All reachable, no dead-ends → continue.
|
|
393
|
-
├── Threshold achievability (per Pair):
|
|
394
|
-
│ ├── Sum of Forward weights < threshold → WARN: unreachable threshold (dead branch).
|
|
395
|
-
│ ├── Competing Pair always wins first (first-Pair-wins rule) → WARN: dead branch.
|
|
396
|
-
│ └── Achievable → continue.
|
|
397
|
-
└── Forward permissions:
|
|
398
|
-
├── Neither permissionIndex nor namedOperator set → FAIL: forward <name> has no operator.
|
|
399
|
-
├── permissionIndex < 1000 → FAIL: reserved index.
|
|
400
|
-
├── permissionIndex not in Permission object → FAIL: index not configured.
|
|
401
|
-
└── OK → PASS.
|
|
402
|
-
```
|
|
403
|
-
|
|
404
|
-
### D3: Allocation Correctness
|
|
405
|
-
|
|
406
|
-
```
|
|
407
|
-
For each Allocator in order_allocators:
|
|
408
|
-
├── Sum the sharing array:
|
|
409
|
-
│ ├── Sum ≠ 10000 → FAIL: allocation sums to <sum>, must be 10000.
|
|
410
|
-
│ └── Sum = 10000 → continue.
|
|
411
|
-
├── Refund path check (for Service that accepts payments):
|
|
412
|
-
│ ├── Is there a terminal whose Allocator returns funds to buyer?
|
|
413
|
-
│ │ ├── YES → PASS.
|
|
414
|
-
│ │ └── NO → FAIL: no refund path. Recommend refund Allocator on dispute terminal.
|
|
415
|
-
│ └── (Skip if Service is non-payment, e.g., repository-only.)
|
|
416
|
-
├── Gas coin separation:
|
|
417
|
-
│ ├── Allocation contains SUI or WOW (gas coins) alongside business tokens?
|
|
418
|
-
│ │ ├── YES → WARN: gas coin in allocation. Recommend separate treasury.
|
|
419
|
-
│ │ └── NO → PASS.
|
|
420
|
-
│ └── (Skip if Service is single-token WOW only.)
|
|
421
|
-
├── Recipient type:
|
|
422
|
-
│ ├── Known party (merchant, platform) → uses Entity with explicit address? PASS.
|
|
423
|
-
│ ├── Dynamic party (buyer, order-specific) → uses GuardIdentifier? PASS.
|
|
424
|
-
│ └── Uses Signer for a non-signer role → WARN: ambiguous recipient.
|
|
425
|
-
└── Escrow symmetry:
|
|
426
|
-
├── Sum of Allocation paths from order ≠ order escrow amount → FAIL: escrow mismatch.
|
|
427
|
-
└── Equal → PASS.
|
|
428
|
-
```
|
|
429
|
-
|
|
430
|
-
### D4: Publish Approval
|
|
431
|
-
|
|
432
|
-
```
|
|
433
|
-
Aggregate R2-R9 results:
|
|
434
|
-
├── Any FAIL (not overridden)?
|
|
435
|
-
│ ├── YES → BLOCK. List fixes. Do not hand off.
|
|
436
|
-
│ └── NO → continue.
|
|
437
|
-
├── Any WARN?
|
|
438
|
-
│ ├── YES → all acknowledged by user?
|
|
439
|
-
│ │ ├── YES → APPROVE WITH WARNINGS. Hand off to publish Skill.
|
|
440
|
-
│ │ └── NO → request acknowledgement; pause.
|
|
441
|
-
│ └── NO → continue.
|
|
442
|
-
├── PUBLISH_READINESS_RULES:
|
|
443
|
-
│ ├── Service bPublished === false? (must be false to publish)
|
|
444
|
-
│ ├── Machine published (if bound)?
|
|
445
|
-
│ ├── Permission configured with all Forward indices?
|
|
446
|
-
│ ├── Allocators configured and audited?
|
|
447
|
-
│ ├── User confirmed publish intent?
|
|
448
|
-
│ └── Any FAIL above → BLOCK.
|
|
449
|
-
└── All pass → APPROVE. Hand off to [wowok-onboard](../wowok-onboard/SKILL.md) R10 or [wowok-machine](../wowok-machine/SKILL.md) R10.
|
|
450
|
-
```
|
|
451
|
-
|
|
452
|
-
---
|
|
453
|
-
|
|
454
|
-
## Failure Playbooks
|
|
455
|
-
|
|
456
|
-
### F1: Missing Guard on Refund Path
|
|
457
|
-
|
|
458
|
-
**Trigger**: R3 or R5 finds a Service that accepts payments but has no Allocator returning funds to the buyer on any terminal (no refund path), or the refund-path Allocator has no Guard bound.
|
|
459
|
-
|
|
460
|
-
**Diagnosis**: The Service can collect escrow but cannot return it on dispute. Funds would be locked permanently if a customer disputes and wins.
|
|
461
|
-
|
|
462
|
-
**Recovery**:
|
|
463
|
-
1. Identify the dispute terminal node (or create one if absent).
|
|
464
|
-
2. Design a refund Allocator: `sharing: [{recipient: GuardIdentifier|Signer, share: 10000}]` returning 100% to the buyer.
|
|
465
|
-
3. CREATE the refund Allocator's trigger Guard (cite [wowok-guard](../wowok-guard/SKILL.md) §Quick Decision — typically a progress-state check confirming the dispute terminal was reached).
|
|
466
|
-
4. Test the Guard via `gen_passport`.
|
|
467
|
-
5. Bind the Allocator + Guard to the Service's `order_allocators` (pre-publish only; post-publish `order_allocators` is immutable).
|
|
468
|
-
|
|
469
|
-
**Prevention**: Always design refund symmetry alongside the payment path. [wowok-onboard](../wowok-onboard/SKILL.md) R8 includes "refund path covered" in its checkpoint.
|
|
470
|
-
|
|
471
|
-
### F2: Allocation Sum Mismatch
|
|
472
|
-
|
|
473
|
-
**Trigger**: R5 finds an Allocator whose `sharing` array sums to a value other than 10000 (100%).
|
|
474
|
-
|
|
475
|
-
**Diagnosis**: Either the percentages were mis-entered, or a recipient was omitted. On-chain, the Allocator will either fail to execute (sum < 10000 leaves funds undistributed) or revert (sum > 10000 is impossible).
|
|
476
|
-
|
|
477
|
-
**Recovery**:
|
|
478
|
-
1. Recalculate the intended percentages with the user.
|
|
479
|
-
2. Auto-correct to 10000 by scaling or by adjusting the last recipient's share (cite [wowok-onboard](../wowok-onboard/SKILL.md) R8 fallback — auto-correct with user confirmation).
|
|
480
|
-
3. MODIFY the Service's `order_allocators` with the corrected `sharing` array (pre-publish only).
|
|
481
|
-
|
|
482
|
-
**Prevention**: R5 always sums the `sharing` array. The PUBLISH_READINESS_RULES table treats sum ≠ 10000 as FAIL.
|
|
483
|
-
|
|
484
|
-
### F3: Machine Cycle Detected
|
|
485
|
-
|
|
486
|
-
**Trigger**: R4 finds a cycle in the state graph (e.g., node A → B → A).
|
|
487
|
-
|
|
488
|
-
**Diagnosis**: The Machine would loop forever on the cycle. Progress instances entering the cycle never terminate. Allocation never fires. Funds are locked.
|
|
489
|
-
|
|
490
|
-
**Recovery**:
|
|
491
|
-
1. Identify the cycle path.
|
|
492
|
-
2. Break the cycle by either:
|
|
493
|
-
- Removing one Forward in the cycle (if the back-edge is unintended).
|
|
494
|
-
- Splitting into two Machines connected via Guard-based sub-Progress verification (cite [wowok-machine](../wowok-machine/SKILL.md) §Cross-Machine Composition). Each Machine is acyclic; the cross-Machine Guard enforces ordering.
|
|
495
|
-
3. Re-run R4 to confirm acyclicity.
|
|
496
|
-
|
|
497
|
-
**Prevention**: R4's cycle detection runs before publish. Post-publish, a cyclic Machine is permanently broken — must create a new Machine.
|
|
498
|
-
|
|
499
|
-
### F4: Permission Index Conflict
|
|
500
|
-
|
|
501
|
-
**Trigger**: R6 finds a Forward with `permissionIndex` < 1000 (reserved range) or an index not configured in the Permission object.
|
|
502
|
-
|
|
503
|
-
**Diagnosis**: Reserved indices (0–999) are protocol-defined and will collide with built-in roles. Unconfigured indices cause "permission denied" at runtime.
|
|
504
|
-
|
|
505
|
-
**Recovery**:
|
|
506
|
-
1. For a reserved index: switch the Forward to a user-defined index ≥ 1000 (recommend a dedicated Permission object with custom roles per [wowok-machine](../wowok-machine/SKILL.md) §Forward Permission Model).
|
|
507
|
-
2. For an unconfigured index: add the index to the Permission object (if mutable) or recreate the Permission with all required indices, then update the Machine (if mutable).
|
|
508
|
-
3. Alternative: replace `permissionIndex` with `namedOperator` for per-order roles (avoids the index entirely).
|
|
509
|
-
4. Re-run R6.
|
|
510
|
-
|
|
511
|
-
**Prevention**: Design the Permission object first, then the Machine (per [wowok-machine](../wowok-machine/SKILL.md) §Dependency-First Construction). R6 cross-references every index.
|
|
512
|
-
|
|
513
|
-
### F5: Untested Guard
|
|
514
|
-
|
|
515
|
-
**Trigger**: R3 finds a Guard bound to a fund-flow operation, but no passing `gen_passport` test is on record for that Guard.
|
|
516
|
-
|
|
517
|
-
**Diagnosis**: The Guard's logic has not been verified against any submission. A logic bug would only surface after publish, when the Guard is immutable and the host is immutable.
|
|
518
|
-
|
|
519
|
-
**Recovery**:
|
|
520
|
-
1. For each untested Guard: design mock submissions covering pass, fail, and edge cases (empty, boundary, unusual addresses).
|
|
521
|
-
2. Run `onchain_operations` → `operation_type: "gen_passport"` with each mock submission.
|
|
522
|
-
3. If `gen_passport` returns FAIL for the expected-pass case: `guard2file` → export, walk the tree, identify the failing node, CREATE a new Guard with corrected logic (immutable — cannot edit), re-test, rebind.
|
|
523
|
-
4. Record the passing test in the audit checkpoint (R3 expects a passing `gen_passport` on record).
|
|
524
|
-
|
|
525
|
-
**Prevention**: R3's PUBLISH_READINESS_RULES treats an untested Guard as WARN. R8 escalates to Permanent risk if the Guard is bound to a published host. Always run `gen_passport` before binding (cite [wowok-guard](../wowok-guard/SKILL.md) §Phase 5).
|
|
526
|
-
|
|
527
|
-
### F6: Semantic Mismatch (Phantom or Missing Object)
|
|
528
|
-
|
|
529
|
-
**Trigger**: R7 finds an object in `semantic.created` that isn't in our R2 inventory (phantom), or an expected object missing from `semantic.created` (missing), or a fund movement in `semantic.released` that doesn't match R5's expected path.
|
|
530
|
-
|
|
531
|
-
**Diagnosis**:
|
|
532
|
-
- **Phantom**: An orphan object from a failed prior attempt. Not referenced by anything, but exists on-chain and may confuse future queries.
|
|
533
|
-
- **Missing**: The creation operation may have partially failed, or the object was created under a different name/account/network.
|
|
534
|
-
- **Unexpected fund movement**: An unintended Allocator fired, or a Guard passed when it should have failed.
|
|
535
|
-
|
|
536
|
-
**Recovery**:
|
|
537
|
-
1. Phantom: query the object via `query_toolkit` → `onchain_objects` by ID; if truly orphaned, leave it (immutable) but flag it in the report so the user knows it exists.
|
|
538
|
-
2. Missing: retry the creation query with `no_cache: true` (cache lag is the most common cause). If still missing, check `env.account` and `env.network` match the creation operation.
|
|
539
|
-
3. Unexpected fund movement: FAIL — investigate which Allocator fired and why. May indicate an Allocator Guard with too-broad a trigger condition.
|
|
540
|
-
|
|
541
|
-
**Prevention**: R7 cross-checks `semantic` against R2's inventory. Run audits with `no_cache: true` to avoid cache-lag false negatives.
|
|
542
|
-
|
|
543
|
-
---
|
|
544
|
-
|
|
545
|
-
## Tier Layering
|
|
546
|
-
|
|
547
|
-
### Tier 1 — Basic Audit
|
|
548
|
-
|
|
549
|
-
**Profile**: Single Service + single Guard + single Allocator. No Machine (or a trivial 2-node Machine). The user is publishing a simple payment service.
|
|
550
|
-
|
|
551
|
-
**AI Behavior**:
|
|
552
|
-
- Run R1 (scope = single Service), R2 (inventory), R3 (Guard completeness — one Guard), skip R4 (no Machine or trivial), R5 (fund flow — one payment path, one refund path, one Allocator sum), R6 (permission — one index), R7 (semantic — cross-check the single Service's recent operations), R8 (risk — low, recoverable), R9 (report), R10 (decision).
|
|
553
|
-
- GUARD_COMPLETENESS_RULES and FUND_FLOW_RULES are the primary tables. MACHINE_SOUNDNESS_RULES is skipped or trivial.
|
|
554
|
-
- Trigger: user says "audit my service" with a single Service in scope.
|
|
555
|
-
|
|
556
|
-
### Tier 2 — Standard Audit
|
|
557
|
-
|
|
558
|
-
**Profile**: Multi-Guard + multi-state Machine + multi-Allocator. The user is publishing a Service with a non-trivial workflow (e.g., freelance, rental, e-commerce with dispute flow).
|
|
559
|
-
|
|
560
|
-
**AI Behavior**:
|
|
561
|
-
- Full R1-R10. All four rule tables apply.
|
|
562
|
-
- R3 checks every Guard binding across Service `buy_guard`, `order_allocators[].guard`, and Machine Forward `guard`.
|
|
563
|
-
- R4 runs full Machine soundness (acyclicity, single entry, reachability, terminal correctness, forward permissions, threshold achievability).
|
|
564
|
-
- R5 traces every payment → escrow → allocation path, including branches and dispute refund paths.
|
|
565
|
-
- R6 cross-references every Forward's `permissionIndex` against the Permission object.
|
|
566
|
-
- R7 cross-checks `semantic.created`/`modified`/`released`/`events` against the full object inventory.
|
|
567
|
-
- Trigger: user has a Service with a bound published Machine, multiple Guards, and multiple Allocators.
|
|
568
|
-
|
|
569
|
-
### Tier 3 — Advanced Audit
|
|
570
|
-
|
|
571
|
-
**Profile**: Complex dependency chains + conditional flows + arbitration integration. The user is publishing a multi-Machine supply chain, a Service with cross-Machine Guard verification, or an Arbitration-bound Service.
|
|
572
|
-
|
|
573
|
-
**AI Behavior**:
|
|
574
|
-
- Full R1-R10 with extended checks.
|
|
575
|
-
- R2 builds a dependency graph spanning multiple Machines, multiple Services, and Arbitration objects. Detects object-level cycles across the supply chain.
|
|
576
|
-
- R3 includes Arbitration `voting_guard` and `usage_guard` completeness — every voting_guard has a numeric `GuardIdentifier`; every usage_guard has a valid Passport path.
|
|
577
|
-
- R4 includes cross-Machine Guard verification: Machine A's Forward Guard queries Machine B's Progress via `convert_witness`. Verify the witness type and query instruction ID are correct (cite [wowok-machine](../wowok-machine/SKILL.md) F5).
|
|
578
|
-
- R5 traces fund flow across Machines: payment on Service A → escrow → Allocation on Service A triggers sub-order on Service B → escrow on Service B → Allocation on Service B. Verify refund symmetry across the entire chain.
|
|
579
|
-
- R7 cross-checks `semantic` across all Machines and Services — every expected object creation and fund movement appears in the right operation's semantic field.
|
|
580
|
-
- R8 classifies blast radius up to `all_services_on_machine` and `all_arbitrations_on_guard`. A Guard logic bug on a shared voting_guard affects every Arbitration using it.
|
|
581
|
-
- Trigger: user explicitly asks for "advanced audit", references cross-Machine composition, or has an Arbitration-bound Service with voting guards.
|
|
102
|
+
## Appendices (Progressive Disclosure)
|
|
103
|
+
|
|
104
|
+
> The following sections have been extracted to [APPENDIX.md](./APPENDIX.md) for on-demand loading:
|
|
105
|
+
> - Dialogue Scripts (R1-R10) — guided conversation scripts
|
|
106
|
+
> - Decision Trees — branching logic reference
|
|
107
|
+
> - Failure Playbooks — recovery scenarios
|
|
108
|
+
> - Tier Layering — expertise-tier based guidance
|
|
109
|
+
>
|
|
110
|
+
> Load APPENDIX.md when the user needs guided dialogue, recovery help, or tier-specific guidance.
|