copy-chat

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Copy chat

Copy chat

This folder holds a Claude Code mod (the
.claude-plugin
and
hooks
folders): a
Copy chat
button above the prompt. Claude Code loads it by itself in every new conversation. The button is the main way. This skill does the same copy when the user asks in words, or when their Claude Code version does not run mods. Answer in the language of the user's messages.
此文件夹包含一个 Claude Code mod(由
.claude-plugin
和
hooks
文件夹组成):它会在输入框上方显示一个
Copy chat
按钮。Claude Code 会在每次新对话中自动加载它。按钮是主要使用方式。当用户通过文字提出要求,或其 Claude Code 版本尚不运行 mods 时,本 skill 会执行相同的复制操作。请使用用户消息所用的语言回答。

Copying the conversation

复制对话

Run the script in this skill's folder (the base directory shown when this skill loaded), with the Python the computer has (
python3
, else
python
):
bash
python3 "<this skill's folder>/hooks/thread.py" "${CLAUDE_SESSION_ID}" "<the folder this conversation started in>"
  • The first argument is this conversation's id. If it reached you unfilled (the literal text
    ${CLAUDE_SESSION_ID}
    ), use
    --latest
    in its place: the newest conversation of that folder. Say in one line that with several conversations open in the same folder,
    --latest
    may pick another one.
  • The second is the working directory this conversation started in (from your environment info), not a folder you moved to since.
The script prints one JSON line:
  • {"ok": true, "mine": N, "claude": N, "compacts": N}
    : copied. Tell the user it is on the clipboard and ready to paste, with the counts.
  • "why": "no clipboard tool"
    or
    "the clipboard refused it"
    : run it again with
    --print
    at the end, and give the user the text after the first line in one code block to copy.
  • "why": "nothing to copy yet"
    or
    "the conversation file was not found"
    : say so in one line.
Never paste the whole conversation into your reply unless the clipboard failed.
使用计算机上已有的 Python(优先使用
python3
,否则使用
python
),运行此 skill 文件夹中的脚本(该 skill 加载时显示的基准目录):
bash
python3 "<this skill's folder>/hooks/thread.py" "${CLAUDE_SESSION_ID}" "<the folder this conversation started in>"
  • 第一个参数是本次对话的 id。如果传入时未填充该值(字面文本为
    ${CLAUDE_SESSION_ID}
    ),则改用
    --latest
    :它会选取该文件夹中最新的对话。请用一行提醒用户:同一文件夹中同时打开多个对话时,
    --latest
    可能会选中另一个对话。
  • 第二个参数是本次对话启动时的工作目录(可从环境信息中获取),而不是用户之后移动到的目录。
脚本会打印一行 JSON:
  • {"ok": true, "mine": N, "claude": N, "compacts": N}
    :复制成功。告知用户内容已复制到剪贴板、可直接粘贴,并提供各项数量。
  • "why": "no clipboard tool"
    或
    "the clipboard refused it"
    :在命令末尾再次添加
    --print
    并运行,然后将第一行之后的文本放在一个代码块中,供用户复制。
  • "why": "nothing to copy yet"
    或
    "the conversation file was not found"
    :用一行告知用户。
除非剪贴板复制失败,否则不要在回复中粘贴整个对话。

What the copy holds

复制内容

Dana (Oct 6 12:01): ...
and
Claude (12:03): ...
. The name is the first word of the name on the user's Claude account, else "Me". Times are this computer's time zone, with the date on the first message and when the day changes. Images read as
[image]
. Subagents, tool output, reminders and summaries are left out.
内容格式为
Dana (Oct 6 12:01): ...
和
Claude (12:03): ...
。名称取用户 Claude 账户名称的第一个词,否则为
"Me"
。时间使用计算机当前的时区,第一条消息会显示日期,日期发生变化时也会再次显示日期。图片记为
[image]
。Subagents、工具输出、提醒和摘要均会被省略。

The button

按钮

Copy chat
above the prompt does the same in one press, and a notification says how many messages went. Without Python it copies the messages without times. When other mods from this collection, or Smart PreCompact, are installed, the button sits in the same row as theirs.
Off:
claude plugin disable copy-chat@skills-dir
. Remove:
npx skills remove copy-chat -g
. No button in a new conversation: this Claude Code version does not run mods yet; asking in words still works.
输入框上方的
Copy chat
按钮只需一键即可完成相同操作,通知中会显示已复制的消息数量。如果没有 Python,它仍会复制消息,但不会附带时间。安装此合集中的其他 mods 或 Smart PreCompact 后,该按钮会与它们位于同一行。
关闭:
claude plugin disable copy-chat@skills-dir
。移除:
npx skills remove copy-chat -g
。 如果新对话中没有按钮,说明此 Claude Code 版本尚不运行 mods;用户仍可通过文字提出复制要求。