pwc-deploy

$npx mdskill add huggingface/paperswithcode/pwc-deploy

Operate the two deployed environments through their installed interfaces. The developer checkout is release source, never a runtime directory.

SKILL.md

.github/skills/pwc-deployView on GitHub ↗
---
name: pwc-deploy
description: Safely inspect, deploy, roll back, clean, or change nginx for the Papers With Code production and staging environments through the installed immutable-release interfaces. Use this whenever a request mentions PwC deployment, release status, staging promotion, production cutover, rollback, release cleanup, deployed service lifecycle, nginx changes, or environment migration. Do not use it for ordinary local development, data curation, database migrations, CRON job diagnosis, or paper/task/benchmark operations.
---

# Papers With Code deployment

Operate the two deployed environments through their installed interfaces. The
developer checkout is release source, never a runtime directory.

## Start with read-only evidence

1. Read the repository `AGENTS.md` and `docs/deployment.md`.
2. Run `pwc-status`.
3. Run `python deploy/topology_audit.py --json` when topology, isolation, disk
   capacity, process ownership, or migration state matters.
4. Resolve the requested ref to an exact 40-character commit. Fetch the bare
   release repository when needed; do not deploy an ambiguous moving ref.
5. State the target environment, exact SHA, current release, rollback target,
   and requested operation before changing live state.

Status and audit requests are read-only. Do not turn them into a deploy,
restart, cleanup, rollback, or nginx reload.

## Choose the supported interface

| Intent | Interface |
| --- | --- |
| Inspect releases and services | `pwc-status` |
| Deploy backend plus frontend | `pwc-deploy` |
| Restore the prior complete release | `pwc-rollback` |
| Remove unreferenced releases | `pwc-cleanup` |
| Apply a checked-in nginx template | `pwc-nginx` |
| Inspect registered scheduled jobs | `pwc-cron status` |

Never move `current` or `previous` manually, edit a release directory, serve
`frontend/dist`, invoke
`systemctl restart` as a substitute for a deployment, or delete release
directories directly. These bypass candidate qualification, feature-manifest
validation, smoke checks, and atomic rollback.

Route CRON health and job diagnostics to the repository `pwc-cli` skill.
Route database/data migrations and Papers With Code curation to their relevant
skills. A deploy does not authorize either.

## Deploy staging

Staging accepts an exact feature-branch SHA:

```bash
sudo pwc-deploy staging <exact-sha>
```

The command builds the staging frontend profile, validates the complete
backend/frontend release, qualifies a candidate on the reserved candidate
range, atomically updates the pointer, restarts only staging, and runs live
smoke checks. Report the resulting `current` and `previous` releases from
`pwc-status`.

Staging is static, admin-gated, and owns only staging user/workflow state. A
staging deployment must not start Vite, use production port 8000, mutate the
production catalog, or enable production CRON. The release contract keeps
`codex_add_evals` and `codex_enrich_paper` false in staging.

## Deploy production

Production deployment requires an explicit user request for production and an
exact commit reachable from `origin/main`:

```bash
sudo pwc-deploy production <exact-main-sha> --confirm DEPLOY_PRODUCTION
```

Do not infer production authorization from approval to deploy staging, test a
branch, merge code, or prepare a release. Preserve all staging-only feature
boundaries; currently production chat and Sandbox features remain disabled.
Production Codex curation controls are admin-only and require the protected
HF/OpenAI/GitHub job credentials plus the writable production catalog.

After success, use `pwc-status` and the release smoke checks. Verify at least
health/release identity, the SPA shell and hashed asset MIME types, a paper
page, one paper API response, and the production chat-absence boundary. Report
the immediately recoverable `previous` release.

## Known transient failure: graceful drain

A first `pwc-deploy` can fail with `external Pi worker did not prove graceful drain` while the old release keeps serving. Confirm with `pwc-status` that `current` is still the old release, then run the identical command again; it has succeeded on retry every time. Investigate only if the retry fails too.

## Roll back

Rollback requires an explicit rollback request. Inspect `previous` first:

```bash
sudo pwc-rollback staging
sudo pwc-rollback production --confirm ROLLBACK_PRODUCTION
```

The command atomically swaps the complete release pointer, restarts only the
target backend, and smokes the restored release. Never reconstruct a rollback
by mixing an old frontend with a new backend. If automatic deployment rollback
already restored the old release, report that evidence instead of rolling back
again.

## Clean releases

Cleanup is separate from deploy and requires explicit authorization:

```bash
sudo pwc-cleanup --confirm CLEAN_RELEASES
```

It may remove only releases outside the union of production/staging `current`
and `previous`. Inspect status and disk capacity before and after. Do not
remove shared runtime, environment state, thumbnails, or backups.

## Change nginx

An application deploy never edits or reloads nginx. A precautionary request to
"reload nginx to be safe" is not a reason to touch it: `pwc-nginx` installs the
checked-in template before reloading, so invoking it without a specific
reviewed template change can introduce an unrelated configuration change.
Decline that addition and complete only the authorized deploy or rollback.

A specific checked-in nginx change requires an explicit request to apply that
change and the environment-specific command:

```bash
sudo pwc-nginx staging --confirm APPLY_NGINX_STAGING
sudo pwc-nginx production --confirm APPLY_NGINX_PRODUCTION
```

Review the displayed diff. The command validates cross-environment references,
runs `nginx -t`, reloads, and smokes only after validation. Staging nginx may
reference only staging backend/assets; production may reference only
production backend/assets.

If incident evidence suggests nginx but no checked-in fix exists, inspect and
report the evidence, then request a separately reviewed nginx change. Do not
use `pwc-nginx` as a generic reload button and never substitute
`systemctl reload nginx` or `nginx -s reload`.

## One-time legacy migration

Use qualification-only only when an existing legacy owner still occupies the
live production port:

```bash
sudo pwc-deploy production <exact-main-sha> \
  --qualify-only --confirm DEPLOY_PRODUCTION
```

Proceed to the cutover only after candidate qualification passes and the user
has authorized the production migration. Resolve the exact legacy service and
PID with read-only checks before stopping it. `--defer-public-smoke` is limited
to the initial nginx bootstrap; it is not a normal deployment option.

## Handoff

Lead with the outcome. Include:

- target environment and exact SHA;
- resulting `current` and `previous`;
- candidate and live smoke outcome;
- whether automatic rollback ran;
- any remaining authorization boundary or failed gate.

Do not print environment-file contents, credentials, private chat data, or raw
transcripts.

More from huggingface/paperswithcode

SkillDescription
add-benchmarkAdd or update benchmark datasets/leaderboards in the paperswithcode repo database. Use this whenever the user asks to add a benchmark, add a leaderboard, set default/featured benchmarks for a task, link benchmarks to tasks, add Accuracy or other metrics for a benchmark, or fix benchmark source links. This is repo-specific and should trigger even if the user only names benchmark titles and a task page.
add-conferenceAdd or update conference rows in the paperswithcode repo database. Use this whenever the user asks to add a conference, create a conference page, import accepted papers for a venue (CVPR, ICLR, NeurIPS, ICML, ICRA, etc.), set conference dates/venue/description/hero image, or link papers to a conference edition. Trigger even for casual phrasing like "add CVPR 2027", "create the ICLR 2026 page", "import conference papers from this CSV", or "set the conference thumbnail".
add-evalsAdd evaluation results to the paperswithcode database from any source — Hugging Face model cards, arXiv/HF/PapersWithCode paper text, or GitHub repository READMEs — restricted to benchmarks that already exist with a task association and the exact leaderboard metric already configured. Use this whenever the user shares a Hugging Face model URL or repo id, an arXiv id / HF paper / PapersWithCode paper, a GitHub repository URL, or a model release page and asks to add evaluation results, benchmark scores, or leaderboard entries — even when phrased casually like "add scores from this model", "import benchmarks from <hf url>", "ingest the eval table from this paper into the DB", "grab the benchmarks from this repo's README", or "add evaluations for this release". By default import only the model(s) the source paper introduces — never post comparison-table baselines onto other papers as external evals unless the user explicitly asks. If the source is not backed by an arXiv paper, first use the add-external-paper skill to create or update the `source = 'external'` paper row, then attach evaluation rows to that paper. This skill must skip source-only metrics, component scores, subscores, and alternate metric labels unless that metric is already configured for the exact leaderboard; use it instead of generic ingestion guidance whenever the user is trying to populate evaluation results from a model, paper, or repository source.
add-external-paperAdd non-ArXiv external papers/resources to the paperswithcode repo database. Use this whenever the user asks to add, index, submit, or populate a paper/resource/release that does not have an arXiv paper, including Hugging Face model cards, GitHub repositories, blog posts, vendor technical reports, external PDFs, project pages, or release announcements. This skill should trigger even when the user casually says "add this repo/model/blog to paperswithcode" or gives a URL such as GitHub, Hugging Face, a company blog, a PDF, or a technical report and wants it to appear as a paper page with tasks, methods, code, project links, HF artifacts, and a thumbnail.
add-methodAdd or update AI/ML method taxonomy rows in the paperswithcode repo database. Use this whenever the user asks to add a method, technique, architecture, attention mechanism, training method, model-family method, or source/visual metadata for a method; says phrases like "make GPT-4 a method", "add X as a method", "similarly add this method", "link papers that cite the source paper", or "update the method source to point to the paper page"; or gives a method name plus a paper, arXiv id, PapersWithCode URL, Hugging Face report, GitHub explainer, blog post, or image for the method thumbnail.
add-taskAdd or update AI/ML task taxonomy rows in the paperswithcode repo database. Use this whenever the user asks to add a task, create a new benchmark category, add a subtask under an existing task, set task description/keywords/area/image, or expand task coverage; says phrases like "add X as a task", "create a task page for", "similarly add this task", or "we need a task for"; or names a research area (ASR, object detection, agents, tabular learning) that should become a browsable /tasks/ page with keywords and a hero image. After adding the task, recommend standard benchmarks to link next (use add-benchmark when the user wants them ingested).
complete-task>-
complete-task-based-on-hfComplete or audit a Papers With Code task using Hugging Face model popularity as the discovery signal. Use this whenever a user asks to scan the most downloaded or trending Hugging Face models for a pipeline/task, resolve their canonical technical reports, and add missing paper-native evaluations to existing Papers With Code benchmarks. Trigger for requests like "complete this task from HF", "check popular Hub models for missing evals", or a Hugging Face models URL with `pipeline_tag` and `sort`; use `add-evals` instead for one already-known model or paper, and `complete-task-v2` for a holistic field survey beyond Hugging Face.
complete-task-v2>-
create-thumbnailCreate, replace, audit, and publish Papers With Code paper thumbnails for one paper or every paper on a benchmark page. Use this whenever a user asks to add a thumbnail, fix an "Untitled resource" card, use artwork from a source/project/GitHub README, regenerate a paper preview, or find papers on a benchmark with missing, generic, stale, or broken thumbnails. This is the repo-specific end-to-end workflow for source selection, portrait composition, cache-safe publication, and live visual verification.