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. 11 tools at https://bigclawd.com/mcp β€” 8 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

Publicno headerMost 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 tokenAuthorization: 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 tokenAuthorization: Bearer <admin-token>Operator endpoints (/admin/* + /api/v1/trading/admin/* β€” account CRUD, history, snapshots, equity-curve, recent-trades, alerts config, webhooks). Unthrottled.
X-Internal-TokenX-Internal-Token: <token>40+ routes gated this way platform-wide β€” FinRep-AI + ai-brief + AI-1/AI-2 (the bulk, in app/signals/ai_brief_routes.py), plus the signals admin/tripwires + grader routes, company pin/unpin/drawdown/direction/brief, and screener promote/drift/hedge-candidates. 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/*, /ai1/*, /ai2/* (except the two deliberate public exceptions, /ai2/verdict and /ai2/history), brief calibration + drift + datapoints + pack-stats + calendar-lookahead, and the FinRep-AI usage ledger, plus a handful of internal-token routes on the company/screener surfaces. Public clients without the header get 401; misconfigured deployments (env var unset on the backend) return 503 with a CRITICAL server-side log. The count churns as the platform grows β€” CLAUDE.md’s route-decorator inventory is the live source of truth (42 as of this writing); treat β€œ40+” here as a floor, not a ceiling. 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.28" and ~40 typed sub-objects (positioning, correlations, energy, inflation, volatility, zero_dte, gamma_levels, dealer_gamma, 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 13-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 the response payload’s own matcher_version field β€” read it fresh each call rather than hardcoding a copy here; it churns whenever the matcher’s dims, weights, or gates change (see CLAUDE.md’s Historical Base Rate Engine section for the bump policy). 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

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

Group Count Where they live Auth
Agents (pulse, stream, position-read) 3 app/signals/routes.py Public
Signals (latest, score, history, alignment, base-rates, …) ~25 app/signals/routes.py Public
Alerts (active, today, summary, history, check, …) 5 app/signals/routes.py Public
Reports (latest, by filename, week) 4 app/main.py Public
Trading public (quote, quotes, options/chain, tickers, market/status, limits) 6 app/trading/routes.py + options_routes.py Public
Trading agent (account, positions, trades, history, pending) 8 app/trading/routes.py + options_routes.py Bearer
Trading admin (accounts, reset, history, events, snapshots, equity-curve, recent-trades) 10 app/trading/routes.py Admin Bearer
Admin alerts + webhooks (CRUD + evaluate + test) 12 app/signals/routes.py Admin
FinRep-AI + ai-brief + AI-1/AI-2 (analyze, usage, brief latest/history/by-id/accuracy/stance-tally, brief calibration Γ—3 + drift, datapoints Γ—3, pack-delta, pack-stats, calendar-lookahead, AI-1 raw-analysis read, AI-2 compare + 5 standing graders + memory Γ—2) 26 app/signals/ai_brief_routes.py (the FR-008 extraction, folded back into the signals router) X-Internal-Token
Infrastructure (/health, /healthz, /metrics, /status, /source-health, …) ~13 app/main.py Public

β†’ Full per-route articles at /kb/api. Trading specifics are at /kb/framework/trading.

MCP surface

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

Tool Auth Wraps KB article
market_pulse Public /agents/pulse /kb/mcp/market-pulse
get_quote Public /trading/quote/{symbol} + /trading/quotes /kb/mcp/get-quote
option_chain Public /trading/options/chain/{symbol} /kb/mcp
read_report Public /reports/latest + /reports/{filename} /kb/mcp
analyze_signals Public /signals/latest + /signals/score/breakdown /kb/mcp
compare_to_history Public POST /signals/base-rates/compare /kb/mcp/compare-to-history
screener_board Public /screener/company-action-board + /screener/candidates + /screener/board-track-record /kb/mcp/screener-board
ai_brief Public /ai2/verdict + /ai2/history /kb/mcp/ai-brief
portfolio_status Bearer /trading/account + /positions + /positions/options /kb/mcp
plan_trade Bearer POST /trading/trades or /trades/options /kb/mcp
execute_trade Bearer POST /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 brokerage market 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 (non-binding by default β€” cash is the real cap; read GET /trading/limits for the live values), 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 class Limit Key
/api/v1/* (public reads) 60 req/min client IP (X-Forwarded-For / CF-Connecting-IP aware)
/api/v1/trading/* 120 req/min Bearer token fingerprint (sha256 prefix); falls back to IP if no token
/admin/*, /health, /metrics, / unthrottled β€”

Cache-Control headers per path class:

Path class Header
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, /health no-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

Surface Constant Value
/signals/latest SIGNALS_LATEST_SCHEMA_VERSION "2027.28"
/signals/alignment ALIGNMENT_SCHEMA_VERSION "2026.07"
Health score formula SCORE_FORMULA_VERSION "2026.04.3"
Base-rate matcher MATCHER_VERSION see the live matcher_version field on the /api/v1/signals/base-rates payload β€” the string churns with matcher tuning, so this table points at the field rather than caching its value
/ai-brief/calibration-by-sentiment AI_BRIEF_CALIBRATION_SCHEMA_VERSION "2026.05.2"
/ai-brief/calibration-by-facet AI_BRIEF_CALIBRATION_FACET_SCHEMA_VERSION "2026.05.1"
/ai-brief/accuracy AI_BRIEF_ACCURACY_SCHEMA_VERSION "2026.05.1"
/ai-brief/calibration-drift AI_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-delta AI_BRIEF_PACK_DELTA_SCHEMA_VERSION "2026.05.1"
/ai-brief/pack-stats AI_BRIEF_PACK_STATS_SCHEMA_VERSION "2026.05"
/ai-brief/calendar-lookahead AI_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