Skip to content

refactor: 优化系统提示词体系——工作流程、错误处理与语言对齐#5256

Open
menghuanshiguang wants to merge 2 commits into
esengine:main-v2from
menghuanshiguang:improve-system-prompts
Open

refactor: 优化系统提示词体系——工作流程、错误处理与语言对齐#5256
menghuanshiguang wants to merge 2 commits into
esengine:main-v2from
menghuanshiguang:improve-system-prompts

Conversation

@menghuanshiguang

Copy link
Copy Markdown

Summary

优化 Reasonix 三层 Agent 架构中全部五个系统提示词,将隐式行为显式化,减少模型猜测。

改动文件:

文件 改动
internal/config/config.go 主提示词新增:4步核心工作流、错误恢复规则(重试→报告→替代方案)、思考引导、语言跟随;移除冗余plan mode说明
internal/agent/coordinator.go 规划器提示词新增:跳过调研快捷路径、引用代码标注路径行号、审查类任务先出报告再问确认
internal/agent/task.go 子任务提示词新增:失败契约(尝试了什么→哪里失败→如何补救)、临时错误最多重试一次
internal/agent/compact.go 压缩摘要新增:Pending小节标注用户最新意图优先级
internal/boot/boot.go 组装顺序调整:项目记忆提前到策略性约束之前

Verification

  • go build ./... — 编译通过
  • go test ./internal/config/ ./internal/agent/ ./internal/boot/ ./internal/memory/ ./internal/control/ -count=1 — 全量测试通过
  • 手动冒烟测试:Planner 和 Executor 均正确遵循新工作流和错误处理规则
  • 缓存稳定性守卫测试已同步更新

Cache impact

Cache-impact: medium — 系统提示词文本变更,前缀缓存会在首次会话时刷新
Cache-guard: TestCacheHit* 和 boot 测试已更新为新的提示词文本
System-prompt-review: 已按缓存影响规范审查,所有改动涉及 provider-visible system prompt

- DefaultSystemPrompt: add error recovery guidance, thinking format hint,
  structured Core workflow; remove redundant plan-mode instructions
- DefaultPlannerPrompt: add skip-research shortcut, require file path+line refs,
  add review-before-execute rule for audit/improvement tasks
- DefaultTaskSystemPrompt: add failure contract (what was attempted / went wrong
  / parent alternative) with retry limit
- summarySystemPrompt: add user-intent priority to Pending section
- boot order: move Memory before policies for coherence, policies appended last
- boot_test.go: update stripLanguagePolicy comment for new assembly order

Cache-impact: medium — system prompt text changed, prefix cache flushed.
@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development agent Core agent loop (internal/agent, internal/control) config Configuration & setup (internal/config) labels Jun 24, 2026
@clearnature

Copy link
Copy Markdown

提示词可以使用一些训练优化方法,建议直接固定增加一个纪律监督子代理常驻监督任务,耗费不了多少流量,模型实在是无法约束住,只能直接实时监督。

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

Labels

agent Core agent loop (internal/agent, internal/control) config Configuration & setup (internal/config) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants