Prompts as Code: The Build Step That Beats Vendor Drift

Module 21: Multi-Vendor Reality · Expansion Guide

Back to Module 21

The Problem

You use Claude Code, Cursor, and a homegrown agent on top of OpenAI's API. All three are doing real work. None of them agree on what “good” looks like.

You shipped a coding standard last sprint — “run the test suite before declaring a task done.” You added it to CLAUDE.md. You forgot the .cursorrules. You forgot the OpenAI system prompt entirely. Cursor's agent has been merging untested code for two weeks. Nobody noticed because the failures look like the agent being “flaky.”

Then a new policy lands: “don't run rm -rf without explicit confirmation.” You add it to CLAUDE.md. Three days later you remember .cursorrules. You never get to the OpenAI agent because there's no obvious place — its prompt is a 400-line Python string in a service file someone ships infrequently.

Your prompts and policy are slowly diverging. You don't have multi-vendor agents; you have three single-vendor agents that happen to live in the same repo. The thing you bought when you went multi-vendor — redundancy, best-of-breed per task — is being eaten by drift.

The Core Insight

Your prompt and policy stack is infrastructure. Author it once, render to each vendor's format. Anything else gets eaten by drift.

Most teams reach for one of two failure modes when this hurts. Either they pick a framework (LangChain, AutoGen, etc.) that “abstracts the vendor away” — and now they're locked into the framework's mental model, missing every vendor-specific advantage, and their abstraction layer is itself a vendor that can break. Or they accept the drift and pay the cost in incidents and reviewer time.

The third path is the boring one and the right one: treat prompts and policy like infrastructure-as-code. One source of truth, multiple targets, a build step that produces vendor-shaped artifacts, a CI check that hand-edits never sneak in. The artifacts are dumb output — a real CLAUDE.md, a real .cursorrules, a real Python module that returns the OpenAI system prompt — so each vendor gets the format it wants without giving up any of its native features.

// across actors

TEAM: Prompts as code in a vendored library so Claude and ChatGPT versions don't drift apart.

SOLO: Same — your prompt library is a single source of truth, vendor-agnostic.

BOT: Multi-vendor agent routing — pick the cheapest model that meets quality, fall back across vendors on outages.