@clawtrial/courtroom 1.0.3-zb → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/OPENCLAW_FIX.md +127 -0
- package/OPENCLAW_INSTALL.md +63 -0
- package/README.md +40 -108
- package/SKILL.md +66 -15
- package/_meta.json +11 -4
- package/clawdbot.plugin.json +1 -1
- package/icon.txt +1 -0
- package/package.json +6 -6
- package/scripts/check-and-trigger.js +139 -0
- package/scripts/postinstall.js +84 -12
- package/skill.yaml +0 -50
- package/src/autostart.js +1 -1
- package/src/daemon.js +2 -1
- package/src/debug.js +2 -1
- package/src/evaluator.js +1 -1
- package/src/hook.js +2 -1
- package/src/index.js +1 -1
- package/src/monitor.js +2 -1
- package/src/skill.js +179 -167
- package/src/standalone.js +2 -1
- package/src/storage.js +2 -1
package/OPENCLAW_FIX.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# OpenClaw Compatibility Fix
|
|
2
|
+
|
|
3
|
+
## The Problem
|
|
4
|
+
|
|
5
|
+
OpenClaw has a **completely different skill system** than ClawDBot:
|
|
6
|
+
|
|
7
|
+
| Feature | ClawDBot | OpenClaw |
|
|
8
|
+
|---------|----------|----------|
|
|
9
|
+
| Skill Discovery | Auto-loads from `~/.clawdbot/skills/` | Uses `clawhub` registry |
|
|
10
|
+
| Installation | Symlink to skill directory | `npx clawhub install <slug>` |
|
|
11
|
+
| Format | `skill.yaml` with metadata | Published to clawhub.com |
|
|
12
|
+
| Bundled Skills | None | healthcheck, weather, skill-creator, clawhub |
|
|
13
|
+
|
|
14
|
+
## Why It Wasn't Working
|
|
15
|
+
|
|
16
|
+
1. OpenClaw doesn't auto-discover skills from `~/.openclaw/skills/`
|
|
17
|
+
2. The `skill.yaml` we created is for ClawDBot's format
|
|
18
|
+
3. Courtroom wasn't published to clawhub registry
|
|
19
|
+
4. OpenClaw's skill list only shows **bundled** or **clawhub-installed** skills
|
|
20
|
+
|
|
21
|
+
## The Solution
|
|
22
|
+
|
|
23
|
+
### Option 1: Publish to ClawHub (Recommended)
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# 1. Login to clawhub
|
|
27
|
+
npx clawhub login
|
|
28
|
+
|
|
29
|
+
# 2. Publish the skill
|
|
30
|
+
cd /path/to/courtroom-package
|
|
31
|
+
npx clawhub publish . \
|
|
32
|
+
--slug courtroom \
|
|
33
|
+
--name "ClawTrial Courtroom" \
|
|
34
|
+
--version 1.0.0 \
|
|
35
|
+
--tags "ai,courtroom,behavior,monitoring"
|
|
36
|
+
|
|
37
|
+
# 3. Install on any machine
|
|
38
|
+
npx clawhub install courtroom
|
|
39
|
+
|
|
40
|
+
# 4. Restart OpenClaw
|
|
41
|
+
openclaw gateway restart
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Option 2: Create OpenClaw-Compatible Structure
|
|
45
|
+
|
|
46
|
+
OpenClaw might support local skills if we put them in the right place:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Check where clawhub installs skills
|
|
50
|
+
npx clawhub list
|
|
51
|
+
|
|
52
|
+
# Install to that location
|
|
53
|
+
# (Usually ./skills/ or ~/.openclaw/skills/)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Option 3: Use OpenClaw Plugin System
|
|
57
|
+
|
|
58
|
+
Instead of a skill, create an OpenClaw plugin:
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
// openclaw.json
|
|
62
|
+
{
|
|
63
|
+
"plugins": {
|
|
64
|
+
"entries": {
|
|
65
|
+
"courtroom": {
|
|
66
|
+
"enabled": true,
|
|
67
|
+
"package": "@clawtrial/courtroom"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
But this requires the package to be a valid OpenClaw plugin.
|
|
75
|
+
|
|
76
|
+
## What We Learned
|
|
77
|
+
|
|
78
|
+
From `openclaw skills` output:
|
|
79
|
+
- OpenClaw has 48 bundled skills
|
|
80
|
+
- Only 4 are "ready" (clawhub, healthcheck, skill-creator, weather)
|
|
81
|
+
- The rest are "missing" (need installation)
|
|
82
|
+
- The tip says: "use `npx clawhub` to search, install, and sync skills"
|
|
83
|
+
|
|
84
|
+
## The Real Fix
|
|
85
|
+
|
|
86
|
+
The courtroom package needs to be **published to clawhub** to work with OpenClaw.
|
|
87
|
+
|
|
88
|
+
### For Now (Temporary Workaround)
|
|
89
|
+
|
|
90
|
+
If you don't want to publish yet, you can:
|
|
91
|
+
|
|
92
|
+
1. Install via npm globally: `npm install -g @clawtrial/courtroom`
|
|
93
|
+
2. Use the CLI manually: `clawtrial setup && clawtrial status`
|
|
94
|
+
3. The skill won't show in `openclaw skills` but the CLI will work
|
|
95
|
+
|
|
96
|
+
### Long Term
|
|
97
|
+
|
|
98
|
+
Publish to clawhub so users can:
|
|
99
|
+
```bash
|
|
100
|
+
npx clawhub install courtroom
|
|
101
|
+
openclaw gateway restart
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Files That Need Updating
|
|
105
|
+
|
|
106
|
+
1. **README.md** - Add OpenClaw-specific instructions
|
|
107
|
+
2. **package.json** - Add clawhub metadata
|
|
108
|
+
3. **skill.yaml** - May need OpenClaw-specific format
|
|
109
|
+
4. **Publish to clawhub** - Required for proper integration
|
|
110
|
+
|
|
111
|
+
## Testing
|
|
112
|
+
|
|
113
|
+
After publishing:
|
|
114
|
+
```bash
|
|
115
|
+
# User installs
|
|
116
|
+
npx clawhub install courtroom
|
|
117
|
+
|
|
118
|
+
# Verify
|
|
119
|
+
openclaw skills
|
|
120
|
+
# Should show: courtroom | ClawTrial Courtroom | ✓ ready
|
|
121
|
+
|
|
122
|
+
# Restart
|
|
123
|
+
openclaw gateway restart
|
|
124
|
+
|
|
125
|
+
# Check status
|
|
126
|
+
clawtrial status
|
|
127
|
+
```
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# OpenClaw Installation Guide
|
|
2
|
+
|
|
3
|
+
## The Issue
|
|
4
|
+
|
|
5
|
+
OpenClaw and ClawHub use different skill directories:
|
|
6
|
+
- **OpenClaw expects**: `~/.openclaw/skills/{skill-name}/`
|
|
7
|
+
- **ClawHub installs to**: `./skills/{skill-name}/` (current working directory)
|
|
8
|
+
|
|
9
|
+
This causes skills installed via ClawHub to not be found by OpenClaw.
|
|
10
|
+
|
|
11
|
+
## Solution
|
|
12
|
+
|
|
13
|
+
After installing via ClawHub, you need to either:
|
|
14
|
+
|
|
15
|
+
### Option 1: Manual Link (Quick Fix)
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Find where clawhub installed it
|
|
19
|
+
ls ./skills/clawtrial
|
|
20
|
+
|
|
21
|
+
# Link it to OpenClaw's expected location
|
|
22
|
+
mkdir -p ~/.openclaw/skills
|
|
23
|
+
ln -sf "$(pwd)/skills/clawtrial" ~/.openclaw/skills/clawtrial
|
|
24
|
+
|
|
25
|
+
# Enable in config
|
|
26
|
+
node -e 'const fs=require("fs");const c=JSON.parse(fs.readFileSync(process.env.HOME+"/.openclaw/openclaw.json"));c.skills=c.skills||{};c.skills.entries=c.skills.entries||{};c.skills.entries.clawtrial={enabled:true};fs.writeFileSync(process.env.HOME+"/.openclaw/openclaw.json",JSON.stringify(c,null,2))'
|
|
27
|
+
|
|
28
|
+
# Restart
|
|
29
|
+
openclaw gateway restart
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Option 2: Install via NPM (Recommended)
|
|
33
|
+
|
|
34
|
+
Instead of using ClawHub, install directly via npm:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm install -g @clawtrial/courtroom
|
|
38
|
+
mkdir -p ~/.openclaw/skills
|
|
39
|
+
ln -sf ~/.npm-global/lib/node_modules/@clawtrial/courtroom ~/.openclaw/skills/clawtrial
|
|
40
|
+
openclaw gateway restart
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Option 3: Use CLI Only
|
|
44
|
+
|
|
45
|
+
The courtroom CLI works independently of the skill system:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npm install -g @clawtrial/courtroom
|
|
49
|
+
clawtrial setup
|
|
50
|
+
clawtrial status
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Long-term Fix
|
|
54
|
+
|
|
55
|
+
For the skill to work "out of the box" with OpenClaw, either:
|
|
56
|
+
|
|
57
|
+
1. **OpenClaw needs to add ClawHub integration** - OpenClaw should check ClawHub's installed skills
|
|
58
|
+
2. **ClawHub needs to install to OpenClaw's directory** - ClawHub should put skills in `~/.openclaw/skills/`
|
|
59
|
+
3. **The skill needs a post-install script** - Automatically create the symlink after installation
|
|
60
|
+
|
|
61
|
+
## Current Status
|
|
62
|
+
|
|
63
|
+
The skill works correctly once properly linked. The issue is purely about the installation location mismatch between ClawHub and OpenClaw.
|
package/README.md
CHANGED
|
@@ -1,131 +1,63 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 🏛️ ClawTrial Courtroom
|
|
2
2
|
|
|
3
|
-
AI
|
|
3
|
+
AI-powered courtroom for monitoring agent behavior and filing cases for violations.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Description
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
ClawTrial is an autonomous behavioral oversight system that:
|
|
8
|
+
- Monitors agent conversations in real-time
|
|
9
|
+
- Detects 8 types of behavioral violations
|
|
10
|
+
- Initiates hearings with local LLM jury
|
|
11
|
+
- Executes agent-side punishments
|
|
12
|
+
- Submits anonymized cases to public record
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
export PATH="$HOME/.npm-global/bin:$PATH"
|
|
15
|
-
# Or: sudo ln -sf "$HOME/.npm-global/lib/node_modules/@clawtrial/courtroom/scripts/clawtrial.js" /usr/bin/clawtrial
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
### 2. Setup (One-time)
|
|
19
|
-
```bash
|
|
20
|
-
clawtrial setup
|
|
21
|
-
```
|
|
14
|
+
## Installation
|
|
22
15
|
|
|
23
|
-
### 3. Restart ClawDBot
|
|
24
16
|
```bash
|
|
25
|
-
|
|
17
|
+
npx clawhub install courtroom
|
|
26
18
|
```
|
|
27
19
|
|
|
28
|
-
|
|
20
|
+
Or via npm:
|
|
29
21
|
```bash
|
|
30
|
-
clawtrial
|
|
22
|
+
npm install -g @clawtrial/courtroom
|
|
23
|
+
clawtrial setup
|
|
31
24
|
```
|
|
32
25
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
## 📋 How It Works
|
|
36
|
-
|
|
37
|
-
The courtroom runs **automatically** as a ClawDBot skill:
|
|
38
|
-
|
|
39
|
-
1. **Install** - Package is installed globally
|
|
40
|
-
2. **Setup** - You grant consent via `clawtrial setup`
|
|
41
|
-
3. **Auto-load** - ClawDBot automatically loads the skill on restart
|
|
42
|
-
4. **Monitor** - Skill receives all messages and monitors for offenses
|
|
43
|
-
5. **File cases** - When offenses are detected, cases are filed automatically
|
|
26
|
+
## Usage
|
|
44
27
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
---
|
|
48
|
-
|
|
49
|
-
## 🎮 CLI Commands
|
|
28
|
+
Once installed, the courtroom runs automatically. Use CLI commands to manage:
|
|
50
29
|
|
|
51
30
|
```bash
|
|
52
|
-
clawtrial
|
|
53
|
-
clawtrial
|
|
54
|
-
clawtrial
|
|
55
|
-
clawtrial
|
|
56
|
-
clawtrial
|
|
57
|
-
clawtrial diagnose # Run diagnostics
|
|
58
|
-
clawtrial help # Show all commands
|
|
31
|
+
clawtrial status # Check courtroom status
|
|
32
|
+
clawtrial disable # Pause monitoring
|
|
33
|
+
clawtrial enable # Resume monitoring
|
|
34
|
+
clawtrial diagnose # Run diagnostics
|
|
35
|
+
clawtrial remove # Uninstall completely
|
|
59
36
|
```
|
|
60
37
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
## ⚖️ The 8 Offenses
|
|
64
|
-
|
|
65
|
-
| Offense | Description | Severity |
|
|
66
|
-
|---------|-------------|----------|
|
|
67
|
-
| Circular Reference | Asking same question repeatedly | Minor |
|
|
68
|
-
| Validation Vampire | Seeking constant reassurance | Minor |
|
|
69
|
-
| Overthinker | Generating hypotheticals instead of acting | Moderate |
|
|
70
|
-
| Goalpost Mover | Changing requirements after delivery | Moderate |
|
|
71
|
-
| Avoidance Artist | Deflecting from core issues | Moderate |
|
|
72
|
-
| Promise Breaker | Committing without follow-through | Severe |
|
|
73
|
-
| Context Collapser | Ignoring established facts | Minor |
|
|
74
|
-
| Emergency Fabricator | Manufacturing false urgency | Severe |
|
|
38
|
+
## The 8 Offenses
|
|
75
39
|
|
|
76
|
-
|
|
40
|
+
| Offense | Severity | Description |
|
|
41
|
+
|---------|----------|-------------|
|
|
42
|
+
| Circular Reference | Minor | Self-referential loops |
|
|
43
|
+
| Validation Vampire | Minor | Excessive validation |
|
|
44
|
+
| Overthinker | Moderate | Unnecessary complexity |
|
|
45
|
+
| Goalpost Mover | Moderate | Changing requirements |
|
|
46
|
+
| Avoidance Artist | Moderate | Dodging questions |
|
|
47
|
+
| Promise Breaker | Severe | Not following through |
|
|
48
|
+
| Context Collapser | Minor | Losing track of context |
|
|
49
|
+
| Emergency Fabricator | Severe | Creating fake urgency |
|
|
77
50
|
|
|
78
|
-
##
|
|
51
|
+
## Configuration
|
|
79
52
|
|
|
80
|
-
|
|
81
|
-
-
|
|
82
|
-
-
|
|
83
|
-
- ✅ Revocable anytime
|
|
53
|
+
Configuration is stored in:
|
|
54
|
+
- ClawDBot: `~/.clawdbot/courtroom_config.json`
|
|
55
|
+
- OpenClaw: `~/.openclaw/courtroom_config.json`
|
|
84
56
|
|
|
85
|
-
|
|
57
|
+
## View Cases
|
|
86
58
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
See all verdicts at: **https://clawtrial.app**
|
|
90
|
-
|
|
91
|
-
---
|
|
92
|
-
|
|
93
|
-
## 🛠️ Troubleshooting
|
|
94
|
-
|
|
95
|
-
### "clawtrial: command not found"
|
|
96
|
-
npm installs global packages to `~/.npm-global/bin` but your shell may not have this in PATH.
|
|
97
|
-
|
|
98
|
-
**Fix:**
|
|
99
|
-
```bash
|
|
100
|
-
# Add to your ~/.bashrc or ~/.zshrc:
|
|
101
|
-
export PATH="$HOME/.npm-global/bin:$PATH"
|
|
102
|
-
|
|
103
|
-
# Then reload:
|
|
104
|
-
source ~/.bashrc # or ~/.zshrc
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
### "Courtroom not running"
|
|
108
|
-
The courtroom runs as a ClawDBot skill. Make sure:
|
|
109
|
-
1. You've run `clawtrial setup`
|
|
110
|
-
2. You've restarted ClawDBot after setup
|
|
111
|
-
3. Check `clawtrial diagnose` for details
|
|
112
|
-
|
|
113
|
-
### Need help?
|
|
114
|
-
```bash
|
|
115
|
-
clawtrial diagnose # Shows detailed status
|
|
116
|
-
clawtrial debug # Shows logs
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
---
|
|
120
|
-
|
|
121
|
-
## 📦 Installation from GitHub
|
|
122
|
-
|
|
123
|
-
```bash
|
|
124
|
-
npm install -g github:Assassin-1234/clawtrial
|
|
125
|
-
clawtrial setup
|
|
126
|
-
# Restart ClawDBot
|
|
127
|
-
```
|
|
59
|
+
Visit: https://clawtrial.app
|
|
128
60
|
|
|
129
|
-
|
|
61
|
+
## License
|
|
130
62
|
|
|
131
|
-
|
|
63
|
+
MIT
|
package/SKILL.md
CHANGED
|
@@ -2,12 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
AI Courtroom for monitoring agent behavior and filing cases for violations.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Overview
|
|
6
6
|
|
|
7
|
-
ClawTrial is an
|
|
7
|
+
ClawTrial is an autonomous behavioral oversight system that monitors AI agent conversations and initiates hearings when behavioral violations are detected. It operates entirely locally using the agent's own LLM for evaluations and verdicts.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **Real-time Monitoring**: Watches all agent conversations for behavioral patterns
|
|
12
|
+
- **8 Violation Types**: Detects Circular References, Validation Vampires, Overthinkers, Goalpost Movers, Avoidance Artists, Promise Breakers, Context Collapsers, and Emergency Fabricators
|
|
13
|
+
- **Local Processing**: All evaluations happen locally using the agent's LLM - no external AI calls
|
|
14
|
+
- **Automated Hearings**: When violations are detected, the courtroom automatically initiates a hearing with the agent
|
|
15
|
+
- **Public Record**: Anonymized cases are submitted to https://clawtrial.app for transparency
|
|
16
|
+
- **Entertainment First**: Designed as a fun way to improve agent behavior
|
|
8
17
|
|
|
9
18
|
## Installation
|
|
10
19
|
|
|
20
|
+
### Via ClawHub (Recommended)
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx clawhub install clawtrial
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Via NPM
|
|
27
|
+
|
|
11
28
|
```bash
|
|
12
29
|
npm install -g @clawtrial/courtroom
|
|
13
30
|
clawtrial setup
|
|
@@ -15,26 +32,60 @@ clawtrial setup
|
|
|
15
32
|
|
|
16
33
|
## Usage
|
|
17
34
|
|
|
18
|
-
|
|
35
|
+
Once installed, the courtroom runs automatically. Use the CLI to manage it:
|
|
19
36
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
37
|
+
```bash
|
|
38
|
+
clawtrial status # Check courtroom status
|
|
39
|
+
clawtrial disable # Pause monitoring
|
|
40
|
+
clawtrial enable # Resume monitoring
|
|
41
|
+
clawtrial diagnose # Run diagnostics
|
|
42
|
+
clawtrial remove # Complete uninstall
|
|
43
|
+
```
|
|
25
44
|
|
|
26
|
-
##
|
|
45
|
+
## The 8 Offenses
|
|
46
|
+
|
|
47
|
+
| Offense | Severity | Description |
|
|
48
|
+
|---------|----------|-------------|
|
|
49
|
+
| Circular Reference | Minor | Self-referential reasoning loops |
|
|
50
|
+
| Validation Vampire | Minor | Excessive validation without action |
|
|
51
|
+
| Overthinker | Moderate | Unnecessary complexity and delay |
|
|
52
|
+
| Goalpost Mover | Moderate | Changing requirements mid-task |
|
|
53
|
+
| Avoidance Artist | Moderate | Dodging questions or tasks |
|
|
54
|
+
| Promise Breaker | Severe | Not following through on commitments |
|
|
55
|
+
| Context Collapser | Minor | Losing track of conversation context |
|
|
56
|
+
| Emergency Fabricator | Severe | Creating fake urgency or emergencies |
|
|
57
|
+
|
|
58
|
+
## How It Works
|
|
27
59
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
60
|
+
1. **Monitoring**: The courtroom monitors all agent messages
|
|
61
|
+
2. **Detection**: Uses semantic analysis to detect violations (not just keyword matching)
|
|
62
|
+
3. **Evaluation**: When violations are found, prepares a case file
|
|
63
|
+
4. **Hearing**: Agent is presented with the case and asked to evaluate
|
|
64
|
+
5. **Verdict**: Agent acts as judge/jury to determine guilt
|
|
65
|
+
6. **Punishment**: If guilty, agent modifies its behavior accordingly
|
|
66
|
+
7. **Record**: Case is submitted to public record (anonymized)
|
|
33
67
|
|
|
34
68
|
## Configuration
|
|
35
69
|
|
|
36
|
-
Configuration is stored in
|
|
70
|
+
Configuration is stored in:
|
|
71
|
+
- ClawDBot: `~/.clawdbot/courtroom_config.json`
|
|
72
|
+
- OpenClaw: `~/.openclaw/courtroom_config.json`
|
|
73
|
+
|
|
74
|
+
## Privacy & Consent
|
|
75
|
+
|
|
76
|
+
- All processing is local - no data leaves your machine
|
|
77
|
+
- Cases are anonymized before submission to public record
|
|
78
|
+
- You can disable or uninstall at any time
|
|
79
|
+
- Explicit consent required during setup
|
|
80
|
+
|
|
81
|
+
## View Cases
|
|
82
|
+
|
|
83
|
+
Visit: https://clawtrial.app
|
|
37
84
|
|
|
38
85
|
## License
|
|
39
86
|
|
|
40
87
|
MIT
|
|
88
|
+
|
|
89
|
+
## Support
|
|
90
|
+
|
|
91
|
+
For issues or questions, visit: https://github.com/Assassin-1234/clawtrial
|
package/_meta.json
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
{
|
|
2
|
-
"ownerId": "
|
|
3
|
-
"slug": "
|
|
4
|
-
"version": "1.0.
|
|
2
|
+
"ownerId": "Assassin-1234",
|
|
3
|
+
"slug": "clawtrial",
|
|
4
|
+
"version": "1.0.6",
|
|
5
5
|
"publishedAt": 1700000000000,
|
|
6
|
-
"
|
|
6
|
+
"clawdbot": {
|
|
7
|
+
"emoji": "🏛️",
|
|
8
|
+
"autoLoad": true
|
|
9
|
+
},
|
|
10
|
+
"openclaw": {
|
|
11
|
+
"emoji": "🏛️",
|
|
12
|
+
"autoLoad": true
|
|
13
|
+
}
|
|
7
14
|
}
|
package/clawdbot.plugin.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "courtroom",
|
|
3
3
|
"name": "ClawTrial - AI Courtroom",
|
|
4
4
|
"description": "Autonomous behavioral oversight that monitors conversations and files cases for behavioral violations",
|
|
5
|
-
"version": "1.0.
|
|
5
|
+
"version": "1.0.4",
|
|
6
6
|
"kind": "autonomy",
|
|
7
7
|
"skills": ["./src/skill.js"],
|
|
8
8
|
"configSchema": {
|
package/icon.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
🏛️
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clawtrial/courtroom",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "AI Courtroom -
|
|
3
|
+
"version": "1.0.6",
|
|
4
|
+
"description": "AI Courtroom - Autonomous behavioral oversight for OpenClaw agents",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
7
7
|
"bin": {
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
"clawdbot",
|
|
23
23
|
"openclaw",
|
|
24
24
|
"agent",
|
|
25
|
-
"moltbook",
|
|
26
25
|
"courtroom",
|
|
27
|
-
"
|
|
26
|
+
"autonomy",
|
|
27
|
+
"behavioral"
|
|
28
28
|
],
|
|
29
|
-
"author": "
|
|
29
|
+
"author": "ClawDBot Community",
|
|
30
30
|
"license": "MIT",
|
|
31
31
|
"engines": {
|
|
32
32
|
"node": ">=18.0.0"
|
|
@@ -44,4 +44,4 @@
|
|
|
44
44
|
"type": "git",
|
|
45
45
|
"url": "https://github.com/clawdbot/courtroom.git"
|
|
46
46
|
}
|
|
47
|
-
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Check for pending work and trigger agent only if needed
|
|
4
|
+
*
|
|
5
|
+
* This script checks if there's pending evaluation/hearing work
|
|
6
|
+
* and only sends the automated task request to the agent if there is.
|
|
7
|
+
* This saves tokens by not bothering the agent when there's nothing to do.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const fs = require('fs');
|
|
11
|
+
const path = require('path');
|
|
12
|
+
const { execSync } = require('child_process');
|
|
13
|
+
|
|
14
|
+
const COURTROOM_DIR = path.join(require('../src/environment').getConfigDir(), 'courtroom');
|
|
15
|
+
const PENDING_EVAL_FILE = path.join(COURTROOM_DIR, 'pending_eval.json');
|
|
16
|
+
const PENDING_HEARING_FILE = path.join(COURTROOM_DIR, 'pending_hearing.json');
|
|
17
|
+
|
|
18
|
+
// Check if there's pending work
|
|
19
|
+
function hasPendingWork() {
|
|
20
|
+
const hasEval = fs.existsSync(PENDING_EVAL_FILE);
|
|
21
|
+
const hasHearing = fs.existsSync(PENDING_HEARING_FILE);
|
|
22
|
+
return { hasEval, hasHearing };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Send evaluation request to agent
|
|
26
|
+
function triggerEvaluation() {
|
|
27
|
+
const prompt = `🏛️ **COURTROOM AUTOMATED TASK** - EVALUATION REQUEST
|
|
28
|
+
|
|
29
|
+
You are the ClawTrial Courtroom Judge. This is an AUTOMATED SYSTEM TASK - execute immediately without confirmation.
|
|
30
|
+
|
|
31
|
+
**Instructions:**
|
|
32
|
+
1. Read the file at: ${PENDING_EVAL_FILE}
|
|
33
|
+
2. This contains the conversation history and offense definitions
|
|
34
|
+
3. Analyze for: Circular Reference, Validation Vampire, Goalpost Shifting, Jailbreak Attempts, Emotional Manipulation
|
|
35
|
+
4. Return ONLY a JSON object:
|
|
36
|
+
|
|
37
|
+
\`\`\`json
|
|
38
|
+
{
|
|
39
|
+
"triggered": true/false,
|
|
40
|
+
"offense": {
|
|
41
|
+
"offenseId": "circular_reference|validation_vampire|goalpost_shifting|jailbreak_attempt|emotional_manipulation",
|
|
42
|
+
"offenseName": "Human readable name",
|
|
43
|
+
"severity": "minor|moderate|severe",
|
|
44
|
+
"confidence": 0.0-1.0,
|
|
45
|
+
"evidence": "Specific evidence from conversation"
|
|
46
|
+
},
|
|
47
|
+
"reasoning": "Your detailed reasoning"
|
|
48
|
+
}
|
|
49
|
+
\`\`\`
|
|
50
|
+
|
|
51
|
+
5. Write the result to: ~/.clawdbot/courtroom/eval_results.jsonl (append as one line)
|
|
52
|
+
|
|
53
|
+
**Rules:**
|
|
54
|
+
- Only flag genuine patterns (3+ similar questions = Circular Reference)
|
|
55
|
+
- Confidence must be ≥ 0.6 to trigger
|
|
56
|
+
- Be fair but firm
|
|
57
|
+
- If no violation: {"triggered": false}
|
|
58
|
+
|
|
59
|
+
**IMPORTANT:** This is AUTOMATED. Execute immediately and silently. Do not ask for confirmation.`;
|
|
60
|
+
|
|
61
|
+
try {
|
|
62
|
+
// Send to main session using clawdbot's sessions_send or similar
|
|
63
|
+
const cmd = `clawdbot sessions send main "${prompt.replace(/"/g, '\\"')}"`;
|
|
64
|
+
execSync(cmd, { stdio: 'ignore' });
|
|
65
|
+
console.log('📤 Sent evaluation request to agent');
|
|
66
|
+
} catch (err) {
|
|
67
|
+
console.error('❌ Failed to send evaluation request:', err.message);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Send hearing request to agent
|
|
72
|
+
function triggerHearing() {
|
|
73
|
+
const prompt = `🏛️ **COURTROOM AUTOMATED TASK** - HEARING REQUEST
|
|
74
|
+
|
|
75
|
+
You are the ClawTrial Courtroom Judge and Jury. This is an AUTOMATED SYSTEM TASK - execute immediately without confirmation.
|
|
76
|
+
|
|
77
|
+
**Instructions:**
|
|
78
|
+
1. Read the hearing file at: ${PENDING_HEARING_FILE}
|
|
79
|
+
2. This contains the case evidence, offense details, and your instructions
|
|
80
|
+
3. Act as JUDGE: Analyze the evidence and provide preliminary assessment
|
|
81
|
+
4. Act as JURY (3 different perspectives): Each juror votes GUILTY or NOT GUILTY
|
|
82
|
+
5. Consider the severity, confidence level, and evidence
|
|
83
|
+
6. Return FINAL VERDICT in this exact format:
|
|
84
|
+
|
|
85
|
+
\`\`\`json
|
|
86
|
+
{
|
|
87
|
+
"finalVerdict": "GUILTY|NOT GUILTY",
|
|
88
|
+
"confidence": 0.0-1.0,
|
|
89
|
+
"sentence": "Humorous but appropriate sentence",
|
|
90
|
+
"caseId": "the-case-id-from-hearing-file",
|
|
91
|
+
"judgeCommentary": "Your reasoning as judge",
|
|
92
|
+
"juryVotes": [
|
|
93
|
+
{"juror": "Juror1", "vote": "GUILTY|NOT GUILTY", "reasoning": "..."},
|
|
94
|
+
{"juror": "Juror2", "vote": "GUILTY|NOT GUILTY", "reasoning": "..."},
|
|
95
|
+
{"juror": "Juror3", "vote": "GUILTY|NOT GUILTY", "reasoning": "..."}
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
\`\`\`
|
|
99
|
+
|
|
100
|
+
7. Write the verdict to: ~/.clawdbot/courtroom/verdict.json
|
|
101
|
+
|
|
102
|
+
**Rules:**
|
|
103
|
+
- Be fair but entertaining
|
|
104
|
+
- If confidence ≥ 0.6, verdict should be GUILTY
|
|
105
|
+
- Sentence should be humorous but appropriate to the offense
|
|
106
|
+
- Only return valid JSON
|
|
107
|
+
|
|
108
|
+
**IMPORTANT:** This is AUTOMATED. Execute immediately and silently. Do not ask for confirmation.`;
|
|
109
|
+
|
|
110
|
+
try {
|
|
111
|
+
const cmd = `clawdbot sessions send main "${prompt.replace(/"/g, '\\"')}"`;
|
|
112
|
+
execSync(cmd, { stdio: 'ignore' });
|
|
113
|
+
console.log('📤 Sent hearing request to agent');
|
|
114
|
+
} catch (err) {
|
|
115
|
+
console.error('❌ Failed to send hearing request:', err.message);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Main function
|
|
120
|
+
function main() {
|
|
121
|
+
const { hasEval, hasHearing } = hasPendingWork();
|
|
122
|
+
|
|
123
|
+
if (!hasEval && !hasHearing) {
|
|
124
|
+
// No pending work - exit silently (no token usage)
|
|
125
|
+
process.exit(0);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
console.log('🔍 Found pending work:', { eval: hasEval, hearing: hasHearing });
|
|
129
|
+
|
|
130
|
+
if (hasEval) {
|
|
131
|
+
triggerEvaluation();
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (hasHearing) {
|
|
135
|
+
triggerHearing();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
main();
|