From 70d6e7abd6096354cdf28072a594c18e00a87257 Mon Sep 17 00:00:00 2001 From: Yichen Jiang Date: Mon, 24 Aug 2026 17:05:34 +0800 Subject: [PATCH] fix(file-reference): teach the @-mention guidance directories and the workspace root MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Field test: the model received a bare '@niulai/' and guessed a user mention — the guidance section was present but said only that @-prefixed paths are files, never covering the trailing-slash directory form, the workspace-relative root, or the quoted spelling. Rewrite the section to name all three; the section's presence conditions and every consumer pin the constant, so nothing else moves. --- packages/context/file-reference-local/README.i18n.yaml | 4 ++-- packages/context/file-reference-local/README.md | 2 +- packages/context/file-reference-local/README.zh.md | 2 +- packages/context/file-reference/src/index.ts | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/context/file-reference-local/README.i18n.yaml b/packages/context/file-reference-local/README.i18n.yaml index 475baf10db..9be1063d1c 100644 --- a/packages/context/file-reference-local/README.i18n.yaml +++ b/packages/context/file-reference-local/README.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write packages/context/file-reference-local/README.md -README.md: 67b07eef4b59fdcc5e21104cac4628feb1c15f4e -README.zh.md: beded13250daf041294e4e2656d0e1374407ff94 +README.md: 588b58b263d1c35e2285096af01808d363415d0c +README.zh.md: cd74d62067043be21392af541c49b5236002a911 diff --git a/packages/context/file-reference-local/README.md b/packages/context/file-reference-local/README.md index 67b07eef4b..588b58b263 100644 --- a/packages/context/file-reference-local/README.md +++ b/packages/context/file-reference-local/README.md @@ -27,7 +27,7 @@ When the addressed agent has an effective `read` tool, the provider contributes ##### File-reference instruction ```markdown -Paths prefixed with @ are files explicitly referenced by the user. Use the read tool when their contents are needed; do not claim to have inspected a file before reading it. +Tokens prefixed with @ are workspace paths the user explicitly referenced, relative to the workspace root. A trailing slash marks a directory: list it when its contents matter. Anything else is a file: use the read tool when its contents are needed, and do not claim to have inspected it before reading. @"..." quotes a path containing spaces. ``` #### Token effect diff --git a/packages/context/file-reference-local/README.zh.md b/packages/context/file-reference-local/README.zh.md index beded13250..cd74d62067 100644 --- a/packages/context/file-reference-local/README.zh.md +++ b/packages/context/file-reference-local/README.zh.md @@ -27,7 +27,7 @@ ##### 文件引用指令 ```markdown -Paths prefixed with @ are files explicitly referenced by the user. Use the read tool when their contents are needed; do not claim to have inspected a file before reading it. +Tokens prefixed with @ are workspace paths the user explicitly referenced, relative to the workspace root. A trailing slash marks a directory: list it when its contents matter. Anything else is a file: use the read tool when its contents are needed, and do not claim to have inspected it before reading. @"..." quotes a path containing spaces. ``` #### Token 影响 diff --git a/packages/context/file-reference/src/index.ts b/packages/context/file-reference/src/index.ts index ca8c017236..45da48c929 100644 --- a/packages/context/file-reference/src/index.ts +++ b/packages/context/file-reference/src/index.ts @@ -15,7 +15,7 @@ export type { ActiveAtToken } from './grammar.ts' export type { FileReferenceCandidate } from './types.ts' /** Model guidance for path-only references selected by a user interface. */ -export const FILE_REFERENCE_PROMPT = 'Paths prefixed with @ are files explicitly referenced by the user. Use the read tool when their contents are needed; do not claim to have inspected a file before reading it.' +export const FILE_REFERENCE_PROMPT = 'Tokens prefixed with @ are workspace paths the user explicitly referenced, relative to the workspace root. A trailing slash marks a directory: list it when its contents matter. Anything else is a file: use the read tool when its contents are needed, and do not claim to have inspected it before reading. @"..." quotes a path containing spaces.' declare module '@deepseek-ai/cordis' { interface Context {