/fold-cp:dispatch_work [module/test scope, or 'all new modules in current_code_structure.md']from fold-cp
Orchestrates parallel integration of CP modules and tests by building dependency graphs, sorting into GPU-bounded waves, and spawning coder+reviewer pairs.
Ships in fold-cp. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Use this only when there are multiple modules/tests to port at once. For one
module, call /fold-cp:dtensor_modules + /fold-cp:test directly. Roles, the
spawn-prompt template, the interface-reconciliation protocol, the review gates, and
GPU partitioning are in coordination.md.
This skill assumes the agent-team tooling (Agent/TeamCreate/SendMessage/
Task*). If team_swarm:intercomm is installed, load it as the messaging protocol
(verifiable artifact reports, lead health-checks). code_quality:write_test /
run_test are the test-discipline references for reviewers.
docs/current_code_structure.md (§4 module map, with reuse/adapt/new status) and
docs/cp_infra.md (topology, world_size, GPU slots, launch recipe) exist.RULES.md, injected at SessionStart) are in scope; every
spawn prompt repeats them.shard_data_feats).slots = floor(free_GPUs / world_size) from
cp_infra.md. Run at most slots CP test jobs concurrently; queue the rest.For each item in the wave, spawn two agents (template in coordination.md):
/fold-cp:dtensor_modules /
/fold-cp:test, loads the module's row from module_map.md, the serial twin, and the relevant
tech-guide §. Verifies the fwd+bwd decomposition on a 1×1 mesh (fp64) before the multi-rank
parity run (/fold-cp:test Step 3) and runs the test green before handoff — this makes the
GPU run pass first try and keeps the slot-bounded queue moving.Explore agent (no Edit/Write): it reviews the
coder's code and test against the gates in Step 5 and returns a verdict; it never writes
(the coder owns all authoring + testing).On a shared local (non-SLURM) box, give each pair a contiguous GPU chunk of world_size
devices (CUDA_VISIBLE_DEVICES); never let two CP jobs share GPUs; probe occupancy and HOLD if
busy (parallel tests otherwise overload the GPUs and stall). Under SLURM the scheduler handles
per-job device visibility. Track each item as a Task (coder + reviewer subtasks).
Before a coupled item is declared done, its coder and the neighbor's coder must cross-review the shared placement contract:
current_code_structure.md §3.This catches the integration bug that unit tests miss: each module passes its own
parity test but they disagree at the seam. The lead routes this exchange via
SendMessage and does not advance the wave until every coupled seam is reconciled.
A work item is done only when its reviewer confirms all of:
grad_output, sharding-active assert,
replicated-identical assert, non-zero grads, fp64 default tolerances, >=1
adversarial case (Rule 14).from_local
shape/stride, promote_types, backward budget matches forward, sorted collective
keys, control-flow scalars broadcast (Rules 6–12).timeout, logged; pre-commit clean.The lead verifies the reviewer's claim by inspecting the durable evidence (Rule 22) — the committed test is non-vacuous (Rule 14), the tee'd log shows measured-vs-tolerance for a run against the current tree, and the diff touches only the distributed tree (Rule 2) — re-running only if inspection leaves doubt, before marking the Task done.
isolation: "worktree"). After merge, re-run the item's parity test on the merged
tree to confirm it still passes (landing verification — the merge changed the tree; Rule 22), then
remove the item's worktree and shut down its coder + reviewer agents with an explicit
shutdown_request (finished, no further task; completed background teammates do not auto-dismiss
and TaskStop won't remove an idle one) — freeing their GPU chunk (destroy groups, kill orphaned
ranks). See the coordination.md Shutdown & cleanup protocol.current_code_structure.md §4 status to done; advance to the next wave.If the items are independent (no coupling — e.g. porting a batch of unrelated
substrate primitives), prefer a deterministic Workflow pipeline or foreground agents over a
persistent background team. A Workflow pipeline (implement → parity-test → adversarial-verify
per item) and foreground Agent calls (omit run_in_background) leave no lingering teammate —
they return inline and never accumulate as idle rows in the agent view, whereas a messageable
background team persists as idle teammates that must each be torn down with a shutdown_request.
They're also lighter and minimise orchestrator round-trips (Rule 24). Reserve the persistent
background team strictly for coupled seams that need mid-run lead↔coder messaging; use
Workflow / foreground for embarrassingly-parallel ports.
current_code_structure.md §3/§4.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub nvidia-bionemo/boltz-cp --plugin fold-cp11 skills in this plugin
/benchmarkBenchmark a CP inference or training workflow to find the maximum token count that fits at a given CP size and to record end-to-end walltime. Sweeps input size (tokens N, atoms, MSA depth S) over real or synthesized data, ramps N until OOM to report the max, times fwd (inference) or fwd+bwd+step (training) with warmup and median-of-repeats, captures peak memory, and writes a results table to docs/cp_benchmark.md. Use once a CP workflow runs end-to-end, to quantify the memory headroom CP buys and the walltime cost.
/build_infraProbe and establish the distributed test infrastructure for CP development. Inventories local GPUs (count, model, memory, NVLink topology), checks the software stack (Python, PyTorch+CUDA, NCCL, torch.distributed), and runs shipped smoke tests for batch_isend_irecv P2P, all_gather, all_reduce, reduce_scatter, and a DTensor round-trip. Maps the GPU count to which CP topologies are testable (2D needs >=4 GPUs, 1D needs >=2 ideally 3, full integration wants 8). When no local GPUs are available, generates a SLURM submission template and guides the user to provide cluster access. Records docs/cp_infra.md. Use after learn_context, before shard_data_feats / dtensor_modules / test.
/cpize_model_workflowOrchestrate the END-TO-END integration of context parallelism into a custom co-folding / structure-prediction model: turn the whole effort into a prioritized, dependency-sorted worklist, then drive it phase by phase — map the model (learn_context), verify infra (build_infra), shard data features (shard_data_feats), port modules (dtensor_modules, fanned out via dispatch_work), prove correctness (test), wire the trainer/predictor (dist_lifecycle), and finally profile memory and compute (mem_profile, nsys_profile) and benchmark. Use as the front door when the user wants to "CP-ify my model" as a whole program of work — it prioritizes, sequences, and gates the long task list and delegates each task to the right fold-cp skill. Not for a single module (use dtensor_modules + test directly).
/dist_lifecycleStand up the distributed-model lifecycle for a CP training/inference run: device placement before DTensor wrapping, the all-trainable-params-are-DTensors invariant (with placeholder/freeze for unimplemented modules), checkpoint save (DTensor → plain) and load (realign via the live state_dict template + redistribute optimizer state to parameter placements), resume RNG seed offset, and DTensor-safe EMA. Use after dtensor_modules + build_infra, when wiring the ported CP modules into a real trainer/predictor (Lightning or custom) and you need checkpoints, resume, or EMA to work — the gap between "modules pass parity" and "training runs and resumes".
/dtensor_modulesImplement DTensor-based context-parallel model modules that mirror a serial reference. Maps each serial layer/module to its Boltz-CP counterpart with exact input/output shapes, placements, collectives, and backward memory budget; writes the CP implementation following the autograd.Function conventions (explicit collectives, no implicit DTensor ops, promote_types, explicit from_local shape/stride, attribute-name + registration-order mirroring); and verifies it against the serial forward+backward via the test skill. Use when porting a custom model's trunk / attention / triangle / OPM / diffusion / confidence / loss modules to CP.
/learn_contextExplore a custom co-folding / structure-prediction model to understand its inference and training workflows, entry points, training framework (PyTorch Lightning vs DeepSpeed), data-feature format, and featurization pipeline — then map those components onto the existing Boltz-CP context-parallel reference so downstream CP integration reuses what already exists. Produces docs/current_code_structure.md. Use FIRST, before any other fold-cp skill, or whenever that doc is missing/stale. Runs interactively (Q&A with the user) or autonomously on request.
Other plugins' skills for the same job