Skip to content
Back to skills

Message Injector

ASecurity

OpenClaw plugin that prepends custom text to every user message before it reaches the agent. Use for: enforcing memory_search before replies, injecting system-level instructions, adding persistent reminders to every conversation turn. Install as a workspace extension — works on all channels including WebChat, Telegram, Slack, etc.

  • 21 stars
  • 0 votes
  • 0 copies
  • 6 views
  • Added September 7, 2026
developmentbashreactnodeawsgit

Security analysis

A93/100
  • highPerforms destructive filesystem operations

Pro scans all 3 files and shows the line behind each finding

Scanned September 7, 2026

npx -y skills add modbender/skill-library-mcp --skill message-injector --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Message Injector?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Message Injector
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/modbender-message-injector/badge)](https://www.skillsdirectory.com/skills/modbender-message-injector)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: message-injector
description: "OpenClaw plugin that prepends custom text to every user message before it reaches the agent. Use for: enforcing memory_search before replies, injecting system-level instructions, adding persistent reminders to every conversation turn. Install as a workspace extension — works on all channels including WebChat, Telegram, Slack, etc."
---

# 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

```bash
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:

```bash
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`:

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

### 4. Restart Gateway

```bash
openclaw gateway restart
```

## Configuration

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `enabled` | boolean | `true` | Enable or disable the injector |
| `prependText` | string | `""` | Text to prepend before every user message |

## Example Use Cases

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

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

**Inject safety rules:**
```json
"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

Files in this skill

  • SKILL.md2.4 KB
  • scripts/index.ts662 B
  • scripts/openclaw.plugin.json513 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.