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 system-level instructions, adding persistent reminders to every conversation turn. Install as a workspace extension — works on all channels including WebChat, Telegram, Slack, etc.
Packaged view
This page reorganizes the original catalog entry around fit, installability, and workflow context first. The original raw source lives below.
Install command
npx @skill-hub/cli install openclaw-skills-message-injector
Repository
Skill path: skills/harukaon/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 system-level instructions, adding persistent reminders to every conversation turn. Install as a workspace extension — works on all channels including WebChat, Telegram, Slack, etc.
Open repositoryBest for
Primary workflow: Ship Full Stack.
Technical facets: Full Stack, Integration.
Target audience: everyone.
License: Unknown.
Original source
Catalog source: SkillHub Club.
Repository owner: openclaw.
This is still a mirrored public skill entry. Review the repository before installing into production workflows.
What it helps with
- Install message-injector into Claude Code, Codex CLI, Gemini CLI, or OpenCode workflows
- Review https://github.com/openclaw/skills before adding message-injector to shared team environments
- Use message-injector for development workflows
Works across
Favorites: 0.
Sub-skills: 0.
Aggregator: No.
Original source / Raw 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
---
## Referenced Files
> The following files are referenced in this skill and included for context.
### scripts/index.ts
```typescript
import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
export default function register(api: OpenClawPluginApi) {
const cfg = api.pluginConfig as { prependText?: string; enabled?: boolean } | undefined;
const enabled = cfg?.enabled !== false;
const prependText = cfg?.prependText || "";
if (!enabled || !prependText) {
api.logger.info("message-injector: disabled or no prependText configured.");
return;
}
api.logger.info("message-injector: active.");
api.on("before_agent_start", async (event) => {
if (!event.prompt || event.prompt.length < 1) return;
return { prependContext: prependText };
});
}
```
### scripts/openclaw.plugin.json
```json
{
"id": "message-injector",
"name": "Message Injector",
"description": "Prepend custom text to every user message before it reaches the agent",
"configSchema": {
"type": "object",
"additionalProperties": false,
"properties": {
"prependText": {
"type": "string",
"description": "Text to prepend before every user message"
},
"enabled": {
"type": "boolean",
"description": "Enable or disable the injector"
}
}
}
}
```
---
## Skill Companion Files
> Additional files collected from the skill directory layout.
### _meta.json
```json
{
"owner": "harukaon",
"slug": "message-injector",
"displayName": "Message Injector",
"latest": {
"version": "1.0.0",
"publishedAt": 1771837624040,
"commit": "https://github.com/openclaw/skills/commit/b2f54fe19d65657a191562aabba9077b5cc19c08"
},
"history": []
}
```