@oracle-agent/oracle 0.24.1 → 0.24.3

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 (52) hide show
  1. package/dist/assets/skills/chain/SKILL.md +34 -0
  2. package/dist/assets/skills/chain-defi-ecosystem-analysis/SKILL.md +181 -0
  3. package/dist/assets/skills/chain-ecosystem-gap-analysis/SKILL.md +162 -0
  4. package/dist/assets/skills/cross-chain-twap-execution/SKILL.md +125 -0
  5. package/dist/assets/skills/defi-protocol-pmf-assessment/SKILL.md +332 -0
  6. package/dist/assets/skills/evm-contract-research.md +8 -3
  7. package/dist/assets/skills/multi-venue-prepare-only-ranking/SKILL.md +93 -0
  8. package/dist/assets/skills/oracle-access-control/SKILL.md +71 -0
  9. package/dist/assets/skills/oracle-action-arming/SKILL.md +99 -0
  10. package/dist/assets/skills/oracle-airdrop-calculator/SKILL.md +111 -0
  11. package/dist/assets/skills/oracle-desk-product/SKILL.md +341 -0
  12. package/dist/assets/skills/oracle-evm/SKILL.md +55 -0
  13. package/dist/assets/skills/oracle-harness/SKILL.md +44 -0
  14. package/dist/assets/skills/oracle-mcp-install/SKILL.md +140 -0
  15. package/dist/assets/skills/oracle-multichain-convert/SKILL.md +87 -0
  16. package/dist/assets/skills/oracle-native-harness/SKILL.md +32 -0
  17. package/dist/assets/skills/oracle-ownership-gate/SKILL.md +42 -0
  18. package/dist/assets/skills/oracle-public-product-ux/SKILL.md +114 -0
  19. package/dist/assets/skills/oracle-tailscale/SKILL.md +32 -0
  20. package/dist/assets/skills/oracle-thin-client/SKILL.md +47 -0
  21. package/dist/assets/skills/perp-venue-funding-research/SKILL.md +161 -0
  22. package/dist/assets/skills/polymarket/SKILL.md +160 -0
  23. package/dist/assets/skills/protocol-api-key-integration/SKILL.md +141 -0
  24. package/dist/assets/skills/self-custodial-onchain-execution/SKILL.md +1284 -0
  25. package/dist/assets/skills/setup/SKILL.md +40 -0
  26. package/dist/assets/skills/stable-launch-ops/SKILL.md +89 -0
  27. package/dist/assets/skills/trade-loop-circuit-breaker/SKILL.md +441 -0
  28. package/dist/assets/skills/venue-capability-boundaries/SKILL.md +32 -0
  29. package/dist/bin/desk-server.mjs +16 -16
  30. package/dist/bin/oracle-data-mcp.mjs +1 -1
  31. package/dist/bin/oracle-equities.mjs +1 -1
  32. package/dist/bin/oracle-gateway.mjs +18 -15
  33. package/dist/bin/oracle-init.mjs +9 -9
  34. package/dist/cli/commands/bootstrap.mjs +1 -1
  35. package/dist/cli/commands/chat.mjs +86 -77
  36. package/dist/cli/commands/doctor.mjs +8 -6
  37. package/dist/cli/commands/eval.mjs +1 -1
  38. package/dist/cli/commands/harness.mjs +6 -6
  39. package/dist/cli/commands/model.mjs +87 -78
  40. package/dist/cli/commands/receipt.mjs +5 -0
  41. package/dist/cli/commands/setup.mjs +1 -1
  42. package/dist/cli/commands/venues.mjs +3 -0
  43. package/dist/cli/commands/watch.mjs +16 -0
  44. package/dist/equities/index.mjs +1 -1
  45. package/dist/index.mjs +1 -1
  46. package/package.json +1 -1
  47. package/public/install.ps1 +102 -0
  48. package/public/install.sh +1 -1
  49. package/public/oracle-splash/downloads/index.html +2 -0
  50. package/public/oracle-splash/index.html +1 -0
  51. package/public/oracle-splash/install.ps1 +102 -0
  52. package/public/oracle-splash/install.sh +1 -1
@@ -0,0 +1,332 @@
1
+ ---
2
+ name: defi-protocol-pmf-assessment
3
+ description: Use when scoping or costing a new DeFi protocol on a chain.
4
+ version: 1.0.0
5
+ author: agent
6
+ license: MIT
7
+ platforms: [linux, macos, windows]
8
+ metadata:
9
+ hermes:
10
+ tags: [defi, pmf, market-analysis, protocol-design, cost-modeling, defillama]
11
+ related_skills: [evm-contract-research, self-custodial-onchain-execution, verification-gate]
12
+ ---
13
+ > Oracle native tools: `oracle_cli` (read/prepare), `vault_status`, `signer_status`, `signer_execute` (needs human confirmationNonce), `skill_load`. Works on every shipped EVM chain, not only RH/HL.
14
+
15
+
16
+ # DeFi protocol PMF assessment
17
+
18
+ Use when the question is **"should we build a protocol here, and what would it cost"** —
19
+ not "how does this contract work" (that's `evm-contract-research`). Triggers: "is there
20
+ PMF for X on chain Y", "what gap should we fill", "what would it cost to launch", or a
21
+ category diff showing absent protocol categories.
22
+
23
+ The deliverable is **a specific buildable protocol with a budget**, not a research memo.
24
+ See "Deliver a protocol, not a monitor" below — this is the failure mode that gets
25
+ corrected most.
26
+
27
+ ## The core discipline
28
+
29
+ > **An absent category is not an opportunity. Find the binding constraint.**
30
+
31
+ DefiLlama will happily show 49 missing categories on a young chain. That looks like 49
32
+ opportunities and is usually **one repeated fact** — the chain is small, and every gap
33
+ hits the same wall. Identify that wall first; it determines which (if any) protocol is
34
+ actually buildable and at what size.
35
+
36
+ Constraints that repeatedly turn out to be binding:
37
+
38
+ | Constraint | How to measure | Kills |
39
+ |---|---|---|
40
+ | **Hedging depth** | DEX liquidity + perp OI, take ~10% as safely tradeable | Options, market making, anything delta-hedged |
41
+ | **Yield source count** | Count distinct real sources and the spread between them | Yield aggregators, routers, optimizers |
42
+ | **Average position size** | token `holders_count` vs float value | Any per-position product |
43
+ | **Incumbent concentration** | top protocol's share of category TVL | Lending, DEX, launchpads |
44
+
45
+ ## Step 1: category diff, then de-duplicate
46
+
47
+ Pull `https://api.llama.fi/protocols` (~8MB, filter in Python, never print raw). For each
48
+ protocol read `chainTvls['<Chain>']`. Build category rollups for the target chain and two
49
+ mature comparators (Base, Arbitrum). Diff into ABSENT / DEAD (<$100k) / HEALTHY.
50
+
51
+ **Traps that produce a wrong headline number:**
52
+
53
+ - **Curators double-count.** "Risk Curators" (Steakhouse, Gami) and yield wrappers
54
+ (Spark Savings) sit *on top of* a lending market's deposits. Summing all entries gave
55
+ $784.4M against a real chain TVL of $422M. Never add a curator row to the venue it
56
+ curates; reconcile sum-of-parts against `api.llama.fi/v2/chains` and explain the gap.
57
+ - **`CEX` is a false positive.** Those rows are exchange proof-of-reserve wallets, not
58
+ deployable protocols. Same for `Chain` and `Bug Bounty`. Strike them before ranking.
59
+ - **High protocol counts are mirages.** 30 DEXes where Uniswap holds 92.6% means one DEX
60
+ and 29 forks splitting scraps. Always report the top-1 / top-2 concentration next to
61
+ the count.
62
+ - **Derivatives-by-chain breakdown is paywalled.** `overview/derivatives/<chain>` returns
63
+ an upgrade notice. Say "unknown", do not infer.
64
+
65
+ ## Step 2: reconcile "idle capital" before pitching it
66
+
67
+ The most seductive and most wrong finding is "$X hundred million sitting idle, just
68
+ deploy it." Verify by tracing the actual balances.
69
+
70
+ **Worked correction (RH 4663):** stablecoin supply was $338.7M and the main vault held
71
+ only $23.7M, which read as "93% idle." Wrong. The reconciliation:
72
+
73
+ ```
74
+ supplied into lending markets $306.3M
75
+ borrowed back out by loopers $276.5M
76
+ -> net retained in core $29.9M <- matches on-chain balance
77
+ vault idle buffer $23.7M
78
+ ```
79
+
80
+ The capital was **circulating inside a leverage loop** (borrow stable, swap to collateral,
81
+ redeposit, borrow again). The same dollars counted repeatedly. There was no idle pile.
82
+
83
+ Method: read `balanceOf` on the lending core and the vault directly, then check that
84
+ `supplied - borrowed` equals the core's real balance. If it reconciles, the "idle" money
85
+ is fully deployed and the thesis is dead.
86
+
87
+ ## Step 3: size demand from holders, not TVL
88
+
89
+ TVL tells you what whales did. **Holder counts and average position tell you what product
90
+ shape is possible.**
91
+
92
+ For each candidate asset pull `/api/v2/tokens/{addr}` → `holders_count`, `total_supply`,
93
+ then value the float at the live oracle price.
94
+
95
+ **Worked example (RH 4663 tokenized equities):**
96
+
97
+ | Asset | Holders | Float | Avg position |
98
+ |---|---|---|---|
99
+ | NVDA | 33,759 | $4.36M | **$129** |
100
+ | AAPL | 29,298 | $1.56M | **$53** |
101
+ | TSLA | 22,728 | $1.58M | **$70** |
102
+
103
+ This single table killed an options build: **one NVDA option contract costs $216 — more
104
+ than the average holder's entire NVDA position.** Any per-position product is dead on
105
+ arrival. The product must be *pooled* and work at $50-150 tickets.
106
+
107
+ Run this check **before** designing anything. It is cheap and it is decisive.
108
+
109
+ ## Step 4: restructure to fit the constraint (the highest-leverage move)
110
+
111
+ Once the binding constraint is measured, ask what product shape needs **less** of it.
112
+ Capital-efficiency structuring routinely moves the ceiling by an order of magnitude.
113
+
114
+ **Worked example — same insight, three shapes, against a measured $425k hedging ceiling:**
115
+
116
+ | Product | Hedge needed per $1M | Max size |
117
+ |---|---|---|
118
+ | Direct options book | $1,000,000 | $425k |
119
+ | Covered-call vault | $300,000 | $1.4M |
120
+ | **Principal-protected note** | **$31,300** | **$13.6M** |
121
+
122
+ The note funds convexity out of *yield* (3.13%) rather than principal, so the hedging
123
+ requirement drops ~32x and the constraint that made options unviable becomes irrelevant.
124
+
125
+ Two structural rules that fell out of the same build:
126
+
127
+ - **A cash-settled call cannot be fully collateralized** — unbounded upside. Cap it and
128
+ it becomes a call spread; the writer locks `(cap - strike) x size`, which is ~10x less
129
+ than a cash-secured put locks, and the vault is provably always solvent.
130
+ - **Full collateralization removes liquidations, which removes cascade risk.** On a 24/7
131
+ chain with an underlying that halts (equities, RWAs), no-liquidation is the design that
132
+ makes the asset underwritable at all.
133
+
134
+ ## Step 5: cost it — separate BURN from DEPLOYED
135
+
136
+ **The error to avoid: presenting deployed capital as spend.** These are different numbers
137
+ and conflating them overstates the ask massively.
138
+
139
+ | Bucket | Meaning |
140
+ |---|---|
141
+ | **Burn** | Audit, legal, frontend, ops. Gone. Never comes back. |
142
+ | **Deployed** | Seed capital, market-maker float. Yours, at risk, recoverable. |
143
+
144
+ Report as: "**~$60k of real spend, plus ~$300k of your own capital deployed. Total cash
145
+ touched ~$360k; total lost ~$60k.**"
146
+
147
+ **Gas is not a line item on a modern L2.** Measure it, then say so and move on. RH 4663
148
+ at 0.0215 gwei with ETH ~$1,864: a full 6-contract protocol deploy cost **$0.35**, and a
149
+ year of weekly rebalances plus monthly settlements cost **$2.00**. Do not pad a budget
150
+ with gas estimates; `cast gas-price` and the explorer `/stats` coin_price give the real
151
+ figure in one call.
152
+
153
+ **Audit dominates the burn** (~2/3). Two audits (one firm + one competitive contest) is
154
+ the bar for anything holding retail principal. Engineering is $0 only when the agent
155
+ fleet builds it — say so explicitly, because human engineering for the same scope is
156
+ $150k-400k and that dependency is real.
157
+
158
+ **Legal is a gate, not a line item.** For anything resembling a structured product,
159
+ principal guarantee, or yield promise, spend $5-10k on a preliminary read **before**
160
+ committing to audit. If counsel says "regulated security," the cost is not the fee, it
161
+ is the project. Sequence: legal read -> audit -> deploy -> seed -> scale.
162
+
163
+ ## The budget-constraint cascade
164
+
165
+ Budget determines architecture more than ambition does. Work down this ladder:
166
+
167
+ | Budget | What is possible |
168
+ |---|---|
169
+ | Full (~$60k+) | Custody user funds. Vaults, lending, options, anything with a balance. |
170
+ | **No audit** | **Cannot custody user funds — full stop.** Prepare-only, read-only, or immutable-no-funds contracts. |
171
+ | ~$0 | Routers/aggregators returning unsigned calldata; immutable no-owner primitives; indexers and data products. |
172
+
173
+ **Unaudited + holds retail principal = do not ship.** When the budget rules out an audit,
174
+ pivot to a **prepare-only** design: quote, compare, return unsigned calldata, let the
175
+ user's wallet sign. A bug then produces a bad quote, not a theft. This is the same custody
176
+ posture as `self-custodial-onchain-execution` — reuse it.
177
+
178
+ An immutable, owner-less, fund-less contract (a calendar, a math library, a registry) is
179
+ also safe to ship cheaply and is often the durable public good in the space.
180
+
181
+ **Venue price dispersion is the cheap gap.** Before concluding a low-budget chain has
182
+ nothing to build, measure the same asset's price across every venue at the same instant
183
+ (CLOB spot vs each AMM). On RH 4663 the median dispersion across 19 tokenized equities
184
+ was **26.4bp**, with outliers at 105-107bp — retail trading thin AMM pools while a
185
+ zero-fee CLOB sat unrouted. A prepare-only best-execution router monetizes that with no
186
+ custody and therefore no audit gate.
187
+
188
+ ### Widen the venue set before declaring a ceiling — one chain is not the market
189
+
190
+ A constraint measured on a single chain is often an **artifact of the sample**, not a real
191
+ ceiling. The RH-only hedging depth read **$425k**, which killed options, structured notes,
192
+ and market making in turn. Adding the other venues that list the same assets moved it past
193
+ **$1B**. Same product, same insight, 2400x the addressable depth.
194
+
195
+ So when a constraint kills every idea on one chain, **enumerate the other venues carrying
196
+ that asset class before concluding the product is unviable.** For on-chain equities the
197
+ live venue set (all verified this session) is in
198
+ `references/onchain-equity-venue-registry.md` — Hyperliquid HIP-3, Arcus perps + CLOB spot,
199
+ RH Uniswap, Solana xStocks, TON.
200
+
201
+ **Never conclude a venue lacks an asset class from one endpoint.** Hyperliquid's core
202
+ `metaAndAssetCtxs` returns 232 markets and **zero** equities, which reads as "crypto-only."
203
+ It is wrong: equities live exclusively in HIP-3 builder dexs at ~$1.49B/24h. Two failure
204
+ modes produce the same silent zero — querying the default namespace, and a naive symbol
205
+ filter that misses `dex:TICKER` namespacing. Dump the raw market-name list and read it
206
+ before filtering. This exact mistake required a user correction; treat a zero result on a
207
+ venue you *expect* to have the asset as a bug in your query until proven otherwise.
208
+
209
+ ### Gate cross-venue comparisons on liveness or the number lies
210
+
211
+ Dormant venues keep serving their last mark. Those stale prices are indistinguishable from
212
+ live quotes in the API response and they **inflate every dispersion statistic**. Measured
213
+ across 9 HIP-3 builder dexs plus Arcus and RH:
214
+
215
+ | Sample | Median cross-venue spread |
216
+ |---|---|
217
+ | All venues (naive) | 96.1bp |
218
+ | **Live venues only** | **43.8bp** |
219
+
220
+ Five of nine builder dexs had $0 24h volume. Including them more than doubled the apparent
221
+ opportunity — i.e. it would have doubled the pitch. Filter on 24h volume **per venue and
222
+ per market**, and reject crossed books (bid > ask, seen live on a CLOB spot feed: either a
223
+ stale indexer snapshot or a genuinely uncrossed thin book — both unquotable).
224
+
225
+ Report the gated number as the headline and mention the ungated one only as the trap you
226
+ avoided. A liveness gate is a **correctness requirement, not polish**: quoting a dormant
227
+ venue is the single most likely way a routing product lies to a user.
228
+
229
+ **Then ask whether the remaining spread is real.** Perp mark vs spot last vs oracle mid
230
+ *should* differ — that is basis and instrument difference, not mispricing. Before pitching
231
+ a dispersion number as an execution edge, decompose how much survives once you compare
232
+ like instruments. If most of it is basis, the product is a data viewer, not an edge. Put
233
+ this question to the planner explicitly rather than assuming the favorable reading.
234
+
235
+ ## Deliver a protocol, not a monitor
236
+
237
+ **Correction from a live session — do not repeat it.** After measuring that every gap on
238
+ a chain hit the same depth ceiling, the answer given was "I'd rather hand you a monitor
239
+ than a protocol." The user pushed back: *"so its not a protocol? we want make a protocol
240
+ thats product market fit."*
241
+
242
+ Analysis paralysis reads as evasion. When the ask is a protocol:
243
+
244
+ - Constraints **shape** the product, they do not veto it. Restructure (Step 4) before
245
+ concluding "not viable."
246
+ - Never substitute a dashboard, watcher, or "let's instrument and wait" for the buildable
247
+ thing. Offer that only as an *addition* to a named protocol, never in place of one.
248
+ - End with a **named protocol, a concrete mechanism, and a budget** — then the caveats.
249
+ Caveats after the answer, never instead of it.
250
+ - If the honest conclusion really is "don't build," say that in one line and immediately
251
+ name what you *would* build instead at the same budget.
252
+
253
+ ## Extend the existing product before inventing a new one
254
+
255
+ **Second correction from the same session.** After landing on a cross-chain best-execution
256
+ router, it was framed as a brand-new protocol with Hyperliquid as the "primary venue." The
257
+ user corrected: *"not primary venue but have the multichain thesis oracle has."*
258
+
259
+ Before scoping a greenfield protocol, check whether the user **already owns a product whose
260
+ thesis covers it**. Here Oracle already had a multichain routing desk with a documented
261
+ best-execution law (rank net-of-cost, report runners-up with `improvementBps`, honest
262
+ capability tiers, `unknown` for anything not live-read). The correct framing was *a new
263
+ asset class inside an existing product*, not a new protocol.
264
+
265
+ Two concrete rules that fall out:
266
+
267
+ - **Load the user's own product skills before designing.** If skills exist describing their
268
+ desk, router, or execution law, read them and inherit the vocabulary and invariants
269
+ verbatim. Inventing a parallel ranking scheme next to an existing one is duplicated
270
+ surface the user has to reconcile.
271
+ - **In a multi-venue router, no venue is "primary."** Naming one primary reintroduces the
272
+ single-venue dependency the router exists to remove. Every venue is a source with a
273
+ capability tier; the deepest venue is still just a source that can fail into `failed[]`.
274
+
275
+ ## Report to the stated audience, and plainly on request
276
+
277
+ When the user asks for it simply — *"give me the tldr like im a retard"* — drop every
278
+ domain term and lead with the decision. Numbered short lines, concrete dollar figures, one
279
+ bolded takeaway each, and a single closing question. No tables, no bp, no protocol names,
280
+ no hedging paragraphs. Re-expand to full analytical depth on the next substantive question;
281
+ the request is per-message, not a permanent register change.
282
+
283
+ ## Reporting standard
284
+
285
+ - Lead with the number or the verdict. Tables over prose.
286
+ - Mark every figure's provenance: live probe vs API vs estimate. Cost estimates for audit
287
+ and legal are **market-rate guesses**, not measurements — label them as such while
288
+ chain data stays labelled verified.
289
+ - State confidence explicitly (high / moderate / low / unknown) and say *why* it is not
290
+ higher.
291
+ - Volunteer corrections to your own earlier claims the moment you find them. Two happened
292
+ in one session (the idle-capital misread and the burn-vs-deployed conflation); catching
293
+ them yourself is worth more than a clean-looking narrative.
294
+
295
+ ## Pitfalls
296
+
297
+ - **Chain age distorts everything.** A 5-week-old chain's TVL trend is not adoption. Pull
298
+ `v2/historicalChainTvl/<chain>` and the DEX volume chart, and compare last-14d vs
299
+ prior-14d. TVL rising while volume falls 28% means mercenary capital arriving as users
300
+ leave — say that, do not report the TVL alone.
301
+ - **Verify the incumbent is really absent before claiming a gap.** A category showing zero
302
+ can still be served by a venue DefiLlama does not track, or by an aggregator already
303
+ deployed. Check before building.
304
+ - **A market that exists but is unused is a *rejected* gap, not an unbuilt one.** Equity
305
+ collateral markets existed on the chain's main lender and held $2,789 total. Capital had
306
+ already looked and refused. That is much stronger evidence than an empty category, and it
307
+ means you must explain *why the refusal was wrong* before building the same thing.
308
+ - **Check whether the asset issuer already solved it.** Tokenized-equity contracts on RH
309
+ 4663 are `BeaconProxy` → a `Stock` implementation exposing `uiMultiplier` /
310
+ `updateMultiplier` / `effectiveAt` — a scheduled split-rebase. Corporate actions were
311
+ never a gap. The same read surfaced `pause()`, `pauseOracle()`, and `adminBurn()`, so
312
+ any protocol holding those tokens inherits issuer freeze/burn risk: put it in the risk
313
+ disclosure. Read the implementation ABI behind a proxy before scoping work around it.
314
+ - **`forge` internal-library reverts need an external harness.** `vm.expectRevert` on a
315
+ library's internal function fails with `call didn't revert at a lower depth than
316
+ cheatcode call depth`, because the call is inlined. Wrap it in a small external harness
317
+ contract and call through that. Not a code bug; only a test-harness shape.
318
+ - **Prototype to measure, not to ship.** Writing one real contract plus its tests is often
319
+ the cheapest way to get a truthful gas number and validate the core math. 512 fuzz runs
320
+ proving a solvency invariant cost minutes and de-risked the whole design.
321
+
322
+ ## References
323
+
324
+ - `references/rh-4663-options-pmf-worked-example.md` — the full worked assessment on
325
+ Robinhood Chain 4663: category diff numbers, the leverage-loop reconciliation, holder
326
+ and float tables, the hedging-depth measurement, the three-shape capital-efficiency
327
+ comparison, the HoodNotes design, and the measured deploy-cost table.
328
+ - `references/onchain-equity-venue-registry.md` — every venue carrying on-chain equities
329
+ (Hyperliquid HIP-3, Arcus perps + CLOB spot, RH Uniswap, Solana xStocks, TON) with
330
+ keyless endpoints, the Arcus off-hours band/margin regime worth copying, the empirical
331
+ proof that an off-hours funding lock kills the weekend-basis trade, and the dormant-venue
332
+ list. Read this before scoping anything multi-venue.
@@ -22,6 +22,11 @@ description: Use when researching or verifying EVM contracts, routers, factories
22
22
  - Proxy with unverified implementation
23
23
 
24
24
  ## Trusted routers (verify on-chain, don't assume)
25
- - Uniswap V2 Router: 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D (Ethereum)
26
- - Uniswap V3 Router: 0xE592427A0AEce92De3Edee1F18E0157C05861564
27
- - UniversalRouter: 0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD
25
+
26
+ Ethereum is not the only chain. Resolve the router on the **token's home chain**.
27
+
28
+ - Uniswap V2 Router (Ethereum): `0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D`
29
+ - Uniswap V3 SwapRouter (Ethereum): `0xE592427A0AEce92De3Edee1F18E0157C05861564`
30
+ - UniversalRouter (Ethereum): `0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD`
31
+
32
+ On Base / Arb / OP / Polygon / BSC / Avalanche / HyperEVM / Abstract / Stable / RH, look up that chain's Uniswap / Pancake / Aerodrome / venue router from live data (`dex_token`, `scan_token`). Never paste an Ethereum router onto another chainId.
@@ -0,0 +1,93 @@
1
+ ---
2
+ name: multi-venue-prepare-only-ranking
3
+ description: Use when building prepare-only cross-venue rank surfaces.
4
+ ---
5
+
6
+ > Oracle native tools: `oracle_cli` (read/prepare), `vault_status`, `signer_status`, `signer_execute` (needs human confirmationNonce), `skill_load`. No generic shell. No fleet SSH.
7
+
8
+
9
+ # Multi-venue prepare-only ranking
10
+
11
+ Class of product: compare quotes across venues, rank honestly, prepare unsigned artifacts only. Worked repo: `/home/demi/work/oracle-equities` (298 offline tests as of 2026-08-04).
12
+
13
+ ## Product law
14
+
15
+ - Prepare-only. No keys, no sign, no broadcast in the public package.
16
+ - Rank on **net received after fees/gas/impact** when costs are known; otherwise `rankedOn: "gross"` and say so.
17
+ - **Unknown is not zero.** Missing gas/impact/funding => field `null` and `costAccounted: false`.
18
+ - **Adapters report truth. Liveness filters.** Never "repair" crossed books or drop dormant venues inside an adapter.
19
+ - **Winner ≠ actionable.** Always emit `bestPreparable` (tier `prepare`) separately from overall winner.
20
+
21
+ ## Three outcome buckets
22
+
23
+ | Bucket | Meaning |
24
+ | --- | --- |
25
+ | ranked / survivors | answered + passed integrity |
26
+ | failed[] | did not answer |
27
+ | excluded[] | answered but untrustworthy (`dormant-venue`, `crossed-book`, `stale-quote`, `stale-oracle`) |
28
+
29
+ Do not collapse excluded into failed.
30
+
31
+ ## Pipeline shape
32
+
33
+ ```
34
+ adapters -> normalize -> liveness -> (marketHours, funding, bridge) -> rank -> prepare
35
+ ```
36
+
37
+ Default rank: **homogeneous** instrument tables (spot vs spot, perp vs perp).
38
+ Horizon mode: heterogeneous + funding carry labeled `confidence: "estimate"` (never upgrades `costAccounted`).
39
+
40
+ Session states: `core` / `extended` / `dark` (not a single 04:00-20:00 lit window). DST and holidays from fixtures, not host tzdata.
41
+
42
+ Search `bestPreparable` across ALL scored survivors, not only the instrument-segmented pool (homogeneous mode can rank perps and drop the spot prepare route from `ranked`).
43
+
44
+ ## Fixed-point money
45
+
46
+ All prices/sizes/rates: `{ mantissa: bigint, scale: int }`. No JS floats in contract fields.
47
+
48
+ Venue JSON often stores IEEE doubles (`1.25e-5`). Provide **one** audited crossing module that expands exponent notation to plain decimal strings before parse. Missing source -> `null`; measured zero stays zero.
49
+
50
+ ## Fixture discipline
51
+
52
+ 1. Freeze live venue responses into `fixtures/` before Wave 1.
53
+ 2. Offline tests only against fixtures; live probes in `scripts/` only.
54
+ 3. **Re-derive goldens from the frozen capture** before pinning (plan "56 assets / 43.8bp" became ~45 / ~39bp on the actual snapshot). Prefer bands when the capture drifts.
55
+ 4. If tier is `prepare` but capture has no price/reserves/sqrtPriceX96: capture state first or demote tier. Do not invent mids.
56
+
57
+ ### RH Uniswap V3/V4 price capture (chain 4663)
58
+
59
+ When pools are address+liq only:
60
+
61
+ - RPC: `https://rpc.mainnet.chain.robinhood.com` (chainId `0x1237`)
62
+ - V3: `slot0()` `0x3850c7bd` on pair address
63
+ - V4: StateView `0xF3334192D15450CdD385c8B70e03f9A6bD9E673b` `getSlot0(bytes32)` `0xc815641c`
64
+ - V4 token0: USDG is token0 iff `int(USDG) < int(equity)` (currency0 < currency1). Without this, GOOGL/AMZN/SPY/TSLA invert by ~1e19.
65
+ - Gas observed ~0.0215 gwei; gas in quote units still needs an ETH price (else leave gas null).
66
+
67
+ ## Swarm recovery pitfalls
68
+
69
+ - Before writing into a recovered worktree: scan for live `hermes` workers whose cwd is the repo. Stand down if Wave N is still running.
70
+ - OAuth-dead swarm summaries can hide commits and green uncommitted leaves. Check `git log` / `git status` / transcript tails.
71
+ - Spine edits (fixture loader maps) must be atomic: FILES + VALIDATORS + getter + test in one commit before leaf waves.
72
+
73
+ ## CLI surface pattern
74
+
75
+ ```
76
+ venues # inventory + liveness tallies
77
+ quote <TICKER> --size --horizon --json
78
+ prepare <TICKER> --recipient 0x... # unsigned only; refuse stale quotes
79
+ ```
80
+
81
+ ## Symbol normalization traps
82
+
83
+ - Namespace strip (`xyz:NVDA`), `-USD` strip, lowercase `x` suffix only on allowlist.
84
+ - Fail closed on ambiguity (`{ ambiguous: true, candidates }`). Never guess.
85
+ - Real trap: SKHX vs SKHY must not alias; LIT can be multi-asset-class contested.
86
+
87
+ ## Related umbrellas (user-owned; adopt to merge)
88
+
89
+ - `oracle-best-execution` — swap/bridge UX copy for net-of-cost ranking
90
+ - `parallel-build-swarm-file-ownership` — disjoint leaf ownership + spine rules
91
+ - `planner-builder-profile-pipeline` — fable plan / builder execute / verify
92
+
93
+ Detail: `references/oracle-equities-2026-08-04.md`.
@@ -0,0 +1,71 @@
1
+ ---
2
+ name: oracle-access-control
3
+ description: Sender gating and operator wallet boundaries for Oracle.
4
+ ---
5
+
6
+ > Oracle native tools: `oracle_cli` (read/prepare), `vault_status`, `signer_status`, `signer_execute` (needs human confirmationNonce), `skill_load`. No generic shell. No fleet SSH.
7
+
8
+
9
+ # Oracle access control
10
+
11
+ ## Two layers of authorization
12
+
13
+ 1. **Sender gate** — who can talk to this instance at all
14
+ 2. **Grant gate** — what an authorized sender may do (chain, spend cap, TTL)
15
+
16
+ Never confuse them. A valid grant does not authorize an unauthorized sender.
17
+
18
+ ## Private instance model
19
+
20
+ The owner's Telegram/Discord ID is hardcoded in the SOUL. All other senders
21
+ are refused immediately:
22
+
23
+ "Oracle is self-hostable. Install your own instance: npm install -g @oracle-agent/oracle"
24
+
25
+ No read access. No prepare access. No negotiation.
26
+
27
+ The shipped package SOUL is owner-agnostic ("you are the owner"). DEMI's
28
+ instance override lives at `~/.hermes/profiles/oracle/SOUL.md` with the
29
+ owner's Telegram ID hardcoded.
30
+
31
+ ## Self-host model
32
+
33
+ ```
34
+ npm install -g @oracle-agent/oracle
35
+ oracle bootstrap
36
+ oracle auth login claude
37
+ oracle init --apply
38
+ oracle chat
39
+ ```
40
+
41
+ Full capabilities with their wallet, their keys, their models. Oracle
42
+ ships its own agent runtime — Hermes is optional. `oracle chat` auto-detects
43
+ Hermes on PATH; falls back to standalone.
44
+
45
+ ## Address-agnostic arming
46
+
47
+ `fromAddress` in prepare/arm pathways is caller-supplied. Any sender can arm
48
+ a trade to any address. The unsigned transaction sits in `awaiting_signature`
49
+ until the target wallet signs with its private key. The wallet key is the
50
+ real gate.
51
+
52
+ ## Operator wallet boundary
53
+
54
+ `oracle_control_arm`, `oracle_control_confirm`, and any house/executor wallet
55
+ tool are owner-only. The operator wallet is never shared with other senders.
56
+
57
+ ## Tool safety gates (SOUL-level)
58
+
59
+ These persistent-state tools are gated by the SOUL — never call them without explicit owner direction:
60
+ - `skill_manage` — creates, edits, deletes skills. Refuse unless owner names exact skill + action.
61
+ - `cronjob` — creates, updates, removes scheduled jobs. Refuse unless owner names exact job + schedule.
62
+ - `memory` — writes to persistent memory. Refuse unless owner states a preference or fact to save.
63
+
64
+ Both the private-instance SOUL and the npm-distributed SOUL include these gates.
65
+ Ambiguity = ask. Never create/edit/delete speculatively or as a "cleanup" pass.
66
+
67
+ ## Config key-path hygiene
68
+
69
+ Signer material must not live in readable config files. Use `oracle sign`
70
+ / the local vault, or a 0600 secret file the operator owns. Config should
71
+ point at that file path, never embed a key.
@@ -0,0 +1,99 @@
1
+ ---
2
+ name: oracle-action-arming
3
+ description: Use when arming Oracle actions via oracle_control_arm.
4
+ ---
5
+
6
+ > Oracle native tools: `oracle_cli` (read/prepare), `vault_status`, `signer_status`, `signer_execute` (needs human confirmationNonce), `skill_load`. No generic shell. No fleet SSH.
7
+
8
+
9
+ # Oracle action arming
10
+
11
+ Two-step control-plane workflow for armed execution actions. Complements
12
+ `oracle-action-semantics` (vocabulary) and `oracle-grants` (authorization bounds).
13
+
14
+ ## Two-step flow
15
+
16
+ 1. **Arm** — `oracle_control_arm` creates an action in `pending_confirmation`.
17
+ 2. **Confirm** — `oracle_control_confirm(id, intentHash)` activates it.
18
+
19
+ Until confirmed, the action is inert. After confirmation: `state: "active"`,
20
+ `actionMode: "execute"`.
21
+
22
+ ## Schema gotchas
23
+
24
+ - `trigger.type` MUST be a non-empty string. Fails with `trigger.type must be a non-empty string` otherwise.
25
+ - `policy.caps` MUST be a decimal number (e.g. `0.1`), NOT an object. Fails with `policy.caps must be a decimal` otherwise.
26
+ - `intent` is an open object — include `action`, `token`, `chainId`, `amountEth`/`amount`, `slippageBps`, `router`, `recipient`, `symbol`.
27
+
28
+ ## Common trigger shapes
29
+
30
+ ### Liquidity trigger ("buy when it's live")
31
+ ```json
32
+ {
33
+ "type": "liquidity",
34
+ "chainId": 4663,
35
+ "token": "0x...",
36
+ "kind": "liquidity",
37
+ "condition": "any_pool_with_liquidity"
38
+ }
39
+ ```
40
+
41
+ ### Price trigger ("buy when it hits X")
42
+ ```json
43
+ {
44
+ "type": "price",
45
+ "chainId": 8453,
46
+ "token": "0x...",
47
+ "direction": "above",
48
+ "threshold": 0.05,
49
+ "metric": "px"
50
+ }
51
+ ```
52
+
53
+ ## Full example: armed liquidity snipe
54
+
55
+ ```
56
+ oracle_control_arm({
57
+ trigger: {
58
+ type: "liquidity",
59
+ chainId: 4663,
60
+ token: "0xc72F232a6869e6CF34dC06129AfFD07F8a2a246A",
61
+ kind: "liquidity",
62
+ condition: "any_pool_with_liquidity"
63
+ },
64
+ intent: {
65
+ action: "buy",
66
+ symbol: "MANCER",
67
+ token: "0xc72F232a6869e6CF34dC06129AfFD07F8a2a246A",
68
+ chainId: 4663,
69
+ amountEth: 0.1,
70
+ slippageBps: 100,
71
+ router: "uniswap",
72
+ recipient: "0xYOUR_WALLET"
73
+ },
74
+ policy: {
75
+ caps: 0.1,
76
+ maxSpendEth: 0.1,
77
+ maxGasGwei: 500,
78
+ priorityFeeGwei: 50
79
+ },
80
+ maxExecutions: 1,
81
+ expiresAt: "2026-08-07T23:59:59Z"
82
+ })
83
+ → oracle_control_confirm(id, intentHash)
84
+ ```
85
+
86
+ ## Pre-arm checklist
87
+
88
+ 1. Resolve exact chain + token (multi-chain scan if unknown).
89
+ 2. Verify executor health for target chain.
90
+ 3. Require exact amount, slip, recipient, expiry from user.
91
+ 4. Present compact confirmation card before confirming.
92
+ 5. One-shot default; recurring needs explicit user request.
93
+
94
+ ## Post-arm
95
+
96
+ - Action fires when trigger condition met, up to `maxExecutions` times, until `expiresAt`.
97
+ - Every execution re-quotes + re-checks grant at sign time and broadcast time.
98
+ - Use `oracle_action_list` / `oracle_action_status` to inspect.
99
+ - Use `oracle_action_cancel` to cancel.