Self-hosting an AI agent environment with OpenCode and shared memory A developer documented a self-hosted AI agent environment built on OpenCode with a shared memory layout stored in Dropbox, using a global AGENTS.md (and CLAUDE.md for Claude Code) to make multiple harnesses read and update the same notes across machines. The setup requires manual confirmation for every memory write to limit sync conflicts and token spend, and the author reports it covered roughly 80% of local cross-machine work. The author rejected existing open-source agent platforms such as OpenClaw, Agent Zero and Hermes Agent to keep control of the security model — what agents can access, where they execute commands, and which actions need approval. I planned this article on my phone during a train ride to Milan. Back home, I typed one word and it went live. Here's the setup behind it, starting with a little context. Today's frontier models are widely available through APIs, and a common way to use them is through a harness on your own computer, such as Claude Code or OpenCode. The harness lets an AI agent interact with local files, make changes and produce output. An individual model invocation is stateless: to build on a previous discussion, it needs the relevant context made available to it. The harness or provider's API manages that context, which can include conversation history, summaries and selected information. Many agent systems also use persistent memory: usually notes on important facts and decisions that carry across conversations and projects. Shared memory first That idea intrigued me. My own setup is spread thin: subscriptions with several providers, chats on the web, local sessions on different machines, and project work scattered across all of them. The first problem was consolidating memory across machines and harnesses. I defined a few basic rules for a memory layout in a shared folder Dropbox in my case, but Google Drive would work just as well . Each harness is instructed to read and update the relevant notes via a custom instruction in a global AGENTS.md , with the equivalent in CLAUDE.md for Claude Code. The layout itself is simple: ~/dropbox/memory/ ├── MEMORY.md rules, conventions, links to notes ├──