Agent Autoloop Lets Your Coding Agent Quit the Moment It Needs You

A self-hosted kernel that routes events to Claude Code or Codex, writes every fact to SQLite, and wakes you only when a decision is waiting.

7 min read • View on GitHub • More from KKKKhazix

A wide ink illustration of an empty office desk after hours: a single lamp, a chair pushed back from the desk, one small upright card standing on the surface, a mechanical articulated hand withdrawing from it, and a stack of finished pages in an out-tray beside an empty one. The scene depicts the article's central idea that the agent process has exited while a human decision sits waiting on the desk.
The work is finished, the worker has gone, and the one thing that could not be decided alone waits on the desk. That is the whole lifecycle in one frame.

我希望它应该是极其轻量、快速、安全,但同时也是可扩展性极佳的。

KKKKhazix, Creator and repository owner · Techub News announcement
Key Takeaways

The Agent Quits When It Needs You

It is 02:00. A GitHub issue opens on a repo you maintain. A small always-on hub is watching the repo's webhook, matches the event against a rule in a JSON file, and spawns Codex with a prompt. Codex reads the issue, drafts a triage note, and reaches a judgement call it will not make on its own: is this a bug or a feature request, and does it deserve a reply tonight?

So it prints a card and exits. Not idles. Not blocks on input(). The process is gone. Nothing is running. The question is now a row in a SQLite log, and a notification is sitting on your phone. You read it over coffee at 08:00, tap an option, and Codex is respawned with its session intact to finish the job.

That is the whole thesis of KKKKhazix/agent-autoloop, and it reframes what a background agent even is. Every human-in-the-loop system you have used keeps something alive while it waits. Autoloop argues the process is the least important part.

Step through the lifecycle and watch the one thing that matters: the Hub column never dims, the agent box blinks out, and the log keeps growing while nothing is running. Toggle the two modes to see the exit-and-resume model next to the keep-it-alive model.

The README describes the intended effect plainly: let your command-line agent take jobs on its own in the background and follow through to the end, and normally it does not bother you, sending a card only when it is unsure.

中台只让它在原会话里重写最后这段回复,不会把已经干完的业务重做一遍;重写也失败时,保留原结论并通知你回执没有生效。

KKKKhazix, Creator and repository owner · KKKKhazix/agent-autoloop README

(The README's own words, roughly: the hub only asks the agent to rewrite its final reply inside the original session, so it never redoes work it has already finished. If the rewrite fails too, it keeps the original conclusion and tells you the receipt did not take effect.) That is the resume guarantee in one sentence.

One Year, Then a Rewrite

KKKKhazix spent a year on this before releasing it. The first version worked, but it was not the version that shipped. The creator's announcement describes a redesign that split the core from four separable concerns: event sources, agents, notification channels, and delivery pipelines, so each could be swapped as a plugin.

A WSJ hedcut-style ink portrait of KKKKhazix, the creator of Agent Autoloop, rendered in black stipple and hatching.

Roughly translated: I wanted it to be extremely lightweight, fast, and safe, while also being extremely extensible. That tension between a tiny core and a wide surface is the design brief. The kernel is about 1,800 lines with zero runtime dependencies, MIT licensed, and it requires Node 24. The announcement credits two influences: Pi's minimal-kernel-with-extensions design, and DeepSeek Harness's everything-is-a-plugin architecture.

The creator's stated motivation is narrower than the feature list suggests. In the same announcement, the reason behind the whole project: human attention is, and always will be, the most precious asset.

Rules, Not Code

The routing surface is a single file, ~/.agent-autoloop/rules.json. A rule pairs a trigger with an agent and a prompt. One cron rule, one source rule:

[
  {
    "name": "morning-brief",
    "when": { "cron": "0 9 * * *" },
    "to": "codex",
    "cwd": "~/notes",
    "prompt": "Summarize anything that changed in this folder overnight."
  },
  {
    "name": "issue-triage",
    "when": { "source": "github", "types": ["issues.opened"] },
    "to": "claude",
    "cwd": "~/repos/site",
    "parallel": 3,
    "prompt": "Triage this issue. Ask before you reply publicly."
  }
]

The difference from a bare cron job is not the schedule. A cron job runs a command and forgets it. A rule here carries the agent choice, the working directory, a concurrency limit, and the prompt, and its output is persisted as events rather than lost to a log file.

Two commands make the config honest. agent-autoloop rules explain prints the effective rules, the agents, the channels, and the next cron fire time exactly as this machine would run them. And emit <type> --dry-run tells you which rule would catch an event before you send it, or warns that no rule takes it at all. Both are read-only and never touch the running hub.

The Protocol Is a Code Fence in stdout

Here is the part that makes people stop reading and look up. The contract between the agent and the hub is not an SDK, not a client library, not an API key. It is a fenced Markdown block in the agent's final message.

agent-autoloop
{
  "ask": [
    {
      "title": "Reply to issue #412?",
      "text": "This looks like a feature request, not a bug. Draft a reply?",
      "options": ["reply", "skip", "escalate"],
      "key": "shipping"
    }
  ]
}

The worker parses the final output of the CLI process for this block. If it finds an ask, it raises a question card. If it finds a notice, it sends a one-way message. If it finds nothing, the run just ends. Any tool that can print text and exit can participate, which is why the README claims any command-line tool can be plugged in.

The init command also accepts a raw command template, --command 'somecmd {prompt}', where {prompt} is passed as a single argument. That single-argument rule is the shell-injection guard: the prompt cannot be split into extra flags or chained commands.

A close-up ink illustration of a strip of ticker tape emerging from a machine slot, printed with a small fenced code block marked by tick marks at top and bottom, while a pair of human fingers pinches the free end of the tape and crosshatched metal rollers sit behind. The scene makes the article's point that the agent-to-hub protocol is literally a fenced code block printed to stdout and read by hand.
The integration surface is a strip of text. The machine prints it, a person reads it, and that is the entire protocol.

Under the Hood: A Log, a Hash, and No Version Numbers

The storage layer is two tables. facts is an append-only log: a sequence number and a JSON blob. projections is a generic key-value store of JSON documents, keyed by collection and key. Everything the system knows is derived by folding the log into the projections.

The clever part is how the relational views are built. Instead of hand-writing them, the runtime regex-parses kernel/schema.sql, extracts each column name, and generates a SQL view per table that does json_extract(data,'$.col') AS col over the projections. The schema file is the single source of truth for both the table shape and the JSON paths inside it.

The fingerprint is the reward for the reader who stayed. The runtime hashes the source text of the files that define how facts fold into state (evolve.ts and credentials.ts), plus the master key. When that hash changes, the projections are rebuilt from the log automatically. The code comment makes the invariant explicit: the persisted projection is expendable, and the log alone rebuilds it.

That buys you a system with no version number to bump and no migration to write. The tradeoff is real: any cosmetic edit to those two files forces a full rebuild, and the cost of that rebuild grows with the size of the log. Views are dropped and recreated inside one BEGIN IMMEDIATE transaction so no other process ever sees the gap between them.

The same restraint shows up in the scheduler, which is not a scheduler. One setTimeout is re-armed after every change to fire at the minimum of three things: the earliest scheduled item, the earliest long-polling waiter, and a retry timestamp. It clamps to the largest value Node's timer accepts, about 24.8 days, a detail a lot of implementations miss.

How It Compares

The fastest way to place Autoloop is to say what it is not. It is the glue between triggers, a local CLI agent, durable task state, and human approval. It is not a workflow engine, not a visual builder, not a multi-agent framework.

ProjectWhat it isWho runs the agentHow you get pulled inDurability model
Agent AutoloopLocal event-to-agent hubThe hub spawns the agent as an intermittent subprocessCards via Feishu, desktop, or webhookEvent-sourced SQLite log
LangGraphLibrary for stateful agent graphsYou write the graph and run itA human-in-the-loop node you authorYour choice of checkpointer
TemporalGeneral durable execution platformYour workers run arbitrary codeApprovals are signalsDurability is the product
n8nVisual workflow automationNodes call servicesApprovals via integrationsWorkflow state
OpenHands / SWE-agentAutonomous software-engineering agentsThe agent is the productNo external event routerThe agent's own run

The axis that separates Autoloop from all of them is not features. It is where the process lives while a human thinks. Everyone else keeps something running. Autoloop writes a row and exits.

What's Proven and What Isn't

The repo is unusually candid about the line between tested and assumed, and that honesty is worth taking at face value.

None of that undercuts the design. It just means you should treat the untested integrations as templates to adapt, not turnkey connectors, and read the README's own verification notes before you wire it into anything that matters.