morphyDocs

Drive Morphy from your tools

Start chats, send them work and read their answers from a script, an editor or an app of your own, through Morphy's bridge.

Any program on your computer can drive your chats in Morphy: start a chat in a folder, send it a message, wait for its answer and read it, stop it. A build script can hand a review to Claude, an editor extension can send a file to a chat, your own app can run a team of agents. It's the same bridge Morphy's own chat uses to run your other chats.

Beta

The bridge works today, but it's new as a public way in. Commands may still change. A change will be in the release notes.

Morphy has to be running. The bridge only works on the computer Morphy runs on: there's no network port, and cards can't use it.

The command tool

Morphy keeps a small command tool in its data folder, and writes it again every time it starts:

  • Windows: %APPDATA%\Morphy\assistant\scripts\morph-ctl.mjs
  • Mac: ~/Library/Application Support/Morphy/assistant/scripts/morph-ctl.mjs
  • Linux: ~/.config/Morphy/assistant/scripts/morph-ctl.mjs

Run it with Node.js:

node "$HOME/Library/Application Support/Morphy/assistant/scripts/morph-ctl.mjs" status

On Windows: node "%APPDATA%\Morphy\assistant\scripts\morph-ctl.mjs" status. Don't change the file: Morphy replaces it at its next start.

CommandWhat it does
status [--tag <tag>] [--json]Every chat: its id, AI, model, name, folder, what it's doing and its last message
spawn --provider <ai> [--cwd <folder>] [--prompt "…"] [--title "…"] [--model <id>] [--tags a,b]Starts a new chat, sends it the prompt once it's up, and prints its id
spawn … --count 3 or --models a,b,cSeveral chats at once: copies of one, or one per model with the same prompt
send <chatId> "text" [--model <id>]Sends a message to a chat
results [--id <chatId> | --tag <tag>] [--full] [--json]The last answer of each chat
history <chatId>A chat's recent messages, to tell chats apart
modelsThe model ids you can ask for, per AI
interrupt <chatId>Stops what a chat is doing, like its Stop button
close <chatId>Closes a chat
set-cwd <chatId> <folder>Moves a chat to another folder
focus <chat or card…> [--primary <one>] [--view tiles|stage|strip] · unfocusOpens chats and cards in focus mode, and leaves it

--provider takes claude, codex, grok, copilot, opencode, antigravity, openrouter-agent, ollama, or custom, custom-2… for your own providers. The AI has to be connected in Morphy first.

What to know

  • Morphy's own chat is main. Other chats have ids like chat-k3x9p2ab: spawn prints the new one, and status lists them all.
  • A message shows in the chat as if you'd typed it, and you can take over at any time.
  • A chat that's working answers busy. Wait until status shows it done, then send again. A chat that's asleep wakes up for the message. A chat open as a terminal takes no messages from here.
  • New chats start like any new chat: the model, effort and permission mode you set for new chats in Settings → General, unless you name a model.
  • Tags keep a batch together. Spawn several chats with --tags review and read all their answers with results --tag review.
  • On Freemium, only 3 agents work at a time. A message for a fourth waits its turn by itself.

An example

Ask Claude and Codex to review the same change, then read what they said:

CTL="$HOME/Library/Application Support/Morphy/assistant/scripts/morph-ctl.mjs"
ASK="Review the last commit for bugs. Don't change anything."

node "$CTL" spawn --provider claude --cwd ~/code/shop --title "Claude review" --tags review --prompt "$ASK"
node "$CTL" spawn --provider codex --cwd ~/code/shop --title "Codex review" --tags review --prompt "$ASK"

# a few minutes later
node "$CTL" results --tag review --full

To compare models of one AI instead, models lists their ids and spawn --models a,b,c starts one chat per model.

From any language

The command tool is a thin layer over files, so a program in any language can use the bridge directly. Everything is in the .morph folder of Morphy's data folder.

Send commands by writing a JSON file into .morph/agent-ipc/:

{ "ops": [ { "op": "send", "id": "main", "text": "Summarise today's commits" } ] }
  1. Write it as <name>.tmp, then rename it to <name>.json, so Morphy never reads half a file. Pick a name nothing else uses.
  2. Morphy runs the commands in order, deletes the file and writes <name>.result.json: { "ok": true, "results": [ … ] }, one result per command, each with its own ok (and an error when it failed).
  3. Read the result and delete it. If none comes, Morphy isn't running (the command tool gives up after 20 seconds).

The commands:

opFieldsAnswers
statusid, ids, tag or tags (optional: all chats without)chats, by id
resultthe sameresults: each chat's last answer, up to 20,000 characters
createprovider, and optionally cwd, prompt, title, model, tags, x, y, w, hid of the new chat
sendid, text, optionally modelok, or error: busy, starting, no-host (closed), terminal
interrupt · closeidok
set-cwdid, cwdok
modelsproviders: the model ids per AI
focus · unfocusnodes (chat:<id>, card:<file>), primary, viewok

create places the chat at x, y in canvas pixels (the command tool puts new chats to the right of everything). Give w and h too, for example 420 × 520.

Watch chats without asking: .morph/chats-live.json is rewritten whenever a chat changes. For each chat it has running, asleep, waiting (for a free agent on Freemium), title, provider, model, cwd, tags, latestPrompt, lastDone (ok and when) and lastResult (the first 600 characters of its last answer; result gives the whole of it). A chat has finished a turn when running goes false and lastDone changes.

Safety

Any program running under your user account can use the bridge, the agents in your chats included. That's the same set of programs that can already read and change your files, so it adds no new way in, but only run tools you trust. A chat started this way does what its permission mode allows, so keep chats for folders you can't easily restore in Ask first. See Security.

On this page