Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
28 changes: 28 additions & 0 deletions templates/codex/.codex/clawmini-insert-pending.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
set -euo pipefail

printf '%s\t%s\tcwd=%s\n' "$(date -Is)" "clawmini-insert-pending" "${PWD}" >> /home/user/.codex/hook-debug.log

if ! command -v clawmini-lite.js >/dev/null 2>&1; then
exit 0
fi

output="$(clawmini-lite.js fetch-pending 2>/dev/null || true)"

if [ -z "${output}" ]; then
exit 0
fi

hook_event_name="$(jq -r '.hook_event_name // "PostToolUse"' < /dev/stdin 2>/dev/null || printf '%s' "PostToolUse")"

printf '%s\t%s\thook_event_name=%s\n' "$(date -Is)" "clawmini-insert-pending" "${hook_event_name}" >> /home/user/.codex/hook-debug.log

jq -n \
--arg hook_event_name "${hook_event_name}" \
--arg out "${output}" \
'{
hookSpecificOutput: {
hookEventName: $hook_event_name,
additionalContext: $out
}
}'
18 changes: 18 additions & 0 deletions templates/codex/.codex/clawmini-tool-logging.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -euo pipefail

export LANG="${LANG:-en_US.UTF-8}" LC_ALL="${LC_ALL:-en_US.UTF-8}"

printf '%s\t%s\tcwd=%s\n' "$(date -Is)" "clawmini-tool-logging" "${PWD}" >> /home/user/.codex/hook-debug.log

if ! command -v clawmini-lite.js >/dev/null 2>&1; then
exit 0
fi

input="$(cat)"
tool_name="$(printf '%s' "${input}" | jq -r '.tool_name')"
tool_input="$(printf '%s' "${input}" | jq -c '.tool_input')"

printf '%s\t%s\ttool_name=%s\ttool_input=%s\n' "$(date -Is)" "clawmini-tool-logging" "${tool_name}" "${tool_input}" >> /home/user/.codex/hook-debug.log

clawmini-lite.js tool "${tool_name}" "${tool_input}" >/dev/null 2>&1 || true
28 changes: 28 additions & 0 deletions templates/codex/.codex/hooks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"hooks": {
"PostToolUse": [
{
"matcher": ".*",
"hooks": [
{
"type": "command",
"command": ".codex/clawmini-insert-pending.sh",
"statusMessage": "Checking pending clawmini context"
}
]
}
],
"PreToolUse": [
{
"matcher": ".*",
"hooks": [
{
"type": "command",
"command": ".codex/clawmini-tool-logging.sh",
"statusMessage": "Logging tool use"
}
]
}
]
}
}
8 changes: 8 additions & 0 deletions templates/codex/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"commands": {
"new": "codex exec --yolo --json \"$CLAW_CLI_MESSAGE\" < /dev/null",
"append": "codex exec --yolo --json resume $SESSION_ID \"$CLAW_CLI_MESSAGE\" < /dev/null",
"getSessionId": "jq -r 'select(.type == \"thread.started\") | .thread_id'",
"getMessageContent": "jq -r 'select(.type == \"item.completed\" and .item.type == \"agent_message\") | .item.text'"
}
}
Loading