# adom/hook

**Registry-native, cross-agent auto-update.** Keeps your `adom/core` apps and
skills current from [wiki.adom.inc](https://wiki.adom.inc) automatically, on every
Claude Code and Codex prompt. No git, no private repository.

![adom-hook updating core in the background on a prompt](docs/shot.png)

## Why

The old update path fetched a private GitHub repo on every prompt. That works for
insiders but cannot be shared, and it only runs under Claude. This hook checks the
public registry instead, so it works for any user and any agent.

## How it works

A throttled, bounded check (`adom-wiki outdated`, ~every 30 min). When an installed
package is behind the registry, it applies the update **in the background** and
drops a one-line note into the model's context. It never blocks your prompt.

Two triggers are wired, sharing one throttle stamp (so a double fire is a no-op):

| Trigger | Where it matters |
| --- | --- |
| `UserPromptSubmit` (Claude Code / Codex) | interactive containers -- updates as you type |
| cron (`*/30` + `@reboot`) | **headless** lite/service containers -- no prompts, so this is the only trigger they get, and it's where prod releases run |

If the image has no `crontab` (or `crond` isn't running), install says so; have the
app call `~/.adom/hooks/adom-core-update.sh` on its own interval instead (throttled
+ idempotent, safe to call often).

Under cron, stdout goes to mail or `/dev/null`, so the durable record is
`~/.adom/last-update.status` (`running`, or the last exit code) and
`~/.adom/last-update.log`.

One pass updates **everything installed**, not just `adom/core`'s tree:

| What | How | Cadence |
| --- | --- | --- |
| every installed package (apps, skills, bootstraps), including ones you installed yourself | `pkg update` | ~30 min, on prompt **or** cron |
| newly added `adom/core` members | `pkg install adom/core` (update alone never *adds*) | same run |
| the `adom-wiki` CLI itself | just another package -- `adom/core` depends on it | same run |

The CLI is **not** a separate self-updating layer: there is no automatic
self-update and no CLI timer. `adom-wiki self-update` is a manual fallback for the
one case the package path cannot handle (the atomic binary swap failing with
ETXTBSY). If this hook is broken, the CLI goes stale along with everything else.

Components are out of scope: they are wiki content you reference, not packages you
install.

## Install

```bash
adom-wiki install adom/hook
```

`adom/core` already depends on it, so a normal bootstrap wires it for you.

## Controls

| Env var | Effect |
| --- | --- |
| `ADOM_HOOK_INTERVAL=<seconds>` | check cadence (default `1800`) |
| `ADOM_HOOK_FORCE=1` | force a check on the next prompt |
| `ADOM_HOOK_DISABLE=1` | disable the hook |

## Uninstall

```bash
adom-wiki uninstall adom/hook
```

Unwires the hook from both `~/.claude/settings.json` and `~/.codex/hooks.json`.
