Start a Codex handoff gate - generates handoff context and triggers Codex on exit
Creates a handoff gate that triggers Codex CLI on exit to continue work.
/plugin marketplace add 0xBigBoss/claude-code/plugin install codex-handoff@0xbigboss-pluginsoptional focus area or additional notesCreate a handoff gate that triggers Codex CLI when you exit. Codex will process the handoff and its output will be fed back to continue the session.
Arguments: $ARGUMENTS
The entire argument string is the optional focus for the handoff. If empty, the handoff skill will determine appropriate framing based on session context.
IMPORTANT: Before creating a new gate, check if an ACTIVE one already exists:
# Check current repo and all ancestor superprojects for ACTIVE gate
DIR="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
FOUND_ACTIVE=""
while [ -n "$DIR" ]; do
STATE_FILE="$DIR/.claude/codex-handoff.local.md"
if [ -f "$STATE_FILE" ] && grep -q "active: true" "$STATE_FILE"; then
echo "Found ACTIVE state file at: $STATE_FILE"
cat "$STATE_FILE"
FOUND_ACTIVE="true"
break
fi
# Check for parent superproject
PARENT="$(git -C "$DIR" rev-parse --show-superproject-working-tree 2>/dev/null)"
[ -z "$PARENT" ] && break
DIR="$PARENT"
done
[ -z "$FOUND_ACTIVE" ] && echo "NO_ACTIVE_STATE_FILE"
If an ACTIVE state file exists:
The handoff gate is already active.
ALLOWED when gate is active:
/handoff) to capture your latest workFORBIDDEN when gate is active:
.claude/codex-handoff.local.md)After optionally updating the handoff, output:
Handoff gate already active. Exiting to trigger Codex...
Then exit immediately. The stop hook will call Codex and feed the output back.
Only proceed to Step 1 if no state file exists or active: false.
Invoke the /handoff skill.
If custom focus provided (from $ARGUMENTS):
Generate a handoff. {custom focus from arguments}
Default focus (no arguments):
Generate a handoff for a teammate who will continue this work. Include context on what was done, current state, and next steps.
The handoff will be written to ~/.claude/handoffs/handoff-<repo>-<shortname>.md.
CRITICAL: After the handoff is saved, you MUST continue with this step. The handoff gate is NOT active until the state file exists. Do not stop after the handoff.
Find the state directory (git root, or cwd if not in a repo):
STATE_DIR="$(git rev-parse --show-toplevel 2>/dev/null || pwd)/.claude"
mkdir -p "$STATE_DIR"
Create the state file using the Write tool at {STATE_DIR}/codex-handoff.local.md:
---
active: true
handoff_path: "~/.claude/handoffs/handoff-<repo>-<shortname>.md"
timestamp: "[current ISO timestamp]"
debug: false
---
# Codex Handoff Gate
Handoff gate active. Run `/codex-handoff:cancel` to abort.
Important:
CRITICAL: You MUST complete this step. Verify the state file was created, then exit.
Verify the state file exists:
cat "$(git rev-parse --show-toplevel 2>/dev/null || pwd)/.claude/codex-handoff.local.md" | head -5
Output summary:
## Work Summary
[2-3 bullet points of what was done]
Handoff gate is now active. Exiting to trigger Codex...
Exit - The stop hook will:
/codex-handoff:cancel to abort the handoff gate~/.claude/codex-handoff/{session_id}/crash.log/handoffWrite or update a handoff document so the next agent with fresh context can continue this work.