Skip to content

feat(cli): add --append-system-prompt option - #4810

Merged
marius-kilocode merged 8 commits into
mainfrom
session/agent_92e56d9e-582a-45f5-b0d1-fa34d4297d4d
Jan 6, 2026
Merged

feat(cli): add --append-system-prompt option#4810
marius-kilocode merged 8 commits into
mainfrom
session/agent_92e56d9e-582a-45f5-b0d1-fa34d4297d4d

Conversation

@kilo-code-bot

@kilo-code-bot kilo-code-bot Bot commented Jan 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Add support for appending custom instructions to the system prompt via CLI flag.

Changes

  • Add --append-system-prompt <text> option to the CLI API
  • Pass appendSystemPrompt through CLI -> ExtensionService -> ExtensionHost -> ExtensionState
  • Integrate with system prompt generation in src/core/prompts/system.ts
  • Add tests for CLI flag parsing and system prompt appending functionality
  • Add changeset for patch release

Testing

  • Added unit tests in cli/src/__tests__/append-system-prompt.test.ts
  • Tests cover CLI flag parsing and system prompt appending logic

Usage

kilocode --append-system-prompt "Always use TypeScript strict mode" "Create a new React component"

The custom text will be appended to the system prompt when the agent runs.

Related

Implements TDD approach with tests written first, then implementation.

- Add --append-system-prompt CLI flag to append custom instructions to system prompt
- Pass appendSystemPrompt through CLI -> ExtensionService -> ExtensionHost -> ExtensionState
- Integrate with system prompt generation in src/core/prompts/system.ts
- Add tests for CLI flag parsing and system prompt appending
- Add changeset for patch release
@changeset-bot

changeset-bot Bot commented Jan 6, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 69133f6

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

This PR includes changesets to release 2 packages
Name Type
@kilocode/cli Patch
kilo-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

@kilo-code-bot

kilo-code-bot Bot commented Jan 6, 2026

Copy link
Copy Markdown
Contributor Author

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Overview

This PR adds a --append-system-prompt CLI option that allows users to append custom instructions to the system prompt. The implementation is well-structured and follows existing patterns in the codebase.

Key Changes

Area Description
CLI Layer New --append-system-prompt <text> option added to commander.js
Extension Host Setting synchronized to extension via updateSettings message
System Prompt Custom text appended at end of generated prompt with proper newline separation
Type Safety All necessary type definitions updated consistently
Tests Basic tests included for CLIOptions type and integration behavior

Implementation Quality

✅ Properly handles undefined/empty appendSystemPrompt values
kilocode_change markers correctly used for changes in shared code
✅ Consistent implementation across all layers (CLI → ExtensionHost → ClineProvider → System Prompt)
✅ Tests cover basic functionality
✅ Changeset included with correct package references

Files Reviewed (12 files)
  • .changeset/append-system-prompt-cli.md
  • cli/src/__tests__/append-system-prompt.test.ts
  • cli/src/cli.ts
  • cli/src/host/ExtensionHost.ts
  • cli/src/index.ts
  • cli/src/services/extension.ts
  • cli/src/types/cli.ts
  • cli/src/types/messages.ts
  • packages/types/src/global-settings.ts
  • src/core/prompts/system.ts
  • src/core/webview/ClineProvider.ts
  • src/shared/ExtensionMessage.ts

The appendSystemPrompt property was added to ExtensionServiceOptions but
not properly excluded from the Required<> type constraint, causing a
TypeScript error. This fix:

1. Adds appendSystemPrompt to the Omit<> list in the options type
2. Adds appendSystemPrompt as an optional property in the type union
3. Spreads appendSystemPrompt into the options object when provided
Changed single-line comment to start/end markers for the multi-line
appendSystemPrompt block in system.ts as per project conventions.
…ompt

The --append-system-prompt CLI option was not working because the value
was not being properly propagated through the full chain:

1. Added appendSystemPrompt to globalSettingsSchema in packages/types
   so it's recognized as a valid RooCodeSettings key

2. Added sync logic in ExtensionHost.syncConfigurationMessages() to send
   appendSystemPrompt to the extension via updateSettings message

3. Added appendSystemPrompt to getState() return object in ClineProvider.ts
   so it's included in ClineProviderState (which is passed to SYSTEM_PROMPT)

4. Added appendSystemPrompt to CLI's ExtensionState interface for type safety

The full data flow is now:
CLI options -> ExtensionService -> ExtensionHost.syncConfigurationMessages()
-> updateSettings message -> contextProxy.setValue() -> getState()
-> ClineProviderState -> SYSTEM_PROMPT() -> appended to prompt
@marius-kilocode
marius-kilocode enabled auto-merge (squash) January 6, 2026 14:13

@eshurakov eshurakov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚀

CLI code is Kilo Code-specific and doesn't need kilocode_change markers
since it won't be merged with upstream Roo Code.
@marius-kilocode
marius-kilocode force-pushed the session/agent_92e56d9e-582a-45f5-b0d1-fa34d4297d4d branch from 0b69406 to e54d556 Compare January 6, 2026 14:17
@marius-kilocode
marius-kilocode enabled auto-merge (squash) January 6, 2026 14:17
@marius-kilocode
marius-kilocode merged commit 2d8f5b4 into main Jan 6, 2026
12 checks passed
@marius-kilocode
marius-kilocode deleted the session/agent_92e56d9e-582a-45f5-b0d1-fa34d4297d4d branch January 6, 2026 15:31
slamj1 pushed a commit to slamj1/kilocode that referenced this pull request May 16, 2026
… display state in the command_list (resolves Kilo-Org#4582) (Kilo-Org#4810)

Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
jliounis pushed a commit to jliounis/kilocode that referenced this pull request May 18, 2026
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
… display state in the command_list (resolves Kilo-Org#4582) (Kilo-Org#4810)

Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
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