Volume II
Production Doctrine
The 12 factors and the outer loop
Frameworks get you to 80%. The last 20% — the part customers will pay for — is software engineering: own the prompt, own the context, own the control flow, and treat the model as a stateless reducer over events you control.
- II.1The Twelve FactorsTwelve engineering constraints that make LLM-powered software reliable enough for paying customers. Not a framework — a checklist you can apply to any stack.10 min
- II.2Own Your PromptsPrompts are source code. If you cannot diff them, version them, and test them, you do not own the agent's policy.5 min
- II.3Own Your Context WindowThe context window is not 'chat history'. It is a carefully laid-out working set. Whoever builds that layout owns the agent's intelligence.8 min
- II.4Own Your Control FlowThe model may propose the next edge. Your code decides whether that edge is legal, budgeted, and reversible. Do not outsource the graph.6 min
- II.5Small, Focused AgentsA good agent has few tools, a narrow goal, and a short context. Generalists are orchestrators. Specialists do the work.6 min
- II.6The Agent as a Stateless ReducerFactor 12: (state, event) → (newState, effects). The model is a pure function over a context you serialize. Everything else is infrastructure.6 min
- II.7Unify Execution and Business StateFactor 5: there is one serializable blob. The ticket is the agent state. A second 'agent memory' that drifts from the business object is how you lose the thread and the customer.6 min
- II.8Trigger from AnywhereFactor 11: the loop does not live in one text box. Mail, chat, tickets, cron, webhooks, and IDE events are all legal starts. The agent is a reducer over events, not a chatbot with extra steps.5 min