Codex hook json sessionstart
Skill whyy9527/codexception/examples/codex-hook-json-sessionstart
Codex-native continuous learning skill for extracting reusable debugging and workflow knowledge into SKILL.md files
npx -y skills add whyy9527/codexception --skill codex-hook-json-sessionstartAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Fix Codex SessionStart hooks that print plain text, invalid JSON, or reminders that do not enter model-visible context. Use when editing ~/.codex/hooks.json, ~/.codex/hooks/*.sh, or a skill-bundled hook script for Codex.
SKILL.md
2.0 KB, as published. Nobody here has run it
Codex Hook JSON SessionStart
Use When
- A Codex hook is meant to inject reminder context at session start.
- The hook prints plain text copied from a Claude hook.
hooks.jsonpoints at a shell script but Codex does not receive the reminder.- You are renaming or replacing a hook under
~/.codex/hooks/.
Failure Mechanism
Claude hooks can inject visible plain text. Codex SessionStart hooks should emit
structured JSON so Codex can place the reminder in additionalContext. A copied
Claude hook may execute successfully while providing no usable Codex context.
Procedure
- Read
~/.codex/hooks.jsonand the referenced hook script. - Make the command point at a real executable under
~/.codex/hooks/. - Have the script emit JSON with:
hookSpecificOutput.hookEventNameset toSessionStart- reminder text in
hookSpecificOutput.additionalContext
- Keep the hook output short. It should remind Codex to evaluate a skill, not duplicate the whole skill.
Example hook body:
#!/bin/bash
cat << 'EOF'
{
"hookSpecificOutput": {
"hookEventName": "SessionStart",
"additionalContext": "[codexception]\nAfter completing this user request, evaluate whether the work produced reusable knowledge worth preserving as a Codex skill."
}
}
EOF
Verification
ruby -rjson -e 'JSON.parse(File.read(File.expand_path("~/.codex/hooks.json")))'ruby -rjson -e 'JSON.parse(~/.codex/hooks/codexception-activator.sh)'~/.codex/claude-bridge/validate.shstill passes if bridge-managed files are present.
High-Risk Actions
- Do not paste the full skill into the hook output.
- Do not leave stale hook paths after renaming a skill or script.
- Do not use a Claude plain-text activation banner as the Codex hook body.
Gives 0 of the 12 instructions most skill authoring skills give
Counted across 521 of the 523 authors here whose files we hold, read 2026-08-06
- keep skill files under 500 linesin 182 of 521, across 89 files
- use imperative form in instructionsin 101 of 521, across 30 files
- draft assertions while test runs are in progressin 88 of 521, across 22 files
- save test cases to evals jsonin 87 of 521, across 21 files
- create two to three realistic test promptsin 85 of 521, across 20 files
- write skill descriptions to be pushyin 84 of 521, across 19 files
- ask questions about edge cases and input formatsin 81 of 521, across 16 files
- save timing data immediately when runs completein 74 of 521, across 9 files
- include all trigger conditions in the skill descriptionin 73 of 521, across 7 files
- capture intent before writing a skillin 70 of 521, across 4 files
- launch all test runs in a single turnin 68 of 521, across 2 files
- write the description in third personin 56 of 521, across 19 files
Said here and by no other author read
- read the hooks configuration and referenced hook script
- point the command at a real executable script
- set hookEventName to SessionStart
- put reminder text in additionalContext
- keep the hook output short
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once.