Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk3 min

Giving an OpenCode Coding Agent Persistent, Editable Memory

OpenCode's persistent memory is files you maintain: AGENTS.md, the instructions option, skills and custom agents. Here is when to use each.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

OpenCode’s persistent “memory” is a set of files you write and maintain. Put project guidance in an AGENTS.md file in the repository. Put personal, cross-project guidance in ~/.config/opencode/AGENTS.md. Use the instructions config option to pull in other files. The official docs don’t describe an automatic system that recalls every past conversation, so the setup is editable and predictable but not self-updating. Details below follow the OpenCode Rules documentation.

What “memory” means in OpenCode

The documented mechanisms are persistent instructions and reusable configuration. You decide what goes in, you edit it like any text file, and you can review it in version control. The sources I relied on do not establish automatic recall of prior chat history. If you want OpenCode to “remember” something, write it down in one of the files below.

Choosing the right mechanism

Need Best fit Why
Conventions for one repository Project AGENTS.md Documented as project guidance; the docs recommend committing it so teammates benefit (Rules).
Personal conventions across projects Global ~/.config/opencode/AGENTS.md Documented global instruction file (Rules).
Reuse existing guides or matching files instructions in OpenCode config Accepts paths and glob patterns; combined with AGENTS.md files (Instructions).
Procedure needed only for relevant tasks Skill with SKILL.md Discovered and loaded on demand (Skills).
Named specialist with its own prompt or model Custom agent Defined as Markdown files or config entries (Agents).
Custom tools, hooks, integrations Plugin Advanced option; not needed for persistent instructions (Config).

Setting it up

1. Decide the scope

Ask whether the guidance is about you or about the repository. Personal habits, such as how terse you want answers, belong in the global file. Build commands, layout and team conventions belong in the project file.

2. Write durable, concise guidance

Include what a future session needs and could not easily infer:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Commands for building, testing and linting.
  • Architecture facts that are not obvious from the code.
  • Conventions and style rules.
  • Operational gotchas, such as steps that must run in a certain order.

Skip anything the agent can read straight from the code. Short, specific entries are easier to keep accurate.

3. Commit shared guidance

Commit the project AGENTS.md so teammates get the same instructions, as the Rules page recommends. Keep personal preferences in the global file so they don’t leak into the repository.

4. Include existing files with instructions

If you already have a contribution guide or style guide, reference it in your OpenCode config through the instructions option rather than copying it. You can use file paths or glob patterns, and the files are combined with AGENTS.md content. OpenCode also documents remote instruction URLs, fetched with a timeout. Only rely on remote material you trust and that someone maintains, because changes upstream change your agent’s behavior.

5. Move situational procedures into skills

If a behavior is only relevant to certain tasks, such as a release checklist, store it as a SKILL.md in a supported project or global skills directory. OpenCode discovers skills natively and loads them on demand, which keeps your always-on instructions short. See the Skills page for the exact locations.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

6. Add a custom agent when you need a specialist

When you want a named profile with its own prompt, and possibly a model preference, define an agent as a Markdown file or config entry. See Agents.

Keeping it maintainable

  • Compare the mechanisms on four axes: scope (global or repository), loading (always-on instructions or on-demand skills), reuse (shared conventions or a named agent), and maintenance (one file or references to existing ones).
  • Update the file when the agent gets something wrong twice. A correction written into the file persists, and a correction given in chat does not.
  • Review changes to AGENTS.md in pull requests like any other code.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

A caveat on discovery order

The Rules and Instructions pages differ in some details and appear to reflect different documentation versions. This article does not claim one universal discovery or precedence order. Check the current Rules page for the version you run.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.