Drops the userEmail block from the context Claude Code attaches to a conversation

Claude Code fn hook/mod to block your email from the system prompt https://www.reddit.com/r/ClaudeAI/comments/1wyiw3k/you_put_my_what/
Else Opus loves to put it in request headers.
hooks/register.ts 15 lines1import type { Register } from 'claude-code';
2
3// Claude Code adds a `userEmail` block (from `oauthAccount.emailAddress` in
4// ~/.claude.json) whenever you're signed in with claude.ai, and no setting
5// turns it off. Filter it out of whatever the rest of the chain returns.
6export const register: Register = on => {
7 on('prompt.context', async ($, e, next) => {
8 const context = await next(e);
9 return {
10 ...context,
11 blocks: context.blocks.filter(block => block.name !== 'userEmail'),
12 };
13 });
14};
15