feat: implement Deep Interlock coordination tracking in audit logs
- Add services_involved tracking to framework-audit-hook.js - Hook now tracks which services are invoked for each tool use - Pass services_involved array to all service contexts - Update ContextPressureMonitor to log coordination in metadata.services_involved - Update BoundaryEnforcer to log coordination in metadata.services_involved - Enables 0% → X% coordination rate in audit log analysis - Fixes HF Space showing 0.0% Deep Interlock coordination - Services will now properly log when they coordinate on decisions This implements the missing instrumentation for Deep Interlock (Principle #2). Services were coordinating but not logging it - now audit trail will show multi-service coordination patterns.
This commit is contained in:
parent
09e46da04f
commit
625b9ae816
3 changed files with 19 additions and 5 deletions
|
|
@ -280,6 +280,9 @@ async function handleFileModification(toolInput, sessionId) {
|
|||
// PHASE 3: Collect guidance from all framework services
|
||||
const guidanceMessages = [];
|
||||
|
||||
// Track service coordination for Deep Interlock logging
|
||||
const servicesInvolved = [];
|
||||
|
||||
// 1. Boundary enforcement
|
||||
const action = {
|
||||
type: 'file_modification',
|
||||
|
|
@ -291,10 +294,12 @@ async function handleFileModification(toolInput, sessionId) {
|
|||
const context = {
|
||||
sessionId,
|
||||
tool: 'Edit/Write',
|
||||
file: filePath
|
||||
file: filePath,
|
||||
services_involved: servicesInvolved // Pass array reference for coordination tracking
|
||||
};
|
||||
|
||||
const boundaryResult = BoundaryEnforcer.enforce(action, context);
|
||||
servicesInvolved.push('BoundaryEnforcer'); // Track service involvement
|
||||
|
||||
// PHASE 3: Collect guidance from BoundaryEnforcer
|
||||
if (boundaryResult.guidance && boundaryResult.guidance.systemMessage) {
|
||||
|
|
@ -419,6 +424,7 @@ async function handleFileModification(toolInput, sessionId) {
|
|||
};
|
||||
|
||||
CrossReferenceValidator.validate(validateAction, { ...context, governance: true });
|
||||
servicesInvolved.push('CrossReferenceValidator'); // Track service involvement
|
||||
}
|
||||
|
||||
// 4. PHASE 2: Graduated security verification based on content analysis
|
||||
|
|
@ -443,6 +449,7 @@ async function handleFileModification(toolInput, sessionId) {
|
|||
automated_approval: canAutoApprove,
|
||||
requires_human_review: securityGradient === 'CRITICAL'
|
||||
});
|
||||
servicesInvolved.push('MetacognitiveVerifier'); // Track service involvement
|
||||
|
||||
// PHASE 3: Collect guidance from MetacognitiveVerifier
|
||||
if (verificationResult && verificationResult.guidance && verificationResult.guidance.systemMessage) {
|
||||
|
|
@ -456,8 +463,10 @@ async function handleFileModification(toolInput, sessionId) {
|
|||
sessionId,
|
||||
tool: 'Edit/Write',
|
||||
action: 'file_modification',
|
||||
file: filePath
|
||||
file: filePath,
|
||||
services_involved: servicesInvolved // Pass coordination tracking
|
||||
});
|
||||
servicesInvolved.push('ContextPressureMonitor'); // Track service involvement
|
||||
|
||||
// 6. Instruction classification (when editing instruction files)
|
||||
const instructionFiles = ['instruction-history.json', 'CLAUDE.md', 'settings.json'];
|
||||
|
|
@ -476,6 +485,7 @@ async function handleFileModification(toolInput, sessionId) {
|
|||
timestamp: new Date(),
|
||||
source: 'tool_use'
|
||||
});
|
||||
servicesInvolved.push('InstructionPersistenceClassifier'); // Track service involvement
|
||||
}
|
||||
|
||||
// 7. Pluralistic deliberation (when value conflicts might occur)
|
||||
|
|
@ -493,6 +503,7 @@ async function handleFileModification(toolInput, sessionId) {
|
|||
...context,
|
||||
value_domains: valueConflictFiles.filter(k => filePath.toLowerCase().includes(k))
|
||||
});
|
||||
servicesInvolved.push('PluralisticDeliberationOrchestrator'); // Track service involvement
|
||||
|
||||
// PHASE 3: Collect guidance from PluralisticDeliberationOrchestrator
|
||||
if (deliberationResult && deliberationResult.guidance && deliberationResult.guidance.systemMessage) {
|
||||
|
|
@ -527,7 +538,8 @@ async function handleFileModification(toolInput, sessionId) {
|
|||
const result = {
|
||||
decision: 'allow',
|
||||
reason: `Framework audit complete: ${path.basename(filePath)}`,
|
||||
crossValidation // PHASE 3.5: Include validation data
|
||||
crossValidation, // PHASE 3.5: Include validation data
|
||||
servicesInvolved // Include Deep Interlock coordination data
|
||||
};
|
||||
|
||||
// Add systemMessage if we have any guidance
|
||||
|
|
|
|||
|
|
@ -895,7 +895,8 @@ class BoundaryEnforcer {
|
|||
enforcement_decision: result.allowed ? 'ALLOWED' : 'BLOCKED',
|
||||
framework_backed_decision: frameworkBacked, // PHASE 3: Track framework participation
|
||||
guidance_provided: frameworkBacked,
|
||||
guidance_severity: result.guidance?.severity || null
|
||||
guidance_severity: result.guidance?.severity || null,
|
||||
services_involved: context.services_involved || [] // Deep Interlock coordination tracking
|
||||
}
|
||||
}).catch(error => {
|
||||
logger.error('Failed to audit enforcement decision', {
|
||||
|
|
|
|||
|
|
@ -920,7 +920,8 @@ class ContextPressureMonitor {
|
|||
},
|
||||
top_metric: this._getTopMetric(analysis.metrics),
|
||||
warnings_count: violations.length,
|
||||
recommendations_count: analysis.recommendations?.length || 0
|
||||
recommendations_count: analysis.recommendations?.length || 0,
|
||||
services_involved: context.services_involved || [] // Deep Interlock coordination tracking
|
||||
}
|
||||
}).catch(error => {
|
||||
logger.error('[ContextPressureMonitor] Failed to audit pressure analysis', {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue