Commit 20a3dc7
committed
Add 'handoff' command: paste-ready prompts for continuing in another AI agent
The new feature closes the 'I want to switch agents mid-conversation' UX
gap. One command produces everything needed to keep going in Claude.ai,
ChatGPT, Cursor, or any other chat-style AI tool — without re-explaining
context manually.
USAGE
claude-backup handoff <id-prefix> # print to stdout
claude-backup handoff <id-prefix> | pbcopy # macOS — straight to clipboard
claude-backup handoff <id-prefix> | xclip ... # Linux
claude-backup handoff <id-prefix> -o handoff.md # save to a file
claude-backup handoff <id-prefix> --lang en|ru # force wrapper language
OUTPUT SHAPE
A self-contained prompt with:
1. Framing line ('You are continuing a conversation I started in <source>')
2. Original task (from session title or first user prompt)
3. Started date + dialogue-only message count
4. The full clean transcript (no tool noise — keeps paste size sane)
5. Closing line asking the new agent to acknowledge and wait
DESIGN CHOICES
- Always uses the dialogue-only render so paste size stays small. 200-msg
session is typically 80-200 KB — fine for any modern hosted assistant.
- Wrapper language auto-detects Cyrillic in the title or first prompt and
picks Russian; otherwise English. Override with --lang. The transcript
itself is unchanged either way (the new agent will speak whatever
language was in the conversation).
- The clipboard tip prints to stderr so '| pbcopy' captures only the
prompt, not the helper text.
- Reuses the same session-prefix lookup as 'export', so any unique 8-char
prefix works.
CODE
- exporter.py: new render_handoff(), detect_handoff_language(),
bilingual templates, source-label maps.
- cli.py: extracted shared _resolve_session_or_exit() so 'export' and
'handoff' share the prefix-matching + ambiguity error path.
- 10 new tests covering: framing, dialogue-only count, language detection
for both Cyrillic and ASCII sessions, explicit --lang override, source
label, CLI stdout vs --output, missing-session error, and the
stderr-discipline contract for the clipboard tip.
DOCS
README, README.ru, QUICKSTART, PROMPT all gain a handoff section. The
PROMPT additionally instructs the AI assistant to plant a seed about
'handoff' near the end so users learn about it during onboarding.
95/95 tests pass, 91% coverage.1 parent 66c9c79 commit 20a3dc7
7 files changed
Lines changed: 395 additions & 17 deletions
File tree
- claude_backup
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| 69 | + | |
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
137 | 155 | | |
138 | 156 | | |
139 | 157 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
56 | 60 | | |
57 | 61 | | |
58 | 62 | | |
| |||
162 | 166 | | |
163 | 167 | | |
164 | 168 | | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
165 | 199 | | |
166 | 200 | | |
167 | 201 | | |
| |||
229 | 263 | | |
230 | 264 | | |
231 | 265 | | |
| 266 | + | |
232 | 267 | | |
233 | 268 | | |
234 | 269 | | |
| |||
251 | 286 | | |
252 | 287 | | |
253 | 288 | | |
254 | | - | |
| 289 | + | |
255 | 290 | | |
256 | 291 | | |
257 | 292 | | |
| |||
273 | 308 | | |
274 | 309 | | |
275 | 310 | | |
276 | | - | |
| 311 | + | |
| 312 | + | |
277 | 313 | | |
278 | 314 | | |
279 | 315 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
56 | 60 | | |
57 | 61 | | |
58 | 62 | | |
| |||
162 | 166 | | |
163 | 167 | | |
164 | 168 | | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
165 | 199 | | |
166 | 200 | | |
167 | 201 | | |
| |||
226 | 260 | | |
227 | 261 | | |
228 | 262 | | |
| 263 | + | |
229 | 264 | | |
230 | 265 | | |
231 | 266 | | |
| |||
248 | 283 | | |
249 | 284 | | |
250 | 285 | | |
251 | | - | |
| 286 | + | |
252 | 287 | | |
253 | 288 | | |
254 | 289 | | |
| |||
270 | 305 | | |
271 | 306 | | |
272 | 307 | | |
273 | | - | |
| 308 | + | |
| 309 | + | |
274 | 310 | | |
275 | 311 | | |
276 | 312 | | |
| |||
0 commit comments