Impossible OS Docs

Automation Hardening

What is it?

Automation hardening turns the repository's AI workflow rules from reminders into gates. Where a hook once printed "remember to run the review", it now refuses the commit until the review ran, was received, and still matches the code being committed. Both interchangeable writers (claude via .claude/settings.json and agy via .agents/hooks.json and scripts/agy-hook-bridge.py) execute the exact same hook scripts, the same MCP servers are wired for both writers and Codex, neither writer can override Codex's model settings, and audits fail when hooks or cross-tool configs drift from documentation.

How does it work?

Claude Code (.claude/settings.json) and Antigravity CLI (.agents/hooks.json routed through scripts/agy-hook-bridge.py) run the exact same hook scripts from .claude/hooks/ before and after tool calls, at session start, prompt submission, and stop. A hook that blocks exits with status 2 and a message naming what is missing. Review evidence is recorded in state files under .claude/state/ (gitignored) and the writer-agnostic .claude/overnight/reviews/manifest.jsonl receipt log, so a later gate checks that the required pass ran over the staged candidate. Antigravity's PostToolUse host event does not deliver tool output bodies (and has no SubagentStop event), so on agy agent_result_cache.py pre reads shared cache entries and inflight_race_guard.py / agent_dispatch_recorder.py run cleanly, while new cache population from agy waits on upstream Antigravity hook output.

flowchart LR
  impl[Edit code] --> review[Codex review dispatch]
  review --> state[(.claude/state + reviews manifest)]
  state --> recv[receiving-code-review]
  recv --> build[build + tests]
  build --> gate{section_commit_gate}
  gate -- evidence complete --> commit[git commit]
  gate -- missing or stale --> block[BLOCK with reason]
  • Codex invocation policy. codex_model_flag_block.py refuses any Codex dispatch from either writer that passes a model or effort flag; the user sets those centrally. See Codex Invocation Policy.
  • Review effort by area and finding. The operator's [schedule.effort] table in .conclave/reviewers.toml routes both claude and agy through the Astra pin ([routes]) and sets each review pass's reasoning effort: kernel and boot rounds 1 to 3 at high then medium, a kernel or boot round after a P1 at high again, and everything else at medium. scripts/codex-dispatch.sh applies it and records effort and tier on the receipt of every pass it applied a pinned level to (a fallback, a grandfathered section or a pin with no table leaves them out): Reviewer Effort Follows the Area and the Chain.
  • Review reception record. codex_review_completed.py records each Codex review and when its findings were received, and section_commit_gate.py reads both that record and checked Astra round receipts bound to HEAD, index_tree ("staged-" + sha256(ls-files)), and worktree_sha256 with a partial-staging check (including staged deletions). The PreToolUse gate that blocked edits until reception (receiving_review_required.py) was deleted on 2026-11-09 with the other process gates.
  • Section commit gate. section_commit_gate.py refuses a section-ship commit without a fresh build and reviews bound to the staged content. It finds the commit in a Bash call by reading the command as bash does (_BashLexer): $'...' and quotes that span lines, heredoc bodies dropped, substitutions read as commands, (( ... )) as arithmetic; git commit's options are read as git's parse-options reads them (a value option takes its value, -- ends them, a unique prefix such as --no-veri counts, the last of -n and --verify wins); the lines after a syntax error bash reports (bash -n) never run, and text it cannot read is refused as a possible no-verify commit. Before 2026-11-12 it used shlex and misread 165 of 575 recorded commit commands, 160 of them as no commit at all. Reading a command is still a guess, so --no-verify is refused by git itself: .githooks/prepare-commit-msg refuses a git commit whose pre-commit never ran, however -n was spelled.
  • Step telemetry. Skill steps are recorded as they happen and survive context compaction, so a skill cannot claim a step it never ran.
  • Content lints. scripts/lint.sh flags tautological tests, stubs behind a completion stamp, and roadmap sections whose stamps or OS Comparison rows are incomplete.
  • Audits. scripts/audit-hooks.sh checks every wired hook against MANIFEST.md plus parity between .claude/settings.json and scripts/agy-hook-bridge.py, and scripts/audit-ai-system.sh runs 9 cross-tool checks across Claude Code, Antigravity CLI, and Codex.

What are its interfaces?

Interface Purpose
.claude/hooks/MANIFEST.md One row per hook: event, matcher, purpose and whether it blocks
Hook Message Codes What each block code means and how to clear it
SKIP_REVIEW_HOOK=1 with SKIP_REVIEW_HOOK_REASON="..." The logged opt-out for a legitimate false positive (revert, stamp-only commit)
bash scripts/audit-hooks.sh Hook wiring versus the manifest and Antigravity bridge parity
bash scripts/audit-ai-system.sh 9-check cross-tool configuration drift audit (Claude, Antigravity, Codex)
scripts/codex-dispatch.sh The review dispatch shape the gates recognise

Opt-outs are recorded in .claude/state/skip-log.jsonl, and using one resets the review record so it cannot be reused.

How do I use it?

Run both audits after adding or changing a hook; the commit hook also runs the first automatically when a commit touches .claude/hooks/, .claude/settings.json, .agents/hooks.json, or scripts/agy-hook-bridge.py:

bash scripts/audit-hooks.sh      # audit-hooks.sh: PASS (no drift)
bash scripts/audit-ai-system.sh  # audit-ai-system.sh: PASS (9/9 checks)

Both outputs were measured on 2026-11-27 across all 6 audit-hooks.sh checks and all 9 audit-ai-system.sh checks. When a gate blocks, read its code in Hook Message Codes and supply the missing evidence rather than opting out. To decide what to do with a review finding, follow Triage Codex Finding.

What is not implemented yet?

  • Codex MCP in non-interactive runs. The servers are configured for Codex, but every MCP call from a non-interactive Codex path is cancelled by an upstream Codex bug: Codex MCP Wiring.
  • Stronger review binding. The reception gate expires on a one-hour timer rather than on a HEAD or tree change, and findings are not parsed into structured records: receiving-code-review Hard Gate.
  • Per-section review state. Review records are keyed per file, not per section, pending an operator decision: Four-Dispatch Enforcement.

How does it compare with Windows 11 and Linux?

Neither Windows nor Linux development has an equivalent, because neither is built around an AI agent working through hooks. The closest analogues are CI checks and linters that run after the fact; the gates here run at the moment of the edit or commit and refuse it with a reason.

See also

Impossible OS is free software under the GPL-3.0-only license. Last updated Privacy Edit this page on GitHub