memesh AGENTS.md

Persistent shared memory instructions for AI coding agents, stored in one local database that all connected hosts can use.

In plain words
What is it for?
Use it to load project context at session start, record user-stated goals and blockers, and maintain clean shared memory.
Why use it?
It reduces repeated repository exploration between sessions. It also prevents future sessions from treating guessed goals, next steps, or blockers as facts.

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/pcircle-ai/memesh/agents-md
Clone the repo
git clone --depth 1 https://github.com/PCIRCLE-AI/memesh

Made for: Codex, OpenCode.

Per session 1,839 This file is loaded in full into every session.
When invoked 1,839 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.01839 $0.01839
Opus 5 $0.00920 $0.00920
Sonnet 5 $0.00368 $0.00368
Haiku 4.5 $0.00184 $0.00184

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

Security

Grade A, and why

memesh 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 · 132 lines

How it starts

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

Using MeMesh — for AI agents

MeMesh is persistent memory shared by every MCP host on this machine — one SQLite database at ~/.memesh/knowledge-graph.db. A memory stored from one host is recallable from all of them. Not installed yet? Follow llms-install.md.

The loop that pays for itself

  1. Session start — load, don't re-explore. Call the briefing tool once (CLI: memesh briefing). It returns the assembled work topology for the current project: goal / next / blocked / done, decisions, lessons, knowledge, recent activity. Read that instead of re-reading the repo to reconstruct context.
  2. When the user states a goal, a next step, or a blocker — record it. Call the task_state tool (CLI: memesh task --goal "…" --next "…"). It is injected at the start of the next session and acted on as fact.
    • An empty string clears a field: pass blocked: "" (CLI: memesh task --blocked "") once a blocker is resolved.
    • Record only what the user actually said. Never infer goal / next / done from files edited or commands run — a guessed value becomes a wrong instruction to a future session with nothing to contradict it. Leave a field out if it was not said.
  3. "What do you remember?" — call briefing and relay its content. Do not answer from your own conversation context.
  4. When you need another agent — to hand off, to ask, to report back — send a message before anything else. The host's own push tool (Claude Code's SendMessage, a Codex queue) delivers a wakeup; it is not the record, and it cannot reach an agent on a different host or one that is not running. briefing and SessionStart tell you when something is waiting for you: N messages waiting for "<project>" — fetch them.

All 11 MCP tools

Tool Purpose
remember Store knowledge as an entity with observations, tags, and relations
recall Search stored knowledge (words are OR-ed, ranked by relevance); empty query lists recent
forget Archive an entity (soft-delete), or remove one observation via the observation parameter
export Export memories as portable JSON for sharing or backup
import Import a JSON export; merge_strategy (required): skip / append / overwrite
learn Record a structured lesson: error, root cause, fix, prevention
task_state Read or update where the work stands: goal / next / blocked / done
briefing The assembled work topology for a project — call once at session start
user_patterns Analyze work schedule, tool preferences, and focus areas from memory
improvement Propose an evidence-linked product improvement or read its status; only a human may accept/reject it
message Contact another local agent — hand off work, ask for a result, report a disposition. Send here first: the durable inbox is the record, host push is only delivery. Polling/fetching never implies acknowledgement

Read the full file on GitHub · 132 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. 2d ago First seen · 132 lines · 1,839 tokens per session scan A aded262ace4b

Subscribe to this mod's changes

memesh AGENTS.md is an instructions file published in the GitHub repository PCIRCLE-AI/memesh (15 stars, last pushed yesterday), licensed MIT. It adds 1,839 tokens to every session, about $0.0092 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.

Related

Other instructions, from other repositories

agents-remember AGENTS.md

Instructions for Foxfire1st/agents-remember, covering agents remember source checkout instructions, start here — route by role, memory and onboarding, memory retrieval strategies and source layout.

Foxfire1st/agents-remember · 2,557 tokens

GoodMemory AGENTS.md

Instructions for hjqcan/GoodMemory, covering repository guidelines, project structure & module organization, build, test, and development commands, coding style & naming conventions and testing guidelines.

hjqcan/GoodMemory · 2,771 tokens

Agent-Memory-Bridge AGENTS.md

Instructions for zzhang82/Agent-Memory-Bridge, covering agent memory bridge contributor instructions, setup and checks, architecture boundaries, mutation and migration invariants and benchmark expectations.

zzhang82/Agent-Memory-Bridge · 1,089 tokens

infinity-context AGENTS.md

Instructions for 777genius/infinity-context, covering agents.md, project intent, source of truth and implementation rule.

777genius/infinity-context · 284 tokens

mainline copilot-instructions.md

Copilot instructions for mainline-org/mainline, covering mainline, read team intents for context (do this aggressively), write your own intent and if mainline hooks is installed for your agent.

mainline-org/mainline · 550 tokens

mainline CLAUDE.md

Claude Code instructions for mainline-org/mainline, covering mainline, read team intents for context (do this aggressively), write your own intent and if mainline hooks is installed for your agent.

mainline-org/mainline · 479 tokens