Files
boshu2__agentops/scripts/check-hookless-cold-start.sh
T
Bo b84dcf3ca2 docs(hookless): close cold-start orientation drift (soc-qh2g1 #cold-start-orientation-coherence) (#795)
## Summary

Close the hookless cold-start orientation gap for `soc-qh2g1` by making
the live startup docs and skills point at explicit `ao session
bootstrap` plus pulled context (`ao inject` / `ao lookup`) instead of
hidden SessionStart behavior.

## Changes

- Reframes live docs that still implied automatic startup/handoff
injection to the hookless explicit-command path.
- Updates source and Codex skill mirrors for `quickstart`, `inject`,
`using-agentops`, `recover`, `bug-hunt`, and `session-bootstrap`.
- Expands the cold-start and docs drift gates so `SessionStart hook`,
`startup hooks`, and `auto-inject ... hook` promises fail unless
explicitly hedged as opt-in, removed, or historical.
- Refreshes scoped Codex skill hashes for the touched mirrors.

## Test plan

- [x] `bash scripts/check-hookless-cold-start.sh`
- [x] `bash scripts/check-doc-hooks-drift.sh`
- [x] `bats tests/scripts/check-hookless-cold-start.bats
tests/scripts/check-doc-hooks-drift.bats`
- [x] `shellcheck scripts/check-hookless-cold-start.sh
scripts/check-doc-hooks-drift.sh`
- [x] `bash scripts/regen-codex-hashes.sh --check --only
session-bootstrap,quickstart,inject,using-agentops,recover,bug-hunt`
- [x] `bash scripts/validate-codex-generated-artifacts.sh`
- [x] `bash scripts/validate-codex-lifecycle-guards.sh`
- [x] `bash scripts/validate-agents-split.sh`
- [x] `git diff --check`
- [x] `bash scripts/validate-skill-runtime-parity.sh`
- [x] `bash scripts/lint-codex-native.sh`

Closes-scenario: soc-qh2g1#cold-start-orientation-coherence
Bounded-context: BC1-Corpus
Evidence: scripts/check-hookless-cold-start.sh
2026-06-06 11:23:56 -04:00

85 lines
3.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# check-hookless-cold-start.sh — scenario-2 regression gate for soc-qh2g1.
#
# AgentOps 3.0 is hookless: no SessionStart/Stop hook ships, so no cold-start or
# continuity doc/skill may present a hook path or SessionStart hook as a
# CURRENTLY ACTIVE surface. A hook reference is allowed only on a line that
# hedges it as opt-in / author-it-yourself / historical / removed / legacy (the
# hooks-authoring escape hatch).
#
# Scope is a FIXED list of cold-start / continuity AND workflow-discipline
# surfaces. It deliberately does NOT scan all of docs/+skills/ (release notes, the
# hooks-authoring skill, and scope guards legitimately name hook paths). The repo
# CLAUDE.md + its tiered split (AGENTS-WORKFLOW.md) and the session-scope surfaces
# (ship-loop, the evolve post-mortem checkpoint) were brought IN scope by ag-o5xp:
# their `session-pr-counter.sh` reference was a stale active-surface promise after
# the hook was removed in the #511 hookless teardown. They are now hedged
# (removed / opt-in / hooks-authoring) and gated here so the drift cannot recur.
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
FILES=(
"AGENTS.md"
"docs/architecture/primitive-chains.md"
"skills/session-bootstrap/SKILL.md"
"skills-codex/session-bootstrap/SKILL.md"
"skills/quickstart/SKILL.md"
"skills-codex/quickstart/SKILL.md"
"skills/inject/SKILL.md"
"skills-codex/inject/SKILL.md"
"skills/using-agentops/SKILL.md"
"skills-codex/using-agentops/SKILL.md"
"skills/recover/SKILL.md"
"skills-codex/recover/SKILL.md"
"skills/bug-hunt/SKILL.md"
"skills-codex/bug-hunt/SKILL.md"
"docs/newcomer-guide.md"
# Workflow-discipline surfaces (ag-o5xp): must never present the removed
# session-pr-counter hook as an active surface.
"CLAUDE.md"
"AGENTS-WORKFLOW.md"
"skills/ship-loop/SKILL.md"
"skills/evolve/references/postmortem-checkpoint.md"
"skills-codex/evolve/references/postmortem-checkpoint.md"
)
# A hook path is "hedged" (allowed) when its line also carries one of these.
# These hedge ARTIFACT EXISTENCE (opt-in / author-it-yourself / historical /
# removed). "When supported" is deliberately NOT here: it hedges harness
# capability, not whether AgentOps ships the hook (it does not).
HEDGE='hookless|explicit|replacement|replaced|opt-in|optional|author|authored|if you author|hooks-authoring|historical|legacy|compatibility|removed|no such hook|ships no|example|if installed|when hooks are installed|when installed|used to|formerly'
HOOK_PROMISE='hooks/[A-Za-z0-9_.-]+\.sh|[A-Za-z0-9_.-]*session-(start|end|autostart)[A-Za-z0-9_.-]*\.sh|Session(Start|End) hook|session-(start|end|autostart) hook|startup hooks?|precompact-snapshot hook|auto-inject[^[:cntrl:]]*hook|hook[^[:cntrl:]]*auto-inject'
fail() {
printf 'FAIL: %s\n' "$1" >&2
exit 1
}
violations=0
scanned=0
for rel in "${FILES[@]}"; do
file="$ROOT/$rel"
[[ -f "$file" ]] || continue
scanned=$((scanned + 1))
while IFS= read -r match; do
[[ -n "$match" ]] || continue
lineno="${match%%:*}"
content="${match#*:}"
if ! grep -qiE "$HEDGE" <<<"$content"; then
printf 'FAIL: %s:%s presents a hook/startup promise as an active surface without an opt-in/historical hedge\n' \
"$rel" "$lineno" >&2
printf ' %s\n' "$content" >&2
violations=$((violations + 1))
fi
done < <(grep -nE "$HOOK_PROMISE" "$file" || true)
done
[[ "$scanned" -gt 0 ]] || fail "no cold-start surfaces found under $ROOT"
if [[ "$violations" -gt 0 ]]; then
fail "$violations stale hook promise(s) in cold-start/continuity surfaces. Reframe as explicit \`ao\` commands or hedge as opt-in (author via the hooks-authoring skill)."
fi
printf 'PASS: no stale hook-context promises in %d cold-start/continuity surface(s)\n' "$scanned"