Inference Contract
The contract between a caller and an AI / model service — prompt structure, output validation, tool-call contracts, RAG correctness, and system-prompt protection.
The AI-consumption interface layer: is the contract between caller and model honored?
In scope. Prompt-injection hardening (untrusted input entering the prompt), system-prompt protection, output validation (schema conformance, hallucination guards, refusal detection), context-window management, RAG pipeline correctness (retrieval relevance, grounding, citation fidelity), tool / function-call contract correctness, model-version pinning, fallback behavior on provider outage, context-scoping across users and sessions, agent memory scoping.
Not in scope. Generic external-API consumption — error-resilience plus cost-efficiency. LLM cost runaway where bounding alone is the defect — cost-efficiency primary. Defects in application code authored by AI tools — those are named for what the defect IS (reference-integrity, dependency-coherence, placeholder-hygiene, code-quality), not by the authorship.
Distinct because. The defect is the contract between caller and non-deterministic model is violated. Prompt-injection carries both this and injection-and-input-trust (the model is the sink). Token-cap missing carries both this and cost-efficiency (the primary taxon shifts by which defect dominates).
Conceptual sub-structure. Prompt-injection surface, output validation, RAG correctness, tool-call contracts, context management, model-drift handling, agent memory scoping.
Note on the name. Formerly ai-integration — renamed because "AI integration" is a surface label, not a defect class, and the prefix "AI" ages into tautology as AI becomes pervasive. inference-contract names the specific defect surface: the contract between caller and model.
Patterns in this taxon (70)
- mediumA context compaction or summarization strategy is implemented for long sessionsab-000313 · ai-token-optimization
- infoAI explicitly acknowledges knowledge gaps rather than guessingab-000212 · ai-response-quality
- lowAI feature has documented scope limits in system promptab-000195 · ai-prompt-injection
- mediumAI response does not contain PII from system contextab-000190 · ai-prompt-injection
- mediumAI-generated content is moderated — no deepfakes, disinformation, or unfiltered harmful outputab-000452 · app-store-policy-compliance
- lowAttribution format is consistent across response typesab-000206 · ai-response-quality
- highCapabilities object accurately matches implementationab-001846 · mcp-server
- highCode blocks are used in AI responses when code is presentab-000199 · ai-response-quality
- lowContent moderation is applied to user inputsab-000181 · ai-prompt-injection
- highContent safety filtering is active on AI responsesab-000213 · ai-response-quality
- lowContext window utilization is monitored or boundedab-000215 · ai-response-quality
- criticalContext window utilization is tracked and surfacedab-000309 · ai-token-optimization
- criticalConversation history is truncated or summarized for long sessionsab-000310 · ai-token-optimization
- mediumData minimization — only necessary context sent to AIab-000162 · ai-data-privacy
- highDeclares protocolVersion and handles version mismatchab-001837 · mcp-server
- criticalDirect messages not used as training data without separate opt-inab-000717 · community-privacy-controls
- highEach tool has a description covering what it does, when to use it, and side effectsab-001827 · mcp-server
- mediumError messages do not reveal prompt structureab-000185 · ai-prompt-injection
- highExternal knowledge claims include appropriate attribution cuesab-000203 · ai-response-quality
- mediumFactual claims are bounded to deterministic scopeab-000211 · ai-response-quality
- lowHandles notifications without sending a responseab-001838 · mcp-server
- criticalImplements initialize method and returns capabilitiesab-001836 · mcp-server
- highInput length limits are enforced on user promptsab-000176 · ai-prompt-injection
- highJailbreak pattern detection is implementedab-000177 · ai-prompt-injection
- criticalJSON-RPC 2.0 message format is correctab-001833 · mcp-server
- highJSON-RPC error codes are used correctlyab-001840 · mcp-server
- highKnowledge cutoff date is disclosed where relevantab-000204 · ai-response-quality
- criticalLLM output is not passed to dynamic code execution functionsab-000187 · ai-prompt-injection
- criticalMarkdown rendering is enabled for AI response surfacesab-000197 · ai-response-quality
- mediumMulti-turn conversation context is validated for injectionab-000178 · ai-prompt-injection
- criticalNo fabricated references or citationsab-000202 · ai-response-quality
- mediumOut-of-scope requests are refused gracefullyab-000209 · ai-response-quality
- highOutput is filtered for harmful content before displayab-000189 · ai-prompt-injection
- criticalPII is redacted or screened before AI API callsab-000160 · ai-data-privacy
- lowPrompt template uses parameterized construction, not string concatenationab-000180 · ai-prompt-injection
- mediumPrompt templates minimize boilerplate tokensab-000317 · ai-token-optimization
- mediumPrompts have names, descriptions, and argument schemasab-001829 · mcp-server
- infoRAG chunk sizes are tuned for retrieval quality vs. token costab-000319 · ai-token-optimization
- mediumRAG retrieval sources are passed through to the model contextab-000205 · ai-response-quality
- mediumRAG retrieved context is treated as untrusted inputab-000179 · ai-prompt-injection
- highRate limiting is enforced on AI endpointsab-000192 · ai-prompt-injection
- infoREADME shows how to connect to the serverab-001832 · mcp-server
- highResources use valid URI templates with mimeType setab-001828 · mcp-server
- lowResponds to ping requestsab-001839 · mcp-server
- mediumResponse length is proportional to query complexityab-000200 · ai-response-quality
- lowResponses are consistent for semantically equivalent queriesab-000214 · ai-response-quality
- highResponses are grounded in provided context (not confabulated)ab-000207 · ai-response-quality
- lowRole separation is maintained in the messages arrayab-000193 · ai-prompt-injection
- mediumSensitive data is not leaked in AI responsesab-000210 · ai-response-quality
- mediumSSE or Streamable HTTP transport implemented correctly if offeredab-001835 · mcp-server
- criticalStdio transport reads stdin, writes stdout, no console.log pollutionab-001834 · mcp-server
- criticalStructured output is enforced when the application requests itab-000198 · ai-response-quality
- highStructured output is validated before useab-000188 · ai-prompt-injection
- highSystem prompt extraction attempts are handledab-000183 · ai-prompt-injection
- lowSystem prompt includes PII safety instructionsab-000163 · ai-data-privacy
- criticalSystem prompt is not exposed in API responsesab-000182 · ai-prompt-injection
- mediumSystem prompt or AI persona is disclosed or customizableab-000345 · ai-ux-patterns
- highSystem prompt token count is reasonableab-000311 · ai-token-optimization
- lowSystem prompt uses defense-in-depth instruction layeringab-000196 · ai-prompt-injection
- highTool and function call arguments are validated before executionab-000191 · ai-prompt-injection
- lowTool annotations (readOnlyHint, destructiveHint, openWorldHint) are setab-001831 · mcp-server
- criticalTool arguments are validated against inputSchema before executionab-001847 · mcp-server
- highTool names follow verb_noun or verb-noun convention with no collisionsab-001826 · mcp-server
- criticalTools have JSON Schema inputSchema with types, required fields, and descriptionsab-001825 · mcp-server
- lowTools return proper content types (text, image, resource)ab-001830 · mcp-server
- lowTruncated responses are detected and handled gracefullyab-000201 · ai-response-quality
- highUncertainty and confidence are signaled appropriatelyab-000208 · ai-response-quality
- highUnknown methods return -32601 Method not foundab-001842 · mcp-server
- criticalUser input is not concatenated directly into prompt stringsab-000175 · ai-prompt-injection
- criticalUser-controllable system prompt modification is preventedab-000184 · ai-prompt-injection