session-share
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSession Share
会话共享
Share Claude Code sessions between developers through portable file export/import.
Version: 1.0 | Privacy: Files are never uploaded to cloud unless you choose to share them
通过可移植的文件导出/导入功能,在开发者之间共享Claude Code会话。
版本: 1.0 | 隐私说明: 除非你选择共享,否则文件绝不会上传至云端
Quick Start
快速开始
bash
undefinedbash
undefinedExport current session
导出当前会话
scripts/export.sh
scripts/export.sh
Output: ~/session-shares/session-2024-01-20-my-feature.json
输出: ~/session-shares/session-2024-01-20-my-feature.json
Share the file via Slack, email, AirDrop, etc.
通过Slack、邮件、AirDrop等方式共享文件
Other developer imports
其他开发者导入会话
scripts/import.sh ~/Downloads/session-2024-01-20-my-feature.json
scripts/import.sh ~/Downloads/session-2024-01-20-my-feature.json
Session appears in agent-deck, ready to continue
会话将出现在agent-deck中,可直接继续工作
undefinedundefinedCommands
命令说明
Export Session
导出会话
Export the current Claude session to a portable file:
bash
scripts/export.sh [options]Options:
| Option | Description |
|---|---|
| Export specific session (default: current) |
| Custom output path |
| Include Claude's thinking blocks |
| Don't redact sensitive data |
Examples:
bash
undefined将当前Claude会话导出为可移植文件:
bash
scripts/export.sh [选项]选项:
| 选项 | 说明 |
|---|---|
| 导出指定会话(默认:当前会话) |
| 自定义输出路径 |
| 包含Claude的思考块 |
| 不对敏感数据进行脱敏 |
示例:
bash
undefinedExport current session
导出当前会话
scripts/export.sh
scripts/export.sh
Export to specific location
导出到指定位置
scripts/export.sh --output /tmp/handoff.json
scripts/export.sh --output /tmp/handoff.json
Export specific session with thinking blocks
导出指定会话并包含思考块
scripts/export.sh --session abc123 --include-thinking
**What gets exported:**
- All conversation messages (user and assistant)
- Tool calls and results
- File modifications tracked
- Session metadata
**What gets redacted (by default):**
- API keys and tokens
- Absolute paths (converted to relative)
- Thinking blocks (Claude's internal reasoning)scripts/export.sh --session abc123 --include-thinking
**导出内容包括:**
- 所有对话消息(用户和助手)
- 工具调用及结果
- 跟踪到的文件修改记录
- 会话元数据
**默认脱敏内容包括:**
- API密钥和令牌
- 绝对路径(转换为相对路径)
- 思考块(Claude的内部推理过程)Import Session
导入会话
Import a shared session file and create an agent-deck session:
bash
scripts/import.sh <file-path> [options]Options:
| Option | Description |
|---|---|
| Override session title |
| Import to specific project |
| Don't auto-start the session |
Examples:
bash
undefined导入共享的会话文件并创建agent-deck会话:
bash
scripts/import.sh <文件路径> [选项]选项:
| 选项 | 说明 |
|---|---|
| 覆盖会话标题 |
| 导入到指定项目 |
| 不自动启动会话 |
示例:
bash
undefinedImport and start
导入并启动会话
scripts/import.sh ~/Downloads/session-feature.json
scripts/import.sh ~/Downloads/session-feature.json
Import with custom title
导入并自定义标题
scripts/import.sh session.json --title "Feature Work from Alice"
scripts/import.sh session.json --title "来自Alice的功能开发会话"
Import without starting
导入但不启动
scripts/import.sh session.json --no-start
undefinedscripts/import.sh session.json --no-start
undefinedWorkflow: Sharing a Session
工作流程:共享会话
Developer A (Exporter)
开发者A(导出方)
- Working in agent-deck session on a feature
- Needs to hand off to Developer B
- Runs:
scripts/export.sh - Gets file:
~/session-shares/session-2024-01-20-feature.json - Sends file to Developer B via Slack DM, email, or AirDrop
- 在agent-deck会话中进行功能开发
- 需要将工作交接给开发者B
- 运行命令:
scripts/export.sh - 生成文件:
~/session-shares/session-2024-01-20-feature.json - 通过Slack私信、邮件或AirDrop将文件发送给开发者B
Developer B (Importer)
开发者B(导入方)
- Receives the session file
- Runs:
scripts/import.sh ~/Downloads/session-2024-01-20-feature.json - Session appears in agent-deck as "Imported: feature"
- Starts session - Claude has full context from Developer A's work
- Continues where Developer A left off
- 接收会话文件
- 运行命令:
scripts/import.sh ~/Downloads/session-2024-01-20-feature.json - 会话将以“已导入:feature”的名称出现在agent-deck中
- 启动会话 - Claude将拥有开发者A的完整工作上下文
- 从开发者A停止的位置继续工作
Export File Format
导出文件格式
json
{
"version": "1.0",
"exported_at": "2024-01-20T15:30:00Z",
"exported_by": "alice",
"session": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"title": "Feature Implementation",
"original_project": "/Users/alice/my-project"
},
"context": {
"summary": "Last few user messages for quick context",
"modified_files": ["src/auth.ts", "src/middleware.ts"]
},
"messages": [ /* JSONL records as JSON array */ ],
"stats": {
"total_messages": 150,
"user_messages": 45,
"assistant_messages": 105
}
}json
{
"version": "1.0",
"exported_at": "2024-01-20T15:30:00Z",
"exported_by": "alice",
"session": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"title": "Feature Implementation",
"original_project": "/Users/alice/my-project"
},
"context": {
"summary": "Last few user messages for quick context",
"modified_files": ["src/auth.ts", "src/middleware.ts"]
},
"messages": [ /* JSONL records as JSON array */ ],
"stats": {
"total_messages": 150,
"user_messages": 45,
"assistant_messages": 105
}
}Security & Privacy
安全与隐私
What's Redacted by Default
默认脱敏内容
| Data Type | Redaction |
|---|---|
| API keys | Replaced with |
| Tokens | Replaced with |
| Home paths | Converted to |
| Username in paths | Converted to |
| Thinking blocks | Removed entirely |
| 数据类型 | 脱敏方式 |
|---|---|
| API密钥 | 替换为 |
| 令牌 | 替换为 |
| 主目录路径 | 转换为 |
| 路径中的用户名 | 转换为 |
| 思考块 | 完全移除 |
Best Practices
最佳实践
- Review before sharing - Open the export file and scan for sensitive data
- Use direct transfer - Slack DM, email, AirDrop are more private than cloud links
- Delete after import - Remove the file once imported successfully
- Use sparingly - Thinking blocks may contain sensitive reasoning
--include-thinking
- 共享前检查 - 打开导出文件并扫描敏感数据
- 使用直接传输 - Slack私信、邮件、AirDrop比云链接更私密
- 导入后删除 - 成功导入后删除文件
- 谨慎使用- 思考块可能包含敏感推理内容
--include-thinking
Troubleshooting
故障排除
| Issue | Solution |
|---|---|
| "Could not detect current Claude session" | Make sure you're in an agent-deck session with active Claude |
| "Session file not found" | Session may not have been saved yet; send a message first |
| Import shows wrong project | Use |
| Large file size | Use default settings (strips thinking blocks) |
| 问题 | 解决方案 |
|---|---|
| "无法检测到当前Claude会话" | 确保你处于agent-deck的活跃Claude会话中 |
| "会话文件未找到" | 会话可能尚未保存;先发送一条消息再尝试 |
| 导入后显示错误的项目 | 使用 |
| 文件过大 | 使用默认设置(会移除思考块) |
Technical Details
技术细节
Session Storage
会话存储
Claude stores sessions in:
~/.claude/projects/<encoded-path>/<session-id>.jsonlPath encoding: becomes
/Users/alice/project-Users-alice-projectClaude将会话存储在:
~/.claude/projects/<encoded-path>/<session-id>.jsonl路径编码规则: 转换为
/Users/alice/project-Users-alice-projectHow Import Works
导入原理
- Reads export JSON file
- Creates directory:
~/.claude/projects/<encoded-current-project>/ - Writes messages as JSONL:
<session-id>.jsonl - Creates agent-deck session pointing to this path
- Sets so restart uses
claude-session-id--resume
- 读取导出的JSON文件
- 创建目录:
~/.claude/projects/<encoded-current-project>/ - 将消息写入JSONL文件:
<session-id>.jsonl - 创建指向该路径的agent-deck会话
- 设置,以便重启时使用
claude-session-id参数--resume
Dependencies
依赖项
- - JSON processing (install:
jq)brew install jq - - Session management
agent-deck - - Claude Code CLI
claude
- - JSON处理工具(安装:
jq)brew install jq - - 会话管理工具
agent-deck - - Claude Code命令行工具
claude