Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
14406bf
context: Add Codex mutation-scope integration plan
davidabram Sep 7, 2026
c554949
codex: Freeze hook lifecycle contract with probe fixtures
davidabram Sep 7, 2026
ae4e46e
hooks: Record Codex MCP mutation-scope lifecycle findings
davidabram Sep 7, 2026
d643908
hooks: Implement Codex mutation-scope event foundation
davidabram Sep 8, 2026
2b2ee37
hooks: Add durable Codex mutation-scope state
davidabram Sep 8, 2026
d6730b3
hooks: Implement Codex mutation-scope adapter routing
davidabram Sep 8, 2026
4f160df
hooks: Make Codex mutation admission atomic across processes
davidabram Sep 8, 2026
c51917a
hooks: Add a boundary lock for Codex mutation scopes
davidabram Sep 8, 2026
3168294
hooks: Skip untracked Codex PostToolUse events
davidabram Sep 8, 2026
0b53f3a
hooks: Register Codex mutation-scope lifecycle hooks
davidabram Sep 8, 2026
be8ad1a
codex: Make mutation-scope tool bootstrap fail closed
davidabram Sep 8, 2026
e897044
hooks: Preflight Codex Bash policy before mutation scopes
davidabram Sep 8, 2026
7c283a4
hooks: Sweep stale Codex mutation attempts by turn lane
davidabram Sep 8, 2026
c0c4ce6
runtime+language: Prevent false mutation attribution for unconfirmed …
davidabram Sep 8, 2026
c870342
tests: Exercise hooks with a minimal command path
davidabram Sep 8, 2026
4f2e061
context: Update Codex mutation-scope integration plan
davidabram Sep 8, 2026
5a3cfb5
tests: Add production-path Codex mutation-scope regressions
davidabram Sep 8, 2026
f6e3617
context: Author Codex mutation-scope integration context
davidabram Sep 8, 2026
956fcb8
context: reconcile Codex mutation-scope durable context
davidabram Sep 8, 2026
310a9b5
runtime: Normalize Codex lifecycle hook timeouts
davidabram Sep 8, 2026
037bf6c
runtime: use mutation trace worktree identity after rebase
davidabram Sep 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
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