Skip to content

KB / framework

AI Agent & Programmatic Access

Last verified

The platform exposes the same signal intelligence three ways — a versioned JSON REST API, a Model Context Protocol (MCP) server, and a Server-Sent Events (SSE) push stream. Every surface returns the same numbers from the same in-process helpers, so an agent reading /signals/latest, calling the MCP market_pulse tool, and watching the SSE stream cannot see the dashboard drift from itself.

Your environment

Three ways to consume

REST JSON API. 104 routes under /api/v1/.... Public read routes (signals, alerts, reports, agents) are unauthenticated; trading routes require a Bearer token; FinRep-AI + ai-brief routes require an internal token. Versioned; pinned via schema_version on every typed surface. → details below and per-route articles at /kb/api.

MCP server. 9 tools at https://bigclawd.com/mcp — 6 public (no auth), 3 trading (Bearer token in Authorization). Suitable for Claude Desktop, Claude Code, Cursor, and any other MCP-aware client. Each tool wraps a curated cluster of REST routes into one round-trip. → details at /kb/mcp and the per-tool articles.

SSE event stream. GET /api/v1/agents/stream opens a persistent connection. Emits a snapshot event on connect, then regime_change, critical_fired, critical_resolved events as they happen, plus a heartbeat every ~30s of silence. Use instead of busy-looping /agents/pulse when you want push notification of regime flips and critical alerts. → details at /kb/api.

Authentication

Four tiers. The header / posture each surface requires:

Auth tiers — pick the right one before you call

Public no header Most read routes (/signals/*, /alerts/*, /reports/*, /agents/pulse, /agents/position-read, /agents/stream, /trading public quotes + chains + tickers + market/status). 60 req/min per IP.
Bearer token Authorization: Bearer <token> Trading agent routes (/api/v1/trading/account, /positions, /trades, /trades/options, /history, /trades/pending, /limits). 120 req/min per token. Obtained from the operator out-of-band.
Admin token Authorization: Bearer <admin-token> Operator endpoints (/admin/* + /api/v1/trading/admin/* — account CRUD, history, snapshots, equity-curve, recent-trades, alerts config, webhooks). Unthrottled.
X-Internal-Token X-Internal-Token: <token> 18 FinRep-AI + ai-brief routes that burn Anthropic credit or expose brief content. Default-deny when the env var is unset. Source: app/internal_auth.py.

The X-Internal-Token tier is what gates /finrep-ai/*, /ai-brief/*, brief calibration + drift + datapoints + pack-stats + calendar-lookahead, and the FinRep-AI usage ledger. Public clients without the header get 401; misconfigured deployments (env var unset on the backend) return 503 with a CRITICAL server-side log. Per Law 8 ground-truth: 18 routes total carry this gate. The catalog generator excludes them from the public per-route articles, so they only surface here.

Common queries — worked examples

Start every session with /agents/pulse. Drill into the typed shape when you need it.

Start-of-session pulse check

One round-trip; same helpers as the rendered report.

curl -s https://bigclawd.com/api/v1/agents/pulse

Returns {schema_version, generated_at, age_seconds, regime, health_score, headline, summary, what_changed, active_alerts: {count, by_severity, top: [...]}, key_numbers: {...}}. Mirrors /signals/latest so the agent narrative cannot drift from the dashboard. → details at /kb/api/get-agents-pulse.

The MCP equivalent is the market_pulse tool — same payload, slightly trimmed for token economy. → /kb/mcp/market-pulse.

Full signal snapshot

curl -s https://bigclawd.com/api/v1/signals/latest

Carries schema_version: "2027.01" and ~40 typed sub-objects (positioning, correlations, energy, inflation, volatility, zero_dte, gamma_levels, alignment, freshness, rotation, …). Pin on schema_version if your code depends on the shape. The legacy ?flat=* shim returns HTTP 410 Gone — read the typed sub-objects, not the flat duplicates (Law 5).

Event feed — transition stream

curl -N https://bigclawd.com/api/v1/agents/stream

-N disables curl’s output buffering so the SSE frames arrive as they fire. Use this instead of polling /agents/pulse every 5 seconds — the server polls every 5s internally and pushes the deltas. Heartbeat every ~30s tells you the connection is alive. → details at /kb/api/get-agents-stream.

Historical pattern match — “when has this happened before?”

curl -s 'https://bigclawd.com/api/v1/signals/base-rates?mode=hybrid&top_k=100'

Matches today’s 15-numeric + 3-categorical signal vector against history. Returns forward 1d/3d/5d SPY return distribution with bootstrap CIs across the top-K analogues. Pin on matcher_version (currently "2026.05.9-hybrid-15d-recency730"). Defaults to mode=soft; pass mode=hybrid to opt into the tag-prefilter + Euclidean dispatch — per DOCTRINE P0 the response surfaces hybrid_fallback=true when the filter under-shoots 30 analogues and the matcher fell back to unfiltered Euclidean. → matcher details at /kb/framework/hybrid-matcher. MCP equivalent: /kb/mcp/compare-to-history.

Position-read — filter dashboard noise to your book

curl -s 'https://bigclawd.com/api/v1/agents/position-read?symbol=SPY&side=long&type=call&expiry=2026-06-21&strike=560'

Returns only the signal categories, active alerts, regime factors, and alignments that materially affect that specific position. Use when you’re holding ten positions and don’t want to re-derive relevance for each from the full snapshot. → details at /kb/api/get-agents-position-read.

REST API surface

104 routes across four files. Each row links into the per-endpoint article at /kb/api/<slug> (where the catalog generator has built one). Counts per group:

GroupCountWhere they liveAuth
Agents (pulse, stream, position-read)3app/signals/routes.pyPublic
Signals (latest, score, history, alignment, base-rates, …)~25app/signals/routes.pyPublic
Alerts (active, today, summary, history, check, …)5app/signals/routes.pyPublic
Reports (latest, by filename, week)4app/main.pyPublic
Trading public (quote, quotes, options/chain, tickers, market/status, limits)6app/trading/routes.py + options_routes.pyPublic
Trading agent (account, positions, trades, history, pending)8app/trading/routes.py + options_routes.pyBearer
Trading admin (accounts, reset, history, events, snapshots, equity-curve, recent-trades)10app/trading/routes.pyAdmin Bearer
Admin alerts + webhooks (CRUD + evaluate + test)12app/signals/routes.pyAdmin
FinRep-AI + ai-brief (analyze, usage, latest, history, accuracy, by-id, sentiment-sparkline, calibration-by-sentiment, calibration-by-facet, calibration-drift, pack-delta, pack-stats, datapoints, datapoints/paths, datapoints/summary, calendar-lookahead)18app/signals/routes.pyX-Internal-Token
Infrastructure (/health, /healthz, /metrics, /status, /source-health, …)~13app/main.pyPublic

→ Full per-route articles at /kb/api. Trading specifics are at /kb/framework/trading.

MCP surface

9 tools. The MCP transport is JSON-RPC over HTTP (no SSE); every tool is a synchronous round-trip that wraps the corresponding REST cluster.

ToolAuthWrapsKB article
market_pulsePublic/agents/pulse/kb/mcp/market-pulse
get_quotePublic/trading/quote/{symbol} + /trading/quotes/kb/mcp/get-quote
option_chainPublic/trading/options/chain/{symbol}/kb/mcp
read_reportPublic/reports/latest + /reports/{filename}/kb/mcp
analyze_signalsPublic/signals/latest + /signals/score/breakdown/kb/mcp
compare_to_historyPublicPOST /signals/base-rates/compare/kb/mcp/compare-to-history
portfolio_statusBearer/trading/account + /positions + /positions/options/kb/mcp
plan_tradeBearerPOST /trading/trades or /trades/options/kb/mcp
execute_tradeBearerPOST /trading/trades/{id}/confirm / DELETE/kb/mcp

Client config (Claude Desktop / Claude Code / Cursor):

{
  "mcpServers": {
    "bigclawd": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://bigclawd.com/mcp"]
    }
  }
}

For Bearer-gated tools, add the token to the upstream environment per your client’s docs — never embed it in the JSON checked into source. → full per-tool detail at /kb/mcp.

Trading

A fully separate agent-facing surface — paper-tracked positions in /app/data/trading.db, real Schwab prices, two-step plan-then-confirm flow with a 60-second quote window, single-execute claim via BEGIN IMMEDIATE. Account model, order shapes (stocks vs options — different endpoints!), guardrails (25% per-symbol cap, 50 trades/day, 10 option contracts/symbol/day), and admin endpoints all live at /kb/framework/trading. Read that page before sending the first POST /trades.

Alerts for agents

The platform fires 63 defined alerts when signal conditions cross threshold (see the full catalog at /kb/alerts). Agents subscribe in three ways: poll GET /alerts/active for the current state, subscribe to GET /agents/stream (SSE) for real-time regime changes + critical fires, or register an alert_fired / alert_resolved webhook via the admin endpoints. Payloads include alert_id, severity, rendered message, and the signal value that triggered the fire.

Response conventions

Rate limits and caching

Moving-window limiter; exceeded requests return 429 Too Many Requests with a Retry-After header and {error, message, retry_after} body. Back off exponentially (2s → 4s → 8s, capped at Retry-After).

Route classLimitKey
/api/v1/* (public reads)60 req/minclient IP (X-Forwarded-For / CF-Connecting-IP aware)
/api/v1/trading/*120 req/minBearer token fingerprint (sha256 prefix); falls back to IP if no token
/admin/*, /health, /metrics, /unthrottled

Cache-Control headers per path class:

Path classHeader
Archive reports (/api/v1/reports/report-YYYYMMDD-HHMMSS.md)public, max-age=86400, stale-while-revalidate=86400
Historical series (/signals/history, /signals/sparklines, /signals/regime-log, /signals/base-rates, /reports/week/*)max-age=300, stale-while-revalidate=600
Live snapshots (/signals/latest, /alerts/active, /agents/pulse, /status)max-age=30, stale-while-revalidate=60
Trading, admin, /metrics, /healthno-store

Steady pollers: cap at ≤1 req/sec per token to stay well under the 120/min trading limit with headroom for bursty confirms. Prefer /agents/stream over busy-loop polling when you need event latency.

Error semantics

Trading-specific:

Rules and limitations

Schema version reference

SurfaceConstantValue
/signals/latestSIGNALS_LATEST_SCHEMA_VERSION"2027.01"
/signals/alignmentALIGNMENT_SCHEMA_VERSION"2026.05.1"
Health score formulaSCORE_FORMULA_VERSION"2026.04.3"
Base-rate matcherMATCHER_VERSION"2026.05.9-hybrid-15d-recency730"
/ai-brief/calibration-by-sentimentAI_BRIEF_CALIBRATION_SCHEMA_VERSION"2026.05.2"
/ai-brief/calibration-by-facetAI_BRIEF_CALIBRATION_FACET_SCHEMA_VERSION"2026.05.1"
/ai-brief/accuracyAI_BRIEF_ACCURACY_SCHEMA_VERSION"2026.05.1"
/ai-brief/calibration-driftAI_BRIEF_CALIBRATION_DRIFT_SCHEMA_VERSION"2026.05.1"
/ai-brief/datapoints*AI_BRIEF_DATAPOINTS_SCHEMA_VERSION"2026.05.2"
/ai-brief/sentiment-sparkline(inline)"2026.05.2"
/ai-brief/pack-deltaAI_BRIEF_PACK_DELTA_SCHEMA_VERSION"2026.05.1"
/ai-brief/pack-statsAI_BRIEF_PACK_STATS_SCHEMA_VERSION"2026.05"
/ai-brief/calendar-lookaheadAI_BRIEF_CALENDAR_LOOKAHEAD_SCHEMA_VERSION"2026.05"
AI brief signal pack(inline)"2026.05.4"

Pin on these. Bumps are loud — every new shape adds an integer / dot-segment, never silently mutates an existing one.

See also