Skip to content

chore(agent-core-v2): slim prompts and reminders - #4521

Merged
7Sageer merged 3 commits into
release/2026-10-30from
chore/slim-prompts-release-2026-10-29
Oct 30, 2026
Merged

7Sageer merged 3 commits into
release/2026-10-30from
chore/slim-prompts-release-2026-10-29

Conversation

@7Sageer

@7Sageer 7Sageer commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Requirement or Bug

将 #4466、#4476、#4483、#4518 合并为一个发布 PR,精简工具、system prompt 与 Goal / Plan 提醒,降低长会话的 prompt 开销。

Bug Reproduction Steps

N/A

Root Cause

N/A

Code Changes

不 rebase 原 stacked 分支;从 release/2026-10-29 新建分支,以 squash merge 收拢四个 PR 的最终内容。不包含无关的 #4457;release 已有 #4456 的等价提交。

工具描述
  删除参数 schema、运行时返回、模式提醒已承接的重复文本
  Bash 描述改为按实际后台与超时能力渲染
  Edit 不再强制每次调用前 Read,保留同文件连续 Edit 之间的重读

system prompt / subagent
  拆分 Coding、Delivering work、Project information 片段
  只读 Explore / Plan profile 不接收编码与可写交付规则
  保留完整 AGENTS.md、Plan 使用方式与工具授权边界
  系统层恢复未经用户、AGENTS.md 或 skill 授权不得启动 subagent,保留 swarm / tower 例外

Goal / Plan 动态提醒
  Goal:首轮、状态或披露信息变化、compaction 后发送 full;稳定 active 轮次发送 sparse
  Plan:保留完整与简短提醒节奏,缩短 sparse;其他 system injection 不再误触发 full

Behavior Changes and Affected Users

受影响人群:TUI、print、desktop / web、VS Code、ACP、SDK 中接收内置提示词的会话;Goal / Plan 的 full / sparse 变化只影响使用对应模式的会话,Tower 动态提醒不在范围内。

以下行为变化与逐句承接关系沿用已审查的 #4466、#4476、#4483、#4518;本 PR 没有新增超出这四个 PR 的产品行为。

Behavior Before After Who relies on the old behavior Escape hatch
Cron 工具描述 展开 cron 示例、返回字段、调度与任务管理细节 保留会话生命周期、管理入口、7 天过期等产品规则,其余由 schema、返回值与错误承接 使用 Cron 的主 agent 工具参数与运行时行为不变;完整逐句表见 #4466
Read / Bash / Agent 描述 重复路径、编码、shell 常识、后台任务与附件细节 保留安全、并行、后台及子 agent 授权规则,删除重复说明 使用这些工具的主 agent 与子 agent schema、状态块、错误与其他提示词承接;完整逐句表见 #4466 / #4476
Bash 描述生成 按 Markdown 原文替换后台与超时说明 按实际能力通过模板变量渲染 禁用后台任务或使用不同超时配置的 agent bashAutoBackgroundOnTimeout 与后台能力判定不变;执行行为不变
Glob / Grep / Write / Edit 描述 重复 pattern、分页、路径、mode 与换行规则 由参数 schema 与动态结果承接,保留跨工具路由及必要约束 使用文件工具的会话 工具输入与执行行为不变;完整逐句表见 #4476 / #4483
Edit 前置 Read 每次 Edit 前都必须 Read,禁止依据已有上下文编辑 不再强制每次前置 Read;同文件连续 Edit 之间仍要求重读 依赖提示词强制刷新文件内容的会话 Read 视图 schema 与连续编辑重读规则仍保留;无恢复开关,删除已获维护者确认
ReadMediaFile 描述 展开附件存储、元数据、坐标、压缩失败与恢复规则 保留并行、生成后回读与大小上限,其余由参数和实际结果承接 读取图片或视频的会话 buildMediaNote、参数 schema 与运行时错误保留具体指引
TaskList / TaskOutput / WaitFor 描述 重复任务字段、等待参数、超时与返回结构 保留防轮询、压缩后重新枚举 ID 与归属规则 使用后台任务的 agent schema、formatTaskRecord 与实际返回承接;等待与通知机制不变
Plan / Goal 工具描述 重复 Plan 提问、多方案、Goal 完成与阻塞审计 由对应模式提醒及参数 schema 承接 使用 Plan / Goal 的会话 full reminder 保留审计与使用规则;工具状态机不变
system prompt 与只读 profile 所有内置 profile 接收完整 Coding / 可写交付规则,且重复 subagent 与通知说明 只读 profile 使用精简只读交付规则;其余 profile 保留编码规则与完整 AGENTS.md;系统级 subagent 授权禁令保留 内置 coder、Explore、Plan、Tower worker 工具清单、AGENTS.md 注入和授权边界不变;完整表见 #4483
Goal active reminder 每个新 turn 重发完整目标、预算、流程与审计 稳定 active turn 使用 sparse,保留动态目标、预算与行动约束 所有 Goal mode 会话 新 goal、状态或披露变化、compaction 后仍发送 full;无配置开关
Goal sparse 的完整审计 每轮包含 complete / blocked 的完整判断 sparse 保留完成 / 阻塞门槛并回指 full 依赖每轮完整审计的 Goal 会话 full reminder 与自动 continuation 的完整流程不变
Goal 状态与预算刷新 每次从完整模板重建 目标、验收条件、预算档位或 WaitFor 可用性变化时重发 full 长 Goal、暂停恢复、接近预算及 compaction 后的会话 动态进度与预算每轮更新;迁移由注入与 compaction 测试覆盖
Plan sparse 重复 Bash 权限、auto 决策、多方案与文件编辑细节 保留只读、plan 文件与结束本轮方式 Plan mode 会话 full reminder、ExitPlanMode schema 与普通权限规则仍保留
Plan full 刷新 任何 user-role 消息都触发 full,包括 system injection 仅真实用户消息触发 full 接收 AGENTS.md、Todo、Goal 等注入的 Plan 会话 真实用户消息仍触发 full;2 步 sparse、5 步 full 节奏不变
Plan inline sparse 无 plan path 时重复偏好、auto 与多方案规则 保留只读、等待 host 提供路径与审批方式 无 plan path host 的 Plan 会话 full inline reminder 保留详细规则
Prompt cache 沿用旧工具和 system prompt 文本 升级后的新请求重新计算前缀 所有已有会话 一次性 cache miss,后续恢复正常

参数结构、配置键、环境变量、kap-server API、工具执行状态机与 cron 调度未修改。Goal 的 origin.disclosure 新增用于恢复 full / sparse 选择的状态;旧会话没有 disclosure 时按需要 full 处理。

测试与覆盖:

范围 结果
本次 subagent 授权修复 agentProfileCatalog 58 条、loop / fullCompaction 218 条全部通过
合并后 Goal / Plan / compaction / Edit / loop / tool 定向回归 431 条中 430 条通过;唯一失败为已知的 foreground subagent times out base 30 秒超时,本 PR 未改该路径
profile、config、Read、Bash 补充回归 318 条通过
agent-core-v2 typecheck 通过
仓库 pnpm lint 0 errors;既有 warnings
GitHub CI 全部通过;PR merge state 为 CLEAN
合并范围 55 个文件全部来自 #4466 / #4476 / #4483 / #4518;无 #4457 文件;git diff --check 通过

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue (external PRs: issue must have a maintainer's /approve).
  • I have updated existing tests to cover behavior changes.
  • 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, retaining the two confirmed changesets from the stacked PRs.
  • 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: cee5a7e

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

@7Hanrui

7Hanrui commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

@codex review

@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-30T06:31:07.992449Z cee5a7e 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.

@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@cee5a7e
npx https://pkg.pr.new/@moonshot-ai/kimi-code@cee5a7e

commit: cee5a7e

@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: fbccf610ff

ℹ️ 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".

Comment on lines +177 to +179
agents_section:
agentsMd.length > 0 || options.readOnly !== true
? renderPrompt(PROJECT_INFORMATION_SECTION, {

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 Preserve scoped AGENTS.md discovery for read-only profiles

When Explore or Plan starts at a cwd with no applicable AGENTS.md but investigates a subtree that has one, this condition removes the entire Project information section, including the instruction to discover more-specific files. Initial loading only walks cwd ancestors (agent/profile/context.ts:195-205), while the later discovery reminder says to read them only “before making changes” (agentsMdReminderService.ts:350-355), which does not direct these read-only profiles to apply them while analyzing or planning. Such subagents can therefore silently return findings or plans that violate the target subtree's rules; retain the discovery instruction even when the initially rendered content is empty.

AGENTS.md reference: AGENTS.md:L119-L121

Useful? React with 👍 / 👎.

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

Shorten built-in tool and subagent prompts.

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 removed behaviors in both changesets

For users of Edit and Goal mode, this generic release note—and the equivalent line in .changeset/slim-goal-plan-reminders.md—does not disclose the actual losses: Edit no longer requires a fresh Read, and stable Goal turns no longer repeat the full completion/blocked audit. These are user-visible prompt behaviors without restoration switches, so the changesets need to name what users lose rather than describing the change only as shortening prompts.

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

Useful? React with 👍 / 👎.

When the requested time is approximate, avoid minute 0 and 30 so fires from many users do not land at once: "around 9" → `57 8 * * *`, "hourly" → `7 * * * *`.

## One-shot tasks (recurring: false)
Tasks fire only while this session is alive and idle, and never carry over to a new session. Missed fires collapse into one delivery with `coalescedCount` > 1: act on the latest state once. The final fire carries `stale="true"`, so call CronCreate again with the same `cron` and `prompt` if the schedule is still wanted.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Limit final-fire guidance to recurring cron tasks

For a one-shot reminder (recurring=false), processDue skips coalescing and isStaleAt always returns false, so its only fire has coalescedCount="1" and stale="false" before the task is deleted. This new sentence presents both coalescing and stale="true" as properties of every task, which gives Cron users and the model an incorrect lifecycle contract for one-shots; qualify these behaviors as recurring-task behavior and state separately that one-shots fire once and auto-delete without becoming stale.

AGENTS.md reference: AGENTS.md:L119-L121

Useful? React with 👍 / 👎.

@7Hanrui

7Hanrui commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: dde3480520

ℹ️ 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".

@7Hanrui

7Hanrui commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: cee5a7e317

ℹ️ 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".

@7Sageer
7Sageer merged commit dbb65af into release/2026-10-30 Oct 30, 2026
14 checks passed
@7Sageer
7Sageer deleted the chore/slim-prompts-release-2026-10-29 branch October 30, 2026 07:18
@github-actions github-actions Bot mentioned this pull request Oct 30, 2026
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 1, 2026
Sets `@moonshot-ai/kimi-code` to 2.4.1 and carries the upstream changelog
entries for the release: the Read output cap (MoonshotAI#4553), the shortened tool and
subagent prompts (MoonshotAI#4521), and the shortened goal and plan-mode reminders
(MoonshotAI#4521). This fork follows upstream versions and does not publish on its own;
these entries record what upstream shipped, and the fork's own patch stream
keeps its changesets until a release consumes them.
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.

3 participants