返回 DeepSeek-TUI-2026
cycle_handoff.md
根目录 / crates / tui / src / prompts / cycle_handoff.md
1 # Cycle Handoff Briefing
2
3 You are about to cross a context cycle boundary. The conversation so far has
4 crossed the per-cycle token budget, so this entire transcript is going to be
5 **archived to disk** and the next turn will start with a fresh context: the
6 original system prompt, structured state (todos, plan, working set, open
7 sub-agents), the user's pending message, and a free-form briefing that **you
8 write right now**.
9
10 Your job, in this single message: produce a `<carry_forward>` block of at most
11 **3,000 tokens** that captures the irreducible state the *next cycle's you* will
12 need to continue without redoing work.
13
14 ## What to put in `<carry_forward>`
15
16 Write concrete prose, not bullet-point summaries of the transcript. Cover:
17
18 - **Decisions made and why.** The things you've chosen and the reasoning that
19 led there. Not "we discussed options" — name the choice and the constraint
20 that made it the right one.
21 - **Constraints discovered.** Concrete facts about the codebase, environment,
22 user preferences, or external systems that the next cycle will trip over if
23 it doesn't know them. (e.g. "the audit log is JSONL not JSON", "the user
24 insists on no `unwrap()` in non-test code", "macOS sandbox blocks raw
25 sockets in tools/exec.rs".)
26 - **Hypotheses being tested.** Open questions you're actively investigating,
27 what you're trying to falsify, what evidence would change your mind.
28 - **Approaches that failed.** Dead ends with enough detail that the next
29 cycle won't repeat them. Name the approach and the specific reason it
30 didn't work, not just "tried X, didn't work".
31 - **Open questions for the user.** Things you're blocked on that the next
32 cycle should ask about if the user doesn't volunteer them.
33
34 ## What NOT to put in `<carry_forward>`
35
36 - Tool output bytes. (They're already archived to disk.)
37 - File contents you read. (The next cycle can re-read them — pricier than a
38 briefing token, but cheaper than a wrong assumption built on a stale
39 paraphrase.)
40 - Step-by-step recap of what you did. The next cycle does not need to know
41 the order of operations; it needs to know the *current state*.
42 - Pleasantries, throat-clearing, framing language. Every token matters.
43
44 ## Format
45
46 Open with `<carry_forward>` on its own line. Close with `</carry_forward>` on
47 its own line. No prose outside the tags. No nested tags. No code fences around
48 the block itself (you can use code fences inside if you need to quote a
49 specific snippet).
50
51 The `recall_archive` tool is available in the next cycle. It searches the
52 archived transcripts (BM25 over message text, top-N hits) when your briefing
53 missed something the next cycle needs. Use it sparingly — frequent recalls
54 mean your briefing was too sparse, so refine your *next* briefing rather than
55 leaning on the archive. Don't try to be exhaustive here: be precise about the
56 load-bearing state and trust the archive for the rest.
57
58 ## Example shape (do not copy verbatim — write your own)
59
60 ```
61 <carry_forward>
62 Working on issue #124 (cycle-restart). Key decisions: (1) trigger at 110K
63 tokens not 128K — need ~8.5K headroom for the briefing turn itself plus
64 next-turn growth before the next boundary; (2) archive to JSONL with a
65 header line so future tools can stream-read without parsing the whole
66 file. Constraint discovered: DeepSeek V4 thinking-mode requires
67 reasoning_content replay on assistant messages with tool calls — so seed
68 messages can't include orphan tool calls from the archived cycle. The
69 approach of "summarize then keep recent messages" (the old compaction
70 path) was failing because the model couldn't tell which fragments were
71 verbatim vs. paraphrased; replacing it entirely. Open question for user:
72 do they want per-model briefing token caps, or one global cap?
73 </carry_forward>
74 ```
75
76 Now write your `<carry_forward>` for this conversation.
77
77 lines MARKDOWN