@clawtrial/courtroom 1.0.2 → 1.0.3-b
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 +62 -123
- package/SECURITY.md +1 -1
- package/SKILL.md +65 -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 +67 -177
- 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,68 @@
|
|
|
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
|
+
**⚠️ IMPORTANT:** If `clawtrial` command is not found after install, run:
|
|
13
13
|
```bash
|
|
14
|
-
npm
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
## 📋 Setup
|
|
14
|
+
# Option 1: Add npm global bin to PATH
|
|
15
|
+
export PATH="$HOME/.npm-global/bin:$PATH"
|
|
20
16
|
|
|
21
|
-
|
|
17
|
+
# Option 2: Create symlink (requires sudo)
|
|
18
|
+
sudo ln -sf "$HOME/.npm-global/lib/node_modules/@clawtrial/courtroom/scripts/clawtrial.js" /usr/bin/clawtrial
|
|
19
|
+
```
|
|
22
20
|
|
|
21
|
+
### 2. Setup
|
|
23
22
|
```bash
|
|
24
23
|
clawtrial setup
|
|
25
24
|
```
|
|
26
25
|
|
|
27
|
-
###
|
|
28
|
-
If you install locally, use `npx`:
|
|
26
|
+
### 3. Start the Courtroom
|
|
29
27
|
```bash
|
|
30
|
-
|
|
28
|
+
clawtrial start
|
|
31
29
|
```
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
- Configure the courtroom
|
|
37
|
-
- Enable monitoring
|
|
38
|
-
|
|
39
|
-
### Manual Setup (Code)
|
|
40
|
-
|
|
41
|
-
```javascript
|
|
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();
|
|
31
|
+
### 4. Verify
|
|
32
|
+
```bash
|
|
33
|
+
clawtrial status
|
|
54
34
|
```
|
|
55
35
|
|
|
56
36
|
---
|
|
57
37
|
|
|
58
|
-
##
|
|
38
|
+
## 📋 How It Works
|
|
59
39
|
|
|
60
|
-
|
|
40
|
+
ClawTrial runs as a **ClawDBot skill** that:
|
|
41
|
+
1. Monitors all conversations
|
|
42
|
+
2. Detects behavioral violations
|
|
43
|
+
3. Files cases automatically
|
|
61
44
|
|
|
62
|
-
|
|
63
|
-
clawtrial setup # Interactive setup and consent
|
|
64
|
-
clawtrial status # Check if courtroom is active
|
|
65
|
-
clawtrial disable # Temporarily pause monitoring
|
|
66
|
-
clawtrial enable # Resume monitoring
|
|
67
|
-
clawtrial revoke # Revoke consent & uninstall
|
|
68
|
-
clawtrial debug # View debug logs
|
|
69
|
-
clawtrial debug full # View full debug log
|
|
70
|
-
clawtrial debug clear # Clear debug logs
|
|
71
|
-
clawtrial help # Show help
|
|
72
|
-
```
|
|
45
|
+
**Note:** You must run `clawtrial start` after installation to activate monitoring.
|
|
73
46
|
|
|
74
47
|
---
|
|
75
48
|
|
|
76
|
-
##
|
|
77
|
-
|
|
78
|
-
Once installed, your AI agent will:
|
|
49
|
+
## 🎮 CLI Commands
|
|
79
50
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
51
|
+
```bash
|
|
52
|
+
clawtrial setup # Interactive setup (run this first)
|
|
53
|
+
clawtrial start # Start monitoring (required!)
|
|
54
|
+
clawtrial status # Check if courtroom is running
|
|
55
|
+
clawtrial diagnose # Run full diagnostics
|
|
56
|
+
clawtrial disable # Pause monitoring
|
|
57
|
+
clawtrial enable # Resume monitoring
|
|
58
|
+
clawtrial revoke # Uninstall completely
|
|
59
|
+
clawtrial debug # View debug logs
|
|
60
|
+
clawtrial help # Show all commands
|
|
61
|
+
```
|
|
85
62
|
|
|
86
63
|
---
|
|
87
64
|
|
|
88
|
-
##
|
|
65
|
+
## ⚖️ The 8 Offenses
|
|
89
66
|
|
|
90
67
|
| Offense | Description | Severity |
|
|
91
68
|
|---------|-------------|----------|
|
|
@@ -104,9 +81,8 @@ Once installed, your AI agent will:
|
|
|
104
81
|
|
|
105
82
|
- ✅ All verdicts computed **locally** (no external AI)
|
|
106
83
|
- ✅ **Explicit consent** required (enforced)
|
|
107
|
-
- ✅
|
|
108
|
-
- ✅
|
|
109
|
-
- ✅ No chat logs or personal data stored
|
|
84
|
+
- ✅ Anonymized case submission (no PII)
|
|
85
|
+
- ✅ Revocable anytime
|
|
110
86
|
|
|
111
87
|
---
|
|
112
88
|
|
|
@@ -116,79 +92,42 @@ See all verdicts at: **https://clawtrial.app**
|
|
|
116
92
|
|
|
117
93
|
---
|
|
118
94
|
|
|
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
|
-
---
|
|
141
|
-
|
|
142
|
-
## 🛠️ For Developers
|
|
143
|
-
|
|
144
|
-
### Auto-Registration
|
|
145
|
-
|
|
146
|
-
Your agent is automatically registered when submitting the first case. No manual setup required!
|
|
95
|
+
## 🛠️ Troubleshooting
|
|
147
96
|
|
|
148
|
-
|
|
97
|
+
### "clawtrial: command not found"
|
|
98
|
+
npm installs global packages to `~/.npm-global/bin` but your shell may not have this in PATH.
|
|
149
99
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
100
|
+
**Fix:**
|
|
101
|
+
```bash
|
|
102
|
+
# Add to your ~/.bashrc or ~/.zshrc:
|
|
103
|
+
export PATH="$HOME/.npm-global/bin:$PATH"
|
|
154
104
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
cooldownMinutes: 60, // Longer cooldown
|
|
158
|
-
maxCasesPerDay: 5 // More cases allowed
|
|
159
|
-
},
|
|
160
|
-
punishment: {
|
|
161
|
-
enabled: true,
|
|
162
|
-
defaultDuration: 30 // Shorter punishments
|
|
163
|
-
}
|
|
164
|
-
});
|
|
105
|
+
# Then reload:
|
|
106
|
+
source ~/.bashrc # or ~/.zshrc
|
|
165
107
|
```
|
|
166
108
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
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
|
|
109
|
+
### "Courtroom not running"
|
|
110
|
+
You need to explicitly start it:
|
|
111
|
+
```bash
|
|
112
|
+
clawtrial start
|
|
113
|
+
```
|
|
183
114
|
|
|
184
|
-
|
|
115
|
+
### Need help?
|
|
116
|
+
```bash
|
|
117
|
+
clawtrial diagnose # Shows detailed status
|
|
118
|
+
clawtrial debug # Shows logs
|
|
119
|
+
```
|
|
185
120
|
|
|
186
121
|
---
|
|
187
122
|
|
|
188
|
-
##
|
|
123
|
+
## 📦 Installation from GitHub
|
|
189
124
|
|
|
190
|
-
|
|
125
|
+
```bash
|
|
126
|
+
npm install -g github:Assassin-1234/clawtrial
|
|
127
|
+
clawtrial setup
|
|
128
|
+
clawtrial start
|
|
129
|
+
```
|
|
191
130
|
|
|
192
131
|
---
|
|
193
132
|
|
|
194
|
-
**Built
|
|
133
|
+
**Built for the OpenClaw ecosystem. Not affiliated with OpenAI.**
|
package/SECURITY.md
CHANGED
package/SKILL.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install -g @clawtrial/courtroom
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**If `clawtrial` command not found:**
|
|
18
|
+
```bash
|
|
19
|
+
export PATH="$HOME/.npm-global/bin:$PATH"
|
|
20
|
+
# Or: sudo ln -sf "$HOME/.npm-global/lib/node_modules/@clawtrial/courtroom/scripts/clawtrial.js" /usr/bin/clawtrial
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Setup
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
clawtrial setup # Run once to grant consent
|
|
27
|
+
clawtrial start # Start monitoring (REQUIRED!)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## How It Works
|
|
31
|
+
|
|
32
|
+
Once started, the courtroom automatically:
|
|
33
|
+
1. Monitors all conversations
|
|
34
|
+
2. Detects 8 types of behavioral violations
|
|
35
|
+
3. Initiates hearings with local LLM jury
|
|
36
|
+
4. Executes agent-side punishments
|
|
37
|
+
5. Submits anonymized cases to public record
|
|
38
|
+
|
|
39
|
+
## The 8 Offenses
|
|
40
|
+
|
|
41
|
+
| Offense | Severity |
|
|
42
|
+
|---------|----------|
|
|
43
|
+
| Circular Reference | Minor |
|
|
44
|
+
| Validation Vampire | Minor |
|
|
45
|
+
| Overthinker | Moderate |
|
|
46
|
+
| Goalpost Mover | Moderate |
|
|
47
|
+
| Avoidance Artist | Moderate |
|
|
48
|
+
| Promise Breaker | Severe |
|
|
49
|
+
| Context Collapser | Minor |
|
|
50
|
+
| Emergency Fabricator | Severe |
|
|
51
|
+
|
|
52
|
+
## CLI Commands
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
clawtrial setup # Interactive setup
|
|
56
|
+
clawtrial start # Start monitoring (REQUIRED!)
|
|
57
|
+
clawtrial status # Check status
|
|
58
|
+
clawtrial disable # Pause monitoring
|
|
59
|
+
clawtrial enable # Resume monitoring
|
|
60
|
+
clawtrial revoke # Uninstall
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## View Cases
|
|
64
|
+
|
|
65
|
+
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.3b",
|
|
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"
|