hook
Public Made by Adomby adom
Registry-native cross-agent auto-update hook. Keeps adom/core apps and skills current from wiki.adom.inc on every Claude Code and Codex prompt, in the background.
Two ways the hook silently stops updating: cron registration is not HOME-safe, and a missing CLI exits quietly
Both are the failure class this file's own header says it exists to prevent ("a hard failure was indistinguishable from success, and masked a fleet-wide auto-update outage for four days"). Each one leaves a container that has stopped updating and says nothing.
1. install.sh cron registration is not HOME-safe (real, hit live)
CRON_LINE_INTERVAL="*/30 * * * * $HOOK_CMD >/dev/null 2>&1"
if { crontab -l 2>/dev/null | grep -v "adom-core-update.sh" || true; \
echo "$CRON_LINE_INTERVAL"; echo "$CRON_LINE_REBOOT"; } | crontab - 2>/dev/null; then
$HOOK_CMD is derived from $HOME, but crontab is a per-USER resource, not per-HOME. So any pkg install adom/core run with a non-default HOME strips the real entries (grep -v matches every adom-core-update.sh line, not just this HOME's) and repoints that user's crontab at the foreign HOME.
Repro (I did this by accident): run HOME=/tmp/somewhere ADOMPKG_PREFIX=/tmp/somewhere/prefix adom-wiki pkg install adom/core, intending an isolated test. The prefix and ~/.claude/settings.json isolate correctly (both are HOME-scoped). The crontab does not: the real user's cron becomes
*/30 * * * * bash /tmp/somewhere/.adom/hooks/adom-core-update.sh >/dev/null 2>&1
@reboot bash /tmp/somewhere/.adom/hooks/adom-core-update.sh >/dev/null 2>&1
Delete that temp dir and the container's auto-update is dead. Silently -- cron output is >/dev/null 2>&1, the status/log files it would write live under the foreign HOME, and crontab - failures are swallowed by 2>/dev/null. Nothing surfaces. I only caught it because I went looking.
Narrow trigger (it needs a non-standard HOME), but the blast radius is the whole point of the hook, and the detection surface is zero.
Suggested guards, cheapest first:
- Strip only entries matching the current
$HOOK_CMD, not everyadom-core-update.shline. Idempotency is preserved and a foreign HOME can no longer evict the real entry. - Skip the crontab rewrite entirely when
$HOMEis not the invoking user's real home (compare againstgetent passwd "$(id -un)"), since in that situation the cron entry is wrong by construction.
2. A missing CLI exits silently
command -v adom-wiki >/dev/null 2>&1 || exit 0
If the CLI is not on PATH the hook no-ops and reports nothing, so the container stops updating with no signal anywhere. The export PATH="$HOME/.local/bin:$PATH" above makes this narrow, but the whole design principle here is that a broken auto-update is loud. This one path is still quiet.
Suggested: echo a line before exiting, e.g. adom: the adom-wiki CLI is not on PATH, so this container cannot auto-update. Install it with the wiki bootstrap. Under UserPromptSubmit that reaches the model as additionalContext (and is harmlessly discarded under cron, same as every other message here).
Context
Filed from the adom-wiki-cli side while fixing the concurrent-install corruption (adom/adom-wiki-cli#5, fixed in 1.0.39). Related: adom/hook#186. Neither of these is blocking anything today.
0 Replies
Log in to reply.