Purpose
Define exactly what code must implement and save. Do not expand the approved experiment scope or fully plan a dormant fallback.
Preconditions
methods/Qx/qx_method_card.md and probe summary exist.
methods/Qx/qx_decisions.jsonl contains a human DECIDED method choice.
- A usable baseline is identified.
- Cleaned data and
data_profile.json are ready when data is required.
- Implementation target and round are known.
Read legacy candidate/decision artifacts only when the new artifacts are absent.
Workflow
- Read the approved choice, method card, probe conditions, and experiment budget.
- Plan only:
- approved
main;
- approved
usable_baseline;
- shared helpers and comparison logic.
- Record the fallback ID and trigger, but do not plan its full implementation unless the trigger is already evidenced and the human chose activation.
- Map mathematical definitions to inputs, processing steps, intermediate evidence, outputs, and validation checks.
- Define a directly comparable metric/output contract for main and baseline.
- Define the round output:
results/Qx/experiments/roundN/
├── figures/
├── tables/
├── metrics/
└── run_summary.json
Create logs/ only for failures, warnings, or reproducibility needs.
7. Write code/Qx/qx_code_plan.md for Python or code/matlab/Qx/qx_code_plan.md for MATLAB.
8. Hand off to the matching language generator.
Run Summary Contract
Require:
{
"schema_version": 1,
"question": "Q1",
"round": "round1",
"implementation_target": "python",
"random_seed": 2026,
"approved_decision_id": "q1_method_choice",
"methods": [
{
"method_id": "M1",
"role": "usable_baseline",
"script": "code/Q1/q1_baseline.py",
"status": "success",
"execution_time_seconds": 0,
"input_files": [],
"output_files": [],
"figure_files": [],
"metrics_summary": {},
"warnings": [],
"errors": []
}
],
"comparison": {},
"fallback_trigger": {
"fallback_id": null,
"condition": null,
"observed": false,
"evidence": null
},
"environment": {}
}
Code Plan Contents
- target language and round purpose;
- approved decision ID;
- main and baseline IDs and roles;
- input fields and units;
- per-method computation steps;
- comparable outputs and metrics;
- risk-probe conditions that implementation must monitor;
- fallback trigger evaluation;
- paths, seed, dependencies, and expected runtime;
- named review checks expected downstream.
Rules
- Do not write executable model code.
- Do not add candidates or change model meaning.
- Do not plan a diagnostic reference as the official baseline.
- Do not implement a fallback before activation.
- Do not require success logs.
- Do not create a README when the code plan already provides the same instructions.
- Stop if a human choice, required parameter, input field, or comparable baseline output is missing.
Verification
- Plan scope is exactly main plus usable baseline unless fallback activation is recorded.
- Outputs are directly comparable.
- Probe risks and fallback trigger are represented in
run_summary.json.
- Paths follow the experiment contract.
- Handoff targets the correct language generator.
1---2name: model-code-analyzer3description: Translate a human-approved main method and usable baseline into a minimal language-neutral implementation and experiment contract. Use after G2.5 and data readiness, before Python or MATLAB code generation.4---56# Purpose78Define exactly what code must implement and save. Do not expand the approved experiment scope or fully plan a dormant fallback.910# Preconditions1112- `methods/Qx/qx_method_card.md` and probe summary exist.13- `methods/Qx/qx_decisions.jsonl` contains a human `DECIDED` method choice.14- A usable baseline is identified.15- Cleaned data and `data_profile.json` are ready when data is required.16- Implementation target and round are known.1718Read legacy candidate/decision artifacts only when the new artifacts are absent.1920# Workflow21221. Read the approved choice, method card, probe conditions, and experiment budget.232. Plan only:24 - approved `main`;25 - approved `usable_baseline`;26 - shared helpers and comparison logic.273. Record the fallback ID and trigger, but do not plan its full implementation unless the trigger is already evidenced and the human chose activation.284. Map mathematical definitions to inputs, processing steps, intermediate evidence, outputs, and validation checks.295. Define a directly comparable metric/output contract for main and baseline.306. Define the round output:3132```text33results/Qx/experiments/roundN/34├── figures/35├── tables/36├── metrics/37└── run_summary.json38```3940Create `logs/` only for failures, warnings, or reproducibility needs.417. Write `code/Qx/qx_code_plan.md` for Python or `code/matlab/Qx/qx_code_plan.md` for MATLAB.428. Hand off to the matching language generator.4344# Run Summary Contract4546Require:4748```json49{50 "schema_version": 1,51 "question": "Q1",52 "round": "round1",53 "implementation_target": "python",54 "random_seed": 2026,55 "approved_decision_id": "q1_method_choice",56 "methods": [57 {58 "method_id": "M1",59 "role": "usable_baseline",60 "script": "code/Q1/q1_baseline.py",61 "status": "success",62 "execution_time_seconds": 0,63 "input_files": [],64 "output_files": [],65 "figure_files": [],66 "metrics_summary": {},67 "warnings": [],68 "errors": []69 }70 ],71 "comparison": {},72 "fallback_trigger": {73 "fallback_id": null,74 "condition": null,75 "observed": false,76 "evidence": null77 },78 "environment": {}79}80```8182# Code Plan Contents8384- target language and round purpose;85- approved decision ID;86- main and baseline IDs and roles;87- input fields and units;88- per-method computation steps;89- comparable outputs and metrics;90- risk-probe conditions that implementation must monitor;91- fallback trigger evaluation;92- paths, seed, dependencies, and expected runtime;93- named review checks expected downstream.9495# Rules9697- Do not write executable model code.98- Do not add candidates or change model meaning.99- Do not plan a diagnostic reference as the official baseline.100- Do not implement a fallback before activation.101- Do not require success logs.102- Do not create a README when the code plan already provides the same instructions.103- Stop if a human choice, required parameter, input field, or comparable baseline output is missing.104105# Verification106107- Plan scope is exactly main plus usable baseline unless fallback activation is recorded.108- Outputs are directly comparable.109- Probe risks and fallback trigger are represented in `run_summary.json`.110- Paths follow the experiment contract.111- Handoff targets the correct language generator.