Abstractions and Regrets

Every Abstraction I Regret

The best code I ever deleted was a utility function called format_response. It accepted a response object, a format string, a fallback value, an optional transformer function, and a boolean for whether to strip whitespace. It was used in exactly one place. I wrote it because I thought I’d need it again. I didn’t. It sat in utils.py for eight months, collecting type: ignore comments and confusing every developer who opened the file. ...

February 20, 2026 · 7 min · Muhammad Hassan Raza
Legal intake fraud scoring cover

Scoring Fraud in Legal Intake Calls

I worked on RISQ, a fraud detection system for legal intake calls. Mass tort law firms receive thousands of calls from potential claimants, and a significant percentage are fraudulent: coached callers reading from scripts, people who never actually used the drug or product in question, or repeat callers under different names. RISQ listens to these calls, scores them for authenticity, and recommends whether to transfer the caller to a closer, flag them for review, or quarantine the call. ...

February 20, 2026 · 5 min · Muhammad Hassan Raza
Multi-agent middleware illustration

Multi-Agent LLM Middleware: Lessons from Marketing Accelerant

Marketing Accelerant is an AI-powered marketing analytics platform I worked on at Entropy Labs. It runs 15+ specialized LLM agents for Brand Voice, Creative Content, CMO Strategy, SEO, Email Campaigns, Google Ads, Meta Ads, Video Studio, and more, all serving enterprise clients through a single FastAPI backend. The agents themselves aren’t the hard part. The hard part is everything around them: model selection, context management, cost control, error recovery, and human approval. This post covers the middleware architecture that makes it work in production. ...

January 10, 2026 · 7 min · Muhammad Hassan Raza
Learning Through Open Source

The Best Way to Learn a Codebase Is to Break Someone Else's

The best code I’ve ever written was shaped by code I didn’t write. Not tutorials, not books, not conference talks — other people’s production codebases, with their weird naming conventions, unexpected architectural decisions, and review comments that rewired how I think about problems. I contribute to open source projects across five languages. Not because I set out to be polyglot. Because I kept finding bugs in different ecosystems and couldn’t stop myself from tracing them to the source. Along the way, I accidentally learned more about software architecture than any course ever taught me. ...

January 8, 2026 · 7 min · Muhammad Hassan Raza
Open Source Drive-By Fixes

I Fixed a Bug in a Torrent Client I've Never Used

I fix things. Theme alignment in a torrent client I use daily. Ghost deployments in a PaaS that runs my projects. Middleware bugs in Django libraries I spotted just by reading the source code. The internet has a narrative for open source contributions: they’re career investments. “Build your personal brand.” “Get noticed by FAANG.” “Strategic contributions to high-visibility projects.” I’m not doing any of that. I just open software, see something broken, and can’t leave it alone. ...

December 10, 2025 · 4 min · Muhammad Hassan Raza
Production War Stories

I Shipped a Race Condition That Double-Charged Customers (And Other War Stories)

Nobody writes blog posts about the bugs they shipped. The internet is full of “how I built X” and suspiciously empty of “how I broke X and spent 14 hours pretending it wasn’t my fault.” Here are mine. The Race Condition: Two Cashiers, One Item This one happened in Polaris, the ERP system I built for retail businesses. Real money, real transactions, real angry shop owners. The setup: two cashiers at different terminals. Both scan the same product. Both hit “Complete Sale” within 200ms of each other. The inventory says there’s one left. ...

November 15, 2025 · 8 min · Muhammad Hassan Raza
Pyscn tree-sitter analysis cover

How Pyscn Analyzes Python with Go and tree-sitter

Pyscn is a code quality analyzer for Python built by DaisukeYoda at ludo-technologies. It finds dead code, code clones, coupling issues, and complexity hotspots. It’s written in Go, uses tree-sitter for parsing, and processes over 100,000 lines per second. I’ve been studying its internals and the engineering decisions are worth writing about: how it detects dead code through control flow analysis, finds duplicated code across clone types 1-4 with LSH acceleration, and integrates with AI coding assistants via MCP. ...

October 15, 2025 · 4 min · Muhammad Hassan Raza
LangChain production workflow diagram

LangChain in Production: What the Tutorials Don't Tell You

Every LangChain tutorial ends right where the real work begins. You see a neat 50-line script that queries a PDF, and you think, “Cool, I’ll ship this by Friday.” Three weeks later, you’re debugging memory leaks, wondering why your chain silently returns empty strings, and questioning every decision that led you here. I’ve shipped LangChain-based features to production at multiple companies. Here’s what I wish someone had told me before I started. ...

June 20, 2025 · 5 min · Muhammad Hassan Raza
FAQ bot RAG pipeline diagram

Building a Smarter FAQ Bot (with Gemini, RAG, and Structured Output)

Introduction If you’ve ever found yourself digging through product manuals, company wikis, or lengthy documents just to find a simple answer, you know the pain. The fact you’re reading this suggests you’re interested in how Generative AI can make that process less painful. Stick around for a few minutes, and I’ll walk you through how we built a smarter FAQ bot using Google’s Gemini API, Retrieval Augmented Generation (RAG), and structured output. This isn’t just another chatbot; it’s designed to give reliable, context-aware answers based only on provided information, minimizing the risk of making things up (hallucination). This example uses Google Car manuals, but the principles apply anywhere you have a set of documents you need to query effectively. I’m sharing my journey building this; it’s a practical demonstration, not a definitive guide, so adapt the ideas to your needs! ...

April 20, 2025 · 8 min · Muhammad Hassan Raza

Smart Dustbin: IoT with Arduino, Python, Kotlin & Azure

A university project where I built a garbage bin that knows how full it is and tells you about it. An ultrasonic sensor measures the fill level, an ESP8266 sends the data over WiFi, and you can monitor it from a desktop GUI or an Android app. The Hardware An Arduino Uno with an HC-SR04 ultrasonic sensor measures distance to the garbage surface. A servo motor opens the lid when someone approaches (second ultrasonic sensor detects proximity). The Arduino sends distance readings over serial to an ESP8266, which transmits them over WiFi. ...

February 16, 2025 · 3 min · Muhammad Hassan Raza