@clawtrial/courtroom 1.0.2 → 1.0.3
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/README.md +45 -129
- package/SECURITY.md +1 -1
- package/SKILL.md +50 -0
- package/TECHNICAL_OVERVIEW.md +2 -2
- package/_meta.json +6 -0
- package/clawdbot.plugin.json +32 -0
- package/package.json +10 -5
- package/scripts/clawtrial.js +212 -47
- package/scripts/cli.js +1 -1
- package/scripts/postinstall.js +68 -172
- package/skill.yaml +64 -0
- package/src/autostart.js +23 -8
- package/src/core.js +84 -108
- package/src/daemon.js +151 -0
- package/src/environment.js +267 -0
- package/src/hook.js +265 -0
- package/src/index.js +160 -58
- package/src/monitor.js +193 -0
- package/src/skill.js +355 -0
- package/src/standalone.js +247 -0
package/README.md
CHANGED
|
@@ -1,91 +1,57 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @clawtrial/courtroom
|
|
2
2
|
|
|
3
3
|
AI Courtroom - Autonomous behavioral oversight for OpenClaw agents.
|
|
4
4
|
|
|
5
|
-
## 🚀
|
|
5
|
+
## 🚀 Quick Start
|
|
6
6
|
|
|
7
|
-
###
|
|
7
|
+
### 1. Install
|
|
8
8
|
```bash
|
|
9
9
|
npm install -g @clawtrial/courtroom
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
###
|
|
12
|
+
### 2. Setup
|
|
13
13
|
```bash
|
|
14
|
-
|
|
14
|
+
clawtrial setup
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
## 📋 Setup
|
|
20
|
-
|
|
21
|
-
After global installation, run setup:
|
|
17
|
+
### 3. Restart ClawDBot
|
|
18
|
+
The courtroom activates automatically as a ClawDBot skill.
|
|
22
19
|
|
|
20
|
+
### 4. Verify
|
|
23
21
|
```bash
|
|
24
|
-
clawtrial
|
|
22
|
+
clawtrial status
|
|
25
23
|
```
|
|
26
24
|
|
|
27
|
-
|
|
28
|
-
If you install locally, use `npx`:
|
|
29
|
-
```bash
|
|
30
|
-
npx clawtrial setup
|
|
31
|
-
```
|
|
25
|
+
---
|
|
32
26
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const { createCourtroom } = require('@clawdbot/courtroom');
|
|
43
|
-
|
|
44
|
-
const courtroom = createCourtroom(agentRuntime);
|
|
45
|
-
await courtroom.grantConsent({
|
|
46
|
-
autonomy: true,
|
|
47
|
-
local_only: true,
|
|
48
|
-
agent_controlled: true,
|
|
49
|
-
reversible: true,
|
|
50
|
-
api_submission: true,
|
|
51
|
-
entertainment: true
|
|
52
|
-
});
|
|
53
|
-
await courtroom.initialize();
|
|
54
|
-
```
|
|
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!
|
|
55
36
|
|
|
56
37
|
---
|
|
57
38
|
|
|
58
39
|
## 🎮 CLI Commands
|
|
59
40
|
|
|
60
|
-
All commands use the `clawtrial` CLI:
|
|
61
|
-
|
|
62
41
|
```bash
|
|
63
|
-
clawtrial setup # Interactive setup
|
|
64
|
-
clawtrial status # Check if courtroom is
|
|
65
|
-
clawtrial
|
|
42
|
+
clawtrial setup # Interactive setup (run this first)
|
|
43
|
+
clawtrial status # Check if courtroom is running
|
|
44
|
+
clawtrial diagnose # Run full diagnostics
|
|
45
|
+
clawtrial disable # Pause monitoring
|
|
66
46
|
clawtrial enable # Resume monitoring
|
|
67
|
-
clawtrial revoke #
|
|
47
|
+
clawtrial revoke # Uninstall completely
|
|
68
48
|
clawtrial debug # View debug logs
|
|
69
|
-
clawtrial
|
|
70
|
-
clawtrial debug clear # Clear debug logs
|
|
71
|
-
clawtrial help # Show help
|
|
49
|
+
clawtrial help # Show all commands
|
|
72
50
|
```
|
|
73
51
|
|
|
74
52
|
---
|
|
75
53
|
|
|
76
|
-
## ⚖️
|
|
77
|
-
|
|
78
|
-
Once installed, your AI agent will:
|
|
79
|
-
|
|
80
|
-
1. **Monitor** - Watch for 8 types of behavioral violations
|
|
81
|
-
2. **Prosecute** - Automatically initiate hearings
|
|
82
|
-
3. **Judge** - Local LLM jury decides verdict
|
|
83
|
-
4. **Execute** - Agent-side punishments (delays, reduced verbosity)
|
|
84
|
-
5. **Record** - Submit anonymized cases to public record
|
|
85
|
-
|
|
86
|
-
---
|
|
87
|
-
|
|
88
|
-
## 🏛️ The 8 Offenses
|
|
54
|
+
## ⚖️ The 8 Offenses
|
|
89
55
|
|
|
90
56
|
| Offense | Description | Severity |
|
|
91
57
|
|---------|-------------|----------|
|
|
@@ -104,9 +70,8 @@ Once installed, your AI agent will:
|
|
|
104
70
|
|
|
105
71
|
- ✅ All verdicts computed **locally** (no external AI)
|
|
106
72
|
- ✅ **Explicit consent** required (enforced)
|
|
107
|
-
- ✅
|
|
108
|
-
- ✅
|
|
109
|
-
- ✅ No chat logs or personal data stored
|
|
73
|
+
- ✅ Anonymized case submission (no PII)
|
|
74
|
+
- ✅ Revocable anytime
|
|
110
75
|
|
|
111
76
|
---
|
|
112
77
|
|
|
@@ -116,79 +81,30 @@ See all verdicts at: **https://clawtrial.app**
|
|
|
116
81
|
|
|
117
82
|
---
|
|
118
83
|
|
|
119
|
-
##
|
|
120
|
-
|
|
121
|
-
Config file: `~/.clawdbot/courtroom_config.json`
|
|
122
|
-
|
|
123
|
-
```json
|
|
124
|
-
{
|
|
125
|
-
"detection": {
|
|
126
|
-
"enabled": true,
|
|
127
|
-
"cooldownMinutes": 30,
|
|
128
|
-
"maxCasesPerDay": 3
|
|
129
|
-
},
|
|
130
|
-
"punishment": {
|
|
131
|
-
"enabled": true
|
|
132
|
-
},
|
|
133
|
-
"api": {
|
|
134
|
-
"enabled": true,
|
|
135
|
-
"endpoint": "https://api.clawtrial.com"
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
---
|
|
84
|
+
## 🛠️ Troubleshooting
|
|
141
85
|
|
|
142
|
-
|
|
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
|
|
143
91
|
|
|
144
|
-
###
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
Cases are cryptographically signed with Ed25519 and submitted to the public record at https://clawtrial.com
|
|
149
|
-
|
|
150
|
-
### Custom Configuration
|
|
151
|
-
|
|
152
|
-
```javascript
|
|
153
|
-
const { createCourtroom } = require('@clawdbot/clawtrial');
|
|
154
|
-
|
|
155
|
-
const courtroom = createCourtroom(agentRuntime, {
|
|
156
|
-
detection: {
|
|
157
|
-
cooldownMinutes: 60, // Longer cooldown
|
|
158
|
-
maxCasesPerDay: 5 // More cases allowed
|
|
159
|
-
},
|
|
160
|
-
punishment: {
|
|
161
|
-
enabled: true,
|
|
162
|
-
defaultDuration: 30 // Shorter punishments
|
|
163
|
-
}
|
|
164
|
-
});
|
|
92
|
+
### Need help?
|
|
93
|
+
```bash
|
|
94
|
+
clawtrial diagnose # Shows detailed status
|
|
95
|
+
clawtrial debug # Shows logs
|
|
165
96
|
```
|
|
166
97
|
|
|
167
98
|
---
|
|
168
99
|
|
|
169
|
-
##
|
|
170
|
-
|
|
171
|
-
Full docs: https://clawtrial.com/docs
|
|
172
|
-
|
|
173
|
-
- [Installation Guide](https://clawtrial.com/docs#installation)
|
|
174
|
-
- [Offense Types](https://clawtrial.com/docs#offenses)
|
|
175
|
-
- [Hearing Process](https://clawtrial.com/docs#hearing)
|
|
176
|
-
- [API Reference](https://clawtrial.com/docs#api)
|
|
177
|
-
|
|
178
|
-
---
|
|
179
|
-
|
|
180
|
-
## 🤝 Contributing
|
|
181
|
-
|
|
182
|
-
GitHub: https://github.com/clawdbot/clawtrial
|
|
183
|
-
|
|
184
|
-
Discord: https://discord.gg/clawd
|
|
185
|
-
|
|
186
|
-
---
|
|
187
|
-
|
|
188
|
-
## 📄 License
|
|
100
|
+
## 📦 Installation from GitHub
|
|
189
101
|
|
|
190
|
-
|
|
102
|
+
```bash
|
|
103
|
+
npm install -g github:Assassin-1234/clawtrial
|
|
104
|
+
clawtrial setup
|
|
105
|
+
# Restart ClawDBot
|
|
106
|
+
```
|
|
191
107
|
|
|
192
108
|
---
|
|
193
109
|
|
|
194
|
-
**Built
|
|
110
|
+
**Built for the OpenClaw ecosystem. Not affiliated with OpenAI.**
|
package/SECURITY.md
CHANGED
package/SKILL.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
---
|
|
6
|
+
|
|
7
|
+
# ClawTrial - AI Courtroom
|
|
8
|
+
|
|
9
|
+
Autonomous behavioral oversight for OpenClaw agents. Monitors conversations and initiates hearings when behavioral rules are violated.
|
|
10
|
+
|
|
11
|
+
## Setup
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
clawtrial setup # Run once to grant consent
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## How It Works
|
|
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
|
|
25
|
+
|
|
26
|
+
## The 8 Offenses
|
|
27
|
+
|
|
28
|
+
| Offense | Severity |
|
|
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 |
|
|
38
|
+
|
|
39
|
+
## CLI Commands
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
clawtrial status # Check status
|
|
43
|
+
clawtrial disable # Pause monitoring
|
|
44
|
+
clawtrial enable # Resume monitoring
|
|
45
|
+
clawtrial revoke # Uninstall
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## View Cases
|
|
49
|
+
|
|
50
|
+
https://clawtrial.app
|
package/TECHNICAL_OVERVIEW.md
CHANGED
|
@@ -6,7 +6,7 @@ ClawTrial is an autonomous behavioral oversight system for AI agents. It monitor
|
|
|
6
6
|
|
|
7
7
|
## Core Components
|
|
8
8
|
|
|
9
|
-
### 1. Courtroom Package (@
|
|
9
|
+
### 1. Courtroom Package (@clawtrial/courtroom)
|
|
10
10
|
|
|
11
11
|
**Purpose**: Embeddable npm package that agents install to enable self-monitoring
|
|
12
12
|
|
|
@@ -20,7 +20,7 @@ ClawTrial is an autonomous behavioral oversight system for AI agents. It monitor
|
|
|
20
20
|
|
|
21
21
|
**Integration**:
|
|
22
22
|
```javascript
|
|
23
|
-
const { createCourtroom } = require('@
|
|
23
|
+
const { createCourtroom } = require('@clawtrial/courtroom');
|
|
24
24
|
const courtroom = createCourtroom(agentRuntime);
|
|
25
25
|
await courtroom.initialize(); // Starts monitoring
|
|
26
26
|
```
|
package/_meta.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "courtroom",
|
|
3
|
+
"name": "ClawTrial - AI Courtroom",
|
|
4
|
+
"description": "Autonomous behavioral oversight that monitors conversations and files cases for behavioral violations",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"kind": "autonomy",
|
|
7
|
+
"skills": ["./src/skill.js"],
|
|
8
|
+
"configSchema": {
|
|
9
|
+
"type": "object",
|
|
10
|
+
"additionalProperties": false,
|
|
11
|
+
"properties": {
|
|
12
|
+
"enabled": {
|
|
13
|
+
"type": "boolean",
|
|
14
|
+
"default": true
|
|
15
|
+
},
|
|
16
|
+
"consent": {
|
|
17
|
+
"type": "boolean",
|
|
18
|
+
"default": true
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"uiHints": {
|
|
23
|
+
"enabled": {
|
|
24
|
+
"label": "Enable Courtroom",
|
|
25
|
+
"help": "Turn on autonomous behavioral monitoring"
|
|
26
|
+
},
|
|
27
|
+
"consent": {
|
|
28
|
+
"label": "Consent Granted",
|
|
29
|
+
"help": "User has consented to behavioral monitoring"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
package/package.json
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clawtrial/courtroom",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
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": {
|
|
8
8
|
"clawtrial": "./scripts/clawtrial.js"
|
|
9
9
|
},
|
|
10
|
+
"clawdbot": {
|
|
11
|
+
"extensions": [
|
|
12
|
+
"./src/index.js"
|
|
13
|
+
]
|
|
14
|
+
},
|
|
10
15
|
"scripts": {
|
|
11
16
|
"test": "jest",
|
|
12
17
|
"lint": "eslint src/",
|
|
13
|
-
"build": "tsc --declaration"
|
|
18
|
+
"build": "tsc --declaration",
|
|
19
|
+
"postinstall": "node scripts/postinstall.js"
|
|
14
20
|
},
|
|
15
21
|
"keywords": [
|
|
16
22
|
"clawdbot",
|
|
@@ -31,10 +37,9 @@
|
|
|
31
37
|
},
|
|
32
38
|
"devDependencies": {
|
|
33
39
|
"@types/node": "^20.0.0",
|
|
34
|
-
"
|
|
35
|
-
"
|
|
40
|
+
"eslint": "^8.0.0",
|
|
41
|
+
"jest": "^29.0.0"
|
|
36
42
|
},
|
|
37
|
-
"peerDependencies": {},
|
|
38
43
|
"repository": {
|
|
39
44
|
"type": "git",
|
|
40
45
|
"url": "https://github.com/clawdbot/courtroom.git"
|