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
- Base URL:
https://bigclawd.com— versioned routes live under/api/v1/... - Timezone: Eastern Time (ET). Every persisted and emitted timestamp is ET ISO 8601 with explicit offset (Law 1).
- Asset universe: any symbol available through Charles Schwab — stocks, ETFs, options.
/api/v1/trading/tickersreturns a curated S&P 500 + ETF reference list. - Market hours: Monday–Friday, 09:30–16:00 ET. Public read routes serve 24/7; trading routes enforce the clock at both initiation and confirmation. Full release / cycle / lifecycle posture lives at
/kb/operations/schedule.
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
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:
| 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 (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) | 18 | app/signals/routes.py | 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
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.
| 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 |
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 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
schema_versionpinning. Every typed surface emits aschema_versionconstant (/signals/latest→"2027.01";/signals/alignment→"2026.05.1"; per-route versions on the calibration / drift / datapoints surfaces). Bumped on breaking shape changes; pin on it if your code reads the typed objects.- Law 1 timestamps. Every persisted and emitted timestamp is ET ISO 8601 with explicit offset (
"2026-05-04T14:30:00-04:00"). Round-trips throughdatetime.fromisoformat(). Display layers emit ET — they never need to convert. - Law 5 typed sub-objects. Group-related signals live under typed paths (
energy,inflation,volatility,correlations,gamma_levels,zero_dte,alignment,positioning,freshness,rotation). The flatsignalsdict prunes anything that has a typed home.?flat=*returns HTTP 410 — no escape hatch. - Freshness classes. Every metric carries a publish-cadence tag:
intraday,prior_close,weekly,monthly,quarterly,ad_hoc. Plus a staleness layer withmax_age,age_seconds,status∈ stale. Read both before trusting a value — see the per-metricfreshnesssub-object on/signals/latest. - Empty data is loud. Sparse windows on the brief calibration / drift / datapoints surfaces return HTTP 200 with explicit zero counts and a
_legacy_rows_skipped/unmatured_briefsfield rather than 404 (DOCTRINE P0 — never silently drop, never mask coverage gaps).
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
- 401 — missing or invalid auth. Bearer absent / wrong token. For
X-Internal-Token, the header didn’t match; forAuthorization: Bearer, the trading token didn’t match. Don’t retry; fix credentials. - 403 — auth present but wrong tier (e.g. agent Bearer hitting an admin route). Don’t retry.
- 410 Gone —
?flat=*on/signals/latest. Read the typed sub-objects instead. No escape hatch. - 429 — rate limited. Back off per
Retry-After. Exponential retry (capped atRetry-After); never tight-loop. - 503 — backend not ready or
X-Internal-Tokenenv var unset (default-deny on internal routes). Retry after a few seconds; check/healthto see if the backend is up.
Trading-specific:
- 400 with
detaildict onPOST /trades/options—expired_expiration/non_trading_day/no_market/contract_not_found. Parse the dict; don’t string-match the message. - 400 on confirm — status was already
executing/executed/cancelled. Concurrent confirms hit a single-claim guard; only the first request proceeds. - Market closed on
POST /trades*andPOST /trades/{id}/confirm— check/trading/market/statusbefore the call.
Rules and limitations
- Law 3 — one canonical name per concept. “GEX” specifically means SqueezMetrics aggregate dealer gamma. The Schwab per-strike profile is “Gamma Walls” (
gamma_levels). The per-tickergamma × OIproxy is “γ-Sent / Gamma Skew” — never call it GEX. news_sentimentalignment category is flag-gated. 11 categories ship by default; the 12th (news_sentiment) is gated behindENABLE_AI_SENTIMENT_ALIGNMENT. Default off — the alignment response is the 11-category shape until the calibration gate flips it on.- No SSE in MCP transport. MCP is request/response over JSON-RPC; the
/agents/streampush surface lives only on the REST API. - Market-hours enforcement on trading tools.
plan_tradeandexecute_tradeenforce 09:30–16:00 ET, Monday–Friday, US-equity holiday-aware. The MCP wrappers inherit the same rejection — checkmarket_pulsefirst. - Whole shares only, long only. No fractional shares, no short selling, no naked option writing.
- 60-second confirmation window. Quote expires automatically; reset by re-planning. Confirm immediately after
plan_trade.
Schema version reference
| Surface | Constant | Value |
|---|---|---|
/signals/latest | SIGNALS_LATEST_SCHEMA_VERSION | "2027.01" |
/signals/alignment | ALIGNMENT_SCHEMA_VERSION | "2026.05.1" |
| Health score formula | SCORE_FORMULA_VERSION | "2026.04.3" |
| Base-rate matcher | MATCHER_VERSION | "2026.05.9-hybrid-15d-recency730" |
/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
/kb/framework/trading— trading-specific surface (account, orders, options, guardrails, admin)./kb/framework/hybrid-matcher— base-rate matcher modes, tag pre-filter, fallback rule./kb/framework/five-level-scale— universal signal classification (Favorable / Leaning / Neutral / Cautionary / Adverse)./kb/framework/regime-overrides— regime-conditional health-score weighting schema./kb/framework/alignment— 12-category signal-price alignment methodology./kb/indicators/health-score— 18-component composite scoring./kb/alerts— full alert catalog (63 defined)./kb/operations/schedule— cycle profiles + release calendar./kb/operations/source-health— per-source health surface./kb/api— per-route catalog (auto-generated)./kb/mcp— per-tool catalog.