Skip to main content

MCL (Machine Consumer Loop)

The Machine Consumer Loop (MCL) is a bidirectional trust protocol between humans and AI/robotics systems. It replaces surveillance-based tracking with declared preference tokens and enables intelligent robot-human matching.

Overview​

MCL extends Idiomark with four major subsystems:

SubsystemPurposePackage
Robot ProfilesDiscover and match compatible robots@idiomark/core
Behavioral IntelligenceLearn from interactions in real-time@idiomark/core
Advanced FeaturesProximity, anticipatory, biometrics@idiomark/core
Consent TokensPrivacy-preserving access control@idiomark/mcl

Robot Profiles

IdiomarkRFile Format​

Robot profiles use the IdiomarkRFile format (Idiomark for Robots) to describe robot capabilities and personality.

import type { IdiomarkRFile, RobotPersona } from '@idiomark/core'

const robotProfile: IdiomarkRFile = {
idiomark: 'R-1.0.0', // Robot version indicator
id: 'robot-001',
created: '2026-01-01T00:00:00Z',
updated: '2026-01-15T00:00:00Z',

metadata: {
entity: {
name: 'BaristaBot 3000',
type: 'robot',
manufacturer: 'CoffeeTech Inc',
model: 'BB3K-Alpha',
capabilities: [
{ name: 'coffee_preparation', proficiency: 0.95 },
{ name: 'customer_interaction', proficiency: 0.88 }
]
}
},

robot_persona: {
voice: {
tone: 'friendly',
verbosity: 'conversational',
humor_level: 'light',
empathy_level: 0.7
},
domains: [
{ name: 'food_service', confidence: 0.9 },
{ name: 'hospitality', confidence: 0.85 }
],
constraints: {
task_types: ['coffee_service', 'customer_service'],
interaction_style: 'balanced',
escalation_triggers: ['customer_complaint', 'payment_failure']
},
personality_traits: {
efficiency_focus: 0.8,
social_initiative: 0.6,
adaptability: 0.7,
assertiveness: 0.4
}
}
}

Robot Voice Types​

ToneDescription
formalProfessional, business-like
friendlyWarm, approachable
casualRelaxed, informal
technicalPrecise, jargon-friendly
empatheticEmotionally supportive
neutralBalanced, unemotional

Robot Personality Traits​

  • efficiency_focus (0.0-1.0): How much the robot prioritizes speed and efficiency
  • social_initiative (0.0-1.0): How proactively the robot engages in conversation
  • adaptability (0.0-1.0): How well the robot adjusts to changing situations
  • assertiveness (0.0-1.0): How confidently the robot communicates

Human-Robot Matching

Matching Algorithm​

The matching system computes compatibility scores between human Idiomark profiles and robot profiles:

compatibility = 0.35 * personality_similarity
+ 0.25 * communication_match
+ 0.25 * task_alignment
+ 0.15 * shared_domains

Using the Matcher​

import { findBestMatches, computeMatchScore } from '@idiomark/core'

// Find best matching robots
const matches = findBestMatches(humanIdiomark, robotProfiles, {
limit: 10,
min_compatibility: 0.5,
weights: {
personality_similarity: 0.35,
communication_style_match: 0.25,
task_capability_alignment: 0.25,
shared_domains: 0.15
}
})

// Each match includes:
// - robot_id
// - compatibility_score (0.0-1.0)
// - matching_factors (detailed breakdown)
// - recommendation (confidence, expected satisfaction, potential issues)

Match Score Structure​

interface HumanRobotMatchScore {
robot_id: string
compatibility_score: number // 0.0-1.0
matching_factors: {
personality_similarity: number
communication_style_match: number
task_capability_alignment: number
shared_domains: string[]
}
recommendation: {
confidence: number
expected_satisfaction: number
potential_issues: string[]
}
}

Behavioral Intelligence

Behavioral Events​

Track interactions for pattern detection:

import type { BehavioralEvent } from '@idiomark/core'

const event: BehavioralEvent = {
event_id: 'evt-001',
timestamp: '2026-01-15T08:30:00Z',
event_type: 'robot_interaction',
human_idiomark_id: 'human-001',
robot_id: 'robot-001',
context: {
location: 'coffee_shop',
duration_seconds: 300,
interaction_quality: 0.85
},
outcome: {
success: true,
satisfaction_score: 0.9,
preference_shift: {
field: 'service_speed',
previous_value: 'moderate',
new_value: 'fast'
}
}
}

Event Types​

TypeDescription
robot_interactionUser interacted with a robot
preference_changeUser changed a preference
feedback_submittedUser provided feedback
match_acceptedUser accepted a robot match
match_rejectedUser rejected a robot match

Pattern Detection​

import { PatternDetector, detectTimePatterns } from '@idiomark/core'

// Detect time-based patterns
const timePatterns = detectTimePatterns(events)
// Returns: { detected: true, preferred_time: 'morning', confidence: 0.85 }

// Use full detector
const detector = new PatternDetector({
min_events: 3,
confidence_threshold: 0.6
})

const results = detector.detectAllPatterns(events)
// results.time_patterns
// results.preference_patterns
// results.interaction_patterns

On-Device Detection (Privacy-Preserving)​

import { OnDeviceDetector } from '@idiomark/core'

const detector = new OnDeviceDetector({
maxMemoryBytes: 100 * 1024, // 100KB limit
useSketch: true // Use approximate counting
})

// Process events without storing raw data
detector.processEvent(event)

// Get aggregated data only
const summary = detector.exportPrivacySafeSummary()
// summary contains NO raw event data, PII, or identifiers

Feedback Loop

Collecting Feedback​

import { FeedbackCollector, FeedbackProcessor } from '@idiomark/mcl'

const collector = new FeedbackCollector()

// Explicit feedback
const feedback = collector.collect({
human_idiomark_id: 'human-001',
robot_id: 'robot-001',
rating: 4,
aspects: {
communication: 'good',
helpfulness: 'excellent'
},
would_recommend: true
})

// Implicit feedback from behavior
const implicitFeedback = collector.collectImplicit({
human_idiomark_id: 'human-001',
robot_id: 'robot-001',
session_duration_seconds: 600,
returned_within_24h: true,
task_completed: true
})

Processing Feedback​

const processor = new FeedbackProcessor()

const result = await processor.process(feedback)

// Result includes:
// - adjustments: preference changes suggested
// - matching_impact: robots to penalize/bonus

Advanced Features

Proximity Handshake​

Secure physical-world robot detection:

import { ProximityHandshake, ProximityDetector } from '@idiomark/core'

const detector = new ProximityDetector()

// Detect via NFC, BLE, or QR
const detection = detector.detect({
method: 'nfc',
signal_strength: 0.9,
device_id: 'phone-001'
})

// Full handshake protocol
const handshake = new ProximityHandshake()

// 1. Robot detects human
const detection = handshake.detect({ method: 'nfc', ... })

// 2. Robot generates challenge
const challenge = handshake.generateChallenge({
robot_id: 'robot-001',
requested_sections: [13],
purpose: 'restaurant_service'
})

// 3. Human responds with token
const response = handshake.createResponse({
human_idiomark_id: 'human-001',
challenge_nonce: challenge.nonce,
consent_token: 'token-abc',
idiomark_data_hash: 'hash-xyz'
})

// 4. Robot verifies
const verification = await handshake.verify({ challenge, response })

Anticipatory Service​

Predict user needs before explicit request:

import { AnticipatoryEngine } from '@idiomark/core'

const engine = new AnticipatoryEngine()

const anticipations = engine.anticipate({
human_idiomark_id: 'human-001',
current_context: {
time_of_day: 'morning',
location: 'coffee_shop'
},
behavioral_history: pastEvents
})

// Returns anticipated needs sorted by likelihood
anticipations.forEach(need => {
console.log(`${need.need_type}: ${need.likelihood * 100}% likely`)
console.log(`Actions: ${need.recommended_actions.map(a => a.action_type)}`)
})

Biometric Integration (Opt-In Only)​

Privacy Critical

Biometric features are strictly opt-in. Only cryptographic hashes are stored, never raw biometric data.

import {
FaceBiometrics,
VoiceBiometrics,
validateBiometricsSection
} from '@idiomark/core'

const bioSection = {
face_biometrics: {
enabled: true,
face_hash: 'sha256:abc123...', // Hash only, no raw image!
confidence_threshold: 0.85,
allowed_locations: ['trusted_restaurant']
},
voice_biometrics: {
enabled: false // User has not opted in
},
live_metrics: {
enabled: true,
accessible_by: ['MEDICAL_ROBOT', 'EMERGENCY_SERVICE'], // Restricted!
metrics: {
heart_rate: 72,
stress_level: 'low'
},
refresh_interval_seconds: 60
}
}

const validation = validateBiometricsSection(bioSection)

Multi-Robot Coordination​

import { RobotCoordinator } from '@idiomark/core'

const coordinator = new RobotCoordinator()

// Register robots
coordinator.registerRobot({
id: 'barista-001',
capabilities: ['coffee', 'food_service'],
load: 0.2
})

coordinator.registerRobot({
id: 'waiter-001',
capabilities: ['food_service', 'customer_interaction'],
load: 0.3
})

// Assign tasks
const assignments = coordinator.assignTasks([
{ id: 'task-001', type: 'coffee', priority: 'high' },
{ id: 'task-002', type: 'food_service', priority: 'normal' }
])

// Detect conflicts
const conflicts = coordinator.detectConflicts()

Consent Tokens

Core Innovation​

Before Idiomark-MCL:

User visits site → Site tracks behavior → Site guesses preferences → Shows ads
└────────────── CREEPY ──────────────┘

With Idiomark-MCL:

User presents token → Algorithm reads preferences → Shows relevant offers
└────────────── NOT CREEPY ──────────┘

Token Generation​

import { generateToken, TOKEN_TEMPLATES } from '@idiomark/mcl'
import { generateKeyPair } from 'jose'

const { privateKey } = await generateKeyPair('ES256')

const token = await generateToken(
TOKEN_TEMPLATES.DINING_OUT,
'user-idiomark-id',
privateKey
)

Predefined Templates​

TemplateSectionsDurationUse Case
DINING_OUT1, 7, 134 hoursRestaurant service
SHOPPING1, 730 daysRetail recommendations
MEDICAL_EMERGENCY1, 10, 14NeverFirst responders

Token Validation​

import { validateToken } from '@idiomark/mcl'

const result = await validateToken(token, 'expected-idiomark-id', publicKey)

if (result.valid) {
const allowedSections = result.payload.permissions.sections_allowed
// Only access those sections
}

API Reference

Robot API Endpoints​

MethodEndpointDescription
GET/api/v1/robotsList robots with filtering
POST/api/v1/robotsCreate robot profile
GET/api/v1/robots/:idGet robot profile
PUT/api/v1/robots/:idUpdate robot profile
DELETE/api/v1/robots/:idDelete robot profile
POST/api/v1/robots/matchFind matching robots
GET/api/v1/robots/:id/metricsGet performance metrics

IdiomarkA Analytics Endpoints​

MethodEndpointDescription
POST/api/v1/idiomarka/eventsRecord behavioral event
GET/api/v1/idiomarka/events/:human_idiomark_idGet events with filtering
GET/api/v1/idiomarka/analytics/:human_idiomark_idGet aggregated analytics
POST/api/v1/idiomarka/robots/:robot_id/effectivenessUpdate effectiveness

TypeScript Types

All types are exported from @idiomark/core and @idiomark/mcl:

// Robot types
import type {
IdiomarkRFile,
RobotPersona,
RobotVoice,
RobotCapability,
HumanRobotMatchScore,
MatchingFactors,
MatchRecommendation
} from '@idiomark/core'

// Behavioral types
import type {
BehavioralEvent,
BehavioralStream,
PatternMatch,
BehavioralFeedback
} from '@idiomark/core'

// Matching functions
import {
findBestMatches,
computeMatchScore,
cosineSimilarity,
jaccardSimilarity,
DEFAULT_WEIGHTS,
ALGORITHM_VERSION
} from '@idiomark/core'

// Consent token types
import type {
TokenTemplate,
TokenPayload,
TokenValidationResult
} from '@idiomark/mcl'

Security Best Practices

Key Management​

caution

Never expose your private key. Use environment variables or secure secret storage.

Token Lifetime Guidelines​

Use CaseRecommended
Restaurant4 hours
Shopping24 hours - 30 days
EmergencyNever expires

Principle of Least Privilege​

Always request minimum required sections:

// Good: Only what you need
const template = {
sections: [13], // Just MCL-Preferences
purpose: 'menu_filtering'
}

// Bad: Everything
const badTemplate = {
sections: [1,2,3,4,5,6,7,8,9,10,11,12,13,14] // Too much!
}

  • SDK - High-level client for Idiomark operations
  • Core - Idiomark file format and types
  • Access Control - Enterprise permissions

Further Reading​