-
Notifications
You must be signed in to change notification settings - Fork 5
Add system prompt loading functionality #119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Enable system prompt to be automatically loaded from prompts/system_prompt.md and injected at the start of all conversations. This ensures consistent AI behavior and user personalization via email template variable. Changes: - Added PromptProvider.get_system_prompt() method - Added system_prompt_filename config setting - Updated MessageBuilder to inject system prompt - Added comprehensive test coverage - Updated CLAUDE.md documentation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
🔒 Security Scan ResultsSecurity Scan SummaryScan ResultsPython SAST (Bandit)Recommendations
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds system prompt loading functionality to enable automatic injection of a configurable system prompt at the start of all conversations. The implementation integrates seamlessly with the existing prompt infrastructure and follows established code patterns.
Key Changes:
- Added
get_system_prompt()method to PromptProvider following the same pattern as existing prompt methods - Added
system_prompt_filenameconfiguration setting to AppSettings - Updated MessageBuilder to optionally prepend system prompt as the first message
- Wired PromptProvider into MessageBuilder via ChatOrchestrator
- Added comprehensive test coverage with 5 tests covering various scenarios
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| backend/modules/prompts/prompt_provider.py | Added get_system_prompt() method to load and format system prompt template with user_email substitution |
| backend/modules/config/config_manager.py | Added system_prompt_filename configuration setting (default: "system_prompt.md") |
| backend/application/chat/preprocessors/message_builder.py | Updated to accept optional PromptProvider and prepend system prompt when enabled |
| backend/application/chat/orchestrator.py | Wired PromptProvider into MessageBuilder initialization |
| backend/tests/test_system_prompt_loading.py | Added comprehensive test suite covering prompt loading, MessageBuilder integration, and end-to-end flow |
| CLAUDE.md | Added Prompt System documentation section explaining system prompt functionality and configuration |
| async def test_system_prompt_sent_to_llm(): | ||
| """Test that system prompt is sent to LLM in chat flow""" | ||
| # Create a temporary directory for prompts | ||
| import tempfile |
Copilot
AI
Nov 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate import of tempfile - already imported at line 1.
| import tempfile |
| @@ -0,0 +1,182 @@ | |||
| import tempfile | |||
Copilot
AI
Nov 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import of 'tempfile' is not used.
| import tempfile |
🔒 Security Scan ResultsSecurity Scan SummaryScan ResultsPython SAST (Bandit)Recommendations
|
Summary
Enable system prompt to be automatically loaded from
prompts/system_prompt.mdand injected at the start of all conversations. This ensures consistent AI behavior and user personalization.Changes
get_system_prompt()method to load and format system prompt with{user_email}template variablesystem_prompt_filenamesetting (default:system_prompt.md)Test Results
✅ All 5 new tests pass
✅ All 271 backend tests pass
✅ All 108 frontend tests pass
✅ No regressions
Behavior
The system prompt from
prompts/system_prompt.mdis now:PromptProviderwith user email substitution🤖 Generated with Claude Code