opencode-claude-memory: Instructions file for Codex

AGENTS.md

opencode-claude-memory AGENTS.md is an instructions file for Codex, OpenCode from kuitos/opencode-claude-memory. It costs 5,359 tokens per session, scanned A, original, MIT.

Project instructions for an OpenCode plugin that stores and recalls persistent memory across coding sessions. OpenCode is a tool for working with code through an AI agent.

In plain words
What is it for?
Use them when developing or maintaining the plugin’s memory tools, file scanning, prompts, paths, and integration tests.
Why use it?
They explain the plugin’s structure and rules so changes do not break how memories are saved, searched, recalled, or removed.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: mentions Claude Code; mentions AGENTS.md; mentions OpenCode.

This is kuitos/opencode-claude-memory's own configuration. It tells Codex and OpenCode how to work on opencode-claude-memory itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything opencode-claude-memory configures →

Reuse

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.

Copy the file
curl -O https://raw.githubusercontent.com/kuitos/opencode-claude-memory/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/kuitos/opencode-claude-memory

Made for: Codex, OpenCode.

Wrote 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.

agentmods badge for opencode-claude-memory AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/kuitos/opencode-claude-memory/agents-md/github.svg)](https://agentmods.dev/instructions/kuitos/opencode-claude-memory/agents-md)
Your own site
<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.

agentmods 80×15 button for opencode-claude-memory AGENTS.md

Your own site · 80×15
<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>
Per session 5,359 This file is loaded in full into every session.
When invoked 5,359 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce 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

Measured 18d ago against content hash 600c6eb6d6f2, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

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.

AGENTS.md · 189 lines

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)

Read the full file on GitHub · 189 lines

Changes

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.

  1. 18d ago Changed · +3 lines · +254 tokens per session 600c6eb6d6f2
  2. 20d ago Changed · +3 lines · +591 tokens per session 8d2467533a20
  3. 22d ago Changed · +54 lines · +1,997 tokens per session 82c1ae229eb1
  4. 27d ago Changed · +36 tokens per session 3a93e78c5aed
  5. 1mo ago Changed · +1 lines · +60 tokens per session 15467026d489
  6. 1mo ago Changed · +1 lines · +708 tokens per session 2f234cfef4e4
  7. 1mo ago First seen · 127 lines · 1,713 tokens per session scan A e4673923ad01

Subscribe to this mod's changes

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.

Related

Other instructions, from other repositories