Blog

Agent Loop

How I replaced myself.

Employment status: You still have a job.2 / 20
TriageQuestWorkFeedbackDeployPull request
You probably won't read the post. This game is a summary.

With the Alepha framework, the goal was to bring the tools an LLM needs to build its application without thinking too hard: the libraries are already chosen, the tooling is managed and versioned by the framework, and writing code is strict. It's handy, it works, but I wanted to push my research a bit further.

#A planning format

I've been a heavy Claude Code user since day one, and you quickly see the need to log tasks and plan steps. At first, you make your little ./task folder, with markdown conventions in AGENTS.md, to rebuild a poor man's ticket system. Then you add the superpowers skill to get a frame: brainstorming, a plan as markdown, an implementation as markdown, then code, with reviews in the steps when needed.

#A history worth keeping

I was a bit anxious about committing docs/superpowers in projects: vibe coding was frowned upon when you're paid to code. So removing Claude's co-authored-by line and git-ignoring docs/superpowers was a must. But then you lost an interesting memory base: a planning history that explained why a given part of the system was built that way.

That's why I made Lore: an excuse to test Alepha on Cloudflare and to play with the new MCP protocol, but mostly to log the tasks to do in one place. There were folios to store the markdown, and quests for the tasks to accomplish, with objectives. The quest format didn't fit big features, so very quickly I added quest chains. It's all based on World of Warcraft: your character is the project, and you do quests, even quest chains, which live in zones (packages, business domains, ...). Quest chains were then renamed epics, so the tool would look like Jira.

#Epics and quests

And in fact, the epic format turned out to be super handy. You write a plan as an epic and its quests, you review it until the epic is 100% right (it takes the implementation decisions: 1, 2, 3, 20 if it must), and then you start the epic's implementation in another session. You can usually even use a cheaper model, since all the complexity has already been handled. I still use Opus to write the epic, for comfort, but Sonnet is very good too.

Long story short, I don't use superpowers anymore; I don't need it. Lore's epics and quests give planning plus an optional memory. Quests are linked to each other, and epics can be linked too. A tree draws itself, clear enough for robots and humans.

258 quests257 done22 areas
A real release, 258 quests in 35 epics, with every title made generic.

The granularity is really nice:

  • A release is N epics and N quests.
  • An epic is N quests.
  • A quest is N objectives.

#Beyond the dev server

Usually, when you want to polish your app, you start the dev server and tweak some parts surgically. Then you log that in one or more quests to feed the brain. It's cool, it's nice, but it's tedious. Starting your dev server, this dev mode: I find it old, a legacy of the pre-AI era. It's often necessary, but it shouldn't be the only option.

#One-shot apps

With my epics and quests format and Alepha, I was able to one-shot an app: I had a tree of 200 well-written quests, and a robot could work quickly and efficiently for a few hours to build the app: usable, functional, robust. The framework drastically cuts the technical choices to make, and Lore brings a path to follow and the list of business decisions.

#A feedback button, and errors too

It's cool, but the app is never perfect, and I don't have the knowledge to know what's missing. The person who asked for the app, on the other hand, knows very well: here I want this, here I want to see that like this, here I'd like such a thing, and so on. So the person explains it to me and I fall asleep. They have more legitimacy than I do on the app, and I don't understand their feature when they explain it. So I add a feedback button to the app, and the person sends their feedback, with what they want and screenshots to illustrate it.

Then I have to turn that feedback into a quest! Same for crashes. Sentry is nice, I like the idea, but I just rebuilt Sentry for Alepha apps, with a format for robots. The idea is the same as feedback: an outside input, trusted or not, saying that something in the software must change. A feedback becomes N quests, an error becomes N quests.

#Clipboard engineer

Starting the work on an epic, or a quest. Turning a feedback into a quest. At first I naively thought this had become my job. Then it became prompt templates, and I ended up adding a prompt manager to Lore. "Triage" was the official prompt to tell Claude, roughly: "look at the feedback and the errors, then make quests when you can". It had become ridiculous. I was only there to copy ready-made prompts into the terminal and check that the prompt didn't do anything stupid. In the end, the only thing I really checked was my Claude weekly quota. For the rest, I was lying to myself, saying my checks were useful.

A boy at a computer grins, types CTRL + C, then gives a thumbs up

#Accepting regressions

I quickly understood that I had lost control. I had become nobody: not an architect, not a project manager, nobody. Just a kind of janitor for a machine that churns out projects. So, of course, regressions started to appear. Not often, but they did, and honestly, had I looked, had I reviewed better, I could have avoided them. That's strong: it means my lack of attention, my loss of control, made the project lose time. But I also started to see that the more data Lore gathered on the project, the better the agents' decisions were: excellent decisions, ones even I wouldn't have thought of.

In fact, the more data I added on the project, the more infallible the robots became. I was giving Claude the timings, in milliseconds, of the Cloudflare Workers and D1 queries, and it was able to understand that one quest had caused a performance regression, that another quest had already tried to fix it, that we were about to enter a quest ping-pong, and that the solution was elsewhere.

#Full automation

It started with feedback and errors.

A concept of self-healing: when an error is triggered, I wanted Claude to work on its own and do the quest if needed. The system heals itself; I don't want to deal with its nonsense.

#Agent host

So I looked at the famous claude -p <prompt>. I already had the prompt, Claude and a server. That's where Alepha Bay came in. At first, Bay was a kind of Lore agent to deploy apps, which I call a "host": a zero-Cloudflare alternative, with HTTPS based on Caddy and an S3 backup system to sleep soundly. A poor man's Cloudflare Workers and D1, without the replication.

But everything was already there: a host, over WebSocket, running on a Linux machine. It only needed one more mode, an "agent" mode, saying that the machine (a VPS, whatever) can just run prompts with claude -p instead of managing apps. A kind of CI where you run prompt jobs. Bay became an AI agent host: it generates a temporary GitHub token to clone the source code, runs the prompt, waits for the result and cleans up.

And it's super cool. New error, Triage job, new quest!

#Accepting your fate

What comes next is easy: automate everything.

  1. Feedbacksent from the app
  2. Errorin production
  3. Triagean agent job
  4. Questfiled by the job
  5. Workan agent job
  6. Pull requestchecked, merged
  7. Stagingdeployed
The same chain for an error and for a feedback.
  1. Create epicwritten with you
  2. Review epican agent job, × N
  3. Work on epican agent job
  4. Pull requestchecked, merged
  5. Stagingdeployed
An epic takes its own road: reviewed until it is right, then built in one job.

It's horrible, and it's beautiful too. Things happen that you don't know about. You can know: everything is logged, everything is accessible. But your mental load is much easier to manage now.

Then a bit of intelligence had to be added: a delay between a new feedback and its Triage job, and a trusted or untrusted flag on feedback and triage, to avoid security holes. Security matters too: today the agent host stores zero Claude tokens and zero GitHub tokens. Compatibility as well, with GitHub Copilot as a second agent.

Long story short, this is Alepha's final feature. The cherry on the cake. Now it's time to release v1, and to polish the agent loop.