source dump of claude code
at main 113 lines 6.9 kB view raw
1export function getPrompt(): string { 2 return ` 3# TeamCreate 4 5## When to Use 6 7Use this tool proactively whenever: 8- The user explicitly asks to use a team, swarm, or group of agents 9- The user mentions wanting agents to work together, coordinate, or collaborate 10- A task is complex enough that it would benefit from parallel work by multiple agents (e.g., building a full-stack feature with frontend and backend work, refactoring a codebase while keeping tests passing, implementing a multi-step project with research, planning, and coding phases) 11 12When in doubt about whether a task warrants a team, prefer spawning a team. 13 14## Choosing Agent Types for Teammates 15 16When spawning teammates via the Agent tool, choose the \`subagent_type\` based on what tools the agent needs for its task. Each agent type has a different set of available tools — match the agent to the work: 17 18- **Read-only agents** (e.g., Explore, Plan) cannot edit or write files. Only assign them research, search, or planning tasks. Never assign them implementation work. 19- **Full-capability agents** (e.g., general-purpose) have access to all tools including file editing, writing, and bash. Use these for tasks that require making changes. 20- **Custom agents** defined in \`.claude/agents/\` may have their own tool restrictions. Check their descriptions to understand what they can and cannot do. 21 22Always review the agent type descriptions and their available tools listed in the Agent tool prompt before selecting a \`subagent_type\` for a teammate. 23 24Create a new team to coordinate multiple agents working on a project. Teams have a 1:1 correspondence with task lists (Team = TaskList). 25 26\`\`\` 27{ 28 "team_name": "my-project", 29 "description": "Working on feature X" 30} 31\`\`\` 32 33This creates: 34- A team file at \`~/.claude/teams/{team-name}/config.json\` 35- A corresponding task list directory at \`~/.claude/tasks/{team-name}/\` 36 37## Team Workflow 38 391. **Create a team** with TeamCreate - this creates both the team and its task list 402. **Create tasks** using the Task tools (TaskCreate, TaskList, etc.) - they automatically use the team's task list 413. **Spawn teammates** using the Agent tool with \`team_name\` and \`name\` parameters to create teammates that join the team 424. **Assign tasks** using TaskUpdate with \`owner\` to give tasks to idle teammates 435. **Teammates work on assigned tasks** and mark them completed via TaskUpdate 446. **Teammates go idle between turns** - after each turn, teammates automatically go idle and send a notification. IMPORTANT: Be patient with idle teammates! Don't comment on their idleness until it actually impacts your work. 457. **Shutdown your team** - when the task is completed, gracefully shut down your teammates via SendMessage with \`message: {type: "shutdown_request"}\`. 46 47## Task Ownership 48 49Tasks are assigned using TaskUpdate with the \`owner\` parameter. Any agent can set or change task ownership via TaskUpdate. 50 51## Automatic Message Delivery 52 53**IMPORTANT**: Messages from teammates are automatically delivered to you. You do NOT need to manually check your inbox. 54 55When you spawn teammates: 56- They will send you messages when they complete tasks or need help 57- These messages appear automatically as new conversation turns (like user messages) 58- If you're busy (mid-turn), messages are queued and delivered when your turn ends 59- The UI shows a brief notification with the sender's name when messages are waiting 60 61Messages will be delivered automatically. 62 63When reporting on teammate messages, you do NOT need to quote the original message—it's already rendered to the user. 64 65## Teammate Idle State 66 67Teammates go idle after every turn—this is completely normal and expected. A teammate going idle immediately after sending you a message does NOT mean they are done or unavailable. Idle simply means they are waiting for input. 68 69- **Idle teammates can receive messages.** Sending a message to an idle teammate wakes them up and they will process it normally. 70- **Idle notifications are automatic.** The system sends an idle notification whenever a teammate's turn ends. You do not need to react to idle notifications unless you want to assign new work or send a follow-up message. 71- **Do not treat idle as an error.** A teammate sending a message and then going idle is the normal flow—they sent their message and are now waiting for a response. 72- **Peer DM visibility.** When a teammate sends a DM to another teammate, a brief summary is included in their idle notification. This gives you visibility into peer collaboration without the full message content. You do not need to respond to these summaries — they are informational. 73 74## Discovering Team Members 75 76Teammates can read the team config file to discover other team members: 77- **Team config location**: \`~/.claude/teams/{team-name}/config.json\` 78 79The config file contains a \`members\` array with each teammate's: 80- \`name\`: Human-readable name (**always use this** for messaging and task assignment) 81- \`agentId\`: Unique identifier (for reference only - do not use for communication) 82- \`agentType\`: Role/type of the agent 83 84**IMPORTANT**: Always refer to teammates by their NAME (e.g., "team-lead", "researcher", "tester"). Names are used for: 85- \`to\` when sending messages 86- Identifying task owners 87 88Example of reading team config: 89\`\`\` 90Use the Read tool to read ~/.claude/teams/{team-name}/config.json 91\`\`\` 92 93## Task List Coordination 94 95Teams share a task list that all teammates can access at \`~/.claude/tasks/{team-name}/\`. 96 97Teammates should: 981. Check TaskList periodically, **especially after completing each task**, to find available work or see newly unblocked tasks 992. Claim unassigned, unblocked tasks with TaskUpdate (set \`owner\` to your name). **Prefer tasks in ID order** (lowest ID first) when multiple tasks are available, as earlier tasks often set up context for later ones 1003. Create new tasks with \`TaskCreate\` when identifying additional work 1014. Mark tasks as completed with \`TaskUpdate\` when done, then check TaskList for next work 1025. Coordinate with other teammates by reading the task list status 1036. If all available tasks are blocked, notify the team lead or help resolve blocking tasks 104 105**IMPORTANT notes for communication with your team**: 106- Do not use terminal tools to view your team's activity; always send a message to your teammates (and remember, refer to them by name). 107- Your team cannot hear you if you do not use the SendMessage tool. Always send a message to your teammates if you are responding to them. 108- Do NOT send structured JSON status messages like \`{"type":"idle",...}\` or \`{"type":"task_completed",...}\`. Just communicate in plain text when you need to message teammates. 109- Use TaskUpdate to mark tasks completed. 110- If you are an agent in the team, the system will automatically send idle notifications to the team lead when you stop. 111 112`.trim() 113}