Feature: Custom Instructions for GitLab Duo Chat

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

This feature idea has emerged independently from multiple directions, indicating strong user demand:

  • #500822 : Request for reusable prompt templates to improve workflow efficiency
  • #497807: Request for custom instructions to support language preferences and specialized outputs

While those issues proposed different solutions (templates system, suffix features), they point to the same core need: users want persistent, reusable ways to frame their Duo Chat interactions. This proposal aims to solve that core need with a simple first iteration that can be expanded based on usage and feedback.

Business Results:

Proposed Solution

Add a "Custom Instructions" section to Duo Chat:

  1. Single Custom Instructions Field
  • Text area for custom instructions/context
  • Prepended only to first message in each thread
  • Character limit (e.g. 500 chars)
  • Applied globally per user

This minimal approach:

  • Solves the core need for persistent context
  • Uses proven prepend approach
  • Requires minimal UI changes
  • Can be built on existing preferences infrastructure
  • Provides foundation for future template system

User Experience

  1. Settings UI:
  • Add "Duo Chat" section to user preferences
  • Large text area with character counter
  • Save button that shows success/error feedback
  • Placeholder text: "Add instructions that will be prepended to your first message in each chat thread"
  1. Chat Flow:
  • New thread starts -> Custom instructions prepended silently
  • No visual indicator in chat that instructions were added
  • If token limit exceeded -> Show error: "Your message plus custom instructions exceed the token limit. Please shorten your message or reduce custom instructions."
  1. Default States:
  • Empty text area by default
  • Empty string if no instructions set
  • Preserved across sessions

Success Metrics

  • Custom instruction usage rate
  • User feedback on workflow improvements

Future Iterations

  • Multiple named instruction templates
  • Per-thread instruction switching
  • Shareable templates

Acceptance Criteria

  • User can save custom instructions via preferences
  • Instructions persist across sessions
  • Instructions are prepended to first message in new threads
  • Character limit is enforced with UI feedback
  • Token limit errors are handled gracefully
  • Instructions are cleared when preferences are reset
Edited by 🤖 GitLab Bot 🤖