# Handler
<!--
ref: @protocol/handler
type: protocol
tags: [handler, impulse, agent, responsibility, escalation, cadence, watcher]
triggers: [handler, who is handling, take ownership, drive impulse, watcher, escalation, handoff]
trigger_prompt: When a task is assigned but lacks active management, or when a handler needs to transfer responsibility to another agent.
version: 4
updated_at: 2026-10-24T21:11:15.274Z
-->

A **handler** is an agent — human or AI — who has taken responsibility for an impulse.

Assignee names who *should* do the work. Handler names who is *actively driving* it. The two often coincide; they don't have to. Multiple agents can be assignees; only one is handler at a time.

## Why distinguish handler from assignee

- An impulse can be assigned without anyone driving it. That is the failure mode: assigned, untouched, rotting.
- An impulse can be handled by an agent who is not the assignee — for example, a watcher process running on behalf of the operator, or a deputy temporarily covering.
- The handler relationship is the contract that says: *something is going to happen here at the right cadence, and you'll hear about it when it matters.*

## Contract

When you accept handler role on an impulse, you commit to four things:

1. **Maintain awareness** at the cadence the impulse demands.
2. **Route signals** — answer easy ones inline, escalate hard ones to the right channel.
3. **Report milestones** — surface progress so others can rely on the impulse without polling it themselves.
4. **Close the loop** — explicitly mark the impulse `satisfied`, `skipped`, or `canceled` rather than letting it linger.

Failing to do any of these is grounds for the operator to reassign the handler.

## Cadence — three tiers

Different impulses demand different watching. A handler must declare its cadence so others can predict latency.

| Tier | When to use | Latency expectation |
|---|---|---|
| **Daily review** | Long-range goals, weekly intents, "check on this tomorrow" tasks | Hours, not minutes. Handler reads the impulse once a day, advances or reports. |
| **Periodic poll** | System heartbeats, cron-shaped impulses, integration syncs | Minutes. Watcher fires on a schedule (`metadata.recurrence`), self-resolves, reports only on signal. |
| **Moment-to-moment monitor** | Active sessions (tmux panes, in-flight deploys, customer interactions, agent runs) | Seconds. Persistent watcher with a deduped poll loop; escalates immediately on signal. |

Cadence is recorded in `metadata.poll_cadence` (e.g. `"daily"`, `"5m"`, `"120s"`, `"monitor"`).

## Schema additions

When you take handler role, populate these on the impulse:

| Field | Purpose |
|---|---|
| `metadata.handler` | your agent ID (`@user/agent` form preferred) |
| `metadata.poll_cadence` | one of the three tiers above, or a duration |
| `metadata.escalate_to` | channel/agent for hard signals (e.g. `telegram:operator`, `@team/oncall`) |
| `metadata.report_cadence` | how often you'll surface progress (e.g. `30m`, `daily`, `on_milestone`) |
| `metadata.activated_at` | ISO timestamp when handler role was taken |
| `metadata.activated_by` | who installed this handler (operator or upstream agent) |

The impulse itself stays whatever `type` it was. Handler is a role layered on top, not a new type.

## Lifecycle

```
activate → watch → route → report → deactivate
```

1. **Activate** — set the schema fields above. Append a digest entry: `{action: "activate", agent: <handler>, at: <now>}`. Move state to `in_progress` if not already.

2. **Watch** at declared cadence. Each watch tick: capture state of the underlying target (session output, API state, file mtime, etc.), dedup against last observation, classify the signal.

3. **Route** based on classification:
   - **Easy signal** (a yes/no the handler can answer, a continuation prompt) → respond inline at the target.
   - **Hard signal** (question requiring judgment, error, stall) → escalate to `metadata.escalate_to`.
   - **Milestone** (commit, deploy, completion line) → report to operator at `metadata.report_cadence`.
   - **No signal** → continue watching.

4. **Report** at `metadata.report_cadence`, regardless of signal — so silence isn't ambiguous.

5. **Deactivate** when the goal is reached or the operator releases the handler. Set `status: done`, `state: satisfied | skipped | canceled` as appropriate. Stop the watcher. Append digest `{action: "deactivate", agent: <handler>}`.

A handler does **not** stop watching when it escalates. Escalation is a routing decision; deactivation is an explicit close.

## Handoff

If a handler must release responsibility before the impulse is done:

1. Append digest `{action: "handoff", agent: <current_handler>, note: <reason>}`.
2. Update `metadata.handler` to the new agent (or `null` to mark unhandled).
3. Notify the new handler via `metadata.escalate_to`.

Handoff is the legitimate way to drop an impulse. Silently abandoning it violates the contract.

## Extending this protocol

Personal or team handler protocols extend this one with implementation specifics:

- A Claude Code session handler might define Telegram via `@user/my-agent` for `metadata.escalate_to`, a 30-minute report cadence, and specific signal regexes for tmux output classification.
- An on-call handler might define PagerDuty as the escalation channel and a 5-minute monitor cadence.
- A weekly-review handler might define `daily` cadence, no immediate escalation, and a Friday digest as the report rhythm.

The personal protocol describes *how* a particular agent fulfills the contract. This protocol describes *what the contract is*.

A personal extension typically implements the moment-to-moment tier, e.g. for tmux sessions.

---

*Related: `@protocol/protocol-api-write-traps` · `@protocol/stuck` · `@protocol/capture` · `@protocol/ask-lifecycle` · `@protocol/example-impulse`*

---

*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*

*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*