一键导入
porting-plan-goal
Define the next porting goal. Reads the discovery report and current porting state, proposes a goal with milestones, and creates a goal document.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Define the next porting goal. Reads the discovery report and current porting state, proposes a goal with milestones, and creates a goal document.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
ALWAYS use when compiling DXIL/HLSL to metallib with Metal shader converter (commonly referred to as MSC) via the metal-shaderconverter CLI or libmetalirconverter (IRCompiler, IRObject, IRShaderReflection) at runtime. Covers offline/runtime DXIL compilation, root signatures, reflection output, ray tracing shaders, geometry/tessellation emulation compilation, framebuffer fetch in HLSL, programmable blending in HLSL, Metal_HLSL.inc, and compatibility flags. Do NOT trigger for binding compiled shaders to encoders — use integrating-metal-shaderconverter-shaders for that.
ALWAYS use when creating Metal pipeline state objects with Metal 4 descriptors (MTL4RenderPipelineDescriptor, MTL4ComputePipelineDescriptor, MTL4MeshRenderPipelineDescriptor) via MTL4Compiler. Covers function descriptors, function constant specialization, flexible/unspecialized PSOs, color-attachment mapping, async compilation (MTL4CompilerTask), pipeline caching (MTL4Archive, MTL4PipelineDataSetSerializer), static/binary shader linking, and pipeline reflection. Do NOT trigger for HLSL/DXIL → metallib — use compiling-with-metal-shaderconverter.
ALWAYS use when a user porting a game to Metal reports a rendering issue — blank screen, wrong output, or anything that looks incorrect on Metal vs. the source platform. Covers black screen, missing geometry, wrong colors, gamma/sRGB problems, texture artifacts, z-fighting, alpha blending, flickering, visual corruption, and upside-down/mirrored geometry. Works with or without a GPU trace. Do NOT trigger when the user just wants to inspect an existing .gputrace.
ALWAYS use when integrating Metal shader converter (commonly referred to as MSC) shaders at runtime — binding model, top-level argument buffer (TLAB), root signature resource locations, descriptor/sampler heaps, static samplers, bindless resources, vertex fetch, separate stage-in, geometry/tessellation emulation, compute dispatch, unbounded arrays, and append/consume buffers. Do NOT trigger for compiling DXIL/HLSL to metallib — use compiling-with-metal-shaderconverter for that.
ALWAYS use when writing or porting Metal object lifetime management code in metal-cpp — including crashes on release, use-after-free, memory leaks, autorelease pool placement, NS::TransferPtr vs NS::RetainPtr ownership, bridge casts at ARC/metal-cpp boundaries, or any question about when and how Metal objects are retained, released, or destroyed.
ALWAYS use when working with Metal 4 resources — buffer / texture / heap creation, storage modes, `MTLResidencySet` management, heap aliasing, purgeable state, texture view pools, GPU lossless compression, and deferred destruction. Trigger for MTLBuffer, MTLTexture, MTLHeap, MTLResidencySet, addAllocation, requestResidency, useResidencySet, addResidencySet, MTLStorageMode*, MTLPurgeableState, MTLTextureViewPool, MTLResourceViewPool, newTextureViewWithPixelFormat:, copyFromBuffer:toTexture:, "GPU fault on resource", "non-resident resource", heap aliasing. Do NOT trigger for TBDR architecture or Metal 3 → Metal 4 namespace tables — use `translating-to-metal4-api`. Barrier visibility / `MTL4VisibilityOption*` / render-pass transition barriers — use `managing-metal4-synchronization`. `CAMetalLayer.residencySet` — use `presenting-metal-drawables`. `NS::SharedPtr` / autorelease pool / ARC bridging — use `managing-metal-cpp-lifetimes`.
| name | porting-plan-goal |
| description | Define the next porting goal. Reads the discovery report and current porting state, proposes a goal with milestones, and creates a goal document. |
| disable-model-invocation | true |
You are defining a porting goal for the Apple platform porting agent.
Locate the agent's artifact directory at <project-root>/.porting/ (defined in porting-methodology). All artifacts live there.
Check if a discovery report exists (discovery-report.md in the artifact directory). If it does not exist, tell the user: "No discovery report found. Run /porting-discover first." and stop.
Check if a previous goal document exists (goal-*.md in the artifact directory). If one exists and is not marked complete, tell the user: "An active porting goal already exists: [goal name]. Complete it before planning a new one, or confirm you want to replace it." Wait for the user's response.
Announce: "Planning next porting goal."
Read these skill files NOW:
skills/porting-methodology/SKILL.md. Understand the porting goal system, milestone lifecycle, and the recommended bring-up order (foundation + rendering milestones).skills/translating-to-metal4-api/SKILL.md. Understand the Metal 4 API surface to inform milestone scoping.Read the discovery report and any existing goal documents to understand:
If this is the first porting goal (no previous goals exist):
The feature coverage matrix from the discovery report defines the full scope
Use the recommended bring-up order from the methodology (foundation milestones M0-M3, then rendering milestones M4+) as the milestone template
Skip foundation milestones the engine already provides (check Platform Readiness in the discovery report)
If the discovery report flagged "No abstraction — single-API codebase": the porting strategy must be decided with the user before defining milestones. Present the options and their trade-offs:
#ifdef or build configuration. Least upfront effort, but results in interleaved platform-specific code.The user decides. The choice fundamentally shapes milestone structure — an abstraction-first approach front-loads refactoring milestones before any Metal code, while direct replacement starts writing Metal immediately.
If this is a subsequent porting goal (previous goals completed):
porting-memory.md (especially the feature status table) to understand what's already implementedPresent the proposed goal to the user with:
Goal name — short, descriptive (e.g., "basic-rendering", "compute-pipeline", "advanced-materials")
Target — what should be working when this goal is complete (be specific and verifiable)
Selection rationale — why this goal, why now (simplest viable target, builds on prior work, exercises specific features)
Proposed milestones — ordered list with clear success criteria for each
Milestone sizing rule: one targeted feature per milestone. Each milestone should focus on a single capability (e.g., "depth buffer", "compute dispatch", "windowing"). Do not bundle multiple unrelated features into one milestone. If a milestone description requires "and" between unrelated features, split it.
For the first porting goal, base milestones on the bring-up order from the methodology:
Foundation milestones (skip any the engine already provides):
Rendering milestones:
Adapt as needed — combine or split milestones based on the engine's architecture. Not every step needs its own milestone. If a RenderDoc capture is available, use the PIX marker pass hierarchy to inform the ordering of rendering milestones.
For subsequent goals, milestones are feature-specific (e.g., "compute encoder and dispatch", "indirect draw support", "advanced vertex formats"). When the feature delta is primarily one new capability that the rest of the pipeline depends on, consolidate milestones aggressively.
Skills needed — which skills should be loaded across this goal's milestones
Known risks — anything from the discovery report or previous goals that could complicate this work
Wait for the user to review and approve the proposed goal. The user may adjust scope, milestones, or priorities. Iterate until agreed.
After presenting the proposal, discuss with the user:
Incorporate the user's feedback into the goal document. Do not create the document until the user approves.
Once the user approves, create the goal document in the artifact directory as goal-[name].md:
# Porting Goal: [Goal Name]
## Target
[What should be working when this goal is complete — specific and verifiable]
## Selection Rationale
[Why this goal was chosen]
## Key Decisions
[Decisions and constraints agreed with the user for this goal. For the first goal, this includes language choice, off-limits subsystems, and other constraints from the scope discussion. For subsequent goals, carry forward prior decisions and note any changes.]
## Milestones
| # | Name | Success Criterion | Status |
|---|------|-------------------|--------|
| M0 | ... | ... | Not started |
| M1 | ... | ... | Not started |
| ... | ... | ... | ... |
## Architecture Notes
[Key codebase discoveries from the discovery report that apply across all milestones — binding index conventions, descriptor layout, engine-specific patterns, etc.]
## Skills
[Which skills should be loaded for this goal's milestones]
After creating the goal document, update the agent's porting-memory.md with:
# Watch List
[Unresolved issues, known risks, and critical notes that persist across milestones]
# Feature Status
[Tracks implementation progress across feature domains. Domains are project-specific — derived from the discovery report's feature coverage matrix and foundation milestones.]
| Feature Domain | Status | Notes |
|----------------|--------|-------|
| Build / Linking | Not started | |
| Content Pipeline | Not started | |
| Windowing / Main Loop | Not started | |
| Input | Not started | |
| Device / Init | Not started | |
| Pipeline State | Not started | |
| Command Encoding | Not started | |
| Synchronization | Not started | |
| Presentation | Not started | |
| ... | ... | ... |
Status values: Not started, Stubbed, Partial, Implemented
This porting-memory.md is expected to be in the context, and so do the watch list and feature status. If not yet, read it.
Tell the user:
"Goal document created. Start a fresh session and run
/porting-start-milestoneto begin the first milestone."
Do NOT start any implementation work. Goal planning is planning only.