# Adapter packages

An adapter is a process Blossom launches that speaks [the adapter protocol](protocol.md), and each one reaches its agent in one of three ways.

![Three adapter connection patterns](/docs/adapters.jpg)

## Three connection patterns

| Pattern | How it reaches the agent | What Blossom writes | Adapters |
|---|---|---|---|
| **Shell hooks** | The agent runs hooks of the shell, and each one posts one line of JSON to a Unix socket only your user can open, `~/Library/Application Support/Blossom/<adapter>/socket` | Its own entries, merged after yours, into one file of the agent in JSON, TOML or YAML | 21 agents, from `~/.claude/settings.json` to `~/.hermes/config.yaml` |
| **In-process module** | The agent loads one module of Blossom's own into a process of its own, which posts the same lines to the same socket | One file in the folder of extensions or of plugins of the agent, such as `~/.pi/agent/extensions/blossom.ts` | Pi, Oh My Pi, Gajae-Code, Amp, MiMoCode |
| **Local service or CLI** | The adapter talks to a service the agent already runs, or to a command line of your own | Nothing | OpenCode, GitHub Actions |

A module never awaits, imports only what the agent's runtime guarantees and swallows every error, so with Blossom closed the agent notices nothing. What it may and may not do is in [../decisions/module.md](../../decisions/module.md).

> [!IMPORTANT]
> An agent whose hooks follow the format of Claude Code is a description of its tools and a template built by `hookTemplate` of the SDK, with a `HookDialect` where it differs; never fork `sdks/adapter/source/format`.

## A package

An included or catalog adapter is a **package**: the code of the adapter in one file of JavaScript, a manifest, and the templates of the hooks it asks a tool to install. Blossom brings the runtime that runs it, so the user installs neither Bun nor a clone of this repository.

```
claude/
  manifest.json
  main.js
  hooks/
    settings.json
```

The SHA-256 of the exact bytes of `manifest.json` is the digest of the package: the manifest names the size and the SHA-256 of every other file, so the digest pins all of them. The signed index of the catalog names a package by that digest, and there is no archive to unpack.

| Origin | The configuration names it by | Blossom runs |
|---|---|---|
| Included | `package`, an identifier such as `claude` | the package of that identifier inside the app |
| Catalog | `package`, the same way | the package installed from the signed catalog |
| Own | `command` and `arguments` | that command, as it is written |

The higher `version` wins, and on the same version the included package wins. A revoked package, or a folder written by hand, is passed over and the included one runs instead.

## Building one

`blossom-adapter`, the binary of `sdks/adapter`, is the `build` of each adapter: it bundles `source/main.ts` with Bun into one file, copies the templates and writes the package into `build/`. Two checkouts of the same commit give the same bytes and the same digest.

> [!TIP]
> The 28 adapters of this repository are the reference: start from [Included Adapters](../../../adapters/claude/README.md), and read [Adapter Protocol](protocol.md) for the wire contract.
