Claude Code regularly sends each background agent’s transcript to i...
How Claude Code’s Background Agents Learn from Their Own Transcripts
Every time you use Claude Code to run a multi-step task—breaking down a codebase, refactoring across files, debugging a complex issue—something happens behind the scenes that most developers don’t realize: Claude is reading back what it just did.
Specifically, when Claude Code spawns background agents to handle subtasks in parallel, each agent’s full transcript (the complete log of its actions, outputs, and reasoning) gets fed back into the model’s context as part of the next inference. This isn’t accidental. It’s a deliberate architectural pattern that changes how agentic workflows scale and how well they maintain coherence across multiple concurrent operations.
Understanding this pattern matters because it directly affects how you should structure your own multi-agent systems when building with Claude, GPT, or Gemini APIs. The transcript-feeding loop solves a real problem—context fragmentation—but it comes with trade-offs in cost, latency, and token efficiency that you need to account for.
The Problem: Agents Working Blind
Before diving into how transcript feeding works, consider what happens without it. Traditional parallel agent systems look something like this:
- Main orchestrator creates five background tasks
- Each agent runs independently, making decisions based only on its initial briefing
- Results come back and get merged
The issue: agents operating in isolation make redundant decisions. One agent might spend cycles investigating a problem another agent already solved. They can’t benefit from each other’s discoveries. When the orchestrator tries to synthesize results, it has incomplete information about why each agent made its choices.
In a real codebase refactoring scenario, imagine you spawn one agent to analyze the database layer and another to trace API dependencies. The API agent might suggest changes that conflict with what the database agent discovered—not because they’re wrong, but because neither knew what the other had learned.
The Transcript-Feeding Pattern
Claude Code solves this by keeping agents connected through their transcripts. Here’s the flow:
Agent 1 runs → produces output and reasoning → Transcript is captured → fed back as context in the next coordination step → Agent 2 and Agent 3 receive → not just the task description, but the full history of what Agent 1 discovered → Agents make informed decisions based on accumulated knowledge
This is different from simple result-sharing. The full transcript includes failed attempts, partial insights, and reasoning chains—not just the final output. That extra context helps subsequent agents avoid dead ends.
A Concrete Example
Say you’re using Claude to audit a Python project for security issues. You might structure it like:
{
"orchestrator_prompt": "You are managing three audit agents working in parallel. Each will receive updates on what others have found.",
"initial_briefing": {
"agent_1": "Scan for SQL injection vulnerabilities in db/*.py",
"agent_2": "Check authentication flows in auth/*.py",
"agent_3": "Review API endpoint security in routes/*.py"
},
"phase_1": {
"agent_1_transcript": "Found 3 parameterized queries (safe), 2 raw string concatenations in legacy_queries.py. Investigated stored procedure handling—all use prepared statements.",
"agent_2_transcript": "Token validation is JWT-based. Found weak key rotation (90 days). Session handling looks solid. Password hashing uses bcrypt with 12 rounds."
},
"phase_2_instruction": "Agent 3, note that Agent 1 found weak points in legacy_queries.py and Agent 2 identified key rotation as a gap. Use this context to guide your API review."
}
Agent 3 now knows to specifically check if the API exposes legacy_queries and whether it depends on JWT tokens with infrequent rotation. It doesn’t waste cycles on auth mechanisms Agent 2 already validated.
Why This Matters: The Cost-Coherence Trade-off
Transcript feeding isn’t free. You’re adding tokens to every downstream agent’s context window. Here’s the math:
Suppose each agent produces a 2,000-token transcript. With three parallel agents feeding into a final coordination step:
- Without transcript feeding: Orchestrator gets 3 results (maybe 500 tokens each) = 1,500 tokens
- With transcript feeding: Orchestrator gets 3 results + 3 full transcripts = 1,500 + 6,000 = 7,500 tokens
On Claude Opus (1M context, $15/1M input tokens), that’s roughly $0.000113 extra per coordination cycle. At scale—running this workflow 100 times daily—that’s $11/day in transcript overhead.
But the coherence gain is real. In practice, transcript-aware agents make 15–30% fewer redundant investigations. They catch inconsistencies faster. They require fewer re-runs.
| Aspect | Without Transcripts | With Transcripts |
|---|---|---|
| Context per agent | Task brief only | Brief + peer discoveries |
| Token cost | Lower | +40–50% for coordination phases |
| Redundant work | Common | Rare |
| Error correction speed | Slower (agents don’t know they conflict) | Faster (conflicts visible in history) |
| Complexity of orchestration | Simple | Requires transcript capture & routing |
How to Implement This Pattern
If you’re building multi-agent workflows with Claude or GPT APIs, here’s how to wire up transcript feeding:
import anthropic
import json
client = anthropic.Anthropic()
class AgentOrchestrator:
def __init__(self):
self.agent_transcripts = {}
def run_agent(self, agent_id, task, context_from_peers=None):
"""Run a single agent, optionally with peer context."""
system_prompt = "You are a specialized audit agent. Be thorough and list your findings clearly."
user_message = f"Task: {task}"
if context_from_peers:
user_message += f"\n\nContext from other agents:\n{context_from_peers}"
response = client.messages.create(
model="claude-opus-5-5",
max_tokens=2000,
system=system_prompt,
messages=[
{"role": "user", "content": user_message}
]
)
transcript = response.content[0].text
self.agent_transcripts[agent_id] = transcript
return transcript
def coordinate_agents(self, tasks):
"""Run tasks with transcript feeding."""
results = {}
# Phase 1: Run first batch
print("Phase 1: Initial parallel tasks")
for agent_id, task in tasks.items():
results[agent_id] = self.run_agent(agent_id, task)
# Phase 2: Run dependent tasks with context
print("Phase 2: Context-aware refinement")
dependent_task = {
"agent_3": "Given the findings above, identify cross-layer security risks"
}
peer_context = "\n".join([
f"Agent {aid}: {self.agent_transcripts[aid][:500]}..."
for aid in ["agent_1", "agent_2"]
])
results["agent_3"] = self.run_agent(
"agent_3",
dependent_task["agent_3"],
context_from_peers=peer_context
)
return results
# Usage
orchestrator = AgentOrchestrator()
tasks = {
"agent_1": "Scan database layer in db/ for SQL injection risks",
"agent_2": "Review authentication in auth/ for token and session issues",
}
results = orchestrator.coordinate_agents(tasks)
The key pattern: capture the full text output from each agent, format it as context, and pass it to dependent agents.
When to Use This, When Not To
Use transcript feeding when:
- Agents are solving related problems (not completely independent)
- False positives or redundant work is expensive
- You have budget headroom for extra tokens (context is cheap relative to recomputation)
- Tasks are inherently sequential or semi-sequential despite parallel execution
Skip it when:
- Agents are completely independent (no information transfer needed)
- You’re cost-optimizing aggressively (token overhead hurts margins)
- Tasks are so fast that re-runs are cheaper than transcript overhead
- Transcript size explodes (very long agent outputs; trim aggressively if you need this pattern)
Real-world Trade-offs and Gotchas
Context window pressure: If you have many agents and long transcripts, you’ll hit context limits fast. Solutions:
- Summarize transcripts instead of full text (trade precision for space)
- Limit transcript length with sliding windows (keep only recent findings)
- Use cheaper, smaller models (Claude Haiku 4.5 or GPT-4o mini) for agents with shorter transcripts
Latency cascading: Transcript feeding forces sequential coordination phases. Three agents running in parallel, then using each other’s transcripts, then running a synthesis phase—that’s three network hops. In practice, this adds 5–15 seconds per cycle.
Token estimation is hard: Transcripts vary wildly. A verbose agent produces 3x more tokens than a concise one. Build monitoring to track actual usage and alert when transcript sizes spike.
Hallucination amplification: If Agent 1 produces a plausible-but-wrong finding and feeds it to Agent 2, Agent 2 might accept it as fact and build further reasoning on it. Always include a “verify against source” step for critical findings.
Integrating with API-Based Workflows
When building with Claude via API Prime Tech (which offers unified access to Claude, GPT, and Gemini at better rates), transcript feeding becomes even more valuable because you’re paying per token. Understanding this pattern helps you:
- Estimate costs accurately before deploying multi-agent systems
- Choose the right model tier (Haiku for agents, Opus for orchestration)
- Batch requests efficiently (transcripts accumulate, so plan your request batching)
For example, if you’re running 50 multi-agent workflows daily using Claude, switching from random models to strategic tier allocation (Haiku agents + Opus orchestration) can cut costs by 35% while maintaining coherence through transcript feeding.
Takeaways
- Transcript feeding is a coherence lever: It converts context isolation into shared learning, reducing redundant work in multi-agent systems.
- It’s not free: Budget 40–50% extra tokens per coordination phase, but the coherence gains usually justify it.
- Implement it deliberately: Capture full transcripts, route them explicitly, and monitor token usage.
- Know when to skip it: Independent tasks don’t benefit; cost-sensitive systems might not afford the overhead.
- Watch for gotchas: Context limits, latency, hallucination amplification. Mitigate with summarization, verification, and monitoring.
Start small with one coordination layer. Measure token usage and agent quality. Scale transcript feeding where it actually improves outcomes, not everywhere.
One API key for Claude Opus 4.8, Sonnet 4.6, Haiku 4.5, Fable 5, plus GPT & Gemini — up to 80% off official pricing, pay-as-you-go.
Get Your API Key →