From e0b3a7be65bd7f7019a278b2868b61947dad7054 Mon Sep 17 00:00:00 2001 From: andydiaz122 Date: Tue, 24 Feb 2026 10:20:17 -0500 Subject: [PATCH] =?UTF-8?q?fix:=20address=20CodeRabbit=20review=20?= =?UTF-8?q?=E2=80=94=20deduplicate=20prompt,=20fix=20skill=20count?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Swap loadHistory/appendTurn order to prevent user message appearing twice in the prompt (once in history, once as USER MESSAGE) - Calculate actual loaded skill count via fs.existsSync instead of counting requested skill names (banner now reflects reality) - Add err.stack to test harness error output for better debugging --- scripts/claw.js | 11 +++++++---- tests/scripts/claw.test.js | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/claw.js b/scripts/claw.js index aab9df49..1c0e77ab 100644 --- a/scripts/claw.js +++ b/scripts/claw.js @@ -174,11 +174,14 @@ function main() { const sessionPath = getSessionPath(sessionName); const eccContext = loadECCContext(); - const skillCount = (process.env.CLAW_SKILLS || '').split(',').filter(s => s.trim()).length; + const requestedSkills = (process.env.CLAW_SKILLS || '').split(',').map(s => s.trim()).filter(Boolean); + const loadedCount = requestedSkills.filter(name => + fs.existsSync(path.join(process.cwd(), 'skills', name, 'SKILL.md')) + ).length; console.log('NanoClaw v1.0 — Session: ' + sessionName); - if (skillCount > 0) { - console.log('Loaded ' + skillCount + ' skill(s) as context.'); + if (loadedCount > 0) { + console.log('Loaded ' + loadedCount + ' skill(s) as context.'); } console.log('Type /help for commands, exit to quit.\n'); @@ -227,8 +230,8 @@ function main() { } // Regular message — send to Claude - appendTurn(sessionPath, 'User', line); const history = loadHistory(sessionPath); + appendTurn(sessionPath, 'User', line); const response = askClaude(eccContext, history, line); console.log('\n' + response + '\n'); appendTurn(sessionPath, 'Assistant', response); diff --git a/tests/scripts/claw.test.js b/tests/scripts/claw.test.js index 7695ad11..a3c83dee 100644 --- a/tests/scripts/claw.test.js +++ b/tests/scripts/claw.test.js @@ -33,6 +33,7 @@ function test(name, fn) { } catch (err) { console.log(` \u2717 ${name}`); console.log(` Error: ${err.message}`); + if (err.stack) { console.log(` Stack: ${err.stack}`); } return false; } }