Borrowing it
Nothing to install: this file belongs to kuitos/opencode-claude-memory. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/kuitos/opencode-claude-memory/main/AGENTS.mdgit clone --depth 1 https://github.com/kuitos/opencode-claude-memoryWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/kuitos/opencode-claude-memory/agents-md)<a href="https://agentmods.dev/instructions/kuitos/opencode-claude-memory/agents-md"><img src="https://agentmods.dev/badge/instructions/kuitos/opencode-claude-memory/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/instructions/kuitos/opencode-claude-memory/agents-md"><img src="https://agentmods.dev/badge/instructions/kuitos/opencode-claude-memory/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.05359 | $0.05359 |
| Opus 5.5 | $0.02144 | $0.02144 |
| Sonnet 5.5 | $0.01072 | $0.01072 |
| Haiku 4.5 | $0.00536 | $0.00536 |
Grade A, and why
opencode-claude-memory AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 18d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 189 lines — stays where its author put it; the contents beside it link to each section on GitHub.
AGENTS.md
OpenCode plugin that replicates Claude Code's persistent memory system. TypeScript on Bun; published to npm as compiled dist/ via semantic-release. One package serves both plugin APIs: OpenCode ≥ 1.18.29 (V1 server entry; the dual { id, server, setup } default export needs 1.18.29) and OpenCode 2.x (@opencode/cli, V2 setup entry, tested on 2.0.22).
Structure
src/
├── index.ts # Dual entry: default export { id, server, setup } (V1 server = createMemoryPlugin, V2 setup = createV2Setup)
├── config.ts # PluginOptions zod schema (strict) + CLAUDE_CONFIG_DIR → MemoryConfig; fixed agent names
├── agents.ts # Host-independent hidden agent defaults (memoryAgentDefaults: prompt/steps/allowedTools), MEMORY_TOOL_NAMES
├── tools.ts # MemoryToolSpec[] for memory_save / delete / list / search / read (zod/v4 args), wrapped per host; results carry their own titles
├── host/
│ ├── types.ts # MemoryHost interface (readTranscript / listSessions / runFork / generate), TranscriptMessage, SDK_READ_TIMEOUT_MS
│ ├── generate.ts # buildGeneratePrompt: a generate request as text, schema in the prompt (V2 always, V1 after a StructuredOutputError)
│ ├── v1/ # OpenCode 1.18.29+ (`server` entry, @opencode-ai/plugin)
│ │ ├── plugin.ts # createMemoryPlugin: parseConfig → MemoryStore → V1 host → coordinators → Hooks
│ │ ├── sdk.ts # Type aliases derived from @opencode-ai/plugin (client, events, messages) + unwrapData
│ │ ├── host.ts # createV1Host: MemoryHost over the V1 client (deadlines, directory query, tool sandbox)
│ │ ├── fork.ts # runForkSession: create → prompt(timeout) → abort-on-timeout → delete
│ │ ├── agents.ts # AgentRegistry / buildAgentDefaults: defaults merged under user `agent.<name>` in the `config` hook
│ │ ├── coordinators.ts # V1RecallCoordinator / V1ExtractionCoordinator: V1 event + message translation
│ │ ├── messages.ts # getLastUserQuery / buildTurnID / extractRecentTools / surfaced-memory keys (V1 messages)
│ │ ├── ignore.ts # ignore / resume over V1 messages, stripAutoMemoryParts (by marker)
│ │ ├── selector.ts # V1 selector wrappers (child session, structured output)
│ │ ├── tools.ts # MemoryToolSpec → Hooks["tool"]
│ │ └── log.ts # createLogger: client.app.log wrapper
│ └── v2/ # OpenCode 2.x (`setup` entry, @opencode/plugin)
│ ├── plugin.ts # createV2Setup: tools (codemode: false), agent.transform, hooks, event loop, cleanup
│ ├── agents.ts # Permission-rule sandbox [*:*:deny, memory_x:*:allow, ...user rules]; host baseline stripped; permissions probe; forkSessionRules
│ ├── host.ts # V2Host: MemoryHost over ctx.session / generate.text / agent lookup
│ ├── fork.ts # runV2Fork: create → prompt → wait → context → remove; interrupt on timeout
│ ├── events.ts # V2SessionEvents (location filtering, busy/idle) + consumeEvents (resubscribe)
│ ├── transcript.ts # V2 messages → TranscriptMessage
│ └── log.ts # File logger <stateDir>/opencode-memory.log, rotated at LOG_MAX_BYTES
├── store/
│ ├── frontmatter.ts # THE memory file format: MEMORY_TYPES, parseFrontmatter (30-line limit), buildFrontmatter
│ ├── paths.ts # Pure: validateMemoryFileName (sub-paths), sanitizePath, findCanonicalGitRoot, resolveMemoryRoot
│ ├── scan.ts # THE scanner: MemoryHeader/MemoryEntry, defaults decided once, manifest, surfaceKey
│ ├── indexFile.ts # MEMORY.md minimal line-level upsert/remove + truncateEntrypoint
│ └── MemoryStore.ts # Resolves paths once; list/read/save/delete/search/scan/readIndex; stateDir
├── prompt/
│ ├── sections.ts # Claude Code prompt text ports (memoryTypes.ts / memdir.ts)
│ └── systemPrompt.ts # buildMemorySystemPrompt(store, recalled, opts); AUTO_MEMORY_MARKER
├── recall/
│ ├── selector.ts # Host-independent LLM selection: prompt, schema, parseSelectedMemories
│ ├── turn.ts # Ignore / resume phrase rules + surfaced-key parsing
│ ├── format.ts # recallSelectedMemories / formatRecalledMemories / truncation / age warning
│ └── RecallCoordinator.ts # Per-session turn state, prefetch with bounded wait, session-scoped ignore, TTL eviction
├── extraction/
│ ├── prompts.ts # EXTRACT_PROMPT / AUTODREAM_PROMPT (only copies)
│ ├── state.ts # extraction-state.json (watermarks, autodream gate), atomic writes, v1 lock migration, posixCksum
│ ├── lock.ts # Cross-process maintenance lock: token ownership, heartbeat, reap-lock guarded stale recovery
│ ├── autodream.ts # Gate + consolidation fork
│ └── ExtractionCoordinator.ts # Idle debounce → serial queue → incremental fork via MemoryHost; start-up catch-up; recordSave
└── util/
├── log.ts # Host-independent Logger type, LOG_SERVICE, getErrorMessage
├── ownedSessions.ts # Plugin-owned child sessions with grace-period release
├── exclusiveFile.ts # Atomic create-if-absent (tmp + hard link) and the short cross-process file lock
├── timeout.ts # withDeadline() (bounded SDK calls with an AbortSignal) / withTimeout() (no signal, V2)
└── legacyShellHook.ts # Read-only detection of v1's shell hook in rc files
test/
├── helpers/index.ts # temp dirs, makeStore/makeConfig/makePlugin (env + home injected), mock clients, message builders
├── helpers/processWorker.ts # real worker processes for the cross-process state/lock tests
├── helpers/v2ctx.ts # scriptable mock of the V2 plugin context (setup(ctx)); records every host call
├── v2/ # V2 entry tests (setup, tools, agent transform, hooks, events, forks)
├── *.test.ts, store/, recall/, extraction/ # unit + plugin-level tests (bun test)
└── evals/ # task evals: memory-on vs memory-off system prompts (see test/evals/README.md)
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 18d ago Changed · +3 lines · +254 tokens per session 600c6eb6d6f2
- 20d ago Changed · +3 lines · +591 tokens per session 8d2467533a20
- 22d ago Changed · +54 lines · +1,997 tokens per session 82c1ae229eb1
- 27d ago Changed · +36 tokens per session 3a93e78c5aed
- 1mo ago Changed · +1 lines · +60 tokens per session 15467026d489
- 1mo ago Changed · +1 lines · +708 tokens per session 2f234cfef4e4
- 1mo ago First seen · 127 lines · 1,713 tokens per session scan A e4673923ad01
opencode-claude-memory AGENTS.md is an instructions file published in the GitHub repository kuitos/opencode-claude-memory (76 stars, last pushed 18d ago), licensed MIT. It adds 5,359 tokens to every session, about $0.0214 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other instructions, from other repositories
vscode buildNext.instructions.md
Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).
next.js AGENTS.md
AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.
vscode oss-third-party-notices.instructions.md
Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, cache eligibility and rollout and applying the notice (cutover).
langchain AGENTS.md
AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.
vscode copilot-instructions.md
Copilot instructions for microsoft/vscode, covering vs code copilot instructions, project overview, root folders, core architecture (src/ folder) and built-in extensions (extensions/ folder).
vscode model-prompts.instructions.md
Model-specific prompt authoring and registry guidelines.