# Gajae-Code adapter

Shows the sessions of Gajae-Code, the coding agent `gjc`, a fork of Oh My Pi, in the notch: working, done when a turn ends, needing you while its `ask` waits for your answer, what the tool in use does, its first prompt, its repository and its branch as its name, and its tool calls as steps. Nothing is answered from Blossom.
Gajae-Code has no hooks of the shell. It loads modules in TypeScript, its extensions, into its own process. Blossom installs one of its own, `~/.gjc/agent/extensions/blossom.ts`, a copy of [`extension.ts`](extension.ts), which posts a few fields of each event to a Unix socket in your own folder, `~/Library/Application Support/Blossom/gjc/socket`, where this adapter listens. Blossom launches the adapter.

**This adapter was written from the documentation and the source of Gajae-Code and was never run against a real one.** What they say and what is only supposed is in [../../documentation/roadmap/gjc.md](../../documentation/roadmap/gjc.md); the checks at the end say what to look at. Why Blossom installs a module, and what the module may and may not do, is in [the decision](../../documentation/decisions/module.md).

You need:

- Blossom. It includes this adapter and the Bun that runs it; from a clone, `bun run build` makes one.
- Gajae-Code, `gjc`. The module follows its documentation, `docs/hooks.md`, `docs/gjc-plugins.md` and `docs/ooo-bridge-extension-contract.md`, and the source of [Yeachan-Heo/gajae-code](https://github.com/Yeachan-Heo/gajae-code) at commit `5389a2dd3af9391b597198d0b7b775888cb4958b` of 28 November 2026, its version 0.22.3.

## Connect from Blossom

The quickest way. Blossom finds `gjc` in your `PATH` or in the usual folders, and connecting it is one click: "Continue" on the second step of the introduction, with Gajae-Code checked, or its switch in Settings > Agents. Blossom then adds this adapter to its configuration, starts it, and writes `~/.gjc/agent/extensions/blossom.ts`, readable by you alone, creating the folders it needs. No file of yours is changed: your other extensions stay as they are.

"Repair" in the row writes the module again when it is missing, when you changed it or when an update of Blossom brings another one; it keeps a copy of the file it replaces in `~/Library/Application Support/Blossom/backups/gjc/`. "Disconnect", shown while the agent is off, takes the adapter out of Blossom and deletes `blossom.ts`, after the same copy. A file named `blossom.ts` there that is not Blossom's, because it does not name the socket, is left alone and the row says so. Blossom does not follow `GJC_CONFIG_DIR`, `GJC_CODING_AGENT_DIR` or their older names `PI_CONFIG_DIR` and `PI_CODING_AGENT_DIR`: a Gajae-Code that uses another folder does not load the module.

Gajae-Code loads its extensions when a session starts. A session that was open when you connected reports from its next start.

## Run Blossom with the adapter

From the root of the clone:

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

The notch shows nothing until a session of Gajae-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 extension of gajae-code` and exits.

### From Finder

An app opened from Finder reads `~/Library/Application Support/Blossom/configuration.json`. Name the adapter by its package:

```json
{ "adapters": [{ "package": "gjc" }] }
```

## Install by hand

For a clone without the app:

```sh
mkdir -p ~/.gjc/agent/extensions
cp adapters/gjc/extension.ts ~/.gjc/agent/extensions/blossom.ts
```

## Remove by hand

After an install by hand; after connecting from Blossom, Disconnect does it, and removing Blossom deletes the module, see [Removing it](../../documentation/privacy.md#removing-it).

```sh
rm ~/.gjc/agent/extensions/blossom.ts
```

Gajae-Code can also turn it off without removing it, with `extension-module:blossom` among the disabled extensions of its configuration.

## What to know

- **Why an extension and not a hook.** Gajae-Code also loads modules from `~/.gjc/agent/hooks/pre/` and `post/`, one per tool. Those receive the same in-process API under the names `tool_call` and `tool_result`, and a `pre` module that throws blocks the tool. The folder of extensions takes one file that listens to the events of the whole session, as for Oh My Pi, so Blossom uses it and installs nothing among the hooks.
- **Questions are answered in Gajae-Code.** While its `ask` tool runs, between its `tool_execution_start` and its end, the session needs you. Gajae-Code has no events of approvals, of plan reviews or of dialogs that an extension hears, so nothing else makes a session need you, and nothing is answered from Blossom.
- **What the module does.** It listens to `input`, `agent_start`, `tool_execution_start`, `tool_execution_end`, `agent_end`, `agent_failed`, `session_switch` and `session_shutdown`, and to nothing else: not to `tool_call` or `tool_result`, whose handlers can block or change a call. Every handler returns at once with nothing; the posts go one after the other in the background, one second each at most. With Blossom closed, every post fails at once and Gajae-Code notices nothing. It imports `node:http` alone, reads no file and logs nothing. It skips the sessions of subagents, whose `ctx.sessionMetadata.kind` is `sub`. Listening to these events changes nothing in Gajae-Code: none of them is one whose handlers Gajae-Code checks for before it changes how it works.
- **What it sends.** The identifier of the session, its folder and the process of Gajae-Code with every event; the first 4096 characters of a prompt; the identifier of a call, the name of its tool, `path` of its arguments and whether it failed; whether a turn continues by itself. Never a command, the content of a file, what a tool printed, an error or an answer of the model. The adapter keeps the title, the name of the tool and the words of its step, and the folder.
- **A session shows up with its first prompt.** `input` starts a session, and so does `agent_start`. The title is the first line of the first prompt, cut to 60 characters; a prompt that starts with `/` or `!` titles nothing.
- **Steps are tool calls.** Each call is a step from its `tool_execution_start` to its `tool_execution_end`. `read`, `edit` and `write` show the name of their file without its folder when their arguments carry `path`; `bash` shows "Running a command"; the others a label. A step still running when the turn ends is shown failed.
- **How a turn ends.** `agent_end` ends it, except one that stops for a maintenance of the context that Gajae-Code continues by itself, `stopReason` `maintenance` with `maintenanceOutcome` `pruned`, `compacted` or `promoted`. `agent_failed`, which a run that fails sends in place of `agent_end`, ends it too, shown as done.
- **How a session ends.** `session_shutdown` closes it; `session_switch`, after `/new`, a resume or a fork, closes the other sessions of the same process. A session whose `gjc` was killed leaves within five seconds.
- **The terminal of a session.** With each prompt, the module sends the variables a terminal sets and the processes of Gajae-Code and of its parent; the adapter reads its terminal device with `/bin/ps` and checks every value as it checks those of a hook.
- **The socket is yours alone.** A process that runs as you can still post to it or listen on it while Blossom is closed. See [../../documentation/decisions/socket.md](../../documentation/decisions/socket.md).
- **Sixty-four sessions at most.** When a sixty-fifth starts, the adapter closes the one it heard from least recently.

### Not confirmed

Read in the documentation and the source, never seen in a run:

1. That Gajae-Code loads `~/.gjc/agent/extensions/blossom.ts` through Bun and that `node:http` reaches a Unix socket from it.
2. That the interactive `gjc` runs its session in its own process, so the process the module sends is the one in the terminal.
3. That `tool_execution_start` carries `path` in the arguments of `read`, `edit` and `write`; `read` may add a range after a colon, which the step then shows.
4. That `session_switch` comes with the context of the new session.

## Checks by hand

The module was loaded into a double of the API of extensions of Gajae-Code, written from its source, and its posts reached the adapter through a real socket; it never ran inside Gajae-Code. Each check below needs `gjc` signed in.

1. **It loads.** Connect Gajae-Code from Blossom, start `gjc` in a new folder and open `/extensions`. *Is `blossom` listed, with no error?*
2. **A turn.** Ask `hi`. *Does the tile appear, titled `hi` and named after the folder, and turn green when the answer ends?*
3. **A tool.** Ask `read the file package.json`. *Does detail list `Read package.json` as a step?*
4. **A question.** Ask `ask me to choose between two options before you answer`. *Does the tile turn amber while `ask` waits?*
5. **A long turn.** Work until Gajae-Code compacts its context in the middle of a turn. *Does the tile stay working through it?*
6. **The end.** Run `/new`. *Does the old tile leave?* Quit `gjc`. *Does the tile leave?*
7. **Without Blossom.** Quit Blossom and ask `hi`. *Does Gajae-Code answer as before, with nothing printed about an extension?*
8. **Disconnect.** Disconnect Gajae-Code in Settings > Agents. *Is `~/.gjc/agent/extensions/blossom.ts` gone, and your other extensions still there?*
