Skip to content

chore(agent-core-v2): slim goal and plan reminders - #4518

Closed
7Sageer wants to merge 1 commit into
chore/slim-agent-promptsfrom
chore/slim-system-reminders
Closed

7Sageer wants to merge 1 commit into
chore/slim-agent-promptsfrom
chore/slim-system-reminders

Conversation

@7Sageer

@7Sageer 7Sageer commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Requirement or Bug

长 Goal / Plan 会话每轮都重发完整提醒,动态历史开销随轮次线性增长;改为首轮及状态变化时发 full,稳定轮次发 sparse。

Bug Reproduction Steps

N/A

Root Cause

N/A

Code Changes

Stacked on #4483(从中拆出,便于单独审查状态迁移逻辑)。

Goal active 提醒的选择逻辑:

 GoalInjection.reminder(injection)
   if !isNewTurn → skip
   goal = getGoal()
-  active  → full reminder
-  blocked / paused → note
+  disclosure = { goalId, status, objective, completionCriterion, budgetBand, waitForEnabled }
+  full = status != active
+      || 尚无有效注入(含 compaction 已移除旧提醒)
+      || disclosure 与上次注入时不同
+      || 上次注入之后出现 compaction summary
+  return { content: full ? full reminder : sparse reminder, disclosure }
  • Goal sparse 模板 814 字符(full 为 3,057,均不含动态数据与 WaitFor 指引),保留 objective、验收条件、状态、进度、预算与本轮行动约束,并回指 full reminder 中的完整审计。
  • Plan sparse 从 743 / 587 字符降至各 335 字符,保留只读限制、plan 文件写法与结束本轮的方式。
  • Plan 的 full 刷新只由真实用户消息触发,其他 system injection(AGENTS.md、Todo、Goal 等提醒)不再触发;2 步 sparse、5 步 full 的节奏不变。
  • GoalInjection 新增 IAgentContextMemoryService 依赖,用于检测上次注入后的 compaction。

Behavior Changes and Affected Users

受影响人群:所有客户端(TUI、print 模式、desktop 与 web、VS Code、ACP、SDK)中使用 Goal mode 或 Plan mode 的会话。Tower reminder 不在本 PR 范围内。

Behavior Before After Who relies on the old behavior Escape hatch
Goal active reminder 每个新 turn 重发完整目标、预算、迭代流程与完成/阻塞审计 稳定 active turn 使用 sparse,保留动态目标与预算及简短行动约束 所有使用 Goal mode 的会话 新 goal 与状态变化仍注入 full;恢复旧会话时若没有有效 full disclosure 也会补发;无配置开关
Goal sparse 的完整审计 每轮都包含预算检查、bounded work、complete/blocked 的完整判断 压缩为本轮行动、完成/阻塞门槛与指回完整审计 依赖每轮完整审计的 Goal 会话 full reminder 与自动 continuation 中的完整流程仍保留;审计没有被删除
Goal 状态与预算刷新 每次都从完整模板重建,没有 full / sparse 区分 状态、目标、验收条件、预算档位或 WaitFor 可用性变化时重新 full;compaction 后也恢复 full 长 Goal 会话、暂停/恢复、接近预算及 compaction 后的会话 对应迁移由 goalInjection.test.ts 与 compaction 回归钉住;动态进度与预算仍每轮更新
UpdateGoal 描述 说每轮 reminder 都完整说明 complete / blocked 何时可用 完整说明在 full reminder,后续提醒保留当前状态并回指 所有使用 UpdateGoal 的 Goal 会话 工具行为与状态机不变
Plan sparse 的 Bash / 权限说明 sparse 重复 Bash 只按需使用及普通权限规则 删除,保留只读限制与 plan 文件 使用 Plan mode 的会话 full reminder 与普通权限规则仍约束 Bash;工具审批逻辑不变
Plan sparse 的提问与 auto 决策 重复只可询问代码无法确定的偏好,auto 下自行决定并记录 Assumptions 保留询问未决偏好,不再展开 auto 细节 Plan mode 中需要提问的会话 full reminder、auto mode reminder 与 plan 的 Assumptions 结构仍保留
Plan sparse 的多方案与文件编辑说明 重复多方案传 options、Write/Edit 的详细用法 保留 plan 文件写入、更新及 ExitPlanMode 多方案 plan 与需要写 plan 文件的会话 full reminder 与 ExitPlanMode 的 options schema / 说明
Plan full 刷新条件 任何 user-role 消息都触发 full,包括其他 system injection 仅非 injection 的 user-role 消息触发 full Plan mode 中收到 AGENTS.md、Todo、Goal 等提醒的会话 真实用户消息仍触发 full;2 步 sparse、5 步 full 节奏不变
Plan inline sparse 无 plan path 时重复偏好、auto、多方案规则 保留只读、等待 host 提供路径与结束本轮方式;禁止文字请求审批,与有 path 版本对齐 无 plan 文件路径 host 的 Plan mode 会话 full inline reminder 仍保留详细规则

Goal 的 origin.disclosure 新增当前 goal 的状态、目标、预算档位与工具可用性,用于恢复时决定是否重发 full;既有 wire record 的其他字段不变,旧会话没有该 disclosure 时按需要 full 处理。参数 schema、配置键、环境变量与 kap-server API 均未修改。文档无需更新。

测试与覆盖:

范围 覆盖
Goal / Plan 注入 goalInjection.test.ts + planModeInjection.test.ts:连续 sparse、暂停恢复、预算跨档、sparse 后 compaction、其他注入与真实用户消息
Goal / Plan 功能、compaction test/features/goal、test/features/plan、test/agent/fullCompaction 等 22 个测试文件共 646 条通过(含 Goal 十轮 continuation)

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue (external PRs: issue must have a maintainer's /approve).
  • I have added tests that prove my feature works.
  • The behavior-change table above is complete, and every removed behavior or flipped default is named in the changeset and either has an escape hatch or was explicitly approved by a maintainer in this PR.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Oct 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 505396e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T10:02:28.634444Z 505396e Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@7Hanrui

7Hanrui commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

@codex review

@pkg-pr-new

pkg-pr-new Bot commented Oct 29, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@505396e
npx https://pkg.pr.new/@moonshot-ai/kimi-code@505396e

commit: 505396e

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 505396e77f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

"@moonshot-ai/kimi-code": patch
---

Shorten repeated goal and plan mode reminders.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Name the reminder guidance that users lose

For Goal/Plan mode users who rely on repeated guidance, this release stops repeating the full Goal audit and removes Bash-permission, auto-mode assumption, and multi-approach guidance from sparse Plan reminders, with no switch to restore the previous cadence. The changeset only says reminders are “shorten[ed],” so it does not tell upgrading users what behavior is no longer available on sparse turns; name these losses and state that there is no escape hatch.

AGENTS.md reference: AGENTS.md:L115-L117

Useful? React with 👍 / 👎.

@7Sageer

7Sageer commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator Author

已由统一 PR #4521 收拢,目标分支为 release/2026-10-29;保留原分支与历史,不再单独合并此 PR。

@7Sageer 7Sageer closed this Oct 29, 2026
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.

2 participants