Skip to content

Commit 13fc40e

Browse files
committed
docs: document systemPrompt rules-channel delivery
1 parent af2f198 commit 13fc40e

2 files changed

Lines changed: 36 additions & 1 deletion

File tree

‎CHANGELOG.md‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
66

7-
_No unreleased changes._
7+
- **Fixed: Cursor agent rejecting turns as "prompt injection" / "gaslighting."**
8+
The provider flattened opencode's system prompt into the user-message transcript;
9+
Cursor's agent (which has its own system prompt) treated that as an injection
10+
attempt. opencode's system prompt is now delivered through Cursor's authoritative
11+
rules channel — written to a git-ignored `.cursor/rules/opencode.mdc` and loaded
12+
via `settingSources` — so opencode keeps control without being flagged. New
13+
`systemPrompt` option: `"rules"` (default), `"message"` (legacy inline), `"omit"`.
814

915
## [0.4.4] — 2026-06-24
1016

‎README.md‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ The plugin also registers two **delegation tools**:
106106
> - Set `sandbox: true` in `provider.cursor.options` to run Cursor's tools in Cursor's sandbox.
107107
> - Use `cursor_delegate` instead of the provider path — it is gated by opencode's `permission`
108108
> config.
109+
> - By default opencode's system prompt is delivered via a git-ignored Cursor
110+
> rule (`systemPrompt: "rules"`), not inlined into the message stream. See
111+
> [System prompt](#system-prompt).
109112
110113
See [SECURITY.md](./SECURITY.md) for the full threat model.
111114

@@ -124,6 +127,7 @@ See [SECURITY.md](./SECURITY.md) for the full threat model.
124127
| `forwardMcp` | `true` | Forward opencode's configured MCP servers to the Cursor agent |
125128
| `mcpServers` | — | Extra MCP servers (Cursor `McpServerConfig` shape); merged with forwarded ones |
126129
| `toolDisplay` | `"blocks"` | How Cursor's internal tool activity is shown — see [Tool display](#tool-display) |
130+
| `systemPrompt` | `"rules"` | How opencode's system prompt reaches the agent — see [System prompt](#system-prompt) |
127131

128132
| Environment variable | Default | Meaning |
129133
| --- | --- | --- |
@@ -174,6 +178,31 @@ To set controls statically per model:
174178
} } } }
175179
```
176180

181+
## System prompt
182+
183+
opencode drives the Cursor agent the way it drives any provider — through its
184+
**system prompt**. But the Cursor SDK has no system-prompt input (an agent, not a
185+
raw model), and flattening opencode's system prompt into the message stream makes
186+
injection-hardened Cursor models reject it as a prompt-injection attempt.
187+
188+
So by default (`systemPrompt: "rules"`) the plugin writes opencode's system prompt
189+
to `<cwd>/.cursor/rules/opencode.mdc` (`alwaysApply: true`, git-ignored) and loads
190+
the `project` settings layer, delivering it through Cursor's **authoritative rules
191+
channel**. Cursor treats rules as system-level instructions, so opencode stays in
192+
control and nothing is flagged.
193+
194+
Tradeoffs to know:
195+
196+
- A project rule also applies to **your own Cursor IDE** open on this repo. The
197+
plugin removes the file when the session disposes (best-effort).
198+
- Enabling the `project` layer also loads other `.cursor/` config (`.cursor/mcp.json`,
199+
`.cursor/agents`, hooks).
200+
201+
Alternatives:
202+
203+
- `systemPrompt: "message"` — legacy inline delivery (may be rejected as injection).
204+
- `systemPrompt: "omit"` — don't forward the system prompt at all.
205+
177206
## MCP servers
178207

179208
With `forwardMcp: true` (default), the Cursor agent uses the same MCP servers configured in

0 commit comments

Comments
 (0)