Skills and modules: what the blueprint ships and what this reference adds

What a skill is in Anthropic's Claude Commerce Agents blueprint, the ten it ships and the two processor-neutral ones this reference adds, how one skills directory per role is assembled, and the 53-module inventory a team consults before porting the agents to another runtime.

Two kinds of building block decide how much of the blueprint a merchant or a processor keeps when they adapt it. Skills are the flows the model follows on demand; adding one is adding a folder. Modules are the Python files the agents run on, and the inventory below says which of them touch a model and which do not. The Clover merchant's catalog belongs to the same question, because it is the one piece of the reference whose source differs between the demo and a live deployment. The merchants named here (Northstar Outfitters, Lumen Home, Aurora Escapes, Beacon Wireless, Encore Seats) are fictional.

What a skill is

A skill is one Markdown file, SKILL.md, in a directory of its own. It opens with YAML frontmatter carrying a name and a description, then a page of rules for one flow. The blueprint's loader (commerce_common/skills.py, under vendor/commerce-agents/commerce-common/) parses the frontmatter, refuses a file without both fields, and refuses two skills with the same name. SkillRegistry keeps the loaded skills sorted by name so the index renders the same bytes on every request, which matters for prompt caching.

How a skill loads: a request arrives, the assistant scans a five-line index in its standing instructions, the matching entry lights up, a load-skill call brings that page of rules into context alongside the first data read, and the flow runs with those rules. "Compare the top two tents, I care about space and setup" The index, in standing instructions customer-care memory-personalization planning-goals purchase-research search-discovery ◀ matches load_skill the page enters context get_product_details ×2 same round as the load Comparison card 2 to 4 finalists, pros and cons, price gap from the server, "what the extra money buys" in the text, per the skill CHIPS END THE TURN The five shopping entries above are the real index; a merchant's assistant carries a different five. A payment company adds one to each.
The request lights one line of the index. The assistant loads that page and makes its first data read in the same round.

The model never sees a skill's body until it asks for it. The static system prompt carries an index, one line per skill with its name and description, under a heading that says: each entry is a flow whose rules are in the skill; when a request matches an entry, call load_skill in the same round as the first read; one obvious tool call needs no skill (shopping_agent/prompt.py and merchant_agent/prompt.py in the blueprint). load_skill is a tool like any other, whose skill_name argument is an enum of the installed names. The executor's handler (commerce_common/execution.py) returns the skill's body as the tool result, or an error naming the skills that exist. From that round on, the rules are in the model's context for the rest of the flow.

Three consequences follow. Adding a flow is adding a folder; the index is rebuilt on the next start with no code or prompt edit. A skill cannot grant a tool; it only says when and how to use tools the deployment registered, so the tender skill below does nothing on a store without the tender card. And a skill is prompt text, so it is guidance; the rules that hold regardless of what the model does (gates, fences, caps) are in code, described in Security and trust. The blueprint's architecture skill states the layering: a rule for one call lives in that tool's description, a rule for most turns in the static prompt, and a multi-step procedure for a minority of requests in a skill.

The description is the trigger. Every description in the blueprint names the class of request it covers and ends by naming what it is not for, so two skills never claim the same request.

The ten skills the blueprint ships

The shopping agent's five skills live in vendor/commerce-agents/shopping-agent/skills/, the merchant agent's five in vendor/commerce-agents/merchant-agent/skills/.

Skill Role Loads when the person…
search-discovery shopping describes a need with several constraints, a gift, a choice among candidates already shown, or a search that came back empty or sold out
purchase-research shopping asks what matters in a category, how two approaches differ, or where to begin, before any candidates appear
planning-goals shopping wants a coordinated set of items toward a goal, an event, a trip or a project, or changes a plan already presented
customer-care shopping asks about an order or delivery, returns, refunds, exchanges, cancellations, a damaged or late item, or the store's terms or a membership
memory-personalization shopping asks what is remembered, to remember, correct or forget something, or when an older fact would change the pick
performance-insights merchant asks why a metric moved, which segment drove it, pace against a comparable, or progress against a stated goal
inventory-operations merchant wants the daily briefing, acts on low-stock or slow-mover alerts, or triages order exceptions
catalog-listings merchant wants listing content created or improved, categorization fixed, or a content audit across listings
pricing-promotions merchant asks for a price change within the guardrails, a rate recommendation, a promotion with scope and dates, or a markdown
marketing-campaigns merchant wants a campaign or ad drafted, an audience chosen, budget allocated, or results reviewed

Every merchant skill ends in a staged change; the operator's approval on the host's own surface is the only thing that applies a write. The blueprint also ships six engineering skills in its Claude Code plugin (vendor/commerce-agents/plugins/commerce-builder/skills/: architecture, prompt caching, UI tools, evals, merchant operations, trust and safety). Those load for the engineer building or reviewing an agent; none runs at shopping time, and this reference does not assemble them into either role's directory.

The two skills this reference adds

The reference adds one skill per role, both in the blueprint's exact shape so the vendored loader reads them unmodified. They live in psp_commerce/skills/ because they are the same for every processor: neither file names one, and every figure they direct the model to comes from the gateway, whichever processor implements it.

tender-and-loyalty (shopping)

psp_commerce/skills/shopping/tender-and-loyalty/SKILL.md loads when a shopper asks how they can pay for what is in the cart, whether it can be split or financed, whether a gift card or store card applies, what the order earns, or says they are ready to check out and has not seen the options this session. It is not for return, shipping or warranty terms (that is customer-care), and never for an empty cart.

The how-to-pay skill: a customer asks about splitting a purchase and rewards; the tender-and-loyalty skill loads; the assistant reads the cart and calls the tender card tool; the server's hook reads the processor's tender configuration, gift balance and loyalty tier and computes every figure; the card renders; checkout hands the shopper to the processor. SHOPPING · tender-and-loyalty "Can I split the tent, and what do I earn on it?" index match → load_skill tender-and-loyalty get_cart tent $219 · bag $54 present_tender_options payload: one sentence, no numbers The server's hook reads the processor, then does the arithmetic tender configuration · gift-card balance · loyalty tier · the cart's subtotal Pay in 4 → 4 × $68.25 · store card 5% → $13.65 back · gift balance $40 applies Trailhead Rewards → 819 points · Pay by Bank available · card, Apple Pay EVERY FIGURE IS THE PROCESSOR'S; THE MODEL TYPED NONE The card the shopper sees Ways to pay · $273 Store card · $13.65 back Gift card · $40 applies Klarna · 4 × $68.25 Checkout → the processor the shopper picks the tender on the page, or in the component; the assistant cannot press Pay ORDER RETURNS AS AN EVENT What the skill tells the assistant: say none of the figures yourself, point at the card, name the page as where they choose, never state an approval. What the code enforces regardless: an empty cart is refused; a store without the adapter gets a refusal instead of a blank card; the checkout link never reaches the model. Enabled by three lines per merchant: register the card tool, give the backend its merchant id, point the assistant at the skills folder. FIGURES ABOVE ARE FROM THE NORTHSTAR OUTFITTERS DEMO, A FICTIONAL CLOVER MERCHANT
How to pay, wired. The skill decides when the card appears and what the assistant may say; the server decides every number on it.

The rules point the model at four tools: get_cart when it is unsure what the cart holds, present_tender_options for the card, search_policies for the terms behind a tender, and checkout, staged in the same turn when the shopper is ready. The model states none of the figures in its text; the card carries them, and a tender the card does not show is one the model says is unavailable on this cart. The flow never charges, applies a tender, redeems points, states an approval or a credit limit, or asks for card numbers, bank details or one-time codes; choosing and paying happen on the store's checkout page after checkout.

The card it names is the presentation extension in commerce_core/tender.py, whose enrich hook computes every figure from the gateway (psp_commerce/reporting.py::tender_rows). A store enables the skill by registering build_tender_options_extension() in extra_presentation_tools, giving its backend a gateway and a merchant_id, and pointing skills_dir at the assembled directory. tests/test_tender_extension.py covers the figures and the two refusals.

payments-operations (merchant)

psp_commerce/skills/merchant/payments-operations/SKILL.md loads when an operator asks about settled volume and when it lands, authorization and decline rates, the mix of tenders, chargebacks and disputes with their deadlines, the share of sales that AI agents initiated, or processing fees. It is not for the sales and traffic questions the snapshot answers (performance-insights) and not for anything that changes a listing, a price or a campaign.

The payments-operations skill: an operator asks which disputes are due this week and whether agent orders dispute more; the skill loads; the assistant reads the payments block already in its context, lists open disputes from the order issues, queries dispute rate and agent-initiated share, runs one SQL join over transactions and disputes, presents the series, and names the dispute portal as where a response is filed. MERCHANT · payments-operations "Which disputes are due this week, and do agent orders dispute more?" index match → load_skill payments-operations Already in context: the processor's last 7 days settled $76,515 · auth 92.9% · agent-initiated 27.1% · 22 disputes · 11 due get_order_issues Dispute 13.1 on CH-61B0… · $97.67 chargeback · respond by Aug 10 query_metrics dispute_rate · 30 days agent_initiated_share · 30 days run_analysis: one read-only SQL join SELECT agent_initiated, COUNT(d.dispute_id)*1.0/COUNT(*) FROM transactions t LEFT JOIN disputes d ON d.transaction_id = t.transaction_id GROUP BY 1 The answer, in the operator's words "Eleven disputes are due by Friday; the largest is $97.67 for goods not as described." "Agent-initiated orders disputed at 0.19% this month against 0.31% for the rest." + present_metrics: dispute_rate and agent_initiated_share, by day What it hands off, and says it has not done Responding to a dispute, issuing a refund, changing settlement, turning a tender on or off: filed in the processor's portal. READ-ONLY HERE · NOTHING MOVES MONEY FIGURES ABOVE ARE FROM THE HARBOR & PINE DEMO, A FICTIONAL COMMERCE HUB MERCHANT
Settlement, authorization and disputes, wired. The processor's seven-day summary rides in the assistant's context on every request; deeper questions go to named metrics, the dispute list, and one read-only SQL view.

It tells the model where each figure lives: the payments block in the store context for the last seven days, quoted as given; query_metrics under the exact names settled_volume, auth_rate, dispute_rate, chargebacks, agent_initiated_share and tender_mix:<tender>; open disputes in get_order_issues with reason code, amount, transaction and order ids and the response deadline; and run_analysis over the transactions, settlements and disputes tables when a question needs a join or a share. It fixes the order of an answer (the figure, the window, then the deadline or action it implies), asks for a prior-period comparison before an authorization rate is called a problem, and puts any dispute due within seven days first. Responding to a dispute, issuing a refund, changing a settlement schedule or switching a tender happens in the processor's portal; the model describes that as the next step and says nothing has happened here.

The data reaches those tools through PaymentsOpsMixin in commerce_core/merchant.py, mixed in ahead of the merchant's existing backend. Enabling it is the mixin, two attributes (gateway, processor_mid), the payments vocabulary added to metrics_intent_terms (PAYMENTS_METRIC_TERMS in verticals/_rebrand.py) so the blueprint's snapshot gate fires on a payments question, and the assembled skills directory. tests/test_payments_ops.py covers the series, the disputes, the SQL join and a refused write.

One directory per role

Both of the blueprint's runtimes take a single skills_dir, so the reference assembles one directory per role. psp_commerce/skills_dir.py::skills_dir(role) walks two sources for shopping (the blueprint's shopping-agent/skills and psp_commerce/skills/shopping) and two for merchant, copies each SKILL.md into .skills/<role>/<name>/SKILL.md at the repository root (ignored by git), skips directories whose name starts with an underscore (the blueprint's convention for parked flows), and recopies a file only when its source is newer. Every merchant's api/main.py passes skills_dir("shopping") to the shopping agent and skills_dir("merchant") to the merchant agent; commerce_core/skills_dir.py re-exports the function for older imports.

The result is six skills per role: the blueprint's five plus tender-and-loyalty for shopping, the blueprint's five plus payments-operations for merchant. The registry refuses duplicate names, so a processor adding a third skill picks a name the blueprint does not use. On the Agent SDK path (scripts/console.py) the blueprint's commerce_common/agent_sdk.py materializes the same directory for the SDK's own Skill tool and drops load_skill from the tool list, so both paths read the same files.

The module inventory

scripts/module_inventory.py walks the blueprint's seven installable packages, reads each module's docstring, and classifies it. The script takes one optional flag, --json; without it, it prints a Markdown table.

The blueprint's 53 runtime modules on two rings: the inner ring holds the 18 that touch a model (nine import the SDK, nine speak a Messages API shape); the outer ring holds the 35 model-free modules. Sectors are packages. the model CLAUDE · OR ANY commerce_common/agent_sdk.py · tier A (imports the SDK; claude_agent_sdk) · 242 lines · Plumbing the two Agent SDK runtimes share: registering an executor's tools as an in-process MCP server, materializing the repo skills for the SDK, host-side grounding, the hook that ends a turn on a chip-carrying present agent_sdk.py commerce_common/config.py · tier B (speaks an API shape; the thinking effort field, thinking content blocks) · 48 lines · The config fields both roles share, in the section order the role configs continue: identity, models, budgets, capabilities, memory, caps. Fields marked (prompt) render into the static prompt or the tool list, so they ar config.py commerce_common/memory.py · tier A (imports the SDK; anthropic, anthropic.types) · 529 lines · Durable memory: the ``MemoryStore`` contract, the write filter, the post-turn extraction pass with the template each role renders its extraction prompt from, and the ``MemoryRuntime`` the executors consume. Every fact re memory.py commerce_common/prompt_assembly.py · tier B (speaks an API shape; prompt-cache breakpoints, forced tool choice) · 97 lines · Where the cache breakpoints go: after the static system text, after the last tool, and rolling through the conversation on the newest persisted message; and where the per-request context goes: a second system block, behi prompt_assembly.py commerce_common/testing.py · tier B (speaks an API shape; streamed partial tool JSON, the streaming Messages call, the Messages call) · 172 lines · Scripted stand-ins for the two model-client contracts, plus a memory store that counts its reads. ``FakeClient`` plays back ``messages.stream`` and ``FakeCreateClient`` plays back ``messages.create``; both record each re testing.py commerce_common/turn.py · tier B (speaks an API shape; streamed partial tool JSON, thinking content blocks) · 507 lines · Pieces of the Messages API turn loop that both roles use the same way: reading the conversation (latest user text, the exchange memory extraction reads, compaction), running a round (:class:`StreamedRound`, eager dispatc turn.py commerce_common/delegation.py · tier C (model-free; no model dependency) · 41 lines · The delegate contract: an isolated model call behind a tool. A delegate receives a task brief and the session handles, never the conversation or the executor, and returns one schema-validated result; it cannot write, pre delegation.py commerce_common/execution.py · tier C (model-free; no model dependency) · 245 lines · The executor frame both roles extend. A role executor supplies its fence, its handler table, and its wording; this module owns dispatch, the failure ladder, skills, presentation, delegates, memory, and the ``status`` lin execution.py commerce_common/fencing.py · tier C (model-free; no model dependency) · 142 lines · Sanitizing and fencing text the model reads as data. Each role defines one ``Fence``; its label is a source literal, never built from runtime values, so untrusted text cannot reproduce the boundary. Every pattern here is fencing.py commerce_common/grounding.py · tier C (model-free; no model dependency) · 62 lines · Grounding rules: a rule reads the user's message and names one read tool the turn must start with, so an answer of that shape begins from a tool result. Each role lists its rules in precedence order; the runtimes force t grounding.py commerce_common/manifest.py · tier C (model-free; no model dependency) · 153 lines · Resolve a Managed Agent manifest (``agent.yaml``) into a ``/v1/agents`` request body: ``system_file`` is inlined, ``skills[].path`` entries become Skills API references (placeholders until ``skill_ids`` supplies uploaded manifest.py commerce_common/mcp_server.py · tier C (model-free; no model dependency) · 82 lines · Plumbing the two reference MCP servers share: one executor per connection, the registry's descriptions, the outcome-to-result mapping, and the loopback-only bind. The servers verify no credential of their own, so they re mcp_server.py commerce_common/presentation.py · tier C (model-free; no model dependency) · 138 lines · Presentation tools: the component spec the built-ins and deployment extensions share, and the one runner that validates a call, enriches it, and produces its ``ui`` event. The model selects and annotates; every fact on t presentation.py commerce_common/skills.py · tier C (model-free; no model dependency) · 63 lines · Skill loading. A skill is a directory holding ``SKILL.md``: YAML frontmatter with ``name`` and ``description``, then the instructions. The static prompt carries the index and ``load_skill`` returns a body on demand. skills.py commerce_common/streaming.py · tier C (model-free; no model dependency) · 209 lines · The events an agent turn yields to its host, and the outcome type every tool call produces. Hosts render the event types below and ignore any they do not know. streaming.py commerce_common/types.py · tier C (model-free; no model dependency) · 47 lines · Data types both roles share. Role-specific types live in the role packages. types.py commerce_common 16 MODULES · ABC shopping_agent/config.py · tier B (speaks an API shape; the thinking effort field) · 108 lines · Per-deployment settings for the shopping agent; per-request values travel in ``ShoppingSessionContext``. Sections continue ``BaseAgentConfig``'s: capabilities, cart caps, grounding gates. config.py shopping_agent/tools/registry.py · tier B (speaks an API shape; the web_search server tool) · 627 lines · The shopping agent's tool contracts, in a fixed order. The list depends only on the deployment config, so it is the same bytes on every request; whether a capability can serve a call is decided in the executor. A descrip tools/registry.py shopping_agent/backend.py · tier C (model-free; no model dependency) · 132 lines · The StorefrontBackend interface: the one integration surface an adopter implements, mapping each method onto their catalog, cart, profile, order, and policy services. Everything these methods return reaches the model as backend.py shopping_agent/enrichment.py · tier C (model-free; no model dependency) · 254 lines · The built-in components: each payload joined to the session's catalog records, the cart, or an order before it reaches the host. Ids without session provenance are dropped and reported; a component left with nothing cano enrichment.py shopping_agent/executor.py · tier C (model-free; no model dependency) · 187 lines · The shopping agent's tools, one handler each, over the shared executor frame. The Messages API runtime, the SDK toolset, and the MCP server all execute through this class, so a tool result is the same bytes on every path executor.py shopping_agent/fencing.py · tier C (model-free; no model dependency) · 13 lines · The shopping agent's data fence: every tool result built from catalog, review, policy, order, or web content goes back to the model inside it. The mechanism lives in ``commerce_common.fencing``; this module fixes the lab fencing.py shopping_agent/gates.py · tier C (model-free; no model dependency) · 144 lines · The cart gates. A cart write accepts only product ids that catalog or order tools returned this session (or lines already in the cart), holds an add of a product that still has options to choose and points at its variant gates.py shopping_agent/grounding.py · tier C (model-free; no model dependency) · 57 lines · The shopping agent's grounding rules, in precedence order: a store-terms question starts from search_policies, a post-purchase question from get_orders, and a mention of an unseen product id from get_product_details. A r grounding.py shopping_agent/memory.py · tier C (model-free; no model dependency) · 30 lines · The extraction prompt the shopping runtimes hand to ``commerce_common.memory``: what the store may remember about one customer between visits. memory.py shopping_agent/prompt.py · tier C (model-free; no model dependency) · 204 lines · The shopping agent's system prompt: a static half that is cached and a dynamic half appended after the cache breakpoint. The static half depends only on the deployment config and the installed skills; everything per requ prompt.py shopping_agent/serialization.py · tier C (model-free; no model dependency) · 112 lines · The payloads read tools hand the model, built once so every path returns the same bytes. The search header is the one runtime-authored line outside the fence: the result count and a fixed sentence on how to read the resu serialization.py shopping_agent/tools/presentation.py · tier C (model-free; no model dependency) · 55 lines · Payload schemas for the built-in presentation tools: what the model may send. The joins that turn a payload into what the host renders live in ``enrichment``. tools/presentation.py shopping_agent/types.py · tier C (model-free; no model dependency) · 150 lines · The shopping agent's domain models: what a storefront backend returns and the session records the gates and enrichment read. types.py shopping_agent 13 MODULES · BC shopping_agent_runtime/orchestrator.py · tier A (imports the SDK; anthropic) · 259 lines · The shopping agent's turn loop on the Messages API: one model call per iteration, tools dispatched eagerly as their blocks close, presentation calls rendered while they stream, a rolling cache breakpoint through the conv orchestrator.py shopping runtime 1 MODULES · A shopping_agent_sdk/agent.py · tier A (imports the SDK; claude_agent_sdk) · 92 lines · The shopping agent as ``ClaudeAgentOptions``: the static prompt plus the skill adapter, the storefront server as the only tools, and the repo skills materialized for the SDK. ``run_turn`` grounds the message the way the agent.py shopping_agent_sdk/shopping_tools.py · tier A (imports the SDK; claude_agent_sdk) · 75 lines · The shopping tools as an in-process MCP server for the Agent SDK: the registry's contracts minus ``load_skill`` (the SDK's Skill tool replaces it), every call executed by ``ShoppingToolExecutor``, and presentation payloa shopping_tools.py shopping_agent_sdk/_paths.py · tier C (model-free; no model dependency) · 7 lines · Repo paths this runtime reads at import time, resolved from this file. _paths.py shopping SDK 3 MODULES · AC merchant_agent/analysis.py · tier B (speaks an API shape; the code_execution server tool) · 291 lines · The run_analysis contract: the tool definition the orchestrator sees, the system prompt and tool definitions the analysis delegate sees, the SELECT-only check for ``MerchantBackend.execute_analysis_query``, and the metri analysis.py merchant_agent/config.py · tier B (speaks an API shape; the thinking effort field) · 175 lines · Per-deployment settings for the merchant agent; per-request values travel in ``MerchantSessionContext``. Sections continue ``BaseAgentConfig``'s: capabilities (analysis), guardrails, approval, grounding gates. config.py merchant_agent/tools/registry.py · tier B (speaks an API shape; the web_search server tool) · 697 lines · The merchant agent's tool contracts, in a fixed order. The list depends only on the deployment config, so it is the same bytes on every request; whether a capability can serve a call is decided in the executor. A descrip tools/registry.py merchant_agent/backend.py · tier C (model-free; no model dependency) · 182 lines · The MerchantBackend interface: the one integration surface an adopter implements, mapping each method onto their analytics, catalog, inventory, order, pricing, and campaign systems. Everything these methods return reache backend.py merchant_agent/changes.py · tier C (model-free; no model dependency) · 189 lines · The staged-change guardrails and the in-memory ``ChangeLedger`` the example backends build on. Guardrails run when a change is staged and again before it is applied. changes.py merchant_agent/enrichment.py · tier C (model-free; no model dependency) · 394 lines · The built-in merchant components: metric picks resolved to the values tools returned this session, digest items joined to their listing or change records, and a change preview built from the staged record with model text enrichment.py merchant_agent/executor.py · tier C (model-free; no model dependency) · 324 lines · The merchant agent's tools, one handler each, over the shared executor frame. The Messages API runtime, the SDK toolset, the MCP server, and the analysis delegate's reads all execute through this class, so a tool result executor.py merchant_agent/fencing.py · tier C (model-free; no model dependency) · 13 lines · The fence every merchant tool result is returned inside. The mechanism lives in ``commerce_common.fencing``; this module fixes the merchant label and notice wording. fencing.py merchant_agent/gates.py · tier C (model-free; no model dependency) · 191 lines · The merchant gates and the wording every path returns when one holds. Staged writes accept only listing and campaign ids that tools returned this session; a price or restock write that names a listing with options is poi gates.py merchant_agent/grounding.py · tier C (model-free; no model dependency) · 56 lines · The merchant agent's grounding rules, in precedence order: a performance question starts from get_business_snapshot, and an apply request with nothing staged this session starts from get_pending_changes. :func:`change_re grounding.py merchant_agent/memory.py · tier C (model-free; no model dependency) · 30 lines · The extraction prompt the merchant runtimes hand to ``commerce_common.memory``: what the assistant may remember about one operation between sessions, keyed by merchant id. memory.py merchant_agent/prompt.py · tier C (model-free; no model dependency) · 213 lines · The merchant agent's system prompt: a static half that is cached and a dynamic half appended after the cache breakpoint. The static half depends only on the deployment config and the installed skills; everything per requ prompt.py merchant_agent/serialization.py · tier C (model-free; no model dependency) · 80 lines · The search_listings result, built once so every path returns the same bytes. The header is the one runtime-authored line outside the fence: the result count and a fixed sentence on how to read the results as text matches serialization.py merchant_agent/tools/presentation.py · tier C (model-free; no model dependency) · 30 lines · Payload schemas for the built-in presentation tools: what the model may send. The joins that turn a payload into what the portal renders live in ``enrichment``. tools/presentation.py merchant_agent/types.py · tier C (model-free; no model dependency) · 359 lines · Merchant domain types shared by the orchestrator, the MerchantBackend interface, and the examples: listings, metrics, analysis results, inventory and order health, pricing, campaigns, staged changes, and session state. A types.py merchant_agent 15 MODULES · BC merchant_agent_runtime/analysis.py · tier A (imports the SDK; anthropic) · 341 lines · The analysis delegate: a separate model loop, run inside the analysis tool call, whose tools are the merchant read tools plus a submission tool and, per deployment, a SELECT-only query method and the hosted code sandbox. analysis.py merchant_agent_runtime/orchestrator.py · tier A (imports the SDK; anthropic) · 299 lines · The merchant agent's turn loop on the Messages API: one model call per iteration, tools dispatched eagerly as their blocks close while delegate progress lines stream, presentation calls rendered while they stream, a roll orchestrator.py merchant runtime 2 MODULES · A merchant_agent_sdk/agent.py · tier A (imports the SDK; claude_agent_sdk) · 146 lines · The merchant agent as ``ClaudeAgentOptions``: the static prompt plus the SDK adapters, the merchant server as the only tools, the repo skills, and, when analysis is enabled, the delegate as a subagent restricted to the r agent.py merchant_agent_sdk/merchant_tools.py · tier A (imports the SDK; claude_agent_sdk) · 98 lines · The merchant tools as an in-process MCP server for the Agent SDK: the registry's contracts minus ``load_skill`` and ``run_analysis`` (the SDK's Skill tool and a subagent take those roles), every call executed by ``Mercha merchant_tools.py merchant_agent_sdk/_paths.py · tier C (model-free; no model dependency) · 7 lines · Repo paths this runtime reads at import time, resolved from this file. _paths.py merchant SDK 3 MODULES · AC What the colours mean Red · talks to Claude directly (9) imports Anthropic's kit; swap to change the AI Violet · uses a Claude-only trick (9) cache marks, a forced first read, web search Green · works with any AI, or none (35) rules, gates, cards, skills; keep as they are inner ring: red and violet · outer ring: green each wedge is one package (a folder of parts) HOVER OR CLICK A DOT FOR WHAT THAT PART DOES
Inner ring: touches a model. Outer ring: model-free. Everything that makes the product safe sits on the outer ring: the provenance rule, the cart gates, the fences, the presentation contract, the skills. The full inventory with every module's purpose and line count is in the project's docs/MODULES.md; the script that produced it is in the reference.
red · talks to Claude directly (9)violet · uses a Claude-only trick (9)green · works with any AI, or none (35)
.venv/bin/python scripts/module_inventory.py
53 modules: A=9 (imports the SDK), B=9 (Messages-API shapes), C=35 (model-free)

Package __init__.py files are excluded; two of them (the two Agent SDK packages) import the SDK to re-export their runtime, which is where an earlier count of eleven files came from. The classification is mechanical: an import of anthropic or claude_agent_sdk puts a module in tier A; otherwise a hit on one of the Messages API markers (cache_control, tool_choice, input_json_delta, web_search_20250305, code_execution_20260120, thinking_effort, thinking content blocks, messages.stream, messages.create) puts it in tier B; the rest is tier C. Line counts exclude blanks and comments. The figures below come from running the script on 8 September 2026 against the pinned blueprint commit fd4d5922.

Tier Meaning Modules Lines
A. SDK-coupled constructs or drives an Anthropic client, or builds Agent SDK options; replacing the model means replacing the module 9 2,081
B. Messages-API-shape speaks a Messages API feature without importing the SDK: cache breakpoints, forced tool choice, streamed partial tool JSON, the server tools, the thinking field; another provider needs an equivalent or a graceful drop 9 2,722
C. Model-free interfaces, types, gates, fencing, provenance, presentation contracts, enrichment, skills, serialization, manifests, MCP (Model Context Protocol) plumbing; runs unchanged on any model, or with no model at all 35 4,595
Package Modules A B C
commerce_common (what both roles share) 16 2 4 10
shopping_agent (the shopping core) 13 0 2 11
shopping_agent_runtime (Messages API run path) 1 1 0 0
shopping_agent_sdk (Agent SDK run path) 3 2 0 1
merchant_agent (the merchant core) 15 0 3 12
merchant_agent_runtime (Messages API run path) 2 2 0 0
merchant_agent_sdk (Agent SDK run path) 3 2 0 1

Tier A is the two Messages API turn loops (shopping_agent_runtime/orchestrator.py, 259 lines; merchant_agent_runtime/orchestrator.py, 299), the merchant's analysis delegate (341), commerce_common/memory.py (529; only its extraction pass is a Messages call), the shared Agent SDK plumbing (commerce_common/agent_sdk.py, 242), and the four Agent SDK adapters. Tier B is the two tool registries (627 and 697 lines, coupled only by the web_search entry; the JSON schemas are provider-neutral), the three config modules (thinking_effort), commerce_common/prompt_assembly.py (cache breakpoints, forced tool_choice), commerce_common/turn.py (the streamed round), commerce_common/testing.py (scripted stand-ins for the two Messages calls), and merchant_agent/analysis.py (the code_execution server tool).

For a team porting to another runtime the tiers translate into three actions. Tier C is kept as is, and it is where a processor's integration lives: a StorefrontBackend over a catalog, a MerchantBackend over reporting, a PresentationExtension for the tender card, a SKILL.md for payments operations. None of it changes when the merchant chooses a different model. Tier A is small and replaceable; this reference rewrites the shopping loop once against a provider interface, in about 150 lines, and Any model describes what that loop keeps and drops. Tier B is where the trade-offs are: caching, forced reads, eager dispatch and the two server tools are what make the Claude path fast and cheap, and a provider without them is slower per turn and needs the grounding read done by the host before the model call.

Where the Clover merchant's catalog comes from

Northstar Outfitters, the Clover merchant, keeps its catalog, stock and orders in its point of sale. In this reference that catalog is a fixture written for the demo, verticals/northstar_outfitters/data/clover_items.json, laid out in the shape Clover's REST API returns: the response of GET /v3/merchants/{mId}/items?expand=itemStock,categories,options plus the item groups (the variant families, such as a boot with five sizes) and the categories the same merchant exposes. Prices and costs are in cents. build_gateway in verticals/registry.py loads it into the simulated gateway with load_clover_inventory; with CLOVER_MERCHANT_ID and CLOVER_ACCESS_TOKEN set, gateway_for returns the Clover adapter instead, which answers the same reads from one sync_inventory call against the sandbox merchant. Either way CloverCatalogStorefront (commerce_core/storefront.py) maps the inventory onto the blueprint's StorefrontBackend: items become products, item groups become families with options, item stocks become availability, categories become categories. Descriptions, images, brands and ratings are not Clover fields, so they live in a sidecar the store's own site owns, storefront_content.json. The merchant agent's approved restocks and price moves write back through the same shapes (update_item_stock, update_item), and refresh_catalog rebuilds the products at once.

Merchant Clover App Market The app (this reference) Clover REST API Store assistant app registration · permissions installs the app OAuth access token for thismerchant GETitems?expand=itemStock,categories,itemGroup,options GETitem_groups?expand=attributes.options· GET categories elements · itemGroups · categories products · families · stock · categories approved restock POST item_stocks/{itemId} · POSTitems/{itemId} the demo uses a fixture in this exact shape; sync_inventory reads a live merchant with the same three calls
Three reads, one shape. The adapter's inventory sync fetches items, item groups and categories and returns the fixture's shape; the storefront maps them onto the kit's products, families and availability. Descriptions and images are not Clover fields, so a sidecar the store owns supplies them, which is the content gap a feed vendor could fill. Details in docs/CLOVER-INVENTORY.md.

Live, the same shape comes from the adapter. CloverGateway.sync_inventory() in psp_commerce/adapters/clover.py reads a merchant's inventory with three calls (items paged by 1,000 with expand=itemStock,categories,itemGroup,options, item groups with expand=attributes.options, and categories) and returns elements, itemGroups and categories, the fixture's keys, so load_clover_inventory accepts either. The credential is the app's own OAuth grant from the merchant: a Clover app declares the permissions it needs (inventory read and write, orders, payments), the merchant installs it, and the app receives an access token for that merchant, passed here as CLOVER_MERCHANT_ID and CLOVER_ACCESS_TOKEN. Clover's documentation (docs.clover.com, read on 6 September 2026) has no "delegated API" as a product; the token is the app's credential, and it never reaches the model. Stock and price writes go to POST /v3/merchants/{mId}/item_stocks/{itemId} and POST /v3/merchants/{mId}/items/{itemId}.

Two things to be clear about. tests/test_adapters_http.py::test_clover_requests_and_inventory_sync exercises the sync against Clover's documented response shape with a mock transport; it was not run against a Clover sandbox merchant in this repository. And the Northstar demo API (verticals/northstar_outfitters/api/main.py) always builds the simulated gateway from the fixture; feeding a live merchant's sync_inventory() output through load_clover_inventory is a deployment's wiring, and the fixture is what every Northstar scene in the use-case article runs on.

The builder's own skills

The skills above run at shopping time. The blueprint also ships six skills for the engineer building or reviewing an agent, under vendor/commerce-agents/plugins/commerce-builder/skills/, loaded inside Claude Code and never at run time. commerce-architecture fixes where every rule lives: one model owns the conversation, one executor runs every tool call, and a rule sits in exactly one of three places (a tool's description, the static prompt, or a skill loaded on demand). commerce-prompt-caching keeps the request bytes still across turns so the cache prefix is reused. commerce-ui-tools makes every card a tool call whose values the server fills. commerce-evals grades the state a turn leaves behind rather than the prose. commerce-merchant-operations covers staged writes and approval. commerce-trust-and-safety covers the gates, fences and identity binding. The tender card and the payments view in this reference follow the first of them to the letter: the card's "when" is its tool description, the always-on rule that the assistant never charges is in the static prompt, and the procedure for a customer asking how to pay is the skill.

Six tiles, one per engineering skill: architecture, prompt caching, UI tools, evals, merchant operations, trust and safety, with a line showing how they fit together. commerce-architecture Where every rule lives turn loop · executor, one handler per tool · the plug skills folder · the same bytes on every run path LAYERING commerce-prompt-caching Keep the bytes still static system text → tool list → conversation three cache breakpoints · per-request context after them COST AND LATENCY commerce-ui-tools The card is a tool call payload schema · the model picks, the server fills values chips end the turn · every card has a text fallback GENERATIVE UI commerce-evals Grade the state, not the prose a case = messages + a backend fixture scorers on tool calls, cart, cards, refusals · poison TESTING commerce-merchant-operations Propose, preview, approve, apply every change staged with an id · caps re-checked at apply metrics grounded in a snapshot before an explanation THE STAFF AGENT commerce-trust-safety Twenty rules the code enforces fencing · provenance · write gates · caps memory limits · injection handling · no secrets in results SAFETY How they fit architecture sets the places · caching and UI tools fill them · trust rules bound them · merchant ops applies them to writes · evals prove all of it
Six skills for the people building it. The developer tool's commands scaffold an agent, add a flow, author evals, or review an existing assistant. A processor's version of the plugin would pre-answer the stack questions for its own platforms.