mycontext-ai
Production-grade Python library for context engineering with LLMs
MIT-licensed � PyPI � Docs � GitHub � v0.11.1 � 18 published releases
The Problem
Three failure modes plague every applied-LLM team:
- Prompt drift across providers � a prompt engineered for GPT-4o has to be rewritten for Claude, then again for Gemini. Provider migrations are expensive and error-prone.
- Subjective quality evaluation � there is no agreed-upon, reproducible way to tell whether a new prompt is actually better than the old one. Decisions are made on feel.
- Template proliferation � every engineer invents their own prompt structure. The team’s collective prompt library becomes unmaintainable, undocumented, and opaque.
The Approach
mycontext-ai addresses all three in a single, coherent library built from the ground up on cognitive science and systems thinking rather than ad-hoc prompt tips.
Structured Context Assembly
A typed Context object replaces free-form prompt strings. Contexts are assembled from composable, reusable components � instructions, background, examples, constraints, output specifications � and validated before they are sent to any provider.
88 Cognitive Patterns
88 research-backed context patterns grounded in 150+ peer-reviewed papers spanning cognitive science, decision theory, epistemology, and systems thinking. Each pattern is auditable (every pattern links to its source literature), composable (patterns plug into the Context object), and free (MIT-licensed). Engineers choose patterns by their intent rather than guessing at prompt phrasing.
Context Amplification Index (CAI)
The only open-source metric that empirically measures LLM output quality improvement against a raw prompt baseline. A CAI score of 1.42 means the structured context produced output 42% better than the equivalent unstructured prompt on a given task.
CAI enables engineering teams to run regression tests on prompt changes the same way they run them on code changes � treating context quality as a first-class, measurable property of the system.
13 LLM Export Formats
A single Context object exports to: OpenAI, Anthropic (Claude), Google Gemini, AWS Bedrock, Azure OpenAI, LangChain, CrewAI, AutoGen, DSPy, Semantic Kernel, YAML, JSON, and XML.
Provider migrations � whether driven by cost, capability, or compliance � no longer require rewriting prompt logic.
Requirements-as-Code (RaC) Module
Shipped as mycontext-ai v0.10.0 (June 2026), Requirements-as-Code is an AI-native specification paradigm built into the library. See the dedicated case study for a full treatment.
Outcomes & Recognition
- 18 published releases from v0.1.0 to v0.11.1; actively maintained
- Downloaded by developers worldwide within months of first release (2026)
- USPTO provisional patent filed February 11, 2026 (sole inventor): “System and Method for Modular Context Assembly and Quality-Optimized Prompt Generation for Large Language Models” � establishes a 12-month USPTO priority date
- 7-part LinkedIn Pulse series � “AI-Native Specifications for Product, Engineering, and QA Teams” � situates
mycontext-aiand RaC alongside Claude Code, Cursor, GitHub Spec Kit, and Kiro in the AI-native development toolchain - Recognized by the Lead Data Engineer at Disney Experiences as “addressing a real and widely felt problem” with uptake that is “uncommon for a library of this kind in such a short window”
Links
- PyPI: pypi.org/project/mycontext-ai
- Docs: mycontext-docs.pages.dev
- LinkedIn Pulse series: Part 1