receive

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Receiving Context

接收上下文

Received At: !
date '+%Y-%m-%d %H:%M:%S'
Context Directory: !
[[ -d /tmp/claude-ctx ]] && echo "Exists" || echo "Does not exist - will create"

Note: If
/tmp/claude-ctx/
does not exist, create it with:
bash
mkdir -p /tmp/claude-ctx
cat > /tmp/claude-ctx/README.md << 'EOF'
接收时间: !
date '+%Y-%m-%d %H:%M:%S'
上下文目录: !
[[ -d /tmp/claude-ctx ]] && echo "已存在" || echo "不存在 - 将创建"

注意: 如果
/tmp/claude-ctx/
不存在,请使用以下命令创建:
bash
mkdir -p /tmp/claude-ctx
cat > /tmp/claude-ctx/README.md << 'EOF'

Claude Context Handoff Directory

Claude Context Handoff Directory

This is an ephemeral directory for Claude Code session context handoff. Created by claude slash commands. '/context:send' and '/context:receive'. EOF

---
This is an ephemeral directory for Claude Code session context handoff. Created by claude slash commands. '/context:send' and '/context:receive'. EOF

---

Quick Example

快速示例

bash
/context:receive child api-implementation
bash
/context:receive child api-implementation

✓ Context received from child session

✓ 已从子级会话接收上下文

File: /tmp/claude-ctx/ctx-child-to-parent-api-implementation.md

文件: /tmp/claude-ctx/ctx-child-to-parent-api-implementation.md


---

---

receive - Receive context from parent, child, or sibling session

receive - 从父级、子级或同级会话接收上下文

Read and integrate context from session handoff file.
读取并整合会话交接文件中的上下文。

Usage

使用方法

/context:receive parent [subject] [path]
/context:receive child [subject] [path]
/context:receive sibling [subject] [path]
IMPORTANT: Direction is REQUIRED. Must be one of:
parent
,
child
, or
sibling
.
Subject and path are optional:
  • subject: Claude will infer from context if not provided
  • path: Defaults to
    /tmp/claude-ctx/
    if not provided
/context:receive parent [subject] [path]
/context:receive child [subject] [path]
/context:receive sibling [subject] [path]
重要提示:必须指定方向。方向只能是以下之一:
parent
child
sibling
主题(subject)和路径(path)为可选参数:
  • 主题:如果未提供,Claude将从上下文中推断
  • 路径:如果未提供,默认值为
    /tmp/claude-ctx/

What it does

功能说明

  1. Validates direction - Errors if direction is not parent|child|sibling
  2. Check "Context Directory" status above (from dynamic injection)
  3. Create directory only if status shows "Does not exist - will create"
  4. If creating directory, generates minimal README.md:
    markdown
    # Claude Context Handoff Directory
    
    This is an **ephemeral directory** for Claude Code session context handoff. Created by claude slash commands. '/context:send' and '/context:receive'.
  5. Determines direction flow based on argument
  6. Records received timestamp (auto-captured)
  7. If subject provided, looks for
    {path}/ctx-{direction}-{subject}.md
  8. If no subject, uses wildcard:
    {path}/ctx-{direction}-*.md
    sorted by newest first
  9. Path defaults to
    /tmp/claude-ctx/
    but can be customized
  10. Reads and displays context file with original timestamp from sender
  11. Integrates context into current session understanding
Important: When using wildcard (no subject), files are sorted by modification time with newest first, ensuring you get the most recent context.
File patterns:
  • /context:receive parent
    → looks for
    /tmp/claude-ctx/ctx-parent-to-child-*.md
  • /context:receive child
    → looks for
    /tmp/claude-ctx/ctx-child-to-parent-*.md
  • /context:receive sibling
    → looks for
    /tmp/claude-ctx/ctx-sibling-to-sibling-*.md
  1. 验证方向 - 如果方向不是parent|child|sibling则报错
  2. 检查上方的“上下文目录”状态(来自动态注入)
  3. 仅当状态显示“不存在 - 将创建”时才创建目录
  4. 如果创建目录,会生成极简的README.md:
    markdown
    # Claude Context Handoff Directory
    
    This is an **ephemeral directory** for Claude Code session context handoff. Created by claude slash commands. '/context:send' and '/context:receive'.
  5. 根据参数确定方向流向
  6. 记录接收时间戳(自动捕获)
  7. 如果提供了主题,查找
    {path}/ctx-{direction}-{subject}.md
    文件
  8. 如果未提供主题,使用通配符:
    {path}/ctx-{direction}-*.md
    按最新排序
  9. 路径默认为
    /tmp/claude-ctx/
    ,但可自定义
  10. 读取并显示上下文文件,同时显示发送方的原始时间戳
  11. 将上下文整合到当前会话的理解中
重要提示:使用通配符(未指定主题)时,文件会按修改时间从新到旧排序,确保你获取到最新的上下文。
文件模式
  • /context:receive parent
    → 查找
    /tmp/claude-ctx/ctx-parent-to-child-*.md
  • /context:receive child
    → 查找
    /tmp/claude-ctx/ctx-child-to-parent-*.md
  • /context:receive sibling
    → 查找
    /tmp/claude-ctx/ctx-sibling-to-sibling-*.md

Example: Receiving from Parent (Wildcard)

示例:从父级接收上下文(通配符方式)

/context:receive parent

✓ Searching for context files: /tmp/claude-ctx/ctx-parent-to-child-*.md (newest first)
✓ Found: /tmp/claude-ctx/ctx-parent-to-child-database-migration.md (modified 2 minutes ago)

[Context displayed with parent session details]

Ready to begin focused work based on parent's context!
/context:receive parent

✓ 正在搜索上下文文件:/tmp/claude-ctx/ctx-parent-to-child-*.md(按最新排序)
✓ 找到:/tmp/claude-ctx/ctx-parent-to-child-database-migration.md(2分钟前修改)

[显示包含父级会话详情的上下文]

已准备好基于父级上下文开展聚焦工作!

Example: Receiving from Child with Subject

示例:指定主题从子级接收上下文

/context:receive child api-implementation

✓ Context received from child session
  File: /tmp/claude-ctx/ctx-child-to-parent-api-implementation.md

[Context displayed with completed work summary]

Child session completed. Integrating results back.
/context:receive child api-implementation

✓ 已从子级会话接收上下文
  文件: /tmp/claude-ctx/ctx-child-to-parent-api-implementation.md

[显示包含已完成工作摘要的上下文]

子级会话已完成。正在整合结果。

Example: Receiving from Sibling

示例:从同级接收上下文

/context:receive sibling parallel-task

✓ Context received from sibling session
  File: /tmp/claude-ctx/ctx-sibling-to-sibling-parallel-task.md

[Context displayed with parallel work details]

Sibling session completed. Integrating parallel work.
/context:receive sibling parallel-task

✓ 已从同级会话接收上下文
  文件: /tmp/claude-ctx/ctx-sibling-to-sibling-parallel-task.md

[显示包含并行工作详情的上下文]

同级会话已完成。正在整合并行工作。

Example: Custom Path

示例:自定义路径

/context:receive parent database-work ~/Documents/context/

✓ Context received from parent session
  File: ~/Documents/context/ctx-parent-to-child-database-work.md

[Context displayed]
/context:receive parent database-work ~/Documents/context/

✓ 已从父级会话接收上下文
  文件: ~/Documents/context/ctx-parent-to-child-database-work.md

[显示上下文]

Example: Missing Direction (Error)

示例:未指定方向(错误)

/context:receive database-work

✗ Error: Must specify direction: parent, child, or sibling
  Usage: /context:receive <parent|child|sibling> [subject] [path]
/context:receive database-work

✗ 错误:必须指定方向:parent、child或sibling
  使用方法:/context:receive <parent|child|sibling> [subject] [path]

What gets loaded

加载内容

  • Context file content: Decisions, work done, blockers, next actions
  • Handoff metadata: Why the handoff occurred, what was planned
  • Related context: Key information needed to continue
  • 上下文文件内容:决策、已完成工作、障碍、下一步行动
  • 交接元数据:交接原因、计划内容
  • 相关上下文:继续工作所需的关键信息

When to use

使用场景

  • Immediately after starting a new child session from parent
  • After resuming parent session when child is complete
  • When starting a sibling session and receiving context from another sibling
  • When receiving context from any parent/child/sibling session
  • To understand what happened in related session
  • 从父级会话启动新的子级会话后立即使用
  • 子级会话完成后恢复父级会话时使用
  • 启动同级会话并从另一个同级接收上下文时使用
  • 从任何父级/子级/同级会话接收上下文时使用
  • 了解相关会话中发生的情况时使用

Related commands

相关命令

  • /context:send
    - Send context to parent/child before switching
  • /context:send
    - 切换会话前向父级/子级发送上下文