跳到正文
Skillpedia
其他10k · #11899

half-clone

它能做什么

这个技能把你当前对话的后半部分复制成一个新会话,丢弃较早的部分。适合对话已变得很长,并希望以较少上下文继续工作的人。

适用场景

  • ✓当你的对话已经变得很长,继续起来很慢的时候。
  • ✓当你想保留最近的工作,但丢弃对话早期部分的时候。
  • ✓当你想减少每条新消息所使用的词元数量的时候。

技能链接

https://github.com/ykdojo/claude-code-tips/blob/main/skills/half-clone/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/ykdojo/claude-code-tips/blob/main/skills/half-clone/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我的对话很长。请为这段对话做一个半克隆,以便我继续工作。”

每周 5 个新技能,1 分钟读完。

工作原理

该技能会找到当前会话,并运行一个脚本,把后半部分复制到一个新会话中。然后它会给你一条命令,用来打开这个新会话。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Clone the later half of the current conversation, discarding earlier context to reduce token usage while preserving recent work.

Steps:

  1. Get the current session ID and project path: tail -1 ~/.claude/history.jsonl | jq -r '[.sessionId, .project] | @tsv'
  2. Find half-clone-conversation.sh with bash: find ~/.claude -name "half-clone-conversation.sh" 2>/dev/null | sort -V | tail -1
    • This finds the script whether installed via plugin or manual symlink
    • Uses version sort to prefer the latest version if multiple exist
  3. Preview the conversation to verify the session ID: <script-path> --preview <session-id> <project-path>
    • Check that the first and last messages match the current conversation
  4. Run the clone: <script-path> <session-id> <project-path>
    • Always pass the project path from the history entry, not the current working directory
  5. The script prints the new session ID (the New session: <id> line). Give the user the exact command to resume it directly, no picker needed:
    claude --resume <new-session-id>
    
    The script automatically appends a reference to the original conversation at the end of the cloned file. (The new session is also marked [HALF-CLONE <timestamp>], e.g. [HALF-CLONE Jan 7 14:30], so claude -r and picking it works as a fallback.)
常见问题

我会丢失最近的消息吗?

不会。副本保留的是对话的后半部分,其中包含你最近的工作。

如何打开新会话?

该技能会给你一条包含新会话 ID 的命令,便于你直接恢复该会话。

原来的对话会保留吗?

会在新副本的末尾添加一个指向原始对话的引用。

详情

作者的原始描述

Clone the later half of the current conversation, discarding earlier context to reduce token usage while preserving recent work.

repo: ykdojo/claude-code-tips

热度

GitHub 星标
10k
排名
#11899
许可证
—
更新时间
2026/9/25

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能