Skip to main content

CyberMem Agent Protocol

🧠 Context Daemon Architecture

CyberMem — production-grade MCP server that transforms AI from stateless tools into context-aware agents with persistent, cross-client memory.

Design Philosophy

┌────────────────────────────────────────────────────────┐
│ CyberMem Daemon │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Claude │ │ Cursor │ │ Copilot │ │
│ │ Desktop │ │ IDE │ │ Chat │ │
│ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ │
│ │ │ │ │
│ └────────────────┼────────────────┘ │
│ ▼ │
│ ┌───────────────────────┐ │
│ │ Unified Memory DB │ │
│ │ (OpenMemory HSG) │ │
│ └───────────────────────┘ │
└────────────────────────────────────────────────────────┘

📋 Server Policy (MCP Handshake)

Where to store: MCP initialize response → serverInfo.instructions

{
"jsonrpc": "2.0",
"id": 1,
"result": {
"protocolVersion": "2024-11-05",
"serverInfo": {
"name": "cybermem",
"version": "0.12.4"
},
"instructions": "CyberMem is a persistent context daemon. PROTOCOL: (1) On session start, call query_memory with 'user context profile' to load persona. (2) Store new insights immediately with add_memory - include FULL content, not summaries. (3) Refresh context every 6h for active topics, 24h for projects. (4) Always include tags: [topic, year, source:your-client-name]. (5) Priority: CyberMem context > session context > training data."
}
}

🔄 Agent Lifecycle

1. Session Start (MANDATORY)

┌─────────────────────────────────────────────────┐
│ 1. MCP Initialize → receive server instructions │
│ 2. query_memory("user context profile") │
│ 3. Load returned memories into session context │
│ 4. Greet user with context awareness │
└─────────────────────────────────────────────────┘

2. During Session

┌─────────────────────────────────────────────────┐
│ → Learn something new? → add_memory() │
│ → Need context? → query_memory() │
│ → User corrects info? → update_memory() │
│ → Active topic/prevent decay? → reinforce() │
└─────────────────────────────────────────────────┘

3. Session End

┌─────────────────────────────────────────────────┐
│ 1. Store any unsaved insights │
│ 2. Update modified memories │
│ 3. Log session summary (optional) │
└─────────────────────────────────────────────────┘

📝 Memory Format Standard

Required Fields

interface CyberMemory {
content: string; // FULL text, no truncation
tags: string[]; // Always include: topic, year, source
}

🔄 Refresh Protocol

CategoryIntervalTrigger
Active search (job/project)6 hoursHigh priority
Project status24 hoursDaily sync
Insights/learnings7 daysWeekly review
Health/personal30 daysMonthly check
Static factsNeverOnly on correction

Auto-Refresh Pattern

if (memory.age > category.refreshInterval) {
query_memory(memory.topic) → validate → update_memory()
}

Structural vs Metabolic Operations

CyberMem distinguishes between changing the "bones" of a memory and boosting its "energy":

OperationPurposeImpactCost
UpdateStructural mutation of content/tagsRe-embeds & re-links memoryHigh
ReinforceMetabolic boost to salienceUpdates recency & prevents decayLow

Rule of Thumb:

  • Use update_memory when facts change.
  • Use reinforce_memory when a topic remains active or important but hasn't changed.

🚨 Priority Rules

1. CyberMem context  > Session context  > Training data
(persistent) (ephemeral) (stale)

2. Recent memories > Old memories
(this week) (months ago)

3. User corrections > Agent assumptions
(explicit) (inferred)

🔐 Integrity Rules

RuleDoDon't
Full contentStore complete text with detailsTruncate or summarize
Source trackingInclude source:client-name tagAnonymous writes
TimestampsLet server handle created_atFake timestamps
ConflictsLast-write-wins, log conflictSilent overwrite
ArchivalQuery before update to preserveDelete without backup

📌 Quick Reference

ActionMCP ToolWhenCost
Load contextquery_memorySession startLow
Save insightadd_memoryAfter learningHigh
Find memoriesquery_memoryBefore decisionsLow
List recentlist_memoriesFor overviewLow
Update memoryupdate_memoryAfter correctionHigh
Boost memoryreinforce_memoryActive topicsLow

🎯 Goal: Context Daemon

CyberMem transforms AI assistants from:

❌ Stateless tool (forgets everything)

✅ Context daemon (remembers, syncs, grows)

Result: All AI clients share unified, persistent understanding of user context.