# Ibrahim Ulukaya - Canonical AI & Firebase Developer Site > Developer Relations Manager & Engineering Lead for Firebase for Builders at Google. > Canonical home for AI tokenomics, brownfield modernization, and full-stack cloud architectures. ## Core Engineering Principles 1. Never expose a model endpoint to the open internet: every model call goes through a gateway that checks who is asking (Firebase App Check in front of Cloud Run) before it spends anything. 2. Treat tokens like memory: budget the context, route cheap work to cheap models, and put a spend cap and a circuit breaker in front of the meter before adding concurrency. 3. Wrap the old system instead of rewriting it: add AI as a sidecar next to the existing service and move traffic over one route at a time, on the same Firebase App Hosting, Cloud Run, and Firestore stack recommended to builders. ## Canonical Technical Articles - [The Crutch vs. the Operating System: Why I Deleted 4,000 Lines of Agent Prompts](https://ulukaya.dev/posts/the-crutch-vs-the-operating-system): Coding agents at 72.8% on SWE-Bench drop to 25% on multi-file repos. I replaced 4000 lines of markdown prompts with a 45-line AST gate in the commit hook. - [Your #1 Arena Model Fails in Real Repositories: The Leaderboard Mirage](https://ulukaya.dev/posts/leaderboard-mirage-llm-ranking-traps): The #1 leaderboard model failed 34% of my edge cases. Leaderboards rank single turns and my agents run 30 to 60, so I put compiler gates in the commit loop. - [Code Over Context: Why Written Agent Skills Break in Production](https://ulukaya.dev/posts/code-over-context): 10 markdown skill files cost my agent 22,000 tokens per turn and broke on smaller models at turn 4. I distill written skills into deterministic code tools. - [The Hybrid AI Standard: Routing Between On-Device AI and Cloud Run](https://ulukaya.dev/posts/the-hybrid-ai-standard): Cloud added 300 ms a prompt; on-device froze my app for 2.5 seconds. I route Gemini Nano and Gemini 3.1 Pro with Firebase AI Logic, App Check, and Cloud Run. - [Static Docs Blindfold Your Agent: The 4-Plane Verification Fix](https://ulukaya.dev/posts/ai-agent-document-myopia-trap): My agent read one Google Doc and reported a migration my team abandoned two weeks earlier. I make it check 4 planes, with live state on Cloud Run and Firestore. - [Dropped Tokens: Fixing Multi-Turn Agent Streams That Die Mid-Flight](https://ulukaya.dev/posts/the-leaky-abstraction-vol2): Multi-turn agent streams die on disconnects and buffer drops. Idempotent reassembly on Cloud Run brings them back intact. Part 2 of The Leaky Abstraction. - [Two Writers, One Index: How Static Files Corrupt Agent Memory](https://ulukaya.dev/posts/ai-agent-split-brain-trap): Two subagents wrote one record and the second write erased the first 80 ms later. I replaced my markdown summary index with Firestore transactions on Cloud Run. - [The Leaky Abstraction: Why GenAI Streaming Breaks Your JSON](https://ulukaya.dev/posts/the-leaky-abstraction-vol1): A TCP chunk split a 4-byte emoji in my LLM stream and the UI showed a U+FFFD diamond. I built a stateful Node.js reassembler that buffers partial UTF-8 bytes. - [When the Browser Hangs Up: Client-Side Defense for Agent Streams](https://ulukaya.dev/posts/client-runtime-agent-resilience): Pushing 200 tokens a second into React state cut my UI to 8 FPS. Part 3 of The Leaky Abstraction defends the client edge with Firebase AI Logic and Cloud Run. - [Why Your AI Agent Agrees With Everything: 10 Production Failure Modes](https://ulukaya.dev/posts/ten-cognitive-biases-ai-agents): My review agent approved a regex, then reversed itself when I asked the opposite question. I map the 10 biases behind that and one platform primitive per bias. - [Why a $50 Cloud Spend Cap Won't Save You From an Agent Loop](https://ulukaya.dev/posts/cloud-spend-caps-firebase): A runaway loop burned $412.00 past my $50.00 cap before billing tripped. Google Cloud spend caps guard the account, not the session; I built a 3-layer defense. - [11 Rules of AI Tokenomics: From Prompt Hygiene to Hard Caps](https://ulukaya.dev/posts/eleven-principles-of-ai-tokenomics): 78% of my inference bill was repeated prompts and unpruned history. The 11 Principles of AI Tokenomics cover development; I add the guards live runtimes need. - [Stop Sending Every Agent Turn to the Frontier Model](https://ulukaya.dev/posts/stop-sending-every-agent-turn-to-the-frontier-model): Most of an agent's 30 to 60 turns read a file or run a test. I default them to a Workhorse tier model and escalate to the Frontier tier on four signals. - [When the AST Hook Goes Green and the Test Still Fails: The Behavior Gate](https://ulukaya.dev/posts/the-behavior-gate): An AST hook can be gamed. This second pre-commit hook locks each baseline test by hash, runs it against staged code, and rejects the commit on a failure. - [Your AI Says the Bug Is Fixed, but the Test Never Failed: Two Checks Before It Ships](https://ulukaya.dev/posts/the-repro-fence): Two pre-commit rules for coding agents: R1 rejects a reproducer that exits 0 before the fix, R2 rejects a public signature that changed since HEAD. Stdlib only. ## Interactive Labs (Embedded in Essays) - [Broken emoji in your chat UI](https://ulukaya.dev/posts/the-leaky-abstraction-vol1#lab-stream-tear): Type your own text, shrink the chunk size, and watch multibyte characters tear at a chunk boundary, then heal with streaming decode. - [Stream drops on the subway](https://ulukaya.dev/posts/the-leaky-abstraction-vol2#lab-chunk-drop): Cut the connection mid-reply and count the tokens that come back doubled or never come back, then resume from the last event id. - [Two agents edit one file](https://ulukaya.dev/posts/ai-agent-split-brain-trap#lab-split-brain): Run parallel agents against one shared index file and count the writes that quietly overwrite each other, then compare an atomic store. - [Stale-Document Triangulation Probe](https://ulukaya.dev/posts/ai-agent-document-myopia-trap#lab-doc-triangulation): Feed an agent a point-in-time document against live entity state and watch static truth drift while the 4-plane probe stays current. - [Model thinks, proxy hangs up](https://ulukaya.dev/posts/client-runtime-agent-resilience#lab-idle-timeout): Let the model think in silence past a proxy idle timeout and count the seconds of dead air before the connection dies, then turn keep-alive on. - [The bill after a retry storm](https://ulukaya.dev/posts/cloud-spend-caps-firebase#lab-billing-lag): Run an agent loop all night against a $50 cap and read the invoice line that shows how many dollars landed after the cap fired. - [False-Validation Echo Chamber](https://ulukaya.dev/posts/ten-cognitive-biases-ai-agents#lab-sycophancy-loop): Ask an agreeable agent to verify its own work and watch algorithmic sycophancy compound - then break the loop with adversarial cross-examination. - [On-Device vs Cloud Routing Sandbox](https://ulukaya.dev/posts/the-hybrid-ai-standard#lab-hybrid-router): Route live prompts across the four pillars and a Cloud Run fallback and watch latency, cost, and privacy flip per scenario. - [Prompt-Loop Circuit Breaker](https://ulukaya.dev/posts/eleven-principles-of-ai-tokenomics#lab-tokenomics-guard): Discipline alone cannot stop an autonomous loop: fire unbounded tool retries at a budget and watch the idempotency guard trip before the bill does. - [Skill Distillation Simulator](https://ulukaya.dev/posts/code-over-context#lab-skill-distill): Compare prompt-heavy skills against distilled code-first tools across token cost, latency, and model tiers. - [The Crutch vs. Operating System Trajectory Simulator](https://ulukaya.dev/posts/the-crutch-vs-the-operating-system#lab-crutch-vs-os): Simulate a 21-file multi-turn repository evolution across 1 to 40 turns. Compare Prompt Scaffolding (70% KV-cache fracture, 13.8% reward hacking) against an AST Pre-Commit Verification Harness. - [Leaderboard Mirage & Static Overfitting Simulator](https://ulukaya.dev/posts/leaderboard-mirage-llm-ranking-traps#lab-leaderboard-mirage): Adjust benchmark contamination rate (0% to 60%) and AST variable perturbation to watch static leaderboard scores diverge from real production pass rates. - [Frontier vs Workhorse Routing Cost Engine](https://ulukaya.dev/posts/stop-sending-every-agent-turn-to-the-frontier-model#lab-tokenomics-arbitrage): Compare three ways to run one agent trajectory at published per-token list prices: every turn on the Frontier tier, every turn on the Workhorse tier, or a router that keeps the Workhorse tier by default and escalates a chosen share of turns. Pick a model per tier from three vendors or type custom rates, then move prompt size, KV-cache hit rate, turn count, and escalation share. - [Biomorphic Reflex Router (64-Neuron LIF Connectome)](https://ulukaya.dev/posts/the-hybrid-ai-standard#lab-biomorphic-reflex): Wire a 64-neuron Drosophila sensorimotor LIF spiking circuit (1,000 Hz, dt=1.0ms) to a Shannon surprise H(t) gate that escalates to on-device Chrome Built-in AI, with a deterministic local fallback and zero network hops. - [Coupled Rigid-Body RK4 Physics vs. Control Barrier Harness](https://ulukaya.dev/posts/the-crutch-vs-the-operating-system#lab-mujoco-harness): Run a 240 Hz coupled rigid-body robotic arm under unverified LLM torque spikes vs a deterministic Control Barrier Function (CBF) safety clamp. - [WebGPU KV-Cache Attention Thermal Profiler](https://ulukaya.dev/posts/eleven-principles-of-ai-tokenomics#lab-webgpu-kv-thermal): Probe hardware WebGPU adapters, visualize O(N²) causal attention thermal saturation, and run live AST DAG context pruning to snap TTFT back under 200ms. - [32-Neuron Fly Reflex Circuit vs. LLM Traffic Intersection](https://ulukaya.dev/posts/the-hybrid-ai-standard#lab-fly-traffic-intersection): Pit a 32-neuron LIF spiking circuit driven by 7-ray LIDAR raycasting (0.4ms reflex) against a 450ms cloud LLM agent car in a chaotic 4-way city intersection. - [AI Interrogation Room & Live Logprob Polygraph](https://ulukaya.dev/posts/ten-cognitive-biases-ai-agents#lab-logprob-polygraph): Cross-examine a suspect model under a real HALT Shannon token-entropy needle that flashes red on the exact token where bluffing begins. - [Self-Rewriting DOM Virus & Verlet Physics Sandbox](https://ulukaya.dev/posts/the-crutch-vs-the-operating-system#lab-dom-virus-sandbox): Unleash a payload that tears DOM cards loose under a 60 FPS Verlet gravity solver until they are sealed inside a JS Proxy & MutationObserver capability firewall. - [Lord of the Flies: 10-Agent Council Table ($1,000 Treasury)](https://ulukaya.dev/posts/ai-agent-split-brain-trap#lab-lord-of-flies-economy): Watch 10 council agents hold a survival vote every 5 seconds: unverified rounds drain $65 from the $1,000 shared treasury and banish the highest-suspicion agent until proof-enforced consensus is toggled on. - [Memory-Safety Territory Automaton (2,304 Cells)](https://ulukaya.dev/posts/client-runtime-agent-resilience#lab-wasm-gladiator-pit): Run a 60 FPS cellular automaton over a 64x36 Uint8Array grid where bounds-checked memory-safe territory fights unchecked mutating territory, and toggle a bounds-check shield to flip containment. - [On-device vs cloud: where the milliseconds go](https://ulukaya.dev/posts/the-hybrid-ai-standard#lab-webcam-latency): Start your camera, grab one frame, and time each leg yourself: frame grab, JPEG encode, an on-device caption if your browser has a local model, and a same-size upload round trip to this server. Frames never leave the device. ## Interactive Utilities & Curated References - [Technical Essays Index](https://ulukaya.dev/posts): Canonical index of all technical articles, architecture breakdowns, and engineering essays. - [Interactive Developer Tools Hub](https://ulukaya.dev/tools): Canonical hub for open-source, client-side engineering tools. - [AI Tokenomics Solvency Calculator](https://ulukaya.dev/calculator): Interactive live token burn and Cloud Billing spend cap solvency estimator covering Google Gemini 3.7 Flash, Gemini 3.x models, Thinking Mode variants, Eleven Principles architecture blends, and active August 2026 reference models (OpenAI o3-mini, OpenAI o1, Claude Sonnet 5, Claude Opus 5). - [noVibes Agent Spec Generator](https://ulukaya.dev/spec-generator): Deterministic architectural specification builder scaffolding repository-native agents/spec/ trees for production Cloud Run, Firestore, and App Check sidecars. - [Notes](https://ulukaya.dev/til): Short engineering notes from production work on Firebase and Google Cloud: one gotcha, one fix, and the code that applies it. - [Production AI Architecture Blueprints](https://ulukaya.dev/blueprints): Visual reference architectures and trade-off matrices for 3-Layer Tokenomics, Strangler Fig sidecars, and Zero-Backend Mobile AI. - [About Ibrahim Ulukaya](https://ulukaya.dev/about): Who runs this site, why it exists, three engineering principles, and how to get in touch. ## Syndication & Feeds - RSS Feed: https://ulukaya.dev/rss.xml - Podcast RSS Feed (Podcasting 2.0): https://ulukaya.dev/podcast.xml - XML Sitemap: https://ulukaya.dev/sitemap.xml - LinkedIn: https://www.linkedin.com/in/ibrahi/ - X: https://x.com/iulukaya - GitHub: https://github.com/ulukaya