Dashboard
0%
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
51 small wins to finish your pathNext question →

Q46HardConcept

How do you keep an agent effective on long-horizon tasks that run for hours (e.g. a large migration)?

30-second answerSay your answer out loud first, then reveal.

Challenges: context exhaustion, drift from the original goal, compounding errors, losing track of what's done, and one bad step corrupting hours of work.

Techniques

  1. Externalised state:
    • PLAN.md / to-do list with status per item.
    • NOTES.md for decisions, gotchas and learnings.
    • Git commits per completed chunk, giving a natural rollback point.
  2. Chunking + verification: "migrate module X" → run its tests → commit → mark done. Never move on with red tests.
  3. Context resets with handoff: when context fills, compact or start a fresh session that reads the plan and notes files. An initial "setup" session can write the scaffold (plan, test commands) that later sessions follow.
  4. Goal anchoring: periodically restate the original objective and acceptance criteria; check progress against them.
  5. Durable execution: checkpoints so infrastructure failures don't lose progress (Q24).
  6. Budgets and stop conditions per chunk, plus escalation when stuck.
  7. Parallelism where safe: independent modules migrated by parallel agents in separate branches or worktrees, merged after verification.
Example. Migrating 300 test files from Jest to Vitest. The agent writes a migration plan listing all files, converts and verifies in batches of 10, commits each batch, records patterns it discovers in NOTES.md, and resumes from the plan after any interruption.

Little by little, you're building something great.