Skip to content

feat(agent-core-v2): add hostIdentity domain for host-overridable system prompt identity#2144

Open
sailist wants to merge 2 commits into
MoonshotAI:mainfrom
sailist:feat/host-identity-system-prompt
Open

feat(agent-core-v2): add hostIdentity domain for host-overridable system prompt identity#2144
sailist wants to merge 2 commits into
MoonshotAI:mainfrom
sailist:feat/host-identity-system-prompt

Conversation

@sailist

@sailist sailist commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

No linked issue — the problem is explained below.

Problem

The base system-prompt template hardcodes the product name ("Kimi Code CLI") and a terminal-oriented reply-style guide (Markdown rendering in a terminal). Products that embed the engine through kap-server — for example a desktop app — host agents whose replies are not rendered in a terminal, but they have no way to adjust the product identity or the reply-style guidance in the system prompt.

What changed

  • Added a new App-scope hostIdentity domain (L3) in agent-core-v2 that holds host-injected productName / replyStyleGuide overrides, plus a hostIdentitySeed for composition roots; the registered default carries no overrides.
  • The base system.md template now renders ${product_name} and ${reply_style_guide} slots, falling back to the CLI defaults (DEFAULT_PRODUCT_NAME / DEFAULT_REPLY_STYLE_GUIDE) when the host provides no override.
  • AgentProfileService seeds these template variables from IHostIdentity when building the system-prompt context.
  • kap-server's ServerStartOptions gained a hostIdentity option, applied at bootstrap to every agent the server hosts.
  • Added tests covering the CLI-default fallback and the host-override rendering.

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.

…tem prompt identity

- add app-scope hostIdentity domain (L3) with productName / replyStyleGuide
  overrides and hostIdentitySeed for composition roots
- render ${product_name} and ${reply_style_guide} in the base system prompt,
  falling back to CLI defaults when the host provides no override
- seed the variables from AgentProfileService via IHostIdentity
- expose hostIdentity on kap-server's ServerStartOptions
@changeset-bot

changeset-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b62750c

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/agent-core-v2 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 Jul 24, 2026

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

commit: b62750c

@sailist
sailist force-pushed the feat/host-identity-system-prompt branch from a5a3900 to b62750c Compare July 24, 2026 08:44

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

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

// through `opts.seeds`, which override this entry (last seed wins).
...hostRequestHeadersSeed({ 'User-Agent': `kimi-code-cli/${hostVersion}` }),
...skillCatalogRuntimeOptionsSeed(opts.skillDirs),
...hostIdentitySeed(opts.hostIdentity),

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 Seed web hosts with non-terminal prompt identity

When the bundled kimi web path starts this server it does not pass hostIdentity (checked apps/kimi-code/src/cli/sub/web/run.ts:269-288), so this seed is empty and systemPromptVars falls back to the CLI terminal wording. For browser-hosted sessions the model still receives terminal-specific reply guidance, defeating the new host override for an existing non-terminal host; pass a web/GUI identity from that start path or choose a non-terminal default when serving web assets.

AGENTS.md reference: AGENTS.md:L18-L18

Useful? React with 👍 / 👎.

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