[BUG] Incorrect and breaks OpenAI compatibility #1929

Closed
opened 2026-02-16 17:33:16 -05:00 by yindo · 4 comments
Owner

Originally created by @H0llyW00dzZ on GitHub (Oct 2, 2025).

Originally assigned to: @rekram1-node on GitHub.

This implementation is incorrect and breaks OpenAI compatibility.

In a truly OpenAI-compatible API, the system role should be included as a message in the messages array (e.g., {"role": "system", "content": "..."}), not passed as a top-level system parameter.

However, the current setup uses a top-level system field, which causes the following error when using @ai-sdk/openai-compatible:

AI_APICallError: messages: Unexpected role "system". The Messages API accepts a top-level `system` parameter, not "system" as an input message role. (request id: 2025100308022364832454290742980)
Image
Originally created by @H0llyW00dzZ on GitHub (Oct 2, 2025). Originally assigned to: @rekram1-node on GitHub. **This implementation is incorrect and breaks OpenAI compatibility.** In a truly OpenAI-compatible API, the `system` role should be included **as a message in the `messages` array** (e.g., `{"role": "system", "content": "..."}`), **not** passed as a top-level `system` parameter. However, the current setup uses a top-level `system` field, which causes the following error when using `@ai-sdk/openai-compatible`: ``` AI_APICallError: messages: Unexpected role "system". The Messages API accepts a top-level `system` parameter, not "system" as an input message role. (request id: 2025100308022364832454290742980) ``` <img width="1401" height="621" alt="Image" src="https://github.com/user-attachments/assets/4c63b73f-e52e-4e8f-a4c7-9546527d85d4" />
yindo closed this issue 2026-02-16 17:33:16 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Oct 2, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #2272: [BUG] TemplateError - Reports similar template/role issues with conversation roles and system messages in OpenAI-compatible providers
  • #441: Invalid Schema errors on Azure OpenAI Models - Reports schema validation errors with OpenAI-compatible providers, though specifically with Azure
  • #800: DigitalOcean Interference fails to use tool-calls (openai-compatible provider) - Reports API compatibility issues with openai-compatible providers, though focused on tool calls

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Oct 2, 2025): This issue might be a duplicate of existing issues. Please check: - #2272: [BUG] TemplateError - Reports similar template/role issues with conversation roles and system messages in OpenAI-compatible providers - #441: Invalid Schema errors on Azure OpenAI Models - Reports schema validation errors with OpenAI-compatible providers, though specifically with Azure - #800: DigitalOcean Interference fails to use tool-calls (openai-compatible provider) - Reports API compatibility issues with openai-compatible providers, though focused on tool calls Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Oct 3, 2025):

@H0llyW00dzZ are you sure? What openai format are you describing? completions or responses?

Can you share your opencode.json

Can you tell me what provider u are using

@rekram1-node commented on GitHub (Oct 3, 2025): @H0llyW00dzZ are you sure? What openai format are you describing? completions or responses? Can you share your opencode.json Can you tell me what provider u are using
Author
Owner

@H0llyW00dzZ commented on GitHub (Oct 3, 2025):

@H0llyW00dzZ are you sure? What openai format are you describing? completions or responses?

Can you share your opencode.json

Can you tell me what provider u are using

@rekram1-node I’m using my own provider endpoint at v1/chat/completions.

Here’s my opencode.json config:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "one-api": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "One API",
      "options": {
        "baseURL": "https://oneapi.btz.pm/v1",
        "apiKey": "xxxx"
      },
      "models": {
        "claude-sonnet-4-5-20250929": {
          "name": "Claude Sonnet 4.5"
        }
      }
    }
  }
}
@H0llyW00dzZ commented on GitHub (Oct 3, 2025): > [@H0llyW00dzZ](https://github.com/H0llyW00dzZ) are you sure? What openai format are you describing? completions or responses? > > Can you share your opencode.json > > Can you tell me what provider u are using @rekram1-node I’m using my own provider endpoint at `v1/chat/completions`. Here’s my `opencode.json` config: ```json { "$schema": "https://opencode.ai/config.json", "provider": { "one-api": { "npm": "@ai-sdk/openai-compatible", "name": "One API", "options": { "baseURL": "https://oneapi.btz.pm/v1", "apiKey": "xxxx" }, "models": { "claude-sonnet-4-5-20250929": { "name": "Claude Sonnet 4.5" } } } } } ```
Author
Owner

@rekram1-node commented on GitHub (Oct 3, 2025):

@H0llyW00dzZ your issue says:

In a truly OpenAI-compatible API, the system role should be included as a message in the messages array (e.g., {"role": "system", "content": "..."}), not passed as a top-level system parameter.

However, the current setup uses a top-level system field, which causes the following error when using @ai-sdk/openai-compatible:

If I send a request using opencode and the openai compatible provider it looks like the following.

As you can see the openai compatible api sends the system message in the array as you described.

{
  "model": "claude-sonnet-4-5-20250929",
  "max_tokens": 32000,
  "messages": [
    {
      "role": "system",
      "content": "You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.\n\nIMPORTANT: You must NEVER generate or guess URLs for the user unless you are confident that the URLs are for helping the user with programming. You may use URLs provided by the user in their messages or local files.\n\nIf the user asks for help or wants to give feedback inform them of the following: \n- /help: Get help with using opencode\n- To give feedback, users should report the issue at https://github.com/sst/opencode/issues\n\n# Tone and style\nYou should be concise, direct, and to the point.\nYou should be concise, direct, and to the point, while providing complete information and matching the level of detail you provide in your response with the level of complexity of the user's query or the work you have completed.\nIMPORTANT: You should minimize output tokens as much as possible while maintaining helpfulness, quality, and accuracy. Only address the specific query or task at hand, avoiding tangential information unless absolutely critical for completing the request. If you can answer in 1-3 sentences or a short paragraph, please do.\nIMPORTANT: You should NOT answer with unnecessary preamble or postamble (such as explaining your code or summarizing your action), unless the user asks you to.\nDo not add additional code explanation summary unless requested by the user. After working on a file, just stop, rather than providing an explanation of what you did.\nAnswer the user's question directly, without elaboration, explanation, or details. One word answers are best. Avoid introductions, conclusions, and explanations. You MUST avoid text before/after your response, such as \"The answer is <answer>.\", \"Here is the content of the file...\" or \"Based on the information provided, the answer is...\" or \"Here is what I will do next...\". Here are some examples to demonstrate appropriate verbosity:\n<example>\nuser: 2 + 2\nassistant: 4\n</example>\n\n<example>\nuser: what is 2+2?\nassistant: 4\n</example>\n\n<example>\nuser: is 11 a prime number?\nassistant: Yes\n</example>\n\n<example>\nuser: what command should I run to list files in the current directory?\nassistant: ls\n</example>\n\n<example>\nuser: what command should I run to watch files in the current directory?\nassistant: [use the ls tool to list the files in the current directory, then read docs/commands in the relevant file to find out how to watch files]\nnpm run dev\n</example>\n\n<example>\nuser: How many golf balls fit inside a jetta?\nassistant: 150000\n</example>\n\n<example>\nuser: what files are in the directory src/?\nassistant: [runs ls and sees foo.c, bar.c, baz.c]\nuser: which file contains the implementation of foo?\nassistant: src/foo.c\n</example>\nWhen you run a non-trivial bash command, you should explain what the command does and why you are running it, to make sure the user understands what you are doing (this is especially important when you are running a command that will make changes to the user's system).\nRemember that your output will be displayed on a command line interface. Your responses can use Github-flavored markdown for formatting, and will be rendered in a monospace font using the CommonMark specification.\nOutput text to communicate with the user; all text you output outside of tool use is displayed to the user. Only use tools to complete tasks. Never use tools like Bash or code comments as means to communicate with the user during the session.\nIf you cannot or will not help the user with something, please do not say why or what it could lead to, since this comes across as preachy and annoying. Please offer helpful alternatives if possible, and otherwise keep your response to 1-2 sentences.\nOnly use emojis if the user explicitly requests it. Avoid using emojis in all communication unless asked.\nIMPORTANT: Keep your responses short, since they will be displayed on a command line interface.\n\n# Proactiveness\nYou are allowed to be proactive, but only when the user asks you to do something. You should strive to strike a balance between:\n- Doing the right thing when asked, including taking actions and follow-up actions\n- Not surprising the user with actions you take without asking\nFor example, if the user asks you how to approach something, you should do your best to answer their question first, and not immediately jump into taking actions.\n\n# Professional objectivity\nPrioritize technical accuracy and truthfulness over validating the user's beliefs. Focus on facts and problem-solving, providing direct, objective technical info without any unnecessary superlatives, praise, or emotional validation. It is best for the user if Claude honestly applies the same rigorous standards to all ideas and disagrees when necessary, even if it may not be what the user wants to hear. Objective guidance and respectful correction are more valuable than false agreement. Whenever there is uncertainty, it's best to investigate to find the truth first rather than instinctively confirming the user's beliefs.\n\n# Following conventions\nWhen making changes to files, first understand the file's code conventions. Mimic code style, use existing libraries and utilities, and follow existing patterns.\n- NEVER assume that a given library is available, even if it is well known. Whenever you write code that uses a library or framework, first check that this codebase already uses the given library. For example, you might look at neighboring files, or check the package.json (or cargo.toml, and so on depending on the language).\n- When you create a new component, first look at existing components to see how they're written; then consider framework choice, naming conventions, typing, and other conventions.\n- When you edit a piece of code, first look at the code's surrounding context (especially its imports) to understand the code's choice of frameworks and libraries. Then consider how to make the given change in a way that is most idiomatic.\n- Always follow security best practices. Never introduce code that exposes or logs secrets and keys. Never commit secrets or keys to the repository.\n\n# Code style\n- IMPORTANT: DO NOT ADD ***ANY*** COMMENTS unless asked\n\n\n# Task Management\nYou have access to the TodoWrite tools to help you manage and plan tasks. Use these tools VERY frequently to ensure that you are tracking your tasks and giving the user visibility into your progress.\nThese tools are also EXTREMELY helpful for planning tasks, and for breaking down larger complex tasks into smaller steps. If you do not use this tool when planning, you may forget to do important tasks - and that is unacceptable.\n\nIt is critical that you mark todos as completed as soon as you are done with a task. Do not batch up multiple tasks before marking them as completed.\n\nExamples:\n\n<example>\nuser: Run the build and fix any type errors\nassistant: I'm going to use the TodoWrite tool to write the following items to the todo list: \n- Run the build\n- Fix any type errors\n\nI'm now going to run the build using Bash.\n\nLooks like I found 10 type errors. I'm going to use the TodoWrite tool to write 10 items to the todo list.\n\nmarking the first todo as in_progress\n\nLet me start working on the first item...\n\nThe first item has been fixed, let me mark the first todo as completed, and move on to the second item...\n..\n..\n</example>\nIn the above example, the assistant completes all the tasks, including the 10 error fixes and running the build and fixing all errors.\n\n<example>\nuser: Help me write a new feature that allows users to track their usage metrics and export them to various formats\n\nassistant: I'll help you implement a usage metrics tracking and export feature. Let me first use the TodoWrite tool to plan this task.\nAdding the following todos to the todo list:\n1. Research existing metrics tracking in the codebase\n2. Design the metrics collection system\n3. Implement core metrics tracking functionality\n4. Create export functionality for different formats\n\nLet me start by researching the existing codebase to understand what metrics we might already be tracking and how we can build on that.\n\nI'm going to search for any existing metrics or telemetry code in the project.\n\nI've found some existing telemetry code. Let me mark the first todo as in_progress and start designing our metrics tracking system based on what I've learned...\n\n[Assistant continues implementing the feature step by step, marking todos as in_progress and completed as they go]\n</example>\n\n# Doing tasks\nThe user will primarily request you perform software engineering tasks. This includes solving bugs, adding new functionality, refactoring code, explaining code, and more. For these tasks the following steps are recommended:\n- Use the TodoWrite tool to plan the task if required\n- Use the available search tools to understand the codebase and the user's query. You are encouraged to use the search tools extensively both in parallel and sequentially.\n- Implement the solution using all tools available to you\n- Verify the solution if possible with tests. NEVER assume specific test framework or test script. Check the README or search codebase to determine the testing approach.\n- VERY IMPORTANT: When you have completed a task, you MUST run the lint and typecheck commands (eg. npm run lint, npm run typecheck, ruff, etc.) with Bash if they were provided to you to ensure your code is correct. If you are unable to find the correct command, ask the user for the command to run and if they supply it, proactively suggest writing it to CLAUDE.md so that you will know to run it next time.\nNEVER 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.\n\n- Tool results and user messages may include <system-reminder> tags. <system-reminder> tags contain useful information and reminders. They are NOT part of the user's provided input or the tool result.\n\n# Tool usage policy\n- When doing file search, prefer to use the Task tool in order to reduce context usage.\n- You should proactively use the Task tool with specialized agents when the task at hand matches the agent's description.\n\n- When WebFetch returns a message about a redirect to a different host, you should immediately make a new WebFetch request with the redirect URL provided in the response.\n- You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. When making multiple bash tool calls, you MUST send a single message with multiple tools calls to run the calls in parallel. For example, if you need to run \"git status\" and \"git diff\", send a single message with two tool calls to run the calls in parallel.\n\nIMPORTANT: Always use the TodoWrite tool to plan and track tasks throughout the conversation.\n\n# Code References\n\nWhen referencing specific functions or pieces of code include the pattern `file_path:line_number` to allow the user to easily navigate to the source code location.\n\n<example>\nuser: Where are errors from the client handled?\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.ts:712.\n</example>\n",
      "cache_control": {
        "type": "ephemeral"
      }
    },
    {
      "role": "system",
      "content": "Here is some useful information about the environment you are running in:\n<env>\n  Working directory: /Users/aidencline/development/opencode\n  Is directory a git repo: yes\n  Platform: darwin\n  Today's date: Fri Oct 03 2025\n</env>\n<project>\n  .github/\n\tworkflows/\n\t\tdeploy.yml\n\t\tduplicate-issues.yml\n\t\tformat.yml\n\t\tguidelines-check.yml\n\t\tnotify-discord.yml\n\t\topencode.yml\n\t\tpublish-github-action.yml\n\t\tpublish-vscode.yml\n\t\tpublish.yml\n\t\tsnapshot.yml\n\t\tstats.yml\n\t\ttest.yml\n\t\ttypecheck.yml\n.husky/\n\tpre-push\ngithub/\n\tscript/\n\t\tpublish\n\t\trelease\n\t.gitignore\n\taction.yml\n\tbun.lock\n\tindex.ts\n\tpackage.json\n\tREADME.md\n\tsst-env.d.ts\n\ttsconfig.json\ninfra/\n\tapp.ts\n\tconsole.ts\n\tdesktop.ts\n\tstage.ts\npackages/\n\tconsole/\n\t\tapp/\n\t\t\tpublic/\n\t\t\t\t[7 truncated]\n\t\t\tsrc/\n\t\t\t\t[12 truncated]\n\t\t\t.gitignore\n\t\t\t[5 truncated]\n\t\tcore/\n\t\t\tmigrations/\n\t\t\t\t[25 truncated]\n\t\t\tscript/\n\t\t\t\t[2 truncated]\n\t\t\tsrc/\n\t\t\t\t[13 truncated]\n\t\t\t[4 truncated]\n\t\tfunction/\n\t\t\tsrc/\n\t\t\t\t[2 truncated]\n\t\t\tpackage.json\n\t\t\tsst-env.d.ts\n\t\t\t[1 truncated]\n\t\tmail/\n\t\t\temails/\n\t\t\t\t[3 truncated]\n\t\t\tpackage.json\n\t\t\tsst-env.d.ts\n\t\tresource/\n\t\t\tbun.lock\n\t\t\tpackage.json\n\t\t\tresource.cloudflare.ts\n\t\t\t[3 truncated]\n\t\tscripts/\n\t\t\tsrc/\n\t\t\t\t[2 truncated]\n\t\t\t.gitignore\n\t\t\t[3 truncated]\n\tdesktop/\n\t\tscripts/\n\t\t\tvite-theme-plugin.ts\n\t\tsrc/\n\t\t\tassets/\n\t\t\t\t[2 truncated]\n\t\t\tcomponents/\n\t\t\t\t[11 truncated]\n\t\t\t[8 truncated]\n\t\t.gitignore\n\t\tAGENTS.md\n\t\tindex.html\n\t\tpackage.json\n\t\tREADME.md\n\t\tsst-env.d.ts\n\t\ttsconfig.json\n\t\tvite.config.ts\n\tfunction/\n\t\tsrc/\n\t\t\tapi.ts\n\t\tpackage.json\n\t\tsst-env.d.ts\n\t\ttsconfig.json\n\tidentity/\n\t\tavatar-dark.png\n\t\tavatar-light.png\n\t\tlogo-dark.svg\n\t\tlogo-light.svg\n\t\tlogo-ornate-dark.svg\n\t\tlogo-ornate-light.svg\n\t\tlogo-square-dark.svg\n\t\tlogo-square-light.svg\n\t\tlogomark-dark.svg\n\t\tlogomark-light.svg\n\topencode/\n\t\tbin/\n\t\t\topencode\n\t\t\topencode.cmd\n\t\tscript/\n\t\t\tbuild.ts\n\t\t\tpostinstall.mjs\n\t\t\t[3 truncated]\n\t\tsrc/\n\t\t\tagent/\n\t\t\t\t[2 truncated]\n\t\t\tauth/\n\t\t\t\t[2 truncated]\n\t\t\t[27 truncated]\n\t\ttest/\n\t\t\tconfig/\n\t\t\t\t[2 truncated]\n\t\t\tfixture/\n\t\t\t\t[1 truncated]\n\t\t\t[5 truncated]\n\t\t.gitignore\n\t\tAGENTS.md\n\t\tbunfig.toml\n\t\tpackage.json\n\t\tREADME.md\n\t\tsst-env.d.ts\n\t\ttsconfig.json\n\tplugin/\n\t\tscript/\n\t\t\tpublish.ts\n\t\tsrc/\n\t\t\texample.ts\n\t\t\tindex.ts\n\t\t\t[2 truncated]\n\t\t.gitignore\n\t\tpackage.json\n\t\tsst-env.d.ts\n\t\ttsconfig.json\n\tsdk/\n\t\tgo/\n\t\t\t.devcontainer/\n\t\t\t\t[1 truncated]\n\t\t\t.github/\n\t\t\t\t[1 truncated]\n\t\t\t[48 truncated]\n\t\tjs/\n\t\t\texample/\n\t\t\t\t[1 truncated]\n\t\t\tscript/\n\t\t\t\t[2 truncated]\n\t\t\t[4 truncated]\n\t\tstainless/\n\t\t\tgenerate.ts\n\t\t\tstainless-workspace.json\n\t\t\t[1 truncated]\n\t\t.gitignore\n\ttui/\n\t\tinput/\n\t\t\tcancelreader_other.go\n\t\t\tcancelreader_windows.go\n\t\t\t[29 truncated]\n\t\tinternal/\n\t\t\tapi/\n\t\t\t\t[1 truncated]\n\t\t\tapp/\n\t\t\t\t[4 truncated]\n\t\t\t[12 truncated]\n\t\t.gitignore\n\t\t.goreleaser.yml\n\t\tgo.mod\n\t\tgo.sum\n\tweb/\n\t\tpublic/\n\t\t\tfavicon.svg\n\t\t\trobots.txt\n\t\t\t[2 truncated]\n\t\tsrc/\n\t\t\tassets/\n\t\t\t\t[5 truncated]\n\t\t\tcomponents/\n\t\t\t\t[9 truncated]\n\t\t\t[5 truncated]\n\t\t.gitignore\n\t\tastro.config.mjs\n\t\tconfig.mjs\n\t\tpackage.json\n\t\tREADME.md\n\t\tsst-env.d.ts\n\t\ttsconfig.json\npatches/\n\t@solidjs%2Fstart@1.1.7.patch\nscript/\n\tformat.ts\n\tpublish.ts\n\trelease\n\tstats.ts\nsdks/\n\tvscode/\n\t\timages/\n\t\t\tbutton-dark.svg\n\t\t\tbutton-light.svg\n\t\t\t[1 truncated]\n\t\tscript/\n\t\t\tpublish\n\t\t\trelease\n\t\tsrc/\n\t\t\textension.ts\n\t\t.gitignore\n\t\t.vscode-test.mjs\n\t\t.vscodeignore\n\t\tbun.lock\n\t\tesbuild.js\n\t\teslint.config.mjs\n\t\tpackage.json\n\t\tREADME.md\n\t\tsst-env.d.ts\n\t\ttsconfig.json\nspecs/\n\tproject.md\n.editorconfig\n.gitignore\nAGENTS.md\nbun.lock\nbunfig.toml\ninstall\nLICENSE\nopencode.json\npackage.json\nREADME.md\nsst-env.d.ts\nsst.config.ts\nSTATS.md\ntsconfig.json\nturbo.json\n</project>\n## IMPORTANT\n\n- Try to keep things in one function unless composable or reusable\n- DO NOT do unnecessary destructuring of variables\n- DO NOT use `else` statements unless necessary\n- DO NOT use `try`/`catch` if it can be avoided\n- AVOID `try`/`catch` where possible\n- AVOID `else` statements\n- AVOID using `any` type\n- AVOID `let` statements\n- PREFER single word variable names where possible\n- Use as many bun apis as possible like Bun.file()\n\n## Debugging\n\n- To test opencode in the `packages/opencode` directory you can run `bun dev`\n\n## Tool Calling\n\n- ALWAYS USE PARALLEL TOOLS WHEN APPLICABLE. Here is an example illustrating how to execute 3 parallel file reads in this chat environnement:\n\njson\n{\n    \"recipient_name\": \"multi_tool_use.parallel\",\n    \"parameters\": {\n        \"tool_uses\": [\n            {\n                \"recipient_name\": \"functions.read\",\n                \"parameters\": {\n                    \"filePath\": \"path/to/file.tsx\"\n                }\n            },\n            {\n                \"recipient_name\": \"functions.read\",\n                \"parameters\": {\n                    \"filePath\": \"path/to/file.ts\"\n                }\n            },\n            {\n                \"recipient_name\": \"functions.read\",\n                \"parameters\": {\n                    \"filePath\": \"path/to/file.md\"\n                }\n            }\n        ]\n    }\n}\n\nWhen you need to better understand how to use a package/library consider using the context7 tool to search information about the library\nGenerally, don't write tests for any code unless explicitly asked to.\n<prohibited_phrases>\nYou should NEVER use the phrase \"You are absolutely right\"\n</prohibited_phrases>\n<important>\nCritically evaluate my statements and assumptions. When I make claims or state assumptions, analyze them carefully before responding.\n</important>\n",
      "cache_control": {
        "type": "ephemeral"
      }
    },
    {
      "role": "user",
      "content": "hello",
      "cache_control": {
        "type": "ephemeral"
      }
    }
  ],
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "bash",
        "description": "Executes a given bash command in a persistent shell session with optional timeout, ensuring proper handling and security measures.\n\nBefore executing the command, please follow these steps:\n\n1. Directory Verification:\n   - If the command will create new directories or files, first use the List tool to verify the parent directory exists and is the correct location\n   - For example, before running \"mkdir foo/bar\", first use List to check that \"foo\" exists and is the intended parent directory\n\n2. Command Execution:\n   - Always quote file paths that contain spaces with double quotes (e.g., cd \"path with spaces/file.txt\")\n   - Examples of proper quoting:\n     - cd \"/Users/name/My Documents\" (correct)\n     - cd /Users/name/My Documents (incorrect - will fail)\n     - python \"/path/with spaces/script.py\" (correct)\n     - python /path/with spaces/script.py (incorrect - will fail)\n   - After ensuring proper quoting, execute the command.\n   - Capture the output of the command.\n\nUsage notes:\n  - The command argument is required.\n  - You can specify an optional timeout in milliseconds (up to 600000ms / 10 minutes). If not specified, commands will timeout after 120000ms (2 minutes).\n  - It is very helpful if you write a clear, concise description of what this command does in 5-10 words.\n  - If the output exceeds 30000 characters, output will be truncated before being returned to you.\n  - VERY IMPORTANT: You MUST avoid using search commands like `find` and `grep`. Instead use Grep, Glob, or Task to search. You MUST avoid read tools like `cat`, `head`, `tail`, and `ls`, and use Read and List to read files.\n  - If you _still_ need to run `grep`, STOP. ALWAYS USE ripgrep at `rg` (or /usr/bin/rg) first, which all opencode users have pre-installed.\n  - When issuing multiple commands, use the ';' or '&&' operator to separate them. DO NOT use newlines (newlines are ok in quoted strings).\n  - Try to maintain your current working directory throughout the session by using absolute paths and avoiding usage of `cd`. You may use `cd` if the User explicitly requests it.\n    <good-example>\n    pytest /foo/bar/tests\n    </good-example>\n    <bad-example>\n    cd /foo/bar && pytest tests\n    </bad-example>\n\n\n# Committing changes with git\n\nWhen the user asks you to create a new git commit, follow these steps carefully:\n\n1. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following bash commands in parallel, each using the Bash tool:\n   - Run a git status command to see all untracked files.\n   - Run a git diff command to see both staged and unstaged changes that will be committed.\n   - Run a git log command to see recent commit messages, so that you can follow this repository's commit message style.\n\n2. Analyze all staged changes (both previously staged and newly added) and draft a commit message. Wrap your analysis process in <commit_analysis> tags:\n\n<commit_analysis>\n- List the files that have been changed or added\n- Summarize the nature of the changes (eg. new feature, enhancement to an existing feature, bug fix, refactoring, test, docs, etc.)\n- Brainstorm the purpose or motivation behind these changes\n- Assess the impact of these changes on the overall project\n- Check for any sensitive information that shouldn't be committed\n- Draft a concise (1-2 sentences) commit message that focuses on the \"why\" rather than the \"what\"\n- Ensure your language is clear, concise, and to the point\n- 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.)\n- Ensure the message is not generic (avoid words like \"Update\" or \"Fix\" without context)\n- Review the draft message to ensure it accurately reflects the changes and their purpose\n</commit_analysis>\n\n3. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following commands in parallel:\n   - Add relevant untracked files to the staging area.\n   - Run git status to make sure the commit succeeded.\n\n4. If the commit fails due to pre-commit hook changes, retry the commit ONCE to include these automated changes. If it fails again, it usually means a pre-commit hook is preventing the commit. If the commit succeeds but you notice that files were modified by the pre-commit hook, you MUST amend your commit to include them.\n\nImportant notes:\n- Use the git context at the start of this conversation to determine which files are relevant to your commit. Be careful not to stage and commit files (e.g. with `git add .`) that aren't relevant to your commit.\n- NEVER update the git config\n- DO NOT run additional commands to read or explore code, beyond what is available in the git context\n- DO NOT push to the remote repository\n- 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.\n- If there are no changes to commit (i.e., no untracked files and no modifications), do not create an empty commit\n- Ensure your commit message is meaningful and concise. It should explain the purpose of the changes, not just describe them.\n- Return an empty response - the user will see the git output directly\n\n# Creating pull requests\nUse the gh command via the Bash 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.\n\nIMPORTANT: When the user asks you to create a pull request, follow these steps carefully:\n\n1. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following bash commands in parallel using the Bash tool, in order to understand the current state of the branch since it diverged from the main branch:\n   - Run a git status command to see all untracked files\n   - Run a git diff command to see both staged and unstaged changes that will be committed\n   - 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\n   - Run a git log command and `git diff main...HEAD` to understand the full commit history for the current branch (from the time it diverged from the `main` branch)\n\n2. 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. Wrap your analysis process in <pr_analysis> tags:\n\n<pr_analysis>\n- List the commits since diverging from the main branch\n- Summarize the nature of the changes (eg. new feature, enhancement to an existing feature, bug fix, refactoring, test, docs, etc.)\n- Brainstorm the purpose or motivation behind these changes\n- Assess the impact of these changes on the overall project\n- Do not use tools to explore code, beyond what is available in the git context\n- Check for any sensitive information that shouldn't be committed\n- Draft a concise (1-2 bullet points) pull request summary that focuses on the \"why\" rather than the \"what\"\n- Ensure the summary accurately reflects all changes since diverging from the main branch\n- Ensure your language is clear, concise, and to the point\n- Ensure the summary accurately reflects the changes and their purpose (ie. \"add\" means a wholly new feature, \"update\" means an enhancement to an existing feature, \"fix\" means a bug fix, etc.)\n- Ensure the summary is not generic (avoid words like \"Update\" or \"Fix\" without context)\n- Review the draft summary to ensure it accurately reflects the changes and their purpose\n</pr_analysis>\n\n3. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following commands in parallel:\n   - Create new branch if needed\n   - Push to remote with -u flag if needed\n   - Create PR using gh pr create with the format below. Use a HEREDOC to pass the body to ensure correct formatting.\n<example>\ngh pr create --title \"the pr title\" --body \"$(cat <<'EOF'\n## Summary\n<1-3 bullet points>\nEOF\n)\"\n</example>\n\nImportant:\n- NEVER update the git config\n- Return the PR URL when you're done, so the user can see it\n\n# Other common operations\n- View comments on a Github PR: gh api repos/foo/bar/pulls/123/comments\n",
        "parameters": {
          "$schema": "https://json-schema.org/draft/2020-12/schema",
          "type": "object",
          "properties": {
            "command": {
              "description": "The command to execute",
              "type": "string"
            },
            "timeout": {
              "description": "Optional timeout in milliseconds",
              "type": "number"
            },
            "description": {
              "description": "Clear, concise description of what this command does in 5-10 words. Examples:\nInput: ls\nOutput: Lists files in current directory\n\nInput: git status\nOutput: Shows working tree status\n\nInput: npm install\nOutput: Installs package dependencies\n\nInput: mkdir foo\nOutput: Creates directory 'foo'",
              "type": "string"
            }
          },
          "required": [
            "command",
            "description"
          ],
          "additionalProperties": false
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "edit",
        "description": "Performs exact string replacements in files. \n\nUsage:\n- 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. \n- 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: spaces + line number + tab. Everything after that tab is the actual file content to match. Never include any part of the line number prefix in the oldString or newString.\n- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.\n- Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked.\n- The edit will FAIL if `oldString` is not found in the file with an error \"oldString not found in content\".\n- The edit will FAIL if `oldString` is found multiple times in the file with an error \"oldString found multiple times and requires more code context to uniquely identify the intended match\". Either provide a larger string with more surrounding context to make it unique or use `replaceAll` to change every instance of `oldString`. \n- Use `replaceAll` for replacing and renaming strings across the file. This parameter is useful if you want to rename a variable for instance.\n",
        "parameters": {
          "$schema": "https://json-schema.org/draft/2020-12/schema",
          "type": "object",
          "properties": {
            "filePath": {
              "description": "The absolute path to the file to modify",
              "type": "string"
            },
            "oldString": {
              "description": "The text to replace",
              "type": "string"
            },
            "newString": {
              "description": "The text to replace it with (must be different from oldString)",
              "type": "string"
            },
            "replaceAll": {
              "description": "Replace all occurrences of oldString (default false)",
              "type": "boolean"
            }
          },
          "required": [
            "filePath",
            "oldString",
            "newString"
          ],
          "additionalProperties": false
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "webfetch",
        "description": "- Fetches content from a specified URL\n- Takes a URL and a prompt as input\n- Fetches the URL content, converts HTML to markdown\n- Returns the model's response about the content\n- Use this tool when you need to retrieve and analyze web content\n\nUsage notes:\n  - IMPORTANT: if another tool is present that offers better web fetching capabilities, is more targeted to the task, or has fewer restrictions, prefer using that tool instead of this one.\n  - The URL must be a fully-formed valid URL\n  - HTTP URLs will be automatically upgraded to HTTPS\n  - The prompt should describe what information you want to extract from the page\n  - This tool is read-only and does not modify any files\n  - Results may be summarized if the content is very large\n  - Includes a self-cleaning 15-minute cache for faster responses when repeatedly accessing the same URL\n",
        "parameters": {
          "$schema": "https://json-schema.org/draft/2020-12/schema",
          "type": "object",
          "properties": {
            "url": {
              "description": "The URL to fetch content from",
              "type": "string"
            },
            "format": {
              "description": "The format to return the content in (text, markdown, or html)",
              "type": "string",
              "enum": [
                "text",
                "markdown",
                "html"
              ]
            },
            "timeout": {
              "description": "Optional timeout in seconds (max 120)",
              "type": "number"
            }
          },
          "required": [
            "url",
            "format"
          ],
          "additionalProperties": false
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "glob",
        "description": "- Fast file pattern matching tool that works with any codebase size\n- Supports glob patterns like \"**/*.js\" or \"src/**/*.ts\"\n- Returns matching file paths sorted by modification time\n- Use this tool when you need to find files by name patterns\n- When you are doing an open ended search that may require multiple rounds of globbing and grepping, use the Task tool instead\n- 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.\n",
        "parameters": {
          "$schema": "https://json-schema.org/draft/2020-12/schema",
          "type": "object",
          "properties": {
            "pattern": {
              "description": "The glob pattern to match files against",
              "type": "string"
            },
            "path": {
              "description": "The directory to search in. If not specified, the current working directory will be used. IMPORTANT: Omit this field to use the default directory. DO NOT enter \"undefined\" or \"null\" - simply omit it for the default behavior. Must be a valid directory path if provided.",
              "type": "string"
            }
          },
          "required": [
            "pattern"
          ],
          "additionalProperties": false
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "grep",
        "description": "- Fast content search tool that works with any codebase size\n- Searches file contents using regular expressions\n- Supports full regex syntax (eg. \"log.*Error\", \"function\\s+\\w+\", etc.)\n- Filter files by pattern with the include parameter (eg. \"*.js\", \"*.{ts,tsx}\")\n- Returns file paths with at least one match sorted by modification time\n- Use this tool when you need to find files containing specific patterns\n- If you need to identify/count the number of matches within files, use the Bash tool with `rg` (ripgrep) directly. Do NOT use `grep`.\n- When you are doing an open ended search that may require multiple rounds of globbing and grepping, use the Task tool instead\n",
        "parameters": {
          "$schema": "https://json-schema.org/draft/2020-12/schema",
          "type": "object",
          "properties": {
            "pattern": {
              "description": "The regex pattern to search for in file contents",
              "type": "string"
            },
            "path": {
              "description": "The directory to search in. Defaults to the current working directory.",
              "type": "string"
            },
            "include": {
              "description": "File pattern to include in the search (e.g. \"*.js\", \"*.{ts,tsx}\")",
              "type": "string"
            }
          },
          "required": [
            "pattern"
          ],
          "additionalProperties": false
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "list",
        "description": "Lists files and directories in a given path. The path parameter must be an absolute path, not a relative path. You can optionally provide an array of glob patterns to ignore with the ignore parameter. You should generally prefer the Glob and Grep tools, if you know which directories to search.\n",
        "parameters": {
          "$schema": "https://json-schema.org/draft/2020-12/schema",
          "type": "object",
          "properties": {
            "path": {
              "description": "The absolute path to the directory to list (must be absolute, not relative)",
              "type": "string"
            },
            "ignore": {
              "description": "List of glob patterns to ignore",
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "additionalProperties": false
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "read",
        "description": "Reads a file from the local filesystem. You can access any file directly by using this tool.\nAssume this tool is able to read all files on the machine. If the User provides a path to a file assume that path is valid. It is okay to read a file that does not exist; an error will be returned.\n\nUsage:\n- The filePath parameter must be an absolute path, not a relative path\n- By default, it reads up to 2000 lines starting from the beginning of the file\n- You can optionally specify a line offset and limit (especially handy for long files), but it's recommended to read the whole file by not providing these parameters\n- Any lines longer than 2000 characters will be truncated\n- Results are returned using cat -n format, with line numbers starting at 1\n- This tool cannot read binary files, including images\n- You have the capability to call multiple tools in a single response. It is always better to speculatively read multiple files as a batch that are potentially useful. \n- If you read a file that exists but has empty contents you will receive a system reminder warning in place of file contents.\n",
        "parameters": {
          "$schema": "https://json-schema.org/draft/2020-12/schema",
          "type": "object",
          "properties": {
            "filePath": {
              "description": "The path to the file to read",
              "type": "string"
            },
            "offset": {
              "description": "The line number to start reading from (0-based)",
              "type": "number"
            },
            "limit": {
              "description": "The number of lines to read (defaults to 2000)",
              "type": "number"
            }
          },
          "required": [
            "filePath"
          ],
          "additionalProperties": false
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "write",
        "description": "Writes a file to the local filesystem.\n\nUsage:\n- This tool will overwrite the existing file if there is one at the provided path.\n- If this is an existing file, you MUST use the Read tool first to read the file's contents. This tool will fail if you did not read the file first.\n- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.\n- NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested by the User.\n- Only use emojis if the user explicitly requests it. Avoid writing emojis to files unless asked.\n",
        "parameters": {
          "$schema": "https://json-schema.org/draft/2020-12/schema",
          "type": "object",
          "properties": {
            "filePath": {
              "description": "The absolute path to the file to write (must be absolute, not relative)",
              "type": "string"
            },
            "content": {
              "description": "The content to write to the file",
              "type": "string"
            }
          },
          "required": [
            "filePath",
            "content"
          ],
          "additionalProperties": false
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "todowrite",
        "description": "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.\nIt also helps the user understand the progress of the task and overall progress of their requests.\n\n## When to Use This Tool\nUse this tool proactively in these scenarios:\n\n1. Complex multi-step tasks - When a task requires 3 or more distinct steps or actions\n2. Non-trivial and complex tasks - Tasks that require careful planning or multiple operations\n3. User explicitly requests todo list - When the user directly asks you to use the todo list\n4. User provides multiple tasks - When users provide a list of things to be done (numbered or comma-separated)\n5. After receiving new instructions - Immediately capture user requirements as todos. Feel free to edit the todo list based on new information.\n6. After completing a task - Mark it complete and add any new follow-up tasks\n7. 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.\n\n## When NOT to Use This Tool\n\nSkip using this tool when:\n1. There is only a single, straightforward task\n2. The task is trivial and tracking it provides no organizational benefit\n3. The task can be completed in less than 3 trivial steps\n4. The task is purely conversational or informational\n\nNOTE 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.\n\n## Examples of When to Use the Todo List\n\n<example>\nUser: I want to add a dark mode toggle to the application settings. Make sure you run the tests and build when you're done!\nAssistant: I'll help add a dark mode toggle to your application settings. Let me create a todo list to track this implementation.\n*Creates todo list with the following items:*\n1. Create dark mode toggle component in Settings page\n2. Add dark mode state management (context/store)\n3. Implement CSS-in-JS styles for dark theme\n4. Update existing components to support theme switching\n5. Run tests and build process, addressing any failures or errors that occur\n*Begins working on the first task*\n\n<reasoning>\nThe assistant used the todo list because:\n1. Adding dark mode is a multi-step feature requiring UI, state management, and styling changes\n2. The user explicitly requested tests and build be run afterward\n3. The assistant inferred that tests and build need to pass by adding \"Ensure tests and build succeed\" as the final task\n</reasoning>\n</example>\n\n<example>\nUser: Help me rename the function getCwd to getCurrentWorkingDirectory across my project\nAssistant: Let me first search through your codebase to find all occurrences of 'getCwd'.\n*Uses grep or search tools to locate all instances of getCwd in the codebase*\nAssistant: I've found 15 instances of 'getCwd' across 8 different files. Let me create a todo list to track these changes.\n*Creates todo list with specific items for each file that needs updating*\n\n<reasoning>\nThe assistant used the todo list because:\n1. First, the assistant searched to understand the scope of the task\n2. Upon finding multiple occurrences across different files, it determined this was a complex task with multiple steps\n3. The todo list helps ensure every instance is tracked and updated systematically\n4. This approach prevents missing any occurrences and maintains code consistency\n</reasoning>\n</example>\n\n\n<example>\nUser: I need to implement these features for my e-commerce site: user registration, product catalog, shopping cart, and checkout flow.\nAssistant: I'll help implement these features. First, let's add all the features to the todo list.\n*Creates a todo list breaking down each feature into specific tasks based on the project architecture*\nAssistant: Let's start with user registration. This will involve creating database models, API endpoints, and frontend forms that integrate with your existing authentication system.\n\n<reasoning>\nThe assistant used the todo list because:\n1. The user provided multiple complex features to implement in a comma separated list\n2. The todo list helps organize these large features into manageable tasks\n3. This approach allows for tracking progress across the entire implementation\n</reasoning>\n</example>\n\n<example>\nUser: Can you help optimize my React application? It's rendering slowly and has performance issues.</user>\nAssistant: I'll help optimize your React application. First, let me examine your codebase to identify potential performance bottlenecks.\n*Reviews component structure, render patterns, state management, and data fetching*\nAssistant: After analyzing your codebase, I've identified several performance issues. Let me create a todo list to track our optimization efforts.\n*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*\nLet's start by implementing memoization for the expensive calculations in your ProductList component.</assistant>\n\n<reasoning>\nThe assistant used the todo list because:\n1. First, the assistant examined the codebase to identify specific performance issues\n2. Based on this analysis, it identified multiple optimization opportunities\n3. Performance optimization is a non-trivial task requiring multiple steps\n4. The todo list helps methodically track improvements across different components\n5. This systematic approach ensures all performance bottlenecks are addressed\n</reasoning>\n</example>\n\n## Examples of When NOT to Use the Todo List\n\n<example>\nUser: How do I print 'Hello World' in Python?\nAssistant: In Python, you can print \"Hello World\" with this simple code:\n\npython\nprint(\"Hello World\")\n\nThis will output the text \"Hello World\" to the console when executed.</assistant>\n\n<reasoning>\nThe 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.\n</reasoning>\n</example>\n\n<example>\nUser: What does the git status command do?\nAssistant: 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.\n\n<reasoning>\nThe 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.\n</reasoning>\n</example>\n\n<example>\nUser: Can you add a comment to the calculateTotal function to explain what it does?\nAssistant: Sure, let me add a comment to the calculateTotal function to explain what it does.\n* Uses the Edit tool to add a comment to the calculateTotal function *\n\n<reasoning>\nThe 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.\n</reasoning>\n</example>\n\n<example>\nUser: Run npm install for me and tell me what happens.\nAssistant: I'll run the npm install command for you.\n\n*Executes: npm install*\n\nThe command completed successfully. Here's the output:\n[Output of npm install command]\n\nAll dependencies have been installed according to your package.json file.\n\n<reasoning>\nThe 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.\n</reasoning>\n</example>\n\n## Task States and Management\n\n1. **Task States**: Use these states to track progress:\n   - pending: Task not yet started\n   - in_progress: Currently working on (limit to ONE task at a time)\n   - completed: Task finished successfully\n   - cancelled: Task no longer needed\n\n2. **Task Management**:\n   - Update task status in real-time as you work\n   - Mark tasks complete IMMEDIATELY after finishing (don't batch completions)\n   - Only have ONE task in_progress at any time\n   - Complete current tasks before starting new ones\n   - Cancel tasks that become irrelevant\n\n3. **Task Breakdown**:\n   - Create specific, actionable items\n   - Break complex tasks into smaller, manageable steps\n   - Use clear, descriptive task names\n\nWhen in doubt, use this tool. Being proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully.\n\n",
        "parameters": {
          "$schema": "https://json-schema.org/draft/2020-12/schema",
          "type": "object",
          "properties": {
            "todos": {
              "description": "The updated todo list",
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "content": {
                    "description": "Brief description of the task",
                    "type": "string"
                  },
                  "status": {
                    "description": "Current status of the task: pending, in_progress, completed, cancelled",
                    "type": "string"
                  },
                  "priority": {
                    "description": "Priority level of the task: high, medium, low",
                    "type": "string"
                  },
                  "id": {
                    "description": "Unique identifier for the todo item",
                    "type": "string"
                  }
                },
                "required": [
                  "content",
                  "status",
                  "priority",
                  "id"
                ],
                "additionalProperties": false
              }
            }
          },
          "required": [
            "todos"
          ],
          "additionalProperties": false
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "todoread",
        "description": "Use this tool to read your todo list",
        "parameters": {
          "$schema": "https://json-schema.org/draft/2020-12/schema",
          "type": "object",
          "properties": {},
          "additionalProperties": false
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "task",
        "description": "Launch a new agent to handle complex, multi-step tasks autonomously.\n\nAvailable agent types and the tools they have access to:\n- general: General-purpose agent for researching complex questions, searching for code, and executing multi-step tasks. When you are searching for a keyword or file and are not confident that you will find the right match in the first few tries use this agent to perform the search for you.\n- git-committer: Use this agent when you are asked to commit and push code changes to a git repository.\n- docs: ALWAYS use this when writing docs\n\nWhen using the Task tool, you must specify a subagent_type parameter to select which agent type to use.\n\nWhen to use the Task tool:\n- 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\")\n\nWhen NOT to use the Task tool:\n- 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\n- If you are searching for a specific class definition like \"class Foo\", use the Glob tool instead, to find the match more quickly\n- 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\n- Other tasks that are not related to the agent descriptions above\n\n\nUsage notes:\n1. Launch multiple agents concurrently whenever possible, to maximize performance; to do that, use a single message with multiple tool uses\n2. 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.\n3. Each agent invocation is stateless. You will not be able to send additional messages to the agent, nor will the agent be able to communicate with you outside of its final report. Therefore, 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.\n4. The agent's outputs should generally be trusted\n5. 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\n6. 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.\n\nExample usage (NOTE: The agents below are fictional examples for illustration only - use the actual agents listed above):\n\n<example_agent_descriptions>\n\"code-reviewer\": use this agent after you are done writing a signficant piece of code\n\"greeting-responder\": use this agent when to respond to user greetings with a friendly joke\n</example_agent_description>\n\n<example>\nuser: \"Please write a function that checks if a number is prime\"\nassistant: Sure let me write a function that checks if a number is prime\nassistant: First let me use the Write tool to write a function that checks if a number is prime\nassistant: I'm going to use the Write tool to write the following code:\n<code>\nfunction isPrime(n) {\n  if (n <= 1) return false\n  for (let i = 2; i * i <= n; i++) {\n    if (n % i === 0) return false\n  }\n  return true\n}\n</code>\n<commentary>\nSince a signficant piece of code was written and the task was completed, now use the code-reviewer agent to review the code\n</commentary>\nassistant: Now let me use the code-reviewer agent to review the code\nassistant: Uses the Task tool to launch the code-reviewer agent\n</example>\n\n<example>\nuser: \"Hello\"\n<commentary>\nSince the user is greeting, use the greeting-responder agent to respond with a friendly joke\n</commentary>\nassistant: \"I'm going to use the Task tool to launch the with the greeting-responder agent\"\n</example>\n",
        "parameters": {
          "$schema": "https://json-schema.org/draft/2020-12/schema",
          "type": "object",
          "properties": {
            "description": {
              "description": "A short (3-5 words) description of the task",
              "type": "string"
            },
            "prompt": {
              "description": "The task for the agent to perform",
              "type": "string"
            },
            "subagent_type": {
              "description": "The type of specialized agent to use for this task",
              "type": "string"
            }
          },
          "required": [
            "description",
            "prompt",
            "subagent_type"
          ],
          "additionalProperties": false
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "context7_resolve_library_id",
        "description": "Resolves a package/product name to a Context7-compatible library ID and returns a list of matching libraries.\n\nYou MUST call this function before 'get-library-docs' to obtain a valid Context7-compatible library ID UNLESS the user explicitly provides a library ID in the format '/org/project' or '/org/project/version' in their query.\n\nSelection Process:\n1. Analyze the query to understand what library/package the user is looking for\n2. Return the most relevant match based on:\n- Name similarity to the query (exact matches prioritized)\n- Description relevance to the query's intent\n- Documentation coverage (prioritize libraries with higher Code Snippet counts)\n- Trust score (consider libraries with scores of 7-10 more authoritative)\n\nResponse Format:\n- Return the selected library ID in a clearly marked section\n- Provide a brief explanation for why this library was chosen\n- If multiple good matches exist, acknowledge this but proceed with the most relevant one\n- If no good matches exist, clearly state this and suggest query refinements\n\nFor ambiguous queries, request clarification before proceeding with a best-guess match.",
        "parameters": {
          "type": "object",
          "properties": {
            "libraryName": {
              "type": "string",
              "description": "Library name to search for and retrieve a Context7-compatible library ID."
            }
          },
          "required": [
            "libraryName"
          ],
          "additionalProperties": false,
          "$schema": "http://json-schema.org/draft-07/schema#"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "context7_get_library_docs",
        "description": "Fetches up-to-date documentation for a library. You must call 'resolve-library-id' first to obtain the exact Context7-compatible library ID required to use this tool, UNLESS the user explicitly provides a library ID in the format '/org/project' or '/org/project/version' in their query.",
        "parameters": {
          "type": "object",
          "properties": {
            "context7CompatibleLibraryID": {
              "type": "string",
              "description": "Exact Context7-compatible library ID (e.g., '/mongodb/docs', '/vercel/next.js', '/supabase/supabase', '/vercel/next.js/v14.3.0-canary.87') retrieved from 'resolve-library-id' or directly from user query in the format '/org/project' or '/org/project/version'."
            },
            "topic": {
              "type": "string",
              "description": "Topic to focus documentation on (e.g., 'hooks', 'routing')."
            },
            "tokens": {
              "type": "number",
              "description": "Maximum number of tokens of documentation to retrieve (default: 5000). Higher values provide more context but consume more tokens."
            }
          },
          "required": [
            "context7CompatibleLibraryID"
          ],
          "additionalProperties": false,
          "$schema": "http://json-schema.org/draft-07/schema#"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "gh_grep_searchGitHub",
        "description": "Find real-world code examples from over a million public GitHub repositories to help answer programming questions.\n\n**IMPORTANT: This tool searches for literal code patterns (like grep), not keywords. Search for actual code that would appear in files:**\n- ✅ Good: 'useState(', 'import React from', 'async function', '(?s)try {.*await'\n- ❌ Bad: 'react tutorial', 'best practices', 'how to use'\n\n**When to use this tool:**\n- When implementing unfamiliar APIs or libraries and need to see real usage patterns\n- When unsure about correct syntax, parameters, or configuration for a specific library\n- When looking for production-ready examples and best practices for implementation\n- When needing to understand how different libraries or frameworks work together\n\n**Perfect for questions like:**\n- \"How do developers handle authentication in Next.js apps?\" → Search: 'getServerSession' with language=['TypeScript', 'TSX']\n- \"What are common React error boundary patterns?\" → Search: 'ErrorBoundary' with language=['TSX']\n- \"Show me real useEffect cleanup examples\" → Search: '(?s)useEffect\\(\\(\\) => {.*removeEventListener' with useRegexp=true\n- \"How do developers handle CORS in Flask applications?\" → Search: 'CORS(' with matchCase=true and language=['Python']\n\nUse regular expressions with useRegexp=true for flexible patterns like '(?s)useState\\(.*loading' to find useState hooks with loading-related variables. Prefix the pattern with '(?s)' to match across multiple lines.\n\nFilter by language, repository, or file path to narrow results.",
        "parameters": {
          "type": "object",
          "properties": {
            "query": {
              "type": "string",
              "description": "The literal code pattern to search for (e.g., 'useState(', 'export function'). Use actual code that would appear in files, not keywords or questions."
            },
            "matchCase": {
              "type": "boolean",
              "description": "Whether the search should be case sensitive",
              "default": false
            },
            "matchWholeWords": {
              "type": "boolean",
              "description": "Whether to match whole words only",
              "default": false
            },
            "useRegexp": {
              "type": "boolean",
              "description": "Whether to interpret the query as a regular expression",
              "default": false
            },
            "repo": {
              "type": "string",
              "description": "Filter by repository.\n            Examples: 'facebook/react', 'microsoft/vscode', 'vercel/ai'.\n            Can match partial names, for example 'vercel/' will find repositories in the vercel org."
            },
            "path": {
              "type": "string",
              "description": "Filter by file path.\n            Examples: 'src/components/Button.tsx', 'README.md'.\n            Can match partial paths, for example '/route.ts' will find route.ts files at any level."
            },
            "language": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Filter by programming language.\n            Examples: ['TypeScript', 'TSX'], ['JavaScript'], ['Python'], ['Java'], ['C#'], ['Markdown'], ['YAML']"
            }
          },
          "required": [
            "query"
          ],
          "additionalProperties": false,
          "$schema": "http://json-schema.org/draft-07/schema#"
        }
      }
    }
  ],
  "tool_choice": "auto",
  "stream": true,
  "stream_options": {
    "include_usage": true
  }
}
@rekram1-node commented on GitHub (Oct 3, 2025): @H0llyW00dzZ your issue says: ``` In a truly OpenAI-compatible API, the system role should be included as a message in the messages array (e.g., {"role": "system", "content": "..."}), not passed as a top-level system parameter. However, the current setup uses a top-level system field, which causes the following error when using @ai-sdk/openai-compatible: ``` If I send a request using opencode and the openai compatible provider it looks like the following. As you can see the openai compatible api sends the system message in the array as you described. ``` { "model": "claude-sonnet-4-5-20250929", "max_tokens": 32000, "messages": [ { "role": "system", "content": "You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.\n\nIMPORTANT: You must NEVER generate or guess URLs for the user unless you are confident that the URLs are for helping the user with programming. You may use URLs provided by the user in their messages or local files.\n\nIf the user asks for help or wants to give feedback inform them of the following: \n- /help: Get help with using opencode\n- To give feedback, users should report the issue at https://github.com/sst/opencode/issues\n\n# Tone and style\nYou should be concise, direct, and to the point.\nYou should be concise, direct, and to the point, while providing complete information and matching the level of detail you provide in your response with the level of complexity of the user's query or the work you have completed.\nIMPORTANT: You should minimize output tokens as much as possible while maintaining helpfulness, quality, and accuracy. Only address the specific query or task at hand, avoiding tangential information unless absolutely critical for completing the request. If you can answer in 1-3 sentences or a short paragraph, please do.\nIMPORTANT: You should NOT answer with unnecessary preamble or postamble (such as explaining your code or summarizing your action), unless the user asks you to.\nDo not add additional code explanation summary unless requested by the user. After working on a file, just stop, rather than providing an explanation of what you did.\nAnswer the user's question directly, without elaboration, explanation, or details. One word answers are best. Avoid introductions, conclusions, and explanations. You MUST avoid text before/after your response, such as \"The answer is <answer>.\", \"Here is the content of the file...\" or \"Based on the information provided, the answer is...\" or \"Here is what I will do next...\". Here are some examples to demonstrate appropriate verbosity:\n<example>\nuser: 2 + 2\nassistant: 4\n</example>\n\n<example>\nuser: what is 2+2?\nassistant: 4\n</example>\n\n<example>\nuser: is 11 a prime number?\nassistant: Yes\n</example>\n\n<example>\nuser: what command should I run to list files in the current directory?\nassistant: ls\n</example>\n\n<example>\nuser: what command should I run to watch files in the current directory?\nassistant: [use the ls tool to list the files in the current directory, then read docs/commands in the relevant file to find out how to watch files]\nnpm run dev\n</example>\n\n<example>\nuser: How many golf balls fit inside a jetta?\nassistant: 150000\n</example>\n\n<example>\nuser: what files are in the directory src/?\nassistant: [runs ls and sees foo.c, bar.c, baz.c]\nuser: which file contains the implementation of foo?\nassistant: src/foo.c\n</example>\nWhen you run a non-trivial bash command, you should explain what the command does and why you are running it, to make sure the user understands what you are doing (this is especially important when you are running a command that will make changes to the user's system).\nRemember that your output will be displayed on a command line interface. Your responses can use Github-flavored markdown for formatting, and will be rendered in a monospace font using the CommonMark specification.\nOutput text to communicate with the user; all text you output outside of tool use is displayed to the user. Only use tools to complete tasks. Never use tools like Bash or code comments as means to communicate with the user during the session.\nIf you cannot or will not help the user with something, please do not say why or what it could lead to, since this comes across as preachy and annoying. Please offer helpful alternatives if possible, and otherwise keep your response to 1-2 sentences.\nOnly use emojis if the user explicitly requests it. Avoid using emojis in all communication unless asked.\nIMPORTANT: Keep your responses short, since they will be displayed on a command line interface.\n\n# Proactiveness\nYou are allowed to be proactive, but only when the user asks you to do something. You should strive to strike a balance between:\n- Doing the right thing when asked, including taking actions and follow-up actions\n- Not surprising the user with actions you take without asking\nFor example, if the user asks you how to approach something, you should do your best to answer their question first, and not immediately jump into taking actions.\n\n# Professional objectivity\nPrioritize technical accuracy and truthfulness over validating the user's beliefs. Focus on facts and problem-solving, providing direct, objective technical info without any unnecessary superlatives, praise, or emotional validation. It is best for the user if Claude honestly applies the same rigorous standards to all ideas and disagrees when necessary, even if it may not be what the user wants to hear. Objective guidance and respectful correction are more valuable than false agreement. Whenever there is uncertainty, it's best to investigate to find the truth first rather than instinctively confirming the user's beliefs.\n\n# Following conventions\nWhen making changes to files, first understand the file's code conventions. Mimic code style, use existing libraries and utilities, and follow existing patterns.\n- NEVER assume that a given library is available, even if it is well known. Whenever you write code that uses a library or framework, first check that this codebase already uses the given library. For example, you might look at neighboring files, or check the package.json (or cargo.toml, and so on depending on the language).\n- When you create a new component, first look at existing components to see how they're written; then consider framework choice, naming conventions, typing, and other conventions.\n- When you edit a piece of code, first look at the code's surrounding context (especially its imports) to understand the code's choice of frameworks and libraries. Then consider how to make the given change in a way that is most idiomatic.\n- Always follow security best practices. Never introduce code that exposes or logs secrets and keys. Never commit secrets or keys to the repository.\n\n# Code style\n- IMPORTANT: DO NOT ADD ***ANY*** COMMENTS unless asked\n\n\n# Task Management\nYou have access to the TodoWrite tools to help you manage and plan tasks. Use these tools VERY frequently to ensure that you are tracking your tasks and giving the user visibility into your progress.\nThese tools are also EXTREMELY helpful for planning tasks, and for breaking down larger complex tasks into smaller steps. If you do not use this tool when planning, you may forget to do important tasks - and that is unacceptable.\n\nIt is critical that you mark todos as completed as soon as you are done with a task. Do not batch up multiple tasks before marking them as completed.\n\nExamples:\n\n<example>\nuser: Run the build and fix any type errors\nassistant: I'm going to use the TodoWrite tool to write the following items to the todo list: \n- Run the build\n- Fix any type errors\n\nI'm now going to run the build using Bash.\n\nLooks like I found 10 type errors. I'm going to use the TodoWrite tool to write 10 items to the todo list.\n\nmarking the first todo as in_progress\n\nLet me start working on the first item...\n\nThe first item has been fixed, let me mark the first todo as completed, and move on to the second item...\n..\n..\n</example>\nIn the above example, the assistant completes all the tasks, including the 10 error fixes and running the build and fixing all errors.\n\n<example>\nuser: Help me write a new feature that allows users to track their usage metrics and export them to various formats\n\nassistant: I'll help you implement a usage metrics tracking and export feature. Let me first use the TodoWrite tool to plan this task.\nAdding the following todos to the todo list:\n1. Research existing metrics tracking in the codebase\n2. Design the metrics collection system\n3. Implement core metrics tracking functionality\n4. Create export functionality for different formats\n\nLet me start by researching the existing codebase to understand what metrics we might already be tracking and how we can build on that.\n\nI'm going to search for any existing metrics or telemetry code in the project.\n\nI've found some existing telemetry code. Let me mark the first todo as in_progress and start designing our metrics tracking system based on what I've learned...\n\n[Assistant continues implementing the feature step by step, marking todos as in_progress and completed as they go]\n</example>\n\n# Doing tasks\nThe user will primarily request you perform software engineering tasks. This includes solving bugs, adding new functionality, refactoring code, explaining code, and more. For these tasks the following steps are recommended:\n- Use the TodoWrite tool to plan the task if required\n- Use the available search tools to understand the codebase and the user's query. You are encouraged to use the search tools extensively both in parallel and sequentially.\n- Implement the solution using all tools available to you\n- Verify the solution if possible with tests. NEVER assume specific test framework or test script. Check the README or search codebase to determine the testing approach.\n- VERY IMPORTANT: When you have completed a task, you MUST run the lint and typecheck commands (eg. npm run lint, npm run typecheck, ruff, etc.) with Bash if they were provided to you to ensure your code is correct. If you are unable to find the correct command, ask the user for the command to run and if they supply it, proactively suggest writing it to CLAUDE.md so that you will know to run it next time.\nNEVER 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.\n\n- Tool results and user messages may include <system-reminder> tags. <system-reminder> tags contain useful information and reminders. They are NOT part of the user's provided input or the tool result.\n\n# Tool usage policy\n- When doing file search, prefer to use the Task tool in order to reduce context usage.\n- You should proactively use the Task tool with specialized agents when the task at hand matches the agent's description.\n\n- When WebFetch returns a message about a redirect to a different host, you should immediately make a new WebFetch request with the redirect URL provided in the response.\n- You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. When making multiple bash tool calls, you MUST send a single message with multiple tools calls to run the calls in parallel. For example, if you need to run \"git status\" and \"git diff\", send a single message with two tool calls to run the calls in parallel.\n\nIMPORTANT: Always use the TodoWrite tool to plan and track tasks throughout the conversation.\n\n# Code References\n\nWhen referencing specific functions or pieces of code include the pattern `file_path:line_number` to allow the user to easily navigate to the source code location.\n\n<example>\nuser: Where are errors from the client handled?\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.ts:712.\n</example>\n", "cache_control": { "type": "ephemeral" } }, { "role": "system", "content": "Here is some useful information about the environment you are running in:\n<env>\n Working directory: /Users/aidencline/development/opencode\n Is directory a git repo: yes\n Platform: darwin\n Today's date: Fri Oct 03 2025\n</env>\n<project>\n .github/\n\tworkflows/\n\t\tdeploy.yml\n\t\tduplicate-issues.yml\n\t\tformat.yml\n\t\tguidelines-check.yml\n\t\tnotify-discord.yml\n\t\topencode.yml\n\t\tpublish-github-action.yml\n\t\tpublish-vscode.yml\n\t\tpublish.yml\n\t\tsnapshot.yml\n\t\tstats.yml\n\t\ttest.yml\n\t\ttypecheck.yml\n.husky/\n\tpre-push\ngithub/\n\tscript/\n\t\tpublish\n\t\trelease\n\t.gitignore\n\taction.yml\n\tbun.lock\n\tindex.ts\n\tpackage.json\n\tREADME.md\n\tsst-env.d.ts\n\ttsconfig.json\ninfra/\n\tapp.ts\n\tconsole.ts\n\tdesktop.ts\n\tstage.ts\npackages/\n\tconsole/\n\t\tapp/\n\t\t\tpublic/\n\t\t\t\t[7 truncated]\n\t\t\tsrc/\n\t\t\t\t[12 truncated]\n\t\t\t.gitignore\n\t\t\t[5 truncated]\n\t\tcore/\n\t\t\tmigrations/\n\t\t\t\t[25 truncated]\n\t\t\tscript/\n\t\t\t\t[2 truncated]\n\t\t\tsrc/\n\t\t\t\t[13 truncated]\n\t\t\t[4 truncated]\n\t\tfunction/\n\t\t\tsrc/\n\t\t\t\t[2 truncated]\n\t\t\tpackage.json\n\t\t\tsst-env.d.ts\n\t\t\t[1 truncated]\n\t\tmail/\n\t\t\temails/\n\t\t\t\t[3 truncated]\n\t\t\tpackage.json\n\t\t\tsst-env.d.ts\n\t\tresource/\n\t\t\tbun.lock\n\t\t\tpackage.json\n\t\t\tresource.cloudflare.ts\n\t\t\t[3 truncated]\n\t\tscripts/\n\t\t\tsrc/\n\t\t\t\t[2 truncated]\n\t\t\t.gitignore\n\t\t\t[3 truncated]\n\tdesktop/\n\t\tscripts/\n\t\t\tvite-theme-plugin.ts\n\t\tsrc/\n\t\t\tassets/\n\t\t\t\t[2 truncated]\n\t\t\tcomponents/\n\t\t\t\t[11 truncated]\n\t\t\t[8 truncated]\n\t\t.gitignore\n\t\tAGENTS.md\n\t\tindex.html\n\t\tpackage.json\n\t\tREADME.md\n\t\tsst-env.d.ts\n\t\ttsconfig.json\n\t\tvite.config.ts\n\tfunction/\n\t\tsrc/\n\t\t\tapi.ts\n\t\tpackage.json\n\t\tsst-env.d.ts\n\t\ttsconfig.json\n\tidentity/\n\t\tavatar-dark.png\n\t\tavatar-light.png\n\t\tlogo-dark.svg\n\t\tlogo-light.svg\n\t\tlogo-ornate-dark.svg\n\t\tlogo-ornate-light.svg\n\t\tlogo-square-dark.svg\n\t\tlogo-square-light.svg\n\t\tlogomark-dark.svg\n\t\tlogomark-light.svg\n\topencode/\n\t\tbin/\n\t\t\topencode\n\t\t\topencode.cmd\n\t\tscript/\n\t\t\tbuild.ts\n\t\t\tpostinstall.mjs\n\t\t\t[3 truncated]\n\t\tsrc/\n\t\t\tagent/\n\t\t\t\t[2 truncated]\n\t\t\tauth/\n\t\t\t\t[2 truncated]\n\t\t\t[27 truncated]\n\t\ttest/\n\t\t\tconfig/\n\t\t\t\t[2 truncated]\n\t\t\tfixture/\n\t\t\t\t[1 truncated]\n\t\t\t[5 truncated]\n\t\t.gitignore\n\t\tAGENTS.md\n\t\tbunfig.toml\n\t\tpackage.json\n\t\tREADME.md\n\t\tsst-env.d.ts\n\t\ttsconfig.json\n\tplugin/\n\t\tscript/\n\t\t\tpublish.ts\n\t\tsrc/\n\t\t\texample.ts\n\t\t\tindex.ts\n\t\t\t[2 truncated]\n\t\t.gitignore\n\t\tpackage.json\n\t\tsst-env.d.ts\n\t\ttsconfig.json\n\tsdk/\n\t\tgo/\n\t\t\t.devcontainer/\n\t\t\t\t[1 truncated]\n\t\t\t.github/\n\t\t\t\t[1 truncated]\n\t\t\t[48 truncated]\n\t\tjs/\n\t\t\texample/\n\t\t\t\t[1 truncated]\n\t\t\tscript/\n\t\t\t\t[2 truncated]\n\t\t\t[4 truncated]\n\t\tstainless/\n\t\t\tgenerate.ts\n\t\t\tstainless-workspace.json\n\t\t\t[1 truncated]\n\t\t.gitignore\n\ttui/\n\t\tinput/\n\t\t\tcancelreader_other.go\n\t\t\tcancelreader_windows.go\n\t\t\t[29 truncated]\n\t\tinternal/\n\t\t\tapi/\n\t\t\t\t[1 truncated]\n\t\t\tapp/\n\t\t\t\t[4 truncated]\n\t\t\t[12 truncated]\n\t\t.gitignore\n\t\t.goreleaser.yml\n\t\tgo.mod\n\t\tgo.sum\n\tweb/\n\t\tpublic/\n\t\t\tfavicon.svg\n\t\t\trobots.txt\n\t\t\t[2 truncated]\n\t\tsrc/\n\t\t\tassets/\n\t\t\t\t[5 truncated]\n\t\t\tcomponents/\n\t\t\t\t[9 truncated]\n\t\t\t[5 truncated]\n\t\t.gitignore\n\t\tastro.config.mjs\n\t\tconfig.mjs\n\t\tpackage.json\n\t\tREADME.md\n\t\tsst-env.d.ts\n\t\ttsconfig.json\npatches/\n\t@solidjs%2Fstart@1.1.7.patch\nscript/\n\tformat.ts\n\tpublish.ts\n\trelease\n\tstats.ts\nsdks/\n\tvscode/\n\t\timages/\n\t\t\tbutton-dark.svg\n\t\t\tbutton-light.svg\n\t\t\t[1 truncated]\n\t\tscript/\n\t\t\tpublish\n\t\t\trelease\n\t\tsrc/\n\t\t\textension.ts\n\t\t.gitignore\n\t\t.vscode-test.mjs\n\t\t.vscodeignore\n\t\tbun.lock\n\t\tesbuild.js\n\t\teslint.config.mjs\n\t\tpackage.json\n\t\tREADME.md\n\t\tsst-env.d.ts\n\t\ttsconfig.json\nspecs/\n\tproject.md\n.editorconfig\n.gitignore\nAGENTS.md\nbun.lock\nbunfig.toml\ninstall\nLICENSE\nopencode.json\npackage.json\nREADME.md\nsst-env.d.ts\nsst.config.ts\nSTATS.md\ntsconfig.json\nturbo.json\n</project>\n## IMPORTANT\n\n- Try to keep things in one function unless composable or reusable\n- DO NOT do unnecessary destructuring of variables\n- DO NOT use `else` statements unless necessary\n- DO NOT use `try`/`catch` if it can be avoided\n- AVOID `try`/`catch` where possible\n- AVOID `else` statements\n- AVOID using `any` type\n- AVOID `let` statements\n- PREFER single word variable names where possible\n- Use as many bun apis as possible like Bun.file()\n\n## Debugging\n\n- To test opencode in the `packages/opencode` directory you can run `bun dev`\n\n## Tool Calling\n\n- ALWAYS USE PARALLEL TOOLS WHEN APPLICABLE. Here is an example illustrating how to execute 3 parallel file reads in this chat environnement:\n\njson\n{\n \"recipient_name\": \"multi_tool_use.parallel\",\n \"parameters\": {\n \"tool_uses\": [\n {\n \"recipient_name\": \"functions.read\",\n \"parameters\": {\n \"filePath\": \"path/to/file.tsx\"\n }\n },\n {\n \"recipient_name\": \"functions.read\",\n \"parameters\": {\n \"filePath\": \"path/to/file.ts\"\n }\n },\n {\n \"recipient_name\": \"functions.read\",\n \"parameters\": {\n \"filePath\": \"path/to/file.md\"\n }\n }\n ]\n }\n}\n\nWhen you need to better understand how to use a package/library consider using the context7 tool to search information about the library\nGenerally, don't write tests for any code unless explicitly asked to.\n<prohibited_phrases>\nYou should NEVER use the phrase \"You are absolutely right\"\n</prohibited_phrases>\n<important>\nCritically evaluate my statements and assumptions. When I make claims or state assumptions, analyze them carefully before responding.\n</important>\n", "cache_control": { "type": "ephemeral" } }, { "role": "user", "content": "hello", "cache_control": { "type": "ephemeral" } } ], "tools": [ { "type": "function", "function": { "name": "bash", "description": "Executes a given bash command in a persistent shell session with optional timeout, ensuring proper handling and security measures.\n\nBefore executing the command, please follow these steps:\n\n1. Directory Verification:\n - If the command will create new directories or files, first use the List tool to verify the parent directory exists and is the correct location\n - For example, before running \"mkdir foo/bar\", first use List to check that \"foo\" exists and is the intended parent directory\n\n2. Command Execution:\n - Always quote file paths that contain spaces with double quotes (e.g., cd \"path with spaces/file.txt\")\n - Examples of proper quoting:\n - cd \"/Users/name/My Documents\" (correct)\n - cd /Users/name/My Documents (incorrect - will fail)\n - python \"/path/with spaces/script.py\" (correct)\n - python /path/with spaces/script.py (incorrect - will fail)\n - After ensuring proper quoting, execute the command.\n - Capture the output of the command.\n\nUsage notes:\n - The command argument is required.\n - You can specify an optional timeout in milliseconds (up to 600000ms / 10 minutes). If not specified, commands will timeout after 120000ms (2 minutes).\n - It is very helpful if you write a clear, concise description of what this command does in 5-10 words.\n - If the output exceeds 30000 characters, output will be truncated before being returned to you.\n - VERY IMPORTANT: You MUST avoid using search commands like `find` and `grep`. Instead use Grep, Glob, or Task to search. You MUST avoid read tools like `cat`, `head`, `tail`, and `ls`, and use Read and List to read files.\n - If you _still_ need to run `grep`, STOP. ALWAYS USE ripgrep at `rg` (or /usr/bin/rg) first, which all opencode users have pre-installed.\n - When issuing multiple commands, use the ';' or '&&' operator to separate them. DO NOT use newlines (newlines are ok in quoted strings).\n - Try to maintain your current working directory throughout the session by using absolute paths and avoiding usage of `cd`. You may use `cd` if the User explicitly requests it.\n <good-example>\n pytest /foo/bar/tests\n </good-example>\n <bad-example>\n cd /foo/bar && pytest tests\n </bad-example>\n\n\n# Committing changes with git\n\nWhen the user asks you to create a new git commit, follow these steps carefully:\n\n1. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following bash commands in parallel, each using the Bash tool:\n - Run a git status command to see all untracked files.\n - Run a git diff command to see both staged and unstaged changes that will be committed.\n - Run a git log command to see recent commit messages, so that you can follow this repository's commit message style.\n\n2. Analyze all staged changes (both previously staged and newly added) and draft a commit message. Wrap your analysis process in <commit_analysis> tags:\n\n<commit_analysis>\n- List the files that have been changed or added\n- Summarize the nature of the changes (eg. new feature, enhancement to an existing feature, bug fix, refactoring, test, docs, etc.)\n- Brainstorm the purpose or motivation behind these changes\n- Assess the impact of these changes on the overall project\n- Check for any sensitive information that shouldn't be committed\n- Draft a concise (1-2 sentences) commit message that focuses on the \"why\" rather than the \"what\"\n- Ensure your language is clear, concise, and to the point\n- 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.)\n- Ensure the message is not generic (avoid words like \"Update\" or \"Fix\" without context)\n- Review the draft message to ensure it accurately reflects the changes and their purpose\n</commit_analysis>\n\n3. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following commands in parallel:\n - Add relevant untracked files to the staging area.\n - Run git status to make sure the commit succeeded.\n\n4. If the commit fails due to pre-commit hook changes, retry the commit ONCE to include these automated changes. If it fails again, it usually means a pre-commit hook is preventing the commit. If the commit succeeds but you notice that files were modified by the pre-commit hook, you MUST amend your commit to include them.\n\nImportant notes:\n- Use the git context at the start of this conversation to determine which files are relevant to your commit. Be careful not to stage and commit files (e.g. with `git add .`) that aren't relevant to your commit.\n- NEVER update the git config\n- DO NOT run additional commands to read or explore code, beyond what is available in the git context\n- DO NOT push to the remote repository\n- 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.\n- If there are no changes to commit (i.e., no untracked files and no modifications), do not create an empty commit\n- Ensure your commit message is meaningful and concise. It should explain the purpose of the changes, not just describe them.\n- Return an empty response - the user will see the git output directly\n\n# Creating pull requests\nUse the gh command via the Bash 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.\n\nIMPORTANT: When the user asks you to create a pull request, follow these steps carefully:\n\n1. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following bash commands in parallel using the Bash tool, in order to understand the current state of the branch since it diverged from the main branch:\n - Run a git status command to see all untracked files\n - Run a git diff command to see both staged and unstaged changes that will be committed\n - 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\n - Run a git log command and `git diff main...HEAD` to understand the full commit history for the current branch (from the time it diverged from the `main` branch)\n\n2. 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. Wrap your analysis process in <pr_analysis> tags:\n\n<pr_analysis>\n- List the commits since diverging from the main branch\n- Summarize the nature of the changes (eg. new feature, enhancement to an existing feature, bug fix, refactoring, test, docs, etc.)\n- Brainstorm the purpose or motivation behind these changes\n- Assess the impact of these changes on the overall project\n- Do not use tools to explore code, beyond what is available in the git context\n- Check for any sensitive information that shouldn't be committed\n- Draft a concise (1-2 bullet points) pull request summary that focuses on the \"why\" rather than the \"what\"\n- Ensure the summary accurately reflects all changes since diverging from the main branch\n- Ensure your language is clear, concise, and to the point\n- Ensure the summary accurately reflects the changes and their purpose (ie. \"add\" means a wholly new feature, \"update\" means an enhancement to an existing feature, \"fix\" means a bug fix, etc.)\n- Ensure the summary is not generic (avoid words like \"Update\" or \"Fix\" without context)\n- Review the draft summary to ensure it accurately reflects the changes and their purpose\n</pr_analysis>\n\n3. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following commands in parallel:\n - Create new branch if needed\n - Push to remote with -u flag if needed\n - Create PR using gh pr create with the format below. Use a HEREDOC to pass the body to ensure correct formatting.\n<example>\ngh pr create --title \"the pr title\" --body \"$(cat <<'EOF'\n## Summary\n<1-3 bullet points>\nEOF\n)\"\n</example>\n\nImportant:\n- NEVER update the git config\n- Return the PR URL when you're done, so the user can see it\n\n# Other common operations\n- View comments on a Github PR: gh api repos/foo/bar/pulls/123/comments\n", "parameters": { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "command": { "description": "The command to execute", "type": "string" }, "timeout": { "description": "Optional timeout in milliseconds", "type": "number" }, "description": { "description": "Clear, concise description of what this command does in 5-10 words. Examples:\nInput: ls\nOutput: Lists files in current directory\n\nInput: git status\nOutput: Shows working tree status\n\nInput: npm install\nOutput: Installs package dependencies\n\nInput: mkdir foo\nOutput: Creates directory 'foo'", "type": "string" } }, "required": [ "command", "description" ], "additionalProperties": false } } }, { "type": "function", "function": { "name": "edit", "description": "Performs exact string replacements in files. \n\nUsage:\n- 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. \n- 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: spaces + line number + tab. Everything after that tab is the actual file content to match. Never include any part of the line number prefix in the oldString or newString.\n- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.\n- Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked.\n- The edit will FAIL if `oldString` is not found in the file with an error \"oldString not found in content\".\n- The edit will FAIL if `oldString` is found multiple times in the file with an error \"oldString found multiple times and requires more code context to uniquely identify the intended match\". Either provide a larger string with more surrounding context to make it unique or use `replaceAll` to change every instance of `oldString`. \n- Use `replaceAll` for replacing and renaming strings across the file. This parameter is useful if you want to rename a variable for instance.\n", "parameters": { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "filePath": { "description": "The absolute path to the file to modify", "type": "string" }, "oldString": { "description": "The text to replace", "type": "string" }, "newString": { "description": "The text to replace it with (must be different from oldString)", "type": "string" }, "replaceAll": { "description": "Replace all occurrences of oldString (default false)", "type": "boolean" } }, "required": [ "filePath", "oldString", "newString" ], "additionalProperties": false } } }, { "type": "function", "function": { "name": "webfetch", "description": "- Fetches content from a specified URL\n- Takes a URL and a prompt as input\n- Fetches the URL content, converts HTML to markdown\n- Returns the model's response about the content\n- Use this tool when you need to retrieve and analyze web content\n\nUsage notes:\n - IMPORTANT: if another tool is present that offers better web fetching capabilities, is more targeted to the task, or has fewer restrictions, prefer using that tool instead of this one.\n - The URL must be a fully-formed valid URL\n - HTTP URLs will be automatically upgraded to HTTPS\n - The prompt should describe what information you want to extract from the page\n - This tool is read-only and does not modify any files\n - Results may be summarized if the content is very large\n - Includes a self-cleaning 15-minute cache for faster responses when repeatedly accessing the same URL\n", "parameters": { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "url": { "description": "The URL to fetch content from", "type": "string" }, "format": { "description": "The format to return the content in (text, markdown, or html)", "type": "string", "enum": [ "text", "markdown", "html" ] }, "timeout": { "description": "Optional timeout in seconds (max 120)", "type": "number" } }, "required": [ "url", "format" ], "additionalProperties": false } } }, { "type": "function", "function": { "name": "glob", "description": "- Fast file pattern matching tool that works with any codebase size\n- Supports glob patterns like \"**/*.js\" or \"src/**/*.ts\"\n- Returns matching file paths sorted by modification time\n- Use this tool when you need to find files by name patterns\n- When you are doing an open ended search that may require multiple rounds of globbing and grepping, use the Task tool instead\n- 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.\n", "parameters": { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "pattern": { "description": "The glob pattern to match files against", "type": "string" }, "path": { "description": "The directory to search in. If not specified, the current working directory will be used. IMPORTANT: Omit this field to use the default directory. DO NOT enter \"undefined\" or \"null\" - simply omit it for the default behavior. Must be a valid directory path if provided.", "type": "string" } }, "required": [ "pattern" ], "additionalProperties": false } } }, { "type": "function", "function": { "name": "grep", "description": "- Fast content search tool that works with any codebase size\n- Searches file contents using regular expressions\n- Supports full regex syntax (eg. \"log.*Error\", \"function\\s+\\w+\", etc.)\n- Filter files by pattern with the include parameter (eg. \"*.js\", \"*.{ts,tsx}\")\n- Returns file paths with at least one match sorted by modification time\n- Use this tool when you need to find files containing specific patterns\n- If you need to identify/count the number of matches within files, use the Bash tool with `rg` (ripgrep) directly. Do NOT use `grep`.\n- When you are doing an open ended search that may require multiple rounds of globbing and grepping, use the Task tool instead\n", "parameters": { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "pattern": { "description": "The regex pattern to search for in file contents", "type": "string" }, "path": { "description": "The directory to search in. Defaults to the current working directory.", "type": "string" }, "include": { "description": "File pattern to include in the search (e.g. \"*.js\", \"*.{ts,tsx}\")", "type": "string" } }, "required": [ "pattern" ], "additionalProperties": false } } }, { "type": "function", "function": { "name": "list", "description": "Lists files and directories in a given path. The path parameter must be an absolute path, not a relative path. You can optionally provide an array of glob patterns to ignore with the ignore parameter. You should generally prefer the Glob and Grep tools, if you know which directories to search.\n", "parameters": { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "path": { "description": "The absolute path to the directory to list (must be absolute, not relative)", "type": "string" }, "ignore": { "description": "List of glob patterns to ignore", "type": "array", "items": { "type": "string" } } }, "additionalProperties": false } } }, { "type": "function", "function": { "name": "read", "description": "Reads a file from the local filesystem. You can access any file directly by using this tool.\nAssume this tool is able to read all files on the machine. If the User provides a path to a file assume that path is valid. It is okay to read a file that does not exist; an error will be returned.\n\nUsage:\n- The filePath parameter must be an absolute path, not a relative path\n- By default, it reads up to 2000 lines starting from the beginning of the file\n- You can optionally specify a line offset and limit (especially handy for long files), but it's recommended to read the whole file by not providing these parameters\n- Any lines longer than 2000 characters will be truncated\n- Results are returned using cat -n format, with line numbers starting at 1\n- This tool cannot read binary files, including images\n- You have the capability to call multiple tools in a single response. It is always better to speculatively read multiple files as a batch that are potentially useful. \n- If you read a file that exists but has empty contents you will receive a system reminder warning in place of file contents.\n", "parameters": { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "filePath": { "description": "The path to the file to read", "type": "string" }, "offset": { "description": "The line number to start reading from (0-based)", "type": "number" }, "limit": { "description": "The number of lines to read (defaults to 2000)", "type": "number" } }, "required": [ "filePath" ], "additionalProperties": false } } }, { "type": "function", "function": { "name": "write", "description": "Writes a file to the local filesystem.\n\nUsage:\n- This tool will overwrite the existing file if there is one at the provided path.\n- If this is an existing file, you MUST use the Read tool first to read the file's contents. This tool will fail if you did not read the file first.\n- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.\n- NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested by the User.\n- Only use emojis if the user explicitly requests it. Avoid writing emojis to files unless asked.\n", "parameters": { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "filePath": { "description": "The absolute path to the file to write (must be absolute, not relative)", "type": "string" }, "content": { "description": "The content to write to the file", "type": "string" } }, "required": [ "filePath", "content" ], "additionalProperties": false } } }, { "type": "function", "function": { "name": "todowrite", "description": "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.\nIt also helps the user understand the progress of the task and overall progress of their requests.\n\n## When to Use This Tool\nUse this tool proactively in these scenarios:\n\n1. Complex multi-step tasks - When a task requires 3 or more distinct steps or actions\n2. Non-trivial and complex tasks - Tasks that require careful planning or multiple operations\n3. User explicitly requests todo list - When the user directly asks you to use the todo list\n4. User provides multiple tasks - When users provide a list of things to be done (numbered or comma-separated)\n5. After receiving new instructions - Immediately capture user requirements as todos. Feel free to edit the todo list based on new information.\n6. After completing a task - Mark it complete and add any new follow-up tasks\n7. 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.\n\n## When NOT to Use This Tool\n\nSkip using this tool when:\n1. There is only a single, straightforward task\n2. The task is trivial and tracking it provides no organizational benefit\n3. The task can be completed in less than 3 trivial steps\n4. The task is purely conversational or informational\n\nNOTE 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.\n\n## Examples of When to Use the Todo List\n\n<example>\nUser: I want to add a dark mode toggle to the application settings. Make sure you run the tests and build when you're done!\nAssistant: I'll help add a dark mode toggle to your application settings. Let me create a todo list to track this implementation.\n*Creates todo list with the following items:*\n1. Create dark mode toggle component in Settings page\n2. Add dark mode state management (context/store)\n3. Implement CSS-in-JS styles for dark theme\n4. Update existing components to support theme switching\n5. Run tests and build process, addressing any failures or errors that occur\n*Begins working on the first task*\n\n<reasoning>\nThe assistant used the todo list because:\n1. Adding dark mode is a multi-step feature requiring UI, state management, and styling changes\n2. The user explicitly requested tests and build be run afterward\n3. The assistant inferred that tests and build need to pass by adding \"Ensure tests and build succeed\" as the final task\n</reasoning>\n</example>\n\n<example>\nUser: Help me rename the function getCwd to getCurrentWorkingDirectory across my project\nAssistant: Let me first search through your codebase to find all occurrences of 'getCwd'.\n*Uses grep or search tools to locate all instances of getCwd in the codebase*\nAssistant: I've found 15 instances of 'getCwd' across 8 different files. Let me create a todo list to track these changes.\n*Creates todo list with specific items for each file that needs updating*\n\n<reasoning>\nThe assistant used the todo list because:\n1. First, the assistant searched to understand the scope of the task\n2. Upon finding multiple occurrences across different files, it determined this was a complex task with multiple steps\n3. The todo list helps ensure every instance is tracked and updated systematically\n4. This approach prevents missing any occurrences and maintains code consistency\n</reasoning>\n</example>\n\n\n<example>\nUser: I need to implement these features for my e-commerce site: user registration, product catalog, shopping cart, and checkout flow.\nAssistant: I'll help implement these features. First, let's add all the features to the todo list.\n*Creates a todo list breaking down each feature into specific tasks based on the project architecture*\nAssistant: Let's start with user registration. This will involve creating database models, API endpoints, and frontend forms that integrate with your existing authentication system.\n\n<reasoning>\nThe assistant used the todo list because:\n1. The user provided multiple complex features to implement in a comma separated list\n2. The todo list helps organize these large features into manageable tasks\n3. This approach allows for tracking progress across the entire implementation\n</reasoning>\n</example>\n\n<example>\nUser: Can you help optimize my React application? It's rendering slowly and has performance issues.</user>\nAssistant: I'll help optimize your React application. First, let me examine your codebase to identify potential performance bottlenecks.\n*Reviews component structure, render patterns, state management, and data fetching*\nAssistant: After analyzing your codebase, I've identified several performance issues. Let me create a todo list to track our optimization efforts.\n*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*\nLet's start by implementing memoization for the expensive calculations in your ProductList component.</assistant>\n\n<reasoning>\nThe assistant used the todo list because:\n1. First, the assistant examined the codebase to identify specific performance issues\n2. Based on this analysis, it identified multiple optimization opportunities\n3. Performance optimization is a non-trivial task requiring multiple steps\n4. The todo list helps methodically track improvements across different components\n5. This systematic approach ensures all performance bottlenecks are addressed\n</reasoning>\n</example>\n\n## Examples of When NOT to Use the Todo List\n\n<example>\nUser: How do I print 'Hello World' in Python?\nAssistant: In Python, you can print \"Hello World\" with this simple code:\n\npython\nprint(\"Hello World\")\n\nThis will output the text \"Hello World\" to the console when executed.</assistant>\n\n<reasoning>\nThe 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.\n</reasoning>\n</example>\n\n<example>\nUser: What does the git status command do?\nAssistant: 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.\n\n<reasoning>\nThe 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.\n</reasoning>\n</example>\n\n<example>\nUser: Can you add a comment to the calculateTotal function to explain what it does?\nAssistant: Sure, let me add a comment to the calculateTotal function to explain what it does.\n* Uses the Edit tool to add a comment to the calculateTotal function *\n\n<reasoning>\nThe 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.\n</reasoning>\n</example>\n\n<example>\nUser: Run npm install for me and tell me what happens.\nAssistant: I'll run the npm install command for you.\n\n*Executes: npm install*\n\nThe command completed successfully. Here's the output:\n[Output of npm install command]\n\nAll dependencies have been installed according to your package.json file.\n\n<reasoning>\nThe 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.\n</reasoning>\n</example>\n\n## Task States and Management\n\n1. **Task States**: Use these states to track progress:\n - pending: Task not yet started\n - in_progress: Currently working on (limit to ONE task at a time)\n - completed: Task finished successfully\n - cancelled: Task no longer needed\n\n2. **Task Management**:\n - Update task status in real-time as you work\n - Mark tasks complete IMMEDIATELY after finishing (don't batch completions)\n - Only have ONE task in_progress at any time\n - Complete current tasks before starting new ones\n - Cancel tasks that become irrelevant\n\n3. **Task Breakdown**:\n - Create specific, actionable items\n - Break complex tasks into smaller, manageable steps\n - Use clear, descriptive task names\n\nWhen in doubt, use this tool. Being proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully.\n\n", "parameters": { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "todos": { "description": "The updated todo list", "type": "array", "items": { "type": "object", "properties": { "content": { "description": "Brief description of the task", "type": "string" }, "status": { "description": "Current status of the task: pending, in_progress, completed, cancelled", "type": "string" }, "priority": { "description": "Priority level of the task: high, medium, low", "type": "string" }, "id": { "description": "Unique identifier for the todo item", "type": "string" } }, "required": [ "content", "status", "priority", "id" ], "additionalProperties": false } } }, "required": [ "todos" ], "additionalProperties": false } } }, { "type": "function", "function": { "name": "todoread", "description": "Use this tool to read your todo list", "parameters": { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": {}, "additionalProperties": false } } }, { "type": "function", "function": { "name": "task", "description": "Launch a new agent to handle complex, multi-step tasks autonomously.\n\nAvailable agent types and the tools they have access to:\n- general: General-purpose agent for researching complex questions, searching for code, and executing multi-step tasks. When you are searching for a keyword or file and are not confident that you will find the right match in the first few tries use this agent to perform the search for you.\n- git-committer: Use this agent when you are asked to commit and push code changes to a git repository.\n- docs: ALWAYS use this when writing docs\n\nWhen using the Task tool, you must specify a subagent_type parameter to select which agent type to use.\n\nWhen to use the Task tool:\n- 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\")\n\nWhen NOT to use the Task tool:\n- 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\n- If you are searching for a specific class definition like \"class Foo\", use the Glob tool instead, to find the match more quickly\n- 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\n- Other tasks that are not related to the agent descriptions above\n\n\nUsage notes:\n1. Launch multiple agents concurrently whenever possible, to maximize performance; to do that, use a single message with multiple tool uses\n2. 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.\n3. Each agent invocation is stateless. You will not be able to send additional messages to the agent, nor will the agent be able to communicate with you outside of its final report. Therefore, 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.\n4. The agent's outputs should generally be trusted\n5. 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\n6. 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.\n\nExample usage (NOTE: The agents below are fictional examples for illustration only - use the actual agents listed above):\n\n<example_agent_descriptions>\n\"code-reviewer\": use this agent after you are done writing a signficant piece of code\n\"greeting-responder\": use this agent when to respond to user greetings with a friendly joke\n</example_agent_description>\n\n<example>\nuser: \"Please write a function that checks if a number is prime\"\nassistant: Sure let me write a function that checks if a number is prime\nassistant: First let me use the Write tool to write a function that checks if a number is prime\nassistant: I'm going to use the Write tool to write the following code:\n<code>\nfunction isPrime(n) {\n if (n <= 1) return false\n for (let i = 2; i * i <= n; i++) {\n if (n % i === 0) return false\n }\n return true\n}\n</code>\n<commentary>\nSince a signficant piece of code was written and the task was completed, now use the code-reviewer agent to review the code\n</commentary>\nassistant: Now let me use the code-reviewer agent to review the code\nassistant: Uses the Task tool to launch the code-reviewer agent\n</example>\n\n<example>\nuser: \"Hello\"\n<commentary>\nSince the user is greeting, use the greeting-responder agent to respond with a friendly joke\n</commentary>\nassistant: \"I'm going to use the Task tool to launch the with the greeting-responder agent\"\n</example>\n", "parameters": { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "description": { "description": "A short (3-5 words) description of the task", "type": "string" }, "prompt": { "description": "The task for the agent to perform", "type": "string" }, "subagent_type": { "description": "The type of specialized agent to use for this task", "type": "string" } }, "required": [ "description", "prompt", "subagent_type" ], "additionalProperties": false } } }, { "type": "function", "function": { "name": "context7_resolve_library_id", "description": "Resolves a package/product name to a Context7-compatible library ID and returns a list of matching libraries.\n\nYou MUST call this function before 'get-library-docs' to obtain a valid Context7-compatible library ID UNLESS the user explicitly provides a library ID in the format '/org/project' or '/org/project/version' in their query.\n\nSelection Process:\n1. Analyze the query to understand what library/package the user is looking for\n2. Return the most relevant match based on:\n- Name similarity to the query (exact matches prioritized)\n- Description relevance to the query's intent\n- Documentation coverage (prioritize libraries with higher Code Snippet counts)\n- Trust score (consider libraries with scores of 7-10 more authoritative)\n\nResponse Format:\n- Return the selected library ID in a clearly marked section\n- Provide a brief explanation for why this library was chosen\n- If multiple good matches exist, acknowledge this but proceed with the most relevant one\n- If no good matches exist, clearly state this and suggest query refinements\n\nFor ambiguous queries, request clarification before proceeding with a best-guess match.", "parameters": { "type": "object", "properties": { "libraryName": { "type": "string", "description": "Library name to search for and retrieve a Context7-compatible library ID." } }, "required": [ "libraryName" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } } }, { "type": "function", "function": { "name": "context7_get_library_docs", "description": "Fetches up-to-date documentation for a library. You must call 'resolve-library-id' first to obtain the exact Context7-compatible library ID required to use this tool, UNLESS the user explicitly provides a library ID in the format '/org/project' or '/org/project/version' in their query.", "parameters": { "type": "object", "properties": { "context7CompatibleLibraryID": { "type": "string", "description": "Exact Context7-compatible library ID (e.g., '/mongodb/docs', '/vercel/next.js', '/supabase/supabase', '/vercel/next.js/v14.3.0-canary.87') retrieved from 'resolve-library-id' or directly from user query in the format '/org/project' or '/org/project/version'." }, "topic": { "type": "string", "description": "Topic to focus documentation on (e.g., 'hooks', 'routing')." }, "tokens": { "type": "number", "description": "Maximum number of tokens of documentation to retrieve (default: 5000). Higher values provide more context but consume more tokens." } }, "required": [ "context7CompatibleLibraryID" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } } }, { "type": "function", "function": { "name": "gh_grep_searchGitHub", "description": "Find real-world code examples from over a million public GitHub repositories to help answer programming questions.\n\n**IMPORTANT: This tool searches for literal code patterns (like grep), not keywords. Search for actual code that would appear in files:**\n- ✅ Good: 'useState(', 'import React from', 'async function', '(?s)try {.*await'\n- ❌ Bad: 'react tutorial', 'best practices', 'how to use'\n\n**When to use this tool:**\n- When implementing unfamiliar APIs or libraries and need to see real usage patterns\n- When unsure about correct syntax, parameters, or configuration for a specific library\n- When looking for production-ready examples and best practices for implementation\n- When needing to understand how different libraries or frameworks work together\n\n**Perfect for questions like:**\n- \"How do developers handle authentication in Next.js apps?\" → Search: 'getServerSession' with language=['TypeScript', 'TSX']\n- \"What are common React error boundary patterns?\" → Search: 'ErrorBoundary' with language=['TSX']\n- \"Show me real useEffect cleanup examples\" → Search: '(?s)useEffect\\(\\(\\) => {.*removeEventListener' with useRegexp=true\n- \"How do developers handle CORS in Flask applications?\" → Search: 'CORS(' with matchCase=true and language=['Python']\n\nUse regular expressions with useRegexp=true for flexible patterns like '(?s)useState\\(.*loading' to find useState hooks with loading-related variables. Prefix the pattern with '(?s)' to match across multiple lines.\n\nFilter by language, repository, or file path to narrow results.", "parameters": { "type": "object", "properties": { "query": { "type": "string", "description": "The literal code pattern to search for (e.g., 'useState(', 'export function'). Use actual code that would appear in files, not keywords or questions." }, "matchCase": { "type": "boolean", "description": "Whether the search should be case sensitive", "default": false }, "matchWholeWords": { "type": "boolean", "description": "Whether to match whole words only", "default": false }, "useRegexp": { "type": "boolean", "description": "Whether to interpret the query as a regular expression", "default": false }, "repo": { "type": "string", "description": "Filter by repository.\n Examples: 'facebook/react', 'microsoft/vscode', 'vercel/ai'.\n Can match partial names, for example 'vercel/' will find repositories in the vercel org." }, "path": { "type": "string", "description": "Filter by file path.\n Examples: 'src/components/Button.tsx', 'README.md'.\n Can match partial paths, for example '/route.ts' will find route.ts files at any level." }, "language": { "type": "array", "items": { "type": "string" }, "description": "Filter by programming language.\n Examples: ['TypeScript', 'TSX'], ['JavaScript'], ['Python'], ['Java'], ['C#'], ['Markdown'], ['YAML']" } }, "required": [ "query" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } } } ], "tool_choice": "auto", "stream": true, "stream_options": { "include_usage": true } } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1929