# script-exec-blocked

Adopt this skill: https://proskills.md/skills/other/ashutoshsinghpr7-wikiskill-skills-script-exec-blocked

Page: https://proskills.md/skills/other/ashutoshsinghpr7-wikiskill-skills-script-exec-blocked
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: skills/script-exec-blocked/SKILL.md
size: 1123
sha: 8d4d7d664c61e799adb7183add0f2ca30a79d3f5
upstream: https://github.com/ashutoshsinghpr7/wikiskill/blob/main/skills/script-exec-blocked/SKILL.md

```text
---
name: script-exec-blocked
description: "Sandbox approval policy blocks execute_code and python3 -c; use read_file/write_file + manual transforms instead of retrying both runners."
version: 1.0.0
license: MIT
platforms: [linux, macos, windows]
metadata:
  hermes:
    tags: [sandbox, execution, approval, file-tools]
    homepage: https://github.com/ashutoshsinghpr7/wikiskill
---

# Script Execution Blocked in Sandbox

## Problem

`execute_code` and `python3 -c` fail with "BLOCKED … single-query mode (-q)
runs without a user present to approve it". Plain terminal commands (grep,
ls, file, xxd) and file tools (read_file, write_file) still work.

## Fix

- Do NOT retry both runners back-to-back: a real task burned two turns on
  `python3 -c` then `execute_code` before falling back.
- Compute small transforms manually from the files you read; write the
  deliverable with write_file; verify by re-reading it.
- Keep parsing/sorting simple enough to verify by hand.

## Evidence

- Hit in 3/4 analyzed traces; all three recovered this way; the one failure
  was a spec-interpretation bug, not a tooling problem.
```

## File: README.md
upstream: https://github.com/ashutoshsinghpr7/wikiskill/blob/main/README.md

````text
# 🧠 WikiSkill

**Compile agent experience into a persistent wiki — and let skills evolve themselves.**

> 📚 **Docs site**: [ashutoshsinghpr7.github.io/wikiskill](https://ashutoshsinghpr7.github.io/wikiskill) · **arXiv**: [2608.27454](https://arxiv.org/abs/2608.27454)

A faithful, production-minded implementation of **[WikiSkill: Compiling Agent Experience into Persistent Knowledge for Skill Evolution](https://arxiv.org/abs/2608.27454)** (arXiv:2608.27454, Google Research). The loop is **agent-agnostic** — **Hermes Agent** is the reference backend (built natively), **Claude Code**, **Codex** and **GitHub Copilot CLI** ship in the box, and OpenCode is on the roadmap ([issue #13](https://github.com/ashutoshsinghpr7/wikiskill/issues/13)). Your agent becomes both the *student* and the *teacher*.

[![Python](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org)
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
[![PyPI](https://img.shields.io/pypi/v/wikiskill?color=orange)](https://pypi.org/project/wikiskill/)
[![CI](https://img.shields.io/github/actions/workflow/status/ashutoshsinghpr7/wikiskill/ci.yml?label=CI)](https://github.com/ashutoshsinghpr7/wikiskill/actions)
[![arXiv](https://img.shields.io/badge/arXiv-2608.27454-red.svg)](https://arxiv.org/abs/2608.27454)

---

## What this is

Agents fail. They also *learn* — but the lessons usually die with the session. WikiSkill fixes that by keeping a **persistent knowledge wiki** alongside the skill set, and running a closed evolution loop:

1. The agent runs **training tasks** with its current skills → raw execution traces
2. A **Wiki Maintainer** agent distills the traces into pattern pages (root causes, fixes)
3. A **Skill Proposer** agent reads the wiki + traces and proposes one skill change (create or patch)
4. **Gating**: the change is validated on held-out tasks — **strictly better** than the best score so far → kept; otherwise rolled back. **The wiki is never rolled back.**

Over iterations, knowledge compounds in the wiki while only *proven* improvements touch the skills.

```
                ┌──────────────────────────────────────────────────────┐
                │              EVOLUTION LOOP (Algorithm 1)            │
                │                                                      │
   tasks ─────► │  Inference Agent ──► raw/traces/ (immutable)         │
                │        │                                            │
                │        ▼                                            │
                │  Wiki Maintainer ──► wiki/patterns/, index, log     │
                │        │                                            │
                │        ▼                                            │
                │  Skill Proposer ──► proposal (create/patch skill)   │
                │        │                                            │
                │        ▼                                            │
                │  GATE: val score > R_best? ──yes──► keep, R_best=R  │
                │        │ no                                         │
                │        ▼                                            │
                │  rollback skills; wiki retained forever             │
                └──────────────────────────────────────────────────────┘
```

## Why Hermes?

This is not a toy simulator. Every component is a **real Hermes agent turn**:

| WikiSkill (paper) | This repo |
|---|---|
| Inference Agent | `hermes chat --oneshot` in an **isolated `HERMES_HOME` profile** |
| Raw Layer | Full session JSONL transcripts, exported via `hermes sessions export` |
| Wiki Layer | `wiki/` — git-tracked, maintained by a real agent, never rolled back |
| Skill Layer | Real `SKILL.md` packages (frontmatter + instructions), git-managed |
| Wiki Maintainer | Agent turn with the paper's **Appendix E.2 prompt** (extracted verbatim) |
| Skill Proposer | Agent turn with the paper's **Appendix E.3 ReAct prompt** |
| Gating | Strict `R_val > R_best`; `git reset --hard` on reject |

**Why the isolated profile matters:** gating is only meaningful if the agent sees *exactly* the candidate skill set. Each evolution workspace gets its own `HERMES_HOME` (bundled skills opted out, empty memory, skills symlinked per stage) — your real profile is never touched.

## Quickstart (60 seconds)

```bash
pip install wikiskill        # from PyPI (wheel + sdist, Python ≥3.10)
wikiskill init demo           # workspace + 22-task auto-graded bench (13 train / 9 val)
wikiskill status
wikiskill evolve --iters 3    # full Algorithm 1 loop with your default model
```

Or from source: `pip install -e .` (installs the same `wikiskill` CLI).

Workspaces are created **relative to your current directory** (`./workspaces/<domain>/`)
— and because `skills/` lives outside the package, the wheel carries a copy of
the framework skills that `init` stages into each workspace. If you installed
from PyPI before 0.1.5, upgrade and re-`init` any existing workspace: those
wheels shipped no `skills/`, so the maintainer and proposer turns ran with no
skill loaded (silently — the scores still looked well-formed). See
[issue #29](https://github.com/ashutoshsinghpr7/wikiskill/issues/29).

Looking a workspace up (rather than creating one) also prefers `./workspaces/`
and then falls back to the old `<repo>/workspaces/` location with a one-line
notice, so existing workspaces keep working from any directory in a checkout —
or pass `--ws <path>` to be explicit.

That's it. Each evolution workspace lives at `workspaces/<domain>/`:

```
workspaces/demo/
├── raw/traces/iter-01/{train,val}/<task>.jsonl   # immutable execution traces
├── wiki/                                          # persistent knowledge (never rolled back)
│   ├── index.md  ·  log.md  ·  skill-impact.md  ·  patterns/*.md
├── skills/active/                                 # git-managed evolving skill set (S₀ = ∅)
├── skills/framework/                              # maintainer + proposer agent skills
├── bench/tasks/<id>/                              # task sandboxes (inputs + grader)
└── runs/                                          # per-run stdout, proposals, state
```

## CLI

| Command | What it does |
|---|---|
| `wikiskill init <domain> [--backend claude]` | Create workspace + demo bench (pins the agent backend) |
| `wikiskill bench --reset` | Regenerate tasks (deterministic, seed=42) |
| `wikiskill status` | Workspace state: scores, skills, wiki, history |
| `wikiskill evolve --iters N [--model M] [--provider P] [--max-turns N] [--no-early-stop]` | The full loop (`--model`/`--provider` patch the isolated profile's default model, e.g. `google/gemini-2.5-flash-lite` + `openrouter`) |
| `wikiskill run-task <id>` | Single inference rollout (debug) |
| `wikiskill compare <wsA> <wsB> [--iters N]` | Paired statistical comparison: per-task win/loss/tie + two-sided exact-binomial p-value (answers "did the skill actually help?" — see [docs/COMPARING.md](docs/COMPARING.md)) |

## Bring your own tasks

Tasks are plain JSON (`tasks.json`); anything auto-gradable works:

```json
{
  "id": "spec-format1-1", "split": "train",
  "title": "Format products according to spec",
  "prompt": "Read spec.md and products.json...",
  "sandbox": {"spec.md": "...", "products.json": "..."},
  "grader": {"type": "exact", "file": "output.txt", "expected": "alpha|35|active\n..."}
}
```

Graders: `exact`, `contains`, `json_field`, `code_stdout` (runs the produced script). Missing deliverables score **0**, never crash.

## Live results so far

Honest numbers from real agent runs on the bundled bench:

| Setup | Baseline (S₀) | What happened |
|---|---|---|
| deepseek-v4-flash, 15 turns | **1.0** | Algorithm 1 **early-stop** — nothing to evolve |
| deepseek-v4-flash, 8 turns | **1.0** | same |
| deepseek-v4-flash, forced | 1.0 | proposer created `spec_literal_transform` → R_val=1.0, not > R_best → **rejected** |
| deepseek-v4-flash, forced | 1.0
````
