claude-comms 1.0.11 → 1.0.13
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/.claude/agents/session-review.md +5 -22
- package/.claude/hooks/comms/get_unread_messages.py +5 -2
- package/.claude/hooks/comms/register_subagent.py +5 -2
- package/.claude/hooks/comms/send_message.py +5 -2
- package/.claude/hooks/comms/update_subagent_completion.py +4 -1
- package/.claude/hooks/observability/send_event.py +10 -3
- package/.claude/hooks/session-data/get_session_data.py +7 -8
- package/.claude/hooks/utils/server_config.py +17 -0
- package/package.json +1 -1
|
@@ -6,7 +6,6 @@ color: purple
|
|
|
6
6
|
model: opus
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
persona
|
|
10
9
|
|
|
11
10
|
You are an elite Behavioral Session Analyst specializing in multi-agent conversation dynamics and intent alignment analysis. You forensically examine the message history between users, orchestrators, and agents to understand behavioral patterns, communication breakdowns, and deviations from intended outcomes.
|
|
12
11
|
|
|
@@ -25,7 +24,7 @@ Your core competencies:
|
|
|
25
24
|
|
|
26
25
|
You approach each session as a behavioral investigator, seeking to understand not just WHAT happened, but WHY agents behaved as they did. Your analysis reveals the human and artificial cognitive patterns that shape multi-agent collaboration outcomes.
|
|
27
26
|
|
|
28
|
-
|
|
27
|
+
Adhere to Response Format when you respond with with your behavioral forensics report.
|
|
29
28
|
|
|
30
29
|
You must manage and maintain Todos dynamically, refine Todos after every decision, and when new information presents itself.
|
|
31
30
|
Populate your initial Todos with your step by step WORKFLOW:
|
|
@@ -89,30 +88,13 @@ INGEST -> ANALYSE -> REPORT
|
|
|
89
88
|
- Show how proper communication would have prevented deviation
|
|
90
89
|
- Identify where clarifying questions should have been asked
|
|
91
90
|
|
|
92
|
-
# REPORT:
|
|
93
|
-
**Generate Behavioral Analysis Report** (NO files created - response only):
|
|
94
|
-
- Executive summary of deviations from user intent
|
|
95
|
-
- Specific actors and messages that caused deviations
|
|
96
|
-
- Root cause behavioral analysis for each deviation
|
|
97
|
-
- Message correction suggestions
|
|
98
|
-
- Verification of actual vs claimed changes
|
|
99
|
-
|
|
100
|
-
COMPLETION GATE: Behavioral Analysis Checklist:
|
|
101
|
-
□ Session ID retrieved and all pages of data fetched
|
|
102
|
-
□ Every message in conversation flow analyzed chronologically
|
|
103
|
-
□ Specific deviations identified with actor names and exact quotes
|
|
104
|
-
□ Root cause traced for each deviation (WHY it happened)
|
|
105
|
-
□ Git status and file verification performed for truth check
|
|
106
|
-
□ Behavioral patterns and biases identified
|
|
107
|
-
□ Message corrections suggested (what SHOULD have been said)
|
|
108
|
-
□ NO documentation files created (report in response only)
|
|
109
|
-
□ Gaps in understanding acknowledged with confidence levels
|
|
110
91
|
|
|
111
92
|
[/WORKFLOW]
|
|
112
93
|
|
|
113
|
-
# Response Format
|
|
114
94
|
|
|
115
|
-
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
# Response Format
|
|
116
98
|
|
|
117
99
|
## Executive Summary
|
|
118
100
|
Brief overview of deviations from user intent, key actors involved, and critical behavioral patterns identified.
|
|
@@ -237,6 +219,7 @@ Brief overview of deviations from user intent, key actors involved, and critical
|
|
|
237
219
|
### Low Confidence / Speculation [<60%]
|
|
238
220
|
- [Possible pattern but needs more data]
|
|
239
221
|
|
|
222
|
+
|
|
240
223
|
### Data Gaps
|
|
241
224
|
- Would benefit from: [Additional information needed]
|
|
242
225
|
- Could not determine: [What remains unclear]
|
|
@@ -4,6 +4,9 @@ import json
|
|
|
4
4
|
import sys
|
|
5
5
|
import requests
|
|
6
6
|
import argparse
|
|
7
|
+
import os
|
|
8
|
+
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
|
9
|
+
from utils.server_config import get_server_url
|
|
7
10
|
|
|
8
11
|
def get_unread_messages(subagent_name):
|
|
9
12
|
"""
|
|
@@ -17,7 +20,7 @@ def get_unread_messages(subagent_name):
|
|
|
17
20
|
"""
|
|
18
21
|
try:
|
|
19
22
|
response = requests.post(
|
|
20
|
-
'
|
|
23
|
+
f'{get_server_url()}/subagents/unread',
|
|
21
24
|
json={
|
|
22
25
|
'subagent_name': subagent_name
|
|
23
26
|
},
|
|
@@ -32,7 +35,7 @@ def get_unread_messages(subagent_name):
|
|
|
32
35
|
return []
|
|
33
36
|
|
|
34
37
|
except requests.exceptions.ConnectionError:
|
|
35
|
-
print("Error: Could not connect to observability server at
|
|
38
|
+
print(f"Error: Could not connect to observability server at {get_server_url()}", file=sys.stderr)
|
|
36
39
|
return []
|
|
37
40
|
except requests.exceptions.Timeout:
|
|
38
41
|
print("Error: Request timed out", file=sys.stderr)
|
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
import json
|
|
10
10
|
import sys
|
|
11
11
|
import requests
|
|
12
|
+
import os
|
|
13
|
+
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
|
14
|
+
from utils.server_config import get_server_url
|
|
12
15
|
|
|
13
16
|
|
|
14
17
|
def main():
|
|
@@ -34,7 +37,7 @@ def main():
|
|
|
34
37
|
# Register the subagent with the server
|
|
35
38
|
try:
|
|
36
39
|
response = requests.post(
|
|
37
|
-
'
|
|
40
|
+
f'{get_server_url()}/subagents/register',
|
|
38
41
|
json={
|
|
39
42
|
'session_id': session_id,
|
|
40
43
|
'name': nickname,
|
|
@@ -48,7 +51,7 @@ def main():
|
|
|
48
51
|
# Now update with initial prompt using PATCH endpoint
|
|
49
52
|
if initial_prompt:
|
|
50
53
|
prompt_response = requests.patch(
|
|
51
|
-
f'
|
|
54
|
+
f'{get_server_url()}/subagents/{session_id}/{nickname}',
|
|
52
55
|
json={'initial_prompt': initial_prompt},
|
|
53
56
|
timeout=2
|
|
54
57
|
)
|
|
@@ -4,6 +4,9 @@ import json
|
|
|
4
4
|
import sys
|
|
5
5
|
import requests
|
|
6
6
|
import argparse
|
|
7
|
+
import os
|
|
8
|
+
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
|
9
|
+
from utils.server_config import get_server_url
|
|
7
10
|
|
|
8
11
|
def send_message(sender_name, message):
|
|
9
12
|
"""
|
|
@@ -26,7 +29,7 @@ def send_message(sender_name, message):
|
|
|
26
29
|
pass
|
|
27
30
|
|
|
28
31
|
response = requests.post(
|
|
29
|
-
'
|
|
32
|
+
f'{get_server_url()}/subagents/message',
|
|
30
33
|
json={
|
|
31
34
|
'sender': sender_name,
|
|
32
35
|
'message': message
|
|
@@ -41,7 +44,7 @@ def send_message(sender_name, message):
|
|
|
41
44
|
return False
|
|
42
45
|
|
|
43
46
|
except requests.exceptions.ConnectionError:
|
|
44
|
-
print("Error: Could not connect to observability server at
|
|
47
|
+
print(f"Error: Could not connect to observability server at {get_server_url()}", file=sys.stderr)
|
|
45
48
|
return False
|
|
46
49
|
except requests.exceptions.Timeout:
|
|
47
50
|
print("Error: Request timed out", file=sys.stderr)
|
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
import json
|
|
10
10
|
import sys
|
|
11
11
|
import requests
|
|
12
|
+
import os
|
|
13
|
+
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
|
14
|
+
from utils.server_config import get_server_url
|
|
12
15
|
|
|
13
16
|
|
|
14
17
|
def main():
|
|
@@ -86,7 +89,7 @@ def main():
|
|
|
86
89
|
# Update subagent completion status
|
|
87
90
|
try:
|
|
88
91
|
response = requests.post(
|
|
89
|
-
'
|
|
92
|
+
f'{get_server_url()}/subagents/update-completion',
|
|
90
93
|
json={
|
|
91
94
|
'session_id': session_id,
|
|
92
95
|
'name': agent_name,
|
|
@@ -16,8 +16,15 @@ import urllib.request
|
|
|
16
16
|
import urllib.error
|
|
17
17
|
from datetime import datetime
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
# Add parent directory to path for imports
|
|
20
|
+
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
|
21
|
+
from utils.server_config import get_server_url
|
|
22
|
+
|
|
23
|
+
def send_event_to_server(event_data, server_url=None):
|
|
20
24
|
"""Send event data to the observability server."""
|
|
25
|
+
if server_url is None:
|
|
26
|
+
server_url = f'{get_server_url()}/events'
|
|
27
|
+
|
|
21
28
|
try:
|
|
22
29
|
# Prepare the request
|
|
23
30
|
req = urllib.request.Request(
|
|
@@ -49,7 +56,6 @@ def main():
|
|
|
49
56
|
parser = argparse.ArgumentParser(description='Send Claude Code hook events to observability server')
|
|
50
57
|
parser.add_argument('--source-app', required=True, help='Source application name')
|
|
51
58
|
parser.add_argument('--event-type', required=True, help='Hook event type (PreToolUse, PostToolUse, etc.)')
|
|
52
|
-
parser.add_argument('--server-url', default='http://localhost:4000/events', help='Server URL')
|
|
53
59
|
parser.add_argument('--add-chat', action='store_true', help='Include chat transcript if available')
|
|
54
60
|
parser.add_argument('--summarize', action='store_true', help='Generate AI summary of the event')
|
|
55
61
|
|
|
@@ -94,7 +100,8 @@ def main():
|
|
|
94
100
|
|
|
95
101
|
|
|
96
102
|
# Send to server
|
|
97
|
-
|
|
103
|
+
server_url = f'{get_server_url()}/events'
|
|
104
|
+
success = send_event_to_server(event_data, server_url)
|
|
98
105
|
|
|
99
106
|
# Always exit with 0 to not block Claude Code operations
|
|
100
107
|
sys.exit(0)
|
|
@@ -14,6 +14,9 @@ import sys
|
|
|
14
14
|
import argparse
|
|
15
15
|
import requests
|
|
16
16
|
import time
|
|
17
|
+
import os
|
|
18
|
+
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
|
19
|
+
from utils.server_config import get_server_url
|
|
17
20
|
|
|
18
21
|
# Maximum tokens per page (easily configurable)
|
|
19
22
|
MAX_TOKENS_PER_PAGE = 6000
|
|
@@ -170,12 +173,6 @@ def main():
|
|
|
170
173
|
help='Return only the total number of pages instead of page data'
|
|
171
174
|
)
|
|
172
175
|
|
|
173
|
-
parser.add_argument(
|
|
174
|
-
'--api-base',
|
|
175
|
-
default='http://localhost:4000',
|
|
176
|
-
help='Base API URL (default: http://localhost:4000)'
|
|
177
|
-
)
|
|
178
|
-
|
|
179
176
|
args = parser.parse_args()
|
|
180
177
|
|
|
181
178
|
# Wait 100ms per page before hitting the DB (as requested)
|
|
@@ -184,7 +181,8 @@ def main():
|
|
|
184
181
|
|
|
185
182
|
try:
|
|
186
183
|
# Fetch the data from API
|
|
187
|
-
|
|
184
|
+
api_base = get_server_url()
|
|
185
|
+
url = f"{api_base}/api/sessions/{args.session_id}/introspect"
|
|
188
186
|
response = requests.get(url, timeout=10)
|
|
189
187
|
|
|
190
188
|
if response.status_code == 200:
|
|
@@ -234,8 +232,9 @@ def main():
|
|
|
234
232
|
sys.exit(1)
|
|
235
233
|
|
|
236
234
|
except requests.exceptions.ConnectionError:
|
|
235
|
+
api_base = get_server_url()
|
|
237
236
|
error_data = {
|
|
238
|
-
'error': f'Could not connect to API server at {
|
|
237
|
+
'error': f'Could not connect to API server at {api_base}',
|
|
239
238
|
'status_code': 0
|
|
240
239
|
}
|
|
241
240
|
print(json.dumps(error_data, indent=2), file=sys.stderr)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Utility module to get the communication server URL from environment variable.
|
|
4
|
+
Falls back to default if not set.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import os
|
|
8
|
+
|
|
9
|
+
def get_server_url():
|
|
10
|
+
"""
|
|
11
|
+
Get the communication server URL from CLAUDE_COMMS_SERVER environment variable.
|
|
12
|
+
Falls back to http://localhost:4000 if not set.
|
|
13
|
+
|
|
14
|
+
Returns:
|
|
15
|
+
str: The server URL
|
|
16
|
+
"""
|
|
17
|
+
return os.environ.get('CLAUDE_COMMS_SERVER', 'http://localhost:4000')
|