Skip to content

add /system-prompt command to show the exact prompt sent to the model - #237

Merged
kevinjosethomas merged 3 commits into
mainfrom
add-system-prompt-command
Jun 23, 2026
Merged

add /system-prompt command to show the exact prompt sent to the model#237
kevinjosethomas merged 3 commits into
mainfrom
add-system-prompt-command

Conversation

@kevinjosethomas

@kevinjosethomas kevinjosethomas commented Jun 23, 2026

Copy link
Copy Markdown
Member
  • adds a /system-prompt slash command that prints the exact system prompt the model receives for the current session, verbatim, so it's easy to see what skills, harness state, and context are actually being sent.
  • plumbs a getSystemPrompt call through the in-process, daemon, and deferred connection layers, mirroring the existing getLastAssistantText path.
  • falls back to building the current prompt when the session hasn't run a turn yet, since the stored prompt is empty until the first turn.

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-prompt builtin 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 as getLastAssistantText: in-process reads session.systemPrompt, the daemon adds get_system_prompt (read-only, does not invalidate attach snapshots), and DeferredAgentConnection returns 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-prompt slash command to display the current system prompt in the chat UI

  • Adds a /system-prompt command that fetches and displays the active system prompt (with its character count) in the chat UI via InteractiveMode.handleSystemPromptCommand().
  • Extends the AgentConnection interface with getSystemPrompt(), implemented across in-process, daemon-backed, and deferred connections.
  • The daemon handles a new get_system_prompt command type that looks up the prompt by session ID without invalidating the cached snapshot.

Macroscope summarized 5ddd09e.

Adds getSystemPrompt across the agent-connection layers and a getEffectiveSystemPrompt fallback so the command works before the first turn populates state.
Comment thread packages/coding-agent/src/core/agent-session.ts Outdated
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.

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Fix All in Cursor

❌ 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.

Comment thread packages/coding-agent/src/core/agent-session.ts Outdated
Comment thread packages/coding-agent/src/core/agent-session.ts Outdated
Comment thread packages/coding-agent/src/modes/interactive/interactive-mode.ts Outdated
…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.
@kevinjosethomas
kevinjosethomas merged commit 99cffde into main Jun 23, 2026
3 checks passed
@kevinjosethomas
kevinjosethomas deleted the add-system-prompt-command branch June 24, 2026 04:49
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.
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