openclaw hooks

에이전트 훅을 관리합니다(/new, /reset, 게이트웨이 시작 등의 명령어에 대한 이벤트 기반 자동화).

관련 문서:

모든 훅 나열

openclaw hooks list

워크스페이스, 관리형, 번들 디렉토리에서 발견된 모든 훅을 나열합니다.

옵션:

  • --eligible: 적격 훅만 표시 (요구 사항 충족)
  • --json: JSON으로 출력
  • -v, --verbose: 누락된 요구 사항을 포함한 상세 정보 표시

출력 예시:

Hooks (4/4 ready)

Ready:
  🚀 boot-md ✓ - Run BOOT.md on gateway startup
  📎 bootstrap-extra-files ✓ - Inject extra workspace bootstrap files during agent bootstrap
  📝 command-logger ✓ - Log all command events to a centralized audit file
  💾 session-memory ✓ - Save session context to memory when /new command is issued

예시 (상세):

openclaw hooks list --verbose

부적격 훅의 누락된 요구 사항을 표시합니다.

예시 (JSON):

openclaw hooks list --json

프로그래밍 방식 사용을 위한 구조화된 JSON을 반환합니다.

훅 정보 조회

openclaw hooks info <name>

특정 훅에 대한 상세 정보를 표시합니다.

인수:

  • <name>: 훅 이름 (예: session-memory)

옵션:

  • --json: JSON으로 출력

예시:

openclaw hooks info session-memory

출력:

💾 session-memory ✓ Ready

Save session context to memory when /new command is issued

Details:
  Source: openclaw-bundled
  Path: /path/to/openclaw/hooks/bundled/session-memory/HOOK.md
  Handler: /path/to/openclaw/hooks/bundled/session-memory/handler.ts
  Homepage: https://docs.openclaw.ai/automation/hooks#session-memory
  Events: command:new

Requirements:
  Config: ✓ workspace.dir

훅 적격성 확인

openclaw hooks check

훅 적격성 상태 요약을 표시합니다(준비된 훅 수 대 미준비 훅 수).

옵션:

  • --json: JSON으로 출력

출력 예시:

Hooks Status

Total hooks: 4
Ready: 4
Not ready: 0

훅 활성화

openclaw hooks enable <name>

설정(~/.openclaw/config.json)에 추가하여 특정 훅을 활성화합니다.

참고: 플러그인이 관리하는 훅은 openclaw hooks list에서 plugin:<id>로 표시되며, 여기서 활성화/비활성화할 수 없습니다. 대신 플러그인을 활성화/비활성화하세요.

인수:

  • <name>: 훅 이름 (예: session-memory)

예시:

openclaw hooks enable session-memory

출력:

✓ Enabled hook: 💾 session-memory

동작:

  • 훅이 존재하고 적격한지 확인
  • 설정에서 hooks.internal.entries.<name>.enabled = true 업데이트
  • 설정을 디스크에 저장

활성화 후:

  • 훅이 다시 로드되도록 게이트웨이를 재시작하세요(macOS에서는 메뉴 바 앱 재시작, 또는 개발 환경에서 게이트웨이 프로세스 재시작).

훅 비활성화

openclaw hooks disable <name>

설정을 업데이트하여 특정 훅을 비활성화합니다.

인수:

  • <name>: 훅 이름 (예: command-logger)

예시:

openclaw hooks disable command-logger

출력:

⏸ Disabled hook: 📝 command-logger

비활성화 후:

  • 훅이 다시 로드되도록 게이트웨이를 재시작하세요

훅 설치

openclaw hooks install <path-or-spec>
openclaw hooks install <npm-spec> --pin

로컬 폴더/아카이브 또는 npm에서 훅 팩을 설치합니다.

npm 스펙은 레지스트리 전용(패키지 이름 + 선택적 정확한 버전 또는 dist-tag)입니다. Git/URL/파일 스펙과 semver 범위는 거부됩니다. 의존성 설치는 안전을 위해 --ignore-scripts로 실행됩니다.

기본 스펙과 @latest는 안정 트랙을 유지합니다. npm이 이들 중 하나를 프리릴리스로 해석하면, OpenClaw은 중지하고 @beta/@rc 같은 프리릴리스 태그나 정확한 프리릴리스 버전으로 명시적 동의를 요청합니다.

동작:

  • 훅 팩을 ~/.openclaw/hooks/<id>에 복사
  • hooks.internal.entries.*에서 설치된 훅 활성화
  • hooks.internal.installs에 설치 기록

옵션:

  • -l, --link: 복사하지 않고 로컬 디렉토리를 링크 (hooks.internal.load.extraDirs에 추가)
  • --pin: npm 설치를 hooks.internal.installs에 정확히 해석된 name@version으로 기록

지원 아카이브: .zip, .tgz, .tar.gz, .tar

예시:

# 로컬 디렉토리
openclaw hooks install ./my-hook-pack

# 로컬 아카이브
openclaw hooks install ./my-hook-pack.zip

# NPM 패키지
openclaw hooks install @openclaw/my-hook-pack

# 복사하지 않고 로컬 디렉토리 링크
openclaw hooks install -l ./my-hook-pack

훅 업데이트

openclaw hooks update <id>
openclaw hooks update --all

설치된 훅 팩을 업데이트합니다(npm 설치만 해당).

옵션:

  • --all: 추적된 모든 훅 팩 업데이트
  • --dry-run: 기록하지 않고 변경될 내용 표시

저장된 무결성 해시가 존재하고 가져온 아티팩트 해시가 변경되면, OpenClaw은 진행 전에 경고를 출력하고 확인을 요청합니다. CI/비대화형 실행에서 프롬프트를 건너뛰려면 전역 --yes를 사용하세요.

번들 훅

session-memory

/new를 실행할 때 세션 컨텍스트를 메모리에 저장합니다.

활성화:

openclaw hooks enable session-memory

출력: ~/.openclaw/workspace/memory/YYYY-MM-DD-slug.md

참조: session-memory documentation

bootstrap-extra-files

agent:bootstrap 중에 추가 부트스트랩 파일(예: 모노레포 로컬 AGENTS.md / TOOLS.md)을 주입합니다.

활성화:

openclaw hooks enable bootstrap-extra-files

참조: bootstrap-extra-files documentation

command-logger

모든 명령어 이벤트를 중앙 감사 파일에 기록합니다.

활성화:

openclaw hooks enable command-logger

출력: ~/.openclaw/logs/commands.log

로그 보기:

# 최근 명령어
tail -n 20 ~/.openclaw/logs/commands.log

# 보기 좋게 출력
cat ~/.openclaw/logs/commands.log | jq .

# 액션별 필터링
grep '"action":"new"' ~/.openclaw/logs/commands.log | jq .

참조: command-logger documentation

boot-md

게이트웨이가 시작될 때(채널 시작 후) BOOT.md를 실행합니다.

이벤트: gateway:startup

활성화:

openclaw hooks enable boot-md

참조: boot-md documentation