Publish llms.txt and agents.md with OpenCode
Publishing llms.txt and agents.md with OpenCode means asking the open-source terminal agent to read your store's AI discovery file status through StoreSEO, then generate, switch or reset a file once you confirm.
Last updated: October 2026
Set up OpenCode for StoreSEO
Skip this if OpenCode is already connected. The full guide, with the alternatives, is on the OpenCode page.
- 1
Add StoreSEO to OpenCode
Run this from the project that should use StoreSEO, or add --global to make it available in every project. OpenCode writes a remote server entry to its configuration; the equivalent hand-written entry is shown in the next step.
Terminalopencode mcp add storeseo --url https://mcp.storeseo.com/mcp
- 2
Sign in to your store
Remote servers use OAuth by default. Run the auth command, then pick your Shopify store in the browser and approve access. Inside OpenCode, /mcps does the same: select storeseo and sign in. opencode mcp list should then show it as connected.
Terminalopencode mcp auth storeseo opencode mcp list
How does this work in OpenCode?
You run OpenCode from your project folder, and after opencode mcp add and opencode mcp auth storeseo, the StoreSEO tools are available as storeseo_ prefixed tools in the session. Ask whether your agents.md is live and OpenCode calls storeseo_start, then storeseo_get_agents_md_status and storeseo_get_llms_txt_status. They are reads, so they run straight away. You see the tool names scroll by, and the answer says whether a custom file is live, which llms.txt version is active and whether a rebuild is due.
Writes go through the conversation. For storeseo_generate_agents_md StoreSEO tells the agent to say that the file publishes live at once, replaces Shopify's default and spends AI Content Optimizer credit, and to wait for your yes. For storeseo_generate_llms_txt it tells the agent to say that a template is written into your live theme and a copy uploaded to Shopify Files in the same run. OpenCode then polls storeseo_get_llms_txt_status until generation finishes. Since you are already in a project, you can ask it to save the returned agents.md text into a file, so you hold a copy before any reset.
OpenCode's documentation describes deny rules for MCP tools but no ask-first mode, so the permissions entry is your client-side lever. A permissions entry with the action storeseo_storeseo_generate_llms_txt and a deny effect hides that tool entirely, which suits a session meant only to check statuses. Because tool names are the server name plus the tool name, check the exact names with opencode mcp list or the /mcps view before you write a rule, and note that opencode mcp add writes to the project unless you pass --global.
-
You: Is my agents.md live? If it is only Shopify's default, write a custom one.
- storeseo_start read-only
- storeseo_get_agents_md_status read-only
-
OpenCode: Only Shopify's default is serving. A custom file is written from your brand profile and top products, goes live immediately and spends AI credit. Generate it?
-
You: Yes, generate it.
- storeseo_generate_agents_md needs approval
-
OpenCode: Published at your /agents.md. I saved the text to agents-md-copy.md in this folder. Want me to check llms.txt next?
What to ask OpenCode
Use StoreSEO to check my llms.txt and agents.md status and summarize it in five lines. Do not generate anything.
Generate agents.md for my store and save the returned text to agents-md-copy.md here. Tell me the cost and that it publishes live before you run it.
List my llms.txt versions and tell me whether the active one is the newest.
- Is my llms.txt up to date, and which version is live right now?
- Generate a new llms.txt that includes products and collections but not blog posts. Warn me before it goes live.
- Show me my llms.txt versions and switch back to the one from last week.
- Does my store serve a custom agents.md or Shopify's default?
- Write an agents.md for my store and publish it. Tell me what it costs first.
- Reset agents.md to Shopify's default.
What StoreSEO does: llms.txt and agents.md
llms.txt is a curated map of your store for AI crawlers, and agents.md tells AI shopping agents who you are and how to buy. StoreSEO generates both from your store data and publishes them to your live theme; the agent checks status, generates, switches llms.txt versions and resets agents.md to Shopify's default.
Requires: agents.md generation spends AI Content Optimizer credit and needs at least one published product.
- 1
Check what is live
The agent reads the llms.txt status (settings, latest version, whether a rebuild is due, public URL) and the agents.md status (custom file or Shopify's default, public URL).
- 2
Warn before publishing
Generating llms.txt writes a template to your live theme and uploads a copy to Shopify Files in the same run, with no separate publish step. Generating agents.md publishes it live at once and spends credit. The agent says so and waits for your yes.
- 3
Generate and wait
llms.txt generation takes a minute or two; the agent polls the status until it finishes. agents.md returns the published text and its URL straight away.
- 4
Manage versions
StoreSEO keeps the latest ten llms.txt versions. The live file serves the active version, which is not always the newest, and any version can be made active again.
- 5
Roll back
Deleting a version is permanent. Resetting agents.md drops the custom file so Shopify's default serves again, and there is no history to restore it from.
llms.txt and agents.md reference
| llms.txt | Generated from your products, collections, pages and posts; served at your store's /llms.txt |
|---|---|
| Where it is written | A template in the live theme plus a copy in Shopify Files, in the same run |
| Schedule | llms.txt can regenerate on a saved schedule; settings passed with a run are saved for scheduled runs |
| Versions kept | The latest ten; the live file serves the active one |
| Generation time | About one to two minutes for llms.txt |
| agents.md | AI-written from your brand profile, top products, collections and contact details; served at /agents.md |
| agents.md publish | Live immediately; replaces Shopify's native default |
| agents.md reset | Shopify's default serves again within seconds; the custom text is gone for good |
Rules OpenCode follows
- The agent tells you that llms.txt generation writes to your live theme before it starts.
- agents.md generation publishes live and spends credit, so the agent says both and waits for your yes.
- Deleting an llms.txt version and resetting agents.md cannot be undone; the agent confirms each one.
- Deleting the active llms.txt version promotes the next newest automatically, so the agent says which version will go live.
In OpenCode
OpenCode documents deny rules for MCP tools but no ask-first mode, so for this job the confirmation StoreSEO asks the agent for is the main check. Writes here include publishing agents.md live and writing to your theme, so read each proposal before you agree. If you want a client-side stop, deny the generate, activate, delete and reset tools by name in a permissions entry. Also, OpenCode V2 expects servers under mcp.servers while older versions put the entry directly under mcp, so check the layout your version documents if the tools do not appear.
What runs without asking. Reads such as SEO scores, store listings, settings and Google reports run straight away. Generating a preview spends AI credit but writes nothing, and StoreSEO tells the agent to say what a generation will cost before it runs one. Applying content, optimizing images, changing settings, publishing llms.txt or agents.md, writing a product description and deleting anything wait for your yes in the conversation. That yes is an instruction the agent follows, not a lock on the server, so your client's own tool-approval setting is the hard stop.
Questions
How do I stop OpenCode from generating files by accident?
Add permissions entries with a deny effect for the write tools you do not want, such as the generate and reset tools, using the server name plus the tool name. The status and list tools stay available for read-only checks.
Does OpenCode keep a copy of my agents.md before I replace it?
Not by itself, and StoreSEO keeps no history for agents.md. Ask OpenCode to fetch the public URL and write the text to a file in your project before generating or resetting, so you have your own copy.
What is the difference between llms.txt and agents.md?
llms.txt is a curated map of your store for AI crawlers and answer engines, served at /llms.txt. agents.md is the file AI shopping agents read to understand your brand and how to shop with you, served at /agents.md. StoreSEO can generate both.
Does generating llms.txt change my theme?
Yes. The same run writes an llms.txt template into your live theme and uploads a copy to Shopify Files. There is no separate publish step, which is why the agent should warn you before it starts.
Can I go back to an older llms.txt?
Yes. StoreSEO keeps the latest ten versions, and any of them can be made the active one, which republishes it to your storefront. Deleting a version is permanent.
Can I undo a generated agents.md?
You can reset it, which makes Shopify's native default serve again within seconds. The custom text is discarded with no history, so keep a copy if you might want it back.
Keep going
llms.txt and agents.md with other agents
More OpenCode guides