# microsoft/skillopt — AlpLab Radar Static Code Audit

- Ring: `trial`
- Category: `agents`
- Overall score: `4.0/5`
- Implementation check: `verified`
- Maturity: `early`
- Audited commit: `9a4b84873939` (read-only; nothing from the repository was executed)
- Reviewed at: 2026-12-01T20:26:55Z
- Repository: https://github.com/microsoft/skillopt
- Radar entry: https://radar.alplab.co/#repo/microsoft/skillopt
- License: `MIT`
- CI workflows: `.github/workflows`
- Tags: `prompt-optimization`, `agent-skills`, `self-evolving-agents`, `llm-training-loop`, `benchmark-harness`, `microsoft`

## Summary

A research framework (ReflACT trainer) that trains natural-language agent-skill markdown documents through a rollout→reflect→aggregate→select→update→gated-evaluate loop across six benchmark adapters and many model/CLI backends, plus SkillOpt-Sleep, a nightly offline self-evolution engine that harvests local coding-agent transcripts and stages validation-gated SKILL.md/CLAUDE.md edits for human adoption.

## Implementation Check

Every core README claim maps to working code — the training loop in skillopt/engine/trainer.py ReflACTTrainer.train() with the validation gate in skillopt/evaluation/gate.py evaluate_gate(), six benchmark packages under skillopt/envs/, multi-backend support in skillopt/model/ (azure_openai, claude, qwen, minimax, openai_compatible, copilot, codex_harness), the WebUI in skillopt_webui/app.py, and the SkillOpt-Sleep cycle in skillopt_sleep/cycle.py run_sleep_cycle() with staging in skillopt_sleep/staging.py — only the paper's headline accuracy lifts (best on 52 cells, +23.5 pts) are unverifiable statically.

## When to Use

Use it to run reproducible, validation-gated optimization of a skill/prompt document against a benchmark, or to let a local coding agent (Claude Code, Codex, Copilot, Cursor, Pi, OpenCode) consolidate nightly session history into human-reviewed skill/memory updates via the mock or CLI backends. Not for production-critical paths: it is v0.2.0 alpha with heavy external API/CLI dependencies, its exec harness deliberately grants rollout agents unattended shell access, and its benchmark claims need independent reproduction.

## Sub-scores

| Dimension | Score |
|---|---|
| quality | 4.5/5 |
| usability | 4.0/5 |
| reliability | 3.0/5 |
| security | 4.0/5 |
| integration | 4.5/5 |

## Code Evidence

skillopt/engine/trainer.py ReflACTTrainer.train() implements the full 6-stage loop with epochs, gradient accumulation, LR scheduling (build_scheduler), selection-set baseline, and _redact_cfg scrubbing api_key/token/password-suffixed config values before config.json is written; skillopt/evaluation/gate.py evaluate_gate()/select_gate_score() is a pure accept/reject decision over hard/soft/mixed metrics plus an optional semantic-density bonus; skillopt/envs/{searchqa,alfworld,docvqa,officeqa,livemathematicianbench,spreadsheetbench}/ each ship adapter+dataloader+evaluator+rollout matching the six claimed benchmarks; skillopt/model/backend_config.py configure_codex_exec()/validate_exec_sandbox() whitelists sandbox modes and resolves CLI paths, and no shell=True or verify=False exists anywhere (only a test docstring in tests/test_react_agent_no_shell.py recording its removal); skillopt_sleep/cycle.py run_sleep_cycle() wires harvest_for_config→mine→replay→dream_consolidate→write_staging with token-budget gating, split protection (state.protect_splits), and a model-change warning; skillopt_sleep/staging.py enforces the Dreams contract — _safe_live_path traversal rejection, _is_link_or_junction symlink refusal, sha256 live-baseline pins in _prepare_skill_proposals, atomic _write_atomic_bytes with a WAL transaction for adopt, and redact_secrets scrubbing OpenAI/AWS/GitHub/Slack/JWT/private-key patterns before anything is persisted; skillopt_sleep/backend.py MockBackend is deterministic and API-free for tests, ClaudeCliBackend._isolation_flag() fails closed (StagingError) unless ANTHROPIC_API_KEY or a probed --safe-mode CLI is available, and CliBackend.judge() rejects out-of-range model scores rather than clamping them; tests/ holds 140+ files including test_gate.py, 175KB test_sleep_engine.py, test_webui_security.py (fail-closed public-bind auth, path-traversal denial), and test_reproducibility.py; .github/workflows/ci.yml runs pytest on Python 3.10–3.12, a gradio 5.50/6.26 WebUI matrix, and strict mkdocs build with all actions pinned by commit SHA.

## Issues Found

skillopt_sleep/backend.py hardcodes internal Microsoft Azure OpenAI endpoints and a managed-identity client ID (_AZURE_ENDPOINTS, _AZURE_MI_CLIENT_ID, AzureOpenAIBackend._endpoint_for) as silent fallback defaults — leaked internal infrastructure and a surprising default for non-Microsoft users; skillopt/model/codex_harness.py grants rollout agents unattended shell access ('bypassPermissions' for Claude Code, default 'workspace-write' Codex sandbox) which is by design but unsafe if a workspace is misconfigured.

## Key Risks

Nothing was executed — 'tests exist' is not 'tests pass', and all paper/benchmark accuracy numbers are unverifiable statically. Real runs need external resources: Azure OpenAI credentials or authenticated claude/codex/copilot/cursor/pi/opencode CLIs, plus separately materialized benchmark datasets (SearchQA manifests, ALFWorld, etc.). The exec target harness in skillopt/model/codex_harness.py runs Claude Code with permission_mode 'bypassPermissions' and Codex with default sandbox 'workspace-write' inside prepared temp workspaces — deliberate for rollouts, but it grants the target agent unattended shell execution. Version is 0.2.0 (Development Status :: 3 - Alpha) with no lockfiles and a fast-moving history; the skillopt_sleep research evaluators (skillopt_sleep.experiments.real_eval) are intentionally not bundled and fall back to local scoring.

## Reviewed Files

- `README.md`
- `pyproject.toml`
- `requirements.txt`
- `.env.example`
- `.github/workflows/ci.yml`
- `docs/index.md`
- `mkdocs.yml`
- `skillopt/__init__.py`
- `skillopt/engine/trainer.py`
- `skillopt/evaluation/gate.py`
- `skillopt/model/backend_config.py`
- `skillopt/model/codex_harness.py`
- `skillopt_sleep/__init__.py`
- `skillopt_sleep/backend.py`
- `skillopt_sleep/cycle.py`
- `skillopt_sleep/staging.py`
- `skillopt_sleep/harvest_sources.py`
- `tests/test_webui_security.py`
