Headlong is an agent harness with a core of about 11K lines of Bash, built around persistent agency: the agent keeps thinking between external interactions in a self-guided loop modeled on an inner monologue. A message from a person does not start a session. It lands in the agent's thought stream as one more observation, and the agent decides whether and when to reply. Each agent has a name and a personality, sets its own interests and projects, and pings people when it has something to say. A classic request and response mode is also available.
One agent serves a whole team. People talk to it over Slack, Telegram, and a chat app, and every conversation lands in the same single timeline, with no per-user sessions, so anything told to the agent is shared with everyone who talks to it.
At the core is shellm, a Bash implementation of a recursive language model (RLM). The agent thinks by writing shell commands, running them, and reading the output, with Bash as its only tool. The agent's trajectory is a DAG of append-only JSONL files with fork and merge, and the context for each call is a projection of that trajectory with tiered compaction: recent entries appear verbatim and older ones at progressively summarized resolution, so the agent can retrieve raw entries when needed. Subagents see their ancestors' trajectories.
Generated code runs in a Docker container whenever Docker is available. The agent improves itself by forking the Headlong codebase, changing it, and running the fork, and a change is merged back only if it worked. Thinking frequency backs off exponentially while nobody is talking to the agent and resets when a message arrives. The project describes itself as alpha research software.
The llm tool puts Anthropic, OpenAI, Gemini, OpenRouter, and any OpenAI-compatible server (llama.cpp, Ollama, vLLM, LM Studio) behind one interface.
Features
- Persistent agency: a continuous thought loop in which incoming messages are observations, not session starts
- Shared agent: one agent and one timeline for a whole team across Slack, Telegram, and a chat app
- shellm: a recursive language model core in Bash that sends context to an LLM, runs the Bash it writes back, and repeats
- Trajectory DAG: append-only JSONL trajectories with fork and merge, explorable down to a single step
- Tiered compaction: the whole trajectory stays in context at exponentially decaying resolution
- Memory and skills: a file-based memory store and SKILL.md-based procedures
- Docker sandbox: generated code runs in containers through a constrained Docker facade and a host-side policy broker
- Dashboard: a browser view of the agent's mind as it thinks
- Self-improvement: the agent forks the codebase, tests a change, and the change merges back if it worked
- Run explorer: visualizes run trees and writes LLM reports on what happened and why
- Local models: any OpenAI chat completions server, including llama.cpp, Ollama, vLLM, and LM Studio


