agentleFS
yangwhaleyangwhale/CloseCrab/skills/session-handoff/SKILL.md

session-handoff

Skill5 starsChanged 3 months agoApache-2.0View on GitHub

Generate a handoff prompt that lets a fresh Claude Code session resume a complex task from a crashed/restarted CloseCrab bot session. Reads the old session jsonl plus the bot's recently-written CC Pages docs, extracts task identity / latest state / file locations / pitfalls / team coordination signals, and synthesizes a concise markdown prompt to paste into the new session. Use when a CloseCrab bot's session crashed (API error, context overflow, OOM-killed), or when the user says "wrap up this context for a new session", "give me a handoff prompt for {bot}", "{bot} 的 session 挂了写个交接", or "总结一下让新 session 接着干".

139 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 10 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

  • +1 more from SethGammon

The file

We split this skill into the rules it gives an agent

7 rules. 0 are common, 5 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 117 edited versions we read keep these.

  • 5

    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:

    Read references/handoff-template.md for:

    line 67
  2. Distinctive:

    Mine pitfalls from user corrections: Search user messages for "不要", "千万别", "为什么", "❌", "你这个怎么..." — these are pitfall-shaped statements …

    line 95
  3. Distinctive:

    Don't write HTML unless asked: Default output is the markdown prompt only.

    line 99
  4. Distinctive:

    Does not SSH to remote machines (assumes everything is on local gLinux)

    line 103
  5. Very specific:

    Does not modify sessions.json (read-only)

    line 104
  6. Distinctive:

    Does not kill the old session process

    line 105
  7. Very specific:

    Does not auto-restart the bot (user does that via /restart in 飞书)

    line 106

“Common” is measured: kept by at least 6 in 10 of the 117 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

Session Handoff

Generate a handoff prompt so a fresh Claude Code session of a CloseCrab bot can resume a long-running task without re-asking the user for context.

When this triggers

  • A bot's session crashed (API Error, context too long, OOM-killed bot.py)
  • User wants to restart a bot mid-task and preserve state
  • User says variations of: "give me a prompt for {bot}", "{bot} session 挂了,写交接", "总结一下让新 session 接着干"

Workflow

1. Run extract_session.py {bot}        →  structured markdown extract
2. Read top 1-2 most recent CC Pages   →  ground truth latest state
3. Synthesize 8-section handoff prompt →  markdown ready to paste
4. Output the prompt in chat           →  optionally save HTML brief

Step 1: Extract session signals

python3 ${SKILL_DIR}/scripts/extract_session.py {bot_name}

Or with explicit jsonl:

python3 ${SKILL_DIR}/scripts/extract_session.py --jsonl /path/to/session.jsonl

The script emits markdown sections:

  • User Messages Timeline — every [from: ...] user msg in order. Mine task evolution from this.
  • Last N Records — final tool calls / assistant turns. Confirms where it crashed.
  • Documents — cc.higcp.com Pages Mentioned — URLs the bot already wrote/referenced.
  • Recent Local cc-pages files — mtime-sorted local HTML files. ⚠️ The newest one is often newer than the jsonl — it has the freshest state.
  • GitHub URLs / Files Worked On / GCS Paths — code locations, including /lustre/, /workspace/, /tmp/claude/ paths.
  • Git Signals — branches and commit hashes mentioned.
  • Version Iterations — v1 ... vN sequence (telling for "what version is current").
  • Errors / Crash Points — API errors, OOMs, tracebacks.

Step 2: Read the freshest CC Pages

Identify the 1-2 most recent HTML files from the "Recent Local cc-pages files" section. These are usually the bot's own status/plan documents written after the most recent debugging round.

# Strip HTML tags for plain-text reading
python3 -c "
import re, html
raw = open('/usr/local/google/home/chrisya/gcs-mount/cc-pages/pages/{file.html}').read()
t = re.sub(r'<script.*?</script>', '', raw, flags=re.DOTALL)
t = re.sub(r'<style.*?</style>', '', t, flags=re.DOTALL)
t = re.sub(r'<[^>]+>', ' ', t)
print(html.unescape(t)[:8000])
"

Why this matters: the jsonl captures conversation, but the bot often writes the final state ("✅ commit d905b434 pushed", "40L sanity PASS", "next: extend to 61L") into an HTML doc after the last conversation turn. Trust the HTML.

Step 3: Synthesize the 8-section prompt

Read references/handoff-template.md for:

  • The 8 required sections
  • The format skeleton
  • Synthesis hints for picking content from the extract

The 8 sections (中文 by default — matches user's working language):

  1. 角色 + 任务一句话
  2. 当前最新状态(带 ✅❌⏳ + 具体数字)
  3. 必读文档链接(按优先级)
  4. 关键文件位置(已 patched,不要重写)
  5. 绝对不要再踩的坑
  6. Node pool / 资源现状
  7. 团队 + 沟通规则
  8. 第一步具体行动清单(精确到 kubectl / git / curl 命令)

Target length: ~80 lines. If detail overflows, link to a HTML brief.

Step 4: Output to user

Print the prompt as a fenced markdown block in chat, ready to copy-paste.

Key principles

The extract is mechanical, the synthesis is judgmental. The script gives you raw signals. Picking which user message captures the "real task", which version is current, which pitfalls actually matter — these all require reading and judgment.

Trust HTML > jsonl for state. The bot writes its final status to CC Pages after the last conversation turn. Use the HTML for §2.

Mine pitfalls from user corrections. Search user messages for "不要", "千万别", "为什么", "❌", "你这个怎么..." — these are pitfall-shaped statements where the user told the bot to stop doing something.

Concrete > abstract. §8 first-step list should have actual commands the bot can run, not "check the status".

Don't write HTML unless asked. Default output is the markdown prompt only. Generate a HTML brief on cc.higcp.com only if the user explicitly asks for one or if the prompt would otherwise exceed 100 lines.

What this skill does NOT do

  • Does not SSH to remote machines (assumes everything is on local gLinux)
  • Does not modify sessions.json (read-only)
  • Does not kill the old session process
  • Does not auto-restart the bot (user does that via /restart in 飞书)

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.