nextcloud / nextcloud/assistant
Feature Request: Support additional placeholder variables in the system prompt
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 88
- Forks
- 43
- Avg merge
- 18h 49m
- Merged PRs (30d)
- 3
Description
Describe the feature you'd like to request
Summary
Currently, the admin-configurable "Chat User Instructions" (system prompt) for both chat completions and title generation only supports a single placeholder: {user}, which resolves to the current user's display name (see lib/Controller/ChattyLLMController.php, str_replace('{user}', $user->getDisplayName(), $userInstructions)).
It would be useful to support a small set of additional placeholders so admins can write more context-aware and personalized system prompts without needing code changes for every use case.
Motivation
Right now the system prompt is fairly static aside from the display name. Being able to inject a few more pieces of contextual information (date, language, login name, etc.) would let admins:
- Localize/adjust behavior based on the user's preferred language
- Reference the current date/time for time-sensitive tasks (e.g. "today is {date}")
- Distinguish between a user's display name and their login/username
Describe the solution you'd like
Proposed variables
| Placeholder | Resolves to |
|---|---|
{user} |
(existing) User's display name |
{username} |
User's login name / UID (IUser::getUID()) |
{email} |
User's email address (IUser::getEMailAddress()) |
{language} |
User's preferred language (e.g. from IUser/IL10N) |
{date} |
Current date (server or user timezone) |
{time} |
Current time (server or user timezone) |
Additional context
- Substitution currently happens via simple
str_replace()calls inlib/Controller/ChattyLLMController.php(used innewSession(),generateTitle(), andcheckTitleGenerationTask()), so adding more placeholders would follow the same pattern. - The available placeholders are documented inline in the admin settings UI (
src/components/AdminSettings.vue) viaNcNoteCardhint text below each prompt field — this documentation should be updated to list any newly added variables. - Open question: should placeholder resolution be strict (only replace exact known tokens) or should unknown
{...}tokens be left untouched/escaped to avoid breaking existing prompts that happen to contain literal curly braces?
Describe alternatives you've considered
None
Assisted-by: ClaudeCode:claude-fable-5
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in lib/Controller/ChattyLLMController.php by tracing placeholder substitution in newSession(), generateTitle(), and checkTitleGenerationTask(). Review the user and localization APIs needed for the proposed values, then update the prompt hints in src/components/AdminSettings.vue. Done means the supported placeholders work consistently in each flow and the admin documentation lists them, with the unknown-token behavior clarified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, php
- Domain
- backend, frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100