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
..

Guardrail MCP Server

A pure-stdlib Model Context Protocol (MCP) server that exposes the read-only Guardrail API as MCP tools, resources and prompts. It lets other agents (CMC Agent Hub / TWAK style) consume Guardrail over MCP without any network or SDK glue of their own.

  • Transport: JSON-RPC 2.0 over stdio (line-delimited JSON).
  • Dependencies: none. Standard library only. It reuses the dependency-free Python SDK in clients/python/guardrail_client, imported via a sys.path insert.
  • Read-only: every tool and resource maps to a read-only Guardrail API route. The server never mutates agent state.
  • Capabilities: initialize advertises tools, resources and prompts.
  • Hub manifest: see manifest.json for the machine- readable catalog and ../../docs/MCP_HUB.md for hub registration instructions.

Tools

Tool Inputs Description
guardrail_health — API and database health status.
guardrail_backtest steps?, fear_greed?, preset? Strategy-vs-benchmark backtest.
guardrail_walkforward windows?, steps?, preset? Rolling walk-forward windows.
guardrail_sweep steps?, fear_greed? (int[]), preset? Sentiment comparison sweep.
guardrail_regime — Current market regime classification.
guardrail_funding — Funding rates across markets.
guardrail_compete — Competition status and standings.
guardrail_alerts — Currently evaluated alerts.
guardrail_proof — Agent identity + report proof.
guardrail_compile_policy mandate (required) Compile a natural-language mandate into a validated policy + hash.
guardrail_indicators symbol?, steps? Deterministic synthetic indicators for a symbol.
guardrail_skill — Agent skill descriptor / capability catalog.
guardrail_prizes — Hackathon prize-track catalog and mapping.
guardrail_readiness — Operational readiness probe for the agent.
guardrail_journal — Decision journal: the agent's recent event log (/events).
guardrail_scenarios — Stress-scenario catalog and each scenario's expected risk response.
guardrail_skill_catalog — List the 5 strategy skills (id, name, thesis) from skills/INDEX.json.
guardrail_ensemble_routing regime? Resolve regime-routed ensemble weights — blends the embedded per-skill weights (skills/ensemble.json) for the live /regime classification, or for a regime you pass in.

Ensemble core vs. standalone sizing. The ensemble core is the four regime-complementary skills (regime-routed alpha, funding-rate carry, mean-reversion-chop, trend-breakout-momentum) blended by guardrail_ensemble_routing. volatility-targeted-risk-parity is an additional standalone sizing strategy on a different axis (how much, not what) — it is not part of the blended ensemble weights. The full 5-skill catalog is exposed by guardrail_skill_catalog and the guardrail://skills resource.

All inputs are optional unless marked required. Each tool advertises a JSON Schema inputSchema via tools/list.

Resources

Resources expose read-only Guardrail artifacts under the guardrail:// URI scheme. resources/list advertises them; resources/read fetches the underlying API route and returns its content. When the API is unreachable, a read returns a JSON error payload as the resource content (it never crashes the transport).

URI Route Description
guardrail://compete /compete Live competition standings and status.
guardrail://regime /regime Current market regime classification.
guardrail://skill /skill Agent skill descriptor / capability catalog.
guardrail://prizes /prizes Hackathon prize-track catalog and mapping.
guardrail://readiness /readiness Operational readiness probe.
guardrail://ensemble skills/ensemble.json (file) Embedded meta-allocator weights blending the four regime-complementary ensemble-core skills by regime.
guardrail://scenarios configs/scenarios/index.json (file) Committed stress-scenario catalog with expected risk responses.
guardrail://skills skills/INDEX.json (file) Full Track-2 strategy skill catalog (5 skills): the four ensemble-core skills plus the standalone volatility-targeted-risk-parity sizing strategy.

The last three resources have no API route — they read committed artifacts off disk (anchored at the repo root; override with GUARDRAIL_REPO_ROOT). They therefore work fully offline, without the API running.

Prompts

Prompts are reusable message templates. prompts/list advertises them with typed arguments; prompts/get renders a template into MCP messages. Renderers are pure (no network), so prompts work without a live API.

Prompt Arguments Description
analyze-regime focus?, horizon? Analyze the current market regime and risk implications.
explain-decision decision?, audience? Explain an agent decision with grounded evidence.
draft-mandate objective?, risk_tolerance?, constraints? Draft a compilable Guardrail mandate.
explain-ensemble-routing regime?, audience? Explain how the regime-routed ensemble blends the strategy skills.
summarize-journal window?, focus? Summarize the decision journal (/events) into a timeline.

Running

python3 clients/mcp/run.py
# or, as a module:
python3 clients/mcp

Configure the target API base URL with an environment variable (default http://localhost:8080):

export GUARDRAIL_BASE_URL=https://your-guardrail-host
python3 clients/mcp/run.py

Quick handshake check

printf '%s\n%s\n%s\n%s\n' \
  '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' \
  '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' \
  '{"jsonrpc":"2.0","id":3,"method":"resources/list","params":{}}' \
  '{"jsonrpc":"2.0","id":4,"method":"prompts/list","params":{}}' \
  | python3 clients/mcp/run.py

This prints four JSON-RPC results: initialize advertises the tools, resources and prompts capabilities; the remaining three list the available tools, resources and prompts. The Guardrail API does not need to be running for any list call or for initialize / prompts/get — only tools/call and resources/read reach the backend.

Registering with an MCP client

The server speaks stdio, so register it as a stdio MCP server. A sample config entry lives in mcp.json:

{
  "mcpServers": {
    "guardrail": {
      "command": "python3",
      "args": ["clients/mcp/run.py"],
      "env": {
        "GUARDRAIL_BASE_URL": "http://localhost:8080"
      }
    }
  }
}

Adjust the args path to an absolute path if your MCP client does not run from the repository root.

Protocol details

  • initialize returns serverInfo ({"name": "guardrail-mcp", "version": ...}) and capabilities ({"tools": {...}, "resources": {...}, "prompts": {...}}).
  • tools/list advertises the tools above, each with a JSON-Schema inputSchema.
  • tools/call dispatches to the matching SDK method and returns the JSON result as {"content": [{"type": "text", "text": "<json>"}]}.
  • resources/list advertises the guardrail:// resources, each with a uri, name, description and mimeType.
  • resources/read fetches the underlying route and returns {"contents": [{"uri": ..., "mimeType": ..., "text": "<json>"}]}. If the API is down, the content is a JSON error payload (the transport never crashes).
  • prompts/list advertises the prompt templates and their typed arguments.
  • prompts/get renders a template into {"description": ..., "messages": [...]} using the supplied (optional) arguments.
  • On API or argument errors the server returns an MCP tool error (isError: true) with a descriptive message — it never crashes the transport.
  • Notifications (requests without an id, e.g. notifications/initialized) produce no response, per JSON-RPC 2.0.