Agent Memory — Telegram Memory for AI Agents
Gives you persistent long-term memory across Telegram channels and groups. Search conversations, generate digests, extract decisions and action items.
First Run (if AGENTMEMORYAPI_KEY is not set)
When the user asks anything related to Telegram memory, channels, or this skill, and AGENT_MEMORY_API_KEY is not configured, walk them through setup:
- 1. Tell the user: "To use Telegram memory, you need an API key. Open @AgentMemoryBot in Telegram: https://t.me/AgentMemoryBot"
- In the bot: press /start → 📱 Connect Telegram (share contact, enter reversed code) → 🔑 API Keys → ➕ Create Key
- Ask the user to paste the key (starts with
amk_) - Once they give you the key, save it to the OpenClaw config:
CODEBLOCK0
Or if openclaw.json doesn't exist or has no skills section, create it. Then tell the user to restart the OpenClaw session.
How to Use
All API calls use: Authorization: Bearer $AGENT_MEMORY_API_KEY
Base URL: INLINECODE3
Search Memory
Find information across synced Telegram channels. Use for any question about channel content.
CODEBLOCK1
- -
scope: optional — @username for one channel, folder:Name for a folder, omit for all - Response: INLINECODE7
List Sources
See which channels are connected.
CODEBLOCK2
Add Source
Connect a new Telegram channel. User must have connected their Telegram in the bot first.
CODEBLOCK3
sync_range options: 1w, 1m, 3m, 6m, 1y
Get Digest
Summarize conversations for a period.
CODEBLOCK4
period options: 1d, 3d, 7d, 30d
Extract Decisions
Get decisions, action items, and open questions.
CODEBLOCK5
Sync Status
Check if channels are still syncing after add_source.
CODEBLOCK6
Balance
Check remaining points.
CODEBLOCK7
When to Use Which Operation
- - "What did they discuss about X?" → search with the topic as query
- "What happened this week in @channel?" → digest with period=7d
- "What decisions were made?" → decisions
- "Connect @newchannel" → addsource, then wait and check syncstatus
- "What channels do I have?" → list_sources
- "How many points left?" → balance
Costs
1 point ≈ $0.01. Search: 3 pts, Digest: 25 pts, Decisions: 12 pts. Top up via TON in @AgentMemoryBot.
Agent Memory — AI代理的Telegram记忆功能
在Telegram频道和群组中提供持久化的长期记忆。可搜索对话、生成摘要、提取决策和行动项。
首次运行(若未设置AGENTMEMORYAPI_KEY)
当用户询问任何与Telegram记忆、频道或本技能相关的问题,且AGENTMEMORYAPI_KEY未配置时,引导用户完成设置:
- 1. 告知用户:要使用Telegram记忆功能,您需要一个API密钥。请在Telegram中打开@AgentMemoryBot:https://t.me/AgentMemoryBot
- 在机器人中:按/start → 📱 连接Telegram(分享联系方式,输入反向代码)→ 🔑 API密钥 → ➕ 创建密钥
- 要求用户粘贴密钥(以amk_开头)
- 用户提供密钥后,将其保存到OpenClaw配置中:
bash
添加到openclaw.json技能配置
cat ~/.openclaw/openclaw.json | jq .skills.entries[agent-memory] = {env: {AGENT
MEMORYAPI
KEY: USERKEY_HERE}} > /tmp/oc.json && mv /tmp/oc.json ~/.openclaw/openclaw.json
若openclaw.json不存在或没有skills部分,则创建该文件。然后告知用户重启OpenClaw会话。
使用方法
所有API调用使用:Authorization: Bearer $AGENTMEMORYAPI_KEY
基础URL:https://agent.ai-vfx.com
搜索记忆
在同步的Telegram频道中查找信息。用于任何关于频道内容的提问。
bash
curl -s -X POST https://agent.ai-vfx.com/api/v1/memory/search \
-H Content-Type: application/json \
-H Authorization: Bearer $AGENTMEMORYAPI_KEY \
-d {query: 关于主题X讨论了什么, scope: @channel, limit: 10}
- - scope:可选 — @username用于单个频道,folder:Name用于文件夹,省略则搜索全部
- 响应:{answer: ..., sources: [{url: https://t.me/..., channel: ...}]}
列出来源
查看已连接的频道。
bash
curl -s https://agent.ai-vfx.com/api/v1/sources \
-H Authorization: Bearer $AGENTMEMORYAPI_KEY
添加来源
连接新的Telegram频道。用户必须先通过机器人连接其Telegram账号。
bash
curl -s -X POST https://agent.ai-vfx.com/api/v1/sources/add \
-H Content-Type: application/json \
-H Authorization: Bearer $AGENTMEMORYAPI_KEY \
-d {handle: @channelusername, syncrange: 1m}
sync_range选项:1w, 1m, 3m, 6m, 1y
获取摘要
汇总一段时间内的对话。
bash
curl -s -X POST https://agent.ai-vfx.com/api/v1/digest \
-H Content-Type: application/json \
-H Authorization: Bearer $AGENTMEMORYAPI_KEY \
-d {scope: @channel, period: 7d}
period选项:1d, 3d, 7d, 30d
提取决策
获取决策、行动项和未解决的问题。
bash
curl -s -X POST https://agent.ai-vfx.com/api/v1/decisions \
-H Content-Type: application/json \
-H Authorization: Bearer $AGENTMEMORYAPI_KEY \
-d {scope: @channel, topic: 可选过滤器}
同步状态
检查添加来源后频道是否仍在同步。
bash
curl -s https://agent.ai-vfx.com/api/v1/sync-status \
-H Authorization: Bearer $AGENTMEMORYAPI_KEY
余额
查看剩余点数。
bash
curl -s https://agent.ai-vfx.com/api/v1/account/balance \
-H Authorization: Bearer $AGENTMEMORYAPI_KEY
何时使用何种操作
- - 他们讨论了关于X的什么内容? → 以该主题作为查询进行搜索
- @channel本周发生了什么? → 使用period=7d进行摘要
- 做出了哪些决策? → 决策
- 连接@newchannel → 添加来源,然后等待并检查同步状态
- 我有哪些频道? → 列出来源
- 还剩多少点数? → 余额
费用
1点 ≈ $0.01。搜索:3点,摘要:25点,决策:12点。通过@AgentMemoryBot使用TON充值。