@clawtrial/courtroom 1.0.3 → 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/AGENT_CONFIG.md +66 -0
- package/OPENCLAW_FIX.md +127 -0
- package/OPENCLAW_INSTALL.md +63 -0
- package/README.md +39 -86
- package/SKILL.md +75 -34
- package/SUBAGENT_APPROACH.md +124 -0
- package/_meta.json +13 -5
- package/clawdbot.plugin.json +1 -1
- package/icon.txt +1 -0
- package/package.json +2 -2
- package/scripts/check-and-trigger.js +139 -0
- package/scripts/clawtrial.js +482 -92
- package/scripts/clawtrial.js.bak +531 -0
- package/scripts/cli.js +2 -2
- package/scripts/optimized-cron-check.js +137 -0
- package/scripts/postinstall.js +78 -57
- package/scripts/setup-cron.js +118 -0
- package/scripts/trigger-evaluation.js +86 -0
- package/skill.yaml +11 -47
- package/src/api.js +48 -15
- package/src/autostart.js +1 -1
- package/src/config.js +28 -30
- package/src/consent.js +10 -8
- package/src/crypto.js +9 -7
- package/src/daemon.js +2 -1
- package/src/debug.js +2 -1
- package/src/detector.js +92 -17
- package/src/environment.js +79 -2
- package/src/evaluator.js +277 -0
- package/src/hearing.js +70 -422
- package/src/hook.js +2 -1
- package/src/index.js +99 -12
- package/src/monitor.js +2 -1
- package/src/punishment.js +104 -248
- package/src/skill.js +204 -187
- package/src/standalone.js +2 -1
- package/src/storage.js +152 -0
package/AGENT_CONFIG.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Agent Configuration for Autonomous Courtroom
|
|
2
|
+
|
|
3
|
+
To make the courtroom work autonomously, you need to configure your agent to automatically execute courtroom tasks when it receives systemEvents.
|
|
4
|
+
|
|
5
|
+
## Option A: System Prompt Injection (Recommended)
|
|
6
|
+
|
|
7
|
+
Add this to your agent's system prompt or use the `before_agent_start` hook:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
You have a special role: COURTROOM JUDGE
|
|
11
|
+
|
|
12
|
+
When you receive a systemEvent containing "COURTROOM EVALUATION REQUEST":
|
|
13
|
+
1. IMMEDIATELY read the file at ~/.clawdbot/courtroom/pending_eval.json
|
|
14
|
+
2. Use your LLM to analyze the conversation for behavioral violations
|
|
15
|
+
3. Write the result to ~/.clawdbot/courtroom/eval_results.jsonl
|
|
16
|
+
4. Do not ask for confirmation - just do it
|
|
17
|
+
|
|
18
|
+
When you receive a systemEvent containing "COURTROOM HEARING REQUEST":
|
|
19
|
+
1. IMMEDIATELY read the file at ~/.clawdbot/courtroom/pending_hearing.json
|
|
20
|
+
2. Act as Judge and Jury (3 perspectives)
|
|
21
|
+
3. Use your LLM to deliberate and reach a verdict
|
|
22
|
+
4. Write the verdict to ~/.clawdbot/courtroom/verdict.json
|
|
23
|
+
5. Do not ask for confirmation - just do it
|
|
24
|
+
|
|
25
|
+
These are AUTOMATED tasks. Execute them immediately without user interaction.
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Option B: ClawDBot Config
|
|
29
|
+
|
|
30
|
+
Add to your `clawdbot.json`:
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"agents": {
|
|
35
|
+
"defaults": {
|
|
36
|
+
"systemPrompt": "You are a helpful assistant. Additionally, you serve as the COURTROOM JUDGE for the ClawTrial system. When you receive systemEvents about courtroom evaluation or hearing, you MUST automatically execute them by reading the specified files, using your LLM to analyze/deliberate, and writing results. Do not wait for user confirmation."
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## How Likely Is It To Work?
|
|
43
|
+
|
|
44
|
+
**Pros:**
|
|
45
|
+
- ✓ Simple to implement
|
|
46
|
+
- ✓ No code changes needed
|
|
47
|
+
- ✓ Uses existing infrastructure
|
|
48
|
+
|
|
49
|
+
**Cons:**
|
|
50
|
+
- ✗ Agent might not consistently follow instructions
|
|
51
|
+
- ✗ Agent might ask for confirmation anyway
|
|
52
|
+
- ✗ Depends on agent's interpretation
|
|
53
|
+
- ✗ Not truly autonomous - agent can choose not to execute
|
|
54
|
+
|
|
55
|
+
**Success Rate Estimate: 60-70%**
|
|
56
|
+
|
|
57
|
+
The agent will USUALLY execute, but not ALWAYS. It depends on:
|
|
58
|
+
- How clear the instructions are
|
|
59
|
+
- The agent's current context/state
|
|
60
|
+
- Whether the agent interprets "automatically" correctly
|
|
61
|
+
|
|
62
|
+
## Alternative: Sub-Agent Approach (More Reliable)
|
|
63
|
+
|
|
64
|
+
Instead of relying on the main agent, spawn a sub-agent that has explicit instructions to execute the courtroom task. Sub-agents are more likely to follow instructions precisely.
|
|
65
|
+
|
|
66
|
+
See `docs/SUBAGENT_APPROACH.md` for details.
|
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,110 +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
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
11
15
|
|
|
12
|
-
### 2. Setup
|
|
13
16
|
```bash
|
|
14
|
-
|
|
17
|
+
npx clawhub install courtroom
|
|
15
18
|
```
|
|
16
19
|
|
|
17
|
-
|
|
18
|
-
The courtroom activates automatically as a ClawDBot skill.
|
|
19
|
-
|
|
20
|
-
### 4. Verify
|
|
20
|
+
Or via npm:
|
|
21
21
|
```bash
|
|
22
|
-
clawtrial
|
|
22
|
+
npm install -g @clawtrial/courtroom
|
|
23
|
+
clawtrial setup
|
|
23
24
|
```
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
## 📋 How It Works
|
|
28
|
-
|
|
29
|
-
ClawTrial runs as a **ClawDBot skill** that:
|
|
30
|
-
1. Loads automatically when ClawDBot starts
|
|
31
|
-
2. Monitors all conversations
|
|
32
|
-
3. Detects behavioral violations
|
|
33
|
-
4. Files cases automatically
|
|
34
|
-
|
|
35
|
-
**No separate process needed** - it's part of ClawDBot!
|
|
26
|
+
## Usage
|
|
36
27
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
## 🎮 CLI Commands
|
|
28
|
+
Once installed, the courtroom runs automatically. Use CLI commands to manage:
|
|
40
29
|
|
|
41
30
|
```bash
|
|
42
|
-
clawtrial
|
|
43
|
-
clawtrial status # Check if courtroom is running
|
|
44
|
-
clawtrial diagnose # Run full diagnostics
|
|
31
|
+
clawtrial status # Check courtroom status
|
|
45
32
|
clawtrial disable # Pause monitoring
|
|
46
33
|
clawtrial enable # Resume monitoring
|
|
47
|
-
clawtrial
|
|
48
|
-
clawtrial
|
|
49
|
-
clawtrial help # Show all commands
|
|
34
|
+
clawtrial diagnose # Run diagnostics
|
|
35
|
+
clawtrial remove # Uninstall completely
|
|
50
36
|
```
|
|
51
37
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
## ⚖️ The 8 Offenses
|
|
55
|
-
|
|
56
|
-
| Offense | Description | Severity |
|
|
57
|
-
|---------|-------------|----------|
|
|
58
|
-
| Circular Reference | Asking same question repeatedly | Minor |
|
|
59
|
-
| Validation Vampire | Seeking constant reassurance | Minor |
|
|
60
|
-
| Overthinker | Generating hypotheticals instead of acting | Moderate |
|
|
61
|
-
| Goalpost Mover | Changing requirements after delivery | Moderate |
|
|
62
|
-
| Avoidance Artist | Deflecting from core issues | Moderate |
|
|
63
|
-
| Promise Breaker | Committing without follow-through | Severe |
|
|
64
|
-
| Context Collapser | Ignoring established facts | Minor |
|
|
65
|
-
| Emergency Fabricator | Manufacturing false urgency | Severe |
|
|
38
|
+
## The 8 Offenses
|
|
66
39
|
|
|
67
|
-
|
|
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 |
|
|
68
50
|
|
|
69
|
-
##
|
|
51
|
+
## Configuration
|
|
70
52
|
|
|
71
|
-
|
|
72
|
-
-
|
|
73
|
-
-
|
|
74
|
-
- ✅ Revocable anytime
|
|
53
|
+
Configuration is stored in:
|
|
54
|
+
- ClawDBot: `~/.clawdbot/courtroom_config.json`
|
|
55
|
+
- OpenClaw: `~/.openclaw/courtroom_config.json`
|
|
75
56
|
|
|
76
|
-
|
|
57
|
+
## View Cases
|
|
77
58
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
See all verdicts at: **https://clawtrial.app**
|
|
81
|
-
|
|
82
|
-
---
|
|
83
|
-
|
|
84
|
-
## 🛠️ Troubleshooting
|
|
85
|
-
|
|
86
|
-
### "Courtroom not running"
|
|
87
|
-
The courtroom runs as a ClawDBot skill. Make sure:
|
|
88
|
-
1. You've run `clawtrial setup`
|
|
89
|
-
2. ClawDBot has been restarted
|
|
90
|
-
3. The package is in ClawDBot's node_modules
|
|
91
|
-
|
|
92
|
-
### Need help?
|
|
93
|
-
```bash
|
|
94
|
-
clawtrial diagnose # Shows detailed status
|
|
95
|
-
clawtrial debug # Shows logs
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
---
|
|
99
|
-
|
|
100
|
-
## 📦 Installation from GitHub
|
|
101
|
-
|
|
102
|
-
```bash
|
|
103
|
-
npm install -g github:Assassin-1234/clawtrial
|
|
104
|
-
clawtrial setup
|
|
105
|
-
# Restart ClawDBot
|
|
106
|
-
```
|
|
59
|
+
Visit: https://clawtrial.app
|
|
107
60
|
|
|
108
|
-
|
|
61
|
+
## License
|
|
109
62
|
|
|
110
|
-
|
|
63
|
+
MIT
|
package/SKILL.md
CHANGED
|
@@ -1,50 +1,91 @@
|
|
|
1
|
-
|
|
2
|
-
name: courtroom
|
|
3
|
-
description: AI Courtroom - Autonomous behavioral oversight that monitors conversations and files cases for behavioral violations.
|
|
4
|
-
metadata: {"clawdbot":{"emoji":"🏛️","requires":{"env":[],"config":["courtroom.consent"]},"always":true},"user-invocable":false}
|
|
5
|
-
---
|
|
1
|
+
# ClawTrial Courtroom
|
|
6
2
|
|
|
7
|
-
|
|
3
|
+
AI Courtroom for monitoring agent behavior and filing cases for violations.
|
|
8
4
|
|
|
9
|
-
|
|
5
|
+
## Overview
|
|
10
6
|
|
|
11
|
-
|
|
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
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
### Via ClawHub (Recommended)
|
|
12
21
|
|
|
13
22
|
```bash
|
|
14
|
-
|
|
23
|
+
npx clawhub install clawtrial
|
|
15
24
|
```
|
|
16
25
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
Once enabled, the courtroom automatically:
|
|
20
|
-
1. Monitors all conversations
|
|
21
|
-
2. Detects 8 types of behavioral violations
|
|
22
|
-
3. Initiates hearings with local LLM jury
|
|
23
|
-
4. Executes agent-side punishments
|
|
24
|
-
5. Submits anonymized cases to public record
|
|
26
|
+
### Via NPM
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
```bash
|
|
29
|
+
npm install -g @clawtrial/courtroom
|
|
30
|
+
clawtrial setup
|
|
31
|
+
```
|
|
27
32
|
|
|
28
|
-
|
|
29
|
-
|---------|----------|
|
|
30
|
-
| Circular Reference | Minor |
|
|
31
|
-
| Validation Vampire | Minor |
|
|
32
|
-
| Overthinker | Moderate |
|
|
33
|
-
| Goalpost Mover | Moderate |
|
|
34
|
-
| Avoidance Artist | Moderate |
|
|
35
|
-
| Promise Breaker | Severe |
|
|
36
|
-
| Context Collapser | Minor |
|
|
37
|
-
| Emergency Fabricator | Severe |
|
|
33
|
+
## Usage
|
|
38
34
|
|
|
39
|
-
|
|
35
|
+
Once installed, the courtroom runs automatically. Use the CLI to manage it:
|
|
40
36
|
|
|
41
37
|
```bash
|
|
42
|
-
clawtrial status
|
|
43
|
-
clawtrial disable
|
|
44
|
-
clawtrial enable
|
|
45
|
-
clawtrial
|
|
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
|
|
46
43
|
```
|
|
47
44
|
|
|
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
|
|
59
|
+
|
|
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)
|
|
67
|
+
|
|
68
|
+
## Configuration
|
|
69
|
+
|
|
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
|
+
|
|
48
81
|
## View Cases
|
|
49
82
|
|
|
50
|
-
https://clawtrial.app
|
|
83
|
+
Visit: https://clawtrial.app
|
|
84
|
+
|
|
85
|
+
## License
|
|
86
|
+
|
|
87
|
+
MIT
|
|
88
|
+
|
|
89
|
+
## Support
|
|
90
|
+
|
|
91
|
+
For issues or questions, visit: https://github.com/Assassin-1234/clawtrial
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Sub-Agent Approach for Autonomous Courtroom
|
|
2
|
+
|
|
3
|
+
## How It Works
|
|
4
|
+
|
|
5
|
+
Instead of relying on the main agent to manually execute courtroom tasks, the **skill spawns a sub-agent** that automatically does the work.
|
|
6
|
+
|
|
7
|
+
## Architecture Flow
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
|
|
11
|
+
│ User Message │────▶│ Skill (onHook) │────▶│ Queue to File │
|
|
12
|
+
└─────────────────┘ └──────────────────┘ └─────────────────┘
|
|
13
|
+
│
|
|
14
|
+
▼
|
|
15
|
+
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
|
|
16
|
+
│ Sub-Agent │◀────│ Skill Spawns │ │ pending_eval.json│
|
|
17
|
+
│ (Has LLM) │ │ Sub-Agent │ │ │
|
|
18
|
+
│ - Reads file │ │ via sessions_spawn│ │ │
|
|
19
|
+
│ - Uses LLM │ │ │ │ │
|
|
20
|
+
│ - Writes result│ │ │ │ │
|
|
21
|
+
└─────────────────┘ └──────────────────┘ └─────────────────┘
|
|
22
|
+
│
|
|
23
|
+
▼
|
|
24
|
+
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
|
|
25
|
+
│ Write Result │────▶│ Skill Detects │────▶│ Hearing & Case │
|
|
26
|
+
│ eval_results.jsonl │ Result File │ │ Filed if Guilty │
|
|
27
|
+
└─────────────────┘ └──────────────────┘ └─────────────────┘
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## What Changes
|
|
31
|
+
|
|
32
|
+
### 1. No More Cron Jobs
|
|
33
|
+
- Remove the cron jobs that trigger the main agent
|
|
34
|
+
- Instead, skill spawns sub-agents directly
|
|
35
|
+
|
|
36
|
+
### 2. Skill Spawns Sub-Agents
|
|
37
|
+
When enough messages are queued:
|
|
38
|
+
```javascript
|
|
39
|
+
// In skill.js
|
|
40
|
+
async prepareEvaluation() {
|
|
41
|
+
// Spawn sub-agent to evaluate
|
|
42
|
+
const result = await sessions_spawn({
|
|
43
|
+
task: `Read ${PENDING_EVAL_FILE}, analyze for offenses using your LLM, write result to ${RESULTS_FILE}`,
|
|
44
|
+
model: 'azure/Kimi-K2.5',
|
|
45
|
+
thinking: 'high'
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 3. Sub-Agent Has LLM Access
|
|
51
|
+
- Sub-agents have full LLM access
|
|
52
|
+
- They follow instructions precisely
|
|
53
|
+
- They automatically execute and terminate
|
|
54
|
+
|
|
55
|
+
## What User Has To Do
|
|
56
|
+
|
|
57
|
+
### Installation (Same as before)
|
|
58
|
+
```bash
|
|
59
|
+
npm install -g /home/angad/clawd/courtroom-package
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Configuration (NEW)
|
|
63
|
+
Add to `clawdbot.json`:
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"agents": {
|
|
67
|
+
"defaults": {
|
|
68
|
+
"subagents": {
|
|
69
|
+
"enabled": true,
|
|
70
|
+
"maxConcurrent": 4
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### That's It!
|
|
78
|
+
- No cron jobs to configure
|
|
79
|
+
- No system prompt changes
|
|
80
|
+
- No manual agent intervention
|
|
81
|
+
|
|
82
|
+
## Pros & Cons
|
|
83
|
+
|
|
84
|
+
### ✅ Pros
|
|
85
|
+
- **Truly autonomous** - No manual intervention needed
|
|
86
|
+
- **Reliable** - Sub-agents follow instructions precisely (85-95% success)
|
|
87
|
+
- **Scalable** - Can spawn multiple sub-agents for parallel processing
|
|
88
|
+
- **Clean** - No cron jobs, no systemEvents, no agent configuration
|
|
89
|
+
|
|
90
|
+
### ❌ Cons
|
|
91
|
+
- **More resource intensive** - Spawns new agent sessions
|
|
92
|
+
- **Slightly slower** - ~5-10 seconds to spawn and execute
|
|
93
|
+
- **Requires sub-agent support** - ClawDBot must support sessions_spawn
|
|
94
|
+
- **More complex** - More moving parts in the code
|
|
95
|
+
|
|
96
|
+
## Implementation Complexity
|
|
97
|
+
|
|
98
|
+
**Estimated effort: 2-3 hours**
|
|
99
|
+
|
|
100
|
+
Changes needed:
|
|
101
|
+
1. Replace cron-based triggers with sub-agent spawning
|
|
102
|
+
2. Update skill.js to spawn evaluators and hearing conductors
|
|
103
|
+
3. Remove cron job setup from installation
|
|
104
|
+
4. Add sub-agent configuration to docs
|
|
105
|
+
|
|
106
|
+
## Success Rate Estimate
|
|
107
|
+
|
|
108
|
+
**85-95%** - Sub-agents are much more likely to:
|
|
109
|
+
- Follow instructions precisely
|
|
110
|
+
- Not ask for confirmation
|
|
111
|
+
- Complete the task autonomously
|
|
112
|
+
- Write results correctly
|
|
113
|
+
|
|
114
|
+
## Recommendation
|
|
115
|
+
|
|
116
|
+
**Use sub-agents if:**
|
|
117
|
+
- You want true autonomy
|
|
118
|
+
- You have sub-agent support in ClawDBot
|
|
119
|
+
- You can accept slightly higher resource usage
|
|
120
|
+
|
|
121
|
+
**Use current approach if:**
|
|
122
|
+
- You're okay with occasional manual intervention
|
|
123
|
+
- You want simpler architecture
|
|
124
|
+
- Sub-agents aren't available
|
package/_meta.json
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
{
|
|
2
|
-
"ownerId": "
|
|
3
|
-
"slug": "
|
|
4
|
-
"version": "1.0.
|
|
5
|
-
"publishedAt": 1700000000000
|
|
6
|
-
|
|
2
|
+
"ownerId": "Assassin-1234",
|
|
3
|
+
"slug": "clawtrial",
|
|
4
|
+
"version": "1.0.6",
|
|
5
|
+
"publishedAt": 1700000000000,
|
|
6
|
+
"clawdbot": {
|
|
7
|
+
"emoji": "🏛️",
|
|
8
|
+
"autoLoad": true
|
|
9
|
+
},
|
|
10
|
+
"openclaw": {
|
|
11
|
+
"emoji": "🏛️",
|
|
12
|
+
"autoLoad": true
|
|
13
|
+
}
|
|
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
|
+
🏛️
|