ai4scientist/nano-scientist/experiment-queue
Claude Code and agent skill by ai4scientist/nano-scientist
- community
Checking that the SKILL.md file is still in the repository.
SSH job queue for multi-seed/multi-config ML experiments with OOM-aware retry, stale-screen cleanup, and wave-transition race prevention. Use when user says "batch experiments", "队列实验", "run grid", "multi-seed sweep", "auto-chain experiments", or when /run-experiment is insufficient for 10+ jobs that need orchestration.
Install
npx vskill@latest install ai4scientist/nano-scientist/experiment-queueSKILL.md
Experiment Queue
Orchestrate large batches of ML experiments on SSH remote GPU servers with proper state tracking, OOM retry, stale cleanup, and wave transitions.
When to Use This Skill
Use when /run-experiment is insufficient:
- ≥10 jobs that need batching across GPUs
- Multi-seed sweeps (e.g., 21 seeds × 12 cells)
- Wave transitions (run wave 1, wait, run wave 2, wait, run wave 3...)
- Teacher+student chains (train teacher then distill; auto-trigger student after teacher done)
- OOM-prone configs where you need to retry with different GPU or wait
- Mixed seed grids where failed cells need re-running
Do NOT use for:
- Single ad-hoc experiment (use
/run-experiment) - Modal/Vast.ai deployments (those have their own orchestration)
- Experiments that need manual inspection between runs
Why This Exists
Based on session audit (2026-04-16), the major wall-clock sinks in multi-seed grid experiments are:
- Stale screens — python finishes, wandb uploads, screen hangs, next wave blocked
- OOM on shared GPU — previous job's memory not yet released
- Wave race — new wave launches before previous wave fully settles
- Missing checkpoints — student launches before teacher saved
- Parser duplication — rewriting multi-seed analysis python every batch
All of these are pure engineering friction that can be orchestrated.
Core Concepts
Job Manifest
A manifest lists jobs with explicit state:
Job State Machine
Wave Orchestration
A "wave" is a batch of jobs that fit available GPUs. Next wave only starts when:
- All current-wave python processes have exited
- No stale screens remain for current-wave tags
- GPU memory has dropped below threshold (≤500 MiB)
- Precondition checks pass for next-wave jobs
Workflow
Step 1: Parse Manifest / Build from Grid
Input can be:
- YAML manifest (explicit job list, recommended for complex cases)
- Grid spec (Cartesian product of param values, e.g.,
N=[64,128,256] × n=[50K,150K,500K,652K]) - Natural language description (Claude parses into manifest)
Bind the run identifiers once so every later step (manifest save, scp, launch, monitor, resume) refers to the same paths. Set these as local shell variables before generating the manifest:
Save the built manifest to $LOCAL_RUN_DIR/manifest.json for reproducibility.
Step 2: Pre-flight
- Check SSH connection works
- Check conda env exists on remote
- Check
cwdexists on remote - Check all preconditions (checkpoints, input files)
- Check GPU availability (at least
max_parallelfree GPUs)
If any precondition fails, show user which jobs are blocked and why.
Step 3: Launch Scheduler
The scheduler implementation lives in tools/experiment_queue/queue_manager.py. Three preliminaries before launch.
3a. Resolve the local helper directory. The two helpers (queue_manager.py, build_manifest.py) sit under tools/experiment_queue/ in the ARIS repo. Use this fallback chain so the skill works from any project layout:
The .aris/tools symlink is set up by install_aris.sh (#174). Older installs without that symlink fall through to tools/experiment_queue (works if invoked from inside the ARIS repo) or $ARIS_REPO/tools/experiment_queue.
3b. Compute remote paths. Use both a remote-relative form (for scp destinations — modern scp runs in SFTP mode and does NOT reliably expand $HOME in destination paths) and a $HOME-prefixed form (for ssh ... command strings, where remote bash WILL expand $HOME):
3c. Bootstrap the remote run directory and copy helpers + manifest. Per-invocation and idempotent. Use a unique run directory rather than /tmp so concurrent queues do not collide and so resume-after-crash is reproducible.
3d. Launch the scheduler as a detached `nohup` process on the SSH host:
Notes for callers:
--log-diris whatqueue_manager.pyactually consumes (per-job log files for OOM detection). Do NOT pass--log <path>— that flag is declared but unused, and a single combined log breaks the per-job stale-screen / OOM heuristics.- Persist
RUN_TS/REMOTE_RUN_REL/REMOTE_RUN_DIRto disk so monitoring and resume can reload them without regenerating:
``bash { printf 'PROJECT_DIR=%q\n' "$PROJECT_DIR" printf 'RUN_TS=%q\n' "$RUN_TS" printf 'LOCAL_RUN_DIR=%q\n' "$LOCAL_RUN_DIR" printf 'REMOTE_RUN_REL=%q\n' "$REMOTE_RUN_REL" printf 'REMOTE_RUN_DIR=%q\n' "$REMOTE_RUN_DIR" } > "$LOCAL_RUN_DIR/run_meta.txt" ``
%q shell-escapes the values so the file is safely sourceable later. Note that REMOTE_RUN_DIR keeps a literal $HOME (do not expand it locally), which is the right form for re-use inside ssh "..." strings later.
3e. Resume an existing queue (only when the user asks). A fresh RUN_TS per invocation is correct for new queues. To resume a crashed queue, do NOT regenerate RUN_TS — reload the recorded values and re-run only the launch command (Step 3d), not the bootstrap (Step 3c):
The scheduler:
- Reads manifest
- Loops: for each pending job, assign to free GPU, launch via
screen - Polls job status (every 60s)
- Detects stale screens (python exited but screen detached → kill)
- Detects OOM (CUDA OOM in log → mark failed_oom → retry after delay)
- Detects completion (expected output JSON/file exists) → mark completed
- Launches next wave when current wave settles
- Writes state to
queue_state.jsoncontinuously
Step 4: Monitoring
User can check state anytime, using $REMOTE_RUN_DIR from Step 3b (or reload from $LOCAL_RUN_DIR/run_meta.txt for an older run):
Note: /monitor-experiment is currently focused on screen sessions, result JSONs, and W&B; it does not yet read queue_state.json directly. For queue-state monitoring, use the literal command above against the recorded REMOTE_RUN_DIR. (Tracking /monitor-experiment queue-state integration as a follow-up.)
Step 5: Post-completion
When all jobs in manifest.json are completed or stuck:
- The remote scheduler (
queue_manager.py) exits cleanly withAll jobs doneto its own stdout (captured in$REMOTE_RUN_DIR/queue_mgr.log). It does NOT write the local summary. - The local skill agent then aggregates state into
$LOCAL_RUN_DIR/summary.md(read$REMOTE_RUN_DIR/queue_state.json, group by status, optionally pull per-job logs). - Local skill agent invokes
/analyze-resultsifanalyze_on_complete: true.
Grid Spec Syntax
Instead of writing 24 job entries manually:
Expands to 36 jobs automatically.
Wave Chaining
For sequential phases (teacher → student):
Scheduler enforces depends_on: distill_students jobs stay pending until all train_teachers jobs are completed.
OOM Handling
Detect OOM from stdout:
On detection:
- Mark job
failed_oom - Kill screen
- Wait
oom_retry.delayseconds - Check if current GPU is free; if not, try another free GPU
- Requeue as
pending - Max
oom_retry.max_attemptsbefore markingstuck
Stale Screen Detection
Every 60s, for each running screen:
- Check screen exists (
screen -ls) - Check python PID still running (
ps -p) - If screen exists but python exited:
- If expected output file exists → mark
completed, kill stale screen - If no output file → mark
failed_other, kill screen
Resume-on-restart
If scheduler crashes / is killed:
- Read
queue_state.json - For each
runningjob: check screen; if still alive, keep; if not, re-evaluate state - For each
pending: continue normally - Idempotent: safe to restart scheduler without losing state
Output: Summary Report
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/experiment-queue/SKILL.md
Popularity
- Repository stars
- 100
- Repository forks
- 16
- 7-day trend score
- 23
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/ai4scientist/nano-scientist/experiment-queue)