Skip to content

Conversation

@stephen-cox
Copy link
Owner

Summary

  • Implements a complete custom prompting system with template management, variable substitution, and comprehensive validation
  • Adds chat commands for prompt management (/prompt, /prompts, /prompts search)
  • Provides 5 built-in templates for common use cases (email, code-review, summarize, explain, analyze)
  • Includes robust security validation and user-defined template support

Test plan

  • All 16 new unit tests pass with comprehensive coverage
  • Template engine handles variable substitution correctly
  • Security validation prevents dangerous patterns
  • Chat integration works with interactive variable collection
  • Built-in templates render properly with provided variables
  • Code quality checks pass (ruff, black, formatting)
  • System prompt integration functions correctly

🤖 Generated with Claude Code

stephen-cox and others added 5 commits August 6, 2025 21:54
This commit introduces a complete custom prompting system that allows users to create, manage, and apply reusable prompt templates with variable substitution and comprehensive validation.

## Features Added

### Core Prompt Management System
- **PromptManager**: Central management system for templates with built-in and user-defined prompt support
- **PromptTemplateEngine**: Safe variable substitution using Python's Template class with context variables
- **PromptValidator**: Security validation for dangerous patterns, length limits, and variable validation
- Template categories (WRITING, DEVELOPMENT, ANALYSIS, BUSINESS, EDUCATION, COMMUNICATION, GENERAL)
- Built-in templates: email, code-review, summarize, explain, analyze

### Chat Integration
- New chat commands: `/prompt <name>`, `/prompts`, `/prompts search <query>`
- Interactive variable collection for template application
- System prompt integration with profile-based template references
- Template-based system prompts with context variable support

### Configuration & Storage
- PromptConfig: Comprehensive prompt system configuration
- User-defined templates stored in `~/.nova/prompts/user/custom/`
- Template validation settings and security controls
- Profile-based system prompts and prompt variables

### Security & Validation
- Dangerous pattern detection (script tags, eval, exec, etc.)
- Template length and variable count limits
- Variable type validation (string, text, integer, boolean, list)
- Path sanitization for user templates

### Models & Data Structures
- PromptTemplate: Complete template definition with metadata
- PromptVariable: Typed variables with required/optional support
- ValidationResult: Structured validation feedback
- PromptLibraryEntry: Library indexing support

### Comprehensive Testing
- 16 new unit tests covering all core functionality
- Test coverage for template engine, validator, and manager
- Edge case testing (long templates, dangerous patterns, missing variables)
- Integration tests for system prompt functionality

## Documentation Updates
- Updated CLAUDE.md with prompt management commands
- Added security validation guidelines
- Updated project status to Phase 3 (Custom Prompting)
- Documented template storage locations and usage

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@stephen-cox stephen-cox linked an issue Aug 7, 2025 that may be closed by this pull request
9 tasks
@stephen-cox stephen-cox merged commit e8bd292 into main Aug 7, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Custom Prompting System

2 participants