/findings-workflow:setup-envfrom findings-workflow
Detects or creates a project-local Python environment (≥ 3.11) using uv. Installs Python, creates .venv, lockfile, and baseline tooling with zero global footprint.
Ships in findings-workflow. Installing the plugin adds it to Claude Code.
The workflow runs all analysis, loaders, and figures in Python (conventions/coding.md). This command makes sure this project has a usable interpreter and a locked, project-local environment before any Python is executed (Stage 1 onward). It is idempotent — safe to re-run; it never overwrites a working setup.
The floor is Python ≥ 3.11 (conventions/coding.md). Anything older is treated as "not suitable."
Two principles govern this command:
uv binary under ./.uv/bin, the interpreter under ./.uv/python, the virtualenv under ./.venv. We do not modify the user's PATH, shell profile, or any system location. Removing the project removes everything.uv is, why we want it, and exactly what will happen, then ask the scientist to approve. If they decline, they install Python ≥ 3.11 themselves and we proceed once it is present.Check, in order, and stop at the first that satisfies the floor:
./.venv exists and ./.venv/bin/python (Unix) or ./.venv/Scripts/python.exe (Windows) reports ≥ 3.11, the project is already set up. Report it as kept, run Step 5 (baseline tooling) idempotently, and stop.uv. Is ./.uv/bin/uv (project-local) present, or uv on PATH? Note it — we can reuse it instead of downloading it.python3 --version, then python --version, then (Windows) py -3 --version. Parse the MAJOR.MINOR and compare to 3.11.From this, determine what (if anything) must be downloaded:
uv binary — needed only if no usable uv was found in (2);If nothing needs downloading (a suitable uv and a suitable Python already exist), skip Step 2 and go straight to Step 3 with a brief notice of what you're reusing.
Tell the scientist, in plain terms, before doing anything:
Your environment doesn't have a Python that meets this workflow's floor (≥ 3.11)[, and
uvisn't installed]. I can set one up inside this project without touching anything else on your system. Here's exactly what that involves:
- What
uvis: a fast, widely-used Python package & version manager (from Astral). It can download a self-contained Python interpreter and manage a locked dependency set — which is what makes every finding computationally reproducible.- What I'll download: the
uvbinary (~a few tens of MB) [and a standalone Python 3.11 interpreter (~a few hundred MB)].- Where it goes: entirely under this project —
./.uv/bin(uv),./.uv/python(interpreter),./.venv(the virtualenv). I will set the install flags that prevent any change to your PATH, shell profile, or system Python, and disable uv self-updates.- To undo it later: delete
./.uv,./.venv,./.python-version,./uv.lock— nothing is left elsewhere.- Source: the official one-line installer from https://github.com/astral-sh/uv.
Shall I proceed? If you'd rather install Python ≥ 3.11 yourself, decline and I'll continue once it's available.
Wait for an explicit answer.
If the scientist declines: do not install anything. Record the decline (Step 6, mode: "system", declined: true), and tell them: "No problem — install Python ≥ 3.11 yourself (e.g. python.org, your OS package manager, pyenv, or conda), then re-run /findings-workflow:setup-env. Stage 1 stays blocked until a usable interpreter is available." Stop here.
If the scientist approves: continue to Step 3.
Detect the platform (you know it from your environment). Use an absolute project path for the env-var values ($PWD on Unix, the resolved project path on Windows). Run from the project root.
3a. Install uv into the project (only if it must be downloaded). The key flag is UV_UNMANAGED_INSTALL, which installs uv to the given directory and suppresses all PATH/profile/env modification and self-update (UV_INSTALL_DIR + UV_NO_MODIFY_PATH are the lower-level equivalents).
curl -LsSf https://astral.sh/uv/install.sh \
| env UV_UNMANAGED_INSTALL="$PWD/.uv/bin" sh
$env:UV_UNMANAGED_INSTALL = "$PWD\.uv\bin"
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
The project-local uv is invoked by its explicit path (./.uv/bin/uv on Unix, .\.uv\bin\uv.exe on Windows). If a usable uv already existed, use that instead.
3b. Pin the interpreter into the project. Set UV_PYTHON_INSTALL_DIR so any interpreter uv downloads lands inside the project, then pin and create the venv. Keep UV_PYTHON_INSTALL_DIR set on every uv invocation that may resolve or change the interpreter:
export UV_PYTHON_INSTALL_DIR="$PWD/.uv/python"
./.uv/bin/uv python pin 3.11 # writes ./.python-version
./.uv/bin/uv venv --python 3.11 # creates ./.venv (downloads a 3.11 into .uv/python only if needed)
$env:UV_PYTHON_INSTALL_DIR = "$PWD\.uv\python"
.\.uv\bin\uv.exe python pin 3.11
.\.uv\bin\uv.exe venv --python 3.11
uv venv reuses a suitable already-present interpreter if one exists and only downloads when it must — so an approved install with a fine system Python still avoids an unnecessary interpreter download.
Fail open with a clear message. If a download fails (no network, corporate proxy / SSL interception, or — on Windows — execution-policy blocking the script), do not leave a half-installed state: report the specific error and fall back to the decline path (Step 2), telling the scientist to install Python ≥ 3.11 themselves and re-run. Clean up an empty ./.uv if nothing was installed.
If ./pyproject.toml is absent, create a minimal one (do not overwrite an existing one):
[project]
name = "findings-workflow-study"
version = "0.0.0"
requires-python = ">=3.11"
dependencies = []
[tool.mypy]
python_version = "3.11"
strict = true # full strict type checking — the promotion type-gate has real teeth
ignore_missing_imports = true # scientific deps often ship no stubs; don't fail the gate on those
[tool.ruff]
target-version = "py311"
[tool.ruff.lint]
# Strict, explicit rule set (conventions/coding.md) — NOT ruff's minimal defaults.
select = ["E", "F", "W", "I", "B", "UP", "SIM", "C4", "PD", "NPY", "RUF"]
Seed the [tool.mypy] and [tool.ruff] blocks above — the strictness lives in this config, and the promotion hook (ruff check + mypy) reads it. Without them both gates are near-no-ops: bare mypy lets untyped functions through, and bare ruff checks only a minimal default rule set. strict = true gives the type-gate full teeth (untyped/partially-typed defs, implicit Any, and unused ignores all become errors), while ignore_missing_imports = true keeps it failing on real type errors rather than on unstubbed scientific libraries. The select set is the strict lint bar (conventions/coding.md); tune per-rule ignores per study if a rule genuinely doesn't fit, but do not weaken the set below this baseline.
Then add the baseline with uv (this resolves, installs into ./.venv, and writes ./uv.lock — the lockfile recorded in every finding's provenance.environment). Invoke uv with UV_PYTHON_INSTALL_DIR set (as in 3b):
# Quality tooling the gates depend on (dev deps):
./.uv/bin/uv add --dev ruff mypy pytest hypothesis
# Recommended scientific baseline (tune per study; scikit-learn is load-bearing — it
# powers the KNN missing-value imputer (lib/common/missing-values) and the leakage-safe
# ML templates, not just an optional extra):
./.uv/bin/uv add numpy pandas scipy scikit-learn matplotlib statsmodels
# Normalization the lib/ templates seed from (pronoms: median / MAD / VSN normalizers).
# The normalize template is version-sensitive (MADNormalizer's scaling default and the
# VSN engine API), so pin it; only add when the study normalizes (omics intensities):
./.uv/bin/uv add 'pronoms==0.4.0'
# ComBat for the batch-correction template (pycombat exposes `Combat`); add only when
# the study has a batch axis to correct:
./.uv/bin/uv add 'pycombat==0.20'
# Collision-free point labels for the volcano template (textalloc.allocate); add only
# when annotating top hits on a volcano. Ships py.typed, so it stays mypy --strict clean.
./.uv/bin/uv add 'textalloc==1.2.3'
# Boruta all-relevant feature selection (lib/analysis/boruta seeds from BorutaPy); add
# only when running Boruta. Pinned — the template intercepts a private method to keep the
# per-iteration shadow threshold, so a version bump must be re-verified against its tests.
./.uv/bin/uv add 'boruta==0.4.3'
# Gradient-boosted-tree classifier (lib/analysis/classification-xgboost seeds from
# XGBClassifier); add only when running the non-linear XGBoost classification. Ships
# py.typed, so it stays mypy --strict clean. Pin for reproducible tree builds.
./.uv/bin/uv add 'xgboost==3.3.0'
The dev tooling is not optional: ruff + mypy power the promotion hook and pytest + hypothesis power the code-reviewer's test check. Without them in ./.venv, the promotion gate degrades to a no-op. The scientific baseline is a sensible default — add/remove packages as the study needs (uv add / uv remove), and the lockfile updates.
.gitignore the env (idempotent)Ensure the project ./.gitignore contains these entries (create the file if absent; append any missing lines; never duplicate):
# Findings Workflow — project-local Python environment (regenerable; not committed)
.uv/
.venv/
__pycache__/
*.pyc
The interpreter and venv are derived state — regenerable from pyproject.toml + uv.lock + .python-version, which are committed. Do not commit .uv/ or .venv/.
Update the environment block in state/workflow.json (schema: conventions/workflow-state.md) and bump updated:
"environment": {
"mode": "project-uv",
"python_min": "3.11",
"interpreter": ".venv/bin/python",
"configured": true,
"declined": false,
"updated": "<YYYY-MM-DD>"
}
mode: "project-uv" when we created a project-local env; "system" when reusing a suitable system Python (or when the scientist declined and will provide their own).interpreter: the venv python path (.venv/Scripts/python.exe on Windows), or "system" if relying on a system interpreter without a project venv.configured: true only once a usable env (≥ python_min) has actually been verified; false if the scientist declined and no suitable Python is present yet.declined: true if the scientist declined the project-local install.This block is advisory state; the stage gates still live-verify a working interpreter (the Stage 1 hard gate, re-verified at the Stage 3 integrity gate) — they never trust a stale flag.
Print a created-vs-kept summary and how to use the environment in this project:
./.venv/bin/python … (Unix) or .\.venv\Scripts\python … (Windows). Equivalently ./.uv/bin/uv run python … (with UV_PYTHON_INSTALL_DIR set) ensures the env is synced first.UV_PYTHON_INSTALL_DIR="$PWD/.uv/python" ./.uv/bin/uv add|remove <pkg> (re-locks automatically).pyproject.toml, uv.lock, and .python-version; .uv/ and .venv/ are git-ignored and rebuilt with ./.uv/bin/uv sync.End by pointing to the next workflow step (e.g. "Environment ready. Continue the workflow; Python execution begins at Stage 1 — run /findings-workflow:stage1-metadata when you reach it.").
What the command file sets; muted values are Claude Code's defaults
python-environment, virtualenv, uv, project-setup, idempotent
7-day visitors to each command page
npx claudepluginhub mriffle/findings-ai-collab-workflow --plugin findings-workflow11 commands in this plugin
/initScaffold a Findings Workflow project in the current directory — create the standard layout, seed the color registry, initialize the findings graph, and write the project CLAUDE.md./READMEcommands/Slash commands that are the **workflow entry points** (spec doc 02). Each is an `.md` file; when the plugin is installed they are invoked as `/findings-workflow:<name>`./stage0-scienceStage 0 — State the science. Interview the scientist about the study and write state/PROJECT.md, the framing that shapes everything downstream./stage1-metadataStage 1 — Understand the metadata. Infer and validate the meaning of every column, test the relationships that should hold, detect confounds, and write state/METADATA.md./stage2-dataStage 2 — Understand the data. Determine orientation, transformation/normalization state, and missing-value semantics of the data matrix; characterize missingness, contaminants, decoys, and duplicates; write state/DATA_DESCRIPTION.md./stage3-loadersStage 3 — Loaders, pairing, QC [INTEGRITY GATE]. Build and verify tested data+metadata loaders that pair every sample exactly, verify the loaded data against the source, produce QC, and pass the integrity gate. Unlocks all analysis.