Metadata-Version: 2.4
Name: apheris-foundry-cli
Version: 2.8.0rc1
Summary: Command-line interface for Apheris Foundry workflows.
Author: Apheris
License-Expression: LicenseRef-Apheris-Foundry-Software-License
Project-URL: Homepage, https://github.com/apheris/apheris-foundry-cli
Project-URL: License, https://www.apheris.com/docs/hub/hub-license.html
Project-URL: Repository, https://github.com/apheris/apheris-foundry-cli
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx<1,>=0.28
Requires-Dist: httpcore>=1.0.9
Requires-Dist: jsonschema<5,>=4
Requires-Dist: PyYAML<7,>=6.0.3
Requires-Dist: rich>=13
Requires-Dist: truststore<1,>=0.10
Requires-Dist: typer<1,>=0.12
Provides-Extra: dev
Requires-Dist: build<2,>=1; extra == "dev"
Requires-Dist: pytest<10,>=9; extra == "dev"
Requires-Dist: ruff<1,>=0.9; extra == "dev"
Requires-Dist: wheel<1,>=0.45; extra == "dev"
Dynamic: license-file

# Apheris Foundry CLI

Command-line interface for submitting and managing Foundry workflow runs on an Apheris Hub instance.

## Requirements

- Python 3.10 or later
- Access to an Apheris Hub instance

## Installation

### conda

Recommended if you already use conda for scientific Python work. A dedicated environment avoids dependency conflicts.

#### Linux / macOS

```bash
conda create -n apheris-foundry python=3.11 -y
conda activate apheris-foundry
pip install apheris-foundry-cli
```

#### Windows (Anaconda Prompt or PowerShell)

```powershell
conda create -n apheris-foundry python=3.11 -y
conda activate apheris-foundry
pip install apheris-foundry-cli
```

Activate the environment at the start of each session with `conda activate apheris-foundry`.

### venv (standard Python)

#### Linux / macOS (venv)

```bash
python3 -m venv ~/.venvs/apheris-foundry
source ~/.venvs/apheris-foundry/bin/activate
pip install apheris-foundry-cli
```

#### Windows (PowerShell, venv)

```powershell
python -m venv $env:USERPROFILE\.venvs\apheris-foundry
& $env:USERPROFILE\.venvs\apheris-foundry\Scripts\Activate.ps1
pip install apheris-foundry-cli
```

Activate the environment at the start of each session with the `activate` command above.

### Verify

```bash
apheris-foundry --version
apheris-foundry --help
```

### Upgrade

```bash
pip install --upgrade apheris-foundry-cli
```

## Login

Connect to your Hub using the URL provided by your team:

```bash
apheris-foundry login --url https://hub.example.com
```

Follow the sign-in instructions. The CLI saves your session for later commands.
Use `apheris-foundry logout` to sign out, or log in again to switch Hubs.
See [callback URL settings](docs/usage.md#login-and-saved-sessions) to pin a registered URL.

If login reports that its local ports are already in use, follow the commands
in the error message to identify the conflicting application. Close it if
appropriate, then retry login. If you cannot resolve the conflict, share the
error message with your support team.

## Install agent skills

If you use an AI agent, install the CLI guidance for your agent:

```bash
apheris-foundry skills install --agent codex
# Or: apheris-foundry skills install --agent claude
```

The CLI skill is bundled and can be installed offline. After login, install
workflow guidance directly from your Hub:

```bash
apheris-foundry workflows list
apheris-foundry skills install --workflow <workflow-id> --agent codex
```

Here and below, replace `<workflow-id>` with an ID that `workflows list` shows.
Which workflows exist, and what they're called, depends on your Hub.

Use `--path ./.agents/skills` instead of `--agent` for another agent or a
project directory. Reload skills in your agent if needed. Installing skills
copies instructions; it does not log in or submit a job.

`skills list` shows bundled CLI skills and every workflow skill from your active
Hub together. If Hub is unavailable, bundled skills still appear; unavailable
workflow skills are quietly skipped. Display the selected skill without installing it:

```bash
apheris-foundry skills show apheris-foundry-hub
apheris-foundry skills show --workflow <workflow-id>
apheris-foundry skills show apheris-workflow-<workflow-id>
# Install every bundled and Hub workflow skill after login:
apheris-foundry skills install --all --agent codex
```

The default `skills install --agent codex` installs all bundled skills offline. Use `--force` when you
want to replace an installed skill, including after changing Hubs or upgrading
workflows. Replacement removes local edits and stale files in that skill only.

Older Hubs or custom workflows may not provide skills yet. In that case, the
CLI reports the API error; ask your Hub administrator to deploy workflow skills.
See [Using the CLI](docs/usage.md) for help and skill provenance details.

## Quick start: run a workflow

Each workflow documents itself: what it does, the input it takes, its settings
and its results. That documentation and the workflow's agent skill come from the
workflow package deployed on your Hub, so they always match what your Hub runs.
This README covers only the CLI.

### Choose an MSA server

Only workflows that search for multiple sequence alignments (MSAs) use this setting.

MSA server preferences live under `settings`, just as in the Hub UI:

```bash
apheris-foundry settings msa list
# Select an ID shown in the list:
apheris-foundry settings msa select 2
```

The list shows the servers configured on your current Hub and marks the active
one. IDs vary by deployment; use your Hub's list. Selection is saved
on Hub and shared with the UI. Subsequent MSA-enabled Foundry runs use it without
an additional run option. If you do not change this setting, existing behavior
is preserved. Switching servers does not change jobs already submitted.

Use `apheris-foundry settings msa disable` to opt out of automatic MSA and supply
your own MSA files where required. Select a server again to re-enable it.
Each command supports `--json`. See [MSA settings](docs/usage.md#msa-settings)
for details about preference scope and scripting.

### Submit a job

After login, find the workflow you need and read its documentation:

```bash
apheris-foundry workflows list
apheris-foundry workflows get --workflow <workflow-id>
apheris-foundry workflows docs --workflow <workflow-id>
apheris-foundry workflows models --workflow <workflow-id>
```

`workflows get` also prints example commands built from that workflow's
definition. Prepare the input that the workflow's documentation describes, then
submit it with your Hub's default model settings:

```bash
apheris-foundry workflows run --workflow <workflow-id> --input <input>
```

Optionally add a name and one or more tags when submitting:

```bash
apheris-foundry workflows run --workflow <workflow-id> --input <input> \
  --name "Kinase pilot" --tag kinase --tag pilot
```

Omit `--name` for an unnamed run and omit `--tag` for an untagged run. Repeat
`--tag` for multiple tags. Hub validates and normalizes tags, trimming whitespace,
removing empty tags and deduplicating them. `jobs list` shows the saved name and
tags in separate `NAME` and `TAGS` columns; `jobs get --id <job-id>` shows both
fields in detail. Missing names and tags appear as `—`.

Repeat `--input` when the workflow takes several files for one run. Each file
is uploaded under its own name:

```bash
apheris-foundry workflows run --workflow <workflow-id> --input <file-1> --input <file-2>
```

When the workflow's input refers to other files by relative path, pass the
folder that holds all of them instead. Folders and ZIP files use binary archive
upload on Hub versions that support `POST /api/v1/foundry/runs/upload`:

```bash
apheris-foundry workflows run --workflow <workflow-id> --input ./input/ --name training
apheris-foundry workflows run --workflow <workflow-id> --input ./input.zip --strip-archive-root --name training
```

Folders are packaged automatically as an uncompressed ZIP in a temporary directory,
then streamed to Hub. The temporary archive is removed after submission, including
on failure. Existing ZIPs are validated; pass a ZIP alone. Hidden files and directories
(dot-prefixed path components) are excluded. ZIPs containing them are streamed
into a filtered temporary ZIP; other ZIPs are uploaded unchanged.
Binary contents and relative paths are preserved by default. For the supplier's
extra `input/` folder, pass `--strip-archive-root` explicitly. Folder uploads
need local temporary disk space roughly equal to the dataset size. Uploads and
expanded archives are limited to 1 GiB; the server controls the entry count; links, traversal and
conflicting paths are rejected. A failed network upload must be submitted again;
uploads are not resumable or reusable datasets. Single text-file inputs retain
the existing JSON submission path for older Hub versions.

This uploads the input and starts a job on Hub. Copy the returned job ID and use
it in the commands below:

```bash
apheris-foundry jobs get --id <job-id>
apheris-foundry jobs logs --id <job-id>
# After the job succeeds:
apheris-foundry jobs download --id <job-id> --output ./results
```

If the job fails, use `apheris-foundry jobs error --id <job-id>` to inspect the
error before retrying. A workflow runs only when its models and compute
resources are configured on your Hub.

Override model parameters inline or from a JSON/YAML file. Select models and weights
that `workflows models` lists; the field names come from the selected model's
parameter schema (see [Choosing how to pass settings](#choosing-how-to-pass-settings)):

```bash
apheris-foundry workflows run --workflow <workflow-id> --input <input> \
  --model-params '{"<field>": <value>}'
apheris-foundry workflows run --workflow <workflow-id> --input <input> \
  --model <model-id> --weight <weight-id> \
  --model-params @./model-params.yaml
```

## Quick start: models and weights

```bash
# 1. Discover: one row per model and weight (* = default); --weight shows one in detail
apheris-foundry workflows models --workflow <workflow-id>
apheris-foundry workflows models --workflow <workflow-id> --weight <weight-id>
# 2. Use a listed model and weight (rejected if not listed; never substituted)
apheris-foundry workflows run --workflow <workflow-id> --input <input> --model <model-id> --weight <weight-id>
# 3. Make a fine-tuned checkpoint available: private, or --public for everyone on this Hub
apheris-foundry weights enable --name my-kinase-ft --run-id <finetune-job-id> --path <checkpoint-path> --tag kinase
# 4. It now appears as a weight in step 1; manage it by ID
apheris-foundry weights list
apheris-foundry weights delete --id <weight-id> --yes
```

The same steps work for every workflow that lists models; for a training
workflow, the weight you pick is the starting point. Add `--json` for scripts. Once `weights enable` succeeds on Hub
2.0 or later, you can delete the source job and keep using the enabled weight.
Details: [Model weights](#model-weights-weights).

## Edit job names and tags

Update an existing run in any status, including succeeded, failed, or cancelled:

```bash
# Rename, preserving tags
apheris-foundry jobs update --id <job-id> --name "Corrected name"
# Replace all tags, preserving the name (does not append)
apheris-foundry jobs update --id <job-id> --tag mcl1 --tag rerun
# Change both fields and return the updated run as JSON
apheris-foundry jobs update --id <job-id> --name "Corrected name" --tag mcl1 --json
# Explicitly clear either field
apheris-foundry jobs update --id <job-id> --name ""
apheris-foundry jobs update --id <job-id> --clear-tags
```

Omitted fields remain unchanged. Supply at least one metadata option;
`--tag` and `--clear-tags` cannot be combined. Hub trims names and tags,
deduplicates tags, and removes empty tags. Output uses the updated metadata
returned by Hub. Existing ownership checks apply, and open Hub views receive
the metadata change notification.

## Command reference

Every command, generated from the CLI itself. Workflow IDs, models and weights come
from your Hub, so the commands take them as options rather than listing them here.

<!-- BEGIN COMMAND REFERENCE: generated by `task docs:commands` from the CLI. Do not edit. -->

### `login`

Log in to a Hub instance or inspect the current login session.

| Command | Description |
| --- | --- |
| `apheris-foundry login` | Log in to a Hub instance or inspect the current login session. |
| `apheris-foundry login status` | Show whether you're logged in, to which Hub and as whom. |

### `workflows`

List, inspect, and run Foundry workflow definitions.

| Command | Description |
| --- | --- |
| `apheris-foundry workflows list` | List Foundry workflow definitions exposed by Hub. |
| `apheris-foundry workflows get` | Inspect one Foundry workflow definition. |
| `apheris-foundry workflows models` | List the models and weights a Foundry workflow accepts, with defaults. |
| `apheris-foundry workflows graph` | Show a Foundry workflow graph served by Hub. |
| `apheris-foundry workflows docs` | Read the documentation that a Foundry workflow's package ships. |
| `apheris-foundry workflows run` | Submit any Foundry workflow exposed by Hub. |

### `jobs`

Manage submitted Foundry jobs.

| Command | Description |
| --- | --- |
| `apheris-foundry jobs list` | List jobs. |
| `apheris-foundry jobs get` | Inspect a submitted Foundry job, including workflow warnings and available files. |
| `apheris-foundry jobs update` | Edit metadata in any job status. |
| `apheris-foundry jobs logs` | Print logs for a Foundry job. |
| `apheris-foundry jobs download` | Download results for a completed Foundry job. |
| `apheris-foundry jobs error` | Print the saved error for a failed Foundry job. |
| `apheris-foundry jobs cancel` | Cancel a pending or running Foundry job. |
| `apheris-foundry jobs delete` | Permanently delete a terminal Foundry job and its files. |

### `skills`

List and install CLI skills or workflow skills from the active Hub.

| Command | Description |
| --- | --- |
| `apheris-foundry skills list` | List CLI and active Hub workflow skills together. |
| `apheris-foundry skills show` | Display a bundled skill by name or a workflow skill from Hub. |
| `apheris-foundry skills install` | Install CLI skills or a Hub workflow skill into an agent's discovery directory. |

### `docs`

Read private release notes, known issues and guides from your Hub.

| Command | Description |
| --- | --- |
| `apheris-foundry docs list` | List the private documents available on the selected Hub. |
| `apheris-foundry docs show` | Read a document path from 'docs list'. |

### `settings`

Manage settings shared with the Hub UI.

| Command | Description |
| --- | --- |
| `apheris-foundry settings msa list` | List configured MSA servers and mark the active selection. |
| `apheris-foundry settings msa select` | Save an MSA server selection for this Hub, shared with the UI. |
| `apheris-foundry settings msa disable` | Disable automatic MSA for this Hub, shared with the UI. |

### `weights`

Enable, import, inspect, label, share and delete model weights.

| Command | Description |
| --- | --- |
| `apheris-foundry weights models` | List models and versions available for importing external checkpoints. |
| `apheris-foundry weights import` | Import an external checkpoint without a producing job; does not run prediction or certify compatibility. |
| `apheris-foundry weights list` | List your weights and weights shared with you. |
| `apheris-foundry weights get` | Inspect one of your weights or a weight shared with you. |
| `apheris-foundry weights enable` | Enable weights from a job artifact in Hub's weight catalog; this does not run prediction. |
| `apheris-foundry weights update` | Rename or relabel one of your active weights. |
| `apheris-foundry weights delete` | Delete one of your weights, which also stops sharing it. |

### `tools`

Utilities for preparing scientific inputs.

| Command | Description |
| --- | --- |
| `apheris-foundry tools compounds resolve` | Resolve one public name or CID. |

### Other commands

| Command | Description |
| --- | --- |
| `apheris-foundry logout` | Log out of the current Hub session. |

<!-- END COMMAND REFERENCE -->

Use `--help` on any command for the full option reference and examples:

```bash
apheris-foundry workflows run --help
apheris-foundry jobs get --help
```

`--name` optionally names the run. Omitted or blank names submit an unnamed run.

With `--json`, stdout contains only one JSON document; prompts, notices and
errors go to stderr. `workflows run --wait --json` prints nothing until the job
finishes. See [JSON output for scripts and agents](docs/usage.md#json-output-for-scripts-and-agents).

### Choosing how to pass settings

Workflow instructions describe the configuration and its meaning; the CLI maps
that configuration to submission options:

| Configuration | CLI option | Where to find accepted values |
| --- | --- | --- |
| Model and weight selection | `--model <id> --weight <version-or-enabled-id>` | `workflows models --workflow <id> --json` |
| Several enabled weights, one per weight parameter | `--<param> <enabled-weight-id>` | `workflows get --workflow <id>` lists the weight parameters |
| Top-level workflow setting | Repeat `--param name=value` | `workflows get --workflow <id> --json` and the workflow docs |
| Model-parameter object, when the workflow supports it | `--model-params '<JSON object>'` or `--model-params @file.json` / `@file.yaml` | The selected task's parameter schema and workflow restrictions |
| Input data or a workflow-specific configuration file | `--input <file-or-folder>` | The workflow's input contract and preparation instructions |

Read `workflows docs --workflow <id>` and the workflow skill for supported model
parameters, restrictions and defaults. Model parameters configure how the model
runs and which outputs it writes. In model discovery, `modelParamsTask` identifies the entry in
`schemas.tasks[]` whose `parameters` defines field types, enums and constraints. A task
schema can include fields controlled by the workflow or unsupported by that
workflow; it is not a promise that every field works as a model override.
The same model can support different overrides in different workflows.

`--model-params` accepts an inline JSON object or a JSON/YAML parameter file.
Use an inline object for short overrides, or prefix a `.json`, `.yaml` or `.yml`
filename with `@` to load the object from that file. The CLI retrieves the
selected model and validates the object against its parameter schema before
submission. Hub validates declared task-parameter objects before staging a run;
the workflow also enforces its implementation restrictions. Keep exact field
names and JSON types, such as `true` rather than `"true"`, and pass only intended
overrides. Task-schema defaults can differ from workflow defaults, so do not
copy every schema default into the object.

Model task schemas retain their required fields. Hub's `modelParamsSuppliedFields`
identifies the fields supplied by the workflow; only those may be omitted despite
being required by the task. A workflow whose model needs a parameter, such as a
training step count, says so in its documentation. Hub also checks required
fields when the whole model parameter object is omitted.

A run can combine a workflow setting with model parameters. The workflow's
documentation says which of its values is which:

```bash
apheris-foundry workflows run --workflow <workflow-id> --input <input> \
  --model <model-id> \
  --param <setting>=<value> \
  --model-params '{"<field>": <value>}'
```

Check that the deployed workflow supports these fields before submission.
Do not flatten a model field into `--param <field>=<value>`, pass raw
`--param modelParams=...`, or translate an uploaded config file's keys into
flags. Use the route the selected workflow documents; `--help` describes the
installed CLI syntax.

### YAML model parameters

A `model-params.yaml` file holds the same object as the inline JSON, one field
per line, with the field names from the model's parameter schema:

```yaml
<field>: <value>
<list-field>: [<value>, <value>]
```

Files must be UTF-8 and no larger than 8 MiB, with fewer than 50 nesting levels.
Duplicate keys, aliases, explicit YAML tags, multiple documents and non-finite
numbers are rejected. Scalars use JSON spellings; `on` and dates stay strings.
Inline values and files without a `.yaml`/`.yml` extension must use JSON syntax.
Workflow inputs are uploaded unchanged; YAML manifest support depends on the
workflow package deployed in Hub.

## License

This package is licensed under the [Apheris Foundry Software License](https://www.apheris.com/docs/hub/hub-license.html). The full license text is also included in every published wheel as `LICENSE`.

## Support

Contact [support@apheris.com](mailto:support@apheris.com) for access and deployment assistance.


### Model weights (`weights`)

`weights` manages weights enabled from completed jobs or imported from local files: enable, import, list, inspect,
rename or relabel, share and delete. Every command accepts `--json`, which
prints Hub's response unchanged.

```sh
# 1. Enable weights from a job artifact (private by default)
apheris-foundry weights enable --name <unique-name> --run-id <job-id> --path <run-relative-bundle-directory> --tag trial --json
# 2. Label or rename it; --tag replaces the whole tag set, --clear-tags removes it
apheris-foundry weights update --id <weight-id> --tag trial --tag benchmark --name <new-name>
# 3. Find and inspect it
apheris-foundry weights list --model <model-id> --version <model-version> --tag benchmark
apheris-foundry weights get --id <weight-id>
# 4. Use it
apheris-foundry workflows models --workflow <workflow-id> --json
apheris-foundry workflows run --workflow <workflow-id> --input ./input --weight <weight-id>
# 5. Retire it (also stops sharing it)
apheris-foundry weights delete --id <weight-id> --yes
apheris-foundry weights delete --id <weight-id> --delete-files --yes
```

`weights enable` matches the UI’s “Enable weights” action and replaces
`weights deploy`. Update existing scripts to use `weights enable`; the old
command is no longer supported. The Hub API endpoint remains `/api/v1/weights/deploy`.

`weights list` lists your weights plus weights other users shared. Filter with
`--run-id`, `--model`, `--version`, `--task` or repeated `--tag` (a weight must
carry every tag). `--model` and `--version` together also include the model's
built-in vendor weights. Hub returns every match in a single response, so there
is no pagination. The table shows ID, name, model, version, tags, owner and
status: `private`, `shared`, `built-in` or `deleted`. `weights get` and `--json`
report visibility (`isPublic`) and deletion (`isDeleted`) separately.
`--include-deleted` adds your deleted records; they cannot be selected.
`weights get --id` shows one weight in full, including its producing job,
lineage and who shared it when.

`weights enable` registers a job artifact through Hub; it does not upload local
weights or start prediction. `--name` is required: use an instance-wide unique
name of 1–255 characters after trimming whitespace, without control characters.
Names are case-sensitive and must be unique among active weights; deleting a
weight frees its name. `--description`
is separate metadata and does not replace the name. Use the path shown by
`jobs get`, including the complete directory when the weights are a bundle of files. Optional
`--task`, `--description`, `--derived-from`, repeated `--capability` and
repeated `--tag` values accompany the request; Hub derives and validates model
identity and ownership. `--dry-run true weights enable ...` prints the request
without submission. Verify selection in the target workflow's model catalog
before reuse.

Enabling weights can take several minutes while Hub copies and verifies large
checkpoints. The HTTP timeout defaults to 300 seconds; use `--timeout 1800` to
allow 30 minutes, or another positive integer number of seconds (minimum: 1).
This setting applies only to the enable request and cannot override a shorter server or
network timeout. If the outcome is uncertain, check `weights list --run-id`
before retrying; the CLI does not automatically retry the write.

#### Import external checkpoints

Start by listing the models and versions that the connected Hub accepts for import:

```sh
apheris-foundry weights models
```

It prints one row per model version that accepts a checkpoint:

```text
MODEL        VERSION          LABEL
<model-id>   <model-version>  <label>
```

Copy `MODEL` into `--model` and `VERSION` into `--version` from the same row.
The version identifies the installed model build that will consume the checkpoint;
it is not a name for your checkpoint or the Hub release number. Use `--name` to name
your imported weights. You may omit `--version` when that model has exactly one
available version. If it has several, the CLI lists the choices and requires an
explicit `--version` before uploading.

With the values from one row:

```sh
# Raw checkpoint, with an explicit model version
apheris-foundry weights import --name kinase-ft --model <model-id> --version <model-version> --checkpoint ./model.pt

# Short form: only valid when the model has exactly one available version
apheris-foundry weights import --name kinase-ft --model <model-id> --checkpoint ./model.pt

# ZIP: select weights/model.pt after removing the archive's common root directory
apheris-foundry weights import --name kinase-bundle --model <model-id> --version <model-version> --archive ./weights.zip --checkpoint-path weights/model.pt --strip-archive-root
```

For scripts and agents, `weights models --json` returns the Hub's
catalog: `models[].id` supplies `--model`; that model's `targets[].version`
supplies `--version`; `targets[].label` is display text, not an accepted identifier.
Discovery does not upload anything and cannot be combined with import arguments.
Use the import catalog rather than `weights list`, which lists registered weights.

After a successful import, use the returned weight ID:

```sh
apheris-foundry weights get --id <returned-weight-id>
apheris-foundry workflows models --workflow <workflow-id> --json
apheris-foundry workflows run --workflow <workflow-id> --input ./input --weight <returned-weight-id>
```

Discovery and registration do not verify scientific compatibility. No producing
job, run ID, task or caller-supplied capabilities are needed. Hub derives
capabilities from the selected model version.

Use exactly one of `--checkpoint` or `--archive`. For ZIPs, `--checkpoint-path`
selects a file or directory; `.` selects the entire bundle. With
`--strip-archive-root`, the path is relative to the normalized archive after its
common root directory is removed. These two flags apply only to ZIPs. Local
directories and URLs are not accepted. The CLI checks ZIP metadata without
extracting files: it sums declared uncompressed sizes and confirms the selected
path exists. OS metadata such as `__MACOSX` and `.DS_Store` is ignored; ordinary
hidden companion files count. A single root folder is stripped only when every
retained file is nested under it. Empty directory entries do not create selectable
directories. A raw `--checkpoint` is not inspected as an archive, even when its
format internally uses ZIP (for example, a PyTorch checkpoint).

Imports accept repeated `--tag`, `--description` and `--public/--private`. On
authenticated Hubs, imports are private by default and visibility is fixed at
registration. On a Hub with authentication disabled, `--public` fails before
upload; omit it. Private/shared controls provide no privacy isolation there,
including with `--private`. Human import output shows `no auth`; JSON preserves
the Hub's `isPublic` field without redefining it.

`--dry-run true weights import ...` checks availability, target and local input,
including the same ZIP metadata checks, and previews without uploading or
registering anything. Every import uses a live preflight; it does not trust cached
availability to submit an upload. Real imports inspect ZIP metadata once on the
opened file before each upload attempt, including an authentication retry.

Uploads stream with bounded memory. The payload limit comes from
`weights models` (`maxUploadBytes`, normally 10 GiB); both the uploaded file and
the aggregate declared expanded ZIP size must independently fit that limit.
Selecting one checkpoint does not exclude companion files from the total.
The CLI also limits ZIP metadata reads to 8 MiB to bound local preflight resources.
If that budget is exceeded, repackage with fewer entries or shorter names/comments.
This is a separate CLI resource limit, not Hub's upload limit. Hub remains
responsible for actual expanded-byte limits, checksums, extraction safety and
storage capacity; a successful dry-run does not guarantee registration or
scientific compatibility.
`--timeout` defaults to 300 seconds and accepts a positive integer. Interactive
progress goes to stderr and is disabled for `--json` and `--quiet true`.
Reaching 100% uploaded is not success: the CLI waits for Hub to confirm
registration with HTTP 201 and the created weight ID. If the connection is lost
or the response is ambiguous, check `weights list --json` before retrying. Uploads
are not resumed or automatically replayed after these failures; an explicit 401
may refresh authentication once and restart the upload.

**Availability and offline help.** The CLI uses endpoint capabilities, not a
comparison of CLI and Hub release numbers. Successful discovery makes the `models` and `import`
commands visible in `weights --help` and shell completion. A 404 (older Hub or
disabled feature) hides them; directly invoking either command still checks the
Hub and explains how to resolve unavailability. Authentication, network, server
and malformed-response errors are distinct from confirmed lack of support.
An empty model list means import is supported but no eligible target is available.

Help, completion and `apheris-foundry --version` never make discovery requests. Help uses a
five-minute capability cache bound to the current Hub configuration and session;
switching either invalidates the result. Before discovery or after expiry,
`weights models` and `weights import` are hidden and help explains that availability is unknown. Run
`weights models` to refresh, including after enabling the feature or
upgrading Hub. An unwritable cache does not block imports.

#### Sharing and deletion

**Sharing.** Enabled and imported weights are private by default. `--public` shares a weight with every
authenticated user of this Hub; they can list, inspect and run with it, but only
the owner can update or delete it. Hub fixes visibility when enabling: to stop
sharing a weight, delete it, and enable under a new name if you still need a
private copy. Mutating a weight you do not own fails with "Only the owner can
update or delete a weight".

**Deletion.** `weights delete --id` asks for confirmation; pass `--yes` in
scripts. By default, deletion is a soft delete: new jobs can no longer select
the weight, jobs already using it keep running, and checkpoint files remain.
Its name can be reused. Add `--delete-files` to permanently remove managed
checkpoint files as well; the record and provenance remain. This also works
on an already soft-deleted weight, and repeating either delete is safe.
If active jobs use the weight, Hub soft-deletes it but refuses file removal
with HTTP 409. The CLI exits with precondition code 4 and explains that files
remain; retry after the jobs finish. JSON success reports `cleanup: "removed"`
when deleting files and `cleanup: "deferred"` for soft deletion; deferred
cleanup requires an explicit `--delete-files` request.

Hub copies enabled checkpoints into independent storage, so deleting the
producing job (`jobs delete`) retains its enabled weights, including shared
ones.
`--dry-run true` previews `update` and `delete` after reading the current
record. The delete preview includes `deleteFiles`; it does not check active
jobs or remove files.

Use a CLI release that supports `weights enable --name`. Upgrade if this
command is unavailable; adding `--description` does not replace the required
weight name.

Workflows that read several models in one run list weight parameters in
`workflows get --workflow <workflow-id>` (`weightParams` in `--json`): each
names the task it feeds and the model a weight must have been produced by.
Bind one enabled weight to each with an option named like the parameter, the
same name a toolkit-only run passes a path to:

```bash
apheris-foundry workflows run --workflow <workflow-id> --input <input> \
  --<weight-param> <weight-id> --<other-weight-param> <weight-id>
```

Hub checks that you may use each weight and that it was produced by the
task's model, mounts it read-only in that task's pods and records it on the
run's task. A bare `--weight <id>` keeps selecting one weight as before; it
can't be combined with weight options, nor can `--model`. A Hub that predates
weight parameters lists none, and the CLI refuses the options rather than
submit a run that would ignore them.

Some workflows take a checkpoint file directly as part of their input instead
of an enabled weight. Read the workflow's documentation and skill before
enabling weights: they say which file to upload and under which name. That route
does not need `weights enable` or `--weight`. Report prediction
submission/completion separately from weight registration.

Workflow skill responses may include shared presentation skills. Installation
validates their content digests and installs them alongside the workflow skill;
`--all` deduplicates equal versions and rejects conflicting ones. Hub serves
these with the workflow skill; they aren't part of this Python package.

The optional skill `resources` field currently carries only `vocabulary.json`.
The CLI checks its name, UTF-8 byte limit, SHA-256 and JSON syntax before writing
it beside the workflow SKILL.md. A malformed resource prevents installation.
Older Hubs omit resources; workflow skills that use one then say that the
vocabulary check is unavailable rather than claiming it was done.

### Public compound resolution (no Hub required)

```sh
apheris-foundry tools compounds resolve --name gemcitabine --json
apheris-foundry tools compounds resolve --cid 60750 --json
apheris-foundry tools compounds resolve --cid 60750 --offline --json
```

Resolves exact PubChem records with isomeric SMILES, InChIKey, source and timestamp.
Only public names/CIDs should be sent; supplied proprietary structures need no public lookup.
Ambiguous matches stop for clarification. No automatic parent/salt substitution.
Responses are cached locally for 30 days; offline use marks stale entries. Use
`--refresh` for fresh evidence or `--cache-dir` to isolate a project cache.
The shared chemical-identity and foundry-scientific-integrity skills also work
without Hub through documented official APIs.

Without `--output`, `jobs download` extracts into `./job_<job-id>_results/`
in the current directory, matching the FCP CLI naming convention, and
`--artifact-id` saves the file under
`./job_<job-id>_results/artifacts/`. The CLI prints the absolute path and
refuses to write into a non-empty directory unless `--overwrite=true` is set.
CLI versions up to 2.7.0 used the hidden `./.apherisfold/runs/foundry-results/`
directory; those files stay there.

`jobs download` preserves the workflow's `result.json`; the CLI's download
manifest is `cli-result.json`. A conflicting artifact with that name is rejected
rather than overwritten. `--result-view` controls that CLI manifest's detail.

### Querying jobs

Find jobs by name, ID, or tag:

```sh
apheris-foundry jobs list --search 'screen_1'
apheris-foundry jobs list --workflow <workflow-id> --status succeeded --limit 10
```

Search is literal (no wildcards). Workflow and status filters can be repeated.
The default shows up to 30 jobs; use `--limit -1` only when you need all matches.
Add `--json` for scripts: `total` counts all matches, and `incomplete` indicates
that fewer rows were returned.

See [the usage guide](docs/usage.md#find-jobs)
for model, date, duration, and sorting options, which are hidden from default help.

### Research previews

Workflow and model listings mark early releases as **Research preview**. Workflow
and model details use this explanation:

> An early-access workflow, released so you can try it before it has been fully tested. You may run into issues. Your feedback helps us improve it.

Running a preview prints the same explanation to stderr, so stdout remains
machine-readable: in a yellow **Research Preview** panel, or as one plain line
with `--json`. The Hub's `researchPreview` boolean
is preserved in workflow/model JSON output; missing or false shows no label.
CLI-only access and preview status are independent.
Workflow discovery shows Hub's categories, tags, and UI mode. Local dry-runs do
not fetch preview metadata or print a preview notice.
