podman-runner
Skill2 starsChanged 7 months agoApache-2.0View on GitHub
Use when the user wants to run an experiment script, command, or pipeline step inside a reproducible container — phrases like "run this in a container", "containerize this run", "execute train.py under podman", "reproduce this run". Handles the Containerfile, build, GPU passthrough, log capture, and `runs/<id>/` provenance. Do not invoke for local-only dev loops or for production deployments.
- Deletes or force-pushes
- Installs packages
In this repository5 other files it gives its agents.
- dataset-insightsSkill
- experiment-reportSkill
- experiment-structureSkill
- marimo-figuresSkill
- plan-pi-fleshoutSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
17 rules. About 0 are common, 6 are distinctive, and 11 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
11
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 36
If the user hasn't set this up, fall back to CPU and flag it.
- Distinctive: line 54
If the working tree is dirty, append a warning.
- Very specific: line 76
If the project has an empty Containerfile, populate it with this and ask the user to confirm before the first build:
- Very specific: line 102
Do not bake data/ or secrets into the image.
- Distinctive: line 168
Before claiming a run used the GPU, verify:
- Distinctive: line 176
If any step fails, drop GPU flags and surface a warning in the run README.
- Distinctive: line 181
When the user says "reproduce run X":
- Very specific: line 183
Read runs/X/git.txt — check out that commit (or warn if dirty).
- Very specific: line 184
Read runs/X/config.yaml — pass it verbatim to the script.
- Very specific: line 185
Read runs/X/cmd.txt — use the same command.
- Very specific: line 194
Run id and absolute path to runs/<id>/.
- Very specific: line 201
Don't run sudo podman. Rootless podman is the default.
- Very specific: line 203
Don't mount ~ or / into the container.
- Distinctive: line 205
Don't delete a run directory on failure.
- Very specific: line 206
Don't skip provenance "because it's just a test run".
- Very specific: line 209
Don't invent metrics the script didn't produce.
- Very specific: line 211
Don't use --privileged, --cap-add=ALL, or disable SELinux labels (:z / :Z are fine.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
podman-runner
Single entry point for executing experiment commands inside a
podman container. The skill guarantees the
command runs in a reproducible environment, captures logs, and writes
a provenance-complete runs/<id>/ directory matching the layout in
experiment-structure.
When to use
- The user asks to run a script or command and reproducibility matters: "train the model", "run the sweep", "reproduce run 2026-03-10-lr-sweep".
- A new experiment has just been scaffolded (
experiment-structure) and theContainerfileis empty. - CI or a teammate will need to run the same command on another machine.
Skip this skill for:
- quick interactive debugging loops (just run the script directly),
- deploying a service (use a proper orchestration tool),
- commands that don't produce artifacts worth preserving (e.g.
ruff check).
Prerequisites (assumed, not installed by this skill)
podmanon PATH (podman --versionworks). If not, stop and ask the user to install it; don't shell out toapt/dnf.- For GPU work:
nvidia-container-toolkitconfigured for podman, andpodman run --device nvidia.com/gpu=allsucceeds on a probe image. If the user hasn't set this up, fall back to CPU and flag it. - A project laid out by
experiment-structure(or at least aContainerfileand ascripts/entry point).
The contract
Given a command like python scripts/train.py --config
configs/base.yaml, this skill:
- Builds (or rebuilds, if Containerfile changed) an image tagged
<project>:<short-git-hash>. - Generates a run id (
YYYY-MM-DD-HHMM-<slug>) and createsruns/<id>/. - Writes provenance files into the run directory before
launching the container:
config.yaml— the fully-resolved config (substitute all${var}references and merged overrides).git.txt—git rev-parse HEAD+git status --porcelain. If the working tree is dirty, append a warning; do not block.env.txt— image digest +pip freezecaptured from inside the image.cmd.txt— the exact command as invoked, plus the podman flags used.
- Runs the container with:
--rm(no leftover containers),-v $(pwd):/workspace:z(bind-mount the repo;:zfor SELinux),-w /workspace,--device nvidia.com/gpu=allwhen GPUs are requested and available,-e PYTHONUNBUFFERED=1so logs stream,- stdout →
runs/<id>/logs/stdout.log(viateefor live view), - stderr →
runs/<id>/logs/stderr.log, - exit code captured into
runs/<id>/exit_code.
- On success: writes a small
runs/<id>/README.mdstub ("Started at …, finished at …, command: …, exit code: 0"). - On failure: does not delete the run directory — the partial artifacts and logs are the debugging trail.
Containerfile starter
If the project has an empty Containerfile, populate it with this
and ask the user to confirm before the first build:
FROM python:3.11-slim
# System deps: add only what the experiment actually needs
RUN apt-get update && apt-get install -y --no-install-recommends \
git build-essential \
&& rm -rf /var/lib/apt/lists/*
# Python deps: install pinned requirements separately from source
# so the cache survives edits to src/.
WORKDIR /workspace
COPY pyproject.toml ./
RUN pip install --no-cache-dir -e .
# Source is bind-mounted at runtime; no COPY . .For GPU workloads swap the base image for one of:
nvidia/cuda:12.4.1-cudnn-runtime-ubuntu22.04(runtime only),pytorch/pytorch:2.3.0-cuda12.1-cudnn8-runtime(if PyTorch is the primary framework), andpip install torchagainst the matching CUDA build.
Do not bake data/ or secrets into the image. Data is
bind-mounted; secrets come from --env-file at run time.
Running a command
Minimum invocation:
podman run --rm \
-v "$(pwd):/workspace:z" \
-w /workspace \
<project>:<tag> \
python scripts/train.py --config configs/base.yamlThis skill wraps that with provenance capture. Pseudocode for the runner flow (implement inline — don't require a helper script):
run_id = f"{datetime.now():%Y-%m-%d-%H%M}-{slug}"
run_dir = Path(f"runs/{run_id}")
run_dir.mkdir(parents=True)
# 1. Resolve config
resolved = merge_config(base="configs/base.yaml", override=args.config)
(run_dir / "config.yaml").write_text(yaml.safe_dump(resolved))
# 2. Provenance
subprocess.run(["git", "rev-parse", "HEAD"], stdout=(run_dir/"git.txt").open("w"))
subprocess.run(["git", "status", "--porcelain"], stdout=(run_dir/"git.txt").open("a"))
(run_dir / "cmd.txt").write_text(" ".join(shlex.quote(a) for a in full_cmd))
# 3. Build image (cached if Containerfile unchanged)
tag = f"{project}:{git_short_hash}"
subprocess.run(["podman", "build", "-t", tag, "."], check=True)
# 4. Capture env from inside the image
subprocess.run(
["podman", "run", "--rm", tag, "pip", "freeze"],
stdout=(run_dir/"env.txt").open("w"), check=True,
)
# 5. Run
gpu_flags = ["--device", "nvidia.com/gpu=all"] if gpu_available() else []
cmd = [
"podman", "run", "--rm",
"-v", f"{os.getcwd()}:/workspace:z",
"-w", "/workspace",
"-e", "PYTHONUNBUFFERED=1",
*gpu_flags,
tag,
*user_cmd,
]
proc = subprocess.run(
cmd,
stdout=(run_dir/"logs/stdout.log").open("w"),
stderr=(run_dir/"logs/stderr.log").open("w"),
)
(run_dir / "exit_code").write_text(str(proc.returncode))For live log viewing, wrap each stream with tee or Python's
subprocess.Popen + threaded line-reader; don't swallow output.
GPU passthrough — quick checklist
Before claiming a run used the GPU, verify:
- Host:
nvidia-smiworks. - Podman:
podman run --rm --device nvidia.com/gpu=all \ nvidia/cuda:12.4.1-base-ubuntu22.04 nvidia-smishows the GPU. - Inside the experiment image: add a boot-time sanity check that
logs
torch.cuda.is_available()(or equivalent) toruns/<id>/logs/stdout.log.
If any step fails, drop GPU flags and surface a warning in the run README. Never silently fall back; the user needs to know.
Reproducing a prior run
When the user says "reproduce run X":
- Read
runs/X/git.txt— check out that commit (or warn if dirty). - Read
runs/X/config.yaml— pass it verbatim to the script. - Read
runs/X/cmd.txt— use the same command. - Build the image at that commit (tag will differ; that's expected).
- Execute into a new
runs/<new-id>/— never overwrite. - Diff
runs/X/metrics.jsonagainstruns/<new-id>/metrics.jsonand report exact-match, within-tolerance, or divergent.
Output
Report to the user:
- Run id and absolute path to
runs/<id>/. - Exit code and wall-clock time.
- Headline numbers from
metrics.json(if present). - Any warning: dirty git tree, CPU fallback, non-zero exit.
What not to do
- Don't run
sudo podman. Rootless podman is the default; if rootless fails, surface the error rather than escalating. - Don't mount
~or/into the container. Mount the project directory only. - Don't delete a run directory on failure. The logs are the point.
- Don't skip provenance "because it's just a test run". Every run
writes
git.txt,env.txt,config.yaml,cmd.txt. No exceptions. - Don't invent metrics the script didn't produce. If the script
didn't write
metrics.json, the run has no metrics — say so. - Don't use
--privileged,--cap-add=ALL, or disable SELinux labels (:z/:Zare fine;--security-opt label=disableis not).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

