@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.
@@ -273,403 +273,12 @@ Guard created with bug → Cannot fix (immutable)
273
273
 
274
274
  ---
275
275
 
276
- ## Dialogue Scripts (R1-R10)
277
-
278
- A 10-round dialogue for the Machine design journey: from "I need a workflow" through "published and bound to a Service". Each round produces one piece of the Machine blueprint and verifies it before advancing. The sequence enforces the dependency-first construction order (Permission → unpublished Machine → Guards → bind → publish → bind Service) — publishing too early is the single most expensive mistake in this domain.
279
-
280
- ### R1: Workflow Intent Capture
281
-
282
- **AI Goal**: Understand the user's business process at the node-graph level: what stages exist, who advances each, what conditions gate each transition.
283
-
284
- **Key Questions**:
285
- - In plain language, what are the stages an order goes through from start to finish? (e.g., "ordered → in progress → delivered → accepted → completed")
286
- - Are there any branches? (e.g., "if disputed, go to refund instead of complete")
287
- - Who advances each transition? (customer, provider, system auto-advance, named operator like a delivery person)
288
-
289
- **Tool Calls**:
290
- 1. `query_toolkit` → `local_names` — confirm the working account and any existing Machines that might be reusable.
291
- 2. `wowok_buildin_info` → `info: "guard instructions"` — pre-fetch the query instruction catalog so R7's Guards reference real instruction IDs.
292
- 3. (Internal) Cross-reference [wowok-scenario](../wowok-scenario/SKILL.md) for a mode template that matches the user's described stages — load it as a starting point, not a constraint.
293
-
294
- **Success Criteria**: AI sketches the proposed node graph in ASCII and the user confirms the topology matches their mental model.
295
-
296
- **Fallback**: User cannot articulate stages → suggest a mode template (freelance/rental/education) and ask "does this look right?". User wants a non-mode workflow → switch to `general` mode and proceed with manual design, leaning on [wowok-machine](../wowok-machine/SKILL.md) §Workflow Design Patterns.
297
-
298
- **Checkpoint**: Persist `{ round: R1, nodes: [...], branches: [...], actors: [...] }` via `local_info_operation`.
299
-
300
- ### R2: Node List Finalization
301
-
302
- **AI Goal**: Lock the full node name list with no duplicates, no orphans, and at least one entry node (prev_node = "") and one terminal node.
303
-
304
- **Key Questions**:
305
- - Confirm the node names. Names are immutable after publish — pick names that future-you will understand.
306
- - For each node, is it an entry (no incoming), terminal (no outgoing), or intermediate?
307
- - Any node that should auto-advance on timeout? (Records the need for a time-lock Forward.)
308
-
309
- **Tool Calls**:
310
- 1. (Internal) Validate node list: at least 2 nodes (entry + terminal), no duplicate names, every non-entry has at least one incoming Pair, every non-terminal has at least one outgoing Forward.
311
- 2. `machineNode2file` → (only if iteratively editing an existing Machine) export current state as the starting JSON.
312
-
313
- **Success Criteria**: AI returns a table of nodes with `prev_node`, classification (entry/intermediate/terminal), and the user confirms.
314
-
315
- **Fallback**: Node count < 2 → enforce minimum (entry + terminal). User wants to rename later → fine pre-publish via `node.rename` (auto-updates Pair references); impossible post-publish. User has too many nodes (>20) → suggest decomposition into multiple Machines via §Cross-Machine Supply Chain Composition.
316
-
317
- **Checkpoint**: Persist `{ round: R2, node_count, nodes: [{name, type: entry|intermediate|terminal}] }`.
318
-
319
- ### R3: Pair & Threshold Design
320
-
321
- **AI Goal**: For each target node, configure the incoming Pair: which `prev_node`(s) feed it and what `threshold` of Forward weight is required to advance.
322
-
323
- **Key Questions**:
324
- - For each transition, is it single-actor (threshold=1, one Forward weight=1) or multi-actor (threshold=N, multiple Forwards)?
325
- - Are there competing transitions from the same node? (Mutually exclusive branches — first Pair to meet threshold wins.)
326
- - Any dual-signature requirements? (Both customer and merchant must confirm — threshold=2 with two weight=1 Forwards.)
327
-
328
- **Tool Calls**:
329
- 1. (Internal) Build the Pair table: `(prev_node, target_node, threshold)`. Validate that no Pair creates an unreachable branch (a Pair whose threshold can never be met because users always prefer another path = dead branch per §Threshold Mechanics).
330
- 2. `schema_query` → `get` for `onchain_operations_machine` to confirm threshold is `u32` and weight is `u16` (0–65535).
331
-
332
- **Success Criteria**: Pair table is complete and validated; every Pair is independently achievable. AI shows the graph with thresholds annotated.
333
-
334
- **Fallback**: User wants weighted voting (e.g., 60+40) → use threshold=100 with weights 60 and 40. User wants parallel-AND (all must contribute) → threshold=N with N weight=1 Forwards. User wants parallel-OR (mutually exclusive) → multiple Pairs each threshold=1, accepting that first-Pair-wins abandons the others.
335
-
336
- **Checkpoint**: Persist `{ round: R3, pairs: [{prev_node, target_node, threshold}], pattern: sequential|and|or|weighted|hybrid }`.
337
-
338
- ### R4: Forward & Operator Design
339
-
340
- **AI Goal**: For each Pair, define its Forward(s): `name`, `weight`, and exactly one of (`permissionIndex` | `namedOperator` | both).
341
-
342
- **Key Questions**:
343
- - For each Forward, who can execute it? (Internal staff via `permissionIndex`, per-order role via `namedOperator`, order owner/agents via `namedOperator: ""`.)
344
- - Should the Forward require BOTH a permission AND a named operator? (Rare; use both fields.)
345
- - Any Forward that should be auto-executable by anyone after a timeout? (Set `namedOperator: ""` and bind a time-lock Guard in R7.)
346
-
347
- **Tool Calls**:
348
- 1. `query_toolkit` → `onchain_objects` (filter type=Permission) — list the user's Permission objects and their indices.
349
- 2. `wowok_buildin_info` → `info: "built-in permissions"` — confirm 0–999 are protocol-reserved; user indices must be ≥ 1000.
350
- 3. (Internal) Validate every Forward has at least one of `permissionIndex` or `namedOperator` — both empty = SDK error per §Forward Permission Model.
351
-
352
- **Success Criteria**: Forward table is complete with `(name, weight, permissionIndex?, namedOperator?)` for every Pair. Every `permissionIndex` exists in the chosen Permission.
353
-
354
- **Fallback**: User wants a role that varies per order (delivery person, reviewer) → use `namedOperator: "<role_name>"` and assign addresses per Progress via `progress` MODIFY later. User wants customer to operate → `namedOperator: ""`. User picks an index < 1000 → block, cite §Permission Index Model.
355
-
356
- **Checkpoint**: Persist `{ round: R4, forwards: [{pair, name, weight, permissionIndex?, namedOperator?}], permission_id }`.
357
-
358
- ### R5: CREATE the Unpublished Machine
359
-
360
- **AI Goal**: Execute `onchain_operations` → `operation_type: "machine"` CREATE with `publish: false`. This is the first on-chain action — everything before was design.
361
-
362
- **Key Questions**:
363
- - Confirm the Machine name (versioned: `<project>_machine_<purpose>_v1`).
364
- - Confirm `publish: false` — we publish only after Guards are created and bound (R8).
365
- - Confirm the operating account and `env.no_cache: true` (we'll immediately query the Machine in R6).
366
-
367
- **Tool Calls**:
368
- 1. `onchain_operations` → `operation_type: "machine"` with `data.name`, `data.nodes`, `data.pairs`, `data.forwards`, `publish: false`.
369
- 2. `query_toolkit` → `onchain_objects` for the new `machine_id` — verify all nodes are present and `bPublished: false`.
370
- 3. `local_mark_operation` → tag the Machine (e.g., `freelance_machine_v1`).
371
-
372
- **Success Criteria**: Machine created on-chain, `bPublished: false`, all nodes/forwards present in the query. Local mark persisted.
373
-
374
- **Fallback**: CREATE fails with "node count < 2" → return to R2 and enforce minimum. CREATE fails with "forward missing permissionIndex and namedOperator" → return to R4 and fill the empty field. CREATE fails with name collision → append `_v1`/`_v2` per [wowok-safety](../wowok-safety/SKILL.md) §4.
375
-
376
- **Checkpoint**: Persist `{ round: R5, machine_id, machine_name, bPublished: false }`.
377
-
378
- ### R6: Progress Template Decision
379
-
380
- **AI Goal**: Decide whether to bind a Progress template now or after Guard binding. Most flows bind Progress now (R6) so R7's Guard tests can use a real Progress instance.
381
-
382
- **Key Questions**:
383
- - Should Progress mirror every Machine node (typical) or only customer-visible milestones (alternative)?
384
- - Do you want customer-facing labels per state? (Stored as Progress metadata.)
385
- - Will the Progress be Service-bound (auto-spawned per Order) or standalone?
386
-
387
- **Tool Calls**:
388
- 1. `onchain_operations` → `operation_type: "progress"` CREATE with `data.machine = "<machine_name>"` (resolves via `GetObjectExisted()`), `data.belong_to` = the Service (if known), optional metadata fields.
389
- 2. (If Service not yet created) defer Progress binding to [wowok-onboard](../wowok-onboard/SKILL.md) R6 — just record the intent in the checkpoint.
390
-
391
- **Success Criteria**: Progress template created and bound to Machine (or intent recorded for later binding).
392
-
393
- **Fallback**: Binding fails because Machine is already published → impossible to unpublish (immutable); create a NEW Machine and rebind. Progress field missing → use mode default template.
394
-
395
- **Checkpoint**: Persist `{ round: R6, progress_id, mirrored_nodes: [...] }`.
396
-
397
- ### R7: Guard Design & Binding Plan
398
-
399
- **AI Goal**: Design the Guards that gate specific Forwards (workflow gates) and the Guards that gate fund release (Allocator gates). Use the circular reference pattern (object first, Guard second, bind third).
400
-
401
- **Key Questions**:
402
- - Which Forwards need Guards? (Common: pickup, delivery, acceptance, refund trigger.)
403
- - For each Forward Guard, what does it validate? (Identity, time-lock, external data, progress history, reward record count.)
404
- - Should the Guard retain submissions for later query? (`retained_submission` indexed by `(current_node, next_node, forward_name)`.)
405
-
406
- **Tool Calls**:
407
- 1. `wowok_buildin_info` → `info: "guard instructions"` — confirm each `query` node's instruction ID and parameter count before designing the tree.
408
- 2. `wowok_buildin_info` → `info: "value types"` — confirm table entry types.
409
- 3. (Internal) For each Guard, sketch the table + computation tree per [wowok-guard](../wowok-guard/SKILL.md) §Phase 1-3. Guards are CREATE-only — design before building.
410
- 4. Plan the binding: which Guard binds to which Forward via `onchain_operations` → `operation_type: "machine"` MODIFY (Forward `guard` field).
411
-
412
- **Success Criteria**: Each planned Guard has a table draft, a computation tree draft, and a designated Forward to bind to. AI presents the full binding plan.
413
-
414
- **Fallback**: User wants a Guard that queries an object not yet created (e.g., queries Order from a Forward) → use `convert_witness` (e.g., `TypeOrderProgress` = 100) to derive the target from a submitted ID. User wants a Guard that depends on another Guard → use `rely` (max 4, AND/OR logic, all dependencies must have `rep: true`).
415
-
416
- **Checkpoint**: Persist `{ round: R7, guards: [{name, target_forward, table_sketch, tree_sketch, convert_witness?}] }`.
417
-
418
- ### R8: Guard CREATE & gen_passport Test
419
-
420
- **AI Goal**: Create each Guard on-chain, immediately test it via `gen_passport`, and bind the passing Guards to their Forwards.
421
-
422
- **Key Questions**:
423
- - Confirm: I'm creating `<n>` Guards. Each is immutable after creation — logic must be correct.
424
- - For each `gen_passport` test, what mock submission should I use? (Use small time-locks like 1000ms during testing per [wowok-guard](../wowok-guard/SKILL.md) trap 5.)
425
- - Confirm binding: Guard A → Forward X, Guard B → Forward Y, etc.
426
-
427
- **Tool Calls**:
428
- 1. For each Guard: `onchain_operations` → `operation_type: "guard"` CREATE (with `root.type: "node"` inline, or `root.type: "file"` from a `guard2file` export).
429
- 2. For each Guard: `onchain_operations` → `operation_type: "gen_passport"` with mock `info` submissions — verify PASS.
430
- 3. For each passing Guard: `onchain_operations` → `operation_type: "machine"` MODIFY to bind `guard` on the target Forward (use the `node` operations: `add forward` with full `MachineForward` including `guard` + `retained_submission`).
431
- 4. `guard2file` → export each bound Guard for the audit trail.
432
-
433
- **Success Criteria**: All Guards created, all `gen_passport` tests PASS, all Guards bound to the correct Forwards. `guard2file` exports persisted.
434
-
435
- **Fallback**: `gen_passport` fails → isolate the failing Guard via `guard2file` export, inspect the computation tree, consult [wowok-guard](../wowok-guard/SKILL.md) §10 traps, CREATE a new Guard with corrected logic (immutable — cannot edit), re-test, rebind. Type mismatch in `convert_witness` → re-create Guard with correct target type.
436
-
437
- **Checkpoint**: Persist `{ round: R8, guards: [{name, id, bound_to, passport_test: pass|fail}], all_pass: true }`.
438
-
439
- ### R9: Pre-Publish Audit & Test Progress
440
-
441
- **AI Goal**: Run the full §Pre-Publish Validation Checklist against the unpublished Machine, then execute a test Progress through every path to catch runtime issues the static checks miss.
442
-
443
- **Key Questions**:
444
- - Confirm: ready to run the pre-publish audit? This is the last chance to fix before immutability.
445
- - For the test Progress, can you provide a second account to play the customer role?
446
-
447
- **Tool Calls**:
448
- 1. (Internal) Run the §Pre-Publish Validation Checklist: entry point exists, no dead-end nodes, no orphaned nodes, all thresholds achievable, all Guards exist and tested, `namedOperator` vs `permissionIndex` correct, every Forward has at least one operator, terminal nodes mapped to Allocators.
449
- 2. `machineNode2file` → export the current Machine as a backup (pre-publish state).
450
- 3. `account_operation` → `gen` (second account for testing) + `faucet`.
451
- 4. `onchain_operations` → `operation_type: "progress"` (or `order` if Service-bound) — advance a test instance through every node, including branch paths.
452
- 5. At each terminal node: verify Allocation triggers correctly (if Allocators are configured).
453
-
454
- **Success Criteria**: All checklist items pass. Test Progress traverses every path. `machineNode2file` backup persisted. AI presents the audit report.
455
-
456
- **Fallback**: Checklist blocker (e.g., dead-end node) → return to R2/R3 and fix. Test Progress stuck at a node → check Forward operators, check Guard submissions, check threshold accumulation. Competing Pair always wins → dead branch; either remove the losing Pair or restructure to make it achievable.
457
-
458
- **Checkpoint**: Persist `{ round: R9, audit_pass: true, test_progress_id, paths_tested: [...], backup_export_path }`.
459
-
460
- ### R10: Publish & Bind to Service
461
-
462
- **AI Goal**: Execute the irreversible `publish: true`, then bind the published Machine to its Service. Post-publish, verify immutability locks are in place.
463
-
464
- **Key Questions**:
465
- - Final confirmation: publish is irreversible. Nodes, Forwards, Guards, thresholds all become immutable. Proceed?
466
- - Is the target Service already created and unpublished? (Service publish requires a published Machine per [wowok-tools](../wowok-tools/SKILL.md) §service constraints.)
467
-
468
- **Tool Calls**:
469
- 1. `onchain_operations` → `operation_type: "machine"` with `publish: true` — Machine locked.
470
- 2. `onchain_operations` → `operation_type: "service"` MODIFY to bind `data.machine = "<published_machine_id>"`.
471
- 3. (If Service is also ready to publish) `onchain_operations` → `operation_type: "service"` with `publish: true` — Service `machine` and `order_allocators` fields locked.
472
- 4. Post-publish verification: `query_toolkit` → `onchain_objects` for the Machine → confirm `bPublished: true`. For the Service → confirm `machine` field is locked.
473
- 5. `onchain_events` → confirm Publish event fired.
474
-
475
- **Success Criteria**: Machine `bPublished: true`. Service `machine` field bound and (if published) immutable. Publish event recorded. Handoff packet produced for [wowok-provider](../wowok-provider/SKILL.md).
476
-
477
- **Fallback**: Pre-publish audit fails → return to R9 and fix; do NOT publish. Publish transaction fails (gas) → re-faucet, retry. Service publish fails with "machine not published" → confirm Machine publish succeeded first (cache may be stale — use `env.no_cache: true`). Post-publish immutability check fails (rare) → escalate; protocol-level invariant violated.
478
-
479
- **Checkpoint**: Persist `{ round: R10, machine_published: true, service_bound: true, service_published: bool, publish_digest }`. Mark Machine design COMPLETE.
480
-
481
- **Handoff Packet** (emitted to [wowok-provider](../wowok-provider/SKILL.md) and [wowok-order](../wowok-order/SKILL.md)):
482
- - Machine ID + name + publish digest
483
- - Node topology summary (entry, terminals, branches)
484
- - Forward → Guard binding map
485
- - Progress template ID
486
- - Test Progress digest + result
487
- - Recommended next Skill: wowok-provider (operations), wowok-order (buyer perspective)
488
-
489
- ---
490
-
491
- ## Decision Trees
492
-
493
- ### D1: Execution Pattern Selection
494
-
495
- ```
496
- Transition requirement:
497
- ├── Single actor each step? ──→ Sequential: threshold=1, one Forward weight=1
498
- ├── All parties must contribute? ──→ Parallel AND: threshold=N, N Forwards weight=1
499
- ├── Mutually exclusive branches? ──→ Parallel OR: multiple Pairs each threshold=1 (first-Pair-wins)
500
- ├── Unequal stakeholder power? ──→ Weighted Voting: threshold=100, varied weights (60+40)
501
- └── Key party required + others optional? ──→ Hybrid: threshold=5, mixed weights (3+1+1)
502
- ```
503
-
504
- ### D2: Forward Operator Selection
505
-
506
- ```
507
- Who executes this Forward?
508
- ├── Internal staff (same for every order)? ──→ permissionIndex (≥1000, from governing Permission)
509
- ├── Per-order role (delivery person, reviewer)? ──→ namedOperator: "<role_name>" (assigned per Progress)
510
- ├── Order owner / agents (the customer)? ──→ namedOperator: "" (empty string)
511
- ├── Both internal staff AND per-order roles? ──→ set BOTH fields (executor needs EITHER)
512
- └── Auto-advance on timeout (anyone can push)? ──→ namedOperator: "" + time-lock Guard
513
- ```
514
-
515
- ### D3: Decompose into Multiple Machines?
516
-
517
- ```
518
- Workflow complexity check:
519
- ├── Same participants and permission model throughout? ──→ KEEP in one Machine
520
- ├── Dense sequential data flow with no clear boundary? ──→ KEEP in one Machine
521
- ├── Sub-process is independently valuable as a standalone Service? ──→ DECOMPOSE
522
- ├── Different participant sets operate in different phases? ──→ DECOMPOSE
523
- ├── Sub-process is reusable across multiple parent workflows? ──→ DECOMPOSE
524
- └── If decomposed: connect via Guard-based sub-Progress / sub-Order verification (§Cross-Machine Composition)
525
- ```
526
-
527
- ### D4: Guard Binding Target
528
-
529
- ```
530
- Guard validates...
531
- ├── A specific Forward's execution? ──→ bind to Machine Forward `guard` field (workflow gate)
532
- ├── Fund release at a terminal node? ──→ bind to Service `order_allocators[].guard` (Allocator gate)
533
- ├── Order placement eligibility? ──→ bind to Service `buy_guard` (purchase gate)
534
- ├── Vote weight in arbitration? ──→ bind to Arbitration `voting_guard[]` (governance)
535
- ├── Dispute filing eligibility? ──→ bind to Arbitration `usage_guard` (case gate)
536
- ├── Reward claim eligibility? ──→ bind to Reward `guard` (claim gate)
537
- └── Repository write eligibility? ──→ bind to Repository `write_guard` (storage gate)
538
- ```
539
-
540
- ### D5: Pre-Publish Audit Outcome
541
-
542
- ```
543
- R9 pre-publish audit:
544
- ├── All checklist items PASS + test Progress traversed every path? ──→ proceed to R10 publish
545
- ├── Warnings only (e.g., no Compensation Fund on Service)? ──→ ask user, then publish or fix
546
- ├── Blockers (dead-end node, missing Guard, unreachable Pair)? ──→ return to R2/R3/R7/R8, fix, re-audit
547
- └── Test Progress stuck at a node? ──→ diagnose Forward operator / Guard / threshold, fix, re-test
548
- ```
549
-
550
- ---
551
-
552
- ## Failure Playbooks
553
-
554
- ### F1: Guard + Machine Immutability Deadlock
555
-
556
- **Trigger**: A Guard is created with a bug, bound to a Forward on a Machine, and then the Machine is published. The Guard cannot be edited (immutable) and the Machine cannot be modified (immutable after publish).
557
-
558
- **Diagnosis**: Both immutability locks have fired. The Guard's bug is now permanent on this Machine.
559
-
560
- **Recovery**:
561
- 1. Accept that this Machine is permanently broken at the buggy Forward.
562
- 2. `machineNode2file` → export the Machine's topology as a starting point.
563
- 3. Create a NEW Machine (unpublished) with the same topology, but leave the buggy Forward's `guard` field empty.
564
- 4. CREATE a new Guard with corrected logic (use `guard2file` on the buggy Guard as a reference, fix the tree).
565
- 5. Test the new Guard via `gen_passport`.
566
- 6. Bind the new Guard to the corresponding Forward on the new Machine.
567
- 7. Publish the new Machine, rebind the Service to it.
568
-
569
- **Prevention**: NEVER publish a Machine before all Guards are created, tested via `gen_passport`, and bound. The §Pre-Publish Validation Checklist exists for exactly this reason. Test every Guard with mock submissions including edge cases (empty, boundary values, unusual addresses) before binding.
570
-
571
- ### F2: Dead Branch (Unreachable Pair)
572
-
573
- **Trigger**: A Pair's threshold can never be met because users always prefer another competing path from the same node. Funds or orders get stuck if they reach the dead branch's preconditions.
574
-
575
- **Diagnosis**: Static analysis of the Machine topology. The dead branch's Pair is reachable in principle, but in practice every executor chooses the competing Pair first (first-Pair-wins rule).
576
-
577
- **Recovery** (pre-publish):
578
- 1. Either: remove the dead Pair entirely (if the branch is truly unwanted), OR
579
- 2. Restructure so the dead branch's Forward is the ONLY path from its source node, OR
580
- 3. Add a time-lock Forward on the dead branch's path that auto-advances after a deadline (so even if no human picks it, the timeout triggers).
581
-
582
- **Recovery** (post-publish — Machine immutable):
583
- 1. Cannot modify the Machine. Accept the dead branch exists.
584
- 2. Ensure Service-level Allocation rules route funds correctly regardless of which branch wins.
585
- 3. For future orders, create a new Machine without the dead branch and rebind the Service.
586
-
587
- **Prevention**: R3's Pair validation explicitly checks "is every Pair independently achievable?" — if any Pair's threshold can never be met because a competing Pair always wins first, flag it as a dead branch before CREATE.
588
-
589
- ### F3: Threshold Not Met (Session Stuck)
590
-
591
- **Trigger**: A Progress instance is stuck at a node because the accumulated Forward weight in the current session is below the Pair's threshold, and no further Forwards can be executed.
592
-
593
- **Diagnosis**: Query the Progress via `query_toolkit` → `onchain_objects` — inspect `current_node`, `session`, and `forward_history`. Identify which Forwards have executed and which haven't.
594
-
595
- **Recovery**:
596
- 1. If a Forward was missed (e.g., a named operator didn't execute): `progress` MODIFY to assign the role address, then execute the Forward.
597
- 2. If a Guard is blocking a Forward: re-collect the correct submission, re-call `progress` with `hold: false` and the submission.
598
- 3. If the session is locked by another party: `progress` with `adminUnhold: true` to force-release stale locks (use with care — this overrides others' locks).
599
- 4. If the threshold is genuinely unreachable (e.g., a required Forward's operator is permanently unavailable): the only recovery is to escalate to a dispute path or accept the order is stuck.
600
-
601
- **Prevention**: During R3 Pair design, verify that every threshold is achievable by the Forwards defined. During R4 Forward design, ensure every Forward has a clear operator (not "nobody"). For customer-side Forwards, set a time-lock auto-advance so the session can't stick indefinitely.
602
-
603
- ### F4: `node.clear` Wipes Machine
604
-
605
- **Trigger**: The user (or AI) calls `onchain_operations` → `operation_type: "machine"` with `node.clear`, expecting a confirm prompt, and the Machine's nodes are instantly wiped with no undo.
606
-
607
- **Diagnosis**: `clear` is irreversible by design (§Node Operations). The Machine's topology is gone.
608
-
609
- **Recovery**:
610
- 1. If `machineNode2file` was run before the clear (R9 backup), the topology is recoverable: re-create the nodes via `node.add` or `node.json_or_markdown_file` (complete replacement from the file).
611
- 2. If no backup exists: rebuild from memory / design notes. This is painful but the Machine itself (object ID, publish state) is not destroyed — only its node graph.
612
- 3. If the Machine was already published: clearing is impossible (nodes are immutable post-publish), so this failure mode cannot occur.
613
-
614
- **Prevention**: ALWAYS `machineNode2file` before any `node.clear`, `node.exchange`, or `node.set` with `bReplace: true`. Treat the export as a mandatory pre-flight, not an optional step. The §Pre-Publish Validation Checklist explicitly includes "Current state exported via `machineNode2file` as backup".
615
-
616
- ### F5: Cross-Machine Guard Fails to Query Sub-Progress
617
-
618
- **Trigger**: A Guard on Machine A queries Machine B's Progress (sub-Progress dependency) and returns false even though Machine B's Progress has reached the expected node.
619
-
620
- **Diagnosis**: The `convert_witness` type is wrong, the query instruction ID is wrong, or the sub-Progress's `current_node` field name doesn't match what the Guard expects.
621
-
622
- **Recovery**:
623
- 1. `guard2file` → export the failing Guard, inspect the `query` node's instruction and `convert_witness`.
624
- 2. `wowok_buildin_info` → `info: "guard instructions"` — confirm the instruction ID targets Progress and accepts the witness type.
625
- 3. Query the sub-Progress directly via `query_toolkit` → `onchain_objects` — confirm `current_node` matches the Guard's expected value.
626
- 4. If the Guard logic is wrong: CREATE a new Guard with corrected logic (immutable — cannot edit), rebind to Machine A's Forward.
627
- 5. If Machine A is already published (immutable): see F1 deadlock recovery — must create a new Machine A.
628
-
629
- **Prevention**: During R7 Guard design, for every cross-Machine query, validate the witness type and instruction ID against `wowok_buildin_info` BEFORE creating the Guard. Test the Guard via `gen_passport` with a real sub-Progress instance before binding.
630
-
631
- ### F6: Publish Fails Because Service Already Bound to Another Machine
632
-
633
- **Trigger**: `service` MODIFY with `data.machine = "<new_machine_id>"` reverts because the Service is already published and its `machine` field is immutable.
634
-
635
- **Diagnosis**: The Service was published with a different Machine bound. Post-publish, `service.machine` cannot be changed.
636
-
637
- **Recovery**:
638
- 1. Confirm the Service's `bPublished` state via `query_toolkit` → `onchain_objects`.
639
- 2. If published: the only path is to create a NEW Service (unpublished), bind the new Machine to it, publish the new Service. The old Service remains on-chain but is deprecated.
640
- 3. If not published: the previous bind was a draft — re-call `service` MODIFY with the new Machine ID, it should succeed.
641
- 4. Migrate any active orders to the new Service if applicable (or honor the old Service's commitments until they complete).
642
-
643
- **Prevention**: During [wowok-onboard](../wowok-onboard/SKILL.md) R5-R10, bind the Machine to the Service BEFORE either is published. The dependency order is: create Machine (unpublished) → bind to Service (unpublished) → publish Machine → publish Service. Never publish the Service before the Machine is bound.
644
-
645
- ---
646
-
647
- ## Tier Layering
648
-
649
- ### Novice Tier — Mode-Template Path
650
-
651
- - Start from a [wowok-scenario](../wowok-scenario/SKILL.md) mode template (freelance, rental, education, travel, subscription) — the node graph, thresholds, and Forward operators are pre-filled.
652
- - R1-R4 reduce to "confirm the template" rather than "design from scratch".
653
- - R7 Guards are also templated — the user confirms which subset of template Guards to use.
654
- - The full R1-R10 sequence still executes, but each round is a confirmation, not a design decision.
655
- - Pre-publish audit is mandatory and blocking — no overrides.
656
- - Trigger: user is new, or says "I want the standard freelance/rental workflow".
657
-
658
- ### Advanced Tier — Template Customization
659
-
660
- - Start from a mode template but override specific fields: add/remove nodes, change thresholds, swap Forward operators, add custom Guards.
661
- - R1-R4 are interactive design sessions, with the template as a starting point.
662
- - R7 may include Guards not in the template (e.g., a custom time-lock, a custom Repository query).
663
- - Pre-publish audit runs; warnings are non-blocking with explicit user confirmation, blockers still block.
664
- - Cross-Machine composition becomes available (§Cross-Machine Supply Chain Composition) — decompose complex flows into multiple Machines.
665
- - Trigger: user says "I want to customize" or has completed prior Machine designs.
666
-
667
- ### Expert Tier — Free-Form Design
668
-
669
- - No mode template; the user designs the full topology from scratch using §Workflow Design Patterns as the reference.
670
- - R1-R4 are full design sessions; the AI's role is to validate (no dead branches, no orphaned nodes, thresholds achievable) rather than to suggest.
671
- - R7 may include advanced Guard patterns: `rely` composition (AND/OR across up to 4 Guards), `convert_witness` cross-object queries, `retained_submission` for audit trails.
672
- - R9 pre-publish audit is optional but strongly recommended; the user may publish without it (at their own risk).
673
- - Dual-signature consensus, weighted voting, and hybrid threshold patterns are all available.
674
- - Cross-Machine composition via Guard-based sub-Progress / sub-Order verification is the norm for complex business processes.
675
- - Trigger: user explicitly asks for "expert mode", invokes `machineNode2file` and `guard2file` themselves, or has published multiple Machines previously.
276
+ ## Appendices (Progressive Disclosure)
277
+
278
+ > The following sections have been extracted to [APPENDIX.md](./APPENDIX.md) for on-demand loading:
279
+ > - Dialogue Scripts / Onboarding Flow (R1-R10) — guided conversation scripts
280
+ > - Decision Trees — branching logic reference
281
+ > - Failure Playbooks — recovery scenarios
282
+ > - Tier Layering expertise-tier based guidance
283
+ >
284
+ > Load APPENDIX.md when the user needs guided dialogue, recovery help, or tier-specific guidance.