ctxmem AGENTS.md

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

Install

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.

agentmods
npx agentmods add instructions/doppiag93/ctxmem/agents-md
Clone the repo
git clone --depth 1 https://github.com/DoppiaG93/ctxmem

Made for: Codex, OpenCode.

Per session 566 This file is loaded in full into every session.
When invoked 566 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
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 $0.00566 $0.00566
Opus 5 $0.00283 $0.00283
Sonnet 5 $0.00113 $0.00113
Haiku 4.5 $0.00057 $0.00057

Measured 2d ago against content hash 3cfb6881dc3d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 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.

AGENTS.md · 56 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.

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 point at code that no longer exists — verify against the repo and supersede them if they are wrong.

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 recall(...) and remember(..., supersedes="<id>") the same way.

Managed by ctxmem 1.4.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. 2d 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 26d ago), licensed MIT. It adds 566 tokens to every session, about $0.0028 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-31.