> ## Documentation Index
> Fetch the complete documentation index at: https://docs.walletwall.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Dune vault readiness scope

# Dune Scope & Cost Audit — Stablecoin Vault Readiness

**Date:** 2026-06-23
**Branch:** `audit/dune-vault-readiness-scope`
**Method:** static analysis only — derived from `api/*.js` route handlers, `src/lib/**`,
`dune/**`, `.env.example`, the existing Dune audits, and the guardrail code/tests.
**No Dune queries were executed, refreshed, scheduled, exported, written, or test-run to
produce this audit. No runtime Dune behavior was changed.**

This audit re-anchors every Dune query reference against the **stablecoin vault readiness
platform** direction established by the alignment series (PRs #1233–#1244). The existing
[dune-query-inventory.md](./dune-query-inventory.md) (#1128) and
[dune-product-dependency-map.md](./dune-product-dependency-map.md) (#1130) were last audited
**2026-06-20** — *before* that alignment work. This document does **not** duplicate them; it
adds a third lens on top of them:

> For each Dune query, **how relevant is it to stablecoin vault readiness**, and what is the
> recommended **keep / reduce / review / deprecate** action given that direction and the
> RED credit-budget posture?

See also:

* [dune-query-inventory.md](./dune-query-inventory.md) — authoritative per-env-var inventory (status, query IDs, files)
* [dune-product-dependency-map.md](./dune-product-dependency-map.md) — per-surface runtime dependency + degradation
* [../operations/dune-query-guardrails.md](../operations/dune-query-guardrails.md) — read-only/cache-only operating contract
* [../operations/dune-agent-safety.md](../operations/dune-agent-safety.md) — agent/CLI execution lockdown
* [../operations/dune-budget-baseline.md](../operations/dune-budget-baseline.md) — 🔴 RED credit-budget baseline (#1131)
* [../operations/dune-schedule-triage.md](../operations/dune-schedule-triage.md) — owner-side Dune-UI cadence triage
* [api-cost-control-map.md](./api-cost-control-map.md) — per-provider credit-risk map

***

## 1. Executive summary

* **The vault-readiness alignment added ZERO new Dune spend paths.** The new shared model,
  adapter, packet builder, Migration Readiness wiring, and state refinement
  (`src/lib/stablecoin-vault-readiness-model.js`, `buildStablecoinVaultReadiness.js`,
  `buildVaultReadinessPacket.js`, `migration-readiness.js`) are **pure functions** — each
  documents "no Dune query execution, no I/O." They consume Dune-derived facts that already
  flow through the existing cached read paths (`/api/quantum-readiness`,
  `/api/quantum-exposure` → `api/_quantum-facts.js`). No new query IDs, no new routes, no
  execution.
* **Guardrails hold and are unchanged.** Dune is read-only by default; `executeAndPoll` is
  fail-closed behind a four-factor gate; reads and writes use separate keys; `dune:verify`
  * four guardrail test files + the CLI pre-flight guard enforce the contract; CI and tests
    hard-block execution. Verified by reading the code and running the static + mocked checks
    (0 credits) — see §7.
* **The direct vault-readiness signal set is mostly cheap.** The queries that *directly* feed
  vault/wallet readiness (migration readiness, dormant quantum exposure, counterparty
  context, adversarial heuristics, value-at-risk) are weekly or scheduled snapshots. The
  expensive surfaces are the **discovery/analytics** queries (48h active wallets, whale
  trades, 12-week activity, and the generic Coinstellation/Insights trio), several of which
  are only *indirectly* aligned or **not aligned at all** with the vault direction.
* **Highest-leverage cost action is unchanged from #1131 triage:** pause stale Dune-UI
  schedules and slow the 6h/12h cadences. This audit adds product justification: the generic
  analytics queries are now **deprecate candidates** under the vault-readiness direction, and
  the stale/mis-named slots should be resolved.

Classification totals (by logical query; see §4):

| Classification                                                      |                          Count |
| ------------------------------------------------------------------- | -----------------------------: |
| **Keep** — critical for stablecoin vault readiness                  |                              9 |
| **Keep but cache/reduce** — useful but cost-sensitive               |                              7 |
| **Review** — unclear or partially aligned                           |                              6 |
| **Deprecate candidate** — stale or generic-analytics direction      |                              4 |
| **Guardrail-only / reference** — must not execute / already removed | 4 removed + execution-gate set |

***

## 2. Current Dune posture

| Dimension                | State                                                                                                                                                                                                                             |
| ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Execution mode (app)** | Read-only `GET /query/:id/results` (0 credits). No `/execute` on any request path.                                                                                                                                                |
| **Execution gate**       | `executeAndPoll` fail-closed behind `assertDuneExecutionAllowed` (4 factors: `ALLOW_DUNE_EXECUTION` + `DUNE_EXECUTION_ACK` + `DUNE_WRITE_API_KEY` + not CI/test).                                                                 |
| **Key separation**       | Reads: `DUNE_READONLY_API_KEY` → `DUNE_API_KEY` (fallback). Execution: `DUNE_WRITE_API_KEY` only. A read key can never authorize a write.                                                                                         |
| **Caching**              | Redis (`dune:v1:<queryId>:default`) + in-process fallback; in-flight read coalescing; TTLs 6h/12h/24h as named constants asserted in tests.                                                                                       |
| **Budget**               | 🔴 **RED** per [dune-budget-baseline.md](../operations/dune-budget-baseline.md): \~11,064 / 4,000 credits at mid-cycle (≈2.77×), projecting ≈5.2× month-end. Spend originates from **Dune-UI scheduled executions**, not the app. |
| **Vault path**           | `/vault` (`StablecoinVaultPage.jsx`) is mock/rehearsal-only — **no Dune reads on the vault route itself**. Vault *readiness* is computed from quantum/migration facts read elsewhere.                                             |

***

## 3. Query inventory (vault-readiness lens)

One row per **logical query** (by Dune query ID). Env-var-level detail (aliases, exact files,
`.env` vs `.env.example`) lives in [dune-query-inventory.md](./dune-query-inventory.md); this
table adds the **product surface (new architecture)**, **vault-readiness relevance**,
**cost/scan risk**, and **classification**.

Relevance legend: **Direct** = feeds the wallet/vault readiness, migration, or evidence
computation. **Indirect** = supports a discovery/context surface that funnels into readiness
or frames the stablecoin product. **None** = generic analytics with no vault-readiness role.

| Query ID                              | Primary env var                                                                      | Product surface (new)                                   | Vault relevance                              | Cost / scan risk                                          | Cadence           | Classification                             |
| ------------------------------------- | ------------------------------------------------------------------------------------ | ------------------------------------------------------- | -------------------------------------------- | --------------------------------------------------------- | ----------------- | ------------------------------------------ |
| 7605290                               | `DUNE_QUERY_WALLET_SIGNATURE_EXPOSURE`                                               | Wallet Readiness (PQ signature)                         | **Direct**                                   | Med (per-wallet snapshot, 6h TTL — aggressive)            | scheduled / 6h    | Keep but cache/reduce                      |
| 7605304                               | `DUNE_QUERY_QUANTUM_VALUE_AT_RISK` (alias `…_VALUE_AT_RISK`)                         | Wallet Readiness (value-at-risk)                        | **Direct**                                   | Low–Med                                                   | scheduled         | Keep                                       |
| 7605315                               | `DUNE_QUERY_WALLET_MIGRATION_READINESS`                                              | Migration Readiness                                     | **Direct**                                   | Low (weekly)                                              | weekly            | Keep                                       |
| 7605194                               | `DUNE_QUERY_DORMANT_QUANTUM_EXPOSURE`                                                | Wallet Readiness + Holder Wall (shared)                 | **Direct**                                   | Med (global snapshot)                                     | weekly            | Keep                                       |
| 7634380                               | `DUNE_QUERY_QUANTUM_COUNTERPARTY_CONTEXT`                                            | Readiness Packet / evidence                             | **Direct**                                   | Low–Med                                                   | scheduled         | Keep                                       |
| 7634433                               | `DUNE_QUERY_QUANTUM_ADVERSARIAL_HEURISTICS`                                          | Readiness Packet / evidence                             | **Direct**                                   | Low–Med                                                   | scheduled         | Keep                                       |
| 7724327                               | `DUNE_QUERY_DORMANT_QUANTUM_CANDIDATES`                                              | Holder Wall → vault-candidate discovery                 | **Direct** (heuristic proxy)                 | Med (broad receiver scan)                                 | scheduled         | Keep                                       |
| 7641256                               | `DUNE_QUERY_STABLE_PEG_HISTORY`                                                      | Stablecoin Intelligence                                 | **Indirect** (vault asset context)           | Low (daily)                                               | daily             | Keep                                       |
| 7641531                               | `DUNE_QUERY_STABLE_VOLUME_TREND`                                                     | Stablecoin Intelligence                                 | **Indirect**                                 | Low–Med                                                   | scheduled         | Keep                                       |
| 7641537                               | `DUNE_QUERY_STABLE_WHALE_FLOWS`                                                      | Stablecoin Intelligence / treasury                      | **Indirect**                                 | Med (network flow scan)                                   | scheduled         | Keep                                       |
| 7521767                               | `DUNE_QUERY_48H_ACTIVE_WALLETS` (alias `DUNE_QUERY_ID`)                              | Holder Wall / Wallet Activity                           | **Indirect**                                 | **High** (broad scan, 6h, multi-surface, fallback-backed) | scheduled / 6h    | Keep but cache/reduce                      |
| 7560801                               | `DUNE_QUERY_WHALE_TRADES`                                                            | Holder Wall + Coinstellation (shared)                   | **Indirect** (Holder Wall) / None (Insights) | **High** (network-wide ≥\$100k scan, multi-surface)       | scheduled         | Keep but cache/reduce                      |
| 7583106                               | `DUNE_QUERY_12WK_ACTIVE_WALLETS`                                                     | Whale Watcher / treasury monitoring                     | **Indirect**                                 | **High** (12-week window scan)                            | 24h               | Keep but cache/reduce                      |
| 7641114                               | `DUNE_QUERY_WALLET_PORTFOLIO`                                                        | Wallet Readiness (holdings → VaR context)               | **Indirect**                                 | Med (per-wallet)                                          | scheduled         | Keep but cache/reduce                      |
| 7641495                               | `DUNE_QUERY_WALLET_ACTIVITY_BREAKDOWN`                                               | Wallet Profile                                          | **Indirect**                                 | Med (per-wallet, 12h)                                     | 12h               | Keep but cache/reduce                      |
| 7641515                               | `DUNE_QUERY_WALLET_PROTOCOL_AFFINITY`                                                | Wallet Profile                                          | **Indirect**                                 | Med (per-wallet, 12h)                                     | 12h               | Keep but cache/reduce                      |
| 7746246                               | `DUNE_QUERY_WALLET_CHAIN_AFFINITY` (mis-named `DUNE_QUERY_CHAIN_AFFINITY` in `.env`) | Wallet Readiness (Quantum Exposure Clock bridge driver) | **Direct** (intended)                        | Low–Med (weekly, no route reads it yet)                   | weekly (intended) | Review                                     |
| 7673583                               | `DUNE_QUERY_STABLECOIN_MARKET_DAILY`                                                 | Stablecoin Intelligence (reserved)                      | **Indirect** (potential)                     | Unknown — **no route reads it**                           | n/a               | Review                                     |
| 7641521                               | `DUNE_QUERY_RECENT_NOTABLE_WALLETS`                                                  | Leaderboards                                            | **Indirect** (generic discovery)             | Low–Med                                                   | scheduled         | Review                                     |
| (empty)                               | `DUNE_QUERY_DEX_ID`                                                                  | Wallet Profile (DEX enrichment, optional)               | None                                         | Low (optional, unset)                                     | scheduled         | Review                                     |
| 7560798                               | `DUNE_QUERY_PROTOCOL_VOLUME`                                                         | Coinstellation / Insights                               | **None** (generic DeFi analytics)            | Med                                                       | scheduled         | Deprecate candidate                        |
| 7560799                               | `DUNE_QUERY_TOKEN_FLOWS`                                                             | Coinstellation / Insights                               | **None**                                     | Med                                                       | scheduled         | Deprecate candidate                        |
| 7560800                               | `DUNE_QUERY_CHAIN_ACTIVITY`                                                          | Coinstellation / Insights                               | **None**                                     | Med                                                       | scheduled         | Deprecate candidate                        |
| (empty)                               | `DUNE_QUERY_MULTICHAIN_QUANTUM_EXPOSURE`                                             | (stale placeholder, no route)                           | None                                         | n/a (empty)                                               | n/a               | Deprecate candidate                        |
| 7658207 / 7658215 / 7658220 / 7658222 | `DUNE_QUERY_SOLANA_STABLECOIN_*` (4)                                                 | Stable Seer (Solana — retired)                          | None                                         | n/a (removed)                                             | n/a               | Guardrail-only / reference (removed #1130) |
| —                                     | `DUNE_WRITE_API_KEY` + `ALLOW_DUNE_EXECUTION` + `DUNE_EXECUTION_ACK`                 | Execution gate (admin one-off only)                     | n/a                                          | **Credit-spending if opened**                             | n/a               | Guardrail-only / reference                 |

> **Aliases / config drift** (carried from the inventory; counted under their canonical query):
> `DUNE_QUERY_ID` → 7521767, `DUNE_QUERY_VALUE_AT_RISK` → 7605304,
> `DUNE_QUERY_CHAIN_AFFINITY` (mis-named) → 7746246. These are **Review** items (retire /
> rename), not independent queries.

***

## 4. Classification summary

| Classification                 | Queries                                                                                                                                                                                                                                                                                              |
| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Keep** (9)                   | Signature exposure¹, value-at-risk, migration readiness, dormant quantum exposure, counterparty context, adversarial heuristics, dormant quantum candidates, stable peg history, stable volume trend, stable whale flows — *(10 listed; signature exposure is grouped under Keep-but-reduce, see ¹)* |
| **Keep but cache/reduce** (7)  | `WALLET_SIGNATURE_EXPOSURE` (6h→12–24h), `48H_ACTIVE_WALLETS` (6h→reduce/pause; BigQuery primary), `WHALE_TRADES` (shared, ensure single cache), `12WK_ACTIVE_WALLETS` (large window), `WALLET_PORTFOLIO`, `WALLET_ACTIVITY_BREAKDOWN` (12h→24h), `WALLET_PROTOCOL_AFFINITY` (12h→24h)               |
| **Review** (6)                 | `WALLET_CHAIN_AFFINITY` (name mismatch + no route), `STABLECOIN_MARKET_DAILY` (reserved, no route), `RECENT_NOTABLE_WALLETS` (generic), `DEX_ID` (optional/empty), `DUNE_QUERY_ID` (alias), `DUNE_QUERY_VALUE_AT_RISK` (alias)                                                                       |
| **Deprecate candidate** (4)    | `PROTOCOL_VOLUME`, `TOKEN_FLOWS`, `CHAIN_ACTIVITY` (generic Coinstellation/Insights analytics, not vault-aligned), `MULTICHAIN_QUANTUM_EXPOSURE` (empty stale placeholder)                                                                                                                           |
| **Guardrail-only / reference** | 4× retired Solana stablecoin vars (removed #1130); the execution-gate env set (`DUNE_WRITE_API_KEY`, `ALLOW_DUNE_EXECUTION`, `DUNE_EXECUTION_ACK`) which must never be set in app/dev/CI                                                                                                             |

> ¹ **Stable totals:** the **Keep** bucket is 9 (the three Stable Seer queries + value-at-risk,
> migration readiness, dormant exposure, counterparty context, adversarial heuristics, dormant
> candidates). `WALLET_SIGNATURE_EXPOSURE` is **Direct/critical** but its *recommended action*
> is cadence reduction, so it is counted under **Keep but cache/reduce** to avoid double-count.
> This reconciles with the inventory's 18 **Active** env vars + 2 aliases + 1 candidate-removal
>
> * 3 stale + the reserved market-daily slot.

***

## 5. Mapping to the new product architecture

| Product pillar                            | Direct Dune queries                                                                                                    | Indirect Dune queries                                                                                     | Notes                                                                                                                          |
| ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| **Stablecoin Intelligence** (Stable Seer) | —                                                                                                                      | `STABLE_PEG_HISTORY`, `STABLE_VOLUME_TREND`, `STABLE_WHALE_FLOWS`, *(reserved `STABLECOIN_MARKET_DAILY`)* | Frames the vault's stablecoin asset context; keep, cheap-ish.                                                                  |
| **Wallet Readiness**                      | `WALLET_SIGNATURE_EXPOSURE`, `QUANTUM_VALUE_AT_RISK`, `DORMANT_QUANTUM_EXPOSURE`, *(intended `WALLET_CHAIN_AFFINITY`)* | `WALLET_PORTFOLIO`                                                                                        | Core PQ/exposure signals feeding `buildStablecoinVaultReadiness`.                                                              |
| **Migration Readiness**                   | `WALLET_MIGRATION_READINESS`                                                                                           | —                                                                                                         | Weekly; powers `/api/quantum-readiness` + MigrationPathPanel adapter (#1242).                                                  |
| **Readiness Packet / evidence**           | `QUANTUM_COUNTERPARTY_CONTEXT`, `QUANTUM_ADVERSARIAL_HEURISTICS`                                                       | —                                                                                                         | Source-backed evidence facts; consumed by `buildVaultReadinessPacket` (#1237).                                                 |
| **Holder Wall / concentration discovery** | `DORMANT_QUANTUM_CANDIDATES` (vault-candidate proxy)                                                                   | `48H_ACTIVE_WALLETS`, `WHALE_TRADES`                                                                      | Discovery funnel into readiness; highest-cost surface.                                                                         |
| **Whale Watcher / treasury monitoring**   | —                                                                                                                      | `12WK_ACTIVE_WALLETS`                                                                                     | Large-window scan; monitor cadence.                                                                                            |
| **Legacy / generic analytics**            | —                                                                                                                      | — (None-relevance)                                                                                        | `PROTOCOL_VOLUME`, `TOKEN_FLOWS`, `CHAIN_ACTIVITY`, `RECENT_NOTABLE_WALLETS`, `DEX_ID` — not part of the vault-readiness path. |

**How readiness consumes Dune (no execution):**
`/api/quantum-readiness` + `/api/quantum-exposure` → `api/_quantum-facts.js`
(`getOrCache` / `readOrCache`, params ignored for execution, rows filtered by wallet) →
`src/lib/quantum-vault-readiness.js` → **pure** `buildStablecoinVaultReadiness` /
`buildVaultReadinessPacket` / `migration-readiness`. The pure layer never touches Dune; it
only shapes already-read snapshot facts.

***

## 6. Cost / risk notes

**Highest-risk queries (cost / scan breadth / blast radius):**

1. **`DUNE_QUERY_48H_ACTIVE_WALLETS` (7521767)** — 6h cadence, broad network activity scan,
   **multi-surface** (Holder Wall + Wallet Activity), and **fallback-backed** (BigQuery is the
   primary source). Reducing or pausing its Dune schedule is the single highest-leverage,
   lowest-risk spend cut.
2. **`DUNE_QUERY_WHALE_TRADES` (7560801)** — network-wide ≥\$100k transfer scan, **shared**
   across Holder Wall (aligned) and Coinstellation/Insights (not aligned). One cached snapshot
   serves both; if Insights is deprecated, the Holder Wall consumer alone justifies it.
3. **`DUNE_QUERY_12WK_ACTIVE_WALLETS` (7583106)** — 12-week window is an inherently large scan;
   already 24h cadence, but confirm it is not a top consumer.
4. **`DUNE_QUERY_WALLET_SIGNATURE_EXPOSURE` (7605290)** — core *direct* readiness signal but on
   an aggressive **6h** cadence; signature exposure changes slowly, so 12–24h is safe.
5. **Generic Insights trio (`PROTOCOL_VOLUME` / `TOKEN_FLOWS` / `CHAIN_ACTIVITY`)** — scheduled
   credit spend for a surface with **no vault-readiness role**. Prime deprecate/pause candidates.

**Multi-surface / shared-snapshot queries** (one cached read serves N surfaces — good; but a
schedule change affects all consumers): `WHALE_TRADES` (Holder Wall + Insights),
`DORMANT_QUANTUM_EXPOSURE` (Wallet Readiness + Holder Wall), `48H_ACTIVE_WALLETS` (Holder Wall +
Wallet Activity).

**Queries that should require cached snapshots (and already do):** every active query. All reads
go through `readOrCache` / `getOrCache` / `readLatestResults`; per-wallet routes share one
snapshot per query ID and filter rows locally. No per-render reads; no per-wallet cache fan-out.

**Accidental-execution exposure (agents/tests/CI):** **None reachable.** `executeAndPoll` is the
only credit-spending path and is fail-closed behind the four-factor gate; `NODE_ENV=test` and CI
env detection hard-block it regardless of other vars; `dune:verify` blocks `/execute` and
mutating CLI verbs outside `api/_dune.js`; tests are fully mocked. The historical spike came from
**human/agent Dune-UI or CLI executions**, now contained — see
[dune-agent-safety.md](../operations/dune-agent-safety.md).

**Queries that must never execute during CI:** all of them — CI never needs execution. Enforced
by `isAutomatedEnv()` in the guard + the `dune:verify` CI-workflow scan.

***

## 7. Guardrails verified

Verified by reading the code and running the **read-only / mocked** checks (0 credits — no query
execution). Results in §"Tests run" of the PR.

| #  | Guardrail                                                | Evidence                                                                                                                                                                                                                                             | Status |
| -- | -------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ |
| 1  | Public routes are read-only (`GET /results`, 0 credits)  | `api/_dune.js` `readLatestResults`/`readOrCache`/`getOrCache`; `_dune-feature-route.js`, `_quantum-facts.js` use only read funnels                                                                                                                   | ✅      |
| 2  | `executeAndPoll` fail-closed behind 4-factor gate        | `api/_dune.js:169` calls `assertDuneExecutionAllowed`; `api/_dune-execution-guard.js` requires `ALLOW_DUNE_EXECUTION` + `DUNE_EXECUTION_ACK` + `DUNE_WRITE_API_KEY` + not CI/test                                                                    | ✅      |
| 3  | Read/write key separation                                | reads use `DUNE_READONLY_API_KEY`/`DUNE_API_KEY`; execution uses `DUNE_WRITE_API_KEY` only; read key can never authorize a write                                                                                                                     | ✅      |
| 4  | No `/execute` or write path reachable from public routes | `scripts/verify-dune-usage.mjs` checks 1–2, 5b(A–D); only `api/_dune.js` may reference `executeAndPoll`/`/execute`                                                                                                                                   | ✅      |
| 5  | CLI mutating verbs denylisted                            | `api/_dune-execution-guard.js` `DENYLISTED_DUNE_COMMANDS`; `scripts/dune-guard.mjs` (`npm run dune:guard`)                                                                                                                                           | ✅      |
| 6  | CI/tests cannot execute                                  | `isAutomatedEnv()` blocks `CI`/`GITHUB_ACTIONS`/`VERCEL`/`NODE_ENV=test`/`VITEST`; `dune:verify` fails CI workflows that set gate vars                                                                                                               | ✅      |
| 7  | No React/client-side Dune access                         | `verify-dune-usage.mjs` §3 + `dune-usage-guardrails.test.mjs` §6 block `_dune.js` imports and `api.dune.com` in `src/**`                                                                                                                             | ✅      |
| 8  | New alignment libs add no execution path                 | `buildStablecoinVaultReadiness.js`, `buildVaultReadinessPacket.js`, `stablecoin-vault-readiness-model.js`, `migration-readiness.js` are PURE (documented + no `_dune` import); `quantum-vault-readiness-display.js` *redacts* query IDs from display | ✅      |
| 9  | API key is read-only / documented as read-only           | `.env.example` comments: "Dune READ key … read-only/metadata calls (0 credits) … NEVER put a write/execution-capable key in either of these"; write key documented as human-only, never in Vercel/CI                                                 | ✅      |
| 10 | Agents warned not to write/execute                       | `docs/operations/dune-agent-safety.md` "hard rule"; guardrails doc anti-patterns                                                                                                                                                                     | ✅      |

**No write-capable Dune path exists in the app.** The only write/execute path
(`executeAndPoll`) is gated, key-separated, and unreachable from routes, tests, CI, and agents.

***

## 8. Recommended actions

**Repo-side (safe, no Dune execution; future PRs):**

1. **Retire confirmed aliases** once primary names are set in all deployed envs:
   `DUNE_QUERY_ID` → `DUNE_QUERY_48H_ACTIVE_WALLETS`; `DUNE_QUERY_VALUE_AT_RISK` →
   `DUNE_QUERY_QUANTUM_VALUE_AT_RISK`.
2. **Resolve chain-affinity config drift** — local `.env` uses the mis-named
   `DUNE_QUERY_CHAIN_AFFINITY`; code/`.env.example`/guardrails use `DUNE_QUERY_WALLET_CHAIN_AFFINITY`.
   Rename in `.env` (no code change) **or** decide whether to wire the lib into a route or drop it.
3. **Decide the generic Insights trio** (`PROTOCOL_VOLUME` / `TOKEN_FLOWS` / `CHAIN_ACTIVITY`): if
   Coinstellation/Insights is not part of the vault-readiness product, pause their Dune-UI
   schedules and mark the env vars deprecated. **No blind deletion** — confirm Coinstellation's
   product status first.
4. **Decide `STABLECOIN_MARKET_DAILY` and `MULTICHAIN_QUANTUM_EXPOSURE`:** wire into a surface or
   deprecate; both currently have no route.
5. **Declare `DUNE_QUERY_DEX_ID` intentionally optional** in docs so operators don't treat the
   empty value as missing config.

**Owner-side (Dune UI / billing — outside this repo, per #1131):**

6. Execute the [dune-schedule-triage.md](../operations/dune-schedule-triage.md) checklist: pause
   §4a stale schedules, drop the two 6h cadences (`48H_ACTIVE_WALLETS`, `WALLET_SIGNATURE_EXPOSURE`)
   to 12–24h, move 12h wallet-profile enrichments to 24h, then re-baseline via the 0-credit Usage
   API.
7. Get **per-query credit attribution** (Dune billing/usage export) to confirm the top consumers
   match the High-risk list in §6.

***

## 9. Follow-up issues / PRs

* **Dune query reduction PR** (repo): retire aliases (#1), resolve chain-affinity drift (#2), mark
  the generic Insights trio + stale placeholders deprecated (#3–#4) — docs/env/test only, no
  runtime behavior change.
* **Owner Dune-UI cadence triage** (no repo change): execute schedule-triage §4–§7; flip the
  launch-checklist "Dune usage stays within budget plan" P1 once projection ≤ budget.
* **Holder Wall tile signal polish** (product): now that `DORMANT_QUANTUM_CANDIDATES` is the
  vault-candidate discovery signal, tighten the tile signal mapping to the readiness vocabulary —
  separate, product-side follow-up.

***

## 10. Confirmation

* **No runtime Dune behavior was changed by this audit** — docs + a structural guardrail test only.
* **No Dune queries were executed, refreshed, scheduled, exported, written, or test-run.**
* Every **Direct/Indirect** entry is backed by a confirmed runtime/cache reference in an
  `api/*.js` route or `src/lib/*` module; nothing was marked aligned by inference.
* **Review / Deprecate candidate** entries are flagged for an owner decision, **not** auto-deleted.
* Cross-checked against `npm run dune:verify`, the four Dune guardrail test files, and the existing
  inventory + dependency map (whose per-env-var status counts remain authoritative).
