From chat to graphs in Claude Code
Claude Code now gives you four ways to get work done. You can chat with it. You can put it on a loop with /loop or /goal. You can have it send out subagents. Or you can have it write a workflow, a script that runs dozens of agents in a fixed pattern while you get on with something else.
It is tempting to read these as a ladder, with chat for beginners and graphs for experts. That reading gets the tools wrong and costs real money. All four run the same engine. What changes is who holds the plan: who decides what happens next, what starts the next step, and what makes it stop. Pick by that question and the choice usually makes itself.
I built an interactive explainer that goes with this article. It has a step-through of the loop, a slider from chat to graph, the six standard patterns with diagrams, and a six-question helper that recommends an approach for your task.
Open the explainer: Who holds the plan? It runs in your browser and weighs about 50KB. The article below stands on its own if you would rather read.
The basic unit is already a loop
Every Claude Code turn is a small loop. Anthropic’s documentation describes three phases: Claude gathers context, takes action and verifies results, then repeats until the task is done. Each tool result (a file it read, a command it ran) feeds the next decision. This is the reason-then-act pattern from the ReAct paper (Yao et al., 2022), built into a product.
Here is what that looks like on a task from my own field. I ask Claude Code to check a week of traffic counts from one site for missing hours. It reads the file and finds 7 days of hourly counts by vehicle class. It writes and runs a short script to count the hours recorded each day. It expects 168 rows (24 hours times 7 days) and finds 162, so it isn’t done: the gap could be a counter outage or a broken file. It goes round again, searches the field log, and finds a note that the battery was replaced at 08:10 on day 3. Then it stops and reports.
I gave one instruction. Claude chose every file to read and every command to run. So even “just chatting” in Claude Code is agentic. The difference between the four modes is who closes the loop at the end of a turn.
Four answers to “who decides what happens next?”
Chat: you do. Within a turn, Claude decides. Between turns, you decide. You can press Esc to stop it, or type a correction while it works and Claude reads it after the current tool call finishes. Results live in Claude’s context window, the working memory of the conversation, which gets summarised when it fills. Nothing about the conversation is repeatable. Rules you want to keep belong in a CLAUDE.md file or a skill.
Loop: Claude does, toward a goal you set. Claude Code has two loop commands, and they differ in what starts the next turn. /loop re-runs a prompt on a timer, for example /loop 10m check whether the build finished. Recurring loops expire after 7 days, which stops a forgotten loop from running for ever. /goal starts the next turn as soon as the last one ends, and keeps going until a condition holds:
/goal all tests in test/auth pass and the lint step is clean
The useful detail is who judges the condition. After each turn, a separate small model reads the conversation and returns “not yet met”, “met” or “impossible”. It doesn’t run commands or read files itself, so write conditions that Claude’s own output can prove, such as a test result that appears in the transcript. The docs also suggest adding a limit to the condition, such as “or stop after 20 turns”.
Subagents: Claude does, and hands out the pieces. Claude spawns workers, each with its own fresh context window, and only a summary of each worker’s result comes back. This keeps the main conversation clean. Claude still decides, turn by turn, what to send out next.
Graph: a script does. A dynamic workflow is a JavaScript file that Claude writes and a runtime executes in the background. The script holds the loops, the branches and the intermediate results, so Claude’s context holds only the final answer. You start one by asking (“use a workflow to…”) or with the keyword ultracode. The documentation’s own comparison puts it in one row: for subagents, skills and agent teams, Claude decides what runs next. For workflows, “the script” does.
That shift has consequences. A workflow takes no input from you mid-run. You can watch it, pause it or stop it in /workflows, but you can’t steer it. In return you get something chat can’t give you: the orchestration itself is repeatable. Save a run that worked and it becomes a command you can run next month on new files.
What each step along the scale costs
More agents means more tokens, the units AI usage is billed in. Anthropic measured this on its own research system and published the multiples: a single agent uses about 4 times the tokens of a plain chat, and a multi-agent system about 15 times.
A Claude Code turn is a single agent, so chat sits near the 4 times mark. A /goal costs about the same per turn, but the total grows with every turn it takes. Subagents and workflows sit at 15 times or above, and every agent in a workflow counts. Claude Code shows a “Large workflow” warning when a run schedules more than 25 agents or its projected total passes 1.5 million tokens. The docs advise trying a workflow on a small slice first, such as one folder instead of the whole project.
The same Anthropic article is honest about where the extra spend pays. Multi-agent setups did best on research that splits into independent parts. They did worse where every agent needs the same context, and the authors note that “most coding tasks involve fewer truly parallelizable tasks than research.” More agents is not the same as better answers.
I learned this the expensive way. I once asked for a three-agent check of the documentation on a question that one search would mostly have answered. It used about 296,000 tokens. The answer was fine. One agent and a single search would have given me most of it for a small fraction of that.
Six patterns, one building block
Graphs did not arrive with Claude Code. Anthropic’s 2024 essay Building Effective Agents draws the line this article rests on. In workflows, “LLMs and tools are orchestrated through predefined code paths.” Agents “dynamically direct their own processes and tool usage.” The essay then names five workflow patterns and one agent pattern:
| Pattern | Shape | Use it when |
|---|---|---|
| Prompt chaining | Fixed steps in sequence, with checks between them | The task “can be easily and cleanly decomposed into fixed subtasks” |
| Routing | Classify the input, send it to a specialist | Distinct categories are “better handled separately” |
| Parallelisation | Several calls at once, then combine | Parts are independent, or several attempts raise confidence |
| Orchestrator–workers | A lead model splits the task on the fly | You “can’t predict the subtasks needed” |
| Evaluator–optimiser | One model drafts, another critiques, repeat | There are “clear evaluation criteria” |
| Autonomous agent | A model uses tools in a loop until it stops | Open-ended problems where the steps can’t be fixed in advance |
All six are built from the same block: a language model with tools, retrieval and memory. In Claude Code, /goal is a light evaluator–optimiser, because a second model checks the first one’s work. A workflow script that calls pipeline() over a list of files is parallelisation. Every ordinary turn is the autonomous agent. The explainer has a diagram and a failure mode for each.
The failure modes matter more than the shapes. A chain carries an early mistake through every later step. A router that misclassifies sends a confident answer to the wrong question. An evaluator with vague criteria either loops for ever or approves everything.
How I choose
My rule, which is my own summary of the sources and not a rule from Anthropic: start with the simplest option, and add structure only for a reason you can name. Anthropic’s version is shorter: start by “finding the simplest solution possible, and only increasing complexity when needed.”
In practice I ask a few questions of each task.
- Will I need to steer as it goes? If taste or judgement is involved, stay in chat. Workflows can’t take input mid-run.
- Is there a check that proves it’s done? If yes, and the steps are unclear, a
/goalwith that check as the condition fits. - Does it split into independent parts? If yes, but I can’t list the parts in advance, let Claude send out subagents.
- Could I write the steps down, and will I run this again? If both, write the plan as a workflow and save it.
Here is where some of my own tasks land. These placements are my judgement, and I’d test each on a small piece before relying on it.
| Task | Mode | Why |
|---|---|---|
| Drafting a Mwangaza article | Chat | Voice and audience need me at every turn. A fact-check pass can run at the end. |
| Fixing a TARA module until its tests pass | /goal | The test output proves when it’s done, which is what the evaluator needs. |
| Watching a tender portal or a long build | /loop | A fixed interval fits, and the 7-day expiry stops a forgotten loop. |
| QA across 40 traffic-count files | Workflow | The same checks on many independent files, with a verify step. Worth saving as a command. |
| A literature scan for a course | Workflow | Many sources, cross-checking, little shared context. The bundled /deep-research does this. |
| TARA’s production appraisal process | Code | A service that runs without me belongs in ordinary software, not in a Claude Code session. |
The last row is the one people skip. If something needs to run every day without a person watching, it has outgrown Claude Code. The Claude Agent SDK or a graph framework such as LangGraph is the next step there.
Four misconceptions worth dropping
“Graphs are the advanced stage you graduate to.” They are a different trade, not a higher level. Many tasks need one well-written prompt.
“A loop knows when it’s finished.” /loop stops when you cancel it, when Claude judges the work done, or after 7 days. /goal’s judge only reads the transcript. If the proof isn’t in the output, the judge can’t see it.
“A workflow makes the results deterministic.” The control flow is fixed. Each agent’s output still varies from run to run, which is why good workflows add verifiers and voting. This one is my reasoning rather than a documented claim.
“Start with a framework.” Anthropic suggests starting with the model directly, because frameworks “often create extra layers of abstraction” that hide what is actually being sent and make problems harder to trace.
Where to start
Take one task you did this week and ask who should have held the plan. If the answer is you, you were right to chat. If the answer is a check you could have written down, try /goal on it next time. If you have done the same steps three times on different files, that is a workflow waiting to be saved.
The explainer has a helper that asks six questions about a task and recommends a mode, with the reasons. Try it on something you’ll run more than once.
Claude Code changes often. Everything here is from documentation I read on 4 November 2026, and the limits and commands are worth checking against the linked pages before you rely on them.
Subscribe to Mwangaza to get the next guide when it’s published.
How this was written: Drafted with AI (Claude), edited and verified by the author.