Skip to content

The open-source app everyone uses to manage agents at work

cursor adapter: pipe prompts over stdin

Dottabc68c3a504a7
diff --git a/packages/adapters/cursor-local/src/index.ts b/packages/adapters/cursor-local/src/index.ts
index 15bbb9d565..b83a92dfd2 100644
--- a/packages/adapters/cursor-local/src/index.ts
+++ b/packages/adapters/cursor-local/src/index.ts
@@ -76,7 +76,7 @@ Operational fields:
Notes:
- Runs are executed with: agent -p --output-format stream-json ...
-- Prompts are passed as a final positional argument.
+- Prompts are piped to Cursor via stdin.
- Sessions are resumed with --resume when stored session cwd matches current cwd.
- Paperclip auto-injects local skills into "~/.cursor/skills" when missing, so Cursor can discover "$paperclip" and related skills on local runs.
- Paperclip auto-adds --trust unless one of --trust/--yolo/-f is already present in extraArgs.
diff --git a/packages/adapters/cursor-local/src/server/execute.ts b/packages/adapters/cursor-local/src/server/execute.ts
index ad2f02e28f..66fad0b59f 100644
--- a/packages/adapters/cursor-local/src/server/execute.ts
+++ b/packages/adapters/cursor-local/src/server/execute.ts
@@ -301,6 +301,7 @@ export async function execute(ctx: AdapterExecutionContext): Promise<AdapterExec
if (autoTrustEnabled) {
notes.push("Auto-added --trust to bypass interactive workspace trust prompt.");
}
+ notes.push("Prompt is piped to Cursor via stdin.");
if (!instructionsFilePath) return notes;
if (instructionsPrefix.length > 0) {
notes.push(
@@ -334,7 +335,6 @@ export async function execute(ctx: AdapterExecutionContext): Promise<AdapterExec
if (mode) args.push("--mode", mode);
if (autoTrustEnabled) args.push("--trust");
if (extraArgs.length > 0) args.push(...extraArgs);
- args.push(prompt);
return args;
};
@@ -346,10 +346,7 @@ export async function execute(ctx: AdapterExecutionContext): Promise<AdapterExec
command,
cwd,
commandNotes,
- commandArgs: args.map((value, idx) => {
- if (idx === args.length - 1) return `<prompt ${prompt.length} chars>`;
- return value;
- }),
+ commandArgs: args,
env: redactEnvForLogs(env),
prompt,
context,
@@ -385,6 +382,7 @@ export async function execute(ctx: AdapterExecutionContext): Promise<AdapterExec
env,
timeoutSec,
graceSec,
+ stdin: prompt,
onLog: async (stream, chunk) => {
if (stream !== "stdout") {
await onLog(stream, chunk);
diff --git a/server/src/__tests__/cursor-local-execute.test.ts b/server/src/__tests__/cursor-local-execute.test.ts
index 70776ac2bf..937315d0c7 100644
--- a/server/src/__tests__/cursor-local-execute.test.ts
+++ b/server/src/__tests__/cursor-local-execute.test.ts
@@ -11,7 +11,7 @@ const fs = require("node:fs");
const capturePath = process.env.PAPERCLIP_TEST_CAPTURE_PATH;
const payload = {
argv: process.argv.slice(2),
- prompt: process.argv.at(-1) ?? "",
+ prompt: fs.readFileSync(0, "utf8"),
paperclipEnvKeys: Object.keys(process.env)
.filter((key) => key.startsWith("PAPERCLIP_"))
.sort(),
@@ -96,6 +96,7 @@ describe("cursor execute", () => {
expect(result.errorMessage).toBeNull();
const capture = JSON.parse(await fs.readFile(capturePath, "utf8")) as CapturePayload;
+ expect(capture.argv).not.toContain("Follow the paperclip heartbeat.");
expect(capture.argv).not.toContain("--mode");
expect(capture.argv).not.toContain("ask");
expect(capture.paperclipEnvKeys).toEqual(