Skip to content

Refactor prompt template management to use external config files #8

@chigwell

Description

@chigwell

User Story
As a software developer using Beatrica,
I want to manage prompt templates through external JSON/YAML configuration files
so that I can customize review behaviors without modifying core application code.

Background
The current implementation hardcodes XML-based prompt templates directly in beatrica/prompts.py (lines 1-35). This creates three key issues:

  1. Maintenance friction: Every template adjustment requires code deployment cycles
  2. Rigid customization: Teams can't adapt review criteria for specific projects/contexts
  3. Version control conflicts: Template edits become entangled with functional code changes

The XML structure also complicates adding new prompt types like Markdown or dynamic placeholders. Transitioning to externally managed templates reduces upgrade friction and enables environment-specific configurations (e.g., test/staging/prod templates).

Acceptance Criteria

  • Modify beatrica/prompts.py to load templates from config/prompts/ directory instead of hardcoded XML
  • Implement YAML/JSON schema validation for template files during application startup
  • Maintain backward compatibility through fallback to existing XML structure if config files are missing
  • Add unit tests verifying template loading from both YAML (test_templates.yml) and JSON (test_prompts.json)
  • Create CLI command beatrica generate-template that exports current XML prompts to YAML format
  • Document template configuration options in README.md's "Advanced Usage" section
  • Verify through CLI test that modified templates alter review outputs without code changes:
beatrica --base_branch=dev --template=config/prompts/security-review.yml

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions