Most people treat prompt chaining like a relay race. Pass the baton, hope the next runner catches it. That works fine for simple three-step workflows. It completely falls apart when you're doing anything with real complexity, multiple decisions, branching logic, or tasks that take more than a few exchanges to complete.
I've built a lot of these systems. Client onboarding pipelines. Research-to-draft workflows. Code review loops. Feature spec generators. The ones that broke almost always broke for the same reason: the chain had no memory of what it decided earlier.
Each prompt was essentially starting fresh with a summary of what came before. That summary was either too thin to be useful or too long and diluted to stay accurate. Claude would drift. Contradict earlier outputs. Lose the thread of a decision made in step two by the time it hit step six.
This post is about how I fixed that.
The Core Problem With Most Prompt Chains
When you build a prompt chain, you're managing state. Every decision, constraint, and piece of established context from earlier steps needs to survive into later steps. The question is how you carry it.
Most builders do one of two things:
- Dump the entire prior output into the next prompt and hope the model picks out what matters
- Write a manual summary and inject it as a context block
Both approaches have failure modes. Full output dumps bloat the context fast and bury the signal in noise. Manual summaries require you to be in the loop for every transition, which defeats the point of automation.
What actually works is treating state like a structured object, not a blob of text.
The State Object Pattern
Before I run any multi-step chain, I define a state schema. Not a complex one. Just a simple structure that captures the decisions and constraints that need to survive the whole run.
It looks something like this in practice. Say I'm running a feature spec pipeline. My state object tracks things like: the core user problem, the constraints we've locked in, the approach we ruled out, and the acceptance criteria we've already agreed on.
At the end of each step, I have the model output the updated state object in a consistent format, usually JSON. That object, not the full output, gets injected into the next prompt. The full output gets stored separately if I need it for review.
This does two things. It forces the model to summarize what actually changed and matters. And it gives each subsequent step a clean, structured anchor instead of a wall of prose to parse through.
The Update Prompt
The trick that makes this work is adding an explicit state update step at the end of each chain node. Not as part of the main task prompt. As a separate follow-up.
After Claude does the work of step three, for example, I send a second prompt in that same call or immediately after. It says something like: given what we just decided, here's the current state object, update only the fields that changed, return the updated object in the same schema.
This keeps the state clean. Claude isn't trying to do the work and update the ledger at the same time. Two jobs, two prompts, one turn.
