Shows the sessions of Grok Build, the program grok of xAI, in the notch: working, done when a turn completes or is cancelled, failed when a turn ends on an error of the API, needing you while Grok Build shows a permission prompt or asks you a question, what the tool in use does, its first prompt, its repository and its branch as its name, its tool calls as steps and how many subagents it runs.
Grok Build reports through hooks: each hook posts its event with curl to a Unix socket in your own folder, ~/Library/Application Support/Blossom/grok/socket, where this adapter listens. Blossom launches the adapter.
Permissions and questions are answered in Grok Build. Blossom shows that the session needs you, and you answer in the terminal. A hook of Grok Build can deny a tool or force its prompt, but an allow only means "not blocked": no hook can approve a call you would otherwise be asked about.
The hooks are one file of Blossom's own in the hooks folder of Grok Build, ~/.grok/hooks/blossom.json. You can try them in one folder, or install them for every session.
This adapter was written from the source of Grok Build and was never run against a real one. What the source says and what is only supposed is in ../../documentation/roadmap/grok.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.
Grok Build, grok, signed in. The hooks follow the source of xai-org/grok-build at commit 2bdd1d6a6369de0e8c68132ea4539e9abd9e14a8 of 29 September 2026, release 1.0.45: its guide crates/codegen/xai-grok-pager/docs/user-guide/10-hooks.md and the code that implements it, crates/codegen/xai-grok-hooks.
curl, printf and cat, which every hook runs by their full paths under /usr/bin and /bin, and ps, which the hook of a prompt runs as /bin/ps. Grok Build runs a hook with sh -c; the hooks were tested with sh, bash and zsh.
The quickest way. Blossom finds grok on your Mac, in your PATH or in ~/.grok/bin, where its installer puts it, and connecting it is one click: "Continue" on the second step of the introduction, with Grok Build checked, or its switch in Settings > Agents. Blossom then adds this adapter to its configuration, starts it, and writes the hooks of adapters/grok/hooks.json to ~/.grok/hooks/blossom.json, a file of its own. Grok Build reads every .json file of ~/.grok/hooks, always trusted, and adds their hooks to yours, so no file of yours is touched, ~/.grok/config.toml included.
When the file is missing, Blossom creates it, and the folders above it, readable by you alone. When it is there, Blossom keeps a copy of it in ~/Library/Application Support/Blossom/backups/grok/, named after the moment in UTC, before it writes; it writes the new content to a file next to it, whose name starts with a dot so Grok Build never loads it, and moves it into place, so a failure halfway leaves the file as it was. "Repair" in the row 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 {} and stays: Grok Build reads a file without hooks as one with no hooks. Blossom does not follow GROK_HOME: a Grok Build that uses another folder does not read the file. What Blossom writes and why is in the decision.
bun install && bun run bootstrap && bun run buildBLOSSOM_CONFIGURATION=adapters/grok/configuration.json apps/macos/build/Build/Products/Debug/Blossom.app/Contents/MacOS/Blossom
The notch shows nothing until a session of Grok Build 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 grok and exits.
An app opened from Finder reads ~/Library/Application Support/Blossom/configuration.json. Name the adapter by its package, which Blossom includes, so neither a path nor Bun is needed:
{ "adapters": [{ "package": "grok" }] }
If the file already exists, add the adapter to its adapters list instead.
Grok Build also reads the hooks of a project from .grok/hooks/*.json, once you trust the folder. So try the hooks in a folder made for it, and nothing of yours changes:
cd "$(mktemp -d)"mkdir -p .grok/hooks && cp "<absolute path of the clone>/adapters/grok/hooks.json" .grok/hooks/blossom.jsongrok --trust
--trust trusts that folder alone, for hooks, MCP, LSP and project instructions together. What you should see:
Nothing when the session opens. The tile appears next to the notch with the first prompt, named after the first line of that prompt and the repository, blossom · Fix the flaky notch tests, with its branch beside it.
No badge while it works, and the tool in use in live.
The amber badge while Grok Build asks you to allow a tool or answer a question, and no request panel: answer there.
The green badge when a turn completes or you interrupt it; the red one when it ends on an error of the API.
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. Check that the file holds nothing but Blossom's hooks, which name the socket, and delete it:
Permissions and questions are shown, not answered. Grok Build tells a hook when a permission prompt waits, with a Notification of type permission_prompt, which it also sends while it asks you to approve a plan, and when it asks you a question with ask_user_question, with the type elicitation_dialog. The session needs you until its next event, such as the end of the tool, or PermissionDenied when you decline. A PreToolUse hook can deny or force a prompt, never approve one, so nothing here could answer from the notch.
A session shows up with its first prompt. An open session with nothing typed shows nothing, and so does a session that was already running when Blossom started, until its next prompt. SessionStart is not installed.
The name comes from the first prompt and the repository. The first line of the first prompt is the title, cut to 60 characters, and stays; a prompt that starts with / or ! titles nothing. The project is the repository and the branch of its folder, read from HEAD and the pointers of .git at most once every five seconds, without running git. See ../../documentation/decisions/names.md.
Steps are tool calls, saying what they do. Each call of a tool is a step, from its start to its end, paired by the toolUseId Grok Build gives every call. A call that fails, or that the permission system or you deny, is a failed step, and a step still running when the turn ends is shown failed. A step is the description of run_terminal_command and spawn_subagent, never the command or the prompt; the verb and the name of the file of read_file, search_replace and write, never its folder or its content; or a label for any other tool. Those fields are read from the input types in the source, not seen in a run. Nothing a tool printed is reported.
How a turn ends. A Stop whose reason is end_turn is done, a StopCancelled, after an interrupt, a declined prompt or the limit of turns, is done too, and a StopFailure, an error of the API, is failed. The Stop that Grok Build sends when a session closes, with another reason, changes nothing. A report of an earlier turn that arrives after the next prompt, which the guide says can happen to a cancelled turn, is ignored by its promptId. A turn that reports none of the three settles with the idle_prompt notification, about a minute after the session goes idle.
Subagents are counted from their start to their end. A subagent of Grok Build runs as a session of its own: SubagentStart comes from the session with the identifier of the child, and the child's own events carry subagentType. Those events are never steps or sessions of their own; the child's SubagentStop, StopFailure, StopCancelled or SessionEnd takes one from the count, and the end of the turn of the session sets it to zero.
The hooks send the whole payload, and the adapter keeps a few fields. Each hook sends {"event":"<its event>","payload":<the payload>}, the payload as it came, with your prompt, the input and the output of tools. The adapter keeps the identifier of the session, of the turn and of the call, the title taken from the first line of the prompt, the name of the tool and the words of its step, the folder, the type of a notification, the identifier of a subagent, whether the event comes from one and the reason of a stop, and drops the rest at once. Nothing else of your prompt or of a tool is kept, logged or sent to Blossom. The event is the one the hook is installed on, so no text of the payload can pass for another.
The hook of a prompt finds the terminal of its session. Before it posts, the hook of UserPromptSubmit walks up its processes with /bin/ps, from Grok Build, sixteen at most, for the terminal device and the processes above it, and reads the variables terminal programs and multiplexers set, such as TERM_PROGRAM, __CFBundleIdentifier, TMUX_PANE and KITTY_WINDOW_ID, from the environment Grok Build passes on. Each is named with a default, ${TERM_PROGRAM-}, so Grok Build neither refuses the hook nor writes the value into the command when it loads the file. It sends each value in a header only when it is short and of plain characters, and Blossom keeps it in memory, shows it nowhere, and uses it to bring that terminal forward when you ask. It adds about 50 ms to a prompt, and to no other hook. Hooks connected before this version need Repair in Settings > Agents.
The hooks print nothing and always succeed. Grok Build reads what a PreToolUse, PostToolUse, UserPromptSubmit, Stop or SubagentStop hook prints as a decision or as words for the model, and an exit status of 2 denies a tool, blocks a prompt or keeps the agent working. Every command sends everything it runs to /dev/null and ends with || /usr/bin/true, so neither a configuration file of curl nor whatever answers on the socket can make a hook decide anything, and with Blossom closed every tool still runs. A function of your shell named curl, printf or cat does not run in place of the full paths.
The hooks name $HOME and nothing else. Before it runs a hook, Grok Build refuses one that names a variable it does not have, and writes your home folder into the command when it loads the file. HOME is always there; the process is read with ${PPID-}, which it leaves to the shell, and so is every variable the hook of a prompt reads to find its terminal, below.
The hooks ignore your curl configuration.-q keeps curl from reading ~/.curlrc and its siblings.
Without Blossom, Grok Build works as before. With Blossom closed nothing listens on the socket: each hook gives up at once, prints nothing and ends without an error. When the adapter is alive but does not answer, every event waits one second, well inside the five seconds Grok Build gives a hook by default.
A session whose grok was killed leaves within seconds, if the process is the one supposed. Every command names the process that started its shell, in the header Blossom-Process. Grok Build starts the shell itself, so that is the process of Grok Build that runs the session. The adapter watches a process only once two events in a row name it, and every five seconds asks the system whether it still exists. That this process is the grok of the terminal for the whole session is supposed, not seen; if it outlives the session, the tile leaves at SessionEnd or when you dismiss it.
This adapter counts a session once. Grok Build also loads ~/.claude/settings.json and ~/.cursor/hooks.json, where Blossom puts the hooks of Claude Code and of the Cursor CLI when you connect them. Those hooks post to the sockets of their own adapters, never to this one, so nothing reaches this adapter twice. The hooks of the Cursor CLI send nothing for a payload of Grok Build, which does not have the fields they look for. A payload of Grok Build does carry session_id, hook_event_name and often transcript_path, as Claude Code's do, so the hooks of Claude Code stand aside themselves: each one ends before curl, printing nothing, when GROK_HOOK_EVENT has a value, which Grok Build sets for every hook it runs. A session of Grok Build shows once, as Grok Build. Read in the source, not seen: Grok Build refuses to start a hook that names a variable it does not have, and those hooks name $CLAUDE_PID, so it may not run them at all and write a line about a failed hook in its scrollback instead; check 14 looks at it. Hooks of Claude Code connected before that guard need Repair. To keep Grok Build from loading those files at all, set [compat.claude] hooks = false and [compat.cursor] hooks = false in ~/.grok/config.toml.
The socket is yours alone. It lives in a folder only your user can open. A process that runs as you can still post events to it, or listen on it while Blossom is closed and read the payloads, your prompts included. See ../../documentation/decisions/socket.md.
Sixty-four sessions at most. When a sixty-fifth starts, the adapter closes the one it heard from least recently.
Where hooks are turned off, nothing shows. An organization that sets allow_managed_hooks_only, or a hook you turn off with Space in /hooks, keeps these hooks from running.
The hooks find the socket through $HOME. A session started with another HOME does not report.
That the shell of a hook has the process of the session as its parent for the whole session, so that $PPID is the same on every event.
That ~/.grok/hooks/blossom.json loads in a folder Grok Build was not told to trust, as the guide says of every global hook, and that a file added while a session runs is read after r in /hooks.
That a subagent's SubagentStop, and its events with subagentType, carry the identifier the parent's SubagentStart gave as subagentId.
That the permission_prompt notification comes from the session that shows the prompt, also when a subagent asked for the tool.
That the input of run_terminal_command, read_file, search_replace and spawn_subagent reaches a hook with the names of the fields of their types.
That Grok Build reads a file of {}, as Disconnect leaves it, without a complaint.
The adapter was tested with its hook commands run by sh, bash and zsh against the socket, with payloads written from the types of the source, never captured from a run. Each check below needs grok signed in. Write down what the line in italics asks.
Prepare once. To see the raw payloads first, make a folder whose hooks log what they receive, and remove it afterwards:
The payloads. Ask hi, then run the shell command ls, allow it, and quit. Is every event of events.log followed by one line of JSON with sessionId, promptId on the events of a turn, and toolUseId on the tool events?
The process. In a second terminal, ps -ax -o pid,ppid,command | grep '[g]rok'. Is the process on every line the grok of the session, the same for the whole session?
A permission. Ask run the shell command touch probe.txt and wait. Is there a Notification with "notificationType":"permission_prompt" and the sessionId of the session? Decline it. Do PermissionDenied and StopCancelled with "reason":"permission_rejected" follow?
A question. Ask ask me to choose between two options before you answer. Is there a Notification with "notificationType":"elicitation_dialog"?
A subagent. Ask for a task that Grok Build hands to a subagent. Does SubagentStart carry a subagentId, and do the events with subagentType that follow carry that identifier as their sessionId?
An interrupt. Ask count from 1 to 300, one number per line and press ctrl-c. Does StopCancelled follow, with "reason":"user_interrupt" and the promptId of the turn?
The field names.Does the toolInput of run_terminal_command carry description, and that of read_file carry target_file?
Then run Blossom with the adapter and connect Grok Build, which writes ~/.grok/hooks/blossom.json. Delete the folder of the logger.
A turn. In a new folder, start grok and ask hi. Does the tile appear with the prompt, titled hi and named after the new folder, with no badge, and turn green when the answer ends? Write down whether Grok Build asked to trust the folder first.
A tool. Ask run the shell command sleep 5 and allow it. Does live show the tool, does detail list it as a step, and does the tile turn green at the end?
A permission. Ask run the shell command touch probe.txt and do not answer yet. Does the tile turn amber, with no request panel? Allow it. Does it go back to working, and turn green at the end?
A question. Ask ask me to choose between two options before you answer. Does the tile turn amber while Grok Build asks?
A subagent. Ask for a task handed to a subagent. Does peek show one running subagent while it works, its tools nowhere among the steps, and none once it ends?
An interrupt. Ask count from 1 to 300, one number per line and press ctrl-c. Does the tile turn green?
Once. With Claude Code connected too, ask hi. Does the session show once, as Grok Build, and not also as Claude Code? Does Grok Build print a line about a hook that failed?
The end. Quit grok. Does the tile leave at once? Start it again, ask hi, and kill -9 its process from another terminal. Does the tile leave within about five seconds?
Quitting Blossom. Quit Blossom and ask run the shell command ls. Does the tool run, with nothing printed about a hook?
Disconnect. Disconnect Grok Build in Settings > Agents. Does ~/.grok/hooks/blossom.json hold {}, does a new session no longer show, and does /hooks list no hook of the file and no error?
The terminal of a session. Send a prompt from Terminal, one from iTerm and one inside tmux. Does each prompt start as quickly as before, with no failed hook in the scrollback?