Created
May 5, 2026 11:55
-
-
Save kepocnhh/06b1674c7e97d2c1671a2ff5bcfcfe13 to your computer and use it in GitHub Desktop.
codex hooks on stop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/local/bin/bash | |
| FILE_DIR="$(TZ='utc' date +%Y/%m/%d)" | |
| JSON_INPUT="$(cat)" | |
| CODEX_SESSION_ID=$(echo "${JSON_INPUT}" | yq .session_id) | |
| CODEX_TURN_ID=$(echo "${JSON_INPUT}" | yq .turn_id) | |
| CODEX_WORKDIR=$(echo "${JSON_INPUT}" | yq .cwd) | |
| CODEX_TRANSCRIPT_PATH=$(echo "${JSON_INPUT}" | yq .transcript_path) | |
| CODEX_RESPONSE=$(echo "${JSON_INPUT}" | yq .last_assistant_message) | |
| POINTER="$(TZ='utc' date +%Y%m%d%H%M%S)-${CODEX_SESSION_ID:0:8}" | |
| ISSUER='.excluded/md/codex' | |
| if test -d "${ISSUER}"; then | |
| mkdir -p "${ISSUER}/${FILE_DIR}" | |
| echo "${CODEX_RESPONSE}" > "${ISSUER}/${FILE_DIR}/codex-${POINTER}.md" | |
| else | |
| echo "No dir \"${ISSUER}\"." | |
| fi | |
| echo '{"continue": true}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment