Skip to main content

sp

The Spare Parts command line.

pip install ".[anthropic]"     # or [openai], or [gemini], or [all]
sp

Modules

Module What it does
sp ec Install engineering-context commands for coding agents
sp ingest Enrich GitHub issue events into Core ingestion records
sp lgtm Prove you read a diff before you merge it
sp plugin Discover and install Spare Parts agent plugins

sp ec

Installs engineering-context slash commands and their shared .sp/ working area into a repo.

sp ec install                    # auto-detect the coding agent
sp ec install --agent codex
sp ec install --agent claude
sp ec install --all
sp ec install --dir path/to/repo

When --dir is a folder of git repos, each repo gets its own commands and .sp/ area. The workspace root gets the cross-repo /huddle command and a workspace constitution, but no pooled repo scaffold.

The installer appends ignore rules for generated .sp state and templates, while keeping .sp/memory/constitution.md trackable. Blanket .sp/ ignores are left untouched and reported as warnings.

Codex commands are installed as repository skills under .agents/skills/<command>/SKILL.md. Codex is auto-detected from AGENTS.md, .agents/, or .codex/ in the target repository.

Guided integration setup

Run diagnostics after installation:

sp ec doctor
sp ec project setup

doctor reports the configured huddle store, GitHub CLI authentication, and whether a Linear MCP configuration or LINEAR_API_KEY is visible. Every missing capability includes the command or configuration needed to fix it.

Setup can also be scripted:

sp ec project setup --provider github --url https://github.com/orgs/example/projects/1
sp ec project setup --provider linear --url https://linear.app/example --team Engineering --transport mcp

GitHub Projects huddle store

Configure a workspace-level GitHub Project, then check access or synchronize a huddle manually:

sp ec project configure https://github.com/orgs/example/projects/1 --dir ..
sp ec project status --dir ..
sp ec project sync ../.sp/huddles/001-example/huddle.md --dry-run
sp ec project sync ../.sp/huddles/001-example/huddle.md

/huddle prefers installed GitHub MCP tools capable of managing Projects. It falls back to gh project through sp ec project sync. Each draft item carries a stable huddle-path marker, so later syncs update it instead of creating a duplicate. Markdown remains authoritative when remote synchronization fails.

Spare Parts workspace sync

Configure a workspace once at the workspace root. The ingest key stays in the environment and is never written to .sp/integrations.json:

sp ec workspace configure --workspace workspace_...
export SPAREPARTS_INGEST_KEY=sp_...
sp ec workspace sync .sp/huddles/001-example/huddle.md
sp ec workspace sync --all

Download every huddle available to the configured workspace. Existing local files are preserved unless --force is passed:

export SPAREPARTS_READ_KEY=sp_...
sp ec workspace pull
sp ec workspace pull --force

Every revision includes the repository, branch, commit, dirty state, and the name/email resolved from git config user.name and git config user.email. Git identity is recorded as unverified until user login is introduced.

To record when artifacts reach main, run reconciliation from CI after every main-branch push:

on:
  push:
    branches: [main]
steps:
  - uses: actions/checkout@v7
    with:
      fetch-depth: 0
  - run: pipx install spareparts-cli
  - run: sp ec workspace reconcile --ref "$GITHUB_SHA" --dir .
    env:
      SPAREPARTS_INGEST_KEY: ${{ secrets.SPAREPARTS_INGEST_KEY }}

The local Markdown remains authoritative if synchronization fails. Repeated sync and reconciliation calls are idempotent.


sp ingest

Processes one GitHub issues event file, builds or reuses the organization's repository ontology, asks one configured model which catalog repositories are affected, gathers bounded pull-request approval evidence, and submits the safe, idempotent result to Core:

export GITHUB_TOKEN=...
export SPAREPARTS_INGEST_KEY=...
export OPENAI_API_KEY=... # or ANTHROPIC_API_KEY / GEMINI_API_KEY

sp ingest issue "$GITHUB_EVENT_PATH" \
  --provider openai:gpt-5.5 \
  --core-url "$SP_CORE_URL" \
  --delivery-id "$GITHUB_DELIVERY_ID"

--model overrides the model in vendor:model. Exactly one provider is used. Model, GitHub, and Core ingest keys are read from runtime environment variables only; they are never written to configuration, stdout, or Core records. The command only reads GitHub and submits ingestion evidence. It does not assign users, change issues, start builds, or update Project fields.


sp plugin

Lists and installs the immutable plugin versions pinned by this sp release:

sp plugin list
sp plugin install lgtm
sp plugin install lgtm --refresh
sp plugin install lgtm --agent claude --dir path/to/repo
sp plugin install lgtm --agent cursor --agent gemini
sp plugin install lgtm --all --dir path/to/repo

Installation downloads the official archive and verifies its pinned SHA-256 digest. Use --agent for one or more project-native targets, or --all for the complete matrix supported by sp ec install: claude, codex, cursor, copilot, gemini, and opencode. Existing files are preserved unless --force is passed. Start a new session in each selected agent afterward.

The archive contains one canonical, agent-neutral LGTM command. The CLI renders only the destination wrapper required by each selected agent; it does not carry separate behavior for every vendor. Installation does not add a Git hook, edit memory or instruction files, or create a preference. The separate sp lgtm install command manages the optional local Git hook.

For backward compatibility, the command without --agent or --all uses the Codex marketplace adapter and installs lgtm@sparepartslabs. --refresh downloads and verifies that same pinned version. Explicit Codex mode instead writes .agents/skills/lgtm/SKILL.md like the other project-native adapters.


sp lgtm

Generates a few multiple-choice questions about a range of commits and asks them, in your terminal. The questions are about what the change does — what a new guard prevents, what the error path now returns, which edit can touch existing rows — never about statistics, naming, or formatting.

sp lgtm                       # what this branch adds since it left main
sp lgtm main...feature/x      # someone else's branch, before you merge it
sp lgtm -n 3 -d hard
sp lgtm --dry-run             # what it would ask about, no model call

Generation is three model calls, so expect it to take a moment — this is a thing you run before a merge, not on every commit.

Providers

Anthropic, OpenAI and Gemini, and no vendor is the assumed one. Install the SDK for whichever you use:

pip install ".[anthropic]"     # or [openai], or [gemini], or [all]

Name nobody and sp uses whichever key you have set. With more than one set it picks in the order below, which is a tie-break rather than a ranking; name provider: in .github/lgtm.yml to decide it yourself.

Vendor Key Default model Typical run
anthropic ANTHROPIC_API_KEY claude-opus-5 ~55s
openai OPENAI_API_KEY gpt-5.5 ~65s
gemini GEMINI_API_KEY or GOOGLE_API_KEY gemini-pro-latest ~115s
sp lgtm -p openai
sp lgtm -p gemini --model gemini-3.6-flash
sp lgtm -p anthropic --verifier openai     # see below

All three are exercised against live APIs, on a 32KB diff, and the timings above are from those runs.

The defaults were chosen by listing each vendor's models with a live key. Gemini uses the tracking alias because the vendor currently publishes no plain gemini-3.x-pro — only -image variants — so pinning a pro model would mean pinning to 2.5 indefinitely. The other two pin, because a default that changes underneath a quiz changes what the quiz asks.

Two vendors are better than one

sp lgtm writes a question with one call and then asks a second call to refute it. A candidate that can't be refuted survives; everything else is dropped.

Both calls going to the same model is the weak version of that check — a model asked to find fault with its own reasoning mostly doesn't. If you have keys for two vendors, split them:

sp lgtm --provider anthropic --verifier openai

That is the strongest arrangement available, and it is why the provider layer exists rather than a bare --model flag. It costs one extra vendor's tokens and nothing else — the verifier sees the question and the diff, never the proposer's reasoning.

It also costs no extra wall-clock in practice: proposing and verifying are sequential either way, and the cross-vendor run above came in at 68s against 55s for Anthropic alone.

It is a self-check, not a gate

sp lgtm has no way to stop you doing anything. The answers live in the same process as the questions, on your machine, and you can skip the whole thing. That is on purpose: the version that actually gates is the GitHub Action, which asks the reviewer after they approve and holds a check run open until they answer.

What local gets in exchange is the thing the Action can't have: the code is checked out. Press ? on any question to print the hunk it came from. Wrong answers are never a failure — you get told which files to look at again, and it re-asks, as many times as you like.

Configuration

Reads .github/lgtm.yml from the repo you're in, the same file the Action uses, so a repo is configured once:

questions: 2          # 1-5
difficulty: medium    # easy | medium | hard
provider: anthropic   # anthropic | openai | gemini, or vendor:model
verifier: openai      # optional; defaults to the proposer
exemptPaths:
  - "docs/**"

provider and verifier are read here but validated by the provider layer, so a typo is reported with the list of known vendors rather than silently ignored.

Keys that only mean something to the Action (enforce, webConcepts, surfaceReading, answerQuestions, exemptReviewers) are accepted and ignored. -n and -d override the file.

Lockfiles, dist/, vendor/, *.pbxproj and friends are never quizzed.

As a git hook

sp lgtm install                       # pre-push, advisory
sp lgtm install --hook pre-commit     # earlier, and once per commit
sp lgtm install --blocking            # wrong answers stop the push
sp lgtm uninstall

pre-push is the default. The old framing for this tool was "the person answering didn't write the code" — that's why it quizzes a reviewer. That framing is dated: when a model wrote the diff, nobody in the loop wrote it, and the author is as much a reader as anyone. The useful question isn't who typed it, it's where the last cheap moment to catch it is — and that's before the code leaves your machine, which is left of anything the Action can do.

It also matches how the cost lands. Generation is three model calls and about a minute; per push that's fine, per commit it taxes every checkpoint you save. --hook pre-commit is there if you want it, and quizzes the staged diff.

Advisory by default. A hook that costs a minute and can stop you is one you delete within a week. --blocking is opt-in, and even then only a wrong answer (exit 1) blocks — "couldn't ask" (exit 2: no API key, vendor outage, nothing quizzable) never costs you a push.

Escape hatches, in the order you'll want them:

SP_LGTM_SKIP=1 git push ...    # skip this once
git push --no-verify ...       # skip every hook

What it reads

pre-push quizzes exactly what you're about to push. Git names the refs on stdin, so the hook takes <remote sha>..<local sha> — the commits the remote doesn't have yet. A branch the remote has never seen has no such range, so it falls back to what the branch adds since it left the default branch. A push that only deletes a remote branch reads nothing at all.

That ref list arrives on the same stdin the quiz needs for answers, so the hook consumes it before attaching /dev/tty.

It skips itself silently when there's no terminal — a rebase, a GUI client, CI. Git runs hooks with stdin closed; where there's no tty, nobody can answer and nobody failed.

sp lgtm install refuses to overwrite a hook it didn't write (--force overrides), and honours core.hooksPath — writing to an assumed .git/hooks when that's set installs a hook that never runs, which looks exactly like success.

Exit codes

Code Meaning
0 Confirmed
1 Not confirmed — wrong answers, or you quit
2 Couldn't ask — no API key, git failed, nothing quizzable

If you wire this into a git hook, treat only 1 as a failure. A tool that cannot run must not block a commit.

Development

python3 -m venv .venv && .venv/bin/pip install -e ".[dev]"
.venv/bin/python -m pytest

lgtm's diff parsing, config, screening and generator are a port of the TypeScript in spareparts-lgtm. The prompts in generator.py are the part worth keeping identical — changing the wording here without changing it there produces two tools that disagree about the same diff.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spareparts_cli-0.8.1.tar.gz (181.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spareparts_cli-0.8.1-py3-none-any.whl (138.7 kB view details)

Uploaded Python 3

File details

Details for the file spareparts_cli-0.8.1.tar.gz.

File metadata

  • Download URL: spareparts_cli-0.8.1.tar.gz
  • Upload date:
  • Size: 181.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for spareparts_cli-0.8.1.tar.gz
Algorithm Hash digest
SHA256 e88a79db44c79c8adf84af67d1dfb1352976c805184a689572d8e6783032ca72
MD5 6bcb7efcf6cda57876829869138338a2
BLAKE2b-256 31d9f0e5a2917a7f5a67db01ff689c315df780e800282d64aeda7ae3766940e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for spareparts_cli-0.8.1.tar.gz:

Publisher: publish.yml on sparepartslabs/spareparts-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spareparts_cli-0.8.1-py3-none-any.whl.

File metadata

  • Download URL: spareparts_cli-0.8.1-py3-none-any.whl
  • Upload date:
  • Size: 138.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for spareparts_cli-0.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2b1d8f52d463e3d57b1d7a8c968eb5813869f91561de6ba7a3991c3b6870e93a
MD5 837d7673e6d6da6d7a9becc4a1b2e45c
BLAKE2b-256 12fa727e3229436ac6ad4a1309830f4fc419e2027e426d17977bd0eefe268ed0

See more details on using hashes here.

Provenance

The following attestation bundles were made for spareparts_cli-0.8.1-py3-none-any.whl:

Publisher: publish.yml on sparepartslabs/spareparts-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.28.0

2 files

0.27.0

2 files

0.26.0

2 files

0.25.0

2 files

0.24.1

2 files

0.24.0

2 files

0.23.0

2 files

0.22.0

2 files

0.21.0

2 files

0.20.0

2 files

0.19.0

2 files

0.18.3

2 files

0.18.2

2 files

0.18.1

2 files

0.18.0

2 files

0.17.0

2 files

0.16.0

2 files

0.15.0

2 files

0.14.1

2 files

0.14.0

2 files

0.13.3

2 files

0.13.2

2 files

0.13.1

2 files

0.13.0

2 files

0.12.3

2 files

0.12.2

2 files

0.12.1

2 files

0.12.0

2 files

0.11.1

2 files

0.11.0

2 files

0.10.0

2 files

0.9.0

2 files

This release

0.8.1 This release

2 files

0.8.0

2 files

0.7.0

2 files

0.6.0

2 files

0.5.3

2 files

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.1

2 files

0.4.0

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.0

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page