Skip to content

fix(prompts): preserve scoped instruction context#258

Open
YOMXXX wants to merge 1 commit into
TencentCloud:mainfrom
YOMXXX:fix/scoped-instruction-prompt-guardrails
Open

fix(prompts): preserve scoped instruction context#258
YOMXXX wants to merge 1 commit into
TencentCloud:mainfrom
YOMXXX:fix/scoped-instruction-prompt-guardrails

Conversation

@YOMXXX

@YOMXXX YOMXXX commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Description | 描述

Add conservative L1 prompt guardrails so scene-limited user instructions are preserved as scoped rules instead of being generalized into unconditional global behavior.

This addresses the over-generalization path described in #48 without changing schema or storage:

  • L1 extraction now tells the model to keep explicit applicability conditions in content for instruction memories.
  • L1 conflict detection now compares instruction scope before merge/update and preserves valid scope qualifiers in merged_content.
  • Dedup now warns against automatically raising merged_priority for scoped/diagnostic instructions during merge.
  • Focused tests lock these prompt constraints in place.

Related Issue | 关联 Issue

Fixes #48

Verification | 验证

  • RED: npm test -- src/core/prompts/l1-scoped-instruction.test.ts failed because guardrails were absent
  • GREEN: npm test -- src/core/prompts/l1-scoped-instruction.test.ts
  • npm test
  • npm run build

Signed-off-by: 李冠辰 <liguanchen@xiaomi.com>
@Maxwell-Code07

Copy link
Copy Markdown
Collaborator

We have received multiple PRs submitted by you. Thank you for your consistent contributions. We will review them one by one and provide feedback accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] L1 指令提取缺少场景限定机制,用户的场景受限偏好被泛化为全局规则

2 participants