Skip to content

feat(agent-core): refine system prompt context#777

Merged
RealKai42 merged 3 commits into
mainfrom
kaiyi/polish-sp
Jun 15, 2026
Merged

feat(agent-core): refine system prompt context#777
RealKai42 merged 3 commits into
mainfrom
kaiyi/polish-sp

Conversation

@RealKai42

Copy link
Copy Markdown
Collaborator

Related Issue

No linked issue. This PR polishes the system prompt context based on direct prompt-review feedback.

Problem

The default system prompt spent tokens on hidden directory contents and a long AGENTS.md explanation, while dynamic prompt context was mixed into the surrounding guidance. It also gave no signal when AGENTS.md files were truncated by the prompt budget.

What changed

  • Collapse hidden directories in the workspace directory snapshot while keeping the top-level entries visible.
  • Add prompt guidance for inspecting hidden paths with Glob, Read, and Grep.
  • Compress the AGENTS.md prompt guidance and move dynamic AGENTS/skill context after the static rules.
  • Add a marker when AGENTS.md content is truncated or omitted because of the prompt budget.
  • Cover the new behavior with focused prompt/profile tests.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

Tests run:

pnpm --filter @moonshot-ai/agent-core exec vitest run test/tools/list-directory.test.ts test/profile/context.test.ts test/profile/default-agent-profiles.test.ts test/prompt-placeholders.test.ts test/session/subagent-host.test.ts
pnpm --filter @moonshot-ai/agent-core typecheck
pnpm exec oxlint packages/agent-core/src/tools/support/list-directory.ts packages/agent-core/src/profile/context.ts packages/agent-core/test/tools/list-directory.test.ts packages/agent-core/test/session/subagent-host.test.ts packages/agent-core/test/profile/context.test.ts packages/agent-core/test/profile/default-agent-profiles.test.ts

Keep hidden directory entries visible in the cwd snapshot while omitting their contents to reduce prompt noise, and document the tools models should use to inspect hidden paths.
Add a marker when AGENTS.md content is truncated by the prompt budget and move dynamic system prompt context after the static guidance.
@changeset-bot

changeset-bot Bot commented Jun 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3458ed7

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

This PR includes changesets to release 2 packages
Name Type
@moonshot-ai/agent-core Patch
@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

@pkg-pr-new

pkg-pr-new Bot commented Jun 15, 2026

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

commit: 3458ed7

@RealKai42 RealKai42 merged commit 4516f62 into main Jun 15, 2026
9 checks passed
@RealKai42 RealKai42 deleted the kaiyi/polish-sp branch June 15, 2026 10:38
@github-actions github-actions Bot mentioned this pull request Jun 15, 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.

1 participant