Cowork: Support Claude Code hooks (~/.claude/settings.json — UserPromptSubmit, Stop, etc.)
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
Claude Code supports lifecycle hooks configured in ~/.claude/settings.json (UserPromptSubmit, Stop, PreToolUse, PostToolUse, etc.). Cowork is built on Claude Code, but does not fire these hooks.
Verified May 28, 2026: two hooks configured in ~/.claude/settings.json with scripts installed at ~/.claude/hooks/ —
- UserPromptSubmit → inject-datetime.sh (adds a "Current date/time:" line to each prompt's context)
- Stop → record-session-event.sh (logs a timestamped row after each assistant turn)
In a fresh Cowork chat after a full quit-and-restart:
- UserPromptSubmit did not fire — the assistant got the date from Cowork's own <env> block, not from the injected line. Confirmed across two fresh chats. The script itself works: run directly in Terminal it emits correct JSON. So Cowork just never triggers it.
- Stop did not fire — no log file was ever written.
- There is no /hooks command in Cowork — typing /hooks returns "Unknown skill: hooks". Cowork treats a leading slash as a skill invocation and has no concept of Claude Code's command set, so hooks can't be inspected or reloaded from a chat either.
Proposed Solution
Honour the Claude Code hooks lifecycle in Cowork, at minimum UserPromptSubmit and Stop (ideally PreToolUse/PostToolUse too). Read ~/.claude/settings.json and fire the configured commands at the corresponding lifecycle points.
Open question for Anthropic to resolve: Cowork sessions run in a Linux sandbox while the hooks config and scripts live on the host Mac. It's unclear whether hooks should fire host-side (where settings.json lives) or inside the sandbox. Host-side is likely most useful, since that's where the config and scripts already are — and it parallels how Cowork's first-party Word/PowerPoint connectors already bridge to the host.
Bonus: expose a way to inspect configured hooks from within Cowork (the equivalent of Claude Code's /hooks command).
Alternative Solutions
- Use Claude Code CLI on the Mac for any workflow needing hooks — works natively, but terminal-only and breaks the Cowork-chat workflow.
- For session-duration tracking specifically: have the assistant log a start timestamp when each chat opens and an end timestamp when the chat is wrapped up. Wall-time only, no active-vs-wait split, and only captures chats that are explicitly closed out.
- Use the session_info MCP for chat count and topic listing — but it has no timestamps, so no duration data.
Priority
Medium - Would be very helpful
Feature Category
Other
Use Case Example
Scenario — per-chat session-duration tracking:
- A Stop hook fires after every assistant turn and logs "timestamp | session_id | stop" to a file in the Cowork workspace.
- A UserPromptSubmit hook injects the current date/time into each user message.
- A daily aggregator reads both signals and computes, per chat: wall time, active time (sum of conversational bursts), and wait time (idle gaps).
- This distinguishes a chat worked on steadily for 20 minutes from one that sat open for 6 hours before being closed out.
Today none of this is possible in Cowork — neither hook fires, so the only signals available are coarse (session count and topic from the session_info MCP, with no timestamps).
Additional Context
Verified May 28, 2026 on macOS with Cowork desktop app:
- inject-datetime.sh run directly in Terminal: emits correct JSON. Script is sound.
- Same hook in a fresh Cowork chat: did not fire (date came from <env> block instead).
- /hooks in a Cowork chat: "Unknown skill: hooks".
- Cowork session sandbox: Linux 6.8.0-106-generic, aarch64, Ubuntu.
Related issues:
- #60651 — Cowork host-Mac AppleScript bridge FR (same root: Cowork Linux sandbox lacks host integration)
- #40495 — Confirms Cowork sandbox is Linux/aarch64, not host macOS
- #48909 — Custom stdio MCP support in Cowork (related host-integration gap)
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗