Borrowing it
Nothing to install: this file belongs to mahmoud-bebars/distributed-ai-memory-system. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/mahmoud-bebars/distributed-ai-memory-system/main/CLAUDE.mdgit clone --depth 1 https://github.com/mahmoud-bebars/distributed-ai-memory-systemWrote 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.
[](https://agentmods.dev/instructions/mahmoud-bebars/distributed-ai-memory-system/claude-md)<a href="https://agentmods.dev/instructions/mahmoud-bebars/distributed-ai-memory-system/claude-md"><img src="https://agentmods.dev/badge/instructions/mahmoud-bebars/distributed-ai-memory-system/claude-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.
<a href="https://agentmods.dev/instructions/mahmoud-bebars/distributed-ai-memory-system/claude-md"><img src="https://agentmods.dev/badge/instructions/mahmoud-bebars/distributed-ai-memory-system/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.07078 | $0.07078 |
| Opus 5.5 | $0.02831 | $0.02831 |
| Sonnet 5.5 | $0.01416 | $0.01416 |
| Haiku 4.5 | $0.00708 | $0.00708 |
Grade A, and why
distributed-ai-memory-system CLAUDE.md scanned grade A with 1 finding 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 6d 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.
Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
local `curl -H "Host: ..."` spoofing can't actually exercise this logic. How it starts
The opening of the file, as written. The whole thing — 444 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Instructions for Claude Code working in this repo
Repo layout
npm workspaces monorepo, two workspaces under one root package.json:
server/ (the Cloudflare Worker — Hono, D1, R2, MCP, token auth) and client/
(the Vite/React frontend, built into client/dist and served by the Worker
as static assets). Run npm install once from the repo root. Root-level
npm run <script> commands delegate to the right workspace — see
"Commands" below. wrangler.toml and its CLI (wrangler d1 ...,
wrangler secret put ...) live in and must run from server/.
wrangler.toml is git-ignored on purpose (only wrangler.toml.example is
tracked) so a fork of this repo can't accidentally deploy onto the
original account's D1 database or domain — server/scripts/render-wrangler-toml.sh
reconstructs a real one from the template at CI build time; see
docs/DEPLOY.md's "Continuous deployment" section. The template's
[ai]/[[vectorize]] bindings sit between # >>> semantic-search /
# <<< semantic-search markers so CI can strip them
(WRANGLER_DISABLE_SEMANTIC_SEARCH=1) — keep the markers when editing it.
Hard preferences (non-negotiable, apply repo-wide)
- npm only — never yarn or pnpm
- No Express, no Next.js
- No
anyin TypeScript — if a type is genuinely unknown, useunknownand narrow it - Zod validation at every route boundary — no unvalidated
c.req.json() - Every backend module follows the 4-file pattern:
schema.ts(Zod + types),service.ts(business logic, D1/R2 access),routes.ts(Hono handlers),index.ts(barrel export). Don't collapse these into one file even for small modules. - Shared
Bindings/Envtype lives inserver/src/lib/bindings.ts— modules import from there, they don't declare their own.
Data model rules
- R2 is the source of truth for memory content. D1 is an index/registry only — it should never hold data that isn't reconstructable from R2.
memory.jsonlis append-only. Never rewrite history in place; the sync model (local CLI ↔ R2) depends on this being true. If you need to "edit" an entry, append a new one and treat resolution as an application-level concern, not a storage-level overwrite.- Memory entries have a
typeofentity,relation, orobservation. The frontend graph (client/src/components/MemoryGraph.tsx) assumes entity entries carry anameand relation entries carrysource/targetmatching entity names — if you change entry shapes, update that assumption or the graph silently renders nothing. - Content shape conventions by type (documented, not Zod-enforced — see
memoryEntrySchemainserver/src/modules/projects/schema.ts— enforcing them strictly would reject entries written before the convention existed):entity:{ name, category? }.categoryis one ofentityCategorySchema's ten values; readers default to"other"(DEFAULT_ENTITY_CATEGORY) when it's absent. Old entities predate this field — that's expected, not a bug to backfill automatically.observation:{ text, entity? }.textis the plain-language note;entityoptionally names which entity (by name) it's about — absent means a general project note, not an error. Entries that predate this shape (notextstring) fall back to a JSON preview in the UI rather than breaking.relation:{ source, target, label? }— unchanged.
- Entities are last-write-wins, not append-once. An entity can be
appended again under the same
name; the append-only log keeps every revision (the raw R2 file andread_memorystill return all of them — never filtered), but any reader building a "current" view (the frontend graph/entries table,update_entity) should dedupe bycontent.nameand keep the last occurrence in file order. The canonical implementation iscurrentEntities(), duplicated inserver/src/modules/projects/service.ts(backend) andclient/src/lib/memory.ts(frontend, which doesn't build against the Worker's source tree) — keep both in sync if the rule changes. Relations and observations are never deduped; every one is part of the log. update_entity(MCP tool,server/src/modules/mcp) is how a category (or any other entity field) gets attached after the fact: it appends a new entity revision merging the given fields onto the entity's current content. It fails clearly if no entity with that name exists yet — creating one is stillappend_memory's job.
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.
- 6d ago Changed · +6 lines · +114 tokens per session 8e29c390b065
- 1mo ago Changed · +185 lines · +3,006 tokens per session 79317dcc094c
- 1mo ago Changed · +41 lines · +742 tokens per session d51c12c63a9f
- 1mo ago Changed · +80 lines · +1,325 tokens per session b2daad4bb5e5
- 2mo ago Changed · +51 lines · +820 tokens per session 9203aec41636
- 2mo ago First seen · 81 lines · 1,071 tokens per session scan A 756bfd18b0a1
distributed-ai-memory-system CLAUDE.md is an instructions file published in the GitHub repository mahmoud-bebars/distributed-ai-memory-system (1 stars, last pushed yesterday), licensed MIT. It adds 7,078 tokens to every session, about $0.0283 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
distributed-ai-memory-system CLAUDE.md compared with instructions from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| distributed-ai-memory-system CLAUDE.mdmahmoud-bebars/distributed-ai-memory-system | Instructions file | 1 | yesterday | MIT | A | 7,078 | Claude Code |
| vscode buildNext.instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 9,719 | GitHub Copilot |
| next.js AGENTS.mdvercel/next.js | Instructions file | 143k | yesterday | MIT | A | 7,461 | Codex, OpenCode |
| langchain AGENTS.mdlangchain-ai/langchain | Instructions file | 149k | yesterday | MIT | A | 4,680 | Codex, OpenCode |
| vscode oss-third-party-notices.instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 5,516 | GitHub Copilot |
| vscode copilot-instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 3,093 | GitHub Copilot |
| deepseek-harness AGENTS.mddeepseek-ai/deepseek-harness | Instructions file | 274k | 2d ago | MIT | A | 4,313 | Codex, OpenCode |