opencode-raven 2.1.7 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.2.0
4
+
5
+ ### Added
6
+ - Separate Raven Search and Raven MCP agents with independent models, reasoning effort, instructions, and timeouts.
7
+ - Public `raven_mcp` delegation tool and Raven-only `raven_mcp_bridge` for on-demand MCP operations.
8
+ - Delegated sessions now attach directly to the root session so nested agent calls remain visible in the main session's child switcher.
9
+
10
+ ### Changed
11
+ - Raven configuration now uses `raven_seek` and `raven_mcp` sections. Existing flat configuration migrates automatically without a version field.
12
+ - `raven_seek` is explicitly limited to narrowly scoped search and evidence retrieval; review, audit, implementation, and judgment remain with the calling agent.
13
+ - Per-agent commands replace the shared model, effort, and timeout commands.
14
+
15
+ ### Removed
16
+ - `/raven on`, `/raven off`, and the configuration-wide `enabled` field. Search routing is active while the plugin is installed.
17
+ - Shared `/raven model`, `/raven effort`, and `/raven timeout` commands.
18
+
19
+ ## 2.1.8
20
+
21
+ ### Added
22
+ - `raven_seek` now returns a model-visible session ID and accepts it through the optional `sessionId` argument, allowing follow-up research to continue in the same Raven session.
23
+ - Resumed sessions are validated as Raven children of the current main session before they can be prompted again.
24
+
25
+ ### Fixed
26
+ - Context estimates for resumed sessions count only the newly handled context instead of counting earlier Raven turns again.
27
+
3
28
  ## 2.1.7
4
29
 
5
30
  ### Fixed
package/README.md CHANGED
@@ -15,9 +15,10 @@
15
15
  </td>
16
16
  <td valign="top">
17
17
  <h2>Why Raven</h2>
18
- <p>Raven delegates search, web, documentation, GitHub, command-inspection, and MCP work to a focused subagent, then returns a compact answer to the main session.</p>
18
+ <p>Raven delegates search and on-demand MCP retrieval to separate focused agents, then returns compact evidence to the calling session.</p>
19
19
  <ul>
20
- <li>Routes OpenCode tools and globally configured MCPs through <code>raven_seek</code>.</li>
20
+ <li>Routes OpenCode search tools and globally configured MCPs through <code>raven_seek</code>.</li>
21
+ <li>Uses a separately configurable model for on-demand MCP retrieval through <code>raven_mcp</code>.</li>
21
22
  <li>Keeps optional on-demand MCP schemas out of the main model's tool list.</li>
22
23
  <li>Preconfigures Context7, Exa, and Grep.app endpoints.</li>
23
24
  <li>Tracks estimated main-session context avoided by delegation.</li>
@@ -54,19 +55,29 @@ In this run, Raven handled the search-heavy web research in a child session and
54
55
 
55
56
  1. Your agent attempts to use a routed search, fetch, shell-discovery, or MCP tool.
56
57
  2. Raven blocks the noisy direct call and gives the agent the exact `raven_seek` retry.
57
- 3. The agent continues automatically through a linked Raven child session.
58
- 4. Raven performs the tool-heavy work and returns only compact findings to the main session.
58
+ 3. The selected Raven agent creates a session attached directly to the root session or resumes one for a related follow-up.
59
+ 4. Raven performs retrieval work and returns compact evidence to the calling agent, which retains analysis and judgment.
59
60
 
60
- The main model receives Raven's final answer instead of its raw tool output. Child sessions remain available in OpenCode's session/subagent view for inspection.
61
+ The main model receives Raven's final answer instead of its raw tool output. Each result includes a Raven session ID that the main agent can pass back for a context-aware follow-up. Child sessions remain available in OpenCode's session/subagent view for inspection.
61
62
 
62
- For direct control, mention `@Raven` in any chat. This sends the request straight to the Raven agent, but it is optional and not required for automatic routing.
63
+ For direct search control, mention `@Raven` in any chat. This sends the request to the search agent, but it is optional and not required for automatic routing.
63
64
 
64
- Under the hood, Raven registers two tools:
65
+ Under the hood, Raven registers two public delegation tools and one internal bridge:
65
66
 
66
67
  | Tool | Purpose |
67
68
  |------|---------|
68
- | `raven_seek` | Creates a linked Raven child session and returns its compact result. |
69
- | `raven_mcp` | Raven-only bridge to MCPs configured under `onDemandMcpServers`. |
69
+ | `raven_seek` | Creates or resumes a Raven Search session for narrowly scoped evidence retrieval. |
70
+ | `raven_mcp` | Creates or resumes a Raven MCP session for configured on-demand MCP capabilities. |
71
+ | `raven_mcp_bridge` | Internal bridge used only by the Raven MCP agent. |
72
+
73
+ For a related follow-up, the main agent can reuse the ID returned by the earlier call:
74
+
75
+ ```text
76
+ raven_seek(query="Research the available options")
77
+ raven_seek(query="Compare the first two in more detail", sessionId="ses_...")
78
+ ```
79
+
80
+ Raven accepts a resumed session only when it belongs to the same root session tree and matching Raven agent. Do not pass session IDs between `raven_seek` and `raven_mcp`. Delegated sessions attach directly to the root so they remain visible in the main session's child switcher even when delegation starts inside another child.
70
81
 
71
82
  OpenCode's built-in tools already exist; Raven routes selected calls instead of replacing those tools. Global MCPs also remain globally registered, so their schemas still enter the main session even when Raven routes their calls.
72
83
 
@@ -80,21 +91,26 @@ Raven creates its global configuration here:
80
91
  ~/.config/opencode/opencode-raven/raven-config.json
81
92
  ```
82
93
 
83
- Manual edits require an OpenCode restart. `/raven on`, `/raven off`, routing changes, and timeout changes apply immediately unless the command says otherwise.
94
+ Manual edits require an OpenCode restart. Route and timeout commands apply immediately unless the command says otherwise.
84
95
 
85
96
  | Field | Fresh-install default | Description |
86
97
  |-------|-----------------------|-------------|
87
- | `enabled` | `true` | Enables hard routing. It does not disable Raven's update check or MCP health probes. |
88
- | `model` | From `Raven.md` | Raven model override. Availability and pricing depend on the provider. |
89
- | `reasoning_effort` | `low` | Raven model reasoning option. |
90
- | `ravenInstructions` | `""` | Extra Raven-only instructions. |
91
- | `routeTools` | Search/fetch tools plus `bash` | Exact tools routed through Raven. `bash` only intercepts search-like commands. |
92
- | `routeToolKeywords` | `[]` | Case-insensitive tool-name substrings, useful for nonstandard MCP tool names. |
93
- | `onDemandMcpDescriptionDetail` | `"full"` | `full` includes tool names and short summaries; `minimized` includes capability summaries only. |
94
- | `onDemandMcpServers` | Context7, Exa, Grep.app | Remote HTTP/SSE or local stdio MCP definitions. |
95
- | `excludeAgents` | `[]` | Agents allowed to bypass routing. |
96
- | `excludeTools` | `[]` | Exact tools never routed by Raven. |
97
- | `timeout` | `600` | Raven delegation and fallback MCP timeout in seconds; minimum 10. |
98
+ | `raven_seek.model` | From `Raven.md` | Search-agent model override. |
99
+ | `raven_seek.reasoning_effort` | `low` | Search-agent reasoning option. |
100
+ | `raven_seek.instructions` | `""` | Extra search-agent instructions. |
101
+ | `raven_seek.routeTools` | Search/fetch tools plus `bash` | Exact tools routed through Raven Search. |
102
+ | `raven_seek.routeToolKeywords` | `[]` | Case-insensitive routed tool-name substrings. |
103
+ | `raven_seek.excludeAgents` | `[]` | Agents allowed to bypass search routing. |
104
+ | `raven_seek.excludeTools` | `[]` | Exact tools never routed through Raven Search. |
105
+ | `raven_seek.timeout` | `600` | Search delegation timeout in seconds. |
106
+ | `raven_mcp.model` | From `RavenMcp.md` | MCP-agent model override. |
107
+ | `raven_mcp.reasoning_effort` | `low` | MCP-agent reasoning option. |
108
+ | `raven_mcp.instructions` | `""` | Extra MCP-agent instructions. |
109
+ | `raven_mcp.timeout` | `600` | MCP delegation and fallback connection timeout in seconds. |
110
+ | `raven_mcp.descriptionDetail` | `"full"` | Full or minimized generated MCP guidance. |
111
+ | `raven_mcp.onDemandMcpServers` | Context7, Exa, Grep.app | Remote HTTP/SSE or local stdio MCP definitions. |
112
+
113
+ Existing flat configuration is migrated automatically on startup without a version field. Shared model, reasoning effort, instructions, and timeout values seed both sections; routing and MCP fields move to their corresponding sections.
98
114
 
99
115
  ## On-Demand MCPs
100
116
 
@@ -108,17 +124,19 @@ Fresh installs include:
108
124
 
109
125
  Provider access policies can change. `/raven mcp` shows the result of Raven's current startup probe.
110
126
 
111
- Merge changes into the existing `onDemandMcpServers` object; replacing it removes omitted defaults. Header and environment values support `{env:VARIABLE}` placeholders.
127
+ Merge changes into the existing `raven_mcp.onDemandMcpServers` object; replacing it removes omitted defaults. Header and environment values support `{env:VARIABLE}` placeholders.
112
128
 
113
129
  Custom remote MCP or keyed endpoint:
114
130
 
115
131
  ```jsonc
116
132
  {
117
- "onDemandMcpServers": {
118
- "myDocs": {
119
- "type": "remote",
120
- "url": "https://example.com/mcp",
121
- "headers": { "Authorization": "Bearer {env:MY_DOCS_TOKEN}" }
133
+ "raven_mcp": {
134
+ "onDemandMcpServers": {
135
+ "myDocs": {
136
+ "type": "remote",
137
+ "url": "https://example.com/mcp",
138
+ "headers": { "Authorization": "Bearer {env:MY_DOCS_TOKEN}" }
139
+ }
122
140
  }
123
141
  }
124
142
  }
@@ -128,13 +146,15 @@ Custom local stdio MCP:
128
146
 
129
147
  ```jsonc
130
148
  {
131
- "onDemandMcpServers": {
132
- "myLocal": {
133
- "type": "local",
134
- "command": ["bunx", "some-mcp-server"],
135
- "environment": { "API_KEY": "{env:MY_LOCAL_KEY}" },
136
- "cwd": "C:\\path\\to\\workspace",
137
- "timeout": 60000
149
+ "raven_mcp": {
150
+ "onDemandMcpServers": {
151
+ "myLocal": {
152
+ "type": "local",
153
+ "command": ["bunx", "some-mcp-server"],
154
+ "environment": { "API_KEY": "{env:MY_LOCAL_KEY}" },
155
+ "cwd": "C:\\path\\to\\workspace",
156
+ "timeout": 60000
157
+ }
138
158
  }
139
159
  }
140
160
  }
@@ -161,7 +181,7 @@ Route or unroute exact tools:
161
181
  /raven route tool remove bash
162
182
  ```
163
183
 
164
- `excludeTools` leaves selected tools direct even if their MCP prefix is routed. `excludeAgents` bypasses routing for selected agents.
184
+ `raven_seek.excludeTools` leaves selected tools direct even if their MCP prefix is routed. `raven_seek.excludeAgents` bypasses routing for selected agents.
165
185
 
166
186
  When `bash` is routed, Raven intercepts primary discovery commands such as `rg`, recursive `grep`, `find -name`, `dir /s`, and `Get-ChildItem -Recurse`, including common quoted shell wrappers. Bounded output filters such as `command | grep ...` remain direct.
167
187
 
@@ -171,22 +191,25 @@ When `bash` is routed, Raven intercepts primary discovery commands such as `rg`,
171
191
  |---------|--------|
172
192
  | `/raven` | Show status, routing, MCP health, version, model, timeout, and stats. |
173
193
  | `/raven help` | Show command help. |
174
- | `/raven on` / `/raven off` | Enable or disable hard routing. |
175
194
  | `/raven route` | Show and edit routed tools and keywords. |
176
195
  | `/raven mcp` | Show on-demand MCP health and generated metadata. |
177
196
  | `/raven mcp refresh [server]` | Recheck MCP health and regenerate metadata. |
178
197
  | `/raven mcp detail full|minimized` | Set generated guidance detail; restart afterward. |
179
- | `/raven model <provider/model>` | Change Raven's model; restart afterward. |
180
- | `/raven effort <value>` | Change Raven's reasoning effort; restart afterward. |
181
- | `/raven timeout <seconds>` | Change the delegation timeout. |
198
+ | `/raven seek model <provider/model>` | Change the search model; restart afterward. |
199
+ | `/raven seek effort <value>` | Change search reasoning effort; restart afterward. |
200
+ | `/raven seek timeout <seconds>` | Change the search delegation timeout. |
201
+ | `/raven mcp model <provider/model>` | Change the MCP model; restart afterward. |
202
+ | `/raven mcp effort <value>` | Change MCP reasoning effort; restart afterward. |
203
+ | `/raven mcp timeout <seconds>` | Change the MCP delegation timeout. |
182
204
  | `/raven stats` | Show estimated context avoided. |
183
205
  | `/raven update` | Check npm, clear Raven's OpenCode package cache when needed, and show restart instructions. |
184
206
 
185
207
  ## Security And Privacy
186
208
 
187
- Raven is optimized for autonomous inspection:
209
+ Raven is optimized for autonomous retrieval:
188
210
 
189
- - It has read, search, unrestricted shell, external-directory, and configured MCP access without normal permission prompts.
211
+ - Raven Search has read, search, unrestricted shell, external-directory, and globally configured MCP access without normal permission prompts.
212
+ - Raven MCP has only the internal on-demand MCP bridge and cannot use shell, local search, or edit tools.
190
213
  - Its `edit` tool is denied, but shell access is not a read-only sandbox and can modify the system.
191
214
  - Queries are sent to Raven's configured model provider.
192
215
  - Remote MCP requests are sent to their services; local MCP entries launch local commands and inherit environment values.
@@ -200,7 +223,8 @@ Review `Raven.md` and your MCP commands before using Raven in sensitive environm
200
223
 
201
224
  ## Troubleshooting
202
225
 
203
- - Provider or quota failure: run `/raven model <provider/model>`, then restart OpenCode.
226
+ - Search provider or quota failure: run `/raven seek model <provider/model>`, then restart OpenCode.
227
+ - MCP-agent provider or quota failure: run `/raven mcp model <provider/model>`, then restart OpenCode.
204
228
  - MCP failure: run `/raven mcp`, then `/raven mcp refresh <server>` after correcting its URL, command, environment, or credentials.
205
229
  - Stale plugin version: run `/raven update`, restart OpenCode, and follow the cache-clearing instructions it prints if needed.
206
230
  - Remove Raven: delete `"opencode-raven"` from `plugin`, restart, then optionally remove `~/.config/opencode/opencode-raven/`.
package/Raven.md CHANGED
@@ -11,17 +11,20 @@ permission:
11
11
  list: allow
12
12
  edit: deny
13
13
  bash: allow
14
- task: deny
15
- raven_seek: deny
16
- raven_mcp: allow
14
+ task: deny
15
+ raven_seek: deny
16
+ raven_mcp: deny
17
+ raven_mcp_bridge: deny
17
18
  external_directory: allow
18
19
  ---
19
20
 
20
21
  You are Raven.
21
22
 
22
- You search, fetch, inspect, and use routed MCPs only.
23
- You return compact findings only.
24
- Never call `raven_seek`; you are Raven. Use your direct tools, globally available MCPs, and `raven_mcp` for on-demand MCPs instead.
23
+ You locate and retrieve evidence with search, fetch, read, command-inspection, and globally routed MCP tools only.
24
+ You return compact evidence only.
25
+ Never call `raven_seek` or `raven_mcp`; you are Raven Search. Use your direct tools and globally available routed MCPs.
26
+
27
+ Do not perform code review, auditing, correctness judgments, implementation, debugging decisions, planning, or general task execution. During those tasks, retrieve only narrowly scoped evidence; the calling agent owns analysis and judgment. If asked to review or audit, return concrete requested locations and facts without a verdict.
25
28
 
26
29
  When a query implies multiple independent searches, run tools in parallel (single turn) for speed.
27
30
 
@@ -33,39 +36,18 @@ Use tools/MCPs like this:
33
36
 
34
37
  **Command-output/system inspection:** when the caller asks about installed commands, `--help` output, man pages, package metadata, loaded modules, local environment state, or whether a local tool supports a format/flag, use bash as needed and return compact findings. This includes running or inspecting bounded command output that a primary agent would otherwise filter with grep/rg/head.
35
38
 
36
- **MCP usage guidance:**
37
-
38
- Use direct MCP tools when they are globally available in your tool list.
39
- Use `raven_mcp` for on-demand MCPs described in your prompt. If you do not know the exact tool name, call `raven_mcp` with `operation: "list_tools"` first, then call the selected tool with `operation: "call_tool"`. For `call_tool` and `get_prompt`, pass arguments as a JSON object string in `argumentsJson`.
40
-
41
- *Context7:*
42
- Use when implementing, configuring, or debugging code that depends on a library, framework, SDK, package, or API.
43
- Prefer Context7 over memory when docs may be version-specific or recently changed.
44
-
45
- *Exa AI:*
46
- Use for live web search, current information, company/product research, reading webpages, comparing tools, and broad external research.
47
- Use Exa when the answer may depend on recent updates, pricing, docs pages, releases, or online sources.
48
-
49
- *Grep.app:*
50
- Use for searching public GitHub code examples, real-world usage patterns, config examples, and how other projects structure similar code.
51
- Use Grep.app when docs are unclear or when implementation examples would help.
52
-
53
- *Other routed MCPs:*
54
- When the caller asks for a configured MCP, use that MCP directly and return a compact summary of only what the primary agent needs.
39
+ **Globally routed MCPs:** when a globally available MCP is present in your tool list, use it directly and return compact evidence. On-demand MCPs belong to the separate Raven MCP agent and are not available here.
55
40
 
56
41
  Output format:
57
42
 
58
- Answer:
59
- * Short direct finding.
43
+ Result:
44
+ * Short direct evidence.
60
45
 
61
46
  Sources / locations:
62
47
  * File paths, URLs, docs, examples, MCP records, or local objects checked.
63
48
 
64
- Relevant details:
65
- * Small notes only. No long code dumps.
66
-
67
- Recommended next step:
68
- * What the caller should do next.
69
-
70
- Uncertainty:
71
- * Anything unclear or not found.
49
+ Relevant evidence:
50
+ * Small notes only. No long code dumps.
51
+
52
+ Search gaps:
53
+ * Anything unclear or not found.
package/RavenMcp.md ADDED
@@ -0,0 +1,42 @@
1
+ ---
2
+ description: Focused on-demand MCP agent that retrieves compact information through Raven's internal MCP bridge.
3
+ mode: subagent
4
+ hidden: true
5
+ model: opencode/deepseek-v4-flash-free
6
+ reasoning_effort: low
7
+ permission:
8
+ "*": deny
9
+ read: deny
10
+ glob: deny
11
+ grep: deny
12
+ list: deny
13
+ edit: deny
14
+ bash: deny
15
+ task: deny
16
+ raven_seek: deny
17
+ raven_mcp: deny
18
+ raven_mcp_bridge: allow
19
+ external_directory: deny
20
+ ---
21
+
22
+ You are Raven MCP.
23
+
24
+ You retrieve information from configured on-demand MCP servers only. Use `raven_mcp_bridge` to list and call their tools, resources, and prompts.
25
+
26
+ Do not perform code review, auditing, implementation, planning, or general task execution. Extract only the information requested by the caller and return compact evidence. The calling agent owns analysis, judgment, and final recommendations.
27
+
28
+ If you do not know the exact tool name, call `raven_mcp_bridge` with operation `list_tools`, then call the selected tool with operation `call_tool`. For `call_tool` and `get_prompt`, pass arguments as a JSON object string in `argumentsJson`.
29
+
30
+ Output format:
31
+
32
+ Result:
33
+ * Short direct answer based on MCP output.
34
+
35
+ Sources / records:
36
+ * MCP server, tool, resource, prompt, URLs, or records checked.
37
+
38
+ Relevant evidence:
39
+ * Small factual notes only. No long dumps.
40
+
41
+ Retrieval gaps:
42
+ * Anything unavailable or unclear.