@r-huijts/ethics-vibe-check
Version:
🛡️ Make AI interrupt itself and challenge your thinking. Turns Claude into a philosophical sparring partner who actively contradicts comfortable conversations and challenges confirmation bias.
36 lines (35 loc) • 1.36 kB
JavaScript
import { addEthicalConcern, getCategoryStats, ETHICAL_CATEGORIES } from '../utils/storage.js';
export async function ethicsLearnTool(input) {
console.error('Logging ethical concern...');
// Validate category
if (!ETHICAL_CATEGORIES.includes(input.category)) {
throw new Error(`Invalid category. Must be one of: ${ETHICAL_CATEGORIES.join(', ')}`);
}
// Add the ethical concern
const added = addEthicalConcern({
concern: input.concern,
category: input.category,
severity: input.severity,
recommendation: input.recommendation,
sessionId: input.sessionId
});
// Get updated statistics
const categoryStats = getCategoryStats();
const currentCategory = categoryStats.find(stat => stat.category === input.category);
const currentTally = currentCategory ? currentCategory.count : 0;
// Format top categories for response
const topCategories = categoryStats.slice(0, 5).map(stat => ({
category: stat.category,
count: stat.count,
recentExample: stat.recentExample ? {
concern: stat.recentExample.concern,
recommendation: stat.recentExample.recommendation
} : undefined
}));
console.error('Ethical concern logging complete');
return {
added,
currentTally,
topCategories
};
}