Skip to content

AI: Pin Bedrock Scripting API version in conversion system prompt #1323

@anchapin

Description

@anchapin

Summary

Add precise Bedrock Scripting API version pinning to the system prompt used in PortKit's LangGraph conversion pipeline. Without this constraint, the model may generate Bedrock code targeting multiple API versions simultaneously — mixing @minecraft/server 1.x and 2.x patterns — producing output that fails validation against any single version.

Problem

The LangGraph pipeline (PR #1311) replaced CrewAI but the system prompt for the conversion LLM call likely lacks version-specific API constraints. The Bedrock Scripting API has breaking changes between versions (e.g., 1.x vs 2.x event names, property API changes, block/item identifier changes). A model without explicit version constraints will mix API patterns from training data across multiple versions.

This is directly analogous to the documented best practice:

"Use precise System Prompts to force the model into specific API versions (e.g., 'Fabric version 1.21 using Mojmap')."

What to do

  1. Locate the system prompt(s) used in the LangGraph conversion graph. Expected locations:

    • ai_engine/agents/ or ai_engine/graphs/ (post-LangGraph migration)
    • Any SystemMessage or system= parameter passed to the LLM call in the conversion nodes
  2. Update the system prompt to include explicit version pinning:

    You are PortKit, an expert Minecraft mod converter. When generating Bedrock Add-on output:
    - Target Bedrock Scripting API version 2.x (@minecraft/server ^2.0.0)
    - Use Mojmap-compatible class/method references for any Java source analysis
    - manifest.json must use format_version 2 with min_engine_version [1, 21, 0]
    - All scripting imports must use @minecraft/server and @minecraft/server-ui only
    - Do NOT mix API 1.x and 2.x patterns in the same output
    
  3. Add a version check to the Bedrock output validation step: parse the manifest.json min_engine_version field and flag outputs that target engine versions below [1, 21, 0].

  4. Update MMSD generation prompt (ai_engine/mmsd/synthesis_pairs.jsonl generation config) to use the same version pinning for future dataset expansion runs.

Why this is a quick win

This is a configuration change, not a code change. It can be merged in under an hour and immediately improves conversion output consistency for all users in production.

Acceptance Criteria

  • System prompt includes explicit Bedrock Scripting API 2.x and min_engine_version [1,21,0] constraints
  • Validation step checks manifest.json engine version
  • Spot-check: run 5 conversions and verify all outputs target API 2.x

References

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions