The Deska blog

Get a Push Notification When Claude Code Finishes

Learn how to get a push notification when Claude Code finishes long tasks using scripts, webhooks, and Deska desktop and mobile applications.

· 9 min read

Running a complex refactor or a large scale codebase analysis with an AI agent takes time. If you want to get a push notification when Claude Code finishes its task, you need a workflow that bridges your local terminal environment with a mobile alerting system. This guide explores the different methods for monitoring long running agent sessions without staring at a terminal window for twenty minutes.

The Problem with Long Running AI Tasks

When you trigger a command in Claude Code to migrate a legacy module or write a suite of integration tests, the agent often enters a cycle of thinking, writing, and executing. During this period, your primary workstation is effectively occupied or your focus is split. Developers frequently switch to other tabs or walk away from their desks, only to return later and realize the agent finished ten minutes ago or, worse, stopped because it required a manual confirmation.

Automating a notification when the process completes allows you to maintain flow. You can handle other tasks and return to your code exactly when the agent is ready for your review. This is particularly important for agents that operate in the terminal, where visual cues are limited to the console output.

Using Standard Shell Completion Hooks

The most direct way to get notified is by appending a secondary command to your agent execution. In most Unix like environments, you can use the && operator to run a notification script immediately after the main process exits successfully.

You might use a simple curl command to a webhook service or a local system beep. However, these lack context. A simple sound at your desk does not help if you are in another room. More advanced developers often write small wrapper scripts that capture the exit code of the Claude process and send a message to a messaging platform. While this works, it requires managing API keys for third party services and ensuring your local environment has the necessary network permissions to reach those external endpoints.

Integrating with a Mobile Ecosystem

For a more seamless experience, using a specialized developer workspace can simplify the notification pipeline. Deska provides a mobile application that allows you to monitor your local terminal sessions directly from your phone. Because Deska is local-first, the communication happens through a secure relay that does not require you to expose ports or configure complex firewalls.

When you run Claude Code within one of the terminals in the Deska workspace, the status of that session is accessible via the paired mobile device. You do not need to write custom scripts to get a alert. The workspace handles the connectivity between your Mac, Windows, or Linux machine and your mobile device, ensuring that you stay informed about the progress of your coding agents.

Setting Up Notifications in Deska

To receive a push notification when Claude Code finishes in Deska, you follow a straightforward setup process within the application settings.

  1. Open the Deska desktop app and go to the settings panel.
  2. Ensure your mobile device is paired using the QR code found in the mobile section.
  3. Open a terminal panel and launch your agent.
  4. Enable session alerts for the specific terminal window.

The ask-deska assistant can also help you manage these sessions. You can ask the assistant to notify you when a specific terminal becomes idle. This is useful because it covers not just successful completions but also instances where the agent is stuck waiting for user input. The integration between the desktop canvas and the mobile relay ensures that the notification reaches you wherever you are.

Alternative Scripting Methods

If you prefer to stay entirely within a standard terminal emulator like iTerm2 or Alacritty, you can use tools like ntfy or pushover. These services provide a CLI tool that you can pipe output into. For example, you might run a command like claude-code "refactor this" ; ntfy publish my_topic "Claude is done".

The downside to this approach is the lack of interactivity. You get the notification, but you cannot see what the agent actually did until you return to your computer. Modern developer tools aim to solve this by providing a window into the remote session. By using the remote-access capabilities of a unified workspace, you can not only get the push notification but also view the terminal output and even type follow up commands from your phone.

Security Considerations for Agent Notifications

When setting up any form of notification for an AI agent, you must consider the security of the data being sent. Standard webhooks often send data over public internet channels in plain text or rely on third party privacy policies. If your notification includes snippets of your code or file names, this could be a security risk.

This is why a local-first approach is preferred for professional development. Systems that establish a direct, encrypted link between your workstation and your mobile device prevent your source code from being stored on external servers. When you receive a notification, it is a signal that your local machine has completed a task, rather than a data dump to a cloud provider. You can read more about how data is handled in the privacy documentation.

FAQ

How to get a notification when a command finishes in terminal?

You can use a command suffix like && say "done" on macOS or use a utility like notify-send on Linux. For mobile alerts, you can use a curl call to a push service or use the built in notifications system in Deska which bridges your desktop terminals to your mobile phone automatically.

Can Claude Code send mobile alerts natively?

As of the current version, Claude Code is a CLI tool that does not have a native mobile app or push notification service. To get alerts on your phone, you must wrap the execution in a script or run it within a workspace like Deska that supports mobile monitoring.

Is it safe to use webhooks for AI agent status?

Using generic webhooks is generally safe for simple "process finished" messages. However, you should avoid sending sensitive code data or internal paths through these webhooks. Using an encrypted relay like the one provided by Deska ensures that your data and storage remain private while still giving you the convenience of remote alerts.

Get Started with Better Agent Workflows

Monitoring your AI agents should not require you to be tethered to your desk. By using the right combination of local tools and mobile integration, you can significantly increase your productivity and handle larger refactoring tasks with confidence.

You can download the Deska desktop app for free on Mac, Windows, and Linux to start running your agents in an infinite canvas with built in mobile sync. It is a powerful way to manage multiple agent threads and ensure you always know exactly when your work is ready for the next step.

💡 Ideas+🐛 BugsSuggest a feature or report a bug