feat: add optional systemPrompt field to session/new#1494
Draft
wpfleger96 wants to merge 2 commits into
Draft
Conversation
Reference implementation of the Client-Provided System Prompt RFD. Adds an optional `systemPrompt: Option<String>` to NewSessionRequest, letting clients deliver system-level instructions to an agent at session creation. Semantics are additive: agents incorporate the content alongside their own built-in instructions rather than replacing them. The field is optional and backward compatible — agents that ignore it behave unchanged. Regenerates the committed JSON Schema and protocol docs so the published artifacts match the Rust types. Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
This was referenced Jun 23, 2026
The schema docs already document the field, but the narrative session-setup pages still listed only cwd and mcpServers.
|
Hope this work can progress quickly. |
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.
Adds an optional
systemPrompt: Option<String>field toNewSessionRequest(session/new), giving clients a standard way to deliver system-level instructions to an agent at session creation.The semantics are additive: agents incorporate the content alongside their own built-in instructions rather than replacing them, and an agent that ignores the field behaves exactly as before. The field is optional and backward compatible. Per the field's contract, an agent that cannot incorporate the system prompt MUST return a JSON-RPC error and MUST NOT create the session.
This is the reference implementation of the RFD in #1237.
Changes
src/agent.rs—system_prompt: Option<String>onNewSessionRequest, asystem_prompt(...)builder, and round-trip + absent-omission serialization tests.schema/schema.json,schema/schema.unstable.json,docs/protocol/schema.mdx,docs/protocol/draft/schema.mdx— regenerated so the published artifacts match the Rust types.docs/protocol/session-setup.mdx,docs/protocol/draft/session-setup.mdx— addedsystemPromptto the parameter bullet list and JSON-RPC example in the narrative docs.The field serializes as
systemPrompton the wire and is omitted entirely when absent.Related: #1237 (the RFD this implements) and the consuming goose change aaif-goose/goose#9971.