Skip to content
PKResources
Course outline

Agentic Engineering: the hands-on course · Module 2: Context engineering

Keeping context fresh on long tasks

Long sessions go stale. Spot the symptoms, then use checkpoints, handoff notes and clean resets to keep an agent sharp across hours of work.

Lesson 8 / 24 · ⏱ 7 min

A session that started brilliantly can turn sloppy two hours later. Nothing broke. The window just filled with old file versions, dead-end attempts and instructions you have since changed your mind about.

The fix is not a bigger window. It is a habit: checkpoint, reset, resume.

Spot a stale session

Flip the cards. If you recognize two or more in your current session, it is time to reset.

🃏 Symptoms of stale context

Tap a card to flip it

Checkpoint, reset, resume

  1. WorkOne focused chunk of the task
  2. CheckpointCommit, then write a handoff note
  3. ResetClose the session, open a fresh one
  4. ResumeStart from the note and the code

↺ Repeat at every natural milestone

The code and the note carry the state. The session is disposable.

The key idea: state lives in the repo, not in the chat. A commit captures what was done. A short note captures what the code can’t: what’s left, what failed, what was decided.

A handoff note that works

Ask the agent to write it before you reset. Then read it: you’re the one who knows if it’s accurate.

Before we stop, write docs/progress/csv-export.md with:

- Goal: one sentence
- Done: what is finished and committed (with commit hashes)
- Next: the next 2-3 concrete steps, in order
- Decisions: choices made and why (so we don't revisit them)
- Dead ends: approaches tried that failed, and why
- Open questions: things I (the human) need to answer

Keep it under 40 lines. No code, only pointers to files.

Then the new session starts with one line: “Read docs/progress/csv-export.md and continue with the next step.”

✕ Marathon session

  • –One chat for the whole feature, all day
  • –Decisions buried somewhere in the scrollback
  • –Recovering after a crash means re-explaining everything
  • –Quality drifts and you can’t tell why

✓ Relay of short sessions

  • +One session per milestone, committed at each step
  • +Decisions written in a note you can review
  • +Any session, or a teammate, can pick up from the note
  • +Each session starts sharp with a small, clean context

The same handoff note is what lets you split work across several agents in parallel, which we get to in Module 5.

Before you move on

✅ Key takeaways

0 / 4 completed