Getting started
Agent install
Onboard and configure copperhead using a single pasteable prompt inside your AI assistant.
Onboarding Prompt: Install and Configure copperhead
Section titled “Onboarding Prompt: Install and Configure copperhead”You are an AI coding assistant. The user has asked you to install and configure copperhead (the AI agent for KiCad PCB design) for their repository.
Follow these instructions exactly. Do not skip any steps.
1. Preamble & Instruction Gating
Section titled “1. Preamble & Instruction Gating”CRITICAL: You must ask the questionnaire in Section 2 and wait for the user’s response before running any installation or verification commands. Do not run any command in the background until the user has answered the questions.
2. Questionnaire
Section titled “2. Questionnaire”Before starting, present these three multiple-choice questions to the user.
Self-Correction/Detection: Before asking, inspect the system environment to see if any local configurations exist (e.g., check if codex is on the path, if CLAUDE_CODE_OAUTH_TOKEN is set, or if you are running inside a .cursor environment). If a backend is detected, mark it as (Recommended).
- Q1: Which model backend would you like to use?
- Option A: Existing Codex CLI login (detect if
@openai/codex-sdkis installed orcodexcommand is on PATH) - Option B: Existing Cursor Agent CLI login
- Option C: Existing Claude Code login (detect if
CLAUDE_CODE_OAUTH_TOKENis set) - Option D: Direct API Key via
ANTHROPIC_API_KEYenv var - Option E: Direct API Key via
OPENAI_API_KEYenv var - Option F: Decide later (let copperhead resolve it dynamically at runtime)
- Option A: Existing Codex CLI login (detect if
- Q2: Is this repository an existing KiCad project or a new (greenfield) project?
- Option A: Existing KiCad project (we will run
copperhead initto scaffolddocs/from your schematic) - Option B: New greenfield project (we will point you to
copperhead createand the ready-made examples)
- Option A: Existing KiCad project (we will run
- Q3: Install mode?
- Option A: Install globally via npm (
npm install -g copperhead) - Option B: Build from source (Recommended if we are currently running inside a cloned
copperheaddevelopment directory)
- Option A: Install globally via npm (
Wait for the user’s input before moving to Section 3.
3. Install and Verify
Section titled “3. Install and Verify”Once the user answers, perform the following actions:
- Install copperhead:
- Inside a copperhead checkout: If Q3 Option B is selected, run:
Terminal window npm ci && npm run build && npm link - On macOS/Linux (outside checkout): Run:
Terminal window npm install -g copperhead - On Windows (outside checkout): Run:
Terminal window npm install -g copperhead
- Inside a copperhead checkout: If Q3 Option B is selected, run:
- Verify the environment:
Run the doctor diagnostics tool to check Node, Git, KiCad, and path configurations:
Terminal window copperhead doctor - Initialize the repository (if existing KiCad project):
If Q2 Option A was selected, run:
Terminal window copperhead init - Verify the repository state:
Run the deterministic verify command (which runs ERC, DRC, doc drift, and constraint validation without calling any LLM):
Terminal window copperhead check
4. Repository Hygiene
Section titled “4. Repository Hygiene”First, check if .env or .copperhead/runs/ are already tracked by Git (e.g. by running git ls-files .env). If either is tracked, warn the user and untrack them using git rm --cached <file>.
Ensure the repository’s .gitignore contains the following lines to prevent configuration leakage and local run logs from being committed:
.env.copperhead/runs/If .gitignore exists but lacks these entries, append them. If it does not exist, create it with these entries.
5. Safety Rules (Strict Invariants)
Section titled “5. Safety Rules (Strict Invariants)”As an AI agent, you must adhere to these safety boundaries:
- Never ask the user to paste an API key directly into the chat conversation. If they need to configure a key, instruct them to set it as a system environment variable or place it in a
.envfile (which is git-ignored). - Do not run
copperhead doorcopperhead createas part of the installation process. These are mutating, LLM-backed commands. Onboarding ends atdoctorandcheck. - If a copperhead CLI command prompts you for confirmation, do not answer on the user’s behalf. Pause and let the user answer it.
- Do not echo the entire raw stdout of the installer script or npm pack. Only output short, clean summaries of the command status.
6. Final Report Format
Section titled “6. Final Report Format”End your turn with a concise 3-4 sentence response:
- Confirm the installation status of
copperhead(state if successful or if blocked by issues) and state the resolved model backend. - Summarize what
copperhead doctorreported. - Summarize what
copperhead checkreported (or what blocked it from running). - If installation or verification failed (e.g. missing
kicad-cli), do NOT suggest runningcopperhead doorcopperhead create. Instead, provide the exact steps the user should take to fix the blocker. If successful, provide the exact command the user should run next (e.g.,copperhead do "rename net..."orcopperhead create --brief brief.md).