Skip to content

Commit b7a04f3

Browse files
committed
fix: move hooks teaching comments out of hooks{} to stop settings loader warnings
The Claude Code settings loader validates every key under hooks{} as a lifecycle event name. _comment and the two _disabled_*_example teaching blocks aren't events, so they logged unknown-event warnings on every startup. Moved them to top-level keys (_hooks_comment, _hooks_disabled_PostToolUse_example, _hooks_disabled_PreToolUse_example), matching the existing _commands_comment/_mcpServers_comment convention. Content preserved verbatim; live SessionEnd/SessionStart hooks unchanged.
1 parent e839eef commit b7a04f3

1 file changed

Lines changed: 32 additions & 32 deletions

File tree

.claude/settings.json

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
]
2323
},
2424
"hooks": {
25-
"_comment": "Hooks run shell commands on Claude Code lifecycle events. type:command runs a script; timeout is in seconds. ${CLAUDE_PROJECT_DIR} resolves to the repo root. The two memory hooks below are LIVE. The commented blocks under _disabled_* are teaching examples: copy one up into its matching event array to activate it.",
2625
"SessionEnd": [
2726
{
2827
"hooks": [
@@ -44,37 +43,38 @@
4443
}
4544
]
4645
}
47-
],
48-
"_disabled_PostToolUse_example": {
49-
"_comment": "TEACHING EXAMPLE (inactive because the key is _disabled_*, not a real event name). Rename to PostToolUse to activate. This runs Ruff to auto-format any Python file right after Claude edits it, so demo code is always clean on screen. The matcher scopes it to file-writing tools. The hook script is expected at hooks/scripts/auto-format-python.sh.",
50-
"value": [
51-
{
52-
"matcher": "Edit|Write|MultiEdit",
53-
"hooks": [
54-
{
55-
"type": "command",
56-
"command": "bash ${CLAUDE_PROJECT_DIR}/hooks/scripts/auto-format-python.sh",
57-
"timeout": 30
58-
}
59-
]
60-
}
61-
]
62-
},
63-
"_disabled_PreToolUse_example": {
64-
"_comment": "TEACHING EXAMPLE (inactive). Rename to PreToolUse to activate. This is where a secret-scan guard would sit: a script that inspects a pending Write/Edit for a hardcoded key and exits non-zero (exit 2 = deny) to block the write. Enforces the secrets-security rule at the tool boundary, not just by convention.",
65-
"value": [
66-
{
67-
"matcher": "Edit|Write|MultiEdit",
68-
"hooks": [
69-
{
70-
"type": "command",
71-
"command": "bash ${CLAUDE_PROJECT_DIR}/hooks/scripts/secret-scan-guard.sh",
72-
"timeout": 15
73-
}
74-
]
75-
}
76-
]
77-
}
46+
]
47+
},
48+
"_hooks_comment": "Hooks run shell commands on Claude Code lifecycle events. type:command runs a script; timeout is in seconds. ${CLAUDE_PROJECT_DIR} resolves to the repo root. The two memory hooks under hooks{} (SessionEnd, SessionStart) are LIVE. The two _hooks_disabled_*_example keys below are teaching examples: copy one into the hooks{} object under its matching event name to activate it. They are NOT nested under hooks{} because the settings loader validates every key there as a lifecycle event name and warns on anything else.",
49+
"_hooks_disabled_PostToolUse_example": {
50+
"_comment": "TEACHING EXAMPLE (inactive). Move this array into hooks.PostToolUse to activate. This runs Ruff to auto-format any Python file right after Claude edits it, so demo code is always clean on screen. The matcher scopes it to file-writing tools. The hook script is expected at hooks/scripts/auto-format-python.sh.",
51+
"value": [
52+
{
53+
"matcher": "Edit|Write|MultiEdit",
54+
"hooks": [
55+
{
56+
"type": "command",
57+
"command": "bash ${CLAUDE_PROJECT_DIR}/hooks/scripts/auto-format-python.sh",
58+
"timeout": 30
59+
}
60+
]
61+
}
62+
]
63+
},
64+
"_hooks_disabled_PreToolUse_example": {
65+
"_comment": "TEACHING EXAMPLE (inactive). Move this array into hooks.PreToolUse to activate. This is where a secret-scan guard would sit: a script that inspects a pending Write/Edit for a hardcoded key and exits non-zero (exit 2 = deny) to block the write. Enforces the secrets-security rule at the tool boundary, not just by convention.",
66+
"value": [
67+
{
68+
"matcher": "Edit|Write|MultiEdit",
69+
"hooks": [
70+
{
71+
"type": "command",
72+
"command": "bash ${CLAUDE_PROJECT_DIR}/hooks/scripts/secret-scan-guard.sh",
73+
"timeout": 15
74+
}
75+
]
76+
}
77+
]
7878
},
7979
"_commands_comment": "Slash commands are NOT declared here. They are markdown files in .claude/commands/. This repo ships two GenAI-on-Azure commands: /deploy-genai (pre-deploy gate + azd deploy walkthrough) and /eval-prompts (run the prompt-eval suite). Open .claude/commands/*.md to read or edit them. Type / in the CLI to list all available commands.",
8080
"_mcpServers_comment": "Project-scoped MCP servers for the Claude Code CLI live in .mcp.json at the repo root (the documented team-share location the CLI reads and prompts to approve on clone), NOT here. See .mcp.json for microsoft-learn, oreilly-july20-documentmcp, oreilly-july20-memorymcp, and github. A parallel .vscode/mcp.json registers the document server for VS Code's Copilot."

0 commit comments

Comments
 (0)