一键导入
workflow-planning
Use when an experiment design is approved and needs to be turned into a concrete stage-by-stage execution plan with checkpoint files
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when an experiment design is approved and needs to be turned into a concrete stage-by-stage execution plan with checkpoint files
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when creating, reading, or updating workflow checkpoint files (workflow-state.json, progress.log, init.sh) — the file-centric state system for cross-session computational workflows
Use when a workflow stage subagent has prepared computation scripts and needs to submit the job to a local or HPC backend via DPDispatcher
Use when a workflow plan exists and stages need to be executed sequentially in the current session
Use when the user wants to set up a new computational experiment — before any computation begins, to design the method, stages, and success criteria
Use before marking any workflow stage as completed — verify outputs exist, are valid, and meet success criteria defined in workflow-state.json
Use when starting a new session and workflow-state.json exists in the working directory — recovers full context from checkpoint files before any new work
| name | workflow-planning |
| description | Use when an experiment design is approved and needs to be turned into a concrete stage-by-stage execution plan with checkpoint files |
Turn an approved experiment design into a concrete execution plan with all checkpoint artifacts created.
Core principle: The plan creates the harness. After this skill completes, workflow-state.json, progress.log, and init.sh exist and are ready.
Read the full design doc. Extract: objectives, stages, parameters, success criteria, pitfalls, software, walltimes.
For each stage in the design, define:
| Field | Content |
|---|---|
id | stage-1, stage-2, stage-3, ... (always sequential integers) |
name | Human-readable name |
depends_on | List of stage IDs this depends on |
inputs | Exact file paths (relative to workflow root) as array of strings |
outputs | Expected output file paths as array of strings |
parameters | Software-specific parameters from the design (object) |
success_criteria | Specific, measurable criteria as a single string |
backend | Backend profile name (optional — omit to use default_backend) |
Stage ID rules:
stage-N with sequential integers: stage-1, stage-2, stage-3, stage-4, stage-5stage-2a, stage-2b — even for parallel branchesdepends_on, not via IDsOutput directory convention:
stage-N/ subdirectorystage-2/isotherm.csv, stage-3/output.logstructures/)After defining all stages, ask the user:
"This workflow has N stages. Enable autonomous session chaining? If yes,
executing-workflowswill launch a background runner that automatically chains Claude sessions until the workflow completes or blocks. Requires: tmux installed, tool permissions pre-approved in.claude/settings.json."
session_config.autonomous: true in the workflow-state.json created in Step 3.session_config.autonomous: false (the default).workflow-state.jsonCreate with all stages in pending status. Every stage MUST have all fields shown below — no optional fields, no extra fields.
{
"workflow_id": "<topic>-YYYY-MM-DD",
"version": 1,
"created": "<ISO-timestamp>",
"updated": "<ISO-timestamp>",
"experiment_design": "<relative-path-to-design-doc>",
"workflow_plan": "<relative-path-to-plan-doc>",
"amendments": [],
"session_config": {
"autonomous": false,
"session_budget": 6,
"session_count": 0,
"session_id": null,
"session_cost": 0,
"exit_reason": null,
"stage_weights": {
"sync": 1,
"async": 1.5,
"error_cycle": 2,
"diagnostic": 2
}
},
"default_backend": "local",
"backend_profiles": {
"local": {
"type": "local",
"config": {
"batch_type": "Shell",
"context_type": "LocalContext"
}
},
"hpc-cluster": {
"type": "remote",
"batch_type": "Slurm",
"config_path": "/home/user/.dpdisp/hpc_config.json",
"resource_defaults": {
"number_node": 1,
"cpu_per_node": 16,
"gpu_per_node": 0,
"queue_name": "",
"group_size": 1
}
}
},
"stages": [
{
"id": "stage-1",
"name": "Human-readable name",
"status": "pending",
"depends_on": [],
"backend": null,
"inputs": ["path/to/input.file"],
"outputs": ["stage-1/output.file"],
"parameters": {
"software": "SoftwareName",
"key_param": "value"
},
"success_criteria": "Specific measurable criterion in a single string",
"started_at": null,
"completed_at": null,
"retry_count": 0,
"last_error": null,
"running_process": null
}
]
}
Schema rules:
stages is an array, not an objectinputs and outputs are arrays of strings (file paths), not objectssuccess_criteria is a single string, not an arrayparameters is an object with key-value pairsstarted_at, completed_at, retry_count, last_error, running_process) initialized to null/0version: 1 and amendments: []default_backend and backend_profiles (at minimum a "local" profile)backend field is optional — null means use default_backendbackend_profiles with type: "remote" must include batch_type (the scheduler type from the machine config, e.g., "Slurm", "PBS", "LSF", "SGE"), config_path (path to external machine config — validated for existence, never read), and resource_defaultssession_config with session_budget (default 6), session_count (0), session_id (null), session_cost (0), exit_reason (null), and stage_weights (sync: 1, async: 1.5, error_cycle: 2, diagnostic: 2). session_count is incremented by session-resume at each session start — single source of truth for session numbering. User may adjust session_budget and stage_weights after planning.session_config.autonomous is a boolean (default false). Set to true during planning when the user opts in to autonomous session chaining.description, known_pitfalls, safeguards, expected_walltime, execution_order) — those belong in the design doc or plan doc, not the state fileprogress.logSingle line via Bash tool. No more.
echo "[$(date -Iseconds)] Workflow created: <workflow_id>. N stages. Purpose: <purpose>." > progress.log
Note: > (create) not >> (append) — this is the initial creation.
init.shBuild environment checks for every software tool in the workflow. This script runs at every session resume — if it's wrong, the workflow breaks.
Critical rules:
set -e — fail immediately on any errorconda activate (unreliable in non-interactive shells)exit 1 on failure — never use WARNING for required softwareTemplate:
#!/bin/bash
set -e
# ── Infrastructure (always required) ──
command -v uvx >/dev/null 2>&1 || { echo "FAIL: uvx not found"; exit 1; }
command -v tmux >/dev/null 2>&1 || { echo "FAIL: tmux not found"; exit 1; }
uvx --from dpdispatcher dpdisp --help > /dev/null 2>&1 || { echo "FAIL: dpdispatcher not accessible via uvx"; exit 1; }
# ── Project-specific (derive ALL from design doc) ──
# Use direct conda/venv paths — `conda activate` is unreliable in non-interactive shells.
# Every check MUST `exit 1` on failure — never WARNING for required software.
#
# Examples (adapt to your software stack):
# CONDA_ENV="/path/to/conda/env"
# PYTHON="$CONDA_ENV/bin/python3"
# $PYTHON --version || { echo "FAIL: python3 not found at $PYTHON"; exit 1; }
# $PYTHON -c "import numpy; import torch" || { echo "FAIL: required Python libraries not available"; exit 1; }
# command -v lmp >/dev/null 2>&1 || { echo "FAIL: LAMMPS not found"; exit 1; }
# command -v simpleFoam >/dev/null 2>&1 || { echo "FAIL: OpenFOAM not found"; exit 1; }
echo "Environment ready."
For each software in the design doc, add a check:
Save to docs/superscientist/plans/YYYY-MM-DD-<topic>.md:
# [Topic] Workflow Plan
**Experiment Design:** [relative path to design doc]
**Workflow ID:** [workflow_id]
**Stages:** N total
## Stage Execution Order
1. Stage 1: [name] — [brief description]
2. Stage 2: [name] (depends on: stage-1) — [brief description]
...
## Per-Stage Details
### Stage N: [Name]
- **Dependencies:** [list]
- **Inputs:** [file paths]
- **Commands:** [exact commands to run — not vague descriptions]
- **Outputs:** [expected files]
- **Success criteria:** [specific]
- **Estimated walltime:** [from design]
- **Backend:** [profile name, e.g., "local" or "hpc-cluster"]
- **Dispatch mode:** [sync (local < 2 min) or async (tmux)]
Commands must be exact. Not "Run the simulation at 298K" but the actual command: lmp -in input.lammps or python train.py --config config.yaml. If the exact command depends on stage preparation, describe the command template and what the subagent fills in.
Backend and dispatch: Each stage specifies which backend profile to use. The superscientist:compute-backend skill handles dispatch — sync for local short jobs (< 2 min), async via tmux for everything else (remote backends always, local long jobs).
git add workflow-state.json progress.log init.sh docs/superscientist/plans/
git commit -m "feat: create workflow plan for <topic>"
Announce: "Workflow plan created. Invoke superscientist:executing-workflows to begin execution, or review the plan first."
| Thought | Reality |
|---|---|
| "I'll create the state files later" | Create them now. They ARE the plan. |
| "init.sh can be generic" | Add software-specific checks from the design. Every tool. |
| "Dependencies are obvious" | Write them explicitly in depends_on. |
| "I'll use stage-2a/2b/2c for parallel branches" | Always sequential integers. Branching is in depends_on. |
"conda activate works fine" | Not in non-interactive shells. Use direct paths. |
| "A WARNING is enough for missing software" | Hard fail (exit 1). Session-resume depends on this. |
| "Commands can be vague in the plan" | Exact commands. The executing agent needs them. |