Initial commit

This commit is contained in:
Zhongwei Li
2025-11-29 18:03:07 +08:00
commit b86a9a4d11
5 changed files with 314 additions and 0 deletions

93
commands/receive.md Normal file
View File

@@ -0,0 +1,93 @@
---
description: Receive context from parent or child session
argument-hint: <direction> [subject] [path]
allowed-tools: Bash, Read
---
# receive - Receive context from parent or child session
Read and integrate context from a parent or child session handoff file.
## Usage
```
/context:receive parent [subject] [path]
/context:receive child [subject] [path]
```
Both subject and path are optional:
- **subject**: Claude will infer from context if not provided
- **path**: Defaults to `/tmp/claude-ctx/` if not provided
## What it does
1. Checks if `/tmp/claude-ctx/` directory exists using test command
2. Creates directory only if it doesn't exist
3. 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'.
```
3. Determines direction: parent-to-child or child-to-parent
4. If subject provided, looks for `{path}/ctx-{direction}-{subject}.md`
5. If no subject, uses wildcard: `{path}/ctx-{direction}-*.md` **sorted by newest first**
6. Path defaults to `/tmp/claude-ctx/` but can be customized
7. Reads and displays context file
8. 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.
## 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!
```
## 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.
```
## 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]
```
## 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 receiving context from any parent/child session
- To understand what happened in related session
## Related commands
- `/context:send` - Send context to parent/child before switching