- dashboard: /ensemble (regime->skill weights) + /journal (per-cycle narrative) pages; /lab already server-backed. tsc clean. - clients/go: guardrailctl watch/ensemble/journal + typed Ensemble/Journal SDK methods. build+vet+gofmt clean. - guardrail-api: GET /snapshots over the persisted snapshot history (5 tests). OpenAPI 67 paths. - docs: DASHBOARD.md, WASM_NOTE.md (Track B deferral rationale), WHATS_NEW/FEATURE_MATRIX/PRODUCT_OVERVIEW/INDEX refresh. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
6.7 KiB
Guardrail Alpha — Phase 2 Expansion Plan
The original architecture in
plan.mdis fully realized (every crate, app, config, migration, doc, script, infra file, dashboard page, and skill it names exists; the build exceeds it). This document is the next phase: net-new folders, files, and functionality that deepen the product and the four hackathon prize lanes — Track 1 (autonomous trading), Track 2 (skills), CMC Agent Hub, BNB SDK, and TWAK self-custody.Everything stays offline-safe (paper/mock, no keys, no live token launches) and conflict-safe (new crates/dirs; existing shared files get one owner per change). Each increment must build green (
cargo build+clippy,tsc --noEmit) before commit, then push to GitHub; the dashboard auto-deploys to Vercel on push. No CI suites and no dedicated test trees this phase (inline Rust unit tests only where natural).
Track A — Real-time engine telemetry (live, not polling)
Today the dashboard/cockpit poll the read-only API every 5s. Make it push.
New:
crates/event-bus/— a thintokio::sync::broadcastfan-out over the append-only event store; the agent publishes eachAgentEventas it is logged.apps/guardrail-api/src/stream.rs— an SSE endpointGET /stream(and/stream/{topic}) that serializes live events to the browser.dashboard/src/lib/stream.ts+ a live/livecockpit page that subscribes to/streamand updates regime, trades, NAV, and risk decisions in real time.clients/web-lite— aLivetab usingEventSource.
Prize fit: Track 1 (visible, verifiable autonomy in real time).
Track B — In-browser backtesting (WASM)
Run the real Rust strategy + risk + backtester engine client-side.
New:
crates/strategy-wasm/—wasm-bindgenwrapper exposingrun_backtest(mandate, preset)overstrategy-engine+risk-engine+backtester(compiled towasm32-unknown-unknown).dashboard/src/wasm/(generated pkg) + a/labpage: type a natural-language mandate → compile policy → backtest in the browser → equity/drawdown charts, no server.scripts/build_wasm.sh—wasm-pack buildinto the dashboard.
Prize fit: differentiation; the same risk engine that gates live trades runs in the judge's browser.
Status — deferred (honest note). The in-browser-WASM-real-engine track is deferred: the compute stack (
backtester→market-data→cmc-client→reqwest/tokio) is notwasm32-compatible. The/labpage provides the same capability server-side instead, callingGET /backtestso the cockpit runs the exact same engine that gates live trades. Full rationale and the path to revisit it:docs/WASM_NOTE.md.
Track C — Native Rust strategy ensemble (live)
Promote the Python/cockpit ensemble into the live engine (the deferred Phase-1 native piece).
New:
crates/strategy-ensemble/— loadsskills/ensemble.json+ the per-skill specs, blends target portfolios by regime confidence, defers torisk-engineas the sole gate.- Wire into
crates/agent-runtimebehind a config flag (strategy.mode = "ensemble"). apps/guardrail-api/ensemble/live— the live blended book + per-skill attribution (the existing/ensembleroute from batch-39 stays as the static view).crates/backtester— ensemble-vs-single comparison run.
Prize fit: Track 2 (ties the 6 skills into one live strategy).
Track D — Strategy marketplace + dynamic skill loader
Make skills first-class, discoverable, and runnable end-to-end.
New:
crates/skill-loader/— parseskills/*/strategy_spec.yamlat runtime into a typed registry; validate against the same contractpython-lab/guardrail_lab/skill.pyenforces.apps/guardrail-api—/skills/{id}(detail) and/skills/{id}/backtest?preset=(run).dashboard/src/app/skills/— a marketplace page (cards, regime routing, "backtest this skill").clients/web-lite— a richer Skills tab driven by the loader.
Prize fit: Track 2 (reusability + a real catalog/runner).
Track E — Proof explorer + independent verifier UI
Surface the BNB identity/proof so judges can verify it themselves.
New:
apps/guardrail-api/src/proof_verify.rs—GET /proof/verifyrecomputes the sha256 policy/report hashes and checks the contract + BscScan URLs server-side.dashboard/src/app/proof/— deepen into a proof explorer: identity, ERC-8004/8183 records, hash recomputation status, BscScan/BscTrace deep links.- Reuse
clients/proof-verifierlogic; optional WASM verifier widget.
Prize fit: BNB SDK ($2k) — "identity is verifiable, not cosmetic."
Track F — Control & growth services
New top-level services/ tree (out-of-process, read-only, offline-safe):
services/control-bot/— a stdlib Telegram/Discord bot exposing read-only commands (/status,/regime,/journal,/verify) over the API; never signs.services/gateway/— a tiny edge (rate-limit + CORS + caching) fronting the API for public dashboard access.services/report-publisher/— renders the daily signed report bundle (reuses the python-lab report bundler) and writes it to a publishedreports/dir.
Prize fit: operational maturity; CMC Agent Hub (bot is another MCP/agent surface).
Track G — Close the last plan.md gap + data pipeline
python-lab/notebooks/— the 6 planned notebooks (01_universe_filtering…06_submission_charts) that load the event log and render the analyses (closes the one structural gap fromplan.md).crates/market-datacompaniondata/snapshots/ingestion:apps/guardrail-agentpersists periodic market snapshots so the analytics have real history to chart.
Build order & conflict-safety
- G (notebooks) + C (ensemble crate) + D (skill-loader crate) — new files/crates, no collisions. New crates register via the workspace members glob.
- A (event-bus + SSE) + E (proof_verify) — additive API modules + new crate.
- B (WASM) + dashboard pages for C/D/E — dashboard is single-owner per batch.
- F (services/) — entirely new top-level tree.
Each batch: disjoint dirs, one owner per shared file (server.rs, Cargo.toml,
dashboard layout), build green + clippy clean, then commit + push (Vercel
auto-deploys the dashboard). Parallelize across different crates/apps via
subagents; serialize anything that edits the same file.
Definition of done (per track)
- Builds green (
cargo build+cargo clippy -D warnings;tsc --noEmitfor dashboard). - Runs offline (mock/paper; no keys, no network required to demo).
- Pushed to
github.com/caelum0x/guardrail; dashboard live on Vercel. - Mapped in
docs/PRIZE_MAP.md/docs/WHATS_NEW.md.