runshiftrunshift

docs / claude code

claude code

what this does

Connect Claude Code to runshift using hooks. Every time Claude Code runs a tool (writes a file, runs a command, edits code), a hook fires an AMP signal to your runshift dashboard. You see what happened, when it happened, and what it produced.

The hook runs in the background. Claude Code is never slowed down.

prerequisites

A runshift account with at least one AMP agent registered

Claude Code installed

jq installed (most systems have it; brew install jq on macOS)

Your AMP key (starts with rs-amp-)

step 1 — get your AMP key

Register an AMP agent in the runshift dashboard. Open the roster, click the plus button, choose "connect via AMP". Name it something like "claude-code". Copy the key. You will not see it again.

The agent name in the hook script is display only. Your AMP key determines which agent appears in the roster.

step 2 — save the hook script

Save this script to ~/runshift-hook.sh. It reads the tool call from stdin and POSTs an AMP signal to runshift.

#!/usr/bin/env bash
# runshift AMP hook for Claude Code
# Fires an AMP signal on every tool call.

# Read the PostToolUse payload from stdin
INPUT=$(cat)

AGENT_NAME="${RUNSHIFT_AGENT_NAME:-claude-code}"

TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name // "unknown"')
TOOL_INPUT=$(echo "$INPUT" | jq -c '.tool_input // {}' | head -c 500)
TOOL_OUTPUT=$(echo "$INPUT" | jq -r '.tool_output // ""' | head -c 1000)
PROJECT=$(echo "$INPUT" | jq -r '.cwd // "unknown"')

curl -s -X POST "https://www.runshift.ai/api/amp/signal" \
  -H "Authorization: Bearer ${RUNSHIFT_AMP_KEY}" \
  -H "Content-Type: application/json" \
  -d "$(jq -n \
    --arg agent_name "$AGENT_NAME" \
    --arg status "done" \
    --arg task "$TOOL_NAME in $PROJECT" \
    --arg action "$TOOL_NAME: $TOOL_INPUT" \
    --arg content "$TOOL_OUTPUT" \
    '{
      agent_name: $agent_name,
      status: $status,
      task: $task,
      action: $action,
      content: $content,
      reversible: true
    }'
  )" > /dev/null 2>&1

exit 0

Make it executable:

chmod +x ~/runshift-hook.sh

Set your key:

export RUNSHIFT_AMP_KEY="rs-amp-your-key-here"

Add the export to your shell profile (~/.zshrc or ~/.bashrc) so it persists across sessions.

step 3 — add to Claude Code config

Open ~/.claude/settings.json (global) or .claude/settings.json (per-project). Add the hooks block:

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Bash|Write|Edit",
        "hooks": [
          {
            "type": "command",
            "command": "~/runshift-hook.sh",
            "async": true,
            "timeout": 10
          }
        ]
      }
    ]
  }
}

This fires after every Bash, Write, and Edit tool call. The hook runs in the background (async: true) so it never slows Claude Code down.

step 4 — test it

Run Claude Code and ask it to create a file. Check your runshift dashboard. You should see the signal appear in the relay activity panel and the agent status update in the roster.

To fire a gate (human approval required), change the status in the script from "done" to "gate". Claude Code will not be blocked (the hook is async), but the gate will appear in your dashboard and Slack for review.

what you will see

When the hook fires, your runshift dashboard shows:

Agent status updates in the roster (running, done, gate)

Audit trail entries with the tool name, input summary, and output

If gated: an amber banner in the deck with approve and deny buttons

multiple machines

Running Claude Code on multiple machines? Register a separate AMP agent for each and set RUNSHIFT_AGENT_NAME in your shell profile.

blocking gates

Want Claude Code to wait for approval before proceeding? Blocking gates are on the roadmap. Follow @runshiftai for updates.

next

runshift docs · claude code

© 2026 runshift