Skip to main content
Version: 0.12.0

Taking the Plugins

An application is written from Plugins that exist, and a Plugin reaches it as two files: its executable, built for the application's architecture, and its Manifest. The composer takes a Plugin from its source: it builds it for the application, places the two files in the project, declares the unit and records where the Plugin came from. Whether you wrote the Plugin or somebody else did changes where its source is, and nothing after that.

The example composes two Plugins:

PluginIts authorWhat it does
com.example.greeteryou, in Building a Pluginanswers greeter.hello with a greeting, and is told which greeting with greeter.set
com.yoke.reference.clockthe Yoke project, in the repository yoke-referenceanswers clock.now with the time, and is told to mark it with clock.mark

Make the project​

From the directory that holds greeter/, make the application's project beside it:

yoke-compose init com.example.hello --dir hello --version 0.1.0 --arch x86_64 --core ">=0.12.0"
com.example.hello made: hello/yoke.yaml, with manifests/ and components/ beside it
OptionIs
com.example.hellothe application's identifier
--versionthe application's own version, not Yoke's and not any Plugin's
--archthe architecture its executables are built for, as uname -m prints it
--corethe range of Core versions it runs on; a host whose Core is outside it refuses the package

Take the greeter​

Your own Plugin is the Plugin project you made in Building a Plugin. Take it from its path, in hello/:

cd hello
yoke-compose add plugin ../greeter
Taking com.example.greeter runs its author's build.
source: ../greeter
commit: e975b4171b590beb86322dc10ed4866cb3fd1a9d
in: plugin/
command: CGO_ENABLED=0 GOOS=linux GOARCH="$YOKE_GOARCH" GOFLAGS=-mod=mod go build -trimpath -o "$YOKE_OUT/greeter" .
Run it? [y/N] y
took ../greeter as the unit greeter, recorded in plugins.yaml

Taking a Plugin runs its author's build, on your machine, so the composer shows what it will run and asks first. Read the command before answering: it is the author's, and it runs as you. --yes answers for a script, and --as <unit> names the unit something other than the program.

What it did: the executable is in components/plugins/greeter, built for the descriptor's arch; the Manifest, as the author keeps it, is in manifests/com.example.greeter.yaml; the unit greeter is declared with the executable's digest pinned. And it recorded where the Plugin came from, in plugins.yaml beside the descriptor:

hello/plugins.yaml
plugins:
- id: com.example.greeter
unit: greeter
source: ../greeter
tag: null
commit: e975b4171b590beb86322dc10ed4866cb3fd1a9d
clean: true
arch: x86_64
digest: sha256:a700b8da21fda0a76389c7027d393531662c97a96702479915ccfd75733bbb73
taken: 2026-11-05T17:46:42Z

plugins.yaml is the project's memory, not the application's: no package carries it, and nothing in it is granted to anybody. A path has no tag; the commit and clean say what the tree was when it was taken.

A Plugin published at a tag is taken by its repository and its tag, the same way: yoke-compose add plugin https://github.com/you/greeter@v0.1.0 (handing it on). yoke-compose plugins lists what was taken.

Take the clock, by hand​

The clock is not published as a Plugin project: yoke-reference holds the same examples in several languages, side by side, to read and to compare, and no tag of it names one Plugin. So its two files are gathered by hand, as any Plugin's can be.

It is built from its author's source, at a commit you name. With -trimpath, which leaves the directory it was built in out of the executable, the same commit and the same Go toolchain give the same executable, and so the same digest, on any machine. Back in the directory that holds hello/:

mkdir -p plugins/clock
git clone https://github.com/yoke-project/yoke-reference
git -C yoke-reference checkout ae1bb18064942ba60e57845121e6645d100bcdc7
CGO_ENABLED=0 go -C yoke-reference/plugins/go/clock build -trimpath -o "$PWD/plugins/clock/clock" .
plugins/clock/clock manifest > plugins/clock/com.yoke.reference.clock.yaml

Then put its two files in the project and declare its unit, pinning the executable by digest:

mkdir -p hello/components/plugins
cp plugins/clock/clock hello/components/plugins/
cp plugins/clock/com.yoke.reference.clock.yaml hello/manifests/
yoke-compose add unit clock --dir hello --kind plugin --plugin com.yoke.reference.clock \
--exec components/plugins/clock
wrote units.clock in hello/yoke.yaml

A unit is not a Plugin. The unit is what this application runs, under its own name; the Plugin is the program it is launched from. One Plugin may be several units — two clocks would be two add unit with one --plugin — and the operator authorises the Plugin once for all of them (vocabulary).

Read what each one declares​

A Manifest is what you will ask the operator to grant, so read it before composing the Plugin. The clock declares one question, one command and one occurrence, each governed by a capability:

hello/manifests/com.yoke.reference.clock.yaml
manifest: 1
id: com.yoke.reference.clock
protocol: 1
commands:
- id: clock.mark
queries:
- id: clock.now
occurrences:
- id: clock.marked
capabilities:
- name: command.mark.accept
governs:
command: clock.mark
- name: query.now.answer
governs:
query: clock.now
- name: event.marked.report
governs:
occurrence: clock.marked

An application uses what it needs of a Plugin, and the rest stays withheld. This one only asks the time and the greeting, so the operator grants two capabilities, query.now.answer and query.hello.answer. The other four are declared, never granted, and the two Plugins are admitted without them (admission).

A Plugin's identity is how everything after this names it: the project's units, the operator's grants, the log. A Plugin taken from somebody else keeps the identity its author gave it, and the project's Manifest is stored under it, as manifests/<identity>.yaml.

The same, by hand

Without the composer, your own Plugin is gathered as the clock is: its two files copied into the project, and its unit declared. From the directory that holds hello/, with the greeter built (handing it on):

mkdir -p hello/components/plugins
cp greeter/build/x86_64/greeter hello/components/plugins/
cp greeter/plugin/com.example.greeter.yaml hello/manifests/
yoke-compose add unit greeter --dir hello --kind plugin --plugin com.example.greeter \
--exec components/plugins/greeter
wrote units.greeter in hello/yoke.yaml

Nothing records where the files came from: that is what plugins.yaml adds. A new build is copied in again, and its digest written again with set (the project).