Every hookMọi hook
A hook is a small program the harness runs around a tool call. Its tier is a code constant (HOOK_CLASS) — config can toggle a hook on/off but never change its tier, and the fail posture follows the tier. The 83 files under harness/hooks/ hold 67 tiered hooks (grouped below) and 16 shared libraries with no tier. See the rig for how the gate uses them.Hook là một chương trình nhỏ harness chạy quanh mỗi lần gọi tool. Hạng của nó là hằng số trong code (HOOK_CLASS) — config bật/tắt được nhưng không đổi được hạng, và tư thế-khi-lỗi theo hạng. 83 tệp dưới harness/hooks/ gồm 67 hook có hạng (nhóm bên dưới) và 16 thư viện dùng chung, không có hạng. Xem the rig để biết gate dùng chúng thế nào.
ComplianceCưỡng chế (16)
fail-closed, exit 2 — blocks the tool and prints the fix when it trips.
bash_safety_guard
PreToolUse(Bash) compliance hook: destructive-command gate.
context_firewall
PreToolUse gate on a tool call's blast radius.
disabled_skill_router
PreToolUse(Skill) block-with-map for an off skill.
floor_bash_guard
PreToolUse(Bash) compliance floor for Bash-spelled writes.
gate_stage
PreToolUse(Bash) compliance hook: the stage gate.
hook_dispatch
ONE command per (event, matcher) group.
instruction_policy_rewrite
PreToolUse(Bash): run the command the project's adopted policy prefers (`prefer-command`), in place of the one written.
model_guard
PreToolUse(Agent|Task) gate: enforce the model-bound posture.
plannotator_wrapper_guard
PreToolUse compliance gate: force the annotate review through the wrapper.
privacy_read_guard
put reads of secret files in front of the human (compliance).
protected_ref_guard
PreToolUse(Bash) compliance hook: protect refs.
secrets_inject
PreToolUse compliance hook: substitute ${secret:NAME} in memory, or block the call.
simplify_gate
PreToolUse(Bash) gate: oversized unsimplified diffs.
skill_quality_gate
write-time SKILL.md content gate (compliance, fail-open on crash).
spawn_provenance_workflow_guard
PreToolUse(Workflow) gate: enforce the spawn-provenance budget against the Workflow tool's OWN declared fan-out width (Ask-3 Layer-2).
write_guard
tool-mediated config-edit gate (compliance, fail-closed).
NudgeNhắc (30)
advisory on stderr — reminds, never blocks; default OFF.
agent_behavior_linter
observes PostToolUse/PreCompact, reports at Stop.
auto_decision_review_nudge
Stop nudge for unreviewed must-review auto-decisions.
backlog_capture_nudge
advisory reminder to record deferred work through the backlog register instead of hand-editing prose (nudge class).
backlog_hygiene_nudge
advisory reminder to close stale open backlog items before a publish stage (nudge class).
cook_delegate_nudge
advisory backstop for cook's per-phase posture.
cook_isolation_nudge
advisory /clear-before-cook reminder (nudge class).
decision_capture_nudge
opt-in decision-capture nudge (nudge-class).
decision_reconcile_nudge
Stop-event NUDGE for Decision Register drift.
descriptive_name
advise against generic file names (nudge class).
dev_override_wiring_nudge
warn when a `.harness-dev/<name>.yaml` override is present but wired to no `HARNESS_*` env, so it is silently ignored (the loader falls back to the shipped default).
discover_isolation_nudge
advisory /clear-before-plan reminder (nudge class).
engine_root_inject
SessionStart engine-root context (telemetry, fail-open).
engine_skew_nudge
SessionStart courier health advisory (nudge, fail-open).
gemini_stop_review_gate
Stop-event hook: an optional gemini review of the assistant's last turn. REWRITTEN fail-open (NOT the vendored fail-closed .mjs).
glossary_capture_nudge
opt-in glossary-capture nudge (nudge-class).
goal_cycle_nudge
advisory reminder to drop a cycle-memory breadcrumb at a tick boundary (nudge class).
instruction_policy_nudge
PreToolUse nudge: say what the project's adopted instruction policy says about this edit or this landing.
ledger_red_watch
PostToolUse:{Write|Edit|MultiEdit, Bash} nudge (nudge-class).
memory_gap_hook
opt-in tier-1 memory-gap hook (nudge-class).
memory_index_watch
PostToolUse:{Write|Edit|MultiEdit, Bash} nudge (nudge-class).
mutation_guard
SubagentStart/Stop DETECTION hook (nudge class, fail-open).
pending_decisions_resurface
SessionStart hook: after a compaction, re-surface the most-recent still-open AskUserQuestion so a summary cannot quietly bury a decision the user was still weighing.
plan_dir_nudge
PreToolUse(Write/Edit/MultiEdit) nudge: a write under a `plans/<dir>/` that has no valid `plan.md` will never anchor a hard stage.
rule_nudge_hook
name the rules whose scope matches the file being written.
spawn_fingerprint_audit
Ask-3 C3's group-fingerprint post-run audit (nudge-class, OBSERVATION-only).
stale_plan_close_nudge
advisory reminder to close a finished-but-open plan before it gates unrelated work (nudge class).
standards_drift_nudge
keep the auto-loaded prose standards from drifting.
usage_nudge
advisory near-ceiling reminder before a heavy spawn (nudge class).
yaml_comment_cut_nudge
PostToolUse:{Write|Edit|MultiEdit} nudge (nudge-class).
zsh_split_nudge
PreToolUse(Bash) nudge: an unquoted multi-word parameter expansion is NOT word-split under zsh.
TelemetryĐo lường (21)
fail-open, silent — records what ran; an internal error never blocks a tool.
agent_memory_stray
SubagentStop telemetry hook: remove the empty `.claude/agent-memory/<agent>/` dirs Claude Code leaves below the project root.
auto_finalize_ship
PreToolUse(Skill) hook: ship-belt backstop that finalizes the single active plan when N/N phases have a PASS snapshot.
bash_write_guard
PostToolUse:Bash advisory (telemetry-class, fail-open).
emit_session_summary
on session Stop, emits one line to state/telemetry/sessions.jsonl (telemetry-class):
glossary_pointer_inject
SessionStart hook (telemetry-class) injecting a one-line pointer at the glossary as additionalContext.
inject_prompt_context
context re-injection hook (telemetry-class).
manual_test_anchor
PostToolUse:Bash telemetry hook (manual-test anchor).
mark_bash_start
PreToolUse:Bash hook (telemetry-class).
notify_remote
Notification-event hook: relay Claude's notification to a user-configured webhook so an UNATTENDED run (/goal until-429) reaches the operator's phone/chat the moment something needs them.
nudge_context_inject
UserPromptSubmit hook (telemetry-class) re-surfacing turn-end nudge observations to the MODEL as additionalContext.
panel_flag_relay
mechanical `--ultra`/`--debate` panel-flag detector (UserPromptSubmit, telemetry-class, `kind: additionalContext`).
phase_progress_writer
PostToolUse hook: per-phase evidence snapshot + plan lifecycle (auto-open, auto-close).
reinject_stop_context
Stop-event hook: re-inject working context on a /goal continuation.
session_init
SessionStart hook (telemetry-class).
setup_nudge
SessionStart onboarding advisory (telemetry-class, fail-open).
spawn_ledger_writer
append each Agent/Task spawn to the provenance ledger (telemetry, fail-open).
stamp_artifact
PostToolUse hook: stamp harness provenance into plan/ report markdown as it is written (telemetry-class).
subagent_init
SubagentStart context injector (telemetry, fail-open).
track_script_execution
PostToolUse:Bash hook (telemetry-class).
track_skill_invocation
records every skill invocation to state/telemetry/invocations.jsonl (telemetry-class).
track_subagent_outcome
SubagentStop hook (telemetry-class).