Skip to content

Conversation

@DrDonik
Copy link

@DrDonik DrDonik commented Sep 30, 2025

Summary

  • Adds custom system prompt functionality to projects that allows users to define project-specific instructions
  • Project system prompts are automatically combined with assistant instructions when sending messages within that project
  • This way, assistants can (but don't have to) work as general personas, being included in specific project contexts.

Changes

Core Changes

  • Add systemPrompt field to project/folder entities in type definitions

Frontend Changes

  • Add system prompt text input to "Create New Project" and "Edit Project" dialogs.

Backend Changes

  • useChat Hook: Modified to combine project system prompts with assistant instructions
    • Retrieves project system prompt from thread metadata
    • Combines it with assistant instructions before sending to completion API
    • Maintains proper precedence (project prompt + assistant instructions)
  • Thread Management: Enhanced thread creation to support project metadata assignment

Testing

  • Add test suite for project system prompt functionality (useChat.projectSystemPrompt.test.ts)
  • Add tests for thread management with projects (useThreadManagement.test.ts)
  • All existing tests pass

Implementation Details

When a thread belongs to a project with a system prompt defined, the system combines:

  1. Project system prompt (if exists)
  2. Assistant instructions (if exists)

These are joined with double newlines and passed to the completion builder, ensuring project-level context is always included in conversations.

Test Plan

  • Create projects with custom system prompts
  • Verify system prompts combine with assistant instructions correctly
  • Test project metadata persistence across thread lifecycle
  • Verify messages use combined instructions in completions
  • All existing tests pass
  • Manual testing of temporary chat mode

🤖 Generated with https://claude.com/claude-code

Co-Authored-By: Claude noreply@anthropic.com

@louis-jan
Copy link
Contributor

This one is crucial for Projects to function effectively. @DrDonik Do you mind rebasing this PR, and we will proceed with testing and merging.

@louis-jan
Copy link
Contributor

Hey @DrDonik, thanks for the PR. I believe @urmauur attempted to resolve the conflict. Could you please help me make a few changes to clean up the code so that linter doesn't cause an error?

@louis-jan
Copy link
Contributor

@DrDonik Could you please help fix linter issues?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants