Skip to content
Agentic Control Plane

Muse Code Hooks: How to Install One and What It Can See

David Crowe David Crowe · · Updated · 9 min read
muse-code hooks permissions reference
Share X HN LinkedIn

Just want the answer?

On the 0.2.1 beta, a Muse Code hook is not a file you edit by hand. It ships inside a plugin, and you turn plugins on with an experimental flag:

MUSE_EXPERIMENTAL_PLUGINS=1 muse plugins install @agenticcontrolplane/muse-code
MUSE_EXPERIMENTAL_PLUGINS=1 muse plugins approve @agenticcontrolplane/muse-code

Full walkthrough: Muse Code install guide. Native control model: Muse Code permissions, explained.

Muse Code is Meta’s terminal coding agent. It ships with an OS sandbox and tool approvals both on from the first run. Its hooks get neither. A hook command runs straight through your shell, outside the sandbox and outside the approval layer. And on the 0.2.1 beta, the only way to register one is a flag that Meta’s extending docs don’t mention. This post covers what is wired today, what the hook payload looks like, and what “outside the sandbox” means if you want a hook to be your control point.

The docs and the binary disagree

Meta’s docs describe a muse hooks command and a project-level .muse/hooks.json file. Neither works in the 0.2.1 beta. The command isn’t exposed. A hand-written hooks.json is ignored with no error and no warning.

What does work is the plugin system, behind MUSE_EXPERIMENTAL_PLUGINS=1. A plugin (.muse-plugin/plugin.json) lists hooks as one of its capabilities. muse plugins install and muse plugins approve register it and trust it. The flag only gates those management commands. Once a plugin is approved, its hooks fire in normal sessions without the flag.

Trust levels in Meta’s docs

Meta’s docs describe three levels. We haven’t been able to exercise the project and user levels on the beta, since the hook file isn’t read.

Level Where Trust step
Project <project-root>/.muse/hooks.json muse hooks trust <key> per project
User machine-wide settings file explicit trust on first use
Managed file at managed_hooks_path pre-approved, no trust step

The managed level is the one to read twice. A hook installed there runs with no per-user approval. Whoever controls that file controls what runs on every machine pointed at it, so guard it like a sudoers file.

Install the ACP plugin

MUSE_EXPERIMENTAL_PLUGINS=1 muse plugins install @agenticcontrolplane/muse-code
MUSE_EXPERIMENTAL_PLUGINS=1 muse plugins approve @agenticcontrolplane/muse-code

Or let the installer detect Muse Code and do the same:

curl -sf https://agenticcontrolplane.com/install.sh | bash

The wire format is Claude Code’s

Field names match Claude Code’s hook contract. Input is snake_case: hook_event_name, tool_name, tool_input, session_id, permission_mode. Output is camelCase, with the decision under hookSpecificOutput.permissionDecision. Exit code 2 plus stderr is a fallback way to deny. A systemMessage string is shown to the model as advice and doesn’t change the decision.

Event Gateway call Effect
PreToolUse POST /govern/tool-use a deny blocks the call before it runs
PermissionRequest POST /govern/tool-use settles Muse Code’s own prompt
PostToolUse POST /govern/tool-output audit and content scan after the call
Stop / SubagentStop none receipt only, no decision

Muse Code fires more events than most harnesses: SessionStart, UserPromptSubmit, PreToolUse, PermissionRequest, PostToolUse, PreLLMCall, PostLLMCall, PreCompact, PostCompact, SubagentStart, SubagentStop and Stop. The ACP plugin uses the four in the table.

On the coverage page, Muse Code is marked as checking every native tool through one pipeline, and a PostToolUse block comes back to the model as feedback. A held call is blocked in the agent. You approve it on the console or from the email, then ask the agent to retry.

What “outside the sandbox” means

Muse Code’s sandbox uses Seatbelt on macOS and bubblewrap on Linux. It confines writes to the workspace and temp, and keeps .git, .muse and .agents read-only. None of that reaches a hook. The hook runs through the shell with a cleared environment and a short allowlist of variables. MCP tools get the same treatment.

Two things follow.

  1. Credentials don’t arrive through env vars. An ACP_BEARER_TOKEN exported in your shell never reaches the hook. The plugin reads ~/.acp/credentials, which the installer writes once. Overrides such as govern_base, agent_tier, check_timeout_ms and shadow go in ~/.acp/config.json.
  2. Every dependency is a risk. A hook sits outside Muse Code’s strongest containment. So the ACP plugin is one file of plain ESM with no dependencies and no build step. You can read it start to finish before you trust it.

If the gateway is down

In an interactive session the plugin lets the call through. It prints an UNGOVERNED warning and writes a line to ~/.acp/lapse.log. In unattended sessions (CI, MUSE_HEADLESS, or a non-interactive agent_tier) it blocks every call while the gateway can’t be reached, because nobody is watching to notice a gap. A deny from the gateway holds either way.

Expect this to change

The 0.2.1 release notes warn about breaking changes. The muse hooks command that the docs describe is the likely end state, and the flagged plugin path will probably move toward it. Re-check after every Muse Code update.

Limits

  • Hooks see tool calls, not tokens. Muse Code model spend isn’t metered, and no proxy or transcript path ships for it. The audit trail holds tool calls without per-call cost.
  • The hook fires at the edge of the sandbox. Don’t assume the sandbox’s guarantees reach one step further.
  • The docs describe commands the beta doesn’t have.

Compared with Claude Code hooks

The JSON is the same shape. The differences are the install path (a flagged plugin here, a settings file there) and the sandbox. Claude Code has an optional /sandbox mode, and in Muse Code the sandbox is on by default with the hook outside it. See the Claude Code hooks reference for that side.

Frequently asked questions

How do I install a hook in Muse Code today?

Through the plugin system, behind the MUSE_EXPERIMENTAL_PLUGINS=1 flag. muse plugins install and muse plugins approve register a plugin whose capabilities include hooks. The documented muse hooks command and a project .muse/hooks.json file are not wired in the 0.2.1 beta binary.

Is Muse Code's hook payload the same shape as Claude Code's?

Yes, checked against the beta binary. Fields come in as snake_case (hook_event_name, tool_name, tool_input, session_id, permission_mode). Decisions go back as camelCase under hookSpecificOutput. Exit code 2 plus stderr is a fallback way to deny, and a systemMessage line is shown to the model as advice.

Do Muse Code hooks run inside the sandbox?

No. Hook commands run directly through your shell, outside both the OS sandbox and the approval layer. The only hardening is a cleared environment. MCP tools get the same treatment: approved, not contained.

What happens if the ACP gateway is unreachable?

In an interactive session the ACP plugin lets the call through, prints a warning and writes a line to ~/.acp/lapse.log. In unattended sessions (CI, MUSE_HEADLESS, or a non-interactive agent_tier) it blocks every call while the gateway can’t be reached. A deny from the gateway holds either way.

Where to read more

Running Muse Code? One command adds a hook. Each tool call it sees is recorded, and a force-push, destructive SQL or curl | sh is blocked until you approve it on the console or from the email.

macOS · Linux · WSL
curl -fsSL https://agenticcontrolplane.com/install.sh | bash
Windows · PowerShell
irm https://agenticcontrolplane.com/install.ps1 | iex

What the installer writes  ·  Muse Code guide  ·  free up to 5 agents

Share X HN LinkedIn
Get the next data drop
What agents actually cost, new tool-surface captures, and the occasional incident post-mortem — sent when we publish something worth your inbox, not on a schedule. Unsubscribe anytime.
Share: Twitter LinkedIn
Related posts

← back to blog