CRUCIBLE
VENDOR-NEUTRAL AI ARCHITECTURE · CLAUDE · OPENAI · GEMINI · VLLM · FREE KV-CACHE & WIRE LAB

AI, LLM & MCP Primitives Master Lab

Master the 7 physical and protocol primitives that govern every frontier model on earth — KV-cache silicon math, programmatic policy hooks, raw MCP JSON-RPC 2.0 with recoverable isError, zero-leak Hybrid RAG, and crash-safe multi-agent state machines.

01 · SEVEN UNIVERSAL AI & MCP PRIMITIVES (CLAUDE · OPENAI · GEMINI · VLLM)VENDOR-AGNOSTIC ARCHITECTURE
PRIMITIVE 01 · PREFILL = COMPUTE-BOUND · DECODE = HBM BANDWIDTH-BOUND

Wire & KV-Cache Silicon Math

Open Blueprint
PHYSICAL & PROTOCOL INVARIANTEvery transformer allocates KV-cache proportional to 2 × Layers × KV_Heads × Head_Dim × Seq_Len × Batch × Bytes. Prefix caching cuts TTFT & input cost by 70–90% when system prompts + tool schemas stay byte-stable.
ANTHROPIC / CLAUDE
Anthropic Prompt Caching (`cache_control: ephemeral`)
OPENAI / GPT
Automatic Prompt Caching (1024+ token prefix)
GOOGLE GEMINI
Vertex / Gemini Context Caching (`cachedContent`)
OPEN-WEIGHT / VLLM
vLLM PagedAttention + Automatic Prefix Caching (`--enable-prefix-caching`)
02 · LIVE KV-CACHE VRAM & FINOPS CALCULATORH100 80GB ROOFLINE
WEIGHTS + KV TOTAL
90.0 GiB
70.0 GiB weights + 20.0 GiB KV
MIN H100 80GB GPUS
2× H100
1.25 GiB KV per request
DECODE ROOFLINE
64 tok/s
HBM 3.35 TB/s bandwidth bound
FINOPS CACHE SAVINGS
$7,301/mo
Effective spend: $7,099/mo
03 · UNIVERSAL TOOL-USE & MCP WIRE INSPECTOR
{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "tools/call",
  "params": {
    "name": "issue_refund",
    "arguments": { "order_id": "ord_991", "amount_usd": 650 }
  }
}
// Recoverable tool-level policy block (model reads & adapts):
{
  "jsonrpc": "2.0",
  "id": 42,
  "result": {
    "isError": true,
    "content": [{ "type": "text", "text": "POLICY_HOLD: refunds > $500 require manager approval token" }]
  }
}
Notice the isomorphism: every provider simply wraps a JSON function call + structured result. Put your business logic behind one MCP server + programmatic policy hook and swap model providers with 1 config flag.
04 · FIVE LIVE BREAK-FIX AI & MCP LABS (GRADED IN-BROWSER)AST-SANDBOXED PYTHON VERIFIER
M09 · PYTHON COLD DRILL · PYODIDE WASM SANDBOXKV-Cache VRAM & Max Concurrency Sizing (Silicon Math)

Implement `estimate_kv_cache_gb(layers: int, kv_heads: int, head_dim: int, seq_len: int, batch_size: int, dtype_bytes: int = 2) -> float` computing exact KV-cache memory in GiB (`2 * layers * kv_heads * head_dim * seq_len * batch_size * dtype_bytes / (1024 ** 3)` rounded to 4 decimals) AND `max_batch_for_vram(free_vram_gb: float, per_req_kv_gb: float) -> int` returning floor concurrency (>= 0).

solution.py · ⌘+ENTER TO RUN
VERIFIER OUTPUT
Write your solution cold in the left buffer and click “Run Automated Verifier” (or press ⌘+Enter). Python drills execute locally in an isolated WebAssembly CPython 3.12 Web Worker with zero server round-trip. Passing persists Stage 03 completion automatically.