Memory

Session Branch

Try it

Branch a coding session into a new conversation with full context handoff — generate structured handoff doc and startup prompts. Triggers ONLY on '支线任务' / '开...

What it does

Branch your current coding session into a new conversation without losing context.

The skill document

Session Branch

Branch your current coding session into a new conversation without losing context.

When to Use

  • Current conversation is getting long and context compression is degrading quality
  • You want to start a new task on the same project but keep full context
  • You need to fork your work into a parallel direction
  • User says: "支线任务" / "开个支线" / "分叉"

Before executing any step, the agent MUST:

  1. Warn the user that this skill will write a file to the project directory (e.g., docs/session-handoff.md)
  2. Ask for explicit consent before scanning any IDE-specific identity, memory, or configuration files
  3. Never harvest env var values — only record variable names and whether they are configured (yes/no)
  4. Use project-relative paths in all generated documents — never absolute paths containing usernames or home directories

Execution Flow

Step 1: Analyze Current Session

Scan the current conversation and project to extract:

  1. Primary request and intent — all user intents, deduplicated, numbered chronologically
  2. Key technical concepts — keywords, categorized (Architecture / Tools / Patterns)
  3. Files and code sections — all Read/Edit/Write operations, with change summaries and key snippets
  4. Errors and fixes — recent 5-10 errors with root cause and solution
  5. Problem solving — completed achievements + key decision chain (chosen vs rejected + why)
  6. All user messages — original text preserved with sanitization (strip credentials/PII), truncate >500 chars with "..."
  7. Conversation language — detected primary language
  8. Current work — active task, unfinished Todos with status, branchable directions

Supplementary context (not token-budgeted): project identity, platform status, env var names (status only), capability boundary, knowledge file index, user preferences.

IDE-Specific Additional Scanning

Consent required: Before scanning any of the following, inform the user what files will be accessed and ask for explicit permission. Skip any category the user declines.

For WorkBuddy, also scan (with user consent):

  • Identity files: ~/.workbuddy/SOUL.md, IDENTITY.md, USER.md — persona and preferences
  • Memory files: .workbuddy/memory/MEMORY.md + daily logs — project memory
  • Installed skills: ~/.workbuddy/skills/ — list of active skills
  • Scheduled tasks: automation/cron task list and status
  • Channel config: IMA knowledge base IDs, Feishu channel configuration
  • MCP connectors: active MCP connector status

For TRAE SOLO, also scan (with user consent):

  • Rules: .trae/rules/ — project-level rules
  • Schedule: TRAE SOLO Schedule task list
  • Memory system: ~/.trae-cn/memory/ — user profile, project memory, recent topics (see references/memory-guide.md for path structure)

For Cursor, also scan:

  • Rules: .cursor/rules/ or .cursorrules

For Claude Code, also scan:

  • Rules: CLAUDE.md in project root

Step 1.5: Apply Compression Strategy

Based on Trae IDE session-copy architecture. The handoff doc uses an 8-section fixed structure with token budget management.

8 Core Sections (token budget ~4000 total):

#SectionPriorityBudgetRule
1Primary Request and IntentP2~300Numbered list, deduplicated
2Key Technical ConceptsP2~200Keyword list, categorized
3Files and Code SectionsP1~1200Paths + changes + snippets (max 500 chars each)
4Errors and FixesP1~600Recent 5-10 only, description + cause + fix
5Problem SolvingP2~300Completed achievements + decision chain
6All User MessagesP0~800Original text with sanitization (strip credentials/PII), truncate >500 chars with "..."
7Conversation LanguageP3~10Single field
8Current WorkP0~600Active task + unfinished Todos + branchable directions with sanitization (no personal paths)

Compression priority: When content exceeds budget, compress in reverse priority order (P3 first, P0 last):

  • P3 (can discard): Conversation Language is just one word
  • P2 (summary only): Compress to keyword lists
  • P1 (keep recent): Only recent 5-10 errors, only key code snippets
  • P0 (preserve with mandatory sanitization): All user messages and current work status — strip credentials, tokens, real names, emails, and personal identifiers before preserving; replace with `` placeholders

Supplementary sections (not budgeted): Project identity, platform status, env vars, capability boundary, knowledge index, user preferences, IDE-specific context (with consent).

Step 2: Generate Handoff Document

Use the template at references/handoff-template.md to create a structured handoff document.

Save location by IDE:

IDEDefault pathRationale
WorkBuddy.workbuddy/session-handoff.mdAlign with memory system, keep project root clean
TRAE SOLOdocs/session-handoff.mdStandard docs location
Cursordocs/session-handoff.mdStandard docs location
Claude Codedocs/session-handoff.mdStandard docs location

Critical rules:

  • NO personal information (real names, emails, token values)
  • NO project-specific secrets or credentials
  • Use project-relative paths (e.g., docs/session-handoff.md), never absolute paths containing usernames or home directories
  • Use generic placeholders: , , ``
  • The handoff doc must be reusable as a TEMPLATE, not a one-time snapshot

Step 3: Validate with Checklist

Cross-check the generated handoff against references/checklist.md.

Every item must be covered. If something is not applicable, write "N/A" with a reason.

Step 4: Generate Startup Prompt

Use references/startup-prompts.md to generate the startup prompt for the new conversation.

The prompt must include:

  1. Project-relative file paths for the new AI to read (never absolute paths with usernames)
  2. A three-step flow: Load → Report → Ask
  3. Clear role: "This is a continuation of an existing project, not starting from scratch"

Step 5: Present to User

Show the user:

  1. The generated handoff document (key sections summary)
  2. The startup prompt (ready to copy-paste)
  3. List of files created and their locations
  4. Ask: "Ready to open a new conversation?"

Permission Declaration

CapabilityUsedDescription
NetworkNoNo network access required
File read/writeYesReads project files; writes docs/session-handoff.md (overwrites if exists). Reads IDE memory/identity files (e.g., ~/.trae-cn/memory/, ~/.workbuddy/SOUL.md) ONLY with explicit user consent — opt-in, never silent reads
Environment variablesYesReads env var names (status only, never values)
subprocessNoNo subprocess calls
External APINoNo external API calls

Configuration

SettingDefaultDescription
handoff_pathAuto (by IDE)Where to save the handoff document
include_checklisttrueWhether to validate against checklist
target_ideautoTarget IDE for startup prompt (auto/trae/workbuddy/cursor/claude-code)

References

  • references/handoff-template.md — Full template for the handoff document (8 sections + supplementary context)
  • references/checklist.md — Validation checklist (8 core sections + supplementary + IDE-specific)
  • references/startup-prompts.md — IDE-specific startup prompt templates (5 IDEs with memory integration)
  • references/memory-guide.md — TRAE memory system reference (3 layers + quick lookup guide)

Related skills

Stores durable facts in a categorized, plain-markdown vault on disk, alongside your agent's built-in memory.

by Iván559 installs18 stars

Find why your productivity system keeps failing, then apply the smallest fix — capacity math, bottleneck routing, durable local notes.

by Iván855 installs69 stars

Join a video meeting as an AI bot with voice, avatar, and screenshare across four operating modes.

by johnpatternai22 installs8 stars

Run Git operations — commits, branches, merges, rebases, conflict resolution, and recovery — with safety rules enforced.

by Iván535 installs31 stars

Generate and edit Draw.io, Mermaid, and Excalidraw diagrams from natural language using a structured JSON spec.

by nssa.io1.0k installs47 stars

More from edwardwason

Browse all skills

Convert URLs or local files to structured Markdown and save to Obsidian, Feishu Cloud Drive, and Tencent IMA.

by edwardwason15 installs1 stars

Daily curated briefing of 8 notable ClawHub AI Agent Skills, with optional Lark or IMA push.

by edwardwason10 installs1 stars

Daily Chinese-market skill digest with 8 curated picks and dual-lab security audit.

by edwardwason10 installs1 stars

Convert a Markdown article into 3:4 PNG image cards plus a compressed text script for posting on social platforms.

by edwardwason10 installs1 stars

技能熔炉 — 锻造/评估/改进 Skill。说 技能熔炉 走全流程(含R5改进已有skill);说 技能评估/skill评估/评估技能 只做同类比对+腾讯9维度。可选能力:搜索SkillHub同类技能(通过TRAE内置工具)、修改已有skill文件(仅R5诊断修复路径,需用户确认)。发布环节请用 skill-pu...

by edwardwason9 installs1 stars

Generate React design drafts (4-piece set) from content. Invoke for 'design draft'/'设计稿'/'生成页面'/'信息图'/'知识卡片'/'多图配图'. Do NOT use for editing existing code.

by edwardwason8 installs1 stars