← 返回
开发者工具 中文

Message Injector

OpenClaw plugin that prepends custom text to every user message before it reaches the agent. Use for: enforcing memory_search before replies, injecting syste...
OpenClaw插件,在用户消息送达代理前自动添加自定义文本。用于:强制回复前执行memory_search、注入系统...
harukaon
开发者工具 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 1,056
下载
💾 11
安装
1
版本
#latest#memory#plugin#utility

概述

Message Injector

A lightweight OpenClaw workspace extension that uses the before_agent_start hook to inject custom text into every user message via prependContext.

Installation

1. Create the extension directory

mkdir -p ~/.openclaw/workspace/.openclaw/extensions/message-injector

2. Copy the plugin files

Copy scripts/index.ts and scripts/openclaw.plugin.json to the extension directory:

cp scripts/index.ts ~/.openclaw/workspace/.openclaw/extensions/message-injector/
cp scripts/openclaw.plugin.json ~/.openclaw/workspace/.openclaw/extensions/message-injector/

3. Add configuration

Add the following to ~/.openclaw/openclaw.json under plugins.entries:

"message-injector": {
  "enabled": true,
  "config": {
    "enabled": true,
    "prependText": "Your custom text here"
  }
}

4. Restart Gateway

openclaw gateway restart

Configuration

FieldTypeDefaultDescription
-----------------------------------
enabledbooleantrueEnable or disable the injector
prependTextstring""Text to prepend before every user message

Example Use Cases

Force memory search:

"prependText": "[⚠️ 回答前必须先 memory_search 检索相关记忆,禁止凭印象回答]"

Add persistent context:

"prependText": "[当前项目:my-app | 技术栈:React + Node.js | 部署环境:AWS]"

Inject safety rules:

"prependText": "[RULE: Always verify file paths before deletion. Never run rm -rf without confirmation.]"

How It Works

The plugin registers a before_agent_start hook. When triggered, it returns { prependContext: prependText } which OpenClaw prepends to the user's message before the agent processes it. This is a hard injection at the Gateway level — the agent cannot skip or ignore it.

Source Code

GitHub: https://github.com/Harukaon/openclaw-message-injector

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-29 09:05 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

productivity

Workspace Indexer

harukaon
自动扫描和更新 workspace 目录索引,记录目录用途、运行状态、相关记忆及搜索关键词,不深入分析项目文件。
★ 0 📥 810
developer-tools

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 68 📥 180,176
developer-tools

Gog

steipete
Google Workspace 命令行工具,支持 Gmail、日历、云端硬盘、通讯录、表格和文档。
★ 921 📥 185,799