Type
Investigation — Feature or Bug?
Problem Statement
Claude Code agents operate in isolated context windows. When they complete, results flow back to the parent via <task-notification> messages. This raises fundamental architecture questions about how agents should communicate:
- Agent → Parent: Currently dumps full result text. No truncation. No file-based handoff.
- Agent → Agent: No direct communication path exists. Agents can't coordinate or share findings.
- Parent → Agent: Only at spawn time via the prompt parameter. No mid-execution messaging (except via Agent Teams/Swarm which uses SendMessage).
Core question: What are the designed communication patterns for Claude Code agents, and where do PAI's assumptions diverge from the intended design?
Specific Observations
Agent Result Injection
From session 10625351 forensics:
L432 task-notification from agent a55fc65: 15,104 chars injected into parent
L206 task-notification from agent a4d43ba: 20,618 chars injected into parent
L194 task-notification from agent a45a5c5: 12,644 chars injected into parent
Each of these is the full agent output — not a summary. When 7+ agents complete in quick succession, the parent accumulates 100K+ chars of task-notifications alone.
Auto-Compact Cascade Failure
When context overflows, Claude Code spawns auto-compact agents. But:
- The compact agent receives the full conversation (including all bloated task-notifications) as its input
- If the conversation is already too large, the compact agent's prompt is also too large
- Result: 14 compact agents spawned, all failed with
"Prompt is too long"
- This is a feedback loop with no exit — the only escape was
/exit
Agent Teams vs. Background Agents
PAI has two agent coordination mechanisms:
- Task tool (
run_in_background: true) — isolated agents, results via task-notification
- Agent Teams (TeamCreate + SendMessage) — coordinated agents with shared task lists and direct messaging
Question: Should research workflows use Agent Teams instead of background Task agents to manage context better? Are Agent Teams designed for this use case?
Investigation Questions
- Is there a
max_result_length or truncation parameter for Task tool results?
- Can agents write to shared files as their output mechanism instead of returning text?
- What is the designed flow for 5+ parallel agents that each produce 10K+ char results?
- Should PAI's Research skill use Agent Teams (SendMessage for incremental results) instead of background agents (full result dump)?
- Is the auto-compact cascade failure a known issue? Is there a circuit breaker?
- Does Claude Code have context usage metrics accessible to the model (e.g., "you're at 80% context")?
Related
- Depends on findings from: "Investigate: Agent result reporting overflows parent context"
Affected PAI Components
- Research skill architecture
- Algorithm's agent spawning in CAPABILITIES SELECTION
- Delegation system (
SYSTEM/THEDELEGATIONSYSTEM.md)
- Agent system (
SYSTEM/PAIAGENTSYSTEM.md)
Type
Investigation — Feature or Bug?
Problem Statement
Claude Code agents operate in isolated context windows. When they complete, results flow back to the parent via
<task-notification>messages. This raises fundamental architecture questions about how agents should communicate:Core question: What are the designed communication patterns for Claude Code agents, and where do PAI's assumptions diverge from the intended design?
Specific Observations
Agent Result Injection
From session
10625351forensics:Each of these is the full agent output — not a summary. When 7+ agents complete in quick succession, the parent accumulates 100K+ chars of task-notifications alone.
Auto-Compact Cascade Failure
When context overflows, Claude Code spawns auto-compact agents. But:
"Prompt is too long"/exitAgent Teams vs. Background Agents
PAI has two agent coordination mechanisms:
run_in_background: true) — isolated agents, results via task-notificationQuestion: Should research workflows use Agent Teams instead of background Task agents to manage context better? Are Agent Teams designed for this use case?
Investigation Questions
max_result_lengthor truncation parameter for Task tool results?Related
Affected PAI Components
SYSTEM/THEDELEGATIONSYSTEM.md)SYSTEM/PAIAGENTSYSTEM.md)