distributed-ai-memory-system: Instructions file for Claude Code

CLAUDE.md

distributed-ai-memory-system CLAUDE.md is an instructions file for Claude Code from mahmoud-bebars/distributed-ai-memory-system. It costs 7,078 tokens per session, scanned A, original, MIT.

A set of instructions for Claude Code when working in the distributed-ai-memory-system repository, covering its project rules, data model, and MCP and OAuth conventions.

In plain words
What is it for?
Use it to guide Claude Code while changing that repository and to keep implementations consistent with its data and authentication rules.
Why use it?
It gives the coding assistant repository-specific constraints, including areas that are intentionally not built.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: mentions Claude Code.

This is mahmoud-bebars/distributed-ai-memory-system's own configuration. It tells Claude Code how to work on distributed-ai-memory-system 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 distributed-ai-memory-system configures →

Reuse

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.

Copy the file
curl -O https://raw.githubusercontent.com/mahmoud-bebars/distributed-ai-memory-system/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/mahmoud-bebars/distributed-ai-memory-system

Made for: Claude Code.

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 distributed-ai-memory-system CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/mahmoud-bebars/distributed-ai-memory-system/claude-md/github.svg)](https://agentmods.dev/instructions/mahmoud-bebars/distributed-ai-memory-system/claude-md)
Your own site
<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.

agentmods 80×15 button for distributed-ai-memory-system CLAUDE.md

Your own site · 80×15
<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>
Per session 7,078 This file is loaded in full into every session.
When invoked 7,078 The same file — it is already loaded in full.
Security scan A 1 finding. 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.07078 $0.07078
Opus 5.5 $0.02831 $0.02831
Sonnet 5.5 $0.01416 $0.01416
Haiku 4.5 $0.00708 $0.00708

Measured 6d ago against content hash 8e29c390b065, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

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.
CLAUDE.md · 444 lines

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 any in TypeScript — if a type is genuinely unknown, use unknown and 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/Env type lives in server/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.jsonl is 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 type of entity, relation, or observation. The frontend graph (client/src/components/MemoryGraph.tsx) assumes entity entries carry a name and relation entries carry source/target matching 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 memoryEntrySchema in server/src/modules/projects/schema.ts — enforcing them strictly would reject entries written before the convention existed):
    • entity: { name, category? }. category is one of entityCategorySchema'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? }. text is the plain-language note; entity optionally names which entity (by name) it's about — absent means a general project note, not an error. Entries that predate this shape (no text string) 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 and read_memory still return all of them — never filtered), but any reader building a "current" view (the frontend graph/entries table, update_entity) should dedupe by content.name and keep the last occurrence in file order. The canonical implementation is currentEntities(), duplicated in server/src/modules/projects/service.ts (backend) and client/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 still append_memory's job.

Read the full file on GitHub · 444 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. 6d ago Changed · +6 lines · +114 tokens per session 8e29c390b065
  2. 1mo ago Changed · +185 lines · +3,006 tokens per session 79317dcc094c
  3. 1mo ago Changed · +41 lines · +742 tokens per session d51c12c63a9f
  4. 1mo ago Changed · +80 lines · +1,325 tokens per session b2daad4bb5e5
  5. 2mo ago Changed · +51 lines · +820 tokens per session 9203aec41636
  6. 2mo ago First seen · 81 lines · 1,071 tokens per session scan A 756bfd18b0a1

Subscribe to this mod's changes

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.

Related

distributed-ai-memory-system CLAUDE.md compared with instructions from other repositories

distributed-ai-memory-system CLAUDE.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
distributed-ai-memory-system CLAUDE.mdmahmoud-bebars/distributed-ai-memory-systemInstructions file1yesterdayMITA7,078Claude Code
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