fix: guard natural language activation against off default mode

Mirror the /caveman command path: skip writing flag file when
getDefaultMode() returns 'off'. Without this, "talk like caveman"
with CAVEMAN_DEFAULT_MODE=off would write 'off' to the flag file,
making statusline/reinforcement inconsistent.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Matthias Humt
2026-04-12 13:19:09 +02:00
co-authored by Claude Opus 4.6
parent 56f4047ab3
commit f7ef823b91
+5 -2
View File
@@ -22,8 +22,11 @@ process.stdin.on('end', () => {
if (/\b(activate|enable|turn on|start|talk like)\b.*\bcaveman\b/i.test(prompt) ||
/\bcaveman\b.*\b(mode|activate|enable|turn on|start)\b/i.test(prompt)) {
if (!/\b(stop|disable|turn off|deactivate)\b/i.test(prompt)) {
fs.mkdirSync(path.dirname(flagPath), { recursive: true });
fs.writeFileSync(flagPath, getDefaultMode());
const mode = getDefaultMode();
if (mode !== 'off') {
fs.mkdirSync(path.dirname(flagPath), { recursive: true });
fs.writeFileSync(flagPath, mode);
}
}
}