Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
6d01b6f
task: add codex-repo-hook-trust (active)
raphaeltm Nov 16, 2026
413910d
feat(agents): restore the Codex rule-delivery hook and Codex Stop ent…
raphaeltm Nov 16, 2026
2174c0a
style: sort imports
raphaeltm Nov 16, 2026
2d13120
refactor(vm-agent): move per-agent startup config writers to session_…
raphaeltm Nov 16, 2026
94f9c11
feat(vm-agent): SAM Codex sessions trust the repository's Codex hooks…
raphaeltm Nov 16, 2026
b9a3745
docs: Codex sessions run repository hooks; rule delivery for Codex
raphaeltm Nov 16, 2026
c589ced
chore(diagnostics): seed script for the staging Codex hook probe
raphaeltm Nov 16, 2026
c14caee
task: progress
raphaeltm Nov 16, 2026
71c41bb
fix(vm-agent): trust key is the ACP cwd verbatim, never /; standalone…
raphaeltm Nov 16, 2026
adf4108
fix(vm-agent): only bypass_hook_trust is needed (codex-acp already tr…
raphaeltm Nov 16, 2026
11bcd83
task: progress (local proof, staging wait)
raphaeltm Nov 16, 2026
2464bbc
chore: task text matches the final design; note at the Codex pins to …
raphaeltm Nov 16, 2026
6a9ab6a
Merge remote-tracking branch 'origin/main' into sam/codex-repo-hook-t…
raphaeltm Nov 16, 2026
42a7941
test(vm-agent): share the real-adapter process and mock-stream helper…
raphaeltm Nov 16, 2026
b723b97
chore: task state (staging queue, Sonar fix, CodeRabbit outcome)
raphaeltm Nov 16, 2026
14a8359
chore: task state (staging queue at 19:45Z)
raphaeltm Nov 16, 2026
5f5fa08
chore: archive the Codex repo-hook trust task with its staging evidence
raphaeltm Nov 16, 2026
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: 6 additions & 4 deletions .claude/rules/00-rule-routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ the files it governs with `paths` frontmatter.
- **Claude Code** loads a rule without `paths` at launch. It loads a rule with `paths`
when a matching file is read, written or edited (`.claude/hooks/log-instructions-loaded.sh`
records every load in `.tmp/instruction-loads/`).
- **Codex and other harnesses** load none of these files by themselves. The root
`AGENTS.md` lists the launch rules by name. The `AGENTS.md` nearest the code lists the
path-scoped rules for that directory. Read both sets before editing. This route is a
convention: nothing delivers these rules to Codex automatically.
- **Codex** loads only the root `AGENTS.md`, which lists the launch rules by name. In SAM
sessions the hook `.codex/hooks/rule-context.mjs` adds the path-scoped rules for the files
a shell command or patch touches (see `scripts/quality/README.md`, "Codex hooks").
- **Other harnesses** load none of these files by themselves. The `AGENTS.md` nearest the
code lists the path-scoped rules for that directory. Read it and the launch rules before
editing.
- A path-scoped rule arrives when you first access a matching file. Claude Code counts
the Read, Write and Edit tools and simple shell reads of one file (`cat`, `head`,
`sed -n`). It does not arrive before you write a brand-new file, when a script or
Expand Down
42 changes: 37 additions & 5 deletions .codex/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,45 @@ approval_policy = "never"
# Hooks (schema: https://developers.openai.com/codex/hooks)
# ==============================================================================
# Each event holds matcher groups, and each group holds a `hooks` array of handlers.
# `timeout` is in seconds. Project hooks run only when this .codex/ layer is trusted and
# each hook definition has been trusted (Codex records trust against its hash).
# `timeout` is in seconds. Codex runs project hooks only for a trusted project whose hook
# definitions are trusted. codex-acp trusts the session's project; SAM's vm-agent supplies
# the hook trust (bypass_hook_trust in buildCodexACPManagedConfigEnv,
# packages/vm-agent/internal/acp/session_host_agent_config.go).
# `pnpm quality:agent-context-budget --check` validates these entries.

# No hooks are configured: SAM-managed Codex sessions do not trust this project, so Codex
# would skip them (probe evidence on SAM idea 01M7H32EK6S4E31EHWVSJSENR5). The rule-delivery
# and Stop hooks wait on that decision, on branch sam/codex-rule-delivery-hook.
# Path-scoped rule delivery: Codex loads only the root AGENTS.md by itself. This hook adds
# the rules (.claude/rules/*.md with `paths`) that govern the files a tool call touches,
# the same rules Claude Code loads on file access. See .codex/hooks/rule-context.mjs.
# additionalContextLimit (tokens) sits above the hook's own byte cap so Codex never spills.
[[hooks.SessionStart]]
matcher = "^(startup|resume|clear|compact|fork)$"

[[hooks.SessionStart.hooks]]
type = "command"
command = 'node "$(git rev-parse --show-toplevel)/.codex/hooks/rule-context.mjs"'
timeout = 10
additionalContextLimit = 20000
statusMessage = "Preparing SAM rule delivery"

[[hooks.PreToolUse]]
matcher = "^(Bash|apply_patch)$"

[[hooks.PreToolUse.hooks]]
type = "command"
command = 'node "$(git rev-parse --show-toplevel)/.codex/hooks/rule-context.mjs"'
timeout = 10
additionalContextLimit = 20000
statusMessage = "Checking SAM rules for these files"

# Test-quality Stop gate (rule 35), shared with Claude Code. Delivery per finding class is
# set and measured in .claude/hooks/verify-test-quality.mjs; it never blocks without limit.
[[hooks.Stop]]

[[hooks.Stop.hooks]]
type = "command"
command = 'node "$(git rev-parse --show-toplevel)/.claude/hooks/verify-test-quality.mjs"'
timeout = 30
statusMessage = "Checking tests for changed boundary code"

[projects."/workspaces/simple-agent-manager"]
trust_level = "trusted"
Loading
Loading