Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@
>
> Three version numbers exist and are **not** the same: the framework (`plugins/aios/.claude-plugin/plugin.json`), **AIOS Glass** and the **AIOS App**, each versioned independently. Where an entry says "Glass" or "App" it means that surface. Their current numbers are deliberately not written here — read each from its own manifest, because a version in prose goes stale silently.

## 2026-11-18 — A removed hook now says it is gone

`hash: ` · [#334](https://github.com/The-AIOS/aios/issues/334)

> **What you can now do.** Update past a hook that was renamed or removed and see which hooks are being skipped, instead of finding out weeks later that a guard turned the failure into silence.

**A missing hook file is reported, not hidden.** The `[ ! -f … ] || …` guard correctly keeps a missing hook from blocking every prompt, but it also made the hook a silent no-op: the installer said "Done" and listed nothing about the file that no longer existed. The installer's dry run and `--apply` now print `! missing <event> <path> this hook is being skipped; its file does not exist` for every guarded hook and the status line whose file is gone, so `/aios:update` reads it aloud.

**Action required:** none. Start a new Claude session after the update so the report appears on the next run of `install-settings.py`.

## 2026-11-17 — Agents speak up mid-session, teams from one sentence, and a tidy hooks/ folder

`hash: 95088b4 · 4dae12a` · [#317](https://github.com/The-AIOS/aios/issues/317) · [#274](https://github.com/The-AIOS/aios/issues/274) · [#314](https://github.com/The-AIOS/aios/issues/314) · [#309](https://github.com/The-AIOS/aios/issues/309) · [#323](https://github.com/The-AIOS/aios/issues/323) · [#316](https://github.com/The-AIOS/aios/issues/316) · [#319](https://github.com/The-AIOS/aios/issues/319) · [#321](https://github.com/The-AIOS/aios/pull/321) · [#325](https://github.com/The-AIOS/aios/issues/325) · [#326](https://github.com/The-AIOS/aios/issues/326) · [#327](https://github.com/The-AIOS/aios/issues/327) · [#328](https://github.com/The-AIOS/aios/issues/328)
Expand Down
46 changes: 45 additions & 1 deletion hooks/install/install-settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
R transcript retention -- keep session transcripts for 10 years instead of Claude Code's 30 days
(set only when the file has no cleanupPeriodDays; an operator's own value is never changed)

The summary also reports guarded hooks whose script file no longer exists (`! missing`), so an update
that renames or removes a hook is visible instead of silently skipping it.

USAGE
install-settings.py show what would change (default: changes nothing)
install-settings.py --apply back up settings.json, merge, write, read back and verify
Expand Down Expand Up @@ -80,6 +83,31 @@ def guard(cmd):
return "[ ! -f %s ] || %s" % (m.group(1), cmd) if m else cmd


def guarded_path(cmd):
"""The script path in `[ ! -f <script> ] || <cmd>`, exactly as the command spells it, or None.

Only the first bracket (the guard test) counts. SCRIPT also matches the command after `||`, so
calling it on the whole string would find the second path, which is the one being run, not the
one the shell tests for existence.
"""
if not GUARDED.match(cmd):
return None
end = cmd.find(']')
if end < 0:
return None
m = SCRIPT.search(cmd, 0, end)
return m.group(1) if m else None


def resolve_path(raw):
"""Expand the shell spellings the guard uses (`~`, `$HOME`, `${HOME}`, quotes) for os.path."""
raw = raw.strip('"\'')
for home in ("${HOME}", "$HOME"):
if raw.startswith(home):
raw = "~" + raw[len(home):]
return os.path.expanduser(raw)


def plan(platform, root, venture_guard):
"""[(key, event, matcher, command, timeout, what it does)] in SETUP §10's exact command forms."""
if platform == "windows":
Expand Down Expand Up @@ -304,11 +332,25 @@ def main():
upgrades.append((wanted[signature(cmd)], hk))
if signature(cmd) in wanted and moved(cmd):
moves.append((wanted[signature(cmd)], hk))
# A guarded hook whose file is gone is a silent no-op (that is the point of the guard). Report
# it so an update that renamed or removed a hook is visible in the dry run and in --apply.
missing = []
for event, groups in (settings.get("hooks") or {}).items():
for group in groups or []:
for hk in group.get("hooks", []) or []:
cmd = str(hk.get("command", ""))
raw = guarded_path(cmd)
if raw and not os.path.exists(resolve_path(raw)):
missing.append((event, raw))
status_add = "statusLine" not in settings
cur_status = str(settings.get("statusLine", {}).get("command", ""))
raw_status = guarded_path(cur_status)
if raw_status and not os.path.exists(resolve_path(raw_status)):
missing.append(("statusLine", raw_status))
status_note = None
status_upgrade = None
if not status_add:
cur = str(settings["statusLine"].get("command", "")).strip()
cur = cur_status.strip()
flat = cur.replace('"', "")
# The form AIOS itself wrote before #292: bash + tee + claude-identity.sh cache + context-monitor.py,
# two programs per render. Only those forms are ours to replace; anything else is the operator's.
Expand Down Expand Up @@ -356,6 +398,8 @@ def main():
print(" ~ guard %s a missing hook file is skipped instead of blocking every prompt" % key)
for key in sorted({k for k, _ in moves}):
print(" ~ move %s its file moved into a folder in hooks/ (#309); the path is updated, nothing else" % key)
for event, raw in missing:
print(" ! missing %s %s this hook is being skipped; its file does not exist" % (event, raw))
if not venture_guard:
print(" - later C the venture guard is added when you mount a company (/aios:company --mount)")
if retention_add:
Expand Down
26 changes: 26 additions & 0 deletions tests/install-settings.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -233,5 +233,31 @@ cp "$S" "$T/custom.json"; out=$(run --platform posix --apply)
cmp -s "$S" "$T/custom.json" >/dev/null 2>&1 || grep -q 'my-own-monitor' "$S"
grep -q 'my-own-monitor' "$S" && case "$out" in *"~ update B"*) no "a custom line that feeds the cache was offered as an update" ;; *) ok "a custom status line that feeds the cache is kept, unflagged" ;; esac || no "custom line replaced"

echo "── #334: a guarded hook whose file is gone is reported, not silently skipped ──"
S="$T/missing.json"
DANGLING="$T/empty-home/aios/hooks/context/no-such-hook.py"
"$PYBIN" - "$S" "$DANGLING" <<'PY' && ok "fixture with a dangling guarded hook written" || no "fixture write" "$(cat "$S")"
import json, sys
d = {
"hooks": {"UserPromptSubmit": [{"hooks": [{"type": "command", "command": "[ ! -f %s ] || python3 %s" % (sys.argv[2], sys.argv[2])}]}]},
"statusLine": {"type": "command", "command": "[ ! -f %s ] || python3 %s" % (sys.argv[2], sys.argv[2])},
}
json.dump(d, open(sys.argv[1], "w"))
PY
out=$(run --platform posix)
case "$out" in
*"! missing UserPromptSubmit $DANGLING"*"! missing statusLine $DANGLING"*) ok "dry run names the dangling file for the hook and the status line" ;;
*) no "no missing lines for the dangling hook" "$out" ;;
esac
case "$out" in *'this hook is being skipped'*) ok "the line says the hook is being skipped" ;; *) no "no skip explanation" "$out" ;; esac
mkdir -p "$T/live-home/aios/hooks/context"; : > "$T/live-home/aios/hooks/context/live.py"
LIVE="$T/live-home/aios/hooks/context/live.py"
"$PYBIN" - "$S" "$LIVE" <<'PY' && ok "control fixture with a present hook written" || no "control fixture write"
import json, sys
json.dump({"hooks": {"UserPromptSubmit": [{"hooks": [{"type": "command", "command": "[ ! -f %s ] || python3 %s" % (sys.argv[2], sys.argv[2])}]}]}}, open(sys.argv[1], "w"))
PY
out=$(run --platform posix)
case "$out" in *"! missing"*) no "a present hook was reported missing" "$out" ;; *) ok "a present guarded hook is not reported missing" ;; esac

echo "── RESULT: $PASS passed, $FAIL failed ──"
[ "$FAIL" = 0 ]
Loading