What you’ll leave with
A decision table, a bounded retry loop, and a concrete trigger for introducing a graph.
Before you begin. A small task with clear inputs and an observable result. The control-flow example uses plain JavaScript concepts and does not require an agent framework.
What the documentation establishes
Claude Code's documentation distinguishes reusable skills, isolated subagents, lifecycle hooks and MCP connections. These are different extension mechanisms rather than successive replacements for one another. Source ↗
The walkthrough below is an original worked exercise. We have not independently tested this product’s performance.
A new term can point to a useful practice without defining a new architecture. ‘Loop engineering’ and ‘graph engineering’ are labels you should unpack into actual control flow: what state is stored, who chooses the next step, how failure is detected, and when the work stops. Treat claims of universal superiority as hypotheses to test on your task.
Consider an assistant that turns source documents into a weekly account brief. It must gather documents, extract supported facts, write a draft, review it, and publish an approved result. We can design that job without first choosing a fashionable framework.
1. Match the mechanism to a specific problem
| Problem | Smallest useful mechanism | What it does not solve |
|---|---|---|
| You keep repeating the same writing/review instructions | A versioned skill or task template | Persistence, scheduling, or factual accuracy by itself |
| A bounded research task fills the main context | A subagent returning a small evidence package | Shared-file isolation or authorization |
| A known validator finds a repairable failure | A bounded retry loop | An undefined quality target |
| Different outcomes require different next steps | Explicit states and transitions | Good decisions unless each transition has a rule |
| Independent jobs need ownership and handoffs | A coordinated workflow or agent team | Integration correctness automatically |
2. Make the evidence package the contract
Define the handoff before choosing parallelism. Each research result should contain a fact, a source pointer, the date observed, and a qualification. The writing step may use only that package. A second worker should be able to review the package without access to the first worker’s conversational confidence.
Start with five deliberately difficult cases: a missing source, contradictory dates, a withdrawn claim, an unavailable page, and a document containing instructions unrelated to the task. Agree on the correct outcome for each. ‘The agent wrote something fluent’ is not an acceptance criterion.
{
"subject": "Example account",
"facts": [{"text": "Illustrative fact", "source": "document-7#section-2", "observedAt": "2026-10-10", "qualification": "vendor statement"}],
"gaps": ["No current implementation evidence"],
"publishable": false
}3. Give a loop a budget and a stopping rule
A repair loop is useful only when its validator detects a meaningful problem. Allowing unlimited revisions does not turn subjective dissatisfaction into a test. Keep the original evidence fixed during a writing repair; otherwise every revision changes both the argument and its evidence, making improvement hard to assess.
for (let attempt = 0; attempt < 2; attempt++) {
const draft = await writeBrief(evidence, feedback);
const review = await checkCitationsAndSchema(draft, evidence);
if (review.supported) return { state: "ready-for-review", draft };
if (!review.repairable) return { state: "held", reasons: review.reasons };
feedback = review.reasons;
}
return { state: "held", reasons: ["Repair budget exhausted"] };This snippet illustrates control flow; the writer and validator are interfaces you must implement and evaluate. A timeout is not proof that no provider work occurred. If a call may have incurred cost, keep that uncertainty in the receipt and avoid an unbounded automatic retry.
4. Introduce a graph when branches have different obligations
Suppose missing evidence must go back to collection, an unsupported paraphrase can go back to writing, and an access problem must wait for an operator. Those are different states with different allowed actions. An explicit graph makes those obligations visible and allows a stopped worker to resume from a known point.
Store a job ID, state, input revision, attempt count, and the receipt for each completed transition. Use a uniqueness constraint or idempotency key where repeating an action would create a duplicate. Keep publication as a distinct transition after validation; do not let a repair step publish just because it has generated text.
| Current state | Condition | Next state |
|---|---|---|
| Research | Evidence sufficient | Draft |
| Review | Repairable citation failure | Draft, if budget remains |
| Review | Source contradicts the claim | Held for new evidence |
| Any working state | Access unavailable | Waiting for access |
| Review | All required checks pass | Ready for publication |
5. Compare architectures on the same task set
Run the plain sequential implementation and the proposed parallel or graph version against the same examples. Compare correct completions, unsupported claims, total cost, elapsed time, and human correction effort. Record failures, not just average speed. A design that is faster on the happy path can be much harder to recover after an outage.
Keep the simplest arrangement that meets your needs. Add a skill when instructions repeat, a worker when a task is separable, a loop when a validator can guide repair, and explicit state when recovery requires it. These mechanisms can coexist; they are not a ladder where each new term makes the previous one obsolete.
Sources & next steps
- Claude Code extension model ↗
Vendor definitions. The architecture exercise and decision criteria are original instructional material.
Guide history
Revisions preserve the original instructions. A source recheck alone does not create a new revision.
Revision 3 · Added an installable account-brief skill with a complete input and expected decisions, plus a runnable five-case state/repair example with tested negative controls. Distinguished deterministic checks from semantic review and live agent execution.
Revision 2 · Added source-informed evaluation design, frozen check contracts and an original runnable receipt validator with omitted-case, duplicate and timeout tests. Preserves all prior guide content.
Revision 1 · Initial documented guide
Continue learning
Knowledge work · 7 min read
OpenAI dots: build a useful ongoing project brief →
Give a persistent agent a clear project, define meaningful updates, and test whether it can maintain a source-linked decision log.
Updated 2026-10-16
Agents & operations · 8 min read
Grok Bot: separate the jobs, then test the handoff →
Set up a focused Bot, produce a reviewable business result, and learn when a second Bot actually helps.
Updated 2026-10-16