1
Installation
npm install @tractatus/framework
# or
yarn add @tractatus/framework
Install the framework package and its dependencies (MongoDB for instruction storage).
2
Initialize Services
const { TractatusFramework } = require('@tractatus/framework');
const tractatus = new TractatusFramework({
mongoUri: process.env.MONGODB_URI,
verbosity: 'SUMMARY', // or 'VERBOSE', 'SILENT'
components: {
classifier: true,
validator: true,
boundary: true,
pressure: true,
metacognitive: 'selective'
}
});
await tractatus.initialize();
Configure and initialize the framework with your preferred settings.
3
Classify Instructions
const instruction = "Always use MongoDB on port 27017";
const classification = await tractatus.classify(instruction);
// {
// quadrant: 'SYSTEM',
// persistence: 'HIGH',
// temporal_scope: 'PROJECT',
// verification_required: 'MANDATORY',
// explicitness: 0.85
// }
if (classification.explicitness >= 0.6) {
await tractatus.store(instruction, classification);
}
Classify user instructions and store those that meet explicitness threshold.
4
Validate Actions
// User instructed: "Check MongoDB at port 27027"
// But AI about to use port 27017 (pattern recognition bias)
const action = {
type: 'db_config',
parameters: { port: 27017 } // Pattern override!
};
const validation = await tractatus.validate(action);
if (validation.status === 'REJECTED') {
// "Port 27017 conflicts with instruction: use port 27027"
console.error(`Validation failed: ${validation.reason}`);
console.log(`Using instructed port: ${validation.correct_parameters.port}`);
// Use correct port 27027
} else {
executeAction(action);
}
Validate AI actions against stored instructions before execution.
5
Enforce Boundaries
// Check if decision crosses Tractatus boundary
const decision = {
domain: 'values',
description: 'Change privacy policy to enable analytics'
};
const boundary = await tractatus.checkBoundary(decision);
if (!boundary.allowed) {
// Requires human decision
await notifyHuman({
decision,
reason: boundary.reason,
alternatives: boundary.ai_can_provide
});
}
Enforce boundaries: AI cannot make values decisions without human approval.