Claude research dispatch prompt forbids writes that the trellis-research agent requires
Summary
On Claude Code's Task/Agent dispatch path, shared-hooks/inject-subagent-context.py replaces the trellis-research prompt with build_research_prompt(...), which forbids modifying any files. That contradicts the agent definition (templates/claude/agents/trellis-research.md), which says every research result MUST be written under {TASK_DIR}/research/ and grants the Write tool. The dispatched agent gets mutually exclusive instructions and commonly returns findings only in chat, with no persisted artifact.
Evidence (main @ e77ae89)
The hook rewrites the prompt for research dispatches (inject-subagent-context.py:1174-1208, updatedInput.prompt = build_research_prompt(...)), and the injected text contains:
**Only allowed**: Describe what exists, where it is, how it works
**Forbidden** (unless explicitly asked):
- Modify any fileswhile claude/agents/trellis-research.md says:
tools: Read, Write, Glob, Grep, Bash, Skill, mcp__*
Every research output MUST end up as a file under `{TASK_DIR}/research/`.Proposed fix
Pass the active task directory into build_research_prompt and permit writes there, aligning the report format with the agent definition:
**Allowed writes**: files under `{task_dir}/research/` only (one markdown file per topic)
**Forbidden** (unless explicitly asked):
- Modifying any file outside `{task_dir}/research/`Source: mindfold-ai/Trellis