[feat]: Add setting to disable automatic hook config injection (.claude/settings.local.json, .codex/config.toml)
Description
Every time emdash spawns an agent session, HookConfigWriter.prepareHookConfig() writes
notification hook configs into the project/worktree cwd:
.claude/settings.local.jsonβ addsNotificationandStophook entries pointing at emdash's local POST endpoint (carriesEMDASH_HOOK_PORT/EMDASH_HOOK_TOKENmarkers)..codex/config.tomlβ setsnotify = [...]to the bundled notify script..opencode/plugins/emdash-notifications.js,.pi/extensions/emdash-hook.tsfor those providers.
There is currently no setting that disables this injection. The two related toggles do not gate it:
| Setting | Effect |
|---|---|
notifications.enabled |
Only suppresses Notification.show() (OS toast). The hook file is still written. |
localProject.writeAgentConfigToGitIgnore |
Only controls whether the path is added to .gitignore. The hook file is still written. |
Why this is a problem
- It silently mutates user-owned config files (
.claude/settings.local.jsonis meant for user-specific permissions, not tool-managed hooks). - It runs on every fresh
LocalConversationProviderinstance β disabling per-task caching viapreparedHookProvidersis per-instance and resets across tasks/sessions. - Users who don't want their projects coupled to a running emdash daemon (e.g. they share
the worktree with other agents, run agents directly, or audit their repo for unexpected
files) have no opt-out short of patching the asar or making the files immutable
(
chmod 444/chflags uchg), both of which produce silent write failures emdash logs as warnings.
Reproduction
- emdash 1.1.10, macOS.
- Open any project, start a Claude or Codex task.
cat .claude/settings.local.jsonβ thehooksblock now contains an entry referencingEMDASH_HOOK_PORT. Same for.codex/config.toml(notify = ...).- Toggle off
notifications.enabledandwriteAgentConfigToGitIgnorefrom Settings. - Start a new task β the hook entries are re-written.
Source pointers (1.1.10, packed out/main/index.js)
class HookConfigWriterβwriteClaudeHooks/writeCodexNotify/writeForProvider/writeAll.- Caller:
LocalConversationProvider.prepareHookConfiginvoked fromstartSession. The guard only checkswriteAgentConfigToGitIgnorefor.gitignorewrites, never gates the config file write itself.
Proposed fix
Add a new setting (e.g. localProject.injectAgentNotificationHooks: boolean, default
true to preserve current behavior) and short-circuit prepareHookConfig when it's
false. Optionally per-provider granularity ({ claude: false, codex: true }) for users
who want notifications for one provider but not another.
A "clean up existing emdash hook entries from this project" action in Settings would also be helpful, since users who toggle this off will have stale entries from previous runs.
emdash version
1.1.10
OS
macOS (Darwin 25.3.0)
Hi @rasitakyol, Thanks for flagging this. We will add a setting for opting out of the automatic hook injection.
+1 on this, this has been super annoying, and intrusive.
on it! will have something ready by eod :)
if there is anything else that yall would love to have fixed, just tag me!
@janburzinski I was definitely too sleepy when posting the comment π. I was using Superset, not Emdash, and they keep adding hooks to my agents' configs. I'm sorry, somehow I found myself here. Probably will use Emdash just to see though haha...
haha no problem! would love for you to try emdash
if you find any bug/inconvenience just tag me i'll fix it instantly βΊοΈ @VinhLe1410
Hi, checking in on "will have something ready by eod," did that happen? π Also, I'm using Pi, and I would still like Emdash to write the hook (and keep it updated), but just in my home directory, not per worktree.
Hi @alecmev, Apologies, and thanks for the bump! This slipped through for some reason after the initial follow-up.
We should def. implement this setting and it sits on our list: Weβll take another look and follow up with an implementation path here. @janburzinski
closing as this as resolved