Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add Songhonglei/better-agent-skills --skill init-hooksgit clone --depth 1 https://github.com/Songhonglei/better-agent-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/songhonglei/better-agent-skills/init-hooks)<a href="https://agentmods.dev/skills/songhonglei/better-agent-skills/init-hooks"><img src="https://agentmods.dev/badge/skills/songhonglei/better-agent-skills/init-hooks/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/songhonglei/better-agent-skills/init-hooks"><img src="https://agentmods.dev/badge/skills/songhonglei/better-agent-skills/init-hooks.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00201 | $0.02526 |
| Opus 5 | $0.00101 | $0.01263 |
| Sonnet 5 | $0.00040 | $0.00505 |
| Haiku 4.5 | $0.00020 | $0.00253 |
Grade A, and why
init-hooks scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 228 lines — stays where its author put it; the contents beside it link to each section on GitHub.
init-hooks
- Version: 1.0.0
- License: MIT
- Author: Evan Song · github.com/Songhonglei
- Repository: https://github.com/Songhonglei/better-agent-skills (skills/init-hooks)
管理 OpenClaw 容器/主机启动时自动执行的脚本钩子。gateway 重启、容器重启、容器重建均不丢失(数据持久化在
workspace/.init-hooks/)。支持 inline 命令 / 本地脚本(shell·python)/ CDN URL(zip·tar.gz 自动下载解压)三种钩子类型。
路径约定
~/.openclaw/workspace/.init-hooks/
├── hooks.json # 注册表(truth)
├── dispatcher.sh # 自动生成,post-init.sh 调用这个
├── last-run.log # 每次启动执行日志
└── downloads/ # CDN URL 钩子下载缓存
└── hook_<id>.*
脚本路径:
~/.openclaw/workspace/skills/init-hooks/scripts/
├── manage.py # 主入口(所有 CRUD + run + install)
└── sync_openclaw_config.py # openclaw.json 多路径同步工具
操作命令速查
所有操作通过 exec 运行,工作目录任意:
SCRIPT="$HOME/.openclaw/workspace/skills/init-hooks/scripts/manage.py"
python3 $SCRIPT install # 首次安装
python3 $SCRIPT list # 列出所有钩子
python3 $SCRIPT show <id> # 查看钩子详情
python3 $SCRIPT add ... # 新增(见下方)
python3 $SCRIPT edit <id> ... # 修改
python3 $SCRIPT enable <id> # 启用
python3 $SCRIPT disable <id> # 禁用
python3 $SCRIPT delete <id> # 删除(需二次确认)
python3 $SCRIPT delete <id> --force # 强制删除不确认
python3 $SCRIPT run # 立即运行所有启用的钩子
python3 $SCRIPT run <id> # 立即运行指定钩子
python3 $SCRIPT status # 查看安装状态
新增钩子:三种类型
inline(内嵌 shell 命令)
python3 $SCRIPT add \
--name "初始化日志目录" \
--type inline \
--content "mkdir -p ~/logs && echo 'started' >> ~/logs/boot.log"
多行命令用 \n 分隔:
python3 $SCRIPT add \
--name "环境变量初始化" \
--type inline \
--content $'export MY_VAR=hello\nmkdir -p ~/tmp'
script(本地 shell 脚本)
python3 $SCRIPT add \
--name "凭证/账号启动恢复" \
--type script \
--path "~/.openclaw/workspace/scripts/restore-credentials.sh"
python(本地 Python 脚本)
python3 $SCRIPT add \
--name "Agent workspace 配置" \
--type python \
--path "~/.openclaw/workspace/scripts/set-agents.py"
What ships with it
5 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 10d ago First seen · 228 lines · 201 tokens per session scan A ed94cf1c717b
init-hooks is a skill published in the GitHub repository Songhonglei/better-agent-skills (3 stars, last pushed 3d ago), licensed MIT. It adds 201 tokens to every session and 2,526 once invoked, about $0.0010 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
writing
A writing guide for turning verified facts and calculations into finished text for a specific audience. It follows the requested language, structure, and length.
regex-mastery
Use this skill when writing regular expressions, debugging pattern matching,optimizing regex performance, or implementing text validation. Triggers on regex, regular expressions, pattern matching, lookahead, lookbehind, named groups, capture groups, backreferences, and any task requiring text pattern matching.
ws-ckpt
A Linux-only tool for creating and managing workspace snapshots. A snapshot is a saved view of files that can later be compared, restored, listed, or deleted.
food-order
Reorder previous Foodora orders, preview cart contents, and track delivery ETA/status with ordercli. Use when the user wants to reorder food, check delivery status, or browse recent Foodora order history. Never confirm an order without explicit user approval.
mnemon
Persistent memory CLI for LLM agents. Store facts, recall past knowledge, link related memories, manage lifecycle.
mnemon
Persistent memory for MiniMax Code. Recall durable context, store important facts and decisions, and link related memories with the mnemon CLI.