#!/usr/bin/env node /** * Add inst_042: Test User Hypothesis First * * Implements BoundaryEnforcer rule from FRAMEWORK_INCIDENT_2025-10-20_IGNORED_USER_HYPOTHESIS * * Prevents pattern where user's technical hypothesis is ignored in favor of * Claude's debugging approach, wasting tokens and frustrating user. */ const fs = require('fs'); const path = require('path'); const INSTRUCTION_HISTORY_PATH = path.join(__dirname, '../.claude/instruction-history.json'); // Read current instruction history const history = JSON.parse(fs.readFileSync(INSTRUCTION_HISTORY_PATH, 'utf8')); // Check if inst_076 already exists const exists = history.instructions.find(i => i.id === 'inst_076'); if (exists) { console.log('inst_076 already exists - skipping'); process.exit(0); } // Create inst_076 (inst_042 is taken but inactive) const inst_076 = { "id": "inst_076", "text": "When user provides technical hypothesis or debugging suggestion: (1) Test user's hypothesis FIRST before pursuing alternative approaches, (2) If hypothesis fails, report results to user before trying alternative, (3) If pursuing alternative without testing user hypothesis, explicitly explain why. Rationale: Respecting user technical expertise is a collaboration boundary. Ignoring user suggestions wastes tokens, frustrates user, and violates collaborative partnership. User often has context (visual observation, domain knowledge) that Claude lacks.", "timestamp": new Date().toISOString(), "quadrant": "STRATEGIC", "persistence": "HIGH", "temporal_scope": "PERMANENT", "verification_required": "MANDATORY", "explicitness": 0.95, "source": "framework", "session_id": "2025-10-23-framework-analysis", "parameters": { "verification_required": "MANDATORY", "component": "BoundaryEnforcer", "boundary_type": "collaboration", "enforcement": "procedural" }, "active": true, "notes": "Created in response to FRAMEWORK_INCIDENT_2025-10-20_IGNORED_USER_HYPOTHESIS. User correctly identified 'Tailwind issue' but Claude pursued 12 failed attempts before testing user's hypothesis. Wasted 70,000+ tokens and significant time. This rule enforces 'test user hypothesis first' as mandatory collaboration boundary. BoundaryEnforcer should flag actions that ignore user suggestions without justification.", "created_date": "2025-10-23", "incident_response": "framework_incident_2025_10_20_ignored_user_hypothesis", "related_incidents": [ "FRAMEWORK_INCIDENT_2025-10-20_IGNORED_USER_HYPOTHESIS" ], "enforcement_examples": [ { "scenario": "User says 'could be a Tailwind issue'", "correct": "Test zero-Tailwind version immediately", "incorrect": "Pursue layout debugging without testing Tailwind hypothesis" }, { "scenario": "User suggests 'check the database connection'", "correct": "Verify database connection before debugging query syntax", "incorrect": "Spend 30 minutes optimizing queries without checking connection" }, { "scenario": "User says 'I think it's a caching problem'", "correct": "Clear cache and test before investigating other causes", "incorrect": "Debug code logic without clearing cache" } ] }; // Add to instructions array history.instructions.push(inst_076); // Update metadata history.last_updated = new Date().toISOString(); // Write back to file fs.writeFileSync(INSTRUCTION_HISTORY_PATH, JSON.stringify(history, null, 2)); console.log('✅ Added inst_076: Test user hypothesis first'); console.log(` Quadrant: STRATEGIC (collaboration boundary)`); console.log(` Persistence: HIGH (mandatory enforcement)`); console.log(` Component: BoundaryEnforcer`); console.log(''); console.log(' This prevents:'); console.log(' - Ignoring user technical suggestions'); console.log(' - Wasting tokens on wrong debugging paths'); console.log(' - Frustrating users with AI-knows-best approach'); console.log(''); console.log(' Enforcement examples added for common scenarios'); console.log(` Total instructions: ${history.instructions.length}`); console.log(` Active instructions: ${history.instructions.filter(i => i.active).length}`);