claude-simone
claude-simone copied to clipboard
fix(mcp): Built-in partials not available in user custom prompts
Description
When users create custom prompts in their .simone/prompts folder and reference built-in partials (like {{> github}} or {{> quality-checks}}), these partials fail to load because they don't exist in the user's project folder. Built-in partials should be available by default, with user partials taking precedence only when they exist with the same name.
Context
- Project area: MCP Server - Template/Prompt loading system
- Related files:
/mcp-server/src/templates/loader.ts - Complexity: 4/10 - Moderate logic changes to partial loading
Technical Details
Current Behavior
The loadPartials() method in TemplateLoader class attempts to load partials from both project and built-in directories. However, when running from an installed package (via npm), the built-in partials directory path resolution may fail, causing built-in partials to be unavailable.
Root Cause
In src/templates/loader.ts:
- Lines 104-110: The method loads project partials first, then built-in partials
- Line 109: Built-in partials directory is resolved using
__dirnamewhich may not correctly resolve in bundled/installed versions - The current implementation doesn't ensure built-in partials are always registered
Affected Files
/mcp-server/src/templates/loader.ts- Primary file requiring modification/mcp-server/src/templates/handler.ts- May need updates for partial resolution
Requirements
- Built-in partials must always be available for use in any prompt (user or built-in)
- User partials should override built-in partials when they have the same name
- The solution must work in both development and production (installed via npm) environments
- Maintain backward compatibility with existing custom prompts
Implementation Steps
- [ ] Fix the built-in partial directory resolution in
loadPartials()method - [ ] Ensure built-in partials are loaded and registered before checking for user overrides
- [ ] Update the partial loading logic to handle both development and production paths
- [ ] Add fallback mechanism for built-in partial resolution
- [ ] Test with custom user prompts that reference built-in partials
- [ ] Verify functionality works when installed via
npx simone-mcp
Acceptance Criteria
- [ ] User can create a custom prompt that uses built-in partials like
{{> github}}without copying those partials - [ ] User partials with the same name as built-in partials correctly override them
- [ ] Solution works in development environment (running from source)
- [ ] Solution works in production environment (installed via npm/npx)
- [ ] No breaking changes to existing custom prompts
- [ ] Clear error messages if a referenced partial doesn't exist in either location