[Feature] Expose task/tool context in Notification and Stop hooks

Resolved 💬 0 comments Opened May 11, 2026 by hanpeng-bj Closed May 31, 2026

Problem

The Notification and Stop hooks fire after every Claude response, but they carry no task context — no CLAUDE_TASK, no info about what tools ran or what changed.

Verified in v2.1.138: only CLAUDE_PROJECT_DIR, CLAUDE_EFFORT, and a few infra vars are available. CLAUDE_TASK and CLAUDE_PERMISSION_PROMPT only appear in permission-request hooks, never in Notification or Stop.

Use Case

I want desktop notifications that say what Claude just did — e.g. "Read settings.json", "Edited notice.ps1", "Fixed login bug". Without context, I can only show a static "Response complete" popup. Every modern AI tool with notifications supports this.

Proposed Solution

Set these env vars in Notification and Stop hooks:

| Variable | Example value |
|---|---|
| CLAUDE_TASK | Fix login validation bug |
| CLAUDE_LAST_TOOL_NAME | Edit |
| CLAUDE_LAST_TOOL_SUMMARY | Edited src/auth.ts |

This lets users build dynamic desktop notifications without any plugin or hook architecture changes.``

View original on GitHub ↗