# CodeBuddy Code adapter

Shows the sessions of CodeBuddy Code, the program `codebuddy` of the npm package `@tencent-ai/codebuddy-code`, in the notch: working, done when a turn ends or CodeBuddy Code says it waits for your input, failed when a turn ends on an error, needing you while it asks for a permission, what the tool in use does, its first prompt, its repository and its branch as its name, and its tool calls as steps. Its documentation also calls it WorkBuddy Code CLI, with the same files under `.codebuddy`.
CodeBuddy Code reports through hooks: each hook posts its event with `curl` to a Unix socket in your own folder, `~/Library/Application Support/Blossom/codebuddy/socket`, where this adapter listens. Blossom launches the adapter.
The hooks of CodeBuddy Code take the format of those of Claude Code, so this adapter reads them with the same code of the SDK as the Claude Code adapter.
The hooks are an entry `hooks` of your settings of CodeBuddy Code, `~/.codebuddy/settings.json`, added after yours. The settings of a project, `.codebuddy/settings.json` and `.codebuddy/settings.local.json`, are never touched.

**Permissions are answered in CodeBuddy Code, not in Blossom.** Its documentation lists `PermissionRequest` among its events but documents neither its input nor its answer, and the hook that can allow a call, `PreToolUse`, runs on every call, also on those CodeBuddy Code would not ask about, so holding it would allow what it was going to ask and what it was not. Blossom shows that the session needs you, from the notification of a permission prompt, and you answer in the terminal.

**This adapter was written from the documentation of CodeBuddy Code and was never run against a real one.** What the documentation says and what is only supposed is in [../../documentation/roadmap/codebuddy.md](../../documentation/roadmap/codebuddy.md); the checks at the end say what to look at.

You need:

- Blossom. It includes this adapter and the Bun that runs it; from a clone, `bun run build` makes one.
- CodeBuddy Code 1.16.0 or later, `codebuddy`, signed in. The hooks follow the pages [Hooks Reference](https://www.codebuddy.ai/docs/cli/hooks), [Plugins Reference](https://www.codebuddy.ai/docs/cli/plugins-reference) and [Settings](https://www.codebuddy.ai/docs/cli/settings), read on 2 December 2026. The documentation says its hooks are in beta.
- `curl` and `ps`, which every hook runs by their full paths under `/usr/bin` and `/bin`. CodeBuddy Code runs a hook with your shell, `$SHELL`, or `/bin/sh`; the hooks were tested with `sh`, `bash` and `zsh`.

## Connect from Blossom

The quickest way. Blossom finds `codebuddy` on your Mac, in your `PATH` or the usual folders, where npm puts it, and connecting it is one click: "Continue" on the second step of the introduction, with CodeBuddy Code checked, or its switch in Settings > Agents. Blossom then adds this adapter to its configuration, starts it, and puts the hooks of `adapters/codebuddy/settings.json` in `~/.codebuddy/settings.json`, after the hooks you already have, as it does for Claude Code. Nothing of yours changes, and a file that does not exist is created with the hooks alone.

Before it writes over the file, Blossom keeps a copy of it in `~/Library/Application Support/Blossom/backups/codebuddy/`, named after the moment in UTC, and puts the new content in place in one rename. A file that is not plain JSON is left alone and the row says why. **A file that sets `"disableAllHooks": true` is left alone too**: you turned the hooks of CodeBuddy Code off, and the row says so. "Repair" puts the hooks back when they are missing or not the ones this Blossom installs. "Disconnect", shown while the agent is off, takes the adapter out of Blossom and its hooks out of the file, which then holds what it held before. What Blossom writes and why is in [the decision](../../documentation/decisions/connecting.md).

**Review the hooks in CodeBuddy Code.** Its documentation says it takes a snapshot of the hooks when it starts, warns when the file changes, and applies changes only after you review them in `/hooks`. After connecting, open `/hooks` in CodeBuddy Code, review the hooks of Blossom and start a new session; the row of the agent in Settings > Agents says so.

## Run Blossom with the adapter

From the root of the clone:

```sh
bun install && bun run bootstrap && bun run build
BLOSSOM_CONFIGURATION=adapters/codebuddy/configuration.json apps/macos/build/Build/Products/Debug/Blossom.app/Contents/MacOS/Blossom
```

The notch shows nothing until a session of CodeBuddy Code reports. Run one Blossom at a time: the adapter holds the socket, and the adapter of a second Blossom logs `cannot listen for the hooks of codebuddy code` and exits.

An app opened from Finder reads `~/Library/Application Support/Blossom/configuration.json`; name the adapter there by its package, `{ "adapters": [{ "package": "codebuddy" }] }`.

## What you should see

- Nothing when the session opens. The tile appears next to the notch with the first prompt, with the mark of CodeBuddy, named after the first line of that prompt and the repository, with its branch beside it.
- No badge while it works, and the tool in use in live.
- The amber badge, and no panel, while CodeBuddy Code asks you for a permission: answer in the terminal.
- The green badge when a turn ends, or when CodeBuddy Code says it has waited for your input for a minute; the red one when it ends on an error.
- The tile gone when the session ends.

## Install by hand

For a clone without the app. The `hooks` of `adapters/codebuddy/settings.json` go into your `~/.codebuddy/settings.json`, next to the hooks you have; the merge of [the Claude Code adapter](../claude/README.md#install-by-hand) does it, with `~/.codebuddy/settings.json` and `adapters/codebuddy/settings.json` in place of the files of Claude Code. Then review them in `/hooks`.

## Remove by hand

After an install by hand; after connecting from Blossom, Disconnect does it, and removing Blossom takes out the hooks of every tool, see [Removing it](../../documentation/privacy.md#removing-it). The `jq` command of [the Claude Code adapter](../claude/README.md#remove-by-hand) does it, with `~/.codebuddy/settings.json` and `Blossom/codebuddy/socket`. Then check that nothing is left; this prints `0`:

```sh
grep -c 'Blossom/codebuddy/socket' ~/.codebuddy/settings.json
```

## What to know

- **Needing you comes from a notification.** A `Notification` of `permission_prompt` makes the session need you until its next event, such as the call running. One of `idle_prompt`, which the documentation says comes after sixty seconds of waiting for your input, makes it done. `elicitation_dialog` is listed as not yet supported; it would make the session need you too.
- **A session shows up with its first prompt.** `SessionStart` is not installed.
- **The name and the steps** follow the Claude Code adapter: the first line of the first prompt, the repository and the branch; one step per tool call of the session, saying what it does and never what it holds: the name of the file of `Write`, whose `file_path` the documentation shows, and a label for the rest, such as `Running a command` for `Bash`. A call fails with `PostToolUseFailure`, and every call still running fails when the turn ends. Subagents are not counted: the documentation names `SubagentStart` but not what it carries.
- **The terminal of a session.** The hook of `UserPromptSubmit` also finds the terminal the session runs in, with the shell of the SDK, and sends it in headers.
- **The hooks send the whole payload, and the adapter keeps a few fields.** Each hook posts the payload as CodeBuddy Code gives it on standard input, your prompt and the input and output of tools included. The adapter keeps the identifier of the session, the title taken from the first line of the prompt, the name of the tool and the words of its step, the folder and the type of a notification. Nothing else is kept, logged or sent to Blossom.
- **The hooks print nothing and decide nothing.** Every hook sends what `curl` receives to `/dev/null`, and every command ends with `|| /usr/bin/true`, so a hook never fails and never exits 2, which in `PreToolUse` blocks a call. With Blossom closed, each hook gives up at once and CodeBuddy Code works as before. The documentation gives a hook sixty seconds; these end within one.
- **A session whose `codebuddy` was killed leaves within seconds.** Every command names the parent of its shell, which is supposed to be CodeBuddy Code, in the header `Blossom-Process`, and every five seconds the adapter asks whether it still exists.
- **The hooks name `$HOME` and nothing else without a default**, and ignore your curl configuration with `-q`.
- **CodeBuddy Code does not run the hooks of Claude Code.** Its documentation names `~/.codebuddy/settings.json` and the settings of a project, and reads the plugins of Claude Code, not its settings.
- **The socket is yours alone.** See [../../documentation/decisions/socket.md](../../documentation/decisions/socket.md).

### Not confirmed

Read in the documentation, never seen in a run:

1. That the parent of the shell of a hook is the process of CodeBuddy Code, the same on every event of a session.
2. That `PostToolUseFailure` and `StopFailure`, which the plugins reference lists without their input, carry `tool_name` and the fields of every event.
3. That `notification_type` is `permission_prompt` whenever CodeBuddy Code asks for a permission.
4. That your shell runs the hooks as `sh`, `bash` or `zsh` would; a shell that is not POSIX, such as fish, is not one the documentation allows for `CODEBUDDY_CODE_SHELL`.
5. That the IDE and the plugins of CodeBuddy do not read `~/.codebuddy/settings.json`.

## Checks by hand

The adapter was tested with its hook commands run by `sh`, `bash` and `zsh` against the socket, with payloads written from the documentation, never captured from a run. Each check needs `codebuddy` signed in, connected from Blossom and reviewed in `/hooks`, and Blossom running with the adapter. Write down what the line in italics asks.

1. **A turn.** In a new folder, ask `hi`. *Does the tile appear with the prompt, with no badge, and turn green when the answer ends?*
2. **A permission.** Ask `run the bash command touch probe.txt`. *Does the tile turn amber, with no panel, while the terminal asks, and does the badge leave once you answer there?*
3. **Waiting.** After a turn, wait more than a minute. *Does anything change?*
4. **A failure.** Ask for a command that fails. *Is its step failed in the detail of the session?*
5. **The end.** Quit `codebuddy`. *Does the tile leave at once?* Start it again, ask `hi`, and `kill -9` its process. *Does the tile leave within about five seconds?*
