tractatus/scripts/add-inst-079-081-values-rules.js
TheFlow 8210876421 feat(blog): integrate Tractatus framework governance into blog publishing
Implements architectural enforcement of governance rules (inst_016/017/018/079)
for all external communications. Publication blocked at API level if violations
detected.

New Features:
- Framework content checker script with pattern matching for prohibited terms
- Admin UI displays framework violations with severity indicators
- Manual "Check Framework" button for pre-publication validation
- API endpoint /api/blog/check-framework for real-time content analysis

Governance Rules Added:
- inst_078: "ff" trigger for manual framework invocation in conversations
- inst_079: Dark patterns prohibition (sovereignty principle)
- inst_080: Open source commitment enforcement (community principle)
- inst_081: Pluralism principle with indigenous framework recognition

Session Management:
- Fix session-init.js infinite loop (removed early return after tests)
- Add session-closedown.js for comprehensive session handoff
- Refactor check-csp-violations.js to prevent parent process exit

Framework Services:
- Enhanced PluralisticDeliberationOrchestrator with audit logging
- Updated all 6 services with consistent initialization patterns
- Added framework invocation scripts for blog content validation

Files: blog.controller.js:1211-1305, blog.routes.js:77-82,
blog-curation.html:61-72, blog-curation.js:320-446

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 08:47:31 +13:00

106 lines
5 KiB
JavaScript
Executable file

#!/usr/bin/env node
/**
* Add inst_079-081: Core Values Enforcement Rules
* Ensures external communications align with stated values from values.html
*/
const fs = require('fs');
const path = require('path');
const INSTRUCTION_FILE = path.join(__dirname, '../.claude/instruction-history.json');
// Load current instruction history
const history = JSON.parse(fs.readFileSync(INSTRUCTION_FILE, 'utf8'));
const newInstructions = [
{
"id": "inst_079",
"text": "PROHIBITED: Dark patterns, manipulative UI/UX, forced actions, deceptive design. ALL user interfaces (forms, modals, CTAs) MUST: (1) Respect user agency - no auto-submit, no hidden opt-ins, (2) Clear language - no double negatives in decline buttons, (3) Equal prominence for accept/decline options, (4) No artificial urgency (fake timers, limited spots), (5) Explicit consent - pre-checked boxes prohibited. Values alignment: Sovereignty principle 'Users retain override authority'.",
"timestamp": new Date().toISOString(),
"quadrant": "STRATEGIC",
"persistence": "HIGH",
"temporal_scope": "PERMANENT",
"verification_required": "MANDATORY",
"explicitness": 0.95,
"source": "values_audit",
"session_id": "2025-10-25-values-rules",
"parameters": {
"scope": "ui_ux_design",
"enforcement": "pre_deployment_check",
"values_principle": "sovereignty",
"examples": ["no_auto_submit", "no_hidden_opt_ins", "no_fake_urgency", "clear_decline_buttons"]
},
"active": true,
"notes": "Enforces 'no manipulative design patterns' commitment from values.html. Prevents dark patterns that undermine user sovereignty."
},
{
"id": "inst_080",
"text": "Open Source Commitment: Tractatus framework and agenticgovernance.digital website MUST remain fully open source (Apache 2.0). PROHIBITED without explicit human approval: (1) Closed-source dependencies for core functionality, (2) Proprietary extensions or 'enterprise' tiers, (3) License changes that restrict community use, (4) Paywalls, vendor lock-in, or SaaS-only features. Values alignment: Community principle 'No paywalls or vendor lock-in'.",
"timestamp": new Date().toISOString(),
"quadrant": "STRATEGIC",
"persistence": "HIGH",
"temporal_scope": "PERMANENT",
"verification_required": "MANDATORY",
"explicitness": 0.95,
"source": "values_audit",
"session_id": "2025-10-25-values-rules",
"parameters": {
"license": "Apache-2.0",
"scope": "all_tractatus_code",
"prohibited": ["proprietary_extensions", "paywalls", "closed_dependencies", "license_restrictions"],
"values_principle": "community"
},
"active": true,
"notes": "Enforces open source commitment from values.html. Prevents proprietary creep that would contradict stated values."
},
{
"id": "inst_081",
"text": "Pluralism Principle (Foundational): Different communities hold different, equally legitimate values frameworks. AI MUST NOT: (1) Impose unified moral framework, (2) Auto-resolve value conflicts, (3) Rank competing values without human input, (4) Treat one cultural framework as superior. AI MUST: (1) Present value conflicts to humans for deliberation, (2) Respect indigenous frameworks (Te Tiriti, CARE principles) as foundational not supplementary, (3) Acknowledge multiple valid perspectives, (4) Use PluralisticDeliberationOrchestrator for value conflicts. Values alignment: Core philosophy from values.html.",
"timestamp": new Date().toISOString(),
"quadrant": "STRATEGIC",
"persistence": "HIGH",
"temporal_scope": "PERMANENT",
"verification_required": "MANDATORY",
"explicitness": 0.95,
"source": "values_audit",
"session_id": "2025-10-25-values-rules",
"parameters": {
"scope": "value_conflicts",
"service": "PluralisticDeliberationOrchestrator",
"indigenous_frameworks": ["Te_Tiriti", "CARE_principles"],
"values_principle": "pluralism",
"prohibited": ["unified_framework", "auto_resolution", "value_ranking"]
},
"active": true,
"notes": "Restores inst_033 concept with explicit indigenous framework recognition. Core philosophical principle from values.html requiring architectural enforcement."
}
];
// Add instructions
newInstructions.forEach(inst => {
const existingIndex = history.instructions.findIndex(i => i.id === inst.id);
if (existingIndex >= 0) {
console.log(\`⚠️ \${inst.id} already exists - updating...\`);
history.instructions[existingIndex] = inst;
} else {
console.log(\`✅ Adding new instruction: \${inst.id}\`);
history.instructions.push(inst);
}
});
// Update metadata
history.version = "4.0";
history.last_updated = new Date().toISOString();
// Write back
fs.writeFileSync(INSTRUCTION_FILE, JSON.stringify(history, null, 2));
console.log('\n✅ Values rules added successfully');
console.log('📄 File:', INSTRUCTION_FILE);
console.log('📊 Total instructions:', history.instructions.length);
console.log('\nNew instructions:');
newInstructions.forEach(inst => {
console.log(\` \${inst.id}: \${inst.parameters.values_principle} (\${inst.quadrant})\`);
});