Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Mishchenko.
| `cli/dist/code-alarm.mjs` | The bundled CLI, **committed** and built by `cli/build.mjs`; also the npm package's entry |
| `plugins/claude-code/` | The Claude Code plugin: manifest, hooks, the skill (generated) and `bin/` (the bundle plus PATH shims) |
| `.claude-plugin/marketplace.json` | Makes this repository a Claude Code plugin marketplace |
| `docs/` | Protocol and agent notes |
| `docs/` | Protocol and agent notes; `assets/` holds the README's logo and pictures, hand-written SVG that animates on GitHub. `cli/prepack.mjs` points the npm copy of the README at them on GitHub |

## Working conventions

Expand Down
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ Notable changes to the `code-alarm` CLI and the Claude Code plugin. The format f

## [Unreleased]

## [0.2.2] — 2026-10-18

### Changed

- A new README: the logo, a picture of an agent finishing and the phone ringing, a diagram of
what stays on your computer, both phone apps side by side, a commands table and
troubleshooting. On npm its images and links now point at GitHub, so they show there too.

## [0.2.1] — 2026-10-18

### Changed
Expand Down Expand Up @@ -83,7 +91,8 @@ Notable changes to the `code-alarm` CLI and the Claude Code plugin. The format f
quote safely; `uninstall codex` removes only its own files. The npm package includes the
license and README. `status` never shows the topic.

[Unreleased]: https://github.com/Draganoider/code-alarm/compare/v0.2.1...test
[Unreleased]: https://github.com/Draganoider/code-alarm/compare/v0.2.2...test
[0.2.2]: https://github.com/Draganoider/code-alarm/compare/v0.2.1...v0.2.2
[0.2.1]: https://github.com/Draganoider/code-alarm/compare/v0.2.0...v0.2.1
[0.2.0]: https://github.com/Draganoider/code-alarm/compare/v0.1.0...v0.2.0
[0.1.0]: https://github.com/Draganoider/code-alarm/releases/tag/v0.1.0
185 changes: 126 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,103 @@
<p align="center">
<img src="docs/assets/logo.svg" width="104" height="104" alt="Code Alarm logo: an alarm clock with a terminal prompt">
</p>

<h1 align="center">Code Alarm</h1>

<p align="center">
<b>Start a long agent task, walk away, and get woken up when it's done.</b><br>
A real alarm on your phone when Claude Code or Codex finishes or needs you.
<b>Your agent is done. Your phone rings.</b><br>
A real alarm on your phone when Claude Code or Codex finishes, fails or needs you.
</p>

<p align="center">
<a href="https://www.npmjs.com/package/code-alarm"><img alt="npm" src="https://img.shields.io/npm/v/code-alarm?color=E8364F&label=npm"></a>
<a href="https://github.com/Draganoider/code-alarm/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/Draganoider/code-alarm/actions/workflows/ci.yml/badge.svg?branch=main"></a>
<img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-blue">
<img alt="Agents: Claude Code and Codex" src="https://img.shields.io/badge/agents-Claude%20Code%20%7C%20Codex-8A63D2">
<img alt="Agents: Claude Code and Codex" src="https://img.shields.io/badge/agents-Claude%20Code%20%C2%B7%20Codex-FF8A3D">
<img alt="Node 22+" src="https://img.shields.io/badge/node-%E2%89%A522-339933">
<a href="LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-blue"></a>
</p>

<p align="center">
<a href="#quick-start">Quick start</a> ·
<a href="#use-it">Use it</a> ·
<a href="#how-it-works">How it works</a> ·
<a href="#commands">Commands</a> ·
<a href="docs/protocol.md">Protocol</a>
</p>

---
<p align="center">
<img src="docs/assets/hero.svg" width="100%" alt="A terminal where Claude Code is armed with /code-alarm:alarm and finishes 47 minutes later; a phone shows Code Alarm's ring screen: Done, web-app, with a Stop button.">
</p>

Coding agents now work for an hour or more on their own. Their phone apps will *notify* you when
they're done, but Do Not Disturb swallows a notification and it rings once. **Code Alarm rings like
an alarm**, until you dismiss it, and only for work you armed.
Coding agents now work for an hour or more on their own. Their apps can *notify* you when they're
done, but Do Not Disturb swallows a notification and it only sounds once. **Code Alarm rings like an
alarm**, and only for the work you armed. Start a long task, go make dinner or go to sleep, and
come back when the agent actually needs you.

<table>
<tr>
<td width="33%" valign="top"><b>Only armed work rings</b><br>Sessions you didn't arm stay silent. Old and duplicate alerts never ring.</td>
<td width="33%" valign="top"><b>Knows why it stopped</b><br><i>Done</i>, <i>needs you</i> (a question or a permission prompt), <i>failed</i> or <i>stopped</i>.</td>
<td width="33%" valign="top"><b>Loud, or quiet</b><br>A repeating alarm by default, or one ordinary notification when you arm it with <code>quiet</code>.</td>
</tr>
<tr>
<td valign="top"><b>Private by design</b><br>Only the event's kind, the folder's name and the agent leave your computer. No prompts, code or transcripts.</td>
<td valign="top"><b>Never slows your agent</b><br>Hooks return at once and send in the background, so a bad network can't stall a session.</td>
<td valign="top"><b>Free and open source</b><br>The CLI, the hooks and the Claude Code plugin are MIT, all in this repository.</td>
</tr>
</table>

## Quick start

You need **Node.js 22 or newer** on the computer that runs your agent, and an app on your phone to
ring: the **Code Alarm app** or **ntfy**.

| | Code Alarm app | ntfy |
|---|---|---|
| **Phones** | Android | Android and iPhone |
| **Available** | In closed testing: [join the testers group](https://groups.google.com/g/code-alarm-testers) | Now, free |
| **How it rings** | A full-screen alarm over the lock screen, on the alarm volume, with Stop and Snooze | ntfy's highest-priority alert, which keeps alerting once you turn that on |
| **Set up with** | `npx code-alarm pair` and a QR scan | `npx code-alarm init` and a topic subscription |

### 1. Connect your phone

**With the Code Alarm app.** Once you're in the test, install it from Google Play, then run this
on your computer:

- **One command to arm:** `/code-alarm:alarm` in Claude Code, or ask Codex to use the code-alarm
skill. Sessions you didn't arm stay silent.
- **Knows why it stopped:** *done*, *needs you* (a question or a permission prompt), *failed*, or
*stopped*.
- **Nothing leaves your computer** except the event type and the project folder's name: no prompts,
code, paths or transcripts ([protocol](docs/protocol.md)).
- **Never slows your agent down:** hooks return at once and send in the background. A network
problem can't stall a session.
- **Free:** it rings your phone through the [ntfy](https://ntfy.sh) app today. A dedicated Code
Alarm Android app is coming.
```bash
npx code-alarm pair
```

## Set up (5 minutes)
It shows a QR code. In the app, tap **Pair a computer**, then **Scan QR code**, and confirm. No
camera? Choose **Show a code instead** in the app and run `npx code-alarm pair <that code>`.

You need **Node.js 22 or newer** on the computer that runs your agent.
<details>
<summary><b>With ntfy</b> (Android or iPhone)</summary>
<br>

**1. Create your private alarm channel:**
Create your private alarm channel:

```bash
npx code-alarm init
```

It prints a long random ntfy topic. Treat it like a password: anyone who knows it can ring your
phone.

**2. On your phone:** install **ntfy** ([Google Play](https://play.google.com/store/apps/details?id=io.heckel.ntfy),
phone. Install **ntfy** ([Google Play](https://play.google.com/store/apps/details?id=io.heckel.ntfy),
[F-Droid](https://f-droid.org/packages/io.heckel.ntfy/), [App Store](https://apps.apple.com/app/ntfy/id1625396347))
and subscribe to that topic. In the subscription's settings, turn on **keep alerting for the
highest priority** and the **Do Not Disturb override**. Then check it:
highest priority** and the **Do Not Disturb override**.

</details>

Then ring it once to check:

```bash
npx code-alarm test
```

**3. Connect your agent.**
### 2. Connect your agent

Claude Code:
**Claude Code:** add the plugin.

```bash
claude plugin marketplace add Draganoider/code-alarm
Expand All @@ -63,56 +107,78 @@ claude plugin marketplace add Draganoider/code-alarm
claude plugin install code-alarm@code-alarm
```

Codex (adds user-level hooks and a skill; open Codex afterwards and **trust the new hooks**):
**Codex:** add user-level hooks and a skill, then open Codex and **trust the new hooks**.

```bash
npx code-alarm install codex
```

## Use
## Use it

Before a long task, arm it:

| Agent | How |
| Where | How |
|---|---|
| Claude Code | `/code-alarm:alarm`, then give it the task (or say "wake me when it's done") |
| Claude Code | `/code-alarm:alarm`, then give it the task, or just say "wake me when it's done" |
| Codex | "Use the code-alarm skill and …", or "wake me when it's done" |
| Any terminal | `code-alarm arm` in the project folder; `code-alarm nap 2h` arms every session for 2 hours |

**Prefer a plain notification?** Say *quiet*: `/code-alarm:alarm quiet …`, "quietly notify me
when done", or `code-alarm arm --notify`. You get one normal notification, which pops up with sound
and vibration and follows your phone's sound settings, instead of the repeating alarm.
| Any terminal | `code-alarm arm` in the project folder, or `code-alarm nap 2h` to arm every session for two hours |

The agent ends its work with `done`, `needs-you` or `failed`, and your phone rings with that
reason. If it forgets, the alarm still rings when it stops, labelled *stopped*.

`code-alarm status` shows what's set up, what's armed and the last alerts. `code-alarm disarm`
cancels arming.
**Prefer a plain notification?** Say *quiet*: `/code-alarm:alarm quiet …`, "quietly notify me
when done", or `code-alarm arm --notify`. You get one normal notification with sound and
vibration, following your phone's sound settings, instead of the repeating alarm.

If you reinstall Code Alarm on your phone or clear its data, the phone registers afresh and this
computer's pairing stops reaching it. `code-alarm status` and `code-alarm test` say so: pair again
with `code-alarm pair`, and remove the old computer from the app's list.
## How it works

Codex's hooks run their own copy of code-alarm. After you update code-alarm, `status` says if
that copy is out of date, and `init`, `pair`, `unpair` and `use` update it for you.
<p align="center">
<img src="docs/assets/how-it-works.svg" width="100%" alt="On your computer, your armed agent's hooks call code-alarm. One small event, its kind, the folder's name and the agent, goes through the Code Alarm relay or ntfy to your phone, which rings like an alarm. Prompts, code, file paths and transcripts never leave the computer.">
</p>

## How it works
- **Arming decides.** Hooks fire for every session, but `code-alarm` only sends for work you
armed. Arming a folder lasts until its first end-of-task alert; nap mode lasts until its time is
up.
- **One small event.** An alert carries its kind, the folder's *name* (never a path), the agent,
an ID and two timestamps. That's the whole [protocol](docs/protocol.md), and
[a test](cli/test/privacy.test.ts) fails if anything else would leave.
- **Hooks stay out of the way.** They print nothing, always exit 0 and hand the send to a detached
process, so the agent never waits on the network.
- **The app has the last word.** It ignores an alert that's expired (alerts live 30 minutes), or
one it has already rung for.

```mermaid
sequenceDiagram
actor You
participant Agent as Claude Code / Codex
participant CLI as code-alarm (hooks)
participant Phone as ntfy on your phone
You->>Agent: /code-alarm:alarm + the task
Agent->>CLI: code-alarm arm
Note over Agent: works for minutes or hours
Agent->>CLI: code-alarm done (or the Stop hook)
CLI-->>Phone: {kind, folder name}, max priority
Phone->>You: rings until you dismiss it
```
Push is best-effort, as on any phone: a phone that's off, offline for a long time, or has the app
force-stopped won't ring. With the app, `code-alarm status --last` shows what happened to the last
alert: whether it rang, how long after it was sent, and when you stopped it.

Details: [event protocol](docs/protocol.md) · [agent integration notes](docs/agents.md).
## Commands

| Command | What it does |
|---|---|
| `code-alarm pair [<code>]` | Pair with the Code Alarm app, by QR or by the code the app shows |
| `code-alarm init` | Create a private ntfy topic instead, and show how to subscribe |
| `code-alarm test [--notify]` | Ring the phone now, or send a plain notification |
| `code-alarm arm [--for 12h] [--notify]` | Ring when the agent in this folder next finishes, stops or needs you |
| `code-alarm nap 2h [--notify]` | Ring for every session until the time is up |
| `code-alarm disarm [--all]` | Cancel arming for this folder, or everything |
| `code-alarm status [--last]` | What's set up, what's armed, and the last alerts |
| `code-alarm use ntfy\|app` | Switch between ntfy and the app when both are set up |
| `code-alarm unpair` | Remove this computer from the phone |
| `code-alarm install codex` | Add the hooks and skill to Codex (`uninstall codex` removes them) |

`code-alarm --help` lists every option.

## Troubleshooting

- **Nothing rings after you reinstalled the app or cleared its data.** The phone registered
afresh, so this computer's pairing points at the old install. `code-alarm status` and
`code-alarm test` say so. Pair again with `code-alarm pair`, and remove the old computer from the
app's list.
- **Codex stopped alerting after an update.** Codex's hooks run their own copy of code-alarm.
`code-alarm status` says when it's out of date, and `init`, `pair`, `unpair` and `use` refresh
it for you.
- **Anything else:** `code-alarm status` shows the last alerts and what happened to them. Bugs and
ideas are welcome in [issues](https://github.com/Draganoider/code-alarm/issues).

## Develop

Expand All @@ -124,7 +190,8 @@ npm run check

`npm run check` type-checks, runs the tests, and builds the bundle into `cli/dist/` and the Claude
Code plugin. The bundled files are committed, because plugins install straight from the repository.
To try your working copy in Claude Code: `claude --plugin-dir plugins/claude-code`.
To try your working copy in Claude Code: `claude --plugin-dir plugins/claude-code`. The rules for
contributors, human or AI, are in [AGENTS.md](AGENTS.md).

## License

Expand Down
4 changes: 2 additions & 2 deletions cli/dist/code-alarm.mjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions cli/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "code-alarm",
"version": "0.2.1",
"version": "0.2.2",
"description": "Wake up when Claude Code or Codex finishes or needs you: a real alarm on your phone, from agent hooks.",
"license": "MIT",
"author": "Yevhen Mishchenko",
Expand Down Expand Up @@ -35,7 +35,7 @@
"build": "node build.mjs",
"test": "tsc -p tsconfig.test.json && node --test \"build/test/**/*.test.js\"",
"check": "npm run typecheck && npm test && npm run build",
"prepack": "node -e \"for (const f of ['LICENSE', 'README.md']) require('node:fs').copyFileSync('../' + f, f)\""
"prepack": "node prepack.mjs"
},
"devDependencies": {
"@types/node": "^26.6.5",
Expand Down
25 changes: 25 additions & 0 deletions cli/prepack.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copies the repository's LICENSE and README into the package before `npm pack` or `npm publish`.
// The README's links and images are relative to the repository root, which npm can't resolve, so
// they're pointed at GitHub: images at the raw files on main, links at the files' pages.
import { copyFileSync, readFileSync, writeFileSync } from "node:fs";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";

const here = dirname(fileURLToPath(import.meta.url));
const root = join(here, "..");
const RAW = "https://raw.githubusercontent.com/Draganoider/code-alarm/main/";
const PAGE = "https://github.com/Draganoider/code-alarm/blob/main/";

/** Rewrites src="…", href="…" and markdown (…) targets that are relative paths. */
export function absoluteLinks(readme) {
const relative = (target) => !/^([a-z][a-z0-9+.-]*:|#|\/)/i.test(target);
return readme
.replace(/\bsrc="([^"]+)"/g, (all, target) => (relative(target) ? `src="${RAW}${target}"` : all))
.replace(/\bhref="([^"]+)"/g, (all, target) => (relative(target) ? `href="${PAGE}${target}"` : all))
.replace(/(!?)\]\(([^)\s]+)\)/g, (all, bang, target) => (relative(target) ? `${bang}](${bang ? RAW : PAGE}${target})` : all));
}

if (process.argv[1] === fileURLToPath(import.meta.url)) {
copyFileSync(join(root, "LICENSE"), join(here, "LICENSE"));
writeFileSync(join(here, "README.md"), absoluteLinks(readFileSync(join(root, "README.md"), "utf8")));
}
Loading
Loading