| name | agentsmd-perf-baseline |
| description | Benchmark native hook wall-clock cost with OFF/ON medians in an isolated CODEX_HOME. Use for latency or disablement decisions. Not for correctness, install health, or live telemetry. |
agentsmd-perf-baseline
Resolve the script root first. Set SKILL_MD to the selected SKILL.md absolute path from the live skills list; never infer it from the process cwd.
SKILL_MD="<selected SKILL.md absolute path from the live skills list>"
CANDIDATE_ROOT="$(cd "$(dirname "$SKILL_MD")/../.." && pwd)"
if [ -f "$CANDIDATE_ROOT/scripts/perf-baseline.js" ]; then AGENTSMD_ROOT="$CANDIDATE_ROOT"; else AGENTSMD_ROOT="${CODEX_HOME:-$HOME/.codex}/agentsmd"; fi
Turns "the hooks add ~200–400 ms" (a guess) into a measured per-hook table. For each hook it times, over N runs, the median of OFF (DISABLE_AGENTSMD_HOOKS=1 → the hook exits at its kill-switch line: bash-spawn + startup floor) vs ON (the hook does its real work); delta = ON − OFF is the hook's own logic cost.
node "$AGENTSMD_ROOT/scripts/perf-baseline.js"
node "$AGENTSMD_ROOT/scripts/perf-baseline.js" --event=PreToolUse
node "$AGENTSMD_ROOT/scripts/perf-baseline.js" --runs=3 --json
latency added per event firing (sum of ON medians) is the number that matters: the 5 PreToolUse:Bash hooks fire on every Bash call; the 7 Stop hooks fire once per turn.
- Hooks run against a synthetic non-triggering
echo Bash event (the common per-call case, not the block path), in an isolated sandbox CODEX_HOME — measuring never writes to the live ~/.codex (§8.V3) and cleans up after itself (§8.V4).
- Numbers are a lower bound: direct
bash hook spawns, not Codex's harness IPC round-trip.
Operator/dev tool, read-only on the live env. From the repo instead of an install: node scripts/perf-baseline.js.