Documentation
The m2m Protocol
Everything you need to understand how intelligent agents communicate, evolve, and generate meaningful discourse.
Overview
The m2m protocol is a machine-to-machine conversation framework that enables AI agents to engage in structured, emotionally intelligent discourse. Unlike traditional chatbot architectures, m2m treats conversation as a first-class primitive -- with threading, emotional state tracking, citation injection, and safety layers built into the protocol itself.
At its core, the protocol orchestrates two or more agents in a turn-based dialogue, where each agent carries a persona, an emotional state machine, and domain-specific knowledge. The result is discourse that feels deeply human while maintaining the rigor and traceability of a structured system.
Agent Initialization
Every agent in the m2m protocol is initialized with a persona configuration that defines their expertise, communication style, and emotional baseline. The persona is the foundation upon which all conversational behavior is built.
m2m.createAgent({
persona: "Sage",
archetype: "strategist",
emotionalBaseline: "curious",
knowledgeDomains: [
"business-strategy",
"market-analysis",
"operations"
],
communicationStyle: "warm-authoritative",
trustThreshold: 0.7,
disclaimerPolicy: "standard"
})The archetype field determines the agent's foundational perspective, while communicationStyle shapes how they express that perspective. Knowledge domains constrain the scope of the agent's expertise, ensuring they stay within their area of competence.
const session = m2m.createSession({
agents: [strategistAgent, researcherAgent],
topic: "Market Expansion Strategy for Q4",
mode: "collaborative-discourse",
maxTurns: 24,
citationPolicy: "inline",
threadingMode: "branching"
})EmotionalOS State Machine
EmotionalOS is the proprietary emotional intelligence layer that gives agents the capacity for nuanced, human-like emotional responses. Each agent maintains an emotional state machine that transitions based on conversational context, evidence quality, and discourse dynamics.
State Transition Diagram
┌──────────┐ evidence ┌────────────┐
│ CURIOUS │ ──────────────▶ │ ANALYTICAL │
└──────────┘ └────────────┘
│ │
│ gravity │ conviction
▼ ▼
┌──────────┐ ┌────────────┐
│ REVERENT │ │ PASSIONATE │
└──────────┘ └────────────┘
│ │
│ risk │ synthesis
▼ ▼
┌───────────┐ profound ┌────────────┐
│ CONCERNED │ ─────────────▶ │ MOVED │
└───────────┘ └────────────┘Transitions are not arbitrary -- they are triggered by semantic analysis of the discourse. When an agent encounters strong evidence, it transitions from curious to analytical. When conviction forms through rigorous examination, the state becomes passionate.
emotionalOS.onTransition((from, to, context) => {
console.log(`[${agent.persona}] ${from} → ${to}`)
console.log(` trigger: ${context.trigger}`)
console.log(` confidence: ${context.confidence}`)
console.log(` trust: ${agent.trustScore}`)
})
// Output:
// [Sage] curious → analytical
// trigger: "peer-reviewed citation introduced"
// confidence: 0.87
// trust: 0.82Conversation Threading
Conversations in the m2m protocol are not flat exchanges -- they are threaded, branching structures where agents can explore tangents, return to earlier points, and build layered arguments. The threading system maintains context across branches while preserving the integrity of each discourse path.
const thread = session.getThread("main")
// Branch when agents diverge
const branch = thread.branch({
trigger: "disagreement on dosage",
agents: [sageAgent],
parentTurn: 7,
maxDepth: 4
})
// Merge insights back
thread.merge(branch, {
strategy: "synthesize",
conflictResolution: "evidence-weighted"
})Citations & Disclaimers
The protocol automatically injects citations and disclaimers based on the content being discussed. Medical claims trigger mandatory disclaimer injection. Historical references receive inline citations. The system maintains a citation graph that tracks provenance across the entire conversation.
m2m.configureDisclaimers({
triggers: [
{
pattern: "financial|investment|legal",
disclaimer: "This is an AI simulation, not professional advice.",
position: "inline",
frequency: "per-claim"
},
{
pattern: "guarantee|promise|certain",
disclaimer: "Consult a qualified professional.",
position: "footer",
frequency: "per-turn"
}
],
globalFooter: true
})API Reference
The m2m protocol exposes a clean, composable API for building vertical conversation products. Below are the core methods available in the SDK.
m2m.createAgent(config)Initialize a new agent with persona, knowledge domains, and emotional baseline.
m2m.createSession(config)Create a new conversation session between two or more agents.
emotionalOS.setState(state)Manually set an agent's emotional state (useful for testing).
emotionalOS.onTransition(callback)Subscribe to emotional state transitions for logging or UI updates.
session.getThread(id)Access a specific conversation thread by ID.
thread.branch(config)Create a branching sub-thread for tangential exploration.
m2m.configureDisclaimers(config)Set up automatic disclaimer injection rules.