Reading tracker active
0 / 8 read
0%
← Home
Architecture Notes

Technical Writing

Notes on distributed systems, AI infrastructure, databases, and observability. Written for engineers who want depth, not surface-level takes.

Databases

1 note

Storage engines, query planners, indexing strategies, and schema evolution.

AI Infrastructure

2 notes

MLOps, vector databases, embedding pipelines, and serving large language models.

AGENT LOOPS · THE LIMIT IS THE HYPERPARAMETERSCOPEpromptnarrow the spaceRETRIEVEtop-Nno rerankerPLANdecomposesteps up frontReActstepreason · actTOOLobserveback into stateobserve → re-act, unbounded by defaultMIDDLEWARE AGENTcap 8PATH RESOLVERcap 27DEEP LOOKUPcap ~100SUMMARIZE-ON-LIMIT FALLBACKpresent in 1 of 6 agents · the other 5 return emptyBOUNDING THE LOOP IS HALF THE JOB · THE OTHER HALF IS WHAT HAPPENS AT THE CEILINGaryan.devai-infrastructure
ai-infrastructure

Nobody Tunes the Recursion Limit

Across six agents in a vulnerability scanner, the number I spent the most time on was never a model parameter. It was recursion_limit. The fallback for hitting it exists in exactly one of the six.

Jul 26, 2026·4 min read
AI AGENT OBSERVABILITY · SIX SOURCES, ONE SPAN SHAPEBORROWClaudeTRUSTCursorINVENTCopilotINVENTCodexINVENTGeminiINVENTLangChainNORMALIZEDone span shapeQUEUEKafkapartitioned by tenantASYNC WRITERSconsumersflush · 5s or 100 eventsRECONSTRUCTED CONVERSATION · QUERY TIMEmsg_01H8…promptborrowed idappend-onlymsg_01H8…tool_callsame sessionappend-onlymsg_01H9…responseordered by seqappend-onlyaryan.devai-infrastructure · observability
ai-infrastructureobservability

Six AI Agents, Three Ways to Find a Message ID

Claude, Cursor, Copilot, Codex, Gemini and LangChain do not agree on what a message is. Normalizing them collapsed into three strategies: trust the agent's id, borrow one from a file it wasn't meant to share, or invent your own and persist a counter.

Jul 12, 2026·5 min read

Security

3 notes

API security, threat modeling, supply chain integrity, and zero-trust architectures.

RED TEAM ORCHESTRATOR · MULTI-TURN, ADAPTIVETARGETAI Agent+ MCP servertool calls visibleCrescendoTree JailbreakBad LikertROT13Base64<raw_prompt>BUDGET GUARDper-run mutexVALIDATIONlast turn onlyHISTORY WINDOWlast 10 messagesaryan.devsecurity · ai-infrastructure
securityai-infrastructure

I Built a Red Team Orchestrator for AI Agents. Here's What Made It Hard.

AI red-teaming looks like a prompting problem. It isn't. The hard parts were making attacks survive first contact with a guardrail, validating findings against tool calls rather than text, and a budget race condition that let two requests spend $37 against a $20 limit.

Jun 10, 2026·7 min read
AI CODE ANALYSIS · EXECUTION PATHS, NOT FILE TREESENTRYroute handlerMIDDLEWAREauthnMIDDLEWAREauthzCALLresolve()CALLloadUser()CALLbuildQuery()CALLrender()LEAFf0cleanLEAFf1cleanLEAFf2cleanLEAFf3cleanSINKraw SQLtainted paramLEAFf5cleanWHAT THE MODEL IS ASKEDone path, not one repore-planaryan.devsecurity · ai-infrastructure
securityai-infrastructure

Building an AI Security Engineer Before Coding Agents Could Do It

A hybrid static-analysis, semantic-search and LLM pipeline for finding vulnerabilities in source code, built in 2024 because no model could do it alone. We retired it a year later because they could.

Oct 20, 2025·6 min read
OPENAPI DEPENDENCY GRAPH · EXECUTION ORDER IS THE PRODUCTOPENAPI SPEC400–500 endpointsno ordering givenSTEP 1POST /users→ userIdSTEP 2POST /subscriptions→ subscriptionIdSTEP 3PATCH /subscriptionchange_option=end_of_termUNLOCKED422 → 200workflow satisfiedcycle guardREJECTEDmore string matchingKEPTdeterministic first, AI at edgesaryan.devsecurity · ai-infrastructure
securityai-infrastructure

Swagger Knows the Endpoints. It Doesn't Know the Workflow.

Generating requests straight from an OpenAPI spec got 10% of endpoints to execute. Treating the spec as a dependency graph instead of a list got us to ~60%. The last stretch needed an agent, and only because deterministic heuristics had stopped paying.

Sep 15, 2025·6 min read

Distributed Systems

2 notes

Consensus, replication, consistency models, and failure modes in large-scale systems.

PARALLEL CONSUMER · ONE PARTITION, MANY IN-FLIGHTTEST BACKLOG70,000 testsWORK UNITW0per-key queueWORK UNITW1per-key queueWORK UNITW2per-key queueWORK UNITW3per-key queueWORK UNITW4per-key queueWORK UNITW5per-key queueTHREADT0offset trackedTHREADT1offset trackedTHREADT2offset trackedTHREADT3offset trackedTHREADT4offset trackedTHREADT5offset trackedCOMMIT BOUNDARYmaxConcurrency(100)ONE CONSUMER GROUP · 100 IN FLIGHT · OFFSETS SAFE ACROSS A HARD KILLaryan.devdistributed-systems · observability
distributed-systemsobservability

Kafka, Parallel Consumers, and the 6-Hour Testing Bottleneck

We were running 70,000 security tests in about 6 hours on a shared queue, and I was explicitly not allowed to solve it by adding machines. What that constraint forced was per-message offset tracking, a hard 4-minute timeout, and a state file on disk.

May 25, 2026·6 min read
KAFKA · APPEND-ONLY LOG, TWO CLOCKSPRODUCERappendWRITES ONLY EVER LAND AT THE TAILPARTITION 0 · SEGMENT FILES ON DISKSEGMENTS0off 0+SEGMENTS1off 100+SEGMENTS2off 200+committedSEGMENTS3off 300+SEGMENTS4off 400+SEGMENTS5off 500+SEGMENTS6off 600+SEGMENTS7off 700+log endCONSUMERreadcommits manuallyHEARTBEAT CLOCKsession.timeout.ms · 45sPROCESSING CLOCKmax.poll.interval.ms · 5mA CONSUMER CAN HEARTBEAT PERFECTLY AND STILL BE EVICTED FOR SLOW PROCESSINGaryan.devdistributed-systems · databases
distributed-systemsdatabases

You Don't Need Kafka Internals. You Need Four of Them.

Every Kafka guide hands you the same nine-row config table. In practice almost every failure I've debugged came down to four things: the log's shape, two timeouts people conflate, the rebalance tax, and the fact that auto-commit is a correctness bug with a config flag.

May 22, 2026·5 min read