summaryrefslogtreecommitdiff
path: root/hooks/session-start-codex
diff options
context:
space:
mode:
authorDrew Ritter <drew@primeradiant.com>2026-05-14 14:48:16 -0700
committerDrew Ritter <drew@primeradiant.com>2026-05-14 15:51:53 -0700
commit935de5d5ec5d5ce72638050bdc00c6ac8a253af9 (patch)
tree0a1c31ff6ab1f06faad1cc88dcbb4a65d2629b09 /hooks/session-start-codex
parentf5c43d6055de499a69f3c506f690b4448c275e0e (diff)
Simplify Codex hook entrypointcodex/research-codex-plugin-hooks
Diffstat (limited to 'hooks/session-start-codex')
-rwxr-xr-xhooks/session-start-codex26
1 files changed, 26 insertions, 0 deletions
diff --git a/hooks/session-start-codex b/hooks/session-start-codex
new file mode 100755
index 0000000..a6cc3cf
--- /dev/null
+++ b/hooks/session-start-codex
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+# Codex SessionStart hook for superpowers plugin
+
+set -euo pipefail
+
+SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
+PLUGIN_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
+
+using_superpowers_content=$(cat "${PLUGIN_ROOT}/skills/using-superpowers/SKILL.md" 2>&1 || echo "Error reading using-superpowers skill")
+
+escape_for_json() {
+ local s="$1"
+ s="${s//\\/\\\\}"
+ s="${s//\"/\\\"}"
+ s="${s//$'\n'/\\n}"
+ s="${s//$'\r'/\\r}"
+ s="${s//$'\t'/\\t}"
+ printf '%s' "$s"
+}
+
+using_superpowers_escaped=$(escape_for_json "$using_superpowers_content")
+session_context="<EXTREMELY_IMPORTANT>\nYou have superpowers.\n\n**Below is the full content of your 'superpowers:using-superpowers' skill - your introduction to using skills. For all other skills, follow the Codex skill-loading instructions in that skill:**\n\n${using_superpowers_escaped}\n</EXTREMELY_IMPORTANT>"
+
+printf '{\n "hookSpecificOutput": {\n "hookEventName": "SessionStart",\n "additionalContext": "%s"\n }\n}\n' "$session_context"
+
+exit 0