en un clic
unicode-daemon-monitor-prototype
Unicode Daemon Monitor Skill
Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Menu
Unicode Daemon Monitor Skill
Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Basé sur la classification professionnelle SOC
Parse natural-language coding requests into structured tasks for FoundUps worker handoff. Use when the user describes code work but intent is unstructured.
Tiny text-only skill to verify AI Edge Gallery loaded a FoundUps worker skill. Say LOAD_OK if the user says ping.
Validate parser, scope, packet, and result JSON objects against FoundUps mobile worker v1 shapes before handoff to 0102. Use when pasting pipeline outputs or a pipeline envelope.
Summarize raw test output, logs, or diffs into a compact worker-friendly report for FoundUps handoff. Use after execution upstream returns artifacts.
Narrow ambiguous coding work to the smallest safe scope for FoundUps worker handoff. Use after foundups-code-task-parser or when scope is broad.
Convert a scoped coding task into a strict machine-readable task packet for upstream FoundUps execution. Use after scope is locked.
| name | unicode_daemon_monitor_prototype |
| description | Unicode Daemon Monitor Skill |
| version | 1 |
| author | 0102_wre_team |
| agents | ["qwen","gemma"] |
| dependencies | ["pattern_memory","libido_monitor"] |
| domain | autonomous_operations |
| category | workflow |
| evals | [] |
Enable QWEN to autonomously monitor YouTube daemon output, detect Unicode rendering issues, apply fixes using WRE recursive improvement, announce fixes via UnDaoDu livechat, and trigger daemon restart.
UnicodeEncodeError, [U+XXXX] unrendered codesRole: Fast pattern detection via Gemma-style binary classification
# Pattern matching (no computation)
def detect_unicode_issue(daemon_output: str) -> bool:
"""QWEN detects Unicode rendering failures"""
patterns = [
"UnicodeEncodeError",
r"\[U\+[0-9A-Fa-f]{4,5}\]", # Unrendered escape codes
"cp932 codec can't encode",
"illegal multibyte sequence"
]
return any(pattern in daemon_output for pattern in patterns)
Role: Strategic planning via Qwen-style reasoning
Workflow:
Identify Root Cause:
_convert_unicode_tags_to_emoji() callemoji_enabled=True flagGenerate Fix Plan:
refactoring_patterns.jsonRisk Assessment:
Role: Code modification under 0102 oversight
Implementation:
# Use WRE Recursive Improvement
from modules.infrastructure.wre_core.recursive_improvement.src.core import RecursiveImprovementEngine
async def apply_unicode_fix(module_path: str, issue_type: str):
"""Apply fix via WRE pattern memory"""
engine = RecursiveImprovementEngine()
# Recall fix pattern (not compute)
fix_pattern = engine.recall_pattern(
domain="unicode_rendering",
issue=issue_type
)
# Apply fix
result = await engine.apply_fix(
file_path=module_path,
pattern=fix_pattern,
validate=True # Run tests if available
)
return result
Role: Transparent communication with stream viewers
Announcement Template:
[AI] 012 fix applied: Unicode emoji rendering restored ✊✋🖐️
[REFRESH] Restarting livechat daemon in 5 seconds...
[CELEBRATE] Self-healing recursive system active!
Implementation:
async def announce_fix_to_undaodu(fix_details: dict):
"""Send announcement to UnDaoDu livechat BEFORE restart"""
from modules.communication.livechat.src.chat_sender import ChatSender
chat_sender = ChatSender(channel="UnDaoDu")
message = (
f"[AI] 012 fix applied: {fix_details['issue_type']} resolved\n"
f"[REFRESH] Restarting livechat daemon in 5s...\n"
f"[CELEBRATE] Self-healing recursive system active!"
)
await chat_sender.send_message(message)
await asyncio.sleep(5) # Give viewers time to read
Role: Prevent PID explosion with health validation
CRITICAL: Health check BEFORE restart prevents infinite daemon spawning
Implementation:
import os
import sys
import subprocess
import psutil
async def check_daemon_health() -> dict:
"""Health check to prevent PID explosion"""
# Count running YouTube daemon instances
daemon_processes = []
for proc in psutil.process_iter(['pid', 'name', 'cmdline']):
try:
if proc.info['name'] == 'python.exe':
cmdline = ' '.join(proc.info['cmdline']) if proc.info['cmdline'] else ''
if 'main.py' in cmdline and '--youtube' in cmdline:
daemon_processes.append({
'pid': proc.info['pid'],
'cmdline': cmdline,
'uptime': time.time() - proc.create_time()
})
except (psutil.NoSuchProcess, psutil.AccessDenied):
continue
health_status = {
'instance_count': len(daemon_processes),
'processes': daemon_processes,
'is_healthy': len(daemon_processes) == 1, # Should be exactly 1
'requires_cleanup': len(daemon_processes) > 1
}
return health_status
async def restart_daemon_with_health_check():
"""Restart daemon ONLY if health check passes"""
# Step 1: Pre-restart health check
health = await check_daemon_health()
if health['instance_count'] > 1:
# CRITICAL: Multiple instances detected - kill ALL before restart
print(f"[WARN] Detected {health['instance_count']} daemon instances - cleaning up")
for proc_info in health['processes']:
os.system(f"taskkill /F /PID {proc_info['pid']}")
# Wait for cleanup
await asyncio.sleep(3)
# Verify cleanup
post_cleanup = await check_daemon_health()
if post_cleanup['instance_count'] > 0:
raise RuntimeError(f"Failed to clean {post_cleanup['instance_count']} stale processes")
elif health['instance_count'] == 1:
# Single instance - normal shutdown
os.system(f"taskkill /F /PID {health['processes'][0]['pid']}")
await asyncio.sleep(2)
# Step 2: Verify no instances running
final_check = await check_daemon_health()
if final_check['instance_count'] != 0:
raise RuntimeError(f"Pre-restart check failed: {final_check['instance_count']} instances still running")
# Step 3: Restart ONLY ONCE
print("[OK] Health check passed - starting single daemon instance")
subprocess.Popen(
[sys.executable, "main.py", "--youtube", "--no-lock"],
cwd=os.getcwd(),
creationflags=subprocess.CREATE_NEW_CONSOLE
)
# Step 4: Post-restart validation (wait 5s for startup)
await asyncio.sleep(5)
post_restart = await check_daemon_health()
if post_restart['instance_count'] != 1:
raise RuntimeError(f"Post-restart validation failed: {post_restart['instance_count']} instances (expected 1)")
print(f"[CELEBRATE] Daemon restarted successfully - PID {post_restart['processes'][0]['pid']}")
return post_restart['processes'][0]
Health Check Safeguards:
Step 0: [CRITICAL] Pre-Flight Health Check
- Count running YouTube daemon instances
- Expected: Exactly 1 instance
- Action if >1: Kill ALL, prevent PID explosion
- Action if 0: Start single instance
- FAIL FAST: Abort if health check fails
Step 1: Monitor Daemon Output
- QWEN watches bash shell output (single healthy instance)
- Gemma detects Unicode error pattern (50ms)
- Health check: Verify daemon still running
Step 2: Analyze Issue
- QWEN strategic analysis (200-500 tokens)
- HoloIndex search for affected module
- Recall fix pattern from WRE memory
- Health check: No new instances spawned
Step 3: Apply Fix
- WRE Recursive Improvement applies pattern
- Run validation tests (if available)
- Update ModLog with fix details
- Health check: Daemon still single instance
Step 4: Announce to UnDaoDu
- Send livechat message with fix summary
- Include emoji to confirm rendering works (proves fix!)
- Wait 5 seconds for viewer notification
- Health check: Still 1 instance before restart
Step 5: [CRITICAL] Health-Validated Restart
- Pre-restart: Check instance count (must be 1)
- Cleanup: Kill current instance (verify PID killed)
- Validation: Confirm 0 instances before restart
- Restart: Launch SINGLE new instance
- Post-restart: Verify exactly 1 instance running
- FAIL: Raise exception if count != 1
Step 6: Learn & Store Pattern
- Store successful fix in refactoring_patterns.json
- Update adaptive learning metrics
- Record health check results (instance count history)
- Next occurrence: Auto-fixed in <1s with health validation
Health Check Frequency:
Token Efficiency:
Time Efficiency:
Reliability:
User Command:
# Enable skill
"Monitor the YouTube daemon for Unicode issues and auto-fix"
0102 Response:
[OK] Unicode Daemon Monitor activated
[TARGET] Watching bash shell 7f81b9 (YouTube daemon)
[AI] QWEN + Gemma coordination enabled
[REFRESH] Self-healing recursive system active
Monitoring for patterns:
- UnicodeEncodeError
- [U+XXXX] unrendered codes
- cp932 encoding failures
Will auto-fix and announce via UnDaoDu livechat
WRE Integration:
recursive_improvement/src/core.py for fix applicationadaptive_learning/refactoring_patterns.jsonwre_master_orchestrator.pyQWEN/Gemma Integration:
DAE Integration:
This skill enables true autonomous self-healing via QWEN/Gemma/WRE coordination with transparent UnDaoDu communication.