How to Keep AI Running for 10 Hours Straight Without Crashing?


Unveiling the "Harness Engineering" Method Endorsed by Anthropic!
Many people run long tasks with Claude Code, but as they go, the AI becomes dumb or even stalls.
The reason is simple: the context window overflows.
Today, I’m sharing a system-level solution (Harness Engineering) that allows AI to have "unlimited endurance," not only enabling it to work but also to evolve itself.
1⃣ Core Principle: Reset the Context
AI has limited memory. Anthropic’s official approach is: break large tasks into smaller pieces, and each time, let the AI perform a small task in a brand-new, clean context.
❌ Wrong approach: dump all requirements into the AI at once.
✅ Correct approach: decompose tasks -> execute in independent sessions -> record progress -> repeat in the next cycle.
2⃣ Solution Comparison: Ralph vs Multi-Agent
Option A (Ralph Loop): Write a Bash script with a while loop that forcefully restarts a new session. Simple and crude, suitable for tech enthusiasts.
Option B (Multi-Agent Collaboration - Recommended): The approach I use. More flexible, more like a real team.
Main Agent (Coordinator): Only responsible for scheduling, never writes code (keeps the context extremely clean).
Sub-Agents (Workers): Planning, development, testing (layout/appearance/animation). Each has its own role and independent context.
3⃣ Workflow Design (Key!)
My practical workflow:
Main Agent receives requirements -> hands off to Planning Agent for scheduling.
Main Agent gets the plan -> assigns to Development Agent to write code (only pass file paths, not large code blocks!).
After development -> assigns to Testing Agent to find bugs.
Bug fixing loop: If testing fails? Wake up the same Development Agent with a resume parameter to fix bugs (preserving the current context), instead of opening a new session!
4⃣ The Secret Sauce for AI Self-Evolution
Lessons Learned: Build an experience library file. Every time you hit a snag, force the AI to write the mistake into it. Next time, read this file first to avoid repeating errors.
File communication: Agents only pass file paths, not content. The main Agent’s context always contains just a few lines, never overflowing.
I ran this system overnight, generating over 20 pages of high-quality PPT slides.
True Harness isn’t about making AI smarter, but designing a process that doesn’t rely on AI’s memory.
View Original
This page may contain third-party content, which is provided for information purposes only (not representations/warranties) and should not be considered as an endorsement of its views by Gate, nor as financial or professional advice. See Disclaimer for details.
  • Reward
  • Comment
  • Repost
  • Share
Comment
Add a comment
Add a comment
No comments
  • Pin