guardrail/docs/SUBMISSION_CHECKLIST.md
Caelum c7d296d2c5
feat: submission-complete — proof capture, CMC hub lineage, live wiring, docker fix (#3)
* fix(docker): deterministic pnpm + CI flag for dashboard image

corepack enable downloaded a nondeterministic 'latest' pnpm (v11+) whose
TTY/CI gates broke the non-interactive build. Pin pnpm@9.15.4, set CI=true,
require the lockfile (drop the silent '|| pnpm install' fallback). Verified
with a full local 'docker build -f infra/Dockerfile.dashboard .' (next build
completes, image exports). Greens the docker CI job.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat(cmc): CMC Agent Hub capability/lineage surface (Phase B)

Make the CMC integration verifiable and discoverable, not just asserted —
the gap that kept the CMC Agent Hub lane at PARTIAL. Read-only only; no
execution is ever exposed to the hub.

- configs/cmc/capabilities.json: single source of truth declaring each CMC
  dataset (quotes/OHLCV/Fear&Greed/DEX-liquidity/security/trending/global)
  -> the capability it powers, with the exact cmc-client source and the
  API route / MCP tool that exposes it.
- GET /cmc/capabilities (apps/guardrail-api/src/cmc_capabilities.rs): serves
  the descriptor + a summary (datasets, capabilities, execution_exposed=false).
- MCP resource guardrail://cmc/capabilities mirrors the descriptor.
- agent_card.json: advertise a "CMC Agent Hub" service so the agent is
  discoverable from its ERC-8004 identity document.
- docs/CMC_AGENT_HUB.md + PRIZE_MAP row.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat(submission): one-command proof capture + evidence auto-ticker (Phase C)

Turn the unchecked submission checklist into a captured, evidence-backed
artifact in one command — and tick it from real evidence, never by hand.

- python-lab/scripts/tick_checklist.py: reads the SQLite event log, the run
  report, and configs, then flips each proof-artifact checkbox based on whether
  the artifact actually exists, and regenerates an evidence table. Honest by
  construction: items needing a real on-chain tx report "pending (live)" in
  paper mode instead of a false tick. Evidence is scoped to the primary run's
  run_id so the shared-DB kill-switch demo can't shadow it.
- configs/risk_policy.killswitch_demo.json + configs/killswitch_demo.toml: a
  low-threshold (0.05%) policy/config that trips the kill switch on a normal
  paper run, emitting a real KillSwitchTriggered event (shared DB, throwaway
  report so the primary run report is preserved).
- scripts/capture_submission.sh: orchestrates run -> kill-switch demo -> export
  submission.md -> proof-verify -> tick. Offline-safe (paper/mock); flips to
  live when keys + production config are supplied.

Verified end-to-end: a paper capture ticks 10/11 from real evidence; only
Competition registration stays pending (live), exactly as it should.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat(live): registration wiring + go-live preflight + go_live.sh (Phase D)

Make the live path turn-key and the on-chain registration proof flow end to
end, so the keyed go-live (the one human-in-the-loop step) is a single safe
command.

- agent-runtime: thread the competition registration tx through RunMeta into
  the run report, the AgentProof, and the AgentReportPublished summary — but
  only for a real LIVE registration. In paper the mock executor's synthetic
  hash is logged as an event for the demo and never presented as an anchored
  on-chain tx, so proof_verify and the checklist stay honest (registration =
  pending until live). The run report now also carries agent_id.
- guardrail-doctor --live: a preflight safety gate — required credentials
  (CMC_API_KEY, BSC_RPC_URL, TWAK transport), production config in live mode,
  and conservative policy caps. Env + file checks only; refuses to green when
  unconfigured. +2 tests.
- tick_checklist.py: registration ticks only on a live tx; a paper mock stays
  pending (live).
- scripts/go_live.sh: preflight -> on-chain reachability -> confirm -> bounded
  live run -> capture proof -> print BscScan links. Requires a typed "GO LIVE"
  confirmation (spends real money) unless --yes.

Workspace builds green, clippy clean, agent-runtime e2e tests pass, paper
capture still ticks 10/11.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs: runbook one-command paths, checklist regen note, WHATS_NEW (Phase F)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 02:54:00 +03:00

6.5 KiB

Submission Checklist — Track 1

Maps each Track 1 requirement to where it is satisfied in this repo, with the real files and commands that prove it.

Requirement → implementation map

Requirement Where it lives How to verify
CMC market data crates/cmc-client (CmcDataSource trait, rest.rs, mcp.rs, mock.rs); normalized by crates/market-data. Paper mode uses the deterministic mock (configs/paper.toml → cmc.use_mock = true). CMC-derived snapshot drives every cycle; visible as MarketSnapshotReceived / RegimeClassified events in the log.
TWAK execution crates/twak-client (TwakExecutor trait, swap.rs, quote.rs, mock.rs, rest.rs, mcp.rs). configs/*.toml → twak.mode, twak.quote_before_swap. An order reaches TWAK only after risk approval; guardrail-replay -- trades lists confirmed swaps.
On-chain registration crates/bnb-agent (identity.rs, metadata.rs, erc8004.rs, erc8183.rs, proof.rs, registration.rs); crates/twak-client/src/competition.rs; COMPETITION_CONTRACT in crates/common/src/constants.rs; scripts/register_agent.sh. Gated by twak.competition_register_enabled. cargo run -p guardrail-cli -- identity and -- register; on register, an AgentStarted/TxConfirmed event carries competition_tx, surfaced at GET /proof.
Risk policy crates/policy-compiler (NL/JSON → validated RiskPolicy + SHA-256 hash); crates/risk-engine (the gate); policies in configs/risk_policy.paper.json, configs/risk_policy.production.json, schema configs/risk_policy.schema.json. cargo run -p guardrail-cli -- policy compile "<mandate>" prints policy + hash; GET /policy shows the active policy.
Kill switch crates/risk-engine/src/kill_switch.rs (should_trigger); enforced in crates/agent-runtime/src/runtime.rs (engages at kill_switch_drawdown_pct, stays engaged, halts trading). Manual: guardrail-cli kill-switch, scripts/kill_switch.sh. KillSwitchTriggered event in the log; guardrail_kill_switch gauge flips to 1; /alerts raises it.
Minimum daily trade activity daily_trade_requirement in the policy (min_trades_per_day, max_heartbeat_trade_pct); heartbeat injected in crates/agent-runtime/src/runtime.rs when a cycle is idle, routed through the same risk gate. DailyTradeRequirementSatisfied events; guardrail_daily_trade_satisfied_total gauge.
Eligible-asset allowlist configs/eligible_assets.bsc.json (USDT, WBNB, CAKE on chain 56) loaded via market-data::Universe; allowed_assets + allowed_chains in the policy enforced by risk-engine. GET /universe; risk engine rejects any non-allowlisted symbol or chain.
Read-only dashboard dashboard/ (Next.js) reads from guardrail-api only; apps/guardrail-api is a read-only axum service over the event store — no trading path. Safety invariants enumerated at GET /ops. Dashboard and API cannot call TWAK; /ops lists "API is read-only", "Dashboard cannot call TWAK".
Proof artifacts / hashes policy_hash (policy-compiler), agent_id + ERC records + report hash (bnb-agent), append-only SQLite log (crates/event-store), data/run_report.json, data/exports/submission.md via scripts/export_report.sh. See "Proof artifacts" below.

Operator surfaces (read-only API, port 8080)

  • /health, /cockpit, /portfolio, /trades, /signals, /risk populated.
  • /alerts includes active alerts, counts, and evaluated input values.
  • /readiness has no blocking checks before submission.
  • /events, /policy, /universe, /config, /ops, /proof populated.
  • /metrics (and the guardrail-exporter /metrics on port 9100) return NAV, drawdown, report age, kill switch, trade, and event gauges.

Proof artifacts

These boxes are ticked from real evidence, not by hand. Run scripts/capture_submission.sh (offline/paper) or scripts/go_live.sh (live) to (re)generate the artifacts and re-tick; the auto-generated evidence table at the bottom is the source of truth. Competition registration ticks only after a real on-chain registration (live) — paper leaves it pending.

  • Policy hash generated — guardrail-cli policy compile, embedded in AgentStarted events, exposed at GET /policy.
  • Agent identity + ERC-8004/8183 records — guardrail-cli identity.
  • Competition registration target / tx — guardrail-cli register, GET /proof (registration_tx).
  • Eligible BSC assets loaded — configs/eligible_assets.bsc.json, GET /universe.
  • CMC data visible in the event log — guardrail-replay journal.
  • Risk approval and rejection examples captured — GET /risk, guardrail-replay summary (proposed vs. rejected vs. confirmed).
  • TWAK quote + confirmed transaction captured — guardrail-replay trades, GET /trades.
  • Kill-switch behavior demonstrated — KillSwitchTriggered event, guardrail_kill_switch gauge. See docs/DEMO_SCRIPT.md §9 (low-threshold demo).
  • Daily report / run report generated — data/run_report.json, GET /report, GET /report/markdown.
  • Submission Markdown generated — data/exports/submission.md via scripts/export_report.sh.
  • Dashboard proof page populated — /proof.

Reference docs

docs/ARCHITECTURE.md, docs/RISK.md, docs/STRATEGY.md, docs/CMC_INTEGRATION.md, docs/TWAK_INTEGRATION.md, docs/BNB_AGENT_IDENTITY.md, docs/EXECUTION.md, docs/BACKTEST_METHODOLOGY.md, docs/OBSERVABILITY.md, docs/LIVE_RUNBOOK.md, docs/DEMO_SCRIPT.md.

Evidence (auto-generated)

Generated by python-lab/scripts/tick_checklist.py from real artifacts. 10/11 ticked.

Item Status Evidence
Policy hash generated ✅ policy_hash a25d3a24f541…
Agent identity ✅ agent_id e38b86d49c97…
Competition registration 🟡 pending (live): no registration_tx — run scripts/go_live.sh
Eligible BSC assets ✅ 20 enabled eligible asset(s)
CMC data visible ✅ market_snapshot_received / regime_classified in log
Risk approval and rejection ✅ risk_approved + risk_rejected/clipped in log
TWAK quote ✅ twak_quote_received + tx_confirmed in log (paper: mock tx)
Kill-switch behavior ✅ kill_switch_triggered in log
Daily report ✅ run_report.json present (run run_5416…)
Submission Markdown ✅ data/exports/submission.md present
Dashboard proof page ✅ proof fields (agent_id + policy_hash) available