Skip to content
Back to skills

Session Pilot

ASecurity

Operating policy for an orchestrator agent running long sessions with session-pilot. Covers watching context and subscription quota (5-hour, weekly and per-model weekly), reading the ambient [session-pilot] lines and alerts, how many parallel subagents to run per quota tier, compacting the session with a self-contained handoff, and pausing gracefully before a quota limit and resuming after the reset. Use when orchestrating long-running or multi-subagent work, when a [session-pilot] line or al...

  • 5 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added October 18, 2026
ai-agentspythongit

Works with

  • claude code
  • mcp

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned October 18, 2026

npx -y skills add stgoddv/session-pilot --skill session-pilot --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Session Pilot?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Session Pilot
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/stgoddv-session-pilot/badge)](https://www.skillsdirectory.com/skills/stgoddv-session-pilot)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: session-pilot
description: Operating policy for an orchestrator agent running long sessions with session-pilot. Covers watching context and subscription quota (5-hour, weekly and per-model weekly), reading the ambient [session-pilot] lines and alerts, how many parallel subagents to run per quota tier, compacting the session with a self-contained handoff, and pausing gracefully before a quota limit and resuming after the reset. Use when orchestrating long-running or multi-subagent work, when a [session-pilot] line or alert appears, when context or quota is high, before compacting, or when pausing or resuming around quota resets.
---

# session-pilot: orchestrator operating policy

session-pilot gives the main agent (the orchestrator) three tools and an ambient status line. This skill is the
policy for using them: when to compact, how many subagents to run, how to pause before the quota runs out and how to
resume afterwards. It applies to the **main agent only**; subagents cannot call these tools and should ignore this
skill.

## When to use

- Long-running work that will outlive one context window or one 5-hour quota window.
- Orchestrating several subagents in parallel.
- Whenever a `[session-pilot]` line or an `ALERT` appears in a tool result.
- When the user asks to check context or quota, compact, pause or resume.

## Tools

| Tool | Input | What it does |
|---|---|---|
| `mcp__session-pilot__status` | `{ refresh?: boolean }` | Context, quota, tier, subagent count, pause state and a one-sentence recommendation. A short summary followed by a JSON block. `refresh: true` bypasses the quota cache (a few minutes old by default). |
| `mcp__session-pilot__compact` | `{ handoff: string, instructions?: string }` | Schedules a compaction for the end of the current turn, then sends `handoff` as the next message. `instructions` (optional) tells the summary what to keep. |
| `mcp__session-pilot__pause` | `{ handoff?: string, reason?: string, resume_after_minutes?: number, cancel?: boolean }` | Writes the pause file and schedules an automatic resume when the quota reset is close enough; otherwise the resume is manual. `cancel: true` cancels a scheduled resume. |

Useful fields of the `status` JSON:

- `context.percent`, `context.tokens`, `context.window`, `context.source`.
- `quota.five_hour.percent` and `.remaining_seconds`; `quota.seven_day`; `quota.seven_day_by_model[]`;
  `quota.weekly_effective_percent` (the worst of the weekly figures); `quota.source`
  (`quota.py` = full data, `native` = no per-model weekly, `unknown` = no data).
- `tier.name`, `tier.max_subagents` (`null` when the tier is `unknown`), `tier.active_subagents`.
- `pause.state` (`none`, `scheduled`, `manual`), `pause.resume_at`, `pause.file`. `manual` means a pause file exists
  that is not yet marked as resumed (see the resume protocol).

When quota.py is unavailable and only native figures are used, the reason appears in a `Note:` line of the summary
text above the JSON, not in the JSON.

Call `status` at the start of long work, before launching a batch of subagents, and before compacting or pausing.
Do not poll it in a loop: the ambient line already keeps you informed.

## Ambient lines and alerts

session-pilot appends a line to some tool results, when a threshold is crossed or every few minutes:

```
[session-pilot] ctx 61% (612k/1.0M) · 5h 52% (resets in 2h10m) · 7d 40% (resets in 3d4h) · Opus 7d 55% · tier mid: max 4 subagents (2 active)
```

Fields: context used (tokens / window), 5-hour window, weekly window, per-model weekly window (only with full quota
data), then the tier with its subagent cap and the subagents running now.

A line without `ALERT` is information only: do not reply to it or mention it to the user. That includes the line
that appears when the tier drops to a lower one after a reset. A line ending in ` — ALERT: <text>` asks for action.
Each alert fires once per threshold crossing, so act on it when you see it. When several alerts arrive together they
are chained (`— ALERT: a ALERT: b`): act on each one.

| Alert starts with | Action |
|---|---|
| `context ≥ N%` | Follow the compaction protocol. |
| `5h quota ≥ N%: tier <name>` | Apply the new cap from the tier table; never stop running subagents. |
| `5h quota ≥ N%: start a graceful pause now` | Follow the graceful pause protocol. |
| `weekly quota ≥ N%: start a graceful pause now` | Follow the graceful pause protocol (weekly rule below). |

The numbers come from the user's configuration; the defaults are used below.

## Tiers and parallel subagents

The tier follows the 5-hour window. A weekly figure at or above the weekly threshold forces the pause tier.

| Tier | 5-hour usage | Max parallel subagents | Split |
|---|---|---|---|
| low | below 50% | 6 | 5 large + 1 small |
| mid | 50% to below 70% | 4 | 3 large + 1 small |
| high | 70% to below 85% | 2 | 1 large + 1 small |
| pause | 85% or more, or weekly effective 95% or more | 0 | graceful pause |
| unknown | no quota data | not enforced by the mod | see "Edge cases" |

- **Large** subagents do substantial work: implementing a feature, a multi-file refactor, a deep investigation.
- **The small slot** is kept for minor, short tasks: a quick search, reading a file and summarizing it, running a
  check, a one-line fix, a review of a small diff. Prefer a cheaper or faster model for it when you choose models.
  Do not fill the small slot with a large task: it exists so you never have to wait for a large subagent to finish
  before doing something quick.
- The cap counts the active subagents (pending, running or waiting). Subagents launched by workflows are neither
  counted nor capped. When a spawn is denied with
  `session-pilot: tier <name> (5h quota X%) allows at most <max> parallel subagents` (`weekly quota X%` instead when
  the weekly rule set the tier), do not retry in a loop: wait for a running subagent to report, then launch.

**When the tier drops, never kill or interrupt a subagent.** The extra ones finish naturally; when they finish, do
not replace them until the running count is below the new cap. When the tier rises again (after a reset), you may
launch up to the new cap.

## Compaction protocol

Trigger: the context alert, or `status` showing context at or above the alert threshold.

1. **Wait for a clean cut point.** No subagent is mid-task (all have reported, or you have their results), and the
   work is saved: files written, tests run, and committed if the project's workflow commits. Do not start new large
   work while you wait. A cut point a few steps away is fine; do not postpone indefinitely.
2. **Write the handoff** with [references/handoff-template.md](references/handoff-template.md). It must be
   self-contained: the post-compaction agent sees only the summary and your handoff. Use absolute or repo-relative
   paths, exact commands and concrete next steps.
3. **Call `compact`** with `handoff` and, optionally, `instructions` for the summary (for example "keep the list of
   open review findings").
4. **End the turn immediately** without calling more tools. The compaction runs at the end of the turn; the handoff
   then arrives as a message headed `[session-pilot] Post-compaction handoff`.

After compaction, treat that message as your instructions: re-read the files it names, check the repo state, call
`status`, and continue from "Next steps".

There is no hard cap besides Claude Code's own auto-compact, which the user configures with `/autocompact`.
Auto-compact summarizes without your handoff, so compact yourself before it triggers.

## Graceful pause protocol

Trigger: a pause alert, or `status` showing tier `pause`.

1. **Stop launching** subagents (spawns are denied in the pause tier anyway).
2. **Ask each running subagent to wrap up** with SendMessage, for example:
   > Quota is nearly exhausted and the session will pause. Finish your current step only, save your work (no
   > half-edited files), and report: what is done, what remains, files changed, and anything I must verify.
3. **Wait for their reports**, up to about 15 minutes in total. Do not poll; their completion notices arrive on their
   own. Do not kill subagents that run late: record them in the handoff as "no report, last known task: ...".
4. **Call `pause`** with a `handoff` written from the handoff template plus the subagent reports, and a short
   `reason` (for example "5h quota at 86%"). Use `resume_after_minutes` only when the user asks for a specific time.
5. **End the turn** and tell the user in one or two lines what the result said: when the automatic resume is
   scheduled, or that the resume is manual and how to trigger it.

The pause file is always written (default `.session-pilot/pause.md` under the session's working directory). See
[references/pause-file-template.md](references/pause-file-template.md) for its content. It contains a line
`- Resume status: pending ...`; the resume protocol below says how that line is updated.

The automatic resume is tied to this session. After `/clear` or in a new session it does not fire: only a toast
pointing to the pause file remains, and the resume is manual.

**Weekly rule.** When the effective weekly usage (the worst of the general weekly figure and the per-model weekly
figure) reaches 95% or more, run the same graceful pause. If the weekly reset is less than 24 hours away, the resume
is automatic; otherwise there is only the pause file, and the user resumes manually by asking Claude to
"resume from .session-pilot/pause.md" (or the configured path).

To cancel a scheduled resume (for example the user wants to stop for the day), call `pause` with `cancel: true`.

## Resume protocol

A resume arrives as a message headed `[session-pilot] Resume after quota reset`, with the handoff and
`Pause file: <path>`, or the user asks you to resume from the pause file.

1. **Read the pause file.** It has the reason, the quota snapshot, the resume plan and the handoff.
2. **Call `status` with `refresh: true`.** If the tier is still `pause`, the reset has not happened yet: call `pause`
   again with the same handoff and end the turn.
3. **Check the repo state** against the handoff: `git status`, recent commits, the files it lists, test results. Work
   from subagents that had not reported may have landed partly; inspect it before relaunching.
4. **Relaunch according to the current tier**: up to its cap, large tasks first, the small slot for checks.
5. **Close the pause file once the work has resumed.**
   - After an **automatic** resume the mod has already rewritten the line to `- Resume status: resumed at <time>`;
     nothing more to do.
   - After a **manual** resume (the user asked you to resume from the file) nothing rewrites it. Either edit the line
     `- Resume status: pending ...` to `- Resume status: resumed at <ISO timestamp>`, or delete the file. If you do
     neither, `status` keeps reporting `pause.state: manual` and a "pause file is waiting" toast repeats in every
     session started in that folder.

## Edge cases

- **Quota unknown** (`quota.source` is `unknown`, tier `unknown`, `max_subagents` is `null`): the mod enforces no
  cap and fires no quota alerts. As your own policy, behave as tier mid (at most 4 parallel subagents) and call
  `status` with `refresh: true` now and then. If it stays unknown, tell the user once.
- **Python missing or failing** (`quota.source` is `native`): the 5-hour and general weekly figures still work, but
  there is no per-model weekly figure, so the weekly rule uses the general figure only. Tell the user once that full
  quota data needs Python 3.10+ (or the `pythonCommand` setting). Context still comes from Claude Code itself.
- **Token expired** (also shows as `native`): any message to Claude Code renews it; `status` with `refresh: true`
  later returns full data again.
- **Resume blocked by Stop**: if the user pressed Stop, the automatic resume is not submitted; session-pilot shows a
  notice and keeps it pending. If the user then asks to continue, or you find a pause file with no resume, follow the
  resume protocol by hand from the pause file. If the user wants to resume before the reset, call `pause` with
  `cancel: true` first.
- **Claude Code was closed** while a resume was scheduled: timers do not survive. On the next session the pause file
  is still there; resume from it manually (and close it as in the resume protocol).
- **New session or `/clear`**: the automatic resume is tied to the session id, so it does not fire. Resume manually
  from the pause file.
- **You are a subagent**: these tools are denied to you. Do not try to compact or pause; report to the orchestrator.

Files in this skill

  • SKILL.md12.4 KB
  • references/handoff-template.md1.7 KB
  • references/pause-file-template.md3 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.