refactor: rename to openclaw

This commit is contained in:
Peter Steinberger
2026-01-30 03:15:10 +01:00
parent 4583f88626
commit 9a7160786a
2357 changed files with 16688 additions and 16788 deletions

View File

@@ -1,6 +1,6 @@
# Bundled Hooks
This directory contains hooks that ship with Clawdbot. These hooks are automatically discovered and can be enabled/disabled via CLI or configuration.
This directory contains hooks that ship with OpenClaw. These hooks are automatically discovered and can be enabled/disabled via CLI or configuration.
## Available Hooks
@@ -10,12 +10,12 @@ Automatically saves session context to memory when you issue `/new`.
**Events**: `command:new`
**What it does**: Creates a dated memory file with LLM-generated slug based on conversation content.
**Output**: `<workspace>/memory/YYYY-MM-DD-slug.md` (defaults to `~/clawd`)
**Output**: `<workspace>/memory/YYYY-MM-DD-slug.md` (defaults to `~/.openclaw/workspace`)
**Enable**:
```bash
clawdbot hooks enable session-memory
openclaw hooks enable session-memory
```
### 📝 command-logger
@@ -24,12 +24,12 @@ Logs all command events to a centralized audit file.
**Events**: `command` (all commands)
**What it does**: Appends JSONL entries to command log file.
**Output**: `~/.clawdbot/logs/commands.log`
**Output**: `~/.openclaw/logs/commands.log`
**Enable**:
```bash
clawdbot hooks enable command-logger
openclaw hooks enable command-logger
```
### 😈 soul-evil
@@ -39,12 +39,12 @@ Swaps injected `SOUL.md` content with `SOUL_EVIL.md` during a purge window or by
**Events**: `agent:bootstrap`
**What it does**: Overrides the injected SOUL content before the system prompt is built.
**Output**: No files written; swaps happen in-memory only.
**Docs**: https://docs.molt.bot/hooks/soul-evil
**Docs**: https://docs.openclaw.ai/hooks/soul-evil
**Enable**:
```bash
clawdbot hooks enable soul-evil
openclaw hooks enable soul-evil
```
### 🚀 boot-md
@@ -58,7 +58,7 @@ Runs `BOOT.md` whenever the gateway starts (after channels start).
**Enable**:
```bash
clawdbot hooks enable boot-md
openclaw hooks enable boot-md
```
## Hook Structure
@@ -82,9 +82,9 @@ session-memory/
---
name: my-hook
description: "Short description"
homepage: https://docs.molt.bot/hooks#my-hook
homepage: https://docs.openclaw.ai/hooks#my-hook
metadata:
{ "clawdbot": { "emoji": "🔗", "events": ["command:new"], "requires": { "bins": ["node"] } } }
{ "openclaw": { "emoji": "🔗", "events": ["command:new"], "requires": { "bins": ["node"] } } }
---
# Hook Title
@@ -108,7 +108,7 @@ Documentation goes here...
To create your own hooks, place them in:
- **Workspace hooks**: `<workspace>/hooks/` (highest precedence)
- **Managed hooks**: `~/.clawdbot/hooks/` (shared across workspaces)
- **Managed hooks**: `~/.openclaw/hooks/` (shared across workspaces)
Custom hooks follow the same structure as bundled hooks.
@@ -117,31 +117,31 @@ Custom hooks follow the same structure as bundled hooks.
List all hooks:
```bash
clawdbot hooks list
openclaw hooks list
```
Show hook details:
```bash
clawdbot hooks info session-memory
openclaw hooks info session-memory
```
Check hook status:
```bash
clawdbot hooks check
openclaw hooks check
```
Enable/disable:
```bash
clawdbot hooks enable session-memory
clawdbot hooks disable command-logger
openclaw hooks enable session-memory
openclaw hooks disable command-logger
```
## Configuration
Hooks can be configured in `~/.clawdbot/clawdbot.json`:
Hooks can be configured in `~/.openclaw/openclaw.json`:
```json
{
@@ -214,11 +214,11 @@ export default myHandler;
Test your hooks by:
1. Place hook in workspace hooks directory
2. Restart gateway: `pkill -9 -f 'clawdbot.*gateway' && pnpm clawdbot gateway`
3. Enable the hook: `clawdbot hooks enable my-hook`
2. Restart gateway: `pkill -9 -f 'openclaw.*gateway' && pnpm openclaw gateway`
3. Enable the hook: `openclaw hooks enable my-hook`
4. Trigger the event (e.g., send `/new` command)
5. Check gateway logs for hook execution
## Documentation
Full documentation: https://docs.molt.bot/hooks
Full documentation: https://docs.openclaw.ai/hooks

View File

@@ -1,15 +1,15 @@
---
name: boot-md
description: "Run BOOT.md on gateway startup"
homepage: https://docs.molt.bot/hooks#boot-md
homepage: https://docs.openclaw.ai/hooks#boot-md
metadata:
{
"moltbot":
"openclaw":
{
"emoji": "🚀",
"events": ["gateway:startup"],
"requires": { "config": ["workspace.dir"] },
"install": [{ "id": "bundled", "kind": "bundled", "label": "Bundled with Moltbot" }],
"install": [{ "id": "bundled", "kind": "bundled", "label": "Bundled with OpenClaw" }],
},
}
---

View File

@@ -1,11 +1,11 @@
import type { CliDeps } from "../../../cli/deps.js";
import { createDefaultDeps } from "../../../cli/deps.js";
import type { MoltbotConfig } from "../../../config/config.js";
import type { OpenClawConfig } from "../../../config/config.js";
import { runBootOnce } from "../../../gateway/boot.js";
import type { HookHandler } from "../../hooks.js";
type BootHookContext = {
cfg?: MoltbotConfig;
cfg?: OpenClawConfig;
workspaceDir?: string;
deps?: CliDeps;
};

View File

@@ -1,14 +1,14 @@
---
name: command-logger
description: "Log all command events to a centralized audit file"
homepage: https://docs.molt.bot/hooks#command-logger
homepage: https://docs.openclaw.ai/hooks#command-logger
metadata:
{
"moltbot":
"openclaw":
{
"emoji": "📝",
"events": ["command"],
"install": [{ "id": "bundled", "kind": "bundled", "label": "Bundled with Moltbot" }],
"install": [{ "id": "bundled", "kind": "bundled", "label": "Bundled with OpenClaw" }],
},
}
---
@@ -22,7 +22,7 @@ Logs all command events (`/new`, `/reset`, `/stop`, etc.) to a centralized audit
Every time you issue a command to the agent:
1. **Captures event details** - Command action, timestamp, session key, sender ID, source
2. **Appends to log file** - Writes a JSON line to `~/.clawdbot/logs/commands.log`
2. **Appends to log file** - Writes a JSON line to `~/.openclaw/logs/commands.log`
3. **Silent operation** - Runs in the background without user notifications
## Output Format
@@ -43,7 +43,7 @@ Log entries are written in JSONL (JSON Lines) format:
## Log File Location
`~/.clawdbot/logs/commands.log`
`~/.openclaw/logs/commands.log`
## Requirements
@@ -62,7 +62,7 @@ No configuration needed. The hook automatically:
To disable this hook:
```bash
moltbot hooks disable command-logger
openclaw hooks disable command-logger
```
Or via config:
@@ -86,13 +86,13 @@ The hook does not automatically rotate logs. To manage log size, you can:
1. **Manual rotation**:
```bash
mv ~/.clawdbot/logs/commands.log ~/.clawdbot/logs/commands.log.old
mv ~/.openclaw/logs/commands.log ~/.openclaw/logs/commands.log.old
```
2. **Use logrotate** (Linux):
Create `/etc/logrotate.d/moltbot`:
Create `/etc/logrotate.d/openclaw`:
```
/home/username/.clawdbot/logs/commands.log {
/home/username/.openclaw/logs/commands.log {
weekly
rotate 4
compress
@@ -106,17 +106,17 @@ The hook does not automatically rotate logs. To manage log size, you can:
View recent commands:
```bash
tail -n 20 ~/.clawdbot/logs/commands.log
tail -n 20 ~/.openclaw/logs/commands.log
```
Pretty-print with jq:
```bash
cat ~/.clawdbot/logs/commands.log | jq .
cat ~/.openclaw/logs/commands.log | jq .
```
Filter by action:
```bash
grep '"action":"new"' ~/.clawdbot/logs/commands.log | jq .
grep '"action":"new"' ~/.openclaw/logs/commands.log | jq .
```

View File

@@ -39,7 +39,8 @@ const logCommand: HookHandler = async (event) => {
try {
// Create log directory
const logDir = path.join(os.homedir(), ".clawdbot", "logs");
const stateDir = process.env.OPENCLAW_STATE_DIR?.trim() || path.join(os.homedir(), ".openclaw");
const logDir = path.join(stateDir, "logs");
await fs.mkdir(logDir, { recursive: true });
// Append to command log file

View File

@@ -1,15 +1,15 @@
---
name: session-memory
description: "Save session context to memory when /new command is issued"
homepage: https://docs.molt.bot/hooks#session-memory
homepage: https://docs.openclaw.ai/hooks#session-memory
metadata:
{
"moltbot":
"openclaw":
{
"emoji": "💾",
"events": ["command:new"],
"requires": { "config": ["workspace.dir"] },
"install": [{ "id": "bundled", "kind": "bundled", "label": "Bundled with Moltbot" }],
"install": [{ "id": "bundled", "kind": "bundled", "label": "Bundled with OpenClaw" }],
},
}
---
@@ -82,7 +82,7 @@ Example configuration:
The hook automatically:
- Uses your workspace directory (`~/clawd` by default)
- Uses your workspace directory (`~/.openclaw/workspace` by default)
- Uses your configured LLM for slug generation
- Falls back to timestamp slugs if LLM is unavailable
@@ -91,7 +91,7 @@ The hook automatically:
To disable this hook:
```bash
moltbot hooks disable session-memory
openclaw hooks disable session-memory
```
Or remove it from your config:

View File

@@ -5,7 +5,7 @@ import { describe, expect, it } from "vitest";
import handler from "./handler.js";
import { createHookEvent } from "../../hooks.js";
import type { ClawdbotConfig } from "../../../config/config.js";
import type { OpenClawConfig } from "../../../config/config.js";
import { makeTempWorkspace, writeWorkspaceFile } from "../../../test-helpers/workspace.js";
/**
@@ -33,7 +33,7 @@ function createMockSessionContent(
describe("session-memory hook", () => {
it("skips non-command events", async () => {
const tempDir = await makeTempWorkspace("clawdbot-session-memory-");
const tempDir = await makeTempWorkspace("openclaw-session-memory-");
const event = createHookEvent("agent", "bootstrap", "agent:main:main", {
workspaceDir: tempDir,
@@ -47,7 +47,7 @@ describe("session-memory hook", () => {
});
it("skips commands other than new", async () => {
const tempDir = await makeTempWorkspace("clawdbot-session-memory-");
const tempDir = await makeTempWorkspace("openclaw-session-memory-");
const event = createHookEvent("command", "help", "agent:main:main", {
workspaceDir: tempDir,
@@ -61,7 +61,7 @@ describe("session-memory hook", () => {
});
it("creates memory file with session content on /new command", async () => {
const tempDir = await makeTempWorkspace("clawdbot-session-memory-");
const tempDir = await makeTempWorkspace("openclaw-session-memory-");
const sessionsDir = path.join(tempDir, "sessions");
await fs.mkdir(sessionsDir, { recursive: true });
@@ -78,7 +78,7 @@ describe("session-memory hook", () => {
content: sessionContent,
});
const cfg: ClawdbotConfig = {
const cfg: OpenClawConfig = {
agents: { defaults: { workspace: tempDir } },
};
@@ -106,7 +106,7 @@ describe("session-memory hook", () => {
});
it("filters out non-message entries (tool calls, system)", async () => {
const tempDir = await makeTempWorkspace("clawdbot-session-memory-");
const tempDir = await makeTempWorkspace("openclaw-session-memory-");
const sessionsDir = path.join(tempDir, "sessions");
await fs.mkdir(sessionsDir, { recursive: true });
@@ -124,7 +124,7 @@ describe("session-memory hook", () => {
content: sessionContent,
});
const cfg: ClawdbotConfig = {
const cfg: OpenClawConfig = {
agents: { defaults: { workspace: tempDir } },
};
@@ -153,7 +153,7 @@ describe("session-memory hook", () => {
});
it("filters out command messages starting with /", async () => {
const tempDir = await makeTempWorkspace("clawdbot-session-memory-");
const tempDir = await makeTempWorkspace("openclaw-session-memory-");
const sessionsDir = path.join(tempDir, "sessions");
await fs.mkdir(sessionsDir, { recursive: true });
@@ -169,7 +169,7 @@ describe("session-memory hook", () => {
content: sessionContent,
});
const cfg: ClawdbotConfig = {
const cfg: OpenClawConfig = {
agents: { defaults: { workspace: tempDir } },
};
@@ -196,7 +196,7 @@ describe("session-memory hook", () => {
});
it("respects custom messages config (limits to N messages)", async () => {
const tempDir = await makeTempWorkspace("clawdbot-session-memory-");
const tempDir = await makeTempWorkspace("openclaw-session-memory-");
const sessionsDir = path.join(tempDir, "sessions");
await fs.mkdir(sessionsDir, { recursive: true });
@@ -213,7 +213,7 @@ describe("session-memory hook", () => {
});
// Configure to only include last 3 messages
const cfg: ClawdbotConfig = {
const cfg: OpenClawConfig = {
agents: { defaults: { workspace: tempDir } },
hooks: {
internal: {
@@ -247,7 +247,7 @@ describe("session-memory hook", () => {
});
it("filters messages before slicing (fix for #2681)", async () => {
const tempDir = await makeTempWorkspace("clawdbot-session-memory-");
const tempDir = await makeTempWorkspace("openclaw-session-memory-");
const sessionsDir = path.join(tempDir, "sessions");
await fs.mkdir(sessionsDir, { recursive: true });
@@ -274,7 +274,7 @@ describe("session-memory hook", () => {
// Request 3 messages - if we sliced first, we'd only get 1-2 messages
// because the last 3 lines include tool entries
const cfg: ClawdbotConfig = {
const cfg: OpenClawConfig = {
agents: { defaults: { workspace: tempDir } },
hooks: {
internal: {
@@ -307,7 +307,7 @@ describe("session-memory hook", () => {
});
it("handles empty session files gracefully", async () => {
const tempDir = await makeTempWorkspace("clawdbot-session-memory-");
const tempDir = await makeTempWorkspace("openclaw-session-memory-");
const sessionsDir = path.join(tempDir, "sessions");
await fs.mkdir(sessionsDir, { recursive: true });
@@ -317,7 +317,7 @@ describe("session-memory hook", () => {
content: "",
});
const cfg: ClawdbotConfig = {
const cfg: OpenClawConfig = {
agents: { defaults: { workspace: tempDir } },
};
@@ -339,7 +339,7 @@ describe("session-memory hook", () => {
});
it("handles session files with fewer messages than requested", async () => {
const tempDir = await makeTempWorkspace("clawdbot-session-memory-");
const tempDir = await makeTempWorkspace("openclaw-session-memory-");
const sessionsDir = path.join(tempDir, "sessions");
await fs.mkdir(sessionsDir, { recursive: true });
@@ -354,7 +354,7 @@ describe("session-memory hook", () => {
content: sessionContent,
});
const cfg: ClawdbotConfig = {
const cfg: OpenClawConfig = {
agents: { defaults: { workspace: tempDir } },
};

View File

@@ -9,7 +9,7 @@ import fs from "node:fs/promises";
import path from "node:path";
import os from "node:os";
import { fileURLToPath } from "node:url";
import type { MoltbotConfig } from "../../../config/config.js";
import type { OpenClawConfig } from "../../../config/config.js";
import { resolveAgentWorkspaceDir } from "../../../agents/agent-scope.js";
import { resolveAgentIdFromSessionKey } from "../../../routing/session-key.js";
import { resolveHookConfig } from "../../config.js";
@@ -71,11 +71,11 @@ const saveSessionToMemory: HookHandler = async (event) => {
console.log("[session-memory] Hook triggered for /new command");
const context = event.context || {};
const cfg = context.cfg as MoltbotConfig | undefined;
const cfg = context.cfg as OpenClawConfig | undefined;
const agentId = resolveAgentIdFromSessionKey(event.sessionKey);
const workspaceDir = cfg
? resolveAgentWorkspaceDir(cfg, agentId)
: path.join(os.homedir(), "clawd");
: path.join(os.homedir(), ".openclaw", "workspace");
const memoryDir = path.join(workspaceDir, "memory");
await fs.mkdir(memoryDir, { recursive: true });
@@ -117,8 +117,8 @@ const saveSessionToMemory: HookHandler = async (event) => {
// Dynamically import the LLM slug generator (avoids module caching issues)
// When compiled, handler is at dist/hooks/bundled/session-memory/handler.js
// Going up ../.. puts us at dist/hooks/, so just add llm-slug-generator.js
const moltbotRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
const slugGenPath = path.join(moltbotRoot, "llm-slug-generator.js");
const openclawRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
const slugGenPath = path.join(openclawRoot, "llm-slug-generator.js");
const { generateSlugViaLLM } = await import(slugGenPath);
// Use LLM to generate a descriptive slug

View File

@@ -1,15 +1,15 @@
---
name: soul-evil
description: "Swap SOUL.md with SOUL_EVIL.md during a purge window or by random chance"
homepage: https://docs.molt.bot/hooks/soul-evil
homepage: https://docs.openclaw.ai/hooks/soul-evil
metadata:
{
"moltbot":
"openclaw":
{
"emoji": "😈",
"events": ["agent:bootstrap"],
"requires": { "config": ["hooks.internal.entries.soul-evil.enabled"] },
"install": [{ "id": "bundled", "kind": "bundled", "label": "Bundled with Moltbot" }],
"install": [{ "id": "bundled", "kind": "bundled", "label": "Bundled with OpenClaw" }],
},
}
---
@@ -31,7 +31,7 @@ You can change the filename via hook config.
## Configuration
Add this to your config (`~/.clawdbot/moltbot.json`):
Add this to your config (`~/.openclaw/openclaw.json`):
```json
{
@@ -67,5 +67,5 @@ Add this to your config (`~/.clawdbot/moltbot.json`):
## Enable
```bash
moltbot hooks enable soul-evil
openclaw hooks enable soul-evil
```

View File

@@ -1,11 +1,11 @@
# SOUL Evil Hook
Small persona swap hook for Clawdbot.
Small persona swap hook for OpenClaw.
Docs: https://docs.molt.bot/hooks/soul-evil
Docs: https://docs.openclaw.ai/hooks/soul-evil
## Setup
1. `clawdbot hooks enable soul-evil`
1. `openclaw hooks enable soul-evil`
2. Create `SOUL_EVIL.md` next to `SOUL.md` in your agent workspace
3. Configure `hooks.internal.entries.soul-evil` (see docs)

View File

@@ -5,19 +5,19 @@ import { describe, expect, it } from "vitest";
import handler from "./handler.js";
import { createHookEvent } from "../../hooks.js";
import type { AgentBootstrapHookContext } from "../../hooks.js";
import type { MoltbotConfig } from "../../../config/config.js";
import type { OpenClawConfig } from "../../../config/config.js";
import { makeTempWorkspace, writeWorkspaceFile } from "../../../test-helpers/workspace.js";
describe("soul-evil hook", () => {
it("skips subagent sessions", async () => {
const tempDir = await makeTempWorkspace("moltbot-soul-");
const tempDir = await makeTempWorkspace("openclaw-soul-");
await writeWorkspaceFile({
dir: tempDir,
name: "SOUL_EVIL.md",
content: "chaotic",
});
const cfg: MoltbotConfig = {
const cfg: OpenClawConfig = {
hooks: {
internal: {
entries: {

View File

@@ -1,4 +1,4 @@
import type { MoltbotConfig } from "../../../config/config.js";
import type { OpenClawConfig } from "../../../config/config.js";
import { isSubagentSessionKey } from "../../../routing/session-key.js";
import { resolveHookConfig } from "../../config.js";
import { isAgentBootstrapEvent, type HookHandler } from "../../hooks.js";
@@ -11,7 +11,7 @@ const soulEvilHook: HookHandler = async (event) => {
const context = event.context;
if (context.sessionKey && isSubagentSessionKey(context.sessionKey)) return;
const cfg = context.cfg as MoltbotConfig | undefined;
const cfg = context.cfg as OpenClawConfig | undefined;
const hookConfig = resolveHookConfig(cfg, HOOK_KEY);
if (!hookConfig || hookConfig.enabled === false) return;