Agentic AI Atlasby a5c.ai
OverviewWikiGraphFor AgentsEdgesSearchWorkspace
/
GitHubDocsDiscord
i.4Wiki
Agentic AI Atlas · 15 — Unified Hooks System
docs/agent-mux/reference/15-hooksa5c.ai
Search the atlas/
Wiki · linked records

Article and nearby pages

I.Current articlepp. 1 - 1
Core Types, Client, and Package IdentityRunOptions, Profiles, and Run ConfigurationRunHandle, InteractionChannel, and Run LifecycleAgentEvent Union Type and Event StreamingAdapter Contract, BaseAgentAdapter, and AdapterRegistryAgent Capabilities, Model Registry, and Thinking Normalization
I.
Wiki article

docs/agent-mux/reference/15-hooks

Reading · 2 min

15 — Unified Hooks System reference

agent-mux provides a harness-agnostic hook system that lets one

Page nodewiki/docs/agent-mux/reference/15-hooks.mdNearby pages · 14Documents · 0

Continue reading

Nearby pages in the same section.

Core Types, Client, and Package IdentityRunOptions, Profiles, and Run ConfigurationRunHandle, InteractionChannel, and Run LifecycleAgentEvent Union Type and Event StreamingAdapter Contract, BaseAgentAdapter, and AdapterRegistryAgent Capabilities, Model Registry, and Thinking NormalizationSession Manager and Session Data AccessConfig Manager, Auth Manager, and Agent ConfigurationPlugin Manager and Plugin EcosystemCLI Reference (`amux`)Process Lifecycle, Safety, and Cross-Platform SupportBuilt-in Adapter ImplementationsInvocation ModesHarness Mock

15 — Unified Hooks System

agent-mux provides a harness-agnostic hook system that lets one configuration drive hook dispatch across all 11 supported harnesses.

Concepts

StopHook, OnToolCall). See HOOK_CATALOG in @a5c-ai/agent-mux-core for the per-harness list.

~/.amux/hooks.json (global) that maps (agent, hookType) → handler(target). Project overrides global by id.

command (shell command), or script (executable path).

{ agent, hookType, sessionId, timestamp, data, raw }. data contains fields like tool_name, tool_input, prompt, etc.; raw preserves the original harness payload for bidirectional round-tripping.

modifiedInput?, stdout?, exitCode? }. deny` maps to exit code 2 (the convention used by most harnesses).

  • **Hook type** — a harness-specific event name (e.g. PreToolUse,
  • **Registration** — a record in .amux/hooks.json (project) or
  • **Handler** — builtin (programmatic, in-process),
  • **Unified payload** — normalized UnifiedHookPayload with
  • **Unified result** — `{ decision: allow|deny|modify, message?,

SDK usage

ts
import {
  HookConfigManager, HookDispatcher, builtInHooks,
  parseHookPayload, formatHookResult,
} from '@a5c-ai/agent-mux-core';

const mgr = new HookConfigManager();
await mgr.add({
  id: 'log-all',
  agent: '*',
  hookType: '*',
  handler: 'builtin',
  target: 'log',
  priority: 10,
});

const dispatcher = new HookDispatcher(mgr, builtInHooks);
const payload = parseHookPayload('claude', 'PreToolUse', { tool_name: 'Bash' });
const result = await dispatcher.dispatch(payload);
const { stdout, exitCode } = formatHookResult('claude', 'PreToolUse', result);

CLI usage

Code
amux hooks <agent> discover
amux hooks <agent> list
amux hooks <agent> add <hookType> [--handler builtin|command|script]
                                  [--target <id-or-cmd>]
                                  [--id <id>] [--priority N] [--global]
amux hooks <agent> remove <id> [--global|--project]
amux hooks <agent> set <id> [--priority N] [--enabled true|false] [--target ...]
amux hooks <agent> handle <hookType>   # reads JSON payload on stdin

handle is the entry point registered with harnesses (e.g. claude's settings.json "hooks" section) — the harness pipes its payload to stdin and amux dispatches all matching registrations.

Built-in programmatic hooks

IDDescription
logAppend payload to ~/.amux/hook-log.jsonl
traceEmit a one-line trace to stdout
claude.session-captureCapture claude session metadata (CLAUDE_PROJECT_DIR…)

Add your own with builtInHooks.register({ id, description, fn }).

Dispatch semantics

1. Registrations matching (agent, hookType) are collected (supports *). 2. Disabled entries (enabled: false) are excluded. 3. Remaining entries are sorted by priority ascending (default 100). 4. Each runs in order; results are merged: - deny is sticky — further entries short-circuit. - modify wins over allow for the final decision. - modifiedInput objects are shallow-merged. - stdout fragments are concatenated. - First non-zero exitCode wins.

Trail

Wiki
Babysitter Docs
agent-mux docs
Agent Mux Reference

15 — Unified Hooks System

Continue reading

Core Types, Client, and Package Identity
RunOptions, Profiles, and Run Configuration
RunHandle, InteractionChannel, and Run Lifecycle
AgentEvent Union Type and Event Streaming
Adapter Contract, BaseAgentAdapter, and AdapterRegistry
Agent Capabilities, Model Registry, and Thinking Normalization
Session Manager and Session Data Access
Config Manager, Auth Manager, and Agent Configuration

Page record

Open node ledger

wiki/docs/agent-mux/reference/15-hooks.md

Documents

No documented graph nodes on this page.