Skip to content

AI agent skill that researches any topic across Reddit, X, YouTube, HN, Polymarket, and the web - then synthesizes a grounded summary

fix(hooks): use bare CLAUDE_PLUGIN_ROOT in SessionStart (#1092)

Saurabhd248a09896e3
diff --git a/changelog.d/1074.fixed.md b/changelog.d/1074.fixed.md
new file mode 100644
index 00000000..1a9de80f
--- /dev/null
+++ b/changelog.d/1074.fixed.md
@@ -0,0 +1,3 @@
+SessionStart hook must use the bare ${CLAUDE_PLUGIN_ROOT} form so Claude Code's
+missing-plugin-root guard can match it. A default of `.` resolves relative to the
+session cwd and can execute a decoy check-config.sh from the user's project.
diff --git a/hooks/hooks.json b/hooks/hooks.json
index 2fd710d9..0c88bc40 100644
--- a/hooks/hooks.json
+++ b/hooks/hooks.json
@@ -6,7 +6,7 @@
"hooks": [
{
"type": "command",
- "command": "bash \"${CLAUDE_PLUGIN_ROOT:-${extensionPath:-.}}/hooks/scripts/check-config.sh\""
+ "command": "bash \"${CLAUDE_PLUGIN_ROOT}/hooks/scripts/check-config.sh\""
}
]
}
diff --git a/tests/test_plugin_contract.py b/tests/test_plugin_contract.py
index bdea5816..b58d7e60 100644
--- a/tests/test_plugin_contract.py
+++ b/tests/test_plugin_contract.py
@@ -126,5 +126,16 @@ class TestPluginContract(unittest.TestCase):
self.assertEqual([], offenders)
+ def test_session_start_hook_uses_bare_claude_plugin_root(self) -> None:
+ # Claude Code's missing-plugin-root guard matches the exact literal
+ # ${CLAUDE_PLUGIN_ROOT}. Defaults like ${CLAUDE_PLUGIN_ROOT:-.} slip past
+ # that check and resolve relative to the session cwd (issue #1074).
+ hooks = _json(ROOT / "hooks" / "hooks.json")
+ command = hooks["hooks"]["SessionStart"][0]["hooks"][0]["command"]
+ self.assertIn("${CLAUDE_PLUGIN_ROOT}", command)
+ self.assertNotIn(":-", command)
+ self.assertNotIn("extensionPath", command)
+ self.assertNotIn(":-.}", command)
+
if __name__ == "__main__":
unittest.main()