Skip to content

Conversation

@ericcurtin
Copy link
Contributor

The /set system command allows users to set or update the system message during interactive sessions. The system prompt is now included in the message history sent to the chat endpoint, enabling customized behavior for the AI assistant.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @ericcurtin, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the interactive command-line interface by introducing a new /set system command. This command empowers users to define a custom system message that will be included at the beginning of the message history for all subsequent interactions with the AI assistant. This allows for dynamic customization of the AI's persona or instructions within an ongoing conversation, leading to more tailored and effective responses.

Highlights

  • New Command Added: A new /set system command has been introduced to the interactive CLI mode, allowing users to define a system message.
  • System Message Customization: Users can now set or update a system message during interactive sessions, which will influence the AI's behavior.
  • Message History Integration: The defined system prompt is now prepended to the message history sent to the chat endpoint, ensuring the AI receives the custom instructions.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • The /set system handling uses HasPrefix on the raw line, so input like /set systematics will be interpreted as the command; consider matching on an exact token (e.g., /set system followed by whitespace or EOL) to avoid false positives.
  • When /set system is used without any trailing text the system prompt is silently cleared but still prints Set system message.; consider distinguishing between setting and clearing the prompt in both behavior and user feedback.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `/set system` handling uses `HasPrefix` on the raw line, so input like `/set systematics` will be interpreted as the command; consider matching on an exact token (e.g., `/set system` followed by whitespace or EOL) to avoid false positives.
- When `/set system` is used without any trailing text the system prompt is silently cleared but still prints `Set system message.`; consider distinguishing between setting and clearing the prompt in both behavior and user feedback.

## Individual Comments

### Comment 1
<location> `cmd/cli/commands/run.go:223-225` </location>
<code_context>
 			}
 			continue
+		case strings.HasPrefix(line, "/set system"):
+			// Extract the system prompt text after "/set system "
+			systemPrompt = strings.TrimPrefix(line, "/set system")
+			systemPrompt = strings.TrimSpace(systemPrompt)
+			fmt.Fprintln(os.Stderr, "Set system message.")
+			continue
</code_context>

<issue_to_address>
**issue (bug_risk):** Align the prefix trimming with the comment to avoid subtle command parsing issues.

The comment mentions extracting text after `"/set system "` (with a trailing space), but `TrimPrefix` uses `"/set system"` (no space). This allows `/set systemfoo` to be parsed as `foo`, which is likely unintended. To tighten parsing and match the comment, use `strings.TrimPrefix(line, "/set system ")`; `TrimSpace` will still clean up any surrounding whitespace.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a /set system command to the interactive mode, allowing users to specify a system message. The implementation is straightforward, but I've identified a minor bug in the command parsing logic that could cause incorrect behavior for commands with a similar prefix. I've provided a specific suggestion to make the command matching more precise. The rest of the changes for incorporating the system prompt into the chat history are well-implemented.

The /set system command allows users to set or update the system message
during interactive sessions. The system prompt is now included in the
message history sent to the chat endpoint, enabling customized behavior
for the AI assistant.

Signed-off-by: Eric Curtin <[email protected]>
Copy link
Contributor

@doringeman doringeman left a comment

Choose a reason for hiding this comment

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

Thanks!

$ docker model run llama3.2
> /set system my name's Dorin
Set system message.
> what's my name?
Your name is Dorin.

@ericcurtin ericcurtin merged commit 4d4402b into main Jan 16, 2026
14 checks passed
@ericcurtin ericcurtin deleted the set-system-prompt branch January 16, 2026 14:32
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