Session resume

From the-agency-ai/the-agency · View interactive version

Session resume is an AI agent skill from the GitHub repository the-agency-ai/the-agency. Full session startup for worktree agents — shells to session-pickup --from fresh (sync master + preflight), reports state (handoff mode, dispatch drift, monitor health), relaunches dead monitors, hands back next-action.

How to use this skill

Skill file

<!--

Flag #62/#63: allowed-tools removed. Inherits Bash(*) from

.claude/settings.json. Restricting to specific subcommand patterns at the

skill level silently blocks agents on permission prompts the agent cannot

see — see dispatch #171 for the devex incident that surfaced this trap.

-->

Session Resume

Why this exists

Worktree sessions don't start on a clean slate — master has moved, dispatches have accumulated, the handoff holds carry-over context, monitors need to be live. Without a disciplined startup, agents miss overnight dispatches, work on stale master, forget the last session's next-action, or run without the ISCP monitor so new dispatches arrive silently.

This skill shells to agency/tools/session-pickup --from fresh for the mechanics (sync, preflight, state report) and acts on the output — re-launches dead monitors, surfaces drifted dispatches, hands the agent a clean re-orient point.

PICKUP-for-fresh surface. Paired with /session-end on the other side. Contrast /compact-resume (post-compact, trimmed — no sync, no full preflight).

Required reading

Usage

/session-resume

No arguments. Self-contained. Works from any branch; on master, the sync step silently no-ops (but the rest still runs — it's the mid-session resync path too).

Preconditions

  1. Agency tooling installed (agency/tools/session-pickup, session-preflight, worktree-sync, dispatch, handoff).
  2. Worktree readable, agent identity resolves correctly.
  3. A prior session wrote a handoff (usually via /session-end). First-session-in-worktree is tolerated — pickup reports aborted or an empty next_action in that case.

Flow / Steps

Step 1: Run session-pickup primitive

./agency/tools/session-pickup --from fresh

--from fresh runs worktree-sync --auto and session-preflight in addition to the common PICKUP steps (read handoff, check tree, count dispatch drift, probe monitor health). Preflight failure → status=blocked.

Parse key=value output. Key fields: handoff_mode, pause_commit_sha, next_action, tree_state, dispatches_unread, dispatches_drift_since_pause, monitor_health_{dispatch,ci,issue}, status, error_reason.

Step 2: Handle status

Step 3: Re-launch dead monitors

For each monitor_health_* = dead, invoke the corresponding skill (NOT monitor-register directly):

unknown types aren't registered — probably weren't running. Leave alone unless the agent wants them.

Step 4: Surface dispatch drift + unread

If dispatches_unread > 0, list via ./agency/tools/dispatch list --status unread. An unread dispatch is a blocked person — read before starting new work (standing priority). dispatches_drift_since_pause is the subset that arrived after the prior PAUSE commit — usually what to focus on first.

Step 5: Report and hand off

Report to the user:

Agent resumes from next_action.

Failure modes

What this does NOT do

Status

active (v2 refactored in session-lifecycle-refactor Phase 3 Iteration 3.4 — body collapsed from ~125 lines to ~90, now shells to session-pickup). Paired with /session-end, /compact-resume.

Related

OFFENDERS WILL BE FED TO THE — CUTE — ATTACK KITTENS!

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.