feat(vscode, cli): add system prompt inspection#7814
feat(vscode, cli): add system prompt inspection#7814marius-kilocode wants to merge 5 commits intomainfrom
Conversation
Code Review SummaryStatus: 2 Issues Found | Recommendation: Address before merge Overview
Fix these issues in Kilo Cloud Issue Details (click to expand)WARNING
Other Observations (not in diff)Issues found in unchanged code that cannot receive inline comments:
Files Reviewed (12 files)
Reviewed by gpt-5.4-20260305 · 2,560,251 tokens |
Add a 'Show System Prompt' button (glasses icon) in the VS Code extension chat header that lets users inspect the full assembled system prompt with source metadata. - Server: GET /session/:sessionID/system-prompt endpoint that assembles the prompt and returns each section (soul, provider, environment, instruction files) with provenance metadata - SDK: regenerated client.session.systemPrompt() method - Extension: KiloProvider handler + SystemPromptView component with collapsible sections, expand/collapse all, and copy
- Overlay layout: render panel inside messages area with absolute positioning so it never shifts the prompt input - Session awareness: re-fetch on session switch, key responses by sessionID to prevent stale data from wrong session - Workspace directory: pass directory for worktree session support - Copy feedback: icon swaps to checkmark with green color for 1.5s - i18n: add translated keys for all 18 locales (expand/collapse/copy/copied) - Move promptOpen state from TaskHeader to ChatView
56401e4 to
8b0d774
Compare
# Conflicts: # packages/kilo-vscode/webview-ui/src/types/messages.ts
| * Uses VS Code CSS variables for theming | ||
| */ | ||
|
|
||
| /* ============================================ |
There was a problem hiding this comment.
should we have a css file per components? this css file is becoming quite unwieldy
|
|
||
| /** | ||
| * Assemble the full system prompt with source metadata. | ||
| * Mirrors the assembly in LLM.stream() + SessionPrompt.loop() |
There was a problem hiding this comment.
this fels tricky, how can we be sure this keeps in sync. I think if we dont actually reuse the logic this will only give peolpe a false feeling of safety/understanding
…y, extract CSS - Extract SystemPrompt.header() used by both LLM.stream() and the inspection endpoint, eliminating duplicated assembly logic (Mark's review comment) - Extract system-prompt.css from chat.css (Mark's review comment) - Remove sources metadata - endpoint returns flat system[] array matching what LLM.stream() builds - Simplify SystemPromptView to render segments directly - Close panel when session is cleared (bot comment) - Remove SystemPromptSource type
| const identity = SystemPrompt.header({ model, agent }) | ||
| const env = await SystemPrompt.environment(model, editorContext) | ||
| const instructions = await InstructionPrompt.system() | ||
| const system = [identity, ...env, ...instructions] |
There was a problem hiding this comment.
WARNING: This endpoint still does not mirror the prompt sent to the model
SessionPrompt.loop() builds input.system from environment() and InstructionPrompt.system(), and LLM.stream() folds that array into SystemPrompt.header(...extra), so the model receives a single combined system string. Returning [identity, ...env, ...instructions] here means the inspector/copy view can still drift from what the model actually saw.
| agent: input.agent, | ||
| codex: isCodex, | ||
| extra: [...input.system, ...(input.user.system ? [input.user.system] : [])], | ||
| }), |
There was a problem hiding this comment.
I like it better, but it is trickier to merge
|
@markijbema The technical debt might not be worth the feature. Let's reiterate on this later. |
Summary
Changes
GET /session/:sessionID/system-promptendpoint that assembles the prompt with source metadata viaSystemPrompt.inspect()client.session.systemPrompt()methodrequestSystemPromptmessage handler inKiloProviderSystemPromptViewcomponent, button inTaskHeader, message types, CSSHow to test