agentdock-hook
v0.1.0
Published
Claude Code hook runner for AgentDock — blocks on approval before file writes
Downloads
143
Maintainers
Readme
agentdock-hook
Claude Code hook runner for AgentDock — streams every tool call to your dashboard and blocks on file writes until a human approves them.
Install
npm install -g agentdock-hookSetup
1. Get your project API key from AgentDock → Project → Settings.
2. Set environment variables (add to your shell profile or .env):
AGENTDOCK_API_KEY=ah_live_...
AGENTDOCK_BASE_URL=https://www.getagentdock.com
AGENTDOCK_REQUIRE_APPROVAL=true3. Add hooks to .claude/settings.json in your project:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Write|Edit|MultiEdit|Bash",
"hooks": [{ "type": "command", "command": "npx agentdock-hook pre", "timeout": 30 }]
}
],
"PostToolUse": [
{
"matcher": ".*",
"hooks": [{ "type": "command", "command": "npx agentdock-hook post" }]
}
]
}
}4. Run Claude Code. Every session, tool call, and file change will appear in your AgentDock dashboard in real time.
How it works
- Pre-hook (blocking): fires before every Write/Edit/Bash. Posts the event to AgentDock, then polls for approval. If approved, exits 0. If rejected, exits 2 — Claude Code shows the rejection reason and stops.
- Post-hook (non-blocking): fires after every tool call. Records the result and token usage.
Environment variables
| Variable | Default | Description |
|----------|---------|-------------|
| AGENTDOCK_API_KEY | — | Required. Your project API key. |
| AGENTDOCK_BASE_URL | http://localhost:3000 | AgentDock instance URL. |
| AGENTDOCK_REQUIRE_APPROVAL | true | Set to false to record events without blocking. |
| AGENTDOCK_TIMEOUT_ACTION | approve | What to do if approval poll times out: approve or reject. |
Requirements
Node.js ≥ 18
