commerce-prompt-caching
Skill3.2k starsChanged 3 months agoApache-2.0View on GitHub
The reference agents' cache-stable request assembly, covering the static system and per-request context split, the fixed tool list, the rolling conversation breakpoint, which config fields are prompt bytes, and verification. Load when writing or reviewing a commerce agent's prompt assembly, when cache reads are zero, or when a turn's latency or cost is the question.
Trending
Quiet since September.about the whole repository
Who's talking about anthropics/commerce-agents
- A Hacker News story“Anthropic commerce agent: open-source blueprint for shopping and merchant agents”Hacker News · Sep 10, 2026 · 3 points
- A Hacker News story“Commerce Agents: Reference blueprint for building shopping and merchant agents”Hacker News · Sep 2, 2026 · 3 points
- @anthropicai.xmirror.bot“Also, see our open-source reference implementation. This includes shopping & merchant agents, four vertical …”Bluesky · Sep 2, 2026 · 3 likes
- @greg-harvey.tooting.ch.ap.brid.gy“Anthropic: "Hey, we do open source stuff too!" https://github.com/anthropics/commerce-agents Me: "Folks, …”Bluesky · Sep 16, 2026 · 2 likes
- ProSkillsMD/proskills“[Candidate] anthropics/commerce-agents/shopping-agent/skills/search-discovery - search-discovery”GitHub · Sep 28, 2026
The biggest 5 of 29 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 29
Talked about on GitHub, Bluesky and Hacker News (29 times).
On GitHub · 23
- Sep 28, 2026[Candidate] anthropics/commerce-agents/shopping-agent/skills/search-discovery - search-discovery — ProSkillsMD/proskills0 reactions · 2 comments
- Sep 27, 2026[Candidate] anthropics/commerce-agents/shopping-agent/skills/purchase-research - purchase-research — ProSkillsMD/proskills0 reactions · 2 comments
- Sep 27, 2026[Candidate] anthropics/commerce-agents/shopping-agent/skills/planning-goals - planning-goals — ProSkillsMD/proskills0 reactions · 2 comments
- Sep 27, 2026[Candidate] anthropics/commerce-agents/shopping-agent/skills/memory-personalization - memory-personalization — ProSkillsMD/proskills0 reactions · 2 comments
- Sep 26, 2026[Candidate] anthropics/commerce-agents/shopping-agent/skills/customer-care - customer-care — ProSkillsMD/proskills0 reactions · 2 comments
18 more on GitHub
- Sep 26, 2026[Candidate] anthropics/commerce-agents/merchant-agent/skills/pricing-promotions - pricing-promotions — ProSkillsMD/proskills0 reactions · 2 comments
- Sep 26, 2026[Candidate] anthropics/commerce-agents/merchant-agent/skills/performance-insights - performance-insights — ProSkillsMD/proskills0 reactions · 2 comments
- Sep 26, 2026[Candidate] anthropics/commerce-agents/merchant-agent/skills/marketing-campaigns - marketing-campaigns — ProSkillsMD/proskills0 reactions · 2 comments
- Sep 26, 2026[Candidate] anthropics/commerce-agents/merchant-agent/skills/inventory-operations - inventory-operations — ProSkillsMD/proskills0 reactions · 2 comments
- Sep 26, 2026[Candidate] anthropics/commerce-agents/merchant-agent/skills/catalog-listings - catalog-listings — ProSkillsMD/proskills0 reactions · 1 comment
- Sep 13, 2026fix(81rv10): ground demo in commerce-agents import — huijoohwee/agentic-graph0 reactions · 1 comment
- Sep 12, 2026[新規記事候補] Claude Commerce Agents Blueprint — quintessence-lab/mdTechKnowledge0 reactions · 1 comment
- Sep 10, 2026[mdKnowledge更新候補] 2026-09-11 — quintessence-lab/mdTechKnowledge0 reactions · 2 comments
- Sep 3, 2026📰 Hacker News AI 社区动态日报 2026-09-03 — 96loveslife/big_model_radar0 reactions
- Sep 2, 2026APRV-241: commerce agents blueprint declined in the integrations register — approval-md/approval.md0 reactions
- Sep 2, 2026Add a generic application and workspace-agent builder — tyxter-dev/blackbox0 reactions
- Sep 2, 2026Define a provider-neutral memory policy and reference runtime — tyxter-dev/blackbox0 reactions
- Sep 2, 2026Add cross-surface semantic parity contracts for workspace agent packages — tyxter-dev/blackbox0 reactions
- Sep 2, 2026Add a provenance-gated staged-action reference agent — tyxter-dev/blackbox0 reactions
- Sep 2, 2026Add an optional trust and sanitization boundary for tool results — tyxter-dev/blackbox0 reactions
- Sep 2, 2026Enforce WorkspaceAgentSpec tool permissions at runtime — tyxter-dev/blackbox0 reactions · 1 comment
- Sep 2, 2026Commerce agents: wire the blueprint evals into ork:testing-llm — yonatangross/orchestkitsays it tested it0 reactions
- Sep 2, 2026Commerce agents: skill wrapping the blueprint's shopping and merchant harness for client sites — yonatangross/orchestkit0 reactions
On Bluesky · 4
- Sep 2, 2026Also, see our open-source reference implementation. This includes shopping & merchant agents, four vertical demos, and a Claude Code plugin… — @anthropicai.xmirror.bot3 likes and reposts · 1 reply
- Sep 16, 2026Anthropic: "Hey, we do open source stuff too!" https://github.com/anthropics/commerce-agents Me: "Folks, open sourcing your agents is like… — @greg-harvey.tooting.ch.ap.brid.gy2 likes and reposts
- Sep 6, 2026anthropics/commerce-agents Anthropic published a reference implementation for Claude-powered commerce agents. Shopping flows, merchant… — @githubprojects.bsky.social0 likes and reposts · 1 reply
- Sep 2, 2026Also, see our open-source reference implementation. This includes shopping & merchant agents, four vertical demos, and a Claude Code plugin… — @claudedevs-mirr.selfhosted.social0 likes and reposts · 1 reply
On Hacker News · 2
In this repository16 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- catalog-listingsSkill
- inventory-operationsSkill
- marketing-campaignsSkill
- performance-insightsSkill
- pricing-promotionsSkill
- commerce-architectureSkill
- commerce-evalsSkill
- commerce-merchant-operationsSkill
- commerce-trust-safetySkill
- commerce-ui-toolsSkill
- customer-careSkill
- memory-personalizationSkill
- planning-goalsSkill
- purchase-researchSkill
- search-discoverySkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 53
When a turn's last call was given compact_history_above_tokens or more (its usage says.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Cache-stable request assembly
commerce_common/ is commerce-common/commerce_common/, shopping_agent/ is shopping-agent/core/shopping_agent/, and
merchant_agent/ is merchant-agent/core/merchant_agent/.
The three breakpoints
A request's cacheable prefix runs tools, then system, then the messages; a breakpoint ends a span the next call reads
back. The reference agents place three, all from commerce_common/prompt_assembly.py:
- The last tool:
with_tool_cache_control(tools). - The static system text:
build_system_blocks(static, context)marks it and appends the context block unmarked. - The newest persisted message:
build_request_messages(messages, rolling_breakpoint=...)marks the last persisted block on the outgoing request only; the next call then reads the earlier rounds, search payloads included, from cache.
Everything per request goes in the context block, which the role's build_dynamic_context(...) renders once per turn.
In the static block or the tool list, those bytes would break the system or tool span on every request; in the context block they cost
one re-read of the conversation on a turn whose cart, page, or facts moved, and the rolling marker holds from that turn's
next round. The clock renders to the hour (context_clock), so a new minute moves nothing.
The split as implemented
build_static_system(config, skills)in each role'sprompt.pyrenders identity, the most-turns rules, the fence notice, and the skill index from the config and the installed skills: the same bytes for the life of a deployment.build_dynamic_context(...)in the same module renders the per-request material inside the role's data fence: shopping takes preferences, memory facts, the cart, the page, the account block, and the time; merchant takes the store context, memory facts, and the time. Backend context blocks have their own size cap.ShoppingAgent.__init__andMerchantAgent.__init__(each role'sruntime-messages-apiorchestrator.py) build_static_systemand_toolsonce per process;stream_turnrenders the context block per turn and callsbuild_request_messagesper model call.build_toolsin each role'stools/registry.pyemits the built-ins in a fixed order (the merchant builder addsrun_analysisafter them when enabled), theload_skillenum sorted, then extensions in the order given, thenweb_searchwhen enabled; every registered tool ships on every request, and the executor decides on arrival whether a call can be served.- The Agent SDK runtimes pass the same static text (plus
SKILL_TOOL_ADAPTER) and the same contracts, and the SDK caches them; the hosted manifests carry the text assystem.md, whichscripts/check.pycompares with the builder.
When the rolling marker is skipped
Two rounds carry no marker. A bare first call (one message): a one-shot session would pay the write without a read, and
the second call's marker covers the first message anyway. A round whose tool_choice is other than auto (the
grounding-forced first iteration and the forced-text last one): tool_choice keys the messages span, so an entry written
under a forced round is unreadable by the auto rounds after it; the system and tool spans still hit. Both live in
build_request_messages and the loops' rolling_breakpoint= argument; rolling_conversation_cache turns the marker off
for debugging.
When the conversation is compacted
When a turn's last call was given compact_history_above_tokens or more (its usage says; the default is the platform's
own tool-result-clearing default, a tenth of the window), the turn ends with compact_history in
commerce_common/turn.py, which replaces the oldest tool results in the stored conversation with a one-line marker
until the conversation is half its previous size. The next turn's first round rewrites the messages span once and later
rounds read the shorter one; turn_complete.results_cleared tells a host that appends its transcript to rewrite it. The
system and tool spans, the messages, and the write gates are unaffected; provenance lives on the session state.
Config fields that are prompt bytes
The fields marked (prompt) in commerce_common/config.py and the role configs, plus enable_analysis and
max_items_per_change, which the merchant tool builder reads, render into the static text or the tool list; changing one is a redeploy and a miss on the next request:
| Config | Fields |
BaseAgentConfig (commerce_common/config.py) | brand_name, assistant_name, brand_voice, enable_web_search |
ShoppingAgentConfig (shopping_agent/config.py) | domain_search_notes, enable_disclosures, and the system switches enable_cart, enable_orders, enable_policies, enable_fulfillment |
MerchantAgentConfig (merchant_agent/config.py) | enable_analysis, require_host_approval, approval_surface, stage_shows_preview, and the system switches enable_listing_edits, enable_inventory, enable_pricing, enable_campaigns; max_items_per_change and max_search_results set maxItems and maximum on tool schemas |
Skills, presentation extensions, and delegates are prompt bytes too. Gate lexicons, guardrail limits, memory settings,
the latency knobs (eager_tool_dispatch, rolling_conversation_cache, eager_partial_frames,
close_on_presentation), cart caps, and compact_history_above_tokens are not; tests/test_role_registries.py
asserts it for each.
What breaks a hit
- Anything per request in the static block or the tool list: a name, a cart count, a page, a clock, a request id. The context block takes the first four; a request id belongs nowhere.
- A set or dict iterated into prompt text or a schema without sorting.
tools[]membership decided per request (a flag read per request instead of once at construction).- Rebuilding the static text or the tool list inside the turn instead of in the constructor.
- Persisting the rolling marker into the stored conversation, which then gains one marker per turn.
- Toggling a
(prompt)field, a skill, or an extension on a running deployment; each is a redeploy. - A prompt variant chosen per request instead of per deployment.
- A prefix under the model's minimum cacheable length, which writes nothing.
- A forced
tool_choice(grounding first,nonelast) misses the messages span only; the loops skip the marker there.
How to verify
turn_completecarriesusage(usage_totalsincommerce_common/turn.py, the turn's calls summed) andelapsed_ms; every call also logs one line with the same counters and its own time (log_model_call, onshopping_agent_runtime.orchestratorandmerchant_agent_runtime.orchestrator). Zero cache reads on the second turn of a conversation means the prefix changed. The counters worth charting per config version are cache reads as a share of input,elapsed_ms, rounds per turn, and blockedtool_resultevents by gate.tests/test_role_registries.pybuilds each role's prompt and tools twice and compares bytes, checks the cache marks, and checks that non-prompt settings change nothing;commerce-common/tests/test_prompt_assembly.pycovers the block builders, the context clock, the rolling marker, and the skip cases;tests/test_turn_loop.pypins both loops to the same blocks, marker, and clean history. A deployment's tests carry the same three checks.- In a deployed environment, run one three-turn conversation and read the second and third turns' usage; a proxy or retry layer that rewrites requests shows up here and nowhere else.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

