Constrain audit/critique to only suggest real commands via {{available_commands}}

Adds a dynamic {{available_commands}} placeholder that the build system
replaces with the actual list of user-invokable skill names. Audit and
critique now explicitly instruct the LLM to only suggest from this list,
preventing hallucinated commands like /redesign.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Paul Bakaus
2026-03-05 10:18:52 -08:00
co-authored by Claude Opus 4.6
parent aadaee5c37
commit 870d65b1e3
8 changed files with 24 additions and 13 deletions
+6 -2
View File
@@ -326,13 +326,17 @@ function escapeRegex(str) {
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}
export function replacePlaceholders(content, provider) {
export function replacePlaceholders(content, provider, commandNames = []) {
const placeholders = PROVIDER_PLACEHOLDERS[provider] || PROVIDER_PLACEHOLDERS['cursor'];
const commandList = commandNames.length > 0
? commandNames.map(n => `/${n}`).join(', ')
: '';
return content
.replace(/\{\{model\}\}/g, placeholders.model)
.replace(/\{\{config_file\}\}/g, placeholders.config_file)
.replace(/\{\{ask_instruction\}\}/g, placeholders.ask_instruction);
.replace(/\{\{ask_instruction\}\}/g, placeholders.ask_instruction)
.replace(/\{\{available_commands\}\}/g, commandList);
}
/**