allow1
무료Use when generating, vectorizing, or converting images to SVG — logos, icons, illustrations, or 'allow1'/'quiver' references.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Guide for writing, configuring, and debugging Claude Code hooks. Use when adding, writing, or debugging hooks — including silent failures and permission errors.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
설치 방법 보기설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.
Guide for adding hooks to harness/hooks/hooks.json and writing the scripts they invoke.
| Type | When to use | Cost |
|---|---|---|
command | Deterministic checks, fast guards, file ops | Low |
prompt | Single LLM judgment with {"ok": true/false} response | Medium |
agent | Multi-step LLM reasoning with file tools | High |
http | POST to external service | Varies |
Prefer command whenever the logic can be expressed in any executable script or the Go binary. Reserve agent/prompt for cases that genuinely need judgment — they are slower and cost tokens on every invocation.
Note:
agenthooks do NOT work onPreCompact. Usecommandinstead.
Place scripts in harness/scripts/. Use whichever language fits the task — bash, Python, and Node.js are all fine. The only requirement is that the script is executable and produces the correct exit code and stdout.
Exit codes control the hook outcome:
| Exit code | Meaning |
|---|---|
0 | Allow / pass |
2 + JSON to stdout | Block (PreToolUse / Stop) |
0 + JSON to stdout | Inject context (PostToolUse, PreCompact) |
Bash example — blocking Stop hook:
#!/usr/bin/env bash
if [[ some_condition ]]; then
echo '{"decision":"block","reason":"Explain why"}'
exit 2
fi
exit 0
Python example — blocking Stop hook:
#!/usr/bin/env python3
import sys, json
if some_condition:
print(json.dumps({"decision": "block", "reason": "Explain why"}))
sys.exit(2)
sys.exit(0)
Node.js example — warning injection (PreCompact):
#!/usr/bin/env node
if (someCondition) {
console.log(JSON.stringify({ systemMessage: "Warning: something needs attention" }));
}
process.exit(0); // never block compaction
Scripts without chmod +x fail silently or with permission denied, regardless of language:
chmod +x harness/scripts/your-script.py # or .sh, .js, etc.
Alternatively, invoke the interpreter explicitly in the hook command (step 3) — then chmod +x is not required.
Edit harness/hooks/hooks.json (SSOT). Reference the script via ${CLAUDE_PLUGIN_ROOT} and invoke with the appropriate interpreter:
{ "type": "command", "command": "bash \"${CLAUDE_PLUGIN_ROOT}/scripts/your-script.sh\"", "timeout": 5 }
{ "type": "command", "command": "python3 \"${CLAUDE_PLUGIN_ROOT}/scripts/your-script.py\"", "timeout": 5 }
{ "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/your-script.js\"", "timeout": 5 }
For bin/harness subcommands, use timeout: 3. For scripts, use timeout: 5.
make validate # runs tests/validate-plugin.sh
#!/usr/bin/env bash, #!/usr/bin/env python3, #!/usr/bin/env node)chmod +x) or interpreter is explicit in the hook command (python3 "...", node "...")${CLAUDE_PLUGIN_ROOT}/scripts/ — never absolute paths3 for bin/harness, 5 for scripts, 30 for agentsmake validate passes after editing hooks.jsonThree likely causes:
ls -la harness/scripts/your-script.*. Either chmod +x the file or prefix the command with the interpreter (python3 "...", node "...", bash "...")python3 script.py, node script.js, bash -n script.sh) to surface errors before the hook fireschmod +x harness/scripts/your-script.py # or .sh, .js
# OR use explicit interpreter in hooks.json — no chmod needed
For blocking hooks (PreToolUse / Stop), you must both print JSON to stdout and exit 2. Printing alone or exiting alone won't block.
Agent hooks silently do nothing on PreCompact. Convert to a command script — see harness/scripts/check-wip-precompact.sh as a reference.
Key events and their typical use:
| Event | Use for |
|---|---|
PreToolUse | Guard writes, validate inputs before execution |
PostToolUse | Cleanup, logging, tracking after tool runs |
Stop | Block session end if work is incomplete |
PreCompact | Warn (don't block) before context compaction |
UserPromptSubmit | Inject policy context, track commands |
SessionStart | One-time session initialization (once: true) |
Full event list and response schemas: .claude/rules/hooks-editing.md
harness/hooks/hooks.json — SSOT for all hook configurationharness/scripts/ — All command hook scripts.claude/rules/hooks-editing.md — Complete event reference and timeout guidelinesupdate-config skill — For adding automated behaviors via settings.json아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.
로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.
아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.
Use when generating, vectorizing, or converting images to SVG — logos, icons, illustrations, or 'allow1'/'quiver' references.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Use when running the full team/breezing flow end-to-end — all tasks with parallel workers. Do NOT load for: single-task implementation, planning, review, release, or setup.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Reviews PRs that modify the Feature Table in CLAUDE.md. Use when a PR adds CC version rows or modifies docs/CLAUDE-feature-table.md.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Use when researching Claude Code or Codex upstream releases, selecting adaptations, or preparing Harness upgrades. Local-only; not for distribution.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Creates a single project slide or one-page visual summary for a repo. Use when generating a project intro image or promotional slide.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Generates product demo videos and release walkthroughs via Remotion. Use when creating video documentation or animated demos.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.