Skill flagged — suspicious patterns detected

ClawHub Security flagged this skill as suspicious. Review the scan results before using.

arch-optimization

v1.0.0

OpenClaw通信协议架构优化技能包 - 提供高性能、可靠的agent间通信框架。实现大消息59%性能提升,MessagePack 35%体积减少,统一传输层架构,智能路由算法,完整错误恢复和监控体系。

0· 102·0 current·0 all-time
by木南@21b-a

Install

OpenClaw Prompt Flow

Install with OpenClaw

Best for remote or guided setup. Copy the exact prompt, then paste it into OpenClaw for 21b-a/arch-optimization.

Previewing Install & Setup.
Prompt PreviewInstall & Setup
Install the skill "arch-optimization" (21b-a/arch-optimization) from ClawHub.
Skill page: https://clawhub.ai/21b-a/arch-optimization
Keep the work scoped to this skill only.
After install, inspect the skill metadata and help me finish setup.
Use only the metadata you can verify from ClawHub; do not invent missing requirements.
Ask before making any broader environment changes.

Command Line

CLI Commands

Use the direct CLI path if you want to install manually and keep every step visible.

OpenClaw CLI

Bare skill slug

openclaw skills install arch-optimization

ClawHub CLI

Package manager switcher

npx clawhub@latest install arch-optimization
Security Scan
VirusTotalVirusTotal
Suspicious
View report →
OpenClawOpenClaw
Suspicious
medium confidence
Purpose & Capability
The name/description (agent-to-agent transport, MessagePack, routing, retries) match the included code: core/transport-layer.js, protocol-layer.js, unified-api.js and supporting tests/examples and reports. There are no obvious unrelated dependencies or credential requests in the manifest.
!
Instruction Scope
SKILL.md and README instruct copying files and running local tests. The included test scripts and examples perform filesystem writes/reads (creating inbox/outbox directories, writing JSON files) and cleanup operations. Tests reference absolute hard-coded paths (e.g. /home/kali/.openclaw/workspace/agent_comm, inboxDir: '~/workspace/agent_comm/inbox') that are inconsistent and could cause writes to unexpected locations on your machine. While filesystem I/O is part of the stated transport design, the hard-coded user path and test cleanup behavior are surprising and increase risk if run directly.
Install Mechanism
No install spec / remote downloads are present; the skill is instruction-only but ships complete source and a local packaging script (pack-delivery.sh). There are no network fetch steps in the manifest, so risk from arbitrary remote code fetch is low. The packaging script just copies and zips local files.
!
Credentials
The skill declares no environment variables or credentials, which is appropriate. However, multiple files hard-code absolute filesystem locations (notably '/home/kali/...') and assume a particular home directory layout. That is disproportionate because the skill will read/write those paths without asking for configuration, and the SKILL.md does not clearly document or parameterize where tests will create files. No external credentials are requested.
Persistence & Privilege
The skill is not always-enabled and does not request platform-level privileges. It doesn't attempt to modify other skills or global agent configuration in the provided files. The main persistence concern is ordinary file creation by tests and runtime transports (inbox/outbox/processed dirs) which is expected for a filesystem transport.
What to consider before installing
What to check and do before installing/running: 1) Inspect and edit filesystem paths: Search all core/, tests/, and examples/ for hard-coded paths like '/home/kali' or '~/workspace'. Replace them with a safe, explicit directory you control (e.g., a temp directory) or make them configurable. Tests will create, write and delete files; do not run them against your real home or production directories. 2) Run in an isolated environment: Execute tests and examples inside a disposable container, VM, or chroot where file writes are acceptable and cannot touch important data. 3) Grep for network calls / hidden endpoints: Even though the visible files show no external upload, scan the entire codebase for http(s), fetch, net/socket usage, hard-coded hostnames, or telemetry endpoints before giving it network access. 4) Backup and review: If you plan to integrate into a live agent, review core/unified-api.js and transport-layer.js to confirm behavior for retries, fallback, and where logs/stats are written. Back up any directories that might be overwritten. 5) Limit privileges: Run with a user account that has limited permissions for the directories used by the skill. Avoid running as root. 6) Ask for provenance: The source is 'unknown'. Prefer code from a known maintainer or canonical repository. If possible obtain the package from the project's official release/repo and verify checksums. If you want, I can: - point to exact lines/files where the hard-coded paths appear, - produce a short patch to parameterize the inbox/outbox paths, or - search the codebase for network calls and report findings (I can do that if you grant me the rest of the files or ask me to scan specific files).

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

latestvk973he7mypkghnvksdtkv9mzcn83csv8
102downloads
0stars
1versions
Updated 1mo ago
v1.0.0
MIT-0

🚀 OpenClaw通信协议架构优化 v1.0.0

高性能、生产就绪的agent间通信框架 - 大消息59%性能提升,MessagePack 35%体积减少


📋 技能概述

🎯 核心价值

  • 59%性能提升: 10KB大消息延迟从5.40ms降至2.20ms
  • 35%体积减少: MessagePack二进制协议显著降低网络开销
  • 统一架构: 分层设计(传输层/协议层/应用层)简化开发
  • 生产就绪: 完整错误恢复、监控、智能路由算法
  • 智能决策: 基于消息特性的自适应协议选择和传输路由

📊 已验证的性能改进

优化领域改进指标详细数据
大消息传输+59%性能提升10KB消息: 5.40ms → 2.20ms
协议层压缩-35%体积减少MessagePack平均压缩率0.65
架构统一单一API接口取代多个分散的通信API
错误恢复自动降级重试3次重试 + 传输方式降级

🚀 快速开始

安装方法

# 方法1: 使用clawhub CLI安装
clawhub install communication-protocol-optimization

# 方法2: 手动安装
# 1. 将本目录复制到 ~/.openclaw/skills/
# 2. 运行集成测试验证功能

基础使用示例

// 在您的agent代码中使用统一通信API
const { UnifiedAgentComm } = require('./core/unified-api.js');

// 创建通信实例
const comm = new UnifiedAgentComm({
  transport: {
    filesystem: { enabled: true },
    websocket: { enabled: false },
    http: { enabled: false }
  },
  protocol: {
    enableMessagePack: true,
    defaultProtocol: 'auto'
  }
});

// 发送消息
async function sendMessageExample() {
  const result = await comm.send({
    to: 'target-agent',
    message: {
      id: 'msg-' + Date.now(),
      type: 'greeting',
      content: 'Hello from optimized protocol!',
      timestamp: new Date().toISOString()
    },
    options: {
      priority: 'high',
      timeout: 5000
    }
  });
  
  console.log('✅ 消息发送成功:', result);
}

// 请求-响应模式
async function requestResponseExample() {
  const response = await comm.request({
    to: 'backend-agent',
    message: {
      action: 'process-data',
      data: { /* 您的数据 */ }
    },
    options: {
      timeout: 10000,
      retryAttempts: 3
    }
  });
  
  console.log('📨 收到响应:', response);
}

📁 文件结构

communication-protocol-optimization-v1.0.0/
├── SKILL.md                    # 本技能文档
├── README.md                  # 详细使用指南
├── FINAL_REPORT.md            # 项目最终报告
├── core/                      # ✅ 核心实现文件
│   ├── transport-layer.js     # 统一传输层 (32KB)
│   ├── protocol-layer.js      # 多协议支持层 (25KB)  
│   ├── unified-api.js         # 统一通信API (17KB)
│   ├── smart-transport.js     # 智能传输层 (15KB)
│   └── minimal-fast-path.js   # 简化快速路径 (11KB)
├── docs/                      # 📚 设计文档
│   ├── transport-layer-design.md
│   └── protocol-layer-design.md
├── tests/                     # 🧪 测试套件
│   ├── performance-comparison.js
│   ├── quick-minimal-test.js
│   └── test-transport-layer.js
├── examples/                  # 💡 使用示例
│   ├── basic-usage.js
│   ├── request-response.js
│   └── broadcast-example.js
└── reports/                   # 📊 性能报告
    ├── performance-comparison-results.json
    ├── quick-test-results.json
    └── minimal-optimization-results.json

🏗️ 架构设计

分层架构

┌─────────────────┐
│   应用层        │ ← UnifiedAgentComm API
├─────────────────┤
│   协议层        │ ← JSON / MessagePack / Protocol Buffers
├─────────────────┤
│   传输层        │ ← WebSocket / HTTP / 文件系统
└─────────────────┘

核心组件

1. 统一传输层 (transport-layer.js)

  • UnifiedTransport: 统一抽象层,支持多种传输方式
  • 智能路由: 基于消息大小、优先级自动选择最佳传输
  • 错误恢复: 自动降级、重试机制、监控集成

2. 协议层 (protocol-layer.js)

  • ProtocolManager: 多协议统一管理
  • JSONProtocol: 标准JSON序列化
  • MessagePackProtocol: 二进制协议支持(35%体积减少)
  • 智能协商: 基于消息特性自动选择最佳协议

3. 统一API (unified-api.js)

  • UnifiedAgentComm: 统一通信接口类
  • 多种模式: 发送、请求-响应、广播
  • 事件系统: 消息发送/接收/错误事件监听
  • 完整统计: 实时性能监控和统计

🛠️ 功能特性

核心功能

  1. 统一通信API: 单一接口支持所有通信需求
  2. 多协议支持: JSON + MessagePack (扩展支持Protocol Buffers)
  3. 智能路由: 基于消息特性的自动传输选择
  4. 错误恢复: 自动重试、降级机制、完整监控
  5. 性能监控: 内置指标收集和性能分析

🔧 高级特性

  1. 自适应协议选择: 小消息用JSON,大消息用MessagePack
  2. 传输方式降级: WebSocket失败时自动降级到HTTP/文件系统
  3. 消息优先级: 支持高/中/低优先级消息处理
  4. 广播支持: 同时向多个agents发送消息
  5. 请求-响应模式: 完整的RPC式通信

📈 性能优化

  1. 大消息优化: 10KB消息59%性能提升
  2. 协议层压缩: MessagePack平均35%体积减少
  3. 快速路径: 小消息专用优化路径
  4. 内存优化: 高效的缓冲区管理和资源回收

🧪 测试验证

运行测试套件

# 进入技能目录
cd ~/.openclaw/skills/communication-protocol-optimization

# 运行完整性能测试
node tests/performance-comparison.js

# 运行快速功能测试
node tests/quick-minimal-test.js

# 运行传输层测试
node tests/test-transport-layer.js

预期测试结果

  • ✅ 所有核心功能测试通过
  • ✅ 性能改进验证: 大消息59%提升
  • ✅ 协议压缩验证: MessagePack 35%体积减少
  • ✅ 错误恢复验证: 自动降级和重试机制
  • ✅ 兼容性验证: 与现有agents完全兼容

🔄 集成指南

与新项目集成

// 1. 引入统一API
const { UnifiedAgentComm } = require('communication-protocol-optimization/core/unified-api.js');

// 2. 创建通信实例
const agentComm = new UnifiedAgentComm({
  // 传输配置
  transport: {
    filesystem: { enabled: true },
    websocket: { enabled: false },
    http: { enabled: false }
  },
  
  // 协议配置
  protocol: {
    defaultProtocol: 'auto', // 自动选择最佳协议
    enableMessagePack: true, // 启用MessagePack压缩
    json: { /* JSON协议配置 */ },
    msgpack: { /* MessagePack协议配置 */ }
  },
  
  // 行为配置
  behavior: {
    defaultTimeout: 5000,
    retryAttempts: 3,
    enableBroadcast: true
  }
});

// 3. 开始使用
async function communicate() {
  // 发送消息
  const result = await agentComm.send({
    to: 'target-agent',
    message: { /* 消息内容 */ },
    options: { priority: 'high' }
  });
}

与现有项目迁移

  1. 逐步替换: 先在新功能中使用统一API
  2. 并行运行: 旧系统与新架构可并行运行
  3. 性能监控: 迁移过程中监控性能变化
  4. 完全切换: 验证无问题后全面迁移

⚙️ 配置选项

传输层配置

transport: {
  // 文件系统传输 (默认启用)
  filesystem: {
    enabled: true,
    inboxDir: '~/workspace/agent_comm/inbox',
    outboxDir: '~/workspace/agent_comm/outbox',
    processedDir: '~/workspace/agent_comm/processed'
  },
  
  // WebSocket传输 (可选)
  websocket: {
    enabled: false,
    url: 'ws://localhost:8080',
    reconnectInterval: 5000
  },
  
  // HTTP传输 (可选)
  http: {
    enabled: false,
    baseUrl: 'http://localhost:3000',
    timeout: 10000
  }
}

协议层配置

protocol: {
  // 默认协议选择策略
  defaultProtocol: 'auto', // 'json', 'msgpack', 'auto'
  
  // 启用MessagePack支持
  enableMessagePack: true,
  
  // JSON协议配置
  json: {
    prettyPrint: false,
    maxDepth: 50
  },
  
  // MessagePack协议配置
  msgpack: {
    compressionLevel: 1,
    useRealMessagePack: true
  }
}

行为配置

behavior: {
  // 默认超时时间 (毫秒)
  defaultTimeout: 5000,
  
  // 重试次数
  retryAttempts: 3,
  
  // 重试延迟 (毫秒)
  retryDelay: 1000,
  
  // 启用广播功能
  enableBroadcast: true,
  
  // 性能监控
  enableMetrics: true,
  metricsUpdateInterval: 60000 // 1分钟
}

📊 性能监控

内置监控指标

// 获取性能统计
const metrics = agentComm.getMetrics();

console.log('📊 通信性能统计:');
console.log('  发送总数:', metrics.sent.total);
console.log('  成功发送:', metrics.sent.successful);
console.log('  失败发送:', metrics.sent.failed);
console.log('  平均延迟:', metrics.latency.average + 'ms');
console.log('  协议使用:', metrics.protocolUsage);
console.log('  传输方式:', metrics.transportUsage);

监控数据可视化

// 实时性能事件监听
agentComm.on('metrics-update', (metrics) => {
  console.log('📈 性能指标更新:', {
    timestamp: metrics.timestamp,
    sentLastMinute: metrics.sentLastMinute,
    successRate: metrics.successRate + '%',
    avgLatency: metrics.avgLatency + 'ms'
  });
});

// 错误事件监听
agentComm.on('error', (error, context) => {
  console.error('❌ 通信错误:', {
    message: error.message,
    context: context,
    timestamp: new Date().toISOString()
  });
});

🚨 故障排除

常见问题

1. 消息发送失败

// 检查传输层配置
console.log('传输层状态:', agentComm.getTransportStatus());

// 检查文件系统权限
// 确保 ~/workspace/agent_comm/inbox 目录存在且有写入权限

// 启用详细日志
agentComm.setLogLevel('debug');

2. 性能不达预期

// 运行性能测试验证
node tests/performance-comparison.js

// 检查消息大小
// 大消息(>1KB)才能看到显著优化效果

// 验证协议选择
console.log('当前协议选择:', agentComm.getProtocolStats());

3. MessagePack不可用

// 检查依赖
const msgpack = require('@msgpack/msgpack');
console.log('MessagePack版本:', msgpack.version);

// 回退到JSON
const comm = new UnifiedAgentComm({
  protocol: {
    enableMessagePack: false,
    defaultProtocol: 'json'
  }
});

调试工具

# 运行诊断脚本
cd ~/.openclaw/skills/communication-protocol-optimization
node examples/debug-tools.js

# 查看性能报告
cat reports/performance-comparison-results.json | jq '.summary'

🔮 未来扩展

短期计划 (v1.1.0)

  1. Protocol Buffers集成: 进一步优化二进制协议性能
  2. 实时监控仪表板: Web界面可视化通信性能
  3. 智能算法优化: 基于机器学习的自适应路由

长期规划 (v2.0.0)

  1. 分布式传输: 支持跨节点agent通信
  2. 流式消息处理: 大文件分块传输
  3. 安全增强: 端到端加密和认证
  4. 协议扩展: 支持更多行业标准协议

📄 许可证与支持

许可证

  • 开源协议: MIT License
  • 商业使用: 允许
  • 修改分发: 允许,需保留版权声明

技术支持

  • 问题报告: 通过GitHub Issues或社区论坛
  • 功能请求: 欢迎提交功能建议
  • 贡献指南: 接受Pull Requests

版本历史

  • v1.0.0 (2026-03-21): 初始发布,核心架构优化完成
  • 主要特性: 59%性能提升,35%体积减少,统一API

🎯 使用场景

推荐场景

  1. 高性能agent通信: 需要低延迟、高吞吐量的agent系统
  2. 大规模消息处理: 处理大量或大体积消息的应用
  3. 生产环境部署: 需要完整错误恢复和监控的系统
  4. 团队协作开发: 多agent协同工作的复杂项目

成功案例

  • OpenClaw监控系统: 实时性能数据收集和展示
  • 团队协作框架: 多agent任务分配和状态同步
  • 生产环境通信: 可靠的agent间消息传递

📞 获取帮助

文档资源

  • 详细文档: 查看 docs/ 目录中的设计文档
  • 使用示例: 查看 examples/ 目录中的代码示例
  • 性能报告: 查看 reports/ 目录中的测试结果

社区支持

快速联系

// 技能使用问题反馈模板
const feedback = {
  skill: 'communication-protocol-optimization',
  version: '1.0.0',
  issue: '描述您的问题...',
  environment: 'OpenClaw版本、Node.js版本等',
  reproduction: '重现步骤...'
};

技能状态: ✅ 生产就绪
最后更新: 2026-03-22
兼容性: OpenClaw 1.0+, Node.js 16+
推荐指数: ⭐⭐⭐⭐⭐ (核心通信基础设施)

Comments

Loading comments...