wormhole CLI

Keep the opening of a phrase and listen to two ways back. Start with a MIDI clip or a saved wormhole session.

 wormhole-cli endings --input sketch.mid --keep-bars 2 --output returns

Open returns/pedal-return.wav and returns/short-return.wav to compare. The pedal version sustains a new bass beneath the upper line. The short version clips the accompaniment and moves snare attacks later. Each stereo audition is 48 kHz and matched to the same RMS level with peak headroom.

Drag either .mid into your DAW for editable parts. Open its .wormhole in the standalone app to hear section B. Switch to A for the original. source.wormhole also opens the unedited phrase. manifest.json records the input hash, protected bars, output names, frame counts, RMS and peaks.

Find the installed command

The installer puts wormhole-cli on your path on both systems. In macOS Terminal the second line prints the absolute path to paste into your desktop MCP client’s command field. Set its single argument to mcp.

wormhole-cli --version
printf '%s\n' /Applications/wormhole.app/Contents/Helpers/wormhole-cli

In Windows PowerShell the second line prints the absolute MCP command path.

wormhole-cli --version
(Get-Command wormhole-cli).Source

Choose the material

--keep-bars N retains every note starting in the first N bars, including its full duration. Upper-line notes and pitched notes crossing a bar line stay in place throughout the return. The default upper line is MIDI channel 2. Use --melody-channel 5 for a melody on channel 5. Incoming channel 10 is drums, channel 3 is bass and remaining channels become keys. Exported keys, upper, bass and drums use channels 1, 2, 3 and 10.

When a song contains a recorded reference take, inspect reports its filename, start bar, sample rate, level and playback setting. edit and arrange retain the embedded audio and plug-in rack. Use the Mac standalone’s song export to render that mix or its separate Reference.wav stem.

The instrument uses 4/4, a constant whole-number tempo of 30–240 BPM and a 480 PPQ clock. Import accepts format 0 or 1 MIDI files with up to 640 notes, an exact bar endpoint and up to 16 bars. Input PPQ can differ when notes and endpoints land on the instrument grid. Sustain pedal (CC64) is tracked separately on each pitched MIDI channel. Channel 10 drum hits keep their played lengths. A released key keeps sounding until you lift the pedal, play that pitch again or reach the end of the clip. These durations are editable and carry through to exported MIDI. Other controllers, changing tempo, incompatible meters and unpaired note events produce errors. Export your clip with the ending rest included.

The default ending covers the remaining bars. If you keep the entire phrase, the command adds up to two bars. Specify --ending-bars N to choose the return length. Output must fit within 16 bars and retain all source notes. Choose a new output folder beside an existing folder you can write to.

Inspect and edit

wormhole-cli info
wormhole-cli inspect --input sketch.mid
wormhole-cli edit --input returns/pedal-return.wormhole --action root --bar 3 --delta -2 --output lower.wormhole

Bar numbers start at 1. Root moves by semitones, register by octaves and displace by 60 ticks. Voicing cycles through four shapes. Other actions include pin, contrary, derive, length, variation, section, mix, automix and bpm. Section takes the source index, from 0 for A through 7 for H. Mix uses bar 1–4 for the four parts and delta in percentage points. Each edit saves a new file. Inspect, edit and endings use the activation on this computer.

Every operation and edit action

info lists both. Terse reference for agents and power users; --delta is the target value unless noted.

new --output F
A fresh song.
start_under --pitch_classes "A C E G" --output F
Start chords under a melody's pitch classes.
export --output DIR
master.wav, keys/upper/bass/drums.wav, song.mid, session.wormhole, manifest.json.
costume
bar; 0 as played, 1 m11, 2 m13, 3 sus, 4 maj#11, 5 alt, 6 triad, 7 diatonic 7th.
push
bar 2+; 0 on the beat, 1 eighth early, 2 sixteenth early.
groove
0 as played, 1 pulse, 2 structure, 3 ghosts.
swing
50–75.
stride
bass stride, 1 roots to 4 melodic; 5 kick: a bass note on every kick, following kick edits.
vary
doubles the phrase; 1 swap last two topline notes, 2 lift the last an octave, 3 punctuation chord.
contrast
new section; 1 direction, 2 harmonic rhythm, 3 colour, 4 push, 5 length, 6 diatonic, 8 journey home.
home
back to the section a contrast grew from (refused with NoHomeToReturnTo otherwise).
tag
1 on, 0 off.
intro
adds an intro.
start
1 chords, 2 groove 3-3-2, 3 groove 2-2-3, 4 groove in fives, 5 empty phrase.
comma
five chord as punctuation; 0 end of bar 4, 1 end of the section.
add_chords
m11 pair under a phrase with no chords (PhraseAlreadyHasChords otherwise).
fill_topline
held shared-tone line over a phrase with no upper line (PhraseAlreadyHasTopline otherwise).
band / flavour / session
0–3 solo, duo, trio, full / 0–4 classic, house, soul, hiphop, lofi / 0–65535.
root, contrary, register, voicing, displace
bar; semitones, contrary motion, octaves, four shapes, snare by 60 ticks.
pin, derive, length, variation, section, bpm, automix
pin the topline, derive the bass, bars ±delta, B from A, select source 0–7, tempo ±delta, automatic mix.
mix
bar 1–4 = keys, upper, bass, drums; delta in percentage points.
tie_across
bar; delta = shared tone held into the next bar.
make_unique, insert_section, remove_section, move_section
bar = song slot; insert takes the source index as delta, move the number of places.

Arrange a song

wormhole-cli arrange --input sketch.wormhole --order ABA --output song.wormhole

Use one to eight existing section letters, from A through H. An edit to A is heard each time A returns. Inspect reports the order, each source length and total song bars. Open the new session in the standalone and choose Play song.

To edit a single return, copy that occurrence into its own source. For an ABA song, this command creates ABC, selects C and leaves the first A intact.

wormhole-cli edit --input song.wormhole --action make_unique --bar 3 --output distinct-return.wormhole

JSON Lines API

Start wormhole-cli api and send one UTF-8 JSON object per line. Responses carry v, the supplied id and ok. On success read result. On failure read error. The process accepts another request after an error.

{"v":1,"id":"a","op":"info"}
{"v":1,"id":"b","op":"endings","input":"sketch.mid","keep_bars":2,"melody_channel":2,"output":"returns"}

Connect a desktop client

Register a local stdio MCP server with the executable wormhole-cli and the single argument mcp. In a desktop client that does not inherit your shell PATH, use the full installed executable path. Give file paths as absolute paths when the client opens in another working directory. The server exposes info, new, inspect, edit, arrange, endings, start_under and export with argument schemas.

{"mcpServers":{"wormhole":{"command":"wormhole-cli","args":["mcp"]}}}

Try “Use wormhole to keep bars one and two of my sketch. Keep the held melody on channel two and make two different endings in a new folder. Give me both WAVs to compare.”