> ## Documentation Index
> Fetch the complete documentation index at: https://eispatch.framewire.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Claude Code

> Install and use EISPATCH with Claude Code through a UserPromptSubmit block hook, MCP stdio server, Local Composer, and clipboard fallback.

Claude Code integrates with EISPATCH through a `UserPromptSubmit` block hook and an MCP stdio server. The hook launches the Local Composer, blocks execution until you approve, and dispatches via clipboard fallback because Claude Code does not expose a direct same-session prompt API.

## Verified version

EISPATCH v1.1.0 is verified with Claude Code `2.1.332`.

## Installation

Run the installer from the cloned repository:

```bash theme={null}
node scripts/install-claude-code.mjs
```

The installer supports an optional `--target <dir>` flag to install into an alternate home directory.

### What the installer writes

The installer modifies three locations under the target home.

> [accordion] \~/.claude/skills/eispatch/SKILL.md
>
> The EISPATCH skill file containing instructions and metadata for the Claude Code skill system.

> [accordion] \~/.claude.json
>
> Adds an MCP server entry under `mcpServers.eispatch`:
>
> ```json theme={null}
> {
>   "command": "node",
>   "args": ["<repo>/adapters/claude-code/mcp-server.mjs"]
> }
> ```
>
> Existing servers are preserved; only the `eispatch` key is added or updated.

> [accordion] \~/.claude/settings.json
>
> Merges a `hooks.UserPromptSubmit` entry:
>
> ```json theme={null}
> {
>   "matcher": "",
>   "hooks": [
>     {
>       "type": "command",
>       "command": "node \"<repo>/adapters/claude-code/hooks/user-prompt-submit.mjs\"",
>       "timeout": 5
>     }
>   ]
> }
> ```
>
> Other hooks in `settings.json` are not touched.

> [!WARNING]
>
> Keep the cloned repository in place after installing. The installer references absolute paths inside it; moving the repo breaks the integration.

After installation the installer automatically runs a check and prints one of the following:

```text theme={null}
PASS: Claude Code EISPATCH integration verified (...)
```

### Check error messages

If verification fails, the installer prints one of these errors:

| Error | Cause |
| - | - |
| `Missing Claude Code installation file: ...` | The expected Claude Code configuration file is absent. |
| `Claude Code .claude.json missing valid mcpServers.eispatch entry.` | The MCP server was not written correctly. |
| `Claude Code settings.json missing EISPATCH UserPromptSubmit hook.` | The hook was not registered in settings. |

## Hook flow

When you submit a prompt, the hook processes JSON from stdin containing `prompt`, `session_id`, and `cwd`. It then follows this flow:

**1. Intercept**

The hook matches the trigger prefix and determines EISPATCH should handle the prompt.

**2. Launch Local Composer**

A detached process spawns `core/launch-local-composer.mjs` with `--host claude-code`, the prompt, workspace path, and a temporary ready-file path.

**3. Wait for ready signal**

The hook waits up to 2.5 seconds for the ready file to contain `url`, `port`, and `pid`.

**4. Block and respond**

The hook outputs a block message with `composerUrl` so you can open the Local Composer.

### Block output

When the Local Composer launches successfully, the hook outputs:

```text theme={null}
[EISPATCH] Prompt blocked before execution until approved. Open EISPATCH Local Composer (Claude Code - Clipboard Fallback): http://127.0.0.1:PORT 1. Review capabilities & edit instructions. 2. Click Approve, then Dispatch to copy the approved prompt. 3. Paste and submit the copied prompt here (prompts containing <!-- DISPATCH_COMPILED_PROMPT --> pass through automatically).
```

If the Local Composer fails to launch, the hook outputs:

```text theme={null}
Start EISPATCH Composer via MCP tool dispatch_compose or run npm run preview, approve the prompt, and paste the compiled prompt (containing <!-- DISPATCH_COMPILED_PROMPT -->) to execute.
```

The hook is registered with a timeout of 5 seconds and an empty matcher so it runs on every prompt (the prefix check is handled inside the script).

## Clipboard fallback flow

**1. Open composer**

Click the URL from the block output, or start the composer manually with `npm run preview`.

**2. Review and approve**

Review capabilities, edit the final prompt, and click **Approve**.

**3. Dispatch**

Click **Dispatch** to copy the approved prompt to your clipboard.

**4. Paste**

Paste the compiled prompt into Claude Code. Prompts containing the compiled marker (`<!-- DISPATCH_COMPILED_PROMPT`) pass through the hook automatically.

## Environment variables

| Variable | Effect |
| - | - |
| `EISPATCH_AUTO_INTERCEPT=1` | Intercept every Claude Code prompt even without a trigger prefix. |
| `EISPATCH_NO_SPAWN=1` | Prevent the hook from spawning the Local Composer. It still blocks and directs you to `dispatch_compose` or `npm run preview`. |

## Uninstall

Remove EISPATCH entries from Claude Code:

```bash theme={null}
node scripts/install-claude-code.mjs --uninstall
```

Uninstall removes only EISPATCH-owned entries. It does not remove other MCP servers, skills, or hooks.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.