Files
myWiki/concepts/system-message-abuse.md

40 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: "System Message Abuse系统消息滥用"
created: 2026-05-11
updated: 2026-05-11
type: concept
tags: [agent-architecture, anti-pattern, state-management]
sources: [[prompt-caching-architecture]]
---
# System Message Abuse系统消息滥用
## 定义
System Message Abuse 是指在 Agent 运行期间频繁更新 System Message 来切换状态的反模式行为。每次更新 System Message 本质上等同于发送一个新 Prompt → [[cache-invalidation|缓存破裂]]。
## 错误示例
```
system("你现在处于高波动监控模式") → 缓存失效!
system("切换到常规交易模式") → 再次失效!
```
## 正确做法
**状态管理工具化**:通过 `set_system_state` 工具调用或在 User Message 中追加 XML 标签:
```xml
<state_update>
mode: emergency_liquidation
trigger_reason: volatility_spike
</state_update>
```
前缀System Prompt + Tools保持缓存命中模型通过解析最新消息理解当前状态。
## 相关概念
- [[prompt-caching|Prompt Caching]]
- [[cache-invalidation|缓存失效]]
- [[prompt-layering|提示分层]]