Docs · OSMD 3.0
OSMD and coding assistants
A coding assistant writes OSMD code from what it read in training, and that was written for OSMD 1.x and 2.x: 3.0 is new. So it calls dispose() where 3.0 has destroy(), sets a transposition that does nothing without a calculator, or reaches for a playback API that public OSMD doesn’t have. A few kilobytes in your repository fix most of that.
A snippet for AGENTS.md
agents-snippet.md holds about 6 KB of notes for your project’s AGENTS.md (or CLAUDE.md, or your editor’s rules file): load and render, the component pattern with destroy(), the pitfalls from these guides and the FAQ, where the docs are, and what is free and what isn’t. From your project’s folder, append it with curl -sL https://opensheetmusicdisplay.org/agents-snippet.md >> AGENTS.md, or open it and copy what you need.
Every code block in it is a file from the samples our CI runs against the published package, the same files these guides show. The snippet is built from them, so fetch it again after an OSMD release.
Why a file in your repository: the assistant reads it every time, while a tool or a skill gets called only when the assistant thinks of it. In Vercel’s evaluation of an agent on new Next.js APIs, an 8 KB docs index in AGENTS.md passed every task; a skill passed 53%, the same as no docs at all.
When generated code doesn’t work
Check these first; the snippet has each of them.
render()called beforeload()resolved.load()is async.osmd.zoomin lower case, or a newZoomwithout arender()after it.osmd.Sheet.Transposeset withoutosmd.TransposeCalculator: nothing happens.- A component that never calls
destroy(): the old instance keeps its loaded score and its resize observer. - In Node.js, a named import from the package: it’s a CommonJS build, see Rendering in Node.js.
llms.txt and Context7
llms.txt lists every page of this site with its description, for assistants that look for it. If your assistant has the Context7 MCP server, OSMD is there as /opensheetmusicdisplay/opensheetmusicdisplay, read from the repository’s develop branch.
Free and OSMD Extended
Everything in the snippet runs on public OSMD, free under BSD-3. The audio player, audio export, Jianpu and OSMD Native are OSMD Extended, the sponsors’ build, and the snippet tells the assistant so.