Skip to content

feat: register Codex project safety hooks #407

Closed

Description

@Jammy2211

Overview

Make the managed PyAuto agent safety-hook surface genuinely portable between Claude and Codex. Extend the manifest-driven generator to produce tracked Codex project hook registration, reuse the existing safety implementations, and document the one intentional asymmetry: Claude's remote-only SessionStart bootstrap is not registered unchanged for Codex.

Plan

  • Generate and drift-check .codex/hooks.json from the same repository manifest that owns Claude hook registration.
  • Register the shared end-at-deliverable guard, the shared Mind commit guard where applicable, and each assistant's existing PyAuto API gate without duplicating hook logic.
  • Add Codex-shaped allow, deny, malformed-input, generator, drift, and propagation coverage.
  • Update assistant and generated project documentation to describe Codex project trust and the remaining SessionStart asymmetry accurately.
  • Validate all six repositories independently, then route each through the workspace ship gate; stop at Heart RED until a fresh live-human development override is recorded.
Detailed implementation plan

Affected Repositories

  • PyAutoMind (primary)
  • PyAutoBrain
  • autofit_assistant
  • autogalaxy_assistant
  • autolens_assistant
  • autocti_assistant

Work Classification

Workspace

Branch Survey

Repository Current Branch Dirty?
PyAutoMind main clean after stale-claim reconciliation
PyAutoBrain main clean
autofit_assistant main user-owned untracked scripts/compose_model_gaussians_exponentials.py; preserve
autogalaxy_assistant main clean
autolens_assistant main user-owned untracked scripts/cluster_model_composition.py; preserve
autocti_assistant main clean

Suggested branch: feature/codex-hook-parity

Worktree root: ~/Code/PyAutoLabs-wt/codex-hook-parity/

Implementation Steps

  1. Extend PyAutoMind/scripts/repos_sync.py so expected Codex project hook configuration is derived from the managed repository manifest and can be written or checked for drift.
  2. Generate .codex/hooks.json registrations for the existing end-at-deliverable guard; include the shared Mind guard in PyAutoBrain's Codex surface and each assistant's existing API-gate script.
  3. Resolve repository-local hook commands through git rev-parse --show-toplevel; preserve the existing hook implementations rather than copying their logic.
  4. Leave the Claude-remote SessionStart hook off the Codex surface and document why, including Codex's trusted-project requirement.
  5. Extend synchronization and hook tests with representative Codex PreToolUse payloads covering allow, deny, malformed input, generated configuration, drift, and propagation.
  6. Update assistant setup/AGENTS documentation that currently says Codex has no hook mechanism.
  7. Run targeted tests and generator/drift checks in the isolated worktree, request independent review, and stop at the Heart gate if RED remains.

Key Files

  • PyAutoMind/scripts/repos_sync.py — manifest-driven Codex hook generation and drift checks
  • PyAutoMind/tests/test_session_hook_sync.py — generator, drift, and propagation coverage
  • PyAutoBrain/.codex/hooks.json — Brain Codex hook registration
  • *_assistant/.codex/hooks.json — assistant Codex hook registration
  • *_assistant/docs/setup/codex_cli.md and *_assistant/AGENTS.md — trust and hook-asymmetry documentation
  • autoassistant/tests/test_api_gate.py — Codex-shaped hook protocol coverage

Original Prompt

Click to expand starting prompt

Register safety hooks for Claude and Codex

Type: maintenance
Target: organs
Repos:

  • @PyAutoMind
  • @PyAutoBrain
  • @autofit_assistant
  • @autogalaxy_assistant
  • @autolens_assistant
  • @autocti_assistant
    Difficulty: large
    Autonomy: supervised
    Priority: high
    Status: draft
    Filed: 2026-09-17
    Parent: draft/maintenance/organs/agent_harness_agnostic_setup.md

Request

Can you check that all Agent setup (skills, md files, etc) is agnostic to whether its claude or codex, been using claude for a while but gonna codex for the forseeable so worth an agnostic sweep

Scope

Extend the manifest-driven hook generator and drift tests to create tracked
Codex project-hook registration alongside Claude registration. Use generated
.codex/hooks.json as the Codex adapter. Reuse the compatible
end-at-deliverable, shared-Mind commit and assistant API-gate implementations;
test them with representative Codex hook payloads. Do not register the current
Claude-remote session bootstrap unchanged: either give it an explicitly
harness-aware entry point or document it as a separate follow-up.

Acceptance

  • Expected Claude and Codex safety-hook registrations are generated and
    drift-checked from one manifest/source.
  • Allow, deny and malformed-input fixtures cover Codex PreToolUse payloads.
  • Project trust and any remaining session-bootstrap asymmetry are stated
    accurately in setup documentation.

Activity

  1. Jammy2211 commented on Sep 17, 2026

    @Jammy2211
    CollaboratorAuthor

    Human Heart RED development override — 2026-09-17

    Task: PyAutoMind#407 / codex-hook-parity.

    The agent asked the live human to authorize “PyAutoMind issue #407 / codex-hook-parity to pass the Heart RED development gate so I may push the six branches and open their PRs; this does not authorize release or merge.”

    The live human authorized this contemporaneously, verbatim:

    i do then go to phase 3

    Exact current Heart RED reasons

    • install verification FAILED (testpypi; checks F)
    • release validation FAILED (stage integrate)

    Additional current yellow reason:

    • manifest drift: remote-session blocks (generated) — 2 mismatch(es) vs PyAutoMind/repos.yaml

    Passed branch gates

    • Tests: PyAutoMind 130 passed; PyAutoBrain 28 passed; autofit_assistant 29 passed; autogalaxy_assistant 32 passed; autolens_assistant 32 passed; autocti_assistant 29 passed.
    • Smoke: n/a — organism/config/docs task with no user script behavior changed.
    • Review: CLEAN.
    • Generated Codex hook drift: OK.
    • Lifecycle check: OK, with the known unrelated empty review-minutes-actual warning.
    • git diff --check: clean in all six repos.
    • End-to-end generated hook commands were verified from a nested working directory.

    This live-human development override permits commit, push, and opening the six pending-release PRs. It does not authorize release, release rehearsal, merge, force merge, branch-protection bypass, or bypassing failed CI. It does not claim this task repairs Heart; Heart remains RED for release purposes. Merge requires a separate explicit human command and green required GitHub checks.

  2. Jammy2211 commented on Sep 17, 2026

    @Jammy2211
    CollaboratorAuthor

    PRs open — awaiting merge

    All six feature/codex-hook-parity branches were pushed normally and the PRs carry pending-release:

    Mind state is now awaiting-merge. One-shot check snapshot at PR-open (no polling or waiting):

    • PyAutoMind: Dashboard Refresh FAILURE; Lifecycle Drift, Spawn Drift privacy, and Tenant Firewall in progress.
    • PyAutoBrain: Python 3.12 and 3.13 tests in progress.
    • autofit_assistant: wiki-currency in progress.
    • autogalaxy_assistant: clone-boundary SUCCESS; wiki-currency in progress.
    • autolens_assistant: clone-boundary FAILURE; wiki-currency in progress.
    • autocti_assistant: clone-boundary SUCCESS; wiki-currency in progress.

    The failed checks are not bypassed. Nothing was merged or released. A later merge requires a fresh explicit human /prm invocation and all required checks green.

  3. Jammy2211 commented on Sep 17, 2026

    @Jammy2211
    CollaboratorAuthor

    Phase 2 CI corrections are pushed:

    • PyAutoMind 941bbd1b — regenerated dashboard.md and dashboard.html with ../PyAutoBrain/bin/pyauto-brain intake --apply dashboard; ../PyAutoBrain/bin/pyauto-brain intake dashboard --check reports current and git diff --check passed. The Heart RED override and active task state were preserved.
    • PyAutoBrain 5bb3946 — classifies .codex/hooks.json as generic clone infrastructure in REFERENCE_PROFILES.
    • autolens_assistant 033dd6f — documents .codex/hooks.json in the matching generic Assistant-as-template boundary.
    • Paired local validation: python agents/conductors/clone/check_boundary.py ../autolens_assistant reported boundary complete (generic 64, domain 327, mixed 89); python -m pytest tests/test_clone_conductor.py tests/test_clone_sync.py -q passed 44 tests; diff checks passed.
    • PR prompt: complete covariance-interpolator-rng-seed (PyAutoFit#1451 merged) #128 now declares Brain-ref: feature/codex-hook-parity so the boundary job uses the paired Brain profile.

    No workflows were manually rerun or polled, and no merge was attempted.

  4. Jammy2211 commented on Sep 17, 2026

    @Jammy2211
    CollaboratorAuthor

    Progress Update — 2026-09-18

    Summary

    Implementation, focused tests, generated-hook drift validation, and independent review are complete across all six repositories. Six pending-release PRs remain open:

    • PyAutoMind#408
    • PyAutoBrain#385
    • autofit_assistant#47
    • autogalaxy_assistant#26
    • autolens_assistant#128
    • autocti_assistant#29

    The last /prm judgment found Brain#385, autofit#47, autogalaxy#26, and autocti#29 green. Its Mind#408 observation was CONFLICTING/DIRTY with no current-head runs; concurrent self-heal subsequently merged origin/main into the feature branch as 34d481a. The one-shot snapshot on that head was MERGEABLE/UNSTABLE: Dashboard Refresh and Lifecycle Drift passed, while Spawn Drift privacy and Tenant Firewall firewall failed. The durable resume note and regenerated dashboard are now pushed as 80f35b0f; checks were not polled after that push.

    AutoLens#128 remains UNSTABLE because its clone-boundary run preceded the effective paired-Brain declaration. The PR body now contains the exact line Brain-ref: feature/codex-hook-parity; wiki-currency passed.

    Resume

    • Worktree: /home/jammy/Code/PyAutoLabs-wt/codex-hook-parity
    • Branch in all six repos: feature/codex-hook-parity
    • All six task worktrees were clean and exactly synchronized with their upstream before the Mind resume commit.
    • Preserve the user-owned untracked main-checkout scripts autofit_assistant/scripts/compose_model_gaussians_exponentials.py and autolens_assistant/scripts/cluster_model_composition.py.

    Tomorrow:

    1. Diagnose the two current-head Mind gates. The planned merge of origin/main is already satisfied by 34d481a; if main advances again, merge it normally—never rebase—then regenerate the dashboard, run its drift check and lifecycle check, and push.
    2. Verify the effective Brain-ref: pairing and rerun the AutoLens clone-boundary check.
    3. Have the human invoke /prm again. The prior merge authorization expired because all required checks were not green before the turn ended.
    4. Keep phase 3, PyAutoBrain#386, planned until both codex-hook-parity and mass-field-workspace-sweep claims clear.

    No workflow was manually rerun, no PR was merged, and no phase-3 registration was altered.

  5. added a commit that references this issue on Sep 18, 2026
  6. Jammy2211 commented on Sep 18, 2026

    @Jammy2211
    CollaboratorAuthor

    codex-hook-parity

  7. added a commit that references this issue on Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions