Writing prompts
The prompts for AI charts are Markdown files you can write yourself. This page is about writing a good one: what beatcode already sends, where the song X-ray goes, and how to read the exact text before spending a request on it.
01Start from a bundled prompt
Don’t begin from a blank page. beatcode prompts new --template mood opens a draft of a bundled prompt in $EDITOR, with the replacements explained in comments. Save and close, name it, and it shows up in the topic box. beatcode prompts edit <name> changes one you have.
The file format, the keys (name, description, model, effort, length, lang, kind) and the replacements like {lang} and {topic} are on the settings page, under “AI prompts”.
beatcode prompts new --template moodbeatcode prompts edit mood02Read the text that is actually sent
What you write is not all that is sent: beatcode adds instructions after it (the next topics). Before you try a prompt on a real song, print the whole thing. It needs a song beatcode has analyzed (a Spotify song you played, or asked the AI to write a chart for) and a language. Leave the song out, or give a name that doesn’t match, and beatcode lists your analyzed songs to pick from with ↑ ↓ and Enter (only in a terminal; in a script, give the name).
The prompt is named by its file name, mood.md, not by its path. The output is the system message, then the user message, exactly as the model gets them.
beatcode xray --show mood.md typescriptbeatcode xray "Shining Star" --show mood.md typescript03Where {xray} goes
For a song beatcode has listened to, {xray} is the song X-ray: a table of the song’s sections (time, bars, which notes fall there, how many tokens to write, how loud and how busy), a bar-by-bar loudness graph, how to use them, a shape for the reply, and a checklist to run before replying. The table and graph are wrapped in <xray> … </xray>, the shape in <examples>, and the checklist in <checklist>.
Put {xray} where you want it in the prompt. If the prompt has no {xray}, beatcode adds the X-ray after your text for any song that has one. {xray} is empty for a song without an analysis (and for YouTube Music songs, which are never analyzed), so one prompt works for both. To turn the X-ray off, set [ai] xray = false.
With the X-ray, the length comes from its token counts, not from {lines}: it says so in the text. Don’t also write a line count in your prompt; the two will disagree.
{xray} is one piece. There are no separate placeholders for the table, the rules or the checklist.
---name: Festivaldescription: a loud, crowded scene---You write {lang} code that becomes a rhythm game chart: each token falls as a note.The theme is {topic}. Let the energy of the song show in the subject and the shape of the code.Use English identifiers. {xray}04What beatcode adds to every prompt
After your text, beatcode always adds two things. For code, “every line must be the language itself”: no padding the length with another language inside a heredoc or a string (shorter code is fine if the language can’t reach the length). And, for every prompt, an instruction to write 2–4 sentences about the feelings behind the code between <beatcode-intent> tags, outside the code block. They show under the graph on the results screen.
So a prompt that says “reply with only the code block, nothing else” fights the second one. The bundled prompts say “Outside it, write only what the instructions below ask for” instead, and the added text says the intent is the one thing allowed outside.
The X-ray asks for one marker line at the start of each section, // [@beatcode#section#N] (the comment mark of the language). That overrides a “no comments” rule in your prompt, and it says so. beatcode uses the markers to put each block on its section of the song; without them it follows the blank lines between blocks.
05What to avoid
Don’t give a length. With the X-ray the token counts are the length; without it, {lines} is. A second number in the prose only pulls the model both ways.
Don’t forbid what beatcode asks for: comments (the markers), text outside the code block (the intent), and extra sections or blocks (the X-ray fixes the number).
Describe style, not structure: the subject, the mood, short or long lines, how names look. The structure (sections, markers, token counts) is the X-ray’s job.
Seen once, not measured: on one song with openai/gpt-6-luna at effort = low, the code came back well under half the length asked for and without markers or the intent, then right in length on the next try, still without markers or the intent. We have not compared efforts. If details get dropped, raising [ai] effort (or a stronger model) is the first thing to try, and beatcode xray <song> --show helps you check that the text itself is clear.