Crush Docs

Plugins

A plugin is a Bash script that adds providers or tools to Crush without a new release.

A plugin is a Bash script that adds providers or tools to Crush. You write it with the same commands you'd use in a crushrc (provider add, tool add, and so on), drop it in a plugins folder, and Crush picks it up the next time it starts. You don't need any Go code or a new Crush release.

  • Provider plugins: add a model provider, including ones you sign in to with OAuth

  • Tool plugins: give the agent new tools, backed by any shell command

When you need every flag, see the Provider Plugin Reference and the Tool Reference.

Where plugins live

Crush looks in two places:

  • ~/.config/crush/plugins/ for plugins you want everywhere (or $XDG_CONFIG_HOME/crush/plugins/ if you've set that, or $CRUSH_GLOBAL_CONFIG/plugins/ if you've moved Crush's global config)

  • .crush/plugins/ inside a project, for plugins that only belong there

Every *.sh file that isn't hidden gets run, in alphabetical order, global plugins first. Crush also looks one folder down, which is where installed repositories end up.

When two places declare the same thing, the more specific one wins: a project plugin beats a global one, and your project's own config (crushrc or crush.json) beats both. That means you can always change or switch off something a plugin added without editing the plugin.

Plugins load after your global config, so a plugin can override what your global crushrc says about a provider. Tools are the exception: the tool settings in your global config are applied again after the plugins, so you can tweak or turn off a plugin's tool from either your global or your project config.

If a plugin fails, Crush won't start, same as a broken crushrc. That's on purpose: you'd rather find out now than halfway through a session.

Installing plugins from GitHub

You don't have to copy files around by hand. If someone publishes plugins in a GitHub repository, install them with:

crush plugin install example/crush-plugins

The rest of the commands do what you'd expect:

crush plugin install example/crush-plugins@v1.2.3  # a branch, tag, or commitcrush plugin update example/crush-plugins          # update one repositorycrush plugin update                                # update everythingcrush plugin list                                  # what's installed, and at which commitcrush plugin uninstall example/crush-plugins

A few things worth knowing:

  • Only the .sh files at the root of the repository count as plugins. Everything else in the repo is ignored.

  • Add --project to install into .crush/plugins instead. You can commit that folder so everyone on the team runs the same version.

  • Crush records the exact commit it installed. crush plugin update tells you which commit it moved from and to, and deletes plugins the repository has removed.

  • If you edit an installed plugin, update leaves it alone so your changes don't get lost. Run crush plugin trust example/crush-plugins to keep your edits, or crush plugin update --force to throw them away.

  • For a private repository, export GITHUB_TOKEN or GH_TOKEN first.

Only install plugins you trust

A plugin is ordinary Bash that runs with your permissions every time Crush starts. Crush doesn't sign, sandbox, or review plugins. Installing one is a lot like piping a script from the internet into your shell, so read it first. crush plugin install prints the commit it fetched, so you know exactly what to look at.

Warning

Nothing is prompted for and nothing is verified when a plugin is installed or loaded. The recorded commit is the thing to read before the next start runs it.

Command reference

crush plugin (alias crush plugins) manages plugins installed from GitHub.

Usage:  crush plugin [command]Available Commands:  install    Install plugins from a GitHub repository  update     Update one or all installed plugins  list       List installed plugin repositories (alias: ls)  uninstall  Delete an installed plugin repository (aliases: rm, remove)  trust      Accept an install's files as they now stand

crush plugin install

Install every non-hidden *.sh file at the root of a GitHub repository. The ref may be a branch, tag, or commit, and defaults to the repository's default branch. Installing a repository again refreshes it.

Usage:  crush plugin install <author>/<repo>[@ref] [flags]Flags:      --project   install into .crush/plugins instead of the user-wide directory      --force     overwrite local changes instead of leaving an install alone

An install writes the scripts into <plugins>/<author>__<repo>/ and records the exact commit they came from in a hidden .plugin.json beside them. That record is what lets an update say which commit it moved from and to, and delete a plugin the repository dropped.

crush plugin update

Update an installed repository to the current commit of the ref it follows, or every installed repository when none is named. Naming a ref with @ref points the install at a different branch or tag from now on.

Usage:  crush plugin update [<author>/<repo>[@ref]] [flags]Flags:      --global    act on the user-wide plugins directory only      --project   act on .crush/plugins only      --force     overwrite local changes instead of leaving an install alone

crush plugin list

List every repository installed from GitHub, with the ref and commit it pins, where it lives, and whether its files still match what was installed.

Usage:  crush plugin list [flags]Flags:      --global    act on the user-wide plugins directory only      --project   act on .crush/plugins only      --json      output in JSON format

crush plugin uninstall

Delete an installed repository and the record of its commit. A repository installed in both the global and the project directory is removed from both, unless a scope flag narrows it.

Usage:  crush plugin uninstall <author>/<repo> [flags]Flags:      --global    act on the user-wide plugins directory only      --project   act on .crush/plugins only

crush plugin trust

Record an installed repository's files as they now stand on disk. Use it after editing an installed plugin: without it, crush plugin list keeps reporting the install as modified and crush plugin update refuses to overwrite your changes.

Usage:  crush plugin trust <author>/<repo> [flags]Flags:      --global    act on the user-wide plugins directory only      --project   act on .crush/plugins only