bonecode 1.2.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -0
- package/dist/src/engine/agent/prompt/compaction.txt +9 -0
- package/dist/src/engine/agent/prompt/explore.txt +18 -0
- package/dist/src/engine/agent/prompt/scout.txt +36 -0
- package/dist/src/engine/agent/prompt/summary.txt +11 -0
- package/dist/src/engine/agent/prompt/title.txt +44 -0
- package/dist/src/engine/session/prompt/anthropic.txt +105 -0
- package/dist/src/engine/session/prompt/beast.txt +147 -0
- package/dist/src/engine/session/prompt/bonescript.txt +391 -0
- package/dist/src/engine/session/prompt/build-switch.txt +5 -0
- package/dist/src/engine/session/prompt/codex.txt +79 -0
- package/dist/src/engine/session/prompt/copilot-gpt-5.txt +143 -0
- package/dist/src/engine/session/prompt/default.txt +105 -0
- package/dist/src/engine/session/prompt/gemini.txt +155 -0
- package/dist/src/engine/session/prompt/gpt.txt +107 -0
- package/dist/src/engine/session/prompt/kimi.txt +95 -0
- package/dist/src/engine/session/prompt/max-steps.txt +16 -0
- package/dist/src/engine/session/prompt/plan-reminder-anthropic.txt +67 -0
- package/dist/src/engine/session/prompt/plan.txt +26 -0
- package/dist/src/engine/session/prompt/trinity.txt +97 -0
- package/dist/src/engine/session/prompt.js +35 -2
- package/dist/src/engine/session/prompt.js.map +1 -1
- package/dist/src/engine/skill/prompt/customize-opencode.md +377 -0
- package/dist/src/engine/tool/apply_patch.txt +33 -0
- package/dist/src/engine/tool/edit.txt +10 -0
- package/dist/src/engine/tool/glob.txt +6 -0
- package/dist/src/engine/tool/grep.txt +8 -0
- package/dist/src/engine/tool/lsp.txt +24 -0
- package/dist/src/engine/tool/plan-enter.txt +14 -0
- package/dist/src/engine/tool/plan-exit.txt +13 -0
- package/dist/src/engine/tool/question.txt +10 -0
- package/dist/src/engine/tool/read.txt +14 -0
- package/dist/src/engine/tool/repo_clone.txt +5 -0
- package/dist/src/engine/tool/repo_overview.txt +4 -0
- package/dist/src/engine/tool/shell/shell.txt +77 -0
- package/dist/src/engine/tool/skill.txt +5 -0
- package/dist/src/engine/tool/task.txt +58 -0
- package/dist/src/engine/tool/task_status.txt +13 -0
- package/dist/src/engine/tool/todowrite.txt +167 -0
- package/dist/src/engine/tool/tool/apply_patch.txt +33 -0
- package/dist/src/engine/tool/tool/edit.txt +10 -0
- package/dist/src/engine/tool/tool/glob.txt +6 -0
- package/dist/src/engine/tool/tool/grep.txt +8 -0
- package/dist/src/engine/tool/tool/lsp.txt +24 -0
- package/dist/src/engine/tool/tool/plan-enter.txt +14 -0
- package/dist/src/engine/tool/tool/plan-exit.txt +13 -0
- package/dist/src/engine/tool/tool/question.txt +10 -0
- package/dist/src/engine/tool/tool/read.txt +14 -0
- package/dist/src/engine/tool/tool/repo_clone.txt +5 -0
- package/dist/src/engine/tool/tool/repo_overview.txt +4 -0
- package/dist/src/engine/tool/tool/shell/shell.txt +77 -0
- package/dist/src/engine/tool/tool/skill.txt +5 -0
- package/dist/src/engine/tool/tool/task.txt +58 -0
- package/dist/src/engine/tool/tool/task_status.txt +13 -0
- package/dist/src/engine/tool/tool/todowrite.txt +167 -0
- package/dist/src/engine/tool/tool/webfetch.txt +13 -0
- package/dist/src/engine/tool/tool/websearch.txt +14 -0
- package/dist/src/engine/tool/tool/write.txt +8 -0
- package/dist/src/engine/tool/webfetch.txt +13 -0
- package/dist/src/engine/tool/websearch.txt +14 -0
- package/dist/src/engine/tool/write.txt +8 -0
- package/dist/src/tui.js +118 -29
- package/dist/src/tui.js.map +1 -1
- package/package.json +2 -2
- package/scripts/copy_prompts.js +58 -0
- package/scripts/test_bonescript_primer.js +111 -0
- package/scripts/test_tui_render.js +278 -0
- package/src/engine/session/prompt/bonescript.txt +391 -0
- package/src/engine/session/prompt.ts +36 -2
- package/src/tui.ts +115 -30
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Use the `apply_patch` tool to edit files. Your patch language is a stripped‑down, file‑oriented diff format designed to be easy to parse and safe to apply. You can think of it as a high‑level envelope:
|
|
2
|
+
|
|
3
|
+
*** Begin Patch
|
|
4
|
+
[ one or more file sections ]
|
|
5
|
+
*** End Patch
|
|
6
|
+
|
|
7
|
+
Within that envelope, you get a sequence of file operations.
|
|
8
|
+
You MUST include a header to specify the action you are taking.
|
|
9
|
+
Each operation starts with one of three headers:
|
|
10
|
+
|
|
11
|
+
*** Add File: <path> - create a new file. Every following line is a + line (the initial contents).
|
|
12
|
+
*** Delete File: <path> - remove an existing file. Nothing follows.
|
|
13
|
+
*** Update File: <path> - patch an existing file in place (optionally with a rename).
|
|
14
|
+
|
|
15
|
+
Example patch:
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
*** Begin Patch
|
|
19
|
+
*** Add File: hello.txt
|
|
20
|
+
+Hello world
|
|
21
|
+
*** Update File: src/app.py
|
|
22
|
+
*** Move to: src/main.py
|
|
23
|
+
@@ def greet():
|
|
24
|
+
-print("Hi")
|
|
25
|
+
+print("Hello, world!")
|
|
26
|
+
*** Delete File: obsolete.txt
|
|
27
|
+
*** End Patch
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
It is important to remember:
|
|
31
|
+
|
|
32
|
+
- You must include a header with your intended action (Add/Delete/Update)
|
|
33
|
+
- You must prefix new lines with `+` even when creating a new file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Performs exact string replacements in files.
|
|
2
|
+
|
|
3
|
+
Usage:
|
|
4
|
+
- You must use your `Read` tool at least once in the conversation before editing. This tool will error if you attempt an edit without reading the file.
|
|
5
|
+
- When editing text from Read tool output, ensure you preserve the exact indentation (tabs/spaces) as it appears AFTER the line number prefix. The line number prefix format is: line number + colon + space (e.g., `1: `). Everything after that space is the actual file content to match. Never include any part of the line number prefix in the oldString or newString.
|
|
6
|
+
- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.
|
|
7
|
+
- Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked.
|
|
8
|
+
- The edit will FAIL if `oldString` is not found in the file with an error "oldString not found in content".
|
|
9
|
+
- The edit will FAIL if `oldString` is found multiple times in the file with an error "Found multiple matches for oldString. Provide more surrounding lines in oldString to identify the correct match." Either provide a larger string with more surrounding context to make it unique or use `replaceAll` to change every instance of `oldString`.
|
|
10
|
+
- Use `replaceAll` for replacing and renaming strings across the file. This parameter is useful if you want to rename a variable for instance.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
- Fast file pattern matching tool that works with any codebase size
|
|
2
|
+
- Supports glob patterns like "**/*.js" or "src/**/*.ts"
|
|
3
|
+
- Returns matching file paths sorted by modification time
|
|
4
|
+
- Use this tool when you need to find files by name patterns
|
|
5
|
+
- When you are doing an open-ended search that may require multiple rounds of globbing and grepping, use the Task tool instead
|
|
6
|
+
- You have the capability to call multiple tools in a single response. It is always better to speculatively perform multiple searches as a batch that are potentially useful.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
- Fast content search tool that works with any codebase size
|
|
2
|
+
- Searches file contents using regular expressions
|
|
3
|
+
- Supports full regex syntax (eg. "log.*Error", "function\s+\w+", etc.)
|
|
4
|
+
- Filter files by pattern with the include parameter (eg. "*.js", "*.{ts,tsx}")
|
|
5
|
+
- Returns file paths and line numbers with at least one match sorted by modification time
|
|
6
|
+
- Use this tool when you need to find files containing specific patterns
|
|
7
|
+
- If you need to identify/count the number of matches within files, use the Bash tool with `rg` (ripgrep) directly. Do NOT use `grep`.
|
|
8
|
+
- When you are doing an open-ended search that may require multiple rounds of globbing and grepping, use the Task tool instead
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Interact with Language Server Protocol (LSP) servers to get code intelligence features.
|
|
2
|
+
|
|
3
|
+
Supported operations:
|
|
4
|
+
- goToDefinition: Find where a symbol is defined
|
|
5
|
+
- findReferences: Find all references to a symbol
|
|
6
|
+
- hover: Get hover information (documentation, type info) for a symbol
|
|
7
|
+
- documentSymbol: Get all symbols (functions, classes, variables) in a document
|
|
8
|
+
- workspaceSymbol: List project-wide symbols matching a query string
|
|
9
|
+
- goToImplementation: Find implementations of an interface or abstract method
|
|
10
|
+
- prepareCallHierarchy: Get call hierarchy item at a position (functions/methods)
|
|
11
|
+
- incomingCalls: Find all functions/methods that call the function at a position
|
|
12
|
+
- outgoingCalls: Find all functions/methods called by the function at a position
|
|
13
|
+
|
|
14
|
+
All operations require:
|
|
15
|
+
- filePath: The file to operate on
|
|
16
|
+
- line: The line number (1-based, as shown in editors)
|
|
17
|
+
- character: The character offset (1-based, as shown in editors)
|
|
18
|
+
|
|
19
|
+
workspaceSymbol also accepts:
|
|
20
|
+
- query: A query string to filter symbols by. Empty string requests all symbols.
|
|
21
|
+
|
|
22
|
+
For workspaceSymbol, filePath is not sent in the LSP workspace/symbol request. It is used by opencode to select and start the matching LSP server.
|
|
23
|
+
|
|
24
|
+
Note: LSP servers must be configured for the file type. If no server is available, an error will be returned.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Use this tool to suggest switching to plan agent when the user's request would benefit from planning before implementation.
|
|
2
|
+
|
|
3
|
+
If they explicitly mention wanting to create a plan ALWAYS call this tool first.
|
|
4
|
+
|
|
5
|
+
This tool will ask the user if they want to switch to plan agent.
|
|
6
|
+
|
|
7
|
+
Call this tool when:
|
|
8
|
+
- The user's request is complex and would benefit from planning first
|
|
9
|
+
- You want to research and design before making changes
|
|
10
|
+
- The task involves multiple files or significant architectural decisions
|
|
11
|
+
|
|
12
|
+
Do NOT call this tool:
|
|
13
|
+
- For simple, straightforward tasks
|
|
14
|
+
- When the user explicitly wants immediate implementation
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Use this tool when you have completed the planning phase and are ready to exit plan agent.
|
|
2
|
+
|
|
3
|
+
This tool will ask the user if they want to switch to build agent to start implementing the plan.
|
|
4
|
+
|
|
5
|
+
Call this tool:
|
|
6
|
+
- After you have written a complete plan to the plan file
|
|
7
|
+
- After you have clarified any questions with the user
|
|
8
|
+
- When you are confident the plan is ready for implementation
|
|
9
|
+
|
|
10
|
+
Do NOT call this tool:
|
|
11
|
+
- Before you have created or finalized the plan
|
|
12
|
+
- If you still have unanswered questions about the implementation
|
|
13
|
+
- If the user has indicated they want to continue planning
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Use this tool when you need to ask the user questions during execution. This allows you to:
|
|
2
|
+
1. Gather user preferences or requirements
|
|
3
|
+
2. Clarify ambiguous instructions
|
|
4
|
+
3. Get decisions on implementation choices as you work
|
|
5
|
+
4. Offer choices to the user about what direction to take.
|
|
6
|
+
|
|
7
|
+
Usage notes:
|
|
8
|
+
- When `custom` is enabled (default), a "Type your own answer" option is added automatically; don't include "Other" or catch-all options
|
|
9
|
+
- Answers are returned as arrays of labels; set `multiple: true` to allow selecting more than one
|
|
10
|
+
- If you recommend a specific option, make that the first option in the list and add "(Recommended)" at the end of the label
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Read a file or directory from the local filesystem. If the path does not exist, an error is returned.
|
|
2
|
+
|
|
3
|
+
Usage:
|
|
4
|
+
- The filePath parameter should be an absolute path.
|
|
5
|
+
- By default, this tool returns up to 2000 lines from the start of the file.
|
|
6
|
+
- The offset parameter is the line number to start from (1-indexed).
|
|
7
|
+
- To read later sections, call this tool again with a larger offset.
|
|
8
|
+
- Use the grep tool to find specific content in large files or files with long lines.
|
|
9
|
+
- If you are unsure of the correct file path, use the glob tool to look up filenames by glob pattern.
|
|
10
|
+
- Contents are returned with each line prefixed by its line number as `<line>: <content>`. For example, if a file has contents "foo\n", you will receive "1: foo\n". For directories, entries are returned one per line (without line numbers) with a trailing `/` for subdirectories.
|
|
11
|
+
- Any line longer than 2000 characters is truncated.
|
|
12
|
+
- Call this tool in parallel when you know there are multiple files you want to read.
|
|
13
|
+
- Avoid tiny repeated slices (30 line chunks). If you need more context, read a larger window.
|
|
14
|
+
- This tool can read image files and PDFs and return them as file attachments.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
- Clone or refresh a repository into OpenCode's managed cache under the data directory
|
|
2
|
+
- Accepts git URLs, forge host/path references, or GitHub owner/repo shorthand
|
|
3
|
+
- Returns the cached absolute local path so other tools can explore the cloned source
|
|
4
|
+
- Use this before Read, Glob, or Grep when the code you need lives outside the current workspace
|
|
5
|
+
- This tool is intended for dependency and documentation research workflows, not for modifying the user's workspace
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
- Summarize the structure and likely entrypoints of a cloned repository or local directory
|
|
2
|
+
- Accepts either a cached repository reference or a directory path
|
|
3
|
+
- Reports detected ecosystems, dependency files, package manager, likely entrypoints, and a compact structure tree
|
|
4
|
+
- Use this after repo_clone to orient quickly before deeper Read, Glob, or Grep investigation
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
${intro}
|
|
2
|
+
|
|
3
|
+
Be aware: OS: ${os}, Shell: ${shell}
|
|
4
|
+
|
|
5
|
+
${workdirSection}
|
|
6
|
+
|
|
7
|
+
Use `${tmp}` for temporary work outside the workspace. This directory has already been created, already exists, and is pre-approved for external directory access.
|
|
8
|
+
|
|
9
|
+
IMPORTANT: This tool is for terminal operations like git, npm, docker, etc. DO NOT use it for file operations (reading, writing, editing, searching, finding files) - use the specialized tools for this instead.
|
|
10
|
+
|
|
11
|
+
${commandSection}
|
|
12
|
+
|
|
13
|
+
# Committing changes with git
|
|
14
|
+
|
|
15
|
+
Only create commits when requested by the user. If unclear, ask first. When the user asks you to create a new git commit, follow these steps carefully:
|
|
16
|
+
|
|
17
|
+
Git Safety Protocol:
|
|
18
|
+
- NEVER update the git config
|
|
19
|
+
- NEVER run destructive/irreversible git commands (like push --force, hard reset, etc) unless the user explicitly requests them
|
|
20
|
+
- NEVER skip hooks (--no-verify, --no-gpg-sign, etc) unless the user explicitly requests it
|
|
21
|
+
- NEVER run force push to main/master, warn the user if they request it
|
|
22
|
+
- Avoid git commit --amend. ONLY use --amend when ALL conditions are met:
|
|
23
|
+
(1) User explicitly requested amend, OR the commit succeeded and pre-commit hooks auto-modified files that need including — verify by checking `git log` that HEAD is the new commit before amending
|
|
24
|
+
(2) HEAD commit was created by you in this conversation (verify: git log -1 --format='%an %ae')
|
|
25
|
+
(3) Commit has NOT been pushed to remote (verify: git status shows "Your branch is ahead")
|
|
26
|
+
- CRITICAL: If commit FAILED or was REJECTED by hook, NEVER amend - fix the issue and create a NEW commit
|
|
27
|
+
- CRITICAL: If you already pushed to remote, NEVER amend unless user explicitly requests it (requires force push)
|
|
28
|
+
- NEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTANT to only commit when explicitly asked, otherwise the user will feel that you are being too proactive.
|
|
29
|
+
|
|
30
|
+
1. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following ${gitCommands} in parallel, each using the ${toolName} tool:
|
|
31
|
+
- Run a git status command to see all untracked files.
|
|
32
|
+
- Run a git diff command to see both staged and unstaged changes that will be committed.
|
|
33
|
+
- Run a git log command to see recent commit messages, so that you can follow this repository's commit message style.
|
|
34
|
+
2. Analyze all staged changes (both previously staged and newly added) and draft a commit message:
|
|
35
|
+
- Summarize the nature of the changes (eg. new feature, enhancement to an existing feature, bug fix, refactoring, test, docs, etc.). Ensure the message accurately reflects the changes and their purpose (i.e. "add" means a wholly new feature, "update" means an enhancement to an existing feature, "fix" means a bug fix, etc.).
|
|
36
|
+
- Do not commit files that likely contain secrets (.env, credentials.json, etc.). Warn the user if they specifically request to commit those files
|
|
37
|
+
- Draft a concise (1-2 sentences) commit message that focuses on the "why" rather than the "what"
|
|
38
|
+
- Ensure it accurately reflects the changes and their purpose
|
|
39
|
+
3. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following commands:
|
|
40
|
+
- Add relevant untracked files to the staging area.
|
|
41
|
+
- Create the commit with a message
|
|
42
|
+
- Run git status after the commit completes to verify success.
|
|
43
|
+
Note: git status depends on the commit completing, so run it sequentially after the commit.
|
|
44
|
+
4. If the commit fails due to pre-commit hook, fix the issue and create a NEW commit (see amend rules above)
|
|
45
|
+
|
|
46
|
+
Important notes:
|
|
47
|
+
- NEVER run additional commands to read or explore code, besides ${gitCommandRestriction}
|
|
48
|
+
- NEVER use the TodoWrite or Task tools
|
|
49
|
+
- DO NOT push to the remote repository unless the user explicitly asks you to do so
|
|
50
|
+
- IMPORTANT: Never use git commands with the -i flag (like git rebase -i or git add -i) since they require interactive input which is not supported.
|
|
51
|
+
- If there are no changes to commit (i.e., no untracked files and no modifications), do not create an empty commit
|
|
52
|
+
|
|
53
|
+
# Creating pull requests
|
|
54
|
+
Use the gh command via the ${toolName} tool for ALL GitHub-related tasks including working with issues, pull requests, checks, and releases. If given a GitHub URL use the gh command to get the information needed.
|
|
55
|
+
|
|
56
|
+
IMPORTANT: When the user asks you to create a pull request, follow these steps carefully:
|
|
57
|
+
|
|
58
|
+
1. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following ${gitCommands} in parallel using the ${toolName} tool, in order to understand the current state of the branch since it diverged from the main branch:
|
|
59
|
+
- Run a git status command to see all untracked files
|
|
60
|
+
- Run a git diff command to see both staged and unstaged changes that will be committed
|
|
61
|
+
- Check if the current branch tracks a remote branch and is up to date with the remote, so you know if you need to push to the remote
|
|
62
|
+
- Run a git log command and `git diff [base-branch]...HEAD` to understand the full commit history for the current branch (from the time it diverged from the base branch)
|
|
63
|
+
2. Analyze all changes that will be included in the pull request, making sure to look at all relevant commits (NOT just the latest commit, but ALL commits that will be included in the pull request!!!), and draft a pull request summary
|
|
64
|
+
3. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following commands in parallel:
|
|
65
|
+
- Create new branch if needed
|
|
66
|
+
- Push to remote with -u flag if needed
|
|
67
|
+
- ${createPrInstruction}
|
|
68
|
+
<example>
|
|
69
|
+
${createPrExample}
|
|
70
|
+
</example>
|
|
71
|
+
|
|
72
|
+
Important:
|
|
73
|
+
- DO NOT use the TodoWrite or Task tools
|
|
74
|
+
- Return the PR URL when you're done, so the user can see it
|
|
75
|
+
|
|
76
|
+
# Other common operations
|
|
77
|
+
- View comments on a GitHub PR: gh api repos/foo/bar/pulls/123/comments
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
Load a specialized skill when the task at hand matches one of the skills listed in the system prompt.
|
|
2
|
+
|
|
3
|
+
Use this tool to inject the skill's instructions and resources into current conversation. The output may contain detailed workflow guidance as well as references to scripts, files, etc in the same directory as the skill.
|
|
4
|
+
|
|
5
|
+
The skill name must match one of the skills listed in your system prompt.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
Launch a new agent to handle complex, multistep tasks autonomously.
|
|
2
|
+
|
|
3
|
+
When using the Task tool, you must specify a subagent_type parameter to select which agent type to use.
|
|
4
|
+
|
|
5
|
+
When to use the Task tool:
|
|
6
|
+
- When you are instructed to execute custom slash commands. Use the Task tool with the slash command invocation as the entire prompt. The slash command can take arguments. For example: Task(description="Check the file", prompt="/check-file path/to/file.py")
|
|
7
|
+
|
|
8
|
+
When NOT to use the Task tool:
|
|
9
|
+
- If you want to read a specific file path, use the Read or Glob tool instead of the Task tool, to find the match more quickly
|
|
10
|
+
- If you are searching for a specific class definition like "class Foo", use the Glob tool instead, to find the match more quickly
|
|
11
|
+
- If you are searching for code within a specific file or set of 2-3 files, use the Read tool instead of the Task tool, to find the match more quickly
|
|
12
|
+
- Other tasks that are not related to the agent descriptions above
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
Usage notes:
|
|
16
|
+
1. Launch multiple agents concurrently whenever possible, to maximize performance; to do that, use a single message with multiple tool uses
|
|
17
|
+
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.
|
|
18
|
+
3. If OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS is enabled, background=true launches the subagent asynchronously. Use task_status(task_id=..., wait=false) to poll, or wait=true to block until done.
|
|
19
|
+
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.
|
|
20
|
+
5. The agent's outputs should generally be trusted
|
|
21
|
+
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).
|
|
22
|
+
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.
|
|
23
|
+
|
|
24
|
+
Example usage (NOTE: The agents below are fictional examples for illustration only - use the actual agents listed above):
|
|
25
|
+
|
|
26
|
+
<example_agent_descriptions>
|
|
27
|
+
"code-reviewer": use this agent after you are done writing a significant piece of code
|
|
28
|
+
"greeting-responder": use this agent when to respond to user greetings with a friendly joke
|
|
29
|
+
</example_agent_description>
|
|
30
|
+
|
|
31
|
+
<example>
|
|
32
|
+
user: "Please write a function that checks if a number is prime"
|
|
33
|
+
assistant: Sure let me write a function that checks if a number is prime
|
|
34
|
+
assistant: First let me use the Write tool to write a function that checks if a number is prime
|
|
35
|
+
assistant: I'm going to use the Write tool to write the following code:
|
|
36
|
+
<code>
|
|
37
|
+
function isPrime(n) {
|
|
38
|
+
if (n <= 1) return false
|
|
39
|
+
for (let i = 2; i * i <= n; i++) {
|
|
40
|
+
if (n % i === 0) return false
|
|
41
|
+
}
|
|
42
|
+
return true
|
|
43
|
+
}
|
|
44
|
+
</code>
|
|
45
|
+
<commentary>
|
|
46
|
+
Since a significant piece of code was written and the task was completed, now use the code-reviewer agent to review the code
|
|
47
|
+
</commentary>
|
|
48
|
+
assistant: Now let me use the code-reviewer agent to review the code
|
|
49
|
+
assistant: Uses the Task tool to launch the code-reviewer agent
|
|
50
|
+
</example>
|
|
51
|
+
|
|
52
|
+
<example>
|
|
53
|
+
user: "Hello"
|
|
54
|
+
<commentary>
|
|
55
|
+
Since the user is greeting, use the greeting-responder agent to respond with a friendly joke
|
|
56
|
+
</commentary>
|
|
57
|
+
assistant: "I'm going to use the Task tool to launch the with the greeting-responder agent"
|
|
58
|
+
</example>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Poll the status of a background subagent task launched with the task tool.
|
|
2
|
+
|
|
3
|
+
Use this for tasks started with `task(background=true)`.
|
|
4
|
+
|
|
5
|
+
Parameters:
|
|
6
|
+
- `task_id` (required): the task session id returned by the task tool
|
|
7
|
+
- `wait` (optional): when true, wait for completion
|
|
8
|
+
- `timeout_ms` (optional): max wait duration in milliseconds when `wait=true`
|
|
9
|
+
|
|
10
|
+
Returns compact, parseable output:
|
|
11
|
+
- `task_id`
|
|
12
|
+
- `state` (`running`, `completed`, `error`, or `cancelled`)
|
|
13
|
+
- `<task_result>...</task_result>` or `<task_error>...</task_error>` containing final output, error summary, or current progress text
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
Use this tool to create and manage a structured task list for your current coding session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.
|
|
2
|
+
It also helps the user understand the progress of the task and overall progress of their requests.
|
|
3
|
+
|
|
4
|
+
## When to Use This Tool
|
|
5
|
+
Use this tool proactively in these scenarios:
|
|
6
|
+
|
|
7
|
+
1. Complex multistep tasks - When a task requires 3 or more distinct steps or actions
|
|
8
|
+
2. Non-trivial and complex tasks - Tasks that require careful planning or multiple operations
|
|
9
|
+
3. User explicitly requests todo list - When the user directly asks you to use the todo list
|
|
10
|
+
4. User provides multiple tasks - When users provide a list of things to be done (numbered or comma-separated)
|
|
11
|
+
5. After receiving new instructions - Immediately capture user requirements as todos. Feel free to edit the todo list based on new information.
|
|
12
|
+
6. After completing a task - Mark it complete and add any new follow-up tasks
|
|
13
|
+
7. When you start working on a new task, mark the todo as in_progress. Ideally you should only have one todo as in_progress at a time. Complete existing tasks before starting new ones.
|
|
14
|
+
|
|
15
|
+
## When NOT to Use This Tool
|
|
16
|
+
|
|
17
|
+
Skip using this tool when:
|
|
18
|
+
1. There is only a single, straightforward task
|
|
19
|
+
2. The task is trivial and tracking it provides no organizational benefit
|
|
20
|
+
3. The task can be completed in less than 3 trivial steps
|
|
21
|
+
4. The task is purely conversational or informational
|
|
22
|
+
|
|
23
|
+
NOTE that you should not use this tool if there is only one trivial task to do. In this case you are better off just doing the task directly.
|
|
24
|
+
|
|
25
|
+
## Examples of When to Use the Todo List
|
|
26
|
+
|
|
27
|
+
<example>
|
|
28
|
+
User: I want to add a dark mode toggle to the application settings. Make sure you run the tests and build when you're done!
|
|
29
|
+
Assistant: I'll help add a dark mode toggle to your application settings. Let me create a todo list to track this implementation.
|
|
30
|
+
*Creates todo list with the following items:*
|
|
31
|
+
1. Create dark mode toggle component in Settings page
|
|
32
|
+
2. Add dark mode state management (context/store)
|
|
33
|
+
3. Implement CSS-in-JS styles for dark theme
|
|
34
|
+
4. Update existing components to support theme switching
|
|
35
|
+
5. Run tests and build process, addressing any failures or errors that occur
|
|
36
|
+
*Begins working on the first task*
|
|
37
|
+
|
|
38
|
+
<reasoning>
|
|
39
|
+
The assistant used the todo list because:
|
|
40
|
+
1. Adding dark mode is a multi-step feature requiring UI, state management, and styling changes
|
|
41
|
+
2. The user explicitly requested tests and build be run afterward
|
|
42
|
+
3. The assistant inferred that tests and build need to pass by adding "Ensure tests and build succeed" as the final task
|
|
43
|
+
</reasoning>
|
|
44
|
+
</example>
|
|
45
|
+
|
|
46
|
+
<example>
|
|
47
|
+
User: Help me rename the function getCwd to getCurrentWorkingDirectory across my project
|
|
48
|
+
Assistant: Let me first search through your codebase to find all occurrences of 'getCwd'.
|
|
49
|
+
*Uses grep or search tools to locate all instances of getCwd in the codebase*
|
|
50
|
+
Assistant: I've found 15 instances of 'getCwd' across 8 different files. Let me create a todo list to track these changes.
|
|
51
|
+
*Creates todo list with specific items for each file that needs updating*
|
|
52
|
+
|
|
53
|
+
<reasoning>
|
|
54
|
+
The assistant used the todo list because:
|
|
55
|
+
1. First, the assistant searched to understand the scope of the task
|
|
56
|
+
2. Upon finding multiple occurrences across different files, it determined this was a complex task with multiple steps
|
|
57
|
+
3. The todo list helps ensure every instance is tracked and updated systematically
|
|
58
|
+
4. This approach prevents missing any occurrences and maintains code consistency
|
|
59
|
+
</reasoning>
|
|
60
|
+
</example>
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
<example>
|
|
64
|
+
User: I need to implement these features for my e-commerce site: user registration, product catalog, shopping cart, and checkout flow.
|
|
65
|
+
Assistant: I'll help implement these features. First, let's add all the features to the todo list.
|
|
66
|
+
*Creates a todo list breaking down each feature into specific tasks based on the project architecture*
|
|
67
|
+
Assistant: Let's start with user registration. This will involve creating database models, API endpoints, and frontend forms that integrate with your existing authentication system.
|
|
68
|
+
|
|
69
|
+
<reasoning>
|
|
70
|
+
The assistant used the todo list because:
|
|
71
|
+
1. The user provided multiple complex features to implement in a comma separated list
|
|
72
|
+
2. The todo list helps organize these large features into manageable tasks
|
|
73
|
+
3. This approach allows for tracking progress across the entire implementation
|
|
74
|
+
</reasoning>
|
|
75
|
+
</example>
|
|
76
|
+
|
|
77
|
+
<example>
|
|
78
|
+
User: Can you help optimize my React application? It's rendering slowly and has performance issues.</user>
|
|
79
|
+
Assistant: I'll help optimize your React application. First, let me examine your codebase to identify potential performance bottlenecks.
|
|
80
|
+
*Reviews component structure, render patterns, state management, and data fetching*
|
|
81
|
+
Assistant: After analyzing your codebase, I've identified several performance issues. Let me create a todo list to track our optimization efforts.
|
|
82
|
+
*Creates todo list with items like: 1) Implement memoization for expensive calculations in ProductList, 2) Add virtualization for long lists in Dashboard, 3) Optimize image loading in Gallery component, 4) Fix state update loops in ShoppingCart, 5) Review bundle size and implement code splitting*
|
|
83
|
+
Let's start by implementing memoization for the expensive calculations in your ProductList component.</assistant>
|
|
84
|
+
|
|
85
|
+
<reasoning>
|
|
86
|
+
The assistant used the todo list because:
|
|
87
|
+
1. First, the assistant examined the codebase to identify specific performance issues
|
|
88
|
+
2. Based on this analysis, it identified multiple optimization opportunities
|
|
89
|
+
3. Performance optimization is a non-trivial task requiring multiple steps
|
|
90
|
+
4. The todo list helps methodically track improvements across different components
|
|
91
|
+
5. This systematic approach ensures all performance bottlenecks are addressed
|
|
92
|
+
</reasoning>
|
|
93
|
+
</example>
|
|
94
|
+
|
|
95
|
+
## Examples of When NOT to Use the Todo List
|
|
96
|
+
|
|
97
|
+
<example>
|
|
98
|
+
User: How do I print 'Hello World' in Python?
|
|
99
|
+
Assistant: In Python, you can print "Hello World" with this simple code:
|
|
100
|
+
|
|
101
|
+
python
|
|
102
|
+
print("Hello World")
|
|
103
|
+
|
|
104
|
+
This will output the text "Hello World" to the console when executed.</assistant>
|
|
105
|
+
|
|
106
|
+
<reasoning>
|
|
107
|
+
The assistant did not use the todo list because this is a single, trivial task that can be completed in one step. There's no need to track multiple tasks or steps for such a straightforward request.
|
|
108
|
+
</reasoning>
|
|
109
|
+
</example>
|
|
110
|
+
|
|
111
|
+
<example>
|
|
112
|
+
User: What does the git status command do?
|
|
113
|
+
Assistant: The git status command shows the current state of your working directory and staging area. It displays which changes have been staged, which haven't, and which files aren't being tracked by Git. This is a fundamental command for understanding the current state of your repository before making commits.
|
|
114
|
+
|
|
115
|
+
<reasoning>
|
|
116
|
+
The assistant did not use the todo list because this is an informational request with no actual coding task to complete. The user is simply asking for an explanation, not for the assistant to perform multiple steps or tasks.
|
|
117
|
+
</reasoning>
|
|
118
|
+
</example>
|
|
119
|
+
|
|
120
|
+
<example>
|
|
121
|
+
User: Can you add a comment to the calculateTotal function to explain what it does?
|
|
122
|
+
Assistant: Sure, let me add a comment to the calculateTotal function to explain what it does.
|
|
123
|
+
* Uses the Edit tool to add a comment to the calculateTotal function *
|
|
124
|
+
|
|
125
|
+
<reasoning>
|
|
126
|
+
The assistant did not use the todo list because this is a single, straightforward task confined to one location in the code. Adding a comment doesn't require tracking multiple steps or systematic organization.
|
|
127
|
+
</reasoning>
|
|
128
|
+
</example>
|
|
129
|
+
|
|
130
|
+
<example>
|
|
131
|
+
User: Run npm install for me and tell me what happens.
|
|
132
|
+
Assistant: I'll run the npm install command for you.
|
|
133
|
+
|
|
134
|
+
*Executes: npm install*
|
|
135
|
+
|
|
136
|
+
The command completed successfully. Here's the output:
|
|
137
|
+
[Output of npm install command]
|
|
138
|
+
|
|
139
|
+
All dependencies have been installed according to your package.json file.
|
|
140
|
+
|
|
141
|
+
<reasoning>
|
|
142
|
+
The assistant did not use the todo list because this is a single command execution with immediate results. There are no multiple steps to track or organize, making the todo list unnecessary for this straightforward task.
|
|
143
|
+
</reasoning>
|
|
144
|
+
</example>
|
|
145
|
+
|
|
146
|
+
## Task States and Management
|
|
147
|
+
|
|
148
|
+
1. **Task States**: Use these states to track progress:
|
|
149
|
+
- pending: Task not yet started
|
|
150
|
+
- in_progress: Currently working on (limit to ONE task at a time)
|
|
151
|
+
- completed: Task finished successfully
|
|
152
|
+
- cancelled: Task no longer needed
|
|
153
|
+
|
|
154
|
+
2. **Task Management**:
|
|
155
|
+
- Update task status in real-time as you work
|
|
156
|
+
- Mark tasks complete IMMEDIATELY after finishing (don't batch completions)
|
|
157
|
+
- Only have ONE task in_progress at any time
|
|
158
|
+
- Complete current tasks before starting new ones
|
|
159
|
+
- Cancel tasks that become irrelevant
|
|
160
|
+
|
|
161
|
+
3. **Task Breakdown**:
|
|
162
|
+
- Create specific, actionable items
|
|
163
|
+
- Break complex tasks into smaller, manageable steps
|
|
164
|
+
- Use clear, descriptive task names
|
|
165
|
+
|
|
166
|
+
When in doubt, use this tool. Being proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully.
|
|
167
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Use the `apply_patch` tool to edit files. Your patch language is a stripped‑down, file‑oriented diff format designed to be easy to parse and safe to apply. You can think of it as a high‑level envelope:
|
|
2
|
+
|
|
3
|
+
*** Begin Patch
|
|
4
|
+
[ one or more file sections ]
|
|
5
|
+
*** End Patch
|
|
6
|
+
|
|
7
|
+
Within that envelope, you get a sequence of file operations.
|
|
8
|
+
You MUST include a header to specify the action you are taking.
|
|
9
|
+
Each operation starts with one of three headers:
|
|
10
|
+
|
|
11
|
+
*** Add File: <path> - create a new file. Every following line is a + line (the initial contents).
|
|
12
|
+
*** Delete File: <path> - remove an existing file. Nothing follows.
|
|
13
|
+
*** Update File: <path> - patch an existing file in place (optionally with a rename).
|
|
14
|
+
|
|
15
|
+
Example patch:
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
*** Begin Patch
|
|
19
|
+
*** Add File: hello.txt
|
|
20
|
+
+Hello world
|
|
21
|
+
*** Update File: src/app.py
|
|
22
|
+
*** Move to: src/main.py
|
|
23
|
+
@@ def greet():
|
|
24
|
+
-print("Hi")
|
|
25
|
+
+print("Hello, world!")
|
|
26
|
+
*** Delete File: obsolete.txt
|
|
27
|
+
*** End Patch
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
It is important to remember:
|
|
31
|
+
|
|
32
|
+
- You must include a header with your intended action (Add/Delete/Update)
|
|
33
|
+
- You must prefix new lines with `+` even when creating a new file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Performs exact string replacements in files.
|
|
2
|
+
|
|
3
|
+
Usage:
|
|
4
|
+
- You must use your `Read` tool at least once in the conversation before editing. This tool will error if you attempt an edit without reading the file.
|
|
5
|
+
- When editing text from Read tool output, ensure you preserve the exact indentation (tabs/spaces) as it appears AFTER the line number prefix. The line number prefix format is: line number + colon + space (e.g., `1: `). Everything after that space is the actual file content to match. Never include any part of the line number prefix in the oldString or newString.
|
|
6
|
+
- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.
|
|
7
|
+
- Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked.
|
|
8
|
+
- The edit will FAIL if `oldString` is not found in the file with an error "oldString not found in content".
|
|
9
|
+
- The edit will FAIL if `oldString` is found multiple times in the file with an error "Found multiple matches for oldString. Provide more surrounding lines in oldString to identify the correct match." Either provide a larger string with more surrounding context to make it unique or use `replaceAll` to change every instance of `oldString`.
|
|
10
|
+
- Use `replaceAll` for replacing and renaming strings across the file. This parameter is useful if you want to rename a variable for instance.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
- Fast file pattern matching tool that works with any codebase size
|
|
2
|
+
- Supports glob patterns like "**/*.js" or "src/**/*.ts"
|
|
3
|
+
- Returns matching file paths sorted by modification time
|
|
4
|
+
- Use this tool when you need to find files by name patterns
|
|
5
|
+
- When you are doing an open-ended search that may require multiple rounds of globbing and grepping, use the Task tool instead
|
|
6
|
+
- You have the capability to call multiple tools in a single response. It is always better to speculatively perform multiple searches as a batch that are potentially useful.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
- Fast content search tool that works with any codebase size
|
|
2
|
+
- Searches file contents using regular expressions
|
|
3
|
+
- Supports full regex syntax (eg. "log.*Error", "function\s+\w+", etc.)
|
|
4
|
+
- Filter files by pattern with the include parameter (eg. "*.js", "*.{ts,tsx}")
|
|
5
|
+
- Returns file paths and line numbers with at least one match sorted by modification time
|
|
6
|
+
- Use this tool when you need to find files containing specific patterns
|
|
7
|
+
- If you need to identify/count the number of matches within files, use the Bash tool with `rg` (ripgrep) directly. Do NOT use `grep`.
|
|
8
|
+
- When you are doing an open-ended search that may require multiple rounds of globbing and grepping, use the Task tool instead
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Interact with Language Server Protocol (LSP) servers to get code intelligence features.
|
|
2
|
+
|
|
3
|
+
Supported operations:
|
|
4
|
+
- goToDefinition: Find where a symbol is defined
|
|
5
|
+
- findReferences: Find all references to a symbol
|
|
6
|
+
- hover: Get hover information (documentation, type info) for a symbol
|
|
7
|
+
- documentSymbol: Get all symbols (functions, classes, variables) in a document
|
|
8
|
+
- workspaceSymbol: List project-wide symbols matching a query string
|
|
9
|
+
- goToImplementation: Find implementations of an interface or abstract method
|
|
10
|
+
- prepareCallHierarchy: Get call hierarchy item at a position (functions/methods)
|
|
11
|
+
- incomingCalls: Find all functions/methods that call the function at a position
|
|
12
|
+
- outgoingCalls: Find all functions/methods called by the function at a position
|
|
13
|
+
|
|
14
|
+
All operations require:
|
|
15
|
+
- filePath: The file to operate on
|
|
16
|
+
- line: The line number (1-based, as shown in editors)
|
|
17
|
+
- character: The character offset (1-based, as shown in editors)
|
|
18
|
+
|
|
19
|
+
workspaceSymbol also accepts:
|
|
20
|
+
- query: A query string to filter symbols by. Empty string requests all symbols.
|
|
21
|
+
|
|
22
|
+
For workspaceSymbol, filePath is not sent in the LSP workspace/symbol request. It is used by opencode to select and start the matching LSP server.
|
|
23
|
+
|
|
24
|
+
Note: LSP servers must be configured for the file type. If no server is available, an error will be returned.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Use this tool to suggest switching to plan agent when the user's request would benefit from planning before implementation.
|
|
2
|
+
|
|
3
|
+
If they explicitly mention wanting to create a plan ALWAYS call this tool first.
|
|
4
|
+
|
|
5
|
+
This tool will ask the user if they want to switch to plan agent.
|
|
6
|
+
|
|
7
|
+
Call this tool when:
|
|
8
|
+
- The user's request is complex and would benefit from planning first
|
|
9
|
+
- You want to research and design before making changes
|
|
10
|
+
- The task involves multiple files or significant architectural decisions
|
|
11
|
+
|
|
12
|
+
Do NOT call this tool:
|
|
13
|
+
- For simple, straightforward tasks
|
|
14
|
+
- When the user explicitly wants immediate implementation
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Use this tool when you have completed the planning phase and are ready to exit plan agent.
|
|
2
|
+
|
|
3
|
+
This tool will ask the user if they want to switch to build agent to start implementing the plan.
|
|
4
|
+
|
|
5
|
+
Call this tool:
|
|
6
|
+
- After you have written a complete plan to the plan file
|
|
7
|
+
- After you have clarified any questions with the user
|
|
8
|
+
- When you are confident the plan is ready for implementation
|
|
9
|
+
|
|
10
|
+
Do NOT call this tool:
|
|
11
|
+
- Before you have created or finalized the plan
|
|
12
|
+
- If you still have unanswered questions about the implementation
|
|
13
|
+
- If the user has indicated they want to continue planning
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Use this tool when you need to ask the user questions during execution. This allows you to:
|
|
2
|
+
1. Gather user preferences or requirements
|
|
3
|
+
2. Clarify ambiguous instructions
|
|
4
|
+
3. Get decisions on implementation choices as you work
|
|
5
|
+
4. Offer choices to the user about what direction to take.
|
|
6
|
+
|
|
7
|
+
Usage notes:
|
|
8
|
+
- When `custom` is enabled (default), a "Type your own answer" option is added automatically; don't include "Other" or catch-all options
|
|
9
|
+
- Answers are returned as arrays of labels; set `multiple: true` to allow selecting more than one
|
|
10
|
+
- If you recommend a specific option, make that the first option in the list and add "(Recommended)" at the end of the label
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Read a file or directory from the local filesystem. If the path does not exist, an error is returned.
|
|
2
|
+
|
|
3
|
+
Usage:
|
|
4
|
+
- The filePath parameter should be an absolute path.
|
|
5
|
+
- By default, this tool returns up to 2000 lines from the start of the file.
|
|
6
|
+
- The offset parameter is the line number to start from (1-indexed).
|
|
7
|
+
- To read later sections, call this tool again with a larger offset.
|
|
8
|
+
- Use the grep tool to find specific content in large files or files with long lines.
|
|
9
|
+
- If you are unsure of the correct file path, use the glob tool to look up filenames by glob pattern.
|
|
10
|
+
- Contents are returned with each line prefixed by its line number as `<line>: <content>`. For example, if a file has contents "foo\n", you will receive "1: foo\n". For directories, entries are returned one per line (without line numbers) with a trailing `/` for subdirectories.
|
|
11
|
+
- Any line longer than 2000 characters is truncated.
|
|
12
|
+
- Call this tool in parallel when you know there are multiple files you want to read.
|
|
13
|
+
- Avoid tiny repeated slices (30 line chunks). If you need more context, read a larger window.
|
|
14
|
+
- This tool can read image files and PDFs and return them as file attachments.
|