| name | pp-costco | |||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| description | Your complete Costco receipt history as data — past the website's 2-year wall, in a local database the site never gives you. Trigger phrases: `get my costco receipts`, `how far back do my costco receipts go`, `costco spend this year`, `costco receipt history past 2 years`, `export my costco purchases`, `use costco`, `run costco`. | |||||||||||||||||
| author | David Richie | |||||||||||||||||
| license | Apache-2.0 | |||||||||||||||||
| argument-hint | <command> [args] | install cli|mcp | |||||||||||||||||
| allowed-tools | Read Bash | |||||||||||||||||
| metadata |
|
This skill drives the costco-pp-cli binary. You must verify the CLI is installed before invoking any command from this skill. If it is missing, install it first:
- Install via the Printing Press installer. It defaults binaries to
$HOME/.local/binon macOS/Linux and%LOCALAPPDATA%\Programs\PrintingPress\binon Windows:npx -y @mvanhorn/printing-press-library install costco --cli-only
- Verify:
costco-pp-cli --version - Ensure the reported install directory is on
$PATHfor the agent/runtime that will invoke this skill.
If the npx install fails (no Node, offline, etc.), fall back to a direct Go install (requires Go 1.26.4 or newer). This installs into $GOPATH/bin (default $HOME/go/bin), so add that directory to $PATH instead:
go install github.com/mvanhorn/printing-press-library/library/commerce/costco/cmd/costco-pp-cli@latestIf --version reports "command not found" after install, the runtime cannot see the binary directory on $PATH. Do not proceed with skill commands until verification succeeds.
Costco's site shows receipts in 6-month chunks up to 2 years, but the backend serves more. This CLI pulls in-warehouse, gas, and online purchase history over any date range, probes how far back your account actually goes with history-depth, computes spend and item-price-history analytics on the fly, and builds a local SQLite archive (sync) for offline SQL and search.
Use this CLI when an agent or user needs Costco purchase history as structured data: pulling receipts past the 2-year UI cap, archiving line items locally, computing spend or savings totals, or tracking an item's price over time. It is read-only and member-scoped.
Do not use this CLI for:
- Do not use this CLI to place or modify Costco orders — it is read-only.
- Do not use it to browse the public product catalog or check prices for items you have not purchased.
- Do not use it for membership signup, returns processing, or any account mutation.
These capabilities aren't available in any other tool for this API.
-
history-depth— Discover how far back your Costco receipts actually go, past the website's 2-year UI cap.Reach for this to answer 'can I get receipts older than two years' — it probes the live API boundary instead of trusting the UI.
costco-pp-cli history-depth --json
-
spend— Roll up your spend by month, warehouse, or department over a date range.Use when an agent needs spend totals or trends the website never computes.
costco-pp-cli spend --by month --json
-
savings— Total the instant savings and coupons you captured over a date range.Use to quantify how much Costco deals actually saved you.
costco-pp-cli savings --since 2024-01-01 --json
-
returns-window— Flag recently purchased items still inside a return window you set.Reach for this to find what you can still return before a deadline.
costco-pp-cli returns-window --days 90 --json
-
item-history— Track one item's unit price across every receipt over time.Pick this to see whether a recurring buy has crept up in price.
costco-pp-cli item-history "rotisserie chicken" --json
This CLI uses Chrome-compatible HTTP transport for browser-facing endpoints. It does not require a resident browser process for normal API calls.
costco-pp-cli receipts— List in-warehouse, gas, and carwash receipts (--since,--until,--years,--type,--csv)costco-pp-cli receipt get <barcode>— Full line-item detail for one receiptcostco-pp-cli orders --warehouse <num>— List online costco.com orderscostco-pp-cli counts— Summarize receipt counts and spend by channel
costco-pp-cli history-depth— Probe how far back your receipts gocostco-pp-cli spend --by <month|warehouse|department>— Roll up spendcostco-pp-cli item-history <query>— Track unit price over timecostco-pp-cli savings— Total instant savings and coupons capturedcostco-pp-cli returns-window --days <n>— Items still inside a return window
costco-pp-cli sync— Fetch receipts into SQLite archive (idempotent)costco-pp-cli search <term>— Search synced line itemscostco-pp-cli sql <query>— Read-only SQL against the archive (tables:receipts,items)costco-pp-cli export— Export to JSONL or CSV (--format,--output)
costco-pp-cli doctor— Health check, token expiry, path resolutioncostco-pp-cli auth set-token— Store a Costco idTokencostco-pp-cli raw— Raw GraphQL passthrough (advanced)costco-pp-cli which <query>— Find the command for a capabilitycostco-pp-cli profile— Save and reuse named flag sets
When you know what you want to do but not which command does it, ask the CLI directly:
costco-pp-cli which "<capability in your own words>"which resolves a natural-language capability query to the best matching command from this CLI's curated feature index. Exit code 0 means at least one match; exit code 2 means no confident match — fall back to --help or use a narrower query.
costco-pp-cli history-depth --jsonSteps startDate backward and reports the earliest receipt the API will serve for your account.
costco-pp-cli receipts --since 2024-01-01 --csvFlat line-item CSV ready for budgeting tools.
costco-pp-cli receipts --since 2025-01-01 --agent --select transactionDate,warehouseName,totalReceipts list output is a flat array; --select trims each row to just the fields an agent needs.
costco-pp-cli spend --by warehouse --jsonAggregates local receipts into per-warehouse spend totals.
costco-pp-cli returns-window --days 90 --jsonLists recently bought items still inside a 90-day window from their receipt date.
Costco's receipts API uses a short-lived bearer token (idToken) that your browser stores in localStorage after login. Capture it once from DevTools (localStorage.idToken and localStorage.clientID) and set it with auth set-token; the token expires in minutes, so doctor decodes its expiry and tells you when to refresh. No cookies or password are stored.
Run costco-pp-cli doctor to verify setup.
Add --agent to any command. Expands to: --json --compact --no-input --no-color --yes.
-
Pipeable — JSON on stdout, errors on stderr
-
Filterable —
--selectkeeps a subset of fields. Dotted paths descend into nested structures; arrays traverse element-wise. Critical for keeping context small on verbose APIs:costco-pp-cli raw --query example-value --agent --select id,name,status
-
Previewable —
--dry-runshows the request without sending -
Non-interactive — never prompts, every input is a flag
-
Read-only — do not use this CLI for create, update, delete, publish, comment, upvote, invite, order, send, or other mutating requests
Agents should treat the CLI's path resolver as part of the runtime contract:
-
Use
--home <dir>for one invocation, or setCOSTCO_HOME=<dir>to relocate all four path kinds under one root. -
Use per-kind env vars only when a specific kind must diverge:
COSTCO_CONFIG_DIR,COSTCO_DATA_DIR,COSTCO_STATE_DIR,COSTCO_CACHE_DIR. -
Resolution order is per-kind env var,
--home,COSTCO_HOME, XDG (XDG_CONFIG_HOME,XDG_DATA_HOME,XDG_STATE_HOME,XDG_CACHE_HOME), then platform defaults. -
configcontains settings likeconfig.tomland profiles.datacontainscredentials.toml,data.db, cookies, and auth sidecars.statecontains persisted queries, jobs, andteach.log.cachecontains regenerable HTTP/cache files. -
Stored secrets live in
credentials.tomlunder the data dir. Existing legacyconfig.tomlsecrets are read for compatibility and leaveconfig.tomlon the first auth write. -
Run
costco-pp-cli doctor --fail-on warnto surface path and credential-location warnings.agent-contextexposes a schema v4pathsblock for agents that need the resolved dirs. -
For MCP, pass relocation through the MCP host config. The MCP binary does not inherit CLI flags:
{ "mcpServers": { "costco": { "command": "costco-pp-mcp", "env": { "COSTCO_HOME": "/srv/costco" } } } }
Fleet precedence: an inherited per-kind env var overrides an explicit --home for that kind. Use COSTCO_HOME or per-kind vars as durable fleet levers, and use --home only for a single invocation. Relocation is not reversible by unsetting env vars; move files manually before clearing COSTCO_HOME, or doctor will not find credentials left under the former root.
When you (or the agent) notice something off about this CLI, record it:
costco-pp-cli feedback "the --since flag is inclusive but docs say exclusive"
costco-pp-cli feedback --stdin < notes.txt
costco-pp-cli feedback list --json --limit 10
Entries are stored locally as feedback.jsonl under the resolved data dir. They are never POSTed unless COSTCO_FEEDBACK_ENDPOINT is set AND either --send is passed or COSTCO_FEEDBACK_AUTO_SEND=true. Default behavior is local-only.
Write what surprised you, not a bug report. Short, specific, one line: that is the part that compounds.
Every command accepts --deliver <sink>. The output goes to the named sink in addition to (or instead of) stdout, so agents can route command results without hand-piping. Three sinks are supported:
| Sink | Effect |
|---|---|
stdout |
Default; write to stdout only |
file:<path> |
Atomically write output to <path> (tmp + rename) |
webhook:<url> |
POST the output body to the URL (application/json or application/x-ndjson when --compact) |
Unknown schemes are refused with a structured error naming the supported set. Webhook failures return non-zero and log the URL + HTTP status on stderr.
A profile is a saved set of flag values, reused across invocations. Use it when a scheduled agent calls the same command every run with the same configuration - HeyGen's "Beacon" pattern.
costco-pp-cli profile save briefing --json
costco-pp-cli --profile briefing raw --query example-value
costco-pp-cli profile list --json
costco-pp-cli profile show briefing
costco-pp-cli profile delete briefing --yes
Explicit flags always win over profile values; profile values win over defaults. agent-context lists all available profiles under available_profiles so introspecting agents discover them at runtime.
| Code | Meaning |
|---|---|
| 0 | Success |
| 2 | Usage error (wrong arguments) |
| 3 | Resource not found |
| 4 | Authentication required |
| 5 | API error (upstream issue) |
| 7 | Rate limited (wait and retry) |
| 10 | Config error |
Parse $ARGUMENTS:
- Empty,
help, or--help→ showcostco-pp-cli --helpoutput - Starts with
install→ ends withmcp→ MCP installation; otherwise → see Prerequisites above - Anything else → Direct Use (execute as CLI command with
--agent)
- Install the MCP server:
go install github.com/mvanhorn/printing-press-library/library/commerce/costco/cmd/costco-pp-mcp@latest
- Register with Claude Code:
claude mcp add costco-pp-mcp -- costco-pp-mcp
- Verify:
claude mcp list
- Check if installed:
which costco-pp-cliIf not found, offer to install (see Prerequisites at the top of this skill). - Match the user query to the best command from the Unique Capabilities and Command Reference above.
- Execute with the
--agentflag:costco-pp-cli <command> [subcommand] [args] --agent
- If ambiguous, drill into subcommand help:
costco-pp-cli <command> --help.