@@ -12,9 +12,8 @@ cleanly copied and pasted to continue work in a new session.
1212
13131 . ** Generate the handoff** - Create a complete context handoff following the
1414 XML-structured format
15- 2 . ** Save to temp file** - Use Write tool to save to ` /tmp/context_handoff.md `
16- 3 . ** Copy to clipboard automatically** - Use ` pbcopy < /tmp/context_handoff.md ` without
17- asking
15+ 2 . ** Save to temp file** - Use Write tool to save to a unique timestamped file
16+ 3 . ** Copy to clipboard automatically** - Use pbcopy without asking
18174 . ** Show brief confirmation** - Just ` 📋 Copied to clipboard `
1918
2019## Process
@@ -56,15 +55,19 @@ numbers] </work_completed>
5655
5756** DO NOT ASK** - Just do it:
5857
59- 1 . Use ** Write tool** to save the handoff content to ` /tmp/context_handoff.md `
60- 2 . Use ** Bash** to copy: ` pbcopy < /tmp/context_handoff.md `
61- 3 . Confirm: ` 📋 Copied to clipboard `
58+ 1 . Generate a unique filename: ` /tmp/context_handoff_TIMESTAMP.md ` where TIMESTAMP is the current Unix timestamp
59+ 2 . Use ** Write tool** to save the handoff content to that unique filename
60+ 3 . Use ** Bash** to copy the file you just created: ` pbcopy < /tmp/context_handoff_TIMESTAMP.md `
61+ 4 . Confirm: ` 📋 Copied to clipboard `
62+
63+ ** Implementation:** First run ` date +%s ` to get the timestamp, then use that value in both the Write and Bash commands.
6264
6365** Why Write tool instead of heredoc?**
6466
6567- Avoids triggering git hooks (heredoc with ` << ` can trigger branch protection)
6668- Cleaner, no escaping issues
6769- Faster execution
70+ - Timestamp-based filename prevents collisions between sessions
6871
6972## Important Guidelines
7073
@@ -87,9 +90,10 @@ numbers] </work_completed>
8790
8891** For Clipboard Operation:**
8992
90- 1 . Use Write tool to save to ` /tmp/context_handoff.md ` (avoids heredoc hook triggers)
91- 2 . Run: ` pbcopy < /tmp/context_handoff.md ` (single fast command)
92- 3 . Show: ` 📋 Copied to clipboard ` (brief confirmation)
93+ 1 . First run ` date +%s ` to get current Unix timestamp
94+ 2 . Use Write tool to save to ` /tmp/context_handoff_[timestamp].md `
95+ 3 . Run: ` pbcopy < /tmp/context_handoff_[timestamp].md `
96+ 4 . Show: ` 📋 Copied to clipboard ` (brief confirmation)
9397
9498## Example Usage Flow
9599
@@ -98,9 +102,10 @@ User: `/handoff-context`
98102Assistant immediately:
99103
1001041 . Generates the handoff content
101- 2 . Uses Write tool to save to ` /tmp/context_handoff.md `
102- 3 . Runs ` pbcopy < /tmp/context_handoff.md `
103- 4 . Shows ` 📋 Copied to clipboard `
105+ 2 . Gets timestamp with ` date +%s `
106+ 3 . Uses Write tool to save to ` /tmp/context_handoff_[timestamp].md `
107+ 4 . Runs ` pbcopy < /tmp/context_handoff_[timestamp].md `
108+ 5 . Shows ` 📋 Copied to clipboard `
104109
105110** Total time: ~ 2 seconds**
106111
0 commit comments