-
Notifications
You must be signed in to change notification settings - Fork 12
Description
Summary
All prompt-* AI actions fail with "template file not found" errors in aid v1.3.1, despite template files being present and readable in the working directory. This affects all prompt-based AI actions, while flow-* actions work correctly.
Environment
- OS: Windows 10/11 with Git Bash (MINGW64)
- Terminal: Windows Terminal
- aid Version: v1.3.1 (latest as of Aug 2025)
- Shell: Git Bash / MINGW64
- Binary Path:
C:\Users\CurrentUser\.aid\bin\aid.exe
Bug Description
Expected Behavior
prompt-* AI actions should find and use template files (e.g., refactoring.md) when they are present in the current working directory.
Actual Behavior
All prompt-* AI actions fail with template resolution errors:
$ aid path/to/your/file.ext --ai-action prompt-for-refactoring-suggestion --stdout
Error: content generation failed: template file not found: refactoring.md (searched from /path/to/project)Affected AI Actions
All 8 prompt-based actions are broken:
prompt-for-refactoring-suggestionprompt-for-bug-huntingprompt-for-security-analysisprompt-for-performance-analysisprompt-for-best-practices-analysisprompt-for-single-file-docsprompt-for-diagramsprompt-for-complex-codebase-analysis
Working AI Actions
Flow-based actions work as expected:
flow-for-deep-file-to-file-analysis✅flow-for-multi-file-docs✅
Reproduction Steps
- Download the necessary template files from the official GitHub repository.
curl -O https://raw.githubusercontent.com/janreges/ai-distiller/main/internal/aiactions/templates/refactoring.md # (repeat for all 8 template files) - Place
refactoring.mdin the project's working directory. - Verify that the file exists and is readable:
$ ls -la refactoring.md -rw-r--r-- 1 CurrentUser 197121 4403 Aug 18 10:50 refactoring.md $ file refactoring.md refactoring.md: Unicode text, UTF-8 text, with very long lines (323)
- Run a prompt-based action:
$ aid path/to/your/file.ext --ai-action prompt-for-refactoring-suggestion --stdout ```5. Observe the error, despite the file's presence.
Debugging Information
Verbose Output Analysis
With the -vvv flag, aid successfully processes the source file but fails later:
[11:11:10.849] [distill-for-action] INFO: Distilled 1087 bytes of content
Error: content generation failed: template file not found: refactoring.md (searched from /path/to/project)
Key Finding: The issue occurs during the content generation phase, after the file distillation has completed successfully.
Template Locations Tested
Templates were placed in various locations, but the error persisted:
- Project root:
/path/to/project/refactoring.md - Templates subdirectory:
/path/to/project/templates/refactoring.md - Aid binary directory:
C:\Users\CurrentUser\.aid\bin\refactoring.md - Aid installation templates:
C:\Users\CurrentUser\.aid\templates\refactoring.md - MCP server directory:
C:\Users\CurrentUser\AppData\Roaming\npm\node_modules\@janreges\ai-distiller-mcp\refactoring.md
Path Resolution Troubleshooting
Several attempts were made to rule out common Windows/Git Bash path conversion issues, none of which were successful:
- Disable MSYS path conversion:
MSYS_NO_PATHCONV=1 MSYS2_ARG_CONV_EXCL="*" aid path/to/your/file.ext --ai-action prompt-for-refactoring-suggestion --stdout - PowerShell wrapper with Windows paths:
powershell.exe -Command "Set-Location '/path/to/project'; & 'C:\Users\CurrentUser\.aid\bin\aid.exe' 'path/to/your/file.ext' '--ai-action' 'prompt-for-refactoring-suggestion' '--stdout'"
- cmd.exe wrapper:
cmd.exe /c "pushd /path/to/project && C:\Users\CurrentUser\.aid\bin\aid.exe path/to/your/file.ext --ai-action prompt-for-refactoring-suggestion --stdout"
These tests indicate that the problem is likely not a path conversion issue.
File Accessibility Verification
The template files are accessible using native Windows commands:
PS /path/to/project> Get-ChildItem -Name "*.md"
# Lists all template files including refactoring.md
PS /path/to/project> Get-ItemProperty 'refactoring.md'
Name Length LastWriteTime
---- ------ -------------
refactoring.md 4403 18/08/2025 10:50:20Additional Context
Template File Source
The templates were acquired from the official repository:
- Source:
https://github.com/janreges/ai-distiller/tree/main/internal/aiactions/templates - All 8 template files were downloaded and verified.
- The file format and content appear to be correct (UTF-8 encoded text with template variables like
{{.ProjectName}}).
MCP Integration Status
- MCP server integration is functioning correctly.
- The AI can invoke
aidthrough MCP. - Only
prompt-*actions are affected; standard distillation andflow-*actions work as intended.
Cross-Platform Implications
While this report originates from a Windows Git Bash environment, the bug is likely to affect all platforms. This is because it appears to be in the aid binary's template resolution logic, rather than in OS-specific path handling.
Workaround
Users can utilize flow-* AI actions as an alternative to the non-functional prompt-* actions:```bash
Instead of the broken prompt actions, use:
aid ./src --ai-action flow-for-deep-file-to-file-analysis
aid ./src --ai-action flow-for-multi-file-docs
Flow actions provide similar analytical capabilities by generating structured task lists and analysis workflows without the need for templates.
Expected Fix
The template resolution logic should be updated to:
- Correctly search for template files in the current working directory.
- Provide more informative error messages that specify where templates are being sought.
- Consider adding a
--template-dirflag or anAID_TEMPLATE_DIRenvironment variable for custom template locations. - Include debugging output that shows the actual search paths being attempted.
Impact
This bug prevents users from utilizing 8 of the 10 AI-powered analysis features, which significantly curtails the tool's analytical capabilities. While the flow-* actions offer a partial workaround, they do not provide the same structured analysis prompts as the prompt-* actions.
This issue report contains a comprehensive breakdown of the bug, including all troubleshooting steps and evidence to suggest that this is a genuine bug rather than a configuration error.