Skip to content

Commit 172acf3

Browse files
fix: use Codex hooks schema (nested structure, timeout in seconds, matcher groups)
1 parent 1b80047 commit 172acf3

1 file changed

Lines changed: 26 additions & 12 deletions

File tree

hooks/hooks.json

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
11
{
2-
"hooks": [
3-
{
4-
"event": "SessionStart",
5-
"command": "rm -f /tmp/gcf-proxy-stats.json",
6-
"timeout": 1000
7-
},
8-
{
9-
"event": "Stop",
10-
"command": "node -e \"const fs=require('fs'); try{const d=JSON.parse(fs.readFileSync('/tmp/gcf-proxy-stats.json','utf8')); if(d.calls>0){const s=d.pct_saved.toFixed(0); const tb=d.est_tokens_saved; const saved=tb>=1000?(tb/1000).toFixed(1)+'K':tb; console.log(JSON.stringify({notification:'gcf-proxy: '+d.calls+' tool calls rewritten, '+s+'% fewer tokens (~'+saved+' tokens saved)'}))}}catch(e){}\"",
11-
"timeout": 1000
12-
}
13-
]
2+
"hooks": {
3+
"SessionStart": [
4+
{
5+
"matcher": "startup|resume",
6+
"hooks": [
7+
{
8+
"type": "command",
9+
"command": "rm -f /tmp/gcf-proxy-stats.json",
10+
"timeout": 2
11+
}
12+
]
13+
}
14+
],
15+
"Stop": [
16+
{
17+
"hooks": [
18+
{
19+
"type": "command",
20+
"command": "node -e \"const fs=require('fs'); try{const d=JSON.parse(fs.readFileSync('/tmp/gcf-proxy-stats.json','utf8')); if(d.calls>0){const s=d.pct_saved.toFixed(0); const tb=d.est_tokens_saved; const saved=tb>=1000?(tb/1000).toFixed(1)+'K':tb; console.log(JSON.stringify({notification:'gcf-proxy: '+d.calls+' tool calls rewritten, '+s+'% fewer tokens (~'+saved+' tokens saved)'}))}}catch(e){}\"",
21+
"timeout": 2,
22+
"statusMessage": "Checking GCF proxy savings"
23+
}
24+
]
25+
}
26+
]
27+
}
1428
}

0 commit comments

Comments
 (0)