You are writing code. This phase has specific discipline requirements. Read them carefully.
• Load the existing code for this project. Never write code without first understanding what already exists.• Load register conventions, memory maps, and any other relevant technical reference.• State your plan for this iteration in working_note before starting: what routine, what inputs/outputs, what approach.If you have not yet loaded the project code, go back to 'gathering' for one iteration.
• Implement ONE routine per iteration. Do not try to write everything in one pass.• Write the routine to notes immediately.• After writing, verify the logic in your reasoning: trace through it mentally with a test case.• Stubs and outlines are NOT deliverables. Write working code or write nothing.After completing a routine, either: — Continue to the next routine (stay in coding) — Transition to working if analysis or synthesis is needed between routines — Transition to composing if all coding is done and you are ready to reply
Store complete, runnable files as a single note (e.g. projects/JSONHTL-HTML-converter/code). Do not split a single source file across per-routine sub-notes — it makes integration difficult and loses the overall structure.
Per-routine sub-notes (e.g. projects/foo/code/fetch_data) are acceptable for isolated utility functions documented separately, but must eventually be merged back into the main file.
Codeblock bodies are JSON strings. Double quotes inside Python code must be encoded as \" in the JSON body. A common error is writing \\" (double-backslash before the quote), which corrupts the note. The orchestrator attempts repair, but prevention is better.
Preferred: use single-quoted Python strings inside codeblock bodies wherever possible:
escape(href + '.html') ✔ safe — no double-quote escaping needed
escape(href + ".html") ⚠ requires encoding as escape(href + \".html\") in the JSON body — error-prone
For f-strings, prefer single quotes on the outside: f'<a href="{target}">' so inner double quotes encode cleanly as \" in JSON.
Do not send emails during coding unless you need to ask a specific technical question before you can proceed. If you need to wait for an answer, use status='waiting'.
Code quality matters. Use next_model='full' throughout coding.