Prompt engineering decides what to ask the model. Context engineering decides what to put in front of it so the answer is grounded in reality rather than the model’s memory. UOM leans heavily on the second — it is the difference between “code that looks right” and “code that compiles and returns the same data.”If you have not yet read Prompt Engineering, skim it first: this page describes the material that the dynamic prompt builder injects.
1. What “Context Engineering” Means Here
A language model translating EF Core to Spring Data MongoDB from memory will, sooner or later:- invent a package version that does not exist,
- pick an arbitrary collection/field name that does not match your database,
- emit a query that compiles but reads the wrong field,
- or wrap everything in boilerplate (drivers, config loaders, serializers) that drifts from what the sandbox actually expects.
- Framework configuration — the exact
.csproj/pom.xml(versions, dependencies, language level). - Schema mappings — the canonical relational→document / relational→graph mapping, including naming and embedding rules.
- Compilation skeletons — full, verified harness programs the model only has to fill in.
services/orchestrator/src/context/ and is injected per translation pair — only the active source and target are included, never all five frameworks (see Token Efficiency).
2. Ground-Truth Schema Mappings
To avoid arbitrary naming and incorrect type mappings, the orchestrator references static JSON mapping definitions undercontext/mappings/:
mappings/mssql_mongodb.json— maps relational MSSQL tables/columns onto MongoDB collections/fields, including embedding strategy.mappings/mssql_neo4j.json— maps relational MSSQL tables/columns onto Neo4j node labels, properties, and relationship directions.
- Exact casing rules (
StockItemID→stockItemId,CAMEL_CASE) so generated@Field(...)names match the documents on disk. - Embedding decisions (
EMBEDDED_DOCUMENT_ARRAY,embeddedPath) — i.e. thatStockItemStockGroupsrows are embedded inside their parent stock item rather than stored as a separate collection. This is the single hardest part of relational→document mapping, and it is provided as fact, not inferred.
The mapping JSON is large. UOM injects it into the schema-inspection stage (where an LLM + MCP database tools distill it into a concise
schema_context summary) rather than dumping the whole file into the translation prompt. See MCP Integration and State & Context.3. Compilation Skeleton Snippets
The second most common LLM failure is incomplete boilerplate: a missing import, a wrong namespace, an incompatible dependency version, or a half-writtenmain(). UOM eliminates this by storing complete, compilable project and harness skeletons under context/snippets/.
These are loaded by
get_framework_config_content() (configs) and get_snippet_content() (entrypoints) and injected as few-shot examples into the translation prompt. The pinned versions are listed in Design Decisions §2.4.
The key insight: the same file is used twice.
Because the model is shown the exact pom.xml that the sandbox will compile against, “the API the model wrote for” and “the API it is compiled against” are guaranteed identical. There is no version skew to hallucinate around.
4. Why the Context Lives in the Orchestrator’s context/ Folder
Keeping these resources as plain files inside services/orchestrator/src/context/ (rather than, say, hard-coded strings or a database) is a deliberate design choice:
- Single source of truth, reused twice. The same
.csproj/pom.xmland harness skeletons are both injected into the prompt and shipped into the compile sandbox. One file, zero drift. - Pair-scoped injection = token efficiency. At runtime, only the active source and target files are read (
FRAMEWORK_TO_CONFIG_FILES/FRAMEWORK_TO_SNIPPET_FILES). The prompt never carries context for the four frameworks you are not using. - Editable without touching code. Adding a framework or bumping a dependency version is a matter of dropping a file in
context/and registering it inconstants.py— no prompt rewrite. This is exactly the extension path described in the Contribution Guide. - Versionable & reviewable. Because they are real files in git, the ground-truth context is diffable and code-reviewable like any other source.
Key benefits, summarised
- Minimises dependency errors — pre-pinned NuGet/Maven dependencies leave nothing for the model to invent.
- Standardised serialization — skeletons define exact ISO date and decimal (3 d.p.) formatting, so the DeepDiff equivalence check compares like-for-like data shapes.
- No boilerplate generation — the model spends its tokens on the translation, not on regenerating drivers, config loaders, and test rigs, keeping its attention focused and the output faster and more accurate.
5. Related Reading
Prompt Engineering
How this context is assembled into the dynamic system prompt.
Design Decisions
Why these frameworks, versions, and Template APIs were chosen.
Validators & Equivalence
How the skeletons are compiled and the results compared.
MCP Integration
How the live schema is inspected and summarised into context.