Quark env preflight

From amd/Quark · View interactive version

Quark env preflight is an AI agent skill from the GitHub repository amd/Quark. Collect and normalize environment facts (OS, Python, GPU, CUDA/ROCm, container state) before Quark installation or PTQ planning. Use this skill whenever a downstream skill needs confirmed hardware and toolchain facts, when the user mentions their setup, when you need to decide between CUDA/ROCm/CPU

How to use this skill

Skill file

quark-env-preflight

Purpose

Collect raw environment facts and normalize them into env_context.json so that downstream skills (install, model intake, PTQ planning) can make correct decisions without guessing. This skill is the single source of truth for hardware and toolchain state — getting it wrong here cascades into wrong install commands, incompatible packages, or failed quantization runs.

Inputs

Outputs: env_context.json

Carries OS, Python, and hardware facts collected at preflight.

Schema: CODE0

{
  "environment": {
    "os": "linux",
    "python": "3.13",
    "containerized": false
  },
  "hardware": {
    "accelerator": "nvidia-cuda",
    "cuda_version": "12.6",
    "gpu_count": 1,
    "gpu_model": "RTX 4090",
    "memory_gb": 24
  }
}

env_context.json is for raw machine facts only — no installation results, no user goal, no open questions. Installed PyTorch and Quark versions live in pytorch_install_result.json and quark_install_result.json respectively. Unresolved questions belong in session_context.json (owned by quark-torch-router).

What to Detect

OS and Python

Accelerator

Existing Quark Installation

Detection Commands

# OS and Python
python --version
uname -a  # or systeminfo on Windows

# GPU detection (try both, one will fail gracefully)
nvidia-smi --query-gpu=name,memory.total,driver_version --format=csv,noheader 2>/dev/null
rocm-smi --showproductname 2>/dev/null

# Environment variables
echo $CUDA_HOME $CUDA_VISIBLE_DEVICES $ROCM_PATH $HIP_VISIBLE_DEVICES

# Existing packages
pip show amd-quark torch 2>/dev/null
python -c "import torch; print(torch.__version__, torch.version.cuda, torch.version.hip)"

Rules

Interaction Flow

  1. Intake: Ask what downstream task the user is headed toward (install? PTQ? just checking?). This determines which facts are critical vs. nice-to-have.
  2. Detect: Run the detection commands above. Present what was found in a clear summary table.
  3. Clarify: If the accelerator is ambiguous or versions are uncertain, ask the user — do not guess. Show them the conflicting evidence.
  4. Emit: Write the confirmed facts to env_context.json. Hand any unresolved items back to the caller (typically quark-torch-router) so they land in session_context.json under open_questions.

Recovery

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.