graymatter AGENTS.md

graymatter AGENTS.md is an instructions file for Codex, OpenCode from angelnicolasc/graymatter. It costs 1,001 tokens per session, scanned A, original, MIT.

Repository instructions for an AI-agent memory system. The system stores facts, user preferences, and saved work checkpoints so an agent can use them in later sessions.

In plain words
What is it for?
Searching stored memories before answering, recording new facts, reflecting on memory changes, and saving or restoring an agent's work state.
Why use it?
It helps the agent recover relevant past context instead of relying only on the current conversation. It also defines which memory action to use for searching, saving, updating, or resuming information.

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/angelnicolasc/graymatter/agents-md
Clone the repo
git clone --depth 1 https://github.com/angelnicolasc/graymatter

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

README.md
[![agentmods](https://agentmods.dev/badge/instructions/angelnicolasc/graymatter/agents-md.svg)](https://agentmods.dev/instructions/angelnicolasc/graymatter/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/angelnicolasc/graymatter/agents-md"><img src="https://agentmods.dev/badge/instructions/angelnicolasc/graymatter/agents-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 1,001 This file is loaded in full into every session.
When invoked 1,001 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.01001 $0.01001
Opus 5 $0.00500 $0.00500
Sonnet 5 $0.00200 $0.00200
Haiku 4.5 $0.00100 $0.00100

Measured 4d ago against content hash c90d6f6b638a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

graymatter 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 4d 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 · 73 lines

How it starts

The opening of the file, as written. The whole thing — 73 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AGENTS.md

If you're an AI agent (Claude Code, OpenCode, Codex, Cursor, Antigravity, custom MCP client) operating in this repo, read this first. Full operational manual: docs/AGENTS.md.

This repo is a memory system for AI agents. While you work here, you also get to use it: it's wired into your MCP toolbelt as five tools that persist facts and checkpoints across sessions.

Your tools

Tool Required params Optional
memory_search agent_id, query top_k (default 8)
memory_add agent_id, text
memory_reflect action (add|update|forget|link), agent text, target (which one is required depends on action — for forget, either works)
checkpoint_save agent_id state (JSON-encoded string)
checkpoint_resume agent_id

memory_reflect uses agent_id (canonical since ADR-014). The other four also use agent_id. The deprecated alias agent is still accepted for compatibility; agent_id wins when both are set.

When to call which

  • Before answering any question that depends on prior context → memory_search first.
  • After learning a user preference, project convention, or making a non-obvious decision → memory_add.
  • When the user corrects you or a fact becomes stale → memory_reflect with action="update" and target=<old fact text>.
  • At the start of a session that may resume a long task → checkpoint_resume. Before stopping mid-task → checkpoint_save.

First call

The very first thing to do when you open a session is pull what you already know:

{ "tool": "memory_search", "args": {
    "agent_id": "<project>-<your-role>",
    "query":    "<the task the user just asked you to do>",
    "top_k":    8
}}

Inject the returned facts into your working context before composing your reply.

Identity

Pick a stable agent_id of the form <project>-<role> (e.g. graymatter-backend, okuna-frontend). Don't invent a new ID per session — that defeats persistence.

Read the full file on GitHub · 73 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. 4d ago First seen · 73 lines · 1,001 tokens per session scan A c90d6f6b638a

Subscribe to this mod's changes

graymatter AGENTS.md is an instructions file published in the GitHub repository angelnicolasc/graymatter (464 stars, last pushed yesterday), licensed MIT. It adds 1,001 tokens to every session, about $0.0050 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.