# Scheduled Checks with Claude Have Claude check your Kopai alerts on a schedule and report the likely cause, from Claude Code or from Slack A scheduled check is a prompt that Claude runs on a timer. On each run, Claude asks Kopai which alerts are firing, looks into your traces, logs and metrics, and writes a short report: what fired, the likely cause and what to check first. You set it up yourself, in Claude Code. It needs no Slack, and it works on Claude's paid individual plans. A report can look like this: > **1 alert is firing.** Checked at 10:07 UTC. > > **search latency** has been firing since 09:41 UTC: average 1.4 s against a threshold of 800 ms. > > **Likely cause:** the `orders` database. Search's `SELECT` spans to it went from p95 ≈ 40 ms to ≈ 1.1 s at 09:38 UTC, at flat traffic and with no new `service.version`. > > **Look first at:** the database's connections and slow queries since 09:38. > > Incident: `https://app.kopai.app/alerts/rules/…/incidents/…` :::note[This is one of two ways to put Claude on call] A check runs when its timer fires, not when an alert fires. With a Claude Team or Enterprise plan and Slack, Claude can instead answer each alert when it arrives. [On-Call with Claude in Slack](/docs/claude-on-call/#two-ways-to-put-claude-on-call) compares the two ways. ::: ## How it works 1. Kopai evaluates your [alert rules](/docs/alerting/) as before. If you connected a Slack target, it also posts to Slack when a rule fires. A scheduled check does not replace the rules. 2. When the timer fires, Claude starts a new session with your prompt. Through the Kopai connector, it reads the state of your rules and the alerts of the last hour. Then it queries your telemetry to find the cause. 3. Claude writes the report into that session. You read it in Claude, or you have Claude post it to Slack. ## Where a check can run | Where | Shortest interval | What it needs | | --- | --- | --- | | **Anthropic's cloud**, as a scheduled task that you create in Claude Code | 1 hour | A Claude Pro, Max, Ultra, Team or Enterprise plan. Your computer can be off. | | **Your own machine**, with `/loop` in Claude Code | 1 minute | An open Claude Code session, on a computer that stays on. | | **A Slack channel**, with Claude Tag | 1 hour | A Claude Team or Enterprise plan, and Claude Tag connected to Kopai. | Steps 1 to 3 set up the check in Anthropic's cloud. The other two places follow: [your own machine](#check-more-often-on-your-own-machine) and [Slack](#run-the-check-in-slack-with-claude-tag). ## Before you start - **A Kopai workspace with alert rules.** You see **Alerting** in the dashboard sidebar. [Alerting](/docs/alerting/) explains how to create a rule. Claude reports what your rules found. - **Claude Code, signed in with your claude.ai account.** Scheduled tasks are part of the Claude Pro, Max, Ultra, Team and Enterprise plans. They are not available when Claude Code is signed in with an API key or through a cloud provider. On a Team or Enterprise plan, an Owner can turn them off for the organization. - **A GitHub repository for the task to work in,** for example your service's. A scheduled task in Anthropic's cloud runs in a fresh clone of it. ## Step 1: Connect Kopai on claude.ai A scheduled task in Anthropic's cloud uses the connectors of your claude.ai account. Add Kopai there from the Claude connector directory and approve the connection, as [Connect AI Assistants](/docs/connect-ai-assistants/) describes. :::caution[A server from `claude mcp add` is not enough] A Kopai server that you added in Claude Code with `claude mcp add` is stored on your machine. A task in Anthropic's cloud cannot use it. Connect Kopai on claude.ai as well. ::: ## Step 2: Create the scheduled task In Claude Code, run `/schedule` and describe the check: ```text /schedule every hour, check my Kopai alerts ``` Claude asks about the schedule, the repositories and the prompt. Then it saves the task to your Claude account. When Claude asks for the prompt, paste this: ```text Check my Kopai workspace and report on its alerts. Use the Kopai connector. 1. List the alert rules with their state, and the alert events of the last 70 minutes. 2. For each rule that is firing now, and each alert that fired in that time, read the alert. Then look for the likely cause in the traces, logs and metrics of the services involved. Compare the time before the alert started with the time after. 3. Write a short report. For each alert give: the rule's name, whether it is still firing and since when, the observed value against the threshold, the likely cause with your evidence, what to look at first, and the incident link. If no rule is firing and no alert fired, answer with one line: "No Kopai alerts in the last hour." Only read. Do not create, change or pause alert rules. ``` - **The 70 minutes are one hour plus a margin,** because a run can start a few minutes late. If you pick another schedule, change the number. - **Give the task a repository when Claude asks,** for example your service's own. Each run clones it, so Claude can also read the code when it looks for a cause. Claude tells you if your Claude account still needs GitHub access to the repository. - **Keep the last line of the prompt.** During a run, Claude can do whatever your Kopai connection allows. [What Claude may do in Kopai](#what-claude-may-do-in-kopai) explains this. - **Remove the connectors that the check does not need.** A new task includes every connector of your claude.ai account. Open the task at [claude.ai/code/routines](https://claude.ai/code/routines), choose **Edit**, and look under **Advanced settings › Connectors**. You can also create the task on the web: open [claude.ai/code/routines](https://claude.ai/code/routines) and click **New task**, which some accounts show as **New routine**. Select a repository there too. Without one, the dialog can create a task for claude.ai chat instead of a Claude Code task. Anthropic's [scheduled tasks guide](https://code.claude.com/docs/en/routines) describes the dialog. ## Step 3: Run it once Don't wait for the first hour. Open the task at [claude.ai/code/routines](https://claude.ai/code/routines) and click **Run now**, or run `/schedule run` in Claude Code. Then open the run under **History** on the task's page. It ends with the report, or with the line "No Kopai alerts in the last hour." Both mean that the check works. If Claude writes that it has no Kopai tools, see [Troubleshooting](#troubleshooting). ## Read the reports Each run is a new session in Claude. You find it under **History** on the task's page. A row there tells you only how the session ended, not what Claude found, so open the run to read the report. To get the reports in Slack: 1. Connect Slack to your claude.ai account under [Customize › Connectors](https://claude.ai/customize/connectors). 2. Add Slack to the task. A task keeps the connectors that it had when you created it. Open the task at [claude.ai/code/routines](https://claude.ai/code/routines), choose **Edit**, and add Slack under **Advanced settings › Connectors**. 3. In the same dialog, add this line to the prompt: ```text If there is an alert to report, post the report to #alerts in Slack. ``` Claude posts in your name, because a scheduled task acts through your own connected accounts. ## Check more often, on your own machine A task in Anthropic's cloud runs at most once an hour. During a deploy or an incident, you may want a look every few minutes. In an open Claude Code session, `/loop` repeats a prompt on a shorter timer: ```text /loop 10m check Kopai: which alert rules are firing, and which alerts fired in the last 15 minutes? For each one, give the likely cause and what to look at first. Answer with one line if there are none. ``` - **The loop uses the Kopai connection of that session.** [Connect AI Assistants](/docs/connect-ai-assistants/) explains how to connect Claude Code. - **The loop runs only while the session is open** and the computer is on. Closing the terminal stops it. - **The shortest interval is one minute.** - **The loop stops by itself after 30 days at the latest.** To stop it earlier, ask Claude, for example "cancel the Kopai check". The Claude Desktop app can also run a check on your machine without an open session, while the app runs and the computer is awake. See Anthropic's guide to [Desktop scheduled tasks](https://code.claude.com/docs/en/desktop-scheduled-tasks). ## Run the check in Slack, with Claude Tag Claude Tag is Claude in your Slack channels. It needs a Claude Team or Enterprise plan. If a channel already has the `kopai` bundle from [On-Call with Claude in Slack](/docs/claude-on-call/), anyone in that channel can schedule the check there: ```text @Claude every hour, check Kopai for alerts that fired in the last 70 minutes. Skip the ones you already reported in this channel. For each new one, post when it started, the likely cause and what to look at first. Post nothing when there is nothing new. ``` - **Claude Tag runs a scheduled job at most once an hour.** It declines a shorter interval. - **The job uses the channel's agent token,** not your sign-in. [What the agent token allows](/docs/claude-on-call/#what-the-agent-token-allows) lists what it can do. - **Claude may post a short message for a run that found nothing new.** Claude Tag usually announces each run of a job in the channel. - **To see the channel's scheduled jobs,** send `@Claude !scheduled`. To stop the check, ask Claude in the channel, for example "disable the Kopai check". The check is useful in two kinds of channel: - **Your alert channel.** There it is a safety net for an alert that Claude did not answer. - **Another channel that has the bundle,** such as a team channel. There it brings the alerts to people who don't follow the alert channel. ## What Claude may do in Kopai A scheduled task in Anthropic's cloud uses your own Kopai sign-in. A `/loop` session uses the Kopai connection of that session: your sign-in, or a CLI token. During a check, Claude has the rights of that connection. The table in [Alerting](/docs/alerting/#through-the-kopai-connector) lists them by role. If your connection may change alert rules, Kopai does not stop a check from doing that. Kopai cannot tell a scheduled run from you. This is why the last line of the prompt on this page tells Claude to only read. A check in Slack is different. It uses the channel's agent token, which cannot change or pause a rule. ## Limits - **A check does not replace alert rules.** Between two runs, Claude does not look at your services. Let the rules and the Slack target do the detecting. The check adds the diagnosis. - **Each run in Anthropic's cloud starts fresh.** Claude does not remember the run before. An alert that stays firing is in every report until it resolves. - **A run can start late.** A run that is scheduled exactly on the hour can start several minutes late. - **Runs count against your Claude plan.** A scheduled run uses your plan's usage, like a session that you start yourself. An hourly check is 24 runs a day. - **A scheduled task belongs to you alone.** Your teammates do not see the task or its reports, unless Claude posts the reports to Slack. ## Troubleshooting **Claude Code answers `Unknown command: /schedule`, or says why the command is not available.** The usual causes: - **Claude Code is signed in with an API key or through a cloud provider.** `/schedule` needs a claude.ai sign-in, so run `/login`. If `ANTHROPIC_API_KEY` is set in your shell, remove it, because it takes precedence over the sign-in. - **Your Claude organization turned off scheduled tasks or cloud sessions.** For cloud sessions, the answer is `Cloud sessions are disabled by your organization's policy`. Ask an Owner of your Claude organization. - **You ran `/schedule` inside a cloud session.** Run it in Claude Code on your machine, or create the task at [claude.ai/code/routines](https://claude.ai/code/routines). **The report says that Claude has no Kopai tools.** The task has no Kopai connector. Check that Kopai is connected under [Customize › Connectors](https://claude.ai/customize/connectors) on claude.ai, and that the task's **Connectors** list includes it. A server from `claude mcp add` does not count. **Claude can query Kopai, but finds no alert tools.** Alerting is not available for the workspace, or the workspace is not active. Check that **Alerting** shows in the Kopai dashboard sidebar. **A run does not finish.** Claude may be waiting for a permission. Open the run from **History** and answer the question there. ## Privacy The results of the queries Claude runs and the alerts it reads go from Kopai to Anthropic, which provides Claude. The [Privacy Policy](/privacy/) describes this under "AI Assistants You Connect". A report that Claude posts to Slack is visible to everyone in that channel.