web3skill 0.1.0

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.
Files changed (88) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +127 -0
  3. package/dist/archives/web3-audit-orchestrator.skill +0 -0
  4. package/dist/archives/web3-audit-reporting.skill +0 -0
  5. package/dist/archives/web3-fuzzing-and-invariants.skill +0 -0
  6. package/dist/archives/web3-native-operator.skill +0 -0
  7. package/dist/archives/web3-repo-heuristics.skill +0 -0
  8. package/dist/archives/web3-research-and-market-intel.skill +0 -0
  9. package/dist/archives/web3-risk-gate.skill +0 -0
  10. package/dist/archives/web3-service-orchestrator.skill +0 -0
  11. package/dist/archives/web3-static-analysis-runner.skill +0 -0
  12. package/dist/archives/web3-trace-and-state-analysis.skill +0 -0
  13. package/dist/archives/web3-transaction-simulator.skill +0 -0
  14. package/dist/archives/web3-wallet-operator.skill +0 -0
  15. package/dist/manifest.json +170 -0
  16. package/dist/skills/web3-audit-orchestrator/SKILL.md +79 -0
  17. package/dist/skills/web3-audit-orchestrator/references/ADAPTER_CONSUMPTION_MAP.md +15 -0
  18. package/dist/skills/web3-audit-orchestrator/references/OUTPUT_TEMPLATE.md +52 -0
  19. package/dist/skills/web3-audit-orchestrator/references/REVIEW_STATE_MACHINE.md +25 -0
  20. package/dist/skills/web3-audit-orchestrator/scripts/render_audit_review.py +95 -0
  21. package/dist/skills/web3-audit-reporting/SKILL.md +77 -0
  22. package/dist/skills/web3-audit-reporting/references/FINDING_TEMPLATE.md +54 -0
  23. package/dist/skills/web3-audit-reporting/references/REPORT_TEMPLATE.md +58 -0
  24. package/dist/skills/web3-audit-reporting/references/RETEST_TEMPLATE.md +35 -0
  25. package/dist/skills/web3-audit-reporting/references/SEVERITY_RUBRIC.md +75 -0
  26. package/dist/skills/web3-fuzzing-and-invariants/SKILL.md +68 -0
  27. package/dist/skills/web3-fuzzing-and-invariants/references/ADAPTER_CONSUMPTION_MAP.md +14 -0
  28. package/dist/skills/web3-fuzzing-and-invariants/references/OUTPUT_TEMPLATE.md +40 -0
  29. package/dist/skills/web3-fuzzing-and-invariants/references/READINESS_AND_FAILURES.md +25 -0
  30. package/dist/skills/web3-fuzzing-and-invariants/scripts/render_fuzz_summary.py +64 -0
  31. package/dist/skills/web3-native-operator/SKILL.md +218 -0
  32. package/dist/skills/web3-native-operator/references/EXECUTION_BUNDLE_TEMPLATE.md +47 -0
  33. package/dist/skills/web3-native-operator/references/OPERATOR_BUNDLE_TEMPLATE.md +39 -0
  34. package/dist/skills/web3-native-operator/references/POSTTRADE_FOLLOWUP_BUNDLE_TEMPLATE.md +35 -0
  35. package/dist/skills/web3-native-operator/references/POSTTRADE_WATCH_TEMPLATE.md +34 -0
  36. package/dist/skills/web3-native-operator/references/PRETRADE_PACKET_TEMPLATE.md +34 -0
  37. package/dist/skills/web3-native-operator/references/ROUTE_RECIPES.md +140 -0
  38. package/dist/skills/web3-native-operator/references/ROUTING_STATE_MACHINE.md +73 -0
  39. package/dist/skills/web3-native-operator/references/WATCH_CRON_REQUEST_TEMPLATE.md +26 -0
  40. package/dist/skills/web3-native-operator/references/WATCH_FOLLOWUP_BUNDLE_TEMPLATE.md +35 -0
  41. package/dist/skills/web3-native-operator/references/WATCH_HEARTBEAT_TEMPLATE.md +31 -0
  42. package/dist/skills/web3-native-operator/scripts/apply_followup_bundle_to_heartbeat.py +118 -0
  43. package/dist/skills/web3-native-operator/scripts/render_execution_bundle.py +259 -0
  44. package/dist/skills/web3-native-operator/scripts/render_operator_bundle.py +800 -0
  45. package/dist/skills/web3-native-operator/scripts/render_posttrade_followup_bundle.py +118 -0
  46. package/dist/skills/web3-native-operator/scripts/render_posttrade_watch_status.py +125 -0
  47. package/dist/skills/web3-native-operator/scripts/render_pretrade_packet.py +205 -0
  48. package/dist/skills/web3-native-operator/scripts/render_watch_cron_request.py +88 -0
  49. package/dist/skills/web3-native-operator/scripts/render_watch_followup_bundle.py +118 -0
  50. package/dist/skills/web3-native-operator/scripts/render_watch_heartbeat.py +52 -0
  51. package/dist/skills/web3-repo-heuristics/SKILL.md +37 -0
  52. package/dist/skills/web3-repo-heuristics/references/FOUNDRY.md +49 -0
  53. package/dist/skills/web3-repo-heuristics/references/HARDHAT.md +47 -0
  54. package/dist/skills/web3-repo-heuristics/references/VYPER.md +26 -0
  55. package/dist/skills/web3-research-and-market-intel/SKILL.md +138 -0
  56. package/dist/skills/web3-research-and-market-intel/references/ADAPTER_CONSUMPTION_MAP.md +66 -0
  57. package/dist/skills/web3-research-and-market-intel/references/EVIDENCE_QUALITY.md +27 -0
  58. package/dist/skills/web3-research-and-market-intel/references/OUTPUT_TEMPLATE.md +37 -0
  59. package/dist/skills/web3-research-and-market-intel/references/PORTFOLIO_STATUS_TEMPLATE.md +51 -0
  60. package/dist/skills/web3-research-and-market-intel/references/WATCH_STATUS_TEMPLATE.md +39 -0
  61. package/dist/skills/web3-research-and-market-intel/scripts/render_portfolio_status.py +85 -0
  62. package/dist/skills/web3-research-and-market-intel/scripts/render_research_brief.py +58 -0
  63. package/dist/skills/web3-research-and-market-intel/scripts/render_watch_status.py +70 -0
  64. package/dist/skills/web3-risk-gate/SKILL.md +100 -0
  65. package/dist/skills/web3-risk-gate/references/OUTPUT_TEMPLATE.md +72 -0
  66. package/dist/skills/web3-risk-gate/references/SIGNAL_TAXONOMY.md +34 -0
  67. package/dist/skills/web3-risk-gate/scripts/merge_risk_gate_blocks.py +189 -0
  68. package/dist/skills/web3-service-orchestrator/SKILL.md +34 -0
  69. package/dist/skills/web3-static-analysis-runner/SKILL.md +76 -0
  70. package/dist/skills/web3-static-analysis-runner/references/ADAPTER_CONSUMPTION_MAP.md +13 -0
  71. package/dist/skills/web3-static-analysis-runner/references/OUTPUT_TEMPLATE.md +45 -0
  72. package/dist/skills/web3-static-analysis-runner/references/TRIAGE_BUCKETS.md +16 -0
  73. package/dist/skills/web3-static-analysis-runner/scripts/render_static_analysis_summary.py +64 -0
  74. package/dist/skills/web3-trace-and-state-analysis/SKILL.md +74 -0
  75. package/dist/skills/web3-trace-and-state-analysis/references/ADAPTER_CONSUMPTION_MAP.md +27 -0
  76. package/dist/skills/web3-trace-and-state-analysis/references/OUTPUT_TEMPLATE.md +63 -0
  77. package/dist/skills/web3-trace-and-state-analysis/references/TRACE_BACKEND_PREFLIGHT.md +47 -0
  78. package/dist/skills/web3-trace-and-state-analysis/scripts/render_trace_summary.py +99 -0
  79. package/dist/skills/web3-transaction-simulator/SKILL.md +83 -0
  80. package/dist/skills/web3-transaction-simulator/references/OUTPUT_TEMPLATE.md +86 -0
  81. package/dist/skills/web3-transaction-simulator/references/STATUS_AND_FAILURES.md +49 -0
  82. package/dist/skills/web3-transaction-simulator/scripts/merge_simulation_blocks.py +198 -0
  83. package/dist/skills/web3-wallet-operator/SKILL.md +52 -0
  84. package/dist/skills/web3-wallet-operator/references/ACTION_RECIPES.md +56 -0
  85. package/dist/skills/web3-wallet-operator/references/OUTPUT_TEMPLATE.md +43 -0
  86. package/dist/skills/web3-wallet-operator/scripts/render_wallet_operation_plan.py +101 -0
  87. package/index.js +50 -0
  88. package/package.json +36 -0
@@ -0,0 +1,218 @@
1
+ ---
2
+ name: web3-native-operator
3
+ description: Web3 routing layer for safe execution, simulation, trace analysis, and repo-first smart contract work. Use for transfers, approvals, swaps, audits, onchain debugging, or Web3 research. It does not execute venue-specific flows directly; it routes to safety gates and profile adapters.
4
+ always: true
5
+ ---
6
+
7
+ # Web3-Native Operator
8
+
9
+ Use this skill as the default control plane for Web3 work.
10
+
11
+ ## Routing Rules
12
+
13
+ - If the user wants a chain write, read `web3-risk-gate` first.
14
+ - If the action may move value or approvals, read `web3-transaction-simulator` before any venue-specific adapter.
15
+ - If the user wants a tx, call, state diff, proxy path, or archive-node analysis, read `web3-trace-and-state-analysis`.
16
+ - If the task is a contract or protocol security review, read `web3-audit-orchestrator`.
17
+ - If the user explicitly wants scanners, read `web3-static-analysis-runner`.
18
+ - If the user wants invariants, fuzzing, or failure interpretation, read `web3-fuzzing-and-invariants`.
19
+ - If the task is token research, protocol diligence, market intel, or pre-trade investigation, read `web3-research-and-market-intel`.
20
+ - If the task is venue-specific trading on Hyperliquid, route to `hyperliquid` after risk and simulation.
21
+ - If the task is repo- or contract-based, read `web3-repo-heuristics` before testing or patching.
22
+ - If the task needs live RPC, storage, bytecode, logs, or call data, read `evm-mcp-playbook`.
23
+
24
+ ## Stable Routing Contract
25
+
26
+ For execution, audit, and research flows, do not route from free text alone once
27
+ the relevant downstream skills have produced normalized blocks.
28
+
29
+ Use:
30
+
31
+ - [references/ROUTING_STATE_MACHINE.md](references/ROUTING_STATE_MACHINE.md)
32
+ - [references/ROUTE_RECIPES.md](references/ROUTE_RECIPES.md)
33
+ - [references/EXECUTION_BUNDLE_TEMPLATE.md](references/EXECUTION_BUNDLE_TEMPLATE.md)
34
+ - [references/OPERATOR_BUNDLE_TEMPLATE.md](references/OPERATOR_BUNDLE_TEMPLATE.md)
35
+ - [references/PRETRADE_PACKET_TEMPLATE.md](references/PRETRADE_PACKET_TEMPLATE.md)
36
+ - [references/POSTTRADE_WATCH_TEMPLATE.md](references/POSTTRADE_WATCH_TEMPLATE.md)
37
+ - [references/POSTTRADE_FOLLOWUP_BUNDLE_TEMPLATE.md](references/POSTTRADE_FOLLOWUP_BUNDLE_TEMPLATE.md)
38
+ - [references/WATCH_FOLLOWUP_BUNDLE_TEMPLATE.md](references/WATCH_FOLLOWUP_BUNDLE_TEMPLATE.md)
39
+ - [references/WATCH_CRON_REQUEST_TEMPLATE.md](references/WATCH_CRON_REQUEST_TEMPLATE.md)
40
+ - [references/WATCH_HEARTBEAT_TEMPLATE.md](references/WATCH_HEARTBEAT_TEMPLATE.md)
41
+ - [scripts/render_execution_bundle.py](scripts/render_execution_bundle.py)
42
+ - [scripts/render_operator_bundle.py](scripts/render_operator_bundle.py)
43
+ - [scripts/render_pretrade_packet.py](scripts/render_pretrade_packet.py)
44
+ - [scripts/render_posttrade_followup_bundle.py](scripts/render_posttrade_followup_bundle.py)
45
+ - [scripts/render_posttrade_watch_status.py](scripts/render_posttrade_watch_status.py)
46
+ - [scripts/apply_followup_bundle_to_heartbeat.py](scripts/apply_followup_bundle_to_heartbeat.py)
47
+ - [scripts/render_watch_followup_bundle.py](scripts/render_watch_followup_bundle.py)
48
+ - [scripts/render_watch_cron_request.py](scripts/render_watch_cron_request.py)
49
+ - [scripts/render_watch_heartbeat.py](scripts/render_watch_heartbeat.py)
50
+
51
+ The operator should consume:
52
+
53
+ - execution:
54
+ - `risk_gate.decision`
55
+ - `risk_gate.coverage`
56
+ - `simulation.status`
57
+ - `simulation.readiness`
58
+ - `simulation.venue`
59
+ - audit:
60
+ - `audit_review.review_state`
61
+ - `static_analysis_summary.status`
62
+ - `fuzz_summary.campaign_status`
63
+ - research:
64
+ - `research_brief.conclusion`
65
+ - `research_brief.freshness`
66
+ - watch:
67
+ - `watch_status.status`
68
+ - `watch_status.watch_kind`
69
+ - `watch_status.subject`
70
+ - `watch_status.trigger_source`
71
+ - `watch_status.severity`
72
+ - `watch_status.next_check_hint`
73
+ - `watch_status.recommended_adapter`
74
+ - pretrade:
75
+ - `research_brief.conclusion`
76
+ - `risk_gate.decision`
77
+ - `risk_gate.coverage`
78
+ - `simulation.status`
79
+ - `simulation.readiness`
80
+ - `simulation.venue`
81
+ - posttrade:
82
+ - `execution_receipt.status`
83
+ - `execution_receipt.venue`
84
+ - `execution_receipt.settlement`
85
+ - `execution_receipt.reference_id`
86
+ - portfolio:
87
+ - `portfolio_status.status`
88
+ - `portfolio_status.coverage`
89
+ - `portfolio_status.source_class`
90
+ - `portfolio_status.provider`
91
+ - `portfolio_status.venue`
92
+ - trace:
93
+ - `trace_summary.status`
94
+ - `trace_summary.backend.readiness`
95
+ - `trace_summary.follow_up_skills`
96
+
97
+ Then emit one stable operator bundle before any venue-specific execution step.
98
+
99
+ ## Minimum Inputs
100
+
101
+ Collect the minimum missing context before acting:
102
+
103
+ - chain
104
+ - token or contract address
105
+ - amount and units
106
+ - receiver / spender / target address
107
+ - tx hash or block context
108
+ - repo path, if code is involved
109
+
110
+ ## Adapter Preference
111
+
112
+ Prefer the Web3 profile adapters already bundled in workspace `skills/`:
113
+
114
+ - Safety: `security-check`, `binance-token-audit`, `query-token-audit`, `query-address-info`, `token-integration-analyzer`, `proxy-upgrade-safety`
115
+ - Planning: `swap-planner`, `liquidity-planner`, `token-swap`, `hyperliquid`, `gas-tracker`
116
+ - Analysis: `behavioral-state-analysis`, `entry-point-analyzer`, `etherscan`
117
+ - Audit: `solidity-auditor`, `audit-context-building`, `secure-workflow-guide`, `security-auditor`
118
+ - Static analysis: `codeql`, `semgrep`, `sarif-parsing`, `scv-scan`
119
+ - Fuzzing: `property-based-testing`, `harness-writing`, `coverage-analysis`, `state-invariant-detection`
120
+ - Research: `defillama`, `coingecko`, `dune`, `whale-watcher`, `trading-signal`, `binance-token-info`, `binance-market-rank`, `binance-meme-rush`, `four-meme`, `debank`
121
+
122
+ ## Execution Contract
123
+
124
+ 1. Classify the task: execution, simulation, trace, repo audit, or research.
125
+ 2. Name assumptions explicitly.
126
+ 3. Do not jump from user intent straight to a chain write.
127
+ 4. Prefer reproducible artifacts: command, quote, trace summary, report, patch, or execution bundle.
128
+
129
+ ## Execution Bundle Rules
130
+
131
+ - If `risk_gate.decision = BLOCK`, stop immediately.
132
+ - If `simulation.status = NO_SIMULATION`, do not route to a write adapter.
133
+ - If `risk_gate.decision = WARN` or `simulation.status = WARN`, require explicit confirmation.
134
+ - If both risk and simulation are green enough to continue, emit a bundle naming the next adapter:
135
+ - `hyperliquid` for Hyperliquid perp / spot venue flow
136
+ - `token-swap` for executable EVM swap flow
137
+ - `liquidity-planner` for LP planning flow
138
+ - `web3-trace-and-state-analysis` as follow-up when route safety still depends on trace evidence
139
+
140
+ ## Audit And Research Bundle Rules
141
+
142
+ - For audit flows:
143
+ - if `static_analysis_summary.status != complete`, route to `web3-static-analysis-runner`
144
+ - else if `fuzz_summary.campaign_status != ready`, route to `web3-fuzzing-and-invariants`
145
+ - else if `audit_review.review_state` is at triage/report/retest stages, route to `web3-audit-reporting`
146
+ - For research flows:
147
+ - if `research_brief.conclusion = ready-for-risk-gate`, route to `web3-risk-gate`
148
+ - if `research_brief.conclusion = investigate-more`, keep the flow in research and name the follow-up
149
+ - if `research_brief.conclusion = watch`, normalize the watch target with `watch_status` before scheduling or monitoring
150
+ - if `research_brief.conclusion = avoid-for-now`, stop instead of implying trade readiness
151
+
152
+ ## Pretrade Bundle Rules
153
+
154
+ - For `research -> risk-gate -> simulator -> venue` flows:
155
+ - if `research_brief.conclusion = avoid-for-now`, stop immediately
156
+ - if research is not yet `ready-for-risk-gate`, route back to `web3-research-and-market-intel`
157
+ - if `risk_gate.decision = BLOCK`, stop immediately
158
+ - if `risk_gate.coverage != complete` or `simulation.status = NO_SIMULATION`, route to `web3-trace-and-state-analysis`
159
+ - if `risk_gate.decision = WARN` or `simulation.status = WARN`, require explicit confirmation before venue routing
160
+ - if research is ready, risk is `ALLOW`, and simulation is `PASS/ready`, route directly to the venue adapter
161
+ - if the runtime needs `research_brief`, `risk_gate`, `simulation`, and
162
+ `operator_bundle` together, emit `pretrade_packet` with
163
+ `render_pretrade_packet.py`
164
+
165
+ ## Posttrade Bundle Rules
166
+
167
+ - If `execution_receipt.status = FAILED` or `REVERTED`, route to:
168
+ - `web3-trace-and-state-analysis` for EVM settlement
169
+ - the venue adapter for venue-native failure inspection
170
+ - If `execution_receipt.status = SUBMITTED` or `PENDING`, keep the flow in monitoring:
171
+ - `web3-trace-and-state-analysis` for EVM confirmation
172
+ - `hyperliquid` or the same venue adapter for venue-native fill / position checks
173
+ - If `execution_receipt.status = CONFIRMED` or `FILLED`, route to:
174
+ - `web3-trace-and-state-analysis` for EVM outcome verification
175
+ - the venue adapter for post-fill status and position checks
176
+ - If the posttrade state must persist across turns, normalize `execution_receipt`
177
+ into `watch_status` with `render_posttrade_watch_status.py` before writing a
178
+ heartbeat or cron scaffold.
179
+ - If the consumer needs the immediate posttrade route plus all deferred monitor
180
+ artifacts together, emit `posttrade_followup_bundle` with
181
+ `render_posttrade_followup_bundle.py`.
182
+
183
+ ## Portfolio Bundle Rules
184
+
185
+ - If `portfolio_status.status = UNAVAILABLE` or coverage is missing, route to `web3-research-and-market-intel`.
186
+ - If `source_class = venue` and `venue = hyperliquid`, route to `hyperliquid`.
187
+ - If `source_class = wallet`, prefer `debank`.
188
+ - If `source_class = address`, prefer `query-address-info`.
189
+
190
+ ## Watch Bundle Rules
191
+
192
+ - If `watch_status.status = UNAVAILABLE`, investigate missing data or backend scope before implying monitoring coverage.
193
+ - If severity is `high` or `critical`, escalate to investigation instead of passive monitoring.
194
+ - If `watch_status.status = CLEARED`, stop the watch unless the user explicitly wants it kept alive.
195
+ - Otherwise keep the workflow in monitor mode and route to the recommended adapter or an explicit follow-up.
196
+ - If the watch should persist across sessions, render a heartbeat task block before writing into `HEARTBEAT.md`.
197
+ - If the watch or posttrade bundle is ready to be persisted, use
198
+ `apply_followup_bundle_to_heartbeat.py` to append it under `Active Tasks`.
199
+ - If the watch should become a real scheduled task, render a `cron_request`
200
+ scaffold with `render_watch_cron_request.py` instead of freehand tool args.
201
+ - If the runtime needs all watch follow-up artifacts at once, emit a
202
+ `watch_followup_bundle` with `render_watch_followup_bundle.py`.
203
+
204
+ ## Trace Bundle Rules
205
+
206
+ - If `trace_summary.status = UNAVAILABLE` or backend readiness is missing, route to `evm-mcp-playbook`.
207
+ - If trace was gathered for execution safety:
208
+ - `COMPLETE + ready` -> route back to `web3-transaction-simulator`
209
+ - `PARTIAL` -> route back to `web3-risk-gate` or another explicit follow-up
210
+ - If trace was gathered for audit evidence, route back to `web3-audit-orchestrator`.
211
+ - If trace was gathered for research diligence, route back to `web3-research-and-market-intel`.
212
+
213
+ ## Guardrails
214
+
215
+ - Do not treat adapter output as final until chain, contract, and action scope are explicit.
216
+ - If a safety gate says `BLOCK`, stop and explain why.
217
+ - If simulation or tracing is unavailable, say so explicitly instead of implying safety.
218
+ - Keep the operator bundle stable so future execution runtimes can consume it without reparsing prose.
@@ -0,0 +1,47 @@
1
+ # Web3 Native Operator Execution Bundle Template
2
+
3
+ Emit this bundle after consuming normalized `risk_gate` and `simulation` blocks.
4
+
5
+ ```yaml
6
+ operator_bundle:
7
+ version: 1
8
+ intent: swap
9
+ chain: base
10
+ state: needs-confirmation
11
+ next_adapter: token-swap
12
+ execution_mode: confirm_then_route
13
+ requires_user_confirmation: true
14
+ inputs:
15
+ risk_decision: WARN
16
+ risk_coverage: complete
17
+ simulation_status: PASS
18
+ simulation_readiness: needs-confirmation
19
+ simulation_venue: token-swap
20
+ follow_up_skills:
21
+ - web3-trace-and-state-analysis
22
+ reasons:
23
+ - token is upgradeable
24
+ - route exists but approval is still missing
25
+ ```
26
+
27
+ ## Required Fields
28
+
29
+ - `state`: `blocked | needs-confirmation | ready-to-route | investigate-more`
30
+ - `next_adapter`: venue adapter, follow-up skill, or `none`
31
+ - `execution_mode`
32
+ - `requires_user_confirmation`
33
+ - `inputs`
34
+
35
+ ## Execution Mode Values
36
+
37
+ - `stop`
38
+ - `investigate`
39
+ - `confirm_then_route`
40
+ - `route`
41
+
42
+ ## Notes
43
+
44
+ - Keep `inputs` flattened so downstream runtimes do not need to re-parse earlier blocks.
45
+ - `follow_up_skills` is optional but should be explicit when trace or research is still needed.
46
+ - For `blocked`, prefer `next_adapter = none`.
47
+ - For `investigate-more`, prefer a follow-up analyzer such as `web3-trace-and-state-analysis`.
@@ -0,0 +1,39 @@
1
+ # Web3 Native Operator Bundle Template
2
+
3
+ Use this template when routing normalized blocks from execution, audit, research, watch, pretrade, posttrade, portfolio, or trace flows.
4
+
5
+ ```yaml
6
+ operator_bundle:
7
+ version: 1
8
+ workflow_kind: portfolio
9
+ state: monitor-portfolio
10
+ next_adapter: debank
11
+ execution_mode: route
12
+ requires_user_confirmation: false
13
+ inputs:
14
+ portfolio_status: COMPLETE
15
+ coverage: complete
16
+ source_class: wallet
17
+ provider: debank
18
+ venue: none
19
+ follow_up_skills:
20
+ - web3-research-and-market-intel
21
+ reasons:
22
+ - wallet portfolio state is ready for monitoring
23
+ ```
24
+
25
+ ## Required Fields
26
+
27
+ - `workflow_kind`: `execution | audit | research | watch | pretrade | posttrade | portfolio | trace`
28
+ - `state`
29
+ - `next_adapter`: venue adapter, builtin skill, follow-up skill, or `none`
30
+ - `execution_mode`: `stop | investigate | confirm_then_route | route | monitor`
31
+ - `requires_user_confirmation`
32
+ - `inputs`
33
+
34
+ ## Notes
35
+
36
+ - Execution flows can still use [EXECUTION_BUNDLE_TEMPLATE.md](EXECUTION_BUNDLE_TEMPLATE.md)
37
+ for the execution-specific shape.
38
+ - Audit, research, watch, pretrade, posttrade, portfolio, and trace flows should keep `inputs` flattened so the operator runtime
39
+ does not need to re-parse upstream blocks.
@@ -0,0 +1,35 @@
1
+ # Posttrade Follow-Up Bundle Template
2
+
3
+ Use this template when a normalized `execution_receipt` should immediately
4
+ produce both the posttrade route and deferred monitoring artifacts.
5
+
6
+ ```yaml
7
+ posttrade_followup_bundle:
8
+ version: 1
9
+ execution_receipt:
10
+ receipt_status: SUBMITTED
11
+ venue: token-swap
12
+ settlement: evm
13
+ reference_id: "0xabc"
14
+ operator_bundle:
15
+ workflow_kind: posttrade
16
+ state: monitor-settlement
17
+ next_adapter: web3-trace-and-state-analysis
18
+ execution_mode: monitor
19
+ watch_status:
20
+ status: ACTIVE
21
+ watch_kind: posttrade
22
+ subject: tx:0xabc
23
+ recommended_adapter: web3-trace-and-state-analysis
24
+ heartbeat_task: |
25
+ - [ ] Watch tx:0xabc
26
+ Task: Re-run web3-trace-and-state-analysis for tx:0xabc on heartbeat and summarize any new evidence.
27
+ cron_request:
28
+ action: add
29
+ cron_expr: "*/5 * * * *"
30
+ ```
31
+
32
+ ## Notes
33
+
34
+ - `operator_bundle` here is the immediate posttrade route from `execution_receipt`.
35
+ - `watch_status`, `heartbeat_task`, and `cron_request` are the deferred monitor artifacts.
@@ -0,0 +1,34 @@
1
+ # Posttrade Watch Template
2
+
3
+ Use this template when a normalized `execution_receipt` must be converted into a
4
+ stable `watch_status` block for monitoring or alerting.
5
+
6
+ ```yaml
7
+ watch_status:
8
+ version: 1
9
+ status: ACTIVE
10
+ watch_kind: posttrade
11
+ subject: tx:0xabc
12
+ trigger_source: token-swap
13
+ severity: medium
14
+ next_check_hint: check receipt confirmations and final token balances after 5 minutes
15
+ schedule_hint: "*/5 * * * *"
16
+ recommended_adapter: web3-trace-and-state-analysis
17
+ evidence:
18
+ - adapter: token-swap
19
+ detail: transaction submitted and awaiting settlement
20
+ ```
21
+
22
+ ## Mapping Rules
23
+
24
+ - `SUBMITTED | PENDING` -> `status = ACTIVE`
25
+ - `CONFIRMED | FILLED` -> `status = TRIGGERED`
26
+ - `FAILED | REVERTED` -> `status = TRIGGERED`
27
+ - EVM settlement prefers `recommended_adapter = web3-trace-and-state-analysis`
28
+ - Venue settlement prefers `recommended_adapter = venue`
29
+
30
+ ## Notes
31
+
32
+ - Use `TRIGGERED` for confirmed or failed receipts because both still require a
33
+ verification or failure-inspection step.
34
+ - `schedule_hint` should stay advisory if no scheduler is being installed.
@@ -0,0 +1,34 @@
1
+ # Pretrade Packet Template
2
+
3
+ Use this template when normalized `research_brief`, `risk_gate`, and
4
+ `simulation` should be packaged together with the operator decision before any
5
+ venue-specific route.
6
+
7
+ ```yaml
8
+ pretrade_packet:
9
+ version: 1
10
+ intent: swap
11
+ chain: base
12
+ research_brief:
13
+ conclusion: ready-for-risk-gate
14
+ freshness: fresh
15
+ risk_gate:
16
+ decision: ALLOW
17
+ coverage: complete
18
+ simulation:
19
+ status: PASS
20
+ readiness: ready
21
+ venue: token-swap
22
+ operator_bundle:
23
+ workflow_kind: pretrade
24
+ state: ready-to-route
25
+ next_adapter: token-swap
26
+ execution_mode: route
27
+ ```
28
+
29
+ ## Notes
30
+
31
+ - Use `render_pretrade_packet.py` when the runtime should consume pretrade
32
+ research, safety, simulation, and routing state as one stable artifact.
33
+ - `risk_gate` and `simulation` may be omitted only when research is still
34
+ incomplete or blocks the flow before pretrade checks should run.
@@ -0,0 +1,140 @@
1
+ # Web3 Native Operator Route Recipes
2
+
3
+ Use these recipes after both `web3-risk-gate` and `web3-transaction-simulator`
4
+ have emitted normalized blocks.
5
+
6
+ ## Swap Or Token Buy
7
+
8
+ 1. Run `web3-risk-gate` on token, router, spender, and receiver.
9
+ - If multiple adapters emitted separate `risk_gate` blocks, merge them first with `web3-risk-gate/scripts/merge_risk_gate_blocks.py`
10
+ or pass them directly to the operator scripts with repeated `--risk-input-file`.
11
+ 2. Run `web3-transaction-simulator` for quote, allowance, output, and revert risk.
12
+ - If multiple planners or live-read adapters emitted separate `simulation` blocks, merge them first with
13
+ `web3-transaction-simulator/scripts/merge_simulation_blocks.py`
14
+ or pass them directly to the operator scripts with repeated `--simulation-input-file`.
15
+ 3. Emit `operator_bundle`.
16
+ 4. Route:
17
+ - `state = blocked` -> stop
18
+ - `state = investigate-more` -> `web3-trace-and-state-analysis`
19
+ - `next_adapter = hyperliquid` -> venue-specific Hyperliquid flow
20
+ - `next_adapter = token-swap` -> EVM swap execution flow
21
+
22
+ ## Liquidity Add Or Remove
23
+
24
+ 1. Risk-gate LP tokens, router, pool, and approval targets.
25
+ 2. Simulate token ratios, slippage, approvals, and gas assumptions.
26
+ 3. Emit `operator_bundle`.
27
+ 4. Route:
28
+ - `ready-to-route` or `needs-confirmation` -> `liquidity-planner`
29
+ - incomplete pool evidence -> `web3-trace-and-state-analysis`
30
+
31
+ ## Transfer Or Approve
32
+
33
+ 1. Risk-gate receiver or spender first.
34
+ 2. If value-moving or approval-changing, still use `web3-transaction-simulator`
35
+ for balance, allowance delta, and target code checks.
36
+ 3. Emit `operator_bundle`.
37
+ 4. Route:
38
+ - direct execution adapter only if gate/simulation allow it
39
+ - suspicious receiver or opaque contract -> trace / live-read follow-up
40
+
41
+ ## Trace-Escalated Execution
42
+
43
+ Escalate to `web3-trace-and-state-analysis` when:
44
+
45
+ - `risk_gate.coverage != complete`
46
+ - `simulation.status = NO_SIMULATION`
47
+ - route safety depends on proxy path, delegatecall, storage slot, or internal call attribution
48
+ - the write target is upgradeable or implementation provenance is unclear
49
+
50
+ The trace skill should then emit a stable `trace_summary` block before the operator
51
+ re-enters venue routing.
52
+
53
+ ## Trace Re-Entry
54
+
55
+ 1. Consume `trace_summary`.
56
+ 2. If `trace_summary.status = UNAVAILABLE` or backend readiness is `missing`, route to `evm-mcp-playbook`.
57
+ 3. If the trace goal was execution safety:
58
+ - `COMPLETE + ready` -> re-enter through `web3-transaction-simulator`
59
+ - `PARTIAL` -> re-enter through `web3-risk-gate`
60
+ 4. If the trace goal was audit evidence, re-enter through `web3-audit-orchestrator`.
61
+ 5. If the trace goal was research diligence, re-enter through `web3-research-and-market-intel`.
62
+
63
+ ## Audit Or Review
64
+
65
+ 1. Consume `audit_review`.
66
+ 2. If scanner evidence is incomplete, route to `web3-static-analysis-runner`.
67
+ 3. If invariant or fuzz coverage is incomplete after static triage, route to `web3-fuzzing-and-invariants`.
68
+ 4. Once review state reaches triage, confirmed findings, or retest, emit `operator_bundle`.
69
+ 5. Route:
70
+ - `collect-evidence` -> `web3-static-analysis-runner` or `web3-fuzzing-and-invariants`
71
+ - `triage-findings` -> `web3-audit-orchestrator`
72
+ - `report-and-retest` -> `web3-audit-reporting`
73
+
74
+ ## Research To Execution
75
+
76
+ 1. Consume `research_brief`.
77
+ 2. Emit `operator_bundle`.
78
+ 3. Route:
79
+ - `conclusion = ready-for-risk-gate` -> `web3-risk-gate`
80
+ - `conclusion = investigate-more` -> follow-up research skill or `web3-research-and-market-intel`
81
+ - `conclusion = watch` -> emit `watch_status` before handing the task to monitoring
82
+ - `conclusion = avoid-for-now` -> stop
83
+
84
+ ## Pretrade Closure
85
+
86
+ 1. Consume `research_brief`, `risk_gate`, and `simulation`.
87
+ - If the risk view comes from multiple adapters, merge those `risk_gate` blocks before this step.
88
+ - If the simulation view comes from multiple adapters, merge those `simulation` blocks before this step.
89
+ 2. Emit `operator_bundle`.
90
+ 3. Route:
91
+ - research not ready -> `web3-research-and-market-intel`
92
+ - risk blocked -> stop
93
+ - risk coverage partial or no simulation -> `web3-trace-and-state-analysis`
94
+ - warnings present -> venue adapter with explicit confirmation
95
+ - green path -> venue adapter directly
96
+ 4. If the runtime wants the full pretrade context in one stable payload, emit
97
+ `pretrade_packet` with `render_pretrade_packet.py`.
98
+
99
+ ## Posttrade Verification
100
+
101
+ 1. Consume `execution_receipt`.
102
+ 2. Emit `operator_bundle`.
103
+ 3. Route:
104
+ - EVM `SUBMITTED/PENDING` -> `web3-trace-and-state-analysis`
105
+ - EVM `CONFIRMED/FILLED` -> `web3-trace-and-state-analysis`
106
+ - EVM `FAILED/REVERTED` -> `web3-trace-and-state-analysis`
107
+ - Hyperliquid `SUBMITTED/PENDING/CONFIRMED/FILLED` -> `hyperliquid`
108
+ - venue-native failure -> same venue adapter or explicit follow-up skill
109
+ 4. If the monitoring target must persist beyond the current turn, normalize the
110
+ receipt with `render_posttrade_watch_status.py` before writing heartbeat or
111
+ cron scaffolding.
112
+ 5. If the consumer needs receipt routing and deferred monitoring artifacts in one
113
+ shot, emit `posttrade_followup_bundle` with `render_posttrade_followup_bundle.py`.
114
+
115
+ ## Portfolio Status Routing
116
+
117
+ 1. Consume `portfolio_status`.
118
+ 2. Emit `operator_bundle`.
119
+ 3. Route:
120
+ - wallet portfolio -> `debank`
121
+ - chain-scoped address holdings -> `query-address-info`
122
+ - venue position status -> `hyperliquid`
123
+ - incomplete or unavailable status -> `web3-research-and-market-intel`
124
+
125
+ ## Watch Or Alert Routing
126
+
127
+ 1. Consume `watch_status`.
128
+ 2. Emit `operator_bundle`.
129
+ 3. Route:
130
+ - `status = UNAVAILABLE` -> investigate missing backend or scope via recommended adapter or `web3-research-and-market-intel`
131
+ - `severity = high | critical` -> escalate to investigation using the recommended adapter
132
+ - `status = ACTIVE | TRIGGERED` with low/medium severity -> keep monitor mode and route to the recommended adapter
133
+ - `status = CLEARED` -> stop with `next_adapter = none`
134
+ 4. If the watch must survive beyond the current turn, render a task snippet with
135
+ `render_watch_heartbeat.py` and append it under `HEARTBEAT.md -> Active Tasks`.
136
+ - or apply the full bundle directly with `apply_followup_bundle_to_heartbeat.py`
137
+ 5. If the watch should be scheduled through the `cron` tool, render a
138
+ `cron_request` block with `render_watch_cron_request.py`.
139
+ 6. If the consumer needs the operator route plus heartbeat and cron scaffolding
140
+ together, emit `watch_followup_bundle` with `render_watch_followup_bundle.py`.
@@ -0,0 +1,73 @@
1
+ # Web3 Native Operator Routing State Machine
2
+
3
+ Use this state machine once `web3-risk-gate` and `web3-transaction-simulator` have both produced
4
+ normalized output.
5
+
6
+ ## Inputs
7
+
8
+ - `intent`
9
+ - `risk_gate.decision`
10
+ - `risk_gate.coverage`
11
+ - `simulation.status`
12
+ - `simulation.readiness`
13
+ - `simulation.venue`
14
+
15
+ ## States
16
+
17
+ ### `blocked`
18
+
19
+ Enter when:
20
+
21
+ - `risk_gate.decision = BLOCK`
22
+ - or `simulation.status = FAIL`
23
+
24
+ Result:
25
+
26
+ - do not route to a write adapter
27
+ - set `next_adapter = none` unless an explicit investigation follow-up is required
28
+ - explain the blocker and preserve evidence
29
+
30
+ ### `needs-confirmation`
31
+
32
+ Enter when:
33
+
34
+ - `risk_gate.decision = WARN`
35
+ - or `simulation.status = WARN`
36
+ - or `simulation.readiness = needs-confirmation`
37
+
38
+ Result:
39
+
40
+ - prepare the venue route
41
+ - require explicit confirmation before any write path
42
+
43
+ ### `ready-to-route`
44
+
45
+ Enter when:
46
+
47
+ - `risk_gate.decision = ALLOW`
48
+ - and `simulation.status = PASS`
49
+ - and `simulation.readiness = ready`
50
+
51
+ Result:
52
+
53
+ - emit the next adapter and execution mode
54
+
55
+ ### `investigate-more`
56
+
57
+ Enter when:
58
+
59
+ - `simulation.status = NO_SIMULATION`
60
+ - or `risk_gate.coverage != complete` and the action is value-moving
61
+
62
+ Result:
63
+
64
+ - stop before execution
65
+ - name the missing backend or evidence
66
+ - route to `web3-trace-and-state-analysis` or another explicit follow-up skill instead of a write adapter
67
+
68
+ ## Venue Mapping
69
+
70
+ - `simulation.venue = hyperliquid` -> next adapter `hyperliquid`
71
+ - `simulation.venue = token-swap` or `simulation.action = swap` -> next adapter `token-swap`
72
+ - `simulation.action = liquidity` -> next adapter `liquidity-planner`
73
+ - if route safety still depends on call-path or state evidence -> add follow-up `web3-trace-and-state-analysis`
@@ -0,0 +1,26 @@
1
+ # Watch Cron Request Template
2
+
3
+ Use this template when a `watch_status` should be turned into a structured
4
+ payload for the `cron` tool.
5
+
6
+ ```yaml
7
+ cron_request:
8
+ action: add
9
+ message: Re-run whale-watcher for token:PEPE and summarize any new evidence. Escalate immediately if severity becomes high or critical.
10
+ cron_expr: "*/15 * * * *"
11
+ tz: Asia/Shanghai
12
+ ```
13
+
14
+ ## Required Fields
15
+
16
+ - `action`: always `add`
17
+ - `message`
18
+ - one of:
19
+ - `every_seconds`
20
+ - `cron_expr`
21
+ - `at`
22
+
23
+ ## Notes
24
+
25
+ - Keep the `message` executable by the agent, not just descriptive.
26
+ - `tz` is only valid with `cron_expr`.
@@ -0,0 +1,35 @@
1
+ # Watch Follow-Up Bundle Template
2
+
3
+ Use this template when a normalized `watch_status` should be turned into all
4
+ downstream runtime artifacts in one shot.
5
+
6
+ ```yaml
7
+ watch_followup_bundle:
8
+ version: 1
9
+ watch_status:
10
+ status: ACTIVE
11
+ watch_kind: research
12
+ subject: token:PEPE
13
+ trigger_source: whale-watcher
14
+ severity: medium
15
+ next_check_hint: refresh whale flow after 15 minutes
16
+ schedule_hint: "*/15 * * * *"
17
+ recommended_adapter: whale-watcher
18
+ operator_bundle:
19
+ workflow_kind: watch
20
+ state: monitor-watch
21
+ next_adapter: whale-watcher
22
+ execution_mode: monitor
23
+ heartbeat_task: |
24
+ - [ ] Watch token:PEPE
25
+ Task: Re-run whale-watcher for token:PEPE on heartbeat and summarize any new evidence. Escalate immediately if severity becomes high or critical.
26
+ cron_request:
27
+ action: add
28
+ cron_expr: "*/15 * * * *"
29
+ tz: Asia/Shanghai
30
+ ```
31
+
32
+ ## Notes
33
+
34
+ - `cron_request` may be `null` when the watch is not being promoted to a real scheduled job.
35
+ - `heartbeat_task` remains useful even when `cron_request` is absent.