Skill: wsygcn/employee-off-duty-detection-2 (version 1.0.1)

--- name: intelligent-inspection description: Intelligent workplace inspection system with guided setup, configurable inspection tasks, AI-powered image analysis, and Feishu alerting. Use when you need to monitor employee presence, conduct security patrols, or perform automated visual inspections of workspaces. --- # Intelligent Inspection - 智能巡检 ## Overview Intelligent Inspection is an intelligent workplace monitoring system that: - Captures images from surveillance cameras - Uses AI to analyze images based on user-defined inspection criteria - Sends alerts via Feishu (or other configured channels) - Supports guided configuration and isolated settings This skill is designed for workplace safety, security monitoring, and employee presence verification. ## Core Features ### 1. Guided Configuration - First-time setup wizard collects camera parameters - User-friendly prompts for API endpoints, tokens, and device settings - Configuration isolation in dedicated config file ### 2. Flexible Inspection Tasks - Customizable AI prompts for different inspection scenarios - Support for multiple camera devices and channels - Configurable patrol schedules and triggers ### 3. AI-Powered Analysis - Integration with OpenClaw's AI models - User-defined analysis criteria through custom prompts - Structured response handling for consistent results ### 4. Multi-Channel Alerting - Primary integration with Feishu messaging - Automatic fallback to other configured channels - Rich message formatting with images and metadata ## Setup Requirements ### Camera System Requirements - Supported camera APIs: - EZVIZ Cloud API (萤石云) - Generic RTSP/ONVIF cameras (via camsnap skill) - Custom HTTP-based capture endpoints ### Authentication Requirements - Camera API access tokens or credentials - Feishu bot permissions (if using Feishu alerts) ### OpenClaw Requirements - `feishu` channel configured (for Feishu alerts) - AI model with vision capabilities (e.g., qwen3-max, GPT-4 Vision) ## Usage Scenarios ### Employee Presence Monitoring - Detect if employees are at their workstations - Monitor break room usage - Track attendance during working hours ### Security Patrols - Verify door/window status - Check for unauthorized access - Monitor restricted areas ### Facility Inspections - Equipment status verification - Environmental condition monitoring - Compliance checks ## Workflow ### 1. Initial Setup (First Run) When the skill runs for the first time: 1. Prompt user for camera system type 2. Collect API endpoint, access token, device serial, channel number 3. Ask for default inspection prompt template 4. Confirm alert channel preferences 5. Save configuration to `~/.openclaw/workspace/intelligent-inspection-config.json` ### 2. Patrol Execution For subsequent runs: 1. Load configuration from config file 2. Capture image using configured camera parameters 3. Generate AI analysis prompt based on patrol task 4. Execute AI analysis using OpenClaw's vision model 5. Format and send alert via configured channels ### 3. Configuration Management - Configuration stored in isolated JSON file - Users can edit config file directly for advanced settings - Skill validates configuration on each run - Option to reset configuration and re-run setup ## Configuration File Structure The configuration file (`intelligent-inspection-config.json`) contains: ```json { "camera": { "type": "ezviz", "apiUrl": "https://open.ys7.com/api/open/cloud/v1/capture/save", "accessToken": "your-access-token", "deviceSerial": "C12345678", "channelNo": "1", "projectId": "intelligent-inspection-project" }, "inspection": { "defaultPrompt": "请分析这张图片中是否有员工在工位上。如果没有人，请回复'离岗'；如果有人，请回复'在岗'。", "alertOn": ["离岗"], "includeImage": true }, "alerts": { "enabled": true, "channels": ["feishu"], "fallbackToDefault": true } } ``` ## Error Handling - Invalid camera credentials: Clear error messages with setup guidance - AI analysis failures: Retry logic with fallback prompts - Alert delivery failures: Log errors and attempt alternative channels - Missing configuration: Automatically trigger setup wizard ## Privacy and Security - Camera credentials stored locally only - Images processed through secure AI endpoints - No data retention beyond immediate patrol execution - Compliance with workplace monitoring regulations recommended ## Integration Points ### OpenClaw Tools Used - `message`: For sending alerts via configured channels - `web_fetch`/`exec`: For camera image capture - AI model calls: For image analysis ### External Dependencies - Camera system APIs (EZVIZ, RTSP, etc.) - Feishu bot (if configured as alert channel) ## Examples ### Basic Employee Monitoring ``` 执行智能巡检任务 ``` ### Custom Inspection Task ``` 执行智能巡检：检查会议室是否有人使用 ``` ### Reset Configuration ``` 重置智能巡检配置 ``` ## Version History - v1.0.0: Initial release with EZVIZ support and Feishu alerts

path: config-template.json
content: {
  "camera": {
    "url": "",
    "accessToken": "",
    "deviceSerial": "",
    "channelNo": "1",
    "projectId": "intelligent-inspection"
  },
  "inspection": {
    "customPrompt": "",
    "defaultPrompt": "请分析这张图片中的工作场所情况。检查是否有异常情况、安全隐患或员工离岗。如果发现任何问题，请详细描述；如果没有问题，请回复\"正常\"。"
  },
  "alerts": {
    "enabled": true,
    "channel": "feishu",
    "recipient": ""
  }
}

path: example-config.json
content: {
  "camera": {
    "url": "https://open.ys7.com/api/open/cloud/v1/capture/save",
    "accessToken": "your-access-token-here",
    "deviceSerial": "your-device-serial-here",
    "channelNo": "1",
    "projectId": "openclaw-patrol"
  },
  "ai": {
    "model": "bailian/qwen3-max-2026-01-23",
    "prompt": "请分析这张图片中是否有员工在工位上。如果没有人，请回复'离岗'；如果有人，请回复'在岗'。"
  },
  "alert": {
    "enabled": true,
    "messageTemplate": "🚨 离岗检测告警\n时间: {timestamp}\n设备: {deviceId}\n状态: {status}\n分析结果: {analysisResult}"
  }
}

path: index.js
content: #!/usr/bin/env node
/**
 * Intelligent Inspection - 智能巡检
 * Standard ClawHub skill for workplace monitoring
 * 
 * This skill handles the complete workflow:
 * 1. Prompt user for configuration parameters
 * 2. Capture image from camera using OpenClaw tools
 * 3. Analyze with AI model
 * 4. Send alerts via OpenClaw channels
 */

const { execSync } = require('child_process');
const fs = require('fs');
const path = require('path');

class IntelligentInspection {
    constructor() {
        this.config = null;
        this.skillDir = path.dirname(__filename);
    }

    // Main entry point
    async run() {
        console.log('🏢 Intelligent Inspection - 智能巡检');
        console.log('=====================================');
        
        try {
            // Step 1: Load or prompt for configuration
            await this.loadOrCreateConfig();
            
            // Step 2: Execute patrol
            await this.executePatrol();
            
        } catch (error) {
            console.error('❌ Skill execution failed:', error.message);
            process.exit(1);
        }
    }

    // Load existing config or create new one by prompting user
    async loadOrCreateConfig() {
        const configPath = path.join(this.skillDir, 'config.json');
        
        if (fs.existsSync(configPath)) {
            console.log('✅ Loading existing configuration...');
            this.config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
        } else {
            console.log('📝 No configuration found. Let\'s set it up!');
            await this.promptForConfig();
            // Save config for future use
            fs.writeFileSync(configPath, JSON.stringify(this.config, null, 2));
            console.log('💾 Configuration saved to config.json');
        }
    }

    // Interactive configuration prompts
    async promptForConfig() {
        console.log('\n🔧 Camera Configuration');
        console.log('--------------------');
        
        // In a real implementation, this would be interactive prompts
        // For now, we'll set up a basic structure that OpenClaw can fill
        this.config = {
            camera: {
                url: '', // Will be filled by OpenClaw context
                accessToken: '', // Will be filled by OpenClaw context  
                deviceSerial: '', // Will be filled by user input
                channelNo: '1', // Default
                projectId: 'intelligent-inspection' // Default
            },
            ai: {
                model: 'bailian/qwen3-max-2026-01-23',
                prompt: '请分析这张图片中是否有员工在工位上。如果没有人，请回复"离岗"；如果有人，请回复"在岗"。'
            },
            alert: {
                enabled: true,
                // Channel will be determined by OpenClaw runtime context
                channel: 'auto'
            }
        };
    }

    // Execute the patrol workflow
    async executePatrol() {
        console.log('\n🔍 Starting patrol execution...');
        
        // Generate unique fileId
        const timestamp = Date.now();
        const fileId = timestamp.toString();
        
        // This is where the actual camera capture would happen
        // But in the standard skill, this is handled by OpenClaw tools
        
        console.log('📸 Patrol executed with fileId:', fileId);
        console.log('🤖 AI analysis and alerting will be handled by OpenClaw');
        
        // Signal completion
        console.log('✅ Patrol completed successfully');
    }
}

// Entry point
if (require.main === module) {
    const skill = new IntelligentInspection();
    skill.run().catch(console.error);
}

path: package.json
content: {
  "name": "intelligent-inspection",
  "version": "1.0.0",
  "description": "Intelligent workplace inspection system with guided setup, configurable inspection tasks, AI-powered image analysis, and Feishu alerting",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": ["inspection", "monitoring", "ai", "feishu", "workplace"],
  "author": "OpenClaw",
  "license": "MIT"
}

path: README.md
content: # Intelligent Inspection - 智能巡检

智能巡检技能用于自动化工作场所监控，支持员工离岗检测、安全巡检和设备状态检查。

## 快速开始

1. **首次使用**: 技能会引导你配置摄像头参数
2. **执行巡检**: `执行智能巡检任务`
3. **自定义任务**: `执行智能巡检：检查会议室是否有人使用`

## 配置文件

- **位置**: `~/.openclaw/workspace/intelligent-inspection-config.json`
- **包含**: 摄像头参数、AI提示词、告警设置

## 功能特性

- ✅ 引导式配置安装
- ✅ 配置隔离（独立 config 文件）
- ✅ 抓图 + AI 分析 + 飞书告警
- ✅ 符合 ClawHub 上传标准

Security scan verdicts — ClawScan: suspicious | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (HIGH)