SysClaw Reporting (Client)
Report issues and submit requests to SysClaw. This is the client-side skill — it covers how to communicate with SysClaw, not how SysClaw processes requests.
Prerequisites
1. Install Python dependency
CODEBLOCK0
2. Set environment variables
Set these before running scripts. All scripts use a fallback chain: script-specific vars → SYSCLAW_DB_* → defaults.
CODEBLOCK1
You can also set per-script overrides (ISSUE_DB_*, REQUEST_DB_*) if different scripts need different credentials, but in most cases the shared SYSCLAW_DB_* vars are sufficient.
Ask your SysClaw operator for the correct host address and your agent credentials.
Report an Issue
For errors, warnings, and problems that need attention:
CODEBLOCK2
Severity: info | warning | critical
Categories: disk | service | error | resource | network | config | INLINECODE13
Examples:
CODEBLOCK3
source_host (6th argument, optional): Identifies which machine this report originates from. Defaults to the current hostname if omitted.
Request Something from SysClaw
For software installs, access requests, configuration changes, and more:
CODEBLOCK4
Types: access | software | resource | config | service | deployment | info
Actions: install | remove | create | modify | restart | grant | check | deploy
Urgency: low | normal | urgent (default: normal)
Payload: Valid JSON string (optional). Validated before submission.
Examples
CODEBLOCK5
What Happens Next
- 1. Your request is submitted and SysClaw is automatically notified
- SysClaw assesses and processes the request (typically within 15 minutes)
- SysClaw executes approved actions — you don't need to do anything after approval
- You receive a notification with the result (e.g., "DONE: nginx installed and running")
Verdicts:
- -
approved + DONE — SysClaw completed the work, see notification for details - INLINECODE35 — see notification for reason
- INLINECODE36 — human operator reviewing, you'll be notified when decided
Check Notifications
Check for responses from SysClaw:
CODEBLOCK6
Workflow:
- 1. Run
check-notifications.sh at session start or after submitting a request - Read the results — SysClaw has already done the work for approved requests
- Mark as read when done
Automatic Notification Checking
Set up a cron job so responses are ready when your session starts:
CODEBLOCK7
Then at session start: INLINECODE38
Direct SQL (Alternative to Scripts)
If you prefer direct database access:
CODEBLOCK8
Do not set verdict, security_assessment, resolved_at, or resolved_by — SysClaw manages these.
Post-Install
- 1. TOOLS.md — Add DB host, user, and connection details
- Set up notification cron job — See "Automatic Notification Checking" above
- Test:
CODEBLOCK9
Technical Notes
- - Scripts use Python
psycopg2 with parameterized queries (no SQL injection risk) - JSON payloads are validated with
json.loads() before database insertion - Connection retry: 3 attempts with exponential backoff (1s, 2s, 4s) on initial connection failure
- Mid-session reconnect: If the connection drops between queries, scripts reconnect and retry once automatically
- Connection timeout is 10 seconds per attempt (override with
PGCONNECT_TIMEOUT) - All scripts exit non-zero on failure with descriptive error messages
SysClaw 报告(客户端)
向 SysClaw 报告问题并提交请求。这是客户端技能——涵盖如何与 SysClaw 通信,而非 SysClaw 如何处理请求。
前提条件
1. 安装 Python 依赖
bash
pip3 install psycopg2-binary
2. 设置环境变量
在运行脚本前设置这些变量。所有脚本均使用回退链:脚本特定变量 → SYSCLAWDB* → 默认值。
bash
共享连接设置(所有脚本作为回退使用)
export SYSCLAW
DBHOST=<你的数据库主机> # 向你的 SysClaw 操作员询问
export SYSCLAW
DBPORT=5432
export SYSCLAW
DBNAME=system_comm
export SYSCLAW
DBUSER=<你的代理角色> # 例如 jobagent、pmagent、researcher_agent
export SYSCLAW
DBPASSWORD=<你的数据库密码>
如果不同脚本需要不同凭据,你也可以设置每个脚本的覆盖变量(ISSUEDB、REQUESTDB),但在大多数情况下,共享的 SYSCLAWDB* 变量已足够。
向你的 SysClaw 操作员询问正确的主机地址和你的代理凭据。
报告问题
用于需要关注的错误、警告和问题:
bash
scripts/report-issue.sh <来源> <严重级别> <标题> [类别] [详情] [来源主机]
严重级别: info | warning | critical
类别: disk | service | error | resource | network | config | other
示例:
bash
scripts/report-issue.sh jobhunter warning 磁盘使用率超过80% disk df 显示 /data 使用率82% srv-prod-01
scripts/report-issue.sh pmagent critical API 端点返回500 service 连续5次失败 srv-prod-02
source_host(第6个参数,可选):标识此报告来自哪台机器。如果省略,默认为当前主机名。
向 SysClaw 请求资源
用于软件安装、访问请求、配置更改等:
bash
scripts/request-resource.sh <来源> <类型> <操作> <目标> <理由> [紧急程度] [负载] [来源主机]
类型: access | software | resource | config | service | deployment | info
操作: install | remove | create | modify | restart | grant | check | deploy
紧急程度: low | normal | urgent(默认:normal)
负载: 有效的 JSON 字符串(可选)。提交前会进行验证。
示例
bash
scripts/request-resource.sh jobhunter software install nginx {version:latest} normal
scripts/request-resource.sh pmagent access grant /var/data/pm {level:read}
scripts/request-resource.sh researcher info check disk_usage
后续流程
- 1. 你的请求已提交,SysClaw 会自动收到通知
- SysClaw 评估并处理请求(通常在15分钟内)
- SysClaw 执行已批准的操作——批准后你无需做任何操作
- 你会收到包含结果的通知(例如:完成:nginx 已安装并运行)
裁决结果:
- - approved + DONE — SysClaw 已完成工作,详情请查看通知
- denied — 查看通知了解原因
- escalated — 人工操作员正在审查,决定后会通知你
查看通知
查看 SysClaw 的回复:
bash
scripts/check-notifications.sh <你的代理名称> # 查看未读
scripts/check-notifications.sh <你的代理名称> yes # 查看并标记为已读
工作流程:
- 1. 在会话开始时或提交请求后运行 check-notifications.sh
- 阅读结果——对于已批准的请求,SysClaw 已完成工作
- 完成后标记为已读
自动检查通知
设置定时任务,以便在会话开始时回复已准备就绪:
bash
创建包装脚本
cat > /usr/local/bin/check-sysclaw-notifications.sh << SCRIPT
#!/bin/bash
export SYSCLAW
DBHOST=<数据库主机>
export SYSCLAW
DBPORT=5432
export SYSCLAW
DBNAME=system_comm
export SYSCLAW
DBUSER=<你的角色>
export SYSCLAW
DBPASSWORD=<你的密码>
bash <技能路径>/scripts/check-notifications.sh <你的代理名称> > <工作空间>/memory/notifications.md 2>/dev/null
SCRIPT
chmod +x /usr/local/bin/check-sysclaw-notifications.sh
添加到 crontab
(crontab -l 2>/dev/null; echo
/15 * /usr/local/bin/check-sysclaw-notifications.sh) | crontab -
然后在会话开始时:cat memory/notifications.md
直接 SQL(脚本的替代方案)
如果你更喜欢直接数据库访问:
sql
-- 报告问题
INSERT INTO issues (source, severity, category, title, details, source_host)
VALUES (jobhunter, warning, disk, 磁盘使用率高, 分区使用率85%, srv-prod-01);
-- 提交请求
INSERT INTO agentrequests (requestingagent, requesttype, action, target, justification, urgency, payload, sourcehost)
VALUES (pmagent, software, install, nginx, 需要 Web 服务器, normal, {version:latest}::jsonb, srv-prod-02);
-- 通知 SysClaw(提交请求后)
INSERT INTO notifications (recipient, sender, related_request, message, urgency)
VALUES (sysclaw, pmagent, <请求ID>, 新软件请求:安装 nginx, normal);
-- 检查回复
SELECT * FROM notifications WHERE recipient = pmagent AND read = FALSE;
不要设置 verdict、securityassessment、resolvedat 或 resolved_by——这些由 SysClaw 管理。
安装后
- 1. TOOLS.md — 添加数据库主机、用户和连接详情
- 设置通知定时任务 — 参见上方自动检查通知
- 测试:
bash
scripts/report-issue.sh <你的来源> info SysClaw 报告技能已安装 - 测试
技术说明
- - 脚本使用 Python psycopg2 和参数化查询(无 SQL 注入风险)
- JSON 负载在插入数据库前使用 json.loads() 进行验证
- 连接重试: 初始连接失败时进行3次尝试,采用指数退避(1秒、2秒、4秒)
- 会话中重连: 如果查询之间连接断开,脚本会自动重连并重试一次
- 每次尝试的连接超时为10秒(可通过 PGCONNECT_TIMEOUT 覆盖)
- 所有脚本在失败时以非零退出并附带描述性错误信息