-
Notifications
You must be signed in to change notification settings - Fork 909
feat: Harden the default system prompt and built-in tool descriptions #1102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
47341e3
feat(agent-core): strengthen default system prompt
RealKai42 e775898
feat(agent-core): hoist key working rules into the system prompt
RealKai42 c3d5634
fix: clarify guidelines for file pattern matching and tool usage in e…
RealKai42 76a7258
fix(agent-core): hide the Skills section from agents without the Skil…
RealKai42 779d4fe
Merge remote-tracking branch 'origin/main' into kaiyi/madison
RealKai42 88221b4
fix(agent-core): gate Agent, background-task, and TodoList guidance b…
RealKai42 3deba36
refactor(agent-core): move Agent-delegation and Glob-anchor guidance …
RealKai42 33bed31
test(agent-core): add guidance for blast-radius and concrete examples…
RealKai42 4ebe763
Merge remote-tracking branch 'origin/main' into kaiyi/madison
RealKai42 e7ae4b1
docs: update descriptions for skill-tool and fetch-url; enhance web-s…
RealKai42 07cc7b4
feat(agent-core): disclose enforced constraints in tool descriptions;…
RealKai42 2822e32
fix(agent-core): soften AskUserQuestion answers-keying wording to mat…
RealKai42 71623d0
feat(agent-core): tighten Bash/Grep/Write/Edit tool descriptions
RealKai42 7e7a9ba
feat(agent-core): refine plan-mode/todo/cron tool descriptions
RealKai42 d881b5c
refactor(agent-core): dedupe ExitPlanMode options docs into the param…
RealKai42 9e843f5
Merge remote-tracking branch 'origin/main' into kaiyi/madison
RealKai42 c84917d
fix(agent-core): correct prompt/code inaccuracies found in the final …
RealKai42 469625b
fix(agent-core): gate prompt tool guidance on runtime availability, n…
RealKai42 def27e6
fix(agent-core): exempt the plan-mode plan file from the Write *.md ban
RealKai42 d65132a
fix(agent-core): scope plan-mode prompt guidance and the Write *.md b…
RealKai42 8ebfd75
refactor(agent-core): move tool-coupled guidance into tool descriptions
RealKai42 c76c302
fix(skill-tool): clarify no-reinvoke guard and argument handling in t…
RealKai42 ea032f7
feat(fetch-url): indicate content retrieval mode in output for better…
RealKai42 9ccf56c
fix(agent-core): correct goal-budget rounding and task-output failure…
RealKai42 163ca3e
fix(agent-core): scope free-work guidance by role and steer one-shots…
RealKai42 410e492
fix(enter-plan-mode): clarify availability of Agent tool in plan mode…
RealKai42 7f344b6
fix(agent-core): surface Grep count_matches total and pagination in o…
RealKai42 2cd1767
fix(grep): reorder count summary and results in output for clarity
RealKai42 76676fd
Merge remote-tracking branch 'origin/main' into kaiyi/madison
RealKai42 9e368de
chore(changeset): consolidate prompt-hardening changesets into one
RealKai42 3f5478a
fix(agent-core): stop the agent from blocking on background tasks
RealKai42 de61971
Merge branch 'main' into kaiyi/madison
RealKai42 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@moonshot-ai/kimi-code": patch | ||
| --- | ||
|
|
||
| Harden the default system prompt and built-in tool descriptions: stop the agent from blocking on background tasks it should let run, keep its guidance matched to the tools each profile actually provides, and surface tool-result details (fetched-page mode, Grep match totals) it previously missed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
packages/agent-core/src/tools/builtin/collaboration/agent-background-enabled.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,3 @@ | ||
| When `run_in_background=true`, the subagent runs detached from this turn. The completion arrives in a later turn as a synthetic user-role message containing its result — you do not need to poll, sleep, or check on its progress. Continue with other work or respond to the user. Never fabricate or predict what the result will say. | ||
|
|
||
| Default to a foreground subagent (omit `run_in_background`) when your next step needs its result — foreground hands the result straight back. Reach for `run_in_background=true` only when you have other work to do while it runs and do not need its result to proceed. Never launch in the background and then immediately wait on it (with `TaskOutput` or otherwise): that just blocks the turn for no benefit — run it in the foreground instead. |
4 changes: 3 additions & 1 deletion
4
packages/agent-core/src/tools/builtin/collaboration/agent-swarm.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,11 @@ | ||
| Launch multiple subagents from one prompt template, existing agent resumes, or both. | ||
|
|
||
| Use AgentSwarm when many subagents should run the same kind of task over different inputs. The placeholder is exactly `{{item}}`. For example, with `prompt_template` set to `Review {{item}} for likely regressions.` and `items` set to `["src/a.ts", "src/b.ts"]`, AgentSwarm launches two new subagents with those two concrete prompts. | ||
| Use AgentSwarm when many subagents should run the same kind of task over different inputs. The placeholder is exactly `{{item}}`. For example, with `prompt_template` set to `Review {{item}} for likely regressions.` and `items` set to `["src/a.ts", "src/b.ts"]`, AgentSwarm launches two new subagents with those two concrete prompts. For a few differently-shaped tasks, make separate `Agent` calls in one message instead. | ||
|
|
||
| Use `resume_agent_ids` to continue subagents that already exist from earlier work, such as ones that failed or timed out: map each agent id to the prompt for that resumed subagent (usually `continue` if no extra information is needed). You may combine `resume_agent_ids` with `items` in the same call to resume existing subagents and launch new ones. Do not duplicate resumed work in `items`. | ||
|
|
||
| Each of these is enforced — a violation is rejected before any subagent starts: provide at least 2 `items` unless you pass `resume_agent_ids`; whenever `items` are present, `prompt_template` is required and must contain `{{item}}`; and the filled-in prompts must be distinct (two items that expand to the same prompt are rejected). | ||
|
|
||
| Use enough subagents to keep the work focused and parallel. AgentSwarm supports up to 128 subagents, and launches are queued automatically, so it is safe to split large tasks into many clear, independent items. | ||
|
|
||
| If `AgentSwarm` is called, that call must be the only tool call in the response. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/agent-core/src/tools/builtin/collaboration/skill-tool.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| Invoke a registered skill from the current skill listing. BLOCKING REQUIREMENT: when a skill from the listing matches the user's request, you MUST call this tool (not free-form text). Do NOT call the same skill repeatedly inside one turn — recursive depth is capped at {{ MAX_SKILL_QUERY_DEPTH }}. | ||
| Invoke a registered skill from the current skill listing. BLOCKING REQUIREMENT: when a skill from the listing matches the user's request, you MUST call this tool (not free-form text). Do not re-invoke a skill to repeat work already done: if a `<kimi-skill-loaded>` block for it with the same `args` is already present in the conversation, follow those instructions directly instead of calling the tool again. Do call the tool again when you need the skill with different arguments — the loaded block was expanded with the earlier `args` and will not reflect new inputs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fresh evidence beyond the earlier Agent-gating findings is this newly added
AgentSwarmdescription: in a custom profile that exposesAgentSwarmbut trimsAgent, the model still receives this tool description while theAgenttool is absent from the schema, so the recommended fallback for differently-shaped tasks points it at a call it cannot make. Qualify this fallback with “ifAgentis available” or describe anAgentSwarm-only alternative.Useful? React with 👍 / 👎.