You type a prompt, the engine starts working, and a few minutes later there is new code. But what actually happens in between? In this short lesson Ariel opens the hood on CLI coding agents: Claude Code, Codex CLI, the Pi coding agent, OpenCode and the rest. These are also the engines underneath fancier tools like Antigravity, and even OpenClaw. Spoiler: from high up, they all work more or less the same way.
Step one: gathering context
Your prompt is not the first thing the model sees. The moment you hit enter, the tool starts a stage called context gathering, and that context is built from three layers:
- The system prompt. This is what the product itself writes for the model behind the scenes, before your files and before your words. Claude Code, Pi, Codex, Antigravity: each one has its own. With open-source tools like OpenCode or Pi you can simply read it. With Claude Code, Ariel notes, you can read it too, because its code leaked.
- Your project file. Usually
CLAUDE.mdorAGENTS.md, depending on the tool, assuming you use one. It gets loaded on top of the system prompt. - Your prompt. The thing you actually typed.
Those three together are the package the tool works with. (If you want the deeper background on why everything has to be resent every time, see why AI is stateless.)
Step two: the big loop
Now the tool enters one very big loop:
- Call the LLM. The model gets the whole package.
- Tool call. Most of the time the model answers with a request to use a tool: file read, file write, file edit, bash (run a command in the terminal), search, web fetch, web search. Every product has its own toolbox, and some have many strange ones.
- The result goes back to the model. The output of the tool is added to the conversation.
- “Did I reach my goals?” At the very start, the model defines goals for itself. On every turn of the loop it asks whether they are met. If not, it goes back to the model with the latest tool result and keeps going.
That is exactly what you see on screen when Claude reads a file, comes back to itself, reads another file, comes back to itself, until it actually tries something. And if you did not forbid it, it will also check its own work: on an Angular project, for example, it will try to build and make sure there are no errors. The moment it decides “yes, my goals are achieved”, it exits the loop and tells you it is done.
That is the whole secret, very simplified and seen from very high up. Every one of these smart tools has this inner loop at its core. (For the engineering side of loops, see AI agent loop engineering.)
So what is the difference between them?
When Ariel started researching this, he asked his own agent to map the field, and there are about 100 tools. He focuses on the popular ones:
- Pi coding agent. The most bare-bones of them all, and the engine behind OpenClaw. No add-ons, no plan mode, no fancy task breakdown. Just context gathering, the loop, and out. Need a plan? Make yourself a
plan.md. Need tasks? Write a todo. Its whole instruction is basically “you are a programmer, solve the problem.” That makes it great for two things: it saves a huge amount of tokens, and it suits professional developers who do not need Claude to hold their hand. Because it is open source and built in the open, it is very easy to write extensions for it, and there are tons of them. Think VS Code plugins, or installing Linux and then adding whatever software you want. - OpenCode. Belongs to the open-source community, for everyone who prefers not to use closed code. Today you can point most of these tools at almost any model with one command, but Pi and OpenCode live in the open-source world, which is why they are less popular in enterprise.
- The enterprise side. OpenAI’s Codex CLI is in the group that did not take off as much, in Ariel’s view. The Copilot CLI and GitHub Copilot are the well-known, successful ones there, because they serve enterprise needs a bit better. Claude has also become a strong enterprise option since Anthropic teamed up with Microsoft.
- Claude Code, the big winner. Not only because Anthropic’s models are naturally strong, but because they know how to orchestrate the whole thing so it simply works better. Plan mode and execution mode are done properly, there are plenty of extra commands, and above all: sub-agents. Everyone has sub-agents, but Claude Code gets them to work as an actual team, not as independent messengers that run off and come back with an answer.
Ariel’s recommendation follows from that: even if you work with other models, open-source or otherwise, try running them inside Claude Code. There is no problem launching Claude Code with a different model, and when you close it and open plain Claude Code again, it goes back to its default Anthropic models. Weak models inside Claude Code tend to give better results than the same weak models in other tools, because the harness does so much of the work.
Further up the ladder
Above the CLI engines sit tools like Antigravity, which take your activity and break it into more tasks, make it more visual and supervise it more closely. Then there are tools like Lovable that work behind the scenes for you, and tools where you just open an issue on GitHub and the agent argues with itself behind the scenes until the thing works. Each step up takes you further away from the code itself.
And then there is OpenClaw. It is very easy to give it a goal, set a cron so it runs every X amount of time, and let it drive these coding agents behind the scenes through ACP (the Agent Client Protocol): launch them, wait, get the answer back. That way you enjoy their smart worlds, and because it has a cron or a heartbeat, OpenClaw sits there guarding the goal. You define the top-level goal for your app or product once, and it keeps working until it is ready. (That exact setup is in agents that work while you sleep.)
๐ฅ Roast Corner
Let’s start with the loop. The most advanced coding agents on Earth are built around one sacred question: “did I reach my goals?” They ask it after every file read, every edit, every build. And yet on March 31, 2026, Anthropic shipped a source map file inside the Claude Code npm package and the entire Claude Code CLI source leaked, roughly 512,000 lines of it. Somewhere, a release pipeline ran npm publish, asked itself “are my goals achieved?”, and confidently answered yes. Which is how the system prompt went from “closely guarded secret” to “a teaching example in a YouTube lesson”.
Then there is Ariel. To figure out which AI coding agent is best, he asked his AI agent to research the roughly 100 AI coding agents, so that he could pick the one his AI agent will launch through ACP on a cron while he is away from the keyboard. At this point the only manual step left in his stack is Ariel reading the WhatsApp summary. Give it a quarter. Soon the agent will be researching which Ariel to use.
๐ค AI for Humans
This lesson was about loops that gather context, act, and check the goal. Here is that same idea aimed at people who usually get left out of the digital world. Google.org, Google’s philanthropic arm, gave Israel’s Clalit Health Services a $2 million two-year grant to build an AI conversational assistant that helps patients through their whole healthcare journey, from preparing for an appointment to follow-up care.
The interesting part is who it is for: patients who struggle with digital services because of language barriers, limited literacy, or no smartphone or internet. The system uses speech recognition so people can talk in their own language and natural way of speaking, report symptoms, book appointments and do preliminary intake without typing. A separate voice service works over landlines and regular phones, including the so-called kosher phones that do not support apps or text messages. Calcalist notes this could matter especially for parts of the Arab and ultra-Orthodox communities.
Clalit says it will build on its existing medical record systems, keep patient data inside its protected network with encryption and de-identification, and eventually release the code and methodology as open source for health organizations worldwide. A pilot comes before a national rollout, and there is no published timetable yet. Source: Ctech by Calcalist.

๐ฌ Comments