> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hiroshios.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Self-Healing Polyglot Skills

> Documenting the dynamic laboratory loop for generating, validating, and soft-reloading custom skills.

Hiroshi allows agents to programmatically generate and install custom automation scripts dynamically using the **Dynamic Skill Creator (`create_skill`)** laboratory loop.

### 🔄 The Self-Healing Validation Loop

To ensure new scripts don't crash the background runtime, custom code generated by agents undergoes a multi-layered sandboxed compilation checklist before hot-reload promotion:

```text theme={null}
  [ Generate Code ]
          │
          ▼
 [ Syntax Compilation ] ── (python -m py_compile) ──> Fail ──> [ Self-Correct Loop ]
          │                                                              ▲
       Success                                                           │
          ▼                                                              │
 [ Dry-Run Execution ] ──── (Feed {} on stdin) ──────> Fail ─────────────┘
          │
       Success
          ▼
   [ Hot-Reload ]
```

1. **Syntax Verification**: The engine writes code to a temporary sandbox directory and compiles it (e.g. `python -m py_compile` for Python) to trap syntax and formatting bugs.
2. **Dry-run testing**: Spawns the script under a strict **3-second timeout limit** and feeds `{}` to stdin to catch import errors or runtime exceptions.
3. **Self-Correction**: If verification steps return failure logs, the exceptions are fed back into the agent's reasoning loop, prompting automatic self-healing edits.
4. **Soft-Reload Promotion**: Once verified, the thread-safe mutex scans the skills directory and loads the new skill dynamically without needing a daemon reboot.
