[BUG] Subagent Write Tool Not Creating Files
Bug Report: Subagent Write Tool Not Creating Files
Summary
Subagents invoked via Task tool successfully call the Write tool but files are not actually created on disk.
Environment
- Claude Code Version: 1.0.100
- OS: Windows 10 (22631) via MINGW64
- Node.js: v22.14.0
- Date: 2025-01-03
Issue Description
When using Task tool to invoke custom subagents, the agents appear to execute Write tool calls successfully (showing <write> tags in output) but no files are actually written to disk.
Steps to Reproduce
1. Create Test Subagent
Create .claude/agents/test-agent.md:
---
name: test-agent
description: Simple test agent to verify Write tool functionality
tools: Write
---
Sen bir test agent'ısın. Sadece bir şey yapman gerekiyor:
1. Hangi dosya yolunu yazman söylenirse, oraya "Test başarılı!" yaz
2. Write tool'u mutlaka çağır
3. Başka hiçbir şey yapma
2. Invoke Subagent
Task({
description: "Test agent Write tool",
prompt: "Write 'Test successful!' to C:\\test-output.txt file. Use Write tool only.",
subagent_type: "test-agent"
})
3. Verify Output
Agent output shows:
<write>
<path>C:\test-output.txt</path>
<content>Test successful!</content>
</write>
4. Check File System
ls -la C:\test-output.txt
# Result: ls: cannot access 'C:\test-output.txt': No such file or directory
Expected Behavior
File should be created at the specified path with the specified content.
Actual Behavior
- Subagent executes successfully
- Write tool appears to be called (shows in output)
- No file is created on disk
- No error messages are shown
Additional Test Cases
Test with Custom Persona Subagent
Task({
description: "Test persona Write tool",
prompt: "Write 'Persona test successful!' to C:\\test-persona.txt file.",
subagent_type: "MyPersona"
})
Result: Same issue - agent shows Write tool usage but no file created.
Agent Configuration Details
Working Agent Definition Format
---
name: MyPersona
description: A custom persona agent for testing Write tool functionality
tools: Read, Write, Edit
---
# Agent system prompt here...
Agent Recognition
- Agents are properly recognized by Task tool
- Available agents list includes custom agents properly
- No error when invoking subagents
Impact
This bug makes subagents effectively unusable for any workflow requiring file output, including:
- Document generation
- Code writing
- Data export
- Configuration file creation
Workarounds Attempted
- ✅ Fixed YAML format: Changed
tools: ["Write"]totools: Write - ✅ Removed quotes: Changed
name: "MyPersona"toname: MyPersona - ✅ Added explicit Write tool instructions in agent prompts
- ❌ None resolve the core issue
Related Issues
This may be related to similar reports:
- Subagents not being used despite proper configuration
- Tool access limitations within subagents
- File system permissions in Windows environment
Debug Information
Agent Directory Structure
.claude/agents/
├── my-persona.md ✅
├── test-agent.md ✅
└── ... (other agents) ✅
Tool Permissions
Main Claude Code session can successfully use Write tool. Issue appears specific to subagent execution context.
Request
Please investigate the Write tool execution in subagent context. This appears to be a critical reliability issue affecting subagent functionality.
---
Reporter: User via Claude Code
Priority: High (affects core subagent functionality)
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗