Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add instructions/kuitos/opencode-claude-memory/agents-mdgit clone --depth 1 https://github.com/kuitos/opencode-claude-memoryWhat 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 | $0.01713 | $0.01713 |
| Opus 5 | $0.00856 | $0.00856 |
| Sonnet 5 | $0.00343 | $0.00343 |
| Haiku 4.5 | $0.00171 | $0.00171 |
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 2d 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 — 127 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, consumed as raw .ts by OpenCode (no build step). Published to npm via semantic-release.
Structure
.
├── bin/opencode-memory # Bash wrapper: shell hook install + post-session extraction + auto-dream consolidation
├── src/
│ ├── index.ts # Plugin entry: MemoryPlugin export, 5 tools + system prompt hook
│ ├── memory.ts # CRUD: save/delete/list/search/read + MEMORY.md index management + truncateEntrypoint
│ ├── memoryScan.ts # Recursive memory directory scanner: MemoryHeader[], frontmatter parsing, manifest formatting
│ ├── paths.ts # Path resolution + security: ~/.claude/projects/<hash>/memory/
│ ├── prompt.ts # System prompt builder: type instructions + index + recalled content (aligned with Claude Code memoryTypes.ts)
│ └── recall.ts # Smart recall: keyword scoring via scanMemoryFiles, mtime fallback, truncation, age warnings
├── test/
│ ├── integration.test.ts # End-to-end lifecycle: save→list→search→read→recall→delete
│ ├── memory.test.ts # Unit tests for memory.ts (truncateEntrypoint, CRUD, index)
│ ├── memoryScan.test.ts # Unit tests for memoryScan.ts (scan, frontmatter, manifest)
│ ├── prompt.test.ts # Unit tests for prompt.ts (buildMemorySystemPrompt)
│ ├── recall.test.ts # Unit tests for recall.ts (scoring, recall, formatting)
│ ├── opencode-memory.test.ts # Bash wrapper tests (TMPDIR normalization, log toggle)
│ └── github-actions-ci.test.ts # CI workflow smoke test
├── .releaserc # semantic-release config
└── tsconfig.json # moduleResolution: bundler, types: bun-types
Where to Look
| Task | File |
|---|---|
| Add/modify a memory tool | src/index.ts — tool definitions in tool: section |
| Change memory file format | src/memory.ts — parseFrontmatter(), buildFrontmatter() |
| Fix path resolution or worktree sharing | src/paths.ts — getMemoryDir(), findCanonicalGitRoot() |
| Modify what the agent sees about memory | src/prompt.ts — buildMemorySystemPrompt() |
| Change which memories are auto-recalled | src/recall.ts — recallRelevantMemories() |
| Scan memory directory / build manifest | src/memoryScan.ts — scanMemoryFiles(), formatMemoryManifest() |
| Fix post-session extraction | bin/opencode-memory — bash wrapper |
| Fix shell hook install/uninstall | bin/opencode-memory — install/uninstall subcommands |
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.
- 2d 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 (53 stars, last pushed 2d ago), licensed MIT. It adds 1,713 tokens to every session, about $0.0086 per session on Opus 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
agent-of-empires AGENTS.md
AGENTS.md instructions for agent-of-empires/agent-of-empires, covering repository guidelines, where to look, commands, code rules and tests.
opencode.nvim AGENTS.md
Instructions for nickjvandyke/opencode.nvim, covering opencode.nvim — agent guide, what it is, entrypoints, config quirks and dependencies.
opencode-ensemble AGENTS.md
AGENTS.md instructions for hueyexe/opencode-ensemble, covering opencode-ensemble — agent guidelines, what this is, design context, users and brand personality.
armada AGENTS.md
Instructions for rafmacalaba/armada, covering armada — build rules, the job, the team, repository conventions and adaptive delivery.
memex AGENTS.md
Instructions for iamtouchskyer/memex, covering memex — agent working instructions, what is this, before you touch anything, how the code is layered and files you'll actually need.
systematic AGENTS.md
Instructions for marcusrbrown/systematic, covering agents.md - coding agent guidelines for systematic, for architecture questions, commands, conventions and anti-patterns.