fix(file-reference): teach the @-mention guidance directories and the workspace root

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.
This commit is contained in:
Yichen Jiang
2026-08-24 17:05:34 +08:00
parent 4036db4450
commit 70d6e7abd6
4 changed files with 5 additions and 5 deletions
@@ -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
@@ -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
@@ -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 影响
+1 -1
View File
@@ -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 {