Cognitive Protocol: The Upgrade Guardian
This skill defines a formal, multi-phase cognitive protocol for an agent to execute when tasked with managing an application upgrade. Its purpose is to transcend simple, static checks and provide a dynamic, intelligent analysis that prevents "silent breaking change" incidents.
This is not a script. It is a directive for higher-order reasoning.
Core Principle
An application upgrade is a high-stakes event. The agent must not trust that the upgrade is safe. The agent must assume that any change can have unintended consequences on a stable system. The goal is to make implicit environmental assumptions explicit and resilient before they break.
Protocol Activation
This protocol is activated when a human operator declares their intent to upgrade the application (e.g., "We are planning to upgrade OpenClaw from vA to vB").
Analysis Scope
Upgrade Guardian covers two categories of risks:
- 1. Configuration-level risks: Changes that affect
openclaw.json or static config files
- Breaking changes in schema or validation
- Deprecated config fields
- New required config options
- Default value changes
- 2. Runtime-level risks: Changes that affect behavior without config modifications
- Behavioral shifts in session handling, routing, or delivery
- Logic changes in compaction, memory, or agents
- Protocol-level changes (streaming, API compatibility)
- CLI UX changes (e.g.,
/new behavior)
See references/RISK_CATEGORIES.md for detailed taxonomy.
Phase 1: Information Gathering & Semantic Analysis
- 1. Ingest Release Notes: Fetch the
CHANGELOG or release notes for the target version range. - Semantic Analysis: Perform semantic analysis using patterns in
references/changelog_analysis_patterns.md.
- Do not just search for "breaking change"
- Look for behavioral shift indicators (refactor, unify, improve handling, etc.)
- Identify both config-affecting and runtime-only changes
- 3. Cross-Reference with Environment:
-
For config risks: Load
openclaw.json and identify dependencies on implicit behaviors
-
For runtime risks: Identify active workflows (cron jobs, TUI usage, session routing patterns) that may be affected
Phase 2: Risk Assessment & Scenario Planning
2.1 Formulate "What-If" Scenarios
For each identified change, generate concrete, testable failure scenarios:
Config-level examples:
- - Scenario A: "What if 'improved session handling' means a new, destructive default for unconfigured session types? → Data loss."
- Scenario B: "What if 'refactored security policy' means the
allowlist now requires explicit IP ranges? → Plugin executions fail."
Runtime-level examples:
- - Scenario C: "What if 'duplicate reply suppression' changes session routing logic? → Bot stops responding in some groups."
- Scenario D: "What if
/new now creates independent sessions instead of resetting shared session? → User workflow disrupted." - Scenario E: "What if 'streaming compatibility fix' breaks non-native OpenAI-compatible providers? → Long responses fail mid-stream."
2.2 Quantify Risk
Assign a risk score based on:
- - Impact: data loss > service outage > UX friction > cosmetic
- Likelihood: direct config/workflow overlap > tangential relation > theoretical
2.3 Generate Audit Report
Present findings to the operator using the template in references/AUDIT_REPORT_TEMPLATE.md.
Key sections:
- - Configuration risks (with jq paths and explicit mitigations)
- Runtime risks (with behavioral descriptions and verification tests)
- Risk prioritization (High/Medium/Low)
Phase 3: Mitigation & Verification
3.1 Proactive Mitigation
For config risks: Propose specific openclaw.json changes to make implicit assumptions explicit. Do not execute without operator approval.
For runtime risks: Document expected behavioral changes and suggest workflow adjustments if needed.
3.2 Verification Plan
Define clear, simple tests for each risk:
Config verification examples:
- - "Run
openclaw doctor and confirm no validation errors" - "Check
gateway.err.log for auth mode complaints"
Runtime verification examples:
- - "Send test message in group chat, verify bot responds"
- "Open TUI, run
/new, confirm it creates independent session" - "Trigger long completion from streaming provider, verify no mid-stream failure"
3.3 Post-Upgrade Audit
After the operator confirms upgrade is complete:
- 1. Execute verification plan
- Report results systematically
- Recommend rollback if critical failures detected
3.4 Archive Upgrade Artifacts (relative to workspace)
Save the upgrade write-ups and check results inside the agent workspace so they remain discoverable and portable.
Write locations (relative paths):
- - Pre-upgrade analysis report → INLINECODE13
- Post-upgrade verification report → INLINECODE14
Notes:
- - Prefer workspace-relative paths in reports (avoid hard-coded absolute home paths).
- If
kb/ is a symlink in a particular deployment, still refer to it as kb/... in the protocol/report; the filesystem mapping is an implementation detail.
References
- -
references/changelog_analysis_patterns.md - Semantic analysis patterns - INLINECODE18 - Detailed risk taxonomy
- INLINECODE19 - Report structure
- INLINECODE20 - Common verification tests
Notes
- - This protocol is designed to be conservative. It's better to flag a false positive than miss a silent breaking change.
- Runtime risks are often harder to detect than config risks. Pay extra attention to behavioral keywords like "improve", "fix", "refactor" in areas you actively use (sessions, routing, streaming).
- When in doubt, ask the operator about their workflow patterns before deeming a risk "Low" priority.
认知协议:升级守护者
该技能定义了一个正式的、多阶段的认知协议,供智能体在执行应用升级管理任务时使用。其目的是超越简单的静态检查,提供动态的智能分析,从而防止静默破坏性变更事件的发生。
这不是一个脚本。 这是一个高阶推理的指令。
核心原则
应用升级是一项高风险事件。智能体不能信任升级是安全的。智能体必须假设任何变更都可能对稳定系统产生意外后果。目标是在隐式环境假设被破坏之前,使其显式化并具备弹性。
协议激活
当人类操作员声明其升级应用的意图时(例如,我们计划将OpenClaw从vA升级到vB),该协议将被激活。
分析范围
升级守护者涵盖两类风险:
- 1. 配置级风险:影响openclaw.json或静态配置文件的变更
- 模式或验证中的破坏性变更
- 已弃用的配置字段
- 新增的必需配置选项
- 默认值变更
- 2. 运行时级风险:无需配置修改即可影响行为的变更
- 会话处理、路由或投递中的行为变化
- 压缩、内存或代理中的逻辑变更
- 协议级变更(流式传输、API兼容性)
- CLI用户体验变更(例如,/new行为)
详见references/RISK_CATEGORIES.md中的详细分类。
第一阶段:信息收集与语义分析
- 1. 获取发布说明:获取目标版本范围的CHANGELOG或发布说明。
- 语义分析:使用references/changeloganalysispatterns.md中的模式进行语义分析。
- 不要仅搜索破坏性变更
- 查找行为变化指标(重构、统一、改进处理等)
- 识别影响配置和仅影响运行时的变更
- 3. 与环境交叉引用:
-
对于配置风险:加载openclaw.json并识别对隐式行为的依赖
-
对于运行时风险:识别可能受影响的活动工作流(定时任务、TUI使用、会话路由模式)
第二阶段:风险评估与场景规划
2.1 制定假设场景
对于每个识别出的变更,生成具体、可测试的故障场景:
配置级示例:
- - 场景A:如果改进的会话处理意味着未配置会话类型的新破坏性默认值?→ 数据丢失。
- 场景B:如果重构的安全策略意味着allowlist现在需要显式IP范围?→ 插件执行失败。
运行时级示例:
- - 场景C:如果重复回复抑制改变了会话路由逻辑?→ 机器人在某些群组中停止响应。
- 场景D:如果/new现在创建独立会话而不是重置共享会话?→ 用户工作流中断。
- 场景E:如果流式兼容性修复破坏了非原生OpenAI兼容的提供商?→ 长响应在流中失败。
2.2 量化风险
根据以下因素分配风险评分:
- - 影响:数据丢失 > 服务中断 > 用户体验摩擦 > 外观问题
- 可能性:直接配置/工作流重叠 > 间接关联 > 理论可能
2.3 生成审计报告
使用references/AUDITREPORTTEMPLATE.md中的模板向操作员展示发现结果。
关键部分:
- - 配置风险(包含jq路径和明确的缓解措施)
- 运行时风险(包含行为描述和验证测试)
- 风险优先级(高/中/低)
第三阶段:缓解与验证
3.1 主动缓解
对于配置风险:提出具体的openclaw.json变更,使隐式假设显式化。未经操作员批准不得执行。
对于运行时风险:记录预期的行为变更,并在需要时建议工作流调整。
3.2 验证计划
为每个风险定义清晰、简单的测试:
配置验证示例:
- - 运行openclaw doctor并确认无验证错误
- 检查gateway.err.log中是否有认证模式投诉
运行时验证示例:
- - 在群聊中发送测试消息,验证机器人响应
- 打开TUI,运行/new,确认其创建独立会话
- 从流式提供商触发长完成,验证无流中失败
3.3 升级后审计
操作员确认升级完成后:
- 1. 执行验证计划
- 系统性地报告结果
- 如检测到关键故障,建议回滚
3.4 归档升级工件(相对于工作空间)
将升级记录和检查结果保存在智能体工作空间内,使其保持可发现性和可移植性。
写入位置(相对路径):
- - 升级前分析报告 → kb/logs/upgrade-reports/YYYY-MM-DD-to-upgrade-analysis.md
- 升级后验证报告 → kb/logs/upgrade-verifications/YYYY-MM-DD_post-upgrade-verification.txt
注意:
- - 报告中优先使用工作空间相对路径(避免硬编码的绝对主目录路径)。
- 如果kb/在特定部署中是符号链接,在协议/报告中仍将其引用为kb/...;文件系统映射是实现细节。
参考资料
- - references/changeloganalysispatterns.md - 语义分析模式
- references/RISKCATEGORIES.md - 详细风险分类
- references/AUDITREPORTTEMPLATE.md - 报告结构
- references/VERIFICATIONCHECKLIST.md - 常见验证测试
备注
- - 该协议设计为保守型。标记误报比遗漏静默破坏性变更更好。
- 运行时风险通常比配置风险更难检测。请特别关注你积极使用的领域(会话、路由、流式传输)中的行为关键词,如改进、修复、重构。
- 如有疑问,在将风险判定为低优先级之前,先向操作员询问其工作流模式。