agentleFS
ai-analyst-labai-analyst-lab/ai-analyst/.claude/skills/session-handoff/SKILL.md

session-handoff

Skill304 starsChanged 2 months agoMITView on GitHub

Preserve critical state when a session approaches context limits so the next session can pick up seamlessly. Use this skill whenever you're in a long, multi-step workflow, working with Google Workspace resources (Docs, Slides, Drive), creating external resources that have IDs you need to track, running multi-step pipelines that might need to be resumed, approaching context limits, or when the user says things like "save state", "let's pause", "I'll come back later", "save progress", "I need to stop for now", "bookmark this", "save my work", or when you detect that a workflow involves multiple phases and the user might return later. This skill is CRITICAL after creating Google Docs, Slides, or Drive files — those resource IDs are impossible to recover if lost. Also apply proactively during analysis pipelines after major phases complete (data exploration done, charts generated, narrative written, deck created) so users can resume at natural checkpoints. Write session state immediately after any external resource creation, not just at the end. If context is getting long and you haven't saved state yet, do it now before you forget. This prevents lost work when context compaction occurs or users start new conversations.

143 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use ascii-diagram, research-fleet and 9 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • SethGammonSkill

    ascii-diagram

    Generate perfectly aligned ASCII diagrams — architecture, flow, sequence, box-and-arrow. Uses a programmatic character-grid approach so alignment is guaranteed by math, not token prediction. Includes post-render verification.

    Also in 4 projects that use this

  • SethGammonSkill

    research-fleet

    Parallel research using Fleet wave mechanics. Spawns multiple scout agents, each investigating a different angle of the same question. Findings are compressed between waves. Produces a unified research brief from multiple independent perspectives.

    Also in 3 projects that use this

  • vicoa-aiSkill

    live-preview

    Start a local app in the current user project, expose it through a tunnel, and return preview details in structured Markdown. Use when the user asks for a preview URL, public URL, shareable localhost, mobile/web preview, or tunnel setup.

    Also in 4 projects that use this

  • botlearn-aiSkill

    doc-gen

    Also in 4 projects that use this

  • flyingobsidianSkill

    terminology

    Read a codebase, find terminology, create/update definitions into a markdown document.

    Also in 3 projects that use this

  • Dizzy-TenSkill

    bug-diagnosis

    Diagnose bugs and product issues without modifying code. Use when the user explicitly invokes $bug-diagnosis or asks for diagnosis, root-cause analysis, issue classification, or fix strategy for code bugs, failing tests, configuration/dependency problems, deployment issues, performance regressions, data anomalies, or frontend/user-experience problems described through screenshots, annotations, logs, errors, or natural-language reports. Prioritize analysis and recommendations only; do not edit files.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

10 rules. 0 are common, 8 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 121 edited versions we read keep these.

  • 8

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before any pause point where the user might come back later

    line 20
  2. Very specific:

    Write to the EXACT path working/session_state.yaml (not session_state_handoff.yaml or any variant).

    line 26
  3. Distinctive:

    After creating any Google resource (doc, slides, Drive file)

    line 124
  4. Distinctive:

    After completing a major pipeline phase (analysis, charting, doc creation)

    line 125
  5. Distinctive:

    After any long stretch of tool calls in one workflow (the same trigger as "When to Apply" above)

    line 126
  6. Distinctive:

    Before any operation that might run long (batch chart generation, etc.)

    line 127
  7. Very specific:

    Read working/session_state.yaml if it exists

    line 140
  8. Distinctive:

    Verify external resources still exist (quick API call to check doc/slides)

    line 141
  9. Distinctive:

    Check auth (run auth-preflight skill)

    line 142
  10. Distinctive:

    Auth email is critical state: Always include the exact email used for Google Workspace MCP calls — this is the #1 source of auth failures.

    line 173

“Common” is measured: kept by at least 6 in 10 of the 121 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Skill: Session Handoff

Purpose

Preserve critical state when a session approaches context limits, so the next session (or /resume-pipeline) can pick up seamlessly. Prevents lost work when context compaction occurs or the user starts a new conversation.

When to Apply

Automatically when:

  • A long multi-step workflow is in progress
  • A multi-step Google Workspace workflow is in progress
  • The pipeline involves external resource IDs (doc IDs, slide IDs, Drive folders)
  • Before any pause point where the user might come back later

What to Save

Write to the EXACT path working/session_state.yaml (not session_state_handoff.yaml or any variant). The /resume-pipeline command looks for this specific file path.

This file MUST be comprehensive, regardless of how simple the handoff seems. Capture ALL of the following information:

Required Fields (always include):

  • ✅ Dataset name and connection details
  • ✅ Task description (what analysis/work is in progress)
  • ✅ Pipeline progress (what's complete, what's next)
  • ✅ All external resource IDs (Google Docs, Slides, Drive files) with URLs
  • ✅ Local file inventory (working/ and outputs/ directories)
  • ✅ Auth state (user email, last verified date)
  • ✅ Known issues or blockers (write "None" if no issues)
  • ✅ Resume instructions (step-by-step guide)

The Template (Use This Every Time)

Use the complete template. Fill every section (an empty section is "None"), because the next session has no other context.

Template:

# Session State — auto-generated by session-handoff skill
# Last updated: {{DATE}} {{TIME}}

dataset: "{{DATASET_NAME}}"
task: "brief description of what we're doing"

# External resource IDs (Google Workspace, etc.)
resources:
  google_doc:
    id: "18MTagnf_z5..."
    title: "Document Title"
    url: "https://docs.google.com/document/d/18MTagnf.../edit"
    status: "content complete, needs formatting review"
  google_slides:
    id: "1in6mkRf..."
    title: "Deck Title"
    url: "https://docs.google.com/presentation/d/1in6mkRf.../edit"
    status: "12 slides built, reviewer passed"
  drive_folder:
    id: "1PV9ols..."
    name: "Folder Name"
  drive_files:
    - id: "1abc..."
      name: "01_chart.png"
    - id: "2def..."
      name: "02_chart.png"

# Pipeline progress
pipeline:
  last_completed_step: "chart generation"
  current_step_status: "narrative draft 80% complete — context and findings done, recommendations need 2 more paragraphs"  # Use this for partially-complete steps
  next_step: "Google Doc creation"
  steps_remaining:
    - "Create Google Doc with proper image placement"
    - "Run Google Doc Reviewer"
    - "Final review of both deliverables"

# Local file inventory
local_files:
  charts:
    - outputs/charts/01_height_crossover.png
    - outputs/charts/02_height_gap.png
  data:
    - outputs/ms_case_study/data.csv
  working:
    - working/narrative_draft.md
    - working/storyboard.md

# Auth state (REQUIRED)
auth:
  google_email: "user@example.com"  # If not provided by user, check working files or note "unknown — verify at resume"
  last_verified: "2026-03-05"
  notes: "Tokens expire between sessions — expect re-auth"

# Known issues or blockers (REQUIRED — use "None" if no issues)
issues:
  - "Google Doc images overlap with text — needs rebuild with proper placement"
  - "Doc heading formatting was applied manually, may need re-check"
  # OR if no issues:
  # - "None — all work completed successfully"

# Resume instructions (REQUIRED)
resume:
  command: "/resume-pipeline"
  steps:
    - "Verify auth for {{auth.google_email}}"
    - "Load external resources"
    - "Continue from: {{pipeline.next_step}}"

When to Write

Proactive triggers (write automatically):

  • After creating any Google resource (doc, slides, Drive file)
  • After completing a major pipeline phase (analysis, charting, doc creation)
  • After any long stretch of tool calls in one workflow (the same trigger as "When to Apply" above)
  • Before any operation that might run long (batch chart generation, etc.)

Reactive triggers (write when prompted):

  • User says "save state", "let's pause", "I'll come back later"
  • Context compaction warning from the system
  • /resume-pipeline is likely needed

How to Resume

At session start, check for existing state:

  1. Read working/session_state.yaml if it exists
  2. Verify external resources still exist (quick API call to check doc/slides)
  3. Check auth (run auth-preflight skill)
  4. Report status to user:
Resuming from previous session:
- Google Doc: [title] — [status]
- Google Slides: [title] — [status]
- Charts: [N] uploaded to Drive
- Next step: [description]
- Auth: [OK/needs re-auth]

Rules

  1. Write state after every external resource creation. A Google Doc ID is impossible to recover if lost — save it immediately.
  2. Include URLs, not just IDs. The user needs clickable links to verify their resources.
  3. Describe status in plain English. "content complete, needs formatting review" is more useful than a boolean flag.
  4. Reference, don't copy. Point at file paths instead of pasting narratives or data into the state file.
  5. Overwrite, don't append. Each write is a complete snapshot. The file should reflect current state, not a history log.
  6. Auth email is critical state. Always include the exact email used for Google Workspace MCP calls — this is the #1 source of auth failures. If the user hasn't mentioned their email, check for it in working files or previous MCP calls. If truly unknown, note "email unknown — verify at resume time".

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.