---
name: token-session-kickstart
description: Schedules a minimal one-token remote Haiku session to fire at the exact moment the user's 5-hour Claude token window refreshes, so the new window starts immediately. Use whenever the user mentions their session is ending soon, wants to "kickstart" a new token window, says "my 5-hour session ends in X minutes", "schedule a session refresh", "kickstart my token window", or wants to maximize usable tokens per hour by pre-starting the next window.
---

Schedule a one-token remote Haiku session to fire at the exact moment the 5-hour Claude usage window resets.

## Why this matters

Claude Pro/Max plans use a 5-hour rolling token window. By firing a minimal task the instant the window resets, the new clock starts immediately. When the user resumes real work, they're already partway into the next cycle — maximizing tokens available in any given burst.

## Step 1: Get the window end time

The reset time is server-side only — no local file or API exposes it. Try these sources in order:

### Path A — Chrome MCP (preferred, fully automatic)

Check if `mcp__claude-in-chrome__*` tools are available (look for them in connected MCPs or load via ToolSearch). If connected:

1. Navigate to `https://claude.ai/settings/usage`
2. Read the "Current session — Resets in X min" value from the page
3. Compute `fire_at`:
   ```bash
   python3 -c "
   from datetime import datetime, timezone, timedelta
   mins = <X>  # extracted from page
   fire_at = datetime.now(tz=timezone.utc) + timedelta(minutes=mins, seconds=30)
   print(f'fire_at: {fire_at.strftime(\"%Y-%m-%dT%H:%M:%SZ\")}')
   print(f'Local:   {fire_at.astimezone().strftime(\"%I:%M %p %Z\")}')
   "
   ```
4. Confirm with the user: "Detected reset in X min (fire_at = HH:MM local) — does that match your dashboard?" Wait for explicit confirmation before proceeding.

If the Chrome extension is closed/disabled, the tool call will fail — fall through to Path B.

### Path B — Ask the user

Say: "Chrome MCP isn't available. Check https://claude.ai/settings/usage → 'Resets in X min' and tell me the value."

Once they provide it, compute `fire_at`:
```bash
python3 -c "
from datetime import datetime, timezone, timedelta
mins = <X>  # user-provided
fire_at = datetime.now(tz=timezone.utc) + timedelta(minutes=mins, seconds=30)
print(f'fire_at: {fire_at.strftime(\"%Y-%m-%dT%H:%M:%SZ\")}')
print(f'Local:   {fire_at.astimezone().strftime(\"%I:%M %p %Z\")}')
"
```

**Never use the JSONL fallback** — it only sees Claude Code sessions and will be hours off if Claude.ai chat was used. Never assume confirmation; always wait for the user to explicitly confirm the time before scheduling.

## Step 2: Load RemoteTrigger

```
ToolSearch: { "query": "select:RemoteTrigger", "max_results": 1 }
```

## Step 3: Create the kickstart routine

Use this body (generate a fresh lowercase v4 UUID for `events[].data.uuid`):

```json
{
  "name": "[util] token-kickstart HH:MM ET",
  "run_once_at": "YYYY-MM-DDTHH:MM:SSZ",
  "enabled": true,
  "job_config": {
    "ccr": {
      "environment_id": "env_01ThgKwovKTpvNexvtqNnE3S",
      "session_context": {
        "model": "claude-haiku-4-5-20251001",
        "sources": [],
        "allowed_tools": []
      },
      "events": [
        {
          "data": {
            "uuid": "<fresh lowercase v4 uuid>",
            "session_id": "",
            "type": "user",
            "parent_tool_use_id": null,
            "message": {"content": "ok", "role": "user"}
          }
        }
      ]
    }
  }
}
```

Note the returned `trigger.id` — you'll need it in Step 4.

**Naming convention:** always prefix with `[util]` so it's visually distinct from real work routines when reviewing at claude.ai/code/routines. Format: `[util] token-kickstart HH:MM ET`.

## Step 4: Create the cleanup routine

Compute `cleanup_at` = `fire_at` + 5 minutes. Then create a second routine whose CCR job deletes the kickstart routine by ID:

```bash
python3 -c "
from datetime import datetime, timezone, timedelta
fire_at = datetime.strptime('<fire_at>', '%Y-%m-%dT%H:%M:%SZ').replace(tzinfo=timezone.utc)
cleanup_at = fire_at + timedelta(minutes=5)
print(cleanup_at.strftime('%Y-%m-%dT%H:%M:%SZ'))
"
```

Create this routine (replace `<kickstart_trigger_id>` with the ID from Step 3, and generate a fresh UUID):

```json
{
  "name": "[util] token-kickstart-cleanup HH:MM ET",
  "run_once_at": "<cleanup_at>",
  "enabled": true,
  "job_config": {
    "ccr": {
      "environment_id": "env_01ThgKwovKTpvNexvtqNnE3S",
      "session_context": {
        "model": "claude-haiku-4-5-20251001",
        "sources": [],
        "allowed_tools": ["RemoteTrigger"]
      },
      "events": [
        {
          "data": {
            "uuid": "<fresh lowercase v4 uuid>",
            "session_id": "",
            "type": "user",
            "parent_tool_use_id": null,
            "message": {
              "content": "Delete the RemoteTrigger routine with ID <kickstart_trigger_id>, then delete the cleanup routine with ID <cleanup_trigger_id> (your own ID).",
              "role": "user"
            }
          }
        }
      ]
    }
  }
}
```

Note: `<cleanup_trigger_id>` is the ID returned from THIS create call — set it in the message before creating. So compute cleanup_trigger_id after creation and update the message, OR just instruct the CCR job to delete any `[util] token-kickstart*` named routines.

**Simpler message alternative** (avoids the circular ID problem):

```
"Delete all RemoteTrigger routines whose names start with '[util] token-kickstart'. Use RemoteTrigger list action to find them, then delete each one."
```

## Step 5: Confirm

Output both URLs:
- Kickstart: `https://claude.ai/code/routines/{kickstart_id}`
- Cleanup: `https://claude.ai/code/routines/{cleanup_id}`

## Notes

- Model must be `claude-haiku-4-5-20251001` — cheapest, minimum token burn.
- `sources: []` and `allowed_tools: []` for the kickstart; cleanup needs `["RemoteTrigger"]`.
- The 30-second buffer in `fire_at` ensures the window has fully reset before the task fires.
- If the detected `time remaining` is under 3 minutes, warn the user — scheduling overhead may miss the window.
- The cleanup routine fires 5 minutes after the kickstart and self-deletes both routines via the `[util] token-kickstart*` name pattern.
- Environment ID `env_01ThgKwovKTpvNexvtqNnE3S` is the Default cloud environment for this account.
