Single logo
  • Courses
  • Blog
  • About
Join on SkoolJoin on Skool

In this topic

Claude
  • Claude.ai Interface Tour: Every Control You Need on One Screen
  • The AI Fluency Model: Delegation, Description, Discernment and Diligence
  • Working With Claude: Pick the Surface, Match the Model, Keep the Context Clear
  • Claude's Four Entry Points: Choose Chat, Projects, Artifacts or Research Before You Type
  • What Claude Can Do: Extended Thinking, Web Search, Artifacts and File Analysis
  • Getting More From a Claude Chat: Steer the Conversation Instead of Starting Over
  • Claude Research Mode End to End: From One Prompt to a Cited Briefing
  • Claude's Capability Layer: When to Use Skills, Code Execution or Memory
  • Code Execution and File Creation in Claude: Calculated Numbers and a Real Excel File
  • Adding and Using Skills in Claude: Let Claude Pick the Skill, Then Teach It Your Format
  • Claude Memory, Curation and Incognito: Keep What Helps, Remove What Has Gone Stale
  • Claude Styles, Preferences and Project Instructions: Three Dials, Three Scopes
  • Claude Projects: Knowledge, Instructions and a Real Workspace You Set Up Once
  • Keeping a Claude Project Current and Connected: Refresh, Prune and Grant the Least
  • Claude Scheduled Tasks: Let Claude Work on a Schedule and Email You the Result
  • Claude Code and Claude for Chrome: What They Are and Who They Are For
  • Anatomy of a Good Prompt: Role, Context, Task, Format and Examples
  • Shaping Claude's Output: Format, Tone and Length in a Few Words
  • Iterating and Refining a Prompt: Read, Diagnose, Adjust, Repeat
  • Five Prompting Patterns for Work: Summarise, Extract, Rewrite, Classify and Draft
  • Why Evaluating AI Output Matters Most: Trust, Then Verify
  • Spotting AI Hallucinations and Fabrications: Four Tells and Where Risk Spikes
  • Fact-Checking Claude's Answers: Four Techniques and a Line-by-Line Claim Log
  • Judging AI Output Quality: Four Questions That Score Any Answer
  • Adapting AI Output for Your Audience: One Answer, Three Readers
  • When a Human Must Review AI Output Before It Ships
  • A Personal Validation Checklist for AI Output: Six Lines, Any Draft
  • Fitting Claude Into Real Work: Where It Helps and Where It Never Should
  • Breaking Big Tasks Into Steps With Claude: Small Asks, Checked Hand-offs
  • Designing a Repeatable Claude Workflow: A Reusable Weekly Report Template
  • Measuring If Claude Is Actually Working: One Number, Before and After
  • Communicating AI Value and Limitations to Stakeholders: The Honest Pitch
  • Data Privacy With Claude: What Never Goes in a Prompt, and How to Redact a Document Before You Paste It
  • Responsible AI Use and Transparency: Helpful, Honest, Harmless, and One Honest Line
  • Troubleshooting a Weak Claude Answer: Name the Cause, Fix One Thing, Then Make It Cheaper
  • CLAUDE.md, settings.json and Plugins: Which Claude Code File Advises, Which Enforces, Which Packages
  • Authoring a Claude Skill: SKILL.md, Frontmatter, Progressive Disclosure and the Description That Triggers It
  • One Change, Four Environments: Where a Claude Config Edit Lands in Dev, Staging, Prod and CI
  • Claude in the SDLC: Prompts in Git, a Change Gate by Path, a Claude Review That Advises and a Person Who Merges
  • Hooks That Block Destructive Actions: a PreToolUse Gate That Allows, Asks or Denies
  • Choosing a Claude Code Extension: Skill, Hook, Rules File, Subagent, Slash Command or Plugin
  • Rolling Out Claude Code to a Team: Settings Precedence, dontAsk in CI, a Hook for Every-Time Rules and a Plugin for Five Repos
  • A Claude Code Review Bot in CI: Headless -p, JSON Findings, Team Rules in Git and a Person on the Merge
  • Lab: Three Planted Bugs in a Claude Code CI Repo, a Permission Mode, a Plugin Path and an MCP Token Variable
  • Configuring MCP Servers in Claude Code: A Command or a URL, Three Scopes, and Three Moves When One Breaks
  • Claude Code's Built-in Tools: Read, Write, Edit, Bash, Grep and Glob, and When Each One Is the Right Pick
  • The CLAUDE.md Hierarchy: User, Project and Directory Files, How They Stack, and the Team Rule Stuck on One Laptop
  • Split a 600-Line CLAUDE.md: @import Lines, .claude/rules Files and Which One to Pick
  • Path-Specific Rules in Claude Code: paths Globs, When a Rule Loads and the Glob That Matches Nothing
  • Claude Code Slash Commands and Skills: Project vs User Scope, $ARGUMENTS, context: fork and allowed-tools
  • Iterative Refinement with Claude Code: Input/Output Examples, Tests First and the Interview Pattern
  • Claude Code Sessions: Resume by Name, Fork From a Baseline, or Start Fresh With a Summary Card
  • CI Reviews That Don't Repeat Themselves: Prior Findings, Existing Tests and Test Standards in CLAUDE.md
  • The Claude Messages API: Your First Call, Field by Field
  • Claude Tool Use: How tool_use and tool_result Work in the Messages API
  • Claude Client SDKs Wrap One REST API: Raw HTTP, Python, TypeScript and Async Calls Compared
  • Anthropic SDK Timeouts, Retries and Error Classes: Configure the Client Once, Then Give 429, 529, 400 and Timeouts Their Own Move
  • Claude Streaming Events: The Event Order, message_stop, Tool Arguments, Stop Reasons and a WebSocket Relay
  • Images, PDFs and Thinking Blocks in the Claude Messages API: Typed Blocks In, Typed Blocks Out
  • Getting Data Into Claude: PDF Documents, the Files API, Search Results and Citations
  • Opus, Sonnet or Haiku: Pick the Claude Model per Job, and Test the Request When a New Release Arrives
  • Adaptive Thinking and Effort in Claude: Two Dials, Set per Workload, and the Thinking Block You Must Pass Back
  • Claude Cost Tracking From usage: Count Before, Cap During, Read After, Then Find the Line That Drives the Bill
  • Claude Cache Breakpoints: Where to Put cache_control, How to Move It With the Chat, and Why the Reads Stay at Zero
  • Claude Message Batches or Real Time: Choose by Who Is Waiting, Match by custom_id, Resend Only the Failures
  • Calling Claude Through Amazon Bedrock, Google Cloud and Microsoft Foundry: Same Call, Different Door
  • The Life Cycle of a Claude App: Six Phases, a Model That Retires, and a Release Gate for Every Change
  • Pinning Claude Model IDs and Upgrading Safely: One Change at a Time, a Golden-Set Replay and a Staged Rollout
  • Content Boundaries and Schema Design for Claude: Fence the Input in a Tag, Let the Output Say I Don't Know
  • The Agentic Loop and stop_reason: Keep Turning on tool_use, Stop on end_turn, Cap the Turns
  • The Claude Agent SDK: query(), ClaudeAgentOptions and @tool, in Python and TypeScript
  • Fix the Agent: Four Broken Claude Agent SDK Configs, From the Symptom to the One Wrong Line
  • Claude Managed Agents: Cloud Sandbox, Self-Hosted Sandbox or Self-Hosted Service
  • Agent SDK Hooks for Deterministic Actions: PreToolUse, PostToolUse, and Four Hooks That Fail Silently
  • Memory and Context-Window Patterns for Claude Agents: Context Editing, Compaction and the Memory Tool
  • Reading an Agent Trace: Five Signatures, Five Missing Patterns, and How Long a Fact Must Live
  • Tool Descriptions for Claude: How Claude Picks a Tool, and How to Stop It Picking the Wrong One
  • Tool Input Schemas and Error Responses for Claude: Required Fields, Enums, is_error and a Retry Flag
  • Tool Response Shaping and a Lean Tool Set: Give Claude a Sticky Note, Not the Filing Cabinet
  • Fix the Tool Schema: Read the Trace, Fix the Card, Re-Run (Four Real Schema Bugs)
  • Client Tools, Server Tools and Approval Gates: Who Runs the Tool, and Who Says Yes First
  • Built-in Tool, Custom Tool, Skill or MCP Server? Pick the Lightest One That Fits
  • System Prompt or User Turn: Where Each Instruction Goes, and Output Limits Your Code Enforces
  • Refine the Prompt One Line at a Time, Then Clean and Fence the Customer's Text
  • Prompt Revision Driven by Evals: Name the Cause, Change One Thing, Rerun the Whole Suite
  • Long-Running Sessions: Compact, Prune, Isolate or Start Fresh, Decided by Naming the Failure
  • Context Isolation Through Subagents: Read the Logs Elsewhere, Keep One Line
  • Defensive Parsing of Claude Replies: Check the Stop Reason, Read the Block or the Text, Then Validate the Values
  • Full Context or Retrieval: Choose by Corpus Size, Cost and Freshness
  • Skepticism Toward Confident Output: Check the Quote, the Record and the Sum Before You Send
  • Debugging a Claude App: Three Error Types, the Recovery Each One Earns, and the First Failing Row
  • Six Ways a 200 Can Still Be Wrong: Hallucination, Refusal, Under-Acting, Context Loss, Format Drift and Inconsistency
  • Fix the Cause, Not the Symptom: Four Recovery Drills for an LLM App, Each Checked on a New Input
  • Integration Layer or Model Output? Three Taps and Three Questions to Find Where a Wrong Answer Lives
  • Which Test Layer Owns the Failure? Unit, Functional, Integration and End-to-End Tests for a Claude App
  • Designing an Overnight Document Pipeline on Claude: Batch Lane, Live Lane, a Cached Prefix and a custom_id Reconcile
  • Proving a Model Upgrade Is Ready: A Frozen Golden Set, a Calibrated Judge, the Right Layer and a Release Gate
  • From Requirement to Design for a Claude App: Eight Requirements, Five Elements and a Trace With No Gaps
  • Build a Claude Refund App: the Messages API, Two Tools, an MCP Server and a Hook in One Loop
  • Ship a Claude App: an Eval Gate, Two Guardrail Layers, a Cost Check From usage and a Pinned Model
  • Lab: a 30-Case Golden Set, a Calibrated Judge and a Per-Slice CI Gate on a Claude Refund App
  • Lab: Cut a Claude App's Bill by 62 Percent With Usage Data, Layered Cache Breakpoints and a Batch Job
  • Lab: Three Planted Bugs in a Claude App, a Vague Prompt, a Mistyped Tool Schema and a Broken Stream Handler
  • Lab: Three Planted Bugs in a Claude Code CI Repo, a Permission Mode, a Plugin Path and an MCP Token Variable
  • Lab: Harden a Claude App, an Uncalibrated Judge, a Retry Loop That Retries Everything and a Hook Matcher With a Gap
  • Lab: Turn a Claude App Into a Reusable Template, One Pinned Model Id, No Key in Code and Evals Built From Data
  • Building an MCP Server: Tools, Resources and Prompts in Python and TypeScript
  • MCP Transports: stdio or Streamable HTTP, and Who Starts the Server
  • Deploying and Authenticating an MCP Server: Environment Keys for stdio, Bearer Tokens and Scopes for HTTP
  • Validation-Retry Loops for Claude Extraction: Send Back the Exact Errors, and Stop When a Retry Cannot Help
  • Multi-Pass and Multi-Instance Code Review with Claude: A Fresh Reviewer, Per-File Passes and an Integration Pass
  • When a Claude Support Agent Should Escalate: Three Clear Triggers, Not Mood or a Confidence Score
  • Error Propagation Across Subagents: Retry Locally, Then Report the Failure, the Attempts and What You Found
  • Human Review and Confidence Calibration: Check Accuracy by Type and Field Before You Stop Looking
  • Provenance in Multi-Source Research: Keep Every Claim With Its Source and Date, and Show Conflicts Instead of Settling Them
  • Lab: An Extraction Pipeline With a Nullable Schema, Validation-Retry, a 100-Request Batch and Human Review
  • Lab: A Research Pipeline With Parallel Subagents, a Timeout That Keeps Its Partial Results, and a Report With Its Trail
  • Coordinator and Subagents: Decompose, Delegate, Check Coverage, and Call Only the Spokes You Need
  • Passing Context to Subagents: Nothing Is Inherited, So Put Findings, Goal and Criteria in the Prompt
  • Parallel Subagents: Several Task Calls in One Response, Every Result Back in One User Turn
  • Task Decomposition: a Fixed Prompt Chain With an Integration Pass, or a Dynamic Plan That Adapts
  • Prompt Guidance vs Programmatic Gates: Block the Refund Until the Customer Is Verified, Then Hand Off a Card That Stands Alone
  • Scoped Tools per Agent and tool_choice: Three to Five Tools per Role, a Shared One, and auto, any or a Forced Tool
  1. Blog
  2. /
  3. Claude
  4. /
  5. Building with the Claude API

Passing Context to Subagents: Nothing Is Inherited, So Put Findings, Goal and Criteria in the Prompt

A synthesis subagent asked to write the report from the research has nothing to work from: it never saw the coordinator's chat. handoff.py builds the prompt it needs from findings.json: the goal, three quality criteria and three findings, each with its document and page.

Chaand Sheikh

·27 November 2026Building with the Claude API

What you will learn

  • Explain why a subagent sees only the prompt text the coordinator sends
  • Build a handoff prompt with complete findings, a goal and quality criteria instead of step-by-step orders
  • Keep content apart from metadata so every claim keeps its source and page
  • Describe a subagent with AgentDefinition (description, prompt, tools) and spot the "findings above" bug

Before you start

  • Coordinator and subagents: decompose, delegate, check coverage
  • The Claude Agent SDK: query and ClaudeAgentOptions

The research is done. The coordinator has three findings about city bike lanes, and it asks the synthesis subagent to write the report. The subagent can only ask back: which research?

A subagent starts with an empty head. It doesn't inherit the coordinator's conversation, and it doesn't share its memory. Whatever it must know has to be written in its prompt. This article shows what that prompt needs and how to build it, after the coordinator has done its research.

Two chats, no shared memory

On one side, the coordinator's chat: the user's request, web search results, two analysed papers, three findings with sources. On the other side, the subagent's chat. It's empty.

The coordinator makes a Task call that says write the report. From the subagent's side there's nothing to write about. It never saw the coordinator's chat. That separate, clean context is the whole point of a subagent (see context isolation through subagents), and it's also why the handoff has to be complete.

Think of hiring a new contractor. You remember every meeting and email; the contractor remembers nothing about your job. So you write a briefing pack: the goal, the facts, and where each fact came from. The contractor does the job from the pack alone. Your memories don't travel. In an agent system, the prompt is the briefing pack.

Only the prompt text crosses the arrow Coordinator context chat history web search results document analysis findings so far the history stays here prompt text goal + complete findings + quality criteria Subagent context only this text arrived no chat, no memory Task call
A subagent doesn't inherit context or share memory. What crosses is the prompt, and nothing else.

Findings, goal, criteria

So what goes into that prompt? Three parts.

  1. The complete findings. Every claim, every evidence excerpt, and its source. All of them, not a summary of them.
  2. The goal. What the report is for, and who will read it.
  3. Quality criteria. Cite every claim. Flag disagreements.

What to leave out: step-by-step orders like "Step 1: open finding 1. Step 2: write one line." A script breaks when the data changes. A goal and a quality bar let the subagent adapt.

Keep content apart from metadata

Here is the project's findings.json. In each finding the content (the claim and its evidence) sits in one object, the metadata (URL, document, page) in another:

[
  {"content": {"claim": "Protected lanes raised weekday bike trips",
               "evidence": "Counters on Main St showed more riders"},
   "meta": {"source_url": "https://example.org/city-cycling",
            "document": "City Cycling Report", "page": 12}},
  {"content": {"claim": "Riders felt safer on separated lanes",
               "evidence": "Most survey answers rated them safe"},
   "meta": {"source_url": "https://example.org/rider-survey",
            "document": "Rider Survey", "page": 4}},
  {"content": {"claim": "Shop sales on lane streets stayed steady",
               "evidence": "Monthly sales stayed in the usual range"},
   "meta": {"source_url": "https://example.org/shop-study",
            "document": "Shop Study", "page": 7}}
]

Because they are kept apart, the synthesis subagent can write the claim and attach its source: Protected lanes raised weekday bike trips [City Cycling Report, p.12]. Paste all the findings into one paragraph ("Protected lanes raised trips. Riders felt safer.") and the link is gone. Who said it? Nobody can tell. Metadata travels with each claim, so attribution survives. The findings in the file are made-up sample data.

handoff.py: build the briefing pack

The handoff itself is plain Python, 26 lines, no API key and no packages:

import json

GOAL = "Summarize what the findings say about city bike lanes."
CRITERIA = [
    "Use only the findings below.",
    "Cite the document and page after each claim.",
    "Say so if two findings disagree.",
]


def build_prompt(findings):
    lines = ["GOAL: " + GOAL, "QUALITY CRITERIA:"]
    lines += ["- " + c for c in CRITERIA]
    lines.append("FINDINGS:")
    for i, f in enumerate(findings, 1):
        c, m = f["content"], f["meta"]
        lines.append(f"{i}. {c['claim']}")
        lines.append(f"   evidence: {c['evidence']}")
        lines.append(f"   source: {m['document']}, page {m['page']}")
        lines.append(f"   url: {m['source_url']}")
    return "\n".join(lines)


if __name__ == "__main__":
    with open("findings.json") as fh:
        print(build_prompt(json.load(fh)))

GOAL and CRITERIA say what good looks like, not which steps to take. Inside the loop, c and m read content and meta separately, two reads, never mixed. And the source and page go on the lines right under each claim, so no claim travels alone.

Run python handoff.py. There's no model in this file, so the printout is the prompt itself, exactly the text the subagent would receive:

GOAL: Summarize what the findings say about city bike lanes.
QUALITY CRITERIA:
- Use only the findings below.
- Cite the document and page after each claim.
- Say so if two findings disagree.
FINDINGS:
1. Protected lanes raised weekday bike trips
   evidence: Counters on Main St showed more riders
   source: City Cycling Report, page 12
   url: https://example.org/city-cycling
2. Riders felt safer on separated lanes
   evidence: Most survey answers rated them safe
   source: Rider Survey, page 4
   url: https://example.org/rider-survey
3. Shop sales on lane streets stayed steady
   evidence: Monthly sales stayed in the usual range
   source: Shop Study, page 7
   url: https://example.org/shop-study

Goal and criteria first, then each finding with its claim, evidence, source, page and link. This text is the whole briefing pack. It's all the subagent gets.

agents.py: describing the subagent

In the Claude Agent SDK, the subagent itself is described with an AgentDefinition. The project shows this file but doesn't run it:

from claude_agent_sdk import AgentDefinition
from claude_agent_sdk import ClaudeAgentOptions

synthesizer = AgentDefinition(
    description="Use after research is done, "
                "to write a cited summary.",
    prompt="You write short cited summaries. "
           "Use only the findings in the task. "
           "Never invent a source.",
    tools=["Read"],
)

options = ClaudeAgentOptions(
    allowed_tools=["Agent"],
    agents={"synthesizer": synthesizer},
)
  • description tells Claude when to pick this subagent.
  • prompt is its system prompt: its job and its limits. It's fixed, so the findings for this particular job still have to come in the Task call's prompt, the text handoff.py builds.
  • tools restricts what it may use. Here only Read, so it can look at files and nothing else.
  • allowed_tools on the coordinator lists the tool that spawns subagents. Without it, the coordinator can't delegate at all.

A naming note: this file writes "Agent", the name in the current docs. The exam guide calls the same tool Task, which is what the research team file uses. Check the docs for your SDK version. For configs that look right and still fail, see fixing Agent SDK configs.

One more idea from the same exam task: fork_session. After one shared analysis you can fork the session, and each fork starts from the same baseline and continues on its own. Fork A tries tracked lanes, fork B tries shared streets, and neither disturbs the other. Sessions get their own lesson in Resume, Fork or Start Fresh, so we'll leave it there.

Break it: "the findings above"

The bug: the coordinator's prompt says Summarize the findings above. Above what? This is a fresh subagent. There is no above.

It sees no findings anywhere, and the risk is worse than an error: a confident summary with invented facts and sources, and nothing in it can be checked. The fix is to paste the findings into the prompt, all three, with their sources, which is what build_prompt does. Words like above, earlier and the research so far point at a chat the subagent never saw.

How this shows up in a question

A synthesis subagent writes a vague, uncited report, and its prompt turns out to say "write the report from the research so far". A larger model, more tools, or telling it to ask the search subagent won't help: the model can only use what is in its prompt, and subagents don't share memory. The fix is to put the full findings, with sources, in that prompt. Ask one thing: is the data inside the subagent's own prompt?

Common mistakes

  • Pointing at the chat. "Above", "earlier", "so far" mean nothing to a subagent.
  • Sending a summary of the findings. Send them complete, with evidence, or the subagent can't cite or weigh them.
  • Flattening metadata into prose. Once document and page are mixed into a paragraph, attribution is lost.
  • Scripting the steps. Give a goal and quality criteria; let the subagent decide how.
  • Forgetting the spawning tool. No Task (or Agent) in allowed_tools, no subagent.

Quick recap

Put in the promptWhy
Complete findings (claim + evidence)The subagent has no other copy
Source, document and page next to each claimCitations survive the handoff
The goalIt knows what the report is for
Quality criteriaIt knows what good looks like without step-by-step orders

The project files for this lesson are in the community, free to join.

Try it yourself

Comment out the two lines in build_prompt that add source and url, run handoff.py again, and read the printout as if you were the subagent: which claim can you still cite? Then put the lines back, add a fourth finding to findings.json that disagrees with the first, and check that the third quality criterion gives the subagent a reason to say so.

Tried the exercise? Share your answer or ask a question.

The StudyEasy AI Community is free to join, with the lesson files, notebooks and code.

Join free on Skool

Keep going in Claude · 119 of 123

Previous
Coordinator and Subagents: Decompose, Delegate, Check Coverage, and Call Only the Spokes You Need
Next post
Parallel Subagents: Several Task Calls in One Response, Every Result Back in One User Turn

Related course on Udemy

Claude Certified Architect - Foundations (CCAR-F) Exam Prep

Agentic loops, tools, MCP, Claude Code, prompts, structured output and context.View on Udemy ↗: Claude Certified Architect - Foundations (CCAR-F) Exam Prep (paid course, opens in a new tab)

Related posts

The Claude Messages API: Your First Call, Field by Field

One request in, one Message out. The four fields of a Messages API call (model, max_tokens, system, messages), how to read content blocks, stop_reason and usage, and why every turn resends the history.

Claude Tool Use: How tool_use and tool_result Work in the Messages API

Follow one order question through Claude's tool round trip: define a tool, read the tool_use block, run your own function and send a matching tool_result back, including parallel calls and is_error.

Claude Client SDKs Wrap One REST API: Raw HTTP, Python, TypeScript and Async Calls Compared

Every Claude client SDK wraps the same REST request: a POST to /v1/messages with a JSON body. See it built by hand, through the Python and TypeScript SDKs, as typed errors, and as async calls that wait together.

Anthropic SDK Timeouts, Retries and Error Classes: Configure the Client Once, Then Give 429, 529, 400 and Timeouts Their Own Move

Configure the Anthropic SDK client (timeout, max_retries, with_options, async, pagination), see which errors it retries by itself, then repair a retry wrapper so a 429, a 529, a 400 and a timeout each get the move the docs support.

On this page

  • Two chats, no shared memory
  • Findings, goal, criteria
  • Keep content apart from metadata
  • handoff.py: build the briefing pack
  • agents.py: describing the subagent
  • Break it: "the findings above"
  • How this shows up in a question
  • Common mistakes
  • Quick recap
  • Try it yourself
Community · Free to join
Single logo

StudyEasy AI Community

Hosted onSkool

Learn AI engineering, share what you build, and connect with other learners.

  • Free resources: lesson files, notebooks and code

  • Ask questions and join engineering discussions

  • Meet real people learning and building with AI

Join free on Skool

Related course on Udemy

Claude Certified Architect - Foundations (CCAR-F) Exam Prep

Agentic loops, tools, MCP, Claude Code, prompts, structured output and context.View on Udemy ↗: Claude Certified Architect - Foundations (CCAR-F) Exam Prep (paid course, opens in a new tab)

Single logo

Empowering Education, One Course at a Time

About
About usContact us
Legal
Terms of UsePrivacy Policy

© 2026 StudyEasy Organization. All rights reserved.