Message Split

v1.0.0

长消息自动拆分 skill。当回复内容超过渠道限制时,自动将消息拆分为多条有序发送,避免截断或丢消息。Auto-split long messages into smaller chunks before sending, with sequence markers.

0· 96·0 current·0 all-time
by退役前写代码的@54meteor
Security Scan
VirusTotalVirusTotal
Pending
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
Name/description (auto-split long messages) match the SKILL.md code and prose. No unrelated env vars, binaries, or install steps are requested.
Instruction Scope
Runtime instructions only describe splitting logic and calling a messaging primitive (message(action="send", ...)). The skill does not instruct reading files, accessing credentials, or sending data to external endpoints beyond the channel send call.
Install Mechanism
No install spec or code files (instruction-only). Nothing is downloaded or written to disk by the skill itself.
Credentials
No environment variables, credentials, or config paths are required. The declared needs are minimal and appropriate for the stated task.
Persistence & Privilege
Skill is not always-enabled and does not request elevated persistence or modifications to other skills or system settings. It relies on existing agent messaging primitives.
Assessment
This skill appears safe and coherent: it only implements splitting logic and uses the agent's message send primitive. Before installing, verify that your agent environment exposes the expected message(action="send", channel, message) API, and test behavior on each channel (headers, encoding, rate limits, and how multi-message sequences appear to users). Also consider whether adding sequence headers or sending many small messages could be undesirable for your use case (spam, rate limits, or formatting). Because it's instruction-only and requests no credentials, the security risk is low.

Like a lobster shell, security has layers — review code before you run it.

latestvk9764zzbetk5cm99ghpvdd3g4183j52w
96downloads
0stars
1versions
Updated 3w ago
v1.0.0
MIT-0

Message Split Skill

Problem

Many messaging channels (Feishu, Telegram, etc.) have a per-message character limit (~4000 chars for Feishu). When a response exceeds this limit, it either gets truncated or silently fails, leaving the user with no feedback.

Solution

Before sending any message, check its length and split if necessary.

Usage

def send_long_message(text, channel="{active_channel}"):
    """
    Send a message, splitting it into multiple chunks if it exceeds the length limit.
    
    Args:
        text: The message text to send
        channel: Target channel (feishu/telegram/discord/whatsapp/signal/imessage/openclaw-weixin)
    
    Returns:
        Number of chunks sent
    """
    MAX_LEN = 3600  # Feishu limit with margin
    CHUNK_HEADER = "[{i}/{total}]\n"
    
    if len(text) <= MAX_LEN:
        message(action="send", channel=channel, message=text)
        return 1
    
    chunks = split_text(text, MAX_LEN)
    total = len(chunks)
    
    for i, chunk in enumerate(chunks, 1):
        header = f"[{i}/{total}]\n" if total > 1 else ""
        message(action="send", channel=channel, message=header + chunk)
    
    return total


def split_text(text, max_len):
    """
    Split text into chunks of at most max_len characters.
    Attempts to split at sentence boundaries or line breaks for readability.
    """
    import re
    
    # Try to split at sentence-ending punctuation first
    sentence_split = re.split(r'(?<=[。!?.!?])\s+', text)
    
    chunks = []
    current = ""
    
    for sentence in sentence_split:
        if len(current) + len(sentence) + 1 <= max_len:
            current += (" " + sentence if current else sentence)
        else:
            if current:
                chunks.append(current)
            # If single sentence exceeds limit, split by words/characters
            if len(sentence) > max_len:
                for i in range(0, len(sentence), max_len - 100):
                    chunks.append(sentence[i:i + max_len - 100])
                current = ""
            else:
                current = sentence
    
    if current:
        chunks.append(current)
    
    return chunks

Channel Limits Reference

ChannelMax chars (approx)Notes
Feishu4000Hard limit
Telegram4096
Discord2000Embed limit 6000
WhatsApp65000But relayed messages get truncated
Signal700Very low
iMessage~4000Via macOS relay

Notes

  • Always use MAX_LEN = 3600 as a safe default (leaves room for header)
  • If channel is unknown, default to feishu behavior
  • Splitting is done on word/sentence boundaries when possible to preserve readability
  • Sequence headers [{i}/{total}] are only added when total > 1

Comments

Loading comments...