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.02762 |
| Opus 5.5 | $0.00080 | $0.01105 |
| Sonnet 5.5 | $0.00040 | $0.00552 |
| Haiku 4.5 | $0.00020 | $0.00276 |
Grade A, and why
init-hooks scanned grade A with 1 finding 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 9d 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.
Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
curl -fsSL "https://cdn.example.com/my-init.zip" -o /tmp/pkg How it starts
The opening of the file, as written. The whole thing — 240 lines — stays where its author put it; the contents beside it link to each section on GitHub.
init-hooks
- Version: 1.0.1
- 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.
- 9d ago Changed · +12 lines ef8012c592fc
- 1mo 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 6d ago), licensed MIT. It adds 201 tokens to every session and 2,762 once invoked, about $0.0008 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
eval-dataset-design
A guide to creating reliable test sets for AI agents. Each evaluation task includes the request, the simulated user's behaviour, a reset starting state, and a success check that can be independently verified.
memory-system
A guide to giving an AI agent persistent, user-specific memory across conversations. It covers what to remember, how to store it, how to update or compress it, and when to use memory instead of a shared knowledge base.
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.
pkf-writing
Author, update, convert, validate, persist, and render PKF (.pkf) content through message-inline, Library Asset, or Memory Page carriers. Use for structured reports, knowledge pages, delivery cards, or any .pkf body. NOT for recall, memory-graph placement, or curation decisions — those belong to the memory skill.
memory-import
Bulk-import an external knowledge base into Prismer memory via the three-layer import pipeline (07 §3.1). Use when the user asks to import/migrate documents, a knowledge base, or notes into workspace memory. Layer 1 lands raw documents (zero LLM, instantly searchable); Layer 2 is YOUR distillation work — you read the…
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.