Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
docs(opencode): clarify task delegation prompts
  • Loading branch information
rekram1-node committed Jun 4, 2026
commit d021787faf56e822c9c483debaeb4feac56cb4df
11 changes: 8 additions & 3 deletions packages/opencode/src/tool/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,15 @@ const BACKGROUND_DESCRIPTION = [
"You will be notified automatically when it finishes.",
].join(" ")
const BACKGROUND_STARTED = [
"Background task started. You will be notified automatically when it finishes; do not poll for progress.",
"Do not duplicate its work. Continue only with non-overlapping work, or stop if there is nothing else useful to do.",
"Background task started. You will be notified automatically when it finishes.",
"Do not poll for progress, ask the task for status, or duplicate its work by investigating the same files or topic yourself.",
"Continue only with non-overlapping work, or briefly tell the user what you launched and stop.",
].join("\n")
const BACKGROUND_UPDATED = [
"Additional context sent to the running background task.",
"The task is still running; wait for the automatic completion notification.",
"Do not poll for progress or duplicate its work.",
].join("\n")
const BACKGROUND_UPDATED = "Additional context sent to the background task."

const BaseParameterFields = {
description: Schema.String.annotate({ description: "A short (3-5 words) description of the task" }),
Expand Down
11 changes: 6 additions & 5 deletions packages/opencode/src/tool/task.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ When NOT to use the Task tool:

Usage notes:
1. Launch multiple agents concurrently whenever possible, to maximize performance; to do that, use a single message with multiple tool uses
2. When the agent is done, it will return a single message back to you. The result returned by the agent is not visible to the user. To show the user the result, you should send a text message back to the user with a concise summary of the result. The output includes a task_id you can reuse later to continue the same subagent session.
3. Each agent invocation starts with a fresh context unless you provide task_id to resume the same subagent session (which continues with its previous messages and tool outputs). When starting fresh, your prompt should contain a highly detailed task description for the agent to perform autonomously and you should specify exactly what information the agent should return back to you in its final and only message to you.
4. The agent's outputs should generally be trusted
5. Clearly tell the agent whether you expect it to write code or just to do research (search, file reads, web fetches, etc.), since it is not aware of the user's intent. Tell it how to verify its work if possible (e.g., relevant test commands).
6. If the agent description mentions that it should be used proactively, then you should try your best to use it without the user having to ask for it first. Use your judgement.
2. Once you have delegated work to an agent, do not duplicate that work yourself. Continue with non-overlapping tasks, or wait for the result.
3. When the agent is done, it will return a single message back to you. The result returned by the agent is not visible to the user. To show the user the result, you should send a text message back to the user with a concise summary of the result. The output includes a task_id you can reuse later to continue the same subagent session.
4. Each agent invocation starts with a fresh context unless you provide task_id to resume the same subagent session (which continues with its previous messages and tool outputs). When starting fresh, your prompt should contain a highly detailed task description for the agent to perform autonomously and you should specify exactly what information the agent should return back to you in its final and only message to you.
5. The agent's outputs should generally be trusted
6. Clearly tell the agent whether you expect it to write code or just to do research (search, file reads, web fetches, etc.), since it is not aware of the user's intent. Tell it how to verify its work if possible (e.g., relevant test commands).
7. If the agent description mentions that it should be used proactively, then you should try your best to use it without the user having to ask for it first. Use your judgement.
Loading