fix(cli): stop prepending skill_lookup $name instruction onto user turns (#1096)

Cursor ACP (and other remotes) flagged the glued-on SKILL_LOOKUP_INSTRUCTION
as prompt injection. Keep discovery on the skill_lookup MCP tool description
and on system prompts (OpenCode/Grok); do not taint user messages.

Fixes #1095

Co-authored-by: Debian <heavygee@oos-linux.in.lockhouse>
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
HeavyGee
2026-07-20 18:29:29 +01:00
committed by GitHub
co-authored by Debian Cursor
parent b74a11ecc3
commit af962fc61f
7 changed files with 30 additions and 40 deletions
+3 -11
View File
@@ -10,8 +10,6 @@ import type { PermissionMode } from './types';
import { createKimiBackend } from './utils/kimiBackend';
import { KimiPermissionHandler } from './utils/permissionHandler';
import { resolveKimiRuntimeConfig } from './utils/config';
import { SKILL_LOOKUP_INSTRUCTION } from '@/modules/common/skillLookupInstruction';
class KimiRemoteLauncher extends RemoteLauncherBase {
private readonly session: KimiSession;
private readonly model?: string;
@@ -24,8 +22,6 @@ class KimiRemoteLauncher extends RemoteLauncherBase {
private currentBackendModel: string | null = null;
private setModelSupported: boolean | undefined = undefined;
private lastDisplayedToolCall = new Map<string, string>();
private skillLookupInstructionSent = false;
constructor(session: KimiSession, opts: { model?: string }) {
super(process.env.DEBUG ? session.logPath : undefined);
this.session = session;
@@ -171,15 +167,11 @@ class KimiRemoteLauncher extends RemoteLauncherBase {
this.applyDisplayMode(batch.mode.permissionMode, batch.mode.model);
messageBuffer.addMessage(batch.message, 'user');
let messageText = batch.message;
if (!this.skillLookupInstructionSent && !messageText.trimStart().startsWith('/')) {
messageText = `${SKILL_LOOKUP_INSTRUCTION}\n\n${messageText}`;
this.skillLookupInstructionSent = true;
}
// skill_lookup discovery lives on the MCP tool description — do not
// prepend instructions onto user turns (prompt-injection false positive).
const promptContent: PromptContent[] = [{
type: 'text',
text: messageText
text: batch.message
}];
session.onThinkingChange(true);