ctxmem: Instructions file for Codex

AGENTS.md

ctxmem AGENTS.md is an instructions file for Codex, OpenCode from DoppiaG93/ctxmem. It costs 844 tokens per session, scanned A, original, MIT.

Repository instructions for a project that keeps decisions and code context in a shared, committed memory record.

In plain words
What is it for?
Use them on every request in the ctxmem project to recall relevant records, compare them with the code, and save updated context.
Why use it?
They make the agent check existing project knowledge first and correct it when the current code shows that it is outdated.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md.

This is DoppiaG93/ctxmem's own configuration. It tells Codex and OpenCode how to work on ctxmem 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 ctxmem configures →

Reuse

Borrowing it

Nothing to install: this file belongs to DoppiaG93/ctxmem. 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/DoppiaG93/ctxmem/develop/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/DoppiaG93/ctxmem

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 ctxmem AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/doppiag93/ctxmem/agents-md/github.svg)](https://agentmods.dev/instructions/doppiag93/ctxmem/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/doppiag93/ctxmem/agents-md"><img src="https://agentmods.dev/badge/instructions/doppiag93/ctxmem/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 ctxmem AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/doppiag93/ctxmem/agents-md"><img src="https://agentmods.dev/badge/instructions/doppiag93/ctxmem/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 844 This file is loaded in full into every session.
When invoked 844 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.00844 $0.00844
Opus 5.5 $0.00338 $0.00338
Sonnet 5.5 $0.00169 $0.00169
Haiku 4.5 $0.00084 $0.00084

Measured 1mo ago against content hash 4674507af3a5, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

ctxmem 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 1mo 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 · 78 lines

What it actually says

Project memory

This repo has a ctxmem memory: a shared, git-committed record of decisions and code context. Treat it as your first source of truth and keep it correct. Follow this loop on EVERY request, without being asked.

1. Recall first — before answering. Before you respond to a question or start a task, query the memory to check whether the answer is already known:

ctxmem ask "<the user's question or task, in a few words>"

ask prints a verdict: HIT (memory has an answer — base your reply on the listed records), WEAK (only related code/superseded notes — verify), or MISS (nothing — answer fresh, then remember it). Do this even for questions you think you can answer from your own context.

When assembling context for implementation or a handoff, use a bounded payload:

ctxmem context "<task or question>" --budget 2000

Choose the budget to fit the task and available context; 2000 is an example, not a mandatory limit. This complements the initial ask verdict. Avoid loading both outputs again when the first already provides enough context. context balances relevance, memory authority, freshness, and token cost; superseded records are excluded and sources plus STALE warnings are retained. Oversized blocks are skipped, not truncated; empty output does not prove the memory has no answer. Refine the query, increase the budget, add --explain, or use recall to inspect omitted context when needed. Only stdout is the payload; stderr reports the count and method. The budget covers payload text only (cl100k_base tokens when available, otherwise conservative UTF-8 bytes), not surrounding prompts or arbitrary model tokenizers.

2. Reconcile — decide who is right. If what the memory says conflicts with your own context or with the current code, do not silently pick one. Verify against the actual code in the repo:

  • If the code/reality proves the memory is outdated, correct the memory (step 3) and tell the user what changed.
  • If the memory is right and your context was stale, trust the memory.

Records shown with ⚠ SUPERSEDED are already outdated — use the newer one. Records shown with ⚠ STALE or WARNING: STALE reference files that changed, are missing, or cannot be verified. Check the code and supersede the memory if it is wrong; a changed file alone does not prove the decision is obsolete.

3. Remember — persist every decision and correction. When you make or confirm an important decision, save it:

ctxmem remember --type decision --title "Short title" "Detailed decision text"

When you find that an existing memory is wrong or obsolete, replace it instead of just adding a new one (this demotes and flags the old record in recall):

ctxmem remember --type decision --title "Corrected title" \
  --supersedes <old-memory-id> "What is now true and why it changed"

Each remember prints the new record's id; use it as the --supersedes target later. After changing code, run ctxmem sync to rebuild the index.

If your agent supports the MCP protocol instead of running shell commands, use the MCP tools ask(...), recall(...), and remember(..., supersedes="<id>") the same way. For budgeted context use context(query="<task>", budget=2000); consume its text field as the payload and inspect the separate selection/count metadata. The budget excludes the MCP envelope and metadata.

Managed by ctxmem 2.0.1 — run ctxmem update-instructions after upgrading.

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. 1mo ago Changed · +1 lines · +14 tokens per session 4674507af3a5
  2. 1mo ago Changed · +21 lines · +264 tokens per session 69a8ca700641
  3. 2mo ago First seen · 56 lines · 566 tokens per session scan A 3cfb6881dc3d

Subscribe to this mod's changes

ctxmem AGENTS.md is an instructions file published in the GitHub repository DoppiaG93/ctxmem (3 stars, last pushed yesterday), licensed MIT. It adds 844 tokens to every session, about $0.0034 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-31.

Related

ctxmem AGENTS.md compared with instructions from other repositories

ctxmem AGENTS.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
ctxmem AGENTS.mdDoppiaG93/ctxmemInstructions file3yesterdayMITA844Codex, OpenCode
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143kyesterdayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149kyesterdayMITA4,680Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA5,516GitHub Copilot
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA3,093GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file274k2d agoMITA4,313Codex, OpenCode