bonecode 1.2.3 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/README.md +62 -0
  2. package/compat/opencode_adapter.ts +69 -8
  3. package/dist/compat/opencode_adapter.js +63 -7
  4. package/dist/compat/opencode_adapter.js.map +1 -1
  5. package/dist/src/db_adapter.js +30 -0
  6. package/dist/src/db_adapter.js.map +1 -1
  7. package/dist/src/engine/agent/prompt/compaction.txt +9 -0
  8. package/dist/src/engine/agent/prompt/explore.txt +18 -0
  9. package/dist/src/engine/agent/prompt/scout.txt +36 -0
  10. package/dist/src/engine/agent/prompt/summary.txt +11 -0
  11. package/dist/src/engine/agent/prompt/title.txt +44 -0
  12. package/dist/src/engine/session/build_mode.d.ts +83 -0
  13. package/dist/src/engine/session/build_mode.js +789 -0
  14. package/dist/src/engine/session/build_mode.js.map +1 -0
  15. package/dist/src/engine/session/build_mode_helpers.d.ts +6 -0
  16. package/dist/src/engine/session/build_mode_helpers.js +61 -0
  17. package/dist/src/engine/session/build_mode_helpers.js.map +1 -0
  18. package/dist/src/engine/session/prompt/anthropic.txt +105 -0
  19. package/dist/src/engine/session/prompt/beast.txt +147 -0
  20. package/dist/src/engine/session/prompt/bonescript.txt +402 -0
  21. package/dist/src/engine/session/prompt/build-switch.txt +5 -0
  22. package/dist/src/engine/session/prompt/codex.txt +79 -0
  23. package/dist/src/engine/session/prompt/copilot-gpt-5.txt +143 -0
  24. package/dist/src/engine/session/prompt/default.txt +105 -0
  25. package/dist/src/engine/session/prompt/gemini.txt +155 -0
  26. package/dist/src/engine/session/prompt/gpt.txt +107 -0
  27. package/dist/src/engine/session/prompt/kimi.txt +95 -0
  28. package/dist/src/engine/session/prompt/max-steps.txt +16 -0
  29. package/dist/src/engine/session/prompt/plan-reminder-anthropic.txt +67 -0
  30. package/dist/src/engine/session/prompt/plan.txt +26 -0
  31. package/dist/src/engine/session/prompt/trinity.txt +97 -0
  32. package/dist/src/engine/session/prompt.js +92 -4
  33. package/dist/src/engine/session/prompt.js.map +1 -1
  34. package/dist/src/engine/skill/prompt/customize-opencode.md +377 -0
  35. package/dist/src/engine/tool/apply_patch.txt +33 -0
  36. package/dist/src/engine/tool/edit.txt +10 -0
  37. package/dist/src/engine/tool/glob.txt +6 -0
  38. package/dist/src/engine/tool/grep.txt +8 -0
  39. package/dist/src/engine/tool/lsp.txt +24 -0
  40. package/dist/src/engine/tool/plan-enter.txt +14 -0
  41. package/dist/src/engine/tool/plan-exit.txt +13 -0
  42. package/dist/src/engine/tool/question.txt +10 -0
  43. package/dist/src/engine/tool/read.txt +14 -0
  44. package/dist/src/engine/tool/repo_clone.txt +5 -0
  45. package/dist/src/engine/tool/repo_overview.txt +4 -0
  46. package/dist/src/engine/tool/shell/shell.txt +77 -0
  47. package/dist/src/engine/tool/skill.txt +5 -0
  48. package/dist/src/engine/tool/task.txt +58 -0
  49. package/dist/src/engine/tool/task_status.txt +13 -0
  50. package/dist/src/engine/tool/todowrite.txt +167 -0
  51. package/dist/src/engine/tool/tool/apply_patch.txt +33 -0
  52. package/dist/src/engine/tool/tool/edit.txt +10 -0
  53. package/dist/src/engine/tool/tool/glob.txt +6 -0
  54. package/dist/src/engine/tool/tool/grep.txt +8 -0
  55. package/dist/src/engine/tool/tool/lsp.txt +24 -0
  56. package/dist/src/engine/tool/tool/plan-enter.txt +14 -0
  57. package/dist/src/engine/tool/tool/plan-exit.txt +13 -0
  58. package/dist/src/engine/tool/tool/question.txt +10 -0
  59. package/dist/src/engine/tool/tool/read.txt +14 -0
  60. package/dist/src/engine/tool/tool/repo_clone.txt +5 -0
  61. package/dist/src/engine/tool/tool/repo_overview.txt +4 -0
  62. package/dist/src/engine/tool/tool/shell/shell.txt +77 -0
  63. package/dist/src/engine/tool/tool/skill.txt +5 -0
  64. package/dist/src/engine/tool/tool/task.txt +58 -0
  65. package/dist/src/engine/tool/tool/task_status.txt +13 -0
  66. package/dist/src/engine/tool/tool/todowrite.txt +167 -0
  67. package/dist/src/engine/tool/tool/webfetch.txt +13 -0
  68. package/dist/src/engine/tool/tool/websearch.txt +14 -0
  69. package/dist/src/engine/tool/tool/write.txt +8 -0
  70. package/dist/src/engine/tool/webfetch.txt +13 -0
  71. package/dist/src/engine/tool/websearch.txt +14 -0
  72. package/dist/src/engine/tool/write.txt +8 -0
  73. package/dist/src/tui.js +146 -9
  74. package/dist/src/tui.js.map +1 -1
  75. package/package.json +2 -2
  76. package/scripts/copy_prompts.js +58 -0
  77. package/scripts/test_bonescript_primer.js +111 -0
  78. package/scripts/test_build_fallback.js +221 -0
  79. package/scripts/test_build_mode.js +301 -0
  80. package/src/db_adapter.ts +29 -0
  81. package/src/engine/session/build_mode.ts +895 -0
  82. package/src/engine/session/build_mode_helpers.ts +72 -0
  83. package/src/engine/session/prompt/bonescript.txt +402 -0
  84. package/src/engine/session/prompt.ts +105 -4
  85. package/src/tui.ts +147 -9
@@ -0,0 +1,377 @@
1
+ <!--
2
+ Built-in skill. Name and description are registered in code at
3
+ packages/opencode/src/skill/index.ts (see CUSTOMIZE_OPENCODE_SKILL_NAME
4
+ and CUSTOMIZE_OPENCODE_SKILL_DESCRIPTION). The body below becomes the
5
+ skill's content.
6
+ -->
7
+
8
+ # Customizing opencode
9
+
10
+ opencode validates its own config strictly and refuses to start when a field
11
+ is wrong. The shapes below cover the common surface area, but they are a
12
+ **summary, not the source of truth**.
13
+
14
+ ## Full schema reference
15
+
16
+ The authoritative list of every config option — with field types, enums,
17
+ defaults, and descriptions — lives in the published JSON Schema:
18
+
19
+ **<https://opencode.ai/config.json>**
20
+
21
+ If a field is not documented in this skill, or you need to confirm an exact
22
+ shape before writing config, **fetch that URL and read the schema directly**
23
+ rather than guessing. opencode hard-fails on invalid config, so the cost of a
24
+ wrong shape is a broken startup.
25
+
26
+ Independently, every `opencode.json` should declare
27
+ `"$schema": "https://opencode.ai/config.json"` so the user's editor catches
28
+ mistakes as they type.
29
+
30
+ ## Applying changes
31
+
32
+ Config is loaded once when opencode starts and is not hot-reloaded. After
33
+ saving changes to `opencode.json`, an agent file, a skill, a plugin, or any
34
+ other config-time file, **tell the user to quit and restart opencode** for
35
+ the changes to take effect. The running session will keep using the
36
+ already-loaded config until then.
37
+
38
+ ## Where files live
39
+
40
+ | Scope | Path |
41
+ | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
42
+ | Project config | `./opencode.json`, `./opencode.jsonc`, or `.opencode/opencode.json` (opencode walks up from the cwd to the worktree root) |
43
+ | Global config | `~/.config/opencode/opencode.json` (NOT `~/.opencode/`) |
44
+ | Project agents | `.opencode/agent/<name>.md` or `.opencode/agents/<name>.md` |
45
+ | Global agents | `~/.config/opencode/agent(s)/<name>.md` |
46
+ | Project skills | `.opencode/skill(s)/<name>/SKILL.md` |
47
+ | Global skills | `~/.config/opencode/skill(s)/<name>/SKILL.md` |
48
+ | External skills (auto-loaded) | `~/.claude/skills/<name>/SKILL.md`, `~/.agents/skills/<name>/SKILL.md` |
49
+
50
+ Configs from each scope are deep-merged. Project overrides global. Unknown
51
+ top-level keys in `opencode.json` are rejected with `ConfigInvalidError`.
52
+
53
+ ## opencode.json
54
+
55
+ Every field is optional.
56
+
57
+ ```json
58
+ {
59
+ "$schema": "https://opencode.ai/config.json",
60
+ "username": "string",
61
+ "model": "provider/model-id",
62
+ "small_model": "provider/model-id",
63
+ "default_agent": "agent-name",
64
+ "shell": "/bin/zsh",
65
+ "logLevel": "DEBUG" | "INFO" | "WARN" | "ERROR",
66
+ "share": "manual" | "auto" | "disabled",
67
+ "autoupdate": true | false | "notify",
68
+ "snapshot": true,
69
+ "instructions": ["AGENTS.md", "docs/style.md"],
70
+
71
+ "skills": {
72
+ "paths": [".opencode/skills", "/abs/path/to/skills"],
73
+ "urls": ["https://example.com/.well-known/skills/"]
74
+ },
75
+
76
+ "agent": {
77
+ "my-agent": {
78
+ "model": "anthropic/claude-sonnet-4-6",
79
+ "mode": "subagent",
80
+ "description": "...",
81
+ "permission": { "edit": "deny" }
82
+ }
83
+ },
84
+
85
+ "command": {
86
+ "deploy": { "description": "...", "prompt": "..." }
87
+ },
88
+
89
+ "provider": {
90
+ "anthropic": { "options": { "apiKey": "..." } }
91
+ },
92
+ "disabled_providers": ["openai"],
93
+ "enabled_providers": ["anthropic"],
94
+
95
+ "mcp": {
96
+ "playwright": {
97
+ "type": "local",
98
+ "command": ["npx", "-y", "@playwright/mcp"],
99
+ "enabled": true,
100
+ "env": {}
101
+ },
102
+ "remote-thing": {
103
+ "type": "remote",
104
+ "url": "https://...",
105
+ "headers": { "Authorization": "Bearer ..." }
106
+ }
107
+ },
108
+
109
+ "plugin": [
110
+ "opencode-gemini-auth",
111
+ "opencode-foo@1.2.3",
112
+ "./local-plugin.ts",
113
+ ["opencode-bar", { "option": "value" }]
114
+ ],
115
+
116
+ "permission": {
117
+ "edit": "deny",
118
+ "bash": { "git *": "allow", "*": "ask" }
119
+ },
120
+
121
+ "formatter": false,
122
+ "lsp": false,
123
+
124
+ "experimental": {
125
+ "primary_tools": ["edit"],
126
+ "mcp_timeout": 30000
127
+ },
128
+
129
+ "tool_output": { "max_lines": 200, "max_bytes": 8192 },
130
+
131
+ "compaction": { "auto": true, "tail_turns": 15 }
132
+ }
133
+ ```
134
+
135
+ Shape notes worth being explicit about:
136
+
137
+ - `model` always carries a provider prefix: `"anthropic/claude-sonnet-4-6"`.
138
+ - `skills` is an object with `paths` and/or `urls`, not an array.
139
+ - `agent` is an object keyed by agent name, not an array.
140
+ - `plugin` is an array of strings or `[name, options]` tuples, not an object.
141
+ - `mcp[name].command` is an array of strings, never a single string. `type` is required.
142
+ - `permission` is either a string action or an object keyed by tool name.
143
+
144
+ ## Skills
145
+
146
+ opencode's skill loader scans for `**/SKILL.md` inside skill directories. The
147
+ file is named `SKILL.md` exactly, and lives in its own folder named after the
148
+ skill:
149
+
150
+ ```
151
+ .opencode/skills/my-skill/SKILL.md
152
+ ```
153
+
154
+ Frontmatter:
155
+
156
+ ```markdown
157
+ ---
158
+ name: my-skill
159
+ description: One sentence covering what this skill does AND when to trigger it. Front-load the literal keywords or filenames the user is likely to say.
160
+ ---
161
+
162
+ # My Skill
163
+
164
+ (skill body in markdown: instructions, examples, references)
165
+ ```
166
+
167
+ - `name` is required, lowercase hyphen-separated, up to 64 chars, and matches the folder name.
168
+ - `description` is effectively required: skills without one are filtered out and never surfaced to the model. Cover both _what_ the skill does and _when_ to use it. Write in third person ("Use when...", not "I help with..."). Front-load concrete trigger keywords and filenames; gate with "Use ONLY when..." if the skill should stay quiet on adjacent topics.
169
+ - Optional: `license`, `compatibility`, `metadata` (string-string map).
170
+
171
+ Register skills from non-default locations via `skills.paths` (scanned
172
+ recursively for `**/SKILL.md`) and `skills.urls` (each URL serves a list of
173
+ skills).
174
+
175
+ ## Agents
176
+
177
+ Two ways to define an agent. Use the file form for anything non-trivial.
178
+
179
+ ### Inline (in `opencode.json`)
180
+
181
+ ```json
182
+ {
183
+ "agent": {
184
+ "my-reviewer": {
185
+ "description": "Reviews PRs for style violations.",
186
+ "mode": "subagent",
187
+ "model": "anthropic/claude-sonnet-4-6",
188
+ "permission": { "edit": "deny", "bash": "ask" },
189
+ "prompt": "You are a strict PR reviewer..."
190
+ }
191
+ }
192
+ }
193
+ ```
194
+
195
+ ### File
196
+
197
+ ```
198
+ .opencode/agent/my-reviewer.md OR .opencode/agents/my-reviewer.md
199
+ ```
200
+
201
+ ```markdown
202
+ ---
203
+ description: Reviews PRs for style violations.
204
+ mode: subagent
205
+ model: anthropic/claude-sonnet-4-6
206
+ permission:
207
+ edit: deny
208
+ bash: ask
209
+ ---
210
+
211
+ You are a strict PR reviewer. Focus on...
212
+ ```
213
+
214
+ The file body becomes the agent's `prompt`. Do not also put `prompt:` in the
215
+ frontmatter.
216
+
217
+ `mode` is one of `"primary"`, `"subagent"`, `"all"`.
218
+
219
+ Allowed top-level frontmatter fields: `name, model, variant, description, mode,
220
+ hidden, color, steps, options, permission, disable, temperature, top_p`. Any
221
+ unknown field is silently routed into `options`.
222
+
223
+ To disable a built-in agent: `agent: { build: { disable: true } }`, or in a
224
+ file, `disable: true` in frontmatter.
225
+
226
+ `default_agent` must point to a non-hidden, primary-mode agent.
227
+
228
+ ### Built-in agents
229
+
230
+ opencode ships with `build`, `plan`, `general`, `explore`, plus optionally
231
+ `scout` (gated on `OPENCODE_EXPERIMENTAL_SCOUT`). Hidden internal agents:
232
+ `compaction`, `title`, `summary`. To override a built-in's fields, define the
233
+ same key in `agent: { <name>: { ... } }`.
234
+
235
+ ## Plugins
236
+
237
+ `plugin:` is an array. Each entry is one of:
238
+
239
+ ```json
240
+ "plugin": [
241
+ "opencode-gemini-auth", // npm spec, latest
242
+ "opencode-foo@1.2.3", // npm spec, pinned
243
+ "./local-plugin.ts", // file path, relative to the declaring config
244
+ "file:///abs/path/plugin.js", // file URL
245
+ ["opencode-bar", { "key": "val" }] // tuple form with options
246
+ ]
247
+ ```
248
+
249
+ Auto-discovered plugins (no config entry needed): any `*.ts` or `*.js` file in
250
+ `.opencode/plugin/` or `.opencode/plugins/`.
251
+
252
+ A plugin module exports `default` (or any named export) of type
253
+ `Plugin = (input: PluginInput, options?) => Promise<Hooks>`. The export is a
254
+ function, not a plain object literal, and the function returns an object
255
+ (return `{}` if there is nothing to register).
256
+
257
+ ```ts
258
+ import type { Plugin } from "@opencode-ai/plugin"
259
+
260
+ export default (async ({ client, project, directory, $ }) => {
261
+ return {
262
+ config: (cfg) => {
263
+ // cfg is the live merged config; mutate fields here.
264
+ },
265
+ "tool.execute.before": async (input, output) => {
266
+ // mutate output.args before the tool runs
267
+ },
268
+ }
269
+ }) satisfies Plugin
270
+ ```
271
+
272
+ Hook surface (mutate `output` in place; return `void`):
273
+
274
+ - `event(input)`: every bus event
275
+ - `config(cfg)`: once on init with the merged config
276
+ - `chat.message`, `chat.params`, `chat.headers`
277
+ - `tool.execute.before`, `tool.execute.after`
278
+ - `tool.definition`
279
+ - `command.execute.before`
280
+ - `shell.env`
281
+ - `permission.ask`
282
+ - `experimental.chat.messages.transform`, `experimental.chat.system.transform`,
283
+ `experimental.session.compacting`, `experimental.compaction.autocontinue`,
284
+ `experimental.text.complete`
285
+
286
+ Special object-shaped (not callbacks): `tool: { my_tool: { ... } }`,
287
+ `auth: { ... }`, `provider: { ... }`.
288
+
289
+ ## MCP servers
290
+
291
+ `mcp:` is an object keyed by server name. Each server is discriminated by
292
+ `type`:
293
+
294
+ ```json
295
+ {
296
+ "mcp": {
297
+ "playwright": {
298
+ "type": "local",
299
+ "command": ["npx", "-y", "@playwright/mcp"],
300
+ "enabled": true,
301
+ "env": { "BROWSER": "chromium" }
302
+ },
303
+ "github": {
304
+ "type": "remote",
305
+ "url": "https://...",
306
+ "enabled": true,
307
+ "headers": { "Authorization": "Bearer ${GITHUB_TOKEN}" }
308
+ },
309
+ "old-server": { "enabled": false }
310
+ }
311
+ }
312
+ ```
313
+
314
+ `command` is an array of strings. `type` is required. Use `enabled: false` to
315
+ disable a server inherited from a parent config.
316
+
317
+ ## Permissions
318
+
319
+ ```json
320
+ "permission": {
321
+ "edit": "deny",
322
+ "bash": { "git *": "allow", "rm *": "deny", "*": "ask" },
323
+ "external_directory": { "~/secrets/**": "deny", "*": "allow" }
324
+ }
325
+ ```
326
+
327
+ Actions: `"allow"`, `"ask"`, `"deny"`.
328
+
329
+ Per-tool value forms: `"allow"` shorthand (treated as `{"*": "allow"}`), or an
330
+ object `{ pattern: action }`. Within an object, **insertion order matters**.
331
+ opencode evaluates the LAST matching rule, so put broad rules first and narrow
332
+ rules last.
333
+
334
+ `permission: "allow"` (a string at the top level) is shorthand for "allow
335
+ everything" and is rarely what the user wants.
336
+
337
+ Known permission keys: `read, edit, glob, grep, list, bash, task,
338
+ external_directory, todowrite, question, webfetch, websearch, repo_clone,
339
+ repo_overview, lsp, doom_loop, skill`. Some of these (`todowrite,
340
+ question, webfetch, websearch, doom_loop`) only accept a flat
341
+ action, not a per-pattern object.
342
+
343
+ `external_directory` patterns are filesystem paths (use `~/`, absolute paths,
344
+ or globs like `~/projects/**`).
345
+
346
+ Per-agent `permission:` overrides top-level `permission:`. Plan Mode lives on
347
+ the `plan` agent's permission ruleset (`edit: deny *`).
348
+
349
+ ## Escape hatches
350
+
351
+ When a user's config is broken and opencode won't start, these env vars help:
352
+
353
+ - `OPENCODE_DISABLE_PROJECT_CONFIG=1`: skip the project's local `opencode.json`
354
+ and start from globals only. Run from the project directory, opencode loads,
355
+ the user edits the broken file, then they restart without the flag.
356
+ - `OPENCODE_CONFIG=/path/to/file.json`: load an additional explicit config.
357
+ - `OPENCODE_CONFIG_CONTENT='{"$schema":"https://opencode.ai/config.json"}'`:
358
+ inject inline JSON as a final local-scope merge.
359
+ - `OPENCODE_DISABLE_DEFAULT_PLUGINS=1`: skip default plugins.
360
+ - `OPENCODE_PURE=1`: skip external plugins entirely.
361
+ - `OPENCODE_DISABLE_EXTERNAL_SKILLS=1`,
362
+ `OPENCODE_DISABLE_CLAUDE_CODE_SKILLS=1`: skip the external skill scans under
363
+ `~/.claude/` and `~/.agents/`.
364
+
365
+ ## When proposing edits
366
+
367
+ - Validate against the schema before writing. If you are unsure of a field's
368
+ exact shape, or the field is not covered in this skill, fetch
369
+ `https://opencode.ai/config.json` and read the schema rather than guessing.
370
+ - Preserve `$schema` and any existing fields the user did not ask to change.
371
+ - For agent, skill, and plugin definitions, prefer creating new files in the
372
+ correct location over inlining everything in `opencode.json`.
373
+ - If the user's existing config is malformed, point them at the env-var escape
374
+ hatches above so they can edit from inside opencode without breaking their
375
+ session.
376
+ - After saving any config change, remind the user to quit and restart opencode
377
+ — running sessions keep using the already-loaded config.
@@ -0,0 +1,33 @@
1
+ Use the `apply_patch` tool to edit files. Your patch language is a stripped‑down, file‑oriented diff format designed to be easy to parse and safe to apply. You can think of it as a high‑level envelope:
2
+
3
+ *** Begin Patch
4
+ [ one or more file sections ]
5
+ *** End Patch
6
+
7
+ Within that envelope, you get a sequence of file operations.
8
+ You MUST include a header to specify the action you are taking.
9
+ Each operation starts with one of three headers:
10
+
11
+ *** Add File: <path> - create a new file. Every following line is a + line (the initial contents).
12
+ *** Delete File: <path> - remove an existing file. Nothing follows.
13
+ *** Update File: <path> - patch an existing file in place (optionally with a rename).
14
+
15
+ Example patch:
16
+
17
+ ```
18
+ *** Begin Patch
19
+ *** Add File: hello.txt
20
+ +Hello world
21
+ *** Update File: src/app.py
22
+ *** Move to: src/main.py
23
+ @@ def greet():
24
+ -print("Hi")
25
+ +print("Hello, world!")
26
+ *** Delete File: obsolete.txt
27
+ *** End Patch
28
+ ```
29
+
30
+ It is important to remember:
31
+
32
+ - You must include a header with your intended action (Add/Delete/Update)
33
+ - You must prefix new lines with `+` even when creating a new file
@@ -0,0 +1,10 @@
1
+ Performs exact string replacements in files.
2
+
3
+ Usage:
4
+ - You must use your `Read` tool at least once in the conversation before editing. This tool will error if you attempt an edit without reading the file.
5
+ - When editing text from Read tool output, ensure you preserve the exact indentation (tabs/spaces) as it appears AFTER the line number prefix. The line number prefix format is: line number + colon + space (e.g., `1: `). Everything after that space is the actual file content to match. Never include any part of the line number prefix in the oldString or newString.
6
+ - ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.
7
+ - Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked.
8
+ - The edit will FAIL if `oldString` is not found in the file with an error "oldString not found in content".
9
+ - The edit will FAIL if `oldString` is found multiple times in the file with an error "Found multiple matches for oldString. Provide more surrounding lines in oldString to identify the correct match." Either provide a larger string with more surrounding context to make it unique or use `replaceAll` to change every instance of `oldString`.
10
+ - Use `replaceAll` for replacing and renaming strings across the file. This parameter is useful if you want to rename a variable for instance.
@@ -0,0 +1,6 @@
1
+ - Fast file pattern matching tool that works with any codebase size
2
+ - Supports glob patterns like "**/*.js" or "src/**/*.ts"
3
+ - Returns matching file paths sorted by modification time
4
+ - Use this tool when you need to find files by name patterns
5
+ - When you are doing an open-ended search that may require multiple rounds of globbing and grepping, use the Task tool instead
6
+ - You have the capability to call multiple tools in a single response. It is always better to speculatively perform multiple searches as a batch that are potentially useful.
@@ -0,0 +1,8 @@
1
+ - Fast content search tool that works with any codebase size
2
+ - Searches file contents using regular expressions
3
+ - Supports full regex syntax (eg. "log.*Error", "function\s+\w+", etc.)
4
+ - Filter files by pattern with the include parameter (eg. "*.js", "*.{ts,tsx}")
5
+ - Returns file paths and line numbers with at least one match sorted by modification time
6
+ - Use this tool when you need to find files containing specific patterns
7
+ - If you need to identify/count the number of matches within files, use the Bash tool with `rg` (ripgrep) directly. Do NOT use `grep`.
8
+ - When you are doing an open-ended search that may require multiple rounds of globbing and grepping, use the Task tool instead
@@ -0,0 +1,24 @@
1
+ Interact with Language Server Protocol (LSP) servers to get code intelligence features.
2
+
3
+ Supported operations:
4
+ - goToDefinition: Find where a symbol is defined
5
+ - findReferences: Find all references to a symbol
6
+ - hover: Get hover information (documentation, type info) for a symbol
7
+ - documentSymbol: Get all symbols (functions, classes, variables) in a document
8
+ - workspaceSymbol: List project-wide symbols matching a query string
9
+ - goToImplementation: Find implementations of an interface or abstract method
10
+ - prepareCallHierarchy: Get call hierarchy item at a position (functions/methods)
11
+ - incomingCalls: Find all functions/methods that call the function at a position
12
+ - outgoingCalls: Find all functions/methods called by the function at a position
13
+
14
+ All operations require:
15
+ - filePath: The file to operate on
16
+ - line: The line number (1-based, as shown in editors)
17
+ - character: The character offset (1-based, as shown in editors)
18
+
19
+ workspaceSymbol also accepts:
20
+ - query: A query string to filter symbols by. Empty string requests all symbols.
21
+
22
+ For workspaceSymbol, filePath is not sent in the LSP workspace/symbol request. It is used by opencode to select and start the matching LSP server.
23
+
24
+ Note: LSP servers must be configured for the file type. If no server is available, an error will be returned.
@@ -0,0 +1,14 @@
1
+ Use this tool to suggest switching to plan agent when the user's request would benefit from planning before implementation.
2
+
3
+ If they explicitly mention wanting to create a plan ALWAYS call this tool first.
4
+
5
+ This tool will ask the user if they want to switch to plan agent.
6
+
7
+ Call this tool when:
8
+ - The user's request is complex and would benefit from planning first
9
+ - You want to research and design before making changes
10
+ - The task involves multiple files or significant architectural decisions
11
+
12
+ Do NOT call this tool:
13
+ - For simple, straightforward tasks
14
+ - When the user explicitly wants immediate implementation
@@ -0,0 +1,13 @@
1
+ Use this tool when you have completed the planning phase and are ready to exit plan agent.
2
+
3
+ This tool will ask the user if they want to switch to build agent to start implementing the plan.
4
+
5
+ Call this tool:
6
+ - After you have written a complete plan to the plan file
7
+ - After you have clarified any questions with the user
8
+ - When you are confident the plan is ready for implementation
9
+
10
+ Do NOT call this tool:
11
+ - Before you have created or finalized the plan
12
+ - If you still have unanswered questions about the implementation
13
+ - If the user has indicated they want to continue planning
@@ -0,0 +1,10 @@
1
+ Use this tool when you need to ask the user questions during execution. This allows you to:
2
+ 1. Gather user preferences or requirements
3
+ 2. Clarify ambiguous instructions
4
+ 3. Get decisions on implementation choices as you work
5
+ 4. Offer choices to the user about what direction to take.
6
+
7
+ Usage notes:
8
+ - When `custom` is enabled (default), a "Type your own answer" option is added automatically; don't include "Other" or catch-all options
9
+ - Answers are returned as arrays of labels; set `multiple: true` to allow selecting more than one
10
+ - If you recommend a specific option, make that the first option in the list and add "(Recommended)" at the end of the label
@@ -0,0 +1,14 @@
1
+ Read a file or directory from the local filesystem. If the path does not exist, an error is returned.
2
+
3
+ Usage:
4
+ - The filePath parameter should be an absolute path.
5
+ - By default, this tool returns up to 2000 lines from the start of the file.
6
+ - The offset parameter is the line number to start from (1-indexed).
7
+ - To read later sections, call this tool again with a larger offset.
8
+ - Use the grep tool to find specific content in large files or files with long lines.
9
+ - If you are unsure of the correct file path, use the glob tool to look up filenames by glob pattern.
10
+ - Contents are returned with each line prefixed by its line number as `<line>: <content>`. For example, if a file has contents "foo\n", you will receive "1: foo\n". For directories, entries are returned one per line (without line numbers) with a trailing `/` for subdirectories.
11
+ - Any line longer than 2000 characters is truncated.
12
+ - Call this tool in parallel when you know there are multiple files you want to read.
13
+ - Avoid tiny repeated slices (30 line chunks). If you need more context, read a larger window.
14
+ - This tool can read image files and PDFs and return them as file attachments.
@@ -0,0 +1,5 @@
1
+ - Clone or refresh a repository into OpenCode's managed cache under the data directory
2
+ - Accepts git URLs, forge host/path references, or GitHub owner/repo shorthand
3
+ - Returns the cached absolute local path so other tools can explore the cloned source
4
+ - Use this before Read, Glob, or Grep when the code you need lives outside the current workspace
5
+ - This tool is intended for dependency and documentation research workflows, not for modifying the user's workspace
@@ -0,0 +1,4 @@
1
+ - Summarize the structure and likely entrypoints of a cloned repository or local directory
2
+ - Accepts either a cached repository reference or a directory path
3
+ - Reports detected ecosystems, dependency files, package manager, likely entrypoints, and a compact structure tree
4
+ - Use this after repo_clone to orient quickly before deeper Read, Glob, or Grep investigation
@@ -0,0 +1,77 @@
1
+ ${intro}
2
+
3
+ Be aware: OS: ${os}, Shell: ${shell}
4
+
5
+ ${workdirSection}
6
+
7
+ Use `${tmp}` for temporary work outside the workspace. This directory has already been created, already exists, and is pre-approved for external directory access.
8
+
9
+ IMPORTANT: This tool is for terminal operations like git, npm, docker, etc. DO NOT use it for file operations (reading, writing, editing, searching, finding files) - use the specialized tools for this instead.
10
+
11
+ ${commandSection}
12
+
13
+ # Committing changes with git
14
+
15
+ Only create commits when requested by the user. If unclear, ask first. When the user asks you to create a new git commit, follow these steps carefully:
16
+
17
+ Git Safety Protocol:
18
+ - NEVER update the git config
19
+ - NEVER run destructive/irreversible git commands (like push --force, hard reset, etc) unless the user explicitly requests them
20
+ - NEVER skip hooks (--no-verify, --no-gpg-sign, etc) unless the user explicitly requests it
21
+ - NEVER run force push to main/master, warn the user if they request it
22
+ - Avoid git commit --amend. ONLY use --amend when ALL conditions are met:
23
+ (1) User explicitly requested amend, OR the commit succeeded and pre-commit hooks auto-modified files that need including — verify by checking `git log` that HEAD is the new commit before amending
24
+ (2) HEAD commit was created by you in this conversation (verify: git log -1 --format='%an %ae')
25
+ (3) Commit has NOT been pushed to remote (verify: git status shows "Your branch is ahead")
26
+ - CRITICAL: If commit FAILED or was REJECTED by hook, NEVER amend - fix the issue and create a NEW commit
27
+ - CRITICAL: If you already pushed to remote, NEVER amend unless user explicitly requests it (requires force push)
28
+ - NEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTANT to only commit when explicitly asked, otherwise the user will feel that you are being too proactive.
29
+
30
+ 1. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following ${gitCommands} in parallel, each using the ${toolName} tool:
31
+ - Run a git status command to see all untracked files.
32
+ - Run a git diff command to see both staged and unstaged changes that will be committed.
33
+ - Run a git log command to see recent commit messages, so that you can follow this repository's commit message style.
34
+ 2. Analyze all staged changes (both previously staged and newly added) and draft a commit message:
35
+ - Summarize the nature of the changes (eg. new feature, enhancement to an existing feature, bug fix, refactoring, test, docs, etc.). Ensure the message accurately reflects the changes and their purpose (i.e. "add" means a wholly new feature, "update" means an enhancement to an existing feature, "fix" means a bug fix, etc.).
36
+ - Do not commit files that likely contain secrets (.env, credentials.json, etc.). Warn the user if they specifically request to commit those files
37
+ - Draft a concise (1-2 sentences) commit message that focuses on the "why" rather than the "what"
38
+ - Ensure it accurately reflects the changes and their purpose
39
+ 3. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following commands:
40
+ - Add relevant untracked files to the staging area.
41
+ - Create the commit with a message
42
+ - Run git status after the commit completes to verify success.
43
+ Note: git status depends on the commit completing, so run it sequentially after the commit.
44
+ 4. If the commit fails due to pre-commit hook, fix the issue and create a NEW commit (see amend rules above)
45
+
46
+ Important notes:
47
+ - NEVER run additional commands to read or explore code, besides ${gitCommandRestriction}
48
+ - NEVER use the TodoWrite or Task tools
49
+ - DO NOT push to the remote repository unless the user explicitly asks you to do so
50
+ - IMPORTANT: Never use git commands with the -i flag (like git rebase -i or git add -i) since they require interactive input which is not supported.
51
+ - If there are no changes to commit (i.e., no untracked files and no modifications), do not create an empty commit
52
+
53
+ # Creating pull requests
54
+ Use the gh command via the ${toolName} tool for ALL GitHub-related tasks including working with issues, pull requests, checks, and releases. If given a GitHub URL use the gh command to get the information needed.
55
+
56
+ IMPORTANT: When the user asks you to create a pull request, follow these steps carefully:
57
+
58
+ 1. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following ${gitCommands} in parallel using the ${toolName} tool, in order to understand the current state of the branch since it diverged from the main branch:
59
+ - Run a git status command to see all untracked files
60
+ - Run a git diff command to see both staged and unstaged changes that will be committed
61
+ - Check if the current branch tracks a remote branch and is up to date with the remote, so you know if you need to push to the remote
62
+ - Run a git log command and `git diff [base-branch]...HEAD` to understand the full commit history for the current branch (from the time it diverged from the base branch)
63
+ 2. Analyze all changes that will be included in the pull request, making sure to look at all relevant commits (NOT just the latest commit, but ALL commits that will be included in the pull request!!!), and draft a pull request summary
64
+ 3. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following commands in parallel:
65
+ - Create new branch if needed
66
+ - Push to remote with -u flag if needed
67
+ - ${createPrInstruction}
68
+ <example>
69
+ ${createPrExample}
70
+ </example>
71
+
72
+ Important:
73
+ - DO NOT use the TodoWrite or Task tools
74
+ - Return the PR URL when you're done, so the user can see it
75
+
76
+ # Other common operations
77
+ - View comments on a GitHub PR: gh api repos/foo/bar/pulls/123/comments
@@ -0,0 +1,5 @@
1
+ Load a specialized skill when the task at hand matches one of the skills listed in the system prompt.
2
+
3
+ Use this tool to inject the skill's instructions and resources into current conversation. The output may contain detailed workflow guidance as well as references to scripts, files, etc in the same directory as the skill.
4
+
5
+ The skill name must match one of the skills listed in your system prompt.