SuperAPI AI Directory

entropy-manager

Deployment & operations

View repository

Updated 10-17 13:49

About this skill

Entropy Manager Skill

Core Belief: Every line of code written by the AI team increases the system's chaos. Without actively reducing entropy, the system will naturally decay. Inspiration: Second Law of Thermodynamics × Software Engineering Hygiene × Daniel "Order Rules" Charter

Trigger Conditions

  • Manual trigger:熵扫描 / entropy scan / 减熵 / 清理
  • Periodic trigger: recommended once a week via cron (entropy-weekly-scan)
  • After major changes: after project launch or large-scale refactoring

6 Major Categories of Entropy

# Category Code Description Detection Method
1 Documentation Entropy DOC Outdated docs, broken links, empty TODOs, incorrect dates Date checks, TODO counts, broken link detection
2 Naming Entropy NAME Files not in kebab-case/snake_case, inconsistent naming Filename pattern matching
3 Code Entropy CODE Dead code, commented-out blocks, unused imports, leftover console.log AST/grep scanning
4 Configuration Entropy CONF Outdated configs, unused env vars, orphaned agent configs Config file cross-validation
5 File Entropy FILE Misplaced files, tmp leftovers, duplicate files, empty .gitkeep Directory structure validation
6 Dependency Entropy DEP Unused dependencies, outdated versions, security vulnerabilities package.json/requirements.txt scanning

Severity Levels

Level Definition Example Handling Timeframe
🔴 Critical Security/functional impact Hardcoded secrets, broken entry files Immediately
🟡 Warning Maintainability impact Dead code >50 lines, outdated TODOs >10 This week
🟢 Info Aesthetics/consistency Inconsistent naming, empty files Fix next time it's convenient

Execution Flow

Phase 1: Scan and Diagnose

bash ~/clawd/skills/entropy-manager/scripts/entropy-scan.sh [target_dir]

Output:~/clawd/tmp/entropy-report-YYYY-MM-DD.md

Phase 2: Report Generation

Scan results are summarized as:

  • Total entropy score (0-100, 100=perfect)
  • Score per category
  • Top 10 high-entropy files
  • Auto-fixable items vs items requiring manual confirmation

Phase 3: Auto-Fix (confirmation required)

Automatically fix 🟢 level issues (execute after CEO confirmation):

  • Rename files to standard format
  • Delete empty .gitkeep (when the directory has content)
  • Clean up files in tmp/ older than 7 days
  • Remove commented-out code blocks (>10 consecutive lines of commented-out code)

Phase 4: Record and Track

  • Append each scan result to ~/clawd/tmp/entropy-history.jsonl
  • Trend: Is the entropy value decreasing?
  • Compared to last time: how much entropy was added?

Report Format

# 熵扫描报告 — YYYY-MM-DD

## 📊 总评分: 72/100 (较上次 +5)

| 分类 | 得分 | 问题数 | Critical | Warning | Info |
|------|------|--------|----------|---------|------|
| DOC  | 65   | 12     | 0        | 4       | 8    |
| NAME | 80   | 5      | 0        | 1       | 4    |
| CODE | 70   | 8      | 1        | 3       | 4    |
| CONF | 85   | 3      | 0        | 1       | 2    |
| FILE | 60   | 10     | 0        | 5       | 5    |
| DEP  | 75   | 4      | 0        | 2       | 2    |

## 🔴 Critical (立即处理)
1. [CODE] ~/clawd/projects/xxx/config.py:5 — 硬编码 API key

## 🟡 Warning (本周处理)
1. [DOC] ~/clawd/MEMORY.md — 3 个 TODO 超过 30 天未更新
2. [FILE] ~/clawd/tmp/ — 15 个文件超过 7 天

## 🟢 Info (下次顺手修)
1. [NAME] ~/clawd/scripts/api_health_check.py → 建议 api-health-check.py

## 📈 趋势
- 上次扫描: 67/100 (YYYY-MM-DD)
- 变化: +5
- 熵增最快: FILE (+8 问题)
- 熵减最快: CODE (-3 问题)

Scan Scope

Default Scope

~/clawd/              # 工作主目录(排除 .git, node_modules, venv)
~/.openclaw/agents/   # Agent 配置
~/.openclaw/skills/   # 全局 Skills

Project-Level Scope

entropy-scan.sh ~/clawd/projects/blue-blood-elite/

Relationship with the Charter

Article 8 of the Order Rules — Entropy Management Order:

Systems naturally tend toward disorder. Every line of code an AI team writes increases entropy. Failing to actively reduce entropy is chronic suicide. At least once a week, perform a full-system entropy scan; Critical-level issues must not be left overnight.

Dependencies

  • bash 4+
  • Python 3.11+ (for complex analysis scripts)
  • git (for historical comparison)

File structure

entropy-manager/
├── SKILL.md              # 本文件
├── scripts/
│   ├── entropy-scan.sh   # 主扫描脚本
│   └── entropy-fix.sh    # 自动修复脚本(需确认)
└── README.md