Borrowing it
Nothing to install: this file belongs to 20alexl/claude-engram. 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/20alexl/claude-engram/main/CLAUDE.mdgit clone --depth 1 https://github.com/20alexl/claude-engramWrote 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/20alexl/claude-engram/claude-md)<a href="https://agentmods.dev/instructions/20alexl/claude-engram/claude-md"><img src="https://agentmods.dev/badge/instructions/20alexl/claude-engram/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/20alexl/claude-engram/claude-md"><img src="https://agentmods.dev/badge/instructions/20alexl/claude-engram/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.04702 | $0.04702 |
| Opus 5 | $0.02351 | $0.02351 |
| Sonnet 5 | $0.00940 | $0.00940 |
| Haiku 4.5 | $0.00470 | $0.00470 |
Grade B, and why
claude-engram CLAUDE.md scanned grade B 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 9d 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.
Reads agent configuration directoriesmediumAgent snooping
.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.
- Hook installation merges into existing `~/.claude/settings.json` without destroying other hooks. How it starts
The opening of the file, as written. The whole thing — 251 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Claude Engram - Persistent Memory for Claude Code
How It Works
Claude Engram intercepts your tool calls via Claude Code hooks and automatically tracks what you do. Most features require zero invocations - they fire through hooks on every edit, bash command, error, and session event.
You also have MCP tools for things that need semantic judgment (saving discoveries, declaring rules, managing archives).
What's Fully Automatic
These happen via hooks. You don't call anything:
| What | When It Fires | What You See |
|---|---|---|
| Session restore | SessionStart hook | Rules, mistakes, checkpoint, handoff |
| Edit tracking | PostToolUse Edit/Write | "Edit tracked: file.py (edit #3)" |
| Loop warnings | PreToolUse Edit/Write | Warning when same file edited 3+ times (state lives in per-session hook state, so concurrent sessions don't cross-contaminate) |
| Scored memory injection | PreToolUse Edit/Write | Top 3 relevant memories for the file |
| Test tracking | PostToolUse Bash | "PASS/FAIL Test tracked" |
| Error auto-logging | PostToolUseFailure (all tools) | Mistakes auto-saved from any failed tool |
| Decision capture | UserPromptSubmit | "let's use X" parsed via semantic + regex scoring |
| Checkpoint on compact | PreCompact | Task state saved before context compaction |
| Context re-injection | PostCompact | Rules + mistakes + decisions re-injected |
| Session handoff on stop | Stop | Saves last_assistant_message + files for next session |
| Session summary on end | SessionEnd | Files edited, memory counts |
| Search spiral detection | PostToolUse Bash | Warns after 3+ failed search commands |
| Memory archiving | cleanup / session_start | Old inactive memories archived, not deleted |
| Sub-project scoping | PreToolUse / PostToolUse | Memories scoped to the right sub-project |
| Data migrations | SessionStart (upgrade) | Cheap inline check; full migration in background |
| Pre-edit import check | PreToolUse Edit/Write | <engram-precheck> when a proposed import won't resolve against the code index (closest-name suggestion) |
| Blast-radius alert | PreToolUse Edit/Write | <engram-blast-radius> listing modules that import the file being edited |
| Outcome feedback loop | PreToolUse + PostToolUse Bash | Injection kinds correlated with test pass/fail; surfaced via session_mine(reflect) |
| Schema canary | SessionStart | Warning when Claude Code's log format stops being recognized (mining would otherwise degrade silently) |
| Read context | PreToolUse Read | <engram-read-context>: code-index orientation + the file's most relevant memories, once per file per session |
| Error deja-vu | PostToolUseFailure | "Deja vu: TypeError hit in 3 past session(s) - fix: ..." when a fresh failure matches a mined recurring error or stored mistake (identifier-guarded, so an unrelated class never inherits someone else's fix) |
| Known-good test commands | SessionStart | The project's top tracked test commands that currently pass — verification starts from what worked, not a guess |
| Mistake hygiene | Background miner | Stale auto-captured one-off mistakes (3+ weeks, never recurred, away from current work) move to the archive — banners keep their signal; restorable via memory(restore) |
| Live mining tick | Stop (per turn, debounced) | Session index, extractions, search embeddings, and the active code indexes refresh DURING the session — session_mine(search) sees this session's earlier work, not just past sessions. Interval CLAUDE_ENGRAM_LIVE_MINE (default 300s) |
| Curated-lessons bridge | Background miner (opt-in) | Dated entries in lesson files sync as protected lesson memories with code-index-joined triggers — a lesson mentioning a module surfaces when editing files that import it. The file stays the source of truth (edits update, removals retire). Off unless lessons_globs is set in ~/.claude_engram/config.json (e.g. ["docs/lessons/*.md"]) — no default path |
| Project-scoped patterns | SessionStart | Recurring errors/struggles are attributed to sub-projects and filtered by what the last session touched — a vzip session no longer sees CORTEX errors. Errors unseen for 30 days drop out |
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.
- 9d ago First seen · 251 lines · 4,702 tokens per session scan B 3f0d27e4734b
claude-engram CLAUDE.md is an instructions file published in the GitHub repository 20alexl/claude-engram (16 stars, last pushed 12d ago), licensed MIT. It adds 4,702 tokens to every session, about $0.0235 per session on Opus 5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other instructions, from other repositories
repobrain copilot-instructions.md
Copilot instructions for study8677/repobrain, covering github copilot bootstrap instructions and hard rule — query the repobrain hub first.
next.js AGENTS.md
AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.
codex AGENTS.md
AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.
vscode buildNext.instructions.md
Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).
vscode oss-third-party-notices.instructions.md
Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).
langchain AGENTS.md
AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.