CommunityProductivity & Collaborationgithub.com

crisp-agent-handoff

Seamless agent-to-agent work handoff. Use when a task must transfer from one agent session to another, whether the source is a native chat export, a shared conversation link, or a third-party agent conversation page. Produces a structured handoff envelope that preserves task state, decisions, artifacts, and immediate next steps without context collapse. Triggers: hand off this session, continue from where the previous agent stopped, take over this conversation, hand this work over to a new agent, hand off to the next session.

What is crisp-agent-handoff?

This skill, called 'Agent Handoff Seamless,' is designed for technical users of AI agents (e.g., Claude Code, Cursor, Codex) to transfer work between agent sessions without losing context. It extracts task state from various sources such as native chat exports, shared conversation links (from ChatGPT, Claude, Gemini, etc.), pasted transcripts, or verbal descriptions. The skill then structures this information into a `handoff_envelope` with fields for completed work, remaining tasks, immediate next steps, key decisions, and artifacts, ensuring the receiving agent can continue seamlessly. It is particularly useful when a task exceeds an agent's context budget, requires a different capability, or when a user wants to continue work from another session. The skill enforces design principles to prevent context collapse, such as avoiding re-summarization and separating completed from remaining work, and includes validation and failure recovery mechanisms.

Works with✓Claude Code~Codex CLI~Cursor✓Gemini CLI
npx skills add https://github.com/justcrisp/crisp-skills/tree/HEAD/skills/crisp-agent-handoff

Installed? Explore more Productivity & Collaboration skills: steipete/gemini, steipete/gh-issues, steipete/skill-creator · View all 6 →

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

Agent Handoff Seamless

1. Activation

Trigger this skill when:

  • The user says "hand this work over to a new agent", "hand off this session", "continue from where the previous agent stopped", or equivalent.
  • A task exceeds the current agent's context budget or capability boundary.
  • A shared conversation link (ChatGPT / Claude / Gemini / Grok / DeepSeek / Kimi / Qwen / Perplexity, etc.) is provided and the user asks the receiving agent to take over the work described in it.
  • A previous agent's exported file (Markdown, HTML, JSON, .webarchive, .mhtml) is available as the source of the handoff.

Do not trigger for simple summarization tasks where the user only wants a recap. This skill produces an actionable handoff, not a summary.

2. Design Principles

These principles are non-negotiable and override convenience shortcuts.

P1 - No re-summarization of raw material. The most common handoff failure is context collapse: Agent A summarizes its full analysis for B, B summarizes that summary for C, and critical constraints disappear. The receiving agent must receive structured state plus access to raw artifacts, not a summary of a summary.

P2 - Separate completed work from remaining work. A partial handoff must explicitly distinguish what is closed and needs no re-examination from what the receiving agent is now responsible for. Mixing the two is the second most common failure mode.

P3 - Every immediate next step must be independently verifiable. Write steps as concrete actions with a pass/fail check, not vague intentions.

P4 - Bounded handoff chain. Cap at 3 hops; refuse at 4 or more. If the chain exceeds this, escalate to a hub or restructure the task rather than chaining further.

P5 - Prefer structured output over natural-language prose. The receiving agent needs parseable fields (status enums, file paths, decision records) more than fluent narrative.

3. Handoff Pipeline

Execute the following stages in order. Do not skip Stage 1.

Stage 0 - Chain Depth Check

Before anything else, determine how many handoffs have already occurred. Check the current conversation for prior handoff markers, or ask the user directly.

DepthAction
0-1Proceed normally.
2-3Proceed, but set chain_warning: true in the envelope.
>= 4Stop. Emit: "This handoff chain exceeds the recommended depth. Consolidate at a hub or restructure before continuing." Do not produce a new envelope.

Stage 1 - Source Discovery

Identify what the handoff source actually is. Never assume; verify.

Source typeSignalPrimary extraction path
native_exportUser provides a .md, .html, .json, .webarchive, or .mhtml file, or says "exported from the old agent"Direct file read; see 2.1
share_linkUser provides a URL matching chatgpt.com/share/, claude.ai/share/, gemini.google.com/share/, grok.com/share/, chat.deepseek.com/share/*, etc.Link extraction; see 2.2
pasted_transcriptUser pastes conversation text directly into the current sessionTreat as raw material; parse roles and turns manually
noneUser only describes the prior work verballyRun the reconstruction interview; see 2.3

Output of Stage 1: a confirmed source_type plus the actual raw material. If the source cannot be read or extracted, stop and report the specific failure - do not fabricate a handoff from assumptions.

Stage 2 - Extraction

2.1 Native export / file

Read the file directly. If it is HTML, prefer a parser that preserves code fences and role labels. If it is JSON, inspect the schema before assuming field names.

2.2 Share link

Share links require provider-aware extraction. Ordinary web-fetch will fail on several providers in characteristic ways:

  • claude.ai/share/... returns a Cloudflare challenge shell, not conversation content; the clean JSON lives at claude.ai/api/chat_snapshots/.
  • chatgpt.com/share/... returns ~500 KB of HTML with messages buried in an indexed string table; chatgpt.com/backend-api/share/ returns clean JSON.
  • gemini.google.com/share/... is an Angular shell with zero conversation text on initial fetch; it requires rendering and waiting for the transcript.
  • chat.deepseek.com/share/... returns HTTP 202 with an empty body from WAF bot protection; it needs a real browser window to pass the challenge.

Recommended extraction stack (in order of preference):

  1. If an MCP tool for shared-link reading is available (e.g. shared-url-mcp exposes read_shared_link and inspect_shared_link), use it first. It returns a skeleton with title, message count, and an outline mapping each turn to a line number, while storing the full transcript in a file the agent can read selectively.
  2. If a CLI extraction tool is available, convolvger export -f json produces a canonical archival record, and convolvger inspect lets you preview message counts and extraction findings without writing a file. csctf handles ChatGPT, Gemini, Grok, and Claude share links into Markdown + HTML with preserved code fences.
  3. If no tool is available, use a browser-rendered fetch with provider-specific selectors and fallback chains. Do not attempt to bypass authentication walls; if the page requires login and the user cannot provide a snapshot, ask the user to export manually.

After extraction, validate the result before proceeding:

  • Message count > 0 and alternating user/assistant roles are present.
  • Code blocks retain language tags (if the conversation contained code).
  • The final assistant message is identifiable.

If validation fails, report exactly what was missing and retry with a different extraction path.

2.3 Reconstruction interview (source_type = none)

When the user only describes the prior work verbally, do not guess. Ask these questions in one batch, then build the envelope from the answers:

  1. What is the overall goal, in one sentence?
  2. What exactly has been finished, and how do you know it is finished?
  3. What is still undone, and who was responsible for it before?
  4. Were there any decisions already made that must not be reversed? Why were they made?
  5. Where are the artifacts - files, links, commits - that the new agent must read first?
  6. Are there any hard constraints (budget, API contracts, deadlines) the new agent must not violate?

If the user cannot answer a question, record the corresponding field as UNKNOWN rather than inventing a value.

Stage 3 - Structured Distillation

Transform the raw material into the following structured fields. Do not write a narrative summary. Populate each field only with what the raw material supports; mark unsupported fields as UNKNOWN rather than inferring.

handoff_envelope: meta: envelope_id: "" created_at: "" source_type: "native_export | share_link | pasted_transcript | reconstructed" source_provenance: "" handoff_depth: chain_warning: identity: project: "" goal: "" status: "ready | in_progress | blocked | needs_review" blocker: "<if status == blocked, the concrete blocker; else null>" completed_work: - item: "" evidence: "<file path, commit hash, URL, or quoted result>" closed: true do_not_redo: true task_description: - item: "<what remains and is now the receiving agent's responsibility>" acceptance_criteria: "" dependencies: "<other tasks, files, or decisions this depends on>" immediate_next_steps: - step: 1 action: "<concrete, verifiable action>" verify: "" - step: 2 action: "..." verify: "..." key_decisions: - decision: "" rationale: "" reversible: artifact_ref: "<link to ADR, comment, or message where it was decided>" open_issues: - issue: "" impact: "" suggested_owner: "receiving_agent | user | third_party" artifacts: - path_or_url: "" role: "spec | plan | code | data | reference" must_read_first: context_constraints: - ""

Critical rules for this stage:

  • completed_work items carry do_not_redo: true only when genuinely closed. If in doubt, set do_not_redo: false and move the item to open_issues.
  • immediate_next_steps must have at most 5 items. If you need more, the handoff is too large - split the task.
  • context_constraints captures only binding constraints (e.g. "must not change the public API signature", "budget cap is $200"), not preferences.
  • If source_type is share_link and the original conversation included uploaded files or MCP integrations, note in context_constraints that the share snapshot may not include those attachments; do not assume the receiving agent has access to them.

Stage 4 - Envelope Validation

Before delivering, run this self-check. If any check fails, fix the envelope rather than delivering it with caveats.

CheckPass condition
Source fidelityEvery completed_work item and key_decision traces to a specific span in the raw material or a named artifact
No summarization leakcompleted_work items are structured records, not prose paragraphs
SeparationNo item appears in both completed_work and task_description
VerifiabilityEvery immediate_next_steps item has a verify field that another agent could execute
Artifact reachabilityEvery must_read_first artifact is accessible, or replaced with an inline extract marked inline_fallback: true
Depthhandoff_depth <= 3, or an explicit user override was recorded

Stage 5 - Delivery

Deliver the envelope in the format the receiving agent can consume:

  • Same session or shared filesystem: write the envelope as handoff_envelope.yaml in the project root and report its path.
  • Different session without filesystem access: render the envelope inline in a fenced YAML block, and inline the must_read_first artifacts as fenced extracts immediately below.
  • Third-party agent that expects a prompt: prepend this instruction block to the envelope:

You are taking over an in-progress task. The handoff envelope below contains completed work (do not redo), remaining work (your responsibility), and immediate next steps. Read the must_read_first artifacts before acting. Start with immediate_next_steps[1] and verify each step before proceeding.

4. Failure Recovery

A handoff can fail at three distinct points. Apply the matching recovery path; do not retry blindly.

Failure pointSymptomRecovery
Extraction failureShare link returns challenge shell, empty body, or corrupted transcriptSwitch to a different extraction path (2.2). If all automated paths fail, ask the user for a manual export. Do not build an envelope from a partial transcript.
Envelope rejectionReceiving agent does not understand the task or cannot locate an artifactCheck task_description for ambiguity and artifacts for reachability. Re-emit the envelope with the failing section expanded; do not simply re-send the same envelope.
Execution failure after acceptanceReceiving agent starts but produces a result that violates a binding constraintMost likely a context_constraints omission. Compare the failed output against completed_work and key_decisions to identify the missing constraint, add it, and re-issue.

Escalation ladder: retry the same path once, then reroute to an alternative extraction path, then escalate to the user with a concrete diagnosis. Do not attempt a fourth automated retry.

5. Anti-Patterns

Reject these even when the user asks for them, and explain why:

  • "Just summarize the whole conversation." Produces a narrative summary, not a handoff; directly triggers context collapse. Offer a structured envelope instead.
  • "Include everything, the new agent will figure it out." Over-inclusion dilutes do_not_redo signals and increases the chance the receiving agent re-does completed work. The envelope should be selective but sufficient.
  • "Skip verification, I'm in a hurry." An unverified next step is a liability. At minimum run the Stage 4 self-check.
  • Chaining 5+ agents without consolidation. The skill refuses at depth >= 4. This is a feature, not a bug.

6. Worked Example (abbreviated)

Input: User pastes a chatgpt.com/share/... link and says the previous agent finished a data-pipeline refactor, continue with testing and deployment.

Stage 1: source_type = share_link, provider = ChatGPT. Stage 2: Use shared-link MCP tool. Skeleton shows 34 messages; the last assistant message contains the final file manifest and a "Remaining: integration tests, staging deploy" section.

Stage 3 (abbreviated envelope):

handoff_envelope: meta: source_type: share_link source_provenance: "https://chatgpt.com/share/xxx" handoff_depth: 1 identity: project: "data-pipeline-refactor" goal: "Migrate old pipeline to new schema, pass integration tests, deploy to staging" status: ready completed_work: - item: "New schema migration script written and validated locally" evidence: "migrate_v2.py full content in last assistant message" do_not_redo: true - item: "Old-data backfill logic completed" evidence: "backfill.py in same message" do_not_redo: true task_description: - item: "Write integration tests covering schema migration plus backfill end to end" acceptance_criteria: "All tests pass, at least one boundary record with nulls covered" - item: "Deploy to staging and verify connectivity" acceptance_criteria: "Staging health check passes and can read migrated tables" immediate_next_steps:

...

[truncated for translation]

Related Skills