Reads recent user messages from Telegram and Discord session logs and injects them into the agent's memory context on every gateway request.
When the agent receives a message (via any channel), this bridge reads:
And prepends them as a system context block so the agent has full cross-platform awareness.
text
User message → Gateway → Memory Bridge (reads JSONL) → System context → Agent
"Conversation info (untrusted metadata):"channel: "discord" and message.role: "user"[telegram] or [discord] for clarityThe bridge reads from OpenClaw's session logs. Default path:
text
C:\Users\<user>\.openclaw\agents\main\sessions\
The bridge auto-detects the most recent JSONL file in that directory.
bash
clawhub install cross-platform-memory
Copy references/memory-bridge.ts to your mission-control's src/lib/ directory:
bash
cp references/memory-bridge.ts /path/to/mission-control/src/lib/
In your src/app/api/mc/chat/route.ts:
typescript
import { getMemoryContext } from '@/lib/memory-bridge';
// In your POST handler, before calling the gateway:
const memoryContext = await getMemoryContext();
const messages = memoryContext
? [{ role: 'system' as const, content: memoryContext }, { role: 'user' as const, content: message }]
: [{ role: 'user' as const, content: message }];
The skill uses environment variables for machine-specific paths (set these in your .env or system environment):
VariableDefaultDescriptionOPENCLAW_SESSIONS_DIR``C:\Users\.openclaw\agents\main\sessionsPath to OpenClaw session logsOPENCLAW_WORKSPACE``C:\Users\.openclaw\workspacePath to workspace files
In memory-bridge.ts:
SettingDefaultDescriptionMESSAGES_PER_PLATFORM``8Max messages per platform to includeMAX_MESSAGE_AGE_HOURS``20Only include messages from last N hoursSESSIONS_DIR``C:\Users\...\.openclaw\agents\main\sessionsPath to session logs
text
MEMORY CONTEXT:
## MEMORY.md
[Curated long-term memories]
## Today's Notes
[Daily notes]
## Recent Telegram Conversation
[telegram] Dan: message 1
[telegram] Dan: message 2
## Recent Discord Conversation
[discord] Dan: message 1
[discord] Dan: message 2
IMPORTANT: You are Sancho — use the context above to inform your responses.