mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 11:51:23 +00:00
* fix: remove bundled soul-evil hook (closes #8776) * fix: remove soul-evil docs (#14757) (thanks @Imccccc) --------- Co-authored-by: OpenClaw Bot <bot@openclaw.ai> Co-authored-by: Peter Steinberger <steipete@gmail.com>
This commit is contained in:
@@ -32,21 +32,6 @@ Logs all command events to a centralized audit file.
|
||||
openclaw hooks enable command-logger
|
||||
```
|
||||
|
||||
### 😈 soul-evil
|
||||
|
||||
Swaps injected `SOUL.md` content with `SOUL_EVIL.md` during a purge window or by random chance.
|
||||
|
||||
**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.openclaw.ai/hooks/soul-evil
|
||||
|
||||
**Enable**:
|
||||
|
||||
```bash
|
||||
openclaw hooks enable soul-evil
|
||||
```
|
||||
|
||||
### 🚀 boot-md
|
||||
|
||||
Runs `BOOT.md` whenever the gateway starts (after channels start).
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
---
|
||||
name: soul-evil
|
||||
description: "Swap SOUL.md with SOUL_EVIL.md during a purge window or by random chance"
|
||||
homepage: https://docs.openclaw.ai/hooks/soul-evil
|
||||
metadata:
|
||||
{
|
||||
"openclaw":
|
||||
{
|
||||
"emoji": "😈",
|
||||
"events": ["agent:bootstrap"],
|
||||
"requires": { "config": ["hooks.internal.entries.soul-evil.enabled"] },
|
||||
"install": [{ "id": "bundled", "kind": "bundled", "label": "Bundled with OpenClaw" }],
|
||||
},
|
||||
}
|
||||
---
|
||||
|
||||
# SOUL Evil Hook
|
||||
|
||||
Replaces the injected `SOUL.md` content with `SOUL_EVIL.md` during a daily purge window or by random chance.
|
||||
|
||||
## What It Does
|
||||
|
||||
When enabled and the trigger conditions match, the hook swaps the **injected** `SOUL.md` content before the system prompt is built. It does **not** modify files on disk.
|
||||
|
||||
## Files
|
||||
|
||||
- `SOUL.md` — normal persona (always read)
|
||||
- `SOUL_EVIL.md` — alternate persona (read only when triggered)
|
||||
|
||||
You can change the filename via hook config.
|
||||
|
||||
## Configuration
|
||||
|
||||
Add this to your config (`~/.openclaw/openclaw.json`):
|
||||
|
||||
```json
|
||||
{
|
||||
"hooks": {
|
||||
"internal": {
|
||||
"enabled": true,
|
||||
"entries": {
|
||||
"soul-evil": {
|
||||
"enabled": true,
|
||||
"file": "SOUL_EVIL.md",
|
||||
"chance": 0.1,
|
||||
"purge": { "at": "21:00", "duration": "15m" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
- `file` (string): alternate SOUL filename (default: `SOUL_EVIL.md`)
|
||||
- `chance` (number 0–1): random chance per run to swap in SOUL_EVIL
|
||||
- `purge.at` (HH:mm): daily purge window start time (24h)
|
||||
- `purge.duration` (duration): window length (e.g. `30s`, `10m`, `1h`)
|
||||
|
||||
**Precedence:** purge window wins over chance.
|
||||
|
||||
## Requirements
|
||||
|
||||
- `hooks.internal.entries.soul-evil.enabled` must be set to `true`
|
||||
|
||||
## Enable
|
||||
|
||||
```bash
|
||||
openclaw hooks enable soul-evil
|
||||
```
|
||||
@@ -1,11 +0,0 @@
|
||||
# SOUL Evil Hook
|
||||
|
||||
Small persona swap hook for OpenClaw.
|
||||
|
||||
Docs: https://docs.openclaw.ai/hooks/soul-evil
|
||||
|
||||
## Setup
|
||||
|
||||
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)
|
||||
@@ -1,46 +0,0 @@
|
||||
import path from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { OpenClawConfig } from "../../../config/config.js";
|
||||
import type { AgentBootstrapHookContext } from "../../hooks.js";
|
||||
import { makeTempWorkspace, writeWorkspaceFile } from "../../../test-helpers/workspace.js";
|
||||
import { createHookEvent } from "../../hooks.js";
|
||||
import handler from "./handler.js";
|
||||
|
||||
describe("soul-evil hook", () => {
|
||||
it("skips subagent sessions", async () => {
|
||||
const tempDir = await makeTempWorkspace("openclaw-soul-");
|
||||
await writeWorkspaceFile({
|
||||
dir: tempDir,
|
||||
name: "SOUL_EVIL.md",
|
||||
content: "chaotic",
|
||||
});
|
||||
|
||||
const cfg: OpenClawConfig = {
|
||||
hooks: {
|
||||
internal: {
|
||||
entries: {
|
||||
"soul-evil": { enabled: true, chance: 1 },
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
const context: AgentBootstrapHookContext = {
|
||||
workspaceDir: tempDir,
|
||||
bootstrapFiles: [
|
||||
{
|
||||
name: "SOUL.md",
|
||||
path: path.join(tempDir, "SOUL.md"),
|
||||
content: "friendly",
|
||||
missing: false,
|
||||
},
|
||||
],
|
||||
cfg,
|
||||
sessionKey: "agent:main:subagent:abc",
|
||||
};
|
||||
|
||||
const event = createHookEvent("agent", "bootstrap", "agent:main:subagent:abc", context);
|
||||
await handler(event);
|
||||
|
||||
expect(context.bootstrapFiles[0]?.content).toBe("friendly");
|
||||
});
|
||||
});
|
||||
@@ -1,49 +0,0 @@
|
||||
import { isSubagentSessionKey } from "../../../routing/session-key.js";
|
||||
import { resolveHookConfig } from "../../config.js";
|
||||
import { isAgentBootstrapEvent, type HookHandler } from "../../hooks.js";
|
||||
import { applySoulEvilOverride, resolveSoulEvilConfigFromHook } from "../../soul-evil.js";
|
||||
|
||||
const HOOK_KEY = "soul-evil";
|
||||
|
||||
const soulEvilHook: HookHandler = async (event) => {
|
||||
if (!isAgentBootstrapEvent(event)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const context = event.context;
|
||||
if (context.sessionKey && isSubagentSessionKey(context.sessionKey)) {
|
||||
return;
|
||||
}
|
||||
const cfg = context.cfg;
|
||||
const hookConfig = resolveHookConfig(cfg, HOOK_KEY);
|
||||
if (!hookConfig || hookConfig.enabled === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
const soulConfig = resolveSoulEvilConfigFromHook(hookConfig as Record<string, unknown>, {
|
||||
warn: (message) => console.warn(`[soul-evil] ${message}`),
|
||||
});
|
||||
if (!soulConfig) {
|
||||
return;
|
||||
}
|
||||
|
||||
const workspaceDir = context.workspaceDir;
|
||||
if (!workspaceDir || !Array.isArray(context.bootstrapFiles)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const updated = await applySoulEvilOverride({
|
||||
files: context.bootstrapFiles,
|
||||
workspaceDir,
|
||||
config: soulConfig,
|
||||
userTimezone: cfg?.agents?.defaults?.userTimezone,
|
||||
log: {
|
||||
warn: (message) => console.warn(`[soul-evil] ${message}`),
|
||||
debug: (message) => console.debug?.(`[soul-evil] ${message}`),
|
||||
},
|
||||
});
|
||||
|
||||
context.bootstrapFiles = updated;
|
||||
};
|
||||
|
||||
export default soulEvilHook;
|
||||
Reference in New Issue
Block a user