Agent Skillsykdojo/claude-code-tips › quarter-clone

quarter-clone

GitHub

通过克隆当前对话的最后四分之一来减少 token 消耗,同时保留近期工作上下文。适用于长对话场景下的上下文管理。

skills/quarter-clone/SKILL.md ykdojo/claude-code-tips

触发场景

对话过长需要节省 token 需要保留近期工作上下文

安装

npx skills add ykdojo/claude-code-tips --skill quarter-clone -g -y
更多选项

不安装直接使用

npx skills use ykdojo/claude-code-tips@quarter-clone

指定 Agent (Claude Code)

npx skills add ykdojo/claude-code-tips --skill quarter-clone -a claude-code -g -y

安装 repo 全部 skill

npx skills add ykdojo/claude-code-tips --all -g -y

预览 repo 内 skill

npx skills add ykdojo/claude-code-tips --list

SKILL.md

Frontmatter
{
    "name": "quarter-clone",
    "description": "Clone the last quarter of the current conversation, discarding earlier context to reduce token usage while preserving recent work."
}

Clone the last quarter 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
    • The same script handles both half and quarter cloning; --quarter selects quarter mode
  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> --quarter <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 [QUARTER-CLONE <timestamp>], e.g. [QUARTER-CLONE Jan 7 14:30], so claude -r and picking it works as a fallback.)

版本历史

  • 31038b8 当前 2026-07-31 07:10

同 Skill 集合

skills/clone/SKILL.md
skills/gha/SKILL.md
skills/half-clone/SKILL.md
skills/handoff/SKILL.md
skills/hn-summarize/SKILL.md
skills/private-github-search/SKILL.md
skills/reddit-fetch/SKILL.md
skills/review-claudemd/SKILL.md
skills/version-check/SKILL.md

元信息

文件数
0
版本
31038b8
Hash
3371dcc6
收录时间
2026-07-31 07:10

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-06 18:16
浙ICP备14020137号-1 $访客地图$