Defined in hooks/hooks.json
{
"PreToolUse": [
{
"hooks": [
{
"type": "prompt",
"prompt": "If the file path contains .xcdatamodeld, add context: 'Warning: Core Data model changes require migration planning. Run /axiom:audit-core-data after changes to verify safety.'"
}
],
"matcher": "Edit|Write"
}
],
"PostToolUse": [
{
"hooks": [
{
"type": "prompt",
"prompt": "If this bash command was xcodebuild/swift build and it failed (non-zero exit), suggest: 'Build failed. Run /axiom:fix-build for automatic diagnostics?'"
},
{
"type": "command",
"command": "bash -c 'O=\"$CLAUDE_TOOL_OUTPUT\"; echo \"$O\" | grep -qE \"Unable to simultaneously satisfy constraints\" && echo \"💡 Auto Layout conflict. Try: skill auto-layout-debugging\"; echo \"$O\" | grep -qE \"Actor-isolated|Sendable|data race|@MainActor\" && echo \"💡 Concurrency issue. Try: skill swift-concurrency\"; echo \"$O\" | grep -qE \"no such column|FOREIGN KEY constraint|migration\" && echo \"💡 Database migration issue. Try: skill database-migration\"; echo \"$O\" | grep -qE \"retain cycle|memory leak|deinit.*never called\" && echo \"💡 Memory issue detected. Try: skill memory-debugging\"; echo \"$O\" | grep -qE \"CKError|CKRecord.*error\" && echo \"💡 CloudKit issue. Try: skill cloudkit-ref or cloud-sync-diag\"; echo \"$O\" | grep -qE \"ubiquitous.*error|iCloud Drive|NSFileCoordinator\" && echo \"💡 iCloud Drive issue. Try: skill icloud-drive-ref or cloud-sync-diag\"; echo \"$O\" | grep -qE \"file.*disappeared|file not found|storage.*full\" && echo \"💡 File storage issue. Try: skill storage-diag\"; echo \"$O\" | grep -qE \"FileProtection|data protection|file.*locked\" && echo \"💡 File protection issue. Try: skill file-protection-ref\"; echo \"$O\" | grep -qE \"error:.*module.*not found|linker command failed\" && echo \"💡 Build configuration issue. Try: /axiom:fix-build\"; exit 0'"
}
],
"matcher": "Bash"
},
{
"hooks": [
{
"type": "command",
"command": "bash -c 'if [[ \"$TOOL_INPUT_FILE_PATH\" == *.swift ]]; then if command -v swiftformat &>/dev/null; then swiftformat \"$TOOL_INPUT_FILE_PATH\" --quiet || true; else echo \"⚠️ Axiom: swiftformat not found. Install with: brew install swiftformat\"; fi; fi; exit 0'"
}
],
"matcher": "Write|Edit"
}
],
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "bash -c 'META=$(find ~/.claude/plugins -path \"*/axiom/hooks/metadata.txt\" 2>/dev/null | head -1); if [ -f \"$META\" ]; then { read VER; read SKILLS; read AGENTS; read CMDS; } < \"$META\"; if [[ \"$VER\" =~ ^[0-9]+\\.[0-9]+\\.[0-9]+$ ]]; then LAST=$(cat ~/.claude/axiom-version 2>/dev/null); if [ -z \"$LAST\" ]; then echo \"✓ Axiom v$VER installed ($SKILLS skills, $AGENTS agents, $CMDS commands)\"; elif [ \"$LAST\" != \"$VER\" ]; then echo \"✓ Axiom updated to v$VER ($SKILLS skills, $AGENTS agents, $CMDS commands)\"; fi; mkdir -p ~/.claude 2>/dev/null && echo \"$VER\" > ~/.claude/axiom-version; fi; fi; ZOMBIE=$(pgrep -f xcodebuild 2>/dev/null | wc -l | tr -d \" \"); DD=$(du -sh ~/Library/Developer/Xcode/DerivedData 2>/dev/null | cut -f1); [ \"${ZOMBIE:-0}\" -gt 5 ] 2>/dev/null && echo \"⚠️ $ZOMBIE xcodebuild processes running (consider: killall xcodebuild)\"; if [[ \"$DD\" == *G* ]]; then GB=$(echo \"$DD\" | tr -d G | cut -d. -f1); [ -n \"$GB\" ] && [ \"$GB\" -gt 10 ] 2>/dev/null && echo \"⚠️ Derived Data is $DD (consider cleaning)\"; fi; if ls *.xcodeproj *.xcworkspace 2>/dev/null >/dev/null; then echo \"📱 iOS project detected. Axiom skills available.\"; echo \" Try: /axiom:ask <your question> or browse skills with /skill axiom:getting-started\"; fi; exit 0'"
}
]
}
],
"UserPromptSubmit": []
}{
"riskFlags": {
"touchesBash": true,
"matchAllTools": false,
"touchesFileWrites": true
},
"typeStats": {
"prompt": 2,
"command": 3
},
"eventStats": {
"PreToolUse": 1,
"PostToolUse": 3,
"SessionStart": 1
},
"originCounts": {
"absolutePaths": 0,
"pluginScripts": 0,
"projectScripts": 0
},
"timeoutStats": {
"commandsWithoutTimeout": 3
}
}