# beatcode > A rhythm game for the terminal. The notes are the tokens of real source code, and clearing a song types out a function. beatcode is proprietary software. See LICENSE for the complete terms. ## Play your code. A rhythm game for the terminal. The notes are the tokens of real source code — keywords, names, operators, literals — falling down their own lanes. Clear the song and you’ve typed out a function. ## Install Homebrew: ```sh brew tap yukihirop/beatcode https://github.com/yukihirop/beatcode brew trust --formula yukihirop/beatcode/beatcode brew install beatcode ``` npm: ```sh npx beatcode ``` curl: ```sh curl -fsSL https://beatcode.run/install.sh | sh ``` Runs without installing. Node.js 18 or later. macOS 11+ · Apple silicon / Intel ## Every token has a lane. beatcode reads the file, sorts each token by what it is, and drops it down that kind’s lane. Hit them in order and the function writes itself back out. Lanes: Keyword, Identifier, Operator, Literal. Comments never become notes. ## What you can play - Charts: The bundled songs, the git repos on your machine, your own GitHub repos, or a chart an AI writes for you on the spot. Long files are cut into one chart per function. - Languages: Rust, Python, Go, TypeScript, JavaScript, Ruby and PHP. Plain .md / .txt in English or Japanese. C, C#, CSS, HTML, JSON, Shell, TOML, YAML, Zig and Chinese prose come as plugins. - Music: Your Spotify liked songs play inside beatcode. Tempo and note timing come from analysing the audio on your machine; nothing is sent anywhere. YouTube Music works too, through Pear Desktop. - Difficulty: 4, 6 or 8 lanes — more lanes split tokens into finer kinds. NORMAL, or HARD: the same code packed into 16th notes, with chords and hold notes. - History: Every finished play is kept. Pick one to play the same song and chart again. ## Get started | Command | What it does | | --- | --- | | beatcode | Song select | | beatcode path/to/file.rs | Play one file | | beatcode setup | Connect Spotify, YouTube Music and AI | | beatcode skills | Then run /beatcode-setup in Claude Code or Codex | | beatcode --help | Every command | Keys: D F J K play the four lanes. Switch your input method to plain ASCII before you play. With a Japanese IME on, the keys never reach the game. ## Where it runs - macOS: 11 or later, Apple silicon or Intel. - Linux: Not supported yet. ## Requirements Source: /guide/environment/ What you need before the first song, and what makes playing nicer. A coding agent can do it all for you; otherwise, only what you need and where songs play are must-haves, and the rest adds pictures, sound or speed. ### Let a coding agent set it up The quickest way: copy this prompt into a coding agent (Claude Code, Codex and the like) on the machine you’ll play on. It reads this site, looks at your machine and terminal, and walks you through the rest of this page. It asks before installing anything, and leaves the logins that need a browser (Spotify, gh) for you to type. API keys are only checked for, never read. Prompt for your coding agent: ``` Set up beatcode, a rhythm game that runs in the terminal, on this machine so I can play it comfortably. 1. Read https://beatcode.run/llms-full.txt first. It is the whole beatcode site, including the Requirements page. 2. Look at this machine without changing anything: the OS and CPU, whether beatcode is installed (beatcode --version), which terminal I'm in ($TERM_PROGRAM, and $TMUX for tmux), and whether ffmpeg and gh are installed. 3. If beatcode isn't installed, show me the install command that fits (Homebrew, npm or curl, from the site) and ask before running it. 4. Run beatcode skills, then read ~/.agents/skills/beatcode-setup/SKILL.md and follow it. It asks what to connect: Spotify or YouTube Music, AI charts, the combo voice, icons and shell completion. 5. Anything that needs a browser or my typing (beatcode setup music, gh auth login): give me the command to run myself. 6. Never read or print API keys or credentials. Only check whether they exist. 7. At the end, tell me what is set up, what isn't, and what the Requirements page says about my terminal (pictures, key release, tmux), with what I could change. ``` ### What you need beatcode runs in a terminal on macOS 11 or later (Apple silicon or Intel). Linux and Windows aren’t supported yet. Give it room. The screenshots on this site were taken at 120 columns by 34 rows; song select puts the songs and charts in 62 columns on the left and the code on the right, and 8 lanes take about 80 columns before the score panel. A smaller window still works, with narrower lanes and less code. A keyboard you can hit quickly. Four lanes use D F J K, six S D F J K L, eight A S D F J K L ; (all can be changed in config.toml). | | Needed | | --- | --- | | OS | macOS 11+ (Apple silicon or Intel) | | Terminal size | 120 × 34 or more is comfortable | | Keys | D F J K (4 lanes), up to A S D F J K L ; (8 lanes) | ### Where songs play Pick one with beatcode setup. You can also play with no song at all: Silent keeps a fixed tempo and lights the judgment line on the beat. With Spotify, beatcode analyzes the song’s sound on your machine to place notes on its beats. With YouTube Music it can’t read the sound, so you tap the tempo once per song. beatcode ytmusic check tests the connection to Pear Desktop. beatcode spotify reset forgets the saved Spotify login and beatcode ytmusic reset the Pear Desktop token, so the next beatcode setup music signs in again. ```sh beatcode setup ``` | Where | What you need | Notes | | --- | --- | --- | | Spotify | A Premium account | Plays inside beatcode. Beats come from analyzing the song | | YouTube Music | The Pear Desktop app with its API Server plugin on | beatcode drives the app. Tap the tempo with t | | Silent | Nothing | A fixed tempo (BPM 100 by default) | ### Which terminal Any terminal plays the game. Two things depend on it: pictures (the logo, cover art, the camera) and whether beatcode hears a key being let go (needed to hold HARD’s long notes; without it a long note only needs the press). The author plays in Ghostty (inside cmux), so that’s the one we recommend. The others are listed by what beatcode does with them; we haven’t played on them, so treat their rows as expected, not checked. You can check your own: beatcode logo check prints whether the terminal answered and how pictures will be drawn, and the ready screen before a song says “key release: supported” or “not supported”. Inside herdr, pictures are off until you turn on its experimental kitty graphics: add the lines below to herdr’s config.toml and run herdr server reload-config. The terminal outside herdr also has to draw kitty graphics. Until then, beatcode logo check says “text logo” even though the terminal answered. ```sh beatcode logo check ``` ~/.config/herdr/config.toml: ``` [experimental] kitty_graphics = true ``` | Terminal | Pictures | Key release | Checked | | --- | --- | --- | --- | | Ghostty | Yes (kitty graphics) | Expected (kitty keyboard protocol) | Pictures: yes, in cmux. Key release: not yet | | kitty | Yes (kitty graphics) | Expected (kitty keyboard protocol) | No | | WezTerm | Expected | Expected | No | | iTerm2 | Expected (its own image format) | Not known | No | | Terminal.app | No: a logo in letters, the camera in ▀ blocks | Not known | No | | Inside tmux | No: beatcode doesn’t ask | Not known | No | | Inside herdr | Yes, once kitty_graphics is on (see above) | Not known | Pictures: yes, with herdr 0.8.2 | ### A font with icons beatcode marks repos, files and ranks with Nerd Font icons. Without a Nerd Font they show as boxes; set icons = "text" in config.toml to use letters instead (or "none"). BEATCODE_ICONS=text beatcode tries it for one run without editing the file. ~/.config/beatcode/config.toml: ``` [display] icons = "text" ``` ### Nice to have None of these are needed to play. Each one turns on something more. | What | For | Set up | | --- | --- | --- | | An OpenRouter or OpenAI API key | AI writing a chart for the song (a) | beatcode setup, or OPENROUTER_API_KEY / OPENAI_API_KEY | | gh (GitHub CLI), signed in | Sharing charts as gists and fetching them (g, G) | gh auth login | | VOICEVOX or AivisSpeech engine | A voice calling out the combo | [voice] in config.toml | | ffmpeg | The front camera in the lower right (macOS), and the beatcode record plugin | brew install ffmpeg | | A GitHub account | Sending plays to a ranking server | beatcode setup rank | ### Tips for playing well Turn your Japanese (or other) input method off before playing. With it on, the keys never reach the game. After a song of 30 notes or more, the results screen shows your average timing. Press o to shift judgment by that much; it’s kept for next time. ↑ ↓ on the ready screen change the scroll speed (x0.5 to x4.0). Faster notes are farther apart and easier to read. Wired speakers or headphones are safer than Bluetooth, which tends to lag the sound (not measured here). If you hear the song late, o on the results screen makes up for it. Play outside tmux if you can: beatcode doesn’t draw pictures there. ## How to play Source: /guide/ From song select to the results screen, then the settings worth knowing. Each step shows the screen you’ll see. ### Pick a song and a chart Run beatcode with no arguments. Songs are top left, charts bottom left, and the code of the selected chart is on the right. Press / on songs to find one: typing filters by title and artist, and the last row searches all of Spotify (or YouTube Music). Rest on a song for 0.4 seconds and a preview plays: its loudest 30 seconds with Spotify, from a third of the way in otherwise. A searches everywhere for the artist of the song under the cursor. The bundled source has three songs in each of Rust, Python, Go, TypeScript, JavaScript, Ruby and PHP. Your local git repos and GitHub repos are other sources; switch with [ and ]. ```sh beatcode ``` Keys on this screen: | Key | What it does | | --- | --- | | Tab | Move between songs, charts and code | | ↑ ↓ | Pick | | / | Find a song (on songs) | | A | Find more by this artist (on songs) | | ← → | Language | | Space | Play the selected pair now | | Enter | On charts, choose what the lower right shows, then play | | Esc | Back, or quit from the song list | ### Check your keys The ready screen lists which key plays which kind of token. Press a lane’s key and it lights up, so you can check your keys arrive. Turn your Japanese input method off first. With it on, the keys never reach the game. Keys on this screen: | Key | What it does | | --- | --- | | D F J K | The four lanes: keyword, identifier, operator and bracket, literal | | ↑ ↓ | Scroll speed, x0.5 to x4.0 | | Space / Enter | Start a four-beat count-in | | Esc | Back to song select | ### Hit each token on the line Tokens fall down their lanes. Press the lane’s key as each one reaches the judgment line. The code on the right lights up as you play it, and the combo counts up in the middle of the lanes. PERFECT is within ±50 ms and scores 2, GREAT within ±110 ms scores 1, and anything later is a MISS. Esc pauses and asks whether to quit the song. Keys on this screen: | Key | What it does | | --- | --- | | D F J K | Hit | | Esc | Pause | ### Read the results The rank runs from AAA down to F, from your share of the maximum score. The graph shows the score over the song, the strip below it each judgment in time, and the box on the left the best five plays of the same song and chart. After 30 notes or more, the bottom line shows your average timing. Press o to shift judgment by that much and keep it. e rates how the play felt (◎ ○ △) and y says why (S off the song, C dull chart, M my playing). They are kept with the play and shown in the history. Keys on this screen: | Key | What it does | | --- | --- | | r | Play it again | | f | Favorite this combination | | e | How it felt: ◎ → ○ → △ → none | | y | Why: S → C → M → none | | o | Shift judgment by your average timing | | x | Share a result card on X | | R | Open this chart’s ranking | | q | Back to song select | ### Show it off on X On the results screen, x draws a result card — a 1200×675 PNG with the rank, percentage, judgment counts, graph, difficulty, lanes and language — copies it to the clipboard and opens X’s post page with a draft. Paste the card with ⌘V, then post. The draft has the rank and score, the chart’s gist URL, the beatcode URL, a ranking line (bc1:…; [share] rank = false in config.toml leaves it out) and #beatcode. A bundled, AI or Gist chart that isn’t published yet asks secret or public and goes to a gist first. The card is also kept in ~/.cache/beatcode/share/. Keys on this screen: | Key | What it does | | --- | --- | | x | Make the card and open X (on the results screen) | | ⌘ V | Paste the card into the post | ### More lanes, harder charts On song select, w switches between 4, 6 and 8 lanes, and d between NORMAL and HARD. More lanes split tokens into finer kinds. HARD packs the same tokens into 16th notes. Two tokens written with no space between them in different lanes come down together, and string literals of 12 characters or more become hold notes. With no song playing, --bpm N sets the tempo (100 by default). ```sh beatcode src/main.rs --lanes 8 --hard beatcode src/main.rs --bpm 140 ``` Keys on this screen: | Key | What it does | | --- | --- | | S D F J K L | 6 lanes: keyword, identifier and type, operator and punctuation, bracket, string, number and boolean | | A S D F J K L ; | 8 lanes: keyword, identifier, type, operator, bracket, string, number and boolean, punctuation | | w | Lanes 4 / 6 / 8 | | d | NORMAL / HARD | ### Play one again from history Press p on song select to list finished plays, newest first. A ★ marks your best for that song and chart. Only plays on the current music provider (and silent ones) are listed. Enter asks what the lower right shows while you play, then starts the same song, chart, difficulty and lanes again. Plays of a file given on the command line aren’t kept. Each row shows the feel you gave it (◎ ○ △) and its reason (S C M); e and y change them here too. g publishes that play’s chart to a gist, and x makes its result card again for X. Keys on this screen: | Key | What it does | | --- | --- | | p | Open the history (on song select) | | Enter | Play the same song and chart | | f | Favorite; Tab shows favorites only | | / | Filter | | e | How it felt: ◎ → ○ → △ → none | | y | Why: S → C → M → none | | g | Publish the chart to a gist | | x | Share the result card on X | | Esc | Back | ### Connect music and more beatcode setup asks in turn: where songs play, which AI writes charts, the combo voice, the display language, folders to skip when finding repos, and (with a ranking server set) the GitHub sign-in. Pick with ↑ ↓ and Enter, or skip one with Esc. beatcode setup music (or ai, voice, language, repos, rank) asks just that one. Spotify needs Premium. YouTube Music works through the Pear Desktop app. Not now keeps playing Silent. ```sh beatcode setup ``` Keys on this screen: | Key | What it does | | --- | --- | | ↑ ↓ | Pick | | Enter | Choose | | Esc | Skip this one | ## More Source: /guide/more/ Once you’ve played a song: AI charts, handing setup to Claude Code or Codex, sharing charts as gists, config.toml and more languages. ### Have an AI write a chart On song select, press a, type a topic and press Enter. The AI writes code in the language you picked, and that code becomes the chart. You can keep picking and playing other charts while it writes. With a song picked, the topic starts as the song title and artist. ↑ ↓ picks a prompt (standard, song mood, symbol-heavy, rhythm-first, textbook), ← → a language. Write your own prompt with beatcode prompts new. Pick a blank skeleton or a prompt to start from with ↑ ↓ (or name one with --template mood), and it opens in $EDITOR with the replacements you can use listed as comments at the top; save and close it, give it a name, and it shows up in ↑ ↓. beatcode prompts list shows them all, and beatcode prompts edit changes one. Only the prompt, the topic, the language and a rough length are sent — never code from your repos. The cost shows on screen; with the default model it came to $0.0004 to $0.0005 a chart in these recordings. beatcode ai clean removes the charts the AI wrote. First, paste an API key with beatcode setup ai. beatcode checks that it works, then saves it readable only by you. Switch where it asks with beatcode provider ai . ```sh beatcode setup ai beatcode prompts new --template mood ``` Keys on this screen: | Key | What it does | | --- | --- | | a | Ask the AI (on song select) | | ↑ ↓ | Pick a prompt | | ← → | Pick a language | | Shift+↑↓ | Scroll what will be sent | | Enter | Send | | Provider | Get a key at | Environment variable | | --- | --- | --- | | openrouter (default) | openrouter.ai/settings/keys | OPENROUTER_API_KEY | | openai | platform.openai.com/api-keys | OPENAI_API_KEY | | google-ai-studio (plugin) | aistudio.google.com/apikey | GEMINI_API_KEY | ### Let Claude Code or Codex set it up beatcode skills puts the /beatcode-setup, /beatcode-teardown and /beatcode-work skills in ~/.agents/skills/, and links to them from ~/.claude/skills/ and ~/.codex/skills/ if those exist. Run /beatcode-setup in Claude Code or Codex. It looks at what’s connected — the Spotify login, AI keys, voice engines, config.toml, shell completions — and asks what to set up. Spotify and AI keys go through beatcode setup; the combo voice and icons go into config.toml; completions go into your shell rc. It never reads what’s inside a key. /beatcode-teardown is for leaving: it asks what to remove and shows the list before deleting anything. /beatcode-work does a task as usual and tells you in the crowd panel when it’s done; the Skills page has the details. ```sh beatcode skills ``` ``` Installed: ~/.agents/skills/beatcode-setup/SKILL.md Installed: ~/.agents/skills/beatcode-teardown/SKILL.md Installed: ~/.agents/skills/beatcode-work/SKILL.md Run /beatcode-setup in Claude Code or Codex ``` ### Pass a chart around as a gist Bundled charts, charts the AI wrote and charts taken from a gist can go up as a gist for someone else to play. beatcode talks to gists through gh, so you need gh auth login with the gist scope. Pick the chart and press g. ← → picks secret (anyone with the URL; the default) or public (searchable), Enter publishes. The code and the notes (.bme) go into one gist, and the URL shows at the bottom. To play one, press G on song select, paste the gist URL or ID and press Enter. It lands in the Gist source with the author’s difficulty, lanes and song (d and w still change them), and starts playing. Typing it after / on the chart row fetches it too, without playing. Charts from a public GitHub repo can be published too, as long as the files match what’s pushed. beatcode doesn’t check the license, so make sure the code may be shared. Example: https://gist.github.com/yukihirop/bf0269cdd3f7e408bdd89d08e8195e74 — R.Y.U.S.E.I. (J SOUL BROTHERS III) on Spotify, NORMAL, 4 lanes: the code (.ts) and its notes (.bme). Paste the URL with G to play it. Keys on this screen: | Key | What it does | | --- | --- | | g | Publish to a gist | | ← → | secret or public | | Enter | Publish | | Esc | Cancel | | G | Paste a gist and play it | ### Change things in config.toml Settings live in ~/.config/beatcode/config.toml. Without it everything runs on defaults. An unknown key or a typo stops beatcode with the line and column, so mistakes don’t pass silently. The provider lines of [music], [ai] and [voice] can also be changed with beatcode provider, which rewrites just that one line. ```sh beatcode provider beatcode provider music youtube-music ``` | Section | Keys | What they do | | --- | --- | --- | | [music] | provider | Where songs play: "spotify" (default) or "youtube-music" | | [ai] | provider · model · effort · xray · xray_notes | Who writes charts, which model, how hard it thinks, and the song’s X-ray in the prompt | | [voice] | provider | "voicevox" or "aivisspeech" calls out every 10 combo | | [keys] | lanes · lanes6 · lanes8 | Keys per lane (default D F J K) | | [theme] | name | default · monokai · dracula · nord · gruvbox · solarized | | [effects] | bomb · beam · crowd · combo · milestone · notices | Hit flashes, lit lanes, the crowd of faces, the big combo count, the 100-combo flash and notices from other terminals | | [sound] | se · volume | Sound effects for moving around the screens | | [display] | language · icons · logo · note_text · next_token · select_jacket | Screen language, icons, the logo, the token text on notes and in the middle of the lanes, and cover art on song select | | [share] | rank | Put the ranking line in the X draft or not | | [repos] | ignore · min_notes | Folders to skip when finding your repos, and the fewest notes in a repo chart | ### Add a language Built in: Rust, Python, Go, TypeScript, JavaScript, Ruby and PHP, plus Japanese and English prose. More can be added without rebuilding beatcode; they line up after the built-in tabs and work for your repos too. beatcode plugins install c adds one from the Releases; the Plugins page lists all of them. Describe a language in ~/.config/beatcode/langs/.toml: keywords, comments and strings (beatcode plugins example prints one for Lua). beatcode plugins lists every language and why an external one failed to load. ```sh beatcode plugins ``` ``` Rust rust .rs built-in Python python .py .pyi built-in Go go .go built-in TypeScript typescript .ts .tsx .mts .cts built-in JavaScript javascript .js .jsx .mjs .cjs built-in Ruby ruby .rb .rake built-in PHP php .php built-in 日本語 ja .md .txt built-in English en .md .txt built-in ``` ## Settings Source: /guide/config/ beatcode reads its settings from one file, config.toml. Everything has a default, so write only what you want to change. This page goes through every section. ### Where it lives Settings live in ~/.config/beatcode/config.toml (under XDG_CONFIG_HOME if it is set). Without the file, everything is default. beatcode reads it at startup. An unknown option or a typo stops beatcode with the line and column, because quietly falling back to the default would hide the mistake. After editing, check it with beatcode --help >/dev/null: it prints nothing when the file is fine. beatcode config init writes an example with every option to config.toml.example, leaving config.toml alone. Below is an example with a little of each section. Each section is explained further down. ```sh beatcode config beatcode --help >/dev/null ``` ~/.config/beatcode/config.toml: ``` version = "1.0.0" [effects] bomb = false beam = true crowd = false combo = false milestone = false [sound] se = false volume = 0.3 [display] icons = "text" logo = "text" [music] provider = "spotify" analyze = true [ai] provider = "openrouter" model = "openai/gpt-6-luna" effort = "low" [voice] provider = "aivisspeech" [keys] lanes = [["d", "Left"], "f", "j", ["k", "Right"]] [theme] name = "dracula" keyword = "#ff79c6" [plugins] external = false [repos] ignore = ["~/xxxx", "venv"] ``` ### Version The version at the top is the version of the config.toml format (x.y.z), separate from beatcode’s own version. It is 1.0.0 now; without it, the file is read as 1.0.0. beatcode setup and beatcode provider add it when they write the file. The format version goes up when an option is renamed or changes shape. A file of an older version still works, translated as it is read; beatcode config migrate rewrites it in the current format, keeps your comments, and leaves the original as config.toml..bak. A file newer than this beatcode stops with “please update beatcode”. beatcode config shows where the file is and its version. ```sh beatcode config migrate ``` ### Switching providers The provider of [music], [ai] and [voice] can be switched with a command instead of by hand. Only that one line changes; your other lines and comments stay. beatcode provider alone lists the current providers and whether they are connected, and what to run next when they aren’t. For voice, off removes the provider, so beatcode stays quiet. ```sh beatcode provider beatcode provider music youtube-music beatcode provider ai openai beatcode provider voice aivisspeech ``` ### [effects] — what shows while playing Turn the effects off one by one if they get in the way of reading the notes. | Option | Default | What it does | | --- | --- | --- | | bomb | true | A ring of light and sparks on the lane you hit | | beam | false | Light up the whole lane while you press its key. The key label under the judgment line lights up either way. Off by default, because a whole lane flashing on every press tires the eyes | | crowd | true | A parade of kaomoji along the bottom of the right pane (4 rows). Hidden when the terminal is under 30 rows | | combo | true | The big combo count and COMBO above the lanes, while 2 or more are chained. Hidden when the lanes are under 16 rows tall | | milestone | true | Every 100 combo, the big count flashes gold (rainbow at 500 and every 500 from 1000) with sparks, and the lane dividers and the judgment line pulse on the beat. With combo = false the dividers and the line still pulse | | notices | true | Show notices from work in another terminal (beatcode notify, sent by the /beatcode-work skill) in the crowd. false shows none, and beatcode notify leaves nothing either | ### [sound] — menu sound effects Short sounds for moving the cursor, switching tabs, confirming, going back, opening a screen and starting a song. Nothing plays when you hit notes. beatcode makes the sounds itself (there are no sound files) and mixes them over the music. | Option | Default | What it does | | --- | --- | --- | | se | true | false turns the sound effects off | | volume | 0.5 | Volume from 0 to 1 | ### [display] — language, icons, logo and token text The environment variables BEATCODE_ICONS and BEATCODE_LANG win over icons and language, so you can try a setting for one run without editing the file. The logo shows at startup (a 1 s splash), in the song select and history titles, above the ready screen’s guide, on the tap-the-tempo screen, in the quit box, above the rank on the result screen, in the top-right box while playing, and at the top of beatcode --help. | Option | Default | What it does | | --- | --- | --- | | icons | "nerd" | Icons for repos, files and ranks. "text" uses letters like gh / 1st, "none" shows none | | language | "auto" | Screen language: "auto" / "ja" / "en". auto picks Japanese when LC_ALL / LC_MESSAGES / LANG starts with ja, English otherwise | | note_text | true | Write the token on each falling note. false draws plain colored bars; the big next token and the code pane stay as they are | | next_token | true | Show the next token to hit large in the middle of the lanes. false hides it; the text on notes and the code pane stay as they are | | select_jacket | true | Show the cover art of the song under the cursor in the right panel while you’re on Songs in song select; false keeps the code there (terminals that can show images only; Spotify, or YouTube Music once the preview plays that song) | | logo | "auto" | auto shows the image on terminals that can show images (kitty graphics, iTerm2 or sixel; not inside tmux or in Terminal.app) and a ▀▄█ text logo elsewhere. "text" always uses the text logo, "none" shows no logo and no splash | ### [music] — where songs play from Spotify plays inside beatcode and needs Premium. YouTube Music drives the Pear Desktop app through its API server. The song list shows only the songs of the provider you pick here; another name stops beatcode with unknown variant. With Spotify, beatcode reads the song’s audio on your machine to set the tempo and where the notes go. The audio is never sent anywhere. | Option | Default | What it does | | --- | --- | --- | | provider | "spotify" | "spotify" or "youtube-music" | | url | "http://127.0.0.1:26538" | For youtube-music: where Pear Desktop’s API server is (http:// only) | | analyze | true | For spotify: read the audio to set the tempo and notes. With false it works like YouTube Music: you tap the tempo with Space, notes sit on the 8th-note grid (16th on HARD), there is no sort by fit, and previews start a third of the way in. Earlier analyses are kept and used again when you set it back to true | ### [ai] — who writes AI charts Built in are OpenRouter and OpenAI. You can also write the id of an external provider plugin (beatcode-plugin-provider-ai- on PATH), such as google-ai-studio for the Gemini API: install it with beatcode plugins install google-ai-studio and check it with beatcode plugins. Model IDs are written differently per provider (openai/gpt-6-luna on OpenRouter, gpt-6-luna on OpenAI), so change or remove model when you switch providers. The API key is asked for by beatcode setup and kept in its own file per provider, readable only by you. An environment variable wins over it. ~/.config/beatcode/config.toml: ``` [ai] provider = "openai" model = "gpt-6-luna" effort = "medium" ``` | Option | Default | What it does | | --- | --- | --- | | provider | "openrouter" | "openrouter", "openai", or an external plugin’s id | | model | the provider’s | Model ID. "openai/gpt-6-luna" on openrouter, "gpt-6-luna" on openai | | effort | the provider’s | How much to think: none / minimal / low / medium / high and so on, depending on the model. "low" on openrouter, openai and google-ai-studio. Empty to not send it | | xray | true | Add the X-ray of an analyzed song (its sections and how many notes fall in each) to the prompt. The audio itself is never sent. YouTube Music songs get none | | xray_notes | [1000, 2000] | How many notes a chart with an X-ray should have. If the song has too few spots, more come from the grid; if too many, the weakest go | ### [voice] — calling out combos With a VOICEVOX or AivisSpeech engine running on your machine, beatcode says “50 combo!” and the like while you play. The clips are made ahead on the ready screen, so they play on time. Without provider, beatcode stays quiet. beatcode voice check makes one clip with these settings and plays it. beatcode voice prepare [N] makes the clips up to N combo (1000 if left out) ahead of time. ~/.config/beatcode/config.toml: ``` [voice] provider = "voicevox" speaker = 3 every = 50 combos = [25, 75] text = "{n}コンボ!" ``` | Option | Default | What it does | | --- | --- | --- | | provider | none | "voicevox" or "aivisspeech" | | speaker | voicevox: 3 (Zundamon) / aivisspeech: "zonoko" | Speaker ID or name | | style | the first (normal) | The style when the speaker is a name ("A" and so on) | | url | voicevox: http://127.0.0.1:50021 / aivisspeech: http://127.0.0.1:10101 | Where the engine is | | every | 10 | Speak at every multiple of this. 0 for none | | combos | [] | Other combo counts to speak at, like [25, 75] | | text | "{n}コンボ!" | The words. {n} becomes the combo count | | miss_after | 100 | When a combo of at least this many breaks on a miss, say miss_text. 0 for never | | miss_text | "あ〜やっちゃったぁ〜" | The words for that | ### [keys] — lane keys List the keys from the left lane. To give a lane several keys, write a list for it. Each lane count has its own option, so changing lanes6 leaves 4 lanes as they were. A key is one character (letters are case-insensitive here) or Left Right Up Down Tab Backspace Home End PageUp PageDown Insert Delete F1–F12. Space, Enter and Esc start and stop the game, so they can’t be lane keys. The same key in two lanes is an error. ~/.config/beatcode/config.toml: ``` [keys] lanes = [["d", "Left"], "f", "j", ["k", "Right"]] lanes6 = ["q", "w", "e", "i", "o", "p"] ``` | Option | Default | | --- | --- | | lanes | ["d", "f", "j", "k"] | | lanes6 | ["s", "d", "f", "j", "k", "l"] | | lanes8 | ["a", "s", "d", "f", "j", "k", "l", ";"] | ### [keys.select] and friends — screen keys Each screen has its own table: [keys.select] for song select, [keys.history] for the play history, [keys.result] for the results and [keys.tap] for tapping the beat. Write an action’s name and its key; actions you leave out keep their default. The key hints at the bottom of the screen and messages that name a key show the keys you wrote. Keys are written as for lanes, but letters are case-sensitive: R and r are different keys. A list means any of them works. Keys that move, pick or go back can’t be assigned: ↑↓←→, h j k l, Tab, Home, End, PageUp, PageDown, Space, Enter and Esc. Those, the text inputs (the / filter and the AI topic), the confirm boxes, and the keys on the ready screen and while playing stay as they are. The same key for two actions in one table is an error. Different tables may share a key, as r does now. ~/.config/beatcode/config.toml: ``` [keys.select] history = "H" ai = ["i", "F2"] [keys.result] retry = "Backspace" ``` | Action | Table | Default | What it does | | --- | --- | --- | --- | | reload | [keys.select] | r | Songs: reload the song list. Charts: rescan your repos | | source_prev | [keys.select] | [ | The previous chart source | | source_next | [keys.select] | ] | The next chart source | | ai | [keys.select] | a | Ask the AI to write a chart | | publish | [keys.select] | g | Publish the chart to a gist | | fetch | [keys.select] | G | Paste a gist URL or ID: fetch the chart and play it | | report | [keys.select] | b | Open a bug report or an idea on GitHub | | ranking | [keys.select] | R | Open the ranking’s top page | | web | [keys.select] | W | Open the beatcode website | | commits | [keys.select] | c | Files ⇄ commit diffs of a repo | | filter | [keys.select] | / | Songs: search songs. Charts: filter the sources | | artist | [keys.select] | A | Songs: search everywhere for the artist of the song under the cursor | | sort | [keys.select] | s | Original order → most ★ → best fit for the song | | difficulty | [keys.select] | d | NORMAL / HARD | | lanes | [keys.select] | w | 4 / 6 / 8 lanes | | panel | [keys.select] | v | Code, cover art or camera in the lower right while playing | | provider | [keys.select] | P | Pick the music, AI and voice providers | | history | [keys.select] | p | Play history | | retap | [keys.select] | t | Tap the song’s beat again | | bpm_down | [keys.select] | - | Silent BPM down | | bpm_up | [keys.select] | + = | Silent BPM up | | quit | [keys.select] | q | Back a step, then ask to quit (same as Esc) | | filter | [keys.history] | / | Filter the history | | favorite | [keys.history] | f | Add or remove the ♥ | | feel | [keys.history] | e | How that play felt: ◎ good → ○ ok → △ meh → none | | reason | [keys.history] | y | Why it felt that way: S off the song → C dull chart → M my playing → none | | publish | [keys.history] | g | Pick that play's song and chart on song select and publish the chart to a gist | | share | [keys.history] | x | Make that play's results card again and show it off on X | | back | [keys.history] | q p | Back to song select (same as Esc) | | retry | [keys.result] | r | Play the same song again | | share | [keys.result] | x | Show it off on X | | ranking | [keys.result] | R | Open the board the play went on | | timing | [keys.result] | o | Set the timing offset from this play | | favorite | [keys.result] | f | Add or remove the ♥ | | feel | [keys.result] | e | How this play felt: ◎ good → ○ ok → △ meh → none | | reason | [keys.result] | y | Why it felt that way: S off the song → C dull chart → M my playing → none | | back | [keys.result] | q | Back to song select (same as Esc and Enter) | | reset | [keys.tap] | r | Start the taps over (same as Backspace) | | back | [keys.tap] | q | Back (same as Esc) | ### [theme] — colors Colors per kind of token for the code on song select and the code pane while playing (the tokens not hit yet). The code always uses all eight kinds, whatever the lane count. The lanes, notes, bombs and beams keep their own colors unless you write lanes = true. Then the literal lane of 4 lanes takes string; with 6, the identifier-and-type lane takes ident and the operator-and-separator lane takes op. A color that can’t be read stops beatcode and names the option. On terminals without 24-bit color (COLORTERM not truecolor), #rrggbb falls back to the nearest of 256 colors. ~/.config/beatcode/config.toml: ``` [theme] name = "nord" keyword = "#ff79c6" string = "lightgreen" number = "208" lanes = true ``` | Option | Default | What it does | | --- | --- | --- | | name | "default" | default / monokai / dracula / nord / gruvbox / solarized | | keyword ident type op bracket string number punct | the theme’s | Override one kind: "#rrggbb", a name like "red" or "lightgreen", or a number from "0" to "255" | | lanes | false | true paints the lanes and notes with the theme too | | comment | the theme’s | Code that isn’t played, such as comments. default uses #8b949e | | muted | #a0a0a0 | The faint gray across the screens: line numbers, the chart column in the history, hints and borders | ### [plugins] — external languages beatcode finds language plugins on your PATH (beatcode-plugin-lang-* and beatcode-plugin-nlang-*) and languages you wrote yourself in ~/.config/beatcode/langs/*.toml. Turn that off here. With external = false, external AI providers aren’t loaded either, and writing one in [ai] is an error. | Option | Default | What it does | | --- | --- | --- | | external | true | false skips external languages and providers | ### [repos] — where not to look for repos beatcode looks for your repos by finding .git up to 3 levels below your home. ignore lists directories it doesn’t go into. An entry with / or ~ is that one place (relative to home unless it starts with ~/ or /). An entry without is a directory name at any level. It doesn’t filter files inside a repo. After changing it, beatcode rescans on the next launch; you don’t have to press r. ~/.config/beatcode/config.toml: ``` [repos] ignore = ["~/xxxx", "~/go/pkg", "venv"] ``` | Option | Default | What it does | | --- | --- | --- | | ignore | none | Directories not gone into when looking for repos | | min_notes | 400 | The fewest notes a chart made from a repo file may have. Functions in the same file are joined top to bottom until they reach it, and a function over twice this is cut partway. Whatever stays short is left out of the chart list. Bundled, AI and Gist charts and commit diffs are not affected | ### [share] — the ranking With a ranking server, the results screen sends each finished play to it and says how it went. R there opens the board the play went on, and R on song select opens the ranking’s top page. You are named by your GitHub sign-in in gh, and its token goes to the server, so only write a server you trust. The Ranking server page explains running your own. ~/.config/beatcode/config.toml: ``` [share] ranking_server_url = "https://ranking.example.com" ``` | Option | Default | What it does | | --- | --- | --- | | ranking_server_url | none | The ranking server (https://…; http:// only on this machine). Left out or empty, nothing is sent | | ranking_allow_http | false | true also sends to an http:// server on another machine, such as one in your home network. Your GitHub token travels unencrypted | ### AI prompts The prompts for AI charts are Markdown files in ~/.config/beatcode/prompts/, one per file. The first time you press a, the seven bundled ones are written there: standard, song mood, symbol-heavy, rhythm-first and textbook for code, and standard and song mood for prose. They are read again each time you press a, so edits show at once. When a new beatcode bundles a new prompt, only that one is added. Prompts you deleted don’t come back, and files you edited aren’t overwritten. {lang}, {topic} and {lines} in the body are replaced (for prose, {lines} is the number of sentences). {difficulty} becomes how tokens are placed at the selected difficulty, and {lanes} the token kinds in each lane. {title}, {artist}, {bpm} and {duration} come from the selected song (empty when unknown), {ui_lang} is Japanese or English (the UI language), and {date} is today's date. If the body has {topic}, only the body is sent; otherwise the body becomes the instructions and the topic, language and length go separately. beatcode adds one instruction to every prompt: write 2–4 sentences about the feelings behind the code. They show under the graph on the result screen. {xray} puts the song X-ray (the song’s sections and how many tokens to write in each) where you write it. The page “Writing prompts” (guide/prompts/) covers it, what beatcode adds after your text, and how to print the exact text that is sent. ~/.config/beatcode/prompts/symbols.md: ``` --- name: Symbols description: short names, packed with operators and brackets length: 0.6 --- Write dense {lang} code about {topic}, about {lines} lines. ... ``` | Key | What it does | | --- | --- | | name / description | Shown in the topic box | | model / effort | Override [ai] for this prompt only | | length | Multiplier on the lines (sentences for prose) asked for, 0.1–5 | | lang | The language. Wins over the language tab | | kind | code (default) or prose. A prose lang implies prose | ### Files beatcode keeps Besides config.toml, beatcode keeps these in ~/.config/beatcode/. Key and token files are readable only by you. ~/.cache/beatcode/ (under XDG_CACHE_HOME if set) holds repos fetched from GitHub (removed by beatcode github clean), the combo voice clips, and a log of why Spotify tracks failed to load. All of it is made again when needed. | File | What it is | | --- | --- | | history.tsv | Play history, up to 1000 plays | | favorites.tsv | ♥ favorites | | spotify/ | Spotify login, song analysis, tapped tempos, output latency, track names and searched songs | | youtube-music/ | Pear Desktop token, tapped tempos and searched songs | | judge_offset.tsv | Timing offset, separately for silent, Spotify and YouTube Music | | .key | AI keys, one per provider (openrouter.key and so on) | | ai/ prompts/ ai_prompt.txt | Charts the AI wrote, prompts, and the last prompt used | | gist/ | Charts fetched from gists and the URLs of charts you published | | repos.tsv github.tsv | Your local and GitHub repos (r rescans) | | difficulty.txt lanes.txt panel.txt | The last difficulty, lane count and lower-right panel | | langs/*.toml | Languages you wrote yourself (beatcode plugins example prints a sample) | ## Plugins Source: /guide/plugins/ Plugins add what beatcode doesn’t ship with: 53 programming languages, 46 written languages, two more AI providers, a recorder and a gist previewer. Each is a small program that beatcode starts when it needs it. ### Install and remove beatcode plugins install with no name lists every plugin in the Releases of the same version as your beatcode. Give names to install them: the short form (c, zh, ollama, record) is enough when it means one plugin. Each one is downloaded for your machine (Apple silicon or Intel), checked against its SHA-256 and put in ~/.local/share/beatcode/plugins/. beatcode looks there after PATH, so a plugin of the same name on PATH wins. A new language gets its own tab after the built-in ones, with two or three bundled charts, and is used for the files in your repos too. beatcode plugins uninstall zh removes one. ```sh beatcode plugins install c zh ``` ``` Downloading beatcode-plugin-lang-c-aarch64-apple-darwin.tar.gz Installed: ~/.local/share/beatcode/plugins/beatcode-plugin-lang-c Downloading beatcode-plugin-nlang-zh-aarch64-apple-darwin.tar.gz Installed: ~/.local/share/beatcode/plugins/beatcode-plugin-nlang-zh Check with: beatcode plugins ``` ### Programming languages 53 languages. Charts from code in them: the bundled ones, AI charts and the files in your repos. The name on the left is what you give beatcode plugins install. | Install | Language | Files | | --- | --- | --- | | asm | Assembly | .s .asm | | batch | Batch | .bat .cmd | | c | C | .c .h | | clojure | Clojure | .clj .cljs .cljc .edn | | cobol | COBOL | .cob .cbl .cpy | | coffeescript | CoffeeScript | .coffee | | cpp | C++ | .cpp .cc .cxx .hpp .hh .hxx .h .ipp .tpp .inl .ixx .cppm | | csharp | C# | .cs .csx | | css | CSS | .css .scss | | cuda | CUDA | .cu .cuh | | dart | Dart | .dart | | dockerfile | Dockerfile | Dockerfile Containerfile *.Dockerfile | | elixir | Elixir | .ex .exs | | erlang | Erlang | .erl .hrl | | fsharp | F# | .fs .fsi .fsx | | gleam | Gleam | .gleam | | graphql | GraphQL | .graphql .gql | | groovy | Groovy | .groovy .gradle | | haskell | Haskell | .hs | | html | HTML | .html .htm | | ipynb | Jupyter | .ipynb | | java | Java | .java | | json | JSON | .json | | julia | Julia | .jl | | kotlin | Kotlin | .kt .kts | | liquid | Liquid | .liquid | | lua | Lua | .lua | | make | Makefile | Makefile GNUmakefile .mk .mak | | mdx | MDX | .mdx | | moonbit | MoonBit | .mbt | | nim | Nim | .nim .nims .nimble | | nix | Nix | .nix | | objc | Objective-C | .m .mm .h | | ocaml | OCaml | .ml .mli | | perl | Perl | .pl .pm .t | | powershell | PowerShell | .ps1 .psm1 .psd1 | | prisma | Prisma | .prisma | | proto | Protocol Buffers | .proto | | r | R | .r | | scala | Scala | .scala .sc | | shell | Shell | .sh .bash .zsh | | solidity | Solidity | .sol | | sql | SQL | .sql | | svelte | Svelte | .svelte | | swift | Swift | .swift | | tcl | Tcl | .tcl .tm .tk | | terraform | Terraform | .tf .tfvars .hcl | | toml | TOML | .toml | | vim | Vim script | .vim vimrc gvimrc | | vue | Vue | .vue | | xml | XML | .xml .xsd .xsl .xslt .plist | | yaml | YAML | .yml .yaml | | zig | Zig | .zig .zon | ### Written languages 46 languages, for charts from text instead of code. Like the bundled Japanese and English, they read .md and .txt files and look at the text to tell which language it is, so a German README becomes a German chart. | Install | Language | Name on the tab | | --- | --- | --- | | am | Amharic | አማርኛ | | ar | Arabic | العربية | | bn | Bengali | বাংলা | | cs | Czech | Čeština | | da | Danish | Dansk | | de | German | Deutsch | | el | Greek | Ελληνικά | | es | Spanish | Español | | fa | Persian | فارسی | | fi | Finnish | Suomi | | fr | French | Français | | gu | Gujarati | ગુજરાતી | | he | Hebrew | עברית | | hi | Hindi | हिन्दी | | hu | Hungarian | Magyar | | hy | Armenian | Հայերեն | | id | Indonesian | Bahasa Indonesia | | it | Italian | Italiano | | ka | Georgian | ქართული | | km | Khmer | ខ្មែរ | | kn | Kannada | ಕನ್ನಡ | | ko | Korean | 한국어 | | ml | Malayalam | മലയാളം | | mr | Marathi | मराठी | | ms | Malay | Bahasa Melayu | | my | Burmese | မြန်မာ | | nb | Norwegian Bokmål | Norsk | | nl | Dutch | Nederlands | | pa | Punjabi (Gurmukhi) | ਪੰਜਾਬੀ | | pl | Polish | Polski | | pt | Portuguese | Português | | ro | Romanian | Română | | ru | Russian | Русский | | si | Sinhala | සිංහල | | sv | Swedish | Svenska | | sw | Swahili | Kiswahili | | ta | Tamil | தமிழ் | | te | Telugu | తెలుగు | | th | Thai | ไทย | | tl | Tagalog | Tagalog | | tr | Turkish | Türkçe | | uk | Ukrainian | Українська | | ur | Urdu | اردو | | vi | Vietnamese | Tiếng Việt | | zh-hant | Traditional Chinese | 繁體中文 | | zh | Chinese | 中文 | ### AI providers OpenRouter and OpenAI are built in. These two add more places to send AI chart requests. beatcode setup ai also lists them and installs the one you pick. Switch with beatcode provider ai , then paste the key in beatcode setup ai. Ollama runs on your own machine and doesn’t use a key, but beatcode won’t ask without one, so enter anything. ```sh beatcode plugins install ollama beatcode provider ai ollama ``` | Install | Provider | Key | Default model | | --- | --- | --- | --- | | google-ai-studio | Google AI Studio (Gemini API) | aistudio.google.com/apikey · GEMINI_API_KEY | gemini-3.5-flash-lite | | ollama | Ollama, on your machine (localhost:11434) | Not used (enter anything) | qwen3.8:27b-mlx | ### beatcode record A plugin can add a command. beatcode record starts beatcode, records the screen and the sound of beatcode and YouTube Music, and makes an .mp4 in the current folder when you quit. It needs ffmpeg. The videos on this site were made with it. The song is in the video, so don’t share what you record. On macOS 14.2 and later, the first run asks to allow beatcode record to capture system audio. ```sh beatcode plugins install record beatcode record ``` ### beatcode gist preview beatcode gist preview takes a beatmap gist’s URL or ID and opens a page in your browser, the same as a board on the ranking: the song’s card, and its notes playing themselves without sound. Play this song copies the gist’s URL to paste after G on the song select. It fetches the gist with gh, so it shows your secret gists too. -o writes the page where you say; --no-open only writes it. ```sh beatcode plugins install gist beatcode gist preview ``` ### Make your own Without writing a program: describe a language in ~/.config/beatcode/langs/.toml with its keywords, comments and strings. beatcode plugins example prints one for Lua. As a program: put an executable called beatcode-plugin-lang- (beatcode-plugin-nlang- for a written language) on PATH. beatcode talks to it in JSON lines. In Rust, implement LangPlugin from beatcode-plugin-api and call beatcode_plugin_api::protocol::serve. beatcode plugins lists every language, where it comes from and why one failed to load. To read no external languages at all, set [plugins] external = false in config.toml. ```sh beatcode plugins ``` ``` Rust rust .rs built-in … English en .md .txt built-in C c .c .h ~/.local/share/beatcode/plugins/beatcode-plugin-lang-c 中文 zh .md .txt ~/.local/share/beatcode/plugins/beatcode-plugin-nlang-zh ``` ## Skills Source: /guide/skills/ beatcode comes with three skills for coding agents. They set beatcode up for you, remove it when you’re done, and tell you in the crowd panel when work you handed to Claude Code is finished. ### Install the skills beatcode skills puts the three skills in ~/.agents/skills/. The skills are built into beatcode, so they match the version you have; run it again after updating beatcode to refresh them. If ~/.claude/skills/ or ~/.codex/skills/ exists, it also links each skill there, so Claude Code and Codex find them. A skill of the same name that’s already there is left alone. ```sh beatcode skills ``` ``` Installed: ~/.agents/skills/beatcode-setup/SKILL.md Installed: ~/.agents/skills/beatcode-teardown/SKILL.md Installed: ~/.agents/skills/beatcode-work/SKILL.md Installed: ~/.claude/skills/beatcode-setup -> ~/.agents/skills/beatcode-setup Installed: ~/.claude/skills/beatcode-teardown -> ~/.agents/skills/beatcode-teardown Installed: ~/.claude/skills/beatcode-work -> ~/.agents/skills/beatcode-work Run /beatcode-setup in Claude Code or Codex ``` ### /beatcode-setup Gets beatcode ready to play for the first time. It looks at what’s already there (the Spotify login, the AI key, the voice engine, config.toml and shell completion) and asks what you want to connect. Spotify and the AI key go through beatcode setup, which the skill walks you to. The combo voice and how icons are drawn go in config.toml, and shell completion is one line in your rc file. It never reads or shows your keys; it only checks whether they exist. ```sh /beatcode-setup ``` ### /beatcode-teardown Removes what beatcode left on your machine: ~/.config/beatcode/ (settings, play history, the Spotify login, the AI key and AI charts), ~/.cache/beatcode/, the plugins in ~/.local/share/beatcode/, the two completion lines in your rc file, the skills and their links, and the binary. It asks what to remove, and shows the list before deleting anything. ```sh /beatcode-teardown ``` ### /beatcode-work Hand Claude Code some work and keep playing. /beatcode-work does the work as usual, and when it’s done, a kaomoji walks “: ” across the crowd panel, in play and under the jacket or code on the song select. It says so when the work failed, too. If Claude Code stops partway, you see that as well: “has a question — ” before it asks you something, and “is waiting for permission — ” when it needs your OK. These only show while the work is going, so ordinary chats stay quiet. Where the crowd isn’t shown (the results screen, a terminal shorter than 30 rows, or [effects] crowd = false), notices wait and the song select shows how many in its title. To turn them off, set [effects] notices = false in config.toml. /beatcode-work is long to type every time, so we recommend giving it a short name: link it as bcw in ~/.claude/skills/ and Claude Code also calls it as /bcw. beatcode skills doesn’t make this link, so when you stop using beatcode, remove ~/.claude/skills/bcw yourself. ```sh ln -s ~/.agents/skills/beatcode-work ~/.claude/skills/bcw /bcw fix the failing tests ``` ### beatcode notify /beatcode-work uses beatcode notify, which you can call from anything: a script, a build, another agent. Each call leaves one notice, and the crowd walks them in order. --begin and --end mark the current folder’s work as started and finished; --end also leaves “: ”. --hook reads a Claude Code hook’s JSON and only leaves a notice while that folder’s work is marked. ```sh beatcode notify "build finished" cargo build && beatcode notify "build OK" || beatcode notify "build failed" ``` ## Writing prompts Source: /guide/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. ### Start 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 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”. ```sh beatcode prompts new --template mood beatcode prompts edit mood ``` ### Read 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. ```sh beatcode xray --show mood.md typescript beatcode xray "Shining Star" --show mood.md typescript ``` ### Where {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 … , the shape in , and the checklist in . 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. ~/.config/beatcode/prompts/festival.md: ``` --- name: Festival description: 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} ``` ### What 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 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. ### What 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 --show helps you check that the text itself is clear. ## Ranking server Source: /guide/ranking-server/ Put a ranking server in config.toml and beatcode sends each finished play to it. The server is one Docker image: the ranking page and the API on one address, with the plays in one SQLite file. ### What you get Every chart anyone plays gets its own board. The page lists them with the song’s cover, how many have played and when, and you can narrow them to Spotify, YouTube Music or silent play. A board puts the top three on a podium with their score, accuracy and grade, and the rest in a table with their judgements and max combo. When the chart came from a gist, the play preview plays the notes by itself, and Play this chart copies the chart’s gist URL: press G on beatcode’s song select and paste it to play the same chart. Each player has a page with their best on every chart and where it ranks. Press R on beatcode’s result screen to jump straight to the board the play went on. ### Let a coding agent set it up Copy this prompt into a coding agent (Claude Code, Codex and the like) on the machine that will run the server, or the one you reach it from. It reads this site, asks where to run it, writes the compose file and points your beatcode at it. It asks before starting anything, and leaves the GitHub App’s secret, the sign-ins (gh, beatcode setup rank) and the Cloudflare tunnel token for you. Tokens are only checked for, never read. Prompt for your coding agent: ``` Set up a ranking server for beatcode, a rhythm game that runs in the terminal, and point my beatcode at it. 1. Read https://beatcode.run/llms-full.txt first. It is the whole beatcode site; follow its Ranking server page. 2. Ask me where to run it: on this machine with Docker, on a Raspberry Pi with Cloudflare Tunnel, or on a hosting service. Ask for the https address people will open (PUBLIC_URL) too, if there is one. 3. Look without changing anything: whether docker and docker compose work, and my ~/.config/beatcode/config.toml. 4. Tell me how to make the server's GitHub OAuth App as the page shows (Device Flow on, token expiration opted out), and let me make it myself. Write compose.yaml as the page shows, with /data on a volume (on a Raspberry Pi, on a USB SSD). Make .env readable only by me (chmod 600) and let me paste GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET and, for Cloudflare Tunnel, the tunnel token into it myself. Show me the file and ask before starting it, then check that /healthz answers {"ok":true}. 5. Add ranking_server_url under [share] in my config.toml (read it first and add to [share] if it is there), then run beatcode --help to check it still loads. 6. Give me beatcode setup rank to run myself. It signs in on github.com. 7. Never read or print tokens or secrets: gh's, the GitHub App's, the tunnel's or beatcode's. Only check whether they exist. 8. At the end, tell me the page's address, where ranking.db is and how to back it up, and anything left undone. ``` ### A GitHub App for the server Each ranking server signs its players in with its own GitHub OAuth App, so a token a player sends to one server can’t be used on another. Make one at GitHub → Settings → Developer settings → OAuth Apps → New OAuth App (any homepage and callback URL, such as the page’s address). On the App’s page, tick Enable Device Flow, opt out of token expiration (Activate optional features → Token expiration; beatcode doesn’t refresh tokens, so they would stop after 8 hours) and generate a client secret. Give the server GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET, and keep the secret out of any repository. Without them the page shows but plays are turned down. ### Run it One container is the whole ranking. Open http://localhost:8080 for the page. The plays are kept in the volume at /data; without it, they go when the container does. There is no database to run beside it: the server reads and writes /data/ranking.db, an SQLite file, itself. ```sh docker run -d --name beatcode-ranking --restart unless-stopped -p 8080:8787 -v beatcode-ranking:/data -e GITHUB_CLIENT_ID= -e GITHUB_CLIENT_SECRET= ghcr.io/yukihirop/beatcode-ranking:latest ``` ### With Docker Compose The same in a compose.yaml, with PUBLIC_URL set. GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET come from a .env next to it, readable only by you. Start it with docker compose up -d. ```sh docker compose up -d ``` compose.yaml: ``` services: ranking: image: ghcr.io/yukihirop/beatcode-ranking:latest restart: unless-stopped environment: PUBLIC_URL: https://ranking.example.com GITHUB_CLIENT_ID: ${GITHUB_CLIENT_ID} GITHUB_CLIENT_SECRET: ${GITHUB_CLIENT_SECRET} ports: - "8080:8787" volumes: - ranking-data:/data volumes: ranking-data: ``` ### Settings The server is plain HTTP. For HTTPS, put your own proxy (Caddy, nginx or a hosting service’s) in front of it and set PUBLIC_URL to the https address. beatcode sends the player’s GitHub token (read:user only, from beatcode setup rank) with each play, so it sends only to https:// addresses, and to http:// only on your own machine (localhost, 127.0.0.1, [::1]). Scores are self-reported, and the server limits how often one address or player can send. It logs sign-ins, turned-down plays and requests over the limits as JSON lines on its output (docker compose logs ranking). | Variable | Default | Meaning | | --- | --- | --- | | PUBLIC_URL | none | Where people open the page. The links in a board’s card (the picture X shows under a shared board) start with it. Left out, the address the request came to is used, which is http:// behind an HTTPS proxy | | GITHUB_CLIENT_ID / GITHUB_CLIENT_SECRET | none | The server’s GitHub OAuth App (see above). Without them the server takes no plays | | TRUST_PROXY | none | 1 only when a proxy in front sets X-Forwarded-For, -Proto and -Host itself. The limits then count each player’s address instead of the proxy’s | | PORT | 8787 | The port the server listens on inside the container. Most hosting services set it | | GITHUB_API_URL | https://api.github.com | Where the server asks whether a play’s token is its App’s, and reads gists | | SHOW_SECRET_GISTS | none | 1 links a board to the beatmap gist its play preview comes from even when the gist is secret (beatcode makes a secret one when it sends a play). Anyone who opens the board can then open the gist, so set it only for a ranking only people you know open | ### Send plays to it Put the page’s address in config.toml. Each time you finish a song, the results screen sends the play and says how it went; R there opens the board it went on. Then sign in once with beatcode setup rank (a code to enter on github.com). beatcode signs in with that server’s GitHub App and keeps the token for that server only. It can only read your profile (read:user) and works only on that server, but still only put in a server you trust. The address has to be https:// (http:// only for localhost). ~/.config/beatcode/config.toml: ``` [share] ranking_server_url = "https://ranking.example.com" ``` ### On a hosting service A host that runs a Docker image can run it as is: the image ghcr.io/yukihirop/beatcode-ranking, a volume (a persistent disk) at /data, PUBLIC_URL, and GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET (the secret in the host’s secret settings). Set TRUST_PROXY=1 if the host’s proxy sets X-Forwarded-For itself. SQLite is one file on that one disk, so run one copy, not several. ### On a Raspberry Pi with Cloudflare Tunnel A Raspberry Pi 4 or 5 with a 64-bit OS runs the image too: it is built for arm64. A Cloudflare Tunnel gives it an https address without opening a port on the Pi or your router, and keeps your home IP out of sight. It needs a domain on Cloudflare; a Quick Tunnel (trycloudflare.com) changes its address every time, so it doesn’t suit a ranking. In Cloudflare’s dashboard, create a tunnel under Networking → Tunnels, pick Docker and keep only the token from the command it shows. Then add a route: Published application, your subdomain and domain, and the service URL http://ranking:8787 — the service name and port inside the compose file below. The compose file has no ports at all: the tunnel is the only way in. Keep the tokens in .env next to it, readable only by you. All requests come through cloudflared, so to count each player for the limits add TRUST_PROXY: "1" to ranking’s environment (Cloudflare adds the player’s address to X-Forwarded-For; not tried yet). Put /data on a USB SSD rather than the SD card, which wears out under SQLite’s writes, and copy ranking.db somewhere else now and then (Update and back up, below). With restart: unless-stopped, both come back on their own after a power cut. ```sh curl -fsSL https://get.docker.com | sh printf 'TUNNEL_TOKEN=\nGITHUB_CLIENT_ID=\nGITHUB_CLIENT_SECRET=\n' > .env && chmod 600 .env docker compose up -d curl https://ranking.example.com/healthz ``` compose.yaml: ``` services: ranking: image: ghcr.io/yukihirop/beatcode-ranking:latest restart: unless-stopped environment: PUBLIC_URL: https://ranking.example.com GITHUB_CLIENT_ID: ${GITHUB_CLIENT_ID} GITHUB_CLIENT_SECRET: ${GITHUB_CLIENT_SECRET} volumes: - /mnt/ssd/beatcode-ranking:/data cloudflared: image: cloudflare/cloudflared:latest restart: unless-stopped command: tunnel --no-autoupdate run environment: TUNNEL_TOKEN: ${TUNNEL_TOKEN} ``` ### Update and back up The server makes its tables match the schema each time it starts, so pulling the new image and starting it again is the update. Versions are tagged (0.1.0); latest is the newest. Every play is in /data/ranking.db. Copy it out while nothing is being sent. docker compose down -v removes the volume and every play with it. ```sh docker compose pull && docker compose up -d docker compose cp ranking:/data/ranking.db ./ranking.db ``` ## Philosophy Source: /philosophy/ Giving sleeping code a beat again. ### I stopped writing code These days I hardly write code myself. I tell Claude Code or Codex what I want, wait a little, and working code comes back, tests passing. It almost never gets it wrong. It's fast, and it's right. Still, something went missing: the fun of writing it by hand, getting stuck, and finally seeing it run. ### Code that had gone to sleep Then, tidying the files on my PC, I kept finding code I had written long ago. Scripts I no longer ran, projects I had stopped halfway, functions I had once fought hard to get right. Reading them again, the way I thought back then and the habits I had were all still there. Too good to delete, yet with nowhere left to use them. Code I had written by hand, one line at a time. Could it be put to some use? ### Music in the terminal The other half was an everyday habit. While I wrote code, Spotify played from a TUI in the terminal. The editor, git and the music all lived on the same black screen. Looking at that screen, the two came together. ### Code as a chart Keywords, identifiers, operators, literals: code already has a rhythm. Deep nesting turns into a flurry, a long string into a hold. Your old code falls toward the judgment line in time with a song you love, and you hit it. Clear a song, and you've written a function. That's how beatcode began. ### What it holds to - It stays in the terminal. You play without leaving the place you already work in. - Your own code is the chart. Not only the bundled songs: code from your local repos and gists can be played too. - Your code stays with you. Code in your local repos is turned into charts on your machine. Even when an AI writes a chart, none of your code is sent. - It works with what you already use. The music you already listen to on Spotify or YouTube Music, the editor you already use, the repos you already have. - Anyone, anywhere, gets the rules. Notes fall; hit them on the line. No need to read the code, and no language barrier to playing.