Merge pull request #446 from claude-code-best/feature/prompt-cut-down

feat: 大量系统提示词优化
This commit is contained in:
claude-code-best
2026-05-10 15:30:34 +08:00
committed by GitHub
16 changed files with 175 additions and 396 deletions

View File

@@ -452,19 +452,36 @@ export function prependUserContext(
return messages
}
return [
createUserMessage({
content: `<system-reminder>\nAs you answer the user's questions, you can use the following context:\n${Object.entries(
context,
)
.map(([key, value]) => `# ${key}\n${value}`)
.join('\n')}
// Extract claudeMd as a dedicated high-weight user message so it isn't
// buried inside the generic <system-reminder> with the "may or may not be
// relevant" disclaimer, which would degrade its instructional weight.
const { claudeMd, ...rest } = context
const result: Message[] = []
if (claudeMd) {
result.push(
createUserMessage({
content: `<project-instructions>\n${claudeMd}\n</project-instructions>\n`,
isMeta: true,
}),
)
}
const restEntries = Object.entries(rest)
if (restEntries.length > 0) {
result.push(
createUserMessage({
content: `<system-reminder>\nAs you answer the user's questions, you can use the following context:\n${restEntries
.map(([key, value]) => `# ${key}\n${value}`)
.join('\n')}
IMPORTANT: this context may or may not be relevant to your tasks. You should not respond to this context unless it is highly relevant to your task.\n</system-reminder>\n`,
isMeta: true,
}),
...messages,
]
isMeta: true,
}),
)
}
return [...result, ...messages]
}
/**