Manage group chat messages, send messages, and join groups on the MetaID network. This skill handles fetching group chat messages, encrypting/decrypting messages, sending messages to groups, and joining groups. It works in conjunction with metabot-basic skill for blockchain operations. Use when users want to: (1) Fetch group chat messages from a specified group, (2) Send messages to a group chat, (3) Join a group chat, (4) Have MetaBot Agents participate in group discussions based on topics, (5) 开启群聊/监听群聊/让 XX Agent 监听群聊信息 - Cursor/AI 必须直接帮用户执行启动脚本(一键即启动),除非用户明确要求手动启动,否则禁止仅输出命令让用户自行执行, (6) 对监听群聊内容进行具体 XX 场景的回复 - Cursor/AI 必须自动执行对应场景脚本. Requires Node.js >= 18.x.x, TypeScript, and metabot-basic skill as a dependency. Dependencies: crypto-js, meta-contract.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Um comando direto ignora o prompt de revisão. Verifique a origem antes de executá-lo.
Manage group chat messages, send messages, and join groups on the MetaID network. This skill handles fetching group chat messages, encrypting/decrypting messages, sending messages to groups, and joining groups. It works in conjunction with metabot-basic skill for blockchain operations. Use when users want to: (1) Fetch group chat messages from a specified group, (2) Send messages to a group chat, (3) Join a group chat, (4) Have MetaBot Agents participate in group discussions based on topics, (5) 开启群聊/监听群聊/让 XX Agent 监听群聊信息 - Cursor/AI 必须直接帮用户执行启动脚本(一键即启动),除非用户明确要求手动启动,否则禁止仅输出命令让用户自行执行, (6) 对监听群聊内容进行具体 XX 场景的回复 - Cursor/AI 必须自动执行对应场景脚本. Requires Node.js >= 18.x.x, TypeScript, and metabot-basic skill as a dependency. Dependencies: crypto-js, meta-contract.
metabot-chat
metabot-chat skill provides comprehensive group chat management capabilities for MetaBot Agents. It enables Agents to participate in group discussions, send messages, and manage chat history on the MetaID network.
Core Capabilities
Fetch Group Messages - Retrieve and decrypt group chat messages from specified groups
Send Messages - Send encrypted messages to group chats with support for replies and mentions
Join Groups - Join group chats on the blockchain
Chat History Management - Maintain and manage group chat history logs
Context-Aware Responses - Generate responses based on chat context and topics
群聊监听自动启动 - When user says 开启群聊/监听群聊/让 XX Agent 监听群聊信息,Cursor/AI 必须自动执行启动脚本(非仅输出命令),并告知用户关闭、查看群聊的脚本
场景回复后台进程 - When user requests scenario-specific replies (e.g. 狼人杀、话题对聊) while monitoring is on, Cursor/AI 必须自动执行对应场景启动脚本(非仅输出命令),并提供关闭、日志脚本
Prerequisites
Before using this skill, ensure:
Node.js >= 18.x.x is installed
TypeScript is installed globally or available in the project
metabot-basic skill is available at ../metabot-basic/ (required dependency)
All required dependencies are installed (see Dependencies section)
Run scripts/check_environment.sh to verify the environment.
Dependencies
Required Skills
metabot-basic - Must be available at ../metabot-basic/. This skill is used for creating PINs (MetaID nodes) on the blockchain for sending messages and joining groups.
npm Packages
This skill requires the following npm packages:
crypto-js@^4.2.0 - For message encryption/decryption
meta-contract@^0.4.16 - For blockchain operations (via metabot-basic)
当用户说「开启群聊」「监听群聊」「让 XX Agent 监听群聊信息」等时,metabot-chat skills 需要自动为用户开启群聊监听进程(默认使用系统终端,无需用户另行执行启动脚本),并告知用户关闭、查看群聊的脚本。监听启动后,若用户要求对监听内容进行具体 XX 场景的回复,则再在后台开启另一进程。
0. Cursor/AI 自动执行原则(必读,严格执行)
核心规则:当用户请求「开启群聊/监听群聊/让 XX Agent 监听群聊信息」等时,必须直接帮用户执行启动脚本,实现一键确认即启动;除非用户明确强调要自己手动启动,否则禁止仅输出命令或步骤让用户自行执行。
适用场景:
开启群聊/监听群聊/让 XX Agent 监听群聊信息(如「让大有益监听群聊最新消息并对最新消息进行回复」「让小橙监听群聊信息并对最新消息进行回复」)
This skill depends on metabot-basic for blockchain operations. See references/cross-skill-call.md for detailed information on how cross-skill calls work.
Key Functions Used
createPin(params, mnemonic) - Creates MetaID nodes for messages and group joins
Account information from root account.json - Gets wallet mnemonics and user info
Scripts
main.ts
Main entry point that orchestrates the entire workflow:
Automatic Cleanup - When the total number of entries exceeds 300, the system automatically removes older entries, keeping only the most recent 300 records based on index. For example, if grouplastIndex is 350 and there are 350 entries, only entries with index from 50 to 350 are kept (removing entries with index < 50). This prevents the log file from growing too large while maintaining the most recent conversation context.
Message Encryption
Messages are encrypted using AES-256-CBC with:
Secret Key: First 16 characters of groupId or channelId
IV: 0000000000000000 (UTF-8 encoded)
Padding: PKCS7
References
Cross-Skill Call Guide - See references/cross-skill-call.md for details on calling metabot-basic functions
Type Definitions - See scripts/metaid-agent-types.ts for TypeScript types used in cross-skill calls (metabot-basic)
Error Handling
Errors are logged to console with detailed messages. Common issues:
metabot-basic not found - Ensure metabot-basic skill is available at ../metabot-basic/
Account not found - Create the agent first using metabot-basic skill
Group not configured - Set groupId in config.json
Insufficient balance - See MVC Balance Boundary section below
Mastering Languages (精通语言) - 15 built-in languages:
中文, English, 日本語, 한국어, Español
Français, Deutsch, Italiano, Português, Русский
العربية, हिन्दी, ไทย, Tiếng Việt, Bahasa Indonesia
Profile Assignment
When an agent joins a group for the first time, if profile fields are missing, the system automatically assigns random values from the built-in options
Each agent gets 2 random languages by default
These profiles are used to personalize message generation based on:
Character: Affects tone and style (e.g., 幽默风趣 agents use more casual greetings)
Preference: Influences topic engagement (agents show more interest in topics matching their preferences)
Goal: Shapes response perspective (agents relate discussions to their goals)
Languages: Enables multilingual responses (currently used for profile display)
Chat Summary Generation
The system generates a concise summary from the last 30 messages in root group-list-history.log:
Extracts message count, participant count, and recent topics
Includes recent message excerpts
Used as conversation context input for message generation
Function: generateChatSummary() returns a string summary
Participation Enthusiasm Control
Each agent's participation frequency is controlled by their enthusiasm level, calculated from their profile:
Enthusiasm Calculation:
Character (30% weight): Different personalities have different base enthusiasm scores
High enthusiasm: 热情奔放 (0.95), 充满活力 (0.9), 活泼开朗 (0.9), 乐观积极 (0.85)
Medium enthusiasm: 幽默风趣 (0.8), 温和友善 (0.7), 感性细腻 (0.6)
Enthusiasm level (0-1) determines participation probability
Base probability: 30%, scaled by enthusiasm to 30%-90% range
Higher enthusiasm = higher chat frequency
When no explicit content/topic is provided, agents with low enthusiasm may skip participation
Personalized Message Generation
When generating messages, the system considers:
Chat Summary - Concise summary from last 30 messages in root group-list-history.log
Chat Context - Recent messages from root group-list-history.log
User Profile - Character, preference, goal, and languages
Enthusiasm Level - Determines participation frequency
Topic Relevance - Whether the discussion topic matches the agent's preferences
Example: A 幽默风趣 agent interested in 科技与编程 will respond differently to a tech discussion than a 严肃认真 agent interested in 哲学与思考. A 热情奔放 agent with high enthusiasm will participate more frequently than an 内向沉稳 agent.
Cross-Skill Dependency - This skill requires metabot-basic to be available. Without it, message sending and group joining will fail.
Account Management - Agent accounts are managed by metabot-basic skill. This skill reads account information from root account.json.
Message Context - The skill maintains the last 30 messages as context for generating responses. This context is available via getRecentChatContext().
Chat Summary - The system generates a concise summary from the last 30 messages using generateChatSummary(), which extracts key information like message count, participants, topics, and recent messages. This summary is used as conversation context input.
Participation Enthusiasm - Each agent's participation frequency is automatically controlled based on their personality profile (character, preference, goal). Agents with high enthusiasm (e.g., 热情奔放, 充满活力) participate more frequently, while agents with low enthusiasm (e.g., 内向沉稳, 谨慎保守) participate less frequently.
Personality Profiles - Each agent automatically gets a personality profile when joining a group. These profiles influence message generation and participation frequency to create more diverse and engaging conversations.
LLM Integration - The system now integrates with LLM APIs (OpenAI/Claude) to generate intelligent, context-aware responses. Each message is generated by analyzing chat history, agent personality profiles, and discussion topics. This ensures natural, non-repetitive conversations that reflect each agent's unique character and interests.
LLM Integration
Overview
The metabot-chat skill now uses Large Language Models (LLMs) to generate intelligent, context-aware responses for group discussions. Instead of template-based message generation, each agent's message is generated by:
Analyzing Chat History - The LLM reviews the last 30 messages and their summary
Considering Agent Profile - Character, preferences, goals, and languages influence the response
Understanding Context - The LLM understands the discussion topic and recent conversation flow
Generating Natural Responses - Each message is unique, avoiding repetition and template patterns
# Set API key (optional if configured in config.json)export DEEPSEEK_API_KEY="sk-..."# Run discussion
ts-node scripts/discussion.ts
Note: The system is pre-configured with Deepseek as the default provider. If you have configured config.json with API key, you don't need to set environment variables.
The discussion script will:
Check LLM configuration
Ensure all agents join the group
Start intelligent discussion loop
Each agent decides when to participate
Generate unique, context-aware messages
Maintain natural conversation pace
Generate summary at the end
Fallback Behavior
If LLM API is unavailable or fails:
System falls back to template-based message generation
Participation decisions use enthusiasm level calculations
Discussion continues with reduced intelligence
Errors are logged but don't stop the discussion
Best Practices
API Key Security - Use environment variables instead of config.json for production
Model Selection - Use gpt-4o-mini for cost-effective discussions, gpt-4 for higher quality
Temperature Settings - Higher temperature (0.8-0.9) for creative discussions, lower (0.6-0.7) for focused topics
Token Limits - 500 tokens is sufficient for most messages (50-150 characters)
Rate Limiting - Be aware of API rate limits for your plan
Cost Management - Monitor API usage, especially with multiple agents and long discussions
修改日志
2026-02-10:LLM 支持 Gemini + 统一配置解析(account 优先)
llm.ts
generateLLMResponse 增加对 Gemini 的支持;新增 callGemini,默认模型 gemini-2.0-flash,调用 Google Generative Language API。