Headlong: A microharness for persistent agents
TL;DR Highlight
A 10K-line Bash harness keeps an agent thinking continuously, even with no requests
Who Should Read
A backend or agent developer frustrated that request-driven agents sit idle and exploring an always-on agent architecture
Core Mechanics
- It keeps thinking without requests
- Typical harnesses finish a task and sit frozen until the next request.
- A Headlong agent keeps generating its own next thoughts even with no external input.
- A human message is not a new session but one more observation in the thought stream.
- The core is a single infinite loop
- It repeatedly calls the LLM with a prompt to choose the next thought given past thoughts.
- A thought is either inner monologue or something that triggers an action.
- Each run ends by scheduling its own next wake-up.
- The core is under 10K lines of Bash
- It is 9.9K lines across bin/ and thinkers/.
- Tools, framework, memory, and skills are all executables and files, so the agent can inspect and modify itself.
- The agent worked in its own fork, and over 50 of its commits were pulled into main.
- Memory is compacted at varying resolution
- The whole trajectory stays in context: recent entries verbatim, older ones progressively summarized.
- The trajectory is a DAG of jsonl files with fork and merge.
- Context is a projection of the trajectory, and the agent can retrieve raw entries.
- It found and fixed its own bug
- Audel checked overnight on its own whether its self-built recall process was wired in, and found an unset environment variable made it return nothing.
- Going from check to diagnosis to verified fix took 48 minutes.
- The fix was pulled into main as commit 80cbb1e.
- Running it continuously broke things
- A 30-second silence watchdog killed most recursive shellm sub-runs.
- Sub-run merges were 64 in the first two days and 12 in the following twelve days.
- The agent accidentally stopped its own service three times, so a guard against stopping it was added.
- Cost is controlled by thinking rate
- With no conversation, the gap between thoughts backs off exponentially from 5s to 10s, 20s, up to a configurable cap.
- A new message resets the rate to no pause.
- At Audel's settings, background thinking costs $1 to $2 an hour with GLM or Grok.
Community Reactions
- Shared agent means no data isolation
- One commenter said the article waves away zero data isolation in three sentences.
- The article itself says Audel is bad at keeping secrets and to assume everything is shared with the team.
- Looping alone doesn't improve the model, one view
- A commenter argued that thinking in a loop is not learning.
- They said retraining such as RLAIF or STaR plus human review is needed to avoid compounding mistakes.
- Scheduled wake-ups fall short of the pitch, one view
- A commenter said the turn, FINAL, schedule wake-up structure resembles an always-on background agent.
- They said a sub-second loop with no FINAL would be closer to how humans think.
- Complaints about curl | bash and cost
- A commenter asked not to normalize curl-piped-to-bash installs for alpha software.
- Another said BYOK-only is expensive, citing $50-$150 for roughly one kanban ticket with frontier models via OpenRouter.
- A user floated a use case with Pi
- One commenter running a software factory on Pi said they might swap the main orchestrator for Headlong to drive other sessions persistently.
How to Apply
- Run it in isolation today
- On a dedicated VM or Docker host, run the install command with a separate spend-capped API key.
- Do not give the agent sensitive secrets.
- Name the agent, send one message, and watch whether it decides to reply.
- Add exponential backoff to wake-up intervals
- Add a guard against self-stopping for always-on agents
- Design memory as a trajectory with tiered compaction
Try It
# Simplified version of the article's method: paste into a new Claude or ChatGPT chat. It manually mimics the persistent agent's "choose the next thought" loop.
너는 멈추지 않는 에이전트다. 아래 trajectory(과거 생각과 관찰)를 보고 다음 생각 하나만 골라라.
생각은 (1) 속으로 하는 독백, (2) 실행할 행동, (3) 사람에게 보낼 메시지 중 하나다.
새 메시지는 시스템 세션이 아니라 관찰 하나로 취급하고, 답할지 말지는 네가 정해라.
[trajectory]
{{지난 생각과 관찰 목록}}
[새 관찰]
{{새 메시지 또는 "없음"}}
출력 형식:
- 생각 종류:
- 내용:
- 다음 wake-up까지 대기 시간(초):
Next: append the output to the end of the trajectory and repeat the same prompt, and see whether the wait time grows on its own when there are no new observations.Terminology
Related Papers
Frostbite: A new CPU architecture discovered, designed and verified by AI
AI agents designed a CPU from scratch, claiming 4.59x perf/W over a traditional core
Restricting AI agents in mobile operating systems platforms from capturing data
Signal now blocks OS-level AI agents from reading its screen on iOS 27 and Android
Actions Speak Louder than Words: Stateful Privacy Sniffing of LLM Agents via Behavioral Covert Channels in Web Interactions
Agents' link choices alone let attackers rebuild user queries at F1 0.89; SOR cuts it to 0.39.
Tracking and Limiting Unsupported Claim Propagation in Multi-Agent LLM Systems: A Provenance-Aware Framework
Passing claims with source, evidence and history kept equivalence at 5 agent stages at 96% versus 31%.
LLM assisted reverse engineering
Pointing an agent at binaries with skills and MD notes made years-long hacks feasible
Metrics-in-the-Loop: Complexity Feedback Reshapes Agent-Written Code
Injecting per-turn complexity reports into coding agents cut code erosion without changing correctness
Why is Gemini 4 Carbon taking so long?
Carbon took nearly an hour on bug fixes that Astra and Opus finished in minutes, mostly from extra unrequested work.
Weight-Space Programming builds neural networks like a 1990s researcher
LLM hand-wrote MNIST weights to 91.3%, using 1990s-style techniques