Repository navigation
fix: support additional user instructions in the system prompt - #285
Merged
marcelklehr merged 2 commits intoOct 22, 2026
Merged
marcelklehr merged 2 commits into
marcelklehr merged 2 commits into
Conversation
Declare a new optional `user_instructions` input on the agent providers (classic and multimodal). When set, e.g. by the Assistant app with its "Chat User Instructions" admin setting, the text is appended to the agent's own system prompt. It does not replace it, so the tool calling instructions stay intact. Refs nextcloud/assistant#338 Signed-off-by: Viacheslav Huliaiev <vyacheslavhulyaev@gmail.com>
vyacheslavhulyaev-glitch
force-pushed
the
fix/338-user-instructions
branch
from
October 21, 2026 20:28
1bc6c51 to
ea180eb
Compare
vyacheslavhulyaev-glitch
marked this pull request as ready for review
October 21, 2026 20:36
Add the optional "output_mode" input. With "speech", the agent's own system prompt asks for a reply without Markdown or other formatting, since it is sent to text-to-speech. This takes precedence over the admin-provided instructions. Signed-off-by: Viacheslav Huliaiev <vyacheslavhulyaev@gmail.com>
Contributor
Author
|
Thanks for the approvals! After the review in nextcloud/assistant#709 I added one more optional input, |
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.
Part of the fix for nextcloud/assistant#338: the "Chat User Instructions for Chat Completions" admin setting of the Assistant is ignored when chatting through the Context Agent.
Companion PR in the Assistant: nextcloud/assistant#709
Changes
provider.py: declare a new optional inputuser_instructions(Text) on the classic and the multimodal provider, the same waymemoriesis declared. No server change is needed.agent.py: if set, append it after the agent's own system prompt, under a note telling the model to follow it unless it conflicts with the instructions above. As discussed in #338 by @janepie, admins can only add to the prompt, not replace it, so the tool calling instructions stay intact. Without the input, the prompt is unchanged.main.py: log the new input along withmemories.tests/test_user_instructions.py: unit tests for the formatting and the provider declaration.Testing
PYTHONPATH=. python tests/test_user_instructions.py: 3/3 passgpt-4.1-mini: the optional input shows up inoptionalInputShapeofcore:contextagent:interactionandcore:contextagent:multimodal-interaction. Withuser_instructions: "Always answer like a pirate. Your name is Captain Cloud."and the input "What is your name?", the agent answers "Ahoy! I be Captain Cloud, yer trusty AI assistant sailin' the digital seas…"Open questions
user_instructionsa good name for the input?ContextAgentInteractionoptional input shape later, so it's a documented API rather than something only this provider declares?