oh-my-customcodex 0.4.9 → 0.4.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/templates/.claude/agents/mgr-gitnerd.md +4 -0
- package/templates/.claude/agents/wiki-curator.md +4 -0
- package/templates/.claude/hooks/hooks.json +20 -0
- package/templates/.claude/hooks/scripts/auto-dev-token-summary.sh +63 -0
- package/templates/.claude/hooks/scripts/auto-dev-token-tracker.sh +46 -0
- package/templates/.claude/skills/codex-exec/SKILL.md +3 -3
- package/templates/.claude/skills/codex-exec/scripts/codex-wrapper.cjs +6 -3
- package/templates/manifest.json +2 -2
package/dist/cli/index.js
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -19,6 +19,10 @@ tools:
|
|
|
19
19
|
permissionMode: bypassPermissions
|
|
20
20
|
---
|
|
21
21
|
|
|
22
|
+
## Mandatory Sensitive Compatibility Paths
|
|
23
|
+
|
|
24
|
+
When a task targets `.claude/**`, `templates/.claude/**`, or other Claude-compatibility mirrors, do not call Write/Edit directly on those paths in unattended automation. Produce the artifact body in `/tmp`, then apply it through the repo-approved sensitive-path script/artifact protocol so Codex-native `.codex/**` work remains autonomous and reviewable.
|
|
25
|
+
|
|
22
26
|
You are a Git operations specialist following GitHub flow best practices.
|
|
23
27
|
|
|
24
28
|
## Capabilities
|
|
@@ -14,6 +14,10 @@ memory: project
|
|
|
14
14
|
permissionMode: bypassPermissions
|
|
15
15
|
---
|
|
16
16
|
|
|
17
|
+
## Mandatory Sensitive Compatibility Paths
|
|
18
|
+
|
|
19
|
+
When a task targets `.claude/**`, `templates/.claude/**`, or other Claude-compatibility mirrors, do not call Write/Edit directly on those paths in unattended automation. Produce the artifact body in `/tmp`, then apply it through the repo-approved sensitive-path script/artifact protocol so Codex-native `.codex/**` work remains autonomous and reviewable.
|
|
20
|
+
|
|
17
21
|
# Wiki Curator
|
|
18
22
|
|
|
19
23
|
Dedicated agent for wiki file operations. All wiki/ directory writes go through this agent per R010 delegation rules.
|
|
@@ -499,6 +499,16 @@
|
|
|
499
499
|
}
|
|
500
500
|
],
|
|
501
501
|
"description": "Advisory reminder to sync skill counts in 6 locations when a SKILL.md is created/modified (R021)"
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
"matcher": "tool == \"Task\" || tool == \"Agent\"",
|
|
505
|
+
"hooks": [
|
|
506
|
+
{
|
|
507
|
+
"type": "command",
|
|
508
|
+
"command": "bash .codex/hooks/scripts/auto-dev-token-tracker.sh"
|
|
509
|
+
}
|
|
510
|
+
],
|
|
511
|
+
"description": "Advisory auto-dev token spend tracking by phase"
|
|
502
512
|
}
|
|
503
513
|
],
|
|
504
514
|
"Stop": [
|
|
@@ -512,6 +522,16 @@
|
|
|
512
522
|
],
|
|
513
523
|
"description": "Final console.log audit and session diagnostics before session ends"
|
|
514
524
|
},
|
|
525
|
+
{
|
|
526
|
+
"matcher": "*",
|
|
527
|
+
"hooks": [
|
|
528
|
+
{
|
|
529
|
+
"type": "command",
|
|
530
|
+
"command": "bash .codex/hooks/scripts/auto-dev-token-summary.sh"
|
|
531
|
+
}
|
|
532
|
+
],
|
|
533
|
+
"description": "Print advisory auto-dev token spend summary when available"
|
|
534
|
+
},
|
|
515
535
|
{
|
|
516
536
|
"matcher": "*",
|
|
517
537
|
"hooks": [
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# auto-dev token spend summary.
|
|
5
|
+
# Trigger: Stop event.
|
|
6
|
+
# Protocol: stdin pass-through, stderr advisory summary, exit 0.
|
|
7
|
+
|
|
8
|
+
input=$(cat 2>/dev/null || true)
|
|
9
|
+
trap 'printf "%s" "$input"' EXIT
|
|
10
|
+
|
|
11
|
+
LOG_FILE="${AUTO_DEV_SPEND_LOG:-/tmp/auto-dev-spend-${PPID}.json}"
|
|
12
|
+
[ -s "$LOG_FILE" ] || exit 0
|
|
13
|
+
|
|
14
|
+
command -v jq >/dev/null 2>&1 || exit 0
|
|
15
|
+
|
|
16
|
+
summary=$(jq -s -r '
|
|
17
|
+
group_by(.phase)
|
|
18
|
+
| map({
|
|
19
|
+
phase: .[0].phase,
|
|
20
|
+
calls: length,
|
|
21
|
+
tokens_in: (map(.tokens_in) | add),
|
|
22
|
+
tokens_out: (map(.tokens_out) | add),
|
|
23
|
+
total: (map(.tokens_in + .tokens_out) | add)
|
|
24
|
+
})
|
|
25
|
+
| sort_by(-.total)
|
|
26
|
+
' "$LOG_FILE" 2>/dev/null) || exit 0
|
|
27
|
+
|
|
28
|
+
[ -z "$summary" ] && exit 0
|
|
29
|
+
[ "$summary" = "[]" ] && exit 0
|
|
30
|
+
|
|
31
|
+
totals=$(printf "%s" "$summary" | jq -r '
|
|
32
|
+
{
|
|
33
|
+
total_calls: (map(.calls) | add),
|
|
34
|
+
total_in: (map(.tokens_in) | add),
|
|
35
|
+
total_out: (map(.tokens_out) | add),
|
|
36
|
+
grand: (map(.total) | add)
|
|
37
|
+
}
|
|
38
|
+
')
|
|
39
|
+
total_calls=$(printf "%s" "$totals" | jq -r '.total_calls')
|
|
40
|
+
total_in=$(printf "%s" "$totals" | jq -r '.total_in')
|
|
41
|
+
total_out=$(printf "%s" "$totals" | jq -r '.total_out')
|
|
42
|
+
grand=$(printf "%s" "$totals" | jq -r '.grand')
|
|
43
|
+
|
|
44
|
+
{
|
|
45
|
+
echo ""
|
|
46
|
+
echo "=== [auto-dev Token Spend Summary] advisory ==="
|
|
47
|
+
echo "Source: $LOG_FILE | heuristic: bytes / 4"
|
|
48
|
+
echo ""
|
|
49
|
+
printf "| %-32s | %5s | %10s | %10s | %10s |\n" "Phase" "Calls" "Tokens In" "Tokens Out" "Total"
|
|
50
|
+
printf "| %-32s | %5s | %10s | %10s | %10s |\n" "--------------------------------" "-----" "----------" "----------" "----------"
|
|
51
|
+
printf "%s" "$summary" | jq -r '.[] | "\(.phase)\t\(.calls)\t\(.tokens_in)\t\(.tokens_out)\t\(.total)"' | \
|
|
52
|
+
while IFS=$'\t' read -r phase calls tin tout tot; do
|
|
53
|
+
phase_trunc=$(printf "%s" "$phase" | head -c 32)
|
|
54
|
+
printf "| %-32s | %5s | %10s | %10s | %10s |\n" "$phase_trunc" "$calls" "$tin" "$tout" "$tot"
|
|
55
|
+
done
|
|
56
|
+
printf "| %-32s | %5s | %10s | %10s | %10s |\n" "TOTAL" "$total_calls" "$total_in" "$total_out" "$grand"
|
|
57
|
+
echo ""
|
|
58
|
+
echo "Note: Estimates only. Prefer exact runtime usage events when available."
|
|
59
|
+
echo "================================================"
|
|
60
|
+
echo ""
|
|
61
|
+
} >&2
|
|
62
|
+
|
|
63
|
+
exit 0
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# auto-dev token spend tracker.
|
|
5
|
+
# Trigger: PostToolUse on Agent/Task during auto-dev pipeline.
|
|
6
|
+
# Protocol: stdin JSON -> append JSONL estimate -> stdout pass-through, exit 0.
|
|
7
|
+
|
|
8
|
+
input=$(cat)
|
|
9
|
+
trap 'printf "%s" "$input"' EXIT
|
|
10
|
+
|
|
11
|
+
PIPELINE_STATE="${AUTO_DEV_PIPELINE_STATE:-/tmp/.codex-pipeline-auto-dev-${PPID}.json}"
|
|
12
|
+
[ -f "$PIPELINE_STATE" ] || exit 0
|
|
13
|
+
|
|
14
|
+
command -v jq >/dev/null 2>&1 || exit 0
|
|
15
|
+
|
|
16
|
+
LOG_FILE="${AUTO_DEV_SPEND_LOG:-/tmp/auto-dev-spend-${PPID}.json}"
|
|
17
|
+
|
|
18
|
+
agent_type=$(printf "%s" "$input" | jq -r '.tool_input.subagent_type // .tool_input.agent_type // "unknown"' 2>/dev/null || echo "unknown")
|
|
19
|
+
description=$(printf "%s" "$input" | jq -r '.tool_input.description // ""' 2>/dev/null || echo "")
|
|
20
|
+
prompt_text=$(printf "%s" "$input" | jq -r '.tool_input.prompt // .tool_input.message // ""' 2>/dev/null || echo "")
|
|
21
|
+
output_text=$(printf "%s" "$input" | jq -r '.tool_output.output // .tool_output // ""' 2>/dev/null || echo "")
|
|
22
|
+
|
|
23
|
+
phase=$(jq -r '.current_phase // .phase // "unknown"' "$PIPELINE_STATE" 2>/dev/null || echo "unknown")
|
|
24
|
+
if [ "$phase" = "unknown" ] || [ "$phase" = "null" ]; then
|
|
25
|
+
phase=$(printf "%s" "$description" | grep -oE '^\[[0-9]+\][^|]*' | head -c 40 || true)
|
|
26
|
+
[ -z "$phase" ] && phase=$(printf "%s" "$description" | head -c 30)
|
|
27
|
+
[ -z "$phase" ] && phase="unknown"
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
in_bytes=$(printf "%s" "$prompt_text" | wc -c | tr -d ' ')
|
|
31
|
+
out_bytes=$(printf "%s" "$output_text" | wc -c | tr -d ' ')
|
|
32
|
+
tokens_in=$((in_bytes / 4))
|
|
33
|
+
tokens_out=$((out_bytes / 4))
|
|
34
|
+
ts=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
|
35
|
+
|
|
36
|
+
entry=$(jq -n -c \
|
|
37
|
+
--arg ts "$ts" \
|
|
38
|
+
--arg phase "$phase" \
|
|
39
|
+
--arg agent "$agent_type" \
|
|
40
|
+
--argjson tin "$tokens_in" \
|
|
41
|
+
--argjson tout "$tokens_out" \
|
|
42
|
+
'{ts: $ts, phase: $phase, agent: $agent, tokens_in: $tin, tokens_out: $tout}' 2>/dev/null) || exit 0
|
|
43
|
+
|
|
44
|
+
printf "%s\n" "$entry" >> "$LOG_FILE" 2>/dev/null || true
|
|
45
|
+
|
|
46
|
+
exit 0
|
|
@@ -31,7 +31,7 @@ Execute OpenAI Codex CLI prompts in non-interactive mode and return structured r
|
|
|
31
31
|
```
|
|
32
32
|
1. Pre-checks
|
|
33
33
|
- Verify `codex` binary is installed (which codex || npx codex --version)
|
|
34
|
-
- Verify authentication (OPENAI_API_KEY or
|
|
34
|
+
- Verify authentication (`OPENAI_API_KEY`, `CODEX_API_KEY`, or stored `codex login` / ChatGPT login)
|
|
35
35
|
2. Build command
|
|
36
36
|
- Base: codex exec --ephemeral "<prompt>"
|
|
37
37
|
- Apply options: --json, --model, --full-auto, -C <dir>
|
|
@@ -132,7 +132,7 @@ Works with the orchestrator pattern:
|
|
|
132
132
|
codex-exec requires the Codex CLI binary to be installed and authenticated. The skill is only usable when:
|
|
133
133
|
|
|
134
134
|
1. `codex` binary is found in PATH (`which codex` succeeds)
|
|
135
|
-
2. Authentication is valid (OPENAI_API_KEY
|
|
135
|
+
2. Authentication is valid (`OPENAI_API_KEY`, `CODEX_API_KEY`, or stored auth from `codex login --api-key` / ChatGPT login)
|
|
136
136
|
|
|
137
137
|
If either check fails, this skill cannot be used. Fall back to Claude agents for the task.
|
|
138
138
|
|
|
@@ -158,7 +158,7 @@ Orchestrator delegates generation task
|
|
|
158
158
|
|
|
159
159
|
When the orchestrator or intent-detection detects a research/information gathering request (routing_rule in agent-triggers.yaml):
|
|
160
160
|
|
|
161
|
-
1. **Check Codex availability**: Verify `codex` binary
|
|
161
|
+
1. **Check Codex availability**: Verify `codex` binary plus `OPENAI_API_KEY`, `CODEX_API_KEY`, or stored `codex login` auth
|
|
162
162
|
2. **If available**: Execute with xhigh reasoning effort for thorough research
|
|
163
163
|
3. **If unavailable**: Fall back to Claude's WebFetch/WebSearch
|
|
164
164
|
|
|
@@ -128,9 +128,11 @@ function validateEnvironment() {
|
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
//
|
|
132
|
-
if (!process.env.OPENAI_API_KEY) {
|
|
133
|
-
console.error(
|
|
131
|
+
// OPENAI_API_KEY/CODEX_API_KEY are optional when codex has stored auth from `codex login`.
|
|
132
|
+
if (!process.env.OPENAI_API_KEY && !process.env.CODEX_API_KEY) {
|
|
133
|
+
console.error(
|
|
134
|
+
'[codex-wrapper] Note: no OPENAI_API_KEY/CODEX_API_KEY set, relying on stored codex login or ChatGPT auth'
|
|
135
|
+
);
|
|
134
136
|
}
|
|
135
137
|
|
|
136
138
|
return {
|
|
@@ -204,6 +206,7 @@ function executeCodex(binary, args, timeout, workingDir = null) {
|
|
|
204
206
|
const spawnOptions = {
|
|
205
207
|
cwd: workingDir || process.cwd(),
|
|
206
208
|
env: process.env,
|
|
209
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
207
210
|
};
|
|
208
211
|
|
|
209
212
|
const child = spawn(binary, args, spawnOptions);
|
package/templates/manifest.json
CHANGED