mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-10 02:30:46 +08:00
- 在 oclaw/ 下重新初始化 Git 仓库 - 补齐子仓库 .gitignore,避免提交本地运行态数据(_local、node_modules、logs 等) - 提交当前工程代码与配置 Made-with: Cursor |
||
|---|---|---|
| .. | ||
| bundled | ||
| __init__.py | ||
| _selftest.py | ||
| frontmatter.py | ||
| internal_hooks.py | ||
| loader.py | ||
| policy.py | ||
| README.md | ||
| workspace.py | ||
oclaw/hooks
Unified Python hooks runtime and hook packages.
What you get
- In-process hook bus: register on
typeortype:action, sync/async handlers, isolated failures. - Directory discovery: finds hooks by
HOOK.md + handler.py(orindex.py). - Config gating: supports
hooks.internal.enabledandhooks.internal.entries.<hookKey>.enabled. - Source precedence: bundled / managed / workspace collision resolution.
Hook layout
Put hooks in any of:
- Bundled:
oclaw/hooks/bundled/<hookName>/ - Managed:
~/.openclaw/hooks/<hookName>/ - Workspace:
<workspace>/hooks/<hookName>/(explicit opt-in by default)
Each hook directory must contain:
HOOK.mdwith YAML frontmatter includingmetadata.openclaw.eventshandler.py(orindex.py) exporting a callablehandle(event)
Minimal self-test
python "oclaw/hooks/_selftest.py"