# Controlled job setup and diagnosis

Example task to paste into a coding agent with this skill installed:

> In my sandbox project, set up a dedicated Monitor and Signal for the staging
> backup verification job. It should check in every five minutes. Use synthetic
> data and disable callbacks. Send one numeric reading, inspect its history,
> then observe a missed-beat incident and recovery. Do not edit my job or create
> a background sender. Ask before pausing the test resources afterward.

This example authorizes only those changes in the selected sandbox. An incident
exercise can alert people if existing resources/default destinations are used;
use dedicated resources with callbacks disabled and agree on a bounded wait.
Do not intentionally interrupt a production publisher to manufacture an incident.

## 1. Inspect the connection and placement

Call `signalsitter_get_organization`, `signalsitter_get_project`, then
`signalsitter_get_default_jurisdiction`, with empty inputs. Confirm the returned
context against the request. Read `signalsitter_list_monitors` and
`signalsitter_list_signals` when reconciling a prior setup; follow page cursors
as needed. Keep returned IDs, keys and jurisdiction distinct.

## 2. Create the dedicated Monitor and Signal

After the request authorizes this setup, call `signalsitter_create_monitor`:

```json
{
  "name": "Staging backup verification",
  "callback": { "kind": "disabled" },
  "signal": {
    "kind": "create",
    "settings": {
      "name": "Staging backup check-in",
      "heartbeat": {
        "mode": "period",
        "periodSeconds": 300,
        "lateGraceSeconds": 60
      },
      "callback": { "kind": "disabled" }
    }
  },
  "idempotencyKey": "sandbox-backup-setup-01",
  "confirm": true
}
```

Choose one fresh stable idempotency key for this authorized setup, then preserve
it for retries. Omitted jurisdiction uses the returned default only when it is
available; otherwise choose an available placement with the user. Capture the
result's `monitorKey`, `jurisdiction`, `signal.signalId`, `signal.signalKey` and
`publishUrl`. In v1 responses, `monitorKey` is the historical field name for the
public Monitor ID: pass that value as `monitorId` in MCP inputs. It is distinct
from the Signal key used to publish. Do not derive a URL from the Monitor ID.

For an existing feed, use `signal: {kind: "link", signalId: "…"}` instead.
Linking preserves its heartbeat configuration. Changing a shared Signal affects
every linked Monitor and needs that scope explicitly authorized.

## 3. Send a controlled reading

MCP has no live publish tool. `signalsitter_test_monitor_beat` is a dry run and
does not record a reading, satisfy a heartbeat or create a real incident. Use
CLI/REST to ingest, with the user's credential already supplied privately.
OAuth MCP sign-in does not by itself put an API key in a shell; if one is absent,
have the user provision it privately or run the supplied command themselves.

With the returned Signal key (shown here as a synthetic example):

```bash
signalsitter signals publish sandbox-backup-feed --data '{"backup_bytes":2048}' --json
```

Use the returned jurisdiction via `--jurisdiction eu` when applicable. The CLI
selects its supported ingest origin. For REST, use the exact returned publish
URL; place it in `SIGNALSITTER_PUBLISH_URL`, a separate noncredential variable:

```bash
curl --fail-with-body --request POST \
  --header "Authorization: Bearer $SIGNALSITTER_API_KEY" \
  --header 'Content-Type: application/json' \
  --header 'Idempotency-Key: sandbox-backup-reading-01' \
  --data '{"backup_bytes":2048}' \
  "$SIGNALSITTER_PUBLISH_URL"
```

For a check-in without a numeric measurement:

```bash
signalsitter signals publish sandbox-backup-feed --json
```

Run only the send the user authorized; the numeric beat also satisfies a
heartbeat. Numeric readings are stored data; empty heartbeats on a scheduled
Signal may be receipt-only unless full-beat retention is enabled. Read the
acceptance response; an event ID for an unretained heartbeat does not promise a
fetchable history row. Do not enable retention merely to make that row appear.

## 4. Inspect history, incident and recovery

Replace example IDs with returned values. Call `signalsitter_get_monitor`:

```json
{ "monitorId": "sandbox-backup-monitor", "jurisdiction": "eu" }
```

Call `signalsitter_get_signal`:

```json
{ "signalId": "sandbox-backup-signal" }
```

Read `signalsitter_list_monitor_observations` for the linked Signal's stored
readings, with bounded pagination:

```json
{ "monitorId": "sandbox-backup-monitor", "jurisdiction": "eu", "limit": 10 }
```

Use `signalsitter_list_signal_activity` to inspect receipt-only check-ins:

```json
{ "signalIds": ["sandbox-backup-signal"] }
```

For an explicitly authorized incident exercise, wait until the Signal's
expected deadline plus grace and bounded processing time. Poll reads with
backoff and a stated time limit; do not keep an unbounded agent session alive.
Otherwise diagnose an existing incident or report that none exists. Call
`signalsitter_list_incidents` using the **Signal** for missing beats:

```json
{ "signalId": "sandbox-backup-signal", "limit": 10 }
```

Take the incident ID from the result, then call `signalsitter_get_incident` and
`signalsitter_get_incident_timeline` with the same input shape:

```json
{ "signalId": "sandbox-backup-signal", "incidentId": "sandbox-backup-incident" }
```

For rule incidents use `monitorId` instead of `signalId`; never pass both.
Read the reason and timeline before diagnosing. If recovery was authorized,
send one further synthetic beat and read the incident/timeline again. A
missing-beat incident can close automatically when beats resume. Manually
resolving an incident is a separate confirmed action, not proof of recovery.

## 5. Pause or cancel the test setup

Describe the exact Monitor/Signal and consequences; request explicit confirmation
if the user has not already authorized the pause. Read each current version.
After approval, call `signalsitter_control_monitor_lifecycle`:

```json
{
  "monitorId": "sandbox-backup-monitor",
  "jurisdiction": "eu",
  "action": "pause",
  "expectedConfigurationVersion": 1,
  "idempotencyKey": "sandbox-backup-pause-monitor-01",
  "confirm": true
}
```

Then call `signalsitter_control_signal_lifecycle` to stop missing-beat alerts:

```json
{
  "signalId": "sandbox-backup-signal",
  "action": "pause",
  "expectedLifecycleGeneration": 0,
  "confirm": true
}
```

The numbers above are illustrative; send versions just read, not hard-coded
defaults. Verify both resources afterward. Neither pause deletes history or
stops ingestion. If the user cancels the proposed pause, send neither call and
state that monitoring remains active. If they ask to stop ingestion, explain
the Signal archive action and obtain that specific authorization. Deletion is
permanent and is unnecessary for this controlled journey.
