Xpersona
O

Openclaw Plugin Dev

CLAWHUB · Unverified

Guide for creating OpenClaw plugins using hooks like llm_input and llm_output, with logging, request tracking, and config management. Skill: Openclaw Plugin Dev Owner: cicadafang Summary: Guide for creating OpenClaw plugins using hooks like llm_input and llm_output, with logging, request tracking, and config management. Tags: latest:1.0.0 Version history: v1.0.0 | 2026-03-29T14:34:22.681Z | user Initial release of the OpenClaw Plugin Development Guide. - Introduces hook mechanisms for plugin development, including llm_input, llm_output, agent_start

62
Rank
84
Safety
1.0k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1K downloads reported by the source. Last updated 10/11/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s17748ws4c7grk9027zvbjs89183gxzg:openclaw-plugin-dev
  1. Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-cicadafang-openclaw-plugin-dev/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

7,297 characters of source documentation, loaded on request.

Extracted files

3 files captured from the source.

SKILL.md

---
name: openclaw-plugin-dev
description: OpenClaw Plugin Development Guide. For creating OpenClaw plugins, including hook mechanisms, logging, configuration management, etc. Trigger words: develop plugin, create plugin, plugin development, llm_input hook, llm_output hook, wrapStreamFn.
---

# OpenClaw Plugin Development Guide

## Core Concepts

### Hook Mechanism

OpenClaw provides various hooks to intercept and process events:

| Hook | Trigger Timing | Usage |
|------|----------------|-------|
| `llm_input` | Before an LLM request is sent | Capture requests (prompt, systemPrompt, historyMessages) |
| `llm_output` | After an LLM response is completed | Capture responses (assistantTexts, usage) |
| `agent_start` | When an Agent session starts | Initialize session state |
| `agent_end` | When an Agent session ends | Clean up resources and record statistics |

### Request-Response Correlation

Use `runId` to correlate requests and responses:

```typescript
const inFlightRequests = new Map<string, RequestData>();

api.on("llm_input", (event: any) => {
  const runId = event.runId;
  inFlightRequests.set(runId, { timestamp: Date.now(), input: event });
});

api.on("llm_output", (event: any) => {
  const runId = event.runId;
  const request = inFlightRequests.get(runId);
  // Successfully paired, record the complete request-response
  inFlightRequests.delete(runId);
});
```

## Plugin Structure

```
~/.openclaw/extensions/plugin-name/
├── openclaw.plugin.json    # Plugin manifest
├── index.ts                # Main entry
├── logger.ts               # Utility module (optional)
└── README.md               # Documentation (optional)
```

### Manifest Example

```json
{
  "id": "plugin-name",
  "name": "Plugin Name",
  "version": "1.0.0",
  "main": "index.ts",
  "description": "Plugin description"
}
```

### Main Entry Template

```typescript
type OpenClawPluginApi = {
  config?: any;
  pluginConfig?: unknown;
  logger: { info: (msg: string) => void; warn: (msg: string) => void; error: (msg: string) => void };
  on: (hookName: string, handler: (event: any, ctx?: any) => void, opts?: { priority?: number }) => void;
};

const plugin = {
  id: "plugin-name",
  name: "Plugin Name",
  description: "Plugin description",
  
  register(api: OpenClawPluginApi) {
    // Get configuration
    const config = api.config?.plugins?.entries?.["plugin-name"]?.config ?? {};
    
    // Register hooks
    api.on("llm_input", (event) => { /* Handle request */ });
    api.on("llm_output", (event) => { /* Handle response */ });
  },
};

export default plugin;
```

## Common Patterns

### Logging

```typescript
// JSONL format, split files by date
const logPath = path.join(basePath, `${new Date().toISOString().split('T')[0]}.jsonl`);
fs.appendFileSync(logPath, JSON.stringify(entry) + "\n");
```

### Configuration Management

```typescript
const DEFAULT_CONFIG = {
  enabled: t

_meta.json

{
  "ownerId": "kn79039bnqnrhc02e3vc53n6t181t7hx",
  "slug": "openclaw-plugin-dev",
  "version": "1.0.0",
  "publishedAt": 1774794862681
}

skill-card.md

## Description:

Guide for creating OpenClaw plugins using hooks like llm_input and llm_output, with logging, request tracking, and configuration management.

This skill is ready for commercial/non-commercial use.

## Publisher:

[cicadafang](https://clawhub.ai/user/cicadafang)

### License/Terms of Use:

MIT-0

## Use Case:

Developers and engineers use this skill to create OpenClaw plugins, register lifecycle and LLM hooks, manage plugin configuration, and build logging or request-response correlation patterns.

### Deployment Geography for Use:

Global

## Known Risks and Mitigations:

Risk: Logger examples can capture raw prompts, system prompts, conversation history, tool data, or complete responses.

Mitigation: Prefer metadata-only logs with redaction, restrictive file permissions, encryption where needed, and retention limits unless full-content logging is explicitly required and approved.

Risk: Generated plugin code or configuration may be used without enough review despite the suspicious security verdict.

Mitigation: Review the generated plugin behavior before installation, especially hook registration, file writes, and any data captured by logging paths.

## Reference(s):

- [Openclaw Plugin Dev on ClawHub](https://clawhub.ai/cicadafang/skills/openclaw-plugin-dev)
- [OpenClaw LLM API Logger example](https://github.com/cicadaFang/openclaw-llm-api-logger)

## Skill Output:

**Output Type(s):** [Guidance, Markdown, Code, Shell commands, Configuration]

**Output Format:** [Markdown guidance with TypeScript, JSON, and bash snippets]

**Output Parameters:** [1D]

**Other Properties Related to Output:** [May produce plugin templates, configuration examples, debugging commands, and logging patterns for review before use.]

## Skill Version(s):

1.0.0 (source: server release metadata)

## Ethical Considerations:

Users should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.

Sponsored

Ads related to Openclaw Plugin Dev and adjacent AI workflows.