add /system-prompt command to show the exact prompt sent to the model - #237
Merged
Conversation
Adds getSystemPrompt across the agent-connection layers and a getEffectiveSystemPrompt fallback so the command works before the first turn populates state.
state.systemPrompt is rebuilt early by tool/resource/refine changes before any request, so capture the exact prompt at send time and label it honestly when no turn has run yet.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit cea19e0. Configure here.
…ield state.systemPrompt is populated at construction and updated on every turn path, so reading it directly avoids the desync, missed-path, and resume-mislabel issues of a separate cached field.
zhengr
pushed a commit
to zhengr/prime-agent
that referenced
this pull request
Aug 8, 2026
…PrimeIntellect-ai#237) * add /system-prompt command to show the exact prompt sent to the model Adds getSystemPrompt across the agent-connection layers and a getEffectiveSystemPrompt fallback so the command works before the first turn populates state. * report the last-sent system prompt instead of the rebuilt state field state.systemPrompt is rebuilt early by tool/resource/refine changes before any request, so capture the exact prompt at send time and label it honestly when no turn has run yet. * use the live session prompt directly instead of tracking a separate field state.systemPrompt is populated at construction and updated on every turn path, so reading it directly avoids the desync, missed-path, and resume-mislabel issues of a separate cached field.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Note
Low Risk
Read-only introspection and a new daemon query command; no changes to prompting, auth, or session mutation paths.
Overview
Adds a
/system-promptbuiltin slash command so you can inspect the exact system prompt the model sees for the current session (skills, harness, per-turn extension overrides).AgentConnection.getSystemPrompt()is wired the same way asgetLastAssistantText: in-process readssession.systemPrompt, the daemon addsget_system_prompt(read-only, does not invalidate attach snapshots), andDeferredAgentConnectionreturns an empty string until a real session exists.Interactive mode handles the command with no args and prints a titled block in the chat, including character count.
Reviewed by Cursor Bugbot for commit 5ddd09e. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add
/system-promptslash command to display the current system prompt in the chat UI/system-promptcommand that fetches and displays the active system prompt (with its character count) in the chat UI viaInteractiveMode.handleSystemPromptCommand().AgentConnectioninterface withgetSystemPrompt(), implemented across in-process, daemon-backed, and deferred connections.get_system_promptcommand type that looks up the prompt by session ID without invalidating the cached snapshot.Macroscope summarized 5ddd09e.