Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
8d6a12c
context: Add Codex mutation-scope integration plan
davidabram Sep 7, 2026
ea46511
codex: Freeze hook lifecycle contract with probe fixtures
davidabram Sep 7, 2026
67464bb
hooks: Record Codex MCP mutation-scope lifecycle findings
davidabram Sep 7, 2026
5e83c60
hooks: Implement Codex mutation-scope event foundation
davidabram Sep 8, 2026
61d3975
hooks: Add durable Codex mutation-scope state
davidabram Sep 8, 2026
363fb6c
hooks: Implement Codex mutation-scope adapter routing
davidabram Sep 8, 2026
9e27375
hooks: Make Codex mutation admission atomic across processes
davidabram Sep 8, 2026
de3d862
hooks: Add a boundary lock for Codex mutation scopes
davidabram Sep 8, 2026
952a36b
hooks: Skip untracked Codex PostToolUse events
davidabram Sep 8, 2026
61bc2e1
hooks: Register Codex mutation-scope lifecycle hooks
davidabram Sep 8, 2026
1e3ab90
codex: Make mutation-scope tool bootstrap fail closed
davidabram Sep 8, 2026
9e9c4da
hooks: Preflight Codex Bash policy before mutation scopes
davidabram Sep 8, 2026
330f18b
hooks: Sweep stale Codex mutation attempts by turn lane
davidabram Sep 8, 2026
aaf4c1e
runtime+language: Prevent false mutation attribution for unconfirmed …
davidabram Sep 8, 2026
76c7939
tests: Exercise hooks with a minimal command path
davidabram Sep 8, 2026
f63ceab
context: Update Codex mutation-scope integration plan
davidabram Sep 8, 2026
cea4973
tests: Add production-path Codex mutation-scope regressions
davidabram Sep 8, 2026
dcbdbd0
context: Author Codex mutation-scope integration context
davidabram Sep 8, 2026
4768a46
context: reconcile Codex mutation-scope durable context
davidabram Sep 8, 2026
d0af17f
runtime: Normalize Codex lifecycle hook timeouts
davidabram Sep 8, 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
56 changes: 56 additions & 0 deletions .codex/hooks.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"hooks": {
"Interrupt": [
{
"hooks": [
{
"command": "root=\"$(git rev-parse --show-toplevel 2>/dev/null)\" || exit 0; exec bash \"$root/.codex/hooks/run-sce-or-show-install-guidance.sh\" sce hooks codex-mutation-scope",
"type": "command"
}
]
}
],
"PostToolUse": [
{
"hooks": [
Expand All @@ -9,6 +19,15 @@
}
],
"matcher": "apply_patch"
},
{
"hooks": [
{
"command": "root=\"$(git rev-parse --show-toplevel 2>/dev/null)\" || exit 0; exec bash \"$root/.codex/hooks/run-sce-or-show-install-guidance.sh\" sce hooks codex-mutation-scope",
"type": "command"
}
],
"matcher": "^(Bash|apply_patch)$"
}
],
"PreToolUse": [
Expand All @@ -20,6 +39,25 @@
}
],
"matcher": "Bash"
},
{
"hooks": [
{
"command": "sce_deny(){ printf '%s' '{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"deny\",\"permissionDecisionReason\":\"SCE could not establish mutation attribution for this tool execution.\"}}'; exit 0; }; root=\"$(git rev-parse --show-toplevel 2>/dev/null)\" || sce_deny; test -r \"$root/.codex/hooks/run-sce-or-show-install-guidance.sh\" || sce_deny; SCE_CODEX_PRE_TOOL_USE_FAIL_CLOSED=1 exec bash \"$root/.codex/hooks/run-sce-or-show-install-guidance.sh\" sce hooks codex-mutation-scope",
"type": "command"
}
],
"matcher": "^(Bash|apply_patch)$"
}
],
"SessionEnd": [
{
"hooks": [
{
"command": "root=\"$(git rev-parse --show-toplevel 2>/dev/null)\" || exit 0; exec bash \"$root/.codex/hooks/run-sce-or-show-install-guidance.sh\" sce hooks codex-mutation-scope",
"type": "command"
}
]
}
],
"Stop": [
Expand All @@ -30,6 +68,24 @@
"type": "command"
}
]
},
{
"hooks": [
{
"command": "root=\"$(git rev-parse --show-toplevel 2>/dev/null)\" || exit 0; exec bash \"$root/.codex/hooks/run-sce-or-show-install-guidance.sh\" sce hooks codex-mutation-scope",
"type": "command"
}
]
}
],
"SubagentStop": [
{
"hooks": [
{
"command": "root=\"$(git rev-parse --show-toplevel 2>/dev/null)\" || exit 0; exec bash \"$root/.codex/hooks/run-sce-or-show-install-guidance.sh\" sce hooks codex-mutation-scope",
"type": "command"
}
]
}
],
"UserPromptSubmit": [
Expand Down
19 changes: 19 additions & 0 deletions .codex/hooks/run-sce-or-show-install-guidance.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
#!/usr/bin/env bash
set -euo pipefail

sce_pre_tool_use_deny() {
printf '%s' '{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"SCE could not establish mutation attribution for this tool execution."}}'
}

if [ "${SCE_CODEX_PRE_TOOL_USE_FAIL_CLOSED:-0}" = "1" ]; then
if ! command -v sce >/dev/null 2>&1; then
echo "sce CLI not found. Install it from https://sce.crocoder.dev/docs/getting-started#install-cli" >&2
sce_pre_tool_use_deny
exit 0
fi
if ! adapter_output="$("$@")"; then
echo "SCE mutation-scope adapter failed; denying the tracked tool to preserve fail-closed PreToolUse." >&2
sce_pre_tool_use_deny
exit 0
fi
printf '%s' "$adapter_output"
exit 0
fi

if ! command -v sce >/dev/null 2>&1; then
echo "sce CLI not found. Install it from https://sce.crocoder.dev/docs/getting-started#install-cli" >&2
exit 0
Expand Down
6 changes: 6 additions & 0 deletions cli/src/cli_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,12 @@ pub enum HooksSubcommand {
hide = true
)]
ClaudeMutationScope,

#[command(
about = "Run the Codex mutation-scope adapter (reads JSON payload from STDIN)",
hide = true
)]
CodexMutationScope,
}

#[derive(Subcommand, Debug, Clone, PartialEq, Eq)]
Expand Down
Loading
Loading