All courses

When and how to start a fresh session

Decide when to clear or restart: a new task, a polluted or stuck conversation, nearly full context, or rising cost. Carry over what matters in a short handoff note or the instruction file instead of the whole history.

Builds on: Why long sessions degrade, Cost and usage limits, Project instruction files: purpose and contents

Read it card by card Start the whole course

Two hours in, and it's getting worse

You fixed a login bug in one long session, then asked the agent to add CSV export in the same conversation. Now it mentions the login code for no reason. It retries an approach you rejected an hour ago, and each reply uses more of your usage limit. The tool also warns that the context is nearly full. Do you push on, or start over? And if you start over, what do you lose?

Old history is weight, not memory

The agent re-reads the whole conversation on every turn: old logs, failed attempts, rejected ideas. That costs tokens every time and pulls it toward the past. A fresh session starts with only the instruction file and what you give it. Very little of a long history matters for the next step. Usually it comes down to a few facts: the goal, what is done, what failed and why, and what comes next. Carry those over and drop the rest.

When to restart, and what to carry

Start fresh when: 1. **New task**: unrelated to the current one. 2. **Polluted**: a wrong idea keeps coming back after you corrected it. 3. **Stuck**: two clear corrections have not helped. 4. **Nearly full**: the context warning appears, or compaction already ran. 5. **Cost rising**: each message uses noticeably more. Before clearing, write a **handoff note** for this task. Put **lasting rules** in the instruction file.

Restarting the CSV task in five steps

1. **Ask** the agent for a short handoff note. 2. **Check** each line against what you saw yourself. The note can be wrong too. 3. **Move lasting rules** to the instruction file. Here: "build CSV rows with `csv.writer`, never by joining strings with commas." 4. **Clear**: `/clear` in some tools, a "New chat" button in others. 5. **Paste** the note and say what to do next. The new session starts focused, and each message is cheaper.

Handoff note, then a clean start

Keep the note short and specific. Exact names, values and the reason something failed are what a fresh session cannot work out on its own.
▸ You: Write a handoff note, max 8 lines:
goal, done, failed + why, open issues, next, files.
◂ Agent: Goal: export orders as CSV.
Done: export_csv() in src/export.py, uses csv.writer
Failed: joining with commas broke names containing commas
Open: dates print 2024-1-5, need ISO 2024-01-05
Next: fix dates, then run pytest
Files: src/export.py, tests/test_export.py
▸ You: /clear
▸ You: <pasted note> Continue from Next.

Clear often, carry little

Start a fresh session for a new task, or when the current one is polluted, stuck, nearly full or getting expensive. Carry over a short, checked handoff note for the task. Put rules that should outlast it in the instruction file.

On Bytewise this lesson comes in small steps with a check at the end, and the app brings it back right before you would forget it.