Skip to content
Free and open to everyone. The lessons keep improving thanks to your feedback.
Language : EN

Hooks and scheduled tasks: automating without trapping yourself

In testingChecked on 24/10/2026 (French version)Translated on 27/10/2026

This lesson is still being tested: it improves with learners' feedback. If something is unclear, it is the lesson that needs fixing, not you.

Follow this lesson with Claude Code

With the course companion installed, open Claude Code in your working folder and type:

/formation-ia:suivre m07-l04 en

It reads the up-to-date lesson on this site and guides you step by step, without changing anything without your consent. Install the companion. Claude Code is not included in the free plan: an eligible Claude subscription, or a Console account billed by usage for the terminal.

By the end of this lesson, you will be able to

  • say what a hook is, and what a scheduled task is;
  • install a simple and safe hook: a notification when Claude is waiting for you;
  • know the safety rules for anything that fires by itself;
  • create, monitor, pause and delete a scheduled task.

Why it matters to you

Some things must happen every time, without you thinking about it: being told when Claude is waiting for your answer, preparing a summary every Monday morning. That is the role of hooks and scheduled tasks. But what fires by itself also acts when you are not looking: a mistake repeats, a misunderstood command runs in a loop. This lesson teaches you to automate small, and to stay in control.

Before you start

You needClaude Code in the terminal (module 4, lesson 2) for the hook, the Claude app for scheduled tasks, and your mon-espace-ia folder
CostThe agent subscription: Claude Pro at minimum, €18 per month excl. VAT, price shown in France on 24/10/2026. A scheduled task uses your usage limit at each run
Duration40 minutes
ReminderA hook runs a command on your computer: don’t install anything you don’t understand

Understand it in 3 minutes

A hook is a command that Claude Code launches automatically, at a precise moment: before or after an action, when Claude is waiting for your answer, at the end of a response. According to the documentation, it is deterministic control: the action always happens, instead of depending on the AI’s choice. A skill, by contrast, is an instruction that Claude chooses to apply.

A scheduled task starts a new Claude Code session at the time you choose, with your instructions. In the app, according to the documentation (24/10/2026):

  • a local task runs on your computer, with access to your files, but only if the app is open and the computer is on and not asleep (closing a laptop’s lid puts it to sleep);
  • each task has its own permission mode; in Manual mode, a task that needs a permission stays blocked until you answer;
  • if the computer was asleep, the app catches up only one missed run, the most recent one.

The safety rules:

RuleWhy
Understand each command of a hook before adding itIt runs on your computer, automatically, every time
Start small: notify, summarize, remindA hook or a task that edits or sends also repeats its mistakes
One hook at a time, tested before the nextSeveral hooks that interact become hard to understand
Know how to stop it before you start it/hooks lists the hooks; a task can be paused or deleted

Do it together

1Step 1: A notification hook, for this folder only

The exercise hook only displays a message when Claude Code is waiting for your answer. It is set up in the hidden .claude/settings.json file of your folder. This is the folder’s settings file, the one that can be shared with it: if you copy or share the folder, the hook goes with it.

It is also a protected file: in Manual mode, Claude Code asks for a separate permission before editing it (in the app, the file pane does not let you edit it by hand either).

The exercise was prepared in the terminal: so start Claude Code in the terminal, in mon-espace-ia:

claude --permission-mode manual

Then write, depending on your computer:

On Mac

Add to .claude/settings.json in this folder a Notification hook, with an empty matcher, that runs exactly this command: osascript -e 'display notification "Claude Code needs your attention" with title "Claude Code"'. Keep everything else in the file as it is. Show me the complete file before writing it.

According to the documentation, if no notification appears, the Script Editor app does not yet have permission to display them: run osascript -e 'display notification "test"' once in Terminal, then allow Script Editor in System Settings, Notifications section.

On Windows

Add to .claude/settings.json in this folder a Notification hook, with an empty matcher, that runs exactly this command: powershell.exe -Command "[System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms'); [System.Windows.Forms.MessageBox]::Show('Claude Code needs your attention', 'Claude Code')". Keep everything else in the file as it is. Show me the complete file before writing it.

This command opens a window, and the window may open behind your terminal: if you don’t see it, look behind it. This step has not been tested on Windows.

Check the hook

Read the proposed file: the "defaultMode": "default" line from the kit must still be there. Allow the write. Then type /hooks: your hook appears under Notification. Ask for something that requires a permission, switch to another window and wait about ten seconds: the notification should appear.

2Step 2: A scheduled task, monitored

In the app, Code tab, open Scheduled in the sidebar (or in its More menu), then New task. If your sidebar shows Routines, that is the earlier name: click it, then New routine. The screen that opens varies with the app version (you need a recent one: 1.1.5368 or later, according to the documentation):

  • if a choice Create with Claude or Set up manually appears, take Set up manually;
  • if Only on this computer is offered at the top, or a choice between Local and Cloud, choose your computer (Local) before filling in the rest;
  • otherwise, open Advanced settings, General tab, and turn on Only on this computer.

This is essential: according to the documentation, this setting is what makes the task run on your computer, in a local folder. Then give:

  • a name: point-du-lundi;
  • the instructions: “Read the last page of my journal and the sheet of the current project, then write me a 5-line catch-up note in the conversation. Do not edit any file.”;
  • the folder: mon-espace-ia;
  • the mode: Manual;
  • a frequency: once a week.

Then:

  1. Click Create: the button stays grayed out while the form is incomplete (the folder is missing or, on some screens, the description); hover over it to see what is missing. The app may also ask you to trust the folder.
  2. On the task’s page, click Run now, open the task’s History and click the row of the run to see the session it opened.
  3. If it asks for a read permission that you have read and understood, choose “always allow”: according to the documentation, the following runs will accept it without asking you, otherwise they will stay blocked waiting for your answer. For a write or a send, refuse, and fix the instructions.
  4. Finally, switch its status from Active to Paused if you don’t want it to run yet, or delete it.

Your turn

  1. Keep your notification hook for a week. If it bothers you, remove it (lesson 7).
  2. Choose one useful routine that changes nothing (a catch-up note, a summary of the week), and make it a scheduled task in Manual mode.
  3. Run it once with Run now, watching it.
  4. Write in your journal: the hook, the task, what they do, and how to stop them.

Check your work

It worked if:

  • /hooks shows your notification hook, and you can say exactly what it runs;
  • the notification appears when Claude is waiting for your answer;
  • your scheduled task ran once with Run now, without changing anything, and you know how to pause it and delete it;
  • your journal says how to stop each of the two.

Common mistakes:

  • installing a hook copied online without understanding its command;
  • a first scheduled task that edits files or sends messages;
  • thinking a local task runs with the computer off: it only runs if the app is open and the computer is on and not asleep;
  • overwriting the kit’s settings file when adding a hook: always read the complete file before you allow.

Keep it and pick it up later

  • Write down in your journal every hook and every scheduled task: what they do, since when, how to stop them.
  • At the monthly upkeep (module 5, lesson 7), keep the ones that are useful, remove the others.

Going further

optional
  • According to the documentation, "disableAllHooks": true in a settings file turns off all your hooks at once; careful, a project’s settings file takes priority over yours and can set it back to false.
  • Scheduled tasks also exist in the cloud, with your computer off: that is a topic for module 8 (“Automating your daily life, while staying in control”).
  • The official documentation, in English: code.claude.com/docs/en/hooks-guide and code.claude.com/docs/en/desktop-scheduled-tasks.

New words

4 words explained
WordWhat it means
HookA command that Claude Code launches automatically at a precise moment, every time
Scheduled taskA Claude Code session that starts by itself, at the chosen time, with your instructions
DeterministicWhich always happens the same way, without depending on the AI’s choice
Run nowThe button that launches a scheduled task right away, to test it while watching it

Check your understanding

3 questions, no grade. An explanation appears after each answer.

1What is the difference between a skill and a hook?
2Someone suggests a hook found online, which you don't understand. What do you do?
3Your scheduled task runs in Manual mode and needs a permission during the night. What happens?

What's next?

Lesson 5 · Subagents: delegating a search: handing a search to a separate assistant, without cluttering your conversation.

Module 7:

✏️ Do the exercises

My space: your progress, your exercises and your last lesson.

To be checked: the notification hook has not been tested for real (it only fires in an interactive session), and the Windows command has never been tried on Windows; the scheduled task screens have not been tested in the app (screenshots to take).

Sources and checks

5 sources

Date, version, sources Written on 24/10/2026. Checks on 24/10/2026:

  • hooks (automatic command, deterministic control, Notification hook and its Mac and Windows commands, Script Editor setting, /hooks, disableAllHooks, settings locations): code.claude.com/docs/en/hooks-guide;
  • writing in .claude requested in Manual mode: code.claude.com/docs/en/permission-modes (protected paths); in the app, this file cannot be edited by hand in the file pane: code.claude.com/docs/en/desktop;
  • local scheduled tasks (computer on and app open, mode per task, blocking in Manual mode, Run now, pause, deletion, missed run): code.claude.com/docs/en/desktop-scheduled-tasks; creation screens, “Only on this computer” setting, minimum app version, “always allow”, checked on 25/10/2026; French labels: the app’s translation file (test T65);
  • Claude Pro price: claude.com/pricing.

Sources checked: